diff --git a/branches/SIPRP/.classpath b/branches/SIPRP/.classpath new file mode 100644 index 00000000..988de3b2 --- /dev/null +++ b/branches/SIPRP/.classpath @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/.project b/branches/SIPRP/.project new file mode 100644 index 00000000..200965fb --- /dev/null +++ b/branches/SIPRP/.project @@ -0,0 +1,17 @@ + + + SIPRP + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/build.xml b/branches/SIPRP/AnaliseAcidentesTrabalho/build.xml new file mode 100644 index 00000000..877e9124 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/build.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + Builds, tests, and runs the project AnaliseAcidentesTrabalho. + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/catalog.xml b/branches/SIPRP/AnaliseAcidentesTrabalho/catalog.xml new file mode 100644 index 00000000..e69de29b diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/jars/activation.jar b/branches/SIPRP/AnaliseAcidentesTrabalho/jars/activation.jar new file mode 100755 index 00000000..589b6749 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/jars/activation.jar differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/jars/mail.jar b/branches/SIPRP/AnaliseAcidentesTrabalho/jars/mail.jar new file mode 100755 index 00000000..e6f70832 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/jars/mail.jar differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/jars/postgresql-8.0-315.jdbc3.jar b/branches/SIPRP/AnaliseAcidentesTrabalho/jars/postgresql-8.0-315.jdbc3.jar new file mode 100755 index 00000000..777b3040 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/jars/postgresql-8.0-315.jdbc3.jar differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/jars/postgresql-8.1-407.jdbc3.jar b/branches/SIPRP/AnaliseAcidentesTrabalho/jars/postgresql-8.1-407.jdbc3.jar new file mode 100755 index 00000000..ddf17862 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/jars/postgresql-8.1-407.jdbc3.jar differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/jars/postgresql-8.2-506.jdbc4.jar b/branches/SIPRP/AnaliseAcidentesTrabalho/jars/postgresql-8.2-506.jdbc4.jar new file mode 100644 index 00000000..260a95eb Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/jars/postgresql-8.2-506.jdbc4.jar differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/lib/avalon-framework-4.2.0.jar b/branches/SIPRP/AnaliseAcidentesTrabalho/lib/avalon-framework-4.2.0.jar new file mode 100644 index 00000000..b1aa6d7c Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/lib/avalon-framework-4.2.0.jar differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/lib/batik.jar b/branches/SIPRP/AnaliseAcidentesTrabalho/lib/batik.jar new file mode 100644 index 00000000..28c8bac0 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/lib/batik.jar differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/lib/evolute.jar b/branches/SIPRP/AnaliseAcidentesTrabalho/lib/evolute.jar new file mode 100644 index 00000000..122596d7 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/lib/evolute.jar differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/lib/fop.jar b/branches/SIPRP/AnaliseAcidentesTrabalho/lib/fop.jar new file mode 100644 index 00000000..f7a3a2c7 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/lib/fop.jar differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/lib/iText-2.0.8.jar b/branches/SIPRP/AnaliseAcidentesTrabalho/lib/iText-2.0.8.jar new file mode 100644 index 00000000..aaf6296a Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/lib/iText-2.0.8.jar differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/lib/jai_imageio.jar b/branches/SIPRP/AnaliseAcidentesTrabalho/lib/jai_imageio.jar new file mode 100644 index 00000000..359551eb Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/lib/jai_imageio.jar differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/lib/jdom.jar b/branches/SIPRP/AnaliseAcidentesTrabalho/lib/jdom.jar new file mode 100644 index 00000000..288e64cb Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/lib/jdom.jar differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/ant-deploy.xml b/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/ant-deploy.xml new file mode 100644 index 00000000..a6f1480c --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/ant-deploy.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/build-impl.xml b/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/build-impl.xml new file mode 100644 index 00000000..06777b36 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/build-impl.xml @@ -0,0 +1,855 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + +The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) +or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at +<netbeans_installation>/java<version>/ant/extra folder. +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/faces-config.NavData b/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/faces-config.NavData new file mode 100644 index 00000000..0adbe3db --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/faces-config.NavData @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/genfiles.properties b/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/genfiles.properties new file mode 100644 index 00000000..814e6850 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=306dea99 +build.xml.script.CRC32=97b5d0ef +build.xml.stylesheet.CRC32=c0ebde35 +# 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=306dea99 +nbproject/build-impl.xml.script.CRC32=88678294 +nbproject/build-impl.xml.stylesheet.CRC32=174458fc diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/navigation.NavData b/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/navigation.NavData new file mode 100644 index 00000000..84ffcf95 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/navigation.NavData @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/project.properties b/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/project.properties new file mode 100644 index 00000000..00dcec9a --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/project.properties @@ -0,0 +1,103 @@ +build.classes.dir=${build.web.dir}/WEB-INF/classes +build.classes.excludes=**/*.java,**/*.form +build.dir=build +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} +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} +excludes= +file.reference.activation.jar=jars/activation.jar +file.reference.avalon-framework-4.2.0.jar=lib/avalon-framework-4.2.0.jar +file.reference.batik.jar=lib/batik.jar +file.reference.evolute.jar=lib/evolute.jar +file.reference.fop.jar=lib/fop.jar +file.reference.iText-2.0.8.jar=lib/iText-2.0.8.jar +file.reference.jdom.jar=lib/jdom.jar +file.reference.mail.jar=jars/mail.jar +file.reference.postgresql-8.2-506.jdbc4.jar=jars/postgresql-8.2-506.jdbc4.jar +includes=** +j2ee.platform=1.4 +j2ee.server.type=Tomcat60 +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}:\ + ${libs.rowset-ri.classpath}:\ + ${file.reference.iText-2.0.8.jar}:\ + ${file.reference.evolute.jar}:\ + ${file.reference.fop.jar}:\ + ${file.reference.jdom.jar}:\ + ${file.reference.avalon-framework-4.2.0.jar}:\ + ${file.reference.batik.jar} +# Space-separated list of extra javac options +javac.compilerargs= +javac.debug=true +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 +# Property libs.rowset-ri.classpath is set here just to make sharing of project simpler. +# The library definition has always preference over this property. +libs.rowset-ri.classpath=../../../../.netbeans/6.0/modules/ext/rowset-1.0.1.jar +persistence.xml.dir=${conf.dir} +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 +webinf.dir=web/WEB-INF diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/project.xml b/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/project.xml new file mode 100644 index 00000000..e9370564 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/nbproject/project.xml @@ -0,0 +1,113 @@ + + + org.netbeans.modules.web.project + + + + AnaliseAcidentesTrabalho + 1.6 + + + ${libs.jsf-designtime.classpath} + WEB-INF/lib + + + ${libs.jsfsupport-designtime.classpath} + WEB-INF/lib + + + ${libs.webui-designtime.classpath} + WEB-INF/lib + + + ${libs.jdbcsupport-designtime.classpath} + WEB-INF/lib + + + ${libs.theme-default.classpath} + WEB-INF/lib + + + ${libs.jstl11.classpath} + WEB-INF/lib + + + ${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.rowset-ri.classpath} + WEB-INF/lib + + + ${file.reference.iText-2.0.8.jar} + WEB-INF/lib + + + ${file.reference.evolute.jar} + WEB-INF/lib + + + ${file.reference.fop.jar} + WEB-INF/lib + + + ${file.reference.jdom.jar} + WEB-INF/lib + + + ${file.reference.avalon-framework-4.2.0.jar} + WEB-INF/lib + + + ${file.reference.batik.jar} + WEB-INF/lib + + + + + ${libs.jsf-runtime.classpath} + WEB-INF/lib + + + ${libs.jsfsupport-runtime.classpath} + WEB-INF/lib + + + ${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/branches/SIPRP/AnaliseAcidentesTrabalho/src/conf/MANIFEST.MF b/branches/SIPRP/AnaliseAcidentesTrabalho/src/conf/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/SIPRPNode.driver.xml b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/SIPRPNode.driver.xml new file mode 100644 index 00000000..9d60be44 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/SIPRPNode.driver.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Acesso.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Acesso.java new file mode 100644 index 00000000..74176c52 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Acesso.java @@ -0,0 +1,331 @@ +/* + * Acesso.java + * + * Created on Oct 15, 2008, 9:49:21 AM + */ + +package analiseacidentestrabalho; + +import com.sun.rave.web.ui.appbase.AbstractPageBean; +import com.sun.rave.web.ui.component.DropDown; +import com.sun.rave.web.ui.component.StaticText; +import db.AnalisesDataProvider; +import db.UtilizadoresDataProvider; +import global.Global; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.context.FacesContext; +import utils.JSFUtils; +import utils.Utils; + +/** + *

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.

+ * + * @author lluis + */ +public class Acesso extends AbstractPageBean { + // + + /** + *

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 StaticText stWelcome = new StaticText(); + + public StaticText getStWelcome() { + return stWelcome; + } + + public void setStWelcome(StaticText st) { + this.stWelcome = st; + } + private DropDown drpEstabelecimentos = new DropDown(); + + public DropDown getDrpEstabelecimentos() { + return drpEstabelecimentos; + } + + public void setDrpEstabelecimentos(DropDown dd) { + this.drpEstabelecimentos = dd; + } + private HtmlPanelGrid gridEstabelecimento = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridEstabelecimento() { + return gridEstabelecimento; + } + + public void setGridEstabelecimento(HtmlPanelGrid hpg) { + this.gridEstabelecimento = hpg; + } + + //
+ + /** + *

Construct a new Page bean instance.

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

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("Acesso 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() { + Utilizador u = getSessionBean1().getCurrentUser(); + //String nomeUnicode = Utils.textToUnicode(u.getNome()); + //System.out.println("NOME UNICODE : " + nomeUnicode); + String nomeHtml = Utils.unicodeToHTML( u.getNome() ); + stWelcome.setText("Bem vindo(a) " + nomeHtml); + + if(u.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR) + { + initializeEstabelecimentos(); + } + else + { + gridEstabelecimento.setRendered(false); + } + + } + + /** + *

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 lnkAnalisesAcidente_action() { + // TODO: Replace with your code + return null; + } + + public String lnkNewUser_action() { + // TODO: Replace with your code + return null; + } + + public String lnkEditUser_action() { + // TODO: Replace with your code + return null; + } + + public String lnkAjuda_action() { + // TODO: Replace with your code + return null; + } + + public String lnkLogout_action() { + // TODO: Replace with your code + FacesContext fc = getFacesContext(); + try + { + JSFUtils.logout(fc); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + return "login"; + } + + public String lnkAnalises_action() { + // TODO: Replace with your code + Utilizador u = getSessionBean1().getCurrentUser(); + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + try + { + Integer permissao = udp.getPermissionCode(u.getId()); + switch(permissao.intValue()) + { + case 1: //seguranca + return "form_seguranca"; + case 2: //rh + return "form_rh"; + case 3: //hs + return "form_hs"; + case 6: //gestor + Integer estabelecimento = null; + if(u.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR) + { + estabelecimento = (Integer) drpEstabelecimentos.getSelected(); + // if(estabelecimento.intValue() == -1) + // { + // getSessionBean1().setMsg("Falta estabelecimento!"); + // return null; + // } + // else + // { + // u.setEstabelecimento(estabelecimento_outro); + u.setEstabelecimento_gestor(estabelecimento); + } + return "form_gestor"; + case 7: //dir ger rh + return "form_dir_ger_rh"; + case 8: //dir_siprp + return "form_dir_siprp"; + default: + return "gestor"; + } + } + catch(Exception ex) + { + ex.printStackTrace(); + return "gestor"; + } + + + } + + public String lnkPlanos_action() { + // TODO: Replace with your code + + Utilizador u = getSessionBean1().getCurrentUser(); +// String curUser = "?user=" + u.getId().toString(); + FacesContext fc = getFacesContext().getCurrentInstance(); + + Integer estabelecimento = null; + if(u.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR) + { + estabelecimento = (Integer) drpEstabelecimentos.getSelected(); +// if(estabelecimento.intValue() == -1) +// { +// getSessionBean1().setMsg("Falta estabelecimento!"); +// return null; +// } +// else +// { +// u.setEstabelecimento(estabelecimento_outro); + u.setEstabelecimento_gestor(estabelecimento); + } + + + Global.redirectToPlanos(fc, u); + +// FacesContext fc = getFacesContext().getCurrentInstance(); +// Utilizador u = getSessionBean1().getCurrentUser(); +// String curUser = "?user=" + u.getId().toString(); +// try +// { +// JSFUtils.redirect(fc, Global.PLANOS_ACTUACAO_URL + curUser); +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } + + return null; + } + + private void initializeEstabelecimentos() + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + com.sun.rave.web.ui.model.Option[] listGestorOptions = adp.getEstabelecimentosGestorList( getSessionBean1().getCurrentUser().getEmpresa_id(), new Boolean(true)); + //listGestorOptions[0].setLabel("-Seleccionar-"); + + + getSessionBean1().setEstabelecimentosGestorOptions( listGestorOptions ); + drpEstabelecimentos.setSelected(new Integer(0)); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + +} + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Acidentado.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Acidentado.java new file mode 100644 index 00000000..503385c7 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Acidentado.java @@ -0,0 +1,186 @@ +/* + * Acidentado.java + * + * Created on October 16, 2007, 2:36 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class Acidentado { + private Integer id; + private String nome; + private java.sql.Date data_nascimento; + private String bilhete_identidade; + private String morada; + private String cod_postal; + private String localidade; + private String contacto_telefonico; + private java.sql.Date data_admissao; + private String funcao; + private String turno; + private Integer trabalhador_id; + private String numero_mecanografico; + private String nome_superior_hierarquico; + private String email_superior_hierarquico; + private String estabelecimento_origem; + private java.sql.Date data_email_superior_hierarquico; + /** Creates a new instance of Acidentado */ + public Acidentado() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public java.sql.Date getData_nascimento() { + return data_nascimento; + } + + public void setData_nascimento(java.sql.Date data_nascimento) { + this.data_nascimento = data_nascimento; + } + + public String getBilhete_identidade() { + return bilhete_identidade; + } + + public void setBilhete_identidade(String bilhete_identidade) { + this.bilhete_identidade = bilhete_identidade; + } + + public String getMorada() { + return morada; + } + + public void setMorada(String morada) { + this.morada = morada; + } + + public String getCod_postal() { + return cod_postal; + } + + public void setCod_postal(String cod_postal) { + this.cod_postal = cod_postal; + } + + public String getLocalidade() { + return localidade; + } + + public void setLocalidade(String localidade) { + this.localidade = localidade; + } + + public String getContacto_telefonico() { + return contacto_telefonico; + } + + public void setContacto_telefonico(String contacto_telefonico) { + this.contacto_telefonico = contacto_telefonico; + } + + public java.sql.Date getData_admissao() { + return data_admissao; + } + + public void setData_admissao(java.sql.Date data_admissao) { + this.data_admissao = data_admissao; + } + + public String getFuncao() { + return funcao; + } + + public void setFuncao(String funcao) { + this.funcao = funcao; + } + + public Integer getTrabalhador_id() { + return trabalhador_id; + } + + public void setTrabalhador_id(Integer trabalhador_id) { + this.trabalhador_id = trabalhador_id; + } + + public String getNome() { + return nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public String getTurno() { + return turno; + } + + public void setTurno(String turno) { + this.turno = turno; + } + + public String getNumero_mecanografico() { + return numero_mecanografico; + } + + public void setNumero_mecanografico(String numero_mecanografico) { + this.numero_mecanografico = numero_mecanografico; + } + + public String getNome_superior_hierarquico() { + if(nome_superior_hierarquico == null) + { + return ""; + } + return nome_superior_hierarquico; + } + + public void setNome_superior_hierarquico(String nome_superior_hierarquico) { + this.nome_superior_hierarquico = nome_superior_hierarquico; + } + + public String getEmail_superior_hierarquico() { + if(email_superior_hierarquico == null) + { + return ""; + } + return email_superior_hierarquico; + } + + public void setEmail_superior_hierarquico(String email_superior_hierarquico) { + this.email_superior_hierarquico = email_superior_hierarquico; + } + + public String getEstabelecimento_origem() { + if(estabelecimento_origem == null) + { + return ""; + } + return estabelecimento_origem; + } + + public void setEstabelecimento_origem(String estabelecimento_origem) { + this.estabelecimento_origem = estabelecimento_origem; + } + + public java.sql.Date getData_email_superior_hierarquico() { + return data_email_superior_hierarquico; + } + + public void setData_email_superior_hierarquico(java.sql.Date data_email_superior_hierarquico) { + this.data_email_superior_hierarquico = data_email_superior_hierarquico; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidente.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidente.java new file mode 100644 index 00000000..23fc1bb3 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidente.java @@ -0,0 +1,1050 @@ +/* + * 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; +import java.sql.Time; + +/** + * + * @author lluis + */ +public class AnaliseAcidente { + private Integer id; + private Integer nr; + private String analise_nr; + private Date data_acidente; + private Integer acidentado_id; + private String nome_acidentado; + private String numero_mecanografico; + private Integer empresa_id; + private Integer estabelecimento_id; + private String nome_estabelecimento; + private Integer estado; + private Integer estado_assinatura; + private String fase; + + private String morada; + private String telefone; + private Integer horas_turno; + private String seccao; + private Integer departamento_id; + private Integer seccao_id; + private String local_trabalho; + private String tarefa; + private String substancias; +// private String superior_hierarquico; + private String condicoes; + private String testemunhas; + private Integer causas; + private String descricao; + private String conclusoes; + private String accoes; + + private Time hora_acidente; + private String formacao_shst; + private String formacao_shst_nao_porque; + private String outros_acidentes_com_colaborador; + private Integer nr_acidentes_com_colaborador; + private Integer nr_relatorio_acidente_colaborador1; + private Integer nr_relatorio_acidente_colaborador2; + private Integer nr_relatorio_acidente_colaborador3; + private Integer nr_relatorio_acidente_colaborador4; + private String acidentes_outros_colaboradores; + private Integer nr_acidentes_outros_colaboradores; + private Integer nr_relatorio_acidente_outros_colaboradores1; + private Integer nr_relatorio_acidente_outros_colaboradores2; + private Integer nr_relatorio_acidente_outros_colaboradores3; + private Integer nr_relatorio_acidente_outros_colaboradores4; + + private String lesao_cabeca; + private String lesao_pescoco; + private String lesao_tronco; + private String lesao_membro_sup_dir; + private String lesao_membro_sup_esq; + private String lesao_membro_inf_dir; + private String lesao_membro_inf_esq; + private String especif1; + private String especif2; + private String especif3; + private String especif4; + private String tipo_lesao; + private String tipo_incapacidade; // 't' ou 'p' + private Integer coef_incapacidade = null; + private Date data_aval_incapacidade; + private Date data_rev_incapacidade; + private Date periodo_incapacidade_de; + private Date periodo_incapacidade_a; + private String img_flexao; + private String img_ext1; + private String img_ext2; + private String img_cab2; + private String img_cab3; + private String img_ma2; + private String img_ma3; + private String img_ma5; + private String img_ma6; + private String img_ma8; + private String img_ma10; + + private String img_rot1; + private String img_rot2; + private String img_cab1; + private String img_cab4; + private String img_ma1; + private String img_ma4; + private String img_ma7; + private String img_ma9; + + private Integer restricao_carga; + private String restricao_motricidade; + private String restricao_conducao; + private String restricao_vibracoes; + private String restricao_outras; + private String med_observ; + + private Integer medico_id; + private Integer tecnico_saude_id; + + private String ass_consolidacao; + private String ass_resp_seg; + private String ass_resp_rh; + + private Date data_consolidacao; + private Date data_assinatura_seg; + private Date data_assinatura_rh; + + private String nome_resp_seg; + private String nome_resp_rh; + + private String correcao; + private Integer estado_antes_correcao; + private String observacoes_correcao; + + private String ass_superior; + private String nome_superior; + private Date data_assinatura_superior; + + private String averiguador; + private String averiguacao_posterior; + private String averiguacao_obs; + + private String nome_resp_consolidacao; + private Date data_inicio_processo; + + private Integer rh_fase4; + + /** 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 getAcidentado_id() { + return acidentado_id; + } + + public void setAcidentado_id(Integer acidentado_id) { + this.acidentado_id = acidentado_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 Integer getCausas() { + return causas; + } + + public void setCausas(Integer 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; + } + + public Time getHora_acidente() { + return hora_acidente; + } + + public void setHora_acidente(Time hora_acidente) { + this.hora_acidente = hora_acidente; + } + + public String getFormacao_shst() { + return formacao_shst; + } + + public void setFormacao_shst(String formacao_shst) { + this.formacao_shst = formacao_shst; + } + + public String getFormacao_shst_nao_porque() { + return formacao_shst_nao_porque; + } + + public void setFormacao_shst_nao_porque(String formacao_shst_nao_porque) { + this.formacao_shst_nao_porque = formacao_shst_nao_porque; + } + + public String getOutros_acidentes_com_colaborador() { + return outros_acidentes_com_colaborador; + } + + public void setOutros_acidentes_com_colaborador(String outros_acidentes_com_colaborador) { + this.outros_acidentes_com_colaborador = outros_acidentes_com_colaborador; + } + + public Integer getNr_acidentes_com_colaborador() { + return nr_acidentes_com_colaborador; + } + + public void setNr_acidentes_com_colaborador(Integer nr_acidentes_com_colaborador) { + this.nr_acidentes_com_colaborador = nr_acidentes_com_colaborador; + } + + public Integer getNr_relatorio_acidente_colaborador1() { + return nr_relatorio_acidente_colaborador1; + } + + public void setNr_relatorio_acidente_colaborador1(Integer nr_relatorio_acidente_colaborador1) { + this.nr_relatorio_acidente_colaborador1 = nr_relatorio_acidente_colaborador1; + } + + public Integer getNr_relatorio_acidente_colaborador2() { + return nr_relatorio_acidente_colaborador2; + } + + public void setNr_relatorio_acidente_colaborador2(Integer nr_relatorio_acidente_colaborador2) { + this.nr_relatorio_acidente_colaborador2 = nr_relatorio_acidente_colaborador2; + } + + public Integer getNr_relatorio_acidente_colaborador3() { + return nr_relatorio_acidente_colaborador3; + } + + public void setNr_relatorio_acidente_colaborador3(Integer nr_relatorio_acidente_colaborador3) { + this.nr_relatorio_acidente_colaborador3 = nr_relatorio_acidente_colaborador3; + } + + public Integer getNr_relatorio_acidente_colaborador4() { + return nr_relatorio_acidente_colaborador4; + } + + public void setNr_relatorio_acidente_colaborador4(Integer nr_relatorio_acidente_colaborador4) { + this.nr_relatorio_acidente_colaborador4 = nr_relatorio_acidente_colaborador4; + } + + public String getAcidentes_outros_colaboradores() { + return acidentes_outros_colaboradores; + } + + public void setAcidentes_outros_colaboradores(String acidentes_outros_colaboradores) { + this.acidentes_outros_colaboradores = acidentes_outros_colaboradores; + } + + public Integer getNr_acidentes_outros_colaboradores() { + return nr_acidentes_outros_colaboradores; + } + + public void setNr_acidentes_outros_colaboradores(Integer nr_acidentes_outros_colaboradores) { + this.nr_acidentes_outros_colaboradores = nr_acidentes_outros_colaboradores; + } + + public Integer getNr_relatorio_acidente_outros_colaboradores1() { + return nr_relatorio_acidente_outros_colaboradores1; + } + + public void setNr_relatorio_acidente_outros_colaboradores1(Integer nr_relatorio_acidente_outros_colaboradores1) { + this.nr_relatorio_acidente_outros_colaboradores1 = nr_relatorio_acidente_outros_colaboradores1; + } + + public Integer getNr_relatorio_acidente_outros_colaboradores2() { + return nr_relatorio_acidente_outros_colaboradores2; + } + + public void setNr_relatorio_acidente_outros_colaboradores2(Integer nr_relatorio_acidente_outros_colaboradores2) { + this.nr_relatorio_acidente_outros_colaboradores2 = nr_relatorio_acidente_outros_colaboradores2; + } + + public Integer getNr_relatorio_acidente_outros_colaboradores3() { + return nr_relatorio_acidente_outros_colaboradores3; + } + + public void setNr_relatorio_acidente_outros_colaboradores3(Integer nr_relatorio_acidente_outros_colaboradores3) { + this.nr_relatorio_acidente_outros_colaboradores3 = nr_relatorio_acidente_outros_colaboradores3; + } + + public Integer getNr_relatorio_acidente_outros_colaboradores4() { + return nr_relatorio_acidente_outros_colaboradores4; + } + + public void setNr_relatorio_acidente_outros_colaboradores4(Integer nr_relatorio_acidente_outros_colaboradores4) { + this.nr_relatorio_acidente_outros_colaboradores4 = nr_relatorio_acidente_outros_colaboradores4; + } + + public String getLesao_cabeca() { + return lesao_cabeca; + } + + public void setLesao_cabeca(String lesao_cabeca) { + this.lesao_cabeca = lesao_cabeca; + } + + public String getLesao_pescoco() { + return lesao_pescoco; + } + + public void setLesao_pescoco(String lesao_pescoco) { + this.lesao_pescoco = lesao_pescoco; + } + + public String getLesao_tronco() { + return lesao_tronco; + } + + public void setLesao_tronco(String lesao_tronco) { + this.lesao_tronco = lesao_tronco; + } + + public String getLesao_membro_sup_dir() { + return lesao_membro_sup_dir; + } + + public void setLesao_membro_sup_dir(String lesao_membro_sup_dir) { + this.lesao_membro_sup_dir = lesao_membro_sup_dir; + } + + public String getLesao_membro_sup_esq() { + return lesao_membro_sup_esq; + } + + public void setLesao_membro_sup_esq(String lesao_membro_sup_esq) { + this.lesao_membro_sup_esq = lesao_membro_sup_esq; + } + + public String getLesao_membro_inf_dir() { + return lesao_membro_inf_dir; + } + + public void setLesao_membro_inf_dir(String lesao_membro_inf_dir) { + this.lesao_membro_inf_dir = lesao_membro_inf_dir; + } + + public String getLesao_membro_inf_esq() { + return lesao_membro_inf_esq; + } + + public void setLesao_membro_inf_esq(String lesao_membro_inf_esq) { + this.lesao_membro_inf_esq = lesao_membro_inf_esq; + } + + public String getEspecif1() { + return especif1; + } + + public void setEspecif1(String especif1) { + this.especif1 = especif1; + } + + public String getEspecif2() { + return especif2; + } + + public void setEspecif2(String especif2) { + this.especif2 = especif2; + } + + public String getEspecif3() { + return especif3; + } + + public void setEspecif3(String especif3) { + this.especif3 = especif3; + } + + public String getEspecif4() { + return especif4; + } + + public void setEspecif4(String especif4) { + this.especif4 = especif4; + } + + public String getTipo_incapacidade() { + return tipo_incapacidade; + } + + public void setTipo_incapacidade(String tipo_incapacidade) { + this.tipo_incapacidade = tipo_incapacidade; + } + + public Integer getCoef_incapacidade() { + return coef_incapacidade; + } + + public void setCoef_incapacidade(Integer coef_incapacidade) { + this.coef_incapacidade = coef_incapacidade; + } + + public Date getData_aval_incapacidade() { + return data_aval_incapacidade; + } + + public void setData_aval_incapacidade(Date data_aval_incapacidade) { + this.data_aval_incapacidade = data_aval_incapacidade; + } + + public Date getData_rev_incapacidade() { + return data_rev_incapacidade; + } + + public void setData_rev_incapacidade(Date data_rev_incapacidade) { + this.data_rev_incapacidade = data_rev_incapacidade; + } + + public Date getPeriodo_incapacidade_de() { + return periodo_incapacidade_de; + } + + public void setPeriodo_incapacidade_de(Date periodo_incapacidade_de) { + this.periodo_incapacidade_de = periodo_incapacidade_de; + } + + public Date getPeriodo_incapacidade_a() { + return periodo_incapacidade_a; + } + + public void setPeriodo_incapacidade_a(Date periodo_incapacidade_a) { + this.periodo_incapacidade_a = periodo_incapacidade_a; + } + + public String getImg_flexao() { + return img_flexao; + } + + public void setImg_flexao(String img_flexao) { + this.img_flexao = img_flexao; + } + + public String getImg_ext1() { + return img_ext1; + } + + public void setImg_ext1(String img_ext1) { + this.img_ext1 = img_ext1; + } + + public String getImg_ext2() { + return img_ext2; + } + + public void setImg_ext2(String img_ext2) { + this.img_ext2 = img_ext2; + } + + public String getImg_cab2() { + return img_cab2; + } + + public void setImg_cab2(String img_cab2) { + this.img_cab2 = img_cab2; + } + + public String getImg_cab3() { + return img_cab3; + } + + public void setImg_cab3(String img_cab3) { + this.img_cab3 = img_cab3; + } + + public String getImg_ma2() { + return img_ma2; + } + + public void setImg_ma2(String img_ma2) { + this.img_ma2 = img_ma2; + } + + public String getImg_ma3() { + return img_ma3; + } + + public void setImg_ma3(String img_ma3) { + this.img_ma3 = img_ma3; + } + + public String getImg_ma5() { + return img_ma5; + } + + public void setImg_ma5(String img_ma5) { + this.img_ma5 = img_ma5; + } + + public String getImg_ma6() { + return img_ma6; + } + + public void setImg_ma6(String img_ma6) { + this.img_ma6 = img_ma6; + } + + public String getImg_ma8() { + return img_ma8; + } + + public void setImg_ma8(String img_ma8) { + this.img_ma8 = img_ma8; + } + + public String getImg_ma10() { + return img_ma10; + } + + public void setImg_ma10(String img_ma10) { + this.img_ma10 = img_ma10; + } + + public Integer getRestricao_carga() { + return restricao_carga; + } + + public void setRestricao_carga(Integer restricao_carga) { + this.restricao_carga = restricao_carga; + } + + public String getRestricao_motricidade() { + return restricao_motricidade; + } + + public void setRestricao_motricidade(String restricao_motricidade) { + this.restricao_motricidade = restricao_motricidade; + } + + public String getRestricao_conducao() { + return restricao_conducao; + } + + public void setRestricao_conducao(String restricao_conducao) { + this.restricao_conducao = restricao_conducao; + } + + public String getRestricao_vibracoes() { + return restricao_vibracoes; + } + + public void setRestricao_vibracoes(String restricao_vibracoes) { + this.restricao_vibracoes = restricao_vibracoes; + } + + public String getRestricao_outras() { + return restricao_outras; + } + + public void setRestricao_outras(String restricao_outras) { + this.restricao_outras = restricao_outras; + } + + public String getMed_observ() { + return med_observ; + } + + public void setMed_observ(String med_observ) { + this.med_observ = med_observ; + } + + public String getTipo_lesao() { + return tipo_lesao; + } + + public void setTipo_lesao(String tipo_lesao) { + this.tipo_lesao = tipo_lesao; + } + + public String getImg_rot1() { + return img_rot1; + } + + public void setImg_rot1(String img_rot1) { + this.img_rot1 = img_rot1; + } + + public String getImg_rot2() { + return img_rot2; + } + + public void setImg_rot2(String img_rot2) { + this.img_rot2 = img_rot2; + } + + public String getImg_cab1() { + return img_cab1; + } + + public void setImg_cab1(String img_cab1) { + this.img_cab1 = img_cab1; + } + + public String getImg_cab4() { + return img_cab4; + } + + public void setImg_cab4(String img_cab4) { + this.img_cab4 = img_cab4; + } + + public String getImg_ma1() { + return img_ma1; + } + + public void setImg_ma1(String img_ma1) { + this.img_ma1 = img_ma1; + } + + public String getImg_ma4() { + return img_ma4; + } + + public void setImg_ma4(String img_ma4) { + this.img_ma4 = img_ma4; + } + + public String getImg_ma7() { + return img_ma7; + } + + public void setImg_ma7(String img_ma7) { + this.img_ma7 = img_ma7; + } + + public String getImg_ma9() { + return img_ma9; + } + + public void setImg_ma9(String img_ma9) { + this.img_ma9 = img_ma9; + } + + public Integer getEmpresa_id() { + return empresa_id; + } + + public void setEmpresa_id(Integer empresa_id) { + this.empresa_id = empresa_id; + } + + public Integer getMedico_id() { + return medico_id; + } + + public void setMedico_id(Integer medico_id) { + this.medico_id = medico_id; + } + + public Integer getTecnico_saude_id() { + return tecnico_saude_id; + } + + public void setTecnico_saude_id(Integer tecnico_saude_id) { + this.tecnico_saude_id = tecnico_saude_id; + } + + public String getAnalise_nr() { + return analise_nr; + } + + public void setAnalise_nr(String analise_nr) { + this.analise_nr = analise_nr; + } + + public String getFase() { + return fase; + } + + public void setFase(String fase) { + this.fase = fase; + } + + public Integer getEstado_assinatura() { + return estado_assinatura; + } + + public void setEstado_assinatura(Integer estado_assinatura) { + this.estado_assinatura = estado_assinatura; + } + + public String getAss_resp_seg() { + return ass_resp_seg; + } + + public void setAss_resp_seg(String ass_resp_seg) { + this.ass_resp_seg = ass_resp_seg; + } + + public String getAss_resp_rh() { + return ass_resp_rh; + } + + public void setAss_resp_rh(String ass_resp_rh) { + this.ass_resp_rh = ass_resp_rh; + } + + public String getNumero_mecanografico() { + return numero_mecanografico; + } + + public void setNumero_mecanografico(String numero_mecanografico) { + this.numero_mecanografico = numero_mecanografico; + } + + public String getNome_estabelecimento() { + return nome_estabelecimento; + } + + public void setNome_estabelecimento(String nome_estabelecimento) { + this.nome_estabelecimento = nome_estabelecimento; + } + + public Date getData_consolidacao() { + return data_consolidacao; + } + + public void setData_consolidacao(Date data_consolidacao) { + this.data_consolidacao = data_consolidacao; + } + + public Date getData_assinatura_seg() { + return data_assinatura_seg; + } + + public void setData_assinatura_seg(Date data_assinatura_seg) { + this.data_assinatura_seg = data_assinatura_seg; + } + + public Date getData_assinatura_rh() { + return data_assinatura_rh; + } + + public void setData_assinatura_rh(Date data_assinatura_rh) { + this.data_assinatura_rh = data_assinatura_rh; + } + + public String getNome_resp_seg() { + if(nome_resp_seg == null) + { + return ""; + } + return nome_resp_seg; + } + + public void setNome_resp_seg(String nome_resp_seg) { + this.nome_resp_seg = nome_resp_seg; + } + + public String getNome_resp_rh() { + if(nome_resp_rh == null) + { + return ""; + } + return nome_resp_rh; + } + + public void setNome_resp_rh(String nome_resp_rh) { + this.nome_resp_rh = nome_resp_rh; + } + + public Integer getEstado_antes_correcao() { + return estado_antes_correcao; + } + + public void setEstado_antes_correcao(Integer estado_antes_correcao) { + this.estado_antes_correcao = estado_antes_correcao; + } + + public String getCorrecao() { + return correcao; + } + + public void setCorrecao(String correcao) { + this.correcao = correcao; + } + + public String getObservacoes_correcao() { + if(observacoes_correcao == null) + { + return ""; + } + return observacoes_correcao; + } + + public void setObservacoes_correcao(String observacoes_correcao) { + this.observacoes_correcao = observacoes_correcao; + } + + public String getAss_superior() { + return ass_superior; + } + + public void setAss_superior(String ass_superior) { + this.ass_superior = ass_superior; + } + + public String getNome_superior() { + if(nome_superior == null) + { + return ""; + } + return nome_superior; + } + + public void setNome_superior(String nome_superior) { + this.nome_superior = nome_superior; + } + + public Date getData_assinatura_superior() { + return data_assinatura_superior; + } + + public void setData_assinatura_superior(Date data_assinatura_superior) { + this.data_assinatura_superior = data_assinatura_superior; + } + + public String getAveriguador() { + if(averiguador == null) + { + return ""; + } + return averiguador; + } + + public void setAveriguador(String averiguador) { + this.averiguador = averiguador; + } + + public String getAveriguacao_posterior() { + if(averiguacao_posterior == null) + { + averiguacao_posterior = "n"; + } + return averiguacao_posterior; + } + + public void setAveriguacao_posterior(String averiguacao_posterior) { + this.averiguacao_posterior = averiguacao_posterior; + } + + public String getAveriguacao_obs() { + if(averiguacao_obs == null) + { + averiguacao_obs = ""; + } + return averiguacao_obs; + } + + public void setAveriguacao_obs(String averiguacao_obs) { + this.averiguacao_obs = averiguacao_obs; + } + + public String getNome_resp_consolidacao() { + return nome_resp_consolidacao; + } + + public void setNome_resp_consolidacao(String nome_resp_consolidacao) { + this.nome_resp_consolidacao = nome_resp_consolidacao; + } + + public Date getData_inicio_processo() { + return data_inicio_processo; + } + + public void setData_inicio_processo(Date data_inicio_processo) { + this.data_inicio_processo = data_inicio_processo; + } + + public String getAss_consolidacao() { + return ass_consolidacao; + } + + public void setAss_consolidacao(String ass_consolidacao) { + this.ass_consolidacao = ass_consolidacao; + } + + public Integer getDepartamento_id() { + return departamento_id; + } + + public void setDepartamento_id(Integer departamento_id) { + this.departamento_id = departamento_id; + } + + public Integer getSeccao_id() { + return seccao_id; + } + + public void setSeccao_id(Integer seccao_id) { + this.seccao_id = seccao_id; + } + + public Integer getRh_fase4() + { + return rh_fase4; + } + + public void setRh_fase4(Integer rh_fase4) + { + this.rh_fase4 = rh_fase4; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidenteTrabalho.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidenteTrabalho.java new file mode 100644 index 00000000..d6e7b7b7 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidenteTrabalho.java @@ -0,0 +1,14900 @@ +/* + * 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.Checkbox; +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.HiddenField; +import com.sun.rave.web.ui.component.Html; +import com.sun.rave.web.ui.component.Hyperlink; +import com.sun.rave.web.ui.component.ImageComponent; +import com.sun.rave.web.ui.component.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.RadioButton; +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 com.sun.rave.web.ui.model.DefaultTableDataProvider; +import com.sun.rave.web.ui.model.SingleSelectOptionsList; +import db.AnalisesDataProvider; +import db.TrabalhadoresListDataProvider; +import db.UtilizadoresDataProvider; +import global.Global; +import java.io.File; +import java.sql.Time; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.ListIterator; +import java.util.Properties; +import javax.activation.DataHandler; +import javax.faces.FacesException; +import javax.faces.FactoryFinder; +import javax.faces.application.ApplicationFactory; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.el.MethodBinding; +import javax.faces.event.ActionEvent; +import javax.faces.event.ValueChangeEvent; +import javax.mail.Authenticator; +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; +import javax.mail.*; +import javax.mail.util.ByteArrayDataSource; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import pagestate.AnaliseAcidenteTrabalhoState; +import pdf.Pdf; +import pdf.PdfGenerator; +import utils.Utils; + +/** + *

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 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 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 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 txtCap = new StaticText(); + + public StaticText getTxtCap() { + return txtCap; + } + + public void setTxtCap(StaticText st) { + this.txtCap = st; + } + + //
+ //private String IMAGE_URL = "/resources/images"; + +// private final static int ESTADO_SEG = 1; +// private final static int ESTADO_RH1 = 2; +// private final static int ESTADO_HS = 3; +// private final static int ESTADO_RH2 = 4; +// private final static int ESTADO_MEDICO = 5; +// private final static int ESTADO_ASSINATURAS = 6; +// private final static int ESTADO_IMPRESSAO = 7; +// private final static int ESTADO_FECHAR = 8; +// private final static int ESTADO_CONCLUIDO = 9; + + + private final static int ESTADO_ASSINATURA_1 = 1; + private final static int ESTADO_ASSINATURA_2 = 2; + private final static int ESTADO_ASSINATURA_3 = 3; + +// private final static int ESTADO_ASSINATURA_RESP_SEG = 1; +// private final static int ESTADO_ASSINATURA_SEG = 2; +// private final static int ESTADO_ASSINATURA_HS = 3; +// private final static int ESTADO_ASSINATURA_MED = 4; +// private final static int ESTADO_ASSINATURA_RH = 5; +// private final static int ESTADO_ASSINATURA_RESP_RH = 6; + + private final static int IMAGE_WIDTH = 48; + private final static int IMAGE_HEIGHT = 48; + + private static final String PDFS_FOLDER_URL = "/resources/pdfs"; + + private Hyperlink lnkLblTrabalhador = new Hyperlink(); + + public Hyperlink getLnkLblTrabalhador() { + return lnkLblTrabalhador; + } + + public void setLnkLblTrabalhador(Hyperlink h) { + this.lnkLblTrabalhador = h; + } + + private HtmlPanelGrid gridAcidentado = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridAcidentado() { + return gridAcidentado; + } + + public void setGridAcidentado(HtmlPanelGrid hpg) { + this.gridAcidentado = hpg; + } + + private HtmlPanelGrid gridPanel23 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel23() { + return gridPanel23; + } + + public void setGridPanel23(HtmlPanelGrid hpg) { + this.gridPanel23 = hpg; + } + + private StaticText staticText29 = new StaticText(); + + public StaticText getStaticText29() { + return staticText29; + } + + public void setStaticText29(StaticText st) { + this.staticText29 = st; + } + + private HtmlPanelGrid gridPanel24 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel24() { + return gridPanel24; + } + + public void setGridPanel24(HtmlPanelGrid hpg) { + this.gridPanel24 = hpg; + } + + private HtmlPanelGrid gridPanel25 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel25() { + return gridPanel25; + } + + public void setGridPanel25(HtmlPanelGrid hpg) { + this.gridPanel25 = hpg; + } + + private StaticText staticText30 = new StaticText(); + + public StaticText getStaticText30() { + return staticText30; + } + + public void setStaticText30(StaticText st) { + this.staticText30 = st; + } + + private StaticText txtNomeAcidentado = new StaticText(); + + public StaticText getTxtNomeAcidentado() { + return txtNomeAcidentado; + } + + public void setTxtNomeAcidentado(StaticText st) { + this.txtNomeAcidentado = st; + } + + private StaticText staticText31 = new StaticText(); + + public StaticText getStaticText31() { + return staticText31; + } + + public void setStaticText31(StaticText st) { + this.staticText31 = st; + } + + private StaticText txtDataNascimento = new StaticText(); + + public StaticText getTxtDataNascimento() { + return txtDataNascimento; + } + + public void setTxtDataNascimento(StaticText st) { + this.txtDataNascimento = st; + } + + private StaticText staticText32 = new StaticText(); + + public StaticText getStaticText32() { + return staticText32; + } + + public void setStaticText32(StaticText st) { + this.staticText32 = st; + } + + private TextField txtBI = new TextField(); + + public TextField getTxtBI() { + return txtBI; + } + + public void setTxtBI(TextField tf) { + this.txtBI = tf; + } + + private StaticText staticText33 = new StaticText(); + + public StaticText getStaticText33() { + return staticText33; + } + + public void setStaticText33(StaticText st) { + this.staticText33 = st; + } + + private TextField txtMorada = new TextField(); + + public TextField getTxtMorada() { + return txtMorada; + } + + public void setTxtMorada(TextField tf) { + this.txtMorada = tf; + } + + private StaticText staticText34 = new StaticText(); + + public StaticText getStaticText34() { + return staticText34; + } + + public void setStaticText34(StaticText st) { + this.staticText34 = st; + } + + private PanelGroup groupPanel6 = new PanelGroup(); + + public PanelGroup getGroupPanel6() { + return groupPanel6; + } + + public void setGroupPanel6(PanelGroup pg) { + this.groupPanel6 = pg; + } + + private TextField txtCodPostal1 = new TextField(); + + public TextField getTxtCodPostal1() { + return txtCodPostal1; + } + + public void setTxtCodPostal1(TextField tf) { + this.txtCodPostal1 = tf; + } + + private StaticText staticText35 = new StaticText(); + + public StaticText getStaticText35() { + return staticText35; + } + + public void setStaticText35(StaticText st) { + this.staticText35 = st; + } + + private TextField txtCodPostal2 = new TextField(); + + public TextField getTxtCodPostal2() { + return txtCodPostal2; + } + + public void setTxtCodPostal2(TextField tf) { + this.txtCodPostal2 = tf; + } + + private StaticText staticText36 = new StaticText(); + + public StaticText getStaticText36() { + return staticText36; + } + + public void setStaticText36(StaticText st) { + this.staticText36 = st; + } + + private TextField txtLocalidade = new TextField(); + + public TextField getTxtLocalidade() { + return txtLocalidade; + } + + public void setTxtLocalidade(TextField tf) { + this.txtLocalidade = tf; + } + + private StaticText staticText37 = new StaticText(); + + public StaticText getStaticText37() { + return staticText37; + } + + public void setStaticText37(StaticText st) { + this.staticText37 = st; + } + + private TextField txtContactoTelefonico = new TextField(); + + public TextField getTxtContactoTelefonico() { + return txtContactoTelefonico; + } + + public void setTxtContactoTelefonico(TextField tf) { + this.txtContactoTelefonico = tf; + } + + private StaticText staticText38 = new StaticText(); + + public StaticText getStaticText38() { + return staticText38; + } + + public void setStaticText38(StaticText st) { + this.staticText38 = st; + } + + private StaticText stDataAdmissao = new StaticText(); + + public StaticText getStDataAdmissao() { + return stDataAdmissao; + } + + public void setStDataAdmissao(StaticText st) { + this.stDataAdmissao = st; + } + + private StaticText staticText39 = new StaticText(); + + public StaticText getStaticText39() { + return staticText39; + } + + public void setStaticText39(StaticText st) { + this.staticText39 = st; + } + + private StaticText stFuncao = new StaticText(); + + public StaticText getStFuncao() { + return stFuncao; + } + + public void setStFuncao(StaticText st) { + this.stFuncao = st; + } + + private StaticText staticText40 = new StaticText(); + + public StaticText getStaticText40() { + return staticText40; + } + + public void setStaticText40(StaticText st) { + this.staticText40 = st; + } + + private HtmlPanelGrid gridDadosAcidenteSeg = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridDadosAcidenteSeg() { + return gridDadosAcidenteSeg; + } + + public void setGridDadosAcidenteSeg(HtmlPanelGrid hpg) { + this.gridDadosAcidenteSeg = 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 gridPanel11 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel11() { + return gridPanel11; + } + + public void setGridPanel11(HtmlPanelGrid hpg) { + this.gridPanel11 = hpg; + } + + private PanelGroup groupPanel10 = new PanelGroup(); + + public PanelGroup getGroupPanel10() { + return groupPanel10; + } + + public void setGroupPanel10(PanelGroup pg) { + this.groupPanel10 = pg; + } + + private StaticText staticText17 = new StaticText(); + + public StaticText getStaticText17() { + return staticText17; + } + + public void setStaticText17(StaticText st) { + this.staticText17 = st; + } + + private PanelGroup groupPanel11 = new PanelGroup(); + + public PanelGroup getGroupPanel11() { + return groupPanel11; + } + + public void setGroupPanel11(PanelGroup pg) { + this.groupPanel11 = pg; + } + + 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 gridPanel12 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel12() { + return gridPanel12; + } + + public void setGridPanel12(HtmlPanelGrid hpg) { + this.gridPanel12 = 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 gridPanel13 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel13() { + return gridPanel13; + } + + public void setGridPanel13(HtmlPanelGrid hpg) { + this.gridPanel13 = 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 gridPanel15 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel15() { + return gridPanel15; + } + + public void setGridPanel15(HtmlPanelGrid hpg) { + this.gridPanel15 = 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 gridPanel16 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel16() { + return gridPanel16; + } + + public void setGridPanel16(HtmlPanelGrid hpg) { + this.gridPanel16 = 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 gridPanel17 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel17() { + return gridPanel17; + } + + public void setGridPanel17(HtmlPanelGrid hpg) { + this.gridPanel17 = hpg; + } + + private StaticText staticText24 = new StaticText(); + + public StaticText getStaticText24() { + return staticText24; + } + + public void setStaticText24(StaticText st) { + this.staticText24 = st; + } + + private HtmlPanelGrid gridPanel18 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel18() { + return gridPanel18; + } + + public void setGridPanel18(HtmlPanelGrid hpg) { + this.gridPanel18 = 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 gridPanel19 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel19() { + return gridPanel19; + } + + public void setGridPanel19(HtmlPanelGrid hpg) { + this.gridPanel19 = hpg; + } + + private HtmlPanelGrid gridPanel20 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel20() { + return gridPanel20; + } + + public void setGridPanel20(HtmlPanelGrid hpg) { + this.gridPanel20 = 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 gridPanel21 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel21() { + return gridPanel21; + } + + public void setGridPanel21(HtmlPanelGrid hpg) { + this.gridPanel21 = 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 gridPanel26 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel26() { + return gridPanel26; + } + + public void setGridPanel26(HtmlPanelGrid hpg) { + this.gridPanel26 = 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 gridDadosAcidenteRh = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridDadosAcidenteRh() { + return gridDadosAcidenteRh; + } + + public void setGridDadosAcidenteRh(HtmlPanelGrid hpg) { + this.gridDadosAcidenteRh = hpg; + } + + private HtmlPanelGrid gridPanel27 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel27() { + return gridPanel27; + } + + public void setGridPanel27(HtmlPanelGrid hpg) { + this.gridPanel27 = hpg; + } + + private StaticText staticText46 = new StaticText(); + + public StaticText getStaticText46() { + return staticText46; + } + + public void setStaticText46(StaticText st) { + this.staticText46 = st; + } + + private HtmlPanelGrid gridPanel28 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel28() { + return gridPanel28; + } + + public void setGridPanel28(HtmlPanelGrid hpg) { + this.gridPanel28 = hpg; + } + + private HtmlPanelGrid gridPanel29 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel29() { + return gridPanel29; + } + + public void setGridPanel29(HtmlPanelGrid hpg) { + this.gridPanel29 = hpg; + } + + private StaticText staticText47 = new StaticText(); + + public StaticText getStaticText47() { + return staticText47; + } + + public void setStaticText47(StaticText st) { + this.staticText47 = st; + } + + private HtmlPanelGrid gridPanel30 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel30() { + return gridPanel30; + } + + public void setGridPanel30(HtmlPanelGrid hpg) { + this.gridPanel30 = hpg; + } + + private StaticText staticText48 = new StaticText(); + + public StaticText getStaticText48() { + return staticText48; + } + + public void setStaticText48(StaticText st) { + this.staticText48 = st; + } + + private HtmlPanelGrid gridPanel31 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel31() { + return gridPanel31; + } + + public void setGridPanel31(HtmlPanelGrid hpg) { + this.gridPanel31 = hpg; + } + + private RadioButton rbFormacaoSHSTY = new RadioButton(); + + public RadioButton getRbFormacaoSHSTY() { + return rbFormacaoSHSTY; + } + + public void setRbFormacaoSHSTY(RadioButton rb) { + this.rbFormacaoSHSTY = rb; + } + + private StaticText staticText49 = new StaticText(); + + public StaticText getStaticText49() { + return staticText49; + } + + public void setStaticText49(StaticText st) { + this.staticText49 = st; + } + + private HtmlPanelGrid gridPanel32 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel32() { + return gridPanel32; + } + + public void setGridPanel32(HtmlPanelGrid hpg) { + this.gridPanel32 = hpg; + } + + private StaticText staticText50 = new StaticText(); + + public StaticText getStaticText50() { + return staticText50; + } + + public void setStaticText50(StaticText st) { + this.staticText50 = st; + } + + private HtmlPanelGrid gridPanel33 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel33() { + return gridPanel33; + } + + public void setGridPanel33(HtmlPanelGrid hpg) { + this.gridPanel33 = hpg; + } + + private RadioButton rbFormacaoSHSTN = new RadioButton(); + + public RadioButton getRbFormacaoSHSTN() { + return rbFormacaoSHSTN; + } + + public void setRbFormacaoSHSTN(RadioButton rb) { + this.rbFormacaoSHSTN = rb; + } + + private StaticText stFormacaoDummy = new StaticText(); + + public StaticText getStFormacaoDummy() { + return stFormacaoDummy; + } + + public void setStFormacaoDummy(StaticText st) { + this.stFormacaoDummy = st; + } + + private PanelGroup groupPanel12 = new PanelGroup(); + + public PanelGroup getGroupPanel12() { + return groupPanel12; + } + + public void setGroupPanel12(PanelGroup pg) { + this.groupPanel12 = pg; + } + + private StaticText lblFormacaoSHSTNWhy = new StaticText(); + + public StaticText getLblFormacaoSHSTNWhy() { + return lblFormacaoSHSTNWhy; + } + + public void setLblFormacaoSHSTNWhy(StaticText st) { + this.lblFormacaoSHSTNWhy = st; + } + + private TextField txtFormacaoSHSTNWhy = new TextField(); + + public TextField getTxtFormacaoSHSTNWhy() { + return txtFormacaoSHSTNWhy; + } + + public void setTxtFormacaoSHSTNWhy(TextField tf) { + this.txtFormacaoSHSTNWhy = tf; + } + + private HtmlPanelGrid gridPanel34 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel34() { + return gridPanel34; + } + + public void setGridPanel34(HtmlPanelGrid hpg) { + this.gridPanel34 = hpg; + } + + private StaticText staticText53 = new StaticText(); + + public StaticText getStaticText53() { + return staticText53; + } + + public void setStaticText53(StaticText st) { + this.staticText53 = st; + } + + private HtmlPanelGrid gridPanel35 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel35() { + return gridPanel35; + } + + public void setGridPanel35(HtmlPanelGrid hpg) { + this.gridPanel35 = hpg; + } + + private StaticText staticText54 = new StaticText(); + + public StaticText getStaticText54() { + return staticText54; + } + + public void setStaticText54(StaticText st) { + this.staticText54 = st; + } + + private HtmlPanelGrid gridPanel36 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel36() { + return gridPanel36; + } + + public void setGridPanel36(HtmlPanelGrid hpg) { + this.gridPanel36 = hpg; + } + + private RadioButton rbAcidentesColaboradorY = new RadioButton(); + + public RadioButton getRbAcidentesColaboradorY() { + return rbAcidentesColaboradorY; + } + + public void setRbAcidentesColaboradorY(RadioButton rb) { + this.rbAcidentesColaboradorY = rb; + } + + private StaticText staticText55 = new StaticText(); + + public StaticText getStaticText55() { + return staticText55; + } + + public void setStaticText55(StaticText st) { + this.staticText55 = st; + } + + private PanelGroup groupPanel13 = new PanelGroup(); + + public PanelGroup getGroupPanel13() { + return groupPanel13; + } + + public void setGroupPanel13(PanelGroup pg) { + this.groupPanel13 = pg; + } + + private StaticText staticText56 = new StaticText(); + + public StaticText getStaticText56() { + return staticText56; + } + + public void setStaticText56(StaticText st) { + this.staticText56 = st; + } + + private TextField txtNrAcidentesColaborador = new TextField(); + + public TextField getTxtNrAcidentesColaborador() { + return txtNrAcidentesColaborador; + } + + public void setTxtNrAcidentesColaborador(TextField tf) { + this.txtNrAcidentesColaborador = tf; + } + + private HtmlPanelGrid gridPanel37 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel37() { + return gridPanel37; + } + + public void setGridPanel37(HtmlPanelGrid hpg) { + this.gridPanel37 = hpg; + } + + private StaticText staticText57 = new StaticText(); + + public StaticText getStaticText57() { + return staticText57; + } + + public void setStaticText57(StaticText st) { + this.staticText57 = st; + } + + private TextField txtNrRelatorioAcidentesColaborador1 = new TextField(); + + public TextField getTxtNrRelatorioAcidentesColaborador1() { + return txtNrRelatorioAcidentesColaborador1; + } + + public void setTxtNrRelatorioAcidentesColaborador1(TextField tf) { + this.txtNrRelatorioAcidentesColaborador1 = tf; + } + + private TextField txtNrRelatorioAcidentesColaborador2 = new TextField(); + + public TextField getTxtNrRelatorioAcidentesColaborador2() { + return txtNrRelatorioAcidentesColaborador2; + } + + public void setTxtNrRelatorioAcidentesColaborador2(TextField tf) { + this.txtNrRelatorioAcidentesColaborador2 = tf; + } + + private TextField txtNrRelatorioAcidentesColaborador3 = new TextField(); + + public TextField getTxtNrRelatorioAcidentesColaborador3() { + return txtNrRelatorioAcidentesColaborador3; + } + + public void setTxtNrRelatorioAcidentesColaborador3(TextField tf) { + this.txtNrRelatorioAcidentesColaborador3 = tf; + } + + private TextField txtNrRelatorioAcidentesColaborador4 = new TextField(); + + public TextField getTxtNrRelatorioAcidentesColaborador4() { + return txtNrRelatorioAcidentesColaborador4; + } + + public void setTxtNrRelatorioAcidentesColaborador4(TextField tf) { + this.txtNrRelatorioAcidentesColaborador4 = tf; + } + + private HtmlPanelGrid gridPanel38 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel38() { + return gridPanel38; + } + + public void setGridPanel38(HtmlPanelGrid hpg) { + this.gridPanel38 = hpg; + } + + private StaticText staticText58 = new StaticText(); + + public StaticText getStaticText58() { + return staticText58; + } + + public void setStaticText58(StaticText st) { + this.staticText58 = st; + } + + private HtmlPanelGrid gridPanel39 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel39() { + return gridPanel39; + } + + public void setGridPanel39(HtmlPanelGrid hpg) { + this.gridPanel39 = hpg; + } + + private RadioButton rbAcidentesColaboradorN = new RadioButton(); + + public RadioButton getRbAcidentesColaboradorN() { + return rbAcidentesColaboradorN; + } + + public void setRbAcidentesColaboradorN(RadioButton rb) { + this.rbAcidentesColaboradorN = rb; + } + + private StaticText staticText59 = new StaticText(); + + public StaticText getStaticText59() { + return staticText59; + } + + public void setStaticText59(StaticText st) { + this.staticText59 = st; + } + + private HtmlPanelGrid gridPanel40 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel40() { + return gridPanel40; + } + + public void setGridPanel40(HtmlPanelGrid hpg) { + this.gridPanel40 = hpg; + } + + private StaticText staticText60 = new StaticText(); + + public StaticText getStaticText60() { + return staticText60; + } + + public void setStaticText60(StaticText st) { + this.staticText60 = st; + } + + private HtmlPanelGrid gridPanel41 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel41() { + return gridPanel41; + } + + public void setGridPanel41(HtmlPanelGrid hpg) { + this.gridPanel41 = hpg; + } + + private StaticText staticText61 = new StaticText(); + + public StaticText getStaticText61() { + return staticText61; + } + + public void setStaticText61(StaticText st) { + this.staticText61 = st; + } + + private HtmlPanelGrid gridPanel42 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel42() { + return gridPanel42; + } + + public void setGridPanel42(HtmlPanelGrid hpg) { + this.gridPanel42 = hpg; + } + + private RadioButton rbAcidentesColaboradoresY = new RadioButton(); + + public RadioButton getRbAcidentesColaboradoresY() { + return rbAcidentesColaboradoresY; + } + + public void setRbAcidentesColaboradoresY(RadioButton rb) { + this.rbAcidentesColaboradoresY = rb; + } + + private StaticText staticText62 = new StaticText(); + + public StaticText getStaticText62() { + return staticText62; + } + + public void setStaticText62(StaticText st) { + this.staticText62 = st; + } + + private PanelGroup groupPanel14 = new PanelGroup(); + + public PanelGroup getGroupPanel14() { + return groupPanel14; + } + + public void setGroupPanel14(PanelGroup pg) { + this.groupPanel14 = pg; + } + + private StaticText staticText63 = new StaticText(); + + public StaticText getStaticText63() { + return staticText63; + } + + public void setStaticText63(StaticText st) { + this.staticText63 = st; + } + + private TextField txtNrAcidentesColaboradores = new TextField(); + + public TextField getTxtNrAcidentesColaboradores() { + return txtNrAcidentesColaboradores; + } + + public void setTxtNrAcidentesColaboradores(TextField tf) { + this.txtNrAcidentesColaboradores = tf; + } + + private HtmlPanelGrid gridPanel43 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel43() { + return gridPanel43; + } + + public void setGridPanel43(HtmlPanelGrid hpg) { + this.gridPanel43 = hpg; + } + + private StaticText staticText64 = new StaticText(); + + public StaticText getStaticText64() { + return staticText64; + } + + public void setStaticText64(StaticText st) { + this.staticText64 = st; + } + + private TextField txtNrRelatorioAcidentesColaboradores1 = new TextField(); + + public TextField getTxtNrRelatorioAcidentesColaboradores1() { + return txtNrRelatorioAcidentesColaboradores1; + } + + public void setTxtNrRelatorioAcidentesColaboradores1(TextField tf) { + this.txtNrRelatorioAcidentesColaboradores1 = tf; + } + + private TextField txtNrRelatorioAcidentesColaboradores2 = new TextField(); + + public TextField getTxtNrRelatorioAcidentesColaboradores2() { + return txtNrRelatorioAcidentesColaboradores2; + } + + public void setTxtNrRelatorioAcidentesColaboradores2(TextField tf) { + this.txtNrRelatorioAcidentesColaboradores2 = tf; + } + + private TextField txtNrRelatorioAcidentesColaboradores3 = new TextField(); + + public TextField getTxtNrRelatorioAcidentesColaboradores3() { + return txtNrRelatorioAcidentesColaboradores3; + } + + public void setTxtNrRelatorioAcidentesColaboradores3(TextField tf) { + this.txtNrRelatorioAcidentesColaboradores3 = tf; + } + + private TextField txtNrRelatorioAcidentesColaboradores4 = new TextField(); + + public TextField getTxtNrRelatorioAcidentesColaboradores4() { + return txtNrRelatorioAcidentesColaboradores4; + } + + public void setTxtNrRelatorioAcidentesColaboradores4(TextField tf) { + this.txtNrRelatorioAcidentesColaboradores4 = tf; + } + + private HtmlPanelGrid gridPanel44 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel44() { + return gridPanel44; + } + + public void setGridPanel44(HtmlPanelGrid hpg) { + this.gridPanel44 = hpg; + } + + private StaticText staticText65 = new StaticText(); + + public StaticText getStaticText65() { + return staticText65; + } + + public void setStaticText65(StaticText st) { + this.staticText65 = st; + } + + private HtmlPanelGrid gridPanel45 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel45() { + return gridPanel45; + } + + public void setGridPanel45(HtmlPanelGrid hpg) { + this.gridPanel45 = hpg; + } + + private RadioButton rbAcidentesColaboradoresN = new RadioButton(); + + public RadioButton getRbAcidentesColaboradoresN() { + return rbAcidentesColaboradoresN; + } + + public void setRbAcidentesColaboradoresN(RadioButton rb) { + this.rbAcidentesColaboradoresN = rb; + } + + private StaticText staticText66 = new StaticText(); + + public StaticText getStaticText66() { + return staticText66; + } + + public void setStaticText66(StaticText st) { + this.staticText66 = st; + } + + private HtmlPanelGrid gridRecomendacoesHS = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridRecomendacoesHS() { + return gridRecomendacoesHS; + } + + public void setGridRecomendacoesHS(HtmlPanelGrid hpg) { + this.gridRecomendacoesHS = hpg; + } + + private HtmlPanelGrid gridPanel46 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel46() { + return gridPanel46; + } + + public void setGridPanel46(HtmlPanelGrid hpg) { + this.gridPanel46 = hpg; + } + + private StaticText staticText67 = new StaticText(); + + public StaticText getStaticText67() { + return staticText67; + } + + public void setStaticText67(StaticText st) { + this.staticText67 = st; + } + + private HtmlPanelGrid gridRecomendacoes = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridRecomendacoes() { + return gridRecomendacoes; + } + + public void setGridRecomendacoes(HtmlPanelGrid hpg) { + this.gridRecomendacoes = hpg; + } + + private HtmlPanelGrid gridPanel48 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel48() { + return gridPanel48; + } + + public void setGridPanel48(HtmlPanelGrid hpg) { + this.gridPanel48 = hpg; + } + + private StaticText stNrRecomendacao1 = new StaticText(); + + public StaticText getStNrRecomendacao1() { + return stNrRecomendacao1; + } + + public void setStNrRecomendacao1(StaticText st) { + this.stNrRecomendacao1 = st; + } + + private ImageHyperlink lnkMoreRec1 = new ImageHyperlink(); + + public ImageHyperlink getLnkMoreRec1() { + return lnkMoreRec1; + } + + public void setLnkMoreRec1(ImageHyperlink ih) { + this.lnkMoreRec1 = ih; + } + + private Hyperlink lnkDelImageTmp = new Hyperlink(); + + public Hyperlink getLnkDelImageTmp() { + return lnkDelImageTmp; + } + + public void setLnkDelImageTmp(Hyperlink lnkDelImageTmp) { + this.lnkDelImageTmp = lnkDelImageTmp; + } + + private HtmlPanelGrid gridSiprpView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridSiprpView() { + return gridSiprpView; + } + + public void setGridSiprpView(HtmlPanelGrid hpg) { + this.gridSiprpView = hpg; + } + + private HtmlPanelGrid gridPanel49 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel49() { + return gridPanel49; + } + + public void setGridPanel49(HtmlPanelGrid hpg) { + this.gridPanel49 = hpg; + } + + private StaticText staticText69 = new StaticText(); + + public StaticText getStaticText69() { + return staticText69; + } + + public void setStaticText69(StaticText st) { + this.staticText69 = st; + } + + private HtmlPanelGrid gridPanel50 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel50() { + return gridPanel50; + } + + public void setGridPanel50(HtmlPanelGrid hpg) { + this.gridPanel50 = hpg; + } + + private HtmlPanelGrid gridPanel51 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel51() { + return gridPanel51; + } + + public void setGridPanel51(HtmlPanelGrid hpg) { + this.gridPanel51 = hpg; + } + + private HtmlPanelGrid gridAcidentadoView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridAcidentadoView() { + return gridAcidentadoView; + } + + public void setGridAcidentadoView(HtmlPanelGrid hpg) { + this.gridAcidentadoView = hpg; + } + + private HtmlPanelGrid gridPanel52 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel52() { + return gridPanel52; + } + + public void setGridPanel52(HtmlPanelGrid hpg) { + this.gridPanel52 = hpg; + } + + private StaticText staticText78 = new StaticText(); + + public StaticText getStaticText78() { + return staticText78; + } + + public void setStaticText78(StaticText st) { + this.staticText78 = st; + } + + private HtmlPanelGrid gridPanel53 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel53() { + return gridPanel53; + } + + public void setGridPanel53(HtmlPanelGrid hpg) { + this.gridPanel53 = hpg; + } + + private HtmlPanelGrid gridPanel54 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel54() { + return gridPanel54; + } + + public void setGridPanel54(HtmlPanelGrid hpg) { + this.gridPanel54 = hpg; + } + + private HtmlPanelGrid gridDadosAcidenteRhView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridDadosAcidenteRhView() { + return gridDadosAcidenteRhView; + } + + public void setGridDadosAcidenteRhView(HtmlPanelGrid hpg) { + this.gridDadosAcidenteRhView = hpg; + } + + private HtmlPanelGrid gridPanel55 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel55() { + return gridPanel55; + } + + public void setGridPanel55(HtmlPanelGrid hpg) { + this.gridPanel55 = hpg; + } + + private StaticText staticText88 = new StaticText(); + + public StaticText getStaticText88() { + return staticText88; + } + + public void setStaticText88(StaticText st) { + this.staticText88 = st; + } + + private HtmlPanelGrid gridPanel56 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel56() { + return gridPanel56; + } + + public void setGridPanel56(HtmlPanelGrid hpg) { + this.gridPanel56 = hpg; + } + + private HtmlPanelGrid gridSHST = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridSHST() { + return gridSHST; + } + + public void setGridSHST(HtmlPanelGrid hpg) { + this.gridSHST = hpg; + } + + private HtmlPanelGrid gridColaborador = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridColaborador() { + return gridColaborador; + } + + public void setGridColaborador(HtmlPanelGrid hpg) { + this.gridColaborador = hpg; + } + + private HtmlPanelGrid gridColaboradores = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridColaboradores() { + return gridColaboradores; + } + + public void setGridColaboradores(HtmlPanelGrid hpg) { + this.gridColaboradores = hpg; + } + + private SingleSelectOptionsList drpHoursDefaultOptions = new SingleSelectOptionsList(); + + public SingleSelectOptionsList getDrpHoursDefaultOptions() { + return drpHoursDefaultOptions; + } + + public void setDrpHoursDefaultOptions(SingleSelectOptionsList ssol) { + this.drpHoursDefaultOptions = ssol; + } + + private SingleSelectOptionsList drpMinutesDefaultOptions = new SingleSelectOptionsList(); + + public SingleSelectOptionsList getDrpMinutesDefaultOptions() { + return drpMinutesDefaultOptions; + } + + public void setDrpMinutesDefaultOptions(SingleSelectOptionsList ssol) { + this.drpMinutesDefaultOptions = ssol; + } + + private TextArea txtRecomendacao1 = new TextArea(); + + public TextArea getTxtRecomendacao1() { + return txtRecomendacao1; + } + + public void setTxtRecomendacao1(TextArea ta) { + this.txtRecomendacao1 = ta; + } + + private HtmlPanelGrid gridRecomendacoesViewHS = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridRecomendacoesViewHS() { + return gridRecomendacoesViewHS; + } + + public void setGridRecomendacoesViewHS(HtmlPanelGrid hpg) { + this.gridRecomendacoesViewHS = hpg; + } + + private HtmlPanelGrid gridPanel47 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel47() { + return gridPanel47; + } + + public void setGridPanel47(HtmlPanelGrid hpg) { + this.gridPanel47 = hpg; + } + + private StaticText staticText51 = new StaticText(); + + public StaticText getStaticText51() { + return staticText51; + } + + public void setStaticText51(StaticText st) { + this.staticText51 = st; + } + + private HtmlPanelGrid gridRecomendacoesView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridRecomendacoesView() { + return gridRecomendacoesView; + } + + public void setGridRecomendacoesView(HtmlPanelGrid hpg) { + this.gridRecomendacoesView = hpg; + } + + private HtmlPanelGrid gridMedidasRH = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridMedidasRH() { + return gridMedidasRH; + } + + public void setGridMedidasRH(HtmlPanelGrid hpg) { + this.gridMedidasRH = hpg; + } + + private HtmlPanelGrid gridPanel57 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel57() { + return gridPanel57; + } + + public void setGridPanel57(HtmlPanelGrid hpg) { + this.gridPanel57 = hpg; + } + + private StaticText staticText68 = new StaticText(); + + public StaticText getStaticText68() { + return staticText68; + } + + public void setStaticText68(StaticText st) { + this.staticText68 = st; + } + + private HtmlPanelGrid gridMedidas = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridMedidas() { + return gridMedidas; + } + + public void setGridMedidas(HtmlPanelGrid hpg) { + this.gridMedidas = hpg; + } + + private HtmlPanelGrid gridPanel58 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel58() { + return gridPanel58; + } + + public void setGridPanel58(HtmlPanelGrid hpg) { + this.gridPanel58 = hpg; + } + + private StaticText stNrMedida1 = new StaticText(); + + public StaticText getStNrMedida1() { + return stNrMedida1; + } + + public void setStNrMedida1(StaticText st) { + this.stNrMedida1 = st; + } + + private TextArea txtMedida1 = new TextArea(); + + public TextArea getTxtMedida1() { + return txtMedida1; + } + + public void setTxtMedida1(TextArea ta) { + this.txtMedida1 = ta; + } + + private ImageHyperlink lnkMoreMed1 = new ImageHyperlink(); + + public ImageHyperlink getLnkMoreMed1() { + return lnkMoreMed1; + } + + public void setLnkMoreMed1(ImageHyperlink ih) { + this.lnkMoreMed1 = ih; + } + + private HtmlPanelGrid gridMedidasViewRH = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridMedidasViewRH() { + return gridMedidasViewRH; + } + + public void setGridMedidasViewRH(HtmlPanelGrid hpg) { + this.gridMedidasViewRH = hpg; + } + + private HtmlPanelGrid gridPanel59 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel59() { + return gridPanel59; + } + + public void setGridPanel59(HtmlPanelGrid hpg) { + this.gridPanel59 = hpg; + } + + private StaticText staticText89 = new StaticText(); + + public StaticText getStaticText89() { + return staticText89; + } + + public void setStaticText89(StaticText st) { + this.staticText89 = st; + } + + private HtmlPanelGrid gridMedidasView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridMedidasView() { + return gridMedidasView; + } + + public void setGridMedidasView(HtmlPanelGrid hpg) { + this.gridMedidasView = hpg; + } + + private HtmlPanelGrid gridMedico = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridMedico() { + return gridMedico; + } + + public void setGridMedico(HtmlPanelGrid hpg) { + this.gridMedico = hpg; + } + + private HtmlPanelGrid gridPanel60 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel60() { + return gridPanel60; + } + + public void setGridPanel60(HtmlPanelGrid hpg) { + this.gridPanel60 = hpg; + } + + private StaticText staticText90 = new StaticText(); + + public StaticText getStaticText90() { + return staticText90; + } + + public void setStaticText90(StaticText st) { + this.staticText90 = st; + } + + private HtmlPanelGrid gridLesao1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLesao1() { + return gridLesao1; + } + + public void setGridLesao1(HtmlPanelGrid hpg) { + this.gridLesao1 = hpg; + } + + private StaticText staticText91 = new StaticText(); + + public StaticText getStaticText91() { + return staticText91; + } + + public void setStaticText91(StaticText st) { + this.staticText91 = st; + } + + private HtmlPanelGrid gridPanel61 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel61() { + return gridPanel61; + } + + public void setGridPanel61(HtmlPanelGrid hpg) { + this.gridPanel61 = hpg; + } + + private PanelGroup groupPanel17 = new PanelGroup(); + + public PanelGroup getGroupPanel17() { + return groupPanel17; + } + + public void setGroupPanel17(PanelGroup pg) { + this.groupPanel17 = pg; + } + + private Checkbox chkCabeca = new Checkbox(); + + public Checkbox getChkCabeca() { + return chkCabeca; + } + + public void setChkCabeca(Checkbox c) { + this.chkCabeca = c; + } + + private StaticText staticText93 = new StaticText(); + + public StaticText getStaticText93() { + return staticText93; + } + + public void setStaticText93(StaticText st) { + this.staticText93 = st; + } + + private PanelGroup groupPanel18 = new PanelGroup(); + + public PanelGroup getGroupPanel18() { + return groupPanel18; + } + + public void setGroupPanel18(PanelGroup pg) { + this.groupPanel18 = pg; + } + + private Checkbox chkMembroSupDir = new Checkbox(); + + public Checkbox getChkMembroSupDir() { + return chkMembroSupDir; + } + + public void setChkMembroSupDir(Checkbox c) { + this.chkMembroSupDir = c; + } + + private StaticText staticText94 = new StaticText(); + + public StaticText getStaticText94() { + return staticText94; + } + + public void setStaticText94(StaticText st) { + this.staticText94 = st; + } + + private HtmlPanelGrid gridPanel62 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel62() { + return gridPanel62; + } + + public void setGridPanel62(HtmlPanelGrid hpg) { + this.gridPanel62 = hpg; + } + + private StaticText lblEspecif1 = new StaticText(); + + public StaticText getLblEspecif1() { + return lblEspecif1; + } + + public void setLblEspecif1(StaticText st) { + this.lblEspecif1 = st; + } + + private TextField txtEspecif1 = new TextField(); + + public TextField getTxtEspecif1() { + return txtEspecif1; + } + + public void setTxtEspecif1(TextField tf) { + this.txtEspecif1 = tf; + } + + private PanelGroup groupPanel19 = new PanelGroup(); + + public PanelGroup getGroupPanel19() { + return groupPanel19; + } + + public void setGroupPanel19(PanelGroup pg) { + this.groupPanel19 = pg; + } + + private Checkbox chkPescoco = new Checkbox(); + + public Checkbox getChkPescoco() { + return chkPescoco; + } + + public void setChkPescoco(Checkbox c) { + this.chkPescoco = c; + } + + private StaticText staticText96 = new StaticText(); + + public StaticText getStaticText96() { + return staticText96; + } + + public void setStaticText96(StaticText st) { + this.staticText96 = st; + } + + private PanelGroup groupPanel20 = new PanelGroup(); + + public PanelGroup getGroupPanel20() { + return groupPanel20; + } + + public void setGroupPanel20(PanelGroup pg) { + this.groupPanel20 = pg; + } + + private Checkbox chkMembroSupEsq = new Checkbox(); + + public Checkbox getChkMembroSupEsq() { + return chkMembroSupEsq; + } + + public void setChkMembroSupEsq(Checkbox c) { + this.chkMembroSupEsq = c; + } + + private StaticText staticText97 = new StaticText(); + + public StaticText getStaticText97() { + return staticText97; + } + + public void setStaticText97(StaticText st) { + this.staticText97 = st; + } + + private HtmlPanelGrid gridPanel63 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel63() { + return gridPanel63; + } + + public void setGridPanel63(HtmlPanelGrid hpg) { + this.gridPanel63 = hpg; + } + + private StaticText lblEspecif2 = new StaticText(); + + public StaticText getLblEspecif2() { + return lblEspecif2; + } + + public void setLblEspecif2(StaticText st) { + this.lblEspecif2 = st; + } + + private TextField txtEspecif2 = new TextField(); + + public TextField getTxtEspecif2() { + return txtEspecif2; + } + + public void setTxtEspecif2(TextField tf) { + this.txtEspecif2 = tf; + } + + private PanelGroup groupPanel21 = new PanelGroup(); + + public PanelGroup getGroupPanel21() { + return groupPanel21; + } + + public void setGroupPanel21(PanelGroup pg) { + this.groupPanel21 = pg; + } + + private Checkbox chkTronco = new Checkbox(); + + public Checkbox getChkTronco() { + return chkTronco; + } + + public void setChkTronco(Checkbox c) { + this.chkTronco = c; + } + + private StaticText staticText99 = new StaticText(); + + public StaticText getStaticText99() { + return staticText99; + } + + public void setStaticText99(StaticText st) { + this.staticText99 = st; + } + + private PanelGroup groupPanel22 = new PanelGroup(); + + public PanelGroup getGroupPanel22() { + return groupPanel22; + } + + public void setGroupPanel22(PanelGroup pg) { + this.groupPanel22 = pg; + } + + private Checkbox chkMembroInfDir = new Checkbox(); + + public Checkbox getChkMembroInfDir() { + return chkMembroInfDir; + } + + public void setChkMembroInfDir(Checkbox c) { + this.chkMembroInfDir = c; + } + + private StaticText staticText100 = new StaticText(); + + public StaticText getStaticText100() { + return staticText100; + } + + public void setStaticText100(StaticText st) { + this.staticText100 = st; + } + + private HtmlPanelGrid gridPanel64 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel64() { + return gridPanel64; + } + + public void setGridPanel64(HtmlPanelGrid hpg) { + this.gridPanel64 = hpg; + } + + private StaticText lblEspecif3 = new StaticText(); + + public StaticText getLblEspecif3() { + return lblEspecif3; + } + + public void setLblEspecif3(StaticText st) { + this.lblEspecif3 = st; + } + + private TextField txtEspecif3 = new TextField(); + + public TextField getTxtEspecif3() { + return txtEspecif3; + } + + public void setTxtEspecif3(TextField tf) { + this.txtEspecif3 = tf; + } + + private StaticText staticText102 = new StaticText(); + + public StaticText getStaticText102() { + return staticText102; + } + + public void setStaticText102(StaticText st) { + this.staticText102 = st; + } + + private PanelGroup groupPanel23 = new PanelGroup(); + + public PanelGroup getGroupPanel23() { + return groupPanel23; + } + + public void setGroupPanel23(PanelGroup pg) { + this.groupPanel23 = pg; + } + + private Checkbox chkMembroInfEsq = new Checkbox(); + + public Checkbox getChkMembroInfEsq() { + return chkMembroInfEsq; + } + + public void setChkMembroInfEsq(Checkbox c) { + this.chkMembroInfEsq = c; + } + + private StaticText staticText103 = new StaticText(); + + public StaticText getStaticText103() { + return staticText103; + } + + public void setStaticText103(StaticText st) { + this.staticText103 = st; + } + + private HtmlPanelGrid gridPanel65 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel65() { + return gridPanel65; + } + + public void setGridPanel65(HtmlPanelGrid hpg) { + this.gridPanel65 = hpg; + } + + private StaticText lblEspecif4 = new StaticText(); + + public StaticText getLblEspecif4() { + return lblEspecif4; + } + + public void setLblEspecif4(StaticText st) { + this.lblEspecif4 = st; + } + + private TextField txtEspecif4 = new TextField(); + + public TextField getTxtEspecif4() { + return txtEspecif4; + } + + public void setTxtEspecif4(TextField tf) { + this.txtEspecif4 = tf; + } + + private HtmlPanelGrid gridPanel66 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel66() { + return gridPanel66; + } + + public void setGridPanel66(HtmlPanelGrid hpg) { + this.gridPanel66 = hpg; + } + + private StaticText staticText105 = new StaticText(); + + public StaticText getStaticText105() { + return staticText105; + } + + public void setStaticText105(StaticText st) { + this.staticText105 = st; + } + + private TextField txtTipoLesao = new TextField(); + + public TextField getTxtTipoLesao() { + return txtTipoLesao; + } + + public void setTxtTipoLesao(TextField tf) { + this.txtTipoLesao = tf; + } + + private HtmlPanelGrid gridPanel67 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel67() { + return gridPanel67; + } + + public void setGridPanel67(HtmlPanelGrid hpg) { + this.gridPanel67 = hpg; + } + + private StaticText staticText106 = new StaticText(); + + public StaticText getStaticText106() { + return staticText106; + } + + public void setStaticText106(StaticText st) { + this.staticText106 = st; + } + + private HtmlPanelGrid gridIncapacidade1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridIncapacidade1() { + return gridIncapacidade1; + } + + public void setGridIncapacidade1(HtmlPanelGrid hpg) { + this.gridIncapacidade1 = hpg; + } + + private HtmlPanelGrid gridPanel68 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel68() { + return gridPanel68; + } + + public void setGridPanel68(HtmlPanelGrid hpg) { + this.gridPanel68 = hpg; + } + + private PanelGroup groupPanel24 = new PanelGroup(); + + public PanelGroup getGroupPanel24() { + return groupPanel24; + } + + public void setGroupPanel24(PanelGroup pg) { + this.groupPanel24 = pg; + } + + private StaticText staticText107 = new StaticText(); + + public StaticText getStaticText107() { + return staticText107; + } + + public void setStaticText107(StaticText st) { + this.staticText107 = st; + } + + private RadioButton rbIncapacidadeNone = new RadioButton(); + + public RadioButton getRbIncapacidadeNone() { + return rbIncapacidadeNone; + } + + public void setRbIncapacidadeNone(RadioButton rb) { + this.rbIncapacidadeNone = rb; + } + + private StaticText staticText108 = new StaticText(); + + public StaticText getStaticText108() { + return staticText108; + } + + public void setStaticText108(StaticText st) { + this.staticText108 = st; + } + + private RadioButton rbIncapacidadeTemp = new RadioButton(); + + public RadioButton getRbIncapacidadeTemp() { + return rbIncapacidadeTemp; + } + + public void setRbIncapacidadeTemp(RadioButton rb) { + this.rbIncapacidadeTemp = rb; + } + + private StaticText staticText109 = new StaticText(); + + public StaticText getStaticText109() { + return staticText109; + } + + public void setStaticText109(StaticText st) { + this.staticText109 = st; + } + + private PanelGroup groupPanel25 = new PanelGroup(); + + public PanelGroup getGroupPanel25() { + return groupPanel25; + } + + public void setGroupPanel25(PanelGroup pg) { + this.groupPanel25 = pg; + } + + private StaticText staticText110 = new StaticText(); + + public StaticText getStaticText110() { + return staticText110; + } + + public void setStaticText110(StaticText st) { + this.staticText110 = st; + } + + private TextField txtCoefIncapacidade = new TextField(); + + public TextField getTxtCoefIncapacidade() { + return txtCoefIncapacidade; + } + + public void setTxtCoefIncapacidade(TextField tf) { + this.txtCoefIncapacidade = tf; + } + + private StaticText staticText111 = new StaticText(); + + public StaticText getStaticText111() { + return staticText111; + } + + public void setStaticText111(StaticText st) { + this.staticText111 = st; + } + + private HtmlPanelGrid gridPanel69 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel69() { + return gridPanel69; + } + + public void setGridPanel69(HtmlPanelGrid hpg) { + this.gridPanel69 = hpg; + } + + private StaticText staticText112 = new StaticText(); + + public StaticText getStaticText112() { + return staticText112; + } + + public void setStaticText112(StaticText st) { + this.staticText112 = st; + } + + private com.sun.rave.web.ui.component.Calendar calAvaliacaoIncap = new com.sun.rave.web.ui.component.Calendar(); + + public com.sun.rave.web.ui.component.Calendar getCalAvaliacaoIncap() { + return calAvaliacaoIncap; + } + + public void setCalAvaliacaoIncap(com.sun.rave.web.ui.component.Calendar c) { + this.calAvaliacaoIncap = c; + } + + private StaticText staticText113 = new StaticText(); + + public StaticText getStaticText113() { + return staticText113; + } + + public void setStaticText113(StaticText st) { + this.staticText113 = st; + } + + private com.sun.rave.web.ui.component.Calendar calRevisaoIncap = new com.sun.rave.web.ui.component.Calendar(); + + public com.sun.rave.web.ui.component.Calendar getCalRevisaoIncap() { + return calRevisaoIncap; + } + + public void setCalRevisaoIncap(com.sun.rave.web.ui.component.Calendar c) { + this.calRevisaoIncap = c; + } + + private HtmlPanelGrid gridPanel70 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel70() { + return gridPanel70; + } + + public void setGridPanel70(HtmlPanelGrid hpg) { + this.gridPanel70 = hpg; + } + + private StaticText staticText114 = new StaticText(); + + public StaticText getStaticText114() { + return staticText114; + } + + public void setStaticText114(StaticText st) { + this.staticText114 = st; + } + + private com.sun.rave.web.ui.component.Calendar calPeridoIncapDe = new com.sun.rave.web.ui.component.Calendar(); + + public com.sun.rave.web.ui.component.Calendar getCalPeridoIncapDe() { + return calPeridoIncapDe; + } + + public void setCalPeridoIncapDe(com.sun.rave.web.ui.component.Calendar c) { + this.calPeridoIncapDe = c; + } + + private StaticText staticText115 = new StaticText(); + + public StaticText getStaticText115() { + return staticText115; + } + + public void setStaticText115(StaticText st) { + this.staticText115 = st; + } + + private com.sun.rave.web.ui.component.Calendar calPeriodoIncapA = new com.sun.rave.web.ui.component.Calendar(); + + public com.sun.rave.web.ui.component.Calendar getCalPeriodoIncapA() { + return calPeriodoIncapA; + } + + public void setCalPeriodoIncapA(com.sun.rave.web.ui.component.Calendar c) { + this.calPeriodoIncapA = c; + } + + private HtmlPanelGrid gridPanel71 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel71() { + return gridPanel71; + } + + public void setGridPanel71(HtmlPanelGrid hpg) { + this.gridPanel71 = hpg; + } + + private StaticText staticText116 = new StaticText(); + + public StaticText getStaticText116() { + return staticText116; + } + + public void setStaticText116(StaticText st) { + this.staticText116 = st; + } + + private HtmlPanelGrid gridRestricoes = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridRestricoes() { + return gridRestricoes; + } + + public void setGridRestricoes(HtmlPanelGrid hpg) { + this.gridRestricoes = hpg; + } + + private HtmlPanelGrid gridPanel72 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel72() { + return gridPanel72; + } + + public void setGridPanel72(HtmlPanelGrid hpg) { + this.gridPanel72 = hpg; + } + + private HtmlPanelGrid gridPanel73 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel73() { + return gridPanel73; + } + + public void setGridPanel73(HtmlPanelGrid hpg) { + this.gridPanel73 = hpg; + } + + private HtmlPanelGrid gridPanel74 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel74() { + return gridPanel74; + } + + public void setGridPanel74(HtmlPanelGrid hpg) { + this.gridPanel74 = hpg; + } + + private HtmlPanelGrid gridPanel75 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel75() { + return gridPanel75; + } + + public void setGridPanel75(HtmlPanelGrid hpg) { + this.gridPanel75 = hpg; + } + + private ImageComponent image3 = new ImageComponent(); + + public ImageComponent getImage3() { + return image3; + } + + public void setImage3(ImageComponent ic) { + this.image3 = ic; + } + + private ImageComponent image4 = new ImageComponent(); + + public ImageComponent getImage4() { + return image4; + } + + public void setImage4(ImageComponent ic) { + this.image4 = ic; + } + + private ImageComponent image5 = new ImageComponent(); + + public ImageComponent getImage5() { + return image5; + } + + public void setImage5(ImageComponent ic) { + this.image5 = ic; + } + + private PanelGroup groupPanel26 = new PanelGroup(); + + public PanelGroup getGroupPanel26() { + return groupPanel26; + } + + public void setGroupPanel26(PanelGroup pg) { + this.groupPanel26 = pg; + } + + private StaticText staticText117 = new StaticText(); + + public StaticText getStaticText117() { + return staticText117; + } + + public void setStaticText117(StaticText st) { + this.staticText117 = st; + } + + private Checkbox chkImgFlexao = new Checkbox(); + + public Checkbox getChkImgFlexao() { + return chkImgFlexao; + } + + public void setChkImgFlexao(Checkbox c) { + this.chkImgFlexao = c; + } + + private HtmlPanelGrid gridPanel76 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel76() { + return gridPanel76; + } + + public void setGridPanel76(HtmlPanelGrid hpg) { + this.gridPanel76 = hpg; + } + + private ImageComponent image6 = new ImageComponent(); + + public ImageComponent getImage6() { + return image6; + } + + public void setImage6(ImageComponent ic) { + this.image6 = ic; + } + + private HtmlPanelGrid gridPanel77 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel77() { + return gridPanel77; + } + + public void setGridPanel77(HtmlPanelGrid hpg) { + this.gridPanel77 = hpg; + } + + private ImageComponent image7 = new ImageComponent(); + + public ImageComponent getImage7() { + return image7; + } + + public void setImage7(ImageComponent ic) { + this.image7 = ic; + } + + private ImageComponent image8 = new ImageComponent(); + + public ImageComponent getImage8() { + return image8; + } + + public void setImage8(ImageComponent ic) { + this.image8 = ic; + } + + private PanelGroup groupPanel27 = new PanelGroup(); + + public PanelGroup getGroupPanel27() { + return groupPanel27; + } + + public void setGroupPanel27(PanelGroup pg) { + this.groupPanel27 = pg; + } + + private StaticText staticText118 = new StaticText(); + + public StaticText getStaticText118() { + return staticText118; + } + + public void setStaticText118(StaticText st) { + this.staticText118 = st; + } + + private Checkbox chkImgExt1 = new Checkbox(); + + public Checkbox getChkImgExt1() { + return chkImgExt1; + } + + public void setChkImgExt1(Checkbox c) { + this.chkImgExt1 = c; + } + + private PanelGroup groupPanel28 = new PanelGroup(); + + public PanelGroup getGroupPanel28() { + return groupPanel28; + } + + public void setGroupPanel28(PanelGroup pg) { + this.groupPanel28 = pg; + } + + private StaticText staticText119 = new StaticText(); + + public StaticText getStaticText119() { + return staticText119; + } + + public void setStaticText119(StaticText st) { + this.staticText119 = st; + } + + private Checkbox chkImgExt2 = new Checkbox(); + + public Checkbox getChkImgExt2() { + return chkImgExt2; + } + + public void setChkImgExt2(Checkbox c) { + this.chkImgExt2 = c; + } + + private HtmlPanelGrid gridPanel78 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel78() { + return gridPanel78; + } + + public void setGridPanel78(HtmlPanelGrid hpg) { + this.gridPanel78 = hpg; + } + + private ImageComponent image9 = new ImageComponent(); + + public ImageComponent getImage9() { + return image9; + } + + public void setImage9(ImageComponent ic) { + this.image9 = ic; + } + + private ImageComponent image10 = new ImageComponent(); + + public ImageComponent getImage10() { + return image10; + } + + public void setImage10(ImageComponent ic) { + this.image10 = ic; + } + + private PanelGroup groupPanel29 = new PanelGroup(); + + public PanelGroup getGroupPanel29() { + return groupPanel29; + } + + public void setGroupPanel29(PanelGroup pg) { + this.groupPanel29 = pg; + } + + private StaticText staticText120 = new StaticText(); + + public StaticText getStaticText120() { + return staticText120; + } + + public void setStaticText120(StaticText st) { + this.staticText120 = st; + } + + private Checkbox chkImgCab2 = new Checkbox(); + + public Checkbox getChkImgCab2() { + return chkImgCab2; + } + + public void setChkImgCab2(Checkbox c) { + this.chkImgCab2 = c; + } + + private PanelGroup groupPanel30 = new PanelGroup(); + + public PanelGroup getGroupPanel30() { + return groupPanel30; + } + + public void setGroupPanel30(PanelGroup pg) { + this.groupPanel30 = pg; + } + + private StaticText staticText121 = new StaticText(); + + public StaticText getStaticText121() { + return staticText121; + } + + public void setStaticText121(StaticText st) { + this.staticText121 = st; + } + + private Checkbox chkImgCab3 = new Checkbox(); + + public Checkbox getChkImgCab3() { + return chkImgCab3; + } + + public void setChkImgCab3(Checkbox c) { + this.chkImgCab3 = c; + } + + private HtmlPanelGrid gridPanel79 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel79() { + return gridPanel79; + } + + public void setGridPanel79(HtmlPanelGrid hpg) { + this.gridPanel79 = hpg; + } + + private ImageComponent image12 = new ImageComponent(); + + public ImageComponent getImage12() { + return image12; + } + + public void setImage12(ImageComponent ic) { + this.image12 = ic; + } + + private ImageComponent image13 = new ImageComponent(); + + public ImageComponent getImage13() { + return image13; + } + + public void setImage13(ImageComponent ic) { + this.image13 = ic; + } + + private ImageComponent image14 = new ImageComponent(); + + public ImageComponent getImage14() { + return image14; + } + + public void setImage14(ImageComponent ic) { + this.image14 = ic; + } + + private PanelGroup groupPanel31 = new PanelGroup(); + + public PanelGroup getGroupPanel31() { + return groupPanel31; + } + + public void setGroupPanel31(PanelGroup pg) { + this.groupPanel31 = pg; + } + + private StaticText staticText122 = new StaticText(); + + public StaticText getStaticText122() { + return staticText122; + } + + public void setStaticText122(StaticText st) { + this.staticText122 = st; + } + + private Checkbox chkImgMa2 = new Checkbox(); + + public Checkbox getChkImgMa2() { + return chkImgMa2; + } + + public void setChkImgMa2(Checkbox c) { + this.chkImgMa2 = c; + } + + private PanelGroup groupPanel32 = new PanelGroup(); + + public PanelGroup getGroupPanel32() { + return groupPanel32; + } + + public void setGroupPanel32(PanelGroup pg) { + this.groupPanel32 = pg; + } + + private StaticText staticText123 = new StaticText(); + + public StaticText getStaticText123() { + return staticText123; + } + + public void setStaticText123(StaticText st) { + this.staticText123 = st; + } + + private Checkbox chkImgMa3 = new Checkbox(); + + public Checkbox getChkImgMa3() { + return chkImgMa3; + } + + public void setChkImgMa3(Checkbox c) { + this.chkImgMa3 = c; + } + + private PanelGroup groupPanel33 = new PanelGroup(); + + public PanelGroup getGroupPanel33() { + return groupPanel33; + } + + public void setGroupPanel33(PanelGroup pg) { + this.groupPanel33 = pg; + } + + private StaticText staticText124 = new StaticText(); + + public StaticText getStaticText124() { + return staticText124; + } + + public void setStaticText124(StaticText st) { + this.staticText124 = st; + } + + private Checkbox chkImgMa5 = new Checkbox(); + + public Checkbox getChkImgMa5() { + return chkImgMa5; + } + + public void setChkImgMa5(Checkbox c) { + this.chkImgMa5 = c; + } + + private PanelGroup groupPanel34 = new PanelGroup(); + + public PanelGroup getGroupPanel34() { + return groupPanel34; + } + + public void setGroupPanel34(PanelGroup pg) { + this.groupPanel34 = pg; + } + + private StaticText staticText125 = new StaticText(); + + public StaticText getStaticText125() { + return staticText125; + } + + public void setStaticText125(StaticText st) { + this.staticText125 = st; + } + + private Checkbox chkImgMa6 = new Checkbox(); + + public Checkbox getChkImgMa6() { + return chkImgMa6; + } + + public void setChkImgMa6(Checkbox c) { + this.chkImgMa6 = c; + } + + private HtmlPanelGrid gridPanel80 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel80() { + return gridPanel80; + } + + public void setGridPanel80(HtmlPanelGrid hpg) { + this.gridPanel80 = hpg; + } + + private ImageComponent image15 = new ImageComponent(); + + public ImageComponent getImage15() { + return image15; + } + + public void setImage15(ImageComponent ic) { + this.image15 = ic; + } + + private ImageComponent image16 = new ImageComponent(); + + public ImageComponent getImage16() { + return image16; + } + + public void setImage16(ImageComponent ic) { + this.image16 = ic; + } + + private PanelGroup groupPanel35 = new PanelGroup(); + + public PanelGroup getGroupPanel35() { + return groupPanel35; + } + + public void setGroupPanel35(PanelGroup pg) { + this.groupPanel35 = pg; + } + + private StaticText staticText126 = new StaticText(); + + public StaticText getStaticText126() { + return staticText126; + } + + public void setStaticText126(StaticText st) { + this.staticText126 = st; + } + + private Checkbox chkImgMa8 = new Checkbox(); + + public Checkbox getChkImgMa8() { + return chkImgMa8; + } + + public void setChkImgMa8(Checkbox c) { + this.chkImgMa8 = c; + } + + private PanelGroup groupPanel36 = new PanelGroup(); + + public PanelGroup getGroupPanel36() { + return groupPanel36; + } + + public void setGroupPanel36(PanelGroup pg) { + this.groupPanel36 = pg; + } + + private StaticText staticText127 = new StaticText(); + + public StaticText getStaticText127() { + return staticText127; + } + + public void setStaticText127(StaticText st) { + this.staticText127 = st; + } + + private Checkbox chkImgMa10 = new Checkbox(); + + public Checkbox getChkImgMa10() { + return chkImgMa10; + } + + public void setChkImgMa10(Checkbox c) { + this.chkImgMa10 = c; + } + + private HtmlPanelGrid gridPanel81 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel81() { + return gridPanel81; + } + + public void setGridPanel81(HtmlPanelGrid hpg) { + this.gridPanel81 = hpg; + } + + private StaticText staticText128 = new StaticText(); + + public StaticText getStaticText128() { + return staticText128; + } + + public void setStaticText128(StaticText st) { + this.staticText128 = st; + } + + private PanelGroup groupPanel37 = new PanelGroup(); + + public PanelGroup getGroupPanel37() { + return groupPanel37; + } + + public void setGroupPanel37(PanelGroup pg) { + this.groupPanel37 = pg; + } + + private Checkbox chkRestricaoCargas = new Checkbox(); + + public Checkbox getChkRestricaoCargas() { + return chkRestricaoCargas; + } + + public void setChkRestricaoCargas(Checkbox c) { + this.chkRestricaoCargas = c; + } + + private StaticText staticText129 = new StaticText(); + + public StaticText getStaticText129() { + return staticText129; + } + + public void setStaticText129(StaticText st) { + this.staticText129 = st; + } + + private RadioButton rbKgs2 = new RadioButton(); + + public RadioButton getRbKgs2() { + return rbKgs2; + } + + public void setRbKgs2(RadioButton rb) { + this.rbKgs2 = rb; + } + + private StaticText stKgs2 = new StaticText(); + + public StaticText getStKgs2() { + return stKgs2; + } + + public void setStKgs2(StaticText st) { + this.stKgs2 = st; + } + + private RadioButton rbKgs5 = new RadioButton(); + + public RadioButton getRbKgs5() { + return rbKgs5; + } + + public void setRbKgs5(RadioButton rb) { + this.rbKgs5 = rb; + } + + private StaticText stKgs5 = new StaticText(); + + public StaticText getStKgs5() { + return stKgs5; + } + + public void setStKgs5(StaticText st) { + this.stKgs5 = st; + } + + private RadioButton rbKgs10 = new RadioButton(); + + public RadioButton getRbKgs10() { + return rbKgs10; + } + + public void setRbKgs10(RadioButton rb) { + this.rbKgs10 = rb; + } + + private StaticText stKgs10 = new StaticText(); + + public StaticText getStKgs10() { + return stKgs10; + } + + public void setStKgs10(StaticText st) { + this.stKgs10 = st; + } + + private RadioButton rbKgs15 = new RadioButton(); + + public RadioButton getRbKgs15() { + return rbKgs15; + } + + public void setRbKgs15(RadioButton rb) { + this.rbKgs15 = rb; + } + + private StaticText stKgs15 = new StaticText(); + + public StaticText getStKgs15() { + return stKgs15; + } + + public void setStKgs15(StaticText st) { + this.stKgs15 = st; + } + + private RadioButton rbKgsOutro = new RadioButton(); + + public RadioButton getRbKgsOutro() { + return rbKgsOutro; + } + + public void setRbKgsOutro(RadioButton rb) { + this.rbKgsOutro = rb; + } + + private StaticText stKgsOutro = new StaticText(); + + public StaticText getStKgsOutro() { + return stKgsOutro; + } + + public void setStKgsOutro(StaticText st) { + this.stKgsOutro = st; + } + + private TextField txtKgs = new TextField(); + + public TextField getTxtKgs() { + return txtKgs; + } + + public void setTxtKgs(TextField tf) { + this.txtKgs = tf; + } + + private StaticText stKg = new StaticText(); + + public StaticText getStKg() { + return stKg; + } + + public void setStKg(StaticText st) { + this.stKg = st; + } + + private PanelGroup groupPanel38 = new PanelGroup(); + + public PanelGroup getGroupPanel38() { + return groupPanel38; + } + + public void setGroupPanel38(PanelGroup pg) { + this.groupPanel38 = pg; + } + + private Checkbox chkRestricaoMotricidade = new Checkbox(); + + public Checkbox getChkRestricaoMotricidade() { + return chkRestricaoMotricidade; + } + + public void setChkRestricaoMotricidade(Checkbox c) { + this.chkRestricaoMotricidade = c; + } + + private StaticText staticText136 = new StaticText(); + + public StaticText getStaticText136() { + return staticText136; + } + + public void setStaticText136(StaticText st) { + this.staticText136 = st; + } + + private PanelGroup groupPanel39 = new PanelGroup(); + + public PanelGroup getGroupPanel39() { + return groupPanel39; + } + + public void setGroupPanel39(PanelGroup pg) { + this.groupPanel39 = pg; + } + + private Checkbox chkRestricaoConducao = new Checkbox(); + + public Checkbox getChkRestricaoConducao() { + return chkRestricaoConducao; + } + + public void setChkRestricaoConducao(Checkbox c) { + this.chkRestricaoConducao = c; + } + + private StaticText staticText137 = new StaticText(); + + public StaticText getStaticText137() { + return staticText137; + } + + public void setStaticText137(StaticText st) { + this.staticText137 = st; + } + + private PanelGroup groupPanel40 = new PanelGroup(); + + public PanelGroup getGroupPanel40() { + return groupPanel40; + } + + public void setGroupPanel40(PanelGroup pg) { + this.groupPanel40 = pg; + } + + private Checkbox chkRestricaoVibracoes = new Checkbox(); + + public Checkbox getChkRestricaoVibracoes() { + return chkRestricaoVibracoes; + } + + public void setChkRestricaoVibracoes(Checkbox c) { + this.chkRestricaoVibracoes = c; + } + + private StaticText staticText138 = new StaticText(); + + public StaticText getStaticText138() { + return staticText138; + } + + public void setStaticText138(StaticText st) { + this.staticText138 = st; + } + + private HtmlPanelGrid gridPanel82 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel82() { + return gridPanel82; + } + + public void setGridPanel82(HtmlPanelGrid hpg) { + this.gridPanel82 = hpg; + } + + private PanelGroup groupPanel41 = new PanelGroup(); + + public PanelGroup getGroupPanel41() { + return groupPanel41; + } + + public void setGroupPanel41(PanelGroup pg) { + this.groupPanel41 = pg; + } + + private Checkbox chkRestricaoOutras = new Checkbox(); + + public Checkbox getChkRestricaoOutras() { + return chkRestricaoOutras; + } + + public void setChkRestricaoOutras(Checkbox c) { + this.chkRestricaoOutras = c; + } + + private StaticText staticText139 = new StaticText(); + + public StaticText getStaticText139() { + return staticText139; + } + + public void setStaticText139(StaticText st) { + this.staticText139 = st; + } + + private TextField txtRestricaoOutras = new TextField(); + + public TextField getTxtRestricaoOutras() { + return txtRestricaoOutras; + } + + public void setTxtRestricaoOutras(TextField tf) { + this.txtRestricaoOutras = tf; + } + + private HtmlPanelGrid gridPanel83 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel83() { + return gridPanel83; + } + + public void setGridPanel83(HtmlPanelGrid hpg) { + this.gridPanel83 = hpg; + } + + private StaticText staticText140 = new StaticText(); + + public StaticText getStaticText140() { + return staticText140; + } + + public void setStaticText140(StaticText st) { + this.staticText140 = st; + } + + private TextField txtObservacoes = new TextField(); + + public TextField getTxtObservacoes() { + return txtObservacoes; + } + + public void setTxtObservacoes(TextField tf) { + this.txtObservacoes = tf; + } + + private RadioButton rbIncapacidadePerm = new RadioButton(); + + public RadioButton getRbIncapacidadePerm() { + return rbIncapacidadePerm; + } + + public void setRbIncapacidadePerm(RadioButton rb) { + this.rbIncapacidadePerm = rb; + } + + private StaticText staticText141 = new StaticText(); + + public StaticText getStaticText141() { + return staticText141; + } + + public void setStaticText141(StaticText st) { + this.staticText141 = st; + } + + private ImageComponent image17 = new ImageComponent(); + + public ImageComponent getImage17() { + return image17; + } + + public void setImage17(ImageComponent ic) { + this.image17 = ic; + } + + private ImageComponent image18 = new ImageComponent(); + + public ImageComponent getImage18() { + return image18; + } + + public void setImage18(ImageComponent ic) { + this.image18 = ic; + } + + private HtmlPanelGrid gridPanel84 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel84() { + return gridPanel84; + } + + public void setGridPanel84(HtmlPanelGrid hpg) { + this.gridPanel84 = hpg; + } + + private ImageComponent image19 = new ImageComponent(); + + public ImageComponent getImage19() { + return image19; + } + + public void setImage19(ImageComponent ic) { + this.image19 = ic; + } + + private ImageComponent image20 = new ImageComponent(); + + public ImageComponent getImage20() { + return image20; + } + + public void setImage20(ImageComponent ic) { + this.image20 = ic; + } + + private PanelGroup groupPanel42 = new PanelGroup(); + + public PanelGroup getGroupPanel42() { + return groupPanel42; + } + + public void setGroupPanel42(PanelGroup pg) { + this.groupPanel42 = pg; + } + + private StaticText staticText142 = new StaticText(); + + public StaticText getStaticText142() { + return staticText142; + } + + public void setStaticText142(StaticText st) { + this.staticText142 = st; + } + + private Checkbox chkImgRot1 = new Checkbox(); + + public Checkbox getChkImgRot1() { + return chkImgRot1; + } + + public void setChkImgRot1(Checkbox c) { + this.chkImgRot1 = c; + } + + private PanelGroup groupPanel43 = new PanelGroup(); + + public PanelGroup getGroupPanel43() { + return groupPanel43; + } + + public void setGroupPanel43(PanelGroup pg) { + this.groupPanel43 = pg; + } + + private StaticText staticText143 = new StaticText(); + + public StaticText getStaticText143() { + return staticText143; + } + + public void setStaticText143(StaticText st) { + this.staticText143 = st; + } + + private Checkbox chkImgRot2 = new Checkbox(); + + public Checkbox getChkImgRot2() { + return chkImgRot2; + } + + public void setChkImgRot2(Checkbox c) { + this.chkImgRot2 = c; + } + + private ImageComponent image21 = new ImageComponent(); + + public ImageComponent getImage21() { + return image21; + } + + public void setImage21(ImageComponent ic) { + this.image21 = ic; + } + + private ImageComponent image11 = new ImageComponent(); + + public ImageComponent getImage11() { + return image11; + } + + public void setImage11(ImageComponent ic) { + this.image11 = ic; + } + + private PanelGroup groupPanel44 = new PanelGroup(); + + public PanelGroup getGroupPanel44() { + return groupPanel44; + } + + public void setGroupPanel44(PanelGroup pg) { + this.groupPanel44 = pg; + } + + private StaticText staticText144 = new StaticText(); + + public StaticText getStaticText144() { + return staticText144; + } + + public void setStaticText144(StaticText st) { + this.staticText144 = st; + } + + private Checkbox chkImgCab1 = new Checkbox(); + + public Checkbox getChkImgCab1() { + return chkImgCab1; + } + + public void setChkImgCab1(Checkbox c) { + this.chkImgCab1 = c; + } + + private PanelGroup groupPanel45 = new PanelGroup(); + + public PanelGroup getGroupPanel45() { + return groupPanel45; + } + + public void setGroupPanel45(PanelGroup pg) { + this.groupPanel45 = pg; + } + + private StaticText staticText145 = new StaticText(); + + public StaticText getStaticText145() { + return staticText145; + } + + public void setStaticText145(StaticText st) { + this.staticText145 = st; + } + + private Checkbox chkImgCab4 = new Checkbox(); + + public Checkbox getChkImgCab4() { + return chkImgCab4; + } + + public void setChkImgCab4(Checkbox c) { + this.chkImgCab4 = c; + } + + private ImageComponent image22 = new ImageComponent(); + + public ImageComponent getImage22() { + return image22; + } + + public void setImage22(ImageComponent ic) { + this.image22 = ic; + } + + private ImageComponent image23 = new ImageComponent(); + + public ImageComponent getImage23() { + return image23; + } + + public void setImage23(ImageComponent ic) { + this.image23 = ic; + } + + private ImageComponent image24 = new ImageComponent(); + + public ImageComponent getImage24() { + return image24; + } + + public void setImage24(ImageComponent ic) { + this.image24 = ic; + } + + private PanelGroup groupPanel46 = new PanelGroup(); + + public PanelGroup getGroupPanel46() { + return groupPanel46; + } + + public void setGroupPanel46(PanelGroup pg) { + this.groupPanel46 = pg; + } + + private StaticText staticText146 = new StaticText(); + + public StaticText getStaticText146() { + return staticText146; + } + + public void setStaticText146(StaticText st) { + this.staticText146 = st; + } + + private Checkbox chkImgMa1 = new Checkbox(); + + public Checkbox getChkImgMa1() { + return chkImgMa1; + } + + public void setChkImgMa1(Checkbox c) { + this.chkImgMa1 = c; + } + + private PanelGroup groupPanel47 = new PanelGroup(); + + public PanelGroup getGroupPanel47() { + return groupPanel47; + } + + public void setGroupPanel47(PanelGroup pg) { + this.groupPanel47 = pg; + } + + private StaticText staticText147 = new StaticText(); + + public StaticText getStaticText147() { + return staticText147; + } + + public void setStaticText147(StaticText st) { + this.staticText147 = st; + } + + private Checkbox chkImgMa4 = new Checkbox(); + + public Checkbox getChkImgMa4() { + return chkImgMa4; + } + + public void setChkImgMa4(Checkbox c) { + this.chkImgMa4 = c; + } + + private ImageComponent image25 = new ImageComponent(); + + public ImageComponent getImage25() { + return image25; + } + + public void setImage25(ImageComponent ic) { + this.image25 = ic; + } + + private ImageComponent image26 = new ImageComponent(); + + public ImageComponent getImage26() { + return image26; + } + + public void setImage26(ImageComponent ic) { + this.image26 = ic; + } + + private PanelGroup groupPanel48 = new PanelGroup(); + + public PanelGroup getGroupPanel48() { + return groupPanel48; + } + + public void setGroupPanel48(PanelGroup pg) { + this.groupPanel48 = pg; + } + + private StaticText staticText148 = new StaticText(); + + public StaticText getStaticText148() { + return staticText148; + } + + public void setStaticText148(StaticText st) { + this.staticText148 = st; + } + + private Checkbox chkImgMa7 = new Checkbox(); + + public Checkbox getChkImgMa7() { + return chkImgMa7; + } + + public void setChkImgMa7(Checkbox c) { + this.chkImgMa7 = c; + } + + private PanelGroup groupPanel49 = new PanelGroup(); + + public PanelGroup getGroupPanel49() { + return groupPanel49; + } + + public void setGroupPanel49(PanelGroup pg) { + this.groupPanel49 = pg; + } + + private StaticText staticText149 = new StaticText(); + + public StaticText getStaticText149() { + return staticText149; + } + + public void setStaticText149(StaticText st) { + this.staticText149 = st; + } + + private Checkbox chkImgMa9 = new Checkbox(); + + public Checkbox getChkImgMa9() { + return chkImgMa9; + } + + public void setChkImgMa9(Checkbox c) { + this.chkImgMa9 = c; + } + + private HtmlPanelGrid gridMedicoView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridMedicoView() { + return gridMedicoView; + } + + public void setGridMedicoView(HtmlPanelGrid hpg) { + this.gridMedicoView = hpg; + } + + private HtmlPanelGrid gridPanel85 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel85() { + return gridPanel85; + } + + public void setGridPanel85(HtmlPanelGrid hpg) { + this.gridPanel85 = hpg; + } + + private StaticText staticText150 = new StaticText(); + + public StaticText getStaticText150() { + return staticText150; + } + + public void setStaticText150(StaticText st) { + this.staticText150 = st; + } + + private HtmlPanelGrid gridLesao = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLesao() { + return gridLesao; + } + + public void setGridLesao(HtmlPanelGrid hpg) { + this.gridLesao = hpg; + } + + private StaticText staticText151 = new StaticText(); + + public StaticText getStaticText151() { + return staticText151; + } + + public void setStaticText151(StaticText st) { + this.staticText151 = st; + } + + private HtmlPanelGrid gridPanel86 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel86() { + return gridPanel86; + } + + public void setGridPanel86(HtmlPanelGrid hpg) { + this.gridPanel86 = hpg; + } + + private StaticText staticText152 = new StaticText(); + + public StaticText getStaticText152() { + return staticText152; + } + + public void setStaticText152(StaticText st) { + this.staticText152 = st; + } + + private HtmlPanelGrid gridIncapacidade2 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridIncapacidade2() { + return gridIncapacidade2; + } + + public void setGridIncapacidade2(HtmlPanelGrid hpg) { + this.gridIncapacidade2 = hpg; + } + + private HtmlPanelGrid gridPanel87 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel87() { + return gridPanel87; + } + + public void setGridPanel87(HtmlPanelGrid hpg) { + this.gridPanel87 = hpg; + } + + private StaticText staticText153 = new StaticText(); + + public StaticText getStaticText153() { + return staticText153; + } + + public void setStaticText153(StaticText st) { + this.staticText153 = st; + } + + private HtmlPanelGrid gridRestricoes1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridRestricoes1() { + return gridRestricoes1; + } + + public void setGridRestricoes1(HtmlPanelGrid hpg) { + this.gridRestricoes1 = hpg; + } + + private HtmlPanelGrid gridPanel88 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel88() { + return gridPanel88; + } + + public void setGridPanel88(HtmlPanelGrid hpg) { + this.gridPanel88 = hpg; + } + + private HtmlPanelGrid gridImagesRestricoes = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridImagesRestricoes() { + return gridImagesRestricoes; + } + + public void setGridImagesRestricoes(HtmlPanelGrid hpg) { + this.gridImagesRestricoes = hpg; + } + + private HtmlPanelGrid gridOutrasRestricoes = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridOutrasRestricoes() { + return gridOutrasRestricoes; + } + + public void setGridOutrasRestricoes(HtmlPanelGrid hpg) { + this.gridOutrasRestricoes = hpg; + } + + private StaticText staticText154 = new StaticText(); + + public StaticText getStaticText154() { + return staticText154; + } + + public void setStaticText154(StaticText st) { + this.staticText154 = st; + } + + private HtmlPanelGrid gridPanel90 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel90() { + return gridPanel90; + } + + public void setGridPanel90(HtmlPanelGrid hpg) { + this.gridPanel90 = hpg; + } + + private StaticText staticText155 = new StaticText(); + + public StaticText getStaticText155() { + return staticText155; + } + + public void setStaticText155(StaticText st) { + this.staticText155 = st; + } + + private StaticText stObservacoes = new StaticText(); + + public StaticText getStObservacoes() { + return stObservacoes; + } + + public void setStObservacoes(StaticText st) { + this.stObservacoes = st; + } + + private HtmlPanelGrid gridHeader1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridHeader1() { + return gridHeader1; + } + + public void setGridHeader1(HtmlPanelGrid hpg) { + this.gridHeader1 = hpg; + } + + private HtmlPanelGrid gridPanel114 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel114() { + return gridPanel114; + } + + public void setGridPanel114(HtmlPanelGrid hpg) { + this.gridPanel114 = hpg; + } + + private PanelGroup groupPanel57 = new PanelGroup(); + + public PanelGroup getGroupPanel57() { + return groupPanel57; + } + + public void setGroupPanel57(PanelGroup pg) { + this.groupPanel57 = pg; + } + + private ImageComponent image27 = new ImageComponent(); + + public ImageComponent getImage27() { + return image27; + } + + public void setImage27(ImageComponent ic) { + this.image27 = ic; + } + + private HtmlPanelGrid gridPanel115 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel115() { + return gridPanel115; + } + + public void setGridPanel115(HtmlPanelGrid hpg) { + this.gridPanel115 = hpg; + } + + private StaticText staticText168 = new StaticText(); + + public StaticText getStaticText168() { + return staticText168; + } + + public void setStaticText168(StaticText st) { + this.staticText168 = st; + } + + private HtmlPanelGrid gridPanel116 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel116() { + return gridPanel116; + } + + public void setGridPanel116(HtmlPanelGrid hpg) { + this.gridPanel116 = hpg; + } + + private PanelGroup groupPanel58 = new PanelGroup(); + + public PanelGroup getGroupPanel58() { + return groupPanel58; + } + + public void setGroupPanel58(PanelGroup pg) { + this.groupPanel58 = pg; + } + + private StaticText staticText169 = new StaticText(); + + public StaticText getStaticText169() { + return staticText169; + } + + public void setStaticText169(StaticText st) { + this.staticText169 = st; + } + + private StaticText stHeaderNr = new StaticText(); + + public StaticText getStHeaderNr() { + return stHeaderNr; + } + + public void setStHeaderNr(StaticText st) { + this.stHeaderNr = st; + } + + private PanelGroup groupPanel59 = new PanelGroup(); + + public PanelGroup getGroupPanel59() { + return groupPanel59; + } + + public void setGroupPanel59(PanelGroup pg) { + this.groupPanel59 = pg; + } + + private StaticText staticText170 = new StaticText(); + + public StaticText getStaticText170() { + return staticText170; + } + + public void setStaticText170(StaticText st) { + this.staticText170 = st; + } + + private StaticText stHeaderDate = new StaticText(); + + public StaticText getStHeaderDate() { + return stHeaderDate; + } + + public void setStHeaderDate(StaticText st) { + this.stHeaderDate = st; + } + + private ImageComponent image28 = new ImageComponent(); + + public ImageComponent getImage28() { + return image28; + } + + public void setImage28(ImageComponent ic) { + this.image28 = ic; + } + + private PanelGroup groupPanel1 = new PanelGroup(); + + public PanelGroup getGroupPanel1() { + return groupPanel1; + } + + public void setGroupPanel1(PanelGroup pg) { + this.groupPanel1 = pg; + } + + private RadioButton rbTurnoManha = new RadioButton(); + + public RadioButton getRbTurnoManha() { + return rbTurnoManha; + } + + public void setRbTurnoManha(RadioButton rb) { + this.rbTurnoManha = rb; + } + + 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 RadioButton rbTurnoTarde = new RadioButton(); + + public RadioButton getRbTurnoTarde() { + return rbTurnoTarde; + } + + public void setRbTurnoTarde(RadioButton rb) { + this.rbTurnoTarde = rb; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private StaticText staticText41 = new StaticText(); + + public StaticText getStaticText41() { + return staticText41; + } + + public void setStaticText41(StaticText st) { + this.staticText41 = st; + } + + private RadioButton rbTurnoNoite = new RadioButton(); + + public RadioButton getRbTurnoNoite() { + return rbTurnoNoite; + } + + public void setRbTurnoNoite(RadioButton rb) { + this.rbTurnoNoite = rb; + } + + private StaticText staticText42 = new StaticText(); + + public StaticText getStaticText42() { + return staticText42; + } + + public void setStaticText42(StaticText st) { + this.staticText42 = st; + } + + private HiddenField hidDisableEnviar = new HiddenField(); + + public HiddenField getHidDisableEnviar() { + return hidDisableEnviar; + } + + public void setHidDisableEnviar(HiddenField hf) { + this.hidDisableEnviar = hf; + } + + private PanelGroup groupPanel2 = new PanelGroup(); + + public PanelGroup getGroupPanel2() { + return groupPanel2; + } + + public void setGroupPanel2(PanelGroup pg) { + this.groupPanel2 = pg; + } + + private StaticText staticText43 = new StaticText(); + + public StaticText getStaticText43() { + return staticText43; + } + + public void setStaticText43(StaticText st) { + this.staticText43 = st; + } + + private TextField txtNrMecanografico = new TextField(); + + public TextField getTxtNrMecanografico() { + return txtNrMecanografico; + } + + public void setTxtNrMecanografico(TextField tf) { + this.txtNrMecanografico = tf; + } + + private StaticText staticText44 = new StaticText(); + + public StaticText getStaticText44() { + return staticText44; + } + + public void setStaticText44(StaticText st) { + this.staticText44 = st; + } + + private TextField txtNomeTrabalhador = new TextField(); + + public TextField getTxtNomeTrabalhador() { + return txtNomeTrabalhador; + } + + public void setTxtNomeTrabalhador(TextField tf) { + this.txtNomeTrabalhador = tf; + } + + private StaticText staticText45 = new StaticText(); + + public StaticText getStaticText45() { + return staticText45; + } + + public void setStaticText45(StaticText st) { + this.staticText45 = st; + } + + private Button butProcurarTrab = new Button(); + + public Button getButProcurarTrab() { + return butProcurarTrab; + } + + public void setButProcurarTrab(Button b) { + this.butProcurarTrab = b; + } + + private Table tblTrabalhadores = new Table(); + + public Table getTblTrabalhadores() { + return tblTrabalhadores; + } + + public void setTblTrabalhadores(Table t) { + this.tblTrabalhadores = 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 DefaultTableDataProvider defaultTableDataProvider = new DefaultTableDataProvider(); + + public DefaultTableDataProvider getDefaultTableDataProvider() { + return defaultTableDataProvider; + } + + public void setDefaultTableDataProvider(DefaultTableDataProvider dtdp) { + this.defaultTableDataProvider = dtdp; + } + + private Hyperlink lnkPOR = new Hyperlink(); + + public Hyperlink getLnkPOR() { + return lnkPOR; + } + + public void setLnkPOR(Hyperlink h) { + this.lnkPOR = h; + } + + private Hyperlink lnkNomeTrabalhador = new Hyperlink(); + + public Hyperlink getLnkNomeTrabalhador() { + return lnkNomeTrabalhador; + } + + public void setLnkNomeTrabalhador(Hyperlink h) { + this.lnkNomeTrabalhador = h; + } + + private Hyperlink lnkEstabelecimentoTrabalhador = new Hyperlink(); + + public Hyperlink getLnkEstabelecimentoTrabalhador() { + return lnkEstabelecimentoTrabalhador; + } + + public void setLnkEstabelecimentoTrabalhador(Hyperlink h) { + this.lnkEstabelecimentoTrabalhador = h; + } + + private StaticText stTecnicoNomeEdit = new StaticText(); + + public StaticText getStTecnicoNomeEdit() { + return stTecnicoNomeEdit; + } + + public void setStTecnicoNomeEdit(StaticText st) { + this.stTecnicoNomeEdit = st; + } + + private HtmlPanelGrid gridDadosAcidenteSegView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridDadosAcidenteSegView() { + return gridDadosAcidenteSegView; + } + + public void setGridDadosAcidenteSegView(HtmlPanelGrid hpg) { + this.gridDadosAcidenteSegView = hpg; + } + + private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel1() { + return gridPanel1; + } + + public void setGridPanel1(HtmlPanelGrid hpg) { + this.gridPanel1 = hpg; + } + + private StaticText staticText95 = new StaticText(); + + public StaticText getStaticText95() { + return staticText95; + } + + public void setStaticText95(StaticText st) { + this.staticText95 = st; + } + + private HtmlPanelGrid gridPanel117 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel117() { + return gridPanel117; + } + + public void setGridPanel117(HtmlPanelGrid hpg) { + this.gridPanel117 = hpg; + } + + private HtmlPanelGrid gridTurnoSeccaoLocal = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridTurnoSeccaoLocal() { + return gridTurnoSeccaoLocal; + } + + public void setGridTurnoSeccaoLocal(HtmlPanelGrid hpg) { + this.gridTurnoSeccaoLocal = hpg; + } + + private StaticText lblHorasTurno = new StaticText(); + + public StaticText getLblHorasTurno() { + return lblHorasTurno; + } + + public void setLblHorasTurno(StaticText st) { + this.lblHorasTurno = st; + } + + private StaticText txtHorasTurno2 = new StaticText(); + + public StaticText getTxtHorasTurno2() { + return txtHorasTurno2; + } + + public void setTxtHorasTurno2(StaticText st) { + this.txtHorasTurno2 = st; + } + + private StaticText lblSeccao = new StaticText(); + + public StaticText getLblSeccao() { + return lblSeccao; + } + + public void setLblSeccao(StaticText st) { + this.lblSeccao = st; + } + + private StaticText txtSeccao1 = new StaticText(); + + public StaticText getTxtSeccao1() { + return txtSeccao1; + } + + public void setTxtSeccao1(StaticText st) { + this.txtSeccao1 = st; + } + + private StaticText lblLocal = new StaticText(); + + public StaticText getLblLocal() { + return lblLocal; + } + + public void setLblLocal(StaticText st) { + this.lblLocal = st; + } + + private StaticText txtLocal1 = new StaticText(); + + public StaticText getTxtLocal1() { + return txtLocal1; + } + + public void setTxtLocal1(StaticText st) { + this.txtLocal1 = st; + } + + private HtmlPanelGrid gridTarefa = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridTarefa() { + return gridTarefa; + } + + public void setGridTarefa(HtmlPanelGrid hpg) { + this.gridTarefa = hpg; + } + + private StaticText lblTarefa = new StaticText(); + + public StaticText getLblTarefa() { + return lblTarefa; + } + + public void setLblTarefa(StaticText st) { + this.lblTarefa = st; + } + + private StaticText txtTarefa1 = new StaticText(); + + public StaticText getTxtTarefa1() { + return txtTarefa1; + } + + public void setTxtTarefa1(StaticText st) { + this.txtTarefa1 = st; + } + + private HtmlPanelGrid gridSubstancias = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridSubstancias() { + return gridSubstancias; + } + + public void setGridSubstancias(HtmlPanelGrid hpg) { + this.gridSubstancias = hpg; + } + + private StaticText lblSubstancias = new StaticText(); + + public StaticText getLblSubstancias() { + return lblSubstancias; + } + + public void setLblSubstancias(StaticText st) { + this.lblSubstancias = st; + } + + private StaticText txtSubstancias1 = new StaticText(); + + public StaticText getTxtSubstancias1() { + return txtSubstancias1; + } + + public void setTxtSubstancias1(StaticText st) { + this.txtSubstancias1 = st; + } + + private HtmlPanelGrid gridCondicoes = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridCondicoes() { + return gridCondicoes; + } + + public void setGridCondicoes(HtmlPanelGrid hpg) { + this.gridCondicoes = hpg; + } + + private StaticText lblCondicoes = new StaticText(); + + public StaticText getLblCondicoes() { + return lblCondicoes; + } + + public void setLblCondicoes(StaticText st) { + this.lblCondicoes = st; + } + + private StaticText txtCondicoes1 = new StaticText(); + + public StaticText getTxtCondicoes1() { + return txtCondicoes1; + } + + public void setTxtCondicoes1(StaticText st) { + this.txtCondicoes1 = st; + } + + private HtmlPanelGrid gridTestemunhas = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridTestemunhas() { + return gridTestemunhas; + } + + public void setGridTestemunhas(HtmlPanelGrid hpg) { + this.gridTestemunhas = hpg; + } + + private StaticText lblTestemunhas = new StaticText(); + + public StaticText getLblTestemunhas() { + return lblTestemunhas; + } + + public void setLblTestemunhas(StaticText st) { + this.lblTestemunhas = st; + } + + private StaticText txtTestemunhas1 = new StaticText(); + + public StaticText getTxtTestemunhas1() { + return txtTestemunhas1; + } + + public void setTxtTestemunhas1(StaticText st) { + this.txtTestemunhas1 = st; + } + + private HtmlPanelGrid gridCausas = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridCausas() { + return gridCausas; + } + + public void setGridCausas(HtmlPanelGrid hpg) { + this.gridCausas = hpg; + } + + private StaticText lblCausas = new StaticText(); + + public StaticText getLblCausas() { + return lblCausas; + } + + public void setLblCausas(StaticText st) { + this.lblCausas = st; + } + + private StaticText txtCausas1 = new StaticText(); + + public StaticText getTxtCausas1() { + return txtCausas1; + } + + public void setTxtCausas1(StaticText st) { + this.txtCausas1 = st; + } + + private HtmlPanelGrid gridDescricao = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridDescricao() { + return gridDescricao; + } + + public void setGridDescricao(HtmlPanelGrid hpg) { + this.gridDescricao = hpg; + } + + private StaticText lblDescricao = new StaticText(); + + public StaticText getLblDescricao() { + return lblDescricao; + } + + public void setLblDescricao(StaticText st) { + this.lblDescricao = st; + } + + private StaticText txtDescricao1 = new StaticText(); + + public StaticText getTxtDescricao1() { + return txtDescricao1; + } + + public void setTxtDescricao1(StaticText st) { + this.txtDescricao1 = st; + } + + private HtmlPanelGrid gridFotografias = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridFotografias() { + return gridFotografias; + } + + public void setGridFotografias(HtmlPanelGrid hpg) { + this.gridFotografias = hpg; + } + + private HtmlPanelGrid gridPanel127 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel127() { + return gridPanel127; + } + + public void setGridPanel127(HtmlPanelGrid hpg) { + this.gridPanel127 = hpg; + } + + private StaticText lblFotografias = new StaticText(); + + public StaticText getLblFotografias() { + return lblFotografias; + } + + public void setLblFotografias(StaticText st) { + this.lblFotografias = st; + } + + private HtmlPanelGrid gridImages1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridImages1() { + return gridImages1; + } + + public void setGridImages1(HtmlPanelGrid hpg) { + this.gridImages1 = hpg; + } + + private HtmlPanelGrid gridConclusoes = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridConclusoes() { + return gridConclusoes; + } + + public void setGridConclusoes(HtmlPanelGrid hpg) { + this.gridConclusoes = hpg; + } + + private StaticText lblConclusoes = new StaticText(); + + public StaticText getLblConclusoes() { + return lblConclusoes; + } + + public void setLblConclusoes(StaticText st) { + this.lblConclusoes = st; + } + + private StaticText txtConclusoes1 = new StaticText(); + + public StaticText getTxtConclusoes1() { + return txtConclusoes1; + } + + public void setTxtConclusoes1(StaticText st) { + this.txtConclusoes1 = st; + } + + private HtmlPanelGrid gridAccoes = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridAccoes() { + return gridAccoes; + } + + public void setGridAccoes(HtmlPanelGrid hpg) { + this.gridAccoes = hpg; + } + + private StaticText lblAccoes = new StaticText(); + + public StaticText getLblAccoes() { + return lblAccoes; + } + + public void setLblAccoes(StaticText st) { + this.lblAccoes = st; + } + + private StaticText txtAccoes1 = new StaticText(); + + public StaticText getTxtAccoes1() { + return txtAccoes1; + } + + public void setTxtAccoes1(StaticText st) { + this.txtAccoes1 = st; + } + + private HtmlPanelGrid gridDataHora = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridDataHora() { + return gridDataHora; + } + + public void setGridDataHora(HtmlPanelGrid hpg) { + this.gridDataHora = hpg; + } + + private PanelGroup groupPanel7 = new PanelGroup(); + + public PanelGroup getGroupPanel7() { + return groupPanel7; + } + + public void setGroupPanel7(PanelGroup pg) { + this.groupPanel7 = pg; + } + + private StaticText lblDataAcidente = new StaticText(); + + public StaticText getLblDataAcidente() { + return lblDataAcidente; + } + + public void setLblDataAcidente(StaticText st) { + this.lblDataAcidente = st; + } + + private StaticText stDataAcidente1 = new StaticText(); + + public StaticText getStDataAcidente1() { + return stDataAcidente1; + } + + public void setStDataAcidente1(StaticText st) { + this.stDataAcidente1 = st; + } + + private PanelGroup groupPanel60 = new PanelGroup(); + + public PanelGroup getGroupPanel60() { + return groupPanel60; + } + + public void setGroupPanel60(PanelGroup pg) { + this.groupPanel60 = pg; + } + + private StaticText lblHoraAcidente = new StaticText(); + + public StaticText getLblHoraAcidente() { + return lblHoraAcidente; + } + + public void setLblHoraAcidente(StaticText st) { + this.lblHoraAcidente = st; + } + + private StaticText stHoraAcidente1 = new StaticText(); + + public StaticText getStHoraAcidente1() { + return stHoraAcidente1; + } + + public void setStHoraAcidente1(StaticText st) { + this.stHoraAcidente1 = st; + } + + private HtmlPanelGrid gridVerificacao = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridVerificacao() { + return gridVerificacao; + } + + public void setGridVerificacao(HtmlPanelGrid hpg) { + this.gridVerificacao = hpg; + } + + private HtmlPanelGrid gridPanel131 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel131() { + return gridPanel131; + } + + public void setGridPanel131(HtmlPanelGrid hpg) { + this.gridPanel131 = hpg; + } + + private StaticText staticText52 = new StaticText(); + + public StaticText getStaticText52() { + return staticText52; + } + + public void setStaticText52(StaticText st) { + this.staticText52 = st; + } + + private HtmlPanelGrid gridPanel132 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel132() { + return gridPanel132; + } + + public void setGridPanel132(HtmlPanelGrid hpg) { + this.gridPanel132 = hpg; + } + + private HtmlPanelGrid gridPanel133 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel133() { + return gridPanel133; + } + + public void setGridPanel133(HtmlPanelGrid hpg) { + this.gridPanel133 = hpg; + } + + private PanelGroup grpVerHs = new PanelGroup(); + + public PanelGroup getGrpVerHs() { + return grpVerHs; + } + + public void setGrpVerHs(PanelGroup pg) { + this.grpVerHs = pg; + } + + private Checkbox chkVerHs = new Checkbox(); + + public Checkbox getChkVerHs() { + return chkVerHs; + } + + public void setChkVerHs(Checkbox c) { + this.chkVerHs = c; + } + + private StaticText stVerHs = new StaticText(); + + public StaticText getStVerHs() { + return stVerHs; + } + + public void setStVerHs(StaticText st) { + this.stVerHs = st; + } + + private PanelGroup grpVerRespSeg = new PanelGroup(); + + public PanelGroup getGrpVerRespSeg() { + return grpVerRespSeg; + } + + public void setGrpVerRespSeg(PanelGroup pg) { + this.grpVerRespSeg = pg; + } + + private Checkbox chkVerRespSeg = new Checkbox(); + + public Checkbox getChkVerRespSeg() { + return chkVerRespSeg; + } + + public void setChkVerRespSeg(Checkbox c) { + this.chkVerRespSeg = c; + } + + private StaticText stVerRespSeg = new StaticText(); + + public StaticText getStVerRespSeg() { + return stVerRespSeg; + } + + public void setStVerRespSeg(StaticText st) { + this.stVerRespSeg = st; + } + + private PanelGroup grpVerRespRh = new PanelGroup(); + + public PanelGroup getGrpVerRespRh() { + return grpVerRespRh; + } + + public void setGrpVerRespRh(PanelGroup pg) { + this.grpVerRespRh = pg; + } + + private Checkbox chkVerRespRh = new Checkbox(); + + public Checkbox getChkVerRespRh() { + return chkVerRespRh; + } + + public void setChkVerRespRh(Checkbox c) { + this.chkVerRespRh = c; + } + + private StaticText stVerRespRh = new StaticText(); + + public StaticText getStVerRespRh() { + return stVerRespRh; + } + + public void setStVerRespRh(StaticText st) { + this.stVerRespRh = st; + } + + private HtmlPanelGrid gridVerificacaoView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridVerificacaoView() { + return gridVerificacaoView; + } + + public void setGridVerificacaoView(HtmlPanelGrid hpg) { + this.gridVerificacaoView = hpg; + } + + private HtmlPanelGrid gridPanel134 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel134() { + return gridPanel134; + } + + public void setGridPanel134(HtmlPanelGrid hpg) { + this.gridPanel134 = hpg; + } + + private StaticText staticText187 = new StaticText(); + + public StaticText getStaticText187() { + return staticText187; + } + + public void setStaticText187(StaticText st) { + this.staticText187 = st; + } + + private HtmlPanelGrid gridPanel135 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel135() { + return gridPanel135; + } + + public void setGridPanel135(HtmlPanelGrid hpg) { + this.gridPanel135 = hpg; + } + + private HtmlPanelGrid gridAssinaturasView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridAssinaturasView() { + return gridAssinaturasView; + } + + public void setGridAssinaturasView(HtmlPanelGrid hpg) { + this.gridAssinaturasView = hpg; + } + + private DropDown drpCausas = new DropDown(); + + public DropDown getDrpCausas() { + return drpCausas; + } + + public void setDrpCausas(DropDown dd) { + this.drpCausas = dd; + } + + private StaticText stObservacoesCorr = new StaticText(); + + public StaticText getStObservacoesCorr() { + return stObservacoesCorr; + } + + public void setStObservacoesCorr(StaticText st) { + this.stObservacoesCorr = st; + } + + private HtmlPanelGrid gridImpressao = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridImpressao() { + return gridImpressao; + } + + public void setGridImpressao(HtmlPanelGrid hpg) { + this.gridImpressao = hpg; + } + + private HtmlPanelGrid gridPanel89 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel89() { + return gridPanel89; + } + + public void setGridPanel89(HtmlPanelGrid hpg) { + this.gridPanel89 = hpg; + } + + private StaticText staticText73 = new StaticText(); + + public StaticText getStaticText73() { + return staticText73; + } + + public void setStaticText73(StaticText st) { + this.staticText73 = st; + } + + private HtmlPanelGrid gridPanel91 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel91() { + return gridPanel91; + } + + public void setGridPanel91(HtmlPanelGrid hpg) { + this.gridPanel91 = hpg; + } + + private HtmlPanelGrid gridPanel92 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel92() { + return gridPanel92; + } + + public void setGridPanel92(HtmlPanelGrid hpg) { + this.gridPanel92 = hpg; + } + + private PanelGroup grpAssSup = new PanelGroup(); + + public PanelGroup getGrpAssSup() { + return grpAssSup; + } + + public void setGrpAssSup(PanelGroup pg) { + this.grpAssSup = pg; + } + + private Checkbox chkAssSup = new Checkbox(); + + public Checkbox getChkAssSup() { + return chkAssSup; + } + + public void setChkAssSup(Checkbox c) { + this.chkAssSup = c; + } + + private StaticText stAssSup1 = new StaticText(); + + public StaticText getStAssSup1() { + return stAssSup1; + } + + public void setStAssSup1(StaticText st) { + this.stAssSup1 = st; + } + + private HtmlPanelGrid gridImpressaoView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridImpressaoView() { + return gridImpressaoView; + } + + public void setGridImpressaoView(HtmlPanelGrid hpg) { + this.gridImpressaoView = hpg; + } + + private HtmlPanelGrid gridPanel93 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel93() { + return gridPanel93; + } + + public void setGridPanel93(HtmlPanelGrid hpg) { + this.gridPanel93 = hpg; + } + + private StaticText staticText76 = new StaticText(); + + public StaticText getStaticText76() { + return staticText76; + } + + public void setStaticText76(StaticText st) { + this.staticText76 = st; + } + + private HtmlPanelGrid gridPanel94 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel94() { + return gridPanel94; + } + + public void setGridPanel94(HtmlPanelGrid hpg) { + this.gridPanel94 = hpg; + } + + private HtmlPanelGrid gridAssSupView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridAssSupView() { + return gridAssSupView; + } + + public void setGridAssSupView(HtmlPanelGrid hpg) { + this.gridAssSupView = hpg; + } + + 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 PanelGroup groupPanel5 = new PanelGroup(); + + public PanelGroup getGroupPanel5() { + return groupPanel5; + } + + public void setGroupPanel5(PanelGroup pg) { + this.groupPanel5 = pg; + } + + private Button butImprimir = new Button(); + + public Button getButImprimir() { + return butImprimir; + } + + public void setButImprimir(Button b) { + this.butImprimir = b; + } + + private Button butGravar = new Button(); + + public Button getButGravar() { + return butGravar; + } + + public void setButGravar(Button b) { + this.butGravar = b; + } + + private Button butCorrecao = new Button(); + + public Button getButCorrecao() { + return butCorrecao; + } + + public void setButCorrecao(Button b) { + this.butCorrecao = b; + } + + private Button butEnviar = new Button(); + + public Button getButEnviar() { + return butEnviar; + } + + public void setButEnviar(Button b) { + this.butEnviar = b; + } + + private TextField txtAssSup = new TextField(); + + public TextField getTxtAssSup() { + return txtAssSup; + } + + public void setTxtAssSup(TextField tf) { + this.txtAssSup = tf; + } + + private StaticText stAssSup2 = new StaticText(); + + public StaticText getStAssSup2() { + return stAssSup2; + } + + public void setStAssSup2(StaticText st) { + this.stAssSup2 = st; + } + + private HtmlPanelGrid gridPanel95 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel95() { + return gridPanel95; + } + + public void setGridPanel95(HtmlPanelGrid hpg) { + this.gridPanel95 = hpg; + } + + private PanelGroup groupPanel50 = new PanelGroup(); + + public PanelGroup getGroupPanel50() { + return groupPanel50; + } + + public void setGroupPanel50(PanelGroup pg) { + this.groupPanel50 = pg; + } + + private StaticText staticText98 = new StaticText(); + + public StaticText getStaticText98() { + return staticText98; + } + + public void setStaticText98(StaticText st) { + this.staticText98 = st; + } + + private TextField txtAveriguador = new TextField(); + + public TextField getTxtAveriguador() { + return txtAveriguador; + } + + public void setTxtAveriguador(TextField tf) { + this.txtAveriguador = tf; + } + + private HtmlPanelGrid gridPanel96 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel96() { + return gridPanel96; + } + + public void setGridPanel96(HtmlPanelGrid hpg) { + this.gridPanel96 = hpg; + } + + private PanelGroup groupPanel51 = new PanelGroup(); + + public PanelGroup getGroupPanel51() { + return groupPanel51; + } + + public void setGroupPanel51(PanelGroup pg) { + this.groupPanel51 = pg; + } + + private StaticText staticText101 = new StaticText(); + + public StaticText getStaticText101() { + return staticText101; + } + + public void setStaticText101(StaticText st) { + this.staticText101 = st; + } + + private StaticText stAveriguador = new StaticText(); + + public StaticText getStAveriguador() { + return stAveriguador; + } + + public void setStAveriguador(StaticText st) { + this.stAveriguador = st; + } + + private HtmlPanelGrid gridPanel97 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel97() { + return gridPanel97; + } + + public void setGridPanel97(HtmlPanelGrid hpg) { + this.gridPanel97 = hpg; + } + + private PanelGroup groupPanel52 = new PanelGroup(); + + public PanelGroup getGroupPanel52() { + return groupPanel52; + } + + public void setGroupPanel52(PanelGroup pg) { + this.groupPanel52 = pg; + } + + private Checkbox chkAveriguacaoPosterior = new Checkbox(); + + public Checkbox getChkAveriguacaoPosterior() { + return chkAveriguacaoPosterior; + } + + public void setChkAveriguacaoPosterior(Checkbox c) { + this.chkAveriguacaoPosterior = c; + } + + private StaticText staticText132 = new StaticText(); + + public StaticText getStaticText132() { + return staticText132; + } + + public void setStaticText132(StaticText st) { + this.staticText132 = st; + } + + private HtmlPanelGrid gridPanel98 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel98() { + return gridPanel98; + } + + public void setGridPanel98(HtmlPanelGrid hpg) { + this.gridPanel98 = hpg; + } + + private StaticText staticText104 = new StaticText(); + + public StaticText getStaticText104() { + return staticText104; + } + + public void setStaticText104(StaticText st) { + this.staticText104 = st; + } + + private HtmlPanelGrid gridPanel99 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel99() { + return gridPanel99; + } + + public void setGridPanel99(HtmlPanelGrid hpg) { + this.gridPanel99 = hpg; + } + + private StaticText staticText131 = new StaticText(); + + public StaticText getStaticText131() { + return staticText131; + } + + public void setStaticText131(StaticText st) { + this.staticText131 = st; + } + + private TextArea txtAveriguacaoObs = new TextArea(); + + public TextArea getTxtAveriguacaoObs() { + return txtAveriguacaoObs; + } + + public void setTxtAveriguacaoObs(TextArea ta) { + this.txtAveriguacaoObs = ta; + } + + private HtmlPanelGrid gridAveriguacaoPosterior = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridAveriguacaoPosterior() { + return gridAveriguacaoPosterior; + } + + public void setGridAveriguacaoPosterior(HtmlPanelGrid hpg) { + this.gridAveriguacaoPosterior = hpg; + } + + private StaticText lblAveriguacaoPosterior = new StaticText(); + + public StaticText getLblAveriguacaoPosterior() { + return lblAveriguacaoPosterior; + } + + public void setLblAveriguacaoPosterior(StaticText st) { + this.lblAveriguacaoPosterior = st; + } + + private StaticText txtAveriguacaoPosterior = new StaticText(); + + public StaticText getTxtAveriguacaoPosterior() { + return txtAveriguacaoPosterior; + } + + public void setTxtAveriguacaoPosterior(StaticText st) { + this.txtAveriguacaoPosterior = st; + } + + private HtmlPanelGrid gridAveriguacaoPosterior1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridAveriguacaoPosterior1() { + return gridAveriguacaoPosterior1; + } + + public void setGridAveriguacaoPosterior1(HtmlPanelGrid hpg) { + this.gridAveriguacaoPosterior1 = hpg; + } + + private HtmlPanelGrid gridPanel101 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel101() { + return gridPanel101; + } + + public void setGridPanel101(HtmlPanelGrid hpg) { + this.gridPanel101 = hpg; + } + + private StaticText staticText134 = new StaticText(); + + public StaticText getStaticText134() { + return staticText134; + } + + public void setStaticText134(StaticText st) { + this.staticText134 = st; + } + + private HtmlPanelGrid gridPanel102 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel102() { + return gridPanel102; + } + + public void setGridPanel102(HtmlPanelGrid hpg) { + this.gridPanel102 = hpg; + } + + private StaticText staticText135 = new StaticText(); + + public StaticText getStaticText135() { + return staticText135; + } + + public void setStaticText135(StaticText st) { + this.staticText135 = st; + } + + private TextArea txtAveriguacaoObs1 = new TextArea(); + + public TextArea getTxtAveriguacaoObs1() { + return txtAveriguacaoObs1; + } + + public void setTxtAveriguacaoObs1(TextArea ta) { + this.txtAveriguacaoObs1 = ta; + } + + private StaticText staticText130 = new StaticText(); + + public StaticText getStaticText130() { + return staticText130; + } + + public void setStaticText130(StaticText st) { + this.staticText130 = st; + } + + private StaticText stEstabelecimentoOrigem = new StaticText(); + + public StaticText getStEstabelecimentoOrigem() { + return stEstabelecimentoOrigem; + } + + public void setStEstabelecimentoOrigem(StaticText st) { + this.stEstabelecimentoOrigem = st; + } + + private HtmlPanelGrid gridPanel100 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel100() { + return gridPanel100; + } + + public void setGridPanel100(HtmlPanelGrid hpg) { + this.gridPanel100 = hpg; + } + + private StaticText staticText156 = new StaticText(); + + public StaticText getStaticText156() { + return staticText156; + } + + public void setStaticText156(StaticText st) { + this.staticText156 = st; + } + + private HtmlPanelGrid gridPanel103 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel103() { + return gridPanel103; + } + + public void setGridPanel103(HtmlPanelGrid hpg) { + this.gridPanel103 = hpg; + } + + private PanelGroup groupPanel53 = new PanelGroup(); + + public PanelGroup getGroupPanel53() { + return groupPanel53; + } + + public void setGroupPanel53(PanelGroup pg) { + this.groupPanel53 = pg; + } + + private StaticText staticText157 = new StaticText(); + + public StaticText getStaticText157() { + return staticText157; + } + + public void setStaticText157(StaticText st) { + this.staticText157 = st; + } + + private TextField txtNomeSuperior = new TextField(); + + public TextField getTxtNomeSuperior() { + return txtNomeSuperior; + } + + public void setTxtNomeSuperior(TextField tf) { + this.txtNomeSuperior = tf; + } + + private PanelGroup groupPanel54 = new PanelGroup(); + + public PanelGroup getGroupPanel54() { + return groupPanel54; + } + + public void setGroupPanel54(PanelGroup pg) { + this.groupPanel54 = pg; + } + + private StaticText staticText158 = new StaticText(); + + public StaticText getStaticText158() { + return staticText158; + } + + public void setStaticText158(StaticText st) { + this.staticText158 = st; + } + + private TextField txtEmailSuperior = new TextField(); + + public TextField getTxtEmailSuperior() { + return txtEmailSuperior; + } + + public void setTxtEmailSuperior(TextField tf) { + this.txtEmailSuperior = tf; + } + + private HtmlPanelGrid gridPanel104 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel104() { + return gridPanel104; + } + + public void setGridPanel104(HtmlPanelGrid hpg) { + this.gridPanel104 = hpg; + } + + private StaticText staticText159 = new StaticText(); + + public StaticText getStaticText159() { + return staticText159; + } + + public void setStaticText159(StaticText st) { + this.staticText159 = st; + } + + private HtmlPanelGrid gridPanel105 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel105() { + return gridPanel105; + } + + public void setGridPanel105(HtmlPanelGrid hpg) { + this.gridPanel105 = hpg; + } + + private PanelGroup groupPanel55 = new PanelGroup(); + + public PanelGroup getGroupPanel55() { + return groupPanel55; + } + + public void setGroupPanel55(PanelGroup pg) { + this.groupPanel55 = pg; + } + + private StaticText staticText160 = new StaticText(); + + public StaticText getStaticText160() { + return staticText160; + } + + public void setStaticText160(StaticText st) { + this.staticText160 = st; + } + + private StaticText stNomeSuperior = new StaticText(); + + public StaticText getStNomeSuperior() { + return stNomeSuperior; + } + + public void setStNomeSuperior(StaticText st) { + this.stNomeSuperior = st; + } + + private PanelGroup groupPanel61 = new PanelGroup(); + + public PanelGroup getGroupPanel61() { + return groupPanel61; + } + + public void setGroupPanel61(PanelGroup pg) { + this.groupPanel61 = pg; + } + + private StaticText staticText162 = new StaticText(); + + public StaticText getStaticText162() { + return staticText162; + } + + public void setStaticText162(StaticText st) { + this.staticText162 = st; + } + + private StaticText stEmailSuperior = new StaticText(); + + public StaticText getStEmailSuperior() { + return stEmailSuperior; + } + + public void setStEmailSuperior(StaticText st) { + this.stEmailSuperior = st; + } + + private HiddenField hidDisableImprimir = new HiddenField(); + + public HiddenField getHidDisableImprimir() { + return hidDisableImprimir; + } + + public void setHidDisableImprimir(HiddenField hf) { + this.hidDisableImprimir = hf; + } + + private DropDown drpSeccao = new DropDown(); + + public DropDown getDrpSeccao() { + return drpSeccao; + } + + public void setDrpSeccao(DropDown dd) { + this.drpSeccao = dd; + } + + private StaticText staticText163 = new StaticText(); + + public StaticText getStaticText163() { + return staticText163; + } + + public void setStaticText163(StaticText st) { + this.staticText163 = st; + } + + private DropDown drpDepartamento = new DropDown(); + + public DropDown getDrpDepartamento() { + return drpDepartamento; + } + + public void setDrpDepartamento(DropDown dd) { + this.drpDepartamento = dd; + } + + private HiddenField hidAnchor = new HiddenField(); + + public HiddenField getHidAnchor() { + return hidAnchor; + } + + public void setHidAnchor(HiddenField hf) { + this.hidAnchor = hf; + } + + private PanelGroup groupPanel62 = new PanelGroup(); + + public PanelGroup getGroupPanel62() { + return groupPanel62; + } + + public void setGroupPanel62(PanelGroup pg) { + this.groupPanel62 = pg; + } + + private StaticText staticText164 = new StaticText(); + + public StaticText getStaticText164() { + return staticText164; + } + + public void setStaticText164(StaticText st) { + this.staticText164 = st; + } + + private StaticText staticText167 = new StaticText(); + + public StaticText getStaticText167() { + return staticText167; + } + + public void setStaticText167(StaticText st) { + this.staticText167 = st; + } + + private PanelGroup groupPanel63 = new PanelGroup(); + + public PanelGroup getGroupPanel63() { + return groupPanel63; + } + + public void setGroupPanel63(PanelGroup pg) { + this.groupPanel63 = pg; + } + + private StaticText staticText171 = new StaticText(); + + public StaticText getStaticText171() { + return staticText171; + } + + public void setStaticText171(StaticText st) { + this.staticText171 = st; + } + + private StaticText stTecnicoNome = new StaticText(); + + public StaticText getStTecnicoNome() { + return stTecnicoNome; + } + + public void setStTecnicoNome(StaticText st) { + this.stTecnicoNome = st; + } + + private StaticText staticText172 = new StaticText(); + + public StaticText getStaticText172() { + return staticText172; + } + + public void setStaticText172(StaticText st) { + this.staticText172 = st; + } + + private StaticText staticText173 = new StaticText(); + + public StaticText getStaticText173() { + return staticText173; + } + + public void setStaticText173(StaticText st) { + this.staticText173 = st; + } + + private StaticText txtCap1 = new StaticText(); + + public StaticText getTxtCap1() { + return txtCap1; + } + + public void setTxtCap1(StaticText st) { + this.txtCap1 = st; + } + + private PanelGroup groupPanel64 = new PanelGroup(); + + public PanelGroup getGroupPanel64() { + return groupPanel64; + } + + public void setGroupPanel64(PanelGroup pg) { + this.groupPanel64 = pg; + } + + private StaticText staticText174 = new StaticText(); + + public StaticText getStaticText174() { + return staticText174; + } + + public void setStaticText174(StaticText st) { + this.staticText174 = st; + } + + private StaticText stMedicoNome = new StaticText(); + + public StaticText getStMedicoNome() { + return stMedicoNome; + } + + public void setStMedicoNome(StaticText st) { + this.stMedicoNome = st; + } + + private StaticText staticText175 = new StaticText(); + + public StaticText getStaticText175() { + return staticText175; + } + + public void setStaticText175(StaticText st) { + this.staticText175 = st; + } + + private StaticText staticText176 = new StaticText(); + + public StaticText getStaticText176() { + return staticText176; + } + + public void setStaticText176(StaticText st) { + this.staticText176 = st; + } + + private StaticText txtCedula1 = new StaticText(); + + public StaticText getTxtCedula1() { + return txtCedula1; + } + + public void setTxtCedula1(StaticText st) { + this.txtCedula1 = st; + } + + private HtmlPanelGrid gridPanel14 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel14() { + return gridPanel14; + } + + public void setGridPanel14(HtmlPanelGrid hpg) { + this.gridPanel14 = hpg; + } + + private StaticText staticText15 = new StaticText(); + + public StaticText getStaticText15() { + return staticText15; + } + + public void setStaticText15(StaticText st) { + this.staticText15 = st; + } + + private com.sun.rave.web.ui.component.Calendar calDataOcorrencia = new com.sun.rave.web.ui.component.Calendar(); + + public com.sun.rave.web.ui.component.Calendar getCalDataOcorrencia() { + return calDataOcorrencia; + } + + public void setCalDataOcorrencia(com.sun.rave.web.ui.component.Calendar c) { + this.calDataOcorrencia = c; + } + + private PanelGroup groupPanel9 = new PanelGroup(); + + public PanelGroup getGroupPanel9() { + return groupPanel9; + } + + public void setGroupPanel9(PanelGroup pg) { + this.groupPanel9 = pg; + } + + private StaticText staticText71 = new StaticText(); + + public StaticText getStaticText71() { + return staticText71; + } + + public void setStaticText71(StaticText st) { + this.staticText71 = st; + } + + private DropDown drpHours = new DropDown(); + + public DropDown getDrpHours() { + return drpHours; + } + + public void setDrpHours(DropDown dd) { + this.drpHours = dd; + } + + private StaticText staticText72 = new StaticText(); + + public StaticText getStaticText72() { + return staticText72; + } + + public void setStaticText72(StaticText st) { + this.staticText72 = st; + } + + private DropDown drpMinutes = new DropDown(); + + public DropDown getDrpMinutes() { + return drpMinutes; + } + + public void setDrpMinutes(DropDown dd) { + this.drpMinutes = dd; + } + + private PanelGroup groupPanel8 = new PanelGroup(); + + public PanelGroup getGroupPanel8() { + return groupPanel8; + } + + public void setGroupPanel8(PanelGroup pg) { + this.groupPanel8 = pg; + } + + private StaticText staticText14 = new StaticText(); + + public StaticText getStaticText14() { + return staticText14; + } + + public void setStaticText14(StaticText st) { + this.staticText14 = st; + } + + private StaticText stNomeAcidentado = new StaticText(); + + public StaticText getStNomeAcidentado() { + return stNomeAcidentado; + } + + public void setStNomeAcidentado(StaticText st) { + this.stNomeAcidentado = st; + } + + private PanelGroup groupPanel15 = new PanelGroup(); + + public PanelGroup getGroupPanel15() { + return groupPanel15; + } + + public void setGroupPanel15(PanelGroup pg) { + this.groupPanel15 = pg; + } + + private StaticText staticText70 = new StaticText(); + + public StaticText getStaticText70() { + return staticText70; + } + + public void setStaticText70(StaticText st) { + this.staticText70 = st; + } + + private StaticText stEstabelecimentoOrigem1 = new StaticText(); + + public StaticText getStEstabelecimentoOrigem1() { + return stEstabelecimentoOrigem1; + } + + public void setStEstabelecimentoOrigem1(StaticText st) { + this.stEstabelecimentoOrigem1 = st; + } + + private PanelGroup groupPanel16 = new PanelGroup(); + + public PanelGroup getGroupPanel16() { + return groupPanel16; + } + + public void setGroupPanel16(PanelGroup pg) { + this.groupPanel16 = pg; + } + + private StaticText staticText74 = new StaticText(); + + public StaticText getStaticText74() { + return staticText74; + } + + public void setStaticText74(StaticText st) { + this.staticText74 = st; + } + + private StaticText stDataNascimento = new StaticText(); + + public StaticText getStDataNascimento() { + return stDataNascimento; + } + + public void setStDataNascimento(StaticText st) { + this.stDataNascimento = st; + } + + private PanelGroup groupPanel65 = new PanelGroup(); + + public PanelGroup getGroupPanel65() { + return groupPanel65; + } + + public void setGroupPanel65(PanelGroup pg) { + this.groupPanel65 = pg; + } + + private StaticText staticText75 = new StaticText(); + + public StaticText getStaticText75() { + return staticText75; + } + + public void setStaticText75(StaticText st) { + this.staticText75 = st; + } + + private StaticText stBI = new StaticText(); + + public StaticText getStBI() { + return stBI; + } + + public void setStBI(StaticText st) { + this.stBI = st; + } + + private PanelGroup groupPanel66 = new PanelGroup(); + + public PanelGroup getGroupPanel66() { + return groupPanel66; + } + + public void setGroupPanel66(PanelGroup pg) { + this.groupPanel66 = pg; + } + + private StaticText staticText77 = new StaticText(); + + public StaticText getStaticText77() { + return staticText77; + } + + public void setStaticText77(StaticText st) { + this.staticText77 = st; + } + + private StaticText stMorada = new StaticText(); + + public StaticText getStMorada() { + return stMorada; + } + + public void setStMorada(StaticText st) { + this.stMorada = st; + } + + private StaticText staticText79 = new StaticText(); + + public StaticText getStaticText79() { + return staticText79; + } + + public void setStaticText79(StaticText st) { + this.staticText79 = st; + } + + private StaticText stCodPostal = new StaticText(); + + public StaticText getStCodPostal() { + return stCodPostal; + } + + public void setStCodPostal(StaticText st) { + this.stCodPostal = st; + } + + private PanelGroup groupPanel67 = new PanelGroup(); + + public PanelGroup getGroupPanel67() { + return groupPanel67; + } + + public void setGroupPanel67(PanelGroup pg) { + this.groupPanel67 = pg; + } + + private StaticText staticText80 = new StaticText(); + + public StaticText getStaticText80() { + return staticText80; + } + + public void setStaticText80(StaticText st) { + this.staticText80 = st; + } + + private StaticText stContactoTelefonico = new StaticText(); + + public StaticText getStContactoTelefonico() { + return stContactoTelefonico; + } + + public void setStContactoTelefonico(StaticText st) { + this.stContactoTelefonico = st; + } + + private PanelGroup groupPanel68 = new PanelGroup(); + + public PanelGroup getGroupPanel68() { + return groupPanel68; + } + + public void setGroupPanel68(PanelGroup pg) { + this.groupPanel68 = pg; + } + + private StaticText staticText81 = new StaticText(); + + public StaticText getStaticText81() { + return staticText81; + } + + public void setStaticText81(StaticText st) { + this.staticText81 = st; + } + + private StaticText stDataAdmissao1 = new StaticText(); + + public StaticText getStDataAdmissao1() { + return stDataAdmissao1; + } + + public void setStDataAdmissao1(StaticText st) { + this.stDataAdmissao1 = st; + } + + private PanelGroup groupPanel69 = new PanelGroup(); + + public PanelGroup getGroupPanel69() { + return groupPanel69; + } + + public void setGroupPanel69(PanelGroup pg) { + this.groupPanel69 = pg; + } + + private StaticText staticText82 = new StaticText(); + + public StaticText getStaticText82() { + return staticText82; + } + + public void setStaticText82(StaticText st) { + this.staticText82 = st; + } + + private StaticText stFuncao1 = new StaticText(); + + public StaticText getStFuncao1() { + return stFuncao1; + } + + public void setStFuncao1(StaticText st) { + this.stFuncao1 = st; + } + + private PanelGroup groupPanel70 = new PanelGroup(); + + public PanelGroup getGroupPanel70() { + return groupPanel70; + } + + public void setGroupPanel70(PanelGroup pg) { + this.groupPanel70 = pg; + } + + private StaticText staticText83 = new StaticText(); + + public StaticText getStaticText83() { + return staticText83; + } + + public void setStaticText83(StaticText st) { + this.staticText83 = st; + } + + private StaticText stTurno = new StaticText(); + + public StaticText getStTurno() { + return stTurno; + } + + public void setStTurno(StaticText st) { + this.stTurno = st; + } + + private PanelGroup groupPanel71 = new PanelGroup(); + + public PanelGroup getGroupPanel71() { + return groupPanel71; + } + + public void setGroupPanel71(PanelGroup pg) { + this.groupPanel71 = pg; + } + + private StaticText staticText84 = new StaticText(); + + public StaticText getStaticText84() { + return staticText84; + } + + public void setStaticText84(StaticText st) { + this.staticText84 = st; + } + + private StaticText staticText85 = new StaticText(); + + public StaticText getStaticText85() { + return staticText85; + } + + public void setStaticText85(StaticText st) { + this.staticText85 = st; + } + + private PanelGroup groupPanel72 = new PanelGroup(); + + public PanelGroup getGroupPanel72() { + return groupPanel72; + } + + public void setGroupPanel72(PanelGroup pg) { + this.groupPanel72 = pg; + } + + private StaticText staticText86 = new StaticText(); + + public StaticText getStaticText86() { + return staticText86; + } + + public void setStaticText86(StaticText st) { + this.staticText86 = st; + } + + private StaticText stMedico = new StaticText(); + + public StaticText getStMedico() { + return stMedico; + } + + public void setStMedico(StaticText st) { + this.stMedico = st; + } + + private StaticText staticText87 = new StaticText(); + + public StaticText getStaticText87() { + return staticText87; + } + + public void setStaticText87(StaticText st) { + this.staticText87 = st; + } + + private StaticText staticText92 = new StaticText(); + + public StaticText getStaticText92() { + return staticText92; + } + + public void setStaticText92(StaticText st) { + this.staticText92 = st; + } + + private StaticText txtCedula = new StaticText(); + + public StaticText getTxtCedula() { + return txtCedula; + } + + public void setTxtCedula(StaticText st) { + this.txtCedula = st; + } + + private PanelGroup groupPanel4 = new PanelGroup(); + + public PanelGroup getGroupPanel4() { + return groupPanel4; + } + + public void setGroupPanel4(PanelGroup pg) { + this.groupPanel4 = pg; + } + + private StaticText staticText7 = new StaticText(); + + public StaticText getStaticText7() { + return staticText7; + } + + public void setStaticText7(StaticText st) { + this.staticText7 = st; + } + + private TextField txtHorasTurno = new TextField(); + + public TextField getTxtHorasTurno() { + return txtHorasTurno; + } + + public void setTxtHorasTurno(TextField tf) { + this.txtHorasTurno = tf; + } + + private HiddenField hidConfEnviar = new HiddenField(); + + public HiddenField getHidConfEnviar() { + return hidConfEnviar; + } + + public void setHidConfEnviar(HiddenField hf) { + this.hidConfEnviar = hf; + } + private StaticText lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + /** + *

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 . . . + } + } + else + { + + initCalendars(); + + HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); + String referer = request.getRequestURI(); + String pageFrom = Utils.getPageFrom(referer); + if(!pageFrom.matches("AnaliseAcidenteTrabalho.jsp")) + { + if(pageFrom.matches("LoadImage.jsp")) + { + restorePageState(); + //if(getSessionBean1().getImageName() != null) + //{ + fillImages(); + //} + } + else + { + String tmpImageFolder = Global.IMAGE_FOLDER + "/tmp" + getSessionBean1().getCurrentUser().getLogin(); + File tmpFolder = new File(tmpImageFolder); + if(tmpFolder.exists()) + { + Global global = new Global(); + global.deleteFolderFiles(tmpFolder); + tmpFolder.delete(); + } + + lblUser.setText( getSessionBean1().getCurrentUser().getLogin() ); + getSessionBean1().setGravado(false); + getSessionBean1().setSubmetido(false); + getSessionBean1().setIeBug(false); + //drpTecnicos.setSelected(new Integer(0)); + //drpMedicos.setSelected(new Integer(0)); + if(getSessionBean1().getCurrentAnalise() == null) // new analise + { + getSessionBean1().setAcidentado(null); // Here ????? + lnkLblTrabalhador.setDisabled(true); + lnkLblTrabalhador.setStyleClass(""); + initializePage(); + } + else // edit analise + { + lnkLblTrabalhador.setDisabled(false); + lnkLblTrabalhador.setStyleClass("labelTrabalhador"); + gridTrabalhadores.setRendered(false); + + fillPage(); + } + + } + } + + } + + + } + + /** + *

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 + getSessionBean1().setIeBug(true); + try + { + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + } + catch(Exception ex){} + + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) {} + //return "login"; + return null; + } + + + private void initializePage() + { + hidAnchor.setValue("none"); + butCorrecao.setRendered(false); + butGravar.setText("Gravar"); + butEnviar.setText("Enviar a RH"); + gridSiprp.setRendered(false); + //gridAcidentadoView.setRendered(false); + gridSiprpView.setRendered(false); + gridAcidentadoView.setRendered(false); + gridDadosAcidenteRh.setRendered(false); + gridDadosAcidenteRhView.setRendered(false); + gridRecomendacoesHS.setRendered(false); + gridRecomendacoesViewHS.setRendered(false); + gridMedidasRH.setRendered(false); + gridMedidasViewRH.setRendered(false); + gridMedico.setRendered(false); + gridMedicoView.setRendered(false); + gridVerificacao.setRendered(false); + gridVerificacaoView.setRendered(false); + gridImpressao.setRendered(false); + gridImpressaoView.setRendered(false); + + tblTrabalhadores.setRendered(false); + gridAcidentado.setRendered(false); + gridDadosAcidenteSeg.setRendered(false); + gridDadosAcidenteSegView.setRendered(false); + + butImprimir.setRendered(false); + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + String nome_empresa = adp.getEmpresaNome(getSessionBean1().getCurrentUser().getEmpresa_id()); + txtEmpresa.setText(utils.Utils.unicodeToHTML(nome_empresa)); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + try + { + txtEstabelecimento.setText(adp.getEstabelecimentoNome(getSessionBean1().getCurrentUser().getEstabelecimento_id())); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + + drpDepartamento.setSelected(new Integer(0)); + try + { + getSessionBean1().setSeccaoOptions(adp.getSeccoesList(null)); + drpSeccao.setSelected(new Integer(0)); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + +// fillTrabalhadoresTable(); + +// Calendar c = Calendar.getInstance(); +// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); +// stDataAcidente.setText(dateFormat.format(c.getTime())); + txtAveriguador.setText( getSessionBean1().getCurrentUser().getNome() ); + java.util.Date today = + new java.util.Date(); + calDataOcorrencia.setValue(today); + + //drpMedicos.setSelected(new Integer(0)); + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + Medico m = udp.getMedico( getSessionBean1().getCurrentUser().getEstabelecimento_id() ); + getSessionBean1().setMedico( m ); + if(m != null) + { + stMedico.setText(m.getNome() + "  "); + txtCedula.setText(m.getNumero_cedula()); + } + drpHours.setSelected(new Integer(-1)); + drpMinutes.setSelected(new Integer(-1)); + drpDepartamento.setSelected(new Integer(0)); + drpSeccao.setSelected(new Integer(0)); + drpCausas.setSelected(new Integer(0)); + } + +// 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(); + + //correcao + if(a.getCorrecao().matches("y")) + { + stObservacoesCorr.setText(a.getObservacoes_correcao()); + } + else + { + stObservacoesCorr.setRendered(false); + } + + + stHeaderNr.setText(a.getAnalise_nr()); + try + { + java.util.Date ddate = new java.util.Date(a.getData_acidente().getTime()); + stHeaderDate.setText(utils.Utils.dateToYYYYMMDD(ddate)); + } + catch(Exception ex){}; + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + String nome_empresa = adp.getEmpresaNome(a.getEmpresa_id()); + txtEmpresa.setText(utils.Utils.unicodeToHTML(nome_empresa)); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + try + { + txtEstabelecimento.setText(adp.getEstabelecimentoNome(a.getEstabelecimento_id())); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + Acidentado ac = null; + try + { + //Trabalhador t = adp.getTrabalhador(a.getTrabalhador_id()); + //txtDataNascimento.setText(t.getData_nascimento()); + ac = adp.getAcidentado(a.getAcidentado_id()); + txtTrabalhador.setText(ac.getNome()); + getSessionBean1().setAcidentado(ac); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + + int estado_documento = a.getEstado().intValue(); +// if(estado_documento != Global.ESTADO_IMPRESSAO) +//// if(estado_documento != Global.ESTADO_ASSINATURAS || (estado_documento == Global.ESTADO_ASSINATURAS && getSessionBean1().getCurrentUser().getTipo().intValue() != Global.TIPO_UTILIZADOR_RH)) +//// { +//// butImprimir.setRendered(false); +//// } +//// else +//// { +//// butGravar.setRendered(false); +//// } + butImprimir.setRendered(false); + + if(estado_documento > Global.ESTADO_SEG && getSessionBean1().getCurrentUser().getTipo().intValue() == 1 && a.getAveriguacao_posterior().matches("y")) + { + boolean booAveriguacao = false; + if(a.getAveriguacao_obs() == null) + { + booAveriguacao = true; + } + else if(a.getAveriguacao_obs().trim().length() == 0) + { + booAveriguacao = true; + } + if(booAveriguacao) + { + butCorrecao.setRendered(false); + butGravar.setText("Gravar"); + butEnviar.setRendered(false); + gridSiprp.setRendered(false); + //gridSiprpView.setRendered(false); + gridAcidentado.setRendered(false); //19/11/2007 + gridAcidentadoView.setRendered(false); //19/11/2007 + gridDadosAcidenteSeg.setRendered(false); //19/11/2007 + //gridDadosAcidenteSegView.setRendered(false); //19/11/2007 + gridDadosAcidenteRh.setRendered(false); + gridDadosAcidenteRhView.setRendered(false); + gridRecomendacoesHS.setRendered(false); + gridRecomendacoesViewHS.setRendered(false); + gridMedidasRH.setRendered(false); + gridMedidasViewRH.setRendered(false); + gridMedico.setRendered(false); + gridMedicoView.setRendered(false); + gridVerificacao.setRendered(false); + gridVerificacaoView.setRendered(false); + gridImpressao.setRendered(false); + gridImpressaoView.setRendered(false); + + // fillSiprp(a); + // fillDadosAcidenteSegView(a); + fillSiprpView(a); + if(ac != null) + { + fillAcidentadoView(ac); + } + fillDadosAcidenteSegView(a); + + return null; + } + + } + + + switch(estado_documento) + { + case Global.ESTADO_SEG: + butCorrecao.setRendered(false); + butGravar.setText("Gravar"); + if(a.getCorrecao().matches("y")) + { + butEnviar.setText("Enviar a Recomendações SHST"); + } + else + { + butEnviar.setText("Enviar a Acompanhamento RH"); + } + gridSiprpView.setRendered(false); + gridAcidentado.setRendered(false); //19/11/2007 + //gridAcidentadoView.setRendered(false); //19/11/2007 + gridDadosAcidenteSegView.setRendered(false); //19/11/2007 + gridDadosAcidenteRh.setRendered(false); + gridDadosAcidenteRhView.setRendered(false); + gridRecomendacoesHS.setRendered(false); + gridRecomendacoesViewHS.setRendered(false); + gridMedidasRH.setRendered(false); + gridMedidasViewRH.setRendered(false); + gridMedico.setRendered(false); + gridMedicoView.setRendered(false); + gridVerificacao.setRendered(false); + gridVerificacaoView.setRendered(false); + gridImpressao.setRendered(false); + gridImpressaoView.setRendered(false); + + fillSiprp(a); + fillAcidentadoView(ac); + fillDadosAcidenteSeg(a); + break; + case Global.ESTADO_RH1: + butCorrecao.setRendered(false); + butGravar.setText("Gravar"); + butEnviar.setText("Enviar a Recomendações SHST"); + gridSiprpView.setRendered(false); + gridAcidentadoView.setRendered(false); + gridDadosAcidenteSeg.setRendered(false); //19/11/2007 + gridDadosAcidenteRhView.setRendered(false); + gridRecomendacoesHS.setRendered(false); + gridRecomendacoesViewHS.setRendered(false); + gridMedidasRH.setRendered(false); + gridMedidasViewRH.setRendered(false); + gridMedico.setRendered(false); + gridMedicoView.setRendered(false); + gridVerificacao.setRendered(false); + gridVerificacaoView.setRendered(false); + gridImpressao.setRendered(false); + gridImpressaoView.setRendered(false); + + if(ac != null) + { + fillAcidentado(ac); + } + fillSiprp(a); + fillDadosAcidenteSegView(a); + fillDadosAcidenteRh(a); + break; + case Global.ESTADO_HS: + butGravar.setText("Gravar"); + butEnviar.setText("Enviar a Medidas RH"); + //gridSiprpView.setRendered(false); + gridSiprp.setRendered(false); + gridAcidentado.setRendered(false); + //gridAcidentadoView.setRendered(false); + gridDadosAcidenteSeg.setRendered(false); + gridDadosAcidenteRh.setRendered(false); + gridRecomendacoesViewHS.setRendered(false); + gridMedidasRH.setRendered(false); + gridMedidasViewRH.setRendered(false); + gridMedico.setRendered(false); + gridMedicoView.setRendered(false); + gridVerificacao.setRendered(false); + gridVerificacaoView.setRendered(false); + gridImpressao.setRendered(false); + gridImpressaoView.setRendered(false); + + fillSiprpView(a); + if(ac != null) + { + fillAcidentadoView(ac); + } + fillDadosAcidenteSegView(a); + fillDadosAcidenteRhView(a); + fillRecomendacoesHs(a); + //gridDadosAcidenteRhView.setRendered(false); + //gridRecomendacoesHS.setRendered(false); + break; + case Global.ESTADO_RH2: + butCorrecao.setRendered(false); + butGravar.setText("Gravar"); + //butEnviar.setText("Enviar a Médico"); +// if(a.getCorrecao().matches("y")) +// { +// butEnviar.setText("Enviar a Consolidação"); +// } +// else +// { +// butEnviar.setText("Enviar a Medicina"); +// } + butEnviar.setText("Enviar a Consolidação"); + + //butEnviar.setText("Enviar a Medicina"); + //gridSiprpView.setRendered(false); + gridSiprp.setRendered(false); + gridAcidentado.setRendered(false); + //gridAcidentadoView.setRendered(false); + gridDadosAcidenteSeg.setRendered(false); + gridDadosAcidenteRh.setRendered(false); + gridRecomendacoesHS.setRendered(false); + //gridRecomendacoesViewHS.setRendered(false); + gridMedidasViewRH.setRendered(false); + //gridMedico.setRendered(false); + gridMedicoView.setRendered(false); + gridVerificacao.setRendered(false); + gridVerificacaoView.setRendered(false); + gridImpressao.setRendered(false); + gridImpressaoView.setRendered(false); + + fillSiprpView(a); + if(ac != null) + { + fillAcidentadoView(ac); + } + fillDadosAcidenteSegView(a); + fillDadosAcidenteRhView(a); + fillRecomendacoesViewHs(a); + //fillMedico(a); //19/11/2007 + fillMedidasRh(a); + fillMedico(a); //23/11/2007 + break; +// case Global.ESTADO_MEDICINA: +// butCorrecao.setRendered(false); +// butGravar.setText("Gravar"); +// butEnviar.setText("Enviar a Consolidação"); +// //gridSiprpView.setRendered(false); +// gridSiprp.setRendered(false); +// gridAcidentado.setRendered(false); +// //gridAcidentadoView.setRendered(false); +// gridDadosAcidenteSeg.setRendered(false); +// gridDadosAcidenteRh.setRendered(false); +// gridRecomendacoesHS.setRendered(false); +// //gridRecomendacoesViewHS.setRendered(false); +// gridMedidasRH.setRendered(false); +// //gridMedidasViewRH.setRendered(false); +// //gridMedico.setRendered(false); +// gridMedicoView.setRendered(false); +// gridVerificacao.setRendered(false); +// gridVerificacaoView.setRendered(false); +// gridImpressao.setRendered(false); +// gridImpressaoView.setRendered(false); +// +// fillSiprpView(a); +// if(ac != null) +// { +// fillAcidentadoView(ac); +// } +// fillDadosAcidenteSegView(a); +// fillDadosAcidenteRhView(a); +// fillRecomendacoesViewHs(a); +// fillMedidasViewRh(a); +// fillMedico(a); //23/11/2007 +// break; + case Global.ESTADO_CONSOLIDACAO: + //butGravar.setText("Gravar"); + butGravar.setRendered(false); + butEnviar.setText("Enviar a Verificação"); + hidDisableEnviar.setValue("n"); +// boolean booAveriguacao = false; +// if(a.getAveriguacao_posterior().matches("y")) +// { +// if(a.getAveriguacao_obs() == null) +// { +// booAveriguacao = true; +// } +// else if(a.getAveriguacao_obs().trim().length() == 0) +// { +// booAveriguacao = true; +// } +// if(booAveriguacao) +// { +// hidDisableEnviar.setValue("y"); +// } +// +// } + gridSiprp.setRendered(false); + gridAcidentado.setRendered(false); + //gridAcidentadoView.setRendered(false); + gridDadosAcidenteSeg.setRendered(false); + gridDadosAcidenteRh.setRendered(false); + gridRecomendacoesHS.setRendered(false); + //gridRecomendacoesViewHS.setRendered(false); + gridMedidasRH.setRendered(false); + //gridMedidasViewRH.setRendered(false); + gridMedico.setRendered(false); + //gridMedicoView.setRendered(false); + //gridVerificacao.setRendered(false); + java.util.Date ddate = new java.util.Date(); + stVerHs.setText("Tomei conhecimento a " + utils.Utils.dateToYYYYMMDD(ddate)); + grpVerRespSeg.setRendered(false); + grpVerRespRh.setRendered(false); + butGravar.setDisabled(true); + butEnviar.setDisabled(true); + gridVerificacaoView.setRendered(false); + gridImpressao.setRendered(false); + gridImpressaoView.setRendered(false); + + fillSiprpView(a); + if(ac != null) + { + fillAcidentadoView(ac); + } + fillDadosAcidenteSegView(a); + fillDadosAcidenteRhView(a); + fillRecomendacoesViewHs(a); + fillMedidasViewRh(a); + fillMedicoView(a); //23/11/2007 + break; + case Global.ESTADO_ASSINATURA_SEG: + butImprimir.setRendered(false); + butCorrecao.setRendered(false); + butEnviar.setText("Enviar a RH"); + //butGravar.setText("Enviar"); + butGravar.setRendered(false); + gridSiprp.setRendered(false); + gridAcidentado.setRendered(false); + gridDadosAcidenteSeg.setRendered(false); + gridDadosAcidenteRh.setRendered(false); + gridRecomendacoesHS.setRendered(false); + gridRecomendacoesViewHS.setRendered(false); + gridMedidasRH.setRendered(false); + //gridMedidasViewRH.setRendered(false); + gridMedico.setRendered(false); + //gridMedicoView.setRendered(false); + //gridVerificacaoView.setRendered(false); + gridImpressao.setRendered(false); + gridImpressaoView.setRendered(false); + grpVerRespSeg.setRendered(true); + grpVerHs.setRendered(false); + grpVerRespRh.setRendered(false); + //chkVerRespRh.setDisabled(true); + ddate = new java.util.Date(); + stVerRespSeg.setText("Tomei conhecimento a " + utils.Utils.dateToYYYYMMDD(ddate)); + + fillSiprpView(a); + if(ac != null) + { + fillAcidentadoView(ac); + } + fillDadosAcidenteSegView(a); + fillDadosAcidenteRhView(a); + fillMedidasViewRh(a); + fillMedicoView(a); + fillVerificacaoView(a); + fillVerificacao(a); + + break; + case Global.ESTADO_ASSINATURA_RH: + butGravar.setRendered(false); + //butGravar.setText("Imprimir"); + butCorrecao.setRendered(false); + butImprimir.setRendered(false); + butEnviar.setText("Enviar a Conclusão"); + gridSiprp.setRendered(false); + gridAcidentado.setRendered(false); + gridDadosAcidenteSeg.setRendered(false); + gridDadosAcidenteRh.setRendered(false); + gridRecomendacoesHS.setRendered(false); + gridMedidasRH.setRendered(false); + gridMedico.setRendered(false); + //gridMedicoView.setRendered(false); + //gridVerificacaoView.setRendered(false); + gridImpressao.setRendered(false); + gridImpressaoView.setRendered(false); + grpVerRespRh.setRendered(true); + grpVerHs.setRendered(false); + grpVerRespSeg.setRendered(false); + //chkVerRespSeg.setDisabled(true); + ddate = new java.util.Date(); + stVerRespRh.setText("Tomei conhecimento a " + utils.Utils.dateToYYYYMMDD(ddate)); + + fillSiprpView(a); + if(ac != null) + { + fillAcidentadoView(ac); + } + fillDadosAcidenteSegView(a); + fillDadosAcidenteRhView(a); + fillRecomendacoesViewHs(a); + fillMedidasViewRh(a); + fillMedicoView(a); + fillVerificacaoView(a); + fillVerificacao(a); + break; + + case Global.ESTADO_FECHAR: + butCorrecao.setRendered(false); + butGravar.setRendered(false); + butGravar.setText("Gravar"); + butEnviar.setText("Fechar"); + gridSiprp.setRendered(false); + gridAcidentado.setRendered(false); + gridDadosAcidenteSeg.setRendered(false); + gridDadosAcidenteRh.setRendered(false); + gridRecomendacoesHS.setRendered(false); + gridMedidasRH.setRendered(false); + gridMedico.setRendered(false); + gridVerificacao.setRendered(false); + gridImpressao.setRendered(false); + gridImpressaoView.setRendered(false); + fillSiprpView(a); + if(ac != null) + { + fillAcidentadoView(ac); + } + fillDadosAcidenteSegView(a); + fillDadosAcidenteRhView(a); + fillRecomendacoesViewHs(a); + fillMedidasViewRh(a); + //fillMedico(a); + fillMedicoView(a); + fillVerificacaoView(a); + //fillImpressaoView(a); + break; + case Global.ESTADO_CONCLUIDO: + } + + return null; + } + + private void fillSiprp(AnaliseAcidente a) + { + //drpTecnicos.setSelected(a.getTecnico_saude_id()); + //drpMedicos.setSelected(a.getMedico_id()); + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + try + { + Utilizador u = udp.getUtilizador(a.getTecnico_saude_id()); + txtCap.setText(u.getCap()); + } + catch(Exception ex) + { + //ex.printStackTrace(); + } + try + { + Utilizador u = udp.getUtilizador(a.getMedico_id()); + stMedico.setText(u.getNome() + "  "); + txtCedula.setText(u.getNumero_cedula()); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + + private void fillSiprpView(AnaliseAcidente a) + { + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + + if(a.getEstado().intValue() == Global.ESTADO_HS) + { + if(a.getTecnico_saude_id().equals(new Integer(0))) + { + a.setTecnico_saude_id( getSessionBean1().getCurrentUser().getId()); + } + } + + try + { + Utilizador u = udp.getUtilizador(a.getTecnico_saude_id()); + stTecnicoNome.setText(Utils.unicodeToHTML(u.getNome())); + txtCap1.setText(u.getCap()); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + try + { + Utilizador u = udp.getUtilizador(a.getMedico_id()); + stMedicoNome.setText(Utils.unicodeToHTML(u.getNome())); + txtCedula1.setText(u.getNumero_cedula()); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + + private void fillAcidentado(Acidentado a) + { + txtNomeAcidentado.setText(a.getNome()); + stEstabelecimentoOrigem.setText(a.getEstabelecimento_origem()); + //txtDataNascimento.setText(a.getData_nascimento()); + try + { + java.util.Date ddate = new java.util.Date(a.getData_nascimento().getTime()); + txtDataNascimento.setText(utils.Utils.dateToYYYYMMDD(ddate)); + } + catch(Exception ex){}; + txtBI.setText(a.getBilhete_identidade()); + txtMorada.setText(a.getMorada()); + String cod_postal1 = ""; + String cod_postal2 = ""; + try + { + cod_postal1 = a.getCod_postal().substring(0, 4); + } + catch(Exception ex){} + try + { + cod_postal2 = a.getCod_postal().substring(5, 8); + } + catch(Exception ex){} + + + txtCodPostal1.setText(cod_postal1); + txtCodPostal2.setText(cod_postal2); + txtLocalidade.setText(a.getLocalidade()); + txtContactoTelefonico.setText(a.getContacto_telefonico()); + try + { + java.util.Date ddate = new java.util.Date(a.getData_admissao().getTime()); + stDataAdmissao.setText(utils.Utils.dateToYYYYMMDD(ddate)); + } + catch(Exception ex){}; + + stFuncao.setText(a.getFuncao()); + rbTurnoManha.setSelected(null); + rbTurnoTarde.setSelected(null); + rbTurnoNoite.setSelected(null); + if(a.getTurno().matches("m")) + { + rbTurnoManha.setSelected(new Boolean(true)); + } + else if(a.getTurno().matches("t")) + { + rbTurnoTarde.setSelected(new Boolean(true)); + } + else if(a.getTurno().matches("n")) + { + rbTurnoNoite.setSelected(new Boolean(true)); + } + + txtNomeSuperior.setText(a.getNome_superior_hierarquico()); + txtEmailSuperior.setText(a.getEmail_superior_hierarquico()); + + } + + private void fillAcidentadoView(Acidentado a) + { + stNomeAcidentado.setText(a.getNome()); + stEstabelecimentoOrigem1.setText(a.getEstabelecimento_origem()); + //stDataNascimento.setText(a.getData_nascimento()); + try + { + java.util.Date ddate = new java.util.Date(a.getData_nascimento().getTime()); + stDataNascimento.setText(utils.Utils.dateToYYYYMMDD(ddate)); + } + catch(Exception ex){}; + stBI.setText(a.getBilhete_identidade()); + stMorada.setText(a.getMorada()); + String cod_postal1 = ""; + String cod_postal2 = ""; + try + { + cod_postal1 = a.getCod_postal().substring(0, 4); + } + catch(Exception ex) + { + cod_postal1 = ""; + } + try + { + cod_postal2 = a.getCod_postal().substring(5, 8); + } + catch(Exception ex) + { + cod_postal2 = ""; + } + + //String cod_postal1 = a.getCod_postal().substring(0, 4); + //String cod_postal2 = a.getCod_postal().substring(5, 8); + if(a.getLocalidade() == null) + { + a.setLocalidade(""); + } + String cod_postal = cod_postal1 + "-" + cod_postal2 + " " + a.getLocalidade(); + stCodPostal.setText(cod_postal); + stContactoTelefonico.setText(a.getContacto_telefonico()); + //stDataAdmissao1.setText(a.getData_admissao()); + try + { + java.util.Date ddate = new java.util.Date(a.getData_admissao().getTime()); + stDataAdmissao1.setText(utils.Utils.dateToYYYYMMDD(ddate)); + } + catch(Exception ex){}; + stFuncao1.setText(a.getFuncao()); + String turno_str = ""; + if(a.getTurno() != null) + { + if(a.getTurno().matches("m")) + { + turno_str = "manhã"; + } + else if(a.getTurno().matches("t")) + { + turno_str += "tarde "; + } + else if(a.getTurno().matches("n")) + { + turno_str += "noite"; + } + } + + stTurno.setText(turno_str); + stNomeSuperior.setText(a.getNome_superior_hierarquico()); + stEmailSuperior.setText(a.getEmail_superior_hierarquico()); + } + + private void fillDadosAcidenteSeg(AnaliseAcidente a) + { + //stDataAcidente.setText(a.getData_acidente()); +// try +// { +// java.util.Date ddate = new java.util.Date(a.getData_acidente().getTime()); +// stDataAcidente.setText(utils.Utils.dateToYYYYMMDD(ddate)); +// } +// catch(Exception ex){}; + if(a.getAveriguador() == null) + { + txtAveriguador.setText(getSessionBean1().getCurrentUser().getNome()); + } + else + { + txtAveriguador.setText(a.getAveriguador()); + } + + if(a.getData_acidente() != null) + { + java.util.Date ddate = new java.util.Date(a.getData_acidente().getTime()); + calDataOcorrencia.setValue(ddate); + } + + Calendar cal = Calendar.getInstance(); + + // set the calendar to have your time + try + { + cal.setTimeInMillis(a.getHora_acidente().getTime()); + + int hour = cal.get(Calendar.HOUR_OF_DAY); + int minutes = cal.get(Calendar.MINUTE); + drpHours.setSelected(new Integer(hour)); + drpMinutes.setSelected(new Integer(minutes)); + } + catch(Exception ex) + { + //ex.printStackTrace(); + } + + if(a.getHoras_turno() != null) + { + txtHorasTurno.setText(a.getHoras_turno().toString()); + } + + ////txtSeccao.setText(a.getSeccao()); + + AnalisesDataProvider adp = new AnalisesDataProvider(); + drpDepartamento.setSelected(a.getDepartamento_id()); + try + { + if(a.getDepartamento_id().intValue() == 0) + { + getSessionBean1().setSeccaoOptions(adp.getSeccoesList(null)); + drpSeccao.setSelected(new Integer(0)); + } + else + { + getSessionBean1().setSeccaoOptions(adp.getSeccoesList(a.getDepartamento_id())); + drpSeccao.setSelected(a.getSeccao_id()); + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + 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()); + + drpCausas.setSelected(a.getCausas()); + txtDescricao.setText(a.getDescricao()); + txtConclusoes.setText(a.getConclusoes()); + txtAccoes.setText(a.getAccoes()); + + if(a.getAveriguacao_posterior().matches("y")) + { + chkAveriguacaoPosterior.setSelected(new Boolean(true)); + } + + txtAveriguacaoObs.setText(a.getAveriguacao_obs()); + + //fill images + if(gridImages.getChildren().size() > 0) + { + gridImages.getChildren().clear(); + } + String folderName = getSessionBean1().getCurrentAnalise().getAnalise_nr().substring(0,2) + getSessionBean1().getCurrentAnalise().getAnalise_nr().substring(3); + ServletContext theApplicationsServletContext = + (ServletContext) this.getExternalContext().getContext(); + + File apacheAnaliseFolder = new File(theApplicationsServletContext.getRealPath( Global.RESOURCES_IMAGE_FOLDER ) + "/analises/" + folderName); + if(apacheAnaliseFolder.exists()) + { + Global global = new Global(); + global.deleteFolderFiles(apacheAnaliseFolder); + } + else + { + apacheAnaliseFolder.mkdir(); + } + + +// String imageFileFolder = theApplicationsServletContext.getRealPath(Global.IMAGE_FOLDER + "/" + folderName); + String imageFileFolder = Global.IMAGE_FOLDER + "/" + folderName; + try + { + File f = new File(imageFileFolder); + + if(f.exists()) + { + File images[] = f.listFiles(); + Arrays.sort(images); + for(int i=0;i 0) + { + gridImages.getChildren().clear(); + } + String folderName = a.getAnalise_nr().substring(0,2) + a.getAnalise_nr().substring(3); + ServletContext theApplicationsServletContext = + (ServletContext) this.getExternalContext().getContext(); +// String imageFileFolder = theApplicationsServletContext.getRealPath(Global.IMAGE_FOLDER + "/" + folderName); + + File apacheAnaliseFolder = new File(theApplicationsServletContext.getRealPath( Global.RESOURCES_IMAGE_FOLDER ) + "/analises/" + folderName); + if(apacheAnaliseFolder.exists()) + { + Global global = new Global(); + global.deleteFolderFiles(apacheAnaliseFolder); + System.out.println("FILES DELETED"); + } + else + { + apacheAnaliseFolder.mkdir(); + } + + + String imageFileFolder = Global.IMAGE_FOLDER + "/" + folderName; + try + { + File f = new File(imageFileFolder); + + if(f.exists()) + { + File images[] = f.listFiles(); + Arrays.sort(images); + for(int i=0;i 0) + { + s = new StaticText(); + s.setId("s103"); + s.setEscape(false); + s.setText(a.getNr_relatorio_acidente_colaborador1()); + pg.getChildren().add(s); + } + } + if(a.getNr_relatorio_acidente_colaborador2() != null) + { + if(a.getNr_relatorio_acidente_colaborador2().intValue() > 0) + { + s = new StaticText(); + s.setId("s104"); + s.setEscape(false); + s.setText("  " + a.getNr_relatorio_acidente_colaborador2()); + pg.getChildren().add(s); + } + + } + if(a.getNr_relatorio_acidente_colaborador3() != null) + { + if(a.getNr_relatorio_acidente_colaborador3().intValue() > 0) + { + s = new StaticText(); + s.setId("s105"); + s.setEscape(false); + s.setText("  " + a.getNr_relatorio_acidente_colaborador3()); + pg.getChildren().add(s); + } + } + if(a.getNr_relatorio_acidente_colaborador4() != null) + { + if(a.getNr_relatorio_acidente_colaborador4().intValue() > 0) + { + s = new StaticText(); + s.setId("s106"); + s.setEscape(false); + s.setText("  " + a.getNr_relatorio_acidente_colaborador4()); + pg.getChildren().add(s); + } + } + grd.getChildren().add(pg); + } + gridColaborador.getChildren().add(grd); + } + + } + else if( a.getOutros_acidentes_com_colaborador().matches("n") ) + { + st1.setText("Não se verificaram outras ocorrências/incidências no mesmo posto de trabalho com o colaborador acidentado."); + gridColaborador.getChildren().add(st1); + } + else //t + { + gridColaborador.setRendered(false); + } + + if(a.getAcidentes_outros_colaboradores().matches("y")) + { + st2.setText("Verificaram-se ocorrências/incidentes semelhantes com outros colaboradores."); + gridColaboradores.getChildren().add(st2); + boolean booShow = false; + boolean booShow1 = false; + boolean booShow2 = false; + if(a.getNr_acidentes_outros_colaboradores() != null) + { + booShow = true; + booShow1 = true; + } + if(a.getNr_relatorio_acidente_outros_colaboradores1() != null || a.getNr_relatorio_acidente_outros_colaboradores2() != null || a.getNr_relatorio_acidente_outros_colaboradores3() != null || a.getNr_relatorio_acidente_outros_colaboradores4() != null) + { + booShow = true; + booShow2 = true; + } + + if(booShow) + { + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setId("grdColaboradoresS"); + grd.setColumns(2); + grd.setColumnClasses("gridColLeft15, gridColLeft85"); + if(booShow1) + { + PanelGroup pg = new PanelGroup(); + StaticText s = new StaticText(); + s.setId("s200"); + s.setEscape(false); + s.setText("Total:  "); + pg.getChildren().add(s); + s = new StaticText(); + s.setId("s201"); + s.setEscape(false); + s.setText(a.getNr_acidentes_outros_colaboradores()); + pg.getChildren().add(s); + grd.getChildren().add(pg); + } + if(booShow2) + { + PanelGroup pg = new PanelGroup(); + StaticText s = new StaticText(); + s.setId("s202"); + s.setEscape(false); + s.setText("Relatórios de acidente nº:  "); + pg.getChildren().add(s); + if(a.getNr_relatorio_acidente_outros_colaboradores1() != null) + { + if(a.getNr_relatorio_acidente_outros_colaboradores1().intValue() > 0) + { + s = new StaticText(); + s.setId("s203"); + s.setEscape(false); + s.setText(a.getNr_relatorio_acidente_outros_colaboradores1()); + pg.getChildren().add(s); + } + } + if(a.getNr_relatorio_acidente_outros_colaboradores2() != null) + { + if(a.getNr_relatorio_acidente_outros_colaboradores2().intValue() > 0) + { + s = new StaticText(); + s.setId("s204"); + s.setEscape(false); + s.setText("  " + a.getNr_relatorio_acidente_outros_colaboradores2()); + pg.getChildren().add(s); + } + } + if(a.getNr_relatorio_acidente_outros_colaboradores3() != null) + { + if(a.getNr_relatorio_acidente_outros_colaboradores3().intValue() > 0) + { + s = new StaticText(); + s.setId("s205"); + s.setEscape(false); + s.setText("  " + a.getNr_relatorio_acidente_outros_colaboradores3()); + pg.getChildren().add(s); + } + } + if(a.getNr_relatorio_acidente_outros_colaboradores4() != null) + { + if(a.getNr_relatorio_acidente_outros_colaboradores4().intValue() > 0) + { + s = new StaticText(); + s.setId("s206"); + s.setEscape(false); + s.setText("  " + a.getNr_relatorio_acidente_outros_colaboradores4()); + pg.getChildren().add(s); + } + } + grd.getChildren().add(pg); + } + gridColaboradores.getChildren().add(grd); + } + } + else if( a.getAcidentes_outros_colaboradores().matches("n") ) + { + st2.setText("Não se verificaram ocorrências/incidentes com outros colaboradores."); + gridColaboradores.getChildren().add(st2); + } + else //t + { + gridColaboradores.setRendered(false); + } + } + + private void fillRecomendacoesHs(AnaliseAcidente a) + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList list = adp.getRecomendacoesByAnalise(a.getId()); + ListIterator iter = list.listIterator(); + int seq = 1; + while(iter.hasNext()) + { + Recomendacao r = (Recomendacao) iter.next(); + if(seq==1) + { + txtRecomendacao1.setText(r.getRecomendacao()); + } + else + { + + //int seq = gridRecomendacoes.getChildren().size(); + //seq++; + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setId("grd" + seq); + grd.setColumns(3); + grd.setColumnClasses("gridColLeft5, gridColLeft90,gridColLeft5"); + grd.setStyle("width: 100%"); + + StaticText st = new StaticText(); + st.setId("st" + seq); + st.setText(seq + " ."); + st.setStyle("width: 24px"); + grd.getChildren().add(st); + + TextArea ta = new TextArea(); + ta.setId("ta" + seq); + ta.setStyle("height: 24px; width: 98%"); + ta.setText(r.getRecomendacao()); + grd.getChildren().add(ta); + + ImageHyperlink ln = new ImageHyperlink(); + ln.setId("ln" + seq); + ln.setWidth(9); + ln.setHeight(9); + ln.setImageURL("/resources/plus_more.gif"); + MethodBinding mbAction = this.getApplication().createMethodBinding("#{AnaliseAcidenteTrabalho.lnkMoreRec1_action}", null); + ln.setAction(mbAction); + + grd.getChildren().add(ln); + + gridRecomendacoes.getChildren().add(grd); + + } + seq++; + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + + private void fillRecomendacoesViewHs(AnaliseAcidente a) + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList list = adp.getRecomendacoesByAnalise(a.getId()); + ListIterator iter = list.listIterator(); + int seq = 1; + while(iter.hasNext()) + { + Recomendacao r = (Recomendacao) iter.next(); + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setId("grdRecomendacaoView" + seq); + grd.setColumns(2); + grd.setColumnClasses("gridColLeft5, gridColLeft95"); + grd.setStyle("width: 100%"); + + StaticText st = new StaticText(); + st.setId("stNrRecomendacaoView" + seq); + st.setText(seq + " ."); + st.setStyle("width: 24px"); + grd.getChildren().add(st); + + st = new StaticText(); + st.setId("stRecomendacaoView" + seq); + st.setText(r.getRecomendacao()); + //st.setStyle("width: 24px"); + grd.getChildren().add(st); + + gridRecomendacoesView.getChildren().add(grd); + seq++; + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + + private void fillMedidasRh(AnaliseAcidente a) + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList list = adp.getMedidasByAnalise(a.getId()); + ListIterator iter = list.listIterator(); + int seq = 1; + while(iter.hasNext()) + { + Medida m = (Medida) iter.next(); + if(seq==1) + { + txtMedida1.setText(m.getMedida()); + } + else + { + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setId("grdMedida" + seq); + grd.setColumns(3); + grd.setColumnClasses("gridColLeft5, gridColLeft90,gridColLeft5"); + grd.setStyle("width: 100%"); + + StaticText st = new StaticText(); + st.setId("stNrMedida" + seq); + st.setText(seq + " ."); + st.setStyle("width: 24px"); + grd.getChildren().add(st); + + TextArea ta = new TextArea(); + ta.setId("taMedida" + seq); + ta.setStyle("height: 24px; width: 98%"); + ta.setText(m.getMedida()); + grd.getChildren().add(ta); + + ImageHyperlink ln = new ImageHyperlink(); + ln.setId("lnMedidaMore" + seq); + ln.setWidth(9); + ln.setHeight(9); + ln.setImageURL("/resources/plus_more.gif"); + MethodBinding mbAction = this.getApplication().createMethodBinding("#{AnaliseAcidenteTrabalho.lnkMoreMed_action}", null); + ln.setAction(mbAction); + + grd.getChildren().add(ln); + + gridMedidas.getChildren().add(grd); + } + seq++; + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + + private void fillMedidasViewRh(AnaliseAcidente a) + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList list = adp.getMedidasByAnalise(a.getId()); + ListIterator iter = list.listIterator(); + int seq = 1; + while(iter.hasNext()) + { + Medida m = (Medida) iter.next(); + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setId("grdMedidaView" + seq); + grd.setColumns(2); + grd.setColumnClasses("gridColLeft5, gridColLeft95"); + grd.setStyle("width: 100%"); + + StaticText st = new StaticText(); + st.setId("stNrMedidaView" + seq); + st.setText(seq + " ."); + st.setStyle("width: 24px"); + grd.getChildren().add(st); + + st = new StaticText(); + st.setId("stMedidaView" + seq); + st.setText(m.getMedida()); + //st.setStyle("width: 24px"); + grd.getChildren().add(st); + + gridMedidasView.getChildren().add(grd); + seq++; + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + + private void fillMedico(AnaliseAcidente a) + { + + if(a.getLesao_cabeca().matches("y")) + { + chkCabeca.setSelected( new Boolean(true) ); + } + + if(a.getLesao_pescoco().matches("y")) + { + chkPescoco.setSelected(new Boolean(true)); + } + + if(a.getLesao_tronco().matches("y")) + { + chkTronco.setSelected(new Boolean(true)); + } + + if(a.getLesao_membro_sup_dir().matches("y")) + { + chkMembroSupDir.setSelected(new Boolean(true)); + //lblEspecif1.setRendered(true); + //txtEspecif1.setRendered(true); + lblEspecif1.setVisible(true); + txtEspecif1.setVisible(true); + + txtEspecif1.setText(a.getEspecif1()); + } + else + { + //lblEspecif1.setRendered(false); + //txtEspecif1.setRendered(false); + lblEspecif1.setVisible(false); + txtEspecif1.setVisible(false); + + } + + if(a.getLesao_membro_sup_esq().matches("y")) + { + chkMembroSupEsq.setSelected(new Boolean(true)); +// lblEspecif2.setRendered(true); +// txtEspecif2.setRendered(true); + lblEspecif2.setVisible(true); + txtEspecif2.setVisible(true); + txtEspecif2.setText(a.getEspecif2()); + } + else + { + lblEspecif2.setVisible(false); + txtEspecif2.setVisible(false); + } + + if(a.getLesao_membro_inf_dir().matches("y")) + { + chkMembroInfDir.setSelected(new Boolean(true)); + lblEspecif3.setVisible(true); + txtEspecif3.setVisible(true); + txtEspecif3.setText(a.getEspecif3()); + } + else + { + lblEspecif3.setVisible(false); + txtEspecif3.setVisible(false); + } + + if(a.getLesao_membro_inf_esq().matches("y")) + { + chkMembroInfEsq.setSelected(new Boolean(true)); + lblEspecif4.setVisible(true); + txtEspecif4.setVisible(true); + txtEspecif4.setText(a.getEspecif4()); + } + else + { + lblEspecif4.setVisible(false); + txtEspecif4.setVisible(false); + } + + txtTipoLesao.setText(a.getTipo_lesao()); + if(a.getTipo_incapacidade().matches("n")) + { + rbIncapacidadeNone.setSelected(new Boolean(true)); + } + else if(a.getTipo_incapacidade().matches("t")) + { + rbIncapacidadeTemp.setSelected(new Boolean(true)); + } + else if(a.getTipo_incapacidade().matches("p")) + { + rbIncapacidadePerm.setSelected(new Boolean(true)); + } + else + { + rbIncapacidadeNone.setSelected(null); + rbIncapacidadeTemp.setSelected(null); + rbIncapacidadePerm.setSelected(null); + } + + if(a.getCoef_incapacidade() == null) + { + txtCoefIncapacidade.setText(""); + } + else + { + txtCoefIncapacidade.setText(a.getCoef_incapacidade()); + } + + + if(a.getData_aval_incapacidade() != null) + { + java.util.Date ddate = new java.util.Date(a.getData_aval_incapacidade().getTime()); + calAvaliacaoIncap.setValue(ddate); + } + + if(a.getData_rev_incapacidade() != null) + { + java.util.Date ddate = new java.util.Date(a.getData_rev_incapacidade().getTime()); + calRevisaoIncap.setValue(ddate); + } + + if(a.getPeriodo_incapacidade_de() != null) + { + java.util.Date ddate = new java.util.Date(a.getPeriodo_incapacidade_de().getTime()); + calPeridoIncapDe.setValue(ddate); + } + + if(a.getPeriodo_incapacidade_a() != null) + { + java.util.Date ddate = new java.util.Date(a.getPeriodo_incapacidade_a().getTime()); + calPeriodoIncapA.setValue(ddate); + } + + if(a.getImg_flexao().matches("y")) + { + chkImgFlexao.setSelected(new Boolean(true)); + } + + if(a.getImg_rot1().matches("y")) + { + chkImgRot1.setSelected(new Boolean(true)); + } + + if(a.getImg_rot2().matches("y")) + { + chkImgRot2.setSelected(new Boolean(true)); + } + + if(a.getImg_ext1().matches("y")) + { + chkImgExt1.setSelected(new Boolean(true)); + } + + if(a.getImg_ext2().matches("y")) + { + chkImgExt2.setSelected(new Boolean(true)); + } + + if(a.getImg_cab1().matches("y")) + { + chkImgCab1.setSelected(new Boolean(true)); + } + + if(a.getImg_cab2().matches("y")) + { + chkImgCab2.setSelected(new Boolean(true)); + } + + if(a.getImg_cab3().matches("y")) + { + chkImgCab3.setSelected(new Boolean(true)); + } + + if(a.getImg_cab4().matches("y")) + { + chkImgCab4.setSelected(new Boolean(true)); + } + + if(a.getImg_ma1().matches("y")) + { + chkImgMa1.setSelected(new Boolean(true)); + } + + if(a.getImg_ma2().matches("y")) + { + chkImgMa2.setSelected(new Boolean(true)); + } + + if(a.getImg_ma3().matches("y")) + { + chkImgMa3.setSelected(new Boolean(true)); + } + + if(a.getImg_ma4().matches("y")) + { + chkImgMa4.setSelected(new Boolean(true)); + } + + if(a.getImg_ma5().matches("y")) + { + chkImgMa5.setSelected(new Boolean(true)); + } + + if(a.getImg_ma6().matches("y")) + { + chkImgMa6.setSelected(new Boolean(true)); + } + + if(a.getImg_ma7().matches("y")) + { + chkImgMa7.setSelected(new Boolean(true)); + } + + if(a.getImg_ma8().matches("y")) + { + chkImgMa8.setSelected(new Boolean(true)); + } + + if(a.getImg_ma9().matches("y")) + { + chkImgMa9.setSelected(new Boolean(true)); + } + + if(a.getImg_ma10().matches("y")) + { + chkImgMa10.setSelected(new Boolean(true)); + } + + if(a.getRestricao_carga() != null) + { + if(a.getRestricao_carga().intValue() > 0) + { + chkRestricaoCargas.setSelected(new Boolean(true)); + rbKgs2.setRendered(true); + rbKgs5.setRendered(true); + rbKgs10.setRendered(true); + rbKgs15.setRendered(true); + rbKgsOutro.setRendered(true); + txtKgs.setRendered(true); + stKgs2.setRendered(true); + stKgs5.setRendered(true); + stKgs10.setRendered(true); + stKgs15.setRendered(true); + stKgsOutro.setRendered(true); + stKg.setRendered(true); + int carga = a.getRestricao_carga().intValue(); + switch(carga) + { + case 2: + rbKgs2.setSelected(new Boolean(true)); + break; + case 5: + rbKgs5.setSelected(new Boolean(true)); + break; + case 10: + rbKgs10.setSelected(new Boolean(true)); + break; + case 15: + rbKgs15.setSelected(new Boolean(true)); + break; + default: + rbKgsOutro.setSelected(new Boolean(true)); + txtKgs.setText(a.getRestricao_carga().toString()); + break; + } + } + else + { + chkRestricaoCargas.setSelected(new Boolean(false)); + rbKgs2.setRendered(false); + rbKgs5.setRendered(false); + rbKgs10.setRendered(false); + rbKgs15.setRendered(false); + rbKgsOutro.setRendered(false); + txtKgs.setRendered(false); + stKgs2.setRendered(false); + stKgs5.setRendered(false); + stKgs10.setRendered(false); + stKgs15.setRendered(false); + stKgsOutro.setRendered(false); + stKg.setRendered(false); + } + } + else + { + chkRestricaoCargas.setSelected(new Boolean(false)); + rbKgs2.setRendered(false); + rbKgs5.setRendered(false); + rbKgs10.setRendered(false); + rbKgs15.setRendered(false); + rbKgsOutro.setRendered(false); + txtKgs.setRendered(false); + stKgs2.setRendered(false); + stKgs5.setRendered(false); + stKgs10.setRendered(false); + stKgs15.setRendered(false); + stKgsOutro.setRendered(false); + stKg.setRendered(false); + } + + if(a.getRestricao_motricidade().matches("y")) + { + chkRestricaoMotricidade.setSelected(new Boolean(true)); + } + + if(a.getRestricao_conducao().matches("y")) + { + chkRestricaoConducao.setSelected(new Boolean(true)); + } + + if(a.getRestricao_vibracoes().matches("y")) + { + chkRestricaoVibracoes.setSelected(new Boolean(true)); + } + + if(a.getRestricao_outras() != null) + { + if(a.getRestricao_outras().trim().length() > 0) + { + chkRestricaoOutras.setSelected(new Boolean(true)); + txtRestricaoOutras.setText(a.getRestricao_outras()); + } + } + + txtObservacoes.setText(a.getMed_observ()); + + } + + private void fillMedicoView(AnaliseAcidente a) + { + PanelGroup pg = null; + StaticText st = null; + HtmlPanelGrid grd = null; + ImageComponent img = null; + //LESAO : + + if(a.getLesao_cabeca().matches("y")) + { + st = new StaticText(); + st.setId("stLesaoCabeca"); + st.setEscape(false); + st.setText("Cabeça"); + gridLesao.getChildren().add(st); + } + + if(a.getLesao_pescoco().matches("y")) + { + st = new StaticText(); + st.setId("stLesaoPescoco"); + st.setEscape(false); + st.setText("Pescoço"); + gridLesao.getChildren().add(st); + } + + if(a.getLesao_tronco().matches("y")) + { + st = new StaticText(); + st.setId("stLesaoTronco"); + st.setEscape(false); + st.setText("Tronco"); + gridLesao.getChildren().add(st); + } + + grd = new HtmlPanelGrid(); + grd.setId("gridLesaoMembros"); + grd.setColumns(2); + grd.setColumnClasses("gridColLeft"); + if(a.getLesao_membro_sup_dir().matches("y")) + { + st = new StaticText(); + st.setId("stLesaoMembroSupDir"); + st.setEscape(false); + st.setText("Membro Superior Direito"); + grd.getChildren().add(st); + if(a.getEspecif1() != null) + { + if(a.getEspecif1().trim().length() > 0) + { + st = new StaticText(); + st.setId("stEspecif1"); + st.setEscape(false); + st.setText(" - " + a.getEspecif1()); + grd.getChildren().add(st); + } + } + + } + + if(a.getLesao_membro_sup_esq().matches("y")) + { + st = new StaticText(); + st.setId("stLesaoMembroSupEsq"); + st.setEscape(false); + st.setText("Membro Superior Esquerdo"); + grd.getChildren().add(st); + if(a.getEspecif2() != null) + { + if(a.getEspecif2().trim().length() > 0) + { + st = new StaticText(); + st.setId("stEspecif2"); + st.setEscape(false); + st.setText(" - " + a.getEspecif2()); + grd.getChildren().add(st); + } + } + + } + + if(a.getLesao_membro_inf_dir().matches("y")) + { + st = new StaticText(); + st.setId("stLesaoMembroInfDir"); + st.setEscape(false); + st.setText("Membro Inferior Direito"); + grd.getChildren().add(st); + if(a.getEspecif3() != null) + { + if(a.getEspecif3().trim().length() > 0) + { + st = new StaticText(); + st.setId("stEspecif3"); + st.setEscape(false); + st.setText(a.getEspecif3()); + grd.getChildren().add(st); + } + } + } + + if(a.getLesao_membro_inf_esq().matches("y")) + { + st = new StaticText(); + st.setId("stLesaoMembroInfEsq"); + st.setEscape(false); + st.setText("Membro Inferior Esquerdo"); + grd.getChildren().add(st); + if(a.getEspecif4() != null) + { + if(a.getEspecif4().trim().length() > 0) + { + st = new StaticText(); + st.setId("stEspecif4"); + st.setEscape(false); + st.setText(a.getEspecif4()); + grd.getChildren().add(st); + } + } + + } + if(grd.getChildren().size() > 0) + { + gridLesao.getChildren().add(grd); + } + + if(a.getTipo_lesao().trim().length() > 0 ) + { + pg = new PanelGroup(); + pg.setId("pgTipoLesao"); + st = new StaticText(); + st.setId("stTipoLesaoLbl"); + st.setEscape(false); + st.setText("Tipo de lesão:   "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stTipoLesao"); + st.setEscape(false); + st.setText(a.getTipo_lesao()); + pg.getChildren().add(st); + gridLesao.getChildren().add(pg); + } + + //INCAPACIDADE : + pg = new PanelGroup(); + pg.setId("pgTipoIncapacidade"); + st = new StaticText(); + st.setId("stTipoIncapacidadeLbl1"); + st.setStyle("font-weight: bold"); + st.setEscape(false); + st.setText("Tipo de incapacidade:  "); + if(a.getTipo_incapacidade().matches("t")) + { + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stTipoIncapacidade"); + st.setEscape(false); + st.setText("Temporária  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stTipoIncapacidadeLbl2"); + st.setStyle("font-weight: bold"); + st.setEscape(false); + st.setText("Coeficiente de incapacidade:  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stCoefIncapacidade"); + st.setEscape(false); + st.setText(a.getCoef_incapacidade().toString() + "%"); + pg.getChildren().add(st); + } + else if(a.getTipo_incapacidade().matches("p")) + { + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stTipoIncapacidade"); + st.setEscape(false); + st.setText("Permanente  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stTipoIncapacidadeLbl2"); + st.setStyle("font-weight: bold"); + st.setEscape(false); + st.setText("Coeficiente de incapacidade:  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stCoefIncapacidade"); + st.setEscape(false); + st.setText(a.getCoef_incapacidade().toString() + "%"); + pg.getChildren().add(st); + } + + if(pg.getChildren().size() > 0) + { + gridIncapacidade2.getChildren().add(pg); + } + + pg = new PanelGroup(); + if(a.getData_aval_incapacidade() != null) + { + + pg.setId("pgAvaliacaoIncapacidade"); + st = new StaticText(); + st.setId("stDataAvalIncapacidadeLbl1"); + st.setEscape(false); + st.setText("Avaliação de incapacidade realizada em  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stDataAvalIncapacidade"); + st.setEscape(false); + //st.setText(a.getData_aval_incapacidade()); + try + { + java.util.Date ddate = new java.util.Date(a.getData_aval_incapacidade().getTime()); + st.setText(utils.Utils.dateToYYYYMMDD(ddate)); + } + catch(Exception ex){}; + pg.getChildren().add(st); + } + + + if(a.getData_rev_incapacidade() != null) + { + st = new StaticText(); + st.setId("stDataRevIncapacidadeLbl1"); + st.setEscape(false); + st.setText("Revisão de incapacidade em  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stDataRevIncapacidade"); + st.setEscape(false); + //st.setText(a.getData_rev_incapacidade()); + try + { + java.util.Date ddate = new java.util.Date(a.getData_rev_incapacidade().getTime()); + st.setText(utils.Utils.dateToYYYYMMDD(ddate)); + } + catch(Exception ex){}; + pg.getChildren().add(st); + } + + + if(pg.getChildren().size() > 0) + { + gridIncapacidade2.getChildren().add(pg); + } + + + pg = new PanelGroup(); + + if(a.getPeriodo_incapacidade_de() != null || a.getPeriodo_incapacidade_a() != null) + { + + pg.setId("pgPeriodoIncapacidade"); + st = new StaticText(); + st.setId("stPeriodoIncapacidadeLbl1"); + st.setEscape(false); + st.setText("Período de incapacidade temporária de  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stPeriodoIncapacidadeDe"); + st.setEscape(false); + //st.setText(a.getPeriodo_incapacidade_de()); + try + { + java.util.Date ddate = new java.util.Date(a.getPeriodo_incapacidade_de().getTime()); + st.setText(utils.Utils.dateToYYYYMMDD(ddate)); + } + catch(Exception ex){}; + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stPeriodoIncapacidadeLbl2"); + st.setEscape(false); + st.setText("  a  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stPeriodoIncapacidadeA"); + st.setEscape(false); + //st.setText(a.getPeriodo_incapacidade_a()); + try + { + java.util.Date ddate = new java.util.Date(a.getPeriodo_incapacidade_a().getTime()); + st.setText(utils.Utils.dateToYYYYMMDD(ddate)); + } + catch(Exception ex){}; + pg.getChildren().add(st); + + } + + if(pg.getChildren().size() > 0) + { + gridIncapacidade2.getChildren().add(pg); + } + + + //RESTRICOES + +// if(a.getImg_flexao().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgFlexao"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// pg = new PanelGroup(); +// pg.setId("pgImgFlexao"); +// img = new ImageComponent(); +// img.setId("imgRestricoes1000"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/fle1.gif"); +// pg.getChildren().add(img); +// img = new ImageComponent(); +// img.setId("imgRestricoes1001"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/fle2.gif"); +// pg.getChildren().add(img); +// img = new ImageComponent(); +// img.setId("imgRestricoes1002"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/fle3.gif"); +// pg.getChildren().add(img); +// img = new ImageComponent(); +// img.setId("imgRestricoes1003"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/fle4.gif"); +// pg.getChildren().add(img); +// grd.getChildren().add(pg); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl1"); +// st.setEscape(false); +// st.setText("Flexão"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_rot1().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgRot1"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes1005"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/rot1.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl2"); +// st.setEscape(false); +// st.setText("Flexão Lateral"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_rot2().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgRot2"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes1006"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/rot2.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl3"); +// st.setEscape(false); +// st.setText("Rotação"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ext1().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgExt1"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes1007"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ext1.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl4"); +// st.setEscape(false); +// st.setText("Extensão"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ext2().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgExt2"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// pg = new PanelGroup(); +// pg.setId("pgImgExt2"); +// img = new ImageComponent(); +// img.setId("imgRestricoes1008"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ext2.gif"); +// pg.getChildren().add(img); +// img = new ImageComponent(); +// img.setId("imgRestricoes1009"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ext3.gif"); +// pg.getChildren().add(img); +// img = new ImageComponent(); +// img.setId("imgRestricoes1010"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ext4.gif"); +// pg.getChildren().add(img); +// grd.getChildren().add(pg); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl5"); +// st.setEscape(false); +// st.setText("Flexão/Extensão Lateral + Rotação"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_cab1().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgCab1"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10011"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ca1.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl6"); +// st.setEscape(false); +// st.setText("Flexão"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_cab2().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgCab2"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10012"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ca2.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl7"); +// st.setEscape(false); +// st.setText("Extensão"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_cab3().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgCab3"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10013"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ca3.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl8"); +// st.setEscape(false); +// st.setText("Flexão Lateral"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_cab4().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgCab4"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10014"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ca4.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl9"); +// st.setEscape(false); +// st.setText("Rotação"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma1().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa1"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10015"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma1.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl10"); +// st.setEscape(false); +// st.setText("Poronação"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma2().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa2"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10016"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma2.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl11"); +// st.setEscape(false); +// st.setText("Supinação"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma3().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa3"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10017"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma3.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl12"); +// st.setEscape(false); +// st.setText("Flexão"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma4().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa4"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10018"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma4.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl13"); +// st.setEscape(false); +// st.setText("Extensão"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma5().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa5"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10019"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma5.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl14"); +// st.setEscape(false); +// st.setText("Desvio Ulnar"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma6().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa6"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10020"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma6.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl15"); +// st.setEscape(false); +// st.setText("Desvio Radial"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma7().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa7"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10021"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma7.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl16"); +// st.setEscape(false); +// st.setText("Pinça Digital"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma8().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa8"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10022"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma8.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl17"); +// st.setEscape(false); +// st.setText("Segurar objectos entre os dedos"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma9().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa9"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10023"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma9.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl18"); +// st.setEscape(false); +// st.setText("Dedos em extensão"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma10().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa10"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10024"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma10.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl19"); +// st.setEscape(false); +// st.setText("Pega palmar"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getRestricao_carga() != null) +// { +// if(a.getRestricao_carga().intValue() > 0) +// { +// pg = new PanelGroup(); +// st = new StaticText(); +// st.setId("stRestricaoCargaLbl"); +// st.setEscape(false); +// st.setText("Movimentação e manipulação de cargas com mais de  "); +// pg.getChildren().add(st); +// st = new StaticText(); +// st.setId("stRestricaoCargaKgs"); +// st.setEscape(false); +// st.setText(a.getRestricao_carga().toString()); +// pg.getChildren().add(st); +// st = new StaticText(); +// st.setId("stRestricaoCargaLbl1"); +// st.setEscape(false); +// st.setText("Kg"); +// pg.getChildren().add(st); +// gridOutrasRestricoes.getChildren().add(pg); +// } +// +// if(a.getRestricao_motricidade().matches("y")) +// { +// st = new StaticText(); +// st.setId("stRestricaoMotricidadeLbl"); +// st.setEscape(false); +// st.setText("Operações que requeiram motricidade fina."); +// gridOutrasRestricoes.getChildren().add(st); +// } +// +// if(a.getRestricao_conducao().matches("y")) +// { +// st = new StaticText(); +// st.setId("stRestricaoConducaoLbl"); +// st.setEscape(false); +// st.setText("Condução/interacção com veículos ou outros equipamentos."); +// gridOutrasRestricoes.getChildren().add(st); +// } +// +// if(a.getRestricao_vibracoes().matches("y")) +// { +// st = new StaticText(); +// st.setId("stRestricaoVibracoesLbl"); +// st.setEscape(false); +// st.setText("Utilizaçõo de equipamentos/ferramentas que impliquem exposição a vibrações ou impactos."); +// gridOutrasRestricoes.getChildren().add(st); +// } +// +// if(a.getRestricao_outras().trim().length() > 0) +// { +// st = new StaticText(); +// st.setId("stRestricaoOutras"); +// st.setEscape(false); +// st.setText(a.getRestricao_outras()); +// gridOutrasRestricoes.getChildren().add(st); +// } +// +// if(a.getMed_observ().trim().length() > 0) +// { +// stObservacoes.setText(a.getMed_observ()); +// } +// } + + } +// private String getPageFrom(String referer) +// { +// String pageFrom = referer.substring(referer.lastIndexOf("/")+1); +// return pageFrom; +// } + +// public String lnkNome_action() { +// // TODO: Replace with your code +// RowKey rk = tableRowGroup1.getRowKey(); +// int k = Integer.parseInt(rk.getRowId()); +// TrabalhadoresListDataProvider provider = (TrabalhadoresListDataProvider) tableRowGroup1.getSourceData(); +// ArrayList list = (ArrayList) provider.getList(); +// Trabalhador t = (Trabalhador)list.get(k); +// txtTrabalhador.setText(t.getNome()); +// txtNomeAcidentado.setText(t.getNome()); +// txtDataNascimento.setText(t.getData_nascimento()); +// Acidentado a = new Acidentado(); +// a.setTrabalhador_id(t.getId()); +// a.setData_nascimento(t.getData_nascimento()); +// a.setNome(t.getNome()); +// a.setFuncao(utils.Utils.unicodeToHTML(t.getFuncao())); +// a.setData_admissao(t.getData_admissao()); +// getSessionBean1().setAcidentado(a); +// if(getSessionBean1().getCurrentAnalise() != null) // new analise) +// { +// gridTrabalhadores.setRendered(false); +// } +// +// return null; +// } + +// public String lnkDataNascimento_action() { +// // TODO: Replace with your code +// RowKey rk = tableRowGroup1.getRowKey(); +// int k = Integer.parseInt(rk.getRowId()); +// TrabalhadoresListDataProvider provider = (TrabalhadoresListDataProvider) tableRowGroup1.getSourceData(); +// ArrayList list = (ArrayList) provider.getList(); +// Trabalhador t = (Trabalhador)list.get(k); +// txtTrabalhador.setText(t.getNome()); +// txtNomeAcidentado.setText(t.getNome()); +// txtDataNascimento.setText(t.getData_nascimento()); +// Acidentado a = new Acidentado(); +// a.setTrabalhador_id(t.getId()); +// a.setData_nascimento(t.getData_nascimento()); +// a.setNome(t.getNome()); +// a.setFuncao(t.getFuncao()); +// a.setData_admissao(t.getData_admissao()); +// getSessionBean1().setAcidentado(a); +// if(getSessionBean1().getCurrentAnalise() != null) // new analise) +// { +// gridTrabalhadores.setRendered(false); +// } +// return null; +// } + + private void fillVerificacao(AnaliseAcidente a) + { + int estado = a.getEstado().intValue(); + switch(estado) + { + case Global.ESTADO_ASSINATURA_SEG: + if(a.getAss_resp_seg().matches("y")) + { + chkVerRespSeg.setSelected(new Boolean(true)); + chkVerRespSeg.setDisabled(true); + java.util.Date ddate = new java.util.Date(a.getData_assinatura_seg().getTime()); + stVerRespSeg.setText("Tomei conhecimento a " + utils.Utils.dateToYYYYMMDD(ddate)); + } + break; + + case Global.ESTADO_ASSINATURA_RH: + if(a.getAss_resp_rh().matches("y")) + { + chkVerRespRh.setSelected(new Boolean(true)); + chkVerRespRh.setDisabled(true); + java.util.Date ddate = new java.util.Date(a.getData_assinatura_rh().getTime()); + stVerRespRh.setText("Tomei conhecimento a " + utils.Utils.dateToYYYYMMDD(ddate)); + } + + break; + } + } + + private void fillVerificacaoView(AnaliseAcidente a) + { + StaticText st = null; + String txtVer = null; + if(a.getAveriguador() != null) + { + if(a.getAveriguador().trim().length() > 0) + { + st = new StaticText(); + st.setId("stVerificacao1"); + st.setEscape(false); + txtVer = "Averiguado por " + a.getAveriguador() + " (Departamento de Segurança) a "; + //txtVer += a.getData_assinatura_seg(); + + try + { + java.util.Date ddate = new java.util.Date(a.getData_inicio_processo().getTime()); + txtVer += utils.Utils.dateToYYYYMMDD(ddate) + "."; + } + catch(Exception ex){}; + st.setText(txtVer); + gridAssinaturasView.getChildren().add(st); + } + } + + if(a.getAss_consolidacao().matches("y")) + { + st = new StaticText(); + st.setId("stVerificacao2"); + st.setEscape(false); + txtVer = "Verificado por " + a.getNome_resp_consolidacao() + " (Técnico de SHST) a "; + //txtVer += a.getData_assinatura_rh(); + try + { + java.util.Date ddate = new java.util.Date(a.getData_consolidacao().getTime()); + txtVer += utils.Utils.dateToYYYYMMDD(ddate) + "."; + } + catch(Exception ex){}; + st.setText(txtVer); + gridAssinaturasView.getChildren().add(st); + } + + if(a.getAss_resp_seg().matches("y")) + { + st = new StaticText(); + st.setId("stVerificacao3"); + st.setEscape(false); + txtVer = "Verificado por " + a.getNome_resp_seg() + " (Responsável de Segurança) a "; + //txtVer += a.getData_assinatura_rh(); + try + { + java.util.Date ddate = new java.util.Date(a.getData_assinatura_seg().getTime()); + txtVer += utils.Utils.dateToYYYYMMDD(ddate) + "."; + } + catch(Exception ex){}; + st.setText(txtVer); + gridAssinaturasView.getChildren().add(st); + } + + if(a.getAss_resp_rh().matches("y")) + { + st = new StaticText(); + st.setId("stVerificacao4"); + st.setEscape(false); + txtVer = "Verificado por " + a.getNome_resp_rh() + " (Responsável de RH) a "; + //txtVer += a.getData_assinatura_rh(); + try + { + java.util.Date ddate = new java.util.Date(a.getData_assinatura_rh().getTime()); + txtVer += utils.Utils.dateToYYYYMMDD(ddate) + "."; + } + catch(Exception ex){}; + st.setText(txtVer); + gridAssinaturasView.getChildren().add(st); + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + Acidentado ac = adp.getAcidentado(a.getAcidentado_id()); + if(ac.getNome_superior_hierarquico() != null) + { + if(ac.getNome_superior_hierarquico().trim().length() > 0) + { + st = new StaticText(); + st.setId("stVerificacao5"); + st.setEscape(false); + txtVer = "Com conhecimento de " + ac.getNome_superior_hierarquico() + " (Responsável hierárquico)"; + + if(ac.getEmail_superior_hierarquico() != null) + { + if(ac.getEmail_superior_hierarquico().trim().length() > 0) + { + try + { + java.util.Date ddate = new java.util.Date(ac.getData_email_superior_hierarquico().getTime()); + txtVer += " a " + utils.Utils.dateToYYYYMMDD(ddate); + } + catch(Exception ex){}; + } + } + txtVer += "."; + st.setText(txtVer); + gridAssinaturasView.getChildren().add(st); + } + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + HtmlPanelGrid grid = new HtmlPanelGrid(); + grid.setId("rodape1"); + grid.setColumns(1); + grid.setStyle("width: 100%"); + grid.setColumnClasses("gridColCenter"); + st = new StaticText(); + st.setId("stRodape1"); + st.setEscape(false); + st.setText("- processamento informático - acesso autenticado -"); + grid.getChildren().add(st); + gridAssinaturasView.getChildren().add(grid); + } + + + private AnaliseAcidente fillAnaliseFieldsImpressao(AnaliseAcidente a) + { + a.setAss_superior("n"); + if(chkAssSup.getSelected() != null) + { + if(chkAssSup.getSelected().equals(new Boolean(true))) + { + a.setAss_superior("y"); + } + } + + if(a.getAss_superior().matches("y")) + { + a.setNome_superior(""); + if(txtAssSup.getText() != null) + { + a.setNome_superior( (String) txtAssSup.getText()); + } + java.util.Date today = + new java.util.Date(); + java.sql.Date sqlToday = + new java.sql.Date(today.getTime()); + a.setData_assinatura_superior(sqlToday); + } + else + { + a.setNome_superior(""); + a.setData_assinatura_superior(null); + } + return a; + } + + private void fillImpressao(AnaliseAcidente a) + { + if(a.getAss_superior().matches("y")) + { + chkAssSup.setSelected(new Boolean(true)); + txtAssSup.setText(a.getNome_superior()); + String txt = (String) stAssSup2.getText(); + String nome_acidentado = getSessionBean1().getAcidentado().getNome(); + String stData = ""; + try + { + java.util.Date ddate = new java.util.Date(a.getData_assinatura_superior().getTime()); + stData += utils.Utils.dateToYYYYMMDD(ddate); + } + catch(Exception ex){}; + stAssSup2.setText(txt + nome_acidentado + ", a " + stData); + } + + } + + private void fillImpressaoView(AnaliseAcidente a) + { + StaticText st = new StaticText(); + st.setId("stImpressaoView1"); + st.setEscape(false); + String stData = ""; + try + { + java.util.Date ddate = new java.util.Date(a.getData_assinatura_superior().getTime()); + stData += utils.Utils.dateToYYYYMMDD(ddate); + } + catch(Exception ex){}; + + String txt = "Assinado na Ficha de Análise de Acidente em papel por " + a.getNome_superior() + ", superior hierárquico / superior de "; + txt += getSessionBean1().getAcidentado().getNome() + ", a " + stData; + gridAssSupView.getChildren().add(st); + } + + public String butImagem_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + getSessionBean1().setIeBug(true); + savePageState(); + return "load_image"; + } + + private void fillImages() + { +// String imageName = getSessionBean1().getImageName(); +// if(imageName != null) +// { +// ImageComponent newImg = new ImageComponent(); +// newImg.setUrl("/resources/imagens/" + imageName); +// System.out.println("IMAGE URL : " + "/resources/imagens/" + imageName); +// newImg.setRendered(true); +// gridImages.getChildren().add(newImg); +// System.out.println("HERE"); +// } +// if(gridImages.getChildren().size() > 0) +// { +// gridImages.getChildren().clear(); +// } + ServletContext theApplicationsServletContext = + (ServletContext) this.getExternalContext().getContext(); + + + File apacheTmpFolder = new File(theApplicationsServletContext.getRealPath( Global.RESOURCES_IMAGE_FOLDER ) + "/tmp" + getSessionBean1().getCurrentUser().getLogin()); + if(apacheTmpFolder.exists()) + { + Global global = new Global(); + global.deleteFolderFiles(apacheTmpFolder); + } + else + { + apacheTmpFolder.mkdir(); + } + +// String imageFileFolder = theApplicationsServletContext.getRealPath(Global.IMAGE_FOLDER + "/tmp" + getSessionBean1().getCurrentUser().getLogin()); + String imageFileFolder = Global.IMAGE_FOLDER + "/tmp" + getSessionBean1().getCurrentUser().getLogin(); + try + { + File f = new File(imageFileFolder); + + if(f.exists()) + { + File files[] = f.listFiles(); + //List list = Arrays.asList(files); + Arrays.sort(files); + for(int i=0;i 0) + { + a.setBilhete_identidade(bi); + } + } + + a.setMorada(""); + if(txtMorada.getText() != null) + { + String morada = (String) txtMorada.getText(); + if(morada.trim().length() > 0) + { + a.setMorada( morada ); + } + } + + a.setCod_postal(""); + String cod_postal = ""; + if(txtCodPostal1.getText() != null ) + { + String cod_postal1 = (String) txtCodPostal1.getText(); + String cod_postal2 = ""; + if(txtCodPostal2.getText() != null) + { + cod_postal2 = (String) txtCodPostal2.getText(); + } + if(cod_postal1.trim().length() > 0) + { + cod_postal =(String) txtCodPostal1.getText() + "-" + (String) txtCodPostal2.getText(); + a.setCod_postal( cod_postal); + } + + } + + a.setLocalidade(""); + if(txtLocalidade.getText() != null) + { + String localidade = (String) txtLocalidade.getText(); + if(localidade.trim().length() > 0) + { + a.setLocalidade( localidade); + } + } + + a.setContacto_telefonico(""); + if(txtContactoTelefonico.getText() != null) + { + String contacto_telefonico = (String) txtContactoTelefonico.getText(); + if(contacto_telefonico.trim().length() > 0) + { + a.setContacto_telefonico( contacto_telefonico ); + } + } + + + a.setTurno("v"); // null + if(rbTurnoManha.getValue() != null) + { + if(rbTurnoManha.getValue().equals(new Boolean(true))) + { + a.setTurno("m"); + } + } + if(rbTurnoTarde.getValue() != null) + { + if(rbTurnoTarde.getValue().equals(new Boolean(true))) + { + a.setTurno("t"); + } + } + if(rbTurnoNoite.getValue() != null) + { + if(rbTurnoNoite.getValue().equals(new Boolean(true))) + { + a.setTurno("n"); + } + } + + if(txtNomeSuperior.getText() != null) + { + a.setNome_superior_hierarquico((String) txtNomeSuperior.getText()); + } + + if(txtEmailSuperior.getText() != null) + { + a.setEmail_superior_hierarquico((String) txtEmailSuperior.getText()); + java.util.Date today = + new java.util.Date(); + java.sql.Date sqlToday = + new java.sql.Date(today.getTime()); + a.setData_email_superior_hierarquico(sqlToday); + } + + return a; + } + + private AnaliseAcidente fillAnaliseFields() + { + int estado = 0; + AnaliseAcidente a = null; + //fill analise fields + if(getSessionBean1().getCurrentAnalise() == null) //null + { + a = new AnaliseAcidente(); + a.setEspecif1(""); + a.setEspecif2(""); + a.setEspecif3(""); + a.setEspecif4(""); + a.setRestricao_outras(""); + a.setTipo_lesao(""); + a.setMed_observ(""); + estado = Global.ESTADO_SEG; + a.setEstado(new Integer(estado)); + } + else + { + a = getSessionBean1().getCurrentAnalise(); + estado = a.getEstado().intValue(); + } + + + //averiguacao posterior +// if(estado < Global.ESTADO_ASSINATURAS) + if(estado <= Global.ESTADO_ASSINATURA_SEG) + { + if(getSessionBean1().getCurrentUser().getTipo().intValue() == 1) //seguranca + { + if(a.getAveriguacao_posterior().matches("y")) + { + if(txtAveriguacaoObs1.getText() != null) + { + a.setAveriguacao_obs((String) txtAveriguacaoObs1.getText()); + } + } + } + } + + switch(estado) + { + case Global.ESTADO_SEG: + a = fillAnaliseFieldsSeg(a); + break; + case Global.ESTADO_RH1: + //a = fillAnaliseFieldsSeg(a); + a = fillAnaliseFieldsRH1(a); + break; + case Global.ESTADO_HS: + //a = fillAnaliseFieldsHS(a); + break; + case Global.ESTADO_RH2: + a = fillAnaliseFieldsMedico(a); + //a = fillAnaliseFieldsRH2(a); + break; +// case Global.ESTADO_MEDICINA: +// a = fillAnaliseFieldsMedico(a); +// break; + case Global.ESTADO_CONSOLIDACAO: + a = fillAnaliseFieldsConsolidacao(a); + break; +// case Global.ESTADO_ASSINATURAS: + case Global.ESTADO_ASSINATURA_SEG: + a = fillAnaliseAssinaturas(a); + break; + case Global.ESTADO_ASSINATURA_RH: + a = fillAnaliseAssinaturas(a); + break; + + } + + return a; + } + + private AnaliseAcidente fillAnaliseFieldsSeg(AnaliseAcidente a) + { + if(txtAveriguador.getText() != null) + { + a.setAveriguador((String) txtAveriguador.getText()); + } + + java.util.Date today = + new java.util.Date(); + java.sql.Date sqlToday = + new java.sql.Date(today.getTime()); + //if(a.getData_acidente() == null) + //{ + // a.setData_acidente(sqlToday); + //} + //else + //{ + DateFormat formatador = new SimpleDateFormat("yyyy-MM-dd"); + + java.util.Date ddate = (java.util.Date) calDataOcorrencia.getValue(); + try + { + String ddate_str = formatador.format(ddate); + java.sql.Date ddate_sql = new java.sql.Date(formatador.parse(ddate_str).getTime()); + a.setData_acidente(ddate_sql); + } + catch(Exception ex) + { + a.setData_acidente(null); + } + //} + + if(a.getData_inicio_processo() == null) + { + a.setData_inicio_processo(sqlToday); + } + + Integer hhInt = (Integer) drpHours.getSelected(); + Integer mmInt = (Integer) drpMinutes.getSelected(); + + if(hhInt.intValue() == -1 || mmInt.intValue() == -1) + { + a.setHora_acidente(null); + } + else + { +// String hh = drpHours.getSelected().toString(); +// String mm = drpMinutes.getSelected().toString(); + String hh = hhInt.toString(); + String mm = mmInt.toString(); + SimpleDateFormat formatter = new SimpleDateFormat ( "HH:mm" ); + try + { + Time horaAcidente = new Time(formatter.parse( hh + ":" + mm ).getTime()); + a.setHora_acidente(horaAcidente); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + } + + + + if(getSessionBean1().getCurrentAnalise() == null) // new + { + a.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id()); + a.setEstabelecimento_id(getSessionBean1().getCurrentUser().getEstabelecimento_id()); + } + +// Integer medico_id = (Integer) drpMedicos.getSelected(); + Medico m = getSessionBean1().getMedico(); + if(m != null) + { + Integer medico_id = m.getId(); + if(medico_id.intValue() > 0) + { + a.setMedico_id(medico_id); + } + + } + + Integer horas_turno = null; + try + { + String horas_turno_str = (String) txtHorasTurno.getText(); + horas_turno = new Integer( Integer.parseInt(horas_turno_str) ); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + a.setHoras_turno(horas_turno); + +// try +// { +// if(txtSeccao.getText() != null) +// { +// a.setSeccao( (String) txtSeccao.getText() ); +// } +// else +// { +// a.setSeccao(""); +// } +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } + + a.setDepartamento_id(( Integer ) drpDepartamento.getSelected()); + a.setSeccao_id((Integer) drpSeccao.getSelected()); + + try + { + if(txtLocal.getText() != null) + { + a.setLocal_trabalho( (String) txtLocal.getText() ); + } + else + { + a.setLocal_trabalho(""); + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + try + { + if(txtTarefa.getText() != null) + { + a.setTarefa( (String) txtTarefa.getText() ); + } + else + { + a.setTarefa(""); + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + try + { + if(txtSubstancias.getText() != null) + { + a.setSubstancias( (String) txtSubstancias.getText() ); + } + else + { + a.setSubstancias(""); + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + +// try +// { +// if(txtSuperior.getText() != null) +// { +// a.setSuperior_hierarquico( (String) txtSuperior.getText() ); +// } +// else +// { +// a.setSuperior_hierarquico(""); +// } +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } + + try + { + if(txtCondicoes.getText() != null) + { + a.setCondicoes( (String) txtCondicoes.getText() ); + } + else + { + a.setCondicoes(""); + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + try + { + if(txtTestemunhas.getText() != null) + { + a.setTestemunhas( (String) txtTestemunhas.getText() ); + } + else + { + a.setTestemunhas(""); + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + +// try +// { +// if(txtCausas.getText() != null) +// { +// a.setCausas( (String) txtCausas.getText() ); +// } +// else +// { +// a.setCausas(""); +// } +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } + + a.setCausas((Integer) drpCausas.getSelected()); + + try + { + if(txtDescricao.getText() != null) + { + a.setDescricao( (String) txtDescricao.getText() ); + } + else + { + a.setDescricao(""); + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + try + { + if(txtConclusoes.getText() != null) + { + a.setConclusoes( (String) txtConclusoes.getText() ); + } + else + { + a.setConclusoes(""); + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + try + { + if(txtAccoes.getText() != null) + { + a.setAccoes( (String) txtAccoes.getText() ); + } + else + { + a.setAccoes(""); + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + a.setAveriguacao_posterior("n"); + if(chkAveriguacaoPosterior.getSelected() != null) + { + if(chkAveriguacaoPosterior.getSelected().equals(new Boolean(true))) + { + a.setAveriguacao_posterior("y"); + } + } + + if(txtAveriguacaoObs.getText() != null) + { + a.setAveriguacao_obs((String) txtAveriguacaoObs.getText()); + } + return a; + } + + private AnaliseAcidente fillAnaliseFieldsRH1(AnaliseAcidente a) + { + boolean booFormacaoSHST = false; + if(rbFormacaoSHSTY.getSelected() != null) + { + Boolean f = (Boolean) rbFormacaoSHSTY.getSelected(); + if(f.equals(new Boolean(true))) + { + a.setFormacao_shst("y"); + booFormacaoSHST = true; + } + } + + if(!booFormacaoSHST) + { + if(rbFormacaoSHSTN.getSelected() != null) + { + Boolean f = (Boolean) rbFormacaoSHSTN.getSelected(); + if(f.equals(new Boolean(true))) + { + a.setFormacao_shst("n"); + a.setFormacao_shst_nao_porque(""); + if(txtFormacaoSHSTNWhy.getText() != null) + { + String s = (String) txtFormacaoSHSTNWhy.getText(); + if(s.trim().length() > 0 ) + { + a.setFormacao_shst_nao_porque( s ); + } + } + } + } + else + { + a.setFormacao_shst("t"); + } + } + + boolean booAcidentesColaborador = false; + a.setOutros_acidentes_com_colaborador("n"); + if(rbAcidentesColaboradorY.getSelected() != null) + { + Boolean f = (Boolean) rbAcidentesColaboradorY.getSelected(); + if(f.equals(new Boolean(true))) + { + a.setOutros_acidentes_com_colaborador("y"); + booAcidentesColaborador = true; + if(txtNrAcidentesColaborador.getText() != null) + { + String nr_str = (String) txtNrAcidentesColaborador.getText(); + if(nr_str.trim().length() > 0) + { + try + { + Integer nr = new Integer(Integer.parseInt(nr_str)); + a.setNr_acidentes_com_colaborador(nr); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + } + + if(txtNrRelatorioAcidentesColaborador1.getText() != null) + { + String nr_str = (String) txtNrRelatorioAcidentesColaborador1.getText(); + if(nr_str.trim().length() > 0) + { + try + { + Integer nr = new Integer(Integer.parseInt(nr_str)); + a.setNr_relatorio_acidente_colaborador1(nr); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + } + if(txtNrRelatorioAcidentesColaborador2.getText() != null) + { + String nr_str = (String) txtNrRelatorioAcidentesColaborador2.getText(); + if(nr_str.trim().length() > 0) + { + try + { + Integer nr = new Integer(Integer.parseInt(nr_str)); + a.setNr_relatorio_acidente_colaborador2(nr); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + } + if(txtNrRelatorioAcidentesColaborador3.getText() != null) + { + String nr_str = (String) txtNrRelatorioAcidentesColaborador3.getText(); + if(nr_str.trim().length() > 0) + { + try + { + Integer nr = new Integer(Integer.parseInt(nr_str)); + a.setNr_relatorio_acidente_colaborador3(nr); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + } + if(txtNrRelatorioAcidentesColaborador4.getText() != null) + { + String nr_str = (String) txtNrRelatorioAcidentesColaborador4.getText(); + if(nr_str.trim().length() > 0) + { + try + { + Integer nr = new Integer(Integer.parseInt(nr_str)); + a.setNr_relatorio_acidente_colaborador4(nr); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + } + } + } + + if(!booAcidentesColaborador) + { + if(rbAcidentesColaboradorN.getSelected() != null) + { + Boolean f = (Boolean) rbAcidentesColaboradorN.getSelected(); + if(f.equals(new Boolean(true))) + { + a.setOutros_acidentes_com_colaborador("n"); + } + } + else + { + a.setOutros_acidentes_com_colaborador("t"); + } + } + + boolean booAcidentesColaboradores = false; + if(rbAcidentesColaboradoresY.getSelected() != null) + { + Boolean f = (Boolean) rbAcidentesColaboradoresY.getSelected(); + if(f.equals(new Boolean(true))) + { + a.setAcidentes_outros_colaboradores("y"); + booAcidentesColaboradores = true; + if(txtNrAcidentesColaboradores.getText() != null) + { + String nr_str = (String) txtNrAcidentesColaboradores.getText(); + if(nr_str.trim().length() > 0) + { + try + { + Integer nr = new Integer(Integer.parseInt(nr_str)); + a.setNr_acidentes_outros_colaboradores(nr); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + } + + if(txtNrRelatorioAcidentesColaboradores1.getText() != null) + { + String nr_str = (String) txtNrRelatorioAcidentesColaboradores1.getText(); + if(nr_str.trim().length() > 0) + { + try + { + Integer nr = new Integer(Integer.parseInt(nr_str)); + a.setNr_relatorio_acidente_outros_colaboradores1(nr); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + } + if(txtNrRelatorioAcidentesColaboradores2.getText() != null) + { + String nr_str = (String) txtNrRelatorioAcidentesColaboradores2.getText(); + if(nr_str.trim().length() > 0) + { + try + { + Integer nr = new Integer(Integer.parseInt(nr_str)); + a.setNr_relatorio_acidente_outros_colaboradores2(nr); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + } + if(txtNrRelatorioAcidentesColaboradores3.getText() != null) + { + String nr_str = (String) txtNrRelatorioAcidentesColaboradores3.getText(); + if(nr_str.trim().length() > 0) + { + try + { + Integer nr = new Integer(Integer.parseInt(nr_str)); + a.setNr_relatorio_acidente_outros_colaboradores3(nr); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + } + if(txtNrRelatorioAcidentesColaboradores4.getText() != null) + { + String nr_str = (String) txtNrRelatorioAcidentesColaboradores4.getText(); + if(nr_str.trim().length() > 0) + { + try + { + Integer nr = new Integer(Integer.parseInt(nr_str)); + a.setNr_relatorio_acidente_outros_colaboradores4(nr); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + } + + } + } + + if(!booAcidentesColaboradores) + { + if(rbAcidentesColaboradoresN.getSelected() != null) + { + Boolean f = (Boolean) rbAcidentesColaboradoresN.getSelected(); + if(f.equals(new Boolean(true))) + { + a.setAcidentes_outros_colaboradores("n"); + } + } + else + { + a.setAcidentes_outros_colaboradores("t"); + } + } + + return a; + } + + private ArrayList fillAnaliseRecomendacoesHs(AnaliseAcidente a) + { + System.out.println("FILL RECOMENDACOES"); + ArrayList list = new ArrayList(); + ListIterator iter = gridRecomendacoes.getChildren().listIterator(); + while(iter.hasNext()) + { + HtmlPanelGrid grd = (HtmlPanelGrid)iter.next(); + TextArea ta = (TextArea) grd.getChildren().get(1); + if(ta.getText() != null ) + { + String txt = (String) ta.getText(); + if(txt.trim().length() > 0) + { + Recomendacao r = new Recomendacao(); + r.setAnalise_id(a.getId()); + r.setRecomendacao(txt); + list.add(r); + } + } + } + return list; + } + + private ArrayList fillAnaliseMedidasRh(AnaliseAcidente a) + { + ArrayList list = new ArrayList(); + ListIterator iter = gridMedidas.getChildren().listIterator(); + while(iter.hasNext()) + { + HtmlPanelGrid grd = (HtmlPanelGrid)iter.next(); + TextArea ta = (TextArea) grd.getChildren().get(1); + if(ta.getText() != null ) + { + String txt = (String) ta.getText(); + if(txt.trim().length() > 0) + { + Medida m = new Medida(); + m.setAnalise_id(a.getId()); + m.setMedida(txt); + list.add(m); + } + } + } + return list; + } + + private AnaliseAcidente fillAnaliseFieldsRH2(AnaliseAcidente a) + { + return a; + } + + private AnaliseAcidente fillAnaliseFieldsMedico(AnaliseAcidente a) + { + a.setLesao_cabeca("n"); + if(chkCabeca.getSelected() != null) + { + if(chkCabeca.getSelected().equals(new Boolean(true))) + { + a.setLesao_cabeca("y"); + } + } + + a.setLesao_pescoco("n"); + if(chkPescoco.getSelected() != null) + { + if(chkPescoco.getSelected().equals(new Boolean(true))) + { + a.setLesao_pescoco("y"); + } + } + + a.setLesao_tronco("n"); + if(chkTronco.getSelected() != null) + { + if(chkTronco.getSelected().equals(new Boolean(true))) + { + a.setLesao_tronco("y"); + } + } + + a.setEspecif1(""); + a.setEspecif2(""); + a.setEspecif3(""); + a.setEspecif4(""); + + a.setLesao_membro_sup_dir("n"); + if(chkMembroSupDir.getSelected() != null) + { + if(chkMembroSupDir.getSelected().equals(new Boolean(true))) + { + a.setLesao_membro_sup_dir("y"); + if(txtEspecif1.getText() != null) + { + a.setEspecif1((String) txtEspecif1.getText()); + } + } + } + + a.setLesao_membro_sup_esq("n"); + if(chkMembroSupEsq.getSelected() != null) + { + if(chkMembroSupEsq.getSelected().equals(new Boolean(true))) + { + a.setLesao_membro_sup_esq("y"); + if(txtEspecif2.getText() != null) + { + a.setEspecif2((String) txtEspecif2.getText()); + } + } + } + + a.setLesao_membro_inf_dir("n"); + if(chkMembroInfDir.getSelected() != null) + { + if(chkMembroInfDir.getSelected().equals(new Boolean(true))) + { + a.setLesao_membro_inf_dir("y"); + if(txtEspecif3.getText() != null) + { + a.setEspecif3((String) txtEspecif3.getText()); + } + } + } + + a.setLesao_membro_inf_esq("n"); + if(chkMembroInfEsq.getSelected() != null) + { + if(chkMembroInfEsq.getSelected().equals(new Boolean(true))) + { + a.setLesao_membro_inf_esq("y"); + if(txtEspecif4.getText() != null) + { + a.setEspecif4((String) txtEspecif4.getText()); + } + } + } + + a.setTipo_lesao(""); + if(txtTipoLesao.getText() != null) + { + a.setTipo_lesao((String) txtTipoLesao.getText()); + } + + a.setTipo_incapacidade("v"); + if(rbIncapacidadeNone.getSelected() != null) + { + if(rbIncapacidadeNone.getSelected().equals(new Boolean(true))) + { + a.setTipo_incapacidade("n"); + } + } + if(rbIncapacidadeTemp.getSelected() != null) + { + if(rbIncapacidadeTemp.getSelected().equals(new Boolean(true))) + { + a.setTipo_incapacidade("t"); + } + } + if(rbIncapacidadePerm.getSelected() != null) + { + if(rbIncapacidadePerm.getSelected().equals(new Boolean(true))) + { + a.setTipo_incapacidade("p"); + } + } + + if(txtCoefIncapacidade.getText() != null) + { + String coef_str = txtCoefIncapacidade.getText().toString(); + try + { + int coef = Integer.parseInt(coef_str); + a.setCoef_incapacidade(new Integer(coef)); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + + DateFormat formatador = new SimpleDateFormat("yyyy-MM-dd"); + + java.util.Date ddate = (java.util.Date) calAvaliacaoIncap.getValue(); + try + { + String ddate_str = formatador.format(ddate); + java.sql.Date ddate_sql = new java.sql.Date(formatador.parse(ddate_str).getTime()); + a.setData_aval_incapacidade(ddate_sql); + } + catch(Exception ex) + { + a.setData_aval_incapacidade(null); + } + + ddate = (java.util.Date) calRevisaoIncap.getValue(); + + try + { + String ddate_str = formatador.format(ddate); + java.sql.Date ddate_sql = new java.sql.Date(formatador.parse(ddate_str).getTime()); + a.setData_rev_incapacidade(ddate_sql); + } + catch(Exception ex) + { + a.setData_rev_incapacidade(null); + } + + ddate = (java.util.Date) calPeridoIncapDe.getValue(); + try + { + String ddate_str = formatador.format(ddate); + java.sql.Date ddate_sql = new java.sql.Date(formatador.parse(ddate_str).getTime()); + a.setPeriodo_incapacidade_de(ddate_sql); + } + catch(Exception ex) + { + a.setPeriodo_incapacidade_de(null); + } + + ddate = (java.util.Date) calPeriodoIncapA.getValue(); + try + { + String ddate_str = formatador.format(ddate); + java.sql.Date ddate_sql = new java.sql.Date(formatador.parse(ddate_str).getTime()); + a.setPeriodo_incapacidade_a(ddate_sql); + } + catch(Exception ex) + { + a.setPeriodo_incapacidade_a(null); + } + +// a.setImg_flexao("n"); +// if(chkImgFlexao.getSelected() != null) +// { +// if(chkImgFlexao.getSelected().equals(new Boolean(true))) +// { +// a.setImg_flexao("y"); +// } +// } +// +// a.setImg_rot1("n"); +// if(chkImgRot1.getSelected() != null) +// { +// if(chkImgRot1.getSelected().equals(new Boolean(true))) +// { +// a.setImg_rot1("y"); +// } +// } +// +// a.setImg_rot2("n"); +// if(chkImgRot2.getSelected() != null) +// { +// if(chkImgRot2.getSelected().equals(new Boolean(true))) +// { +// a.setImg_rot2("y"); +// } +// } +// +// a.setImg_ext1("n"); +// if(chkImgExt1.getSelected() != null) +// { +// if(chkImgExt1.getSelected().equals(new Boolean(true))) +// { +// a.setImg_ext1("y"); +// } +// } +// +// a.setImg_ext2("n"); +// if(chkImgExt2.getSelected() != null) +// { +// if(chkImgExt2.getSelected().equals(new Boolean(true))) +// { +// a.setImg_ext2("y"); +// } +// } +// +// a.setImg_cab1("n"); +// if(chkImgCab1.getSelected() != null) +// { +// if(chkImgCab1.getSelected().equals(new Boolean(true))) +// { +// a.setImg_cab1("y"); +// } +// } +// +// a.setImg_cab2("n"); +// if(chkImgCab2.getSelected() != null) +// { +// if(chkImgCab2.getSelected().equals(new Boolean(true))) +// { +// a.setImg_cab2("y"); +// } +// } +// +// a.setImg_cab3("n"); +// if(chkImgCab3.getSelected() != null) +// { +// if(chkImgCab3.getSelected().equals(new Boolean(true))) +// { +// a.setImg_cab3("y"); +// } +// } +// +// a.setImg_cab4("n"); +// if(chkImgCab4.getSelected() != null) +// { +// if(chkImgCab4.getSelected().equals(new Boolean(true))) +// { +// a.setImg_cab4("y"); +// } +// } +// +// a.setImg_ma1("n"); +// if(chkImgMa1.getSelected() != null) +// { +// if(chkImgMa1.getSelected().equals(new Boolean(true))) +// { +// a.setImg_ma1("y"); +// } +// } +// +// a.setImg_ma2("n"); +// if(chkImgMa2.getSelected() != null) +// { +// if(chkImgMa2.getSelected().equals(new Boolean(true))) +// { +// a.setImg_ma2("y"); +// } +// } +// +// a.setImg_ma3("n"); +// if(chkImgMa3.getSelected() != null) +// { +// if(chkImgMa3.getSelected().equals(new Boolean(true))) +// { +// a.setImg_ma3("y"); +// } +// } +// +// a.setImg_ma4("n"); +// if(chkImgMa4.getSelected() != null) +// { +// if(chkImgMa4.getSelected().equals(new Boolean(true))) +// { +// a.setImg_ma4("y"); +// } +// } +// +// a.setImg_ma5("n"); +// if(chkImgMa5.getSelected() != null) +// { +// if(chkImgMa5.getSelected().equals(new Boolean(true))) +// { +// a.setImg_ma5("y"); +// } +// } +// +// a.setImg_ma6("n"); +// if(chkImgMa6.getSelected() != null) +// { +// if(chkImgMa6.getSelected().equals(new Boolean(true))) +// { +// a.setImg_ma6("y"); +// } +// } +// +// a.setImg_ma7("n"); +// if(chkImgMa7.getSelected() != null) +// { +// if(chkImgMa7.getSelected().equals(new Boolean(true))) +// { +// a.setImg_ma7("y"); +// } +// } +// +// a.setImg_ma8("n"); +// if(chkImgMa8.getSelected() != null) +// { +// if(chkImgMa8.getSelected().equals(new Boolean(true))) +// { +// a.setImg_ma8("y"); +// } +// } +// +// a.setImg_ma9("n"); +// if(chkImgMa9.getSelected() != null) +// { +// if(chkImgMa9.getSelected().equals(new Boolean(true))) +// { +// a.setImg_ma9("y"); +// } +// } +// +// a.setImg_ma10("n"); +// if(chkImgMa10.getSelected() != null) +// { +// if(chkImgMa10.getSelected().equals(new Boolean(true))) +// { +// a.setImg_ma10("y"); +// } +// } +// +// a.setRestricao_carga(new Integer(0)); +// if(chkRestricaoCargas.getSelected()!= null) +// { +// if(chkRestricaoCargas.getSelected().equals(new Boolean(true))) +// { +// if(rbKgs2.getSelected() != null) +// { +// if(rbKgs2.getSelected().equals(new Boolean(true))) +// { +// a.setRestricao_carga(new Integer(2)); +// } +// } +// if(rbKgs5.getSelected() != null) +// { +// if(rbKgs5.getSelected().equals(new Boolean(true))) +// { +// a.setRestricao_carga(new Integer(5)); +// } +// } +// if(rbKgs10.getSelected() != null) +// { +// if(rbKgs10.getSelected().equals(new Boolean(true))) +// { +// a.setRestricao_carga(new Integer(10)); +// } +// } +// if(rbKgs15.getSelected() != null) +// { +// if(rbKgs15.getSelected().equals(new Boolean(true))) +// { +// a.setRestricao_carga(new Integer(15)); +// } +// } +// +// if(rbKgsOutro.getSelected() != null) +// { +// if(rbKgsOutro.getSelected().equals(new Boolean(true))) +// { +// if(txtKgs.getText() != null) +// { +// String kgs_str = txtKgs.getText().toString(); +// int kgs = Integer.parseInt(kgs_str); +// a.setRestricao_carga(new Integer(kgs)); +// } +// } +// } +// } +// } +// +// a.setRestricao_motricidade("n"); +// if(chkRestricaoMotricidade.getSelected() != null) +// { +// if(chkRestricaoMotricidade.getSelected().equals(new Boolean(true))) +// { +// a.setRestricao_motricidade("y"); +// } +// } +// +// a.setRestricao_conducao("n"); +// if(chkRestricaoConducao.getSelected() != null) +// { +// if(chkRestricaoConducao.getSelected().equals(new Boolean(true))) +// { +// a.setRestricao_conducao("y"); +// } +// } +// +// a.setRestricao_vibracoes("n"); +// if(chkRestricaoVibracoes.getSelected() != null) +// { +// if(chkRestricaoVibracoes.getSelected().equals(new Boolean(true))) +// { +// a.setRestricao_vibracoes("y"); +// } +// } +// +// a.setRestricao_outras(""); +// if(chkRestricaoOutras.getSelected() != null) +// { +// if(chkRestricaoOutras.getSelected().equals(new Boolean(true))) +// { +// if(txtRestricaoOutras.getText() != null) +// { +// a.setRestricao_outras((String)txtRestricaoOutras.getText()); +// } +// } +// } +// +// a.setMed_observ(""); +// if(txtObservacoes.getText() != null) +// { +// a.setMed_observ( (String) txtObservacoes.getText() ); +// } + + return a; + } + + private AnaliseAcidente fillAnaliseFieldsConsolidacao(AnaliseAcidente a) + { + String nome_resp_consolidacao = getSessionBean1().getCurrentUser().getNome(); + a.setNome_resp_consolidacao(nome_resp_consolidacao); + java.util.Date today = + new java.util.Date(); + java.sql.Date sqlToday = + new java.sql.Date(today.getTime()); + a.setData_consolidacao(sqlToday); + a.setAss_consolidacao("y"); + return a; + } + + private AnaliseAcidente fillAnaliseAssinaturas(AnaliseAcidente a) + { + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + java.util.Date today = new java.util.Date(); + java.sql.Date sqlToday = new java.sql.Date(today.getTime()); + int estado = a.getEstado().intValue(); + switch(estado) + { + case Global.ESTADO_ASSINATURA_SEG: + //notifyNextSignature(new Integer(Global.ESTADO_ASSINATURA_RH)); + a.setData_assinatura_seg(sqlToday); + a.setAss_resp_seg("y"); + a.setNome_resp_seg( getSessionBean1().getCurrentUser().getNome() ); + break; + case Global.ESTADO_ASSINATURA_RH: + a.setData_assinatura_rh(sqlToday); + a.setAss_resp_rh("y"); + a.setNome_resp_rh(getSessionBean1().getCurrentUser().getNome()); + break; + } + + return a; + } + + private boolean validationDepartmentSectionOk() + { + Integer departmentId = (Integer) drpDepartamento.getSelected(); + if(departmentId.intValue() == 0) + { + getSessionBean1().setMsg("Falta departamento!"); + return false; + } + Integer seccaoId = (Integer) drpSeccao.getSelected(); + if(seccaoId.intValue() == 0) + { + getSessionBean1().setMsg("Falta secção!"); + return false; + } + + return true; + } + + private boolean fieldsLenOk() + { + //System.out.println("VALIDATION GRAVAR OK"); + AnalisesDataProvider adp = new AnalisesDataProvider(); + HashMap meta = new HashMap(); + HashMap meta_ac = new HashMap(); + try + { + meta = adp.getMetaData("analises_acidentes"); + meta_ac = adp.getMetaData("acidentados"); + } + catch(Exception ex) + { + ex.printStackTrace(); + meta = null; + meta_ac = null; + } + + if(meta == null || meta_ac == null) + { + getSessionBean1().setMsg("Erro na aquisição da metadata!"); + return false; + } + + int estado = 0; + if(getSessionBean1().getCurrentAnalise() == null) //null + { + estado = Global.ESTADO_SEG; + } + else + { + AnaliseAcidente a = getSessionBean1().getCurrentAnalise(); + estado = a.getEstado().intValue(); + } + + if(estado == Global.ESTADO_SEG) + { + if(txtAveriguador.getText() != null) + { + String averiguador = txtAveriguador.getText().toString(); + int len = ((Integer)meta.get("averiguador")).intValue(); + System.out.println("Averiguador : " + len); + if(averiguador.length() > len) + { + getSessionBean1().setMsg("O campo Averiguador não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtLocal.getText() != null) + { + String local = txtLocal.getText().toString(); + int len = ((Integer)meta.get("local_trabalho")).intValue(); + System.out.println("Local : " + len); + if(local.length() > len) + { + getSessionBean1().setMsg("O campo Local não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtTarefa.getText() != null) + { + String tarefa = txtTarefa.getText().toString(); + int len = ((Integer)meta.get("tarefa")).intValue(); + System.out.println("Tarefa : " + len); + if(tarefa.length() > len) + { + getSessionBean1().setMsg("O campo Tarefa não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtSubstancias.getText() != null) + { + String substancias = txtSubstancias.getText().toString(); + int len = ((Integer)meta.get("substancias")).intValue(); + System.out.println("Substancias : " + len); + if(substancias.length() > len) + { + getSessionBean1().setMsg("O campo Substancias não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtTestemunhas.getText() != null) + { + String testemunhas = txtTestemunhas.getText().toString(); + int len = ((Integer)meta.get("testemunhas")).intValue(); + System.out.println("Testemunhas : " + len); + if(testemunhas.length() > len) + { + getSessionBean1().setMsg("O campo Testemunhas não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtDescricao.getText() != null) + { + String descricao = txtDescricao.getText().toString(); + int len = ((Integer)meta.get("descricao")).intValue(); + System.out.println("Descricao : " + len); + if(descricao.length() > len) + { + getSessionBean1().setMsg("O campo Descrição não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtConclusoes.getText() != null) + { + String conclusoes = txtConclusoes.getText().toString(); + int len = ((Integer)meta.get("conclusoes")).intValue(); + System.out.println("Conclusoes : " + len); + if(conclusoes.length() > len) + { + getSessionBean1().setMsg("O campo Conclusões não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtAccoes.getText() != null) + { + String accoes = txtAccoes.getText().toString(); + int len = ((Integer)meta.get("accoes")).intValue(); + System.out.println("Accoes : " + len); + if(accoes.length() > len) + { + getSessionBean1().setMsg("O campo Accões não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtCondicoes.getText() != null) + { + String condicoes = txtCondicoes.getText().toString(); + int len = ((Integer)meta.get("condicoes")).intValue(); + System.out.println("Condicoes : " + len); + if(condicoes.length() > len) + { + getSessionBean1().setMsg("O campo Condições não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtAveriguacaoObs.getText() != null) + { + String averiguacao_obs = txtAveriguacaoObs.getText().toString(); + int len = ((Integer)meta.get("averiguacao_obs")).intValue(); + System.out.println("Observacoes : " + len); + if(averiguacao_obs.length() > len) + { + getSessionBean1().setMsg("O campo Observações não pode exceder " + len + " caracteres!"); + return false; + } + } + } + else if(estado == Global.ESTADO_RH1) + { + if(txtBI.getText() != null) + { + String bi = (String) txtBI.getText(); + int len = ((Integer)meta_ac.get("bilhete_identidade")).intValue(); + System.out.println("BI : " + len); + if(bi.length() > len) + { + getSessionBean1().setMsg("Campo Bilhete Identidade não pode exceder " + len + " caracteres!"); + return false; + } +// try +// { +// int bi_nr = Integer.parseInt(bi); +// } +// catch(Exception ex) +// { +// getSessionBean1().setMsg("Nº do Bilhete de Identidade tem de ser numérico!"); +// return false; +// } + } + + if(txtMorada.getText() != null) + { + String morada = txtMorada.getText().toString(); + int len = ((Integer)meta_ac.get("morada")).intValue(); + System.out.println("Morada : " + len); + if(morada.length() > len) + { + getSessionBean1().setMsg("O campo Morada não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtLocalidade.getText() != null) + { + String localidade = txtLocalidade.getText().toString(); + int len = ((Integer)meta_ac.get("localidade")).intValue(); + System.out.println("Localidade : " + len); + if(localidade.length() > len) + { + getSessionBean1().setMsg("O campo Localidade não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtContactoTelefonico.getText() != null) + { + String contacto_telefonico = txtContactoTelefonico.getText().toString(); + int len = ((Integer)meta_ac.get("contacto_telefonico")).intValue(); + System.out.println("Contacto Telefonico : " + len); + if(contacto_telefonico.length() > len) + { + getSessionBean1().setMsg("O campo Contacto Telefónico não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtNomeSuperior.getText() != null) + { + String nome_superior = txtNomeSuperior.getText().toString(); + int len = ((Integer)meta_ac.get("nome_superior_hierarquico")).intValue(); + System.out.println("Nome Superior : " + len); + if(nome_superior.length() > len) + { + getSessionBean1().setMsg("O campo Nome do Superior Hierárquico não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtEmailSuperior.getText() != null) + { + String email_superior = txtEmailSuperior.getText().toString(); + int len = ((Integer)meta_ac.get("email_superior_hierarquico")).intValue(); + System.out.println("Email Superior : " + len); + if(email_superior.length() > len) + { + getSessionBean1().setMsg("O campo Email do Superior Hierárquico não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtEmailSuperior.getText() != null) + { + String email_superior = (String) txtEmailSuperior.getText(); + if(email_superior.trim().length() > 0) + { + if(! utils.Utils.isValidEmail(email_superior)) + { + getSessionBean1().setMsg("Email do superior hierárquico inválido!"); + return false; + } + } + } + + if(txtFormacaoSHSTNWhy.getText() != null) + { + String why = txtFormacaoSHSTNWhy.getText().toString(); + int len = ((Integer)meta.get("formacao_shst_nao_porque")).intValue(); + System.out.println("Porque Nao Teve Formacao : " + len); + if(why.length() > len) + { + getSessionBean1().setMsg("O campo Porquê o Colaborador Não Teve Formação não pode exceder " + len + " caracteres!"); + return false; + } + } + } + else if(estado == Global.ESTADO_HS) + { + if(!checkRecomendacoesLen()) + { + return false; + } + } + else if(estado == Global.ESTADO_RH2) + { + if(!checkMedidasLen()) + { + return false; + } + + if(txtEspecif1.getText() != null) + { + String especif = txtEspecif1.getText().toString(); + int len = ((Integer)meta.get("especif1")).intValue(); + if(especif.length() > len) + { + getSessionBean1().setMsg("O campo Especifíque não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtEspecif2.getText() != null) + { + String especif = txtEspecif2.getText().toString(); + int len = ((Integer)meta.get("especif2")).intValue(); + if(especif.length() > len) + { + getSessionBean1().setMsg("O campo Especifíque não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtEspecif3.getText() != null) + { + String especif = txtEspecif3.getText().toString(); + int len = ((Integer)meta.get("especif3")).intValue(); + if(especif.length() > len) + { + getSessionBean1().setMsg("O campo Especifíque não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtEspecif4.getText() != null) + { + String especif = txtEspecif4.getText().toString(); + int len = ((Integer)meta.get("especif4")).intValue(); + if(especif.length() > len) + { + getSessionBean1().setMsg("O campo Especifíque não pode exceder " + len + " caracteres!"); + return false; + } + } + + if(txtTipoLesao.getText() != null) + { + String tipo_lesao = txtTipoLesao.getText().toString(); + int len = ((Integer)meta.get("tipo_lesao")).intValue(); + System.out.println("Tipo Lesao : " + len); + if(tipo_lesao.length() > len) + { + getSessionBean1().setMsg("O campo Tipo Lesão não pode exceder " + len + " caracteres!"); + return false; + } + } + } + + return true; + } + + private boolean validationOk() + { + + if(getSessionBean1().isSubmetido() || getSessionBean1().isGravado()) + { + return true; + } + if(getSessionBean1().getAcidentado() == null) + { + getSessionBean1().setMsg("Não seleccionou trabalhador acidentado!"); + return false; + } + + if(!fieldsLenOk()) + { + return false; + } + + int estado = 0; + int estado_assinatura = 0; + if(getSessionBean1().getCurrentAnalise() == null) //null + { + estado = Global.ESTADO_SEG; + } + else + { + AnaliseAcidente a = getSessionBean1().getCurrentAnalise(); + estado = a.getEstado().intValue(); + estado_assinatura = a.getEstado_assinatura().intValue(); + } + + if(estado == Global.ESTADO_SEG) + { + if(txtAveriguador.getText() == null) + { + getSessionBean1().setMsg("Falta averiguador!"); + return false; + } + else + { + String averiguador = (String) txtAveriguador.getText(); + if(averiguador.trim().length() == 0) + { + getSessionBean1().setMsg("Falta averiguador!"); + return false; + } + + } + + if(drpHours.getSelected() == null || drpMinutes.getSelected() == null) + { + getSessionBean1().setMsg("Falta hora acidente!"); + return false; + } + else + { + Integer h = (Integer) drpHours.getSelected(); + Integer m = (Integer) drpMinutes.getSelected(); + if(h.intValue() == -1 || m.intValue() == -1) + { + getSessionBean1().setMsg("Falta hora acidente!"); + return false; + } + + } + + if(txtHorasTurno.getText() != null) + { + String horas_turno = txtHorasTurno.getText().toString(); + if(horas_turno.trim().length() == 0) + { + getSessionBean1().setMsg("Falta nº horas trabalhadas no turno!"); + return false; + } + else + { + try + { + int nr = Integer.parseInt(horas_turno); + if(nr > 9) + { + getSessionBean1().setMsg("As horas turno devem ser entre 0 e 9!"); + return false; + } + } + catch(Exception ex) + { + getSessionBean1().setMsg("As horas turno devem ser um valor numérico!"); + return false; + } + } + } + else + { + getSessionBean1().setMsg("Falta nº horas trabalhadas no turno!"); + return false; + } + + + if(drpDepartamento.getSelected() == null) + { + getSessionBean1().setMsg("Falta departamento!"); + return false; + } + else + { + Integer d = (Integer) drpDepartamento.getSelected(); + if(d.intValue() == 0) + { + getSessionBean1().setMsg("Falta departamento!"); + return false; + } + } + + if(drpSeccao.getSelected() == null) + { + getSessionBean1().setMsg("Falta secção!"); + return false; + } + else + { + Integer s = (Integer) drpSeccao.getSelected(); + if(s.intValue() == 0) + { + getSessionBean1().setMsg("Falta secção!"); + return false; + } + } + + if(txtLocal.getText() == null) + { + getSessionBean1().setMsg("Falta local específico!"); + return false; + } + else + { + String local = (String) txtLocal.getText(); + if(local.trim().length() == 0) + { + getSessionBean1().setMsg("Falta local específico!"); + return false; + } + } + + if(txtTarefa.getText() == null) + { + getSessionBean1().setMsg("Falta tarefa!"); + return false; + } + else + { + String tarefa = (String) txtTarefa.getText(); + if(tarefa.trim().length() == 0) + { + getSessionBean1().setMsg("Falta tarefa!"); + return false; + } + } + + if(txtSubstancias.getText() == null) + { + getSessionBean1().setMsg("Falta substâncias!"); + return false; + } + else + { + String substancias = (String) txtSubstancias.getText(); + if(substancias.trim().length() == 0) + { + getSessionBean1().setMsg("Falta substâncias!"); + return false; + } + } + + if(txtCondicoes.getText() == null) + { + getSessionBean1().setMsg("Falta condições!"); + return false; + } + else + { + String condicoes = (String) txtCondicoes.getText(); + if(condicoes.trim().length() == 0) + { + getSessionBean1().setMsg("Falta condições!"); + return false; + } + } + + if(txtTestemunhas.getText() == null) + { + getSessionBean1().setMsg("Falta testemunhas!"); + return false; + } + else + { + String testemunhas = (String) txtTestemunhas.getText(); + if(testemunhas.trim().length() == 0) + { + getSessionBean1().setMsg("Falta testemunhas!"); + return false; + } + } + + if(drpCausas.getSelected() == null) + { + getSessionBean1().setMsg("Falta causa do acidente!"); + return false; + } + else + { + Integer c = (Integer) drpCausas.getSelected(); + if(c.intValue() == 0) + { + getSessionBean1().setMsg("Falta causa do acidente!"); + return false; + } + } + + if(txtDescricao.getText() == null) + { + getSessionBean1().setMsg("Falta descrição do acidente!"); + return false; + } + else + { + String descricao = (String) txtDescricao.getText(); + if(descricao.trim().length() == 0) + { + getSessionBean1().setMsg("Falta descrição do acidente!"); + return false; + } + } + + if(txtConclusoes.getText() == null) + { + getSessionBean1().setMsg("Falta conclusões!"); + return false; + } + else + { + String conclusoes = (String) txtConclusoes.getText(); + if(conclusoes.trim().length() == 0) + { + getSessionBean1().setMsg("Falta conclusões!"); + return false; + } + } + + if(txtAccoes.getText() == null) + { + getSessionBean1().setMsg("Falta acções!"); + return false; + } + else + { + String accoes = (String) txtAccoes.getText(); + if(accoes.trim().length() == 0) + { + getSessionBean1().setMsg("Falta acções!"); + return false; + } + } + + } + + + if(estado == Global.ESTADO_RH1) + { + + if(txtBI.getText() == null) + { + getSessionBean1().setMsg("Falta Nº Bilhete de Identidade!"); + return false; + } + else + { + String bi = (String) txtBI.getText(); + if(bi.trim().length() == 0) + { + getSessionBean1().setMsg("Falta Nº Bilhete de Identidade!"); + return false; + } +// else +// { +// try +// { +// int bi_nr = Integer.parseInt(bi); +// } +// catch(Exception ex) +// { +// getSessionBean1().setMsg("Nº do Bilhete de Identidade tem de ser numérico!"); +// return false; +// } +// } + } + + if(txtMorada.getText() == null) + { + getSessionBean1().setMsg("Falta morada!"); + return false; + } + else + { + String morada = (String) txtMorada.getText(); + if(morada.trim().length() == 0) + { + getSessionBean1().setMsg("Falta morada!"); + return false; + } + } + + String cod_postal1 = ""; + String cod_postal2 = ""; + if(txtCodPostal1.getText() == null || txtCodPostal2.getText() == null) + { + getSessionBean1().setMsg("Falta código postal!"); + return false; + } + else + { + cod_postal1 = (String) txtCodPostal1.getText(); + cod_postal2 = (String) txtCodPostal2.getText(); + + if(cod_postal1.trim().length() == 0 || cod_postal2.trim().length() == 0) + { + getSessionBean1().setMsg("Falta código postal!"); + return false; + } + } + + if(txtCodPostal1.getText() != null) + { + if(cod_postal1.trim().length() > 0) + { + try + { + int nr = Integer.parseInt(cod_postal1); + if(nr < 1000 || nr > 9999) + { + getSessionBean1().setMsg("O formato do código postal é : '9999-999'"); + return false; + } + } + catch(Exception ex) + { + getSessionBean1().setMsg("O código postal tem de ser um valor numérico!"); + return false; + } + } + } + + if(txtCodPostal2.getText() != null) + { + if(cod_postal2.trim().length() > 0) + { + if(cod_postal1.trim().length() == 0) + { + getSessionBean1().setMsg("O formato do código postal é : '9999-999'"); + return false; + } + try + { + int nr = Integer.parseInt(cod_postal2); + if(cod_postal2.length() > 3 ) + { + getSessionBean1().setMsg("O formato do código postal é : '9999-999'"); + return false; + } + } + catch(Exception ex) + { + getSessionBean1().setMsg("O código postal de ser um valor numérico!"); + return false; + } + } + + if(txtLocalidade.getText() == null) + { + getSessionBean1().setMsg("Falta localidade!"); + return false; + } + else + { + String localidade = (String) txtLocalidade.getText(); + if(localidade.trim().length() == 0) + { + getSessionBean1().setMsg("Falta localidade!"); + return false; + } + } + + if(txtContactoTelefonico.getText() == null) + { + getSessionBean1().setMsg("Falta contacto telefónico!"); + return false; + } + else + { + String contacto_telefonico = (String) txtContactoTelefonico.getText(); + if(contacto_telefonico.trim().length() == 0) + { + getSessionBean1().setMsg("Falta contacto telefónico!"); + return false; + } + } + + if(rbTurnoManha.getSelected() == null && rbTurnoTarde.getSelected() == null && rbTurnoNoite.getSelected() == null ) + { + getSessionBean1().setMsg("Falta turno de trabalho!"); + return false; + } + + if(txtNomeSuperior.getText() == null) + { + getSessionBean1().setMsg("Falta nome do superior hierárquico!"); + return false; + } + else + { + String nome_superior = (String) txtNomeSuperior.getText(); + if(nome_superior.trim().length() == 0) + { + getSessionBean1().setMsg("Falta nome do superior hierárquico!"); + return false; + } + } + + if(txtEmailSuperior.getText() != null) + { + String email_superior = (String) txtEmailSuperior.getText(); + if(email_superior.trim().length() > 0) + { + if(! utils.Utils.isValidEmail(email_superior)) + { + getSessionBean1().setMsg("Email do superior hierárquico inválido!"); + return false; + } + } + else + { + getSessionBean1().setMsg("Falta email do superior hierárquico!"); + return false; + } + } + else + { + getSessionBean1().setMsg("Falta email do superior hierárquico!"); + return false; + } + } + + if(estado == Global.ESTADO_RH1) + { + + if(rbFormacaoSHSTY.getSelected() == null && rbFormacaoSHSTN.getSelected() == null) + { + getSessionBean1().setMsg("Falta indicar se o colaborador teve formação em SHST!"); + return false; + } + else + { + if(rbFormacaoSHSTY.getSelected() != null) + { + if(rbFormacaoSHSTY.getSelected().equals(new Boolean(false))) + { + if(rbFormacaoSHSTN.getSelected() != null) + { + if(rbFormacaoSHSTN.getSelected().equals(new Boolean(false))) + { + getSessionBean1().setMsg("Falta indicar se o colaborador teve formação em SHST!"); + return false; + } + } + } + } + } + + if(rbFormacaoSHSTN.getSelected() != null) + { + if(rbFormacaoSHSTN.getSelected().equals(new Boolean(true))) + { + if(txtFormacaoSHSTNWhy.getText() == null) + { + getSessionBean1().setMsg("Falta indicar a razão porque o colaborador não teve formação em SHST!"); + return false; + } + else + { + String why = (String) txtFormacaoSHSTNWhy.getText(); + if(why.trim().length() == 0) + { + getSessionBean1().setMsg("Falta indicar a razão porque o colaborador não teve formação em SHST!"); + return false; + } + } + } + + } + + if(rbAcidentesColaboradorY.getSelected() == null && rbAcidentesColaboradorN.getSelected() == null) + { + getSessionBean1().setMsg("Falta indicar se o colaborador teve outras ocorrências, ou não!"); + return false; + } + else + { + if(rbAcidentesColaboradorY.getSelected() != null) + { + if(rbAcidentesColaboradorY.getSelected().equals(new Boolean(false))) + { + if(rbAcidentesColaboradorN.getSelected() != null) + { + if(rbAcidentesColaboradorN.getSelected().equals(new Boolean(false))) + { + getSessionBean1().setMsg("Falta indicar se o colaborador teve outras ocorrências, ou não!"); + return false; + } + } + } + } + } + + if(rbAcidentesColaboradorY.getSelected() != null) + { + + if(rbAcidentesColaboradorY.getSelected().equals(new Boolean(true))) + { + if(txtNrAcidentesColaborador.getText() != null) + { + String nr_str = txtNrAcidentesColaborador.getText().toString(); + if(nr_str.trim().length() > 0) + { + try + { + int nr = Integer.parseInt(nr_str); + } + catch(Exception ex) + { + getSessionBean1().setMsg("O º de acidentes do colaborador deve ser um valor numérico!"); + return false; + } + } + else + { + getSessionBean1().setMsg("Falta indicar o º de ocorrências do colaborador!"); + return false; + } + } + else + { + getSessionBean1().setMsg("Falta indicar o º de ocorrências do colaborador!"); + return false; + } + + if( + txtNrRelatorioAcidentesColaborador1.getText() == null && + txtNrRelatorioAcidentesColaborador2.getText() == null && + txtNrRelatorioAcidentesColaborador3.getText() == null && + txtNrRelatorioAcidentesColaborador1.getText() == null + ) + { + getSessionBean1().setMsg("Falta indicar o(s) º(s) do(s) relatório(s) de acidente do colaborador!"); + return false; + } + else + { + String nr_relatorio1 = ""; + String nr_relatorio2 = ""; + String nr_relatorio3 = ""; + String nr_relatorio4 = ""; + if(txtNrRelatorioAcidentesColaborador1.getText() != null) + { + nr_relatorio1 = (String) txtNrRelatorioAcidentesColaborador1.getText(); + } + if(txtNrRelatorioAcidentesColaborador2.getText() != null) + { + nr_relatorio2 = (String) txtNrRelatorioAcidentesColaborador2.getText(); + } + if(txtNrRelatorioAcidentesColaborador3.getText() != null) + { + nr_relatorio3 = (String) txtNrRelatorioAcidentesColaborador3.getText(); + } + if(txtNrRelatorioAcidentesColaborador4.getText() != null) + { + nr_relatorio4 = (String) txtNrRelatorioAcidentesColaborador4.getText(); + } + + if(nr_relatorio1.trim().length() == 0 && nr_relatorio2.trim().length() == 0 && nr_relatorio3.trim().length() == 0 && nr_relatorio4.trim().length() == 0) + { + getSessionBean1().setMsg("Falta indicar o(s) º(s) do(s) relatório(s) de acidente do colaborador!"); + return false; + } + } + }// + + } + + + + if(rbAcidentesColaboradoresY.getSelected() == null && rbAcidentesColaboradoresN.getSelected() == null) + { + getSessionBean1().setMsg("Falta indicar se houve outras ocorrências com outros colaboradores!"); + return false; + } + else + { + if(rbAcidentesColaboradoresY.getSelected() != null) + { + if(rbAcidentesColaboradoresY.getSelected().equals(new Boolean(false))) + { + if(rbAcidentesColaboradoresN.getSelected() != null) + { + if(rbAcidentesColaboradoresN.getSelected().equals(new Boolean(false))) + { + getSessionBean1().setMsg("Falta indicar se houve outras ocorrências com outros colaboradores!"); + return false; + } + } + } + } + } + + if(rbAcidentesColaboradoresY.getSelected() != null) + { + + if(rbAcidentesColaboradoresY.getSelected().equals(new Boolean(true))) + { + if(txtNrAcidentesColaboradores.getText() != null) + { + String nr_str = txtNrAcidentesColaboradores.getText().toString(); + if(nr_str.trim().length() > 0) + { + try + { + int nr = Integer.parseInt(nr_str); + } + catch(Exception ex) + { + getSessionBean1().setMsg("O º de acidentes dos colaboradores deve ser um valor numérico!"); + return false; + } + } + else + { + getSessionBean1().setMsg("Falta indicar o º de ocorrências com outros colaboradores!"); + return false; + } + } + else + { + getSessionBean1().setMsg("Falta indicar o º de ocorrências com outros colaboradores!"); + return false; + } + + if( + txtNrRelatorioAcidentesColaboradores1.getText() == null && + txtNrRelatorioAcidentesColaboradores2.getText() == null && + txtNrRelatorioAcidentesColaboradores3.getText() == null && + txtNrRelatorioAcidentesColaboradores1.getText() == null + ) + { + getSessionBean1().setMsg("Falta indicar o(s) º(s) do(s) relatório(s) de acidente com outros colaboradores!"); + return false; + } + else + { + String nr_relatorio1 = ""; + String nr_relatorio2 = ""; + String nr_relatorio3 = ""; + String nr_relatorio4 = ""; + if(txtNrRelatorioAcidentesColaboradores1.getText() != null) + { + nr_relatorio1 = (String) txtNrRelatorioAcidentesColaboradores1.getText(); + } + if(txtNrRelatorioAcidentesColaboradores2.getText() != null) + { + nr_relatorio2 = (String) txtNrRelatorioAcidentesColaboradores2.getText(); + } + if(txtNrRelatorioAcidentesColaboradores3.getText() != null) + { + nr_relatorio3 = (String) txtNrRelatorioAcidentesColaboradores3.getText(); + } + if(txtNrRelatorioAcidentesColaboradores4.getText() != null) + { + nr_relatorio4 = (String) txtNrRelatorioAcidentesColaboradores4.getText(); + } + + if(nr_relatorio1.trim().length() == 0 && nr_relatorio2.trim().length() == 0 && nr_relatorio3.trim().length() == 0 && nr_relatorio4.trim().length() == 0) + { + getSessionBean1().setMsg("Falta indicar o(s) º(s) do(s) relatório(s) de acidente com outros colaboradores!"); + return false; + } + } + }// + + } + + } + } + else if(estado == Global.ESTADO_HS) //recomendacoes + { + if(isRecomendacoesEmpty()) + { + getSessionBean1().setMsg("Tem de preencher pelo menos uma recomendação!"); + return false; + } + } + else if(estado == Global.ESTADO_RH2) //medidas + { + if(isMedidasEmpty()) + { + getSessionBean1().setMsg("Tem de preencher pelo menos uma medida!"); + return false; + } +// } +// //else if(estado == Global.ESTADO_MEDICINA) +// else if(estado == Global.ESTADO_RH2) +// { + if(rbIncapacidadeNone.getSelected() == null && rbIncapacidadeTemp.getSelected() == null && rbIncapacidadePerm.getSelected() == null) + { + getSessionBean1().setMsg("Falta indicar o tipo de incapacidade!"); + return false; + } + else + { + if(rbIncapacidadeNone.getSelected() != null) + { + if(rbIncapacidadeNone.getSelected().equals(new Boolean(false))) + { + if(rbIncapacidadeTemp.getSelected() != null) + { + if(rbIncapacidadeTemp.getSelected().equals(new Boolean(false))) + { + if(rbIncapacidadePerm.getSelected() != null) + { + if(rbIncapacidadePerm.getSelected().equals(new Boolean(false))) + { + getSessionBean1().setMsg("Falta indicar o tipo de incapacidade!"); + return false; + } + } + } + } + } + } + } + + if(txtCoefIncapacidade.getText() != null) + { + String coef_str = txtCoefIncapacidade.getText().toString(); + if(coef_str.trim().length() > 0) + { + try + { + int nr = Integer.parseInt(coef_str); + } + catch(Exception ex) + { + getSessionBean1().setMsg("O coeficiente de incapacidade deve ser um valor numérico!"); + return false; + } + } + else + { + getSessionBean1().setMsg("Falta coeficiente de incapacidade!"); + return false; + } + } + else + { + getSessionBean1().setMsg("Falta coeficiente de incapacidade!"); + return false; + } + + if(chkRestricaoCargas.getSelected() != null) + { + Boolean b = (Boolean) chkRestricaoCargas.getSelected(); + if(b.equals(new Boolean(true))) + { + if(txtKgs.getText() != null) + { + String kgs_str = txtKgs.getText().toString(); + try + { + int nr = Integer.parseInt(kgs_str); + } + catch(Exception ex) + { + getSessionBean1().setMsg("O valor de kgs deve ser um valor numérico!"); + return false; + } + } + } + } + } + else if(estado == Global.ESTADO_CONSOLIDACAO) + { + if(chkVerHs.getSelected() == null) + { + getSessionBean1().setMsg("Falta assinatura!"); + return false; + } + else if(chkVerHs.getSelected().equals(new Boolean(false))) + { + getSessionBean1().setMsg("Falta assinatura!"); + return false; + } + } + else if(estado == Global.ESTADO_ASSINATURA_SEG) + { + if(chkVerRespSeg.getSelected() == null) + { + getSessionBean1().setMsg("Falta assinatura!"); + return false; + } + else if(chkVerRespSeg.getSelected().equals(new Boolean(false))) + { + getSessionBean1().setMsg("Falta assinatura!"); + return false; + } + } + else if(estado == Global.ESTADO_ASSINATURA_RH) + { + if(chkVerRespRh.getSelected() == null) + { + getSessionBean1().setMsg("Falta assinatura!"); + return false; + } + else if(chkVerRespRh.getSelected().equals(new Boolean(false))) + { + getSessionBean1().setMsg("Falta assinatura!"); + return false; + } + } + + + return true; + } + + private void createImagesFolder(AnaliseAcidente a) + //private void createImagesFolder(String folderName) + { + String folderName = a.getAnalise_nr().substring(0,2) + a.getAnalise_nr().substring(3); + + ServletContext theApplicationsServletContext = + (ServletContext) this.getExternalContext().getContext(); +// String imageFileFolder = theApplicationsServletContext.getRealPath(Global.IMAGE_FOLDER + "/" + folderName); + String imageFileFolder = Global.IMAGE_FOLDER + "/" + folderName; + try + { +// String imageFileFolderTmp = theApplicationsServletContext.getRealPath(Global.IMAGE_FOLDER + "/tmp" + getSessionBean1().getCurrentUser().getLogin()); + String imageFileFolderTmp = Global.IMAGE_FOLDER + "/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;i 0) + { + gridImages.getChildren().clear(); + } + ServletContext theApplicationsServletContext = + (ServletContext) this.getExternalContext().getContext(); +// String imageFileFolder = theApplicationsServletContext.getRealPath(Global.IMAGE_FOLDER + "/" + folderName); + + + File apacheAnaliseFolder = new File(theApplicationsServletContext.getRealPath( Global.RESOURCES_IMAGE_FOLDER ) + "/analises/" + folderName); + if(apacheAnaliseFolder.exists()) + { + Global global = new Global(); + global.deleteFolderFiles(apacheAnaliseFolder); + System.out.println("FILES DELETED"); + } + else + { + apacheAnaliseFolder.mkdir(); + } + + + + String imageFileFolder = Global.IMAGE_FOLDER + "/" + folderName; + try + { + File f = new File(imageFileFolder); + + if(f.exists()) + { + File images[] = f.listFiles(); + Arrays.sort(images); + for(int i=0;i"; + + System.out.println( "Sending mail to next user." ); + + String responsavel_loja = "n"; + switch (estado.intValue()) + { + case Global.ESTADO_RH1: + tipo = new Integer(Global.TIPO_UTILIZADOR_RH); + break; + case Global.ESTADO_HS: + tipo = new Integer(Global.TIPO_UTILIZADOR_HS); + break; + case Global.ESTADO_RH2: + tipo = new Integer(Global.TIPO_UTILIZADOR_RH); + break; + case Global.ESTADO_CONSOLIDACAO: + tipo = new Integer(Global.TIPO_UTILIZADOR_HS); + break; + case Global.ESTADO_ASSINATURA_SEG: + tipo =new Integer(Global.TIPO_UTILIZADOR_SEGURANCA); + responsavel_loja = "y"; + break; + case Global.ESTADO_ASSINATURA_RH: + tipo = new Integer(Global.TIPO_UTILIZADOR_RH); + responsavel_loja = "y"; + break; + case Global.ESTADO_FECHAR: + tipo = new Integer(Global.TIPO_UTILIZADOR_HS); + break; + } + +// if(estado.intValue() == Global.ESTADO_FECHAR) +// { +// tipo = new Integer(Global.TIPO_UTILIZADOR_HS); // hs +// } +// else +// { +// tipo = estado; +// } + + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + try + { + ArrayList list = udp.getUtilizadoresListByTipo(tipo, responsavel_loja, a.getEstabelecimento_id()); + ListIterator iter = list.listIterator(); + while(iter.hasNext()) + { + Utilizador u = (Utilizador) iter.next(); + System.out.println("USER MAIL NEXT FASE : " + u.getLogin() + " ; " + u.getEmail()); + try + { + //sendEmail(u.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email); + sendEmailWithPdf(a, u.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email); + } + catch(Exception ex1) + { + ex1.printStackTrace(); + System.out.println("MAIL ERROR : " + ex1.getMessage()); + } + + } + } + catch(Exception ex) + { + //ex.printStackTrace(); + } + + } + + private void sendEmailResponsavelHierarquico(AnaliseAcidente a) + { + Acidentado ac = getSessionBean1().getAcidentado(); + String assunto = "Comunicação de Análise de Acidentes de Trabalho de " + ac.getNome(); + + String data_acidente = ""; + try + { + java.util.Date ddate = new java.util.Date(a.getData_acidente().getTime()); + data_acidente = utils.Utils.dateToYYYYMMDD(ddate); + } + catch(Exception ex){} + + String texto_email = "

Caro(a) Colega,

"; + texto_email += "

Na sequência do acidente de trabalho do colaborador "; + texto_email += ac.getNome(); + texto_email += " no dia " + data_acidente; + texto_email += ", vimos pelo presente remeter cópia da análise do acidente " + a.getAnalise_nr() + " que se encontra em processo de averiguação pelo departamento de Segurança, Recursos Humanos e pela SIPRP para seu conhecimento. Caso tenha qualquer informação importante sobre o processo ou pretenda esclarecimentos adicionais contacte, por favor, a secção de Recursos Humanos.

"; + texto_email += "

Cumprimentos.

"; + try + { + sendEmailWithPdf(a, ac.getEmail_superior_hierarquico(), Global.ENDERECO_ENVIO, assunto, texto_email ); + //sendEmail(ac.getEmail_superior_hierarquico(), Global.ENDERECO_ENVIO, assunto, texto_email); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + + private void sendEmailFimProcesso(AnaliseAcidente a) + { + Acidentado ac = getSessionBean1().getAcidentado(); + String assunto = "Fecho do Processo de Análise de Acidente de Trabalho de " + ac.getNome(); + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + ArrayList responsavelRh_list = udp.getResponsavelRhList( a.getEstabelecimento_id() ); + if(responsavelRh_list != null) + { + ListIterator iter = responsavelRh_list.listIterator(); + while(iter.hasNext()) + { + Utilizador u = (Utilizador) iter.next(); + String texto_email = "

Exmo. (a) Senhor(a), " + u.getNome() + "

"; + texto_email += "

Informamos que o processo de análise de acidente de trabalho nº " + a.getAnalise_nr() + " se encontra finalizado, "; + texto_email += "pelo que solicitamos a sua impressão e arquivamento em pasta própria, juntamente com a participação de sinistro à seguradora.

"; + texto_email += "

Caso pretenda qualquer esclarecimento, contacte-nos, por favor, através de acidentes.auchan@siprp.pt ou pelo telefone 213 504 540.

"; + texto_email += "

Os melhores cumprimentos.

"; + texto_email += "

SIPRP

"; + try + { + //sendEmail(u.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email); + sendEmailWithPdf(a, u.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + } + } + + private void sendEmailToRhFase4(AnaliseAcidente a) + { + System.out.println("SEND EMAIL TO RH FASE 4"); + Acidentado ac = getSessionBean1().getAcidentado(); + //String assunto = "SIPRP ¯ Fecho do Processo de Análise de Acidente de Trabalho nº " + a.getAnalise_nr() + " ¯ Ficheiro para Impressão"; + String assunto = "SIPRP - Fecho do Processo de Análise de Acidente de Trabalho nº " + a.getAnalise_nr() + " - Ficheiro para Impressão"; + + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + try + { + Utilizador urh = udp.getUtilizador(a.getRh_fase4()); + String texto_email = "

Exmo. (a) Senhor(a),

"; + texto_email += "

Confirmamos que o processo de Análise de Acidente de Trabalho nº " + a.getAnalise_nr()+ " se encontra encerrado após o preenchimento e validação de todos os intervenientes.

"; + texto_email += "

Sugerimos que imprima o ficheiro que enviamos em anexo e o junte à Participação de Sinistro à Seguradora para dar conhecimento ao Médico do Trabalho do seu estabelecimento. Após o seu conhecimento, aconselhamos que entregue uma cópia da Ficha de Análise de Acidente de Trabalho à equipa de Saúde Ocupacional, para que esta a arquive no processo clínico do trabalhador antes de juntar toda a documentação no processo individual do colaborador nos Recursos Humanos.

"; + texto_email += "

Agradecemos a sua colaboração e ficamos ao dispor para qualquer esclarecimento através dos telefones 213 504 544 (Catarina Leonardo) ou 213 504 542 (Sónia Campos).

"; + texto_email += "

Os melhores cumprimentos,

"; + texto_email += "

A equipa da SIPRP

"; + try + { + sendEmailWithPdf(a, urh.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email); + } + catch(Exception ex) + { + ex.printStackTrace(); + System.out.println("EMAIL FASE 4 ERROR : " + ex.getMessage()); + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + } + +// private void sendEmail(String emailTo, String emailFrom, String assunto, String texto_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", emailFrom); +// Session session1 = Session.getInstance(props); +// Message msg = new MimeMessage(session1); +// +//// try +//// { +// //Address Email_TO = new InternetAddress("myemail@bol.com.br"); +// msg.setFrom(new InternetAddress(emailFrom)); +// InternetAddress[] address = {new InternetAddress(emailTo)}; +// msg.setRecipients(Message.RecipientType.TO, address); +// msg.setSubject(assunto); +// msg.setSentDate(new Date()); +// Multipart multipart = new MimeMultipart(); +// BodyPart msgBodyPart = new MimeBodyPart(); +// String html; +// html=" "; +// html+=""; +// html+= texto_email; +// html+=""; +// msgBodyPart.setContent(html, "text/html"); +// multipart.addBodyPart(msgBodyPart); +// msg.setContent(multipart); +// Transport.send(msg); +// System.out.println("Email Enviado !!!! "); +//// } +//// catch (Exception ex) +//// { +//// System.out.println("MAIL ERROR : " + ex.getMessage()); +//// ex.printStackTrace(); +//// } +// +// } + + private final String SMTP_HOST = "mail2.evolute.pt"; + private final int SMTP_PORT = 587; + + private final String mail_username = "acidentes.auchan@siprp.pt"; + private final String mail_password = "47Ju6Vb"; + + private final String mail_bcc = "acidentes.auchan@siprp.pt"; + private final String mail_bcc2 = "siprp.aat@evolute.pt"; + + private void sendEmail(String emailTo, String emailFrom, String assunto, String texto_email) + throws Exception + { + Properties props = new Properties(); + //props.put("mail.transport.protocol", "smtp"); + props.put("mail.smtp.host", SMTP_HOST ); + props.put("mail.from", emailFrom); + props.put("mail.smtp.auth", "true"); + props.put("mail.smtp.user", mail_username ); + props.put("mail.smtp.password", mail_password ); + +// Authenticator auth = new SMTPAuthenticator(); +// Session session = Session.getDefaultInstance(props, auth); + Session session = Session.getDefaultInstance( props ); + + Message msg = new MimeMessage(session); + msg.setFrom(new InternetAddress(emailFrom)); + InternetAddress[] address = {new InternetAddress(emailTo)}; + msg.setRecipients(Message.RecipientType.TO, address); + + InternetAddress[] addressBCC = new InternetAddress[ 2 ]; + addressBCC[ 0 ] = new InternetAddress( mail_bcc ); + addressBCC[ 1 ] = new InternetAddress( mail_bcc2 ); + msg.setRecipients( Message.RecipientType.BCC, addressBCC ); + + ((MimeMessage)msg).setSubject(assunto, "UTF-8"); + msg.setSentDate(new Date()); + Multipart multipart = new MimeMultipart(); + BodyPart msgBodyPart = new MimeBodyPart(); + String html; + html=" "; + html+=""; + html+= texto_email; + html+=""; + msgBodyPart.setContent(html, "text/html"); + multipart.addBodyPart(msgBodyPart); + msg.setContent(multipart); +// Transport.send(msg); + Transport t; + t = session.getTransport( "smtp" ); + + t.connect( SMTP_HOST, SMTP_PORT, mail_username, mail_password ); + t.sendMessage( msg, msg.getAllRecipients() ); + + t.close(); + System.out.println("Email Enviado !!!!" ); + + } + + private void sendEmailWithPdf(AnaliseAcidente a, String emailTo, String emailFrom, String assunto, String texto_email) throws Exception + { + System.out.println("SEND EMAIL WITH PDF"); + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + Utilizador ut = udp.getUtilizador(a.getTecnico_saude_id()); + Utilizador um = udp.getUtilizador(a.getMedico_id()); + AnalisesDataProvider adp = new AnalisesDataProvider(); + Acidentado ac = adp.getAcidentado(a.getAcidentado_id()); + Estabelecimento e = new Estabelecimento(); + e.setId(a.getEstabelecimento_id()); + e.setNome(adp.getEstabelecimentoNome(a.getEstabelecimento_id())); + Seccao s = adp.getSeccao(a.getSeccao_id()); + Causa c = adp.getCausa(a.getCausas()); + ArrayList recList = adp.getRecomendacoesByAnalise(a.getId()); + Recomendacao[] recArray = new Recomendacao[recList.size()]; + ListIterator iter = recList.listIterator(); + int i = 0; + while(iter.hasNext()) + { + Recomendacao rec = (Recomendacao) iter.next(); + recArray[i] = rec; + i++; + } + //Recomendacao recArray[] = (Recomendacao)recList.toArray(); + ArrayList medList = adp.getMedidasByAnalise(a.getId()); + //Medida medArray[] = (Medida)medList.toArray(); + Medida[] medArray = new Medida[medList.size()]; + iter = medList.listIterator(); + i = 0; + while(iter.hasNext()) + { + Medida med = (Medida) iter.next(); + medArray[i] = med; + i++; + } + + PdfGenerator pdf = new PdfGenerator(Global.IMAGE_FOLDER, e, ut, um, a, ac, s, recArray, medArray, c); + + ByteArrayDataSource ds = new ByteArrayDataSource(pdf.generatePdf(), + "application/pdf"); + Properties props = new Properties(); + //props.put("mail.transport.protocol", "smtp"); + props.put("mail.smtp.host", SMTP_HOST ); + props.put("mail.from", emailFrom); + props.put("mail.smtp.auth", "true"); + props.put("mail.smtp.user", mail_username ); + props.put("mail.smtp.password", mail_password ); + +// Authenticator auth = new SMTPAuthenticator(); +// Session session = Session.getDefaultInstance(props, auth); + Session session = Session.getDefaultInstance( props ); + + Message msg = new MimeMessage(session); + msg.setFrom(new InternetAddress(emailFrom)); + InternetAddress[] address = {new InternetAddress(emailTo)}; + msg.setRecipients(Message.RecipientType.TO, address); + + InternetAddress[] addressBCC = new InternetAddress[ 2 ]; + addressBCC[ 0 ] = new InternetAddress( mail_bcc ); + addressBCC[ 1 ] = new InternetAddress( mail_bcc2 ); + msg.setRecipients( Message.RecipientType.BCC, addressBCC ); + + ((MimeMessage)msg).setSubject(assunto, "UTF-8"); + msg.setSentDate(new Date()); + Multipart multipart = new MimeMultipart(); + BodyPart msgBodyPart = new MimeBodyPart(); + String html; + html=" "; + html+=""; + html+= "
" + texto_email + "
"; + html+=""; + msgBodyPart.setContent(html, "text/html"); + multipart.addBodyPart(msgBodyPart); + + MimeBodyPart pdfPart = new MimeBodyPart(); + //pdfPart.setContent(ds,"application/pdf"); + pdfPart.setDataHandler(new DataHandler(ds)); + pdfPart.setHeader("Content-Transfer-Encoding","base64"); + pdfPart.setHeader("Content-Disposition","attachment"); + String pdfname = "Analise" + a.getAnalise_nr(); + pdfPart.setFileName(pdfname); + multipart.addBodyPart(pdfPart,1); + + msg.setContent(multipart); + + +// Transport.send(msg); + Transport t; + t = session.getTransport( "smtp" ); + + t.connect( SMTP_HOST, SMTP_PORT, mail_username, mail_password ); + t.sendMessage( msg, msg.getAllRecipients() ); + + t.close(); + System.out.println("Email Pdf Enviado !!!! " + emailTo); + } + + public String butImprimir_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. +// AnaliseAcidente a = getSessionBean1().getCurrentAnalise(); +// if(a.getEstado().intValue() == ESTADO_IMPRESSAO) +// { +// Pdf pdf = new Pdf(); +// pdf.generatePdf(a); +// } + + if(validationOk()) + { + AnaliseAcidente a = fillAnaliseFields(); + Acidentado ac = null; + ArrayList recs = null; + ArrayList meds = null; + int estado = a.getEstado().intValue(); + //if(estado == ESTADO_SEG || estado == ESTADO_RH1) +// if(estado == Global.ESTADO_RH1) +// { +// ac = fillAcidentadoFields(); +// } +// else if(estado == Global.ESTADO_HS) +// { +// a.setTecnico_saude_id(getSessionBean1().getCurrentUser().getId()); +// recs = fillAnaliseRecomendacoesHs(a); +// } +// else if(estado == Global.ESTADO_RH2) +// { +// meds = fillAnaliseMedidasRh(a); +// } +// int novo_estado = a.getEstado().intValue(); +// +// if(a.getCorrecao().matches("y")) +// { +// a.setCorrecao("n"); +// a.setEstado(a.getEstado_antes_correcao()); +// a.setEstado_antes_correcao(null); +// a.setObservacoes_correcao(""); +// } +// else +// { +// if(novo_estado < Global.ESTADO_CONCLUIDO) +// { +// novo_estado++; +// // if(novo_estado == ESTADO_MEDICO) +// // { +// // novo_estado++; //skip medico +// // } +// if(novo_estado == Global.ESTADO_ASSINATURAS) +// { +// a.setEstado_assinatura(new Integer(ESTADO_ASSINATURA_1)); +// notifyNextSignature(new Integer(ESTADO_ASSINATURA_1)); +// } +// } +// a.setEstado(new Integer(novo_estado)); +// } + + try + { + update(a, ac, recs, meds); + chkVerRespRh.setDisabled(true); + //createImagesFolder(analiseId.toString()); +// updateImagesFolder(a.getId().toString()); +// sendMailToNextUser(new Integer(novo_estado)); +// String navFrom = getSessionBean1().getNavFrom(); +// if(navFrom.matches("FormSeguranca")) +// { +// return "form_seguranca"; +// } +// else if(navFrom.matches("FormRH")) +// { +// return "form_rh"; +// } +// else if(navFrom.matches("FormHS")) +// { +// return "form_hs"; +// } +// else if(navFrom.matches("FormMedico")) +// { +// return "form_medico"; +// } + } + catch(Exception ex) + { + getSessionBean1().setMsg("Erro na actualização da análise !"); + ex.printStackTrace(); + } + } + + return null; + } + + private void buildPdf(AnaliseAcidente a) + { + + // create pdf folder + String pdf_folder = createPdfFolder(a.getId().toString()); + if(pdf_folder != null) + { + hidDisableEnviar.setValue(a.getId().toString()); + Pdf pdf = new Pdf(); + pdf.generatePdf(pdf_folder, a); + } + } + + + private String createPdfFolder(String folderName) + { + ServletContext theApplicationsServletContext = + (ServletContext) this.getExternalContext().getContext(); + String pdfFileFolder = theApplicationsServletContext.getRealPath(PDFS_FOLDER_URL + "/" + folderName); + try + { + //String imageFileFolderTmp = theApplicationsServletContext.getRealPath(IMAGE_URL + "/tmp" + getSessionBean1().getCurrentUser().getLogin()); + File folder = new File(pdfFileFolder); + if(! folder.exists()) + { + folder.mkdir(); + } + else + { + //remove all existing files + File files[] = folder.listFiles(); + + for(int i=0;i 0) + { + booNrOk = true; + } + else + { + nr_mecano = null; + } + } + + if(txtNomeTrabalhador.getText() != null) + { + nome = (String) txtNomeTrabalhador.getText(); + if(nome.trim().length() > 0) + { + booNomeOk = true; + } + else + { + nome = null; + } + } + + if(! booNrOk && !booNomeOk) + { + getSessionBean1().setMsg("Tem de preencher Numero Mecanográfico ou Nome"); + return null; + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + Trabalhador t = null; + if(nome != null) + { + nome = utils.Utils.textToUnicode( nome.toUpperCase()); + } + try + { + ArrayList list = adp.searchTrabalhador(getSessionBean1().getCurrentUser().getEmpresa_id(), getSessionBean1().getCurrentUser().getEstabelecimento_id(), nr_mecano, nome ); + if(list.size() == 1) + { + t = (Trabalhador) list.get(0); + txtTrabalhador.setText(t.getNome()); + txtNomeAcidentado.setText(t.getNome()); + txtDataNascimento.setText(t.getData_nascimento()); + Acidentado a = new Acidentado(); + a.setTrabalhador_id(t.getId()); + a.setData_nascimento(t.getData_nascimento()); + a.setNome(t.getNome()); + a.setFuncao(utils.Utils.unicodeToHTML(t.getFuncao())); + a.setData_admissao(t.getData_admissao()); + a.setNumero_mecanografico(t.getNumero_mecanografico()); + getSessionBean1().setAcidentado(a); + gridSiprp.setRendered(true); + gridDadosAcidenteSeg.setRendered(true); + gridTrabalhadores.setRendered(false); + } + else + { + tblTrabalhadores.setRendered(true); + getSessionBean1().getTrabalhadoresListDataProvider().setList(list); + } + if(getSessionBean1().getCurrentAnalise() != null) // new analise) + { + gridTrabalhadores.setRendered(false); + } + } + catch(Exception ex) + { + getSessionBean1().setMsg("Trabalhador inexistente ! "); + tblTrabalhadores.setRendered(false); + txtTrabalhador.setText(""); + gridSiprp.setRendered(false); + gridDadosAcidenteSeg.setRendered(false); + ex.printStackTrace(); + } + + return null; + } + + public String lnkPOR_action() { + // TODO: Replace with your code + getSessionBean1().setIeBug(true); + Trabalhador t = getTrabalhadorRowData(); + Acidentado ac = setAcidentado(t); + gridSiprp.setRendered(true); + gridAcidentadoView.setRendered(true); + gridDadosAcidenteSeg.setRendered(true); + gridTrabalhadores.setRendered(false); + fillAcidentadoView(ac); + return null; + } + + public String lnkNomeTrabalhador_action() { + // TODO: Replace with your code + getSessionBean1().setIeBug(true); + Trabalhador t = getTrabalhadorRowData(); + Acidentado ac = setAcidentado(t); + gridSiprp.setRendered(true); + gridAcidentadoView.setRendered(true); + gridDadosAcidenteSeg.setRendered(true); + gridTrabalhadores.setRendered(false); + fillAcidentadoView(ac); + return null; + } + + public String lnkEstabelecimentoTrabalhador_action() { + // TODO: Replace with your code + getSessionBean1().setIeBug(true); + Trabalhador t = getTrabalhadorRowData(); + Acidentado ac = setAcidentado(t); + gridSiprp.setRendered(true); + gridAcidentadoView.setRendered(true); + gridDadosAcidenteSeg.setRendered(true); + gridTrabalhadores.setRendered(false); + fillAcidentadoView(ac); + return null; + } + + private Trabalhador getTrabalhadorRowData() + { + RowKey rk = tableRowGroup1.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + TrabalhadoresListDataProvider provider = (TrabalhadoresListDataProvider) tableRowGroup1.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + Trabalhador t = (Trabalhador)list.get(k); + return t; + } + + private Acidentado setAcidentado(Trabalhador t) + { + txtTrabalhador.setText(t.getNome()); + txtNomeAcidentado.setText(t.getNome()); + txtDataNascimento.setText(t.getData_nascimento()); + Acidentado a = new Acidentado(); + a.setTrabalhador_id(t.getId()); + a.setData_nascimento(t.getData_nascimento()); + a.setNome(t.getNome()); + a.setMorada(""); + a.setFuncao(utils.Utils.unicodeToHTML(t.getFuncao())); + a.setData_admissao(t.getData_admissao()); + a.setNumero_mecanografico(t.getNumero_mecanografico()); + a.setEstabelecimento_origem(t.getEstabelecimento()); + getSessionBean1().setAcidentado(a); + return a; + } + + public String butCorrecao_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + getSessionBean1().setIeBug(true); + getSessionBean1().setCorrecao(null); + return "correcao"; + } + + public String lnkNewUser_action() { + // TODO: Replace with your code + + return null; + } + + private boolean isRecomendacoesEmpty() + { + boolean res = true; + + for(int i=0; i < gridRecomendacoes.getChildren().size(); i++) + { + HtmlPanelGrid g = (HtmlPanelGrid) gridRecomendacoes.getChildren().get(i); + TextArea t = (TextArea) g.getChildren().get(1); + if(t.getText() != null) + { + String txt = (String) t.getText(); + if(txt.trim().length() > 0) + { + res = false; + break; + } + } + } + + return res; + } + + private boolean isMedidasEmpty() + { + boolean res = true; + + for(int i=0; i < gridMedidas.getChildren().size(); i++) + { + HtmlPanelGrid g = (HtmlPanelGrid) gridMedidas.getChildren().get(i); + TextArea t = (TextArea) g.getChildren().get(1); + if(t.getText() != null) + { + String txt = (String) t.getText(); + if(txt.trim().length() > 0) + { + res = false; + break; + } + } + } + + return res; + } + + public void drpDepartamento_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + + AnalisesDataProvider adp = new AnalisesDataProvider(); + Integer departamento_id = (Integer) drpDepartamento.getSelected(); + try + { + if(departamento_id.intValue()== 0) + { + getSessionBean1().setSeccaoOptions(adp.getSeccoesList(null)); + } + else + { + getSessionBean1().setSeccaoOptions(adp.getSeccoesList(departamento_id)); + } + + drpSeccao.setSelected(new Integer(0)); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + hidAnchor.setValue("dados"); + } + + public String lnkAjuda_action() { + // TODO: Replace with your code +// ServletContext theApplicationsServletContext = +// (ServletContext) this.getExternalContext().getContext(); +// String pdfFolderPath = theApplicationsServletContext.getRealPath(Global.PDF_FOLDER_URL); +// String pdfFilePath = pdfFolderPath + "/Ajuda.pdf"; +// +// Global global = new Global(); +// try +// { +// global.showPdf(pdfFilePath); +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } + getSessionBean1().setIeBug(true); + return null; + } + + private boolean checkRecomendacoesLen() + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + HashMap meta = new HashMap(); + try + { + meta = adp.getMetaData("recomendacoes"); + ArrayList list = new ArrayList(); + ListIterator iter = gridRecomendacoes.getChildren().listIterator(); + while(iter.hasNext()) + { + HtmlPanelGrid grd = (HtmlPanelGrid)iter.next(); + TextArea ta = (TextArea) grd.getChildren().get(1); + if(ta.getText() != null ) + { + String txt = (String) ta.getText(); + if(txt.length() > 0) + { + int len = ( (Integer) meta.get("recomendacao") ).intValue(); + if(txt.length() > len) + { + getSessionBean1().setMsg("Os Campos Recomendações não podem exceder " + len + " caracteres!"); + return false; + } + } + } + } + } + catch(Exception ex) + { + ex.printStackTrace(); + return false; + } + return true; + } + + private boolean checkMedidasLen() + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + HashMap meta = new HashMap(); + + try + { + meta = adp.getMetaData("medidas"); + ArrayList list = new ArrayList(); + ListIterator iter = gridMedidas.getChildren().listIterator(); + while(iter.hasNext()) + { + HtmlPanelGrid grd = (HtmlPanelGrid)iter.next(); + TextArea ta = (TextArea) grd.getChildren().get(1); + if(ta.getText() != null ) + { + String txt = (String) ta.getText(); + if(txt.length() > 0) + { + int len = ( (Integer) meta.get("medida") ).intValue(); + if(txt.length() > len) + { + getSessionBean1().setMsg("Os Campos Medidas não podem exceder " + len + " caracteres!"); + return false; + } + } + } + } + } + catch(Exception ex) + { + ex.printStackTrace(); + return false; + } + + return true; + } + + public String lnkPlanosActuacao_action() { + // TODO: Replace with your code + return null; + } + +} + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/ApplicationBean1.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/ApplicationBean1.java new file mode 100644 index 00000000..36df6ef2 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/ApplicationBean1.java @@ -0,0 +1,100 @@ +/* + * ApplicationBean1.java + * + * Created on September 18, 2007, 3:14 PM + * Copyright lluis + */ +package analiseacidentestrabalho; + +import com.sun.rave.web.ui.appbase.AbstractApplicationBean; +import javax.faces.FacesException; + +/** + *

Application 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/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Bundle.properties b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Bundle.properties new file mode 100644 index 00000000..13e936fe --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Bundle.properties @@ -0,0 +1 @@ +# Sample ResourceBundle properties file diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Causa.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Causa.java new file mode 100644 index 00000000..35f0ef4e --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Causa.java @@ -0,0 +1,40 @@ +/* + * Causa.java + * + * Created on November 27, 2007, 4:21 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class Causa { + private Integer id; + private String causa; + + /** Creates a new instance of Causa */ + public Causa() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getCausa() { + return causa; + } + + public void setCausa(String causa) { + this.causa = causa; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Controle.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Controle.java new file mode 100644 index 00000000..eecef399 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Controle.java @@ -0,0 +1,49 @@ +/* + * Controle.java + * + * Created on January 7, 2008, 3:03 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class Controle { + private Integer id; + private Integer analise_year; + private Integer last_analise_nr; + + /** Creates a new instance of Controle */ + public Controle() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getAnalise_year() { + return analise_year; + } + + public void setAnalise_year(Integer analise_year) { + this.analise_year = analise_year; + } + + public Integer getLast_analise_nr() { + return last_analise_nr; + } + + public void setLast_analise_nr(Integer last_analise_nr) { + this.last_analise_nr = last_analise_nr; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Correcao.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Correcao.java new file mode 100644 index 00000000..5df8a389 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Correcao.java @@ -0,0 +1,75 @@ +/* + * Correcao.java + * + * Created on November 29, 2007, 10:42 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class Correcao { + private Integer analise_id; + private String correcao; // 'y'/ 'n' + private Integer estado_actual; + private Integer estado_corr; + private String descricao; //descricao do estado a corrigir + private String observacoes; + /** Creates a new instance of Correcao */ + public Correcao() { + } + + public Integer getEstado_actual() { + return estado_actual; + } + + public void setEstado_actual(Integer estado_actual) { + this.estado_actual = estado_actual; + } + + public Integer getEstado_corr() { + return estado_corr; + } + + public void setEstado_corr(Integer estado_corr) { + this.estado_corr = estado_corr; + } + + public String getObservacoes() { + return observacoes; + } + + public void setObservacoes(String observacoes) { + this.observacoes = observacoes; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public Integer getAnalise_id() { + return analise_id; + } + + public void setAnalise_id(Integer analise_id) { + this.analise_id = analise_id; + } + + public String getCorrecao() { + return correcao; + } + + public void setCorrecao(String correcao) { + this.correcao = correcao; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Departamento.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Departamento.java new file mode 100644 index 00000000..5fdff6a2 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Departamento.java @@ -0,0 +1,49 @@ +/* + * Departamento.java + * + * Created on December 28, 2007, 11:16 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class Departamento { + private Integer id; + private String descricao; + private String activo; + + /** Creates a new instance of Departamento */ + public Departamento() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public String getActivo() { + return activo; + } + + public void setActivo(String activo) { + this.activo = activo; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Dummy.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Dummy.java new file mode 100644 index 00000000..863ff953 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Dummy.java @@ -0,0 +1,434 @@ +/* + * 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.Form; +import com.sun.rave.web.ui.component.Head; +import com.sun.rave.web.ui.component.HiddenField; +import com.sun.rave.web.ui.component.Html; +import com.sun.rave.web.ui.component.Hyperlink; +import com.sun.rave.web.ui.component.ImageComponent; +import com.sun.rave.web.ui.component.Link; +import com.sun.rave.web.ui.component.Page; +import com.sun.rave.web.ui.component.PanelGroup; +import com.sun.rave.web.ui.component.StaticText; +import com.sun.rave.web.ui.model.SingleSelectOptionsList; +import global.Global; +import java.io.File; +import java.util.Calendar; +import java.util.GregorianCalendar; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.event.ActionEvent; +import javax.faces.event.ValueChangeEvent; +import javax.servlet.ServletContext; + +/** + *

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 HiddenField hiddenField1 = new HiddenField(); + + public HiddenField getHiddenField1() { + return hiddenField1; + } + + public void setHiddenField1(HiddenField hf) { + this.hiddenField1 = hf; + } + + private HiddenField hidConfEnviar = new HiddenField(); + + public HiddenField getHidConfEnviar() { + return hidConfEnviar; + } + + public void setHidConfEnviar(HiddenField hf) { + this.hidConfEnviar = hf; + } + + private HiddenField hidConfDelete = new HiddenField(); + + public HiddenField getHidConfDelete() { + return hidConfDelete; + } + + public void setHidConfDelete(HiddenField hf) { + this.hidConfDelete = hf; + } + private SingleSelectOptionsList dropDown1DefaultOptions = new SingleSelectOptionsList(); + + public SingleSelectOptionsList getDropDown1DefaultOptions() { + return dropDown1DefaultOptions; + } + + public void setDropDown1DefaultOptions(SingleSelectOptionsList ssol) { + this.dropDown1DefaultOptions = ssol; + } + private SingleSelectOptionsList dropDown2DefaultOptions = new SingleSelectOptionsList(); + + public SingleSelectOptionsList getDropDown2DefaultOptions() { + return dropDown2DefaultOptions; + } + + public void setDropDown2DefaultOptions(SingleSelectOptionsList ssol) { + this.dropDown2DefaultOptions = ssol; + } + + //
+ + /** + *

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 butCancelar_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 butGravar_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 butEnviar_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 butImagem_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 lnkMoreMed1_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 lnkEditUser_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkLogout_action() { + // TODO: Replace with your code + + return null; + } + + public String butProcurarTrab_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 lnkPOR_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkNomeTrabalhador_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkEstabelecimentoTrabalhador_action() { + // TODO: Replace with your code + + return null; + } + + public void drpTipo_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + + } + + public void drpNome_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + + } + + public String hyperlink1_action() { + // TODO: Replace with your code + + return null; + } + + public void lnk_actionListener(ActionEvent e) + { + System.out.println("LINK"); + } + + + +// public String lnkAjuda_action() { +// // TODO: Replace with your code +// ServletContext theApplicationsServletContext = +// (ServletContext) this.getExternalContext().getContext(); +// String pdfFolderPath = theApplicationsServletContext.getRealPath(Global.PDF_FOLDER_URL); +// String pdfFilePath = pdfFolderPath + "/Ajuda.pdf"; +// +// Global global = new Global(); +// try +// { +// global.showPdf(pdfFilePath); +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } +// return null; +// } + + public String butVoltar_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 butEliminar_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 lnkPlanosActuacao_action() { + // TODO: Replace with your code + return null; + } + + public String lnkAnalisesAcidente_action() { + // TODO: Replace with your code + return null; + } + + public String lnkNewUser_action() { + // TODO: Replace with your code + return null; + } + + public String lnkAjuda_action() { + // TODO: Replace with your code + return null; + } + + public String lnkGerirUtilizadores_action() { + // TODO: Replace with your code + return null; + } + + public String lnkAnalises_action() { + // TODO: Replace with your code + return null; + } + + public String lnkPlanos_action() { + // TODO: Replace with your code + return null; + } +} + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/EditUser.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/EditUser.java new file mode 100644 index 00000000..70fe873c --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/EditUser.java @@ -0,0 +1,22 @@ +/* + * EditUser.java + * + * Created on December 5, 2007, 2:02 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class EditUser extends Utilizador{ + + /** Creates a new instance of EditUser */ + public EditUser() { + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/EnviarCorrecao.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/EnviarCorrecao.java new file mode 100644 index 00000000..316e2a06 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/EnviarCorrecao.java @@ -0,0 +1,762 @@ +/* + * EnviarCorrecao.java + * + * Created on November 28, 2007, 5:27 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.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.TextArea; +import db.AnalisesDataProvider; +import db.EstadosCorrecaoDataProvider; +import global.Global; +import java.util.ArrayList; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.event.ValueChangeEvent; +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 EnviarCorrecao 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 HtmlPanelGrid gridLayoutTop1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLayoutTop1() { + return gridLayoutTop1; + } + + public void setGridLayoutTop1(HtmlPanelGrid hpg) { + this.gridLayoutTop1 = hpg; + } + + private HtmlPanelGrid gridPanel9 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel9() { + return gridPanel9; + } + + public void setGridPanel9(HtmlPanelGrid hpg) { + this.gridPanel9 = hpg; + } + + private PanelGroup groupPanel8 = new PanelGroup(); + + public PanelGroup getGroupPanel8() { + return groupPanel8; + } + + public void setGroupPanel8(PanelGroup pg) { + this.groupPanel8 = pg; + } + + private StaticText staticText10 = new StaticText(); + + public StaticText getStaticText10() { + return staticText10; + } + + public void setStaticText10(StaticText st) { + this.staticText10 = st; + } + + private ImageComponent image3 = new ImageComponent(); + + public ImageComponent getImage3() { + return image3; + } + + public void setImage3(ImageComponent ic) { + this.image3 = ic; + } + + private StaticText staticText11 = new StaticText(); + + public StaticText getStaticText11() { + return staticText11; + } + + public void setStaticText11(StaticText st) { + this.staticText11 = st; + } + + private HtmlPanelGrid gridMain1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridMain1() { + return gridMain1; + } + + public void setGridMain1(HtmlPanelGrid hpg) { + this.gridMain1 = 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 StaticText staticText6 = new StaticText(); + + public StaticText getStaticText6() { + return staticText6; + } + + public void setStaticText6(StaticText st) { + this.staticText6 = st; + } + + private TextArea txtObservacoes = new TextArea(); + + public TextArea getTxtObservacoes() { + return txtObservacoes; + } + + public void setTxtObservacoes(TextArea ta) { + this.txtObservacoes = ta; + } + + private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel2() { + return gridPanel2; + } + + public void setGridPanel2(HtmlPanelGrid hpg) { + this.gridPanel2 = hpg; + } + + private Button butCancelar = new Button(); + + public Button getButCancelar() { + return butCancelar; + } + + public void setButCancelar(Button b) { + this.butCancelar = b; + } + + private TableColumn tableColumn1 = new TableColumn(); + + public TableColumn getTableColumn1() { + return tableColumn1; + } + + public void setTableColumn1(TableColumn tc) { + this.tableColumn1 = tc; + } + + private Hyperlink lnkEstadoCorr = new Hyperlink(); + + public Hyperlink getLnkEstadoCorr() { + return lnkEstadoCorr; + } + + public void setLnkEstadoCorr(Hyperlink h) { + this.lnkEstadoCorr = h; + } + + private StaticText staticText5 = new StaticText(); + + public StaticText getStaticText5() { + return staticText5; + } + + public void setStaticText5(StaticText st) { + this.staticText5 = st; + } + + private Button butConfirmar = new Button(); + + public Button getButConfirmar() { + return butConfirmar; + } + + public void setButConfirmar(Button b) { + this.butConfirmar = b; + } + + 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 lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + + //
+ + /** + *

Construct a new Page bean instance.

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

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("EnviarCorrecao 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() { + lblUser.setText( getSessionBean1().getCurrentUser().getLogin()); + fillTabelaEstados(); + 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 lnkEditUser_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkLogout_action() { + // TODO: Replace with your code + + try + { + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + } + catch(Exception ex){} + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) {} + //return "login"; + return null; + } + + public String lnkDataAcidente_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkNr_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkPor_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkNomeAcidentado_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkFase_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkDataAcidenteSeg_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkNrSeg_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkPorSeg_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkNomeAcidentadoSeg_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkFaseSeg_action() { + // TODO: Replace with your code + + return null; + } + + public void drpAno_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + + } + + public void drpMes_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + + } + + 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. + + return null; + } + + public String lnkDataConcluida_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkNrConcluida_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkPorConcluida_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkNomeConcluida_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkEstabConcluida_action() { + // TODO: Replace with your code + + return null; + } + + private void fillTabelaEstados() + { + ArrayList list = new ArrayList(); + Correcao c = null; + int estado = getSessionBean1().getCurrentAnalise().getEstado().intValue(); + + switch(estado) + { + case Global.ESTADO_HS: + c = new Correcao(); + c.setCorrecao("y"); + c.setAnalise_id(getSessionBean1().getCurrentAnalise().getId()); + c.setEstado_actual(getSessionBean1().getCurrentAnalise().getEstado()); + c.setEstado_corr(new Integer(Global.ESTADO_SEG)); + c.setDescricao("FASE 1 - SEG - ABERTURA"); + list.add(c); + c = new Correcao(); + c.setCorrecao("y"); + c.setAnalise_id(getSessionBean1().getCurrentAnalise().getId()); + c.setEstado_actual(getSessionBean1().getCurrentAnalise().getEstado()); + c.setEstado_corr(new Integer(Global.ESTADO_RH1)); + c.setDescricao("FASE 2 - RH - ACOMPANHAMENTO"); + list.add(c); + getSessionBean1().getEstadosCorrecaoDataProvider().setList(list); + break; + case Global.ESTADO_CONSOLIDACAO: + c = new Correcao(); + c.setCorrecao("y"); + c.setAnalise_id(getSessionBean1().getCurrentAnalise().getId()); + c.setEstado_actual(getSessionBean1().getCurrentAnalise().getEstado()); + c.setEstado_corr(new Integer(Global.ESTADO_RH2)); + c.setDescricao("FASE 4 - RH - MEDIDAS + LESÃO"); + list.add(c); +// c = new Correcao(); +// c.setCorrecao("y"); +// c.setAnalise_id(getSessionBean1().getCurrentAnalise().getId()); +// c.setEstado_actual(getSessionBean1().getCurrentAnalise().getEstado()); +// c.setEstado_corr(new Integer(Global.ESTADO_MEDICINA)); +// c.setDescricao("Medicina"); +// list.add(c); + getSessionBean1().getEstadosCorrecaoDataProvider().setList(list); + break; + } + } + + public String lnkEstadoCorr_action() { + // TODO: Replace with your code + RowKey rk = tableRowGroup1.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + EstadosCorrecaoDataProvider provider = (EstadosCorrecaoDataProvider) tableRowGroup1.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + Correcao c = (Correcao)list.get(k); + + getSessionBean1().setCorrecao(c); + +// c.setObservacoes(""); +// if(txtObservacoes.getText() != null) +// { +// String obs = (String) txtObservacoes.getText(); +// c.setObservacoes(obs); +// } +// AnalisesDataProvider adp = new AnalisesDataProvider(); +// try +// { +// adp.changeEstado(c); +// +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } +// return "form_hs"; + return null; + } + + public String lnkNewUser_action() { + // TODO: Replace with your code + + 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 "form_hs"; + return "analise_acidente"; + } + + public String lnkAjuda_action() { + // TODO: Replace with your code +// ServletContext theApplicationsServletContext = +// (ServletContext) this.getExternalContext().getContext(); +// String pdfFolderPath = theApplicationsServletContext.getRealPath(Global.PDF_FOLDER_URL); +// String pdfFilePath = pdfFolderPath + "/Ajuda.pdf"; +// +// Global global = new Global(); +// try +// { +// global.showPdf(pdfFilePath); +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } + return null; + } + + public String butConfirmar_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + + Correcao c = getSessionBean1().getCorrecao(); + if(c != null) + { + c.setObservacoes(""); + if(txtObservacoes.getText() != null) + { + String obs = (String) txtObservacoes.getText(); + c.setObservacoes(obs); + } + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + adp.changeEstado(c); + + } + catch(Exception ex) + { + ex.printStackTrace(); + } + return "form_hs"; + } + else + { + getSessionBean1().setMsg("Tem de indicar para onde enviar a correcção"); + return null; + } + + } + + public String lnkAnalisesAcidente_action() { + // TODO: Replace with your code + return null; + } + + public String lnkPlanosActuacao_action() { + // TODO: Replace with your code + return null; + } +} + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Erro.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Erro.java new file mode 100644 index 00000000..66aa2dc1 --- /dev/null +++ b/branches/SIPRP/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/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Estabelecimento.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Estabelecimento.java new file mode 100644 index 00000000..afdcaecf --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Estabelecimento.java @@ -0,0 +1,49 @@ +/* + * Empresa.java + * + * Created on October 11, 2007, 5:19 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class Estabelecimento { + private Integer id; + private String nome_plain; + private String nome; + + /** Creates a new instance of Empresa */ + public Estabelecimento() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getNome_plain() { + return nome_plain; + } + + public void setNome_plain(String nome_plain) { + this.nome_plain = nome_plain; + } + + public String getNome() { + return nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Estado.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Estado.java new file mode 100644 index 00000000..d7354742 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Estado.java @@ -0,0 +1,39 @@ +/* + * Estado.java + * + * Created on November 29, 2007, 10:01 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class Estado { + private Integer estado; + private String descricao; + /** Creates a new instance of Estado */ + public Estado() { + } + + public Integer getEstado() { + return estado; + } + + public void setEstado(Integer estado) { + this.estado = estado; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FichaUtilizador.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FichaUtilizador.java new file mode 100644 index 00000000..0a184890 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FichaUtilizador.java @@ -0,0 +1,1594 @@ +/* + * FichaUtilizador.java + * + * Created on October 11, 2007, 9:49 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.Checkbox; +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.HiddenField; +import com.sun.rave.web.ui.component.Html; +import com.sun.rave.web.ui.component.Hyperlink; +import com.sun.rave.web.ui.component.ImageComponent; +import com.sun.rave.web.ui.component.Link; +import com.sun.rave.web.ui.component.Page; +import com.sun.rave.web.ui.component.PanelGroup; +import com.sun.rave.web.ui.component.PasswordField; +import com.sun.rave.web.ui.component.StaticText; +import com.sun.rave.web.ui.component.TextField; +import com.sun.rave.web.ui.model.SingleSelectOptionsList; +import db.AnalisesDataProvider; +import db.UtilizadoresDataProvider; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.event.ValueChangeEvent; +import javax.servlet.http.HttpServletRequest; +import utils.Utils; +import global.Global; +import javax.faces.context.FacesContext; +import utils.JSFUtils; + +/** + *

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 FichaUtilizador 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 HtmlPanelGrid gridMsg1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridMsg1() { + return gridMsg1; + } + + public void setGridMsg1(HtmlPanelGrid hpg) { + this.gridMsg1 = hpg; + } + + private StaticText txtMsg = new StaticText(); + + public StaticText getTxtMsg() { + return txtMsg; + } + + public void setTxtMsg(StaticText st) { + this.txtMsg = st; + } + + 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 PanelGroup groupPanel3 = new PanelGroup(); + + public PanelGroup getGroupPanel3() { + return groupPanel3; + } + + public void setGroupPanel3(PanelGroup pg) { + this.groupPanel3 = pg; + } + + private StaticText stCriarEditar = new StaticText(); + + public StaticText getStCriarEditar() { + return stCriarEditar; + } + + public void setStCriarEditar(StaticText st) { + this.stCriarEditar = st; + } + + 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 StaticText staticText5 = new StaticText(); + + public StaticText getStaticText5() { + return staticText5; + } + + public void setStaticText5(StaticText st) { + this.staticText5 = st; + } + + private DropDown drpTipo = new DropDown(); + + public DropDown getDrpTipo() { + return drpTipo; + } + + public void setDrpTipo(DropDown dd) { + this.drpTipo = dd; + } + + 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 DropDown drpNome = new DropDown(); + + public DropDown getDrpNome() { + return drpNome; + } + + public void setDrpNome(DropDown dd) { + this.drpNome = dd; + } + + private TextField txtNome = new TextField(); + + public TextField getTxtNome() { + return txtNome; + } + + public void setTxtNome(TextField tf) { + this.txtNome = tf; + } + + private StaticText staticText7 = new StaticText(); + + public StaticText getStaticText7() { + return staticText7; + } + + public void setStaticText7(StaticText st) { + this.staticText7 = st; + } + + private TextField txtLogin = new TextField(); + + public TextField getTxtLogin() { + return txtLogin; + } + + public void setTxtLogin(TextField tf) { + this.txtLogin = tf; + } + + private StaticText staticText8 = new StaticText(); + + public StaticText getStaticText8() { + return staticText8; + } + + public void setStaticText8(StaticText st) { + this.staticText8 = st; + } + + private PasswordField txtPassword = new PasswordField(); + + public PasswordField getTxtPassword() { + return txtPassword; + } + + public void setTxtPassword(PasswordField pf) { + this.txtPassword = pf; + } + + private StaticText staticText9 = new StaticText(); + + public StaticText getStaticText9() { + return staticText9; + } + + public void setStaticText9(StaticText st) { + this.staticText9 = st; + } + + private TextField txtEmail = new TextField(); + + public TextField getTxtEmail() { + return txtEmail; + } + + public void setTxtEmail(TextField tf) { + this.txtEmail = tf; + } + + private StaticText lblCap = new StaticText(); + + public StaticText getLblCap() { + return lblCap; + } + + public void setLblCap(StaticText st) { + this.lblCap = st; + } + + private TextField txtCap = new TextField(); + + public TextField getTxtCap() { + return txtCap; + } + + public void setTxtCap(TextField tf) { + this.txtCap = tf; + } + + private StaticText lblCedula = new StaticText(); + + public StaticText getLblCedula() { + return lblCedula; + } + + public void setLblCedula(StaticText st) { + this.lblCedula = st; + } + + private StaticText stCedula = new StaticText(); + + public StaticText getStCedula() { + return stCedula; + } + + public void setStCedula(StaticText st) { + this.stCedula = st; + } + + private HtmlPanelGrid gridPanel6 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel6() { + return gridPanel6; + } + + public void setGridPanel6(HtmlPanelGrid hpg) { + this.gridPanel6 = hpg; + } + + private PanelGroup groupPanel4 = new PanelGroup(); + + public PanelGroup getGroupPanel4() { + return groupPanel4; + } + + public void setGroupPanel4(PanelGroup pg) { + this.groupPanel4 = pg; + } + + private StaticText staticText13 = new StaticText(); + + public StaticText getStaticText13() { + return staticText13; + } + + public void setStaticText13(StaticText st) { + this.staticText13 = st; + } + + private HtmlPanelGrid gridPanel7 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel7() { + return gridPanel7; + } + + public void setGridPanel7(HtmlPanelGrid hpg) { + this.gridPanel7 = hpg; + } + + private Button butCancelar = new Button(); + + public Button getButCancelar() { + return butCancelar; + } + + public void setButCancelar(Button b) { + this.butCancelar = b; + } + + 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 HiddenField hidConfDelUser = new HiddenField(); + + public HiddenField getHidConfDelUser() { + return hidConfDelUser; + } + + public void setHidConfDelUser(HiddenField hf) { + this.hidConfDelUser = hf; + } + + //
+ private boolean isPostData = false; + + private final static int SEG = 1; + private final static int RH = 2; + private final static int HS = 3; + private final static int MEDICO = 5; + private final static int GESTOR = 6; + private final static int DIRECTOR_RH = 7; + private final static int DIRECTOR_SIPRP = 8; + private final static int DIRECTOR_LOJA = 9; + private final static int DIRECTOR_NACIONAL_SEGURANCA = 10; + + private boolean isFromPlanos = false; + + private StaticText staticText12 = new StaticText(); + + public StaticText getStaticText12() { + return staticText12; + } + + public void setStaticText12(StaticText st) { + this.staticText12 = st; + } + + private DropDown drpEstabelecimentos = new DropDown(); + + public DropDown getDrpEstabelecimentos() { + return drpEstabelecimentos; + } + + public void setDrpEstabelecimentos(DropDown dd) { + this.drpEstabelecimentos = dd; + } + + private SingleSelectOptionsList drpEstabelecimentosDefaultOptions = new SingleSelectOptionsList(); + + public SingleSelectOptionsList getDrpEstabelecimentosDefaultOptions() { + return drpEstabelecimentosDefaultOptions; + } + + public void setDrpEstabelecimentosDefaultOptions(SingleSelectOptionsList ssol) { + this.drpEstabelecimentosDefaultOptions = ssol; + } + + private StaticText lblResponsavelLoja = new StaticText(); + + public StaticText getLblResponsavelLoja() { + return lblResponsavelLoja; + } + + public void setLblResponsavelLoja(StaticText st) { + this.lblResponsavelLoja = st; + } + + private Checkbox chkResponsavelLoja = new Checkbox(); + + public Checkbox getChkResponsavelLoja() { + return chkResponsavelLoja; + } + + public void setChkResponsavelLoja(Checkbox c) { + this.chkResponsavelLoja = c; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private PasswordField txtConfPassword = new PasswordField(); + + public PasswordField getTxtConfPassword() { + return txtConfPassword; + } + + public void setTxtConfPassword(PasswordField pf) { + this.txtConfPassword = pf; + } + + private HtmlPanelGrid gridPanel8 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel8() { + return gridPanel8; + } + + public void setGridPanel8(HtmlPanelGrid hpg) { + this.gridPanel8 = hpg; + } + + private PanelGroup groupPanel6 = new PanelGroup(); + + public PanelGroup getGroupPanel6() { + return groupPanel6; + } + + public void setGroupPanel6(PanelGroup pg) { + this.groupPanel6 = pg; + } + + private StaticText staticText10 = new StaticText(); + + public StaticText getStaticText10() { + return staticText10; + } + + public void setStaticText10(StaticText st) { + this.staticText10 = st; + } + + private ImageComponent image3 = new ImageComponent(); + + public ImageComponent getImage3() { + return image3; + } + + public void setImage3(ImageComponent ic) { + this.image3 = ic; + } + + private StaticText staticText11 = new StaticText(); + + public StaticText getStaticText11() { + return staticText11; + } + + public void setStaticText11(StaticText st) { + this.staticText11 = st; + } + private StaticText lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + private Hyperlink lnkGerirUtilizadores = new Hyperlink(); + + public Hyperlink getLnkGerirUtilizadores() { + return lnkGerirUtilizadores; + } + + public void setLnkGerirUtilizadores(Hyperlink h) { + this.lnkGerirUtilizadores = h; + } + + /** + *

Construct a new Page bean instance.

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

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("FichaUtilizador 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 . . . + } + } + else + { + + FacesContext fc = getFacesContext(); + System.out.println("REQUEST PARAMETERS : " + JSFUtils.requestHasParameters(fc)); + isFromPlanos = false; + if(JSFUtils.requestHasParameters(fc)) + { + isFromPlanos = true; + String user_id = JSFUtils.getRequestParameter(fc, "user"); + String mode = JSFUtils.getRequestParameter(fc, "mode"); + if(mode != null) + { + if(mode.matches("edit")) + { + System.out.println("MODE PARAMETER : " + mode); + getSessionBean1().setModoEdicaoUtilizador("edit"); + } + } + + Utilizador u = null; + try + { + Integer userId = new Integer(Integer.parseInt(user_id)); + System.out.println("USER ID FROM PLANOS : " + user_id); + try + { + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + //udp.checkConnection(); + u = udp.getUtilizador(userId); + getSessionBean1().setCurrentUser(u); + } + catch(Exception ex1) + { + ex1.printStackTrace(); + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + + + if( + getSessionBean1().getCurrentUser().getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_GERAL_RH + || getSessionBean1().getCurrentUser().getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP ) + { + lnkGerirUtilizadores.setDisabled(false); + } + else + { + lnkGerirUtilizadores.setDisabled(true); + } + + HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); + String referer = request.getRequestURI(); + String pageFrom = Utils.getPageFrom(referer); + if(isFromPlanos) + { + isPostData = false; + } + else + { + if(pageFrom.matches("FichaUtilizador.jsp")) + { + isPostData = true; + System.out.println("IS POSTDATA : " + isPostData); + } + } + + if(!isPostData) + { + + + lblUser.setText( getSessionBean1().getCurrentUser().getLogin() ); + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + Integer permissao = udp.getPermissionCode( getSessionBean1().getCurrentUser().getId() ); + getSessionBean1().setTiposOptions(adp.getTiposList(permissao)); + drpTipo.setSelected(new Integer(0)); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + try + { + getSessionBean1().setEstabelecimentosOptions(adp.getEstabelecimentosList( getSessionBean1().getCurrentUser().getEmpresa_id(), new Boolean(false) )); + System.out.println("ESTABELECIMENTOS OPTIONS : " + getSessionBean1().getEstabelecimentosOptions().length); + drpEstabelecimentos.setSelected(new Integer(-1)); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + } + else //postData + { + String del_user = (String)getExternalContext().getRequestParameterMap().get("del_user"); + if(del_user != null) + { + if(del_user.matches("yes")) + { + hidConfDelUser.setValue(""); + try + { + deleteUser(); + } + catch(Exception ex) + { + ex.printStackTrace(); + getSessionBean1().setMsg("Erro na eliminação do utilizador!"); + } + + //force a page reload + // try + // { + // getExternalContext().redirect("FichaUtilizador.jsp"); + // System.out.println("REDIRECT"); + // } + // catch(Exception ex) + // { + // ex.printStackTrace(); + // } + + } + else if(del_user.matches("no")) + { + hidConfDelUser.setValue(""); + showUser(); + } + } + + } + + } + + + + } + + /** + *

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() { + stCriarEditar.setText("EDITAR"); + + if(getSessionBean1().getModoEdicaoUtilizador().matches("new")) + { + if(!isPostData) + { + txtNome.setStyleClass("hide"); + stCriarEditar.setText("CRIAR"); + lblCap.setRendered(false); + txtCap.setRendered(false); + lblCedula.setRendered(false); + stCedula.setRendered(false); + } + + } + if(getSessionBean1().getModoEdicaoUtilizador().matches("edit")) + { + //drpNome.setRendered(true); + + if(!isPostData) + { + showUser(); + } + } + + txtMsg.setText(getSessionBean1().getMsg()); + getSessionBean1().setMsg(""); + + if(getSessionBean1().isMudarPassword()) + { + //txtMsg.setStyle("color: #000000; font-weight: bold"); + if(!isPostData) + { + txtMsg.setText("Por favor confirme os seus dados e altere a password para uma apenas do seu conhecimento."); + } + //getSessionBean1().setMudarPassword(false); + } + } + + /** + *

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 ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1)getBean("ApplicationBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1)getBean("RequestBean1"); + } + + public String lnkAnalisesAcidente_action() { + //return navigate(); + int tipo = getSessionBean1().getCurrentUser().getTipo().intValue(); + if(tipo == Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP) + { + return "form_dir_siprp"; + } + else if(tipo == Global.TIPO_UTILIZADOR_DIRECTOR_GERAL_RH) + { + return "form_dir_ger_rh"; + } + else if(tipo == Global.TIPO_UTILIZADOR_SEGURANCA) + { + return "form_seguranca"; + } + else if(tipo == Global.TIPO_UTILIZADOR_RH) + { + return "form_rh"; + } + else if(tipo == Global.TIPO_UTILIZADOR_RH) + { + return "form_rh"; + } + else if(tipo == Global.TIPO_UTILIZADOR_HS) + { + return "form_hs"; + } + else if(tipo == Global.TIPO_UTILIZADOR_GESTOR) + { + return "form_gestor"; + } + else if(tipo == Global.TIPO_UTILIZADOR_DIRECTOR_LOJA) + { + return "form_gestor"; + } + else if(tipo == Global.TIPO_UTILIZADOR_DIRECTOR_NACIONAL_SEGURANCA) + { + return "form_gestor"; + } + + return null; + } + + public String lnkLogout_action() { + // TODO: Replace with your code + try + { + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + } + catch(Exception ex){} + + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) {} + //return "login"; + 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 navigate(); + } + + public String butGravar_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + if(validationOk()) + { + if(getSessionBean1().getModoEdicaoUtilizador().matches("new")) + { + try + { + Utilizador u = addUser(); + addPermissao(u); + getSessionBean1().setMsg("Utilizador criado"); + } + catch(Exception ex) + { + getSessionBean1().setMsg("Erro na criação do utilizador!"); + ex.printStackTrace(); + } + } + else //edit + { + try + { + updateUser(); + //getSessionBean1().setMsg("Dados actualizados"); + return navigate(); + } + catch(Exception ex) + { + getSessionBean1().setMsg("Erro na actualização do utilizador"); + ex.printStackTrace(); + } + } + + if(getSessionBean1().isMudarPassword()) + { + getSessionBean1().setMudarPassword(false); + } + + } + + return null; + } + + public void drpTipo_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + drpNome.setVisible(true); + Integer tipo = (Integer) drpTipo.getSelected(); + boolean booGestor = false; + if(tipo.intValue() == GESTOR) + { + booGestor = true; + } + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + getSessionBean1().setEstabelecimentosOptions(adp.getEstabelecimentosList( getSessionBean1().getCurrentUser().getEmpresa_id(), new Boolean(booGestor) )); + drpEstabelecimentos.setSelected(new Integer(-1)); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + if(tipo.intValue() == SEG || tipo.intValue() == RH || tipo.intValue() == GESTOR || tipo.intValue() == DIRECTOR_RH || tipo.intValue() == DIRECTOR_SIPRP) + { + drpNome.setRendered(false); + txtNome.setStyleClass("show"); + lblCap.setRendered(false); + txtCap.setRendered(false); + lblCedula.setRendered(false); + stCedula.setRendered(false); + } + else if(tipo.intValue() == HS || tipo.intValue() == MEDICO) + { + drpNome.setRendered(true); + txtNome.setStyleClass("hide"); + if(tipo.intValue() == HS) + { + lblCap.setRendered(true); + txtCap.setRendered(true); + lblCedula.setRendered(false); + stCedula.setRendered(false); + try + { + getSessionBean1().setMedicosOptions(adp.getTecnicosSaudeList()); + drpNome.setSelected(new Integer(0)); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + else // medicos + { + lblCedula.setRendered(true); + stCedula.setRendered(true); + lblCap.setRendered(false); + txtCap.setRendered(false); + try + { + getSessionBean1().setMedicosOptions(adp.getMedicosList()); + drpNome.setSelected(new Integer(0)); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + } + } + + private boolean validationOk() + { + Integer tipo = (Integer) drpTipo.getSelected(); +// if(tipo.intValue() == 0) +// { +// getSessionBean1().setMsg("Tem de escolher um tipo!"); +// return false; +// } +// Integer estabelecimento = (Integer) drpEstabelecimentos.getSelected(); +// if(estabelecimento.intValue() == -1) +// { +// getSessionBean1().setMsg("Tem de escolher um estabelecimento!"); +// return false; +// } + +// if(tipo.intValue() == SEG || tipo.intValue() == RH || tipo.intValue() == GESTOR || tipo.intValue() == DIRECTOR_RH || tipo.intValue() == DIRECTOR_SIPRP) +// { +// if(txtNome.getText() == null) +// { +// getSessionBean1().setMsg("Tem de indicar o nome!"); +// return false; +// } +// else +// { +// String nome = (String) txtNome.getText(); +// if(nome.trim().length() == 0) +// { +// getSessionBean1().setMsg("Tem de indicar o nome!"); +// return false; +// } +// } +// } +// else if(tipo.intValue() == HS || tipo.intValue() == MEDICO) +// { +// Integer nome = (Integer) drpNome.getSelected(); +// if(nome.intValue() == 0) +// { +// getSessionBean1().setMsg("Tem de indicar o nome!"); +// return false; +// } +// } + +// if(txtLogin.getText() == null) +// { +// getSessionBean1().setMsg("Tem de indicar o login!"); +// return false; +// } +// else +// { +// String login = (String) txtLogin.getText(); +// if(login.trim().length() == 0) +// { +// getSessionBean1().setMsg("Tem de indicar o login!"); +// return false; +// } +// } + + if(txtPassword.getText() == null) + { + getSessionBean1().setMsg("Tem de indicar a password!"); + return false; + } + else + { + String password = (String) txtPassword.getText(); + if(password.trim().length() == 0) + { + getSessionBean1().setMsg("Tem de indicar a password!"); + return false; + } + else + { + if(txtConfPassword.getText() == null) + { + getSessionBean1().setMsg("Tem de confirmar a password!"); + return false; + } + else + { + String conf_password = (String) txtConfPassword.getText(); + if(conf_password.trim().length() == 0) + { + getSessionBean1().setMsg("Tem de confirmar a password!"); + return false; + } + else + { + if(!password.equals(conf_password)) + { + getSessionBean1().setMsg("A confirmação tem de ser igual à a password!"); + return false; + } + } + } + } // + } + + if(getSessionBean1().isMudarPassword()) + { + String password = (String) txtPassword.getText(); + if(password.matches(getSessionBean1().getCurrentUser().getPassword())) + { + getSessionBean1().setMsg("A nova password tem de ser diferente da password actual!"); + return false; + } + + } + +// if(tipo.intValue() == HS) +// { +// if(txtCap.getText() == null ) +// { +// getSessionBean1().setMsg("Tem de indicar o c.a.p.!"); +// return false; +// } +// else +// { +// String cap = (String) txtCap.getText(); +// if(cap.trim().length() == 0) +// { +// getSessionBean1().setMsg("Tem de indicar o c.a.p.!"); +// return false; +// } +// } +// } + + return true; + } + + public void drpNome_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + Integer tipo = (Integer) drpTipo.getSelected(); + if(tipo.intValue() == MEDICO) + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + Integer medico_id = (Integer) drpNome.getSelected(); + try + { + String numero_cedula = adp.getNumeroCedula(medico_id); + stCedula.setText(numero_cedula); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + } + + private Utilizador addUser() throws Exception + { + Utilizador u = fillUser(); + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + Integer id = udp.createNewUtilizador(u); + u.setId(id); + return u; + } + + private void addPermissao(Utilizador u) throws Exception + { + Permissao p = new Permissao(); + p.setUser_id(u.getId()); + p.setCodigo_permissao(u.getTipo()); + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + udp.createPermissao(p); + } + + private void updateUser() throws Exception + { + Utilizador u = fillUser(); + u.setId(getSessionBean1().getCurrentUser().getId()); + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + udp.updateUtilizador(u); + } + + private void deleteUser() throws Exception + { + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + udp.deleteUser(getSessionBean1().getCurrentUser().getId()); + } + + private void showUser() + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + Utilizador u = getSessionBean1().getCurrentUser(); + drpTipo.setSelected(u.getTipo()); + if(u.getTipo().intValue() == SEG || u.getTipo().intValue() == RH || u.getTipo().intValue() == HS || u.getTipo().intValue() == MEDICO || u.getTipo().intValue() == GESTOR || u.getTipo().intValue() == DIRECTOR_RH || u.getTipo().intValue() == DIRECTOR_SIPRP) + { + drpNome.setRendered(false); + txtNome.setStyleClass("show"); + lblCap.setRendered(false); + txtCap.setRendered(false); + lblCedula.setRendered(false); + stCedula.setRendered(false); + txtNome.setText(utils.Utils.unicodeToHTML(u.getNome())); + } + else if(u.getTipo().intValue() == HS) + { + //txtNome.setRendered(false); + try + { + getSessionBean1().setMedicosOptions(adp.getTecnicosSaudeList()); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + drpNome.setSelected(u.getFuncionario_hst_id()); + drpNome.setStyleClass("show"); + lblCap.setRendered(true); + txtCap.setRendered(true); + lblCedula.setRendered(false); + stCedula.setRendered(false); + txtCap.setText(u.getCap()); + } + else if(u.getTipo().intValue() == DIRECTOR_LOJA || u.getTipo().intValue() == DIRECTOR_NACIONAL_SEGURANCA) + { + drpNome.setRendered(false); + txtNome.setStyleClass("show"); + lblCap.setRendered(false); + txtCap.setRendered(false); + lblCedula.setRendered(false); + stCedula.setRendered(false); + lblResponsavelLoja.setRendered(false); + chkResponsavelLoja.setRendered(false); + txtNome.setText(utils.Utils.unicodeToHTML(u.getNome())); + } + else if(u.getTipo().intValue() == MEDICO) //medico + { + drpNome.setRendered(true); + try + { + getSessionBean1().setMedicosOptions(adp.getMedicosList()); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + drpNome.setSelected(u.getMedico_id()); + txtNome.setStyleClass("hide"); + lblCap.setRendered(false); + txtCap.setRendered(false); + lblCedula.setRendered(true); + stCedula.setRendered(true); + stCedula.setText(u.getNumero_cedula()); + + } + if(u.getEstabelecimento_id() != null) + { + drpEstabelecimentos.setSelected(u.getEstabelecimento_id()); + } + + txtLogin.setText(u.getLogin()); + //txtPassword.setText(u.getPassword()); + txtEmail.setText(u.getEmail()); + } + + private Utilizador fillUser() + { + //Utilizador u = new Utilizador(); + Utilizador u = getSessionBean1().getCurrentUser(); +// u.setActivo("y"); +// u.setAdministrador("n"); +// u.setTipo((Integer) drpTipo.getSelected()); +// u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id()); +// u.setEstabelecimento_id( (Integer) drpEstabelecimentos.getSelected() ); +// u.setLogin( (String) txtLogin.getText() ); + String password = (String) txtPassword.getText(); + u.setPassword( password ); + java.util.Date today = + new java.util.Date(); + java.sql.Date sqlToday = + new java.sql.Date(today.getTime()); + u.setData_password(sqlToday); + + + u.setEmail(""); + if(txtEmail.getText() != null) + { + u.setEmail( (String) txtEmail.getText() ); + } + + Integer tipo = (Integer) drpTipo.getSelected(); + +// u.setNumero_cedula(""); +// u.setCap(""); +// if(tipo.intValue() == HS || tipo.intValue() == MEDICO) +// { +// AnalisesDataProvider adp = new AnalisesDataProvider(); +// if(tipo.intValue() == HS) +// { +// try +// { +// Integer tecnico_id = (Integer) drpNome.getSelected(); +// u.setFuncionario_hst_id(tecnico_id); +// u.setNome( adp.getTecnicoSaudeNome(tecnico_id) ); +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } +// u.setCap( (String) txtCap.getText()); +// } +// else // medico +// { +// try +// { +// Integer medico_id = (Integer) drpNome.getSelected(); +// u.setMedico_id(medico_id); +// u.setNome( adp.getMedicoNome(medico_id) ); +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } +// u.setNumero_cedula( (String) stCedula.getText()); +// } +// } +// else +// { +// u.setNome( (String) txtNome.getText() ); +// } + +// u.setResponsavel_loja("n"); +// if(chkResponsavelLoja.getSelected() != null) +// { +// if(chkResponsavelLoja.getSelected().equals(new Boolean(true))) +// { +// u.setResponsavel_loja("y"); +// } +// } +// +// if(u.getGestor_geral() == null) +// { +// u.setGestor_geral("n"); +// } + + u.setPrimeiro_login("n"); + return u; + } + + public String lnkEditUser_action() { + // TODO: Replace with your code + + getSessionBean1().setModoEdicaoUtilizador("edit"); + return "user"; + } + + public String butApagar_action() { + // TODO: Replace with your code + hidConfDelUser.setValue("apagar"); + return null; + } + + private String navigate() + { + if(isFromPlanos) + { + Utilizador u = getSessionBean1().getCurrentUser(); + // String curUser = "?user=" + u.getId().toString(); + FacesContext fc = getFacesContext().getCurrentInstance(); + Global.redirectToPlanos(fc, u); + return null; + } + String nav_from = getSessionBean1().getNavFrom(); + if(nav_from.matches("FormSeguranca")) + { + return "form_seguranca"; + } + else if(nav_from.matches("FormRH")) + { + return "form_rh"; + } + else if(nav_from.matches("FormHS")) + { + return "form_hs"; + } + else if(nav_from.matches("FormMedico")) + { + return "form_medico"; + } + else if(nav_from.matches("AnaliseAcidenteTrabalho")) + { + return "analise_acidente"; + } + else if(nav_from.matches("ViewAnaliseAcidenteTrabalho")) + { + return "view_analise"; + } + else if(nav_from.matches("FormGestor")) + { + return "form_gestor"; + } + else if(nav_from.matches("FormDirGerRh")) + { + return "form_dir_ger_rh"; + } + else if(nav_from.matches("FormDirSiprp")) + { + return "form_dir_siprp"; + } + else if(nav_from.matches("GestaoUtilizadores")) + { + return "gestao_utilizadores"; + } + else if(nav_from.matches("NovoUtilizador")) + { + return "novo_utilizador"; + } + else if(nav_from.matches("Login")) // first login + { + int tipo = getSessionBean1().getCurrentUser().getTipo().intValue(); + switch(tipo) + { + case Global.TIPO_UTILIZADOR_SEGURANCA: + return "form_seguranca"; + case Global.TIPO_UTILIZADOR_RH: + return "form_rh"; + case Global.TIPO_UTILIZADOR_HS: + return "form_hs"; + case Global.TIPO_UTILIZADOR_MEDICO: + return "form_medico"; + case Global.TIPO_UTILIZADOR_GESTOR: + return "form_gestor"; + case Global.TIPO_UTILIZADOR_DIRECTOR_GERAL_RH: + return "form_dir_ger_rh"; + case Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP: + return "form_dir_siprp"; + case Global.TIPO_UTILIZADOR_DIRECTOR_LOJA: + return "form_gestor"; + case Global.TIPO_UTILIZADOR_DIRECTOR_NACIONAL_SEGURANCA: + return "form_gestor"; + } + } + return null; + } + + public String lnkNewUser_action() { + // TODO: Replace with your code + + if(getSessionBean1().getCurrentUser().getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_GERAL_RH) + { + getSessionBean1().setNavFrom("FormDirGerRh"); + } + else if(getSessionBean1().getCurrentUser().getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP) + { + getSessionBean1().setNavFrom("FormDirSiprp"); + } + + + return "gestao_utilizadores"; + + } + + public String lnkAjuda_action() { + // TODO: Replace with your code +// ServletContext theApplicationsServletContext = +// (ServletContext) this.getExternalContext().getContext(); +// String pdfFolderPath = theApplicationsServletContext.getRealPath(Global.PDF_FOLDER_URL); +// String pdfFilePath = pdfFolderPath + "/Ajuda.pdf"; +// +// Global global = new Global(); +// try +// { +// global.showPdf(pdfFilePath); +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } + return null; + } + + public String lnkPlanosActuacao_action() { + // TODO: Replace with your code + Utilizador u = getSessionBean1().getCurrentUser(); +// String curUser = "?user=" + u.getId().toString(); + FacesContext fc = getFacesContext().getCurrentInstance(); + Global.redirectToPlanos(fc, u); + return null; + } +} + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Footer.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Footer.java new file mode 100644 index 00000000..52f9e49d --- /dev/null +++ b/branches/SIPRP/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/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormDirGerRh.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormDirGerRh.java new file mode 100644 index 00000000..b9b83ca0 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormDirGerRh.java @@ -0,0 +1,1556 @@ +/* + * FormDirGerRh.java + * + * Created on December 19, 2007, 11:48 AM + * 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.AnalisesConcluidasDataProvider; +import db.AnalisesDataProvider; +import db.AnalisesSeguimentoDataProvider; +import global.Global; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.ListIterator; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.context.FacesContext; +import javax.faces.event.ValueChangeEvent; +import javax.servlet.http.HttpServletRequest; +import utils.Utils; + +/** + *

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 FormDirGerRh 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 HtmlPanelGrid gridLayoutTop1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLayoutTop1() { + return gridLayoutTop1; + } + + public void setGridLayoutTop1(HtmlPanelGrid hpg) { + this.gridLayoutTop1 = hpg; + } + + private HtmlPanelGrid gridSeguimento1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridSeguimento1() { + return gridSeguimento1; + } + + public void setGridSeguimento1(HtmlPanelGrid hpg) { + this.gridSeguimento1 = 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 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 lnkDataAcidenteSeg = new Hyperlink(); + + public Hyperlink getLnkDataAcidenteSeg() { + return lnkDataAcidenteSeg; + } + + public void setLnkDataAcidenteSeg(Hyperlink h) { + this.lnkDataAcidenteSeg = h; + } + + private TableColumn tableColumn2 = new TableColumn(); + + public TableColumn getTableColumn2() { + return tableColumn2; + } + + public void setTableColumn2(TableColumn tc) { + this.tableColumn2 = tc; + } + + private Hyperlink lnkNrSeg = new Hyperlink(); + + public Hyperlink getLnkNrSeg() { + return lnkNrSeg; + } + + public void setLnkNrSeg(Hyperlink h) { + this.lnkNrSeg = h; + } + + private TableColumn tableColumn3 = new TableColumn(); + + public TableColumn getTableColumn3() { + return tableColumn3; + } + + public void setTableColumn3(TableColumn tc) { + this.tableColumn3 = tc; + } + + private Hyperlink lnkPorSeg = new Hyperlink(); + + public Hyperlink getLnkPorSeg() { + return lnkPorSeg; + } + + public void setLnkPorSeg(Hyperlink h) { + this.lnkPorSeg = h; + } + + private TableColumn tableColumn4 = new TableColumn(); + + public TableColumn getTableColumn4() { + return tableColumn4; + } + + public void setTableColumn4(TableColumn tc) { + this.tableColumn4 = tc; + } + + private Hyperlink lnkNomeAcidentadoSeg = new Hyperlink(); + + public Hyperlink getLnkNomeAcidentadoSeg() { + return lnkNomeAcidentadoSeg; + } + + public void setLnkNomeAcidentadoSeg(Hyperlink h) { + this.lnkNomeAcidentadoSeg = h; + } + + private TableColumn tableColumn5 = new TableColumn(); + + public TableColumn getTableColumn5() { + return tableColumn5; + } + + public void setTableColumn5(TableColumn tc) { + this.tableColumn5 = tc; + } + + private Hyperlink lnkFaseSeg = new Hyperlink(); + + public Hyperlink getLnkFaseSeg() { + return lnkFaseSeg; + } + + public void setLnkFaseSeg(Hyperlink h) { + this.lnkFaseSeg = h; + } + + + private Hyperlink lnkEstabelecimentoSeg = new Hyperlink(); + + public Hyperlink getLnkEstabelecimentoSeg() { + return lnkEstabelecimentoSeg; + } + + public void setLnkEstabelecimentoSeg(Hyperlink h) { + this.lnkEstabelecimentoSeg = h; + } + + private HtmlPanelGrid gridConcluidos1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridConcluidos1() { + return gridConcluidos1; + } + + public void setGridConcluidos1(HtmlPanelGrid hpg) { + this.gridConcluidos1 = hpg; + } + + private HtmlPanelGrid gridPanel4 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel4() { + return gridPanel4; + } + + public void setGridPanel4(HtmlPanelGrid hpg) { + this.gridPanel4 = hpg; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private HtmlPanelGrid gridPanel5 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel5() { + return gridPanel5; + } + + public void setGridPanel5(HtmlPanelGrid hpg) { + this.gridPanel5 = hpg; + } + + private PanelGroup groupPanel3 = new PanelGroup(); + + public PanelGroup getGroupPanel3() { + return groupPanel3; + } + + public void setGroupPanel3(PanelGroup pg) { + this.groupPanel3 = pg; + } + + private StaticText staticText4 = new StaticText(); + + public StaticText getStaticText4() { + return staticText4; + } + + public void setStaticText4(StaticText st) { + this.staticText4 = 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 staticText5 = new StaticText(); + + public StaticText getStaticText5() { + return staticText5; + } + + public void setStaticText5(StaticText st) { + this.staticText5 = st; + } + + private TextField txtPor = new TextField(); + + public TextField getTxtPor() { + return txtPor; + } + + public void setTxtPor(TextField tf) { + this.txtPor = tf; + } + + private PanelGroup groupPanel7 = new PanelGroup(); + + public PanelGroup getGroupPanel7() { + return groupPanel7; + } + + public void setGroupPanel7(PanelGroup pg) { + this.groupPanel7 = pg; + } + + private StaticText staticText6 = new StaticText(); + + public StaticText getStaticText6() { + return staticText6; + } + + public void setStaticText6(StaticText st) { + this.staticText6 = 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 gridPanel6 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel6() { + return gridPanel6; + } + + public void setGridPanel6(HtmlPanelGrid hpg) { + this.gridPanel6 = 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 tableColumn6 = new TableColumn(); + + public TableColumn getTableColumn6() { + return tableColumn6; + } + + public void setTableColumn6(TableColumn tc) { + this.tableColumn6 = tc; + } + + private Hyperlink lnkDataConcluida = new Hyperlink(); + + public Hyperlink getLnkDataConcluida() { + return lnkDataConcluida; + } + + public void setLnkDataConcluida(Hyperlink h) { + this.lnkDataConcluida = h; + } + + private TableColumn tableColumn7 = new TableColumn(); + + public TableColumn getTableColumn7() { + return tableColumn7; + } + + public void setTableColumn7(TableColumn tc) { + this.tableColumn7 = tc; + } + + private Hyperlink lnkNrConcluida = new Hyperlink(); + + public Hyperlink getLnkNrConcluida() { + return lnkNrConcluida; + } + + public void setLnkNrConcluida(Hyperlink h) { + this.lnkNrConcluida = h; + } + + private TableColumn tableColumn8 = new TableColumn(); + + public TableColumn getTableColumn8() { + return tableColumn8; + } + + public void setTableColumn8(TableColumn tc) { + this.tableColumn8 = tc; + } + + private Hyperlink lnkPorConcluida = new Hyperlink(); + + public Hyperlink getLnkPorConcluida() { + return lnkPorConcluida; + } + + public void setLnkPorConcluida(Hyperlink h) { + this.lnkPorConcluida = h; + } + + private TableColumn tableColumn9 = new TableColumn(); + + public TableColumn getTableColumn9() { + return tableColumn9; + } + + public void setTableColumn9(TableColumn tc) { + this.tableColumn9 = tc; + } + + private Hyperlink lnkNomeConcluida = new Hyperlink(); + + public Hyperlink getLnkNomeConcluida() { + return lnkNomeConcluida; + } + + public void setLnkNomeConcluida(Hyperlink h) { + this.lnkNomeConcluida = h; + } + + private TableColumn tableColumn10 = new TableColumn(); + + public TableColumn getTableColumn10() { + return tableColumn10; + } + + public void setTableColumn10(TableColumn tc) { + this.tableColumn10 = tc; + } + + private Hyperlink lnkEstabConcluida = new Hyperlink(); + + public Hyperlink getLnkEstabConcluida() { + return lnkEstabConcluida; + } + + public void setLnkEstabConcluida(Hyperlink h) { + this.lnkEstabConcluida = h; + } + + private StaticText txtSearchMsg = new StaticText(); + + public StaticText getTxtSearchMsg() { + return txtSearchMsg; + } + + public void setTxtSearchMsg(StaticText st) { + this.txtSearchMsg = st; + } + + private HtmlPanelGrid gridPanel7 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel7() { + return gridPanel7; + } + + public void setGridPanel7(HtmlPanelGrid hpg) { + this.gridPanel7 = hpg; + } + + private PanelGroup groupPanel8 = new PanelGroup(); + + public PanelGroup getGroupPanel8() { + return groupPanel8; + } + + public void setGroupPanel8(PanelGroup pg) { + this.groupPanel8 = pg; + } + + private StaticText staticText7 = new StaticText(); + + public StaticText getStaticText7() { + return staticText7; + } + + public void setStaticText7(StaticText st) { + this.staticText7 = st; + } + + private ImageComponent image3 = new ImageComponent(); + + public ImageComponent getImage3() { + return image3; + } + + public void setImage3(ImageComponent ic) { + this.image3 = ic; + } + + private StaticText staticText8 = new StaticText(); + + public StaticText getStaticText8() { + return staticText8; + } + + public void setStaticText8(StaticText st) { + this.staticText8 = st; + } + + private TableColumn tableColumn11 = new TableColumn(); + + public TableColumn getTableColumn11() { + return tableColumn11; + } + + public void setTableColumn11(TableColumn tc) { + this.tableColumn11 = tc; + } + + private Hyperlink lnkDataAberturaSeg = new Hyperlink(); + + public Hyperlink getLnkDataAberturaSeg() { + return lnkDataAberturaSeg; + } + + public void setLnkDataAberturaSeg(Hyperlink h) { + this.lnkDataAberturaSeg = h; + } + + private TableColumn tableColumn12 = new TableColumn(); + + public TableColumn getTableColumn12() { + return tableColumn12; + } + + public void setTableColumn12(TableColumn tc) { + this.tableColumn12 = tc; + } + + private TableColumn tableColumn13 = new TableColumn(); + + public TableColumn getTableColumn13() { + return tableColumn13; + } + + public void setTableColumn13(TableColumn tc) { + this.tableColumn13 = tc; + } + + private Hyperlink lnkDataAberturaConcluida = new Hyperlink(); + + public Hyperlink getLnkDataAberturaConcluida() { + return lnkDataAberturaConcluida; + } + + public void setLnkDataAberturaConcluida(Hyperlink h) { + this.lnkDataAberturaConcluida = h; + } + private StaticText lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + private Hyperlink lnkPlanosActuacao = new Hyperlink(); + + public Hyperlink getLnkPlanosActuacao() { + return lnkPlanosActuacao; + } + + public void setLnkPlanosActuacao(Hyperlink h) { + this.lnkPlanosActuacao = h; + } + + + private HtmlPanelGrid gridPanelFilterSeg = new HtmlPanelGrid(); + public HtmlPanelGrid getGridPanelFilterSeg() + { + return this.gridPanelFilterSeg; + } + public void setGridPanelFilterSeg( HtmlPanelGrid pg ) + { + this.gridPanelFilterSeg = pg; + } + + private PanelGroup groupPanelFilterSeg = new PanelGroup(); + public PanelGroup getGroupPanelFilterSeg() + { + return this.groupPanelFilterSeg; + } + public void setGroupPanelFilterSeg( PanelGroup pg ) + { + this.groupPanelFilterSeg = pg; + } + + private StaticText labelFilterNameSeg = new StaticText(); + public StaticText getLabelFilterNameSeg() + { + return this.labelFilterNameSeg; + } + public void setLabelFilterNameSeg( StaticText st ) + { + this.labelFilterNameSeg = st; + } + + private TextField textFilterNameSeg = new TextField(); + public TextField getTextFilterNameSeg() + { + return this.textFilterNameSeg; + } + public void setTextFilterNameSeg( TextField tf ) + { + this.textFilterNameSeg = tf; + } + + private StaticText labelFilterEstabelecimentoSeg = new StaticText(); + public StaticText getLabelFilterEstabelecimentoSeg() { + return labelFilterEstabelecimentoSeg; + } + public void setLabelFilterEstabelecimentoSeg(StaticText labelFilterEstabelecimentoSeg) { + this.labelFilterEstabelecimentoSeg = labelFilterEstabelecimentoSeg; + } + + private TextField textFilterEstabelecimentoSeg = new TextField(); + + public TextField getTextFilterEstabelecimentoSeg() { + return textFilterEstabelecimentoSeg; + } + public void setTextFilterEstabelecimentoSeg(TextField textFilterEstabelecimentoSeg) { + this.textFilterEstabelecimentoSeg = textFilterEstabelecimentoSeg; + } + + private com.sun.rave.web.ui.component.Calendar calFilterDateSeg = new com.sun.rave.web.ui.component.Calendar(); + public com.sun.rave.web.ui.component.Calendar getCalFilterDateSeg() + { + return this.calFilterDateSeg; + } + public void setCalFilterDateSeg( com.sun.rave.web.ui.component.Calendar c ) + { + this.calFilterDateSeg = c; + } + + private TextField textFilterPORSeg = new TextField(); + + public TextField getTextFilterPORSeg() { + return textFilterPORSeg; + } + + public void setTextFilterPORSeg(TextField textFilterPORSeg) { + this.textFilterPORSeg = textFilterPORSeg; + } + + + private Button buttonFilterSeg = new Button(); + public Button getButtonFilterSeg() + { + return this.buttonFilterSeg; + } + public void setButtonFilterSeg( Button b ) + { + this.buttonFilterSeg = b; + } + + private TextField textFilterEstabelecimentoConc = new TextField(); + + public TextField getTextFilterEstabelecimentoConc() { + return textFilterEstabelecimentoConc; + } + + public void setTextFilterEstabelecimentoConc(TextField textFilterEstabelecimentoConc) { + this.textFilterEstabelecimentoConc = textFilterEstabelecimentoConc; + } + + private static final DateFormat D_F = new SimpleDateFormat( "yyyy-MM-dd" ); + //
+ + + /** + *

Construct a new Page bean instance.

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

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 + + if (!getSessionBean1().isLoggedIn()) { + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) { + // . . . handle exception . . . + } + } + + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("FormDirGerRh 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() { + System.out.println("=== FORM_DIR_GER_RH ==="); + lblUser.setText( getSessionBean1().getCurrentUser().getLogin() ); + + HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); + String referer = request.getRequestURI(); + String pageFrom = Utils.getPageFrom(referer); + if(!pageFrom.matches("FormDirGerRh.jsp")) + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + //lblActivos.setRendered(true); + table1.setRendered(true); + + ArrayList seguimentoList = adp.getAnalisesSeguimentoDirGerRhList(); + getSessionBean1().getAnalisesSeguimentoDataProvider().setList(seguimentoList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table1.setRendered(false); + //ex.printStackTrace(); + } + + try + { + //lblActivos.setRendered(true); + table2.setRendered(true); + + ArrayList concluidasList = adp.getAnalisesConcluidasList(null); + getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table2.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 lnkAnalisesAcidente_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkNewUser_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkEditUser_action() { + // TODO: Replace with your code + + getSessionBean1().setNavFrom("FormDirGerRh"); + getSessionBean1().setModoEdicaoUtilizador("edit"); + return "user"; + } + + public String lnkLogout_action() { + // TODO: Replace with your code + + try + { + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + } + catch(Exception ex){} + + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) {} + //return "login"; + return null; + } + + public String lnkDataAcidenteSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirGerRh"); + return "view_analise"; + + } + + public String lnkDataAberturaSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirGerRh"); + return "view_analise"; + } + + public String lnkNrSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirGerRh"); + return "view_analise"; + + } + + public String lnkPorSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirGerRh"); + return "view_analise"; + + } + + public String lnkNomeAcidentadoSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirGerRh"); + return "view_analise"; + + } + + public String lnkFaseSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirGerRh"); + return "view_analise"; + + } + + + public String lnkEstabelecimentoSeg_action() { + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirGerRh"); + return "view_analise"; + } + + private AnaliseAcidente getTableSeguimentoRowData() + { + RowKey rk = tableRowGroup1.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + AnalisesSeguimentoDataProvider provider = (AnalisesSeguimentoDataProvider) tableRowGroup1.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 por = null; + if(txtPor.getText() != null) + { + por = (String) txtPor.getText(); + if(por.trim().length() == 0) + { + por = null; + } + } + + String nome = null; + if(txtNome.getText() != null) + { + nome = (String) txtNome.getText(); + if(nome.trim().length() == 0) + { + nome = null; + } + } + + String estabelecimento = null; + if ( textFilterEstabelecimentoConc.getText() != null ) + { + estabelecimento = (( String ) textFilterEstabelecimentoConc.getText()).trim(); + if( estabelecimento.length() == 0 ) + { + estabelecimento = null; + } + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + + //getSessionBean1().getAnalisesConcluidasDataProvider().setList(new ArrayList()); + ArrayList concluidasList = adp.searchAanalisesConcluidasList( + null, ano, mes, dia, por, nome, estabelecimento ); + + table2.setRendered(true); + txtSearchMsg.setRendered(false); + getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); + + + } + catch(Exception ex) + { + table2.setRendered(false); + txtSearchMsg.setRendered(true); + txtSearchMsg.setText("Não foram encontrados registos para a sua pesquisa !"); + //ex.printStackTrace(); + } + + return null; + } + + public String lnkDataConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirGerRh"); + return "view_analise"; + + } + + public String lnkDataAberturaConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirGerRh"); + return "view_analise"; + } + + public String lnkNrConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirGerRh"); + return "view_analise"; + + } + + public String lnkPorConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirGerRh"); + return "view_analise"; + + } + + public String lnkNomeConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirGerRh"); + return "view_analise"; + + } + + public String lnkEstabConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirGerRh"); + return "view_analise"; + + } + + private AnaliseAcidente getTableConcluidasRowData() + { + RowKey rk = tableRowGroup2.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + AnalisesConcluidasDataProvider provider = (AnalisesConcluidasDataProvider) tableRowGroup2.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + AnaliseAcidente a = (AnaliseAcidente)list.get(k); + return a; + } + + + public String lnkGerirUtilizadores_action() { + // TODO: Replace with your code + + getSessionBean1().setNavFrom("FormDirGerRh"); + //getSessionBean1().setModoEdicaoUtilizador("new"); + return "gestao_utilizadores"; + + } + + private void fillAnoDropDown() + { +// ArrayList anosList = new ArrayList(); +// for(int ano=2007; ano<2051; ano++) +// { +// anosList.add(new Integer(ano)); +// } + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList anosList = adp.getAnosListFromAnalises(); + 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) ); + + } + catch(Exception ex) + { + //ex.printStackTrace(); + } + + } + + + 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() +// { +// +// } + + public String lnkAjuda_action() { + // TODO: Replace with your code +// ServletContext theApplicationsServletContext = +// (ServletContext) this.getExternalContext().getContext(); +// String pdfFolderPath = theApplicationsServletContext.getRealPath(Global.PDF_FOLDER_URL); +// String pdfFilePath = pdfFolderPath + "/Ajuda.pdf"; +// +// Global global = new Global(); +// try +// { +// global.showPdf(pdfFilePath); +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } + return null; + } + + public String lnkPlanosActuacao_action() { + // TODO: Replace with your code + Utilizador u = getSessionBean1().getCurrentUser(); +// String curUser = "?user=" + u.getId().toString(); + FacesContext fc = getFacesContext().getCurrentInstance(); + Global.redirectToPlanos(fc, u); +// Utilizador u = getSessionBean1().getCurrentUser(); +// String curUser = "?user=" + u.getId().toString(); +// FacesContext fc = getFacesContext().getCurrentInstance(); +// try +// { +// JSFUtils.redirect(fc, Global.PLANOS_ACTUACAO_URL + curUser); +// } +// catch(Exception ex) +// { +// +// } + return null; + } + + public String buttonFilterSeg_action() + { + Date visitaDate = ( Date ) calFilterDateSeg.getValue(); + String visitaDateStr = null; + if ( visitaDate != null ) + { + visitaDateStr = D_F.format( visitaDate ); + } + + String POR = null; + if ( textFilterPORSeg.getText() != null ) + { + POR = ( ( String ) textFilterPORSeg.getText() ).trim(); + if ( POR.length() == 0 ) + { + POR = null; + } + } + + String nome = null; + if ( textFilterNameSeg.getText() != null ) + { + nome = (( String ) textFilterNameSeg.getText()).trim(); + if( nome.length() == 0 ) + { + nome = null; + } + } + + String estabelecimento = null; + if ( textFilterEstabelecimentoSeg.getText() != null ) + { + estabelecimento = (( String ) textFilterEstabelecimentoSeg.getText()).trim(); + if ( estabelecimento.length() == 0 ) + { + estabelecimento = null; + } + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList seguimentoList = adp.searchAnalisesSeguimentoDirGerRh( nome, estabelecimento, visitaDateStr, POR ); + + table1.setRendered( true ); + txtSearchMsg.setRendered( false ); + getSessionBean1().getAnalisesSeguimentoDataProvider().setList( seguimentoList ); + } + catch( Exception e ) + { + table1.setRendered( false ); + txtSearchMsg.setRendered( true ); + txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + } + + return null; + } + +} + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormDirSiprp.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormDirSiprp.java new file mode 100755 index 00000000..5fe5e2be --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormDirSiprp.java @@ -0,0 +1,1593 @@ +/* + * FormDirSiprp.java + * + * Created on November 21, 2007, 1:25 PM + * Copyright lluis2 + */ +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.AnalisesConcluidasDataProvider; +import db.AnalisesDataProvider; +import db.AnalisesSeguimentoDataProvider; +import global.Global; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.ListIterator; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.context.FacesContext; +import javax.faces.event.ValueChangeEvent; +import javax.servlet.http.HttpServletRequest; +import utils.Utils; + +/** + *

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 FormDirSiprp 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 HtmlPanelGrid gridLayoutTop1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLayoutTop1() { + return gridLayoutTop1; + } + + public void setGridLayoutTop1(HtmlPanelGrid hpg) { + this.gridLayoutTop1 = hpg; + } + + 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 staticText4 = new StaticText(); + + public StaticText getStaticText4() { + return staticText4; + } + + public void setStaticText4(StaticText st) { + this.staticText4 = 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 tableColumn6 = new TableColumn(); + + public TableColumn getTableColumn6() { + return tableColumn6; + } + + public void setTableColumn6(TableColumn tc) { + this.tableColumn6 = tc; + } + + private Hyperlink lnkDataAcidenteSeg = new Hyperlink(); + + public Hyperlink getLnkDataAcidenteSeg() { + return lnkDataAcidenteSeg; + } + + public void setLnkDataAcidenteSeg(Hyperlink h) { + this.lnkDataAcidenteSeg = h; + } + + private TableColumn tableColumn7 = new TableColumn(); + + public TableColumn getTableColumn7() { + return tableColumn7; + } + + public void setTableColumn7(TableColumn tc) { + this.tableColumn7 = tc; + } + + private Hyperlink lnkNrSeg = new Hyperlink(); + + public Hyperlink getLnkNrSeg() { + return lnkNrSeg; + } + + public void setLnkNrSeg(Hyperlink h) { + this.lnkNrSeg = h; + } + + private TableColumn tableColumn8 = new TableColumn(); + + public TableColumn getTableColumn8() { + return tableColumn8; + } + + public void setTableColumn8(TableColumn tc) { + this.tableColumn8 = tc; + } + + private Hyperlink lnkPorSeg = new Hyperlink(); + + public Hyperlink getLnkPorSeg() { + return lnkPorSeg; + } + + public void setLnkPorSeg(Hyperlink h) { + this.lnkPorSeg = h; + } + + private TableColumn tableColumn9 = new TableColumn(); + + public TableColumn getTableColumn9() { + return tableColumn9; + } + + public void setTableColumn9(TableColumn tc) { + this.tableColumn9 = tc; + } + + private Hyperlink lnkNomeAcidentadoSeg = new Hyperlink(); + + public Hyperlink getLnkNomeAcidentadoSeg() { + return lnkNomeAcidentadoSeg; + } + + public void setLnkNomeAcidentadoSeg(Hyperlink h) { + this.lnkNomeAcidentadoSeg = h; + } + + private TableColumn tableColumn10 = new TableColumn(); + + public TableColumn getTableColumn10() { + return tableColumn10; + } + + public void setTableColumn10(TableColumn tc) { + this.tableColumn10 = tc; + } + + private Hyperlink lnkFaseSeg = new Hyperlink(); + + public Hyperlink getLnkFaseSeg() { + return lnkFaseSeg; + } + + public void setLnkFaseSeg(Hyperlink h) { + this.lnkFaseSeg = 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 staticText5 = new StaticText(); + + public StaticText getStaticText5() { + return staticText5; + } + + public void setStaticText5(StaticText st) { + this.staticText5 = 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 staticText6 = new StaticText(); + + public StaticText getStaticText6() { + return staticText6; + } + + public void setStaticText6(StaticText st) { + this.staticText6 = 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 staticText7 = new StaticText(); + + public StaticText getStaticText7() { + return staticText7; + } + + public void setStaticText7(StaticText st) { + this.staticText7 = st; + } + + private TextField txtPor = new TextField(); + + public TextField getTxtPor() { + return txtPor; + } + + public void setTxtPor(TextField tf) { + this.txtPor = tf; + } + + private PanelGroup groupPanel7 = new PanelGroup(); + + public PanelGroup getGroupPanel7() { + return groupPanel7; + } + + public void setGroupPanel7(PanelGroup pg) { + this.groupPanel7 = pg; + } + + private StaticText staticText8 = new StaticText(); + + public StaticText getStaticText8() { + return staticText8; + } + + public void setStaticText8(StaticText st) { + this.staticText8 = 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 tableColumn11 = new TableColumn(); + + public TableColumn getTableColumn11() { + return tableColumn11; + } + + public void setTableColumn11(TableColumn tc) { + this.tableColumn11 = tc; + } + + private Hyperlink lnkDataConcluida = new Hyperlink(); + + public Hyperlink getLnkDataConcluida() { + return lnkDataConcluida; + } + + public void setLnkDataConcluida(Hyperlink h) { + this.lnkDataConcluida = h; + } + + private TableColumn tableColumn12 = new TableColumn(); + + public TableColumn getTableColumn12() { + return tableColumn12; + } + + public void setTableColumn12(TableColumn tc) { + this.tableColumn12 = tc; + } + + private Hyperlink lnkNrConcluida = new Hyperlink(); + + public Hyperlink getLnkNrConcluida() { + return lnkNrConcluida; + } + + public void setLnkNrConcluida(Hyperlink h) { + this.lnkNrConcluida = h; + } + + private TableColumn tableColumn13 = new TableColumn(); + + public TableColumn getTableColumn13() { + return tableColumn13; + } + + public void setTableColumn13(TableColumn tc) { + this.tableColumn13 = tc; + } + + private Hyperlink lnkPorConcluida = new Hyperlink(); + + public Hyperlink getLnkPorConcluida() { + return lnkPorConcluida; + } + + public void setLnkPorConcluida(Hyperlink h) { + this.lnkPorConcluida = h; + } + + private TableColumn tableColumn14 = new TableColumn(); + + public TableColumn getTableColumn14() { + return tableColumn14; + } + + public void setTableColumn14(TableColumn tc) { + this.tableColumn14 = tc; + } + + private Hyperlink lnkNomeConcluida = new Hyperlink(); + + public Hyperlink getLnkNomeConcluida() { + return lnkNomeConcluida; + } + + public void setLnkNomeConcluida(Hyperlink h) { + this.lnkNomeConcluida = h; + } + + private TableColumn tableColumn15 = new TableColumn(); + + public TableColumn getTableColumn15() { + return tableColumn15; + } + + public void setTableColumn15(TableColumn tc) { + this.tableColumn15 = tc; + } + + private Hyperlink lnkEstabConcluida = new Hyperlink(); + + public Hyperlink getLnkEstabConcluida() { + return lnkEstabConcluida; + } + + public void setLnkEstabConcluida(Hyperlink h) { + this.lnkEstabConcluida = h; + } + + private StaticText txtSearchMsg = new StaticText(); + + public StaticText getTxtSearchMsg() { + return txtSearchMsg; + } + + public void setTxtSearchMsg(StaticText st) { + this.txtSearchMsg = st; + } + + private HtmlPanelGrid gridPanel9 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel9() { + return gridPanel9; + } + + public void setGridPanel9(HtmlPanelGrid hpg) { + this.gridPanel9 = hpg; + } + + private PanelGroup groupPanel8 = new PanelGroup(); + + public PanelGroup getGroupPanel8() { + return groupPanel8; + } + + public void setGroupPanel8(PanelGroup pg) { + this.groupPanel8 = pg; + } + + private StaticText staticText9 = new StaticText(); + + public StaticText getStaticText9() { + return staticText9; + } + + public void setStaticText9(StaticText st) { + this.staticText9 = st; + } + + private ImageComponent image3 = new ImageComponent(); + + public ImageComponent getImage3() { + return image3; + } + + public void setImage3(ImageComponent ic) { + this.image3 = ic; + } + + private StaticText staticText10 = new StaticText(); + + public StaticText getStaticText10() { + return staticText10; + } + + public void setStaticText10(StaticText st) { + this.staticText10 = st; + } + + private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel2() { + return gridPanel2; + } + + public void setGridPanel2(HtmlPanelGrid hpg) { + this.gridPanel2 = hpg; + } + + private StaticText txtMsg1 = new StaticText(); + + public StaticText getTxtMsg1() { + return txtMsg1; + } + + public void setTxtMsg1(StaticText st) { + this.txtMsg1 = st; + } + + private TableColumn tableColumn1 = new TableColumn(); + + public TableColumn getTableColumn1() { + return tableColumn1; + } + + public void setTableColumn1(TableColumn tc) { + this.tableColumn1 = tc; + } + + private Hyperlink lnkDataAberturaSeg1 = new Hyperlink(); + + public Hyperlink getLnkDataAberturaSeg1() { + return lnkDataAberturaSeg1; + } + + public void setLnkDataAberturaSeg1(Hyperlink h) { + this.lnkDataAberturaSeg1 = h; + } + + private TableColumn tableColumn2 = new TableColumn(); + + public TableColumn getTableColumn2() { + return tableColumn2; + } + + public void setTableColumn2(TableColumn tc) { + this.tableColumn2 = tc; + } + + private Hyperlink lnkDataAberturaConcluida1 = new Hyperlink(); + + public Hyperlink getLnkDataAberturaConcluida1() { + return lnkDataAberturaConcluida1; + } + + public void setLnkDataAberturaConcluida1(Hyperlink h) { + this.lnkDataAberturaConcluida1 = h; + } + + private TableColumn tableColumn3 = new TableColumn(); + + public TableColumn getTableColumn3() { + return tableColumn3; + } + + public void setTableColumn3(TableColumn tc) { + this.tableColumn3 = tc; + } + + private Hyperlink lnkEstabelecimentoSeg1 = new Hyperlink(); + + public Hyperlink getLnkEstabelecimentoSeg1() { + return lnkEstabelecimentoSeg1; + } + + public void setLnkEstabelecimentoSeg1(Hyperlink h) { + this.lnkEstabelecimentoSeg1 = h; + } + private Hyperlink lnkPlanosActuacao = new Hyperlink(); + + public Hyperlink getLnkPlanosActuacao() { + return lnkPlanosActuacao; + } + + public void setLnkPlanosActuacao(Hyperlink h) { + this.lnkPlanosActuacao = h; + } + private StaticText lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + + //
+ + + + private HtmlPanelGrid gridPanelFilterSeg = new HtmlPanelGrid(); + public HtmlPanelGrid getGridPanelFilterSeg() + { + return this.gridPanelFilterSeg; + } + public void setGridPanelFilterSeg( HtmlPanelGrid pg ) + { + this.gridPanelFilterSeg = pg; + } + + private PanelGroup groupPanelFilterSeg = new PanelGroup(); + public PanelGroup getGroupPanelFilterSeg() + { + return this.groupPanelFilterSeg; + } + public void setGroupPanelFilterSeg( PanelGroup pg ) + { + this.groupPanelFilterSeg = pg; + } + + private StaticText labelFilterNameSeg = new StaticText(); + public StaticText getLabelFilterNameSeg() + { + return this.labelFilterNameSeg; + } + public void setLabelFilterNameSeg( StaticText st ) + { + this.labelFilterNameSeg = st; + } + + private TextField textFilterNameSeg = new TextField(); + public TextField getTextFilterNameSeg() + { + return this.textFilterNameSeg; + } + public void setTextFilterNameSeg( TextField tf ) + { + this.textFilterNameSeg = tf; + } + + private StaticText labelFilterEstabelecimentoSeg = new StaticText(); + public StaticText getLabelFilterEstabelecimentoSeg() { + return labelFilterEstabelecimentoSeg; + } + public void setLabelFilterEstabelecimentoSeg(StaticText labelFilterEstabelecimentoSeg) { + this.labelFilterEstabelecimentoSeg = labelFilterEstabelecimentoSeg; + } + + private TextField textFilterEstabelecimentoSeg = new TextField(); + + public TextField getTextFilterEstabelecimentoSeg() { + return textFilterEstabelecimentoSeg; + } + public void setTextFilterEstabelecimentoSeg(TextField textFilterEstabelecimentoSeg) { + this.textFilterEstabelecimentoSeg = textFilterEstabelecimentoSeg; + } + + private com.sun.rave.web.ui.component.Calendar calFilterDateSeg = new com.sun.rave.web.ui.component.Calendar(); + public com.sun.rave.web.ui.component.Calendar getCalFilterDateSeg() + { + return this.calFilterDateSeg; + } + public void setCalFilterDateSeg( com.sun.rave.web.ui.component.Calendar c ) + { + this.calFilterDateSeg = c; + } + + private TextField textFilterPORSeg = new TextField(); + + public TextField getTextFilterPORSeg() { + return textFilterPORSeg; + } + + public void setTextFilterPORSeg(TextField textFilterPORSeg) { + this.textFilterPORSeg = textFilterPORSeg; + } + + + private Button buttonFilterSeg = new Button(); + public Button getButtonFilterSeg() + { + return this.buttonFilterSeg; + } + public void setButtonFilterSeg( Button b ) + { + this.buttonFilterSeg = b; + } + + private TextField textFilterEstabelecimentoConc = new TextField(); + + public TextField getTextFilterEstabelecimentoConc() { + return textFilterEstabelecimentoConc; + } + + public void setTextFilterEstabelecimentoConc(TextField textFilterEstabelecimentoConc) { + this.textFilterEstabelecimentoConc = textFilterEstabelecimentoConc; + } + + private static final DateFormat D_F = new SimpleDateFormat( "yyyy-MM-dd" ); + + /** + *

Construct a new Page bean instance.

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

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 + if (!getSessionBean1().isLoggedIn()) { + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) { + // . . . handle exception . . . + } + } + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("FormDirSiprp 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() { + txtMsg1.setText(getSessionBean1().getMsg()); + getSessionBean1().setMsg(""); + } + + /** + *

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() { + System.out.println("=== FORM_DIR_SIPRP ==="); + lblUser.setText( getSessionBean1().getCurrentUser().getLogin() ); + + HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); + String referer = request.getRequestURI(); + String pageFrom = Utils.getPageFrom(referer); + if((!pageFrom.matches("FormDirSiprp.jsp")) || getSessionBean1().isFromAnaliseDeletion()) + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + + try + { + //lblActivos.setRendered(true); + table2.setRendered( true ); + + ArrayList seguimentoList = adp.getAnalisesSeguimentoDirSiprpList(); + getSessionBean1().getAnalisesSeguimentoDataProvider().setList( seguimentoList ); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table2.setRendered( false ); + ex.printStackTrace(); + } + + try + { + //lblActivos.setRendered(true); + table3.setRendered(true); + + ArrayList concluidasList = adp.getAnalisesConcluidasList(null); + 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 RequestBean1 getRequestBean1() { + return (RequestBean1)getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1)getBean("SessionBean1"); + } + + public String lnkEditUser_action() { + // TODO: Replace with your code + + getSessionBean1().setNavFrom("FormDirSiprp"); + getSessionBean1().setModoEdicaoUtilizador("edit"); + return "user"; + } + + public String lnkLogout_action() { + // TODO: Replace with your code + + try + { + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + } + catch(Exception ex){} + + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) {} + //return "login"; + return null; + } + + public String lnkDataAcidente_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkNr_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkPor_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkNomeAcidentado_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkFase_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkDataAcidenteSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirSiprp"); + return "view_analise"; + } + + public String lnkDataAberturaSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirSiprp"); + return "view_analise"; + } + + public String lnkNrSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirSiprp"); + return "view_analise"; + } + + public String lnkPorSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirSiprp"); + return "view_analise"; + } + + public String lnkNomeAcidentadoSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirSiprp"); + return "view_analise"; + } + + public String lnkFaseSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirSiprp"); + return "view_analise"; + } + + public String lnkEstabelecimentoSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirSiprp"); + 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 por = null; + if(txtPor.getText() != null) + { + por = (String) txtPor.getText(); + if(por.trim().length() == 0) + { + por = null; + } + } + + String nome = null; + if(txtNome.getText() != null) + { + nome = (String) txtNome.getText(); + if(nome.trim().length() == 0) + { + nome = null; + } + } + + String estabelecimento = null; + if ( textFilterEstabelecimentoConc.getText() != null ) + { + estabelecimento = (( String ) textFilterEstabelecimentoConc.getText()).trim(); + if( estabelecimento.length() == 0 ) + { + estabelecimento = null; + } + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + + //getSessionBean1().getAnalisesConcluidasDataProvider().setList(new ArrayList()); + ArrayList concluidasList = adp.searchAanalisesConcluidasList( + null, ano, mes, dia, por, nome, estabelecimento ); + + 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 String lnkDataConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirSiprp"); + return "view_analise"; + } + + public String lnkDataAberturaConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirSiprp"); + return "view_analise"; + } + + public String lnkNrConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirSiprp"); + return "view_analise"; + } + + public String lnkPorConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirSiprp"); + return "view_analise"; + } + + public String lnkNomeConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirSiprp"); + return "view_analise"; + } + + public String lnkEstabConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormDirSiprp"); + return "view_analise"; + } + + private AnaliseAcidente getTableConcluidasRowData() + { + RowKey rk = tableRowGroup3.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + AnalisesConcluidasDataProvider provider = (AnalisesConcluidasDataProvider) tableRowGroup3.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + AnaliseAcidente a = (AnaliseAcidente)list.get(k); + return a; + } + + public String lnkNewUser_action() { + // TODO: Replace with your code + + getSessionBean1().setNavFrom("FormDirSiprp"); + //getSessionBean1().setModoEdicaoUtilizador("new"); + return "gestao_utilizadores"; + } + + private void fillAnoDropDown() + { +// ArrayList anosList = new ArrayList(); +// for(int ano=2007; ano<2051; ano++) +// { +// anosList.add(new Integer(ano)); +// } + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList anosList = adp.getAnosListFromAnalises(); + 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) ); + + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + } + + + 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() +// { +// +// } + + public String lnkAjuda_action() { + // TODO: Replace with your code +// ServletContext theApplicationsServletContext = +// (ServletContext) this.getExternalContext().getContext(); +// String pdfFolderPath = theApplicationsServletContext.getRealPath(Global.PDF_FOLDER_URL); +// String pdfFilePath = pdfFolderPath + "/Ajuda.pdf"; +// +// Global global = new Global(); +// try +// { +// global.showPdf(pdfFilePath); +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } + return null; + } + + public String lnkAnalisesAcidente_action() { + // TODO: Replace with your code + return null; + } + + public String lnkPlanosActuacao_action() { + // TODO: Replace with your code + Utilizador u = getSessionBean1().getCurrentUser(); +// String curUser = "?user=" + u.getId().toString(); + FacesContext fc = getFacesContext().getCurrentInstance(); + Global.redirectToPlanos(fc, u); +// Utilizador u = getSessionBean1().getCurrentUser(); +// String curUser = "?user=" + u.getId().toString(); +// FacesContext fc = getFacesContext().getCurrentInstance(); +// try +// { +// JSFUtils.redirect(fc, Global.PLANOS_ACTUACAO_URL + curUser); +// } +// catch(Exception ex) +// { +// +// } + return null; + } + + + public String buttonFilterSeg_action() + { + Date visitaDate = ( Date ) calFilterDateSeg.getValue(); + String visitaDateStr = null; + if ( visitaDate != null ) + { + visitaDateStr = D_F.format( visitaDate ); + } + + String POR = null; + if ( textFilterPORSeg.getText() != null ) + { + POR = ( ( String ) textFilterPORSeg.getText() ).trim(); + if ( POR.length() == 0 ) + { + POR = null; + } + } + + String nome = null; + if ( textFilterNameSeg.getText() != null ) + { + nome = (( String ) textFilterNameSeg.getText()).trim(); + if( nome.length() == 0 ) + { + nome = null; + } + } + + String estabelecimento = null; + if ( textFilterEstabelecimentoSeg.getText() != null ) + { + estabelecimento = (( String ) textFilterEstabelecimentoSeg.getText()).trim(); + if ( estabelecimento.length() == 0 ) + { + estabelecimento = null; + } + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList seguimentoList = adp.searchAnalisesSeguimentoDirSiprp( nome, estabelecimento, visitaDateStr, POR ); + + table2.setRendered( true ); + txtSearchMsg.setRendered( false ); + getSessionBean1().getAnalisesSeguimentoDataProvider().setList( seguimentoList ); + } + catch( Exception e ) + { + table2.setRendered( false ); + txtSearchMsg.setRendered( true ); + txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + } + + return null; + } + +} + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormGestor.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormGestor.java new file mode 100644 index 00000000..27155ae2 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormGestor.java @@ -0,0 +1,1637 @@ +/* + * FormGestor.java + * + * Created on December 19, 2007, 3:58 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.AnalisesConcluidasDataProvider; +import db.AnalisesDataProvider; +import db.AnalisesSeguimentoDataProvider; +import global.Global; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.ListIterator; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.context.FacesContext; +import javax.faces.event.ValueChangeEvent; +import javax.servlet.http.HttpServletRequest; +import utils.Utils; + +/** + *

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 FormGestor 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 HtmlPanelGrid gridLayoutTop1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLayoutTop1() { + return gridLayoutTop1; + } + + public void setGridLayoutTop1(HtmlPanelGrid hpg) { + this.gridLayoutTop1 = hpg; + } + + private HtmlPanelGrid gridSeguimento1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridSeguimento1() { + return gridSeguimento1; + } + + public void setGridSeguimento1(HtmlPanelGrid hpg) { + this.gridSeguimento1 = 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 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 lnkDataAcidenteSeg = new Hyperlink(); + + public Hyperlink getLnkDataAcidenteSeg() { + return lnkDataAcidenteSeg; + } + + public void setLnkDataAcidenteSeg(Hyperlink h) { + this.lnkDataAcidenteSeg = h; + } + + private TableColumn tableColumn2 = new TableColumn(); + + public TableColumn getTableColumn2() { + return tableColumn2; + } + + public void setTableColumn2(TableColumn tc) { + this.tableColumn2 = tc; + } + + private Hyperlink lnkNrSeg = new Hyperlink(); + + public Hyperlink getLnkNrSeg() { + return lnkNrSeg; + } + + public void setLnkNrSeg(Hyperlink h) { + this.lnkNrSeg = h; + } + + private TableColumn tableColumn3 = new TableColumn(); + + public TableColumn getTableColumn3() { + return tableColumn3; + } + + public void setTableColumn3(TableColumn tc) { + this.tableColumn3 = tc; + } + + private Hyperlink lnkPorSeg = new Hyperlink(); + + public Hyperlink getLnkPorSeg() { + return lnkPorSeg; + } + + public void setLnkPorSeg(Hyperlink h) { + this.lnkPorSeg = h; + } + + private TableColumn tableColumn4 = new TableColumn(); + + public TableColumn getTableColumn4() { + return tableColumn4; + } + + public void setTableColumn4(TableColumn tc) { + this.tableColumn4 = tc; + } + + private Hyperlink lnkNomeAcidentadoSeg = new Hyperlink(); + + public Hyperlink getLnkNomeAcidentadoSeg() { + return lnkNomeAcidentadoSeg; + } + + public void setLnkNomeAcidentadoSeg(Hyperlink h) { + this.lnkNomeAcidentadoSeg = h; + } + + private TableColumn tableColumn5 = new TableColumn(); + + public TableColumn getTableColumn5() { + return tableColumn5; + } + + public void setTableColumn5(TableColumn tc) { + this.tableColumn5 = tc; + } + + private Hyperlink lnkFaseSeg = new Hyperlink(); + + public Hyperlink getLnkFaseSeg() { + return lnkFaseSeg; + } + + public void setLnkFaseSeg(Hyperlink h) { + this.lnkFaseSeg = h; + } + + private HtmlPanelGrid gridConcluidos1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridConcluidos1() { + return gridConcluidos1; + } + + public void setGridConcluidos1(HtmlPanelGrid hpg) { + this.gridConcluidos1 = hpg; + } + + private HtmlPanelGrid gridPanel4 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel4() { + return gridPanel4; + } + + public void setGridPanel4(HtmlPanelGrid hpg) { + this.gridPanel4 = hpg; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private HtmlPanelGrid gridPanel5 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel5() { + return gridPanel5; + } + + public void setGridPanel5(HtmlPanelGrid hpg) { + this.gridPanel5 = hpg; + } + + private PanelGroup groupPanel3 = new PanelGroup(); + + public PanelGroup getGroupPanel3() { + return groupPanel3; + } + + public void setGroupPanel3(PanelGroup pg) { + this.groupPanel3 = pg; + } + + private StaticText staticText4 = new StaticText(); + + public StaticText getStaticText4() { + return staticText4; + } + + public void setStaticText4(StaticText st) { + this.staticText4 = 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 staticText5 = new StaticText(); + + public StaticText getStaticText5() { + return staticText5; + } + + public void setStaticText5(StaticText st) { + this.staticText5 = st; + } + + private TextField txtPor = new TextField(); + + public TextField getTxtPor() { + return txtPor; + } + + public void setTxtPor(TextField tf) { + this.txtPor = tf; + } + + private PanelGroup groupPanel7 = new PanelGroup(); + + public PanelGroup getGroupPanel7() { + return groupPanel7; + } + + public void setGroupPanel7(PanelGroup pg) { + this.groupPanel7 = pg; + } + + private StaticText staticText6 = new StaticText(); + + public StaticText getStaticText6() { + return staticText6; + } + + public void setStaticText6(StaticText st) { + this.staticText6 = 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 gridPanel6 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel6() { + return gridPanel6; + } + + public void setGridPanel6(HtmlPanelGrid hpg) { + this.gridPanel6 = 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 tableColumn6 = new TableColumn(); + + public TableColumn getTableColumn6() { + return tableColumn6; + } + + public void setTableColumn6(TableColumn tc) { + this.tableColumn6 = tc; + } + + private Hyperlink lnkDataConcluida = new Hyperlink(); + + public Hyperlink getLnkDataConcluida() { + return lnkDataConcluida; + } + + public void setLnkDataConcluida(Hyperlink h) { + this.lnkDataConcluida = h; + } + + private TableColumn tableColumn7 = new TableColumn(); + + public TableColumn getTableColumn7() { + return tableColumn7; + } + + public void setTableColumn7(TableColumn tc) { + this.tableColumn7 = tc; + } + + private Hyperlink lnkNrConcluida = new Hyperlink(); + + public Hyperlink getLnkNrConcluida() { + return lnkNrConcluida; + } + + public void setLnkNrConcluida(Hyperlink h) { + this.lnkNrConcluida = h; + } + + private TableColumn tableColumn8 = new TableColumn(); + + public TableColumn getTableColumn8() { + return tableColumn8; + } + + public void setTableColumn8(TableColumn tc) { + this.tableColumn8 = tc; + } + + private Hyperlink lnkPorConcluida = new Hyperlink(); + + public Hyperlink getLnkPorConcluida() { + return lnkPorConcluida; + } + + public void setLnkPorConcluida(Hyperlink h) { + this.lnkPorConcluida = h; + } + + private TableColumn tableColumn9 = new TableColumn(); + + public TableColumn getTableColumn9() { + return tableColumn9; + } + + public void setTableColumn9(TableColumn tc) { + this.tableColumn9 = tc; + } + + private Hyperlink lnkNomeConcluida = new Hyperlink(); + + public Hyperlink getLnkNomeConcluida() { + return lnkNomeConcluida; + } + + public void setLnkNomeConcluida(Hyperlink h) { + this.lnkNomeConcluida = h; + } + + private TableColumn tableColumn10 = new TableColumn(); + + public TableColumn getTableColumn10() { + return tableColumn10; + } + + public void setTableColumn10(TableColumn tc) { + this.tableColumn10 = tc; + } + + private Hyperlink lnkEstabConcluida = new Hyperlink(); + + public Hyperlink getLnkEstabConcluida() { + return lnkEstabConcluida; + } + + public void setLnkEstabConcluida(Hyperlink h) { + this.lnkEstabConcluida = h; + } + + private StaticText txtSearchMsg = new StaticText(); + + public StaticText getTxtSearchMsg() { + return txtSearchMsg; + } + + public void setTxtSearchMsg(StaticText st) { + this.txtSearchMsg = st; + } + + private HtmlPanelGrid gridPanel7 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel7() { + return gridPanel7; + } + + public void setGridPanel7(HtmlPanelGrid hpg) { + this.gridPanel7 = hpg; + } + + private PanelGroup groupPanel8 = new PanelGroup(); + + public PanelGroup getGroupPanel8() { + return groupPanel8; + } + + public void setGroupPanel8(PanelGroup pg) { + this.groupPanel8 = pg; + } + + private StaticText staticText7 = new StaticText(); + + public StaticText getStaticText7() { + return staticText7; + } + + public void setStaticText7(StaticText st) { + this.staticText7 = st; + } + + private ImageComponent image3 = new ImageComponent(); + + public ImageComponent getImage3() { + return image3; + } + + public void setImage3(ImageComponent ic) { + this.image3 = ic; + } + + private StaticText staticText8 = new StaticText(); + + public StaticText getStaticText8() { + return staticText8; + } + + public void setStaticText8(StaticText st) { + this.staticText8 = st; + } + + private TableColumn tableColumn11 = new TableColumn(); + + public TableColumn getTableColumn11() { + return tableColumn11; + } + + public void setTableColumn11(TableColumn tc) { + this.tableColumn11 = tc; + } + + private Hyperlink lnkDataAberturaSeg1 = new Hyperlink(); + + public Hyperlink getLnkDataAberturaSeg1() { + return lnkDataAberturaSeg1; + } + + public void setLnkDataAberturaSeg1(Hyperlink h) { + this.lnkDataAberturaSeg1 = h; + } + + private TableColumn tableColumn12 = new TableColumn(); + + public TableColumn getTableColumn12() { + return tableColumn12; + } + + public void setTableColumn12(TableColumn tc) { + this.tableColumn12 = tc; + } + + private Hyperlink lnkDataAberturaConcluida1 = new Hyperlink(); + + public Hyperlink getLnkDataAberturaConcluida1() { + return lnkDataAberturaConcluida1; + } + + public void setLnkDataAberturaConcluida1(Hyperlink h) { + this.lnkDataAberturaConcluida1 = h; + } + + private TableColumn tableColumn13 = new TableColumn(); + + public TableColumn getTableColumn13() { + return tableColumn13; + } + + public void setTableColumn13(TableColumn tc) { + this.tableColumn13 = tc; + } + + private Hyperlink lnkEstabelecimentoSeg1 = new Hyperlink(); + + public Hyperlink getLnkEstabelecimentoSeg1() { + return lnkEstabelecimentoSeg1; + } + + public void setLnkEstabelecimentoSeg1(Hyperlink h) { + this.lnkEstabelecimentoSeg1 = h; + } + private StaticText lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + private Hyperlink lnkPlanosActuacao = new Hyperlink(); + + public Hyperlink getLnkPlanosActuacao() { + return lnkPlanosActuacao; + } + + public void setLnkPlanosActuacao(Hyperlink h) { + this.lnkPlanosActuacao = h; + } + + + + private HtmlPanelGrid gridPanelFilterSeg = new HtmlPanelGrid(); + public HtmlPanelGrid getGridPanelFilterSeg() + { + return this.gridPanelFilterSeg; + } + public void setGridPanelFilterSeg( HtmlPanelGrid pg ) + { + this.gridPanelFilterSeg = pg; + } + + private PanelGroup groupPanelFilterSeg = new PanelGroup(); + public PanelGroup getGroupPanelFilterSeg() + { + return this.groupPanelFilterSeg; + } + public void setGroupPanelFilterSeg( PanelGroup pg ) + { + this.groupPanelFilterSeg = pg; + } + + private StaticText labelFilterNameSeg = new StaticText(); + public StaticText getLabelFilterNameSeg() + { + return this.labelFilterNameSeg; + } + public void setLabelFilterNameSeg( StaticText st ) + { + this.labelFilterNameSeg = st; + } + + private TextField textFilterNameSeg = new TextField(); + public TextField getTextFilterNameSeg() + { + return this.textFilterNameSeg; + } + public void setTextFilterNameSeg( TextField tf ) + { + this.textFilterNameSeg = tf; + } + + private StaticText labelFilterEstabelecimentoSeg = new StaticText(); + public StaticText getLabelFilterEstabelecimentoSeg() { + return labelFilterEstabelecimentoSeg; + } + public void setLabelFilterEstabelecimentoSeg(StaticText labelFilterEstabelecimentoSeg) { + this.labelFilterEstabelecimentoSeg = labelFilterEstabelecimentoSeg; + } + + private TextField textFilterEstabelecimentoSeg = new TextField(); + + public TextField getTextFilterEstabelecimentoSeg() { + return textFilterEstabelecimentoSeg; + } + public void setTextFilterEstabelecimentoSeg(TextField textFilterEstabelecimentoSeg) { + this.textFilterEstabelecimentoSeg = textFilterEstabelecimentoSeg; + } + + private com.sun.rave.web.ui.component.Calendar calFilterDateSeg = new com.sun.rave.web.ui.component.Calendar(); + public com.sun.rave.web.ui.component.Calendar getCalFilterDateSeg() + { + return this.calFilterDateSeg; + } + public void setCalFilterDateSeg( com.sun.rave.web.ui.component.Calendar c ) + { + this.calFilterDateSeg = c; + } + + private TextField textFilterPORSeg = new TextField(); + + public TextField getTextFilterPORSeg() { + return textFilterPORSeg; + } + + public void setTextFilterPORSeg(TextField textFilterPORSeg) { + this.textFilterPORSeg = textFilterPORSeg; + } + + + private Button buttonFilterSeg = new Button(); + public Button getButtonFilterSeg() + { + return this.buttonFilterSeg; + } + public void setButtonFilterSeg( Button b ) + { + this.buttonFilterSeg = b; + } + + private TextField textFilterEstabelecimentoConc = new TextField(); + + public TextField getTextFilterEstabelecimentoConc() { + return textFilterEstabelecimentoConc; + } + + public void setTextFilterEstabelecimentoConc(TextField textFilterEstabelecimentoConc) { + this.textFilterEstabelecimentoConc = textFilterEstabelecimentoConc; + } + + + private static final DateFormat D_F = new SimpleDateFormat( "yyyy-MM-dd" ); + //
+ + /** + *

Construct a new Page bean instance.

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

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 + + if (!getSessionBean1().isLoggedIn()) { + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) { + // . . . handle exception . . . + } + } + + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("FormGestor 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() { + System.out.println("=== FORM_GESTOR ==="); + Utilizador curUser = getSessionBean1().getCurrentUser(); + lblUser.setText( curUser.getLogin() ); + if(curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR) + { + if(curUser.getGestor_geral().matches("n")) + { + lnkPlanosActuacao.setDisabled(true); + } + } + else if(curUser.getTipo().intValue() != Global.TIPO_UTILIZADOR_DIRECTOR_NACIONAL_SEGURANCA) + { + if(curUser.getTipo().intValue() != Global.TIPO_UTILIZADOR_DIRECTOR_LOJA) + { + lnkPlanosActuacao.setDisabled(true); + } + } + + + HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); + String referer = request.getRequestURI(); + String pageFrom = Utils.getPageFrom(referer); + if(!pageFrom.matches("FormGestor.jsp")) + { + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + Integer estabelecimento_id = null; + //lblActivos.setRendered(true); + table1.setRendered(true); + ArrayList seguimentoList = null; + //if(curUser.getGestor_geral().matches("y") || curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_NACIONAL_SEGURANCA || curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_LOJA) + if(curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR) + { + estabelecimento_id = curUser.getEstabelecimento_gestor(); + if(estabelecimento_id.intValue() == 0) + { + seguimentoList = adp.getAnalisesSeguimentoGestorList(null); + } + else + { + seguimentoList = adp.getAnalisesSeguimentoGestorList(curUser.getEstabelecimento_id()); + } + } + + else if(curUser.getGestor_geral().matches("y") || curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_NACIONAL_SEGURANCA) + { + seguimentoList = adp.getAnalisesSeguimentoGestorList(null); + } + else if(curUser.getGestor_geral().matches("n") || curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_LOJA) + { + seguimentoList = adp.getAnalisesSeguimentoGestorList(curUser.getEstabelecimento_id()); + } + + getSessionBean1().getAnalisesSeguimentoDataProvider().setList(seguimentoList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table1.setRendered(false); + //ex.printStackTrace(); + } + + try + { + //lblActivos.setRendered(true); + table2.setRendered(true); + ArrayList concluidasList = null; + if(getSessionBean1().getCurrentUser().getGestor_geral().matches("y") || curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_NACIONAL_SEGURANCA || curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_LOJA) + { + concluidasList = adp.getAnalisesConcluidasList(null); + } + else + { + concluidasList = adp.getAnalisesConcluidasList(getSessionBean1().getCurrentUser().getEstabelecimento_id()); + } + + getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table2.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 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 lnkPlanosActuacao_action() { + // TODO: Replace with your code + Utilizador u = getSessionBean1().getCurrentUser(); +// String curUser = "?user=" + u.getId().toString(); + FacesContext fc = getFacesContext().getCurrentInstance(); + Global.redirectToPlanos(fc, u); + +// Utilizador u = getSessionBean1().getCurrentUser(); +// String curUser = "?user=" + u.getId().toString(); +// FacesContext fc = getFacesContext().getCurrentInstance(); +// try +// { +// JSFUtils.redirect(fc, Global.PLANOS_ACTUACAO_URL + curUser); +// } +// catch(Exception ex) +// { +// +// } + return null; + } + + public String lnkAnalisesAcidente_action() { + return null; + } + + public String lnkGerirUtilizadores_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkEditUser_action() { + // TODO: Replace with your code + + getSessionBean1().setNavFrom("FormGestor"); + getSessionBean1().setModoEdicaoUtilizador("edit"); + return "user"; + + } + + public String lnkLogout_action() { + // TODO: Replace with your code + + try + { + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + } + catch(Exception ex){} + + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) {} + //return "login"; + return null; + } + + public String lnkDataAcidenteSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormGestor"); + return "view_analise"; + + } + + public String lnkDataAberturaSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormGestor"); + return "view_analise"; + } + + public String lnkNrSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormGestor"); + return "view_analise"; + + } + + public String lnkPorSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormGestor"); + return "view_analise"; + + } + + public String lnkNomeAcidentadoSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormGestor"); + return "view_analise"; + + } + + public String lnkFaseSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormGestor"); + return "view_analise"; + + } + + public String lnkEstabelecimentoSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormGestor"); + return "view_analise"; + } + + private AnaliseAcidente getTableSeguimentoRowData() + { + RowKey rk = tableRowGroup1.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + AnalisesSeguimentoDataProvider provider = (AnalisesSeguimentoDataProvider) tableRowGroup1.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 por = null; + if(txtPor.getText() != null) + { + por = (String) txtPor.getText(); + if(por.trim().length() == 0) + { + por = null; + } + } + + String nome = null; + if(txtNome.getText() != null) + { + nome = (String) txtNome.getText(); + if(nome.trim().length() == 0) + { + nome = null; + } + } + + String estabelecimento = null; + if ( textFilterEstabelecimentoConc.getText() != null ) + { + estabelecimento = (( String ) textFilterEstabelecimentoConc.getText()).trim(); + if( estabelecimento.length() == 0 ) + { + estabelecimento = null; + } + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + + //getSessionBean1().getAnalisesConcluidasDataProvider().setList(new ArrayList()); + ArrayList concluidasList = null; + if ( getSessionBean1().getCurrentUser().getGestor_geral().matches( "y" ) ) + { + concluidasList = adp.searchAanalisesConcluidasList( + null, ano, mes, dia, por, nome, estabelecimento ); + } + else + { + concluidasList = adp.searchAanalisesConcluidasList( + getSessionBean1().getCurrentUser().getEstabelecimento_id(), + ano, mes, dia, por, nome, null ); + } + + + table2.setRendered(true); + txtSearchMsg.setRendered(false); + getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); + + + } + catch(Exception ex) + { + table2.setRendered(false); + txtSearchMsg.setRendered(true); + txtSearchMsg.setText("Não foram encontrados registos para a sua pesquisa !"); + //ex.printStackTrace(); + } + + return null; + } + + public String lnkDataConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormGestor"); + return "view_analise"; + + } + + public String lnkDataAberturaConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormGestor"); + return "view_analise"; + } + + public String lnkNrConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormGestor"); + return "view_analise"; + + } + + public String lnkPorConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormGestor"); + return "view_analise"; + + } + + public String lnkNomeConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormGestor"); + return "view_analise"; + + } + + public String lnkEstabConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormGestor"); + return "view_analise"; + + } + + private AnaliseAcidente getTableConcluidasRowData() + { + RowKey rk = tableRowGroup2.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + AnalisesConcluidasDataProvider provider = (AnalisesConcluidasDataProvider) tableRowGroup2.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + AnaliseAcidente a = (AnaliseAcidente)list.get(k); + return a; + } + + + private void fillAnoDropDown() + { +// ArrayList anosList = new ArrayList(); +// for(int ano=2007; ano<2051; ano++) +// { +// anosList.add(new Integer(ano)); +// } + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList anosList = adp.getAnosListFromAnalises(); + 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) ); + + } + catch(Exception ex) + { + //ex.printStackTrace(); + } + + } + + + 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() +// { +// +// } + + public String lnkAjuda_action() { + // TODO: Replace with your code +// ServletContext theApplicationsServletContext = +// (ServletContext) this.getExternalContext().getContext(); +// String pdfFolderPath = theApplicationsServletContext.getRealPath(Global.PDF_FOLDER_URL); +// String pdfFilePath = pdfFolderPath + "/Ajuda.pdf"; +// +// Global global = new Global(); +// try +// { +// global.showPdf(pdfFilePath); +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } + return null; + } + + public String lnkEstabelecimento_action() { + // TODO: Replace with your code + + return null; + } + + public String buttonFilterSeg_action() + { + Date visitaDate = ( Date ) calFilterDateSeg.getValue(); + String visitaDateStr = null; + if ( visitaDate != null ) + { + visitaDateStr = D_F.format( visitaDate ); + } + + String POR = null; + if ( textFilterPORSeg.getText() != null ) + { + POR = ( ( String ) textFilterPORSeg.getText() ).trim(); + if ( POR.length() == 0 ) + { + POR = null; + } + } + + String nome = null; + if ( textFilterNameSeg.getText() != null ) + { + nome = (( String ) textFilterNameSeg.getText()).trim(); + if( nome.length() == 0 ) + { + nome = null; + } + } + + String estabelecimento = null; + if ( textFilterEstabelecimentoSeg.getText() != null ) + { + estabelecimento = (( String ) textFilterEstabelecimentoSeg.getText()).trim(); + if ( estabelecimento.length() == 0 ) + { + estabelecimento = null; + } + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + Utilizador curUser = getSessionBean1().getCurrentUser(); + ArrayList seguimentoList = null; + Integer estabelecimento_id = null; + + if ( curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR ) + { + estabelecimento_id = curUser.getEstabelecimento_gestor(); + if ( estabelecimento_id.intValue() == 0 ) + { + seguimentoList = adp.searchAnalisesSeguimentoGestor( null, nome, estabelecimento, visitaDateStr, POR ); + } + else + { + seguimentoList = adp.searchAnalisesSeguimentoGestor( curUser.getEstabelecimento_id(), nome, estabelecimento, visitaDateStr, POR ); + } + } + else if ( curUser.getGestor_geral().matches( "y" ) || curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_NACIONAL_SEGURANCA ) + { + seguimentoList = adp.searchAnalisesSeguimentoGestor( null, nome, estabelecimento, visitaDateStr, POR ); + } + else if ( curUser.getGestor_geral().matches( "n" ) || curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_LOJA ) + { + seguimentoList = adp.searchAnalisesSeguimentoGestor( curUser.getEstabelecimento_id(), nome, estabelecimento, visitaDateStr, POR ); + } + + table1.setRendered( true ); + txtSearchMsg.setRendered( false ); + getSessionBean1().getAnalisesSeguimentoDataProvider().setList( seguimentoList ); + } + catch( Exception e ) + { + table1.setRendered( false ); + txtSearchMsg.setRendered( true ); + txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + } + + return null; + } + +} + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormHS.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormHS.java new file mode 100644 index 00000000..e7630a0c --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormHS.java @@ -0,0 +1,2068 @@ +/* + * 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.AnalisesConcluidasDataProvider; +import db.AnalisesDataProvider; +import db.AnalisesSeguimentoDataProvider; +import global.Global; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.ListIterator; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.context.FacesContext; +import javax.faces.event.ValueChangeEvent; +import javax.servlet.http.HttpServletRequest; +import utils.Utils; + +/** + *

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 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 lnkDataConcluida = new Hyperlink(); + + public Hyperlink getLnkDataConcluida() { + return lnkDataConcluida; + } + + public void setLnkDataConcluida(Hyperlink h) { + this.lnkDataConcluida = h; + } + + private TableColumn tableColumn8 = new TableColumn(); + + public TableColumn getTableColumn8() { + return tableColumn8; + } + + public void setTableColumn8(TableColumn tc) { + this.tableColumn8 = tc; + } + + private Hyperlink lnkNrConcluida = new Hyperlink(); + + public Hyperlink getLnkNrConcluida() { + return lnkNrConcluida; + } + + public void setLnkNrConcluida(Hyperlink h) { + this.lnkNrConcluida = h; + } + + private TableColumn tableColumn9 = new TableColumn(); + + public TableColumn getTableColumn9() { + return tableColumn9; + } + + public void setTableColumn9(TableColumn tc) { + this.tableColumn9 = tc; + } + + private Hyperlink lnkNomeConcluida = new Hyperlink(); + + public Hyperlink getLnkNomeConcluida() { + return lnkNomeConcluida; + } + + public void setLnkNomeConcluida(Hyperlink h) { + this.lnkNomeConcluida = h; + } + + private StaticText txtSearchMsg = new StaticText(); + + public StaticText getTxtSearchMsg() { + return txtSearchMsg; + } + + public void setTxtSearchMsg(StaticText st) { + this.txtSearchMsg = st; + } + + private TableColumn tableColumn10 = new TableColumn(); + + public TableColumn getTableColumn10() { + return tableColumn10; + } + + public void setTableColumn10(TableColumn tc) { + this.tableColumn10 = tc; + } + + private Hyperlink lnkFase = new Hyperlink(); + + public Hyperlink getLnkFase() { + return lnkFase; + } + + public void setLnkFase(Hyperlink h) { + this.lnkFase = h; + } + + private TableColumn tableColumn11 = new TableColumn(); + + public TableColumn getTableColumn11() { + return tableColumn11; + } + + public void setTableColumn11(TableColumn tc) { + this.tableColumn11 = tc; + } + + private Hyperlink lnkFaseSeg = new Hyperlink(); + + public Hyperlink getLnkFaseSeg() { + return lnkFaseSeg; + } + + public void setLnkFaseSeg(Hyperlink h) { + this.lnkFaseSeg = h; + } + + private TableColumn tableColumn12 = new TableColumn(); + + public TableColumn getTableColumn12() { + return tableColumn12; + } + + public void setTableColumn12(TableColumn tc) { + this.tableColumn12 = tc; + } + + private TableColumn tableColumn13 = new TableColumn(); + + public TableColumn getTableColumn13() { + return tableColumn13; + } + + public void setTableColumn13(TableColumn tc) { + this.tableColumn13 = tc; + } + + private TableColumn tableColumn14 = new TableColumn(); + + public TableColumn getTableColumn14() { + return tableColumn14; + } + + public void setTableColumn14(TableColumn tc) { + this.tableColumn14 = tc; + } + + private TableColumn tableColumn15 = new TableColumn(); + + public TableColumn getTableColumn15() { + return tableColumn15; + } + + public void setTableColumn15(TableColumn tc) { + this.tableColumn15 = tc; + } + + private Hyperlink lnkPor = new Hyperlink(); + + public Hyperlink getLnkPor() { + return lnkPor; + } + + public void setLnkPor(Hyperlink h) { + this.lnkPor = h; + } + + private Hyperlink lnkPorSeg = new Hyperlink(); + + public Hyperlink getLnkPorSeg() { + return lnkPorSeg; + } + + public void setLnkPorSeg(Hyperlink h) { + this.lnkPorSeg = h; + } + + private Hyperlink lnkPorConcluida = new Hyperlink(); + + public Hyperlink getLnkPorConcluida() { + return lnkPorConcluida; + } + + public void setLnkPorConcluida(Hyperlink h) { + this.lnkPorConcluida = h; + } + + private Hyperlink lnkEstabConcluida = new Hyperlink(); + + public Hyperlink getLnkEstabConcluida() { + return lnkEstabConcluida; + } + + public void setLnkEstabConcluida(Hyperlink h) { + this.lnkEstabConcluida = h; + } + + private PanelGroup groupPanel7 = new PanelGroup(); + + public PanelGroup getGroupPanel7() { + return groupPanel7; + } + + public void setGroupPanel7(PanelGroup pg) { + this.groupPanel7 = pg; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private TextField txtPor = new TextField(); + + public TextField getTxtPor() { + return txtPor; + } + + public void setTxtPor(TextField tf) { + this.txtPor = tf; + } + + private HtmlPanelGrid gridPanel9 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel9() { + return gridPanel9; + } + + public void setGridPanel9(HtmlPanelGrid hpg) { + this.gridPanel9 = hpg; + } + + private PanelGroup groupPanel8 = new PanelGroup(); + + public PanelGroup getGroupPanel8() { + return groupPanel8; + } + + public void setGroupPanel8(PanelGroup pg) { + this.groupPanel8 = pg; + } + + private StaticText staticText10 = new StaticText(); + + public StaticText getStaticText10() { + return staticText10; + } + + public void setStaticText10(StaticText st) { + this.staticText10 = st; + } + + private ImageComponent image3 = new ImageComponent(); + + public ImageComponent getImage3() { + return image3; + } + + public void setImage3(ImageComponent ic) { + this.image3 = ic; + } + + private StaticText staticText11 = new StaticText(); + + public StaticText getStaticText11() { + return staticText11; + } + + public void setStaticText11(StaticText st) { + this.staticText11 = st; + } + + private HtmlPanelGrid gridPanel10 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel10() { + return gridPanel10; + } + + public void setGridPanel10(HtmlPanelGrid hpg) { + this.gridPanel10 = hpg; + } + + private StaticText txtMsg = new StaticText(); + + public StaticText getTxtMsg() { + return txtMsg; + } + + public void setTxtMsg(StaticText st) { + this.txtMsg = st; + } + + private TableColumn tableColumn16 = new TableColumn(); + + public TableColumn getTableColumn16() { + return tableColumn16; + } + + public void setTableColumn16(TableColumn tc) { + this.tableColumn16 = tc; + } + + private Hyperlink lnkDataAbertura = new Hyperlink(); + + public Hyperlink getLnkDataAbertura() { + return lnkDataAbertura; + } + + public void setLnkDataAbertura(Hyperlink h) { + this.lnkDataAbertura = h; + } + + private TableColumn tableColumn17 = new TableColumn(); + + public TableColumn getTableColumn17() { + return tableColumn17; + } + + public void setTableColumn17(TableColumn tc) { + this.tableColumn17 = tc; + } + + private Hyperlink lnkDataAberturaSeg = new Hyperlink(); + + public Hyperlink getLnkDataAberturaSeg() { + return lnkDataAberturaSeg; + } + + public void setLnkDataAberturaSeg(Hyperlink h) { + this.lnkDataAberturaSeg = h; + } + + private TableColumn tableColumn18 = new TableColumn(); + + public TableColumn getTableColumn18() { + return tableColumn18; + } + + public void setTableColumn18(TableColumn tc) { + this.tableColumn18 = tc; + } + + private Hyperlink lnkDataAberturaConcluida = new Hyperlink(); + + public Hyperlink getLnkDataAberturaConcluida() { + return lnkDataAberturaConcluida; + } + + public void setLnkDataAberturaConcluida(Hyperlink h) { + this.lnkDataAberturaConcluida = h; + } + + private TableColumn tableColumn19 = new TableColumn(); + + public TableColumn getTableColumn19() { + return tableColumn19; + } + + public void setTableColumn19(TableColumn tc) { + this.tableColumn19 = tc; + } + + private Hyperlink lnkEstabelecimento = new Hyperlink(); + + public Hyperlink getLnkEstabelecimento() { + return lnkEstabelecimento; + } + + public void setLnkEstabelecimento(Hyperlink h) { + this.lnkEstabelecimento = h; + } + + private TableColumn tableColumn20 = new TableColumn(); + + public TableColumn getTableColumn20() { + return tableColumn20; + } + + public void setTableColumn20(TableColumn tc) { + this.tableColumn20 = tc; + } + + private Hyperlink lnkEstabelecimentoSeg = new Hyperlink(); + + public Hyperlink getLnkEstabelecimentoSeg() { + return lnkEstabelecimentoSeg; + } + + public void setLnkEstabelecimentoSeg(Hyperlink h) { + this.lnkEstabelecimentoSeg = h; + } + private StaticText lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + private Hyperlink lnkPlanosActuacao = new Hyperlink(); + + public Hyperlink getLnkPlanosActuacao() { + return lnkPlanosActuacao; + } + + public void setLnkPlanosActuacao(Hyperlink h) { + this.lnkPlanosActuacao = h; + } + + + private HtmlPanelGrid gridPanelFilterActual = new HtmlPanelGrid(); + public HtmlPanelGrid getGridPanelFilterActual() + { + return this.gridPanelFilterActual; + } + public void setGridPanelFilterActual( HtmlPanelGrid pg ) + { + this.gridPanelFilterActual = pg; + } + + private PanelGroup groupPanelFilterActual = new PanelGroup(); + public PanelGroup getGroupPanelFilterActual() + { + return this.groupPanelFilterActual; + } + public void setGroupPanelFilterActual( PanelGroup pg ) + { + this.groupPanelFilterActual = pg; + } + + private StaticText labelFilterNameActual = new StaticText(); + public StaticText getLabelFilterNameActual() + { + return this.labelFilterNameActual; + } + public void setLabelFilterNameActual( StaticText st ) + { + this.labelFilterNameActual = st; + } + + private TextField textFilterNameActual = new TextField(); + public TextField getTextFilterNameActual() + { + return this.textFilterNameActual; + } + public void setTextFilterNameActual( TextField tf ) + { + this.textFilterNameActual = tf; + } + + private StaticText labelFilterEstabelecimentoActual = new StaticText(); + public StaticText getLabelFilterEstabelecimentoActual() { + return labelFilterEstabelecimentoActual; + } + public void setLabelFilterEstabelecimentoActual(StaticText labelFilterEstabelecimentoActual) { + this.labelFilterEstabelecimentoActual = labelFilterEstabelecimentoActual; + } + + private TextField textFilterEstabelecimentoActual = new TextField(); + + public TextField getTextFilterEstabelecimentoActual() { + return textFilterEstabelecimentoActual; + } + public void setTextFilterEstabelecimentoActual(TextField textFilterEstabelecimentoActual) { + this.textFilterEstabelecimentoActual = textFilterEstabelecimentoActual; + } + + private com.sun.rave.web.ui.component.Calendar calFilterDateActual = new com.sun.rave.web.ui.component.Calendar(); + public com.sun.rave.web.ui.component.Calendar getCalFilterDateActual() + { + return this.calFilterDateActual; + } + public void setCalFilterDateActual( com.sun.rave.web.ui.component.Calendar c ) + { + this.calFilterDateActual = c; + } + + private TextField textFilterPORActual = new TextField(); + + public TextField getTextFilterPORActual() { + return textFilterPORActual; + } + + public void setTextFilterPORActual(TextField textFilterPORActual) { + this.textFilterPORActual = textFilterPORActual; + } + + + private Button buttonFilterActual = new Button(); + public Button getButtonFilterActual() + { + return this.buttonFilterActual; + } + public void setButtonFilterActual( Button b ) + { + this.buttonFilterActual = b; + } + + private HtmlPanelGrid gridPanelFilterSeg = new HtmlPanelGrid(); + public HtmlPanelGrid getGridPanelFilterSeg() + { + return this.gridPanelFilterSeg; + } + public void setGridPanelFilterSeg( HtmlPanelGrid pg ) + { + this.gridPanelFilterSeg = pg; + } + + private PanelGroup groupPanelFilterSeg = new PanelGroup(); + public PanelGroup getGroupPanelFilterSeg() + { + return this.groupPanelFilterSeg; + } + public void setGroupPanelFilterSeg( PanelGroup pg ) + { + this.groupPanelFilterSeg = pg; + } + + private StaticText labelFilterNameSeg = new StaticText(); + public StaticText getLabelFilterNameSeg() + { + return this.labelFilterNameSeg; + } + public void setLabelFilterNameSeg( StaticText st ) + { + this.labelFilterNameSeg = st; + } + + private TextField textFilterNameSeg = new TextField(); + public TextField getTextFilterNameSeg() + { + return this.textFilterNameSeg; + } + public void setTextFilterNameSeg( TextField tf ) + { + this.textFilterNameSeg = tf; + } + + private StaticText labelFilterEstabelecimentoSeg = new StaticText(); + public StaticText getLabelFilterEstabelecimentoSeg() { + return labelFilterEstabelecimentoSeg; + } + public void setLabelFilterEstabelecimentoSeg(StaticText labelFilterEstabelecimentoSeg) { + this.labelFilterEstabelecimentoSeg = labelFilterEstabelecimentoSeg; + } + + private TextField textFilterEstabelecimentoSeg = new TextField(); + + public TextField getTextFilterEstabelecimentoSeg() { + return textFilterEstabelecimentoSeg; + } + public void setTextFilterEstabelecimentoSeg(TextField textFilterEstabelecimentoSeg) { + this.textFilterEstabelecimentoSeg = textFilterEstabelecimentoSeg; + } + + private com.sun.rave.web.ui.component.Calendar calFilterDateSeg = new com.sun.rave.web.ui.component.Calendar(); + public com.sun.rave.web.ui.component.Calendar getCalFilterDateSeg() + { + return this.calFilterDateSeg; + } + public void setCalFilterDateSeg( com.sun.rave.web.ui.component.Calendar c ) + { + this.calFilterDateSeg = c; + } + + private TextField textFilterPORSeg = new TextField(); + + public TextField getTextFilterPORSeg() { + return textFilterPORSeg; + } + + public void setTextFilterPORSeg(TextField textFilterPORSeg) { + this.textFilterPORSeg = textFilterPORSeg; + } + + + private Button buttonFilterSeg = new Button(); + public Button getButtonFilterSeg() + { + return this.buttonFilterSeg; + } + public void setButtonFilterSeg( Button b ) + { + this.buttonFilterSeg = b; + } + + + private TextField textFilterEstabelecimentoConc = new TextField(); + + public TextField getTextFilterEstabelecimentoConc() { + return textFilterEstabelecimentoConc; + } + + public void setTextFilterEstabelecimentoConc(TextField textFilterEstabelecimentoConc) { + this.textFilterEstabelecimentoConc = textFilterEstabelecimentoConc; + } + + + private static final DateFormat D_F = new SimpleDateFormat( "yyyy-MM-dd" ); + //
+ + /** + *

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() { + System.out.println("=== FORM_HS ==="); + lblUser.setText( getSessionBean1().getCurrentUser().getLogin() ); + + HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); + String referer = request.getRequestURI(); + String pageFrom = Utils.getPageFrom(referer); + System.out.println("PAGE FROM : " + pageFrom); + if((!pageFrom.matches("FormHS.jsp")) || getSessionBean1().isFromAnaliseDeletion()) + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + //lblActivos.setRendered(true); + table1.setRendered(true); + + //ArrayList actuaisList = adp.getAnalisesActuaisList(getSessionBean1().getCurrentUser().getEstabelecimento_id(), new Integer(3)); + ArrayList actuaisList = adp.getAnalisesActuaisHsList( 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.getAnalisesSeguimentoHsList(getSessionBean1().getCurrentUser().getEstabelecimento_id()); + getSessionBean1().getAnalisesSeguimentoDataProvider().setList(seguimentoList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table2.setRendered(false); + //ex.printStackTrace(); + } + + try + { + //lblActivos.setRendered(true); + System.out.println("CONCLUIDAS TABLE"); + getSessionBean1().getAnalisesConcluidasDataProvider().setList(null); + table3.setRendered(true); + ArrayList concluidasList = adp.getAnalisesConcluidasHsList(); + getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table3.setRendered(false); + ex.printStackTrace(); + System.out.println("ERRRRRROR : " + ex.getMessage()); + } + fillAnoDropDown(); + } + + 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 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 + + try + { + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + } + catch(Exception ex){} + + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) {} + //return "login"; + return null; + } + + public String lnkDataAcidente_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormHS"); + return "analise_acidente"; + } + + public String lnkDataAbertura_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormHS"); + return "analise_acidente"; + } + + public String lnkNr_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormHS"); + return "analise_acidente"; + } + + public String lnkNomeAcidentado_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormHS"); + 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("FormHS"); + return "view_analise"; + } + + public String lnkDataAberturaSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormHS"); + return "view_analise"; + } + + public String lnkNrSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormHS"); + return "view_analise"; + } + + public String lnkNomeAcidentadoSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormHS"); + 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; + } + + private AnaliseAcidente getTableConcluidasRowData() + { + RowKey rk = tableRowGroup3.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + AnalisesConcluidasDataProvider provider = (AnalisesConcluidasDataProvider) tableRowGroup3.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 por = null; + if(txtPor.getText() != null) + { + por = (String) txtPor.getText(); + if(por.trim().length() == 0) + { + por = null; + } + } + + String nome = null; + if(txtNome.getText() != null) + { + nome = (String) txtNome.getText(); + if(nome.trim().length() == 0) + { + nome = null; + } + } + + String estabelecimento = null; + if ( textFilterEstabelecimentoConc.getText() != null ) + { + estabelecimento = (( String ) textFilterEstabelecimentoConc.getText()).trim(); + if( estabelecimento.length() == 0 ) + { + estabelecimento = null; + } + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + + //getSessionBean1().getAnalisesConcluidasDataProvider().setList(new ArrayList()); + ArrayList concluidasList = adp.searchAanalisesConcluidasList( + getSessionBean1().getCurrentUser().getEstabelecimento_id(), + ano, mes, dia, por, nome, estabelecimento ); + + 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)); +// } + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList anosList = adp.getAnosListFromAnalises(); + 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) ); + + } + catch(Exception ex) + { + //ex.printStackTrace(); + } + + } + + + 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 FormMedico 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 lnkEditUser = new Hyperlink(); + + public Hyperlink getLnkEditUser() { + return lnkEditUser; + } + + public void setLnkEditUser(Hyperlink h) { + this.lnkEditUser = 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 HtmlPanelGrid gridLayoutTop1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLayoutTop1() { + return gridLayoutTop1; + } + + public void setGridLayoutTop1(HtmlPanelGrid hpg) { + this.gridLayoutTop1 = hpg; + } + + private HtmlPanelGrid gridActual = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridActual() { + return gridActual; + } + + public void setGridActual(HtmlPanelGrid hpg) { + this.gridActual = 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 gridSeguimento = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridSeguimento() { + return gridSeguimento; + } + + public void setGridSeguimento(HtmlPanelGrid hpg) { + this.gridSeguimento = 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 gridConcluidos = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridConcluidos() { + return gridConcluidos; + } + + public void setGridConcluidos(HtmlPanelGrid hpg) { + this.gridConcluidos = 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 lnkDataConcluida = new Hyperlink(); + + public Hyperlink getLnkDataConcluida() { + return lnkDataConcluida; + } + + public void setLnkDataConcluida(Hyperlink h) { + this.lnkDataConcluida = h; + } + + private TableColumn tableColumn8 = new TableColumn(); + + public TableColumn getTableColumn8() { + return tableColumn8; + } + + public void setTableColumn8(TableColumn tc) { + this.tableColumn8 = tc; + } + + private Hyperlink lnkNrConcluida = new Hyperlink(); + + public Hyperlink getLnkNrConcluida() { + return lnkNrConcluida; + } + + public void setLnkNrConcluida(Hyperlink h) { + this.lnkNrConcluida = h; + } + + private TableColumn tableColumn9 = new TableColumn(); + + public TableColumn getTableColumn9() { + return tableColumn9; + } + + public void setTableColumn9(TableColumn tc) { + this.tableColumn9 = tc; + } + + private Hyperlink lnkNomeConcluida = new Hyperlink(); + + public Hyperlink getLnkNomeConcluida() { + return lnkNomeConcluida; + } + + public void setLnkNomeConcluida(Hyperlink h) { + this.lnkNomeConcluida = h; + } + + private StaticText txtSearchMsg = new StaticText(); + + public StaticText getTxtSearchMsg() { + return txtSearchMsg; + } + + public void setTxtSearchMsg(StaticText st) { + this.txtSearchMsg = st; + } + + private TableColumn tableColumn10 = new TableColumn(); + + public TableColumn getTableColumn10() { + return tableColumn10; + } + + public void setTableColumn10(TableColumn tc) { + this.tableColumn10 = tc; + } + + private Hyperlink lnkFase = new Hyperlink(); + + public Hyperlink getLnkFase() { + return lnkFase; + } + + public void setLnkFase(Hyperlink h) { + this.lnkFase = h; + } + + private Hyperlink lnkEstabelecimento = new Hyperlink(); + + public Hyperlink getLnkEstabelecimento() { + return lnkEstabelecimento; + } + + public void setLnkEstabelecimento(Hyperlink h) { + this.lnkEstabelecimento = h; + } + + private TableColumn tableColumn16 = new TableColumn(); + + public TableColumn getTableColumn16() { + return tableColumn16; + } + + public void setTableColumn16(TableColumn tc) { + this.tableColumn16 = tc; + } + + private TableColumn tableColumn17 = new TableColumn(); + + public TableColumn getTableColumn17() { + return tableColumn17; + } + + public void setTableColumn17(TableColumn tc) { + this.tableColumn17 = tc; + } + + private TableColumn tableColumn11 = new TableColumn(); + + public TableColumn getTableColumn11() { + return tableColumn11; + } + + public void setTableColumn11(TableColumn tc) { + this.tableColumn11 = tc; + } + + private Hyperlink lnkFaseSeg = new Hyperlink(); + + public Hyperlink getLnkFaseSeg() { + return lnkFaseSeg; + } + + public void setLnkFaseSeg(Hyperlink h) { + this.lnkFaseSeg = h; + } + + private Hyperlink lnkEstabelecimentoSeg = new Hyperlink(); + + public Hyperlink getLnkEstabelecimentoSeg() { + return lnkEstabelecimentoSeg; + } + + public void setLnkEstabelecimentoSeg(Hyperlink h) { + this.lnkEstabelecimentoSeg = h; + } + + private TableColumn tableColumn12 = new TableColumn(); + + public TableColumn getTableColumn12() { + return tableColumn12; + } + + public void setTableColumn12(TableColumn tc) { + this.tableColumn12 = tc; + } + + private TableColumn tableColumn13 = new TableColumn(); + + public TableColumn getTableColumn13() { + return tableColumn13; + } + + public void setTableColumn13(TableColumn tc) { + this.tableColumn13 = tc; + } + + private TableColumn tableColumn14 = new TableColumn(); + + public TableColumn getTableColumn14() { + return tableColumn14; + } + + public void setTableColumn14(TableColumn tc) { + this.tableColumn14 = tc; + } + + private TableColumn tableColumn15 = new TableColumn(); + + public TableColumn getTableColumn15() { + return tableColumn15; + } + + public void setTableColumn15(TableColumn tc) { + this.tableColumn15 = tc; + } + + private Hyperlink lnkPor = new Hyperlink(); + + public Hyperlink getLnkPor() { + return lnkPor; + } + + public void setLnkPor(Hyperlink h) { + this.lnkPor = h; + } + + private Hyperlink lnkPorSeg = new Hyperlink(); + + public Hyperlink getLnkPorSeg() { + return lnkPorSeg; + } + + public void setLnkPorSeg(Hyperlink h) { + this.lnkPorSeg = h; + } + + private Hyperlink lnkPorConcluida = new Hyperlink(); + + public Hyperlink getLnkPorConcluida() { + return lnkPorConcluida; + } + + public void setLnkPorConcluida(Hyperlink h) { + this.lnkPorConcluida = h; + } + + private Hyperlink lnkEstabConcluida = new Hyperlink(); + + public Hyperlink getLnkEstabConcluida() { + return lnkEstabConcluida; + } + + public void setLnkEstabConcluida(Hyperlink h) { + this.lnkEstabConcluida = h; + } + + private PanelGroup groupPanel7 = new PanelGroup(); + + public PanelGroup getGroupPanel7() { + return groupPanel7; + } + + public void setGroupPanel7(PanelGroup pg) { + this.groupPanel7 = pg; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private TextField txtPor = new TextField(); + + public TextField getTxtPor() { + return txtPor; + } + + public void setTxtPor(TextField tf) { + this.txtPor = tf; + } + + private HtmlPanelGrid gridPanel9 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel9() { + return gridPanel9; + } + + public void setGridPanel9(HtmlPanelGrid hpg) { + this.gridPanel9 = hpg; + } + + private PanelGroup groupPanel8 = new PanelGroup(); + + public PanelGroup getGroupPanel8() { + return groupPanel8; + } + + public void setGroupPanel8(PanelGroup pg) { + this.groupPanel8 = pg; + } + + private StaticText staticText10 = new StaticText(); + + public StaticText getStaticText10() { + return staticText10; + } + + public void setStaticText10(StaticText st) { + this.staticText10 = st; + } + + private ImageComponent image3 = new ImageComponent(); + + public ImageComponent getImage3() { + return image3; + } + + public void setImage3(ImageComponent ic) { + this.image3 = ic; + } + + private StaticText staticText11 = new StaticText(); + + public StaticText getStaticText11() { + return staticText11; + } + + public void setStaticText11(StaticText st) { + this.staticText11 = st; + } + + + + private HtmlPanelGrid gridPanelFilterActual = new HtmlPanelGrid(); + public HtmlPanelGrid getGridPanelFilterActual() + { + return this.gridPanelFilterActual; + } + public void setGridPanelFilterActual( HtmlPanelGrid pg ) + { + this.gridPanelFilterActual = pg; + } + + private PanelGroup groupPanelFilterActual = new PanelGroup(); + public PanelGroup getGroupPanelFilterActual() + { + return this.groupPanelFilterActual; + } + public void setGroupPanelFilterActual( PanelGroup pg ) + { + this.groupPanelFilterActual = pg; + } + + private StaticText labelFilterNameActual = new StaticText(); + public StaticText getLabelFilterNameActual() + { + return this.labelFilterNameActual; + } + public void setLabelFilterNameActual( StaticText st ) + { + this.labelFilterNameActual = st; + } + + private TextField textFilterNameActual = new TextField(); + public TextField getTextFilterNameActual() + { + return this.textFilterNameActual; + } + public void setTextFilterNameActual( TextField tf ) + { + this.textFilterNameActual = tf; + } + + private com.sun.rave.web.ui.component.Calendar calFilterDateActual = new com.sun.rave.web.ui.component.Calendar(); + public com.sun.rave.web.ui.component.Calendar getCalFilterDateActual() + { + return this.calFilterDateActual; + } + public void setCalFilterDateActual( com.sun.rave.web.ui.component.Calendar c ) + { + this.calFilterDateActual = c; + } + + private TextField textFilterPORActual = new TextField(); + + public TextField getTextFilterPORActual() { + return textFilterPORActual; + } + + public void setTextFilterPORActual(TextField textFilterPORActual) { + this.textFilterPORActual = textFilterPORActual; + } + + + private Button buttonFilterActual = new Button(); + public Button getButtonFilterActual() + { + return this.buttonFilterActual; + } + public void setButtonFilterActual( Button b ) + { + this.buttonFilterActual = b; + } + + private HtmlPanelGrid gridPanelFilterSeg = new HtmlPanelGrid(); + public HtmlPanelGrid getGridPanelFilterSeg() + { + return this.gridPanelFilterSeg; + } + public void setGridPanelFilterSeg( HtmlPanelGrid pg ) + { + this.gridPanelFilterSeg = pg; + } + + private PanelGroup groupPanelFilterSeg = new PanelGroup(); + public PanelGroup getGroupPanelFilterSeg() + { + return this.groupPanelFilterSeg; + } + public void setGroupPanelFilterSeg( PanelGroup pg ) + { + this.groupPanelFilterSeg = pg; + } + + private StaticText labelFilterNameSeg = new StaticText(); + public StaticText getLabelFilterNameSeg() + { + return this.labelFilterNameSeg; + } + public void setLabelFilterNameSeg( StaticText st ) + { + this.labelFilterNameSeg = st; + } + + private TextField textFilterNameSeg = new TextField(); + public TextField getTextFilterNameSeg() + { + return this.textFilterNameSeg; + } + public void setTextFilterNameSeg( TextField tf ) + { + this.textFilterNameSeg = tf; + } + + private com.sun.rave.web.ui.component.Calendar calFilterDateSeg = new com.sun.rave.web.ui.component.Calendar(); + public com.sun.rave.web.ui.component.Calendar getCalFilterDateSeg() + { + return this.calFilterDateSeg; + } + public void setCalFilterDateSeg( com.sun.rave.web.ui.component.Calendar c ) + { + this.calFilterDateSeg = c; + } + + private TextField textFilterPORSeg = new TextField(); + + public TextField getTextFilterPORSeg() { + return textFilterPORSeg; + } + + public void setTextFilterPORSeg(TextField textFilterPORSeg) { + this.textFilterPORSeg = textFilterPORSeg; + } + + + private Button buttonFilterSeg = new Button(); + public Button getButtonFilterSeg() + { + return this.buttonFilterSeg; + } + public void setButtonFilterSeg( Button b ) + { + this.buttonFilterSeg = b; + } + + private static final DateFormat D_F = new SimpleDateFormat( "yyyy-MM-dd" ); + //
+ + /** + *

Construct a new Page bean instance.

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

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("FormMedico 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() ); + + HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); + String referer = request.getRequestURI(); + String pageFrom = Utils.getPageFrom(referer); + if(!pageFrom.matches("FormMedico.jsp")) + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + //lblActivos.setRendered(true); + table1.setRendered(true); + + //ArrayList actuaisList = adp.getAnalisesActuaisList(getSessionBean1().getCurrentUser().getEstabelecimento_id(), new Integer(5)); + // ArrayList actuaisList = adp.getAnalisesActuaisMedicoList( getSessionBean1().getCurrentUser().getEstabelecimento_id() ); + // getSessionBean1().getAnalisesActualDataProvider().setList(actuaisList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table1.setRendered(false); + ex.printStackTrace(); + } + + table2.setRendered(false); + + try + { + //lblActivos.setRendered(true); + table2.setRendered(true); + + ArrayList seguimentoList = adp.getAnalisesSeguimentoMedList(getSessionBean1().getCurrentUser().getEstabelecimento_id()); + getSessionBean1().getAnalisesSeguimentoDataProvider().setList(seguimentoList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table2.setRendered(false); + ex.printStackTrace(); + } + + 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 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 lnkEditUser_action() { + // TODO: Replace with your code + + getSessionBean1().setNavFrom("FormMedico"); + getSessionBean1().setModoEdicaoUtilizador("edit"); + return "user"; + } + + public String lnkLogout_action() { + // TODO: Replace with your code + + try + { + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + } + catch(Exception ex){} + + return "login"; + } + + public String lnkDataAcidente_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormMedico"); + return "analise_acidente"; + } + + public String lnkNr_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormMedico"); + return "analise_acidente"; + } + + public String lnkNomeAcidentado_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormMedico"); + 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; + } + + private AnaliseAcidente getTableConcluidasRowData() + { + RowKey rk = tableRowGroup3.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + AnalisesConcluidasDataProvider provider = (AnalisesConcluidasDataProvider) tableRowGroup3.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("FormMedico"); + return "view_analise"; + } + + public String lnkNrSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormMedico"); + return "view_analise"; + } + + public String lnkNomeAcidentadoSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormMedico"); + 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 por = null; + if(txtPor.getText() != null) + { + por = (String) txtPor.getText(); + if(por.trim().length() == 0) + { + por = null; + } + } + + String nome = null; + if(txtNome.getText() != null) + { + nome = (String) txtNome.getText(); + if(nome.trim().length() == 0) + { + nome = null; + } + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + + //getSessionBean1().getAnalisesConcluidasDataProvider().setList(new ArrayList()); + ArrayList concluidasList = adp.searchAanalisesConcluidasList( + getSessionBean1().getCurrentUser().getEstabelecimento_id(), + ano, mes, dia, por, nome, null + ); + + 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 void fillAnoDropDown() + { +// ArrayList anosList = new ArrayList(); +// for(int ano=2007; ano<2051; ano++) +// { +// anosList.add(new Integer(ano)); +// } + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList anosList = adp.getAnosListFromAnalises(); + 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) ); + + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + } + + + 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() + { + + } + + public String lnkDataConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormMedico"); + return "view_analise"; + } + + public String lnkNrConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormMedico"); + return "view_analise"; + } + + public String lnkNomeConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormMedico"); + return "view_analise"; + } + + public String lnkFase_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormMedico"); + return "analise_acidente"; + } + + public String lnkEstabelecimento_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormMedico"); + return "analise_acidente"; + } + + public String lnkFaseSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormMedico"); + return "view_analise"; + } + + public String lnkEstabelecimentoSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormMedico"); + return "view_analise"; + } + + public String lnkPor_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormMedico"); + return "analise_acidente"; + } + + public String lnkPorSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormMedico"); + return "view_analise"; + } + + public String lnkPorConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormMedico"); + return "view_analise"; + } + + public String lnkEstabConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormMedico"); + return "view_analise"; + } + + + + + public String buttonFilterActual_action() + { + Date visitaDate = ( Date ) calFilterDateActual.getValue(); + String visitaDateStr = null; + if ( visitaDate != null ) + { + visitaDateStr = D_F.format( visitaDate ); + } + + String POR = null; + if ( textFilterPORActual.getText() != null ) + { + POR = ( ( String ) textFilterPORActual.getText() ).trim(); + if ( POR.length() == 0 ) + { + POR = null; + } + } + + String nome = null; + if ( textFilterNameActual.getText() != null ) + { + nome = (( String ) textFilterNameActual.getText()).trim(); + if( nome.length() == 0 ) + { + nome = null; + } + } + +// AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { +// ArrayList actualList = adp.searchAnalisesActuaisMedico( +// getSessionBean1().getCurrentUser().getEstabelecimento_id(), nome, visitaDateStr ); + + table1.setRendered( true ); + txtSearchMsg.setRendered( false ); +// getSessionBean1().getAnalisesActualDataProvider().setList( actualList ); + } + catch( Exception e ) + { + table1.setRendered( false ); + txtSearchMsg.setRendered( true ); + txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + } + + return null; + } + + public String buttonFilterSeg_action() + { + Date visitaDate = ( Date ) calFilterDateSeg.getValue(); + String visitaDateStr = null; + if ( visitaDate != null ) + { + visitaDateStr = D_F.format( visitaDate ); + } + + String POR = null; + if ( textFilterPORSeg.getText() != null ) + { + POR = ( ( String ) textFilterPORSeg.getText() ).trim(); + if ( POR.length() == 0 ) + { + POR = null; + } + } + + String nome = null; + if ( textFilterNameSeg.getText() != null ) + { + nome = (( String ) textFilterNameSeg.getText()).trim(); + if( nome.length() == 0 ) + { + nome = null; + } + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList seguimentoList = adp.searchAnalisesSeguimentoMedico( + getSessionBean1().getCurrentUser().getEstabelecimento_id(), + nome, visitaDateStr, POR ); + + table2.setRendered( true ); + txtSearchMsg.setRendered( false ); + getSessionBean1().getAnalisesSeguimentoDataProvider().setList( seguimentoList ); + } + catch( Exception e ) + { + table2.setRendered( false ); + txtSearchMsg.setRendered( true ); + txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + } + + return null; + } + +} + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormRH.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormRH.java new file mode 100644 index 00000000..dea9ff6d --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormRH.java @@ -0,0 +1,2021 @@ +/* + * FormRH.java + * + * Created on October 1, 2007, 11:43 AM + * 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.AnalisesConcluidasDataProvider; +import db.AnalisesDataProvider; +import db.AnalisesSeguimentoDataProvider; +import global.Global; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.ListIterator; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.context.FacesContext; +import javax.faces.event.ValueChangeEvent; +import javax.servlet.http.HttpServletRequest; +import utils.Utils; + +/** + *

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 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 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 lnkDataConcluida = new Hyperlink(); + + public Hyperlink getLnkDataConcluida() { + return lnkDataConcluida; + } + + public void setLnkDataConcluida(Hyperlink h) { + this.lnkDataConcluida = h; + } + + private TableColumn tableColumn8 = new TableColumn(); + + public TableColumn getTableColumn8() { + return tableColumn8; + } + + public void setTableColumn8(TableColumn tc) { + this.tableColumn8 = tc; + } + + private Hyperlink lnkNrConcluida = new Hyperlink(); + + public Hyperlink getLnkNrConcluida() { + return lnkNrConcluida; + } + + public void setLnkNrConcluida(Hyperlink h) { + this.lnkNrConcluida = h; + } + + private TableColumn tableColumn9 = new TableColumn(); + + public TableColumn getTableColumn9() { + return tableColumn9; + } + + public void setTableColumn9(TableColumn tc) { + this.tableColumn9 = tc; + } + + private Hyperlink lnkNomeConcluida = new Hyperlink(); + + public Hyperlink getLnkNomeConcluida() { + return lnkNomeConcluida; + } + + public void setLnkNomeConcluida(Hyperlink h) { + this.lnkNomeConcluida = h; + } + + private StaticText txtSearchMsg = new StaticText(); + + public StaticText getTxtSearchMsg() { + return txtSearchMsg; + } + + public void setTxtSearchMsg(StaticText st) { + this.txtSearchMsg = st; + } + + private TableColumn tableColumn10 = new TableColumn(); + + public TableColumn getTableColumn10() { + return tableColumn10; + } + + public void setTableColumn10(TableColumn tc) { + this.tableColumn10 = tc; + } + + private Hyperlink lnkFase = new Hyperlink(); + + public Hyperlink getLnkFase() { + return lnkFase; + } + + public void setLnkFase(Hyperlink h) { + this.lnkFase = h; + } + + private Hyperlink lnkEstabelecimento = new Hyperlink(); + + public Hyperlink getLnkEstabelecimento() { + return lnkEstabelecimento; + } + + public void setLnkEstabelecimento(Hyperlink h) { + this.lnkEstabelecimento = h; + } + + private TableColumn tableColumn11 = new TableColumn(); + + public TableColumn getTableColumn11() { + return tableColumn11; + } + + public void setTableColumn11(TableColumn tc) { + this.tableColumn11 = tc; + } + + private Hyperlink lnkFaseSeg = new Hyperlink(); + + public Hyperlink getLnkFaseSeg() { + return lnkFaseSeg; + } + + public void setLnkFaseSeg(Hyperlink h) { + this.lnkFaseSeg = h; + } + + private Hyperlink lnkEstabelecimentoSeg = new Hyperlink(); + + public Hyperlink getLnkEstabelecimentoSeg() { + return lnkEstabelecimentoSeg; + } + + public void setLnkEstabelecimentoSeg(Hyperlink h) { + this.lnkEstabelecimentoSeg = h; + } + + + private TableColumn tableColumn12 = new TableColumn(); + + public TableColumn getTableColumn12() { + return tableColumn12; + } + + public void setTableColumn12(TableColumn tc) { + this.tableColumn12 = tc; + } + + private TableColumn tableColumn13 = new TableColumn(); + + public TableColumn getTableColumn13() { + return tableColumn13; + } + + public void setTableColumn13(TableColumn tc) { + this.tableColumn13 = tc; + } + + private TableColumn tableColumn14 = new TableColumn(); + + public TableColumn getTableColumn14() { + return tableColumn14; + } + + public void setTableColumn14(TableColumn tc) { + this.tableColumn14 = tc; + } + + private TableColumn tableColumn15 = new TableColumn(); + + public TableColumn getTableColumn15() { + return tableColumn15; + } + + public void setTableColumn15(TableColumn tc) { + this.tableColumn15 = tc; + } + + private Hyperlink lnkPor = new Hyperlink(); + + public Hyperlink getLnkPor() { + return lnkPor; + } + + public void setLnkPor(Hyperlink h) { + this.lnkPor = h; + } + + private Hyperlink lnkPorSeg = new Hyperlink(); + + public Hyperlink getLnkPorSeg() { + return lnkPorSeg; + } + + public void setLnkPorSeg(Hyperlink h) { + this.lnkPorSeg = h; + } + + private Hyperlink lnkPorConcluida = new Hyperlink(); + + public Hyperlink getLnkPorConcluida() { + return lnkPorConcluida; + } + + public void setLnkPorConcluida(Hyperlink h) { + this.lnkPorConcluida = h; + } + + private Hyperlink lnkEstabConcluida = new Hyperlink(); + + public Hyperlink getLnkEstabConcluida() { + return lnkEstabConcluida; + } + + public void setLnkEstabConcluida(Hyperlink h) { + this.lnkEstabConcluida = h; + } + + private PanelGroup groupPanel7 = new PanelGroup(); + + public PanelGroup getGroupPanel7() { + return groupPanel7; + } + + public void setGroupPanel7(PanelGroup pg) { + this.groupPanel7 = pg; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private TextField txtPor = new TextField(); + + public TextField getTxtPor() { + return txtPor; + } + + public void setTxtPor(TextField tf) { + this.txtPor = tf; + } + + private HtmlPanelGrid gridPanel9 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel9() { + return gridPanel9; + } + + public void setGridPanel9(HtmlPanelGrid hpg) { + this.gridPanel9 = hpg; + } + + private PanelGroup groupPanel8 = new PanelGroup(); + + public PanelGroup getGroupPanel8() { + return groupPanel8; + } + + public void setGroupPanel8(PanelGroup pg) { + this.groupPanel8 = pg; + } + + private StaticText staticText1 = new StaticText(); + + public StaticText getStaticText1() { + return staticText1; + } + + public void setStaticText1(StaticText st) { + this.staticText1 = st; + } + + private ImageComponent image3 = new ImageComponent(); + + public ImageComponent getImage3() { + return image3; + } + + public void setImage3(ImageComponent ic) { + this.image3 = ic; + } + + private StaticText staticText10 = new StaticText(); + + public StaticText getStaticText10() { + return staticText10; + } + + public void setStaticText10(StaticText st) { + this.staticText10 = st; + } + + private HtmlPanelGrid gridPanel10 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel10() { + return gridPanel10; + } + + public void setGridPanel10(HtmlPanelGrid hpg) { + this.gridPanel10 = hpg; + } + + private StaticText txtMsg1 = new StaticText(); + + public StaticText getTxtMsg1() { + return txtMsg1; + } + + public void setTxtMsg1(StaticText st) { + this.txtMsg1 = st; + } + + private TableColumn tableColumn16 = new TableColumn(); + + public TableColumn getTableColumn16() { + return tableColumn16; + } + + public void setTableColumn16(TableColumn tc) { + this.tableColumn16 = tc; + } + + private Hyperlink lnkDataAbertura = new Hyperlink(); + + public Hyperlink getLnkDataAbertura() { + return lnkDataAbertura; + } + + public void setLnkDataAbertura(Hyperlink h) { + this.lnkDataAbertura = h; + } + + private TableColumn tableColumn17 = new TableColumn(); + + public TableColumn getTableColumn17() { + return tableColumn17; + } + + public void setTableColumn17(TableColumn tc) { + this.tableColumn17 = tc; + } + + private Hyperlink lnkDataAberturaSeg = new Hyperlink(); + + public Hyperlink getLnkDataAberturaSeg() { + return lnkDataAberturaSeg; + } + + public void setLnkDataAberturaSeg(Hyperlink h) { + this.lnkDataAberturaSeg = h; + } + + private TableColumn tableColumn18 = new TableColumn(); + + public TableColumn getTableColumn18() { + return tableColumn18; + } + + public void setTableColumn18(TableColumn tc) { + this.tableColumn18 = tc; + } + + private TableColumn tableColumn19 = new TableColumn(); + + public TableColumn getTableColumn19() { + return tableColumn19; + } + + public void setTableColumn19(TableColumn tc) { + this.tableColumn19 = tc; + } + + private TableColumn tableColumn20 = new TableColumn(); + + public TableColumn getTableColumn20() { + return tableColumn20; + } + + public void setTableColumn20(TableColumn tc) { + this.tableColumn20 = tc; + } + + private Hyperlink lnkDataAberturaConcluida = new Hyperlink(); + + public Hyperlink getLnkDataAberturaConcluida() { + return lnkDataAberturaConcluida; + } + + public void setLnkDataAberturaConcluida(Hyperlink h) { + this.lnkDataAberturaConcluida = h; + } + private Hyperlink lnkPlanosActuacao = new Hyperlink(); + + public Hyperlink getLnkPlanosActuacao() { + return lnkPlanosActuacao; + } + + public void setLnkPlanosActuacao(Hyperlink h) { + this.lnkPlanosActuacao = h; + } + private StaticText lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + + + + private HtmlPanelGrid gridPanelFilterActual = new HtmlPanelGrid(); + public HtmlPanelGrid getGridPanelFilterActual() + { + return this.gridPanelFilterActual; + } + public void setGridPanelFilterActual( HtmlPanelGrid pg ) + { + this.gridPanelFilterActual = pg; + } + + private PanelGroup groupPanelFilterActual = new PanelGroup(); + public PanelGroup getGroupPanelFilterActual() + { + return this.groupPanelFilterActual; + } + public void setGroupPanelFilterActual( PanelGroup pg ) + { + this.groupPanelFilterActual = pg; + } + + private StaticText labelFilterNameActual = new StaticText(); + public StaticText getLabelFilterNameActual() + { + return this.labelFilterNameActual; + } + public void setLabelFilterNameActual( StaticText st ) + { + this.labelFilterNameActual = st; + } + + private TextField textFilterNameActual = new TextField(); + public TextField getTextFilterNameActual() + { + return this.textFilterNameActual; + } + public void setTextFilterNameActual( TextField tf ) + { + this.textFilterNameActual = tf; + } + private com.sun.rave.web.ui.component.Calendar calFilterDateActual = new com.sun.rave.web.ui.component.Calendar(); + public com.sun.rave.web.ui.component.Calendar getCalFilterDateActual() + { + return this.calFilterDateActual; + } + public void setCalFilterDateActual( com.sun.rave.web.ui.component.Calendar c ) + { + this.calFilterDateActual = c; + } + + private TextField textFilterPORActual = new TextField(); + + public TextField getTextFilterPORActual() { + return textFilterPORActual; + } + + public void setTextFilterPORActual(TextField textFilterPORActual) { + this.textFilterPORActual = textFilterPORActual; + } + + + private Button buttonFilterActual = new Button(); + public Button getButtonFilterActual() + { + return this.buttonFilterActual; + } + public void setButtonFilterActual( Button b ) + { + this.buttonFilterActual = b; + } + + private HtmlPanelGrid gridPanelFilterSeg = new HtmlPanelGrid(); + public HtmlPanelGrid getGridPanelFilterSeg() + { + return this.gridPanelFilterSeg; + } + public void setGridPanelFilterSeg( HtmlPanelGrid pg ) + { + this.gridPanelFilterSeg = pg; + } + + private PanelGroup groupPanelFilterSeg = new PanelGroup(); + public PanelGroup getGroupPanelFilterSeg() + { + return this.groupPanelFilterSeg; + } + public void setGroupPanelFilterSeg( PanelGroup pg ) + { + this.groupPanelFilterSeg = pg; + } + + private StaticText labelFilterNameSeg = new StaticText(); + public StaticText getLabelFilterNameSeg() + { + return this.labelFilterNameSeg; + } + public void setLabelFilterNameSeg( StaticText st ) + { + this.labelFilterNameSeg = st; + } + + private TextField textFilterNameSeg = new TextField(); + public TextField getTextFilterNameSeg() + { + return this.textFilterNameSeg; + } + public void setTextFilterNameSeg( TextField tf ) + { + this.textFilterNameSeg = tf; + } + + private com.sun.rave.web.ui.component.Calendar calFilterDateSeg = new com.sun.rave.web.ui.component.Calendar(); + public com.sun.rave.web.ui.component.Calendar getCalFilterDateSeg() + { + return this.calFilterDateSeg; + } + public void setCalFilterDateSeg( com.sun.rave.web.ui.component.Calendar c ) + { + this.calFilterDateSeg = c; + } + + private TextField textFilterPORSeg = new TextField(); + + public TextField getTextFilterPORSeg() { + return textFilterPORSeg; + } + + public void setTextFilterPORSeg(TextField textFilterPORSeg) { + this.textFilterPORSeg = textFilterPORSeg; + } + + + private Button buttonFilterSeg = new Button(); + public Button getButtonFilterSeg() + { + return this.buttonFilterSeg; + } + public void setButtonFilterSeg( Button b ) + { + this.buttonFilterSeg = b; + } + + + private static final DateFormat D_F = new SimpleDateFormat( "yyyy-MM-dd" ); + //
+ + /** + *

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() { + System.out.println("=== FORM_RH ==="); + lblUser.setText( getSessionBean1().getCurrentUser().getLogin() ); + + String responsavel_loja = getSessionBean1().getCurrentUser().getResponsavel_loja(); + if(responsavel_loja.matches("n")) + { + lnkPlanosActuacao.setDisabled(true); + } +// if(getSessionBean1().getCurrentUser().getTipo().intValue() == 7) // director rh +// { +// //////stSep.setText("|"); +// } +// else //rh +// { +// //////stSep.setText(" "); +// //////lnkNewUser.setRendered(false); +// stSep1.setRendered(false); +// } + + + HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); + String referer = request.getRequestURI(); + String pageFrom = Utils.getPageFrom(referer); + if(!pageFrom.matches("FormRH.jsp")) + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + //lblActivos.setRendered(true); + table1.setRendered(true); + + //ArrayList actuaisList = adp.getAnalisesActuaisList(getSessionBean1().getCurrentUser().getEstabelecimento_id()); + ArrayList actuaisList = adp.getAnalisesActuaisRhList(getSessionBean1().getCurrentUser().getEstabelecimento_id(), responsavel_loja); + 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.getAnalisesSeguimentoRhList(getSessionBean1().getCurrentUser().getEstabelecimento_id(), responsavel_loja); + getSessionBean1().getAnalisesSeguimentoDataProvider().setList(seguimentoList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table2.setRendered(false); + //ex.printStackTrace(); + } + + 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(); + } + + txtMsg1.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 lnkLogout_action() { + // TODO: Replace with your code + + try + { + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + } + catch(Exception ex){} + + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) {} + //return "login"; + return null; + } + + 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("FormRH"); + return "analise_acidente"; + } + + public String lnkDataAbertura_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormRH"); + return "analise_acidente"; + } + + public String lnkNr_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormRH"); + return "analise_acidente"; + } + + public String lnkNomeAcidentado_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormRH"); + 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("FormRH"); + return "view_analise"; + } + + public String lnkDataAberturaSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormRH"); + return "view_analise"; + } + + public String lnkNrSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormRH"); + return "view_analise"; + } + + + public String lnkNomeAcidentadoSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormRH"); + 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; + } + + private AnaliseAcidente getTableConcluidasRowData() + { + RowKey rk = tableRowGroup3.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + AnalisesConcluidasDataProvider provider = (AnalisesConcluidasDataProvider) tableRowGroup3.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 por = null; + if(txtPor.getText() != null) + { + por = (String) txtPor.getText(); + if(por.trim().length() == 0) + { + por = null; + } + } + + String nome = null; + if(txtNome.getText() != null) + { + nome = (String) txtNome.getText(); + if(nome.trim().length() == 0) + { + nome = null; + } + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + + //getSessionBean1().getAnalisesConcluidasDataProvider().setList(new ArrayList()); + ArrayList concluidasList = adp.searchAanalisesConcluidasList( + getSessionBean1().getCurrentUser().getEstabelecimento_id(), + ano, mes, dia, por, nome, null ); + + 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)); +// } + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList anosList = adp.getAnosListFromAnalises(); + 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) ); + + } + catch(Exception ex) + { + //ex.printStackTrace(); + } + + } + + + 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 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 lnkDataConcluida = new Hyperlink(); + + public Hyperlink getLnkDataConcluida() { + return lnkDataConcluida; + } + + public void setLnkDataConcluida(Hyperlink h) { + this.lnkDataConcluida = h; + } + + private Hyperlink lnkNrConcluida = new Hyperlink(); + + public Hyperlink getLnkNrConcluida() { + return lnkNrConcluida; + } + + public void setLnkNrConcluida(Hyperlink h) { + this.lnkNrConcluida = h; + } + + private Hyperlink lnkNomeConcluida = new Hyperlink(); + + public Hyperlink getLnkNomeConcluida() { + return lnkNomeConcluida; + } + + public void setLnkNomeConcluida(Hyperlink h) { + this.lnkNomeConcluida = h; + } + + private StaticText txtSearchMsg = new StaticText(); + + public StaticText getTxtSearchMsg() { + return txtSearchMsg; + } + + public void setTxtSearchMsg(StaticText st) { + this.txtSearchMsg = st; + } + + private TableColumn tableColumn10 = new TableColumn(); + + public TableColumn getTableColumn10() { + return tableColumn10; + } + + public void setTableColumn10(TableColumn tc) { + this.tableColumn10 = tc; + } + + private TableColumn tableColumn11 = new TableColumn(); + + public TableColumn getTableColumn11() { + return tableColumn11; + } + + public void setTableColumn11(TableColumn tc) { + this.tableColumn11 = tc; + } + + private Hyperlink lnkFase = new Hyperlink(); + + public Hyperlink getLnkFase() { + return lnkFase; + } + + public void setLnkFase(Hyperlink h) { + this.lnkFase = h; + } + + private Hyperlink lnkEstabelecimento = new Hyperlink(); + + public Hyperlink getLnkEstabelecimento() { + return lnkEstabelecimento; + } + + public void setLnkEstabelecimento(Hyperlink h) { + this.lnkEstabelecimento = h; + } + + private Hyperlink lnkFaseSeg = new Hyperlink(); + + public Hyperlink getLnkFaseSeg() { + return lnkFaseSeg; + } + + public void setLnkFaseSeg(Hyperlink h) { + this.lnkFaseSeg = h; + } + + private Hyperlink lnkEstabelecimentoSeg = new Hyperlink(); + + public Hyperlink getLnkEstabelecimentoSeg() { + return lnkEstabelecimentoSeg; + } + + public void setLnkEstabelecimentoSeg(Hyperlink h) { + this.lnkEstabelecimentoSeg = h; + } + + private TableColumn tableColumn12 = new TableColumn(); + + public TableColumn getTableColumn12() { + return tableColumn12; + } + + public void setTableColumn12(TableColumn tc) { + this.tableColumn12 = tc; + } + + private TableColumn tableColumn13 = new TableColumn(); + + public TableColumn getTableColumn13() { + return tableColumn13; + } + + public void setTableColumn13(TableColumn tc) { + this.tableColumn13 = tc; + } + + private TableColumn tableColumn14 = new TableColumn(); + + public TableColumn getTableColumn14() { + return tableColumn14; + } + + public void setTableColumn14(TableColumn tc) { + this.tableColumn14 = tc; + } + + private TableColumn tableColumn15 = new TableColumn(); + + public TableColumn getTableColumn15() { + return tableColumn15; + } + + public void setTableColumn15(TableColumn tc) { + this.tableColumn15 = tc; + } + + private Hyperlink lnkPor = new Hyperlink(); + + public Hyperlink getLnkPor() { + return lnkPor; + } + + public void setLnkPor(Hyperlink h) { + this.lnkPor = h; + } + + private Hyperlink lnkPorSeg = new Hyperlink(); + + public Hyperlink getLnkPorSeg() { + return lnkPorSeg; + } + + public void setLnkPorSeg(Hyperlink h) { + this.lnkPorSeg = h; + } + + private Hyperlink lnkPorConcluida = new Hyperlink(); + + public Hyperlink getLnkPorConcluida() { + return lnkPorConcluida; + } + + public void setLnkPorConcluida(Hyperlink h) { + this.lnkPorConcluida = h; + } + + private Hyperlink lnkEstabConcluida = new Hyperlink(); + + public Hyperlink getLnkEstabConcluida() { + return lnkEstabConcluida; + } + + public void setLnkEstabConcluida(Hyperlink h) { + this.lnkEstabConcluida = h; + } + + private PanelGroup groupPanel7 = new PanelGroup(); + + public PanelGroup getGroupPanel7() { + return groupPanel7; + } + + public void setGroupPanel7(PanelGroup pg) { + this.groupPanel7 = pg; + } + + private StaticText staticText5 = new StaticText(); + + public StaticText getStaticText5() { + return staticText5; + } + + public void setStaticText5(StaticText st) { + this.staticText5 = st; + } + + private TextField txtPor = new TextField(); + + public TextField getTxtPor() { + return txtPor; + } + + public void setTxtPor(TextField tf) { + this.txtPor = tf; + } + + private HtmlPanelGrid gridPanel9 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel9() { + return gridPanel9; + } + + public void setGridPanel9(HtmlPanelGrid hpg) { + this.gridPanel9 = hpg; + } + + private PanelGroup groupPanel8 = new PanelGroup(); + + public PanelGroup getGroupPanel8() { + return groupPanel8; + } + + public void setGroupPanel8(PanelGroup pg) { + this.groupPanel8 = pg; + } + + private StaticText staticText6 = new StaticText(); + + public StaticText getStaticText6() { + return staticText6; + } + + public void setStaticText6(StaticText st) { + this.staticText6 = st; + } + + private ImageComponent image3 = new ImageComponent(); + + public ImageComponent getImage3() { + return image3; + } + + public void setImage3(ImageComponent ic) { + this.image3 = ic; + } + + 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 HtmlPanelGrid gridPanel10 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel10() { + return gridPanel10; + } + + public void setGridPanel10(HtmlPanelGrid hpg) { + this.gridPanel10 = hpg; + } + + private StaticText txtMsg = new StaticText(); + + public StaticText getTxtMsg() { + return txtMsg; + } + + public void setTxtMsg(StaticText st) { + this.txtMsg = st; + } + + private TableColumn tableColumn16 = new TableColumn(); + + public TableColumn getTableColumn16() { + return tableColumn16; + } + + public void setTableColumn16(TableColumn tc) { + this.tableColumn16 = tc; + } + + private Hyperlink lnkDataAbertura = new Hyperlink(); + + public Hyperlink getLnkDataAbertura() { + return lnkDataAbertura; + } + + public void setLnkDataAbertura(Hyperlink h) { + this.lnkDataAbertura = h; + } + + private TableColumn tableColumn17 = new TableColumn(); + + public TableColumn getTableColumn17() { + return tableColumn17; + } + + public void setTableColumn17(TableColumn tc) { + this.tableColumn17 = tc; + } + + private Hyperlink lnkDataAberturaSeg = new Hyperlink(); + + public Hyperlink getLnkDataAberturaSeg() { + return lnkDataAberturaSeg; + } + + public void setLnkDataAberturaSeg(Hyperlink h) { + this.lnkDataAberturaSeg = h; + } + + private TableColumn tableColumn18 = new TableColumn(); + + public TableColumn getTableColumn18() { + return tableColumn18; + } + + public void setTableColumn18(TableColumn tc) { + this.tableColumn18 = tc; + } + + + private TableColumn tableColumn19 = new TableColumn(); + + public TableColumn getTableColumn19() { + return tableColumn19; + } + + public void setTableColumn19(TableColumn tc) { + this.tableColumn19 = tc; + } + + private TableColumn tableColumn20 = new TableColumn(); + + public TableColumn getTableColumn20() { + return tableColumn20; + } + + public void setTableColumn20(TableColumn tc) { + this.tableColumn20 = tc; + } + + private Hyperlink lnkDataAberturaConcluida = new Hyperlink(); + + public Hyperlink getLnkDataAberturaConcluida() { + return lnkDataAberturaConcluida; + } + + public void setLnkDataAberturaConcluida(Hyperlink h) { + this.lnkDataAberturaConcluida = h; + } + private StaticText lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + private Hyperlink lnkPlanosActuacao = new Hyperlink(); + + public Hyperlink getLnkPlanosActuacao() { + return lnkPlanosActuacao; + } + + public void setLnkPlanosActuacao(Hyperlink h) { + this.lnkPlanosActuacao = h; + } + + + private HtmlPanelGrid gridPanelFilterSeg = new HtmlPanelGrid(); + public HtmlPanelGrid getGridPanelFilterSeg() + { + return this.gridPanelFilterSeg; + } + public void setGridPanelFilterSeg( HtmlPanelGrid pg ) + { + this.gridPanelFilterSeg = pg; + } + + private PanelGroup groupPanelFilterSeg = new PanelGroup(); + public PanelGroup getGroupPanelFilterSeg() + { + return this.groupPanelFilterSeg; + } + public void setGroupPanelFilterSeg( PanelGroup pg ) + { + this.groupPanelFilterSeg = pg; + } + + private StaticText labelFilterNameSeg = new StaticText(); + public StaticText getLabelFilterNameSeg() + { + return this.labelFilterNameSeg; + } + public void setLabelFilterNameSeg( StaticText st ) + { + this.labelFilterNameSeg = st; + } + + private TextField textFilterNameSeg = new TextField(); + public TextField getTextFilterNameSeg() + { + return this.textFilterNameSeg; + } + public void setTextFilterNameSeg( TextField tf ) + { + this.textFilterNameSeg = tf; + } + + private com.sun.rave.web.ui.component.Calendar calFilterDateSeg = new com.sun.rave.web.ui.component.Calendar(); + public com.sun.rave.web.ui.component.Calendar getCalFilterDateSeg() + { + return this.calFilterDateSeg; + } + public void setCalFilterDateSeg( com.sun.rave.web.ui.component.Calendar c ) + { + this.calFilterDateSeg = c; + } + + private TextField textFilterPORSeg = new TextField(); + + public TextField getTextFilterPORSeg() { + return textFilterPORSeg; + } + + public void setTextFilterPORSeg(TextField textFilterPORSeg) { + this.textFilterPORSeg = textFilterPORSeg; + } + + + private Button buttonFilterSeg = new Button(); + public Button getButtonFilterSeg() + { + return this.buttonFilterSeg; + } + public void setButtonFilterSeg( Button b ) + { + this.buttonFilterSeg = b; + } + + + private HtmlPanelGrid gridPanelFilterActual = new HtmlPanelGrid(); + public HtmlPanelGrid getGridPanelFilterActual() + { + return this.gridPanelFilterActual; + } + public void setGridPanelFilterActual( HtmlPanelGrid pg ) + { + this.gridPanelFilterActual = pg; + } + + private PanelGroup groupPanelFilterActual = new PanelGroup(); + public PanelGroup getGroupPanelFilterActual() + { + return this.groupPanelFilterActual; + } + public void setGroupPanelFilterActual( PanelGroup pg ) + { + this.groupPanelFilterActual = pg; + } + + private StaticText labelFilterNameActual = new StaticText(); + public StaticText getLabelFilterNameActual() + { + return this.labelFilterNameActual; + } + public void setLabelFilterNameActual( StaticText st ) + { + this.labelFilterNameActual = st; + } + + private TextField textFilterNameActual = new TextField(); + public TextField getTextFilterNameActual() + { + return this.textFilterNameActual; + } + public void setTextFilterNameActual( TextField tf ) + { + this.textFilterNameActual = tf; + } + + private com.sun.rave.web.ui.component.Calendar calFilterDateActual = new com.sun.rave.web.ui.component.Calendar(); + public com.sun.rave.web.ui.component.Calendar getCalFilterDateActual() + { + return this.calFilterDateActual; + } + public void setCalFilterDateActual( com.sun.rave.web.ui.component.Calendar c ) + { + this.calFilterDateActual = c; + } + + private TextField textFilterPORActual = new TextField(); + + public TextField getTextFilterPORActual() { + return textFilterPORActual; + } + + public void setTextFilterPORActual(TextField textFilterPORActual) { + this.textFilterPORActual = textFilterPORActual; + } + + + private Button buttonFilterActual = new Button(); + public Button getButtonFilterActual() + { + return this.buttonFilterActual; + } + public void setButtonFilterActual( Button b ) + { + this.buttonFilterActual = b; + } + + private static final DateFormat D_F = new SimpleDateFormat( "yyyy-MM-dd" ); + //
+ + /** + *

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() { + System.out.println("=== FORM_SEGURANCA ==="); + lblUser.setText( getSessionBean1().getCurrentUser().getLogin()); + String responsavel_loja = getSessionBean1().getCurrentUser().getResponsavel_loja(); + if(responsavel_loja.matches("n")) + { + lnkPlanosActuacao.setDisabled(true); + } + + + HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); + String referer = request.getRequestURI(); + String pageFrom = Utils.getPageFrom(referer); + if( ! pageFrom.matches( "FormSeguranca.jsp" ) ) + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + //lblActivos.setRendered(true); + table1.setRendered(true); + + //ArrayList actuaisList = adp.getAnalisesActuaisList(getSessionBean1().getCurrentUser().getEstabelecimento_id(), new Integer(1)); + ArrayList actuaisList = adp.getAnalisesActuaisSegList( getSessionBean1().getCurrentUser().getEstabelecimento_id(), responsavel_loja ); + 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.getAnalisesSeguimentoSegList( + getSessionBean1().getCurrentUser().getEstabelecimento_id(), responsavel_loja ); + getSessionBean1().getAnalisesSeguimentoDataProvider().setList( seguimentoList ); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table2.setRendered(false); + //ex.printStackTrace(); + } + + 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(); + } + 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() { + } + + +// 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)); +// } + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList anosList = adp.getAnosListFromAnalises(); + 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) ); + + } + catch(Exception ex) + { + //ex.printStackTrace(); + } + + } + + 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 + try + { + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + } + catch(Exception ex){} + + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) {} + //return "login"; + return null; + } + + 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 buttonFilterActual_action() + { + Date visitaDate = ( Date ) calFilterDateActual.getValue(); + String visitaDateStr = null; + if ( visitaDate != null ) + { + visitaDateStr = D_F.format( visitaDate ); + } + + String POR = null; + if ( textFilterPORActual.getText() != null ) + { + POR = ( ( String ) textFilterPORActual.getText() ).trim(); + if ( POR.length() == 0 ) + { + POR = null; + } + } + + String nome = null; + if ( textFilterNameActual.getText() != null ) + { + nome = (( String ) textFilterNameActual.getText()).trim(); + if( nome.length() == 0 ) + { + nome = null; + } + } + + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList actualList = adp.searchAnalisesActualSeg( + getSessionBean1().getCurrentUser().getEstabelecimento_id(), + nome, visitaDateStr, POR, + getSessionBean1().getCurrentUser().getResponsavel_loja() ); + + table1.setRendered( true ); + txtSearchMsg.setRendered( false ); + getSessionBean1().getAnalisesActualDataProvider().setList( actualList ); + } + catch( Exception e ) + { + table1.setRendered( false ); + txtSearchMsg.setRendered( true ); + txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + } + + return null; + } + + public String buttonFilterSeg_action() + { + Date visitaDate = ( Date ) calFilterDateSeg.getValue(); + String visitaDateStr = null; + if ( visitaDate != null ) + { + visitaDateStr = D_F.format( visitaDate ); + } + + String POR = null; + if ( textFilterPORSeg.getText() != null ) + { + POR = ( ( String ) textFilterPORSeg.getText() ).trim(); + if ( POR.length() == 0 ) + { + POR = null; + } + } + + String nome = null; + if ( textFilterNameSeg.getText() != null ) + { + nome = (( String ) textFilterNameSeg.getText()).trim(); + if( nome.length() == 0 ) + { + nome = null; + } + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList seguimentoList = adp.searchAnalisesSeguimentoSeg( + getSessionBean1().getCurrentUser().getEstabelecimento_id(), + nome, visitaDateStr, POR, + getSessionBean1().getCurrentUser().getResponsavel_loja() ); + + table2.setRendered( true ); + txtSearchMsg.setRendered( false ); + getSessionBean1().getAnalisesSeguimentoDataProvider().setList( seguimentoList ); + } + catch( Exception e ) + { + table2.setRendered( false ); + txtSearchMsg.setRendered( true ); + txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + } + + return null; + } + + 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 por = null; + if(txtPor.getText() != null) + { + por = (String) txtPor.getText(); + if(por.trim().length() == 0) + { + por = null; + } + } + + + String nome = null; + if(txtNome.getText() != null) + { + nome = (String) txtNome.getText(); + if(nome.trim().length() == 0) + { + nome = null; + } + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + + //getSessionBean1().getAnalisesConcluidasDataProvider().setList(new ArrayList()); + ArrayList concluidasList = adp.searchAanalisesConcluidasList( + getSessionBean1().getCurrentUser().getEstabelecimento_id(), + ano, mes, dia, por, nome, null ); + + 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 lnkDataAbertura_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 lnkDataAberturaSeg_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; + } + + private AnaliseAcidente getTableConcluidasRowData() + { + RowKey rk = tableRowGroup3.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + AnalisesConcluidasDataProvider provider = (AnalisesConcluidasDataProvider) tableRowGroup3.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + AnaliseAcidente a = (AnaliseAcidente)list.get(k); + return a; + } + + public String lnkEditUser_action() { + System.out.println("EDIT USER"); + // TODO: Replace with your code + getSessionBean1().setNavFrom("FormSeguranca"); + getSessionBean1().setModoEdicaoUtilizador("edit"); + return "user"; + } + + public String lnkDataConcluida_action() { + // TODO: Replace with your code + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + } + + public String lnkDataAberturaConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + } + + public String lnkNrConcluida_action() { + // TODO: Replace with your code + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + } + + public String lnkNomeConcluida_action() { + // TODO: Replace with your code + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + } + + public String lnkFase_action() { + // TODO: Replace with your code + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "analise_acidente"; + } + + public String lnkEstabelecimento_action() { + // TODO: Replace with your code + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "analise_acidente"; + } + + public String lnkFaseSeg_action() { + // TODO: Replace with your code + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + } + + public String lnkEstabelecimentoSeg_action() { + // TODO: Replace with your code + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + } + + public String lnkPor_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "analise_acidente"; } + + public String lnkPorSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + } + + public String lnkPorConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + } + + public String lnkEstabConcluida_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableConcluidasRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + } + + public String lnkNewUser_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkAjuda_action() { + System.out.println("AJUDA"); +// // TODO: Replace with your code +// ServletContext theApplicationsServletContext = +// (ServletContext) this.getExternalContext().getContext(); +// String pdfFolderPath = theApplicationsServletContext.getRealPath(Global.PDF_FOLDER_URL); +// String pdfFilePath = pdfFolderPath + "/Ajuda.pdf"; +// +// Global global = new Global(); +// try +// { +// global.showPdf(pdfFilePath); +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// return null; +// } + return null; + } + + private void showPdf(String pdfFilePath) throws Exception + { + + File pdfFile = new File(pdfFilePath); + FileInputStream fis = new FileInputStream(pdfFile); + byte[] buf = new byte[(int)pdfFile.length()]; + while ((fis.read(buf)) > 0) + { + //fos.write(buf, 0, buf.length); + } + fis.close(); + FacesContext ctx = FacesContext.getCurrentInstance(); + if (!ctx.getResponseComplete()) + { + HttpServletResponse response = (HttpServletResponse)ctx.getExternalContext().getResponse(); + String contentType = "application/pdf"; + response.setContentType(contentType); + response.setHeader("Content-Disposition","attachment;filename=\"" + "Ajuda.pdf" + "\""); + + ServletOutputStream out = response.getOutputStream(); + + //out.write(model.getInfo().getBytes()); + out.write(buf, 0, buf.length); + out.flush(); + out.close(); + ctx.responseComplete(); + ctx.release(); + } + } + + public String lnkPlanosActuacao_action() { + // TODO: Replace with your code + Utilizador u = getSessionBean1().getCurrentUser(); +// String curUser = "?user=" + u.getId().toString(); + FacesContext fc = getFacesContext().getCurrentInstance(); + Global.redirectToPlanos(fc, u); +// Utilizador u = getSessionBean1().getCurrentUser(); +// String curUser = "?user=" + u.getId().toString(); +// FacesContext fc = getFacesContext().getCurrentInstance(); +// try +// { +// JSFUtils.redirect(fc, Global.PLANOS_ACTUACAO_URL + curUser); +// } +// catch(Exception ex) +// { +// +// } + return null; + } + + public String lnkAnalisesAcidente_action() { + return null; + } + +} + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/GestaoUtilizadores.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/GestaoUtilizadores.java new file mode 100644 index 00000000..9e4027f0 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/GestaoUtilizadores.java @@ -0,0 +1,1212 @@ +/* + * GestaoUtilizadores.java + * + * Created on November 30, 2007, 1:34 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.SingleSelectOptionsList; +import db.AnalisesDataProvider; +import db.UtilizadoresActivosListDataProvider; +import db.UtilizadoresDataProvider; +import db.UtilizadoresInactivosListDataProvider; +import global.Global; +import java.util.ArrayList; +import java.util.Map; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.context.FacesContext; +import javax.faces.event.ValueChangeEvent; +import javax.servlet.http.HttpServletRequest; +import utils.JSFUtils; +import utils.Utils; + +/** + *

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 GestaoUtilizadores 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 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 staticText5 = new StaticText(); + + public StaticText getStaticText5() { + return staticText5; + } + + public void setStaticText5(StaticText st) { + this.staticText5 = st; + } + + private HtmlPanelGrid gridPanel7 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel7() { + return gridPanel7; + } + + public void setGridPanel7(HtmlPanelGrid hpg) { + this.gridPanel7 = hpg; + } + + private PanelGroup groupPanel6 = new PanelGroup(); + + public PanelGroup getGroupPanel6() { + return groupPanel6; + } + + public void setGroupPanel6(PanelGroup pg) { + this.groupPanel6 = pg; + } + + private StaticText staticText7 = new StaticText(); + + public StaticText getStaticText7() { + return staticText7; + } + + public void setStaticText7(StaticText st) { + this.staticText7 = st; + } + + private TextField txtPor = new TextField(); + + public TextField getTxtPor() { + return txtPor; + } + + public void setTxtPor(TextField tf) { + this.txtPor = tf; + } + + private PanelGroup groupPanel7 = new PanelGroup(); + + public PanelGroup getGroupPanel7() { + return groupPanel7; + } + + public void setGroupPanel7(PanelGroup pg) { + this.groupPanel7 = pg; + } + + private StaticText staticText8 = new StaticText(); + + public StaticText getStaticText8() { + return staticText8; + } + + public void setStaticText8(StaticText st) { + this.staticText8 = 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 tableColumn11 = new TableColumn(); + + public TableColumn getTableColumn11() { + return tableColumn11; + } + + public void setTableColumn11(TableColumn tc) { + this.tableColumn11 = tc; + } + + private Hyperlink lnkCategoriaActivos = new Hyperlink(); + + public Hyperlink getLnkCategoriaActivos() { + return lnkCategoriaActivos; + } + + public void setLnkCategoriaActivos(Hyperlink h) { + this.lnkCategoriaActivos = h; + } + + private TableColumn tableColumn13 = new TableColumn(); + + public TableColumn getTableColumn13() { + return tableColumn13; + } + + public void setTableColumn13(TableColumn tc) { + this.tableColumn13 = tc; + } + + private Hyperlink lnkPorActivos = new Hyperlink(); + + public Hyperlink getLnkPorActivos() { + return lnkPorActivos; + } + + public void setLnkPorActivos(Hyperlink h) { + this.lnkPorActivos = h; + } + + private TableColumn tableColumn14 = new TableColumn(); + + public TableColumn getTableColumn14() { + return tableColumn14; + } + + public void setTableColumn14(TableColumn tc) { + this.tableColumn14 = tc; + } + + private Hyperlink lnkNomeActivos = new Hyperlink(); + + public Hyperlink getLnkNomeActivos() { + return lnkNomeActivos; + } + + public void setLnkNomeActivos(Hyperlink h) { + this.lnkNomeActivos = h; + } + + private TableColumn tableColumn15 = new TableColumn(); + + public TableColumn getTableColumn15() { + return tableColumn15; + } + + public void setTableColumn15(TableColumn tc) { + this.tableColumn15 = tc; + } + + private Hyperlink lnkEstabelecimentoActivos = new Hyperlink(); + + public Hyperlink getLnkEstabelecimentoActivos() { + return lnkEstabelecimentoActivos; + } + + public void setLnkEstabelecimentoActivos(Hyperlink h) { + this.lnkEstabelecimentoActivos = h; + } + + private StaticText txtSearchMsg1 = new StaticText(); + + public StaticText getTxtSearchMsg1() { + return txtSearchMsg1; + } + + public void setTxtSearchMsg1(StaticText st) { + this.txtSearchMsg1 = st; + } + + private HtmlPanelGrid gridPanel9 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel9() { + return gridPanel9; + } + + public void setGridPanel9(HtmlPanelGrid hpg) { + this.gridPanel9 = hpg; + } + + private PanelGroup groupPanel8 = new PanelGroup(); + + public PanelGroup getGroupPanel8() { + return groupPanel8; + } + + public void setGroupPanel8(PanelGroup pg) { + this.groupPanel8 = pg; + } + + private StaticText staticText9 = new StaticText(); + + public StaticText getStaticText9() { + return staticText9; + } + + public void setStaticText9(StaticText st) { + this.staticText9 = st; + } + + private ImageComponent image3 = new ImageComponent(); + + public ImageComponent getImage3() { + return image3; + } + + public void setImage3(ImageComponent ic) { + this.image3 = ic; + } + + private StaticText staticText10 = new StaticText(); + + public StaticText getStaticText10() { + return staticText10; + } + + public void setStaticText10(StaticText st) { + this.staticText10 = st; + } + + private PanelGroup groupPanel3 = new PanelGroup(); + + public PanelGroup getGroupPanel3() { + return groupPanel3; + } + + public void setGroupPanel3(PanelGroup pg) { + this.groupPanel3 = pg; + } + + private StaticText staticText2 = new StaticText(); + + public StaticText getStaticText2() { + return staticText2; + } + + public void setStaticText2(StaticText st) { + this.staticText2 = st; + } + + private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel2() { + return gridPanel2; + } + + public void setGridPanel2(HtmlPanelGrid hpg) { + this.gridPanel2 = 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 lnkPorInactivos = new Hyperlink(); + + public Hyperlink getLnkPorInactivos() { + return lnkPorInactivos; + } + + public void setLnkPorInactivos(Hyperlink h) { + this.lnkPorInactivos = h; + } + + private TableColumn tableColumn2 = new TableColumn(); + + public TableColumn getTableColumn2() { + return tableColumn2; + } + + public void setTableColumn2(TableColumn tc) { + this.tableColumn2 = tc; + } + + private Hyperlink lnkNomeInactivos = new Hyperlink(); + + public Hyperlink getLnkNomeInactivos() { + return lnkNomeInactivos; + } + + public void setLnkNomeInactivos(Hyperlink h) { + this.lnkNomeInactivos = h; + } + + private TableColumn tableColumn3 = new TableColumn(); + + public TableColumn getTableColumn3() { + return tableColumn3; + } + + public void setTableColumn3(TableColumn tc) { + this.tableColumn3 = tc; + } + + private Hyperlink lnkCategoriaInactivos = new Hyperlink(); + + public Hyperlink getLnkCategoriaInactivos() { + return lnkCategoriaInactivos; + } + + public void setLnkCategoriaInactivos(Hyperlink h) { + this.lnkCategoriaInactivos = h; + } + + private TableColumn tableColumn4 = new TableColumn(); + + public TableColumn getTableColumn4() { + return tableColumn4; + } + + public void setTableColumn4(TableColumn tc) { + this.tableColumn4 = tc; + } + + private Hyperlink lnkEstabelecimentoInactivos = new Hyperlink(); + + public Hyperlink getLnkEstabelecimentoInactivos() { + return lnkEstabelecimentoInactivos; + } + + public void setLnkEstabelecimentoInactivos(Hyperlink h) { + this.lnkEstabelecimentoInactivos = h; + } + + private StaticText txtSearchMsg2 = new StaticText(); + + public StaticText getTxtSearchMsg2() { + return txtSearchMsg2; + } + + public void setTxtSearchMsg2(StaticText st) { + this.txtSearchMsg2 = st; + } + + private DropDown drpEstabelecimentos = new DropDown(); + + public DropDown getDrpEstabelecimentos() { + return drpEstabelecimentos; + } + + public void setDrpEstabelecimentos(DropDown dd) { + this.drpEstabelecimentos = dd; + } + + private SingleSelectOptionsList drpEstabelecimentosDefaultOptions = new SingleSelectOptionsList(); + + public SingleSelectOptionsList getDrpEstabelecimentosDefaultOptions() { + return drpEstabelecimentosDefaultOptions; + } + + public void setDrpEstabelecimentosDefaultOptions(SingleSelectOptionsList ssol) { + this.drpEstabelecimentosDefaultOptions = ssol; + } + + //
+ boolean isPostback = false; + + 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 HtmlPanelGrid gridPanel5 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel5() { + return gridPanel5; + } + + public void setGridPanel5(HtmlPanelGrid hpg) { + this.gridPanel5 = hpg; + } + + private Button butNovoUtilizador = new Button(); + + public Button getButNovoUtilizador() { + return butNovoUtilizador; + } + + public void setButNovoUtilizador(Button b) { + this.butNovoUtilizador = b; + } + + private HtmlPanelGrid gridMsg1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridMsg1() { + return gridMsg1; + } + + public void setGridMsg1(HtmlPanelGrid hpg) { + this.gridMsg1 = hpg; + } + + private StaticText txtMsg = new StaticText(); + + public StaticText getTxtMsg() { + return txtMsg; + } + + public void setTxtMsg(StaticText st) { + this.txtMsg = st; + } + private StaticText lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + private Hyperlink lnkPlanosActuacao = new Hyperlink(); + + public Hyperlink getLnkPlanosActuacao() { + return lnkPlanosActuacao; + } + + public void setLnkPlanosActuacao(Hyperlink h) { + this.lnkPlanosActuacao = h; + } + /** + *

Construct a new Page bean instance.

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

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("GestaoUtilizadores 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 . . . + } + } + else + { + lblUser.setText( getSessionBean1().getCurrentUser().getLogin() ); + + HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); + String referer = request.getRequestURI(); + String pageFrom = Utils.getPageFrom(referer); + + boolean userDeleted = getSessionBean1().isUserDeleted(); + + if(userDeleted) + { + getSessionBean1().setUserDeleted(false); + } + + FacesContext fc = getFacesContext(); + Map parameters = fc.getCurrentInstance().getExternalContext().getRequestParameterMap(); + if(!pageFrom.matches("GestaoUtilizadores.jsp") || userDeleted || parameters.size() > 0) + { + isPostback = false; + } + else + { + isPostback = true; + } + + + } + + } + + /** + *

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() { + Utilizador u = getSessionBean1().getCurrentUser(); + if(u.getTipo().intValue() != Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP) + { + lnkPlanosActuacao.setDisabled(true); + } + AnalisesDataProvider adp = new AnalisesDataProvider(); + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + System.out.println("POSTBACK : " + isPostback); + if(!isPostback) + { + try + { + com.sun.rave.web.ui.model.Option[] listOptions = adp.getEstabelecimentosList( getSessionBean1().getCurrentUser().getEmpresa_id(), new Boolean(false)); + listOptions[0].setLabel("-Todos-"); + getSessionBean1().setEstabelecimentosOptions( listOptions ); + drpEstabelecimentos.setSelected(new Integer(-1)); + } + catch(Exception ex) + { + //ex.printStackTrace(); + } + + String isDirRh = "n"; + if(getSessionBean1().getCurrentUser().getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_GERAL_RH) // Director geral rh + { + isDirRh = "y"; + } + try + { + ArrayList list = udp.getUtilizadoresList(null, null, null, "y", isDirRh); + getSessionBean1().getUtilizadoresActivosListDataProvider().setList(list); + } + catch(Exception ex) + { + //ex.printStackTrace(); + } + + try + { + ArrayList list = udp.getUtilizadoresList(null, null, null, "n", isDirRh); + getSessionBean1().getUtilizadoresInactivosListDataProvider().setList(list); + } + catch(Exception ex) + { + //ex.printStackTrace(); + getSessionBean1().getUtilizadoresInactivosListDataProvider().setList(new ArrayList()); + table1.setRendered(false); + } + + } + 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 lnkEditUser_action() { + // TODO: Replace with your code + + getSessionBean1().setNavFrom("GestaoUtilizadores"); + getSessionBean1().setModoEdicaoUtilizador("edit"); + return "user"; + } + + public String lnkLogout_action() { + // TODO: Replace with your code + + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) {} + //return "login"; + return null; + + } + + 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 + + return null; + } + + public String lnkNr_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkPor_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkNomeAcidentado_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkFase_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkDataAcidenteSeg_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkNrSeg_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkPorSeg_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkNomeAcidentadoSeg_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkFaseSeg_action() { + // TODO: Replace with your code + + return null; + } + + public void drpAno_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + + } + + public void drpMes_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + + } + + 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. + + String por = null; + String nome = null; + Integer estabelecimento_id = null; + + if(txtPor.getText() != null) + { + por = (String) txtPor.getText(); + if(por.trim().length() == 0) + { + por = null; + } + else + { + por = por.toLowerCase(); + } + } + + if(txtNome.getText() != null) + { + nome = (String) txtNome.getText(); + if(nome.trim().length() == 0) + { + nome = null; + } + else + { + nome = nome.toLowerCase(); + } + } + + estabelecimento_id = (Integer) drpEstabelecimentos.getSelected(); + if(estabelecimento_id.intValue() == -1) + { + estabelecimento_id = null; + } + + String isDirRh = "n"; + + if(getSessionBean1().getCurrentUser().getTipo().intValue() == 7) //director geral rh + { + isDirRh = "y"; + } + + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + try + { + ArrayList list = udp.getUtilizadoresList(por, nome, estabelecimento_id, "y", isDirRh); + getSessionBean1().getUtilizadoresActivosListDataProvider().setList(list); + } + catch(Exception ex) + { + //ex.printStackTrace(); + getSessionBean1().getUtilizadoresActivosListDataProvider().setList(new ArrayList()); + } + + try + { + ArrayList list = udp.getUtilizadoresList(por, nome, estabelecimento_id, "n", isDirRh); + getSessionBean1().getUtilizadoresInactivosListDataProvider().setList(list); + } + catch(Exception ex) + { + //ex.printStackTrace(); + getSessionBean1().getUtilizadoresInactivosListDataProvider().setList(new ArrayList()); + } + + return null; + } + + public String lnkPorActivos_action() { + // TODO: Replace with your code + Utilizador u = getUtilizadorActivoRowData(); + getSessionBean1().setEditUser(u); + getSessionBean1().setModoEdicaoUtilizador("edit"); + getSessionBean1().setNavFrom("GestaoUtilizadores"); + return "user_fields"; + } + + public String lnkNomeActivos_action() { + // TODO: Replace with your code + Utilizador u = getUtilizadorActivoRowData(); + System.out.println("UTILIZADOR ID : " + u.getId()); + getSessionBean1().setEditUser(u); + getSessionBean1().setModoEdicaoUtilizador("edit"); + getSessionBean1().setNavFrom("GestaoUtilizadores"); + return "user_fields"; + } + + public String lnkCategoriaActivos_action() { + // TODO: Replace with your code + Utilizador u = getUtilizadorActivoRowData(); + getSessionBean1().setEditUser(u); + getSessionBean1().setModoEdicaoUtilizador("edit"); + getSessionBean1().setNavFrom("GestaoUtilizadores"); + return "user_fields"; + } + + public String lnkEstabelecimentosActivos_action() { + // TODO: Replace with your code + Utilizador u = getUtilizadorActivoRowData(); + getSessionBean1().setEditUser(u); + getSessionBean1().setModoEdicaoUtilizador("edit"); + getSessionBean1().setNavFrom("GestaoUtilizadores"); + return "user_fields"; + } + + private Utilizador getUtilizadorActivoRowData() + { + RowKey rk = tableRowGroup3.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + UtilizadoresActivosListDataProvider provider = (UtilizadoresActivosListDataProvider) tableRowGroup3.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + Utilizador u = (Utilizador)list.get(k); + return u; + } + + + public String lnkPorInactivos_action() { + // TODO: Replace with your code + Utilizador u = getUtilizadorInactivoRowData(); + getSessionBean1().setEditUser(u); + getSessionBean1().setModoEdicaoUtilizador("edit"); + getSessionBean1().setNavFrom("GestaoUtilizadores"); + return "user_fields"; + } + + public String lnkNomeInactivos_action() { + // TODO: Replace with your code + Utilizador u = getUtilizadorInactivoRowData(); + getSessionBean1().setEditUser(u); + getSessionBean1().setModoEdicaoUtilizador("edit"); + getSessionBean1().setNavFrom("GestaoUtilizadores"); + return "user_fields"; + } + + public String lnkCategoriaInactivos_action() { + // TODO: Replace with your code + Utilizador u = getUtilizadorInactivoRowData(); + getSessionBean1().setEditUser(u); + getSessionBean1().setModoEdicaoUtilizador("edit"); + getSessionBean1().setNavFrom("GestaoUtilizadores"); + return "user_fields"; + } + + public String lnkEstabelecimentoInactivos_action() { + // TODO: Replace with your code + Utilizador u = getUtilizadorInactivoRowData(); + getSessionBean1().setEditUser(u); + getSessionBean1().setModoEdicaoUtilizador("edit"); + getSessionBean1().setNavFrom("GestaoUtilizadores"); + return "user_fields"; + } + + private Utilizador getUtilizadorInactivoRowData() + { + RowKey rk = tableRowGroup1.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + UtilizadoresInactivosListDataProvider provider = (UtilizadoresInactivosListDataProvider) tableRowGroup1.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + Utilizador u = (Utilizador)list.get(k); + return u; + } + + + public String lnkNewUser_action() { + // TODO: Replace with your code + + return null; + } + + public String butNovoUtilizador_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + + return "novo_utilizador"; + } + + public String lnkAnalisesAcidente_action() { + // TODO: Replace with your code + String nav_from = getSessionBean1().getNavFrom(); + Integer tipo_utilizador = getSessionBean1().getCurrentUser().getTipo(); + if(tipo_utilizador.intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP) + { + return "form_dir_siprp"; + } + else if( tipo_utilizador.intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_GERAL_RH ) + { + return "form_dir_ger_rh"; + } + return null; + } + + public String lnkAjuda_action() { + // TODO: Replace with your code +// ServletContext theApplicationsServletContext = +// (ServletContext) this.getExternalContext().getContext(); +// String pdfFolderPath = theApplicationsServletContext.getRealPath(Global.PDF_FOLDER_URL); +// String pdfFilePath = pdfFolderPath + "/Ajuda.pdf"; +// +// Global global = new Global(); +// try +// { +// global.showPdf(pdfFilePath); +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } + return null; + } + + public String lnkPlanosActuacao_action() { + // TODO: Replace with your code + Utilizador u = getSessionBean1().getCurrentUser(); +// String curUser = "?user=" + u.getId().toString(); + FacesContext fc = getFacesContext().getCurrentInstance(); + Global.redirectToPlanos(fc, u); + return null; + } +} + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Header.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Header.java new file mode 100644 index 00000000..713acb0e --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Header.java @@ -0,0 +1,130 @@ +/* + * 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 { + } + //
+ + 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"); + } + + public String lnkAnalisesAcidente_action() { + // TODO: Replace with your code + return null; + } + + public String lnkPlanosActuacao_action() { + // TODO: Replace with your code + return null; + } + + public String lnkNewUser_action() { + // TODO: Replace with your code + return null; + } + + public String lnkEditUser_action() { + // TODO: Replace with your code + return null; + } + + public String lnkAjuda_action() { + // TODO: Replace with your code + return null; + } + + public String lnkLogout_action() { + // TODO: Replace with your code + return null; + } +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/LoadImage.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/LoadImage.java new file mode 100644 index 00000000..7d194938 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/LoadImage.java @@ -0,0 +1,473 @@ +/* + * 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.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 global.Global; +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; + } + + //
+ /** + *

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 StaticText txtMsg = new StaticText(); + + public StaticText getTxtMsg() { + return txtMsg; + } + + public void setTxtMsg(StaticText st) { + this.txtMsg = st; + } + + private PanelGroup groupPanel4 = new PanelGroup(); + + public PanelGroup getGroupPanel4() { + return groupPanel4; + } + + public void setGroupPanel4(PanelGroup pg) { + this.groupPanel4 = pg; + } + + private Button butUpload = new Button(); + + public Button getButUpload() { + return butUpload; + } + + public void setButUpload(Button b) { + this.butUpload = b; + } + + private Button butCancelar = new Button(); + + public Button getButCancelar() { + return butCancelar; + } + + public void setButCancelar(Button b) { + this.butCancelar = b; + } + 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 . . . + } + } + else + { + + getSessionBean1().setImageName(null); + ServletContext theApplicationsServletContext = + (ServletContext) this.getExternalContext().getContext(); + //this.realImageFilePath = theApplicationsServletContext.getRealPath(IMAGE_URL); + //this.realImageFilePath = theApplicationsServletContext.getRealPath(Global.IMAGE_FOLDER); + try + { + realImageFilePath = Global.IMAGE_FOLDER + "/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 butCancelar_action() { + getSessionBean1().setImageName(null); + return "analise_acidente"; + } + + 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. + + //realImageFilePath += "/tmp" + getSessionBean1().getCurrentUser().getLogin(); + System.out.println("REAL IMAGE FILE PATH : " + realImageFilePath); + File fdir = new File(realImageFilePath); + System.out.println("FDIR : " + fdir); + + + UploadedFile uploadedFile = fileUpload1.getUploadedFile(); + if(uploadedFile != null) + { + + 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('.')); + int firstImageNr = getFirstImageNr().intValue(); + File files[] = fdir.listFiles(); + // realImageFilePath += "/" + justFileName; + System.out.println("FILES : " + files); + + int imageName = firstImageNr + files.length + 1; + justFileName = new Integer(imageName).toString(); + + if(imageName < 10) + { + justFileName = "0" + justFileName; + } + //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("Tem de seleccionar um ficheiro do tipo JPEG, PJPEG, GIF, PNG, ou X-PNG !"); + new File(this.realImageFilePath).delete(); + return null; + } + } + else + { + getSessionBean1().setImageName(null); + } + + return "analise_acidente"; + } + + private Integer getFirstImageNr() + { + if(getSessionBean1().getCurrentAnalise() == null) + { + return new Integer(0); + } + else + { + String folderName = getSessionBean1().getCurrentAnalise().getAnalise_nr().substring(0,2) + getSessionBean1().getCurrentAnalise().getAnalise_nr().substring(3); + ServletContext theApplicationsServletContext = + (ServletContext) this.getExternalContext().getContext(); +// String imageFileFolder = theApplicationsServletContext.getRealPath(Global.IMAGE_FOLDER + "/" + folderName); + String imageFileFolder = Global.IMAGE_FOLDER + "/" + folderName; + File fdir = new File(imageFileFolder); + int nr = 0; + if(fdir.exists()) + { + File files[] = fdir.listFiles(); + for(int i=0; i < files.length; i++) + { + String nr_str = files[i].getName(); + int i_nr = Integer.parseInt(nr_str); + if(i_nr > nr) + { + nr = i_nr; + } + } + return new Integer(nr); + } + + return new Integer(0); + } + } +} + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Login.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Login.java new file mode 100644 index 00000000..40bd21e4 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Login.java @@ -0,0 +1,658 @@ +/* + * 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 com.sun.rave.web.ui.model.Option; +import db.AnalisesDataProvider; +import db.UtilizadoresDataProvider; +import global.Global; +import java.sql.Connection; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.GregorianCalendar; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.context.FacesContext; +import utils.JSFUtils; + +/** + *

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(u.getActivo().matches("y")) + { + if(!password.equals(u.getPassword())) + { + getSessionBean1().setMsg("Palavra-chave inválida !"); + } + else + { + //if(u.getOwner_id().intValue() == 0 ) + + //Login Ok ! +// if(u.getPrimeiro_login().matches("y") || mustChangePassword(u)) + if(u.getPrimeiro_login().matches("y") ) + { + getSessionBean1().setMudarPassword(true); + getSessionBean1().setCurrentUser( u ); + getSessionBean1().setNavFrom("Login"); + getSessionBean1().setModoEdicaoUtilizador("edit"); + getSessionBean1().setLoggedIn(true); + initializeClock(); + initializeDropDownOptions(); + return "user"; + } + try + { + Integer permissao = udp.getPermissionCode(u.getId()); + if(permissao.intValue() == 1) //seguranca + { + if(u.getResponsavel_loja().matches("y")) + { + sRet = "acesso"; + } + else + { + sRet = "form_seguranca"; + } + } + else if(permissao.intValue() == 2) // rh + { + if(u.getResponsavel_loja().matches("y")) + { + sRet = "acesso"; + } + else + { + sRet = "form_rh"; + } + //sRet = "form_rh"; + } + else if(permissao.intValue() == 3) // hs + { + //sRet = "form_hs"; + sRet = "acesso"; + } + else if(permissao.intValue() == 5) // medico + { + sRet = "form_medico"; + } + else if(permissao.intValue() == 6) // gestor + { + //sRet = "form_gestor"; + sRet = "acesso"; + } + else if(permissao.intValue() == 7) // director geral rh + { + //sRet = "form_rh"; + //sRet = "form_dir_ger_rh"; + sRet = "acesso"; + } + else if(permissao.intValue() == 8) // director siprp + { + //sRet = "form_dir_siprp"; + sRet = "acesso"; + } + else if(permissao.intValue() == 9) // director loja + { + sRet = "acesso"; + } + else if(permissao.intValue() == 10) // director nacional de seguranca + { + sRet = "acesso"; + } + + u.setCodigo_permissao(permissao); + getSessionBean1().setCurrentUser( u ); + getSessionBean1().setLoggedIn(true); + initializeClock(); + initializeDropDownOptions(); + + // só para testes. retirar depois : + ///getSessionBean1().setModoEdicaoUtilizador("new"); + ///sRet = "create_user"; + } + catch(Exception e1) + { + e1.printStackTrace(); + getSessionBean1().setMsg("Não tem permissão para entrar na aplicação !"); + } + } + + } + else + { + getSessionBean1().setMsg("Utilizador inválido ! "); + } + } + catch(Exception ex) + { + ex.printStackTrace(); + getSessionBean1().setMsg("Utilizador inválido ! "); + } + } + 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(); + } + } + + private void initializeClock() + { + com.sun.rave.web.ui.model.Option[] horasOptions = new com.sun.rave.web.ui.model.Option[25]; + horasOptions[0] = new Option(new Integer(-1), "-"); + int j = 0; + String str_j = ""; + for(int i=1; i < 25; i++) + { + if(j < 10) + { + str_j = "0" + new Integer(j).toString(); + } + else + { + str_j = new Integer(j).toString(); + } + horasOptions[i] = new Option(new Integer(j), str_j); + j++; + } + getSessionBean1().setHorasOptions(horasOptions); + + com.sun.rave.web.ui.model.Option[] minutosOptions = new com.sun.rave.web.ui.model.Option[13]; + minutosOptions[0] = new Option(new Integer(-1), "-"); + j = 0; + for(int i=1; i < 13; i++) + { + if(j < 10) + { + str_j = "0" + new Integer(j).toString(); + } + else + { + str_j = new Integer(j).toString(); + } + minutosOptions[i] = new Option(new Integer(j), str_j); + j += 5; + } + getSessionBean1().setMinutosOptions(minutosOptions); + } + + private void initializeDropDownOptions() + { + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); +// try +// { +// getSessionBean1().setTecnicosOptions(udp.getTecnicosSaudeList()); +// //drpTipo.setSelected(new Integer(0)); +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } + +// try +// { +// getSessionBean1().setMedicosOptions(udp.getMedicosList()); +// //drpTipo.setSelected(new Integer(0)); +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + getSessionBean1().setCausasOptions(adp.getCausasList()); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + try + { + getSessionBean1().setDepartamentoOptions(adp.getDepartamentosList()); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + } + + private boolean mustChangePassword(Utilizador u) + { + java.util.Date now = new java.util.Date(); + Calendar cal = new GregorianCalendar(); + cal.setTime(now); + int ano = cal.get(Calendar.YEAR); + int mes = cal.get(Calendar.MONTH); + int dia = cal.get(Calendar.DAY_OF_MONTH); + + Calendar today = new GregorianCalendar(ano, mes, dia); + Calendar firstJan = new GregorianCalendar(ano, Calendar.JANUARY, 1); +// Calendar firstJan = new GregorianCalendar(ano, Calendar.DECEMBER, 27); + Calendar firstJul = new GregorianCalendar(ano, Calendar.JULY, 1); + + if(today.compareTo(firstJan) == 0 || today.compareTo(firstJul) == 0) + { + return true; + } + + if(u.getData_password() == null) + { + return true; + } + else + { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + try + { + java.util.Date dt_password = sdf.parse(u.getData_password().toString()); + Calendar cal_dt_password = new GregorianCalendar(); + cal_dt_password.setTime(dt_password); + cal_dt_password.add(GregorianCalendar.MONTH, 6); + if(cal.compareTo(cal_dt_password) > 0) + { + return true; + } + else + { + return false; + } + + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + } + return false; + } +} + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Medico.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Medico.java new file mode 100644 index 00000000..257089e6 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Medico.java @@ -0,0 +1,53 @@ +/* + * Medico.java + * + * Created on October 12, 2007, 11:00 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class Medico { + private Integer id; + private String nome; + private String numero_cedula; + + /** Creates a new instance of Medico */ + public Medico() { + } + + 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 String getNumero_cedula() { + return numero_cedula; + } + + public void setNumero_cedula(String numero_cedula) { + this.numero_cedula = numero_cedula; + } + + public String toString() { + return utils.Utils.unicodeToHTML(nome); + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Medida.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Medida.java new file mode 100644 index 00000000..5fe9c763 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Medida.java @@ -0,0 +1,49 @@ +/* + * Medida.java + * + * Created on October 19, 2007, 4:59 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class Medida { + private Integer id; + private Integer analise_id; + private String medida; + + /** Creates a new instance of Medida */ + public Medida() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getAnalise_id() { + return analise_id; + } + + public void setAnalise_id(Integer analise_id) { + this.analise_id = analise_id; + } + + public String getMedida() { + return medida; + } + + public void setMedida(String medida) { + this.medida = medida; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/NewUser.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/NewUser.java new file mode 100644 index 00000000..3b713ced --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/NewUser.java @@ -0,0 +1,176 @@ +/* + * NewUser.java + * + * Created on December 4, 2007, 11:29 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class NewUser { + private Integer tipo; + private String tipo_descricao; + private String nome; + private Integer estabelecimento; + private String estabelecimento_descricao; + private String login; + private String password; + private String email; + + private String numero_mecanografico; + private Integer empresa_id; + private String numero_cedula; + private String cap; + private Integer funcionario_hst_id; + private Integer medico_id; + private String responsavel_loja; + private String gestor_geral; + private String activo; + + /** Creates a new instance of NewUser */ + public NewUser() { + } + + public Integer getTipo() { + return tipo; + } + + public void setTipo(Integer tipo) { + this.tipo = tipo; + } + + public String getTipo_descricao() { + return tipo_descricao; + } + + public void setTipo_descricao(String tipo_descricao) { + this.tipo_descricao = tipo_descricao; + } + + public String getNome() { + return nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public Integer getEstabelecimento() { + return estabelecimento; + } + + public void setEstabelecimento(Integer estabelecimento) { + this.estabelecimento = estabelecimento; + } + + public String getEstabelecimento_descricao() { + return estabelecimento_descricao; + } + + public void setEstabelecimento_descricao(String estabelecimento_descricao) { + this.estabelecimento_descricao = estabelecimento_descricao; + } + + 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 String getNumero_mecanografico() { + return numero_mecanografico; + } + + public void setNumero_mecanografico(String numero_mecanografico) { + this.numero_mecanografico = numero_mecanografico; + } + + public Integer getEmpresa_id() { + return empresa_id; + } + + public void setEmpresa_id(Integer empresa_id) { + this.empresa_id = empresa_id; + } + + public String getNumero_cedula() { + return numero_cedula; + } + + public void setNumero_cedula(String numero_cedula) { + this.numero_cedula = numero_cedula; + } + + public String getCap() { + return cap; + } + + public void setCap(String cap) { + this.cap = cap; + } + + public Integer getFuncionario_hst_id() { + return funcionario_hst_id; + } + + public void setFuncionario_hst_id(Integer funcionario_hst_id) { + this.funcionario_hst_id = funcionario_hst_id; + } + + public Integer getMedico_id() { + return medico_id; + } + + public void setMedico_id(Integer medico_id) { + this.medico_id = medico_id; + } + + public String getResponsavel_loja() { + return responsavel_loja; + } + + public void setResponsavel_loja(String responsavel_loja) { + this.responsavel_loja = responsavel_loja; + } + + public String getActivo() { + return activo; + } + + public void setActivo(String activo) { + this.activo = activo; + } + + public String getGestor_geral() { + return gestor_geral; + } + + public void setGestor_geral(String gestor_geral) { + this.gestor_geral = gestor_geral; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/NovoUtilizador.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/NovoUtilizador.java new file mode 100644 index 00000000..310b1a75 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/NovoUtilizador.java @@ -0,0 +1,2026 @@ +/* + * NovoUtilizador.java + * + * Created on December 3, 2007, 2:30 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.Checkbox; +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.HiddenField; +import com.sun.rave.web.ui.component.Html; +import com.sun.rave.web.ui.component.Hyperlink; +import com.sun.rave.web.ui.component.ImageComponent; +import com.sun.rave.web.ui.component.Link; +import com.sun.rave.web.ui.component.Page; +import com.sun.rave.web.ui.component.PanelGroup; +import com.sun.rave.web.ui.component.RadioButton; +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 db.AnalisesDataProvider; +import db.TrabalhadoresListDataProvider; +import global.Global; +import java.util.ArrayList; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.context.FacesContext; +import javax.faces.event.ValueChangeEvent; +import javax.servlet.http.HttpServletRequest; +import utils.Utils; + +/** + *

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 NovoUtilizador 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 HtmlPanelGrid gridMsg1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridMsg1() { + return gridMsg1; + } + + public void setGridMsg1(HtmlPanelGrid hpg) { + this.gridMsg1 = hpg; + } + + private StaticText txtMsg = new StaticText(); + + public StaticText getTxtMsg() { + return txtMsg; + } + + public void setTxtMsg(StaticText st) { + this.txtMsg = st; + } + + 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 PanelGroup groupPanel3 = new PanelGroup(); + + public PanelGroup getGroupPanel3() { + return groupPanel3; + } + + public void setGroupPanel3(PanelGroup pg) { + this.groupPanel3 = pg; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private HtmlPanelGrid gridPanel6 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel6() { + return gridPanel6; + } + + public void setGridPanel6(HtmlPanelGrid hpg) { + this.gridPanel6 = hpg; + } + + private PanelGroup groupPanel4 = new PanelGroup(); + + public PanelGroup getGroupPanel4() { + return groupPanel4; + } + + public void setGroupPanel4(PanelGroup pg) { + this.groupPanel4 = pg; + } + + private StaticText staticText10 = new StaticText(); + + public StaticText getStaticText10() { + return staticText10; + } + + public void setStaticText10(StaticText st) { + this.staticText10 = st; + } + + private HtmlPanelGrid gridPanel7 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel7() { + return gridPanel7; + } + + public void setGridPanel7(HtmlPanelGrid hpg) { + this.gridPanel7 = hpg; + } + + private Button butCancelar = new Button(); + + public Button getButCancelar() { + return butCancelar; + } + + public void setButCancelar(Button b) { + this.butCancelar = b; + } + + private PanelGroup groupPanel5 = new PanelGroup(); + + public PanelGroup getGroupPanel5() { + return groupPanel5; + } + + public void setGroupPanel5(PanelGroup pg) { + this.groupPanel5 = pg; + } + + private Button butContinuar = new Button(); + + public Button getButContinuar() { + return butContinuar; + } + + public void setButContinuar(Button b) { + this.butContinuar = b; + } + + private HtmlPanelGrid gridPanel4 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel4() { + return gridPanel4; + } + + public void setGridPanel4(HtmlPanelGrid hpg) { + this.gridPanel4 = hpg; + } + + private HtmlPanelGrid gridCategoria = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridCategoria() { + return gridCategoria; + } + + public void setGridCategoria(HtmlPanelGrid hpg) { + this.gridCategoria = hpg; + } + + private HtmlPanelGrid gridUtilizador = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridUtilizador() { + return gridUtilizador; + } + + public void setGridUtilizador(HtmlPanelGrid hpg) { + this.gridUtilizador = hpg; + } + + private PanelGroup pgCatDirRh = new PanelGroup(); + + public PanelGroup getPgCatDirRh() { + return pgCatDirRh; + } + + public void setPgCatDirRh(PanelGroup pg) { + this.pgCatDirRh = pg; + } + + private RadioButton rbCatDirRh = new RadioButton(); + + public RadioButton getRbCatDirRh() { + return rbCatDirRh; + } + + public void setRbCatDirRh(RadioButton rbCatGestao) { + this.rbCatDirRh = rbCatGestao; + } + + private StaticText staticText11 = new StaticText(); + + public StaticText getStaticText11() { + return staticText11; + } + + public void setStaticText11(StaticText st) { + this.staticText11 = st; + } + + private PanelGroup pgCatGestao = new PanelGroup(); + + public PanelGroup getPgCatGestao() { + return pgCatGestao; + } + + public void setPgCatGestao(PanelGroup pg) { + this.pgCatGestao = pg; + } + + private RadioButton rbCatGestao = new RadioButton(); + + public RadioButton getRbCatGestao() { + return rbCatGestao; + } + + public void setRbCatGestao(RadioButton rbCatGestao) { + this.rbCatGestao = rbCatGestao; + } + + private StaticText staticText12 = new StaticText(); + + public StaticText getStaticText12() { + return staticText12; + } + + public void setStaticText12(StaticText st) { + this.staticText12 = st; + } + + private PanelGroup pgCatGestaoAd = new PanelGroup(); + + public PanelGroup getPgCatGestaoAd() { + return pgCatGestaoAd; + } + + public void setPgCatGestaoAd(PanelGroup pg) { + this.pgCatGestaoAd = pg; + } + + private StaticText staticText13 = new StaticText(); + + public StaticText getStaticText13() { + return staticText13; + } + + public void setStaticText13(StaticText st) { + this.staticText13 = st; + } + + private Checkbox chkGestaoGeral = new Checkbox(); + + public Checkbox getChkGestaoGeral() { + return chkGestaoGeral; + } + + public void setChkGestaoGeral(Checkbox c) { + this.chkGestaoGeral = c; + } + + private PanelGroup pgCatHs = new PanelGroup(); + + public PanelGroup getPgCatHs() { + return pgCatHs; + } + + public void setPgCatHs(PanelGroup pg) { + this.pgCatHs = pg; + } + + private RadioButton rbCatHs = new RadioButton(); + + public RadioButton getRbCatHs() { + return rbCatHs; + } + + public void setRbCatHs(RadioButton rbCatGestao) { + this.rbCatHs = rbCatGestao; + } + + private StaticText staticText14 = new StaticText(); + + public StaticText getStaticText14() { + return staticText14; + } + + public void setStaticText14(StaticText st) { + this.staticText14 = st; + } + + private PanelGroup pgCatMed = new PanelGroup(); + + public PanelGroup getPgCatMed() { + return pgCatMed; + } + + public void setPgCatMed(PanelGroup pg) { + this.pgCatMed = pg; + } + + private RadioButton rbCatMed = new RadioButton(); + + public RadioButton getRbCatMed() { + return rbCatMed; + } + + public void setRbCatMed(RadioButton rbCatGestao) { + this.rbCatMed = rbCatGestao; + } + + private StaticText staticText15 = new StaticText(); + + public StaticText getStaticText15() { + return staticText15; + } + + public void setStaticText15(StaticText st) { + this.staticText15 = st; + } + + private PanelGroup pgCatRh = new PanelGroup(); + + public PanelGroup getPgCatRh() { + return pgCatRh; + } + + public void setPgCatRh(PanelGroup pg) { + this.pgCatRh = pg; + } + + private RadioButton rbCatRh = new RadioButton(); + + public RadioButton getRbCatRh() { + return rbCatRh; + } + + public void setRbCatRh(RadioButton rbCatGestao) { + this.rbCatRh = rbCatGestao; + } + + private StaticText staticText16 = new StaticText(); + + public StaticText getStaticText16() { + return staticText16; + } + + public void setStaticText16(StaticText st) { + this.staticText16 = st; + } + + private PanelGroup pgCatRhAd = new PanelGroup(); + + public PanelGroup getPgCatRhAd() { + return pgCatRhAd; + } + + public void setPgCatRhAd(PanelGroup pg) { + this.pgCatRhAd = pg; + } + + private StaticText staticText17 = new StaticText(); + + public StaticText getStaticText17() { + return staticText17; + } + + public void setStaticText17(StaticText st) { + this.staticText17 = st; + } + + private Checkbox chkRhResp = new Checkbox(); + + public Checkbox getChkRhResp() { + return chkRhResp; + } + + public void setChkRhResp(Checkbox c) { + this.chkRhResp = c; + } + + private PanelGroup pgCatSeg = new PanelGroup(); + + public PanelGroup getPgCatSeg() { + return pgCatSeg; + } + + public void setPgCatSeg(PanelGroup pg) { + this.pgCatSeg = pg; + } + + private RadioButton rbCatSeg = new RadioButton(); + + public RadioButton getRbCatSeg() { + return rbCatSeg; + } + + public void setRbCatSeg(RadioButton rbCatGestao) { + this.rbCatSeg = rbCatGestao; + } + + private StaticText staticText18 = new StaticText(); + + public StaticText getStaticText18() { + return staticText18; + } + + public void setStaticText18(StaticText st) { + this.staticText18 = st; + } + + private PanelGroup pgCatSegAd = new PanelGroup(); + + public PanelGroup getPgCatSegAd() { + return pgCatSegAd; + } + + public void setPgCatSegAd(PanelGroup pg) { + this.pgCatSegAd = pg; + } + + private StaticText staticText19 = new StaticText(); + + public StaticText getStaticText19() { + return staticText19; + } + + public void setStaticText19(StaticText st) { + this.staticText19 = st; + } + + private Checkbox chkSegResp = new Checkbox(); + + public Checkbox getChkSegResp() { + return chkSegResp; + } + + public void setChkSegResp(Checkbox c) { + this.chkSegResp = c; + } + + private HtmlPanelGrid gridTrabalhadores = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridTrabalhadores() { + return gridTrabalhadores; + } + + public void setGridTrabalhadores(HtmlPanelGrid hpg) { + this.gridTrabalhadores = hpg; + } + + private StaticText txtSearchMsg1 = new StaticText(); + + public StaticText getTxtSearchMsg1() { + return txtSearchMsg1; + } + + public void setTxtSearchMsg1(StaticText st) { + this.txtSearchMsg1 = st; + } + + private PanelGroup groupPanel6 = new PanelGroup(); + + public PanelGroup getGroupPanel6() { + return groupPanel6; + } + + public void setGroupPanel6(PanelGroup pg) { + this.groupPanel6 = pg; + } + + private StaticText staticText4 = new StaticText(); + + public StaticText getStaticText4() { + return staticText4; + } + + public void setStaticText4(StaticText st) { + this.staticText4 = st; + } + + private TextField txtNrMecanografico = new TextField(); + + public TextField getTxtNrMecanografico() { + return txtNrMecanografico; + } + + public void setTxtNrMecanografico(TextField tf) { + this.txtNrMecanografico = tf; + } + + private StaticText staticText5 = new StaticText(); + + public StaticText getStaticText5() { + return staticText5; + } + + public void setStaticText5(StaticText st) { + this.staticText5 = st; + } + + private TextField txtNomeTrabalhador = new TextField(); + + public TextField getTxtNomeTrabalhador() { + return txtNomeTrabalhador; + } + + public void setTxtNomeTrabalhador(TextField tf) { + this.txtNomeTrabalhador = tf; + } + + private StaticText staticText6 = new StaticText(); + + public StaticText getStaticText6() { + return staticText6; + } + + public void setStaticText6(StaticText st) { + this.staticText6 = st; + } + + private Button butProcurarTrab = new Button(); + + public Button getButProcurarTrab() { + return butProcurarTrab; + } + + public void setButProcurarTrab(Button b) { + this.butProcurarTrab = b; + } + + private Table tblTrabalhadores = new Table(); + + public Table getTblTrabalhadores() { + return tblTrabalhadores; + } + + public void setTblTrabalhadores(Table t) { + this.tblTrabalhadores = 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 lnkPOR = new Hyperlink(); + + public Hyperlink getLnkPOR() { + return lnkPOR; + } + + public void setLnkPOR(Hyperlink h) { + this.lnkPOR = h; + } + + private TableColumn tableColumn2 = new TableColumn(); + + public TableColumn getTableColumn2() { + return tableColumn2; + } + + public void setTableColumn2(TableColumn tc) { + this.tableColumn2 = tc; + } + + private Hyperlink lnkNomeTrabalhador = new Hyperlink(); + + public Hyperlink getLnkNomeTrabalhador() { + return lnkNomeTrabalhador; + } + + public void setLnkNomeTrabalhador(Hyperlink h) { + this.lnkNomeTrabalhador = h; + } + + private TableColumn tableColumn3 = new TableColumn(); + + public TableColumn getTableColumn3() { + return tableColumn3; + } + + public void setTableColumn3(TableColumn tc) { + this.tableColumn3 = tc; + } + + private Hyperlink lnkEstabelecimentoTrabalhador = new Hyperlink(); + + public Hyperlink getLnkEstabelecimentoTrabalhador() { + return lnkEstabelecimentoTrabalhador; + } + + public void setLnkEstabelecimentoTrabalhador(Hyperlink h) { + this.lnkEstabelecimentoTrabalhador = h; + } + + private StaticText staticText7 = new StaticText(); + + public StaticText getStaticText7() { + return staticText7; + } + + public void setStaticText7(StaticText st) { + this.staticText7 = st; + } + + private StaticText stOutro = new StaticText(); + + public StaticText getStOutro() { + return stOutro; + } + + public void setStOutro(StaticText st) { + this.stOutro = st; + } + + private HtmlPanelGrid gridOutro = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridOutro() { + return gridOutro; + } + + public void setGridOutro(HtmlPanelGrid hpg) { + this.gridOutro = hpg; + } + + private StaticText staticText9 = new StaticText(); + + public StaticText getStaticText9() { + return staticText9; + } + + public void setStaticText9(StaticText st) { + this.staticText9 = st; + } + + private TextField txtNomeOutro = new TextField(); + + public TextField getTxtNomeOutro() { + return txtNomeOutro; + } + + public void setTxtNomeOutro(TextField tf) { + this.txtNomeOutro = tf; + } + + private StaticText staticText20 = new StaticText(); + + public StaticText getStaticText20() { + return staticText20; + } + + public void setStaticText20(StaticText st) { + this.staticText20 = st; + } + + private DropDown drpEstabelecimentoOutro = new DropDown(); + + public DropDown getDrpEstabelecimentoOutro() { + return drpEstabelecimentoOutro; + } + + public void setDrpEstabelecimentoOutro(DropDown dd) { + this.drpEstabelecimentoOutro = dd; + } + + private HtmlPanelGrid gridTecnicosHs = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridTecnicosHs() { + return gridTecnicosHs; + } + + public void setGridTecnicosHs(HtmlPanelGrid hpg) { + this.gridTecnicosHs = hpg; + } + + private StaticText staticText21 = new StaticText(); + + public StaticText getStaticText21() { + return staticText21; + } + + public void setStaticText21(StaticText st) { + this.staticText21 = st; + } + + private DropDown drpNomeHs = new DropDown(); + + public DropDown getDrpNomeHs() { + return drpNomeHs; + } + + public void setDrpNomeHs(DropDown dd) { + this.drpNomeHs = dd; + } + + private StaticText staticText22 = new StaticText(); + + public StaticText getStaticText22() { + return staticText22; + } + + public void setStaticText22(StaticText st) { + this.staticText22 = st; + } + + private TextField txtCap = new TextField(); + + public TextField getTxtCap() { + return txtCap; + } + + public void setTxtCap(TextField tf) { + this.txtCap = tf; + } + + private HtmlPanelGrid gridMedicos = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridMedicos() { + return gridMedicos; + } + + public void setGridMedicos(HtmlPanelGrid hpg) { + this.gridMedicos = hpg; + } + + private StaticText staticText23 = new StaticText(); + + public StaticText getStaticText23() { + return staticText23; + } + + public void setStaticText23(StaticText st) { + this.staticText23 = st; + } + + private DropDown drpNomeMed = new DropDown(); + + public DropDown getDrpNomeMed() { + return drpNomeMed; + } + + public void setDrpNomeMed(DropDown dd) { + this.drpNomeMed = dd; + } + + private StaticText staticText24 = new StaticText(); + + public StaticText getStaticText24() { + return staticText24; + } + + public void setStaticText24(StaticText st) { + this.staticText24 = st; + } + + private DropDown drpEstabelecimentoMed = new DropDown(); + + public DropDown getDrpEstabelecimentoMed() { + return drpEstabelecimentoMed; + } + + public void setDrpEstabelecimentoMed(DropDown dd) { + this.drpEstabelecimentoMed = dd; + } + + //
+ boolean isPostback = false; + + private HiddenField hidHighlight = new HiddenField(); + + public HiddenField getHidHighlight() { + return hidHighlight; + } + + public void setHidHighlight(HiddenField hf) { + this.hidHighlight = hf; + } + + private HiddenField hidClear = new HiddenField(); + + public HiddenField getHidClear() { + return hidClear; + } + + public void setHidClear(HiddenField hf) { + this.hidClear = hf; + } + + private HtmlPanelGrid gridPanel8 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel8() { + return gridPanel8; + } + + public void setGridPanel8(HtmlPanelGrid hpg) { + this.gridPanel8 = hpg; + } + + private PanelGroup groupPanel7 = new PanelGroup(); + + public PanelGroup getGroupPanel7() { + return groupPanel7; + } + + public void setGroupPanel7(PanelGroup pg) { + this.groupPanel7 = pg; + } + + private StaticText staticText25 = new StaticText(); + + public StaticText getStaticText25() { + return staticText25; + } + + public void setStaticText25(StaticText st) { + this.staticText25 = st; + } + + private ImageComponent image3 = new ImageComponent(); + + public ImageComponent getImage3() { + return image3; + } + + public void setImage3(ImageComponent ic) { + this.image3 = ic; + } + + private StaticText staticText26 = new StaticText(); + + public StaticText getStaticText26() { + return staticText26; + } + + public void setStaticText26(StaticText st) { + this.staticText26 = st; + } + private RadioButton rbCatDirNacSeg = new RadioButton(); + + public RadioButton getRbCatDirNacSeg() { + return rbCatDirNacSeg; + } + + public void setRbCatDirNacSeg(RadioButton rb) { + this.rbCatDirNacSeg = rb; + } + private RadioButton rbCatDirLoja = new RadioButton(); + + public RadioButton getRbCatDirLoja() { + return rbCatDirLoja; + } + + public void setRbCatDirLoja(RadioButton rb) { + this.rbCatDirLoja = rb; + } + private StaticText lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + /** + *

Construct a new Page bean instance.

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

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("NovoUtilizador 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 . . . + } + } + else + { + lblUser.setText( getSessionBean1().getCurrentUser().getLogin() ); + + HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); + String referer = request.getRequestURI(); + String pageFrom = Utils.getPageFrom(referer); + if(!pageFrom.matches("NovoUtilizador.jsp")) + { + isPostback = false; + } + else + { + isPostback = true; + } + + } + + } + + /** + *

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() { + if(!isPostback) + { + getSessionBean1().setNewUser(null); + initializePage(); + } + else + { + showPagePostback(); + } + + 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 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"); + } + + public String lnkEditUser_action() { + // TODO: Replace with your code + + getSessionBean1().setNavFrom("NovoUtilizador"); + getSessionBean1().setModoEdicaoUtilizador("edit"); + return "user"; + + } + + public String lnkLogout_action() { + // TODO: Replace with your code + + try + { + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + } + catch(Exception ex){} + + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) {} + //return "login"; + return null; + + } + + public void drpTipo_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + + } + + public void drpNome_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + + } + + 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 "gestao_utilizadores"; + } + + public String butApagar_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 butContinuar_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + AnalisesDataProvider adp = new AnalisesDataProvider(); + + if(rbCatHs.getSelected() != null) + { + if(rbCatHs.getSelected().equals(new Boolean(true))) + { + if(drpNomeHs.getSelected().equals(new Integer(0) )) + { + getSessionBean1().setMsg("Falta nome do técnico de higiena e segurança!"); + return null; + } + else if(txtCap.getText() == null) + { + getSessionBean1().setMsg("Falta cap!"); + return null; + } + else + { + String cap = (String) txtCap.getText(); + if(cap.trim().length() == 0) + { + getSessionBean1().setMsg("Falta cap!"); + return null; + } + else + { + NewUser u = new NewUser(); + u.setTipo(new Integer(3)); + u.setNumero_mecanografico(""); + try + { + u.setTipo_descricao(adp.getTipoDescricao(u.getTipo())); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + u.setFuncionario_hst_id((Integer) drpNomeHs.getSelected()); + try + { + Integer tecnico_id = (Integer) drpNomeHs.getSelected(); + u.setNome(Utils.unicodeToHTML(adp.getTecnicoSaudeNome(tecnico_id))); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + u.setCap(cap); + u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id()); + u.setResponsavel_loja("n"); + u.setEstabelecimento(null); + getSessionBean1().setNewUser(u); + getSessionBean1().setModoEdicaoUtilizador("new"); + getSessionBean1().setNavFrom("NovoUtilizador"); + return "new_user_fields"; + } + } + } + } + else if(rbCatMed.getSelected() != null) + { + if(rbCatMed.getSelected().equals(new Boolean(true))) + { + if(drpNomeMed.getSelected().equals(new Integer(0))) + { + getSessionBean1().setMsg("Falta nome do médico!"); + return null; + } + else if(drpEstabelecimentoMed.getSelected().equals(new Integer(-1))) + { + getSessionBean1().setMsg("Falta estabelecimento!"); + return null; + } + else + { + NewUser u = new NewUser(); + u.setTipo(new Integer(5)); + u.setNumero_mecanografico(""); + try + { + u.setTipo_descricao(adp.getTipoDescricao(u.getTipo())); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + u.setMedico_id((Integer) drpNomeMed.getSelected()); + //u.setNome(drpNomeMed.getLabel()); + Medico m = null; + try + { + Integer medico_id = (Integer) drpNomeMed.getSelected(); + m = adp.getMedico(medico_id); + u.setNome(m.getNome()); + u.setNumero_cedula(m.getNumero_cedula()); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id()); + u.setEstabelecimento((Integer) drpEstabelecimentoMed.getSelected()); + try + { + u.setEstabelecimento_descricao(adp.getEstabelecimentoNome(u.getEstabelecimento())); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + u.setResponsavel_loja("n"); + getSessionBean1().setNewUser(u); + getSessionBean1().setModoEdicaoUtilizador("new"); + getSessionBean1().setNavFrom("NovoUtilizador"); + return "new_user_fields"; + } + } + } + else // + { + if(getSessionBean1().getNewUser() == null) + { + boolean booOutro = false; + NewUser u = new NewUser(); + if(txtNomeOutro.getText() != null) + { + String nome_outro = (String) txtNomeOutro.getText(); + if(nome_outro.trim().length() > 0) + { + u.setNome(nome_outro); + booOutro = true; + } + else + { + getSessionBean1().setMsg("Falta designação!"); + return null; + } + } + else + { + getSessionBean1().setMsg("Falta designação!"); + return null; + } + Integer estabelecimento_outro = (Integer) drpEstabelecimentoOutro.getSelected(); + System.out.println("ESTABELECIMENTO OUTRO : " + estabelecimento_outro.intValue()); + if(estabelecimento_outro.intValue() == -1) + { + getSessionBean1().setMsg("Falta estabelecimento!"); + return null; + } + else + { + u.setEstabelecimento(estabelecimento_outro); + try + { + u.setEstabelecimento_descricao(adp.getEstabelecimentoNome(estabelecimento_outro)); + booOutro = true; + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + u = setUserTipo(u); + u.setNumero_mecanografico(""); + u.setResponsavel_loja("n"); + u.setGestor_geral("n"); + switch(u.getTipo().intValue()) + { + case 1: //seg + if(chkSegResp.getSelected() != null) + { + if(chkSegResp.getSelected().equals(new Boolean(true))) + { + u.setResponsavel_loja("y"); + } + } + break; + case 2: //rh + if(chkRhResp.getSelected() != null) + { + if(chkRhResp.getSelected().equals(new Boolean(true))) + { + u.setResponsavel_loja("y"); + } + } + break; + case 6: //gestor + if(chkGestaoGeral.getSelected() != null) + { + if(chkGestaoGeral.getSelected().equals(new Boolean(true))) + { + u.setGestor_geral("y"); + } + } + + break; + } + u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id()); + if(booOutro) + { + getSessionBean1().setNewUser(u); + getSessionBean1().setModoEdicaoUtilizador("new"); + getSessionBean1().setNavFrom("NovoUtilizador"); + return "new_user_fields"; + } + getSessionBean1().setNewUser(u); + } + } + + if(getSessionBean1().getNewUser() == null) + { + getSessionBean1().setMsg("Tem de definir um novo utilizador !"); + return null; + } + else + { + + getSessionBean1().setModoEdicaoUtilizador("new"); + getSessionBean1().setNavFrom("NovoUtilizador"); + return "new_user_fields"; + } + } + + + + private void initializePage() + { + getSessionBean1().getTrabalhadoresListDataProvider().setList(new ArrayList()); + int tipo = getSessionBean1().getCurrentUser().getTipo().intValue(); + switch(tipo) + { + case 7: //Director RH + pgCatDirRh.setRendered(false); + pgCatHs.setRendered(false); + pgCatMed.setRendered(false); + break; + } + + //gridUtilizador.setRendered(false); + gridTrabalhadores.setStyleClass("hidden"); + tblTrabalhadores.setStyleClass("hidden"); + gridTecnicosHs.setStyleClass("hidden"); + gridMedicos.setStyleClass("hidden"); + + rbCatDirRh.setSelected(null); + rbCatGestao.setSelected(null); + rbCatHs.setSelected(null); + rbCatMed.setSelected(null); + rbCatRh.setSelected(null); + rbCatSeg.setSelected(null); + rbCatDirNacSeg.setSelected(null); + rbCatDirLoja.setSelected(null); + + AnalisesDataProvider adp = new AnalisesDataProvider(); + + try + { + com.sun.rave.web.ui.model.Option[] listMedOptions = adp.getEstabelecimentosList( new Integer(Global.AUCHAN), new Boolean(false)); + listMedOptions[0].setLabel("-Seleccionar-"); + com.sun.rave.web.ui.model.Option[] listOutroOptions = adp.getEstabelecimentosList( getSessionBean1().getCurrentUser().getEmpresa_id(), new Boolean(false)); + listOutroOptions[0].setLabel("-Seleccionar-"); + + + getSessionBean1().setEstabelecimentosMedOptions(listMedOptions); + getSessionBean1().setEstabelecimentosOutroOptions( listOutroOptions ); + drpEstabelecimentoOutro.setSelected(new Integer(-1)); + drpEstabelecimentoMed.setSelected(new Integer(-1)); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + try + { + getSessionBean1().setTecnicosOptions(adp.getTecnicosSaudeList()); + drpNomeHs.setSelected(new Integer(0)); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + try + { + getSessionBean1().setMedicosOptions(adp.getMedicosList()); + drpNomeMed.setSelected(new Integer(0)); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + + public String butProcurarTrab_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + boolean booNrOk = false; + boolean booNomeOk = false; + String nr_mecano = null; + String nome = null; + if(txtNrMecanografico.getText() != null) + { + nr_mecano = (String) txtNrMecanografico.getText(); + if(nr_mecano.trim().length() > 0) + { + booNrOk = true; + } + else + { + nr_mecano = null; + } + } + + if(txtNomeTrabalhador.getText() != null) + { + nome = (String) txtNomeTrabalhador.getText(); + + if(nome.trim().length() > 0) + { + booNomeOk = true; + } + else + { + nome = null; + } + } + + if(! booNrOk && !booNomeOk) + { + getSessionBean1().setMsg("Tem de preencher Numero Mecanográfico ou Nome"); + return null; + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + Trabalhador t = null; + if(nome != null) + { + nome = utils.Utils.textToUnicode( nome.toUpperCase()); + } + try + { + ArrayList list = adp.searchTrabalhador(getSessionBean1().getCurrentUser().getEmpresa_id(), nr_mecano, nome ); +// if(list.size() == 1) +// { +// t = (Trabalhador) list.get(0); +// NewUser u = new NewUser(); +// +// u.setNome(t.getNome()); +// u.setNumero_mecanografico(t.getNumero_mecanografico()); +// u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id()); +// u.setEstabelecimento(t.getEstabelecimento_id()); +// u.setEstabelecimento_descricao(t.getEstabelecimento()); +// u = setUserTipo(u); +// u.setResponsavel_loja("n"); +// if(u.getTipo().intValue() == 1) //seg +// { +// if(chkSegResp.getSelected() != null) +// { +// if(chkSegResp.getSelected().equals(new Boolean(true))) +// { +// u.setResponsavel_loja("y"); +// } +// } +// } +// else if(u.getTipo().intValue() == 2) //rh +// { +// if(chkRhResp.getSelected() != null) +// { +// if(chkRhResp.getSelected().equals(new Boolean(true))) +// { +// u.setResponsavel_loja("y"); +// } +// } +// } +// getSessionBean1().setNewUser(u); +// } +// else +// { + //tblTrabalhadores.setRendered(true); + gridTrabalhadores.setStyleClass(""); + tblTrabalhadores.setStyleClass(""); + getSessionBean1().getTrabalhadoresListDataProvider().setList(list); +// } + } + catch(Exception ex) + { + getSessionBean1().setMsg("Trabalhador inexistente !"); + getSessionBean1().getTrabalhadoresListDataProvider().setList(new ArrayList()); + tblTrabalhadores.setStyleClass("hidden"); + ex.printStackTrace(); + } + return null; + } + + public String lnkPOR_action() { + // TODO: Replace with your code + Trabalhador t = getTrabalhadorRowData(); + NewUser u = new NewUser(); + u = setUserTipo(u); + u.setNome(t.getNome()); + u.setNumero_mecanografico(t.getNumero_mecanografico()); + u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id()); + u.setEstabelecimento(t.getEstabelecimento_id()); + u.setEstabelecimento_descricao(t.getEstabelecimento()); + u.setResponsavel_loja("n"); + u.setGestor_geral("n"); + if(u.getTipo().intValue() == 1) //seg + { + if(chkSegResp.getSelected() != null) + { + if(chkSegResp.getSelected().equals(new Boolean(true))) + { + u.setResponsavel_loja("y"); + } + } + } + else if(u.getTipo().intValue() == 2) //rh + { + if(chkRhResp.getSelected() != null) + { + if(chkRhResp.getSelected().equals(new Boolean(true))) + { + u.setResponsavel_loja("y"); + } + } + } + else if(u.getTipo().intValue() == 6) //gestor + { + if(chkGestaoGeral.getSelected() != null) + { + if(chkGestaoGeral.getSelected().equals(new Boolean(true))) + { + u.setGestor_geral("y"); + } + } + + } + + + getSessionBean1().setNewUser(u); + getSessionBean1().setModoEdicaoUtilizador("new"); + getSessionBean1().setNavFrom("NovoUtilizador"); + + return "new_user_fields"; + } + + public String lnkNomeTrabalhador_action() { + // TODO: Replace with your code + Trabalhador t = getTrabalhadorRowData(); + NewUser u = new NewUser(); + u = setUserTipo(u); + u.setNome(t.getNome()); + u.setNumero_mecanografico(t.getNumero_mecanografico()); + u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id()); + u.setEstabelecimento(t.getEstabelecimento_id()); + u.setEstabelecimento_descricao(t.getEstabelecimento()); + u.setResponsavel_loja("n"); + u.setGestor_geral("n"); + if(u.getTipo().intValue() == 1) //seg + { + if(chkSegResp.getSelected() != null) + { + if(chkSegResp.getSelected().equals(new Boolean(true))) + { + u.setResponsavel_loja("y"); + } + } + } + else if(u.getTipo().intValue() == 2) //rh + { + if(chkRhResp.getSelected() != null) + { + if(chkRhResp.getSelected().equals(new Boolean(true))) + { + u.setResponsavel_loja("y"); + } + } + } + else if(u.getTipo().intValue() == 6) //gestor + { + if(chkGestaoGeral.getSelected() != null) + { + if(chkGestaoGeral.getSelected().equals(new Boolean(true))) + { + u.setGestor_geral("y"); + } + } + + } + + getSessionBean1().setNewUser(u); + getSessionBean1().setModoEdicaoUtilizador("new"); + getSessionBean1().setNavFrom("NovoUtilizador"); + + return "new_user_fields"; + } + + public String lnkEstabelecimentoTrabalhador_action() { + // TODO: Replace with your code + Trabalhador t = getTrabalhadorRowData(); + NewUser u = new NewUser(); + u = setUserTipo(u); + u.setNome(t.getNome()); + u.setNumero_mecanografico(t.getNumero_mecanografico()); + u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id()); + u.setEstabelecimento(t.getEstabelecimento_id()); + u.setEstabelecimento_descricao(t.getEstabelecimento()); + u.setResponsavel_loja("n"); + u.setGestor_geral("n"); + if(u.getTipo().intValue() == 1) //seg + { + if(chkSegResp.getSelected() != null) + { + if(chkSegResp.getSelected().equals(new Boolean(true))) + { + u.setResponsavel_loja("y"); + } + } + } + else if(u.getTipo().intValue() == 2) //rh + { + if(chkRhResp.getSelected() != null) + { + if(chkRhResp.getSelected().equals(new Boolean(true))) + { + u.setResponsavel_loja("y"); + } + } + } + else if(u.getTipo().intValue() == 6) //gestor + { + if(chkGestaoGeral.getSelected() != null) + { + if(chkGestaoGeral.getSelected().equals(new Boolean(true))) + { + u.setGestor_geral("y"); + } + } + + } + + getSessionBean1().setNewUser(u); + getSessionBean1().setModoEdicaoUtilizador("new"); + getSessionBean1().setNavFrom("NovoUtilizador"); + + return "new_user_fields"; + } + + private Trabalhador getTrabalhadorRowData() + { + RowKey rk = tableRowGroup1.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + TrabalhadoresListDataProvider provider = (TrabalhadoresListDataProvider) tableRowGroup1.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + Trabalhador t = (Trabalhador)list.get(k); + hidHighlight.setValue(rk.getRowId()); + return t; + } + + private NewUser setUserTipo(NewUser u) + { + if(rbCatDirNacSeg.getSelected() != null) + { + if(rbCatDirNacSeg.getSelected().equals(new Boolean(true))) + { + u.setTipo(new Integer(10)); + } + } + if(rbCatDirLoja.getSelected() != null) + { + if(rbCatDirLoja.getSelected().equals(new Boolean(true))) + { + u.setTipo(new Integer(9)); + } + } + if(rbCatDirRh.getSelected() != null) + { + if(rbCatDirRh.getSelected().equals(new Boolean(true))) + { + u.setTipo(new Integer(7)); + } + } + if(rbCatGestao.getSelected() != null) + { + if(rbCatGestao.getSelected().equals(new Boolean(true))) + { + u.setTipo(new Integer(6)); + } + } + if(rbCatRh.getSelected() != null) + { + if(rbCatRh.getSelected().equals(new Boolean(true))) + { + u.setTipo(new Integer(2)); + } + } + if(rbCatSeg.getSelected() != null) + { + if(rbCatSeg.getSelected().equals(new Boolean(true))) + { + u.setTipo(new Integer(1)); + } + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + u.setTipo_descricao(adp.getTipoDescricao(u.getTipo())); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + return u; + } + + private void showPagePostback() + { + if(rbCatDirRh.getSelected() != null) + { + if(rbCatDirRh.getSelected().equals( new Boolean(true) )) + { + gridTrabalhadores.setStyleClass(""); + return; + } + } + + if(rbCatGestao.getSelected() != null) + { + if(rbCatGestao.getSelected().equals( new Boolean(true) )) + { + gridTrabalhadores.setStyleClass(""); + return; + } + } + + if(rbCatRh.getSelected() != null) + { + if(rbCatRh.getSelected().equals( new Boolean(true) )) + { + gridTrabalhadores.setStyleClass(""); + return; + } + } + if(rbCatSeg.getSelected() != null) + { + if(rbCatSeg.getSelected().equals( new Boolean(true) )) + { + gridTrabalhadores.setStyleClass(""); + return; + } + } + + if(rbCatHs.getSelected() != null) + { + if(rbCatHs.getSelected().equals( new Boolean(true) )) + { + gridTecnicosHs.setStyleClass(""); + return; + } + } + + if(rbCatMed.getSelected() != null) + { + if(rbCatMed.getSelected().equals( new Boolean(true) )) + { + gridMedicos.setStyleClass(""); + return; + } + } + + } + +// public String getColumnStyle(){ +// TableRowDataProvider trdp = (TableRowDataProvider) getBean("currentRow"); +// RowKey rowKey = trdp.getTableRow(); +// System.out.println(rowKey); +// if ((Integer.parseInt(rowKey.getRowId()) % 2) == 0){ +// return " "; +// } +// else { +// return "background-color: #eeeeee"; +// } +// } + + private void setNewUser() + { + + NewUser u = new NewUser(); + u = setUserTipo(u); + u.setNumero_mecanografico(""); + u.setResponsavel_loja("n"); + u.setGestor_geral("n"); + switch(u.getTipo().intValue()) + { + case 1: //seg + if(chkSegResp.getSelected() != null) + { + if(chkSegResp.getSelected().equals(new Boolean(true))) + { + u.setResponsavel_loja("y"); + } + } + break; + case 2: //rh + if(chkRhResp.getSelected() != null) + { + if(chkRhResp.getSelected().equals(new Boolean(true))) + { + u.setResponsavel_loja("y"); + } + } + break; + case 6: //gestor + if(chkGestaoGeral.getSelected() != null) + { + if(chkGestaoGeral.getSelected().equals(new Boolean(true))) + { + u.setGestor_geral("y"); + } + } + + break; + } + u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id()); + + } + + public String lnkNewUser_action() { + // TODO: Replace with your code + + + return "gestao_utilizadores"; + } + + public String lnkAnalisesAcidente_action() { + // TODO: Replace with your code + Integer tipo_utilizador = getSessionBean1().getCurrentUser().getTipo(); + if(tipo_utilizador.intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP) + { + return "form_dir_siprp"; + } + else if(tipo_utilizador.intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_GERAL_RH) + { + return "form_dir_ger_rh"; + } + + return null; + } + + public void rbCatRh_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + } + + public void rbCatHs_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + + } + + public String lnkAjuda_action() { + // TODO: Replace with your code +// ServletContext theApplicationsServletContext = +// (ServletContext) this.getExternalContext().getContext(); +// String pdfFolderPath = theApplicationsServletContext.getRealPath(Global.PDF_FOLDER_URL); +// String pdfFilePath = pdfFolderPath + "/Ajuda.pdf"; +// +// Global global = new Global(); +// try +// { +// global.showPdf(pdfFilePath); +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } + return null; + } + + public String lnkPlanosActuacao_action() { + // TODO: Replace with your code + Utilizador u = getSessionBean1().getCurrentUser(); +// String curUser = "?user=" + u.getId().toString(); + FacesContext fc = getFacesContext().getCurrentInstance(); + Global.redirectToPlanos(fc, u); + return null; + } +} + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Permissao.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Permissao.java new file mode 100644 index 00000000..31b0be5b --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Permissao.java @@ -0,0 +1,49 @@ +/* + * Permissao.java + * + * Created on October 25, 2007, 4:40 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class Permissao { + private Integer id; + private Integer user_id; + private Integer codigo_permissao; + + /** Creates a new instance of Permissao */ + public Permissao() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getUser_id() { + return user_id; + } + + public void setUser_id(Integer user_id) { + this.user_id = user_id; + } + + public Integer getCodigo_permissao() { + return codigo_permissao; + } + + public void setCodigo_permissao(Integer codigo_permissao) { + this.codigo_permissao = codigo_permissao; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Recomendacao.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Recomendacao.java new file mode 100644 index 00000000..85aea13e --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Recomendacao.java @@ -0,0 +1,49 @@ +/* + * Recomendacao.java + * + * Created on October 16, 2007, 3:13 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class Recomendacao { + private Integer id; + private Integer analise_id; + private String recomendacao; + + /** Creates a new instance of Recomendacao */ + public Recomendacao() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getAnalise_id() { + return analise_id; + } + + public void setAnalise_id(Integer analise_id) { + this.analise_id = analise_id; + } + + public String getRecomendacao() { + return recomendacao; + } + + public void setRecomendacao(String recomendacao) { + this.recomendacao = recomendacao; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/RecuperarPassword.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/RecuperarPassword.java new file mode 100644 index 00000000..9bd25837 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/RecuperarPassword.java @@ -0,0 +1,527 @@ +/* + * 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 global.Global; +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; +import utils.Utils; + +/** + *

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(), Global.ENDERECO_ENVIO); + getSessionBean1().setMsg("A sua password foi enviada para o seu email"); + return "login"; + } + catch(Exception ex) + { + getSessionBean1().setMsg("Erro no envio da password !"); + ex.printStackTrace(); + } + + } + 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", "mail2.evolute.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(! Utils.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/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/RequestBean1.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/RequestBean1.java new file mode 100644 index 00000000..66ece1e4 --- /dev/null +++ b/branches/SIPRP/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/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Seccao.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Seccao.java new file mode 100644 index 00000000..f096a6f6 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Seccao.java @@ -0,0 +1,58 @@ +/* + * Seccao.java + * + * Created on December 28, 2007, 11:17 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class Seccao { + private Integer id; + private String descricao; + private Integer departamento_id; + private String activo; + + /** Creates a new instance of Seccao */ + public Seccao() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public Integer getDepartamento_id() { + return departamento_id; + } + + public void setDepartamento_id(Integer departamento_id) { + this.departamento_id = departamento_id; + } + + public String getActivo() { + return activo; + } + + public void setActivo(String activo) { + this.activo = activo; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/SessionBean1.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/SessionBean1.java new file mode 100644 index 00000000..5fe5c2fb --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/SessionBean1.java @@ -0,0 +1,743 @@ +/* + * 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 { + } + //
+ private String logoEmpresaUrl = ""; + /** + *

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(); + setEstadosCorrecaoDataProvider(new db.EstadosCorrecaoDataProvider()); + utilizadoresActivosListDataProvider = new db.UtilizadoresActivosListDataProvider(); + utilizadoresInactivosListDataProvider = new db.UtilizadoresInactivosListDataProvider(); + + setNavFrom(""); + setAcidentado(null); + setCurrentAnalise(null); + setLoggedIn(false); + + modoEdicaoUtilizador = ""; + setIdSequence(1); + setNewUser(null); + setEditUser(null); + setUserDeleted(false); + setMudarPassword(false); + setFromAjuda(false); + setGravado(false); + setSubmetido(false); + setFromAnaliseDeletion(false); + setIeBug(false); + setCorrecao(null); + } + + /** + *

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; + private db.EstadosCorrecaoDataProvider estadosCorrecaoDataProvider; + private db.UtilizadoresActivosListDataProvider utilizadoresActivosListDataProvider; + private db.UtilizadoresInactivosListDataProvider utilizadoresInactivosListDataProvider; + + 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; + } + + public db.EstadosCorrecaoDataProvider getEstadosCorrecaoDataProvider() { + return estadosCorrecaoDataProvider; + } + + public void setEstadosCorrecaoDataProvider(db.EstadosCorrecaoDataProvider estadosCorrecaoDataProvider) { + this.estadosCorrecaoDataProvider = estadosCorrecaoDataProvider; + } + + public db.UtilizadoresActivosListDataProvider getUtilizadoresActivosListDataProvider() { + return utilizadoresActivosListDataProvider; + } + + public void setUtilizadoresActivosListDataProvider(db.UtilizadoresActivosListDataProvider utilizadoresActivosListDataProvider) { + this.utilizadoresActivosListDataProvider = utilizadoresActivosListDataProvider; + } + + public db.UtilizadoresInactivosListDataProvider getUtilizadoresInactivosListDataProvider() { + return utilizadoresInactivosListDataProvider; + } + + public void setUtilizadoresInactivosListDataProvider(db.UtilizadoresInactivosListDataProvider utilizadoresInactivosListDataProvider) { + this.utilizadoresInactivosListDataProvider = utilizadoresInactivosListDataProvider; + } + + 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 com.sun.rave.web.ui.model.Option[] departamentoOptions; + + private Integer departamentoChoice; + + public Integer getDepartamentoChoice() { + return departamentoChoice; + } + + public void setDepartamentoChoice(Integer departamentoChoice) { + this.departamentoChoice = departamentoChoice; + } + + public com.sun.rave.web.ui.model.Option[] getDepartamentoOptions() { + return departamentoOptions; + } + + public void setDepartamentoOptions(com.sun.rave.web.ui.model.Option[] departamentoOptions) { + this.departamentoOptions = departamentoOptions; + } + + private com.sun.rave.web.ui.model.Option[] seccaoOptions; + + private Integer seccaoChoice; + + public Integer getSeccaoChoice() { + return seccaoChoice; + } + + public void setSeccaoChoice(Integer seccaoChoice) { + this.seccaoChoice = seccaoChoice; + } + + public com.sun.rave.web.ui.model.Option[] getSeccaoOptions() { + return seccaoOptions; + } + + public void setSeccaoOptions(com.sun.rave.web.ui.model.Option[] seccaoOptions) { + this.seccaoOptions = seccaoOptions; + } + + 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 Acidentado acidentado; + + public Acidentado getAcidentado() { + return acidentado; + } + + public void setAcidentado(Acidentado 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; + } + + private String modoEdicaoUtilizador; + + public String getModoEdicaoUtilizador() { + return modoEdicaoUtilizador; + } + + public void setModoEdicaoUtilizador(String modoEdicaoUtilizador) { + this.modoEdicaoUtilizador = modoEdicaoUtilizador; + } + + private Integer tipoChoice; + + public Integer getTipoChoice() { + return tipoChoice; + } + + public void setTipoChoice(Integer tipoChoice) { + this.tipoChoice = tipoChoice; + } + + private com.sun.rave.web.ui.model.Option[] tiposOptions; + + public com.sun.rave.web.ui.model.Option[] getTiposOptions() { + return tiposOptions; + } + + public void setTiposOptions(com.sun.rave.web.ui.model.Option[] tiposOptions) { + this.tiposOptions = tiposOptions; + } + + + private Integer estabelecimentoChoice; + + public Integer getEstabelecimentoChoice() { + return estabelecimentoChoice; + } + + public void setEstabelecimentoChoice(Integer estabelecimentoChoice) { + this.estabelecimentoChoice = estabelecimentoChoice; + } + + private com.sun.rave.web.ui.model.Option[] estabelecimentosOptions; + + public com.sun.rave.web.ui.model.Option[] getEstabelecimentosOptions() { + return estabelecimentosOptions; + } + + public void setEstabelecimentosOptions(com.sun.rave.web.ui.model.Option[] estabelecimentosOptions) { + this.estabelecimentosOptions = estabelecimentosOptions; + } + + private Integer estabelecimentoGestorChoice; + + public Integer getEstabelecimentoGestorChoice() { + return estabelecimentoGestorChoice; + } + + public void setEstabelecimentoGestorChoice(Integer estabelecimentoGestorChoice) { + this.estabelecimentoGestorChoice = estabelecimentoGestorChoice; + } + + private com.sun.rave.web.ui.model.Option[] estabelecimentosGestorOptions; + + public com.sun.rave.web.ui.model.Option[] getEstabelecimentosGestorOptions() { + return estabelecimentosGestorOptions; + } + + public void setEstabelecimentosGestorOptions(com.sun.rave.web.ui.model.Option[] estabelecimentosGestorOptions) { + this.estabelecimentosGestorOptions = estabelecimentosGestorOptions; + } + + + + // + private Integer estabelecimentoOutroChoice; + + public Integer getEstabelecimentoOutroChoice() { + return estabelecimentoOutroChoice; + } + + public void setEstabelecimentoOutroChoice(Integer estabelecimentoOutroChoice) { + this.estabelecimentoOutroChoice = estabelecimentoOutroChoice; + } + + + + private com.sun.rave.web.ui.model.Option[] estabelecimentosOutroOptions; + + public com.sun.rave.web.ui.model.Option[] getEstabelecimentosOutroOptions() { + return estabelecimentosOutroOptions; + } + + public void setEstabelecimentosOutroOptions(com.sun.rave.web.ui.model.Option[] estabelecimentosOutroOptions) { + this.estabelecimentosOutroOptions = estabelecimentosOutroOptions; + } + + + private Integer estabelecimentoMedChoice; + + public Integer getEstabelecimentoMedChoice() { + return estabelecimentoMedChoice; + } + + public void setEstabelecimentoMedChoice(Integer estabelecimentoMedChoice) { + this.estabelecimentoMedChoice = estabelecimentoMedChoice; + } + + private com.sun.rave.web.ui.model.Option[] estabelecimentosMedOptions; + + public com.sun.rave.web.ui.model.Option[] getEstabelecimentosMedOptions() { + return estabelecimentosMedOptions; + } + + public void setEstabelecimentosMedOptions(com.sun.rave.web.ui.model.Option[] estabelecimentosMedOptions) { + this.estabelecimentosMedOptions = estabelecimentosMedOptions; + } + + private Integer tecnicoChoice; + + public Integer getTecnicoChoice() { + return tecnicoChoice; + } + + public void setTecnicoChoice(Integer tecnicoChoice) { + this.tecnicoChoice = tecnicoChoice; + } + + private com.sun.rave.web.ui.model.Option[] tecnicosOptions; + + public com.sun.rave.web.ui.model.Option[] getTecnicosOptions() { + return tecnicosOptions; + } + + public void setTecnicosOptions(com.sun.rave.web.ui.model.Option[] tecnicosOptions) { + this.tecnicosOptions = tecnicosOptions; + } + + + private Integer medicoChoice; + + public Integer getMedicoChoice() { + return medicoChoice; + } + + public void setMedicoChoice(Integer medicoChoice) { + this.medicoChoice = medicoChoice; + } + + private com.sun.rave.web.ui.model.Option[] medicosOptions; + + public com.sun.rave.web.ui.model.Option[] getMedicosOptions() { + return medicosOptions; + } + + public void setMedicosOptions(com.sun.rave.web.ui.model.Option[] medicosOptions) { + this.medicosOptions = medicosOptions; + } + + + // Clock : + private Integer horaChoice; + + public Integer getHoraChoice() { + return horaChoice; + } + + public void setHoraChoice(Integer horaChoice) { + this.horaChoice = horaChoice; + } + + private com.sun.rave.web.ui.model.Option[] horasOptions; + + public com.sun.rave.web.ui.model.Option[] getHorasOptions() { + return horasOptions; + } + + public void setHorasOptions(com.sun.rave.web.ui.model.Option[] horasOptions) { + this.horasOptions = horasOptions; + } + + + private Integer minutoChoice; + + public Integer getMinutoChoice() { + return minutoChoice; + } + + public void setMinutoChoice(Integer minutoChoice) { + this.minutoChoice = minutoChoice; + } + + private com.sun.rave.web.ui.model.Option[] minutosOptions; + + public com.sun.rave.web.ui.model.Option[] getMinutosOptions() { + return minutosOptions; + } + + public void setMinutosOptions(com.sun.rave.web.ui.model.Option[] minutosOptions) { + this.minutosOptions = minutosOptions; + } + + + private Integer causaChoice; + + public Integer getCausaChoice() { + return causaChoice; + } + + public void setCausaChoice(Integer causaChoice) { + this.causaChoice = causaChoice; + } + + private com.sun.rave.web.ui.model.Option[] causasOptions; + + public com.sun.rave.web.ui.model.Option[] getCausasOptions() { + return causasOptions; + } + + public void setCausasOptions(com.sun.rave.web.ui.model.Option[] causasOptions) { + this.causasOptions = causasOptions; + } + + private int idSequence; + + public int getIdSequence() { + return idSequence; + } + + public void setIdSequence(int idSequence) { + this.idSequence = idSequence; + } + + private NewUser newUser; + + public NewUser getNewUser() { + return newUser; + } + + public void setNewUser(NewUser newUser) { + this.newUser = newUser; + } + + private Utilizador editUser; + + public Utilizador getEditUser() { + return editUser; + } + + public void setEditUser(Utilizador editUser) { + this.editUser = editUser; + } + + private boolean userDeleted; + + public boolean isUserDeleted() { + return userDeleted; + } + + public void setUserDeleted(boolean userDeleted) { + this.userDeleted = userDeleted; + } + + private boolean mudarPassword; + + public boolean isMudarPassword() { + return mudarPassword; + } + + public void setMudarPassword(boolean mudarPassword) { + this.mudarPassword = mudarPassword; + } + + private Medico medico; + + public Medico getMedico() { + return medico; + } + + public void setMedico(Medico medico) { + this.medico = medico; + } + + private boolean fromAjuda; + + public boolean isFromAjuda() { + return fromAjuda; + } + + public void setFromAjuda(boolean fromAjuda) { + this.fromAjuda = fromAjuda; + } + + private boolean submetido; + + private boolean gravado; + + public boolean isSubmetido() { + return submetido; + } + + public void setSubmetido(boolean submetido) { + this.submetido = submetido; + } + + public boolean isGravado() { + return gravado; + } + + public void setGravado(boolean gravado) { + this.gravado = gravado; + } + + private boolean fromAnaliseDeletion; + + public boolean isFromAnaliseDeletion() { + return fromAnaliseDeletion; + } + + public void setFromAnaliseDeletion(boolean fromAnaliseDeletion) { + this.fromAnaliseDeletion = fromAnaliseDeletion; + } + + private boolean ieBug; + + public boolean isIeBug() { + return ieBug; + } + + public void setIeBug(boolean ieBug) { + this.ieBug = ieBug; + } + + private analiseacidentestrabalho.Correcao correcao; + + public analiseacidentestrabalho.Correcao getCorrecao() { + return correcao; + } + + public void setCorrecao(analiseacidentestrabalho.Correcao correcao) { + this.correcao = correcao; + } + + public String getLogoEmpresaUrl() { + return logoEmpresaUrl; + } + + public void setLogoEmpresaUrl(String logoEmpresaUrl) { + this.logoEmpresaUrl = logoEmpresaUrl; + + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/TecnicoSaude.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/TecnicoSaude.java new file mode 100644 index 00000000..7980ae83 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/TecnicoSaude.java @@ -0,0 +1,44 @@ +/* + * TecnicoSaude.java + * + * Created on October 12, 2007, 11:00 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class TecnicoSaude { + private Integer id; + private String nome; + + /** Creates a new instance of TecnicoSaude */ + public TecnicoSaude() { + } + + 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 String toString() { + return utils.Utils.unicodeToHTML(nome); + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/TipoUtilizador.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/TipoUtilizador.java new file mode 100644 index 00000000..749160c9 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/TipoUtilizador.java @@ -0,0 +1,67 @@ +/* + * TipoUtilizador.java + * + * Created on October 11, 2007, 4:32 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class TipoUtilizador { + private Integer id; + private Integer tipo; + private String descricao; + private String activo; + private Integer ordem; + + /** Creates a new instance of TipoUtilizador */ + public TipoUtilizador() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getTipo() { + return tipo; + } + + public void setTipo(Integer tipo) { + this.tipo = tipo; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public String getActivo() { + return activo; + } + + public void setActivo(String activo) { + this.activo = activo; + } + + public Integer getOrdem() { + return ordem; + } + + public void setOrdem(Integer ordem) { + this.ordem = ordem; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Top.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Top.java new file mode 100644 index 00000000..d183ddf6 --- /dev/null +++ b/branches/SIPRP/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/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Trabalhador.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Trabalhador.java new file mode 100644 index 00000000..446c026e --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Trabalhador.java @@ -0,0 +1,95 @@ +/* + * 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; + private String funcao; + private java.sql.Date data_admissao; + private String numero_mecanografico; + private Integer estabelecimento_id; + private String estabelecimento; + + + /** 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; + } + + public String getFuncao() { + return funcao; + } + + public void setFuncao(String funcao) { + this.funcao = funcao; + } + + public java.sql.Date getData_admissao() { + return data_admissao; + } + + public void setData_admissao(java.sql.Date data_admissao) { + this.data_admissao = data_admissao; + } + + public String getNumero_mecanografico() { + return numero_mecanografico; + } + + public void setNumero_mecanografico(String numero_mecanografico) { + this.numero_mecanografico = numero_mecanografico; + } + + public String getEstabelecimento() { + return estabelecimento; + } + + public void setEstabelecimento(String estabelecimento) { + this.estabelecimento = estabelecimento; + } + + public Integer getEstabelecimento_id() { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_id) { + this.estabelecimento_id = estabelecimento_id; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Utilizador.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Utilizador.java new file mode 100644 index 00000000..e0f723b8 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Utilizador.java @@ -0,0 +1,265 @@ +/* + * 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; + +import java.sql.Date; + +/** + * + * @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 tipo; + private String numero_cedula; + private String cap; + + private Integer codigo_permissao; + + private String nome; + + private Integer medico_id; + private Integer funcionario_hst_id; + + private String activo; + + private Integer acesso; + private String responsavel_loja; + private String gestor_geral; + + private String numero_mecanografico; + private String categoria; //descricao do 'tipo'' + private String nome_estabelecimento; + + private String primeiro_login; + + private String apagado; + + private Date data_password; + + private Integer estabelecimento_gestor = null; + + /** 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; + } + + public Integer getTipo() { + return tipo; + } + + public void setTipo(Integer tipo) { + this.tipo = tipo; + } + + public String getNumero_cedula() { + return numero_cedula; + } + + public void setNumero_cedula(String numero_cedula) { + this.numero_cedula = numero_cedula; + } + + public String getCap() { + return cap; + } + + public void setCap(String cap) { + this.cap = cap; + } + + public String getNome() { + return nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public Integer getMedico_id() { + return medico_id; + } + + public void setMedico_id(Integer medico_id) { + this.medico_id = medico_id; + } + + public Integer getFuncionario_hst_id() { + return funcionario_hst_id; + } + + public void setFuncionario_hst_id(Integer funcionario_hst_id) { + this.funcionario_hst_id = funcionario_hst_id; + } + + public String getActivo() { + return activo; + } + + public void setActivo(String activo) { + this.activo = activo; + } + + public Integer getAcesso() { + return acesso; + } + + public void setAcesso(Integer acesso) { + this.acesso = acesso; + } + + public String getResponsavel_loja() { + return responsavel_loja; + } + + public void setResponsavel_loja(String responsavel_loja) { + this.responsavel_loja = responsavel_loja; + } + + public String getNumero_mecanografico() { + return numero_mecanografico; + } + + public void setNumero_mecanografico(String numero_mecanografico) { + this.numero_mecanografico = numero_mecanografico; + } + + public String getCategoria() { + return categoria; + } + + public void setCategoria(String categoria) { + this.categoria = categoria; + } + + public String getNome_estabelecimento() { + return nome_estabelecimento; + } + + public void setNome_estabelecimento(String nome_estabelecimento) { + this.nome_estabelecimento = nome_estabelecimento; + } + + public String getGestor_geral() { + return gestor_geral; + } + + public void setGestor_geral(String gestor_geral) { + this.gestor_geral = gestor_geral; + } + + public String getPrimeiro_login() { + return primeiro_login; + } + + public void setPrimeiro_login(String primeiro_login) { + this.primeiro_login = primeiro_login; + } + + public String getApagado() { + return apagado; + } + + public void setApagado(String apagado) { + this.apagado = apagado; + } + + public Date getData_password() { + return data_password; + } + + public void setData_password(Date data_password) { + this.data_password = data_password; + } + + /** + * @return the estabelecimento_gestor + */ + public Integer getEstabelecimento_gestor() { + return estabelecimento_gestor; + } + + /** + * @param estabelecimento_gestor the estabelecimento_gestor to set + */ + public void setEstabelecimento_gestor(Integer estabelecimento_gestor) { + this.estabelecimento_gestor = estabelecimento_gestor; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/UtilizadorFields.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/UtilizadorFields.java new file mode 100644 index 00000000..726dd689 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/UtilizadorFields.java @@ -0,0 +1,1643 @@ +/* + * UtilizadorFields.java + * + * Created on December 4, 2007, 3:27 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.Checkbox; +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.HiddenField; +import com.sun.rave.web.ui.component.Html; +import com.sun.rave.web.ui.component.Hyperlink; +import com.sun.rave.web.ui.component.ImageComponent; +import com.sun.rave.web.ui.component.Link; +import com.sun.rave.web.ui.component.Page; +import com.sun.rave.web.ui.component.PanelGroup; +import com.sun.rave.web.ui.component.PasswordField; +import com.sun.rave.web.ui.component.StaticText; +import com.sun.rave.web.ui.component.TextField; +import db.AnalisesDataProvider; +import db.UtilizadoresDataProvider; +import global.Global; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.context.FacesContext; +import javax.faces.event.ValueChangeEvent; +import javax.servlet.http.HttpServletRequest; +import utils.Utils; + +/** + *

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 UtilizadorFields 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 HtmlPanelGrid gridMsg1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridMsg1() { + return gridMsg1; + } + + public void setGridMsg1(HtmlPanelGrid hpg) { + this.gridMsg1 = hpg; + } + + private StaticText txtMsg = new StaticText(); + + public StaticText getTxtMsg() { + return txtMsg; + } + + public void setTxtMsg(StaticText st) { + this.txtMsg = st; + } + + 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 PanelGroup groupPanel3 = new PanelGroup(); + + public PanelGroup getGroupPanel3() { + return groupPanel3; + } + + public void setGroupPanel3(PanelGroup pg) { + this.groupPanel3 = pg; + } + + private StaticText stCriarEditar = new StaticText(); + + public StaticText getStCriarEditar() { + return stCriarEditar; + } + + public void setStCriarEditar(StaticText st) { + this.stCriarEditar = st; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private HtmlPanelGrid gridPanel6 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel6() { + return gridPanel6; + } + + public void setGridPanel6(HtmlPanelGrid hpg) { + this.gridPanel6 = hpg; + } + + private PanelGroup groupPanel4 = new PanelGroup(); + + public PanelGroup getGroupPanel4() { + return groupPanel4; + } + + public void setGroupPanel4(PanelGroup pg) { + this.groupPanel4 = pg; + } + + private StaticText staticText10 = new StaticText(); + + public StaticText getStaticText10() { + return staticText10; + } + + public void setStaticText10(StaticText st) { + this.staticText10 = st; + } + + private HtmlPanelGrid gridPanel7 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel7() { + return gridPanel7; + } + + public void setGridPanel7(HtmlPanelGrid hpg) { + this.gridPanel7 = hpg; + } + + private Button butCancelar = new Button(); + + public Button getButCancelar() { + return butCancelar; + } + + public void setButCancelar(Button b) { + this.butCancelar = b; + } + + 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 HtmlPanelGrid gridPanel4 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel4() { + return gridPanel4; + } + + public void setGridPanel4(HtmlPanelGrid hpg) { + this.gridPanel4 = hpg; + } + + private StaticText staticText4 = new StaticText(); + + public StaticText getStaticText4() { + return staticText4; + } + + public void setStaticText4(StaticText st) { + this.staticText4 = st; + } + + private HtmlPanelGrid gridPanel5 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel5() { + return gridPanel5; + } + + public void setGridPanel5(HtmlPanelGrid hpg) { + this.gridPanel5 = hpg; + } + + private PanelGroup groupPanel6 = new PanelGroup(); + + public PanelGroup getGroupPanel6() { + return groupPanel6; + } + + public void setGroupPanel6(PanelGroup pg) { + this.groupPanel6 = pg; + } + + private PanelGroup groupPanel7 = new PanelGroup(); + + public PanelGroup getGroupPanel7() { + return groupPanel7; + } + + public void setGroupPanel7(PanelGroup pg) { + this.groupPanel7 = pg; + } + + private StaticText staticText5 = new StaticText(); + + public StaticText getStaticText5() { + return staticText5; + } + + public void setStaticText5(StaticText st) { + this.staticText5 = st; + } + + private StaticText staticText8 = new StaticText(); + + public StaticText getStaticText8() { + return staticText8; + } + + public void setStaticText8(StaticText st) { + this.staticText8 = st; + } + + private HtmlPanelGrid gridPanel8 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel8() { + return gridPanel8; + } + + public void setGridPanel8(HtmlPanelGrid hpg) { + this.gridPanel8 = hpg; + } + + private DropDown drpEstabelecimentos = new DropDown(); + + public DropDown getDrpEstabelecimentos() { + return drpEstabelecimentos; + } + + public void setDrpEstabelecimentos(DropDown dd) { + this.drpEstabelecimentos = dd; + } + + private StaticText stEstabelecimento = new StaticText(); + + public StaticText getStEstabelecimento() { + return stEstabelecimento; + } + + public void setStEstabelecimento(StaticText st) { + this.stEstabelecimento = st; + } + + private StaticText staticText11 = new StaticText(); + + public StaticText getStaticText11() { + return staticText11; + } + + public void setStaticText11(StaticText st) { + this.staticText11 = st; + } + + private HtmlPanelGrid gridPanel9 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel9() { + return gridPanel9; + } + + public void setGridPanel9(HtmlPanelGrid hpg) { + this.gridPanel9 = hpg; + } + + private DropDown drpNome = new DropDown(); + + public DropDown getDrpNome() { + return drpNome; + } + + public void setDrpNome(DropDown dd) { + this.drpNome = dd; + } + + private TextField txtNome = new TextField(); + + public TextField getTxtNome() { + return txtNome; + } + + public void setTxtNome(TextField tf) { + this.txtNome = tf; + } + + private StaticText stNome = new StaticText(); + + public StaticText getStNome() { + return stNome; + } + + public void setStNome(StaticText st) { + this.stNome = st; + } + + private StaticText staticText13 = new StaticText(); + + public StaticText getStaticText13() { + return staticText13; + } + + public void setStaticText13(StaticText st) { + this.staticText13 = st; + } + + private TextField txtLogin = new TextField(); + + public TextField getTxtLogin() { + return txtLogin; + } + + public void setTxtLogin(TextField tf) { + this.txtLogin = tf; + } + + private StaticText staticText14 = new StaticText(); + + public StaticText getStaticText14() { + return staticText14; + } + + public void setStaticText14(StaticText st) { + this.staticText14 = st; + } + + private PasswordField txtPassword = new PasswordField(); + + public PasswordField getTxtPassword() { + return txtPassword; + } + + public void setTxtPassword(PasswordField pf) { + this.txtPassword = pf; + } + + private StaticText staticText15 = new StaticText(); + + public StaticText getStaticText15() { + return staticText15; + } + + public void setStaticText15(StaticText st) { + this.staticText15 = st; + } + + private TextField txtEmail = new TextField(); + + public TextField getTxtEmail() { + return txtEmail; + } + + public void setTxtEmail(TextField tf) { + this.txtEmail = tf; + } + + //
+ boolean isPostback = false; + + private HiddenField hidConfDelUser = new HiddenField(); + + public HiddenField getHidConfDelUser() { + return hidConfDelUser; + } + + public void setHidConfDelUser(HiddenField hf) { + this.hidConfDelUser = hf; + } + + private StaticText staticText7 = new StaticText(); + + public StaticText getStaticText7() { + return staticText7; + } + + public void setStaticText7(StaticText st) { + this.staticText7 = st; + } + + private PasswordField txtConfPassword = new PasswordField(); + + public PasswordField getTxtConfPassword() { + return txtConfPassword; + } + + public void setTxtConfPassword(PasswordField pf) { + this.txtConfPassword = pf; + } + + private StaticText stTipo = new StaticText(); + + public StaticText getStTipo() { + return stTipo; + } + + public void setStTipo(StaticText st) { + this.stTipo = st; + } + + private HtmlPanelGrid gridPanel10 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel10() { + return gridPanel10; + } + + public void setGridPanel10(HtmlPanelGrid hpg) { + this.gridPanel10 = hpg; + } + + private PanelGroup groupPanel8 = new PanelGroup(); + + public PanelGroup getGroupPanel8() { + return groupPanel8; + } + + public void setGroupPanel8(PanelGroup pg) { + this.groupPanel8 = pg; + } + + private Checkbox chkActivo = new Checkbox(); + + public Checkbox getChkActivo() { + return chkActivo; + } + + public void setChkActivo(Checkbox c) { + this.chkActivo = c; + } + + private StaticText staticText6 = new StaticText(); + + public StaticText getStaticText6() { + return staticText6; + } + + public void setStaticText6(StaticText st) { + this.staticText6 = st; + } + + private StaticText staticText9 = new StaticText(); + + public StaticText getStaticText9() { + return staticText9; + } + + public void setStaticText9(StaticText st) { + this.staticText9 = st; + } + + private StaticText lblRespLoja = new StaticText(); + + public StaticText getLblRespLoja() { + return lblRespLoja; + } + + public void setLblRespLoja(StaticText st) { + this.lblRespLoja = st; + } + + private Checkbox chkRespLoja = new Checkbox(); + + public Checkbox getChkRespLoja() { + return chkRespLoja; + } + + public void setChkRespLoja(Checkbox c) { + this.chkRespLoja = c; + } + + private StaticText lblGeral = new StaticText(); + + public StaticText getLblGeral() { + return lblGeral; + } + + public void setLblGeral(StaticText st) { + this.lblGeral = st; + } + + private Checkbox chkGeral = new Checkbox(); + + public Checkbox getChkGeral() { + return chkGeral; + } + + public void setChkGeral(Checkbox c) { + this.chkGeral = c; + } + + private HtmlPanelGrid gridPanel11 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel11() { + return gridPanel11; + } + + public void setGridPanel11(HtmlPanelGrid hpg) { + this.gridPanel11 = hpg; + } + + private PanelGroup groupPanel9 = new PanelGroup(); + + public PanelGroup getGroupPanel9() { + return groupPanel9; + } + + public void setGroupPanel9(PanelGroup pg) { + this.groupPanel9 = pg; + } + + private StaticText staticText12 = new StaticText(); + + public StaticText getStaticText12() { + return staticText12; + } + + public void setStaticText12(StaticText st) { + this.staticText12 = st; + } + + private ImageComponent image3 = new ImageComponent(); + + public ImageComponent getImage3() { + return image3; + } + + public void setImage3(ImageComponent ic) { + this.image3 = ic; + } + + private StaticText staticText16 = new StaticText(); + + public StaticText getStaticText16() { + return staticText16; + } + + public void setStaticText16(StaticText st) { + this.staticText16 = st; + } + private StaticText lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + private Hyperlink lnkPlanosActuacao = new Hyperlink(); + + public Hyperlink getLnkPlanosActuacao() { + return lnkPlanosActuacao; + } + + public void setLnkPlanosActuacao(Hyperlink h) { + this.lnkPlanosActuacao = h; + } + /** + *

Construct a new Page bean instance.

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

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("UtilizadorFields 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 . . . + } + } + else + { + + lblUser.setText( getSessionBean1().getCurrentUser().getLogin() ); + HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); + String referer = request.getRequestURI(); + String pageFrom = Utils.getPageFrom(referer); + if(!pageFrom.matches("UtilizadorFields.jsp")) + { + isPostback = false; + } + else + { + isPostback = true; + } + + } + + } + + /** + *

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() { + if(!isPostback) + { + if(getSessionBean1().getModoEdicaoUtilizador().matches("new")) + { + stCriarEditar.setText("CRIAR"); + initializeNew(); + } + else if( getSessionBean1().getModoEdicaoUtilizador().matches("edit")) + { + stCriarEditar.setText("EDITAR"); + fillPage(); + } + } + else //postback + { + String del_user = (String)getExternalContext().getRequestParameterMap().get("del_user"); + if(del_user != null) + { + if(del_user.matches("yes")) + { + hidConfDelUser.setValue(""); + try + { + deleteUser(); + getSessionBean1().setMsg("Utilizador eliminado!"); + //return "gestao_utilizadores"; + getSessionBean1().setUserDeleted(true); + try { + getExternalContext().redirect("GestaoUtilizadores.jsp"); + } catch(Exception e) { + } + } + catch(Exception ex) + { + ex.printStackTrace(); + getSessionBean1().setMsg("Erro na eliminação do utilizador!"); + } + } + else if(del_user.matches("no")) + { + hidConfDelUser.setValue(""); + fillPage(); + } + } + + } + + 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 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 lnkEditUser_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkLogout_action() { + // TODO: Replace with your code + + try + { + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + } + catch(Exception ex){} + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) {} + return null; + + } + + public void drpTipo_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + + } + + public void drpNome_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + + } + + 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. + String nav_from = getSessionBean1().getNavFrom(); + if(nav_from.matches("GestaoUtilizadores")) + { + return "gestao_utilizadores"; + } + else if(nav_from.matches("NovoUtilizador")) + { + return "novo_utilizador"; + } + return null; + } + + public String butApagar_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + hidConfDelUser.setValue("apagar"); + return null; + } + + public String butGravar_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + if(validationOk( getSessionBean1().getModoEdicaoUtilizador() )) + { + if(getSessionBean1().getModoEdicaoUtilizador().matches("new")) + { + try + { + Utilizador u = addUser(); + addPermissao(u); + getSessionBean1().setMsg("Utilizador criado"); + getSessionBean1().setNewUser(null); + return "gestao_utilizadores"; + } + catch(Exception ex) + { + getSessionBean1().setMsg("Erro na criação do utilizador!"); + ex.printStackTrace(); + } + } + else if( getSessionBean1().getModoEdicaoUtilizador().matches("edit") ) + { + try + { + updateUser(); + getSessionBean1().setMsg("Utilizador actualizado"); + return "gestao_utilizadores"; + } + catch(Exception ex) + { + getSessionBean1().setMsg("Erro na actualização do utilizador"); + ex.printStackTrace(); + } + } + } + return null; + } + + private void initializeNew() + { + //drpTipo.setStyleClass("hidden"); + //drpEstabelecimentos.setStyleClass("hidden"); + NewUser u = getSessionBean1().getNewUser(); + getSessionBean1().setEstabelecimentosOptions(getSessionBean1().getEstabelecimentosOutroOptions()); + if(u.getEstabelecimento() == null) + { + drpEstabelecimentos.setDisabled(true); + } + else + { + drpEstabelecimentos.setSelected(u.getEstabelecimento()); + } + + drpNome.setStyleClass("hidden"); + txtNome.setStyleClass("hidden"); + + + stTipo.setText(u.getTipo_descricao()); + //stEstabelecimento.setText(u.getEstabelecimento_descricao()); + stEstabelecimento.setStyleClass("hidden"); + stNome.setText(Utils.unicodeToHTML(u.getNome())); + + txtLogin.setText(""); + txtPassword.setText(""); + txtConfPassword.setText(""); + txtEmail.setText(""); + + + chkActivo.setSelected(new Boolean(true)); + lblGeral.setRendered(false); + chkGeral.setRendered(false); + lblRespLoja.setRendered(false); + chkRespLoja.setRendered(false); + } + + private void fillPage() + { + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + //Integer permissao = udp.getPermissionCode( getSessionBean1().getCurrentUser().getId() ); + //getSessionBean1().setTiposOptions(adp.getTiposList(permissao)); + getSessionBean1().setTiposOptions(adp.getTiposList()); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + Utilizador u = getSessionBean1().getEditUser(); + //stTipo.setStyleClass("hidden"); + stEstabelecimento.setStyleClass("hidden"); + stNome.setStyleClass("hidden"); + + System.out.println("ACTIVO = " + u.getActivo()); + if(u.getActivo().matches("y")) + { + chkActivo.setSelected(new Boolean(true)); + } + else + { + chkActivo.setSelected(new Boolean(false)); + } + //drpTipo.setSelected(u.getTipo()); + try + { + stTipo.setText(adp.getTipoDescricao(u.getTipo())); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + drpEstabelecimentos.setSelected(u.getEstabelecimento_id()); + + if(u.getTipo().intValue() == 3) //hs + { + drpNome.setStyleClass("hidden"); + txtNome.setText(Utils.unicodeToHTML(u.getNome())); + } + else if(u.getTipo().intValue() == 5) //medico + { + drpNome.setStyleClass("hidden"); + System.out.println("MEDICA : " + Utils.unicodeToHTML(u.getNome())); + txtNome.setText(Utils.unicodeToHTML(u.getNome())); + } + else + { + drpNome.setStyleClass("hidden"); + txtNome.setText(Utils.unicodeToHTML(u.getNome())); + } + + if(u.getTipo().intValue() == 6) // gestor + { + chkGeral.setSelected(new Boolean(false)); + if(u.getGestor_geral().matches("y")) + { + chkGeral.setSelected(new Boolean(true)); + } + } + else + { + lblGeral.setRendered(false); + chkGeral.setRendered(false); + } + + + if(u.getTipo().intValue() == 1 || u.getTipo().intValue() == 2) + { + chkRespLoja.setSelected(new Boolean(false)); + if(u.getResponsavel_loja().matches("y")) + { + chkRespLoja.setSelected(new Boolean(true)); + } + } + else + { + lblRespLoja.setRendered(false); + chkRespLoja.setRendered(false); + } + + txtLogin.setText(u.getLogin()); + //txtPassword.setText(u.getPassword()); + txtEmail.setText(u.getEmail()); + + } + + private boolean validationOk(String modo) + { + if(modo.matches("new")) + { + if(txtLogin.getText() == null) + { + getSessionBean1().setMsg("Tem de indicar o login!"); + return false; + } + else + { + String login = (String) txtLogin.getText(); + if(login.trim().length() == 0) + { + getSessionBean1().setMsg("Tem de indicar o login!"); + return false; + } + else + { + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + try + { + Utilizador u = udp.getUtilizador(login); + if(u.getLogin().equals(login)) + { + getSessionBean1().setMsg("O utilizador " + login + " já existe!"); + return false; + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + } + + if(txtPassword.getText() == null) + { + getSessionBean1().setMsg("Tem de indicar a password!"); + return false; + } + else + { + String password = (String) txtPassword.getText(); + if(password.trim().length() == 0) + { + getSessionBean1().setMsg("Tem de indicar a password!"); + return false; + } + else + { + if(txtConfPassword.getText() == null) + { + getSessionBean1().setMsg("Tem de confirmar a password!"); + return false; + } + else + { + String conf_password = (String) txtConfPassword.getText(); + if(conf_password.trim().length() == 0) + { + getSessionBean1().setMsg("Tem de confirmar a password!"); + return false; + } + else + { + if(!password.equals(conf_password)) + { + getSessionBean1().setMsg("A confirmação tem de ser igual à a password!"); + return false; + } + } + } + } // + } + + if(txtEmail.getText() != null) + { + String email = (String) txtEmail.getText(); + if(email.trim().length() > 0) + { + if(! Utils.isValidEmail(email)) + { + getSessionBean1().setMsg("Email inválido!"); + return false; + } + + } + else + { + getSessionBean1().setMsg("Tem de indicar o email!"); + return false; + } + } + else + { + getSessionBean1().setMsg("Tem de indicar o email!"); + return false; + } + + } + else if(modo.matches("edit")) + { + Utilizador u = getSessionBean1().getEditUser(); + +// Integer iTipo = (Integer) drpTipo.getSelected(); +// if(iTipo.intValue() == 0) +// { +// getSessionBean1().setMsg("Falta tipo !"); +// return false; +// } + + int tipo = u.getTipo().intValue(); + + if(tipo != 3) + { + Integer estabelecimento = (Integer) drpEstabelecimentos.getSelected(); + if(estabelecimento.intValue() == -1) + { + getSessionBean1().setMsg("Falta estabelecimento!"); + return false; + } + } + +// if(tipo == 3 || tipo == 5) +// { +// Integer nome = (Integer) drpNome.getSelected(); +// if(nome.intValue() == 0) +// { +// getSessionBean1().setMsg("Falta nome !"); +// return false; +// } +// } +// else +// { + if(txtNome.getText() == null) + { + getSessionBean1().setMsg("Falta nome!"); + + return false; + } + else + { + String nome = (String) txtNome.getText(); + if(nome.trim().length() == 0) + { + getSessionBean1().setMsg("Falta nome!"); + return false; + } + } +// } + + + if(txtLogin.getText() == null) + { + getSessionBean1().setMsg("Tem de indicar o login!"); + return false; + } + else + { + String login = (String) txtLogin.getText(); + if(login.trim().length() == 0) + { + getSessionBean1().setMsg("Tem de indicar o login!"); + return false; + } + else + { + if(!login.equals(u.getLogin())) + { + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + try + { + Utilizador ut = udp.getUtilizador(login); + if(ut.getLogin().equals(login)) + { + getSessionBean1().setMsg("O utilizador " + login + " já existe!"); + return false; + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + + } + } +// if(txtPassword.getText() == null) +// { +// getSessionBean1().setMsg("Falta password!"); +// return false; +// } +// else + if(txtPassword.getText() != null) + { + String password = (String) txtPassword.getText(); + if(password.trim().length() > 0) + { + if(! password.equals(u.getPassword())) + { + if(txtConfPassword.getText() == null) + { + getSessionBean1().setMsg("Tem de confirmar a password!"); + return false; + } + else + { + String conf_password = (String) txtConfPassword.getText(); + if(conf_password.trim().length() == 0) + { + getSessionBean1().setMsg("Tem de confirmar a password!"); + return false; + } + else + { + if(!password.equals(conf_password)) + { + getSessionBean1().setMsg("A confirmação tem de ser igual à password!"); + return false; + } + } + } + } + } + else + { + if(txtConfPassword.getText() != null) + { + String conf = (String) txtConfPassword.getText(); + if(conf.trim().length() > 0) + { + getSessionBean1().setMsg("Falta password!"); + return false; + } + } + } + } + else + { + if(txtConfPassword.getText() != null) + { + String conf = (String) txtConfPassword.getText(); + if(conf.trim().length() > 0) + { + getSessionBean1().setMsg("Falta password!"); + return false; + } + } + } + + if(txtEmail.getText() != null) + { + String email = (String) txtEmail.getText(); + if(email.trim().length() > 0) + { + if(! Utils.isValidEmail(email)) + { + getSessionBean1().setMsg("Email inválido!"); + return false; + } + + } + } + else + { + getSessionBean1().setMsg("Tem de indicar o email!"); + return false; + } + + } + return true; + } + + private Utilizador addUser() throws Exception + { + Utilizador u = fillUser(); + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + Integer id = udp.createNewUtilizador(u); + u.setId(id); + return u; + } + + private void addPermissao(Utilizador u) throws Exception + { + Permissao p = new Permissao(); + p.setUser_id(u.getId()); + p.setCodigo_permissao(u.getTipo()); + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + udp.createPermissao(p); + } + + private void updateUser() throws Exception + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + //Utilizador u = fillUser(); + Utilizador u = getSessionBean1().getEditUser(); + + + //u.setTipo((Integer) drpTipo.getSelected()); + u.setEstabelecimento_id( (Integer) drpEstabelecimentos.getSelected() ); + + int tipo = u.getTipo().intValue(); +// if(tipo == 3) +// { +// u.setFuncionario_hst_id((Integer) drpNome.getSelected()); +// u.setNome( adp.getTecnicoSaudeNome( u.getFuncionario_hst_id() ) ); +// } +// else if(tipo == 5) +// { +// u.setMedico_id( (Integer) drpNome.getSelected() ); +// u.setNome( adp.getMedicoNome(u.getMedico_id()) ); +// } + u.setActivo("n"); + if(chkActivo.getSelected() != null) + { + if(chkActivo.getSelected().equals(new Boolean(true))) + { + u.setActivo("y"); + } + } + u.setNome((String) txtNome.getText()); + u.setLogin((String) txtLogin.getText()); + if(txtPassword.getText() != null) + { + String password = (String) txtPassword.getText(); + if(password.trim().length() > 0) + { + u.setPassword(password); + } + } + + u.setEmail((String) txtEmail.getText()); + + u.setGestor_geral("n"); + try + { + if(chkGeral.getSelected() != null) + { + if(chkGeral.getSelected().equals(new Boolean(true)) ) + { + u.setGestor_geral("y"); + } + } + } + catch(Exception ex){} + + u.setResponsavel_loja("n"); + try + { + if(chkRespLoja.getSelected() != null) + { + if(chkRespLoja.getSelected().equals(new Boolean(true)) ) + { + u.setResponsavel_loja("y"); + } + } + } + catch(Exception ex){} + u.setPrimeiro_login("n"); + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + udp.updateUtilizador(u); + } + + + private Utilizador fillUser() + { + NewUser nu = getSessionBean1().getNewUser(); + Utilizador u = new Utilizador(); + u.setActivo("n"); + if(chkActivo.getSelected() != null) + { + if(chkActivo.getSelected().equals(new Boolean(true))) + { + u.setActivo("y"); + } + } + u.setAdministrador("n"); + u.setTipo(nu.getTipo()); + u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id()); + //u.setEstabelecimento_id( nu.getEstabelecimento() ); + if(nu.getEstabelecimento() != null) + { + u.setEstabelecimento_id((Integer) drpEstabelecimentos.getSelected()); + } + u.setNome(Utils.unicodeToHTML(nu.getNome())); + u.setLogin( (String) txtLogin.getText() ); + u.setPassword( (String) txtPassword.getText() ); + java.util.Date today = + new java.util.Date(); + java.sql.Date sqlToday = + new java.sql.Date(today.getTime()); + u.setData_password(sqlToday); + u.setEmail(""); + u.setNumero_mecanografico(nu.getNumero_mecanografico()); + if(txtEmail.getText() != null) + { + u.setEmail( (String) txtEmail.getText() ); + } + + Integer tipo = (Integer) nu.getTipo(); + + u.setNumero_cedula(""); + u.setCap(""); + if(tipo.intValue() == 3 || tipo.intValue() == 5) + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + if(tipo.intValue() == 3) + { + try + { + //Integer tecnico_id = (Integer) drpNome.getSelected(); + //u.setFuncionario_hst_id(tecnico_id); + //u.setNome( adp.getTecnicoSaudeNome(tecnico_id) ); + u.setFuncionario_hst_id(nu.getFuncionario_hst_id()); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + u.setCap( nu.getCap()); + } + else // medico + { + try + { + //Integer medico_id = (Integer) drpNome.getSelected(); + //u.setMedico_id(medico_id); + //u.setNome( adp.getMedicoNome(medico_id) ); + u.setMedico_id(nu.getMedico_id()); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + //u.setNumero_cedula( (String) stCedula.getText()); + u.setNumero_cedula(nu.getNumero_cedula()); + } + } +// else +// { +// u.setNome( (String) txtNome.getText() ); +// } + + u.setResponsavel_loja(nu.getResponsavel_loja()); + if(nu.getGestor_geral() == null) + { + u.setGestor_geral("n"); + } + else + { + u.setGestor_geral(nu.getGestor_geral()); + } + + +// u.setResponsavel_loja("n"); +// if(chkResponsavelLoja.getSelected() != null) +// { +// if(chkResponsavelLoja.getSelected().equals(new Boolean(true))) +// { +// u.setResponsavel_loja("y"); +// } +// } + return u; + } + + private void deleteUser() throws Exception + { + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + udp.deleteUser(getSessionBean1().getEditUser().getId()); + } + + public String lnkNewUser_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkAnalisesAcidente_action() { + // TODO: Replace with your code + Integer tipo_utilizador = getSessionBean1().getCurrentUser().getTipo(); + if(tipo_utilizador.intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP) + { + return "form_dir_siprp"; + } + else if(tipo_utilizador.intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_GERAL_RH) + { + return "form_dir_ger_rh"; + } + + return null; + } + + public void drpEstabelecimentos_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + + } + + public String lnkAjuda_action() { + // TODO: Replace with your code +// ServletContext theApplicationsServletContext = +// (ServletContext) this.getExternalContext().getContext(); +// String pdfFolderPath = theApplicationsServletContext.getRealPath(Global.PDF_FOLDER_URL); +// String pdfFilePath = pdfFolderPath + "/Ajuda.pdf"; +// +// Global global = new Global(); +// try +// { +// global.showPdf(pdfFilePath); +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } + return null; + } + + public String lnkPlanosActuacao_action() { + // TODO: Replace with your code + Utilizador u = getSessionBean1().getCurrentUser(); +// String curUser = "?user=" + u.getId().toString(); + FacesContext fc = getFacesContext().getCurrentInstance(); + Global.redirectToPlanos(fc, u); + return null; + } +} + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/ViewAnaliseAcidenteTrabalho.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/ViewAnaliseAcidenteTrabalho.java new file mode 100644 index 00000000..c50f30eb --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/ViewAnaliseAcidenteTrabalho.java @@ -0,0 +1,4554 @@ +/* + * 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.Form; +import com.sun.rave.web.ui.component.Head; +import com.sun.rave.web.ui.component.HiddenField; +import com.sun.rave.web.ui.component.Html; +import com.sun.rave.web.ui.component.Hyperlink; +import com.sun.rave.web.ui.component.ImageComponent; +import com.sun.rave.web.ui.component.Link; +import com.sun.rave.web.ui.component.Page; +import com.sun.rave.web.ui.component.PanelGroup; +import com.sun.rave.web.ui.component.StaticText; +import db.AnalisesDataProvider; +import db.UtilizadoresDataProvider; +import global.Global; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.ListIterator; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.servlet.ServletContext; +import utils.Utils; + +/** + *

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 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 gridDadosAcidenteSegView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridDadosAcidenteSegView() { + return gridDadosAcidenteSegView; + } + + public void setGridDadosAcidenteSegView(HtmlPanelGrid hpg) { + this.gridDadosAcidenteSegView = 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 gridTurnoSeccaoLocal = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridTurnoSeccaoLocal() { + return gridTurnoSeccaoLocal; + } + + public void setGridTurnoSeccaoLocal(HtmlPanelGrid hpg) { + this.gridTurnoSeccaoLocal = hpg; + } + + private HtmlPanelGrid gridTarefa = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridTarefa() { + return gridTarefa; + } + + public void setGridTarefa(HtmlPanelGrid hpg) { + this.gridTarefa = hpg; + } + + private StaticText lblTarefa = new StaticText(); + + public StaticText getLblTarefa() { + return lblTarefa; + } + + public void setLblTarefa(StaticText st) { + this.lblTarefa = st; + } + + private HtmlPanelGrid gridSubstancias = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridSubstancias() { + return gridSubstancias; + } + + public void setGridSubstancias(HtmlPanelGrid hpg) { + this.gridSubstancias = hpg; + } + + private StaticText lblSubstancias = new StaticText(); + + public StaticText getLblSubstancias() { + return lblSubstancias; + } + + public void setLblSubstancias(StaticText st) { + this.lblSubstancias = st; + } + + private HtmlPanelGrid gridCondicoes = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridCondicoes() { + return gridCondicoes; + } + + public void setGridCondicoes(HtmlPanelGrid hpg) { + this.gridCondicoes = hpg; + } + + private StaticText lblCondicoes = new StaticText(); + + public StaticText getLblCondicoes() { + return lblCondicoes; + } + + public void setLblCondicoes(StaticText st) { + this.lblCondicoes = st; + } + + private HtmlPanelGrid gridTestemunhas = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridTestemunhas() { + return gridTestemunhas; + } + + public void setGridTestemunhas(HtmlPanelGrid hpg) { + this.gridTestemunhas = hpg; + } + + private StaticText lblTestemunhas = new StaticText(); + + public StaticText getLblTestemunhas() { + return lblTestemunhas; + } + + public void setLblTestemunhas(StaticText st) { + this.lblTestemunhas = st; + } + + private HtmlPanelGrid gridCausas = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridCausas() { + return gridCausas; + } + + public void setGridCausas(HtmlPanelGrid hpg) { + this.gridCausas = hpg; + } + + private StaticText lblCausas = new StaticText(); + + public StaticText getLblCausas() { + return lblCausas; + } + + public void setLblCausas(StaticText st) { + this.lblCausas = st; + } + + private HtmlPanelGrid gridDescricao = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridDescricao() { + return gridDescricao; + } + + public void setGridDescricao(HtmlPanelGrid hpg) { + this.gridDescricao = hpg; + } + + private StaticText lblDescricao = new StaticText(); + + public StaticText getLblDescricao() { + return lblDescricao; + } + + public void setLblDescricao(StaticText st) { + this.lblDescricao = st; + } + + private HtmlPanelGrid gridFotografias = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridFotografias() { + return gridFotografias; + } + + public void setGridFotografias(HtmlPanelGrid hpg) { + this.gridFotografias = hpg; + } + + private HtmlPanelGrid gridPanel19 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel19() { + return gridPanel19; + } + + public void setGridPanel19(HtmlPanelGrid hpg) { + this.gridPanel19 = hpg; + } + + private StaticText lblFotografias = new StaticText(); + + public StaticText getLblFotografias() { + return lblFotografias; + } + + public void setLblFotografias(StaticText st) { + this.lblFotografias = st; + } + + private HtmlPanelGrid gridImages = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridImages() { + return gridImages; + } + + public void setGridImages(HtmlPanelGrid hpg) { + this.gridImages = hpg; + } + + private HtmlPanelGrid gridConclusoes = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridConclusoes() { + return gridConclusoes; + } + + public void setGridConclusoes(HtmlPanelGrid hpg) { + this.gridConclusoes = hpg; + } + + private StaticText lblConclusoes = new StaticText(); + + public StaticText getLblConclusoes() { + return lblConclusoes; + } + + public void setLblConclusoes(StaticText st) { + this.lblConclusoes = st; + } + + private HtmlPanelGrid gridAccoes = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridAccoes() { + return gridAccoes; + } + + public void setGridAccoes(HtmlPanelGrid hpg) { + this.gridAccoes = hpg; + } + + private StaticText lblAccoes = new StaticText(); + + public StaticText getLblAccoes() { + return lblAccoes; + } + + public void setLblAccoes(StaticText st) { + this.lblAccoes = st; + } + + 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 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 String IMAGE_URL = "/resources/images"; + + private final static int IMAGE_WIDTH = 48; + private final static int IMAGE_HEIGHT = 48; + + + private HtmlPanelGrid gridDadosAcidenteRhView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridDadosAcidenteRhView() { + return gridDadosAcidenteRhView; + } + + public void setGridDadosAcidenteRhView(HtmlPanelGrid hpg) { + this.gridDadosAcidenteRhView = 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 HtmlPanelGrid gridSHST = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridSHST() { + return gridSHST; + } + + public void setGridSHST(HtmlPanelGrid hpg) { + this.gridSHST = hpg; + } + + private HtmlPanelGrid gridColaborador = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridColaborador() { + return gridColaborador; + } + + public void setGridColaborador(HtmlPanelGrid hpg) { + this.gridColaborador = hpg; + } + + private HtmlPanelGrid gridColaboradores = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridColaboradores() { + return gridColaboradores; + } + + public void setGridColaboradores(HtmlPanelGrid hpg) { + this.gridColaboradores = hpg; + } + + private HtmlPanelGrid gridRecomendacoesViewHS = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridRecomendacoesViewHS() { + return gridRecomendacoesViewHS; + } + + public void setGridRecomendacoesViewHS(HtmlPanelGrid hpg) { + this.gridRecomendacoesViewHS = hpg; + } + + private HtmlPanelGrid gridPanel23 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel23() { + return gridPanel23; + } + + public void setGridPanel23(HtmlPanelGrid hpg) { + this.gridPanel23 = hpg; + } + + private StaticText staticText29 = new StaticText(); + + public StaticText getStaticText29() { + return staticText29; + } + + public void setStaticText29(StaticText st) { + this.staticText29 = st; + } + + private HtmlPanelGrid gridRecomendacoesView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridRecomendacoesView() { + return gridRecomendacoesView; + } + + public void setGridRecomendacoesView(HtmlPanelGrid hpg) { + this.gridRecomendacoesView = hpg; + } + + private HtmlPanelGrid gridMedidasViewRH = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridMedidasViewRH() { + return gridMedidasViewRH; + } + + public void setGridMedidasViewRH(HtmlPanelGrid hpg) { + this.gridMedidasViewRH = hpg; + } + + private HtmlPanelGrid gridPanel24 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel24() { + return gridPanel24; + } + + public void setGridPanel24(HtmlPanelGrid hpg) { + this.gridPanel24 = hpg; + } + + private StaticText staticText30 = new StaticText(); + + public StaticText getStaticText30() { + return staticText30; + } + + public void setStaticText30(StaticText st) { + this.staticText30 = st; + } + + private HtmlPanelGrid gridMedidasView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridMedidasView() { + return gridMedidasView; + } + + public void setGridMedidasView(HtmlPanelGrid hpg) { + this.gridMedidasView = hpg; + } + + private HtmlPanelGrid gridMedicoView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridMedicoView() { + return gridMedicoView; + } + + public void setGridMedicoView(HtmlPanelGrid hpg) { + this.gridMedicoView = hpg; + } + + private HtmlPanelGrid gridPanel25 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel25() { + return gridPanel25; + } + + public void setGridPanel25(HtmlPanelGrid hpg) { + this.gridPanel25 = hpg; + } + + private StaticText staticText31 = new StaticText(); + + public StaticText getStaticText31() { + return staticText31; + } + + public void setStaticText31(StaticText st) { + this.staticText31 = st; + } + + private HtmlPanelGrid gridLesao = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLesao() { + return gridLesao; + } + + public void setGridLesao(HtmlPanelGrid hpg) { + this.gridLesao = hpg; + } + + private StaticText lblAreasCorporais = new StaticText(); + + public StaticText getLblAreasCorporais() { + return lblAreasCorporais; + } + + public void setLblAreasCorporais(StaticText st) { + this.lblAreasCorporais = st; + } + + private HtmlPanelGrid gridPanel26 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel26() { + return gridPanel26; + } + + public void setGridPanel26(HtmlPanelGrid hpg) { + this.gridPanel26 = hpg; + } + + private StaticText staticText33 = new StaticText(); + + public StaticText getStaticText33() { + return staticText33; + } + + public void setStaticText33(StaticText st) { + this.staticText33 = st; + } + + private HtmlPanelGrid gridIncapacidade = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridIncapacidade() { + return gridIncapacidade; + } + + public void setGridIncapacidade(HtmlPanelGrid hpg) { + this.gridIncapacidade = hpg; + } + + private HtmlPanelGrid gridPanel27 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel27() { + return gridPanel27; + } + + public void setGridPanel27(HtmlPanelGrid hpg) { + this.gridPanel27 = hpg; + } + + private StaticText staticText34 = new StaticText(); + + public StaticText getStaticText34() { + return staticText34; + } + + public void setStaticText34(StaticText st) { + this.staticText34 = st; + } + + private HtmlPanelGrid gridRestricoes = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridRestricoes() { + return gridRestricoes; + } + + public void setGridRestricoes(HtmlPanelGrid hpg) { + this.gridRestricoes = hpg; + } + + private HtmlPanelGrid gridPanel28 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel28() { + return gridPanel28; + } + + public void setGridPanel28(HtmlPanelGrid hpg) { + this.gridPanel28 = hpg; + } + + private HtmlPanelGrid gridImagesRestricoes = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridImagesRestricoes() { + return gridImagesRestricoes; + } + + public void setGridImagesRestricoes(HtmlPanelGrid hpg) { + this.gridImagesRestricoes = hpg; + } + + private HtmlPanelGrid gridOutrasRestricoes = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridOutrasRestricoes() { + return gridOutrasRestricoes; + } + + public void setGridOutrasRestricoes(HtmlPanelGrid hpg) { + this.gridOutrasRestricoes = hpg; + } + + private StaticText staticText35 = new StaticText(); + + public StaticText getStaticText35() { + return staticText35; + } + + public void setStaticText35(StaticText st) { + this.staticText35 = st; + } + + private HtmlPanelGrid gridPanel29 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel29() { + return gridPanel29; + } + + public void setGridPanel29(HtmlPanelGrid hpg) { + this.gridPanel29 = hpg; + } + + private StaticText staticText36 = new StaticText(); + + public StaticText getStaticText36() { + return staticText36; + } + + public void setStaticText36(StaticText st) { + this.staticText36 = st; + } + + private StaticText stObservacoes = new StaticText(); + + public StaticText getStObservacoes() { + return stObservacoes; + } + + public void setStObservacoes(StaticText st) { + this.stObservacoes = st; + } + + private HtmlPanelGrid gridAcidentadoView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridAcidentadoView() { + return gridAcidentadoView; + } + + public void setGridAcidentadoView(HtmlPanelGrid hpg) { + this.gridAcidentadoView = hpg; + } + + private HtmlPanelGrid gridPanel30 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel30() { + return gridPanel30; + } + + public void setGridPanel30(HtmlPanelGrid hpg) { + this.gridPanel30 = hpg; + } + + private StaticText staticText37 = new StaticText(); + + public StaticText getStaticText37() { + return staticText37; + } + + public void setStaticText37(StaticText st) { + this.staticText37 = st; + } + + private HtmlPanelGrid gridPanel31 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel31() { + return gridPanel31; + } + + public void setGridPanel31(HtmlPanelGrid hpg) { + this.gridPanel31 = hpg; + } + + private HtmlPanelGrid gridDataHora = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridDataHora() { + return gridDataHora; + } + + public void setGridDataHora(HtmlPanelGrid hpg) { + this.gridDataHora = hpg; + } + + private PanelGroup groupPanel6 = new PanelGroup(); + + public PanelGroup getGroupPanel6() { + return groupPanel6; + } + + public void setGroupPanel6(PanelGroup pg) { + this.groupPanel6 = pg; + } + + private StaticText lblDataAcidente = new StaticText(); + + public StaticText getLblDataAcidente() { + return lblDataAcidente; + } + + public void setLblDataAcidente(StaticText st) { + this.lblDataAcidente = st; + } + + private StaticText stDataAcidente1 = new StaticText(); + + public StaticText getStDataAcidente1() { + return stDataAcidente1; + } + + public void setStDataAcidente1(StaticText st) { + this.stDataAcidente1 = st; + } + + private PanelGroup groupPanel7 = new PanelGroup(); + + public PanelGroup getGroupPanel7() { + return groupPanel7; + } + + public void setGroupPanel7(PanelGroup pg) { + this.groupPanel7 = pg; + } + + private StaticText lblHoraAcidente = new StaticText(); + + public StaticText getLblHoraAcidente() { + return lblHoraAcidente; + } + + public void setLblHoraAcidente(StaticText st) { + this.lblHoraAcidente = st; + } + + private StaticText stHoraAcidente1 = new StaticText(); + + public StaticText getStHoraAcidente1() { + return stHoraAcidente1; + } + + public void setStHoraAcidente1(StaticText st) { + this.stHoraAcidente1 = st; + } + + private HtmlPanelGrid gridVerificacaoView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridVerificacaoView() { + return gridVerificacaoView; + } + + public void setGridVerificacaoView(HtmlPanelGrid hpg) { + this.gridVerificacaoView = hpg; + } + + private HtmlPanelGrid gridPanel34 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel34() { + return gridPanel34; + } + + public void setGridPanel34(HtmlPanelGrid hpg) { + this.gridPanel34 = hpg; + } + + private StaticText staticText15 = new StaticText(); + + public StaticText getStaticText15() { + return staticText15; + } + + public void setStaticText15(StaticText st) { + this.staticText15 = st; + } + + private HtmlPanelGrid gridPanel35 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel35() { + return gridPanel35; + } + + public void setGridPanel35(HtmlPanelGrid hpg) { + this.gridPanel35 = hpg; + } + + private HtmlPanelGrid gridAssinaturasView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridAssinaturasView() { + return gridAssinaturasView; + } + + public void setGridAssinaturasView(HtmlPanelGrid hpg) { + this.gridAssinaturasView = hpg; + } + + private HtmlPanelGrid gridImpressaoView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridImpressaoView() { + return gridImpressaoView; + } + + public void setGridImpressaoView(HtmlPanelGrid hpg) { + this.gridImpressaoView = hpg; + } + + private HtmlPanelGrid gridPanel10 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel10() { + return gridPanel10; + } + + public void setGridPanel10(HtmlPanelGrid hpg) { + this.gridPanel10 = hpg; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private HtmlPanelGrid gridPanel11 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel11() { + return gridPanel11; + } + + public void setGridPanel11(HtmlPanelGrid hpg) { + this.gridPanel11 = hpg; + } + + private HtmlPanelGrid gridAssSupView = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridAssSupView() { + return gridAssSupView; + } + + public void setGridAssSupView(HtmlPanelGrid hpg) { + this.gridAssSupView = hpg; + } + + private HtmlPanelGrid gridPanel12 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel12() { + return gridPanel12; + } + + public void setGridPanel12(HtmlPanelGrid hpg) { + this.gridPanel12 = hpg; + } + + private PanelGroup groupPanel5 = new PanelGroup(); + + public PanelGroup getGroupPanel5() { + return groupPanel5; + } + + public void setGroupPanel5(PanelGroup pg) { + this.groupPanel5 = pg; + } + + private HtmlPanelGrid gridPanel13 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel13() { + return gridPanel13; + } + + public void setGridPanel13(HtmlPanelGrid hpg) { + this.gridPanel13 = hpg; + } + + private PanelGroup groupPanel8 = new PanelGroup(); + + public PanelGroup getGroupPanel8() { + return groupPanel8; + } + + public void setGroupPanel8(PanelGroup pg) { + this.groupPanel8 = pg; + } + + private StaticText staticText14 = new StaticText(); + + public StaticText getStaticText14() { + return staticText14; + } + + public void setStaticText14(StaticText st) { + this.staticText14 = st; + } + + private StaticText stAveriguador = new StaticText(); + + public StaticText getStAveriguador() { + return stAveriguador; + } + + public void setStAveriguador(StaticText st) { + this.stAveriguador = st; + } + + private HtmlPanelGrid gridPanel14 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel14() { + return gridPanel14; + } + + public void setGridPanel14(HtmlPanelGrid hpg) { + this.gridPanel14 = hpg; + } + + private PanelGroup groupPanel9 = new PanelGroup(); + + public PanelGroup getGroupPanel9() { + return groupPanel9; + } + + public void setGroupPanel9(PanelGroup pg) { + this.groupPanel9 = pg; + } + + private StaticText staticText16 = new StaticText(); + + public StaticText getStaticText16() { + return staticText16; + } + + public void setStaticText16(StaticText st) { + this.staticText16 = st; + } + + private ImageComponent image3 = new ImageComponent(); + + public ImageComponent getImage3() { + return image3; + } + + public void setImage3(ImageComponent ic) { + this.image3 = ic; + } + + private StaticText staticText17 = new StaticText(); + + public StaticText getStaticText17() { + return staticText17; + } + + public void setStaticText17(StaticText st) { + this.staticText17 = st; + } + + private HtmlPanelGrid gridAveriguacaoPosterior = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridAveriguacaoPosterior() { + return gridAveriguacaoPosterior; + } + + public void setGridAveriguacaoPosterior(HtmlPanelGrid hpg) { + this.gridAveriguacaoPosterior = hpg; + } + + private StaticText lblAveriguacaoPosterior1 = new StaticText(); + + public StaticText getLblAveriguacaoPosterior1() { + return lblAveriguacaoPosterior1; + } + + public void setLblAveriguacaoPosterior1(StaticText st) { + this.lblAveriguacaoPosterior1 = st; + } + + private StaticText txtAveriguacaoPosterior = new StaticText(); + + public StaticText getTxtAveriguacaoPosterior() { + return txtAveriguacaoPosterior; + } + + public void setTxtAveriguacaoPosterior(StaticText st) { + this.txtAveriguacaoPosterior = st; + } + + private HtmlPanelGrid gridPanel15 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel15() { + return gridPanel15; + } + + public void setGridPanel15(HtmlPanelGrid hpg) { + this.gridPanel15 = hpg; + } + + private StaticText staticText18 = new StaticText(); + + public StaticText getStaticText18() { + return staticText18; + } + + public void setStaticText18(StaticText st) { + this.staticText18 = st; + } + + private HtmlPanelGrid gridPanel16 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel16() { + return gridPanel16; + } + + public void setGridPanel16(HtmlPanelGrid hpg) { + this.gridPanel16 = hpg; + } + + private PanelGroup groupPanel10 = new PanelGroup(); + + public PanelGroup getGroupPanel10() { + return groupPanel10; + } + + public void setGroupPanel10(PanelGroup pg) { + this.groupPanel10 = pg; + } + + private StaticText staticText19 = new StaticText(); + + public StaticText getStaticText19() { + return staticText19; + } + + public void setStaticText19(StaticText st) { + this.staticText19 = st; + } + + private StaticText stNomeSuperior = new StaticText(); + + public StaticText getStNomeSuperior() { + return stNomeSuperior; + } + + public void setStNomeSuperior(StaticText st) { + this.stNomeSuperior = st; + } + + private PanelGroup groupPanel11 = new PanelGroup(); + + public PanelGroup getGroupPanel11() { + return groupPanel11; + } + + public void setGroupPanel11(PanelGroup pg) { + this.groupPanel11 = pg; + } + + private StaticText staticText20 = new StaticText(); + + public StaticText getStaticText20() { + return staticText20; + } + + public void setStaticText20(StaticText st) { + this.staticText20 = st; + } + + private StaticText stEmailSuperior = new StaticText(); + + public StaticText getStEmailSuperior() { + return stEmailSuperior; + } + + public void setStEmailSuperior(StaticText st) { + this.stEmailSuperior = st; + } + + private HtmlPanelGrid gridSiprp = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridSiprp() { + return gridSiprp; + } + + public void setGridSiprp(HtmlPanelGrid hpg) { + this.gridSiprp = hpg; + } + + private HtmlPanelGrid gridPanel17 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel17() { + return gridPanel17; + } + + public void setGridPanel17(HtmlPanelGrid hpg) { + this.gridPanel17 = hpg; + } + + private StaticText staticText24 = new StaticText(); + + public StaticText getStaticText24() { + return staticText24; + } + + public void setStaticText24(StaticText st) { + this.staticText24 = st; + } + + private HtmlPanelGrid gridPanel18 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel18() { + return gridPanel18; + } + + public void setGridPanel18(HtmlPanelGrid hpg) { + this.gridPanel18 = hpg; + } + + private HtmlPanelGrid gridPanel20 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel20() { + return gridPanel20; + } + + public void setGridPanel20(HtmlPanelGrid hpg) { + this.gridPanel20 = hpg; + } + + private PanelGroup groupPanel12 = new PanelGroup(); + + public PanelGroup getGroupPanel12() { + return groupPanel12; + } + + public void setGroupPanel12(PanelGroup pg) { + this.groupPanel12 = pg; + } + + private StaticText staticText25 = new StaticText(); + + public StaticText getStaticText25() { + return staticText25; + } + + public void setStaticText25(StaticText st) { + this.staticText25 = st; + } + + private StaticText staticText26 = new StaticText(); + + public StaticText getStaticText26() { + return staticText26; + } + + public void setStaticText26(StaticText st) { + this.staticText26 = st; + } + + private PanelGroup groupPanel13 = new PanelGroup(); + + public PanelGroup getGroupPanel13() { + return groupPanel13; + } + + public void setGroupPanel13(PanelGroup pg) { + this.groupPanel13 = pg; + } + + private StaticText staticText27 = new StaticText(); + + public StaticText getStaticText27() { + return staticText27; + } + + public void setStaticText27(StaticText st) { + this.staticText27 = st; + } + + private StaticText txtTecnicoSuperior = new StaticText(); + + public StaticText getTxtTecnicoSuperior() { + return txtTecnicoSuperior; + } + + public void setTxtTecnicoSuperior(StaticText st) { + this.txtTecnicoSuperior = st; + } + + private StaticText staticText28 = new StaticText(); + + public StaticText getStaticText28() { + return staticText28; + } + + public void setStaticText28(StaticText st) { + this.staticText28 = st; + } + + private StaticText staticText47 = new StaticText(); + + public StaticText getStaticText47() { + return staticText47; + } + + public void setStaticText47(StaticText st) { + this.staticText47 = st; + } + + private StaticText txtCap1 = new StaticText(); + + public StaticText getTxtCap1() { + return txtCap1; + } + + public void setTxtCap1(StaticText st) { + this.txtCap1 = st; + } + + private PanelGroup groupPanel14 = new PanelGroup(); + + public PanelGroup getGroupPanel14() { + return groupPanel14; + } + + public void setGroupPanel14(PanelGroup pg) { + this.groupPanel14 = pg; + } + + private StaticText staticText48 = new StaticText(); + + public StaticText getStaticText48() { + return staticText48; + } + + public void setStaticText48(StaticText st) { + this.staticText48 = st; + } + + private StaticText txtMedicoTrabalho = new StaticText(); + + public StaticText getTxtMedicoTrabalho() { + return txtMedicoTrabalho; + } + + public void setTxtMedicoTrabalho(StaticText st) { + this.txtMedicoTrabalho = st; + } + + private StaticText staticText49 = new StaticText(); + + public StaticText getStaticText49() { + return staticText49; + } + + public void setStaticText49(StaticText st) { + this.staticText49 = st; + } + + private StaticText staticText50 = new StaticText(); + + public StaticText getStaticText50() { + return staticText50; + } + + public void setStaticText50(StaticText st) { + this.staticText50 = st; + } + + private StaticText txtCedula1 = new StaticText(); + + public StaticText getTxtCedula1() { + return txtCedula1; + } + + public void setTxtCedula1(StaticText st) { + this.txtCedula1 = st; + } + + private HtmlPanelGrid gridPanel5 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel5() { + return gridPanel5; + } + + public void setGridPanel5(HtmlPanelGrid hpg) { + this.gridPanel5 = hpg; + } + + private PanelGroup groupPanel3 = new PanelGroup(); + + public PanelGroup getGroupPanel3() { + return groupPanel3; + } + + public void setGroupPanel3(PanelGroup pg) { + this.groupPanel3 = pg; + } + + private StaticText staticText6 = new StaticText(); + + public StaticText getStaticText6() { + return staticText6; + } + + public void setStaticText6(StaticText st) { + this.staticText6 = st; + } + + private StaticText stNomeAcidentado = new StaticText(); + + public StaticText getStNomeAcidentado() { + return stNomeAcidentado; + } + + public void setStNomeAcidentado(StaticText st) { + this.stNomeAcidentado = st; + } + + private PanelGroup groupPanel4 = new PanelGroup(); + + public PanelGroup getGroupPanel4() { + return groupPanel4; + } + + public void setGroupPanel4(PanelGroup pg) { + this.groupPanel4 = pg; + } + + private StaticText staticText7 = new StaticText(); + + public StaticText getStaticText7() { + return staticText7; + } + + public void setStaticText7(StaticText st) { + this.staticText7 = st; + } + + private StaticText stEstabelecimentoOrigem = new StaticText(); + + public StaticText getStEstabelecimentoOrigem() { + return stEstabelecimentoOrigem; + } + + public void setStEstabelecimentoOrigem(StaticText st) { + this.stEstabelecimentoOrigem = st; + } + + private PanelGroup groupPanel15 = new PanelGroup(); + + public PanelGroup getGroupPanel15() { + return groupPanel15; + } + + public void setGroupPanel15(PanelGroup pg) { + this.groupPanel15 = pg; + } + + private StaticText staticText8 = new StaticText(); + + public StaticText getStaticText8() { + return staticText8; + } + + public void setStaticText8(StaticText st) { + this.staticText8 = st; + } + + private StaticText stDataNascimento = new StaticText(); + + public StaticText getStDataNascimento() { + return stDataNascimento; + } + + public void setStDataNascimento(StaticText st) { + this.stDataNascimento = st; + } + + private PanelGroup groupPanel16 = new PanelGroup(); + + public PanelGroup getGroupPanel16() { + return groupPanel16; + } + + public void setGroupPanel16(PanelGroup pg) { + this.groupPanel16 = pg; + } + + private StaticText staticText9 = new StaticText(); + + public StaticText getStaticText9() { + return staticText9; + } + + public void setStaticText9(StaticText st) { + this.staticText9 = st; + } + + private StaticText stBI = new StaticText(); + + public StaticText getStBI() { + return stBI; + } + + public void setStBI(StaticText st) { + this.stBI = st; + } + + private PanelGroup groupPanel17 = new PanelGroup(); + + public PanelGroup getGroupPanel17() { + return groupPanel17; + } + + public void setGroupPanel17(PanelGroup pg) { + this.groupPanel17 = pg; + } + + private StaticText staticText10 = new StaticText(); + + public StaticText getStaticText10() { + return staticText10; + } + + public void setStaticText10(StaticText st) { + this.staticText10 = st; + } + + private StaticText stMorada = new StaticText(); + + public StaticText getStMorada() { + return stMorada; + } + + public void setStMorada(StaticText st) { + this.stMorada = st; + } + + private StaticText staticText11 = new StaticText(); + + public StaticText getStaticText11() { + return staticText11; + } + + public void setStaticText11(StaticText st) { + this.staticText11 = st; + } + + private StaticText stCodPostal = new StaticText(); + + public StaticText getStCodPostal() { + return stCodPostal; + } + + public void setStCodPostal(StaticText st) { + this.stCodPostal = st; + } + + private PanelGroup groupPanel18 = new PanelGroup(); + + public PanelGroup getGroupPanel18() { + return groupPanel18; + } + + public void setGroupPanel18(PanelGroup pg) { + this.groupPanel18 = pg; + } + + private StaticText staticText12 = new StaticText(); + + public StaticText getStaticText12() { + return staticText12; + } + + public void setStaticText12(StaticText st) { + this.staticText12 = st; + } + + private StaticText stContactoTelefonico = new StaticText(); + + public StaticText getStContactoTelefonico() { + return stContactoTelefonico; + } + + public void setStContactoTelefonico(StaticText st) { + this.stContactoTelefonico = st; + } + + private PanelGroup groupPanel19 = new PanelGroup(); + + public PanelGroup getGroupPanel19() { + return groupPanel19; + } + + public void setGroupPanel19(PanelGroup pg) { + this.groupPanel19 = pg; + } + + private StaticText staticText51 = new StaticText(); + + public StaticText getStaticText51() { + return staticText51; + } + + public void setStaticText51(StaticText st) { + this.staticText51 = st; + } + + private StaticText stDataAdmissao = new StaticText(); + + public StaticText getStDataAdmissao() { + return stDataAdmissao; + } + + public void setStDataAdmissao(StaticText st) { + this.stDataAdmissao = st; + } + + private PanelGroup groupPanel20 = new PanelGroup(); + + public PanelGroup getGroupPanel20() { + return groupPanel20; + } + + public void setGroupPanel20(PanelGroup pg) { + this.groupPanel20 = pg; + } + + private StaticText staticText52 = new StaticText(); + + public StaticText getStaticText52() { + return staticText52; + } + + public void setStaticText52(StaticText st) { + this.staticText52 = st; + } + + private StaticText stFuncao = new StaticText(); + + public StaticText getStFuncao() { + return stFuncao; + } + + public void setStFuncao(StaticText st) { + this.stFuncao = st; + } + + private PanelGroup groupPanel21 = new PanelGroup(); + + public PanelGroup getGroupPanel21() { + return groupPanel21; + } + + public void setGroupPanel21(PanelGroup pg) { + this.groupPanel21 = pg; + } + + private StaticText staticText53 = new StaticText(); + + public StaticText getStaticText53() { + return staticText53; + } + + public void setStaticText53(StaticText st) { + this.staticText53 = st; + } + + private StaticText stTurno = new StaticText(); + + public StaticText getStTurno() { + return stTurno; + } + + public void setStTurno(StaticText st) { + this.stTurno = st; + } + + private PanelGroup groupPanel22 = new PanelGroup(); + + public PanelGroup getGroupPanel22() { + return groupPanel22; + } + + public void setGroupPanel22(PanelGroup pg) { + this.groupPanel22 = pg; + } + + private StaticText lblHorasTurno = new StaticText(); + + public StaticText getLblHorasTurno() { + return lblHorasTurno; + } + + public void setLblHorasTurno(StaticText st) { + this.lblHorasTurno = st; + } + + private StaticText txtHorasTurno = new StaticText(); + + public StaticText getTxtHorasTurno() { + return txtHorasTurno; + } + + public void setTxtHorasTurno(StaticText st) { + this.txtHorasTurno = st; + } + + private PanelGroup groupPanel23 = new PanelGroup(); + + public PanelGroup getGroupPanel23() { + return groupPanel23; + } + + public void setGroupPanel23(PanelGroup pg) { + this.groupPanel23 = pg; + } + + private StaticText lblSeccao = new StaticText(); + + public StaticText getLblSeccao() { + return lblSeccao; + } + + public void setLblSeccao(StaticText st) { + this.lblSeccao = st; + } + + private StaticText txtSeccao = new StaticText(); + + public StaticText getTxtSeccao() { + return txtSeccao; + } + + public void setTxtSeccao(StaticText st) { + this.txtSeccao = st; + } + + private PanelGroup groupPanel24 = new PanelGroup(); + + public PanelGroup getGroupPanel24() { + return groupPanel24; + } + + public void setGroupPanel24(PanelGroup pg) { + this.groupPanel24 = pg; + } + + private StaticText lblLocal = new StaticText(); + + public StaticText getLblLocal() { + return lblLocal; + } + + public void setLblLocal(StaticText st) { + this.lblLocal = st; + } + + private StaticText txtLocal = new StaticText(); + + public StaticText getTxtLocal() { + return txtLocal; + } + + public void setTxtLocal(StaticText st) { + this.txtLocal = st; + } + + private HtmlPanelGrid gridHeader1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridHeader1() { + return gridHeader1; + } + + public void setGridHeader1(HtmlPanelGrid hpg) { + this.gridHeader1 = hpg; + } + + private HtmlPanelGrid gridPanel6 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel6() { + return gridPanel6; + } + + public void setGridPanel6(HtmlPanelGrid hpg) { + this.gridPanel6 = hpg; + } + + private PanelGroup groupPanel26 = new PanelGroup(); + + public PanelGroup getGroupPanel26() { + return groupPanel26; + } + + public void setGroupPanel26(PanelGroup pg) { + this.groupPanel26 = pg; + } + + private ImageComponent image4 = new ImageComponent(); + + public ImageComponent getImage4() { + return image4; + } + + public void setImage4(ImageComponent ic) { + this.image4 = ic; + } + + private HtmlPanelGrid gridPanel7 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel7() { + return gridPanel7; + } + + public void setGridPanel7(HtmlPanelGrid hpg) { + this.gridPanel7 = hpg; + } + + private StaticText staticText41 = new StaticText(); + + public StaticText getStaticText41() { + return staticText41; + } + + public void setStaticText41(StaticText st) { + this.staticText41 = st; + } + + private HtmlPanelGrid gridPanel21 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel21() { + return gridPanel21; + } + + public void setGridPanel21(HtmlPanelGrid hpg) { + this.gridPanel21 = hpg; + } + + private PanelGroup groupPanel27 = new PanelGroup(); + + public PanelGroup getGroupPanel27() { + return groupPanel27; + } + + public void setGroupPanel27(PanelGroup pg) { + this.groupPanel27 = pg; + } + + private StaticText staticText42 = new StaticText(); + + public StaticText getStaticText42() { + return staticText42; + } + + public void setStaticText42(StaticText st) { + this.staticText42 = st; + } + + private StaticText stHeaderNr = new StaticText(); + + public StaticText getStHeaderNr() { + return stHeaderNr; + } + + public void setStHeaderNr(StaticText st) { + this.stHeaderNr = st; + } + + private PanelGroup groupPanel28 = new PanelGroup(); + + public PanelGroup getGroupPanel28() { + return groupPanel28; + } + + public void setGroupPanel28(PanelGroup pg) { + this.groupPanel28 = pg; + } + + private StaticText staticText43 = new StaticText(); + + public StaticText getStaticText43() { + return staticText43; + } + + public void setStaticText43(StaticText st) { + this.staticText43 = st; + } + + private StaticText stHeaderDate = new StaticText(); + + public StaticText getStHeaderDate() { + return stHeaderDate; + } + + public void setStHeaderDate(StaticText st) { + this.stHeaderDate = st; + } + + private ImageComponent image5 = new ImageComponent(); + + public ImageComponent getImage5() { + return image5; + } + + public void setImage5(ImageComponent ic) { + this.image5 = ic; + } + + private HiddenField hidConfDelete = new HiddenField(); + + public HiddenField getHidConfDelete() { + return hidConfDelete; + } + + public void setHidConfDelete(HiddenField hf) { + this.hidConfDelete = hf; + } + + private PanelGroup groupPanel1 = new PanelGroup(); + + public PanelGroup getGroupPanel1() { + return groupPanel1; + } + + public void setGroupPanel1(PanelGroup pg) { + this.groupPanel1 = pg; + } + + private Button butVoltar = new Button(); + + public Button getButVoltar() { + return butVoltar; + } + + public void setButVoltar(Button b) { + this.butVoltar = b; + } + + private Button butEliminar = new Button(); + + public Button getButEliminar() { + return butEliminar; + } + + public void setButEliminar(Button b) { + this.butEliminar = b; + } + private StaticText lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + /** + *

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 superclasssuperclass + 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 + if (!getSessionBean1().isLoggedIn()) { + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) { + // . . . handle exception . . . + System.out.println("LOGGED IN = " + e.getMessage()); + } + } + else + { + lblUser.setText( getSessionBean1().getCurrentUser().getLogin() ); + 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() { + getSessionBean1().setFromAnaliseDeletion(false); + String confirmacao_analise = (String)getExternalContext().getRequestParameterMap().get("confirmacao_analise"); + if(confirmacao_analise != null) + { + if(confirmacao_analise.matches("yes")) + { + hidConfDelete.setValue(""); + try + { + deleteAnalise(); + //booMsgQuizDeleted = true; + getSessionBean1().setFromAnaliseDeletion(true); + getSessionBean1().setMsg("Análise eliminada !"); + AnalisesDataProvider adp = new AnalisesDataProvider(); + Utilizador u = getSessionBean1().getCurrentUser(); + if(u.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP) + { + + try + { + getExternalContext().redirect("FormDirSiprp.jsp"); + } + catch(Exception ex1) + { + ex1.printStackTrace(); + } + } + else if(u.getTipo().intValue() == Global.TIPO_UTILIZADOR_HS) + { + + try + { + getExternalContext().redirect("FormHS.jsp"); + } + catch(Exception ex1) + { + ex1.printStackTrace(); + } + } + + } + catch(Exception ex) + { + getSessionBean1().setMsg("Erro na eliminação da análise"); + ex.printStackTrace(); +// try +// { +// getExternalContext().redirect("EditarQuestionario.jsp"); +// } +// catch(Exception ex1) +// { +// ex1.printStackTrace(); +// } + } + } + else if(confirmacao_analise.matches("no")) + { + hidConfDelete.setValue(""); + } + } + } + + /** + *

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 + + if (getSessionBean1().isLoggedIn()) { +// try { +// getExternalContext().redirect("Login.jsp"); +// } catch(Exception e) {} + + try + { + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + } + catch(Exception ex){} + + } + + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) {} + //return "login"; + 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() + { + Utilizador u = getSessionBean1().getCurrentUser(); + if(! (u.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP || u.getTipo().intValue() == Global.TIPO_UTILIZADOR_HS)) + { + butEliminar.setRendered(false); + } + else + { + AnaliseAcidente a = getSessionBean1().getCurrentAnalise(); + if(a.getEstado().intValue() == Global.ESTADO_CONCLUIDO) + { + butEliminar.setRendered(false); + } + } + fillPage(); + //fillImages(); + } + + private void fillPage() + { + AnaliseAcidente a = getSessionBean1().getCurrentAnalise(); + fillHeader(a); + fillSIPRP(a); + + AnalisesDataProvider adp = new AnalisesDataProvider(); + Acidentado ac = null; + try + { + ac = adp.getAcidentado(a.getAcidentado_id()); + //txtTrabalhador.setText(ac.getNome()); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + + int estado = a.getEstado().intValue(); + switch(estado) + { + case Global.ESTADO_SEG: + gridDadosAcidenteRhView.setRendered(false); + gridRecomendacoesViewHS.setRendered(false); + gridMedidasViewRH.setRendered(false); + gridMedicoView.setRendered(false); + gridVerificacaoView.setRendered(false); + gridImpressaoView.setRendered(false); + + fillAcidentado(ac); + fillDadosAcidenteSeg(a); + break; + case Global.ESTADO_RH1: + gridDadosAcidenteRhView.setRendered(false); + gridRecomendacoesViewHS.setRendered(false); + gridMedidasViewRH.setRendered(false); + gridMedicoView.setRendered(false); + gridVerificacaoView.setRendered(false); + gridImpressaoView.setRendered(false); + + fillAcidentado(ac); + fillDadosAcidenteSeg(a); + break; + case Global.ESTADO_HS: + gridRecomendacoesViewHS.setRendered(false); + gridMedidasViewRH.setRendered(false); + gridMedicoView.setRendered(false); + gridVerificacaoView.setRendered(false); + gridImpressaoView.setRendered(false); + + fillAcidentado(ac); + fillDadosAcidenteSeg(a); + fillDadosAcidenteRh(a); + break; + case Global.ESTADO_RH2: //medidas + gridMedidasViewRH.setRendered(false); + gridMedicoView.setRendered(false); + gridVerificacaoView.setRendered(false); + gridImpressaoView.setRendered(false); + + fillAcidentado(ac); + fillDadosAcidenteSeg(a); + fillDadosAcidenteRh(a); + fillRecomendacoesHs(a); + + break; +// case Global.ESTADO_MEDICINA: +// gridMedicoView.setRendered(false); +// gridVerificacaoView.setRendered(false); +// gridImpressaoView.setRendered(false); +// +// fillAcidentado(ac); +// fillDadosAcidenteSeg(a); +// fillDadosAcidenteRh(a); +// fillRecomendacoesHs(a); +// fillMedidasRh(a); +// break; + case Global.ESTADO_CONSOLIDACAO: + gridVerificacaoView.setRendered(false); + gridImpressaoView.setRendered(false); + + fillAcidentado(ac); + fillDadosAcidenteSeg(a); + fillDadosAcidenteRh(a); + fillRecomendacoesHs(a); + fillMedidasRh(a); + fillMedico(a); + break; + case Global.ESTADO_ASSINATURA_SEG: + //gridMedidasViewRH.setRendered(false); + //gridMedicoView.setRendered(false); + //gridVerificacaoView.setRendered(false); + gridImpressaoView.setRendered(false); + + fillAcidentado(ac); + fillDadosAcidenteSeg(a); + fillDadosAcidenteRh(a); + fillRecomendacoesHs(a); + fillMedidasRh(a); + fillMedico(a); + fillVerificacao(a); + break; + + case Global.ESTADO_ASSINATURA_RH: + //gridMedidasViewRH.setRendered(false); + //gridMedicoView.setRendered(false); + //gridVerificacaoView.setRendered(false); + gridImpressaoView.setRendered(false); + + fillAcidentado(ac); + fillDadosAcidenteSeg(a); + fillDadosAcidenteRh(a); + fillRecomendacoesHs(a); + fillMedidasRh(a); + fillMedico(a); + fillVerificacao(a); + break; + + +// case Global.ESTADO_IMPRESSAO: +// gridImpressaoView.setRendered(false); +// +// fillAcidentado(ac); +// fillDadosAcidenteSeg(a); +// fillDadosAcidenteRh(a); +// fillRecomendacoesHs(a); +// fillMedidasRh(a); +// fillMedico(a); +// fillVerificacao(a); +// break; + + case Global.ESTADO_FECHAR: + gridImpressaoView.setRendered(false); + + fillAcidentado(ac); + fillDadosAcidenteSeg(a); + fillDadosAcidenteRh(a); + fillRecomendacoesHs(a); + fillMedidasRh(a); + fillMedico(a); + fillVerificacao(a); + //fillImpressao(a); + break; + case Global.ESTADO_CONCLUIDO: + gridImpressaoView.setRendered(false); + + fillAcidentado(ac); + fillDadosAcidenteSeg(a); + fillDadosAcidenteRh(a); + fillRecomendacoesHs(a); + fillMedidasRh(a); + fillMedico(a); + fillVerificacao(a); + + break; + } + } + + private void fillHeader(AnaliseAcidente a) + { + stHeaderNr.setText(a.getAnalise_nr()); + try + { + java.util.Date ddate = new java.util.Date(a.getData_acidente().getTime()); + stHeaderDate.setText(utils.Utils.dateToYYYYMMDD(ddate)); + } + catch(Exception ex){}; + } + + private void fillSIPRP(AnaliseAcidente a) + { + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + try + { + Utilizador u = udp.getUtilizador(a.getTecnico_saude_id()); + txtTecnicoSuperior.setText(Utils.unicodeToHTML(u.getNome())); + txtCap1.setText(u.getCap()); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + try + { + Utilizador u = udp.getUtilizador(a.getMedico_id()); + txtMedicoTrabalho.setText(Utils.unicodeToHTML(u.getNome())); + txtCedula1.setText(u.getNumero_cedula()); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + + private void fillAcidentado(Acidentado a) + { + stNomeAcidentado.setText(a.getNome()); + //stDataNascimento.setText(a.getData_nascimento()); + try + { + java.util.Date ddate = new java.util.Date(a.getData_nascimento().getTime()); + stDataNascimento.setText(utils.Utils.dateToYYYYMMDD(ddate)); + } + catch(Exception ex){}; + stBI.setText(a.getBilhete_identidade()); + stMorada.setText(a.getMorada()); + String cod_postal1 = ""; + String cod_postal2 = ""; + try + { + cod_postal1 = a.getCod_postal().substring(0, 4); + } + catch(Exception ex){} + try + { + cod_postal2 = a.getCod_postal().substring(5, 8); + } + catch(Exception ex){} + + //String cod_postal1 = a.getCod_postal().substring(0, 4); + //String cod_postal2 = a.getCod_postal().substring(5, 8); + String cod_postal = cod_postal1 + "-" + cod_postal2 + " " + a.getLocalidade(); + stCodPostal.setText(cod_postal); + stContactoTelefonico.setText(a.getContacto_telefonico()); + //stDataAdmissao1.setText(a.getData_admissao()); + try + { + java.util.Date ddate = new java.util.Date(a.getData_admissao().getTime()); + stDataAdmissao.setText(utils.Utils.dateToYYYYMMDD(ddate)); + } + catch(Exception ex){}; + stFuncao.setText(a.getFuncao()); + String turno_str = ""; + if(a.getTurno().matches("m")) + { + turno_str = "manhã"; + } + else if(a.getTurno().matches("t")) + { + turno_str += "tarde "; + } + if(a.getTurno().matches("n")) + { + turno_str += "noite"; + } + stTurno.setText(turno_str); + stNomeSuperior.setText(a.getNome_superior_hierarquico()); + stEmailSuperior.setText(a.getEmail_superior_hierarquico()); + stEstabelecimentoOrigem.setText(a.getEstabelecimento_origem()); + } + + private void fillDadosAcidenteSeg(AnaliseAcidente a) + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + String nome_empresa = adp.getEmpresaNome(a.getEmpresa_id()); + txtEmpresa.setText(utils.Utils.unicodeToHTML(nome_empresa)); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + try + { + txtEstabelecimento.setText(adp.getEstabelecimentoNome(a.getEstabelecimento_id())); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + +// try +// { +// //Trabalhador t = adp.getTrabalhador(a.getTrabalhador_id()); +// Acidentado ac = adp.getAcidentado(a.getAcidentado_id()); +// //txtDataNascimento.setText(ac.getData_nascimento()); +// try +// { +// java.util.Date ddate = new java.util.Date(ac.getData_nascimento().getTime()); +// txtDataNascimento.setText(utils.Utils.dateToYYYYMMDD(ddate)); +// } +// catch(Exception ex){}; +// getSessionBean1().setAcidentado(ac); +// } +// catch(Exception ex) +// { +// ex.printStackTrace(); +// } + + txtTrabalhador.setText(a.getNome_acidentado()); +// txtNomeAcidentado.setText(a.getNome_acidentado()); + + stAveriguador.setText(a.getAveriguador()); + + if(a.getData_acidente() == null) + { + lblDataAcidente.setRendered(false); + stDataAcidente1.setRendered(false); + } + else + { + try + { + java.util.Date ddate = new java.util.Date(a.getData_acidente().getTime()); + stDataAcidente1.setText(utils.Utils.dateToYYYYMMDD(ddate)); + } + catch(Exception ex){}; + } + + if(a.getHora_acidente() == null) + { + lblHoraAcidente.setRendered(false); + stHoraAcidente1.setRendered(false); + } + else + { + Calendar cal = Calendar.getInstance(); + + // set the calendar to have your time + cal.setTimeInMillis(a.getHora_acidente().getTime()); + + int hour = cal.get(Calendar.HOUR_OF_DAY); + int minutes = cal.get(Calendar.MINUTE); + try + { + stHoraAcidente1.setText(utils.Utils.timeToHHMM(hour + ":" + minutes)); + } + catch(Exception ex){} + } + + boolean booTurnoSeccaoLocal = false; + if(a.getHoras_turno() == null) + { + lblHorasTurno.setRendered(false); + txtHorasTurno.setRendered(false); + } + else if(a.getHoras_turno().intValue() == 0) + { + lblHorasTurno.setRendered(false); + txtHorasTurno.setRendered(false); + } + else + { + txtHorasTurno.setText(a.getHoras_turno().toString()); + booTurnoSeccaoLocal = true; + } + +// if(a.getSeccao() == null) +// { +// lblSeccao.setRendered(false); +// txtSeccao.setRendered(false); +// } +// else if(a.getSeccao().trim().length() == 0) +// { +// lblSeccao.setRendered(false); +// txtSeccao.setRendered(false); +// } +// else +// { +// txtSeccao.setText(a.getSeccao()); +// booTurnoSeccaoLocal = true; +// } + + try + { + Seccao s = adp.getSeccao(a.getSeccao_id()); + txtSeccao.setText(s.getDescricao()); + booTurnoSeccaoLocal = true; + } + catch(Exception ex) + { + ex.printStackTrace(); + lblSeccao.setRendered(false); + txtSeccao.setRendered(false); + } + + + if(a.getLocal_trabalho() == null) + { + lblLocal.setRendered(false); + txtLocal.setRendered(false); + } + else if(a.getLocal_trabalho().trim().length() == 0) + { + lblLocal.setRendered(false); + txtLocal.setRendered(false); + } + else + { + txtLocal.setText(a.getLocal_trabalho()); + booTurnoSeccaoLocal = true; + } + + if(!booTurnoSeccaoLocal) + { + gridTurnoSeccaoLocal.setRendered(false); + } + + if(a.getTarefa() == null) + { + gridTarefa.setRendered(false); + lblTarefa.setRendered(false); + txtTarefa.setRendered(false); + } + else if(a.getTarefa().trim().length() == 0) + { + gridTarefa.setRendered(false); + lblTarefa.setRendered(false); + txtTarefa.setRendered(false); + } + else + { + txtTarefa.setText(a.getTarefa()); + } + + if(a.getSubstancias() == null) + { + gridSubstancias.setRendered(false); + lblSubstancias.setRendered(false); + txtSubstancias.setRendered(false); + } + else if(a.getSubstancias().trim().length() == 0) + { + gridSubstancias.setRendered(false); + lblSubstancias.setRendered(false); + txtSubstancias.setRendered(false); + } + else + { + txtSubstancias.setText(a.getSubstancias()); + } + +// if(a.getSuperior_hierarquico() == null) +// { +// gridSuperior.setRendered(false); +// lblSuperior.setRendered(false); +// txtSuperior.setRendered(false); +// } +// else if(a.getSuperior_hierarquico().trim().length() == 0) +// { +// gridSuperior.setRendered(false); +// lblSuperior.setRendered(false); +// txtSuperior.setRendered(false); +// } +// else +// { +// txtSuperior.setText(a.getSuperior_hierarquico()); +// } + + if(a.getCondicoes() == null) + { + gridCondicoes.setRendered(false); + lblCondicoes.setRendered(false); + txtCondicoes.setRendered(false); + } + else if(a.getCondicoes().trim().length() == 0) + { + gridCondicoes.setRendered(false); + lblCondicoes.setRendered(false); + txtCondicoes.setRendered(false); + } + else + { + txtCondicoes.setText(a.getCondicoes()); + } + + + if(a.getTestemunhas() == null) + { + gridTestemunhas.setRendered(false); + lblTestemunhas.setRendered(false); + txtTestemunhas.setRendered(false); + } + else if(a.getTestemunhas().trim().length() == 0) + { + gridTestemunhas.setRendered(false); + lblTestemunhas.setRendered(false); + txtTestemunhas.setRendered(false); + + } + else + { + txtTestemunhas.setText(a.getTestemunhas()); + } + +// txtCausas.setText(a.getCausas()); + try + { + Causa c = adp.getCausa(a.getCausas()); + txtCausas.setText(c.getCausa()); + } + catch(Exception ex) + { + ex.printStackTrace(); + gridCausas.setRendered(false); + } + + if(a.getDescricao() == null) + { + gridDescricao.setRendered(false); + lblDescricao.setRendered(false); + txtDescricao.setRendered(false); + } + else if(a.getTestemunhas().trim().length() == 0) + { + gridDescricao.setRendered(false); + lblDescricao.setRendered(false); + txtDescricao.setRendered(false); + } + else + { + txtDescricao.setText(a.getDescricao()); + } + + if(a.getConclusoes() == null) + { + gridConclusoes.setRendered(false); + lblConclusoes.setRendered(false); + txtConclusoes.setRendered(false); + } + else if(a.getConclusoes().trim().length() == 0) + { + gridConclusoes.setRendered(false); + lblConclusoes.setRendered(false); + txtConclusoes.setRendered(false); + } + else + { + txtConclusoes.setText(a.getConclusoes()); + } + + if(a.getAccoes() == null) + { + gridAccoes.setRendered(false); + lblAccoes.setRendered(false); + txtAccoes.setRendered(false); + } + else if(a.getAccoes().trim().length() == 0) + { + gridAccoes.setRendered(false); + lblAccoes.setRendered(false); + txtAccoes.setRendered(false); + } + else + { + txtAccoes.setText(a.getAccoes()); + } + + if(a.getAveriguacao_posterior().matches("n")) + { + gridAveriguacaoPosterior.setRendered(false); + } + else + { + if(a.getAveriguacao_obs().trim().length() > 0) + { + txtAveriguacaoPosterior.setText("Averiguação posterior: " + a.getAveriguacao_obs()); + } + } + + + + //fill images + String folderName = a.getAnalise_nr().substring(0,2) + a.getAnalise_nr().substring(3); + System.out.println("FOLDER NAME : " + folderName); + ServletContext theApplicationsServletContext = + (ServletContext) this.getExternalContext().getContext(); +// String imageFileFolder = theApplicationsServletContext.getRealPath(Global.IMAGE_FOLDER + "/" + folderName); + + + File apacheAnaliseFolder = new File(theApplicationsServletContext.getRealPath( Global.RESOURCES_IMAGE_FOLDER ) + "/analises/" + folderName); + if(apacheAnaliseFolder.exists()) + { + Global global = new Global(); + global.deleteFolderFiles(apacheAnaliseFolder); + } + else + { + apacheAnaliseFolder.mkdir(); + } + + + String imageFileFolder = Global.IMAGE_FOLDER + "/" + folderName; + try + { + File f = new File(imageFileFolder); + + if(f.exists()) + { + File images[] = f.listFiles(); + Arrays.sort(images); + for(int i=0;i 0) + { + s = new StaticText(); + s.setId("s103"); + s.setEscape(false); + s.setText(a.getNr_relatorio_acidente_colaborador1()); + pg.getChildren().add(s); + } + } + if(a.getNr_relatorio_acidente_colaborador2() != null) + { + if(a.getNr_relatorio_acidente_colaborador2().intValue() > 0) + { + s = new StaticText(); + s.setId("s104"); + s.setEscape(false); + s.setText("  " + a.getNr_relatorio_acidente_colaborador2()); + pg.getChildren().add(s); + } + + } + if(a.getNr_relatorio_acidente_colaborador3() != null) + { + if(a.getNr_relatorio_acidente_colaborador3().intValue() > 0) + { + s = new StaticText(); + s.setId("s105"); + s.setEscape(false); + s.setText("  " + a.getNr_relatorio_acidente_colaborador3()); + pg.getChildren().add(s); + } + } + if(a.getNr_relatorio_acidente_colaborador4() != null) + { + if(a.getNr_relatorio_acidente_colaborador4().intValue() > 0) + { + s = new StaticText(); + s.setId("s106"); + s.setEscape(false); + s.setText("  " + a.getNr_relatorio_acidente_colaborador4()); + pg.getChildren().add(s); + } + } + grd.getChildren().add(pg); + } + gridColaborador.getChildren().add(grd); + } + + } + else if( a.getOutros_acidentes_com_colaborador().matches("n") ) + { + st1.setText("Não se verificaram outras ocorrências/incidências no mesmo posto de trabalho com o colaborador acidentado."); + gridColaborador.getChildren().add(st1); + } + else //t + { + gridColaborador.setRendered(false); + } + + if(a.getAcidentes_outros_colaboradores().matches("y")) + { + st2.setText("Verificaram-se ocorrências/incidentes semelhantes com outros colaboradores."); + gridColaboradores.getChildren().add(st2); + boolean booShow = false; + boolean booShow1 = false; + boolean booShow2 = false; + if(a.getNr_acidentes_outros_colaboradores() != null) + { + booShow = true; + booShow1 = true; + } + if(a.getNr_relatorio_acidente_outros_colaboradores1() != null || a.getNr_relatorio_acidente_outros_colaboradores2() != null || a.getNr_relatorio_acidente_outros_colaboradores3() != null || a.getNr_relatorio_acidente_outros_colaboradores4() != null) + { + booShow = true; + booShow2 = true; + } + + if(booShow) + { + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setId("grdColaboradoresS"); + grd.setColumns(2); + grd.setColumnClasses("gridColLeft15, gridColLeft85"); + if(booShow1) + { + PanelGroup pg = new PanelGroup(); + StaticText s = new StaticText(); + s.setId("s200"); + s.setEscape(false); + s.setText("Total:  "); + pg.getChildren().add(s); + s = new StaticText(); + s.setId("s201"); + s.setEscape(false); + s.setText(a.getNr_acidentes_outros_colaboradores()); + pg.getChildren().add(s); + grd.getChildren().add(pg); + } + if(booShow2) + { + PanelGroup pg = new PanelGroup(); + StaticText s = new StaticText(); + s.setId("s202"); + s.setEscape(false); + s.setText("   Relatórios de acidente nº:  "); + pg.getChildren().add(s); + if(a.getNr_relatorio_acidente_outros_colaboradores1() != null) + { + if(a.getNr_relatorio_acidente_outros_colaboradores1().intValue() > 0) + { + s = new StaticText(); + s.setId("s203"); + s.setEscape(false); + s.setText(a.getNr_relatorio_acidente_outros_colaboradores1()); + pg.getChildren().add(s); + } + } + if(a.getNr_relatorio_acidente_outros_colaboradores2() != null) + { + if(a.getNr_relatorio_acidente_outros_colaboradores2().intValue() > 0) + { + s = new StaticText(); + s.setId("s204"); + s.setEscape(false); + s.setText("  " + a.getNr_relatorio_acidente_outros_colaboradores2()); + pg.getChildren().add(s); + } + } + if(a.getNr_relatorio_acidente_outros_colaboradores3() != null) + { + if(a.getNr_relatorio_acidente_outros_colaboradores3().intValue() > 0) + { + s = new StaticText(); + s.setId("s205"); + s.setEscape(false); + s.setText("  " + a.getNr_relatorio_acidente_outros_colaboradores3()); + pg.getChildren().add(s); + } + } + if(a.getNr_relatorio_acidente_outros_colaboradores4() != null) + { + if(a.getNr_relatorio_acidente_outros_colaboradores4().intValue() > 0) + { + s = new StaticText(); + s.setId("s206"); + s.setEscape(false); + s.setText("  " + a.getNr_relatorio_acidente_outros_colaboradores4()); + pg.getChildren().add(s); + } + } + grd.getChildren().add(pg); + } + gridColaboradores.getChildren().add(grd); + } + } + else if( a.getAcidentes_outros_colaboradores().matches("n") ) + { + st2.setText("Não se verificaram ocorrências/incidentes com outros colaboradores."); + gridColaboradores.getChildren().add(st2); + } + else //t + { + gridColaboradores.setRendered(false); + } + } + + private void fillRecomendacoesHs(AnaliseAcidente a) + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList list = adp.getRecomendacoesByAnalise(a.getId()); + ListIterator iter = list.listIterator(); + int seq = 1; + while(iter.hasNext()) + { + Recomendacao r = (Recomendacao) iter.next(); + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setId("grdRecomendacaoView" + seq); + grd.setColumns(2); + grd.setColumnClasses("gridColLeft5, gridColLeft95"); + grd.setStyle("width: 100%"); + + StaticText st = new StaticText(); + st.setId("stNrRecomendacaoView" + seq); + st.setText(seq + " ."); + st.setStyle("width: 24px"); + grd.getChildren().add(st); + + st = new StaticText(); + st.setId("stRecomendacaoView" + seq); + st.setText(r.getRecomendacao()); + //st.setStyle("width: 24px"); + grd.getChildren().add(st); + + gridRecomendacoesView.getChildren().add(grd); + seq++; + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + + private void fillMedidasRh(AnaliseAcidente a) + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + ArrayList list = adp.getMedidasByAnalise(a.getId()); + ListIterator iter = list.listIterator(); + int seq = 1; + while(iter.hasNext()) + { + Medida m = (Medida) iter.next(); + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setId("grdMedidaView" + seq); + grd.setColumns(2); + grd.setColumnClasses("gridColLeft5, gridColLeft95"); + grd.setStyle("width: 100%"); + + StaticText st = new StaticText(); + st.setId("stNrMedidaView" + seq); + st.setText(seq + " ."); + st.setStyle("width: 24px"); + grd.getChildren().add(st); + + st = new StaticText(); + st.setId("stMedidaView" + seq); + st.setText(m.getMedida()); + //st.setStyle("width: 24px"); + grd.getChildren().add(st); + + gridMedidasView.getChildren().add(grd); + seq++; + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + + private void fillMedico(AnaliseAcidente a) + { + + PanelGroup pg = null; + StaticText st = null; + HtmlPanelGrid grd = null; + ImageComponent img = null; + //LESAO : + + if(a.getLesao_cabeca().matches("y")) + { + st = new StaticText(); + st.setId("stLesaoCabeca"); + st.setEscape(false); + st.setText("Cabeça"); + gridLesao.getChildren().add(st); + } + + if(a.getLesao_pescoco().matches("y")) + { + st = new StaticText(); + st.setId("stLesaoPescoco"); + st.setEscape(false); + st.setText("Pescoço"); + gridLesao.getChildren().add(st); + } + + if(a.getLesao_tronco().matches("y")) + { + st = new StaticText(); + st.setId("stLesaoTronco"); + st.setEscape(false); + st.setText("Tronco"); + gridLesao.getChildren().add(st); + } + + grd = new HtmlPanelGrid(); + grd.setId("gridLesaoMembros"); + grd.setColumns(2); + grd.setColumnClasses("gridColLeft"); + if(a.getLesao_membro_sup_dir().matches("y")) + { + st = new StaticText(); + st.setId("stLesaoMembroSupDir"); + st.setEscape(false); + st.setText("Membro Superior Direito"); + grd.getChildren().add(st); + if(a.getEspecif1() != null) + { + if(a.getEspecif1().trim().length() > 0) + { + st = new StaticText(); + st.setId("stEspecif1"); + st.setEscape(false); + st.setText(a.getEspecif1()); + grd.getChildren().add(st); + } + } + } + + if(a.getLesao_membro_sup_esq().matches("y")) + { + st = new StaticText(); + st.setId("stLesaoMembroSupEsq"); + st.setEscape(false); + st.setText("Membro Superior Esquerdo"); + grd.getChildren().add(st); + if(a.getEspecif2() != null) + { + if(a.getEspecif2().trim().length() > 0) + { + st = new StaticText(); + st.setId("stEspecif2"); + st.setEscape(false); + st.setText(a.getEspecif2()); + grd.getChildren().add(st); + } + } + } + + if(a.getLesao_membro_inf_dir().matches("y")) + { + st = new StaticText(); + st.setId("stLesaoMembroInfDir"); + st.setEscape(false); + st.setText("Membro Inferior Direito"); + grd.getChildren().add(st); + if(a.getEspecif3() != null) + { + if(a.getEspecif3().trim().length() > 0) + { + st = new StaticText(); + st.setId("stEspecif3"); + st.setEscape(false); + st.setText(a.getEspecif3()); + grd.getChildren().add(st); + } + } + + } + + if(a.getLesao_membro_inf_esq().matches("y")) + { + st = new StaticText(); + st.setId("stLesaoMembroInfEsq"); + st.setEscape(false); + st.setText("Membro Inferior Esquerdo"); + grd.getChildren().add(st); + if(a.getEspecif4() != null) + { + if(a.getEspecif4().trim().length() > 0) + { + st = new StaticText(); + st.setId("stEspecif4"); + st.setEscape(false); + st.setText(a.getEspecif4()); + grd.getChildren().add(st); + } + } + } + if(grd.getChildren().size() > 0) + { + gridLesao.getChildren().add(grd); + } + + if(a.getTipo_lesao().trim().length() > 0 ) + { + pg = new PanelGroup(); + pg.setId("pgTipoLesao"); + st = new StaticText(); + st.setId("stTipoLesaoLbl"); + st.setEscape(false); + st.setText("Tipo de lesão:   "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stTipoLesao"); + st.setEscape(false); + st.setText(a.getTipo_lesao()); + pg.getChildren().add(st); + gridLesao.getChildren().add(pg); + } + + System.out.println("GRID LESAO : " + gridLesao.getChildren().size()); + if(gridLesao.getChildren().size() == 0) + { + lblAreasCorporais.setRendered(false); + } + + //INCAPACIDADE : + pg = new PanelGroup(); + pg.setId("pgTipoIncapacidade"); + st = new StaticText(); + st.setId("stTipoIncapacidadeLbl1"); + st.setEscape(false); + st.setStyle("font-weight: bold"); + st.setText("Tipo de incapacidade:  "); + if(a.getTipo_incapacidade().matches("t")) + { + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stTipoIncapacidade"); + st.setEscape(false); + st.setText("Temporária  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stTipoIncapacidadeLbl2"); + st.setStyle("font-weight: bold"); + st.setEscape(false); + st.setText("   Coeficiente de incapacidade:  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stCoefIncapacidade"); + st.setEscape(false); + st.setText(a.getCoef_incapacidade().toString() + "%"); + pg.getChildren().add(st); + } + else if(a.getTipo_incapacidade().matches("p")) + { + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stTipoIncapacidade"); + st.setEscape(false); + st.setText("Permanente  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stTipoIncapacidadeLbl2"); + st.setStyle("font-weight: bold"); + st.setEscape(false); + st.setText("   Coeficiente de incapacidade:  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stCoefIncapacidade"); + st.setEscape(false); + st.setText(a.getCoef_incapacidade().toString() + "%"); + pg.getChildren().add(st); + } + + if(pg.getChildren().size() > 0) + { + gridIncapacidade.getChildren().add(pg); + + } + + pg = new PanelGroup(); + pg.setId("pgAvaliacaoIncapacidade"); + if(a.getData_aval_incapacidade() != null) + { + st = new StaticText(); + st.setId("stDataAvalIncapacidadeLbl1"); + st.setStyle("font-weight: bold"); + st.setEscape(false); + st.setText("Avaliação de incapacidade realizada em  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stDataAvalIncapacidade"); + st.setEscape(false); + //st.setText(a.getData_aval_incapacidade()); + try + { + java.util.Date ddate = new java.util.Date(a.getData_aval_incapacidade().getTime()); + st.setText(utils.Utils.dateToYYYYMMDD(ddate)); + } + catch(Exception ex){}; + pg.getChildren().add(st); + } + + + if(a.getData_rev_incapacidade() != null) + { + st = new StaticText(); + st.setId("stDataRevIncapacidadeLbl1"); + st.setStyle("font-weight: bold"); + st.setEscape(false); + st.setText("Revisão de incapacidade em  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stDataRevIncapacidade"); + st.setEscape(false); + //st.setText(a.getData_rev_incapacidade()); + try + { + java.util.Date ddate = new java.util.Date(a.getData_rev_incapacidade().getTime()); + st.setText(utils.Utils.dateToYYYYMMDD(ddate)); + } + catch(Exception ex){}; + pg.getChildren().add(st); + } + + if(pg.getChildren().size() > 0) + { + gridIncapacidade.getChildren().add(pg); + } + + if(a.getPeriodo_incapacidade_a() != null || a.getPeriodo_incapacidade_de() != null) + { + pg = new PanelGroup(); + pg.setId("pgPeriodoIncapacidade"); + st = new StaticText(); + st.setId("stPeriodoIncapacidadeLbl1"); + st.setStyle("font-weight: bold"); + st.setEscape(false); + st.setText("Período de incapacidade temporária de  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stPeriodoIncapacidadeDe"); + st.setEscape(false); + //st.setText(a.getPeriodo_incapacidade_de()); + try + { + java.util.Date ddate = new java.util.Date(a.getPeriodo_incapacidade_de().getTime()); + st.setText(utils.Utils.dateToYYYYMMDD(ddate)); + } + catch(Exception ex){}; + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stPeriodoIncapacidadeLbl2"); + st.setStyle("font-weight: bold"); + st.setEscape(false); + st.setText("  a  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("stPeriodoIncapacidadeA"); + st.setEscape(false); + //st.setText(a.getPeriodo_incapacidade_a()); + try + { + java.util.Date ddate = new java.util.Date(a.getPeriodo_incapacidade_a().getTime()); + st.setText(utils.Utils.dateToYYYYMMDD(ddate)); + } + catch(Exception ex){}; + pg.getChildren().add(st); + gridIncapacidade.getChildren().add(pg); + } + + + +// //RESTRICOES +// +// if(a.getImg_flexao().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgFlexao"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// pg = new PanelGroup(); +// pg.setId("pgImgFlexao"); +// img = new ImageComponent(); +// img.setId("imgRestricoes1000"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/fle1.gif"); +// pg.getChildren().add(img); +// img = new ImageComponent(); +// img.setId("imgRestricoes1001"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/fle2.gif"); +// pg.getChildren().add(img); +// img = new ImageComponent(); +// img.setId("imgRestricoes1002"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/fle3.gif"); +// pg.getChildren().add(img); +// img = new ImageComponent(); +// img.setId("imgRestricoes1003"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/fle4.gif"); +// pg.getChildren().add(img); +// grd.getChildren().add(pg); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl1"); +// st.setEscape(false); +// st.setText("Flexão"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_rot1().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgRot1"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes1005"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/rot1.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl2"); +// st.setEscape(false); +// st.setText("Flexão Lateral"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_rot2().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgRot2"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes1006"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/rot2.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl3"); +// st.setEscape(false); +// st.setText("Rotação"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ext1().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgExt1"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes1007"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ext1.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl4"); +// st.setEscape(false); +// st.setText("Extensão"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ext2().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgExt2"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// pg = new PanelGroup(); +// pg.setId("pgImgExt2"); +// img = new ImageComponent(); +// img.setId("imgRestricoes1008"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ext2.gif"); +// pg.getChildren().add(img); +// img = new ImageComponent(); +// img.setId("imgRestricoes1009"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ext3.gif"); +// pg.getChildren().add(img); +// img = new ImageComponent(); +// img.setId("imgRestricoes1010"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ext4.gif"); +// pg.getChildren().add(img); +// grd.getChildren().add(pg); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl5"); +// st.setEscape(false); +// st.setText("Flexão/Extensão Lateral + Rotação"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_cab1().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgCab1"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10011"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ca1.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl6"); +// st.setEscape(false); +// st.setText("Flexão"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_cab2().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgCab2"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10012"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ca2.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl7"); +// st.setEscape(false); +// st.setText("Extensão"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_cab3().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgCab3"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10013"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ca3.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl8"); +// st.setEscape(false); +// st.setText("Flexão Lateral"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_cab4().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgCab4"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10014"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ca4.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl9"); +// st.setEscape(false); +// st.setText("Rotação"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma1().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa1"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10015"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma1.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl10"); +// st.setEscape(false); +// st.setText("Poronação"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma2().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa2"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10016"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma2.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl11"); +// st.setEscape(false); +// st.setText("Supinação"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma3().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa3"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10017"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma3.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl12"); +// st.setEscape(false); +// st.setText("Flexão"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma4().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa4"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10018"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma4.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl13"); +// st.setEscape(false); +// st.setText("Extensão"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma5().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa5"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10019"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma5.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl14"); +// st.setEscape(false); +// st.setText("Desvio Ulnar"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma6().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa6"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10020"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma6.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl15"); +// st.setEscape(false); +// st.setText("Desvio Radial"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma7().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa7"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10021"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma7.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl16"); +// st.setEscape(false); +// st.setText("Pinça Digital"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma8().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa8"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10022"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma8.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl17"); +// st.setEscape(false); +// st.setText("Segurar objectos entre os dedos"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma9().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa9"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10023"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma9.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl18"); +// st.setEscape(false); +// st.setText("Dedos em extensão"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getImg_ma10().matches("y")) +// { +// grd = new HtmlPanelGrid(); +// grd.setId("grdImgMa10"); +// grd.setColumns(1); +// grd.setColumnClasses("gridColCenter"); +// grd.setStyleClass("centerBlock"); +// +// img = new ImageComponent(); +// img.setId("imgRestricoes10024"); +// img.setWidth(IMAGE_WIDTH); +// img.setHeight(IMAGE_HEIGHT); +// img.setUrl("/resources/images/medico/ma10.gif"); +// grd.getChildren().add(img); +// st = new StaticText(); +// st.setId("stImgRestricaoLbl19"); +// st.setEscape(false); +// st.setText("Pega palmar"); +// grd.getChildren().add(st); +// gridImagesRestricoes.getChildren().add(grd); +// } +// +// if(a.getRestricao_carga() != null) +// { +// if(a.getRestricao_carga().intValue() > 0) +// { +// pg = new PanelGroup(); +// st = new StaticText(); +// st.setId("stRestricaoCargaLbl"); +// st.setEscape(false); +// st.setText("Movimentação e manipulação de cargas com mais de  "); +// pg.getChildren().add(st); +// st = new StaticText(); +// st.setId("stRestricaoCargaKgs"); +// st.setEscape(false); +// st.setText(a.getRestricao_carga().toString()); +// pg.getChildren().add(st); +// st = new StaticText(); +// st.setId("stRestricaoCargaLbl1"); +// st.setEscape(false); +// st.setText("Kg"); +// pg.getChildren().add(st); +// gridOutrasRestricoes.getChildren().add(pg); +// } +// +// if(a.getRestricao_motricidade().matches("y")) +// { +// st = new StaticText(); +// st.setId("stRestricaoMotricidadeLbl"); +// st.setEscape(false); +// st.setText("Operações que requeiram motricidade fina."); +// gridOutrasRestricoes.getChildren().add(st); +// } +// +// if(a.getRestricao_conducao().matches("y")) +// { +// st = new StaticText(); +// st.setId("stRestricaoConducaoLbl"); +// st.setEscape(false); +// st.setText("Condução/interacção com veículos ou outros equipamentos."); +// gridOutrasRestricoes.getChildren().add(st); +// } +// +// if(a.getRestricao_vibracoes().matches("y")) +// { +// st = new StaticText(); +// st.setId("stRestricaoVibracoesLbl"); +// st.setEscape(false); +// st.setText("Utilizaçõo de equipamentos/ferramentas que impliquem exposição a vibrações ou impactos."); +// gridOutrasRestricoes.getChildren().add(st); +// } +// +// if(a.getRestricao_outras().trim().length() > 0) +// { +// st = new StaticText(); +// st.setId("stRestricaoOutras"); +// st.setEscape(false); +// st.setText(a.getRestricao_outras()); +// gridOutrasRestricoes.getChildren().add(st); +// } +// +// if(a.getMed_observ().trim().length() > 0) +// { +// stObservacoes.setText(a.getMed_observ()); +// } +// } + + } + + private void fillVerificacao(AnaliseAcidente a) + { +// StaticText st = new StaticText(); +// st.setId("stVerificacao1"); +// st.setEscape(false); +// String txtVer = "Verificado por " + a.getNome_resp_seg() + " a "; +// //txtVer += a.getData_assinatura_seg(); +// +// try +// { +// java.util.Date ddate = new java.util.Date(a.getData_assinatura_seg().getTime()); +// txtVer += utils.Utils.dateToYYYYMMDD(ddate); +// } +// catch(Exception ex){}; +// st.setText(txtVer); +// gridAssinaturasView.getChildren().add(st); +// +// st = new StaticText(); +// st.setId("stVerificacao2"); +// st.setEscape(false); +// txtVer = "Verificado por " + a.getNome_resp_rh() + " a "; +// //txtVer += a.getData_assinatura_rh(); +// try +// { +// java.util.Date ddate = new java.util.Date(a.getData_assinatura_rh().getTime()); +// txtVer += utils.Utils.dateToYYYYMMDD(ddate); +// } +// catch(Exception ex){}; +// st.setText(txtVer); +// gridAssinaturasView.getChildren().add(st); + + StaticText st = null; + String txtVer = null; + if(a.getAveriguador() != null) + { + if(a.getAveriguador().trim().length() > 0) + { + st = new StaticText(); + st.setId("stVerificacao1"); + st.setEscape(false); + txtVer = "Averiguado por " + a.getAveriguador() + " (Departamento de Segurança) a "; + //txtVer += a.getData_assinatura_seg(); + + try + { + java.util.Date ddate = new java.util.Date(a.getData_inicio_processo().getTime()); + txtVer += utils.Utils.dateToYYYYMMDD(ddate) + "."; + } + catch(Exception ex){}; + st.setText(txtVer); + gridAssinaturasView.getChildren().add(st); + } + } + + if(a.getAss_consolidacao().matches("y")) + { + st = new StaticText(); + st.setId("stVerificacao2"); + st.setEscape(false); + txtVer = "Verificado por " + a.getNome_resp_consolidacao() + " (Técnico de SHST) a "; + //txtVer += a.getData_assinatura_rh(); + try + { + java.util.Date ddate = new java.util.Date(a.getData_consolidacao().getTime()); + txtVer += utils.Utils.dateToYYYYMMDD(ddate) + "."; + } + catch(Exception ex){}; + st.setText(txtVer); + gridAssinaturasView.getChildren().add(st); + } + + if(a.getAss_resp_seg().matches("y")) + { + st = new StaticText(); + st.setId("stVerificacao3"); + st.setEscape(false); + txtVer = "Verificado por " + a.getNome_resp_seg() + " (Responsável de Segurança) a "; + //txtVer += a.getData_assinatura_rh(); + try + { + java.util.Date ddate = new java.util.Date(a.getData_assinatura_seg().getTime()); + txtVer += utils.Utils.dateToYYYYMMDD(ddate) + "."; + } + catch(Exception ex){}; + st.setText(txtVer); + gridAssinaturasView.getChildren().add(st); + } + + if(a.getAss_resp_rh().matches("y")) + { + st = new StaticText(); + st.setId("stVerificacao4"); + st.setEscape(false); + txtVer = "Verificado por " + a.getNome_resp_rh() + " (Responsável de RH) a "; + //txtVer += a.getData_assinatura_rh(); + try + { + java.util.Date ddate = new java.util.Date(a.getData_assinatura_rh().getTime()); + txtVer += utils.Utils.dateToYYYYMMDD(ddate) + "."; + } + catch(Exception ex){}; + st.setText(txtVer); + gridAssinaturasView.getChildren().add(st); + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + Acidentado ac = adp.getAcidentado(a.getAcidentado_id()); + if(ac.getNome_superior_hierarquico() != null) + { + if(ac.getNome_superior_hierarquico().trim().length() > 0) + { + st = new StaticText(); + st.setId("stVerificacao5"); + st.setEscape(false); + txtVer = "Com conhecimento de " + ac.getNome_superior_hierarquico() + " (Responsável hierárquico)"; + + if(ac.getEmail_superior_hierarquico() != null) + { + if(ac.getEmail_superior_hierarquico().trim().length() > 0) + { + try + { + java.util.Date ddate = new java.util.Date(ac.getData_email_superior_hierarquico().getTime()); + txtVer += " a " + utils.Utils.dateToYYYYMMDD(ddate); + } + catch(Exception ex){}; + } + } + txtVer += "."; + st.setText(txtVer); + gridAssinaturasView.getChildren().add(st); + } + } + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + HtmlPanelGrid grid = new HtmlPanelGrid(); + grid.setId("rodape1"); + grid.setColumns(1); + grid.setStyle("width: 100%"); + grid.setColumnClasses("gridColCenter"); + st = new StaticText(); + st.setId("stRodape1"); + st.setEscape(false); + st.setText("- processamento informático - acesso autenticado -"); + grid.getChildren().add(st); + gridAssinaturasView.getChildren().add(grid); + } + + private void fillImpressao(AnaliseAcidente a) + { + StaticText st = new StaticText(); + st.setId("stImpressaoView1"); + st.setEscape(false); + String stData = ""; + try + { + java.util.Date ddate = new java.util.Date(a.getData_assinatura_superior().getTime()); + stData += utils.Utils.dateToYYYYMMDD(ddate); + } + catch(Exception ex){}; + + String txt = "Assinado na Ficha de Análise de Acidente em papel por " + a.getNome_superior() + ", superior hierárquico / superior de "; + txt += getSessionBean1().getAcidentado().getNome() + ", a " + stData; + gridAssSupView.getChildren().add(st); + } + + private void fillImages() + { + ServletContext theApplicationsServletContext = + (ServletContext) this.getExternalContext().getContext(); + try + { +// String imageFileFolder = theApplicationsServletContext.getRealPath(Global.IMAGE_FOLDER + "/" + getSessionBean1().getCurrentAnalise().getId()); + String imageFileFolder = Global.IMAGE_FOLDER + "/" + getSessionBean1().getCurrentAnalise().getId(); + File f = new File(imageFileFolder); + if( f.exists() ) + { + File files[] = f.listFiles(); + + for(int i=0;i " + Global.ESTADO_SEG + " AND estado < " + Global.ESTADO_ASSINATURA_SEG + " AND (" + + "averiguacao_posterior = 'n' OR (averiguacao_posterior = 'y' AND averiguacao_obs <> '')" + + ") " + + "OR (estado > " + Global.ESTADO_ASSINATURA_SEG + " AND estado < " + Global.ESTADO_CONCLUIDO + ")" + + ")" + " ORDER BY analise_nr"; + } + else + { + sql += "AND estabelecimento_id = " + estabelecimento_id + " AND (" + + "(estado > " + Global.ESTADO_SEG + " AND estado < " + Global.ESTADO_FECHAR + " AND (" + + "averiguacao_posterior = 'n' OR (averiguacao_posterior = 'y' AND averiguacao_obs <> '')" + + ")) OR estado = " + Global.ESTADO_FECHAR + + ")" + " ORDER BY analise_nr"; + } + System.out.println( "SQL: " + sql ); + ResultSet rs = st.executeQuery( sql ); + ArrayList list = fillAnaliseFields( rs ); + return list; + } + + public ArrayList getAnalisesSeguimentoSegList( Integer estabelecimento_id, String responsavel_loja ) + throws Exception + { + Statement st = createStatement(); + String sql = null; + + if ( responsavel_loja.matches( "y" ) ) + { + sql ="SELECT * FROM analises_acidentes WHERE " + + "estabelecimento_id = " + estabelecimento_id + " AND (" + + "estado > " + Global.ESTADO_SEG + " AND estado < " + Global.ESTADO_ASSINATURA_SEG + " AND (" + + "averiguacao_posterior = 'n' OR (averiguacao_posterior = 'y' AND averiguacao_obs <> '')" + + ") " + + "OR (estado > " + Global.ESTADO_ASSINATURA_SEG + " AND estado < " + Global.ESTADO_CONCLUIDO + ")" + + ")" + " AND apagada = 'n' " + + "ORDER BY analise_nr"; +// sql ="SELECT * FROM analises_acidentes WHERE estabelecimento_id = " + estabelecimento_id + " AND ((estado = 7 and ass_resp_seg = 'y') OR (estado > 1 AND estado < 7 AND (averiguacao_posterior = 'n' OR (averiguacao_posterior = 'y' AND averiguacao_obs <> ''))) OR (estado > 7 AND estado < 10))"; + } + else + { +// sql ="SELECT * FROM analises_acidentes WHERE estabelecimento_id = " + estabelecimento_id + " AND ((estado > " + Global.ESTADO_SEG + " AND estado < 8 AND (averiguacao_posterior = 'n' OR (averiguacao_posterior = 'y' AND averiguacao_obs <> ''))) OR (estado > 7 AND estado < 10))"; + sql ="SELECT * FROM analises_acidentes WHERE " + + "estabelecimento_id = " + estabelecimento_id + " AND (" + + "(estado > " + Global.ESTADO_SEG + " AND estado < " + Global.ESTADO_FECHAR + " AND (" + + "averiguacao_posterior = 'n' OR (averiguacao_posterior = 'y' AND averiguacao_obs <> '')" + + ")) OR estado = " + Global.ESTADO_FECHAR + + ")" + " AND apagada = 'n' " + + "ORDER BY analise_nr"; + } + + ResultSet rs = st.executeQuery( sql ); + ArrayList list = fillAnaliseFields( rs ); + return list; + } + + public ArrayList searchAnalisesSeguimentoHS( Integer estabelecimento_id, + String nome, String estabelecimento, String visitaDate, String POR ) + throws Exception + { + if ( nome == null && estabelecimento == null && visitaDate == null && POR == null ) + { + return getAnalisesSeguimentoHsList( estabelecimento_id ); + } + + Statement st = createStatement(); + String sql = getExpression( nome, estabelecimento, visitaDate, POR ); + + sql += "AND (" + + "estado < " + Global.ESTADO_HS + " OR (estado > " + Global.ESTADO_HS + " AND estado < " + Global.ESTADO_CONSOLIDACAO + ") " + + "OR (estado > " + Global.ESTADO_CONSOLIDACAO + " AND estado < " + Global.ESTADO_FECHAR + ")" + + ")" + " ORDER BY analise_nr"; + + ResultSet rs = st.executeQuery( sql ); + ArrayList list = fillAnaliseFields( rs ); + return list; + } + + public ArrayList getAnalisesSeguimentoHsList( Integer estabelecimento_id ) + throws Exception + { + Statement st = createStatement(); + String sql = null; + + sql = "SELECT * FROM analises_acidentes WHERE (" + + "estado < " + Global.ESTADO_HS + " OR (estado > " + Global.ESTADO_HS + " AND estado < " + Global.ESTADO_CONSOLIDACAO + ") " + + "OR (estado > " + Global.ESTADO_CONSOLIDACAO + " AND estado < " + Global.ESTADO_FECHAR + ")" + + ")" + " AND apagada = 'n' " + + "ORDER BY analise_nr"; // AND estabelecimento_id = " + estabelecimento_id; + + ResultSet rs = st.executeQuery(sql); + System.out.println("SEGUIMENTO HS SQL : " + sql); + ArrayList list = fillAnaliseFields(rs); + return list; + } + + + public ArrayList searchAnalisesSeguimentoRH( Integer estabelecimento_id, + String nome, String visitaDate, String POR, String responsavel_loja ) + throws Exception + { + if ( nome == null && visitaDate == null && POR == null ) + { + return getAnalisesSeguimentoRhList( estabelecimento_id, responsavel_loja ); + } + + Statement st = createStatement(); + String sql = getExpression( nome, null, visitaDate, POR ); + + if ( responsavel_loja.matches( "y" ) ) + { + sql += "AND (estado = " + Global.ESTADO_SEG + " OR estado = " + Global.ESTADO_HS + + " OR estado = " + Global.ESTADO_CONSOLIDACAO + " OR estado = " + Global.ESTADO_ASSINATURA_SEG + + " OR estado = " + Global.ESTADO_FECHAR + ") AND estabelecimento_id = " + estabelecimento_id + + " ORDER BY analise_nr"; + } + else + { + sql += "AND ( estado = " + Global.ESTADO_SEG + " OR estado = " + Global.ESTADO_HS + + " OR estado = " + Global.ESTADO_CONSOLIDACAO + " OR estado = " + Global.ESTADO_ASSINATURA_SEG + + " OR estado = " + Global.ESTADO_ASSINATURA_RH + " OR estado = " + Global.ESTADO_FECHAR + + ") AND estabelecimento_id = " + estabelecimento_id + + " ORDER BY analise_nr"; + } + ResultSet rs = st.executeQuery( sql ); + ArrayList list = fillAnaliseFields( rs ); + return list; + } + + public ArrayList getAnalisesSeguimentoRhList( Integer estabelecimento_id, String responsavel_loja ) + throws Exception + { + Statement st = createStatement(); + String sql = null; + + if ( responsavel_loja.matches( "y" ) ) + { +// sql ="SELECT * FROM analises_acidentes WHERE (estado = 1 OR estado = 3 OR estado = 6 OR (estado = 7 AND estado_assinatura < 2) OR estado = 9) AND estabelecimento_id = " + estabelecimento_id; +// sql ="SELECT * FROM analises_acidentes WHERE (estado = 1 OR estado = 3 OR estado = 6 OR (estado = 7 AND estado_assinatura < 2) OR (estado = 7 and ass_resp_rh = 'y') OR estado = 9) AND estabelecimento_id = " + estabelecimento_id; + sql ="SELECT * FROM analises_acidentes WHERE (" + + "estado = " + Global.ESTADO_SEG + " OR estado = " + Global.ESTADO_HS + " OR estado = " + Global.ESTADO_CONSOLIDACAO + + " OR estado = " + Global.ESTADO_ASSINATURA_SEG + " OR estado = " + Global.ESTADO_FECHAR + + ") AND estabelecimento_id = " + estabelecimento_id + " AND apagada = 'n' " + + "ORDER BY analise_nr"; + } + else + { + sql ="SELECT * FROM analises_acidentes WHERE (" + + "estado = " + Global.ESTADO_SEG + " OR estado = " + Global.ESTADO_HS + " OR estado = " + Global.ESTADO_CONSOLIDACAO + + " OR estado = " + Global.ESTADO_ASSINATURA_SEG + " OR estado = " + Global.ESTADO_ASSINATURA_RH + " OR estado = " + Global.ESTADO_FECHAR + + ") AND estabelecimento_id = " + estabelecimento_id + " AND apagada = 'n' " + + "ORDER BY analise_nr"; + } + + ResultSet rs = st.executeQuery(sql); + ArrayList list = fillAnaliseFields(rs); + return list; + } + + + public ArrayList searchAnalisesSeguimentoMedico( Integer estabelecimento_id, + String nome, String visitaDate, String POR ) + throws Exception + { + if ( nome == null && visitaDate == null && POR == null ) + { + return getAnalisesSeguimentoMedList( estabelecimento_id ); + } + + Statement st = createStatement(); + String sql = getExpression( nome, null, visitaDate, POR ); + + sql += "AND estado < 5 OR (estado = 6 AND estado_assinatura <> 2) OR (estado = 6 AND estado_assinatura = 2 AND ass_med = 'y') " + + "OR (estado > 6 AND estado < 9) " + + "AND estabelecimento_id = " + estabelecimento_id + + " ORDER BY analise_nr"; + + ResultSet rs = st.executeQuery(sql); + ArrayList list = fillAnaliseFields(rs); + return list; + } + + public ArrayList getAnalisesSeguimentoMedList( Integer estabelecimento_id ) + throws Exception + { + Statement st = createStatement(); + String sql = null; + + sql = "SELECT * FROM analises_acidentes WHERE " + + "estado < 5 OR (estado = 6 AND estado_assinatura <> 2) OR (estado = 6 AND estado_assinatura = 2 AND ass_med = 'y') " + + "OR (estado > 6 AND estado < 9) " + + "AND estabelecimento_id = " + estabelecimento_id + " AND apagada = 'n' " + + "ORDER BY analise_nr"; + + ResultSet rs = st.executeQuery(sql); + ArrayList list = fillAnaliseFields(rs); + return list; + } + + + public ArrayList searchAnalisesSeguimentoDirSiprp( + String nome, String estabelecimento, String visitaDate, String POR ) + throws Exception + { + if ( nome == null && estabelecimento == null && visitaDate == null && POR == null ) + { + return getAnalisesSeguimentoDirSiprpList(); + } + + Statement st = createStatement(); + String sql = getExpression( nome, estabelecimento, visitaDate, POR ); + sql += " AND estado < " + Global.ESTADO_CONCLUIDO + " ORDER BY analise_nr"; + + ResultSet rs = st.executeQuery(sql); + ArrayList list = fillAnaliseFields(rs); + return list; + } + + public ArrayList getAnalisesSeguimentoDirSiprpList() throws Exception + { + Statement st = createStatement(); + String sql = null; + + sql = "SELECT * FROM analises_acidentes WHERE estado < " + Global.ESTADO_CONCLUIDO + " AND apagada = 'n' ORDER BY analise_nr"; + + ResultSet rs = st.executeQuery(sql); + ArrayList list = fillAnaliseFields(rs); + return list; + } + + public ArrayList searchAnalisesSeguimentoDirGerRh( + String nome, String estabelecimento, String visitaDate, String POR ) + throws Exception + { + return searchAnalisesSeguimentoDirSiprp( nome, estabelecimento, visitaDate, POR ); + } + + public ArrayList getAnalisesSeguimentoDirGerRhList() throws Exception + { + return getAnalisesSeguimentoDirSiprpList(); +// Statement st = createStatement(); +// String sql = null; +// +// sql ="SELECT * FROM analises_acidentes WHERE estado < " + Global.ESTADO_CONCLUIDO + " AND apagada = 'n' ORDER BY analise_nr"; +// +// ResultSet rs = st.executeQuery(sql); +// ArrayList list = fillAnaliseFields(rs); +// return list; + } + + public ArrayList searchAnalisesSeguimentoGestor( Integer estabelecimento_id, + String nome, String estabelecimento, String visitaDate, String POR ) + throws Exception + { + if ( nome == null && estabelecimento == null && visitaDate == null && POR == null ) + { + return getAnalisesSeguimentoGestorList( estabelecimento_id ); + } + + Statement st = createStatement(); + String sql = getExpression( nome, estabelecimento, visitaDate, POR ); + + if ( estabelecimento_id == null ) + { + sql += "AND estado < " + Global.ESTADO_CONCLUIDO + + " ORDER BY analise_nr"; + } + else + { + sql += "AND estado < " + Global.ESTADO_CONCLUIDO + " AND estabelecimento_id = " + estabelecimento_id + + " ORDER BY analise_nr"; + } + + ResultSet rs = st.executeQuery(sql); + ArrayList list = fillAnaliseFields(rs); + return list; + } + + public ArrayList getAnalisesSeguimentoGestorList( Integer estabelecimento_id ) + throws Exception + { + Statement st = createStatement(); + String sql = null; + + if ( estabelecimento_id == null ) + { + sql = "SELECT * FROM analises_acidentes WHERE " + + "estado < " + Global.ESTADO_CONCLUIDO + + " AND apagada = 'n' " + + "ORDER BY analise_nr"; + } + else + { + sql = "SELECT * FROM analises_acidentes WHERE " + + "estado < " + Global.ESTADO_CONCLUIDO + " AND estabelecimento_id = " + estabelecimento_id + + " AND apagada = 'n' " + + "ORDER BY analise_nr"; + } + + + ResultSet rs = st.executeQuery(sql); + ArrayList list = fillAnaliseFields(rs); + return list; + } + + + + + + /*************************************************************************/ + /****************************** CONCLUIDOS *******************************/ + /*************************************************************************/ + + public ArrayList getAnalisesConcluidasList(Integer estabelecimento_id) throws Exception + { + Statement st = createStatement(); + String sql = ""; + if(estabelecimento_id == null) + { + sql ="SELECT * FROM analises_acidentes WHERE estado = " + Global.ESTADO_CONCLUIDO + " AND apagada = 'n' ORDER BY analise_nr"; + } + else + { + sql ="SELECT * FROM analises_acidentes WHERE estado = " + Global.ESTADO_CONCLUIDO + " AND estabelecimento_id = " + estabelecimento_id + " AND apagada = 'n' ORDER BY analise_nr"; + } + + ResultSet rs = st.executeQuery(sql); + ArrayList list = fillAnaliseFields(rs); + + return list; + } + + public ArrayList getAnalisesConcluidasHsList() throws Exception + { + Statement st = createStatement(); + String sql ="SELECT * FROM analises_acidentes WHERE estado = " + Global.ESTADO_CONCLUIDO + " AND apagada = 'n' ORDER BY analise_nr"; + ResultSet rs = st.executeQuery(sql); + ArrayList list = fillAnaliseFields(rs); + + return list; + } + + public ArrayList searchAanalisesConcluidasList( Integer estabelecimento_id, + Integer ano, Integer mes, Integer dia, String POR, String nome, String estabelecimento ) + throws Exception + { + String sql = null; + + sql = getExpression( nome, estabelecimento, null, POR ); + + if ( estabelecimento_id != null && estabelecimento_id.intValue() > 0 ) + { + sql += "AND analises_acidentes.estabelecimento_id = " + estabelecimento_id + " "; + } + + if ( ano != null ) + { + final DateFormat D_F = new SimpleDateFormat( "yyyy-MM-dd" ); + Calendar calendar_from = Calendar.getInstance(); + Calendar calendar_to = Calendar.getInstance(); + + calendar_from.set( Calendar.YEAR, ano.intValue() ); + calendar_from.set( Calendar.MONTH, 0 ); + calendar_from.set( Calendar.DATE, 1 ); + + calendar_to.set( Calendar.YEAR, ano.intValue() ); + calendar_to.set( Calendar.MONTH, 11 ); + calendar_to.set( Calendar.DATE, 31 ); + + if ( mes != null ) + { + calendar_from.set( Calendar.MONTH, mes.intValue() - 1 ); + calendar_to.set( Calendar.MONTH, mes.intValue() - 1 ); + + if ( dia != null ) + { + calendar_from.set( Calendar.DATE, dia.intValue() ); + calendar_to.set( Calendar.DATE, dia.intValue() ); + } + else + { + calendar_from.set( Calendar.DATE, 1 ); + calendar_to.set( Calendar.DATE, 31 ); + } + } + else + { + calendar_from.set( Calendar.MONTH, 0 ); + calendar_to.set( Calendar.MONTH, 11 ); + } + + Date dateStart = calendar_from.getTime(); + Date dateEnd = calendar_to.getTime(); + + if ( dateStart.compareTo( dateEnd ) == 0 ) + { + sql += "AND analises_acidentes.data_acidente = '" + D_F.format( dateStart ) + "' "; + } + else + { + sql += "AND ( analises_acidentes.data_acidente >= '" + D_F.format( dateStart ) + "' AND analises_acidentes.data_acidente <= '" + D_F.format( dateEnd ) + "' ) "; + } + } + + sql += "AND estado = " + Global.ESTADO_CONCLUIDO + " ORDER BY analises_acidentes.analise_nr ASC"; + + System.out.println( "CONCLUIDAS SQL: " + sql ); + + Statement st = createStatement(); + ResultSet rs = st.executeQuery( sql ); + ArrayList list = fillAnaliseFields( rs ); + return list; + } + + + //by lino +// public ArrayList searchAanalisesConcluidasList( Integer estabelecimento_id, +// Integer ano, Integer mes, Integer dia, String por, String nome, String estabelecimento ) +// throws Exception +// { +// Calendar cal = Calendar.getInstance(); +// Statement st = createStatement(); +// String sql = ""; +// if(por != null) +// { +// por = por.toUpperCase(); +// } +// if(nome != null) +// { +// nome = nome.toUpperCase(); +// } +// +// 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() ); +// if(por != null && nome != null) +// { +// if(estabelecimento_id == null) +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND data_acidente = '" + data_acidente + +// "' AND (numero_mecanografico LIKE '%" + por + "%' OR nome LIKE '%" + nome + "%') " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND apagada = 'n' ORDER BY analise_nr"; +// } +// else +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND data_acidente = '" + data_acidente + +// "' AND (numero_mecanografico LIKE '%" + por + "%' OR nome LIKE '%" + nome + "%') " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND estabelecimento_id = " + estabelecimento_id + +// " AND apagada = 'n' ORDER BY analise_nr"; +// } +// } +// else if(por != null) +// { +// if(estabelecimento_id == null) +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND data_acidente = '" + data_acidente + +// "' AND numero_mecanografico LIKE '%" + por + "%' AND estado = " + Global.ESTADO_CONCLUIDO + +// " AND apagada = 'n' ORDER BY analise_nr"; +// } +// else +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND data_acidente = '" + data_acidente + +// "' AND numero_mecanografico LIKE '%" + por + "%' AND estado = " + Global.ESTADO_CONCLUIDO + +// " AND estabelecimento_id = " + estabelecimento_id + " AND apagada = 'n' ORDER BY analise_nr"; +// } +// +// } +// else if( nome != null) +// { +// if(estabelecimento_id == null) +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND data_acidente = '" + data_acidente + +// "' AND nome LIKE '%" + nome + "%' AND estado = " + Global.ESTADO_CONCLUIDO + +// " AND apagada = 'n' ORDER BY analise_nr"; +// } +// else +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND data_acidente = '" + data_acidente + +// "' AND nome LIKE '%" + nome + "%' AND estado = " + Global.ESTADO_CONCLUIDO + +// " AND estabelecimento_id = " + estabelecimento_id + " AND apagada = 'n' ORDER BY analise_nr"; +// } +// } +// else +// { +// if(estabelecimento_id == null) +// { +// sql = "SELECT * FROM analises_acidentes " + +// "WHERE data_acidente = '" + data_acidente + "' AND estado = " + Global.ESTADO_CONCLUIDO + +// " AND apagada = 'n' ORDER BY analise_nr"; +// } +// else +// { +// sql = "SELECT * FROM analises_acidentes " + +// "WHERE data_acidente = '" + data_acidente + "' AND estado = " + Global.ESTADO_CONCLUIDO + +// " AND estabelecimento_id = " + estabelecimento_id + " AND apagada = 'n' ORDER BY analise_nr"; +// } +// } +// } +// 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(por != null && nome != null) +// { +// if(estabelecimento_id == null) +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND data_acidente >= '" + data_acidente_from + +// "' AND data_acidente <= '" + data_acidente_to + +// "' AND (numero_mecanografico LIKE '%" + por + "%' OR nome LIKE '%" + nome + "%') " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND apagada = 'n' ORDER BY analise_nr"; +// } +// else +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND data_acidente >= '" + data_acidente_from + +// "' AND data_acidente <= '" + data_acidente_to + +// "' AND (numero_mecanografico LIKE '%" + por + "%' OR nome LIKE '%" + nome + "%') " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND estabelecimento_id = " + estabelecimento_id + +// " AND apagada = 'n' ORDER BY analise_nr"; +// } +// } +// else if(por != null) +// { +// if(estabelecimento_id == null) +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND data_acidente >= '" + data_acidente_from + +// "' AND data_acidente <= '" + data_acidente_to + "' AND numero_mecanografico LIKE '%" + por + "%' " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND apagada = 'n' ORDER BY analise_nr"; +// } +// else +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND data_acidente >= '" + data_acidente_from + +// "' AND data_acidente <= '" + data_acidente_to + "' AND numero_mecanografico LIKE '%" + por + "%' " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND estabelecimento_id = " + estabelecimento_id + +// " AND apagada = 'n' ORDER BY analise_nr"; +// } +// +// } +// else if( nome != null) +// { +// if(estabelecimento_id == null) +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND data_acidente >= '" + data_acidente_from + +// "' AND data_acidente <= '" + data_acidente_to + "' AND nome LIKE '%" + nome + "%' " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND apagada = 'n' ORDER BY analise_nr"; +// } +// else +// { +// sql = "SELECT * FROM analises_acidentes, acidentados" + +// " WHERE acidentado_id = acidentados.id AND data_acidente >= '" + data_acidente_from + +// "' AND data_acidente <= '" + data_acidente_to + "' AND nome LIKE '%" + nome + "%' " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND estabelecimento_id = " + estabelecimento_id + +// " AND apagada = 'n' ORDER BY analise_nr"; +// } +// } +// else +// { +// if(estabelecimento_id == null) +// { +// sql = "SELECT * FROM analises_acidentes " + +// "WHERE data_acidente >= '" + data_acidente_from + "' AND data_acidente <= '" + data_acidente_to + +// "' AND estado = " + Global.ESTADO_CONCLUIDO + " AND apagada = 'n' ORDER BY analise_nr"; +// } +// else +// { +// sql = "SELECT * FROM analises_acidentes " + +// "WHERE data_acidente >= '" + data_acidente_from + "' AND data_acidente <= '" + data_acidente_to + +// "' AND estado = " + Global.ESTADO_CONCLUIDO + " AND estabelecimento_id = " + estabelecimento_id + +// " AND apagada = 'n' ORDER BY analise_nr"; +// } +// +// } +// } // 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(por != null && nome != null) +// { +// if(estabelecimento_id == null) +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND data_acidente >= '" + data_acidente_from + +// "' AND data_acidente <= '" + data_acidente_to + +// "' AND (numero_mecanografico LIKE '%" + por + "%' OR nome LIKE '%" + nome + "%') " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND apagada = 'n' ORDER BY analise_nr"; +// } +// else +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND data_acidente >= '" + data_acidente_from + +// "' AND data_acidente <= '" + data_acidente_to + +// "' AND (numero_mecanografico LIKE '%" + por + "%' OR nome LIKE '%" + nome + "%') " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND estabelecimento_id = " + estabelecimento_id + +// " AND apagada = 'n' ORDER BY analise_nr"; +// } +// } +// else if(por != null) +// { +// if(estabelecimento_id == null) +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND data_acidente >= '" + data_acidente_from + +// "' AND data_acidente <= '" + data_acidente_to + +// "' AND numero_mecanografico LIKE '%" + por + "%' AND estado = " + Global.ESTADO_CONCLUIDO + +// " AND apagada = 'n' ORDER BY analise_nr"; +// } +// else +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND data_acidente >= '" + data_acidente_from + +// "' AND data_acidente <= '" + data_acidente_to + "' AND numero_mecanografico LIKE '%" + por + "%' " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND estabelecimento_id = " + estabelecimento_id + +// " AND apagada = 'n' ORDER BY analise_nr"; +// } +// +// } +// else if( nome != null) +// { +// if(estabelecimento_id == null) +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND data_acidente >= '" + data_acidente_from + +// "' AND data_acidente <= '" + data_acidente_to + "' AND nome LIKE '%" + nome + "%' " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND apagada = 'n' ORDER BY analise_nr"; +// } +// else +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND data_acidente >= '" + data_acidente_from + +// "' AND data_acidente <= '" + data_acidente_to + "' AND nome LIKE '%" + nome + "%' " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND estabelecimento_id = " + estabelecimento_id + +// " AND apagada = 'n' ORDER BY analise_nr"; +// } +// } +// else +// { +// if(estabelecimento_id == null) +// { +// sql = "SELECT * FROM analises_acidentes " + +// "WHERE data_acidente >= '" + data_acidente_from + "' AND data_acidente <= '" + data_acidente_to + +// "' AND estado = " + Global.ESTADO_CONCLUIDO + " AND apagada = 'n' ORDER BY analise_nr"; +// } +// else +// { +// sql = "SELECT * FROM analises_acidentes " + +// "WHERE data_acidente >= '" + data_acidente_from + "' AND data_acidente <= '" + data_acidente_to + +// "' AND estado = " + Global.ESTADO_CONCLUIDO + " AND estabelecimento_id = " + estabelecimento_id + +// " AND apagada = 'n' ORDER BY analise_nr"; +// } +// } +// } +// } // ano +// else +// { +// if(por != null && nome != null) +// { +// if(estabelecimento_id == null) +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND (numero_mecanografico LIKE '%" + por + "%' OR nome LIKE '%" + nome + "%') " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND apagada = 'n' ORDER BY analise_nr"; +// } +// else +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND (numero_mecanografico LIKE '%" + por + "%' OR nome LIKE '%" + nome + "%') " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND estabelecimento_id = " + estabelecimento_id + +// " AND apagada = 'n' ORDER BY analise_nr"; +// } +// } +// else if(por != null) +// { +// if(estabelecimento_id == null) +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND numero_mecanografico LIKE '%" + por + "%' " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND apagada = 'n' ORDER BY analise_nr"; +// } +// else +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND numero_mecanografico LIKE '%" + por + "%' " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND estabelecimento_id = " + estabelecimento_id + +// " AND apagada = 'n' ORDER BY analise_nr"; +// } +// +// } +// else if( nome != null ) +// { +// if(estabelecimento_id == null) +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND nome LIKE '%" + nome + "%' " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND apagada = 'n' ORDER BY analise_nr"; +// } +// else +// { +// sql = "SELECT * FROM analises_acidentes, acidentados " + +// "WHERE acidentado_id = acidentados.id AND nome LIKE '%" + nome + "%' " + +// "AND estado = " + Global.ESTADO_CONCLUIDO + " AND estabelecimento_id = " + estabelecimento_id + +// " AND apagada = 'n' ORDER BY analise_nr"; +// } +// +// } +// else +// { +// if(estabelecimento_id == null) +// { +// sql = "SELECT * FROM analises_acidentes " + +// "WHERE estado = " + Global.ESTADO_CONCLUIDO + " AND apagada = 'n' ORDER BY analise_nr"; +// } +// else +// { +// sql = "SELECT * FROM analises_acidentes " + +// "WHERE estado = " + Global.ESTADO_CONCLUIDO + " AND estabelecimento_id = " + estabelecimento_id + +// " AND apagada = 'n' ORDER BY analise_nr"; +// } +// +// } +// } +// ResultSet rs = st.executeQuery(sql); +// ArrayList list = fillAnaliseFields(rs); +// +// return list; +// } + + private ArrayList fillAnaliseFields(ResultSet rs) throws Exception + { + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement stlocal = dblocal.createStatement(); + Statement stlocal1 = dblocal.createStatement(); + + ArrayList list = new ArrayList(); + if(!rs.isBeforeFirst()) //rs empty + { + dblocal.close(); + return list; + } + 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.setEmpresa_id(new Integer(rs.getInt("empresa_id"))); + a.setEstabelecimento_id(new Integer(rs.getInt("estabelecimento_id"))); + String sqllocal1 = "SELECT nome FROM estabelecimentos WHERE id = " + a.getEstabelecimento_id(); + ResultSet rslocal1 = stlocal1.executeQuery(sqllocal1); + rslocal1.first(); + a.setNome_estabelecimento( utils.Utils.unicodeToHTML( rslocal1.getString("nome") ) ); + + a.setEstado(new Integer(rs.getInt("estado"))); + a.setEstado_assinatura(new Integer(rs.getInt("estado_assinatura"))); + a.setFase(getFase(a.getEstado().intValue())); + a.setAcidentado_id(new Integer( rs.getInt("acidentado_id"))); + Acidentado ac = getAcidentado(a.getAcidentado_id()); + String sqllocal = "SELECT nome, numero_mecanografico FROM trabalhadores WHERE id = " + ac.getTrabalhador_id(); + ResultSet rslocal = stlocal.executeQuery(sqllocal); + String nome_acidentado = ""; + String numero_mecanografico = ""; + if ( rslocal.first() ) + { + nome_acidentado = rslocal.getString("nome"); + numero_mecanografico = rslocal.getString( "numero_mecanografico" ); + } + a.setNome_acidentado(utils.Utils.unicodeToHTML(nome_acidentado)); + a.setNumero_mecanografico( numero_mecanografico ); + Object horas_turno = rs.getObject("horas_turno"); + if(horas_turno == null) + { + a.setHoras_turno(null); + } + else + { + a.setHoras_turno(new Integer(rs.getInt("horas_turno"))); + } + + a.setAveriguador(rs.getString("averiguador")); + //a.setSeccao(rs.getString("seccao")); + a.setDepartamento_id( new Integer(rs.getInt("departamento_id")) ); + a.setSeccao_id( new Integer(rs.getInt("seccao_id")) ); + 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( new Integer(rs.getInt("causas")) ); + a.setDescricao(rs.getString("descricao")); + a.setConclusoes(rs.getString("conclusoes")); + a.setAccoes(rs.getString("accoes")); + a.setAveriguacao_posterior(rs.getString("averiguacao_posterior")); + a.setAveriguacao_obs(rs.getString("averiguacao_obs")); + + a.setHora_acidente(rs.getTime("hora_acidente")); + a.setFormacao_shst(rs.getString("formacao_shst")); + Object o = rs.getString("formacao_shst_nao_porque"); + if(o == null) + { + a.setFormacao_shst_nao_porque(""); + } + else + { + a.setFormacao_shst_nao_porque(rs.getString("formacao_shst_nao_porque")); + } + a.setOutros_acidentes_com_colaborador(rs.getString("outros_acidentes_com_colaborador")); + a.setNr_acidentes_com_colaborador(new Integer(rs.getInt("nr_acidentes_com_colaborador"))); + a.setNr_relatorio_acidente_colaborador1(new Integer(rs.getInt("nr_relatorio_acidente_colaborador1"))); + a.setNr_relatorio_acidente_colaborador2(new Integer(rs.getInt("nr_relatorio_acidente_colaborador2"))); + a.setNr_relatorio_acidente_colaborador3(new Integer(rs.getInt("nr_relatorio_acidente_colaborador3"))); + a.setNr_relatorio_acidente_colaborador4(new Integer(rs.getInt("nr_relatorio_acidente_colaborador4"))); + a.setAcidentes_outros_colaboradores(rs.getString("acidentes_outros_colaboradores")); + a.setNr_acidentes_outros_colaboradores(new Integer(rs.getInt("nr_acidentes_outros_colaboradores"))); + a.setNr_relatorio_acidente_outros_colaboradores1(new Integer(rs.getInt("nr_relatorio_acidente_outros_colaboradores1"))); + a.setNr_relatorio_acidente_outros_colaboradores2(new Integer(rs.getInt("nr_relatorio_acidente_outros_colaboradores2"))); + a.setNr_relatorio_acidente_outros_colaboradores3(new Integer(rs.getInt("nr_relatorio_acidente_outros_colaboradores3"))); + a.setNr_relatorio_acidente_outros_colaboradores4(new Integer(rs.getInt("nr_relatorio_acidente_outros_colaboradores4"))); + + a.setLesao_cabeca(rs.getString("lesao_cabeca")); + a.setLesao_pescoco(rs.getString("lesao_pescoco")); + a.setLesao_tronco(rs.getString("lesao_tronco")); + a.setLesao_membro_sup_dir(rs.getString("lesao_membro_sup_dir")); + a.setLesao_membro_sup_esq(rs.getString("lesao_membro_sup_esq")); + a.setLesao_membro_inf_dir(rs.getString("lesao_membro_inf_dir")); + a.setLesao_membro_inf_esq(rs.getString("lesao_membro_inf_esq")); + Object ob = rs.getString("especif1"); + if(ob == null) + { + a.setEspecif1(""); + } + else + { + a.setEspecif1(rs.getString("especif1")); + } + ob = rs.getString("especif2"); + if(ob == null) + { + a.setEspecif2(""); + } + else + { + a.setEspecif2(rs.getString("especif2")); + } + ob = rs.getString("especif3"); + if(ob == null) + { + a.setEspecif3(""); + } + else + { + a.setEspecif3(rs.getString("especif3")); + } + ob = rs.getString("especif4"); + if(ob == null) + { + a.setEspecif4(""); + } + else + { + a.setEspecif4(rs.getString("especif4")); + } + ob = rs.getString("tipo_lesao"); + if(ob == null) + { + a.setTipo_lesao(""); + } + else + { + a.setTipo_lesao(rs.getString("tipo_lesao")); + } + a.setTipo_incapacidade(rs.getString("tipo_incapacidade")); + //a.setCoef_incapacidade(new Integer(( rs.getInt("coef_incapacidade") ))); + a.setCoef_incapacidade((Integer) rs.getObject("coef_incapacidade")); + a.setData_aval_incapacidade(rs.getDate("data_aval_incapacidade")); + a.setData_rev_incapacidade(rs.getDate("data_rev_incapacidade")); + a.setPeriodo_incapacidade_de(rs.getDate("periodo_incapacidade_de")); + a.setPeriodo_incapacidade_a(rs.getDate("periodo_incapacidade_a")); + a.setImg_flexao(rs.getString("img_flexao")); + a.setImg_ext1(rs.getString("img_ext1")); + a.setImg_ext2(rs.getString("img_ext2")); + a.setImg_cab2(rs.getString("img_cab2")); + a.setImg_cab3(rs.getString("img_cab3")); + a.setImg_ma2(rs.getString("img_ma2")); + a.setImg_ma3(rs.getString("img_ma3")); + a.setImg_ma5(rs.getString("img_ma5")); + a.setImg_ma6(rs.getString("img_ma6")); + a.setImg_ma8(rs.getString("img_ma8")); + a.setImg_ma10(rs.getString("img_ma10")); + a.setImg_rot1(rs.getString("img_rot1")); + a.setImg_rot2(rs.getString("img_rot2")); + a.setImg_cab1(rs.getString("img_cab1")); + a.setImg_cab4(rs.getString("img_cab4")); + a.setImg_ma1(rs.getString("img_ma1")); + a.setImg_ma4(rs.getString("img_ma4")); + a.setImg_ma7(rs.getString("img_ma7")); + a.setImg_ma9(rs.getString("img_ma9")); + a.setRestricao_carga(new Integer( rs.getInt("restricao_carga") )); + a.setRestricao_motricidade(rs.getString("restricao_motricidade")); + a.setRestricao_conducao(rs.getString("restricao_conducao")); + a.setRestricao_vibracoes(rs.getString("restricao_vibracoes")); + ob = rs.getString("restricao_outras"); + if(ob == null) + { + a.setRestricao_outras(""); + } + else + { + a.setRestricao_outras(rs.getString("restricao_outras")); + } + ob = rs.getString("med_observ"); + if(ob == null) + { + a.setMed_observ(""); + } + else + { + a.setMed_observ(rs.getString("med_observ")); + } + a.setAnalise_nr(rs.getString("analise_nr")); + a.setMedico_id(new Integer(rs.getInt("medico_id"))); + a.setTecnico_saude_id(new Integer(rs.getInt("tecnico_saude_id"))); + + //a.setAss_hs(rs.getString("ass_hs")); + //a.setAss_seg(rs.getString("ass_seg")); + a.setAss_resp_seg(rs.getString("ass_resp_seg")); + //a.setAss_med(rs.getString("ass_med")); + a.setAss_resp_rh(rs.getString("ass_resp_rh")); + a.setAss_consolidacao(rs.getString("ass_consolidacao")); + a.setData_consolidacao(rs.getDate("data_consolidacao")); + a.setData_assinatura_seg(rs.getDate("data_assinatura_seg")); + a.setData_assinatura_rh(rs.getDate("data_assinatura_rh")); + a.setNome_resp_seg(rs.getString("nome_resp_seg")); + a.setNome_resp_rh(rs.getString("nome_resp_rh")); + a.setCorrecao(rs.getString("correcao")); + a.setObservacoes_correcao(rs.getString("observacoes_correcao")); + a.setEstado_antes_correcao( new Integer(rs.getInt("estado_antes_correcao"))); + a.setAss_superior(rs.getString("ass_superior")); + a.setNome_superior(rs.getString("nome_superior")); + a.setData_assinatura_superior(rs.getDate("data_assinatura_superior")); + a.setData_inicio_processo(rs.getDate("data_inicio_processo")); + a.setNome_resp_consolidacao(rs.getString("nome_resp_consolidacao")); + //System.out.println("ANALISE NR : " + a.getAnalise_nr()); + a.setRh_fase4(new Integer( rs.getInt("rh_fase4") )); + list.add(a); + }while(rs.next()); + dblocal.close(); + + + return list; + } + + public ArrayList searchTrabalhador(Integer empresa_id, Integer estabelecimento_id, String nrMecanografico, String nome) throws Exception + { + ArrayList list = new ArrayList(); + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement stlocal = dblocal.createStatement(); + String sql = ""; + + + // trabalhadores do estabelecimento + if(nrMecanografico != null) + { + if(nome != null) + { + sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id = " + estabelecimento_id + " AND (trabalhadores.nome LIKE '%" + nome + "%' OR LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%') AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'"; + } + else + { + sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id = " + estabelecimento_id + " AND LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%' AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'"; + } + } + else + { + if(nome != null) + { + sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id = " + estabelecimento_id + " AND trabalhadores.nome LIKE '%" + nome + "%' AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'"; + } + } + + System.out.println("TRABALHADORES SQL B : " + sql); + ResultSet rslocal = stlocal.executeQuery(sql); + if(rslocal.isBeforeFirst()) + { + rslocal.first(); + do + { + Trabalhador t = new Trabalhador(); + t.setId(new Integer(rslocal.getInt(1))); //id + String nome_trab = rslocal.getString(2); + t.setNome(utils.Utils.unicodeToHTML(nome_trab)); + t.setData_nascimento(rslocal.getDate("data_nascimento")); + t.setFuncao(rslocal.getString("funcao_proposta")); + t.setData_admissao(rslocal.getDate("data_admissao")); + t.setNumero_mecanografico(rslocal.getString("numero_mecanografico")); + t.setEstabelecimento_id(new Integer( rslocal.getInt(7) )); + //if(nome != null) + //{ + t.setEstabelecimento(utils.Utils.unicodeToHTML(rslocal.getString(8))); + //} + + list.add(t); + }while(rslocal.next()); + } + + + //restantes trabalhadores + if(nrMecanografico != null) + { + if(nome != null) + { + sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id <> " + estabelecimento_id + " AND (trabalhadores.nome LIKE '%" + nome + "%' OR LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%') AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'"; + } + else + { + sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id <> " + estabelecimento_id + " AND LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%' AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'"; + } + } + else + { + if(nome != null) + { + sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id <> " + estabelecimento_id + " AND trabalhadores.nome LIKE '%" + nome + "%' AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'"; + } + } + + +// if(nrMecanografico != null) +// { +// sql = "SELECT * FROM trabalhadores WHERE LOWER(numero_mecanografico) = '" + nrMecanografico.toLowerCase() + "'"; +// } +// else if(nome != null) +// { +// sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND trabalhadores.nome LIKE '%" + nome + "%'"; +// } + System.out.println("TRABALHADORES SQL : " + sql); + rslocal = stlocal.executeQuery(sql); + if(rslocal.isBeforeFirst()) + { + rslocal.first(); + do + { + Trabalhador t = new Trabalhador(); + t.setId(new Integer(rslocal.getInt(1))); //id + String nome_trab = rslocal.getString(2); + t.setNome(utils.Utils.unicodeToHTML(nome_trab)); + t.setData_nascimento(rslocal.getDate("data_nascimento")); + t.setFuncao(rslocal.getString("funcao_proposta")); + t.setData_admissao(rslocal.getDate("data_admissao")); + t.setNumero_mecanografico(rslocal.getString("numero_mecanografico")); + t.setEstabelecimento_id(new Integer( rslocal.getInt(7) )); + //if(nome != null) + //{ + t.setEstabelecimento(utils.Utils.unicodeToHTML(rslocal.getString(8))); + //} + + list.add(t); + }while(rslocal.next()); + } + dblocal.close(); + return list; + } + + public ArrayList searchTrabalhador(Integer empresa_id, String nrMecanografico, String nome) throws Exception + { + ArrayList list = new ArrayList(); + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement stlocal = dblocal.createStatement(); + String sql = ""; + + StringTokenizer st = null; + + if(nrMecanografico != null) + { + if(nome != null) + { + String sql1 = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND ("; + String sql2 = ""; + String sql3 = ") AND LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%' AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'"; + st = new StringTokenizer (nome); + int n = 0; + while (st.hasMoreTokens ()) { + if(n > 0) + { + sql2 += "AND "; + } + sql2 += "trabalhadores.nome LIKE '%" + st.nextToken () + "%' "; + n++; + } + sql = sql1 + sql2 + sql3; + //sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND (trabalhadores.nome LIKE '%" + nome + "%' AND LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%') AND estabelecimentos.empresa_id = " + empresa_id; + } + else + { + sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%' AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'"; + } + } + else + { + if(nome != null) + { + //sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND trabalhadores.nome LIKE '%" + nome + "%' AND estabelecimentos.empresa_id = " + empresa_id; + String sql1 = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND ("; + String sql2 = ""; + String sql3 = ") AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'"; + st = new StringTokenizer (nome); + int n = 0; + while (st.hasMoreTokens ()) { + if(n > 0) + { + sql2 += "AND "; + } + sql2 += "trabalhadores.nome LIKE '%" + st.nextToken () + "%' "; + n++; + } + sql = sql1 + sql2 + sql3; + + } + } + + System.out.println("TRABALHADORES SQL A : " + sql); +// if(nrMecanografico != null) +// { +// sql = "SELECT * FROM trabalhadores WHERE LOWER(numero_mecanografico) = '" + nrMecanografico.toLowerCase() + "'"; +// } +// else if(nome != null) +// { +// sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND trabalhadores.nome LIKE '%" + nome + "%'"; +// } + ResultSet rslocal = stlocal.executeQuery(sql); + rslocal.first(); + do + { + Trabalhador t = new Trabalhador(); + t.setId(new Integer(rslocal.getInt(1))); //id + String nome_trab = rslocal.getString(2); + t.setNome(utils.Utils.unicodeToHTML(nome_trab)); + t.setData_nascimento(rslocal.getDate("data_nascimento")); + t.setFuncao(rslocal.getString("funcao_proposta")); + t.setData_admissao(rslocal.getDate("data_admissao")); + t.setNumero_mecanografico(rslocal.getString("numero_mecanografico")); + t.setEstabelecimento_id(new Integer( rslocal.getInt(7) )); + //if(nome != null) + //{ + t.setEstabelecimento(utils.Utils.unicodeToHTML(rslocal.getString(8))); + //} + + list.add(t); + }while(rslocal.next()); + dblocal.close(); + return list; + } + + public ArrayList getTrabalhadoresListByEstabelecimento(Integer estabelecimento_id) throws Exception + { + Utils utils = new Utils(); + 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"))); + String nome = rslocal.getString("nome"); + t.setNome(utils.unicodeToHTML(nome)); + t.setData_nascimento(rslocal.getDate("data_nascimento")); + t.setFuncao(rslocal.getString("funcao_proposta")); + t.setData_admissao(rslocal.getDate("data_admissao")); + 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")); + t.setFuncao(rslocal.getString("funcao_proposta")); + t.setData_admissao(rslocal.getDate("data_admissao")); + dblocal.close(); + return t; + } + + public Acidentado getAcidentado(Integer acidentado_id) throws Exception + { + Strings strings = new Strings(); + Acidentado a = new Acidentado(); + Statement st = createStatement(); + String sql ="SELECT * FROM acidentados WHERE id = " + acidentado_id; + ResultSet rs = st.executeQuery(sql); + rs.first(); + a.setId(new Integer(rs.getInt("id"))); + a.setNome(rs.getString("nome")); + a.setData_nascimento(rs.getDate("data_nascimento")); + a.setBilhete_identidade(rs.getString("bilhete_identidade")); + a.setMorada(rs.getString("morada")); + a.setCod_postal(rs.getString("cod_postal")); + a.setLocalidade(rs.getString("localidade")); + a.setContacto_telefonico(rs.getString("contacto_telefonico")); + a.setData_admissao(rs.getDate("data_admissao")); + a.setTurno(rs.getString("turno")); + String funcao = rs.getString("funcao"); + a.setFuncao(utils.Utils.unicodeToHTML(funcao)); + a.setTrabalhador_id(new Integer(rs.getInt("trabalhador_id"))); + a.setNumero_mecanografico(rs.getString("numero_mecanografico")); + a.setNome_superior_hierarquico(rs.getString("nome_superior_hierarquico")); + a.setEmail_superior_hierarquico(rs.getString("email_superior_hierarquico")); + a.setEstabelecimento_origem(rs.getString("estabelecimento_origem")); + a.setData_email_superior_hierarquico(rs.getDate("data_email_superior_hierarquico")); + //a.setAnalise_acidente_id(new Integer("analise_acidente_id")); + return a; + } + + public String getEmpresaNome(Integer empresa_id) throws Exception + { + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement stlocal = dblocal.createStatement(); + String sql ="SELECT designacao_social FROM empresas WHERE id = " + empresa_id; + ResultSet rslocal = stlocal.executeQuery(sql); + rslocal.first(); + String nome = rslocal.getString("designacao_social"); + dblocal.close(); + return nome; + } + + + + 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 Utils.unicodeToHTML(nome); + } + + public String getMedicoNome(Integer medico_id) throws Exception + { + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement stlocal = dblocal.createStatement(); + String sql ="SELECT nome FROM medicos WHERE id = " + medico_id; + ResultSet rslocal = stlocal.executeQuery(sql); + rslocal.first(); + String nome = rslocal.getString("nome"); + dblocal.close(); + return Utils.unicodeToHTML(nome); + } + + public Medico getMedico(Integer id) throws Exception + { + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement stlocal = dblocal.createStatement(); + String sql ="SELECT * FROM medicos WHERE id = " + id; + ResultSet rslocal = stlocal.executeQuery(sql); + rslocal.first(); + Medico m = new Medico(); + m.setId(new Integer( rslocal.getInt("id") )); + m.setNome(rslocal.getString("nome")); + m.setNumero_cedula(rslocal.getString("numero_cedula")); + dblocal.close(); + return m; + } + + public String getTecnicoSaudeNome(Integer tecnico_id) throws Exception + { + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement stlocal = dblocal.createStatement(); + String sql ="SELECT nome FROM marcacoes_tecnicos_hst WHERE id = " + tecnico_id; + ResultSet rslocal = stlocal.executeQuery(sql); + rslocal.first(); + String nome = rslocal.getString("nome"); + dblocal.close(); + return nome; + } + + + public Integer getMaxAcidentadoId() + { + Statement st = createStatement(); + String sql = "SELECT max(acidentados.id)+1 AS MAXACIDENTADOID FROM acidentados"; + try + { + ResultSet rs = st.executeQuery(sql); + rs.first(); + Integer newId = new Integer(rs.getInt("MAXACIDENTADOID")); + if(newId.intValue() == 0) + { + newId = new Integer(1); + } + return newId; + } + catch(Exception ex) + { + return new Integer(1); + } + } + + public Integer createAcidentado(Acidentado a) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxAcidentadoId(); + String sql = "INSERT INTO acidentados (id, nome, data_nascimento, bilhete_identidade, morada, cod_postal, localidade, contacto_telefonico, data_admissao, turno, funcao, trabalhador_id, numero_mecanografico, nome_superior_hierarquico, email_superior_hierarquico, estabelecimento_origem, data_email_superior_hierarquico) VALUES ("; + sql += newId + ", '"; + sql += a.getNome() + "', "; + if(a.getData_nascimento() == null) + { + sql += null + ", '"; + } + else + { + sql += "'" + a.getData_nascimento() + "', '"; + } + //sql += a.getData_nascimento() + "', '"; + sql += a.getBilhete_identidade() + "', '"; + sql += a.getMorada() + "', '"; + sql += a.getCod_postal() + "', '"; + sql += a.getLocalidade() + "', '"; + sql += a.getContacto_telefonico() + "', "; + if(a.getData_admissao() == null) + { + sql += null + ", '"; + } + else + { + sql += "'" + a.getData_admissao() + "', '"; + } +// sql += a.getData_admissao() + "', '"; + sql += a.getTurno() + "', '"; + sql += a.getFuncao() + "', "; + sql += a.getTrabalhador_id() + ", '"; + sql += a.getNumero_mecanografico() + "', '"; + sql += a.getNome_superior_hierarquico() + "', '"; + sql += a.getEmail_superior_hierarquico() + "', '"; + sql += a.getEstabelecimento_origem() + "', "; + if(a.getData_email_superior_hierarquico() == null) + { + sql += null + ")"; + } + else + { + sql += "'" + a.getData_email_superior_hierarquico() + "')"; + } + //sql += a.getAnalise_acidente_id() + ")"; + System.out.println("SQL ACIDENTADO : " + sql); + st.execute(sql); + + return newId; + } + + public void updateAcidentado(Acidentado a) throws Exception + { + Statement st = createStatement(); + String sql = "UPDATE acidentados SET nome = '" + a.getNome() + "', "; + if(a.getData_nascimento() == null) + { + sql += "data_nascimento = " + null + ", "; + } + else + { + sql += "data_nascimento = '" + a.getData_nascimento() + "', "; + } +// sql += "data_nascimento = '" + a.getData_nascimento() + "', "; + sql += "bilhete_identidade = '" + a.getBilhete_identidade() + "', "; + sql += "morada = '" + a.getMorada() + "', "; + sql += "cod_postal = '" + a.getCod_postal() + "', "; + sql += "localidade = '" + a.getLocalidade() + "', "; + sql += "contacto_telefonico = '" + a.getContacto_telefonico() + "', "; + if(a.getData_admissao() == null) + { + sql += "data_admissao = " + null + ", "; + } + else + { + sql += "data_admissao = '" + a.getData_admissao() + "', "; + } +// sql += "data_admissao = '" + a.getData_admissao() + "', "; + sql += "turno = '" + a.getTurno() + "', "; + sql += "funcao = '" + a.getFuncao() + "', "; + sql += "trabalhador_id = " + a.getTrabalhador_id() + ", "; + sql += "numero_mecanografico = '" + a.getNumero_mecanografico() + "', "; + sql += "nome_superior_hierarquico = '" + a.getNome_superior_hierarquico() + "', "; + sql += "email_superior_hierarquico = '" + a.getEmail_superior_hierarquico() + "', "; + sql += "estabelecimento_origem = '" + a.getEstabelecimento_origem() + "', "; + if(a.getData_email_superior_hierarquico() == null) + { + sql += "data_email_superior_hierarquico = " + null + " "; + } + else + { + sql += "data_email_superior_hierarquico = '" + a.getData_email_superior_hierarquico() + "' "; + } + //sql += "analise_acidente_id = '" + a.getAnalise_acidente_id() + " "; + sql += "WHERE id = " + a.getId(); + System.out.println("SQL UPDATE ACIDENTADO : " + sql); + st.execute(sql); + } + + public Integer getMaxControleId() + { + Statement st = createStatement(); + String sql = "SELECT max(controle.id)+1 AS MAXCONTROLEID FROM controle"; + try + { + ResultSet rs = st.executeQuery(sql); + rs.first(); + Integer newId = new Integer(rs.getInt("MAXCONTROLEID")); + if(newId.intValue() == 0 ) + { + newId = new Integer(1); + } + return newId; + } + catch(Exception ex) + { + return new Integer(1); + } + } + + 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")); + if(newId.intValue() == 0 ) + { + newId = new Integer(1); + } + return newId; + } + catch(Exception ex) + { + return new Integer(1); + } + } + + + public AnaliseAcidente createAnalise(AnaliseAcidente a) throws Exception + { + //Controle c = getControle(); + Statement st = createStatement(); + Integer newId = getMaxAnaliseId(); + + //calc analise_nr + java.util.Date data_acidente = new java.util.Date(a.getData_acidente().getTime()); + //java.util.Date now = new java.util.Date(); + Calendar cal = new GregorianCalendar(); + //cal.setTime(now); + cal.setTime(data_acidente); + int ano = cal.get(Calendar.YEAR); + Controle c = getControloByAno(new Integer(ano)); + if(c == null) + { + c = createAnoNumeracao(new Integer(ano)); + } +// if(c.getAnalise_year().intValue() != ano) +// { +// c.setAnalise_year(new Integer(ano)); +// c.setLast_analise_nr(new Integer(0)); +// } + //String seq_str = new Integer(10000 + newId.intValue()).toString(); + int i_analise_nr = c.getLast_analise_nr().intValue() + 1; + c.setLast_analise_nr(new Integer(i_analise_nr)); + //updateControle(c); + String seq_str = new Integer(10000 + i_analise_nr).toString(); + String ano_str = new Integer(ano).toString(); + String analise_nr = ano_str.substring(2) + "/" + seq_str.substring(1); + a.setAnalise_nr(analise_nr); + a.setId(newId); + + String sql = "INSERT INTO analises_acidentes (id, averiguador, data_acidente, acidentado_id, estado, empresa_id, estabelecimento_id, horas_turno, departamento_id, seccao_id, local_trabalho, tarefa, substancias, condicoes, testemunhas, causas, descricao, conclusoes, accoes, hora_acidente, medico_id, tecnico_saude_id, averiguacao_posterior, averiguacao_obs, data_inicio_processo, analise_nr, coef_incapacidade) VALUES ("; + sql += newId + ", '"; + sql += a.getAveriguador() + "', '"; + sql += a.getData_acidente() + "', "; + sql += a.getAcidentado_id() + ", "; + sql += a.getEstado() + ", "; + sql += a.getEmpresa_id() + ", "; + sql += a.getEstabelecimento_id() + ", "; + sql += a.getHoras_turno() + ", "; + sql += a.getDepartamento_id() + ", "; + sql += a.getSeccao_id() + ", '"; + 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() + "', "; + if(a.getHora_acidente() == null) + { + sql += null + ", "; + } + else + { + sql += "'" + a.getHora_acidente() + "', "; + } + + sql += a.getMedico_id() + ", "; + sql += a.getTecnico_saude_id() + ", '"; + sql += a.getAveriguacao_posterior() + "', '"; + sql += a.getAveriguacao_obs() + "', "; + if(a.getData_inicio_processo() == null) + { + sql += null + ", "; + } + else + { + sql += "'" + a.getData_inicio_processo() + "', '"; + } + + sql += analise_nr + "', "; + sql += null + ")"; +// sql += a.getFormacao_shst() + "', '"; +// sql += a.getFormacao_shst_nao_porque() + "', '"; +// sql += a.getOutros_acidentes_com_colaborador() + "', "; +// sql += a.getNr_acidentes_com_colaborador() + ", "; +// sql += a.getNr_relatorio_acidente_colaborador1() + ", "; +// sql += a.getNr_relatorio_acidente_colaborador2() + ", "; +// sql += a.getNr_relatorio_acidente_colaborador3() + ", "; +// sql += a.getNr_relatorio_acidente_colaborador4() + ", '"; +// sql += a.getAcidentes_outros_colaboradores()+ "', "; +// sql += a.getNr_acidentes_outros_colaboradores()+ ", "; +// sql += a.getNr_relatorio_acidente_outros_colaboradores1() + ", "; +// sql += a.getNr_relatorio_acidente_outros_colaboradores2() + ", "; +// sql += a.getNr_relatorio_acidente_outros_colaboradores3() + ", "; +// sql += a.getNr_relatorio_acidente_outros_colaboradores4() + ")"; + System.out.println("SQL : " + sql); + st.execute(sql); + updateControle(c); + return a; + } + + public void updateAnalise(AnaliseAcidente a) throws Exception + { + if(a.getEspecif1().matches("null")) + { + a.setEspecif1(""); + } + if(a.getEspecif2().matches("null")) + { + a.setEspecif2(""); + } + if(a.getEspecif3().matches("null")) + { + a.setEspecif3(""); + } + if(a.getEspecif4().matches("null")) + { + a.setEspecif4(""); + } + if(a.getRestricao_outras().matches("null")) + { + a.setRestricao_outras(""); + } + if(a.getTipo_lesao().matches("null")) + { + a.setTipo_lesao(""); + } + if(a.getMed_observ().matches("null")) + { + a.setMed_observ(""); + } + if(a.getFormacao_shst_nao_porque().matches("null")) + { + a.setFormacao_shst_nao_porque(""); + } + Statement st = createStatement(); + String sql = "UPDATE analises_acidentes SET data_acidente = '" + a.getData_acidente() + "', "; + sql += "acidentado_id = " + a.getAcidentado_id() + ", "; + sql += "estado = " + a.getEstado() + ", "; + sql += "empresa_id = " + a.getEmpresa_id() + ", "; + sql += "estabelecimento_id = " + a.getEstabelecimento_id() + ", "; + sql += "horas_turno = " + a.getHoras_turno() + ", "; + sql += "departamento_id = " + a.getDepartamento_id() + ", "; + sql += "seccao_id = " + a.getSeccao_id() + ", "; + 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 += "averiguador = '" + a.getAveriguador() + "', "; + if(a.getHora_acidente() == null) + { + sql += "hora_acidente = " + null + ", "; + } + else + { + sql += "hora_acidente = '" + a.getHora_acidente() + "', "; + } + + sql += "formacao_shst = '" + a.getFormacao_shst() + "', "; + sql += "formacao_shst_nao_porque = '" + a.getFormacao_shst_nao_porque() + "', "; + sql += "outros_acidentes_com_colaborador = '" + a.getOutros_acidentes_com_colaborador() + "', "; + sql += "nr_acidentes_com_colaborador = " + a.getNr_acidentes_com_colaborador() + ", "; + sql += "nr_relatorio_acidente_colaborador1 = " + a.getNr_relatorio_acidente_colaborador1() + ", "; + sql += "nr_relatorio_acidente_colaborador2 = " + a.getNr_relatorio_acidente_colaborador2() + ", "; + sql += "nr_relatorio_acidente_colaborador3 = " + a.getNr_relatorio_acidente_colaborador3() + ", "; + sql += "nr_relatorio_acidente_colaborador4 = " + a.getNr_relatorio_acidente_colaborador4() + ", "; + sql += "acidentes_outros_colaboradores = '" + a.getAcidentes_outros_colaboradores() + "', "; + sql += "nr_acidentes_outros_colaboradores = " + a.getNr_acidentes_outros_colaboradores() + ", "; + sql += "nr_relatorio_acidente_outros_colaboradores1 = " + a.getNr_relatorio_acidente_outros_colaboradores1() + ", "; + sql += "nr_relatorio_acidente_outros_colaboradores2 = " + a.getNr_relatorio_acidente_outros_colaboradores2() + ", "; + sql += "nr_relatorio_acidente_outros_colaboradores3 = " + a.getNr_relatorio_acidente_outros_colaboradores3() + ", "; + sql += "nr_relatorio_acidente_outros_colaboradores4 = " + a.getNr_relatorio_acidente_outros_colaboradores4() + ", "; + sql += "lesao_cabeca = '" + a.getLesao_cabeca() + "', "; + sql += "lesao_pescoco = '" + a.getLesao_pescoco() + "', "; + sql += "lesao_tronco = '" + a.getLesao_tronco() + "', "; + sql += "lesao_membro_sup_dir = '" + a.getLesao_membro_sup_dir() + "', "; + sql += "lesao_membro_sup_esq = '" + a.getLesao_membro_sup_esq() + "', "; + sql += "lesao_membro_inf_dir = '" + a.getLesao_membro_inf_dir() + "', "; + sql += "lesao_membro_inf_esq = '" + a.getLesao_membro_inf_esq() + "', "; + sql += "especif1 = '" + a.getEspecif1() + "', "; + sql += "especif2 = '" + a.getEspecif2() + "', "; + sql += "especif3 = '" + a.getEspecif3() + "', "; + sql += "especif4 = '" + a.getEspecif4() + "', "; + sql += "tipo_lesao = '" + a.getTipo_lesao() + "', "; + sql += "tipo_incapacidade = '" + a.getTipo_incapacidade() + "', "; + sql += "coef_incapacidade = " + a.getCoef_incapacidade() + ", "; + if(a.getData_aval_incapacidade() == null) + { + sql += "data_aval_incapacidade = " + null + ", "; + } + else + { + sql += "data_aval_incapacidade = '" + a.getData_aval_incapacidade() + "', "; + } + if(a.getData_rev_incapacidade() == null) + { + sql += "data_rev_incapacidade = " + null + ", "; + } + else + { + sql += "data_rev_incapacidade = '" + a.getData_rev_incapacidade() + "', "; + } + if(a.getPeriodo_incapacidade_de() == null) + { + sql += "periodo_incapacidade_de = " + null + ", "; + } + else + { + sql += "periodo_incapacidade_de = '" + a.getPeriodo_incapacidade_de() + "', "; + } + if(a.getPeriodo_incapacidade_a() == null) + { + sql += "periodo_incapacidade_a = " + null + ", "; + } + else + { + sql += "periodo_incapacidade_a = '" + a.getPeriodo_incapacidade_a() + "', "; + } + sql += "img_flexao = '" + a.getImg_flexao() + "', "; + sql += "img_ext1 = '" + a.getImg_ext1() + "', "; + sql += "img_ext2 = '" + a.getImg_ext2() + "', "; + sql += "img_cab2 = '" + a.getImg_cab2() + "', "; + sql += "img_cab3 = '" + a.getImg_cab3() + "', "; + sql += "img_ma2 = '" + a.getImg_ma2() + "', "; + sql += "img_ma3 = '" + a.getImg_ma3() + "', "; + sql += "img_ma5 = '" + a.getImg_ma5() + "', "; + sql += "img_ma6 = '" + a.getImg_ma6() + "', "; + sql += "img_ma8 = '" + a.getImg_ma8() + "', "; + sql += "img_ma10 = '" + a.getImg_ma10() + "', "; + sql += "img_rot1 = '" + a.getImg_rot1() + "', "; + sql += "img_rot2 = '" + a.getImg_rot2() + "', "; + sql += "img_cab1 = '" + a.getImg_cab1() + "', "; + sql += "img_cab4 = '" + a.getImg_cab4() + "', "; + sql += "img_ma1 = '" + a.getImg_ma1() + "', "; + sql += "img_ma4 = '" + a.getImg_ma4() + "', "; + sql += "img_ma7 = '" + a.getImg_ma7() + "', "; + sql += "img_ma9 = '" + a.getImg_ma9() + "', "; + sql += "restricao_carga = " + a.getRestricao_carga() + ", "; + sql += "restricao_motricidade = '" + a.getRestricao_motricidade() + "', "; + sql += "restricao_conducao = '" + a.getRestricao_conducao() + "', "; + sql += "restricao_vibracoes = '" + a.getRestricao_vibracoes() + "', "; + sql += "restricao_outras = '" + a.getRestricao_outras() + "', "; + sql += "med_observ = '" + a.getMed_observ() + "', "; + sql += "estado_assinatura = " + a.getEstado_assinatura() + ", "; + sql += "tecnico_saude_id = " + a.getTecnico_saude_id() + ", "; + sql += "medico_id = " + a.getMedico_id() + ", "; + sql += "ass_consolidacao = '" + a.getAss_consolidacao() + "', "; + sql += "ass_resp_seg = '" + a.getAss_resp_seg() + "', "; + sql += "ass_resp_rh = '" + a.getAss_resp_rh() + "', "; + if(a.getData_consolidacao() == null) + { + sql += "data_consolidacao = " + null + ", "; + } + else + { + sql += "data_consolidacao = '" + a.getData_consolidacao() + "', "; + } + if(a.getData_assinatura_seg() == null) + { + sql += "data_assinatura_seg = " + null + ", "; + } + else + { + sql += "data_assinatura_seg = '" + a.getData_consolidacao() + "', "; + } + if(a.getData_assinatura_rh() == null) + { + sql += "data_assinatura_rh = " + null + ", "; + } + else + { + sql += "data_assinatura_rh = '" + a.getData_consolidacao() + "', "; + } + sql += "nome_resp_seg = '" + a.getNome_resp_seg() + "', "; + sql += "nome_resp_rh = '" + a.getNome_resp_rh() + "', "; + sql += "correcao = '" + a.getCorrecao() + "', "; + sql += "observacoes_correcao = '" + a.getObservacoes_correcao() + "', "; + sql += "estado_antes_correcao = " + a.getEstado_antes_correcao() + ", "; + sql += "ass_superior = '" + a.getAss_superior() + "', "; + sql += "nome_superior = '" + a.getNome_superior() + "', "; + sql += "averiguacao_posterior = '" + a.getAveriguacao_posterior() + "', "; + sql += "averiguacao_obs = '" + a.getAveriguacao_obs() + "', "; + sql += "nome_resp_consolidacao = '" + a.getNome_resp_consolidacao() + "', "; + if(a.getData_assinatura_superior() == null) + { + sql += "data_assinatura_superior = " + null + ", "; + } + else + { + sql += "data_assinatura_superior = '" + a.getData_assinatura_superior() + "', "; + } + sql += "rh_fase4 = " + a.getRh_fase4() + " "; + sql += "WHERE id = " + a.getId(); + System.out.println("SQL UPDATE : " + sql); + st.execute(sql); + } + + public void changeEstado(Correcao c) throws Exception + { + Statement st = createStatement(); + String sql = "UPDATE analises_acidentes SET correcao = '" + c.getCorrecao() + "', estado = " + c.getEstado_corr() + ", estado_antes_correcao = " + c.getEstado_actual() + ", observacoes_correcao = '" + c.getObservacoes() + "' WHERE id = " + c.getAnalise_id(); + st.execute(sql); + } + + public Integer getMaxRecomendacaoId() + { + Statement st = createStatement(); + String sql = "SELECT max(recomendacoes.id)+1 AS MAXRECOMENDACAOID FROM recomendacoes"; + try + { + ResultSet rs = st.executeQuery(sql); + rs.first(); + Integer newId = new Integer(rs.getInt("MAXRECOMENDACAOID")); + if(newId.intValue() == 0) + { + newId = new Integer(1); + } + return newId; + } + catch(Exception ex) + { + return new Integer(1); + } + } + + public Integer createRecomendacao(Recomendacao r) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxRecomendacaoId(); + String sql = "INSERT INTO recomendacoes (id, analise_id, recomendacao) VALUES ("; + sql += newId + ", "; + sql += r.getAnalise_id() + ", '"; + sql += r.getRecomendacao() + "')"; + st.execute(sql); + + return newId; + } + + public void updateRecomendacao(Recomendacao r) throws Exception + { + Statement st = createStatement(); + String sql = "UPDATE recomendacoes SET analise_id = " + r.getAnalise_id() + ", "; + sql += "recomendacao = '" + r.getRecomendacao() + "' "; + sql += "WHERE id = " + r.getId(); + //System.out.println("SQL : " + sql); + st.execute(sql); + } + + public void deleteRecomendacoesByAnalise(Integer analise_id) throws Exception + { + System.out.println("DELETE RECOMENDACOES"); + Statement st = createStatement(); + String sql = "DELETE FROM recomendacoes WHERE analise_id = " + analise_id; + st.execute(sql); + } + + public void deleteAnaliseAcidente(Integer analise_id) throws Exception + { + Statement st = createStatement(); + //String sql = "DELETE FROM analises_acidentes WHERE id = " + analise_id; + String sql = "UPDATE analises_acidentes SET apagada = 'y' WHERE id = " + analise_id; + st.execute(sql); + } + + public void deleteAcidentado(Integer acidentado_id) throws Exception + { + Statement st = createStatement(); + String sql = "DELETE FROM acidentados WHERE id = " + acidentado_id; + st.execute(sql); + } + + public ArrayList getRecomendacoesByAnalise(Integer analiseId) throws Exception + { + ArrayList list = new ArrayList(); + Statement st = createStatement(); + String sql = "SELECT * FROM recomendacoes WHERE analise_id = " + analiseId; + //System.out.println("SQL : " + sql); + ResultSet rs = st.executeQuery(sql); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + Recomendacao r = new Recomendacao(); + r.setId(new Integer(rs.getInt("id"))); + r.setAnalise_id(new Integer(rs.getInt("analise_id"))); + r.setRecomendacao(rs.getString("recomendacao")); + list.add(r); + }while(rs.next()); + } + + return list; + } + + public Integer getMaxMedidaId() + { + Statement st = createStatement(); + String sql = "SELECT max(medidas.id)+1 AS MAXMEDIDAID FROM medidas"; + try + { + ResultSet rs = st.executeQuery(sql); + rs.first(); + Integer newId = new Integer(rs.getInt("MAXMEDIDAID")); + if(newId.intValue() == 0) + { + newId = new Integer(1); + } + return newId; + } + catch(Exception ex) + { + return new Integer(1); + } + } + + public Integer createMedida(Medida m) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxMedidaId(); + String sql = "INSERT INTO medidas (id, analise_id, medida) VALUES ("; + sql += newId + ", "; + sql += m.getAnalise_id() + ", '"; + sql += m.getMedida() + "')"; + st.execute(sql); + + return newId; + } + + + + public void updateMedida(Medida m) throws Exception + { + Statement st = createStatement(); + String sql = "UPDATE medidas SET analise_id = " + m.getAnalise_id() + ", "; + sql += "medida = '" + m.getMedida() + "' "; + sql += "WHERE id = " + m.getId(); + //System.out.println("SQL : " + sql); + st.execute(sql); + } + + public void deleteMedidasByAnalise(Integer analise_id) throws Exception + { + Statement st = createStatement(); + String sql = "DELETE FROM medidas WHERE analise_id = " + analise_id; + st.execute(sql); + } + + public ArrayList getMedidasByAnalise(Integer analiseId) throws Exception + { + ArrayList list = new ArrayList(); + Statement st = createStatement(); + String sql = "SELECT * FROM medidas WHERE analise_id = " + analiseId; + //System.out.println("SQL : " + sql); + ResultSet rs = st.executeQuery(sql); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + Medida m = new Medida(); + m.setId(new Integer(rs.getInt("id"))); + m.setAnalise_id(new Integer(rs.getInt("analise_id"))); + m.setMedida(rs.getString("medida")); + list.add(m); + }while(rs.next()); + } + + return list; + } + + + + public String getNumeroCedula(Integer medico_id) throws Exception + { + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement stlocal = dblocal.createStatement(); + String sql ="SELECT numero_cedula FROM medicos WHERE id = " + medico_id; + ResultSet rslocal = stlocal.executeQuery(sql); + rslocal.first(); + String numero_cedula = rslocal.getString("numero_cedula"); + dblocal.close(); + return numero_cedula; + } + + public String getTipoDescricao(Integer tipo) throws Exception + { + Statement st = createStatement(); + String sql = "SELECT descricao FROM tipos_utilizadores WHERE tipo = " + tipo; + ResultSet rs = st.executeQuery(sql); + rs.first(); + String descricao = rs.getString("descricao"); + return descricao; + } + + public com.sun.rave.web.ui.model.Option[] getTiposList() throws Exception + { + ArrayList list = new ArrayList(); + TipoUtilizador t = new TipoUtilizador(); + t.setId(new Integer(0)); + t.setTipo(new Integer(0)); + t.setDescricao(""); + list.add(t); + Statement st = createStatement(); + String sql ="SELECT * FROM tipos_utilizadores WHERE activo = 'y' ORDER BY ordem"; + ResultSet rs = st.executeQuery(sql); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + t = new TipoUtilizador(); + t.setId(new Integer(rs.getInt("id"))); + t.setTipo(new Integer(rs.getInt("tipo"))); + t.setDescricao(rs.getString("descricao")); + //t.setActivo(rs.getString("activo")); + //t.setOrdem(new Integer(rs.getInt("ordem"))); + list.add(t); + }while(rs.next()); + } + + com.sun.rave.web.ui.model.Option[] listOptions = new com.sun.rave.web.ui.model.Option[list.size()]; + ListIterator iter = list.listIterator(); + int i = 0; + while(iter.hasNext()) + { + t = (TipoUtilizador) iter.next(); + + listOptions[i] = new Option(t.getTipo(), t.getDescricao()); + i++; + } + return listOptions; + } + + public com.sun.rave.web.ui.model.Option[] getTiposList(Integer permissao) throws Exception + { + ArrayList list = new ArrayList(); + TipoUtilizador t = new TipoUtilizador(); + t.setId(new Integer(0)); + t.setTipo(new Integer(0)); + t.setDescricao(""); + list.add(t); + Statement st = createStatement(); + String sql ="SELECT * FROM tipos_utilizadores WHERE activo = 'y' ORDER BY ordem"; + ResultSet rs = st.executeQuery(sql); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + t = new TipoUtilizador(); + if(permissao.intValue() == 7) //director rh + { + t.setTipo(new Integer(rs.getInt("tipo"))); + if(t.getTipo().intValue() == 1 || t.getTipo().intValue() == 2 || t.getTipo().intValue() == 6) // seguranca || rh || gestor + { + t.setId(new Integer(rs.getInt("id"))); + t.setDescricao(rs.getString("descricao")); + //t.setActivo(rs.getString("activo")); + //t.setOrdem(new Integer(rs.getInt("ordem"))); + list.add(t); + } + } + else + { + t.setId(new Integer(rs.getInt("id"))); + t.setTipo(new Integer(rs.getInt("tipo"))); + t.setDescricao(rs.getString("descricao")); + //t.setActivo(rs.getString("activo")); + //t.setOrdem(new Integer(rs.getInt("ordem"))); + list.add(t); + } + + }while(rs.next()); + } + + com.sun.rave.web.ui.model.Option[] listOptions = new com.sun.rave.web.ui.model.Option[list.size()]; + ListIterator iter = list.listIterator(); + int i = 0; + while(iter.hasNext()) + { + t = (TipoUtilizador) iter.next(); + + listOptions[i] = new Option(t.getTipo(), t.getDescricao()); + i++; + } + return listOptions; + } + + public com.sun.rave.web.ui.model.Option[] getEstabelecimentosList(Integer empresa_id, Boolean booGestor) throws Exception + { + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement stlocal = dblocal.createStatement(); + ArrayList list = new ArrayList(); + Estabelecimento e = new Estabelecimento(); + e.setId(new Integer(-1)); + + e.setNome("-Seleccionar-"); + + list.add(e); + if(booGestor.equals(new Boolean(true))) + { + e = new Estabelecimento(); + e.setId(new Integer(0)); + e.setNome("-Todos os estabelecimentos-"); + + list.add(e); + } + String sql ="SELECT * FROM estabelecimentos WHERE empresa_id = " + empresa_id + " AND inactivo = 'n' ORDER BY nome_plain"; + + ResultSet rslocal = stlocal.executeQuery(sql); + if(rslocal.isBeforeFirst()) + { + rslocal.first(); + do + { + e = new Estabelecimento(); + e.setId(new Integer(rslocal.getInt("id"))); + //e.setNome_plain(rslocal.getString("nome_plain")); + e.setNome(rslocal.getString("nome")); + System.out.println("ESTABELECIMENTOAA : " + e.getId().toString() + " - " + e.getNome()); + //t.setActivo(rs.getString("activo")); + //t.setOrdem(new Integer(rs.getInt("ordem"))); + list.add(e); + }while(rslocal.next()); + } + + com.sun.rave.web.ui.model.Option[] listOptions = new com.sun.rave.web.ui.model.Option[list.size()]; + ListIterator iter = list.listIterator(); + int i = 0; + while(iter.hasNext()) + { + e = (Estabelecimento) iter.next(); + System.out.println("ESTABELECIMENTOL : " + e.getId().toString() + " - " + e.getNome()); + listOptions[i] = new Option(e.getId(), Utils.unicodeToHTML(e.getNome())); + i++; + } + dblocal.close(); + return listOptions; + } + + public com.sun.rave.web.ui.model.Option[] getEstabelecimentosGestorList(Integer empresa_id, Boolean booGestor) throws Exception + { + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement stlocal = dblocal.createStatement(); + ArrayList list = new ArrayList(); + Estabelecimento e = null; + //Estabelecimento e = new Estabelecimento(); + //e.setId(new Integer(-1)); + + //e.setNome("-Seleccionar-"); + + //list.add(e); + if(booGestor.equals(new Boolean(true))) + { + e = new Estabelecimento(); + e.setId(new Integer(0)); + e.setNome("-Todos os estabelecimentos-"); + + list.add(e); + } + String sql ="SELECT * FROM estabelecimentos WHERE empresa_id = " + empresa_id + " AND inactivo = 'n' ORDER BY nome_plain"; + + ResultSet rslocal = stlocal.executeQuery(sql); + if(rslocal.isBeforeFirst()) + { + rslocal.first(); + do + { + e = new Estabelecimento(); + e.setId(new Integer(rslocal.getInt("id"))); + //e.setNome_plain(rslocal.getString("nome_plain")); + e.setNome(rslocal.getString("nome")); + System.out.println("ESTABELECIMENTOAA : " + e.getId().toString() + " - " + e.getNome()); + //t.setActivo(rs.getString("activo")); + //t.setOrdem(new Integer(rs.getInt("ordem"))); + list.add(e); + }while(rslocal.next()); + } + + com.sun.rave.web.ui.model.Option[] listOptions = new com.sun.rave.web.ui.model.Option[list.size()]; + ListIterator iter = list.listIterator(); + int i = 0; + while(iter.hasNext()) + { + e = (Estabelecimento) iter.next(); + System.out.println("ESTABELECIMENTOL : " + e.getId().toString() + " - " + e.getNome()); + listOptions[i] = new Option(e.getId(), Utils.unicodeToHTML(e.getNome())); + i++; + } + dblocal.close(); + return listOptions; + } + + public com.sun.rave.web.ui.model.Option[] getMedicosList() throws Exception + { + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement stlocal = dblocal.createStatement(); + ArrayList list = new ArrayList(); + Medico m = new Medico(); + m.setId(new Integer(0)); + m.setNome("-Seleccionar-"); + list.add(m); + String sql ="SELECT * FROM medicos WHERE inactivo = 'n'"; + ResultSet rslocal = stlocal.executeQuery(sql); + if(rslocal.isBeforeFirst()) + { + rslocal.first(); + do + { + m = new Medico(); + m.setId(new Integer(rslocal.getInt("id"))); + m.setNome(rslocal.getString("nome")); + list.add(m); + }while(rslocal.next()); + } + + com.sun.rave.web.ui.model.Option[] listOptions = new com.sun.rave.web.ui.model.Option[list.size()]; + ListIterator iter = list.listIterator(); + int i = 0; + while(iter.hasNext()) + { + m = (Medico) iter.next(); + + listOptions[i] = new Option(m.getId(), Utils.unicodeToHTML(m.getNome())); + i++; + } + dblocal.close(); + return listOptions; + } + + public com.sun.rave.web.ui.model.Option[] getTecnicosSaudeList() throws Exception + { + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement stlocal = dblocal.createStatement(); + ArrayList list = new ArrayList(); + TecnicoSaude t = new TecnicoSaude(); + t.setId(new Integer(0)); + t.setNome("-Seleccionar-"); + list.add(t); + String sql ="SELECT * FROM marcacoes_tecnicos_hst WHERE inactivo = 'n'"; + ResultSet rslocal = stlocal.executeQuery(sql); + if(rslocal.isBeforeFirst()) + { + rslocal.first(); + do + { + t = new TecnicoSaude(); + t.setId(new Integer(rslocal.getInt("id"))); + t.setNome(rslocal.getString("nome")); + list.add(t); + }while(rslocal.next()); + } + + com.sun.rave.web.ui.model.Option[] listOptions = new com.sun.rave.web.ui.model.Option[list.size()]; + ListIterator iter = list.listIterator(); + int i = 0; + while(iter.hasNext()) + { + t = (TecnicoSaude) iter.next(); + + listOptions[i] = new Option(t.getId(), Utils.unicodeToHTML(t.getNome())); + i++; + } + dblocal.close(); + return listOptions; + } + + public com.sun.rave.web.ui.model.Option[] getCausasList() throws Exception + { + ArrayList list = new ArrayList(); + Causa c = new Causa(); + c.setId(new Integer(0)); + c.setCausa("-Seleccionar-"); + list.add(c); + Statement st = createStatement(); + String sql = "SELECT * FROM causas WHERE activa = 'y'"; + ResultSet rs = st.executeQuery(sql); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + c = new Causa(); + c.setId( new Integer(rs.getInt("id")) ); + c.setCausa(rs.getString("causa")); + list.add(c); + }while(rs.next()); + } + + com.sun.rave.web.ui.model.Option[] listOptions = new com.sun.rave.web.ui.model.Option[list.size()]; + ListIterator iter = list.listIterator(); + int i = 0; + while(iter.hasNext()) + { + c = (Causa) iter.next(); + + listOptions[i] = new Option(c.getId(), c.getCausa()); + i++; + } + return listOptions; + } + + public com.sun.rave.web.ui.model.Option[] getDepartamentosList() throws Exception + { + ArrayList list = new ArrayList(); + Departamento d = new Departamento(); + + d.setId(new Integer(0)); + d.setDescricao("-Todos-"); + list.add(d); + Statement st = createStatement(); + String sql = "SELECT * FROM departamentos WHERE activo = 'y'"; + ResultSet rs = st.executeQuery(sql); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + d = new Departamento(); + d.setId( new Integer(rs.getInt("id")) ); + d.setDescricao(rs.getString("descricao")); + list.add(d); + }while(rs.next()); + } + + com.sun.rave.web.ui.model.Option[] listOptions = new com.sun.rave.web.ui.model.Option[list.size()]; + ListIterator iter = list.listIterator(); + int i = 0; + while(iter.hasNext()) + { + d = (Departamento) iter.next(); + + listOptions[i] = new Option(d.getId(), d.getDescricao()); + i++; + } + return listOptions; + } + + public com.sun.rave.web.ui.model.Option[] getSeccoesList(Integer departamento_id) throws Exception + { + ArrayList list = new ArrayList(); + Seccao s = new Seccao(); + + s.setId(new Integer(0)); + s.setDescricao("-Seleccionar-"); + list.add(s); + Statement st = createStatement(); + String sql = ""; + if(departamento_id == null) // todos + { + sql = "SELECT * FROM seccoes WHERE activo = 'y'"; + } + else + { + sql = "SELECT * FROM seccoes WHERE activo = 'y' AND departamento_id = " + departamento_id; + } + + ResultSet rs = st.executeQuery(sql); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + s = new Seccao(); + s.setId( new Integer(rs.getInt("id")) ); + s.setDescricao(rs.getString("descricao")); + s.setDepartamento_id( new Integer(rs.getInt("departamento_id")) ); + list.add(s); + }while(rs.next()); + } + + com.sun.rave.web.ui.model.Option[] listOptions = new com.sun.rave.web.ui.model.Option[list.size()]; + ListIterator iter = list.listIterator(); + int i = 0; + while(iter.hasNext()) + { + s = (Seccao) iter.next(); + + listOptions[i] = new Option(s.getId(), s.getDescricao()); + i++; + } + return listOptions; + } + + + + public Causa getCausa(Integer id) throws Exception + { + Statement st = createStatement(); + String sql = null; + + sql ="SELECT * FROM causas WHERE id = " + id; + + ResultSet rs = st.executeQuery(sql); + rs.first(); + Causa c = new Causa(); + c.setId( new Integer(rs.getInt("id")) ); + c.setCausa(rs.getString("causa")); + return c; + } + + public Seccao getSeccao(Integer id) throws Exception + { + Statement st = createStatement(); + String sql = null; + + sql ="SELECT * FROM seccoes WHERE id = " + id + " AND activo = 'y'"; + + ResultSet rs = st.executeQuery(sql); + rs.first(); + Seccao s = new Seccao(); + s.setId( new Integer(rs.getInt("id")) ); + s.setDescricao(rs.getString("descricao")); + return s; + } + + public ArrayList getAnosListFromAnalises() throws Exception + { + ArrayList list = new ArrayList(); + Statement st = createStatement(); + String sql = null; + + sql ="select distinct extract(year from data_acidente) as ano from analises_acidentes where estado = " + Global.ESTADO_CONCLUIDO + " order by ano"; + + ResultSet rs = st.executeQuery(sql); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + Double dAno = new Double(rs.getDouble("ano")); + Integer iAno = new Integer(dAno.intValue()); + list.add(iAno); + }while(rs.next()); + } + + return list; + } + + + + private String getFase(int estado) + { + if(estado == Global.ESTADO_SEG) + { + return "FASE 1 - SEG - ABERTURA"; + } + else if(estado == Global.ESTADO_RH1) + { + return "FASE 2 - RH - ACOMPANHAMENTO"; + } + else if(estado == Global.ESTADO_HS) + { + return "FASE 3 - SIPRP - RECOMENDAÇÕES"; + } + else if(estado == Global.ESTADO_RH2) + { + return "FASE 4 - RH - MEDIDAS + LESÃO"; + } +// else if(estado == Global.ESTADO_MEDICINA) +// { +// return "Medicina"; +// } + else if(estado == Global.ESTADO_CONSOLIDACAO) + { + return "FASE 5 - SIPRP - CONSOLIDAÇÃO"; + } +// else if(estado == Global.ESTADO_ASSINATURAS) +// { +// return "Verificação"; +// } +// else if(estado == Global.ESTADO_IMPRESSAO) +// { +// return "Impressão"; +// } + else if(estado == Global.ESTADO_ASSINATURA_SEG) + { + return "FASE 6 - SEG - VERIFICAÇÃO SEG."; + } + else if(estado == Global.ESTADO_ASSINATURA_RH) + { + return "FASE 7 - RH - VERIFICAÇÃO RH"; + } + else if(estado == Global.ESTADO_FECHAR) + { + return "FASE 8 - SIPRP - CONCLUSÃO"; + } + return null; + } + + public HashMap getMetaData(String table) throws Exception + { + Statement st = createStatement(); + String sql = "select * from " + table; + + ResultSet rs = st.executeQuery(sql); + ResultSetMetaData rsmd = rs.getMetaData(); + + HashMap hash = new HashMap(); + int cols = rsmd.getColumnCount(); + + for(int i=0; i < cols; i++) + { + String field = rsmd.getColumnName(i + 1); + int len = rsmd.getPrecision(i+1); + hash.put(field, new Integer(len)); + } + return hash; + } + + public byte[] getLogoByEmpresa(Integer empresaId) throws Exception + { + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement st = dblocal.createStatement(); + String sql = "select empresa_logo_id from empresas where id = " + empresaId; + ResultSet rslocal = st.executeQuery(sql); + if(rslocal.isBeforeFirst()) + { + rslocal.first(); + Integer logoId = new Integer(rslocal.getInt("empresa_logo_id")); + byte[] logo = getLogo(logoId); + return logo; + } + + return null; + } + + public byte[] getLogo(Integer logoId) throws Exception + { + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement st = dblocal.createStatement(); + String sql = "select image_data from image where id = " + logoId; + ResultSet rslocal = st.executeQuery(sql); + rslocal.first(); + byte[] logo = rslocal.getBytes("image_data"); + System.out.println("LOGO SIZE : " + logo.length); + return logo; + } + + private Statement createStatement() + { + Db db = new Db(); + return db.createStatement(); + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/AnalisesSeguimentoDataProvider.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/AnalisesSeguimentoDataProvider.java new file mode 100644 index 00000000..a5f9052a --- /dev/null +++ b/branches/SIPRP/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/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/Db.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/Db.java new file mode 100644 index 00000000..167a1ca0 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/Db.java @@ -0,0 +1,60 @@ +/* + * 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_20100629"; //testes + String connectionURL = "jdbc:postgresql://localhost:5436/siprp"; //real + + 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/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/Dblocal.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/Dblocal.java new file mode 100644 index 00000000..a1813572 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/Dblocal.java @@ -0,0 +1,66 @@ +/* + * 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_3"; //testes + String connectionURL = "jdbc:postgresql://localhost:5436/siprp_local_3"; + 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/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/EstadosCorrecaoDataProvider.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/EstadosCorrecaoDataProvider.java new file mode 100644 index 00000000..4a1ac627 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/EstadosCorrecaoDataProvider.java @@ -0,0 +1,24 @@ +/* + * EstadosCorrecaoDataProvider.java + * + * Created on November 29, 2007, 9:50 AM + * + * 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 EstadosCorrecaoDataProvider extends ObjectListDataProvider { + + /** Creates a new instance of EstadosCorrecaoDataProvider */ + public EstadosCorrecaoDataProvider() { + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/TrabalhadoresListDataProvider.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/TrabalhadoresListDataProvider.java new file mode 100644 index 00000000..0edc8ae4 --- /dev/null +++ b/branches/SIPRP/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/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/UtilizadoresActivosListDataProvider.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/UtilizadoresActivosListDataProvider.java new file mode 100644 index 00000000..62c8f48a --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/UtilizadoresActivosListDataProvider.java @@ -0,0 +1,24 @@ +/* + * UtilizadoresListDataProvider.java + * + * Created on November 30, 2007, 2:51 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 UtilizadoresActivosListDataProvider extends ObjectListDataProvider { + + /** Creates a new instance of UtilizadoresListDataProvider */ + public UtilizadoresActivosListDataProvider() { + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/UtilizadoresDataProvider.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/UtilizadoresDataProvider.java new file mode 100644 index 00000000..df6ae183 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/UtilizadoresDataProvider.java @@ -0,0 +1,533 @@ +/* + * 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.Medico; +import analiseacidentestrabalho.Permissao; +import analiseacidentestrabalho.TecnicoSaude; +import analiseacidentestrabalho.Utilizador; +import com.sun.rave.web.ui.model.Option; +import global.Global; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.ListIterator; +import java.util.StringTokenizer; +import utils.Utils; + +/** + * + * @author lluis + */ +public class UtilizadoresDataProvider { + + /** Creates a new instance of UtilizadoresDataProvider */ + public UtilizadoresDataProvider() { + } + + public Integer getMaxUserId() + { + Statement st = createStatement(); + String sql = "SELECT max(utilizadores.id)+1 AS MAXUSERID FROM utilizadores"; + try + { + ResultSet rs = st.executeQuery(sql); + rs.first(); + Integer newId = new Integer(rs.getInt("MAXUSERID")); + if(newId.intValue() == 0) + { + newId = new Integer(1); + } + return newId; + } + catch(Exception ex) + { + ex.printStackTrace(); + return new Integer(1); + } + } + + public Integer createNewUtilizador(Utilizador u) throws Exception + { + Statement st = createStatement(); + Integer newUserId = getMaxUserId(); + + String sql = "INSERT INTO utilizadores (id, login, password, data_password, email, empresa_id, estabelecimento_id, administrador, tipo, numero_cedula, cap, nome, medico_id, funcionario_hst_id, activo, responsavel_loja, gestor_geral, numero_mecanografico) VALUES ("; + sql += newUserId + ", '"; + sql += u.getLogin() + "', '"; + sql += u.getPassword() + "', "; + if(u.getData_password() == null) + { + sql += null + ", '"; + } + else + { + sql += "'" + u.getData_password() + "', '"; + } + sql += u.getEmail() + "', "; + sql += u.getEmpresa_id() + ", "; + sql += u.getEstabelecimento_id() + ", '"; + sql += u.getAdministrador() + "', "; + sql += u.getTipo() + ", '"; + sql += u.getNumero_cedula() + "', '"; + sql += u.getCap() + "', '"; + sql += u.getNome() + "', "; + sql += u.getMedico_id() + ", "; + sql += u.getFuncionario_hst_id() + ", '"; + sql += u.getActivo() + "', '"; + sql += u.getResponsavel_loja() + "', '"; + sql += u.getGestor_geral() + "', '"; + sql += u.getNumero_mecanografico() + "')"; + System.out.println("USER SQL : " + sql); + st.execute(sql); + return newUserId; + } + + public void updateUtilizador(Utilizador u) throws Exception + { + Statement st = createStatement(); + String sql = ""; + if(u.getData_password() == null) + { + sql = "UPDATE utilizadores SET login = '" + u.getLogin() + "', password = '" + u.getPassword() + "', data_password = " + null + ", email = '" + u.getEmail() + "', empresa_id = " + u.getEmpresa_id() + ", estabelecimento_id = " + u.getEstabelecimento_id() + ", administrador = '" + u.getAdministrador() + "', tipo = " + u.getTipo() + ", numero_cedula = '" + u.getNumero_cedula() + "', cap = '" + u.getCap() + "', nome = '" + u.getNome() + "', medico_id = " + u.getMedico_id() + ", funcionario_hst_id = " + u.getFuncionario_hst_id() + ", activo = '" + u.getActivo() + "', responsavel_loja = '" + u.getResponsavel_loja() + "', gestor_geral = '" + u.getGestor_geral() + "', primeiro_login = '" + u.getPrimeiro_login() + "' WHERE id = " + u.getId(); + } + else + { + sql = "UPDATE utilizadores SET login = '" + u.getLogin() + "', password = '" + u.getPassword() + "', data_password = '" + u.getData_password() + "', email = '" + u.getEmail() + "', empresa_id = " + u.getEmpresa_id() + ", estabelecimento_id = " + u.getEstabelecimento_id() + ", administrador = '" + u.getAdministrador() + "', tipo = " + u.getTipo() + ", numero_cedula = '" + u.getNumero_cedula() + "', cap = '" + u.getCap() + "', nome = '" + u.getNome() + "', medico_id = " + u.getMedico_id() + ", funcionario_hst_id = " + u.getFuncionario_hst_id() + ", activo = '" + u.getActivo() + "', responsavel_loja = '" + u.getResponsavel_loja() + "', gestor_geral = '" + u.getGestor_geral() + "', primeiro_login = '" + u.getPrimeiro_login() + "' WHERE id = " + u.getId(); + } + + System.out.println("SQL UPDATE USER : " + sql); + st.execute(sql); + } + + public void deleteUser(Integer userId) throws Exception + { + Statement st = createStatement(); + String sql = "UPDATE utilizadores SET apagado = 'y', activo = 'n' WHERE id = " + userId; + st.execute(sql); + } + + public Utilizador getUtilizador(String login) throws Exception + { + Utilizador u = new Utilizador(); + Statement st = createStatement(); + String sql = "SELECT * FROM utilizadores WHERE LOWER(login) = '" + login.toLowerCase() + "' AND apagado = 'n'"; + 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.setData_password(rs.getDate("data_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")); + u.setTipo(new Integer(rs.getInt("tipo"))); + u.setNumero_cedula(rs.getString("numero_cedula")); + u.setCap(rs.getString("cap")); + u.setNome(rs.getString("nome")); + u.setMedico_id(new Integer(rs.getInt("medico_id"))); + u.setFuncionario_hst_id(new Integer(rs.getInt("funcionario_hst_id"))); + u.setActivo(rs.getString("activo")); + u.setResponsavel_loja(rs.getString("responsavel_loja")); + u.setGestor_geral(rs.getString("gestor_geral")); + u.setPrimeiro_login(rs.getString("primeiro_login")); + u.setApagado(rs.getString("apagado")); + return u; + } + + public Utilizador getUtilizador(Integer id) throws Exception + { + Utilizador u = new Utilizador(); + Statement st = createStatement(); + String sql = "SELECT * FROM utilizadores WHERE id = " + id; + 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.setData_password(rs.getDate("data_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")); + u.setTipo(new Integer(rs.getInt("tipo"))); + u.setNumero_cedula(rs.getString("numero_cedula")); + u.setCap(rs.getString("cap")); + u.setNome(rs.getString("nome")); + u.setMedico_id(new Integer(rs.getInt("medico_id"))); + u.setFuncionario_hst_id(new Integer(rs.getInt("funcionario_hst_id"))); + u.setActivo(rs.getString("activo")); + u.setResponsavel_loja(rs.getString("responsavel_loja")); + u.setGestor_geral(rs.getString("gestor_geral")); + u.setApagado(rs.getString("apagado")); + return u; + } + + public ArrayList getUtilizadoresListByTipo(Integer tipo, String responsavel_loja, Integer estabelecimento_id) throws Exception + { + ArrayList list = new ArrayList(); + Statement st = createStatement(); + String sql = ""; + String estabelecimento_constraint = ""; + if(tipo.intValue() == Global.TIPO_UTILIZADOR_RH || tipo.intValue() == Global.TIPO_UTILIZADOR_SEGURANCA) + { + estabelecimento_constraint = " AND estabelecimento_id = " + estabelecimento_id; + } + if(responsavel_loja.matches("y")) + { + sql = "SELECT * FROM utilizadores WHERE activo = 'y' AND apagado = 'n' AND responsavel_loja = 'y' AND tipo = " + tipo + estabelecimento_constraint; + } + else + { + sql = "SELECT * FROM utilizadores WHERE activo = 'y' AND apagado = 'n' AND tipo = " + tipo + estabelecimento_constraint; + } + + ResultSet rs = st.executeQuery(sql); + rs.first(); + do + { + Utilizador u = new Utilizador(); + u.setId(new Integer(rs.getInt("id"))); + u.setLogin(rs.getString("login")); + u.setPassword(rs.getString("password")); + u.setData_password(rs.getDate("data_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")); + u.setTipo(new Integer(rs.getInt("tipo"))); + u.setNumero_cedula(rs.getString("numero_cedula")); + u.setCap(rs.getString("cap")); + u.setNome(rs.getString("nome")); + u.setMedico_id(new Integer(rs.getInt("medico_id"))); + u.setFuncionario_hst_id(new Integer(rs.getInt("funcionario_hst_id"))); + u.setActivo(rs.getString("activo")); + u.setResponsavel_loja(rs.getString("responsavel_loja")); + list.add(u); + }while(rs.next()); + return list; + } + + public ArrayList getUtilizadoresList(String por, String nome, Integer estabelecimento_id, String activo, String booDirRh) throws Exception + { + StringTokenizer stk = null; + AnalisesDataProvider adp = new AnalisesDataProvider(); + ArrayList list = new ArrayList(); + Statement st = createStatement(); + + String sql = ""; + String sql1 = ""; + String sql2 = ""; + String sql3 = ""; + if(por != null && nome != null && estabelecimento_id != null) + { + sql1 = "SELECT * FROM utilizadores, tipos_utilizadores WHERE utilizadores.tipo = tipos_utilizadores.tipo AND LOWER(numero_mecanografico) LIKE '%" + por + "%' AND ("; + sql3 = ") AND estabelecimento_id = " + estabelecimento_id + " AND utilizadores.activo ='" + activo + "' AND apagado = 'n' AND utilizadores.tipo <> " + Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP + " ORDER BY numero_mecanografico"; + stk = new StringTokenizer (nome); + int n = 0; + while (stk.hasMoreTokens ()) { + if(n > 0) + { + sql2 += "AND "; + } + sql2 += "LOWER(nome) LIKE '%" + stk.nextToken () + "%' "; + n++; + } + sql = sql1 + sql2 + sql3; + //sql = "SELECT * FROM utilizadores, tipos_utilizadores WHERE utilizadores.tipo = tipos_utilizadores.tipo AND LOWER(numero_mecanografico) LIKE '%" + por + "%' AND LOWER(nome) LIKE '%" + nome + "%' AND estabelecimento_id = " + estabelecimento_id + " AND utilizadores.activo ='" + activo + "' ORDER BY numero_mecanografico"; + } + else if(por != null && nome != null) + { + sql1 = "SELECT * FROM utilizadores, tipos_utilizadores WHERE utilizadores.tipo = tipos_utilizadores.tipo AND LOWER(numero_mecanografico) LIKE '%" + por + "%' AND ("; + sql3 = ") AND utilizadores.activo ='" + activo + "' AND apagado = 'n' AND utilizadores.tipo <> " + Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP + " ORDER BY numero_mecanografico"; + stk = new StringTokenizer (nome); + int n = 0; + while (stk.hasMoreTokens ()) { + if(n > 0) + { + sql2 += "AND "; + } + sql2 += "LOWER(nome) LIKE '%" + stk.nextToken () + "%' "; + n++; + } + sql = sql1 + sql2 + sql3; + //sql = "SELECT * FROM utilizadores, tipos_utilizadores WHERE utilizadores.tipo = tipos_utilizadores.tipo AND LOWER(numero_mecanografico) LIKE '%" + por + "%' AND LOWER(nome) LIKE '%" + nome + "%' AND utilizadores.activo ='" + activo + "' ORDER BY numero_mecanografico"; + } + else if(por != null && estabelecimento_id != null) + { + sql = "SELECT * FROM utilizadores, tipos_utilizadores WHERE utilizadores.tipo = tipos_utilizadores.tipo AND LOWER(numero_mecanografico) LIKE '%" + por + "%' AND estabelecimento_id = " + estabelecimento_id + " AND utilizadores.activo ='" + activo + "' AND apagado = 'n' AND utilizadores.tipo <> " + Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP + " ORDER BY numero_mecanografico"; + } + else if(nome != null && estabelecimento_id != null) + { + sql1 = "SELECT * FROM utilizadores, tipos_utilizadores WHERE utilizadores.tipo = tipos_utilizadores.tipo AND ("; + sql3 = ") AND estabelecimento_id = " + estabelecimento_id + " AND utilizadores.activo ='" + activo + "' AND apagado = 'n' AND utilizadores.tipo <> " + Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP + " ORDER BY numero_mecanografico"; + stk = new StringTokenizer (nome); + int n = 0; + while (stk.hasMoreTokens ()) { + if(n > 0) + { + sql2 += "AND "; + } + sql2 += "LOWER(nome) LIKE '%" + stk.nextToken () + "%' "; + n++; + } + sql = sql1 + sql2 + sql3; + //sql = "SELECT * FROM utilizadores, tipos_utilizadores WHERE utilizadores.tipo = tipos_utilizadores.tipo AND LOWER(nome) LIKE '%" + nome + "%' AND estabelecimento_id = " + estabelecimento_id + " AND utilizadores.activo ='" + activo + "' ORDER BY numero_mecanografico"; + } + else if(por != null) + { + sql = "SELECT * FROM utilizadores, tipos_utilizadores WHERE utilizadores.tipo = tipos_utilizadores.tipo AND LOWER(numero_mecanografico) LIKE '%" + por + "%' AND utilizadores.activo ='" + activo + "' AND apagado = 'n' AND utilizadores.tipo <> " + Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP + " ORDER BY numero_mecanografico"; + } + else if(nome != null) + { + sql1 = "SELECT * FROM utilizadores, tipos_utilizadores WHERE utilizadores.tipo = tipos_utilizadores.tipo AND ("; + sql3 = ") AND utilizadores.activo ='" + activo + "' AND apagado = 'n' AND utilizadores.tipo <> " + Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP + " ORDER BY numero_mecanografico"; + stk = new StringTokenizer (nome); + int n = 0; + while (stk.hasMoreTokens ()) { + if(n > 0) + { + sql2 += "AND "; + } + sql2 += "LOWER(nome) LIKE '%" + stk.nextToken () + "%' "; + n++; + } + sql = sql1 + sql2 + sql3; + //sql = "SELECT * FROM utilizadores, tipos_utilizadores WHERE utilizadores.tipo = tipos_utilizadores.tipo AND LOWER(nome) LIKE '%" + nome + "%' AND utilizadores.activo ='" + activo + "' ORDER BY numero_mecanografico"; + } + else if(estabelecimento_id != null) + { + sql = "SELECT * FROM utilizadores, tipos_utilizadores WHERE utilizadores.tipo = tipos_utilizadores.tipo AND estabelecimento_id = " + estabelecimento_id + " AND utilizadores.activo ='" + activo + "' AND apagado = 'n' AND utilizadores.tipo <> " + Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP + " ORDER BY numero_mecanografico"; + } + else // all null + { + sql = "SELECT * FROM utilizadores, tipos_utilizadores WHERE utilizadores.tipo = tipos_utilizadores.tipo AND utilizadores.activo ='" + activo + "' AND apagado = 'n' AND utilizadores.tipo <> " + Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP + " ORDER BY numero_mecanografico"; + } + System.out.println("UTILIZADORES SQL : " + sql); + ResultSet rs = st.executeQuery(sql); + rs.first(); + do + { + Utilizador u = new Utilizador(); + u.setId(new Integer(rs.getInt(1))); + u.setLogin(rs.getString("login")); + u.setPassword(rs.getString("password")); + u.setData_password(rs.getDate("data_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")); + u.setTipo(new Integer(rs.getInt("tipo"))); + u.setNumero_cedula(rs.getString("numero_cedula")); + u.setCap(rs.getString("cap")); + u.setNome(Utils.unicodeToHTML(rs.getString("nome")) ); + u.setMedico_id(new Integer(rs.getInt("medico_id"))); + u.setFuncionario_hst_id(new Integer(rs.getInt("funcionario_hst_id"))); + u.setActivo(rs.getString(14)); + u.setResponsavel_loja(rs.getString("responsavel_loja")); + u.setGestor_geral(rs.getString("gestor_geral")); + u.setNumero_mecanografico(rs.getString("numero_mecanografico")); + u.setCategoria(rs.getString("descricao")); + u.setApagado(rs.getString("apagado")); + try + { + u.setNome_estabelecimento( adp.getEstabelecimentoNome(u.getEstabelecimento_id()) ); + } + catch(Exception e) + { + e.printStackTrace(); + } + if(booDirRh.matches("y")) + { + int uType = u.getTipo().intValue(); + if ( uType == Global.TIPO_UTILIZADOR_SEGURANCA || uType == Global.TIPO_UTILIZADOR_RH || uType == Global.TIPO_UTILIZADOR_GESTOR + || uType == Global.TIPO_UTILIZADOR_DIRECTOR_LOJA ) + { + list.add( u ); + } + } + else + { + list.add(u); + } + + }while(rs.next()); + return list; + } + + public ArrayList getResponsavelRhList(Integer estabelecimento_id) + { + ArrayList list = new ArrayList(); + Utilizador u = null; + Statement st = createStatement(); + String sql ="SELECT * FROM utilizadores WHERE activo = 'y' AND tipo = " + Global.TIPO_UTILIZADOR_RH + " AND apagado = 'n' AND responsavel_loja = 'y' AND estabelecimento_id = " + estabelecimento_id; + try + { + ResultSet rs = st.executeQuery(sql); + rs.first(); + do + { + u = new Utilizador(); + u.setId(new Integer(rs.getInt("id"))); + u.setNome(rs.getString("nome")); + u.setLogin(rs.getString("login")); + u.setEmail(rs.getString("email")); + list.add(u); + }while(rs.next()); + return list; + } + catch(Exception ex) + { + return null; + } + } + + public Medico getMedico(Integer estabelecimento_id) + { + Medico m = null; + Statement st = createStatement(); + String sql ="SELECT * FROM utilizadores WHERE activo = 'y' AND tipo = " + Global.TIPO_UTILIZADOR_MEDICO + " AND apagado = 'n' AND estabelecimento_id = " + estabelecimento_id; + try + { + ResultSet rs = st.executeQuery(sql); + rs.first(); + m = new Medico(); + m.setId(new Integer(rs.getInt("id"))); + m.setNome(rs.getString("nome")); + m.setNumero_cedula(rs.getString("numero_cedula")); + return m; + } + catch(Exception ex) + { + return null; + } + } + + + public com.sun.rave.web.ui.model.Option[] getMedicosList() throws Exception + { +// Dblocal dblocal = new Dblocal(); +// dblocal.connect(); +// Statement stlocal = dblocal.createStatement(); + Statement st = createStatement(); + ArrayList list = new ArrayList(); +// Medico m = new Medico(); +// m.setId(new Integer(0)); +// m.setNome("-Seleccionar-"); +// list.add(m); + String sql ="SELECT * FROM utilizadores WHERE activo = 'y' AND tipo = 5 AND apagado = 'n' "; + ResultSet rs = st.executeQuery(sql); + rs.first(); + do + { + Medico m = new Medico(); + m.setId(new Integer(rs.getInt("id"))); + m.setNome(Utils.unicodeToHTML(rs.getString("nome"))); + list.add(m); + }while(rs.next()); + com.sun.rave.web.ui.model.Option[] listOptions = new com.sun.rave.web.ui.model.Option[list.size()]; + ListIterator iter = list.listIterator(); + int i = 0; + while(iter.hasNext()) + { + Medico m = (Medico) iter.next(); + + listOptions[i] = new Option(m.getId(), Utils.unicodeToHTML(m.getNome())); + i++; + } +// dblocal.close(); + return listOptions; + } + + public com.sun.rave.web.ui.model.Option[] getTecnicosSaudeList() throws Exception + { +// Dblocal dblocal = new Dblocal(); +// dblocal.connect(); +// Statement stlocal = dblocal.createStatement(); + Statement st = createStatement(); + ArrayList list = new ArrayList(); + TecnicoSaude t = new TecnicoSaude(); + t.setId(new Integer(0)); + t.setNome(""); + list.add(t); + String sql ="SELECT * FROM utilizadores WHERE activo = 'y' AND tipo = " + Global.TIPO_UTILIZADOR_HS; + ResultSet rs = st.executeQuery(sql); + rs.first(); + do + { + t = new TecnicoSaude(); + t.setId(new Integer(rs.getInt("id"))); + t.setNome(Utils.unicodeToHTML(rs.getString("nome"))); + list.add(t); + }while(rs.next()); + com.sun.rave.web.ui.model.Option[] listOptions = new com.sun.rave.web.ui.model.Option[list.size()]; + ListIterator iter = list.listIterator(); + int i = 0; + while(iter.hasNext()) + { + t = (TecnicoSaude) iter.next(); + + listOptions[i] = new Option(t.getId(), Utils.unicodeToHTML(t.getNome())); + i++; + } +// dblocal.close(); + return listOptions; + } + + public Integer getMaxPermissaoId() + { + Statement st = createStatement(); + String sql = "SELECT max(permissoes.id)+1 AS MAXPERMISSAOID FROM permissoes"; + try + { + ResultSet rs = st.executeQuery(sql); + rs.first(); + Integer newId = new Integer(rs.getInt("MAXPERMISSAOID")); + if(newId.intValue() == 0) + { + newId = new Integer(1); + } + return newId; + } + catch(Exception ex) + { + ex.printStackTrace(); + return new Integer(1); + } + } + + public Integer createPermissao(Permissao p) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxPermissaoId(); + + String sql = "INSERT INTO permissoes (id, user_id, codigo_permissao) VALUES (" + newId + ", " + p.getUser_id() + ", " + p.getCodigo_permissao() + ")"; + st.execute(sql); + return newId; + } + + 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/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/UtilizadoresInactivosListDataProvider.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/UtilizadoresInactivosListDataProvider.java new file mode 100644 index 00000000..b0c374ff --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/db/UtilizadoresInactivosListDataProvider.java @@ -0,0 +1,24 @@ +/* + * UtilizadoresInactivosListDataProvider.java + * + * Created on November 30, 2007, 4:48 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 UtilizadoresInactivosListDataProvider extends ObjectListDataProvider { + + /** Creates a new instance of UtilizadoresInactivosListDataProvider */ + public UtilizadoresInactivosListDataProvider() { + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/global/Global.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/global/Global.java new file mode 100755 index 00000000..79bebc5b --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/global/Global.java @@ -0,0 +1,168 @@ +/* + * Global.java + * + * Created on November 23, 2007, 10:08 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package global; + +import analiseacidentestrabalho.Utilizador; +//import com.sun.org.apache.bcel.internal.generic.GETFIELD; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import javax.faces.context.FacesContext; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import utils.JSFUtils; + +/** + * + * @author lluis2 + */ +public class Global { + public final static int ESTADO_SEG = 1; + public final static int ESTADO_RH1 = 2; + public final static int ESTADO_HS = 3; + public final static int ESTADO_RH2 = 4; + //public final static int ESTADO_MEDICINA = 5; + public final static int ESTADO_CONSOLIDACAO = 5; + //public final static int ESTADO_ASSINATURAS = 7; + public final static int ESTADO_ASSINATURA_SEG = 6; + public final static int ESTADO_ASSINATURA_RH = 7; + //public final static int ESTADO_IMPRESSAO = 8; + public final static int ESTADO_FECHAR = 8; + public final static int ESTADO_CONCLUIDO = 9; + + + public final static int ESTADO_ASSINATURA_1 = 1; + public final static int ESTADO_ASSINATURA_2 = 2; + public final static int ESTADO_ASSINATURA_3 = 3; + + public final static int TIPO_UTILIZADOR_SEGURANCA = 1; + public final static int TIPO_UTILIZADOR_RH = 2; + public final static int TIPO_UTILIZADOR_HS = 3; + public final static int TIPO_UTILIZADOR_MEDICO = 5; + public final static int TIPO_UTILIZADOR_GESTOR = 6; + public final static int TIPO_UTILIZADOR_DIRECTOR_GERAL_RH = 7; + public final static int TIPO_UTILIZADOR_DIRECTOR_SIPRP = 8; + public final static int TIPO_UTILIZADOR_DIRECTOR_LOJA = 9; + public final static int TIPO_UTILIZADOR_DIRECTOR_NACIONAL_SEGURANCA = 10; + + public final static int AUCHAN = 32; + + + public final static String SERVIDOR_SMTP = "smtp.netcabo.pt"; + public final static String SERVIDOR_SMTP_PASSWORD = "EVOLUTE"; + public final static String ENDERECO_ENVIO = "acidentes.auchan@siprp.pt"; + //public final static String ENDERECO_ENVIO = "lluis@evolute.pt"; //testes + + public final static String IMAGE_FOLDER = "/home/siprp/imagens_acidentes"; + //public final static String IMAGE_FOLDER = "/home/lluis/imagens_acidentes"; + public final static String RESOURCES_IMAGE_FOLDER = "/resources/images"; + + public static final String PDF_FOLDER_URL = "/resources/pdf"; + + + //public static final String PLANOS_ACTUACAO_URL = "http://localhost:8084/PlanosActuacao/faces/ListaPlanos.jsp"; //testes + //public static final String PLANOS_ACTUACAO_URL = "http://192.168.111.24:8084/PlanosActuacao/faces/ListaPlanos.jsp"; //testes portatil + public static final String PLANOS_ACTUACAO_URL = "https://www.siprp.pt/PlanosActuacao/faces/ListaPlanos.jsp"; //real + + public static final String LOGOS_FOLDER = "/resources/images"; + + /** Creates a new instance of Global */ + public Global() { + } + + public void copyImage(File fSource, File fDest) + { + try + { + InputStream in = new FileInputStream(fSource); + OutputStream out = new FileOutputStream(fDest); + + // Transfer bytes from in to out + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0) { + out.write(buf, 0, len); + } + in.close(); + out.close(); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + } + + public void deleteFolderFiles(File folder) + { + File files[] = folder.listFiles(); + for(int i=0;i 0) + { + //fos.write(buf, 0, buf.length); + } + fis.close(); + FacesContext ctx = FacesContext.getCurrentInstance(); + if (!ctx.getResponseComplete()) + { + HttpServletResponse response = (HttpServletResponse)ctx.getExternalContext().getResponse(); + String contentType = "application/pdf"; + response.setContentType(contentType); + response.setHeader("Content-Disposition","attachment;filename=\"" + "Ajuda.pdf" + "\""); + + ServletOutputStream out = response.getOutputStream(); + + //out.write(model.getInfo().getBytes()); + out.write(buf, 0, buf.length); + out.flush(); + out.close(); + ctx.responseComplete(); + ctx.release(); + } + } + + public static void redirectToPlanos(FacesContext fc, Utilizador currentUser) + { + String curUser = "?user=" + currentUser.getId().toString(); + String estab = ""; + if(currentUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR) + { + //obtem estabelecimento da lista de estabelecimentos + estab = "&estab_gestor=" + currentUser.getEstabelecimento_gestor().intValue(); + } + fc = fc.getCurrentInstance(); + try + { + JSFUtils.redirect(fc, Global.PLANOS_ACTUACAO_URL + curUser + estab); + //JSFUtils.dispatch(fc, Global.PLANOS_ACTUACAO_URL + curUser); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pagestate/AnaliseAcidenteTrabalhoState.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pagestate/AnaliseAcidenteTrabalhoState.java new file mode 100644 index 00000000..7be51517 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pagestate/AnaliseAcidenteTrabalhoState.java @@ -0,0 +1,464 @@ +/* + * 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 header_nr; + private Object header_date; + private int estado; + private Object empresa; + private Object estabelecimento; + private Object trabalhador; + private Object data_nascimento; + private Object data_admissao; + private Object funcao; + + private Object bi; + private Object morada; + private Object cod_postal1; + private Object cod_postal2; + private Object localidade; + private Object contacto_telefonico; + private Object turno; + + private Object data_acidente; + private Object horas_turno; + private Object seccao; + private Object local_trabalho; + private Integer hours; + private Integer minutes; + 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; + + + private String formacao_shst; + private Object formacao_shsht_n_why; + private String acidentes_colaborador; + private Object nr_acidentes_colaborador; + private String acidentes_colaboradores; + private Object nr_acidentes_colaboradores; + + private Object nr_relatorio_acidentes_colaborador_1; + private Object nr_relatorio_acidentes_colaborador_2; + private Object nr_relatorio_acidentes_colaborador_3; + private Object nr_relatorio_acidentes_colaborador_4; + + private Object nr_relatorio_acidentes_colaboradores_1; + private Object nr_relatorio_acidentes_colaboradores_2; + private Object nr_relatorio_acidentes_colaboradores_3; + private Object nr_relatorio_acidentes_colaboradores_4; + + private Object averiguador; + private String averiguacao_posterior; + private Object averiguacao_obs; + + /** 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; + } + + public Object getEmpresa() { + return empresa; + } + + public void setEmpresa(Object empresa) { + this.empresa = empresa; + } + + public int getEstado() { + return estado; + } + + public void setEstado(int estado) { + this.estado = estado; + } + + public Object getBi() { + return bi; + } + + public void setBi(Object bi) { + this.bi = bi; + } + + public Object getMorada() { + return morada; + } + + public void setMorada(Object morada) { + this.morada = morada; + } + + public Object getCod_postal1() { + return cod_postal1; + } + + public void setCod_postal1(Object cod_postal1) { + this.cod_postal1 = cod_postal1; + } + + public Object getCod_postal2() { + return cod_postal2; + } + + public void setCod_postal2(Object cod_postal2) { + this.cod_postal2 = cod_postal2; + } + + public Object getLocalidade() { + return localidade; + } + + public void setLocalidade(Object localidade) { + this.localidade = localidade; + } + + public Object getContacto_telefonico() { + return contacto_telefonico; + } + + public void setContacto_telefonico(Object contacto_telefonico) { + this.contacto_telefonico = contacto_telefonico; + } + + public Object getTurno() { + return turno; + } + + public void setTurno(Object turno) { + this.turno = turno; + } + + public Integer getHours() { + return hours; + } + + public void setHours(Integer hours) { + this.hours = hours; + } + + public Integer getMinutes() { + return minutes; + } + + public void setMinutes(Integer minutes) { + this.minutes = minutes; + } + + public String getFormacao_shst() { + return formacao_shst; + } + + public void setFormacao_shst(String formacao_shst) { + this.formacao_shst = formacao_shst; + } + + public Object getFormacao_shsht_n_why() { + return formacao_shsht_n_why; + } + + public void setFormacao_shsht_n_why(Object formacao_shsht_n_why) { + this.formacao_shsht_n_why = formacao_shsht_n_why; + } + + public String getAcidentes_colaborador() { + return acidentes_colaborador; + } + + public void setAcidentes_colaborador(String acidentes_colaborador) { + this.acidentes_colaborador = acidentes_colaborador; + } + + public Object getNr_acidentes_colaborador() { + return nr_acidentes_colaborador; + } + + public void setNr_acidentes_colaborador(Object nr_acidentes_colaborador) { + this.nr_acidentes_colaborador = nr_acidentes_colaborador; + } + + public String getAcidentes_colaboradores() { + return acidentes_colaboradores; + } + + public void setAcidentes_colaboradores(String acidentes_colaboradores) { + this.acidentes_colaboradores = acidentes_colaboradores; + } + + public Object getNr_acidentes_colaboradores() { + return nr_acidentes_colaboradores; + } + + public void setNr_acidentes_colaboradores(Object nr_acidentes_colaboradores) { + this.nr_acidentes_colaboradores = nr_acidentes_colaboradores; + } + + public Object getNr_relatorio_acidentes_colaborador_1() { + return nr_relatorio_acidentes_colaborador_1; + } + + public void setNr_relatorio_acidentes_colaborador_1(Object nr_relatorio_acidentes_colaborador_1) { + this.nr_relatorio_acidentes_colaborador_1 = nr_relatorio_acidentes_colaborador_1; + } + + public Object getNr_relatorio_acidentes_colaborador_2() { + return nr_relatorio_acidentes_colaborador_2; + } + + public void setNr_relatorio_acidentes_colaborador_2(Object nr_relatorio_acidentes_colaborador_2) { + this.nr_relatorio_acidentes_colaborador_2 = nr_relatorio_acidentes_colaborador_2; + } + + public Object getNr_relatorio_acidentes_colaborador_3() { + return nr_relatorio_acidentes_colaborador_3; + } + + public void setNr_relatorio_acidentes_colaborador_3(Object nr_relatorio_acidentes_colaborador_3) { + this.nr_relatorio_acidentes_colaborador_3 = nr_relatorio_acidentes_colaborador_3; + } + + public Object getNr_relatorio_acidentes_colaborador_4() { + return nr_relatorio_acidentes_colaborador_4; + } + + public void setNr_relatorio_acidentes_colaborador_4(Object nr_relatorio_acidentes_colaborador_4) { + this.nr_relatorio_acidentes_colaborador_4 = nr_relatorio_acidentes_colaborador_4; + } + + public Object getNr_relatorio_acidentes_colaboradores_1() { + return nr_relatorio_acidentes_colaboradores_1; + } + + public void setNr_relatorio_acidentes_colaboradores_1(Object nr_relatorio_acidentes_colaboradores_1) { + this.nr_relatorio_acidentes_colaboradores_1 = nr_relatorio_acidentes_colaboradores_1; + } + + public Object getNr_relatorio_acidentes_colaboradores_2() { + return nr_relatorio_acidentes_colaboradores_2; + } + + public void setNr_relatorio_acidentes_colaboradores_2(Object nr_relatorio_acidentes_colaboradores_2) { + this.nr_relatorio_acidentes_colaboradores_2 = nr_relatorio_acidentes_colaboradores_2; + } + + public Object getNr_relatorio_acidentes_colaboradores_3() { + return nr_relatorio_acidentes_colaboradores_3; + } + + public void setNr_relatorio_acidentes_colaboradores_3(Object nr_relatorio_acidentes_colaboradores_3) { + this.nr_relatorio_acidentes_colaboradores_3 = nr_relatorio_acidentes_colaboradores_3; + } + + public Object getNr_relatorio_acidentes_colaboradores_4() { + return nr_relatorio_acidentes_colaboradores_4; + } + + public void setNr_relatorio_acidentes_colaboradores_4(Object nr_relatorio_acidentes_colaboradores_4) { + this.nr_relatorio_acidentes_colaboradores_4 = nr_relatorio_acidentes_colaboradores_4; + } + + public Object getHeader_nr() { + return header_nr; + } + + public void setHeader_nr(Object header_nr) { + this.header_nr = header_nr; + } + + public Object getHeader_date() { + return header_date; + } + + public void setHeader_date(Object header_date) { + this.header_date = header_date; + } + + public Object getFuncao() { + return funcao; + } + + public void setFuncao(Object funcao) { + this.funcao = funcao; + } + + public Object getData_acidente() { + return data_acidente; + } + + public void setData_acidente(Object data_acidente) { + this.data_acidente = data_acidente; + } + + public Object getData_admissao() { + return data_admissao; + } + + public void setData_admissao(Object data_admissao) { + this.data_admissao = data_admissao; + } + + public Object getAveriguador() { + return averiguador; + } + + public void setAveriguador(Object averiguador) { + this.averiguador = averiguador; + } + + public String getAveriguacao_posterior() { + return averiguacao_posterior; + } + + public void setAveriguacao_posterior(String averiguacao_posterior) { + this.averiguacao_posterior = averiguacao_posterior; + } + + public Object getAveriguacao_obs() { + return averiguacao_obs; + } + + public void setAveriguacao_obs(Object averiguacao_obs) { + this.averiguacao_obs = averiguacao_obs; + } + + + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/Logotipos.eml b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/Logotipos.eml new file mode 100644 index 00000000..4510d78f --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/Logotipos.eml @@ -0,0 +1,330 @@ +X-Account-Key: account2 +X-Mozilla-Keys: +Return-Path: +Delivered-To: 4-malves@evolute.pt +Received: (qmail 19936 invoked from network); 26 Dec 2007 15:28:46 +0000 +Received: from localhost (127.0.0.1) + by localhost with SMTP; 26 Dec 2007 15:28:46 +0000 +Received: from a213-22-140-174.cpe.netcabo.pt + (a213-22-140-174.cpe.netcabo.pt [213.22.140.174]) by webmail.evolute.pt + (Horde MIME library) with HTTP; Wed, 26 Dec 2007 15:28:45 +0000 +Message-ID: <20071226152845.ecq9t84xcswo4wow@webmail.evolute.pt> +Date: Wed, 26 Dec 2007 15:28:45 +0000 +From: lluis@evolute.pt +To: malves@evolute.pt +Subject: Logotipos +MIME-Version: 1.0 +Content-Type: multipart/mixed; + boundary="=_6xaiexiy7y80" +Content-Transfer-Encoding: 7bit +User-Agent: Internet Messaging Program (IMP) H3 (4.1.1) +X-Spam-Checker-Version: SpamAssassin 3.0.6 (2005-12-07) on plesk.evolute.pt +X-Spam-Level: +X-Spam-Status: No, score=1.0 required=7.0 tests=AWL,HELO_DYNAMIC_HCC, + HELO_DYNAMIC_IPADDR,NO_REAL_NAME,RCVD_IN_SORBS_DUL autolearn=no + version=3.0.6 + +This message is in MIME format. + +--=_6xaiexiy7y80 +Content-Type: text/plain; + charset=ISO-8859-1; + DelSp="Yes"; + format="flowed" +Content-Disposition: inline +Content-Transfer-Encoding: 7bit + + + +--=_6xaiexiy7y80 +Content-Type: image/gif; + name="auchan_logo.gif" +Content-Disposition: attachment; + filename="auchan_logo.gif" +Content-Transfer-Encoding: base64 + +R0lGODlhJwHRAPAAAAAA/wD//yH5BAEAAP0ALAAAAAAnAdEAhx2YWxulWRayazaYWSuaZjyIYzmb +aDqcciinXj2iTjimWzeobzjBa0mXWkiOYUebZ0ibc1OMZlOPclWaZlObckWjW1alWkamaUepdUi0 +akeyeFSlaFSpdVeybFW0eGSeXW+Ba2mZZ3eTaWylXmSnaGerdmq1aWi2d3WpaHKpdHmza3a1eDmw +iEerhUmqkEmzhUq4lFWsg1a1hVe3mFi3o2ari2OskmW1hGe1mHW3hnW0lW+8rVDDi1vCq2fDhmnC +m3fEjnvHlXHIsHTSy5R9XJh6Zq16Wa97Y/g1T/lIOs5zVNlmVthwXMJ2Y9xpadd/Zu1HWexWWvtJ +SfpLWfxWS/tYWulVZPtMY/xaZf5bculoXP5kS/xjW/1yXOZqZuhzY/1lZ/5oc/50af51df5pgftu +kP54hv17lpCIWoGLYY+OcoiQa5aGaZmJcIWqZ4qqdoWya4a3d5W7eK2AXrWDaaGneIfCd6PJfcCK +XMSKaN2Ib92FddqQfuWLe+SSfP2Fav6Gd/+Qb/6SfP+jeoa5g5avlZa7iJm8k4+ytZuqpa2ZlKq2 +i4jCh4bHl4PRn5nEiJjImJ3VmYjIqofIt4nTu5nFpJnOtJjXqJXUuqbFi6nImKrZi6rRnLXJlrDR +jrrWmarMpqvPs6vTpKrYuLfMprfPubjUqbfXtbfisZHTyp/jxp/i4qLPyqjVyaXc2LfZxrnd0avc +5Ljl0bLn6teQgNqtp+OUh+yXkv6Hhv6Ilv6Vh/6Xlv6Kpv6Xpv6atf+kjP6ll/+zmv+npv6ouP+3 +p/+3t9euwP+rxP6r1f63xv+508nZs8vjrcXjudLhuOPJt//Dq//Gt//Uvcbcw87f1Nvdws7f4cTk +xcfp2Mfx3NXmxtfo1Nry2sTq6cXr98X06cn0+dPq6dTs9tbz69n3/OjLw+XUx//Gxv/H1//WyP/X +1v7J5f7Y6P/a9Obrxefq1e/4zenz2v/kzP7m2PX02ufs5eLu8ev15uf8/f7n5//o+Pj26f7+/vwD ++wAAAP///wj/APsJHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmTKFOq +XMmypcuXMGPKnEmzps2bOHPq3Mmzp8+fQIMKHUq0qNGjSJMqXcq0qdOnUKNKnUq1qtWrWLNq3cq1 +q9evYMOKHUu2rNmzaNOqXcu2rdu3cOPKnUu3rt27ePOWTFasGN9kf88lOycYneDBgAkP1qe38cV0 +VKpInlyFCpcqWKJ0qdIljGQqWKpskXzMsemJwLqAAcOl9Wouq1nHBiNmdRjaXKiMOc37YaAqrT1H +AY5lim0wqrlk2YK8dhUwWBj3no5QnWQsoUNXsYLZOXQsrrFj/4fOZRj18wV/ZVmNGbOVLuuxgGkP +xvP65/Vv774KTdAuYMAIg8suuhAoHXof8SMGbNg9F992YcQnX3tYWFFffZetc5V6l2WhGhjrhXEg +gh1Fs5p88tUXGmtZUJHML6FNEcUVKI6BnxTmWfWLarWFAdt8YLBD4ke6dKFdFWGgKB507cxzHYUn +gtGLOiNOFQyStV0YRmf5DNkRP0aiCAZ32XExBRS4CPRHFuNhZwUWxPDTTzitIJKIIsYkUyVTv6w2 +RooXViGklxup4xl0mH1HI3vKCATNddqBgU4/0+iQRhNLwOYFFmPkoqFTujw33noX7kloRX2e2CBm +8Y0xhnT7eP82oRXt9GPIAEWIQQaQxuVWRS5OARPGFBLKt96gp160z4LQzaedsVVAUQZB6k1oniYU +sHFhlidu+WtTutwWxm3KySdishhF4yODm2qnxWo4EnQOkqvpM00CIWjxnBa3sSbGc89xkeZSunCx +5RjQORcGsuhSpEuzXDw75neCFvQvF6W94QAdFIN4SyH2zEtxaUoBk99qpEJnasMO7WNjF8qZeUUU +IM7HhRkGBSMFFuy4s8EGTLgGxhVjqDCDQIJg1sUUVZgDyyvY4GMUMMaJcUUWZkIhWZcsT5QOkBOW +yRppBs2zCzv8aDJBCV80CN0eJOBgSSV50DgcLjlsYAEFG3D/0Ag5Q8GYhY9hV3HFyl0vBGNsmNEs +6n0ME3RPDhMYIIKz+mLXxgAOOKAEFlfM54UIG1wQxCWQtELUw1yM0W92YCCeOEIuX6b0FRGPJxkZ +CJUyAQUh0KFFdpJNgYUWRhTRBGZtmhEPT/rIqZAgIFaRBcKIZhH57AtFk2iUoA/NGhW+GLSNBwpE +YMS7xV83HxTEQ7cpGAal0xdffqHTV44LoYOOOupgxzn+B8CIqKMXuCCDjTi1i2KYChdhqA3oUGQ8 +2RWFH/pQxzCSwY58WPAnBWNTzWTFqvkwbB+iMMEE2MAEyUSMadyJAnayMBklTWFSBQHEZcyEHM5g +gQrbK0g0/yyzJdmQC4cLUQcwAIGw20hmNmDAhTrSo6oVVSgLXBMIP84hjF3g4ou7EMY5PniQeZyj +GMQQRi+A8R9hCKMYVGrIPtjYCzfqwo1uHNEBs9QFMURQDLvQk1EU9L0kVVEyWSDINnxwgRAwYWzs +iQISmBYhZ4lnV2Agw55w4UfYWO91QSQIMRjEOMlI4VMJSQcEkdMvMWzhQ7Tp1y4OpAu3YYdGz0FW +MLYkBqxFzFsCI2M/iCEGhHGBOWAATRcWFRkxmOEcC5mHwUZDG/xwYVD5AIQP+yWbbiJRKNH4kXiw +V7jy9WMflvBACJpgs+G0pwpMe2JmVsQ4/hHkD8/xjO0EVv8FC6bjObBUzWZQeRBigMc5PvwQbPzY +mX8hK2nGilgNhaQOQBznQxHEGoqSoRB9CINbpEQZcGITsdX0IpT9mEcTxdBJ23RJHf+60IdYyjjW +8EJ6QQkEFZAzBSpAQQoAi4wUzCCnUsTAAWlYgqgkSsMqSIFpFNQa7EJjKkFMyHbYuQUVaqUQaABK +NuL5JkH0EdMVIZIKlRyXGJh2mTHgtJZKihhsRHQOH9FGNbcxkidlQwVeJEQaWGJQbcQwHG4aDFBG +sidB2KEa19GGpVtqRzg746cf0WZXflwN+YaiD314sLOfzUc+2tFZfbzDEB9owPJeUwUyjGs+NMvd +downKhn/VuEMCMGFmOaDnylwNSHRMBd4LgQdgg5EHn/gJsBo6CEajqdZYMDZQARxKPFEqhibAWvA +UoQd1/qRCoo9bmcsGxt6OhZIx+ECR8vWUOi+thi1CZEfk8StbRUTC+u9iShQoQlRvAIVnBjFKQYs +YFSEYsDNaMYrTtGMU2jCAhD4QBPCgygUGY5NxakCEpY0hS14xpwGCUSS2DSZ0PWze7285XxukwXj +9oMeP+oX076TIqwhyVybHUjB2DNcwpUXC4MDsiHBYBzbiMFIppLHE5NUHCxESIROrg0ZuCvBLA5k +HoMLQxNjI65ucvnLrInQH3FKE36o4AIe2EADLkCBDlyA/wMbeIADNoCBCWzAARDQQAcwYIELXAAN +TliSm9pjHMwwaDgUkyF0QlkbmKVIVFNAqaN2StxmTcG4+7Aoa1oDu/JWspc1qwKI+0G9sKXIM0ga +g2yVZK5m9YsLvTiINPLDIOzEE4qsXE9tVA2sgszjQ9hjD6lgeWrbdNnJrxGrTPZhAg184AES8DMF +LjABDgzgARCIwAIgcIEGKGDbDxgAEcaEH+x4gbfgYdrgNGq9y0B1CtI9iCAkWtJPSuG3CPGelpRr +3FChjDXyKSkJKfPo/PYj2K+DbpvABr/YXC+Tod7TrJ2cYTD84ozC0EVMQUS0XferCmLFsqtpU59i +NpHEWP8w0ri6fNcT+fUm7zDBAjhwAQzQ3AMcwIABHoCBBhgAAxtYwMwn0AAjKPoyFDMc7Nhku/Y4 +FzM5PgggiLWuZknGggYlrqjmQ9B0HLm8zoVOysywCwS6jjgM0zR7mjVcUbk9O5F6TWyooOx0+KgK +z7SyvCQYISeL61sEmUdssoTsFWuZ8CCqLhayRKrWkZkm3DABtTFwAZ7H+QERwMACNkCBBdR8AwNo +A/MQRaOIufMK8lSO0hcPHKZBAXELUtJ6Xoj1cm8hNDS6Qtrxg2oKXiEJZFjH4/MhjPXgW4ehY3uK +5IoFKIQhgcPicYOyIMIqhDcdGWqIGKBQ4XxGl8yCf63/+/rlxLN19oAOUtX86lOxmzyDAw/wMwda +cAEDLIAFFziABgSwgAdo4AIVwAaTAQZRkCRcIFXagXoNojtLgiijZhCAcBtugygnphDE4HayMRnI +gn1bNx+kEgVWgAwdJQwjkjTpZ0WbgQVlgA4Hog/psEAgAmScBh27YBDScAbCFFzlRR6wwTCCRy8o +UkwAcwbbkw+48CPf0yaNYhPaYAGlA23U9gBS+AALgAEEwH/ftgEgoGhgUz2hcR/bwSbOdSbz8SaZ +0X4IYVUVdhkpYkGP0jpAxmNVgEq/UG42hjtXMAVLCBGA0Ca4dyJTQAZ6JxDqgB3MwWRmNS0FsQ8Q +wQ+z/2E9F6JegadWEcRymfR4V0YGsKEciYco4QUT+9BnUwgBUkh5VSh0D6AAcmYAIeAFz8EdWWAh +k0Fbo7eJ2vFu0ZIEvNBZCXEx70QxtVczVgRPqKRNYlBjFPSJDIFPKUNcoYFSV4I1ziI+0YURCNN4 +6DZqhoJ4EugZyigQdehe7GF9NkEPGVABPgcAA5AABjAA/bcAGoABCoABpJgAaiBVTMM0V/BTE8Q8 +U4CHinKGeWg4/QAMD0gQ1zhOzlIF+FZQE8I84CEZgzIPErQtvDUFwlQQY+BL1NdDt9FrCOEk9bEe +VmA80BFvEsGImeYhSBJB2MEFuDUQ6kBZSbJ1z6gQwv8wU652jMJwE6pACalACZiACZRgCZIwCZPg +CDFwAS3gAJ73ACFAC7awB3xgC37AB35gC7rAB33QB3uwKYgkUdwlUTc0k2GAiQJhUWHzJ9qBdRaW +Ox44KF7nOs+lHTEpEWrnSeMiGXuIEIMljMSCJLJjRsQwIEykZa7iKv+2dtCxH4RoPX8yHyaJBSh5 +EHYHdxYCBn8SazuRRmn0C0ICBwZwARGAAANgANNWc262ZyXwMxxAAg6ABt+hNe7UHsPBBUgggguC +hhoZgwwyBUtzOAsRDNx1KK0xhwJhIqKygGQzEWtyIrsTlwsBV6txjIlyLgcRDLvZdNXkLCX1XK4D +G5r/dGVVMAZ+JFxeAGvR9HZcBng5oQ4SVYD6sAwRsGZUeAGeJ20PMG1AJ2cP0ABHoDXwNI5TICMC +WgWlESqhoYzOsYDZgZELQQzGYS7MQwXaIxAXSCphsCjzoWwOMQbwIRu0GAaDmB6j0ns01JD9AF8A +N428R1J1KYHSiFPwqWU7SEPfKBCCB0WhkyQDkxPEQAUWQgXKsA8qsAAGoAAZoAB+hgCjKYULUAED +4I46dwB4YDzZRThfOKBCEgih4VNmYCphsAVNBTC2hpYEcSWh8XdA1n67BEUL6GIOMXXlhTDAgZ0J +AQy9ZV3wxDD58CGbUQV/8CcJx4b50ZGPKJwC8U/l/3WeC7oQy3JIqzEFIIkTxjQ06JAPz/AM5lAO +5mAOnCoO9mAP4zCq4XCq01BzBrAGJ2IhlTSOu6gOgjCZkuGhx6h8ZkJVC6Gnn8QFNCIeg/Io+CFS +2OGhDeEqFWmmrzKcNPIghsQzV8ZSMcYq9IJ6FxKHYMVq0SGTuUN+vEUyCRErtgEonlGZNSEPyfGS +AEcckYk4cSCFHNAuxRFPSHBbtQINW6CAFXqQ/TB1xCFoEKoQv2BibHgfWPApXhVwBisFWWBwfPhd +oVMc0HGW00kh4dNkB0JdFOhuD2k48ARPO/NEtoEZG3kgX/Na1CcekqgQyzI4USKB5koTBvUsDQJV +8v9BqQrhDApAARiAB/GjmcPADvtwDrjwHUsDIjtFsRbjY8zDsFMwRdMDJJhhrRKZnOIhjWsqBS8X +EZm2nFnwj6AzngoBDIhXXgy5qNCRgk6GH0+UC8WQDv+TD+pAfKuBSbpzIDAVQRsJJEnisAYRKykY +G1pAQzE7E9qEGUwmmZpVtQlBDyRQc3UQQYBQC7VQBzoADv0QDNEFMGRQoGsrBdsTCEQWITUUGsYq +ELFCBqO3GlcwLHIZMyAiUZJxBWi6EJnVTQGntAmhueRHQpGWlqSynPUxBQuTEOfAKSCCNeOSBTiV +Dn5HQ8ZWBX5bEPlwHDSGNT9qE1/Dp5JhJN+xBYL/uBCQwHMxoAr98A4lgHkOQAn94LziQSFPwpnU +Ah4R87VfKAX8OhDeYz0Y+LGD4jLyRDhQB64QEZlxtSIWBAzPtZDzUSuOuJwUSgXyixDQUGnPcYx4 +KxuZ1XZ9eRB/2pLsEUFgUKk18QtTILswdB9nQgW5ULsCYQo0V3NS4wYN4HM1wA/L8os/JB6BaBB6 +SiPAaVbwphC1wYbEgyK/VTALSEPdmJEDYSS/2FTMuxC74Gk/1iUfPFXs4cL9IAwkdzIgYrISVR+q +gSKnq6OthDIpkr004TJiZ12wUwVRIAUdfBCOewF3Fgv9QAoD0G0QIA79sAvG8auSMccRKVZXkijw +/xSR8NSTBRUZ4UNkuIcZyCINxkN9ZjohuFCii4iQo+dkkZlIu2qHjwYGtbK909ggJCx1KiKB2BEG +jLioq4thNDS9BFG9rWZZ7lkT6ZBd22G0KRIZVkBGcgB/BoAD51Q6GPAAquO84gRPxiMfVKCI+ttU +9rFpTIMEu2Bl8zAIYwMtNnShqBsijAMF0BsaxJAQ3VypztFUUhsGDBEM6+E6zeostUIMqsJbILLK +BSENoEFjJ0IGNLpi0EVkYGDLV7amCLNbd1kTeiomEBkt2CEFDa0Qz7ABLTABf9wPhHAAbTYD/KAg +tgRPKswFI/Jr78SG8TQZggAMvzBvhhbNzRKxjP+bnAWtO+UmBrgQDMQQDdFADMQgCDBDzf1wjIMD +KfKxrGObanT5JKcsgbMRGrzTuNoEZVoiBibrXE40zyC3ELicyuLCzzDBD3/wzSLFHRJ9Sg5hDyVQ +AZUnC/2wDA2AARSgAN4wTFIgVVOLGQIqVlbDJgUKKZzxGVDHv8BhITRiGRXWkP/CxNxFrbwlGUJo +GT2MusEWJdAx1QqxCymCV/cxxfAJGpoIhlPgyAYBDY1daw+ZBWLMiQssBWfcD9U7sUkSbIX7EtJg +OydCMygioFmgognBCDX3ADaAD+/weQ2ACSlVkzJkznBXBRMcyADjPtTKPJRxGQpokt41H7rna57/ +sSujYt2PSHKo5piElCgKK5jDqXDOyDWR+RrMNR+7kA75sA/7oA7QECr4EToiNC6wYbKQCL3Bi9A6 +OrG0QSrywcYyQT3KYSFsWAWuKM01+BCk8KQGIDU5wAEL4AAhYA/9EAgGQx60VWEnLdjQu5zPYTwz +Bh20ZRyHEgagMYjncFjyNCFr96J3p6hFja24Jx+3PRDC8M/DFTZcU0ux+1WR3XTAodoUOpKx3L6Y +MTyj2x6xnQ8LtYOqtrUzESuc+D1i90lTQOAGgb4XwG2s0A86u58U0A0rKt4SEk8drGkSq1asAhpP +FB9XULSf7ERIANxD9LNxiHRAGDasbdkDyl0r/8YQuzCsFHIbXKUOk3rUKyZXJMcFx3h3ARfV9TIQ +54Acg2OSkhnb8+Aj8ZEke6ngMDGTizJDtoZsVxcRcYCfG4AD/HAPJECFEzAJKQV1URDhq9Ja1IuE +bLK3kzF7GAZvhoIogfgdeCpEyuEZnvEnGPYdtvOsSHSr2DEGZhBjFvQLIjxDS4MZB+Kl7VFS6EbO +cmcGRVsf7x0hJuu9CB67VQ5LhhZBuywTffJVFVKXVUDUDuEMBsABOQfIkOAAGOAAR9MP644FUgAG +WiMr2FEl/+Q+iJ5uLVIcuPWn2PrFphyuSYNeP1ZCNOJESKQapGIGrgPtDGHC17pqB7IPuYDuMf+o +oVonIl71Wp0IBs2bSViSVl2tELNt4Ckj1i2xDwt5ta0hoFsABWJ+EPuAAvBoAbo+DRswAZxz19HQ +8AQY2MQjBX7b6UAVGr5qSU80BS8Hnz9kiduqEMOwVuxBBmUVhylTBUsorpP6agbDELpw1CiierFj +MRhyXnW7dgWqIcRANNV5ciZLcaA8HlxQx77WI8fGGkTPEumwC5iP+blAILuQC7qAC7nwRU48EIZQ +AQ9gAC6AD/HwuH6GzC4zBhGo7b2EMAjDz/sgDDYCMB2idLuASvIwjo+IBcBdEPxQDFaVhCNXM7OE +umFCHJ5EvBakoMZhsNihosRg6jFovdBBggL/cSWu5mTK0byFt3joBfm3rBpk0Blddu9UcQ/hEA/b +kA1Scw/YwA3bsA3EjxCyo0RmQHJjcEcAka/fQIL68h3cZ5DdQYINHTbMl05XmC5YuIDBAkaMmGLs +HBI7VyxZsWjJzoU89/DhuV/CiAkLtkvYr13A9KnsF0xMFZ5YrlDBUmWXR4LnxpjZhUsQLkBmAPEj +qK4LoDFUzYipygUdToL0wIA5OubrVy65uJ5Fm1btWrZt3b6FGxdhXLps86k7p06dwLp9/f4FHFjw +YMKFDR9GnFjxYsaNHT+GHFnyZMqVLV/GnFnzZs6HoXYGHVr0aNKlTZ9GnVr1atatXb+GHVv2/2za +tW3fxp1b927evX3/Bh5c+HDixY0fR55c+XLmzZ0/hx5d+nTq1a1fx55d+3bu3b1/Bx9e/Hjy5c2f +R59e/Xr27d2/hx9f/nz69e3fx59f/37+/f3/BzBAAQcksEADD0QwQQUXZLBBBx+EMEIJJ6SwQgsv +xDBDDTfksEMPPwQxRBFHJLFEE09EMUUVV2RRtHgm4CCGbgiyZwUGfACnRd64qWEDDSrAAJ9++Clh +gxc0wGBG/6xpJRYhySMhBh8w8GEBewZaAQMZbujAA2/44wcSEijYoIQvY6vnlVmujIyfFUiAwYMM +NHiAnH72KYGDGD3goIYn8xOlggs24KCBFv/sfO2UBhwI4YIcIWvGAQ40iDGGOodslAMMbrjgglT0 +u+cECDTtgAMHPnXtGkIv4OCCBc50bBkMONgAAx8xEGcgFDTQIIZWJ5hEP3c4WIBYGTxQQIjXDHkA +AgoemOCCHT5rLB4LLvCVh07tvMeEAySglQMFZNGPnlI56MDWDYZ4LcsOWNWgAT8h6+SBDijAgAII +7NznBA08wFZa/t4ggAMDHjCAgFhc2yeOfDHw9QIX/nTskQEMAHIAblMwAIMGLsCBYvzeMWGAGBo4 +gBXYUsAXAw02wFbkxqDCZ5+G9rGHHzb920cTHIJQkuERGlggTxc2mEHmxciRRZZvwvnmyW//sJkl +m1mUJoifc4ABBCxcxhBjF4fyIUYXXHCpSReZaMqLrxD3SeGBGFld4AasEYtnhQ3kzmDffu4ptQIO +LLgB0bGBAYOLKhL/qgpfBtrnnK4VByMMLrjAIoyxxEi8CjOKcbvDfUJ4AAMMOl4g6cfgfhkCDB7Q +wE57TDDd42JFTqciMcjooguNuOhloHkwX7zyxDH/qgvNsVqep+Cj20YUR745S5trXsF6H21GCQct +fri5RpZmXiHflFGw2flvbrSR5ZppZNnmFWru4eoeEkq3dQGI7zZsGVpjwIAHNHABIeEpBum6AAYW +QC6CzMN3YqmIRsIQhpvMI3GaA4PyKDIW/7IsrngYBAMuoLOMBrRKAUNQGiQs8LEYwIog8eDABD4m +BKyB4gQfu0C0GhAtC7iOhvdAQQcc8IAGuKwBCfjYBmSkkn3kQH8xuIACWGCDb5wiCCfwQQm4lANW +3I0f4WuaLLAhC2tg4xtlxIbhGiIKJbrqAh5YwMZcRikMVCBYBOnaV8LgQTBIIRkDAURGFheGoBhP +LBjJCBcqsriNAKIKz2NOPFKQwA1UwAGueIgmMDABKHaABRSDmwUUkMAHYPIhp3jAsyxAJwMYwAIP +gGUlexQDBuhJbr4aYKc2sIBZPKRfL5ABBw5gOg3kwAHYsiWtGhCDXj4kFCegFaEqUAEKsP+KAu8a +1Axy1RBndKxUpnuBkO4RQAC+SwGm7Mc5LqKRsWSEgv2IBgYXd5GMGK+eVcACFrKQkcyFAStgIMpy +MnEBIWqqAjNwyD5M0ClixWthBPlEBw6wgE5VIAbUGgg8RjApmC1glApYAAAGkAADtEoDDBAAAxZg +AAUogE7/ukAGlKjGO/mAkiy4wAAPUIFiYcBVmoKYoxyCCluZrlP6m6aejLoBktLUDhxggQdekEAh +1YMElNLfAl7QkF980HiYM0s/dtGFxQWFn/gMQxbQWoUrVGGdFhlLFYTRHDm4agG8kpgaq5FD0+3S +Uw2JAwUykEDTsYCmzsDWAF/n0Ul84xr/bvTpBSAgAAGwYBbXgATsfMUBCVDUhXciATEXALuVCgEI +ncopujDwLpURZB9cwpYHAggwXnUAZv/yAJmU1RB+ECK1VL3TCTaggACGrCFiqCc/wYBPsfWja/hM +Lj57krnGYdC6WVguGZqzAmKNtmMaeNRAtPG6GGpAhrsdSBzgBQFYGuCzpvDp6xQAgQuorh/LUEDp +Sqc/AZhyHyOYFTFjUAFUEYQbRYLAAjxpAAgoiRnN0tQLXncBGzTEHelqFQemegFX1IwQCHhArSQc +gxiIjB5AIO4DPsmPUM2qAhqgmDrAgF3N6TOfUhjGQDgHhitgpKxqDcpFqjDBr2SBkJMr/+tNlqMC +nj5gtA7wG0G0kdPXmc4AdxwIHCBAJ9TG0SGa6CEGWPCAixU4HhugwDGrLAPDaUJ/e+vVX28WgmEq +sAUNoERDMgHLKrdqYgRpBsxYtVoM7IAg9yAEkviEAQtQgKZDMgUhRoGPe8igZqJgRCgeQozizVhx ++axCjvfRzrcWEtT51ONYNEfkfAY0OSqAgAM69gAHGLYhey1Bp9irgAL3wxAVMAAF9PcAAoR3IJp4 +QJdf18zgaoAFCDCilweC3yFeQAIXMAA6IRcCDWSVWKtoyCkcwKsYIGlShmNGtFxVTQW4MBJ3vcEL +anUA/v2tA/zTBefGoLkxYGEMVZjCMf/uFAYpEHKeUwhKW+u5kyGToXL+RC5YuNAO5qAAlixogJMx +YOxllA5mTr5yQ1ZwAWCz13TG7kcmOrBSKC5gAeCGHAkWUE0kqfhPy2ilAg7gKgO09oVwfMCRPGCA +oPXDFBVowcpnlVeC+I9UD2gBBlxoCgfw4AZ6itGjHRIPD2D0IYCoMVi+EpRQ3wm5Vdhn5dCekX1a +FwtTaJzxwjCGiyhZOSowt0ddbuxqAGmlLg85QbK0cwD41NYN0aSrODXah4JWfyyQLwz+dHTXYXsB +Dej1nT5gAIn961XhppMCHYABBfx5IM0AGLEwIAAOUI8gnFjACZDOp9ihZR8ewPcgKQL/1yxs4XH7 +2GMiB1mRffuOnWPJQsSxKxYs2D05bmAp5AWwgMMPpBpy24AB9JcAdhEEBZxfwDCdTNNFwM50lycA +zO80ApdT9AJQn7xdxayAAWT+HhuAvAJaPvUJQADyLjedm3OVDGiBAXKvNYIYDciADAhA25MBr3OI +X1A7QEAHdUCcPfqjfKA7DtqdVfMxIxMLyxk7jNCjd1KOfTAYwPOYA1CjKWuBBUAAArgAB8CyflgB +ncMAAjCAFjgAlNMkDJioASIAZlMoBcO2BJO8pvuR0SIAn8o8hcI2DGgBbGO2fjiFTtG4jjG9fmAG +nrqrfDlAgiCFcdOAF2ABBay3e+AA/3x7uzBoCEG4iD8CPrIwst/BAjIAiqAgJD06pAmSrjFoDplz +OSRRII67AApggbtyue5Lr6MaLTFDuYFyFRVrhAFQP8BJoPa7gE8iCFPQH847HQN4wiLRn/MrOlTo +AO1TPaabNrvKABbIPheqBJ7iE2zhxLOIB7sRhlzIhT9yCFxYrrAaiGAAuAzsAuxCpJ4YO+kqJOMZ +wXqCpORQKJAqxQt4ATVCrAF4FwVigF4zgbvCNgToGJrKhIOBgAF4gB6ogMaDhxPQHy6jvj+5QsNz +FQTQtjvhGGezMheSFQmoJZzSgCQciFNggKkygI9hwYbghFlhgRZIAQ4QgDQsFT1QnP8nyAAfMBxH +ukO3GYMpCIMcywfk0pwsmAKFaxx8Wi5CyicRRDXF8cXlyBLqY0CtwkbtS7a7CoA8I4gUcJmVUiAX +iEQ3mqi7Qqd9GK7zc7ktNIUOKB1eUQADUL+BuL+OoZskaQhScJkYuKtugzGC6ITzSyCecr2BEAXi +ygAoer966wdssIY/WK5bYMs3BDUzyAtgGDIwAMnliivo2sNCwpyRpCcg45ytGIjQKY4RcJXKMxI1 +ugai2bJaQQCdbEQF6hSXoalIuIAmXIAtw4Ci7AAk2UyPUkpqxKkY4LWtO4GDMSpeaghPbJVBtDmC +YAaAUTEF2riGUKEFQMs0U8uB0IX/xHkch9CFIeOCK/gJxpECgduHCLqCfHJOiiADlAwDMhADLvDI +LEi+GZsxJfuFHEMO2gFAn1oAinGGClCxo3qAXrtBBRoz/aGpQ6imrFop9TNKu3IjFqAWrAQ8/am/ +rUMg0FSAKgSFBALNiymxpmuVZHu/zyMISMipAZI3A9A6lcCFKqAC72wIYNRLLvBALMhL6VKrtIKu +dgoK7Lon5MGC5soHgEKOfVCBnnS/6rsvBFgABoSAA3AA9OqHb4SdBhgA10G5RzAAnNI+D1jHrhCX +0RKAXWKB1qzM8JMsnxuId/AAGUASXhGAoiOFnDpDlxsAF2iIadCw1XqAAuhBhXzH/3zRn97sh43A +gpfEo7TbMb2cguBZUbgLvrKqpyzoN7M6NVWrAsIcAxFCDn6gHQUCv2u8NQIFwgUgAIQaiHgoAT5z +uQs4FIdwUAVyHdJjtngggQRige6yL6MjJpfhgP5siHg4AZc5Eg1QACnVBGfrFMjbxD/xBFPdzER0 +IUMwnQcAIJ9iU1zQHDgdCLpzTujSp7IAJJTkJ1DrU+qqiGYcSSwwg4EghjCAQOIYAUIkgBcAKYrZ +hgEAR62yAAB4KFAYgNOZqMy0NId4BFI6gFgzgMYzyjK0AEW8xX7ohIzDgAxov1FEkhZggZUzrn7A +B4sjLuoboB8ghycxhRg5vwo4p/+GyAELyBcIkAHSY1PEKTuHcCS9rCegqAJcgIpcKKvo5Im/fEaF +o7Ea04p+yIcqSAlpXNV3ZMAWAKV7jToByEGk24EdeL/7JD0dHQhPcLJiITkMUKMV0E0CqDkddYag +04AWoAANMIAqxJL4chnT6YFYcIUbcLJWrccadAagcpXaWQVy8IZGmKMmpBT8XAtglIJieAhdWEkf +c858ugliIB7nBDJUU0ayc8a5GwhhAITl4If7MTwWeEWauoO9OR3qG60NWKVuA8c6eoWHcIdrwQCV +MgAccAhPwDYBYoEE0LZ3IIHXBMKudIhO6JgMeIEMEKCWOsoFqBXqcxVsaAh6gBn/MdvGa0HazlMg +CTCARmALQeAcgXOIMcgCykHGuFqHfkgHjODQKogCtcIn5ClB5uNQ7LKZfggDVzuOfkFLl0KAfCUI +Q/DJBTimSvU/+xwAyXQIT4QdJ+uemxEu0BQCr0MFV6mVC8BayHkEqCs3XgmgTCREl7mA/R0qirpS +Z+OAZOsVl4IjJWLTfgDGN/265NrTGnseQVAunng4PRQDDFrJPWJRftgFLnC+8V0o02mBElgAnFUJ +ZiCBqVIABGAABciABLgAAQApD2AgnOgED2iAF/gsyMmBTiFagtCEKIoBVTgLR+iABhgg4uq2BCAA +AniAhKUhldiEKOI8BECSAOhX/4qSon7dpritgi1Q3oZwpCsw4crppyrwiHkACoyYAp7gHLRbJ2TE +Luuc2V1AOPE1jm2gFUJcgC+9m33Yh3uwmXxw5Elmi+/likc+i3yIh/TBCe25Bve5BmeYhmmgBm04 +hVLm5ITSBmcIhVM4BWcgBVc2BVE4hVLYhrcQhD3CUII4u8xxTh9zK++0yxFFtX6aMYpQKyoYA3UY +iHNQuxbeDUqAARYYgkdzhlopLGwTSPXAhRKORpitiL7cJygQg3Sw5IEQBGX0giHjnJVUnCqQAmIo +CizgnC6gON+ohEGxFRqgKfyCIn6tgC1MDwnsgjNwCGd+xihY5obQB3b4jGgQA/+4ozEfYxxciAa+ +0Idd8LfGuefeUIG9+UwP+GKCOIQAIwAWAKBtTo9gECQ4FQR7AgMqgKR5EIbf5IIxCChi2DcqIMEw +wIVhcL5zQC4OFQPsgubc0LLZyoAGEIKo4QdnYMrucr8eaI95gK4sOAd9UIcVHkEqMIPPEIaxsy5m +Zuh80IdzvpNzgMOHYxws6GjeWAQFeAEBciMO4BMWkFj6+kICyDz04AfjK+GyWq6MiIIrULI9YsYs +IKspMAOgxol8GIZcQOy2SrWgOGrcQCwqi6wBShe/OoBETCCUSw9oMLISvgh/WkaiwAUh6+k55YJq +fQgLWp64u5y0a77f2AcSaAD/CIiBXXKZOWkoCCAAuXa2C/4OfvgDDu0C6qyc6+1YPCZBLCArEQWL +KjDo2B7qEWSrVKuCy8YNd8iAZBuzM+QV+dSfFkAARqzqPKqnsXjjYjg+5wSbPQQD2HaIebAcIiOL +h2M+72YNekALULir/03ALrNclXaPX1CrPZ6CMgidX4ggMHC4ytmnPuYFlVCHOU21Cdo3HsvW3WAG +BPKpSfGpblMgIDDu8tiHeZgHlQAGfVI7zXErRKKCC4/t5Am7Qcogyx4OeJADBfDRBfAACUaAAXCE +ALHLY1S1fcscxbFxh5jeY9Ycj+SCOswI/94N8HmEG/AADwgCR8CEcRAQxFGrgxF0RowQxoZIh/bW +77GjMSzXEcuwy4fDoOTzwG8WHs6Z7a+YcNSG8zinDGhwJw6dOxBaLmItzAkCIeviN/sG9M4YtSqI +zrGDu7MzbJxwJOQ5bRLd5UfnDHXQiY3Yt6oY1KG4ZGE4pM7Ry5/2dOFA61aH9ViX9Vmn9Vq39VvH +9VxnjoAAACH/C1NUQVJESVYgNS4wCQGiDgAAXgoAAAA7 + +--=_6xaiexiy7y80 +Content-Type: image/gif; + name="siprp_logo.gif" +Content-Disposition: attachment; + filename="siprp_logo.gif" +Content-Transfer-Encoding: base64 + +R0lGODlhUgHeAPAAAAAA/wD//yH5BAEAACAALAAAAABSAd4Ah8IxPcVMVMpiZ850eIF/g4yKjZWU +l5+eoKmnqrGwsrm4utODh9eRlNqeod6qreK1t8LBw8nIytHQ0dfX2N/e3+bAwunKy+3U1fHd3ubm +5uzs7PXm5/ju7/Pz8/v3+P39/fwD+wAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE +wDy22L88tqy/PLaAvzy2VL88tii/PLb8vjy20L48tqS+PLZ4vjy2TL48tiC+PLb0vTy2yL08tpy9 +PLZwvTy2RL08thi9PLbsvDy2wLw8tpS8PLZovDy2PLw8thC8PLbkuzy2uLs8toy7PLZguzy2NLs8 +tgi7PLbcujy2sLo8toS6PLZYujy2LLo8tgC6PLbUuTy2qLk8tny5PLZQuTy2JLk8tvi4PLbMuDy2 +oLg8tnS4PLZIuDy2HLg8tvC3PLbEtzy2mLc8tmy3PLZAtzy2FLc8tui2PLa8tjy2kLY8tmS2PLY4 +tjy2DLY8tuC1PLa0tTy2iLU8tly1PLYwtTy2BLU8tti0PLastDy2gLQ8tlS0PLYotDy2/LM8ttCz +PLakszy2eAj/AEEIHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmTKFOq +XMmypcuXMGPKnEmzps2bOHPq3Mmzp8+fQIMKHUq0qNGjSJMqXcq0qdOnUKNKnUq1qtWrWLNq3cq1 +q9evYMOKHUu2rNmzaNOqXcu2rdu3cOPKnUu3rt27ePPq3cu3r9+/gAMLHkw4LYYLDx40WMCYsYPE +GDgUnjzTQwUGAgBo3sy5s+YBDSxIpkzapIcLDDyrXs15gIMNpWN35NAgAOvbuAEIqCC7d0ULC3IL +z91gtO/jCi1kHs4cdwPk0AtiCN68+m0BGKJDd2C9O+4F2bXH/8aw3Lv51QzEk+Z+vv3qAOHVCx7g +vv7qB/IBbyhvv//m5/nxtYFt/hW42QAB6jWggQx+luBdCzbYIIIPzhWhhBNWGBcHBGIoIYAatkVf +gQIs0EBiKDJAXYEOhMhWavYx8EB8CXFwWYfuXeBiWhXUF0BxEwHno3E7jsVhewHgdxFt7i1QZFkr +eqfkRg20x9uTYVlw3gCweVQBjtUFQCSWXPFXXYshcTBidyCSuRUG5l05UpXe0egmVms2F0CXJdFp +nZN3ZvVAd3um5Gd1dgYqFQfe6ajSocwBqihVg1onp0p5MjfmpE+ZKVx6LoEpHJqcQnWBdQHAdGp1 +ApQaFYzNOf/6Eqy5MXCpq01ZR+pLjOI2QAWjcSArrkqt2hxNlXomgAPGWZCapMQmBWmtNXX2I58X +1MZZtEt5iluiL9HJgKwbOCAqAOByG1SvzLVak40DcfCAt/+pe5Sxw+1akwWZvmevUckOxydN+Aq3 +6b8+0ZqbuzchivBQ/d4GasPNTfnwT9VZXFPErGl8MU8O4zTtbdB+vNMG1R0sU8C5lWxyTnAem1OP +kb7cU8zM6YSzcC7bbNPOwulcnc87AZ2b0DITjZPRuCE9XM9Ky8T0bTqx/F3UOYV8k9UkY41TdcPW +pDBuE3tN07kd50TvfWbbFGXLWTd3a9swjcwahTYVnFu6dLP/xPVtKoc7dN8zTb0adjehfTjhNAkX +wGs4adlc2YwL/l4DsmKAeU1v5zZ35SwxbWu8DizHcEyGszYw6C61JqeN/Vowk92snc66Swss2+zY +m9ne0pHN6Xs7S8ZlK5zHK3F82+rDs1Su4qoxnxJ7zfnefPLW4b1S6qx9fn1KklfXJkrA6/l9TNCz +Nr5Jyt+2/vkq/Z2b7Ci1z5qY8MOUPmvCh2R/9/mDCc3YRJL9eIdyAWTJ2nLDpZBYYH+qSyBMuIeb +AHjvIryrmQRhQr0DBk4iD4Dgbfi2QZQscDgMIGFDQuie/pVQJSirz24+eBDNidBXL5TJAGXoAAtI +TyAYeIAD//7HHPzlMCa0Q1JjFkDERh1xJk30kHcu+ETsSdFALqxiS6J4ReG8T4sv4WIX1QfGm4hx +jJ1BXhmRiMbuUHGNL5FfGz1TKDjC7IZdRKAdb5LBOVpwjz6Zzhw7wwAaAvJdnbsi4g4plC+NcTeM +BNgJmxS2SBIFNQbSnSWbUgFtmWdZKtwkUjZQAQckUjUlekAlRVkVDLiyAii6gCsNycpa2vKWuMyl +LnfJy1768pfADKYwh0nMYhrzmGTKgAQigAAEGIAA0IwmAQ7QzAhEIAMdQKZPKKCAZ0rzm+D8ZgEQ +EAEKYCSc6AQnQyKQzna6M5zjRAAEJKABjWjgnfjEZzMVcP/Nj+Tzn+lsZgLKmU2eZCABAM0nAuhJ +kYRKc50OjWg4E2BOi2RAohiN5kILmpGMZtQAEKjnTSjgTY+2E6QcdQhGIWrSjCogAxS5aEsxmgCY +nnOmEjVARWVCUpzi8wA7ZchKF8JOn0oUASl1iEyN6lAE2LQiTI1oASYAkw4gIKr5VIBIFTJUhRQV +qwmNQESWCtZ/QsAiZU3oAbaqkgwUIK34lMBCupqQr8L1pxAh613daQC2QmSv+SxAUE8iAcC6U6xc +lShLDevOAvg1IXplLDwHq1LJulMBKVGAZdGJ2ITQFSF23Sw4HduQyIpWmnKNyGnTiVmTUGC13+ws +Qj57kND/whaapF2IaW/71Mre9ptnJcluRRtczyqWqL8F5wEYMtzVFiCpc03uN1MrkrdKV7YHoa1B +bJvc1kJWut9c7kPAK83nigQC5MWuQbRbEO4mt7cGaS5s1Wtc8kITASHpgH2LO9vjetW+0TSAQuTr +XOj2F8AEoOpHNJve6EZ0sQCmbnwRDE3vOhjAAv6IdTFqAAVQwMAZoAAEELBhfNKXIOwliHuTm+GD +EBi2vkWwhDVSWIw6FSIaYCY++Ztd/9Y1oiceSIh1bFL4Cjmi+F1IBzIQgQOYdMYHTuhCNMDkbpo0 +yRxhMJAtIgGEpjPIAknxQFbcTjAbZAIljaiFCfJicGK5/7RXxah4LwxQHHsZowa2SJoBauaHSMDJ +4DSzmAVC5i9LRMsOLQBC2vzNNzsE0Q5tiI8dooESJxTKF8lpRzSQgBLzeL2Tru2WD43Rx4KA0dJ0 +9KMxamRQR1oilZZoAjiCaml+msbeFHSotztqiez5n5iu9X0pYul/9nnXDSl0OlucEWFD89YbOaiu +H4xch/YZITW2touRTBH0qlmo1J5IsfNJa4mueSWDBoGyw3ntg9yT2xNuakyPCu5XTyTODjX1vKUK +k3SvO9BQhXdBnK3q8Qq8vlKmyL/B2ep9HxzdyFZxryVC73gntOAxBijGURxuiSz8mw2fiLOjeW6U ++Hviqv99uEAIHnB50/mfFfm4NEMuEf1mdK0sObm2G6ryU/e8ITZ3eWLt7XGJ0pziJlVAnkWi87BS +5N0OnbXFNU6RCUgU2hwnekTunFB9UwTfHlW6ySM+ZpT7WaL0ZflEuA5QBQ894eIm+0S8PVMEUBYk +TeczRX6dz2D/fMqlrjfcI/LaiDI7I4X3aQG0OpK8G3si2c73toUOEUA79PBRrvNE+I5PqXNk3C01 +gASWnmm5q9vsDEn85Rf9d4R0wPIOxXrWB/8Q2F/aI3THqt094vh8tlsgHYB0Qj0/8NZvF/T59Prs +Nf8QNGeU9BQJelkLAAHo/9X0MofmtTVAAbZHtOHOPkD/BsZP/vKTPwLep/zbma9bCHD+nxu/SO7T +euObdhy0hm+m/vffTOSvnvUUZn1hhmT8V4A+hWka4X9MpVOld3+iRmEI6HMIJnsFQWEEgHkcoXp7 +ZQBHt37sh38IhoFHBmBzJmkQOBLzt1dINRG9J113N4LkJYIIR14lGBLpd1e/NxAt+FvxJ4HglVsG +B2DKl2Wb1YOupnUPSF6Kpls0yIIARoEdIXx7BYSCR3tJKF1UCIDJRXzXR15cWBKRZ1iClXEfeIXJ +FYFsllxjyHPgVYMnoQG2B1gdCAI7KFoFgIZpeFtfmHLSZYQoqIBRlYU95oC8poZDmIendQAC+HKr +VXIr/3GDZSWDOoh9yeWHiHhaUFiFp7WGMhF8jLWHy1eGhbhaDDhWv4VzLbdaoFhVEACIOEVzdbiB +ePhdvyWIQShaCbCILiEBYAdW8ReLkVhTFoWFuliBRTiLNdEB7pdWIQeMPmUA8hQBh1haUlWAvShn +bHhX1TSHOnFQrvh3zshuMaF2BtF9JpWJRyiKW0EB19hSM6iOErdzL0GO7haHCcWNoUhuZBEB7xdR +LxiOAAcT9IgQkIhPkph5MGcWGdCO3zaISDiKeieQxicQBflOOUiHhCgWC3llCJmQ/yWPLjGQCWGP +gcWHVlgWFPCN6LSE6QiPZQeSLSGSCBFr5taFJ1kWcP+YUR2pjx/pdBKpfj0ZUbpoemKhkurkkDcZ +jz45jxNJEAyJT46IlB5ZFMI4EmGojgAZW+PYlDAolGTIk0VxVbk4Ev3YTjuJTxD2eD95cREhhVn1 +lWh5FHF2hyLxlO50lu+Ulr63lUCpZBjFkowYl0YBduIHEnZpllI5lSC4lCHJlQThliZmgg8ZFNco +dh1BknyFl3dZbYwZk445ENKXUID5jmBJFAyJjg4RmvCnmYgZlGrJlH3JEJD5TrNIlDvxlAUQAcWY +EBWZTtCWldJ0kSAhkwwBdf/ngaU5FIdJAIxXERoIUA0HnNEknB9BnAyxnOmEh7apE9h5gaMXER3Q +m+n/NJr5mJwQ+ZqNGZuph43IKZhhmVAdRgFDyE0etYrSqX18yZZ7x2rtmZdy+VH6pwD6Z5TttHT3 +SQDU6RHWyRBWV3GsiU5I0Z2S9YuUCJMssaAMQaDSZKAZCRQSyljKd6AJ2hEYuhAp+E9RuZ058aGA +RYEimp9UVxGqCVB5pqI4waJ35YYtqZhmuJdrGaMVMZuH9aDhFKE/aH0v+qOrOYwSRZ4DOJkeioXT +mKSwqZ8WgZkWmZjuSRTZB1a2qKVb2qORqaQKhRFX+U8YaKM44YmrhYqSCaUv2ZkX+pkJUZbtBGVq +mhNsallRSaRFypkRWaVAymUctqNhehR7uleFaZJJmBmngZqeVnoRGhpNbvekjWoU/AhXopeNl3p6 +FroSJeoQXTps5emfUOGNUbV7qdipXTqi5aaeEjGp0NRbeSoUGTBiJjVOyKiJPHqePiqoS5oRo0oA +b1arRcFkI4alAYYACsBQG5FuS2Z+0jqtuxkS03qt5TeND0EB48etIdat4Pqt4tpb2Fqu+CgV16pN +6rqu7Nqu7vquHxMQACH/C1NUQVJESVYgNS4wCQE+DwAAAwoAAAA7 + +--=_6xaiexiy7y80-- + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/Pdf.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/Pdf.java new file mode 100644 index 00000000..e02f8c17 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/Pdf.java @@ -0,0 +1,168 @@ +/* + * Pdf.java + * + * Created on November 13, 2007, 11:33 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package pdf; + +import analiseacidentestrabalho.Acidentado; +import analiseacidentestrabalho.AnaliseAcidente; +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.Font; +import com.lowagie.text.FontFactory; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Rectangle; +import com.lowagie.text.pdf.BaseFont; +import com.lowagie.text.pdf.PdfAction; +import com.lowagie.text.pdf.PdfPCell; +import com.lowagie.text.pdf.PdfPTable; +import com.lowagie.text.pdf.PdfWriter; +import db.AnalisesDataProvider; +import java.awt.Color; +import java.io.FileOutputStream; +import javax.faces.context.FacesContext; + +/** + * + * @author lluis + */ +public class Pdf { + + PdfPCell cell = null; + Paragraph p = null; + private final static int FONT_SIZE = 5; + /** Creates a new instance of Pdf */ + public Pdf() { + } + + public void generatePdf(String folder, AnaliseAcidente a) + { + PdfPTable table = null; + FacesContext ctx = FacesContext.getCurrentInstance(); + ////HttpServletResponse response = (HttpServletResponse)ctx.getExternalContext().getResponse(); + Document document = new Document(); + ////response.setContentType("application/pdf"); + + try + { + ////PdfWriter writer = PdfWriter.getInstance(document, response.getOutputStream()); + PdfWriter.getInstance(document, new FileOutputStream(folder + "/" + a.getId().toString() + ".pdf")); + document.open(); + //document.add(new Paragraph("Hello World")); + //document.add(new Paragraph(new Date().toString())); + + table = createTableEmpresa(a); + document.add(table); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + document.close(); + } + + private PdfPTable createTableHeader(AnaliseAcidente a) + { + PdfPTable table = new PdfPTable(3); + return table; + } + + private PdfPTable createTableEmpresa(AnaliseAcidente a) + { + String empresa_str = ""; + String estabelecimento_str = ""; + String trabalhador_str = ""; + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + String nome_empresa = adp.getEmpresaNome(a.getEmpresa_id()); + empresa_str = utils.Utils.unicodeToHTML(nome_empresa); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + try + { + estabelecimento_str = adp.getEstabelecimentoNome(a.getEstabelecimento_id()); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + Acidentado ac = null; + try + { + ac = adp.getAcidentado(a.getAcidentado_id()); + trabalhador_str = ac.getNome(); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + //TableEvents event = new TableEvents(); + + float[] widths = { 1f, 4f }; + PdfPTable table = new PdfPTable(widths); + table.getDefaultCell().setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP | Rectangle.BOTTOM); + //PdfPCell cell = new PdfPCell(new Paragraph("header with colspan 3")); + //cell.setColspan(3); + //table.addCell(cell); + + + + + cell = new PdfPCell(new Paragraph("Empresa:", FontFactory.getFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED, FONT_SIZE))); + cell.setBorder(Rectangle.NO_BORDER); + cell.setBackgroundColor(new Color(102, 133, 151)); + table.addCell(cell); + + cell = new PdfPCell(new Paragraph(empresa_str, FontFactory.getFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED, FONT_SIZE, Font.NORMAL, new Color(255, 255, 255)) )); + cell.setBorder(Rectangle.NO_BORDER); + cell.setBackgroundColor(new Color(102, 133, 151)); + table.addCell(cell); + + cell = new PdfPCell(new Paragraph("Estabelecimento:", FontFactory.getFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED, FONT_SIZE))); + cell.setBorder(Rectangle.NO_BORDER); + cell.setBackgroundColor(new Color(102, 133, 151)); + table.addCell(cell); + + cell = new PdfPCell(new Paragraph(estabelecimento_str, FontFactory.getFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED, FONT_SIZE, Font.NORMAL, new Color(255, 255, 255)))); + cell.setBorder(Rectangle.NO_BORDER); + cell.setBackgroundColor(new Color(102, 133, 151)); + table.addCell(cell); + + cell = new PdfPCell(new Paragraph("Trabalhador:", FontFactory.getFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED, FONT_SIZE))); + cell.setBorder(Rectangle.NO_BORDER); + cell.setBackgroundColor(new Color(102, 133, 151)); + + table.addCell(cell); + + cell = new PdfPCell(new Paragraph(trabalhador_str, FontFactory.getFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED, FONT_SIZE, Font.NORMAL, new Color(255, 255, 255)))); + cell.setBorder(Rectangle.NO_BORDER); + cell.setBackgroundColor(new Color(102, 133, 151)); + table.addCell(cell); + table.getDefaultCell().setBackgroundColor(new Color(102, 133, 151)); + table.getDefaultCell().setPadding(0f); + table.setSpacingAfter(0f); + table.setSpacingBefore(0f); + return table; + } + + private PdfPTable createTableEmpresaHs(AnaliseAcidente a) + { + PdfPTable table = new PdfPTable(3); + return table; + } + + + + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/PdfGenerator.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/PdfGenerator.java new file mode 100644 index 00000000..cb993b0f --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/PdfGenerator.java @@ -0,0 +1,592 @@ +package pdf; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.net.URL; +import java.sql.Time; +import java.util.Calendar; +import java.util.Date; +import java.util.Vector; + +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.output.XMLOutputter; + +import analiseacidentestrabalho.Acidentado; +import analiseacidentestrabalho.AnaliseAcidente; +import analiseacidentestrabalho.Causa; +import analiseacidentestrabalho.Estabelecimento; +import analiseacidentestrabalho.Medida; +import analiseacidentestrabalho.Recomendacao; +import analiseacidentestrabalho.Seccao; +import analiseacidentestrabalho.Utilizador; + +import com.evolute.utils.fop.FOPCreator; +import com.evolute.utils.fop.PDFCreator; + +public class PdfGenerator +{ + protected final String imagePath; + protected final Estabelecimento estabelecimento; + protected final Utilizador tecnicoSuperior; + protected final Utilizador medico; + protected final AnaliseAcidente analiseAcidente; + protected final Acidentado acidentado; + protected final Seccao seccao; + protected final Recomendacao recomendacoes[]; + protected final Medida medidas[]; + protected final Causa causa; + protected final URL urlSiprp; + protected final URL urlAuchan; + //protected Vector imagens = new Vector(); + protected Vector imagens = new Vector(); + + public static void main( String args[] ) + throws Exception + { + AnaliseAcidente analise = new AnaliseAcidente(); + analise.setAnalise_nr( "12/3" ); + byte[] pdf = + new PdfGenerator( "/home/fpalma/Desktop", + new Estabelecimento(), + new Utilizador(), + new Utilizador(), + analise, + new Acidentado(), + new Seccao(), + new Recomendacao[ 0 ], + new Medida[ 0 ], + new Causa() ).generatePdf(); + File pdfFile = new File( "/home/fpalma/Desktop/siprp.pdf" ); + pdfFile.createNewFile(); + FileOutputStream fos = new FileOutputStream( pdfFile ); + fos.write( pdf ); + fos.close(); + System.out.println( "DONE" ); + } + + public PdfGenerator( + String imagePath, + Estabelecimento estabelecimento, + Utilizador tecnicoSuperior, + Utilizador medico, + AnaliseAcidente analiseAcidente, + Acidentado acidentado, + Seccao seccao, + Recomendacao recomendacoes[], + Medida medidas[], + Causa causa ) + { + this.imagePath = imagePath; + this.estabelecimento = estabelecimento; + this.tecnicoSuperior = tecnicoSuperior; + this.medico = medico; + this.analiseAcidente = analiseAcidente; + this.acidentado = acidentado; + this.seccao = seccao; + this.recomendacoes = recomendacoes; + this.medidas = medidas; + this.causa = causa; + this.urlSiprp = getClass().getResource( "siprp_logo.gif" ); + this.urlAuchan = getClass().getResource( "auchan_logo.gif" ); + carregarURLs(); + } + + protected void carregarURLs() + { + String fullPath = + imagePath + "/" + + analiseAcidente.getAnalise_nr().substring(0,2) + + analiseAcidente.getAnalise_nr().substring(3); + File dir = null; + try + { + dir = new File( fullPath ); + + if( dir == null || !dir.exists() || !dir.isDirectory() ) + { + + return; + } + File files[] = dir.listFiles(); + for( int f = 0; f < files.length; f++ ) + { + imagens.add( files[ f ].toURI().toURL() ); + } + } + catch( Exception ex ) + { + return; + } + } + + public byte[] generatePdf() + throws Exception + { + Document doc = new Document( createXml() ); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + new XMLOutputter().output( doc, baos ); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + InputStream xmlIn = new ByteArrayInputStream( baos.toByteArray() ); + InputStream xslStream = getClass().getClassLoader().getResourceAsStream( "pdf/analise_acidentes_trabalho.xsl" ); + FOPCreator.getFOPCreator().createFOfromXML( xmlIn, xslStream, out ); + return PDFCreator.getPDFCreator().createPdfFromFo( out.toByteArray() ); + } + + protected Element createXml() + { + Element rootElement = new Element( "AnaliseAcidente" ); + Element logoTipoSIPRPElement = new Element( "LogotipoSIPRP" ); + logoTipoSIPRPElement.setText( urlSiprp.toString() ); + rootElement.addContent( logoTipoSIPRPElement ); + Element logoTipoAuchanElement = new Element( "LogotipoAuchan" ); + logoTipoAuchanElement.setText( urlAuchan.toString() ); + rootElement.addContent( logoTipoAuchanElement ); + Element numeroElement = new Element( "Numero" ); + numeroElement.setText( analiseAcidente.getAnalise_nr() ); + rootElement.addContent( numeroElement ); + Date data = analiseAcidente.getData_acidente(); + rootElement.addContent( createDataElement( "Data", data ) ); + rootElement.addContent( createEntidadeEmpregadoraElement() ); + rootElement.addContent( createSeguroElement() ); + rootElement.addContent( createEmpresaSHSTElement() ); + rootElement.addContent( createAcidentadoElement() ); + rootElement.addContent( createAcidenteElement() ); + rootElement.addContent( createRecomendacoesSIPRPElement() ); + rootElement.addContent( createMedidasElement() ); + rootElement.addContent( createTomadaConhecimentoElement() ); + return rootElement; + } + + protected Element createEntidadeEmpregadoraElement() + { + Element entidadeEmpregadoraElement = new Element( "EntidadeEmpregadora" ); + Element identificacaoElement = new Element( "IdentificacaoCompleta" ); + identificacaoElement.setText( "Companhia Portuguesa de Hipermercados, S.A., com sede na Travessa Teixeira J\u00fanior, 1 - 1300-553 Lisboa" ); + entidadeEmpregadoraElement.addContent( identificacaoElement ); + Element actividadeElement = new Element( "Actividade" ); + actividadeElement.setText( "Com\u00e9rcio a Retalho em Supermercados e Hipermercados" ); + entidadeEmpregadoraElement.addContent( actividadeElement ); + Element lojaElement = new Element( "Loja" ); + lojaElement.setText( estabelecimento.getNome() ); + entidadeEmpregadoraElement.addContent( lojaElement ); + return entidadeEmpregadoraElement; + } + + protected Element createSeguroElement() + { + Element seguroElement = new Element( "Seguro" ); + Element empresaElement = new Element( "Empresa" ); + empresaElement.setText( "Mapfre Seguros Gerais, S.A." ); + seguroElement.addContent( empresaElement ); + Element apoliceElement = new Element( "Apolice" ); + apoliceElement.setText( "1500591100500" ); + seguroElement.addContent( apoliceElement ); + return seguroElement; + } + + protected Element createEmpresaSHSTElement() + { + Element empresaSHSTElement = new Element( "EmpresaSHST" ); + Element identificacaoElement = new Element( "IdentificacaoCompleta" ); + identificacaoElement.setText( + "SIPRP - Sociedade Ib\u00e9rica de Preven\u00e7\u00e3o de Riscos Profissionais Lda., " + + "com sede no Edif\u00edcio Atrium Saldanha, Pra\u00e7a Duque de Saldanha, 1 - 9\u00ba G" + + " - 1050-094 Lisboa " ); + empresaSHSTElement.addContent( identificacaoElement ); + Element tecnicoSuperiorHSTElement = new Element( "TecnicoSuperiorHST" ); + + Element nomeTecnicoSuperiorHSTElement = new Element( "Nome" ); + nomeTecnicoSuperiorHSTElement.setText( tecnicoSuperior.getNome() ); + tecnicoSuperiorHSTElement.addContent( nomeTecnicoSuperiorHSTElement ); + Element capElement = new Element( "CAP" ); + capElement.setText( tecnicoSuperior.getCap() ); + tecnicoSuperiorHSTElement.addContent( capElement ); + empresaSHSTElement.addContent( tecnicoSuperiorHSTElement ); + Element medicoTrabalhoElement = new Element( "MedicoTrabalho" ); + Element nomeMedicoTrabalhoElement = new Element( "Nome" ); + nomeMedicoTrabalhoElement.setText( medico.getNome() ); + medicoTrabalhoElement.addContent( nomeMedicoTrabalhoElement ); + Element cedulaElement = new Element( "Cedula" ); + cedulaElement.setText( medico.getNumero_cedula() ); + medicoTrabalhoElement.addContent( cedulaElement ); + empresaSHSTElement.addContent( medicoTrabalhoElement ); + return empresaSHSTElement; + } + + protected Element createAcidentadoElement() + { + Element acidentadoElement = new Element( "Acidentado" ); + Element nomeElement = new Element( "Nome" ); + nomeElement.setText( acidentado.getNome() ); + acidentadoElement.addContent( nomeElement ); + Element estabelecimentoOrigemElement = new Element( "EstabelecimentoOrigem" ); + Element nomeEstabelecimentoOrigemElement = new Element( "Nome" ); + nomeEstabelecimentoOrigemElement.setText( acidentado.getEstabelecimento_origem() ); + estabelecimentoOrigemElement.addContent( nomeEstabelecimentoOrigemElement ); + acidentadoElement.addContent( estabelecimentoOrigemElement ); + Date dataNascimento = acidentado.getData_nascimento(); + acidentadoElement.addContent( createDataElement( "DataNascimento", dataNascimento ) ); + Element biElement = new Element( "BilheteIdentidade" ); + Element numeroBiElement = new Element( "Numero" ); + numeroBiElement.setText( acidentado.getBilhete_identidade() ); + biElement.addContent( numeroBiElement ); + acidentadoElement.addContent( biElement ); + Element moradaElement = new Element( "Morada" ); + moradaElement.setText( acidentado.getMorada() + ", " + acidentado.getCod_postal() + " " + acidentado.getLocalidade() ); + acidentadoElement.addContent( moradaElement ); + Element telefoneElement = new Element( "Telefone" ); + telefoneElement.setText( acidentado.getContacto_telefonico() ); + acidentadoElement.addContent( telefoneElement ); + Date dataAdmissao = acidentado.getData_admissao(); + acidentadoElement.addContent( createDataElement( "DataAdmissao", dataAdmissao ) ); + Element funcaoElement = new Element( "Funcao" ); + funcaoElement.setText( acidentado.getFuncao() ); + acidentadoElement.addContent( funcaoElement ); + Element turnoElement = new Element( "Turno" ); + String turno = acidentado.getTurno(); + if( "m".equals( turno ) ) + { + turno = "Manh\u00e3"; + } + else if( "t".equals( turno ) ) + { + turno = "Tarde"; + } + else if( "n".equals( turno ) ) + { + turno = "Noite"; + } + turnoElement.setText( turno ); + acidentadoElement.addContent( turnoElement ); + Element superiorElement = new Element( "Superior" ); + Element nomeSuperiorElement = new Element( "Nome" ); + nomeSuperiorElement.setText( acidentado.getNome_superior_hierarquico() ); + superiorElement.addContent( nomeSuperiorElement ); + Element emailSuperiorElement = new Element( "Email" ); + emailSuperiorElement.setText( acidentado.getEmail_superior_hierarquico() ); + superiorElement.addContent( emailSuperiorElement ); + acidentadoElement.addContent( superiorElement ); + return acidentadoElement; + } + + protected Element createAcidenteElement() + { + Element acidenteElement = new Element( "Acidente" ); + Element averiguadorElement = new Element( "Averiguador" ); + Element nomeAveriguadorElement = new Element( "Nome" ); + nomeAveriguadorElement.setText( analiseAcidente.getAveriguador() ); + averiguadorElement.addContent( nomeAveriguadorElement ); + acidenteElement.addContent( averiguadorElement ); + Date dataOcorrencia = analiseAcidente.getData_acidente(); + acidenteElement.addContent( createDataElement( "DataOcorrencia", dataOcorrencia ) ); + Time horaOcorrencia = analiseAcidente.getHora_acidente(); + acidenteElement.addContent( createHoraElement( "HoraOcorrencia", horaOcorrencia ) ); + Element horasTrabalhadasElement = new Element( "HorasTrabalhadas" ); + horasTrabalhadasElement.setText( "" + analiseAcidente.getHoras_turno() ); + acidenteElement.addContent( horasTrabalhadasElement ); + Element localElement = new Element( "Local" ); + Element seccaoElement = new Element( "Seccao" ); + seccaoElement.setText( seccao.getDescricao() ); + localElement.addContent( seccaoElement ); + Element localEspecificoElement = new Element( "LocalEspecifico" ); + localEspecificoElement.setText( analiseAcidente.getLocal_trabalho() ); + localElement.addContent( localEspecificoElement ); + acidenteElement.addContent( localElement ); + Element actividadeElement = new Element( "Actividade" ); + Element descricaoActividadeElement = new Element( "Descricao" ); + descricaoActividadeElement.setText( analiseAcidente.getTarefa() ); + actividadeElement.addContent( descricaoActividadeElement ); + Element objectosActividadeElement = new Element( "Objectos" ); + objectosActividadeElement.setText( analiseAcidente.getSubstancias() ); + actividadeElement.addContent( objectosActividadeElement ); + Element condicoesActividadeElement = new Element( "Condicoes" ); + condicoesActividadeElement.setText( analiseAcidente.getCondicoes() ); + actividadeElement.addContent( condicoesActividadeElement ); + acidenteElement.addContent( actividadeElement ); + Element testemunhasElement = new Element( "Testemunhas" ); + testemunhasElement.setText( analiseAcidente.getTestemunhas() ); + acidenteElement.addContent( testemunhasElement ); + Element causasElement = new Element( "Causas" ); + causasElement.setText( causa.getCausa() ); + acidenteElement.addContent( causasElement ); + Element descricaoElement = new Element( "Descricao" ); + descricaoElement.setText( analiseAcidente.getDescricao() ); + acidenteElement.addContent( descricaoElement ); + Element imagensElement = new Element( "Imagens" ); + if( imagens.size() > 0 ) + { + Element temImagensElement = new Element( "TemImagens" ); + temImagensElement.setText( "y" ); + imagensElement.addContent( temImagensElement ); + for( int i = 0; i < imagens.size(); i++ ) + { + String imagem = imagens.get( i ).toString(); + Element imagemElement = new Element( "Imagem" ); + imagemElement.setText( imagem ); + imagensElement.addContent( imagemElement ); + } + } + acidenteElement.addContent( imagensElement ); + Element conclusoesElement = new Element( "Conclusoes" ); + conclusoesElement.setText( analiseAcidente.getConclusoes() ); + acidenteElement.addContent( conclusoesElement ); + Element accoesTomadasElement = new Element( "AccoesTomadas" ); + accoesTomadasElement.setText( analiseAcidente.getAccoes() ); + acidenteElement.addContent( accoesTomadasElement ); + Element formacaoSHSTElement = new Element( "FormacaoSHST" ); + Element teveFormacaoSHSTElement = new Element( "TeveFormacao" ); + teveFormacaoSHSTElement.setText( analiseAcidente.getFormacao_shst() ); + formacaoSHSTElement.addContent( teveFormacaoSHSTElement ); + Element motivoFormacaoSHSTElement = new Element( "Motivo" ); + motivoFormacaoSHSTElement.setText( analiseAcidente.getFormacao_shst_nao_porque() ); + formacaoSHSTElement.addContent( motivoFormacaoSHSTElement ); + acidenteElement.addContent( formacaoSHSTElement ); + Element outrasOcorrenciasMesmoPostoElement = new Element( "OutrasOcorrenciasMesmoPosto" ); + Element quantidadeOutrasOcorrenciasMesmoPostoElement = new Element( "Quantidade" ); + boolean outrasOcorrenciasMesmoPosto = "y".equals( analiseAcidente.getOutros_acidentes_com_colaborador() ); + quantidadeOutrasOcorrenciasMesmoPostoElement.setText( + outrasOcorrenciasMesmoPosto ? "" + analiseAcidente.getNr_acidentes_com_colaborador() : "0" ); + outrasOcorrenciasMesmoPostoElement.addContent( quantidadeOutrasOcorrenciasMesmoPostoElement ); + Element relatoriosOutrasOcorrenciasMesmoPostoElement = new Element( "Relatorios" ); + Integer relatorioMesmoPosto1 = analiseAcidente.getNr_relatorio_acidente_colaborador1(); + Integer relatorioMesmoPosto2 = analiseAcidente.getNr_relatorio_acidente_colaborador2(); + Integer relatorioMesmoPosto3 = analiseAcidente.getNr_relatorio_acidente_colaborador3(); + Integer relatorioMesmoPosto4 = analiseAcidente.getNr_relatorio_acidente_colaborador4(); + String numerosRelatoriosOutrasOcorrenciasMesmoPosto[] = + new String[]{ + relatorioMesmoPosto1 != null ? "" + relatorioMesmoPosto1 : null, + relatorioMesmoPosto2 != null ? "" + relatorioMesmoPosto2 : null, + relatorioMesmoPosto3 != null ? "" + relatorioMesmoPosto3 : null, + relatorioMesmoPosto4 != null ? "" + relatorioMesmoPosto4 : null + }; + for( int r = 0; r < numerosRelatoriosOutrasOcorrenciasMesmoPosto.length; r++ ) + { + if( numerosRelatoriosOutrasOcorrenciasMesmoPosto[ r ] == null ) + { + continue; + } + String numeroRelatorio = numerosRelatoriosOutrasOcorrenciasMesmoPosto[ r ]; + Element relatorioElement = new Element( "Relatorio" ); + relatorioElement.setText( numeroRelatorio ); + relatoriosOutrasOcorrenciasMesmoPostoElement.addContent( relatorioElement ); + } + outrasOcorrenciasMesmoPostoElement.addContent( relatoriosOutrasOcorrenciasMesmoPostoElement ); + acidenteElement.addContent( outrasOcorrenciasMesmoPostoElement ); + Element outrasOcorrenciasOutrosTrabalhadoresElement = new Element( "OutrasOcorrenciasOutrosTrabalhadores" ); + Element quantidadeOutrasOcorrenciasOutrosTrabalhadoresElement = new Element( "Quantidade" ); + boolean outrasOcorrenciasOutrosTrabalhadores = "y".equals( analiseAcidente.getAcidentes_outros_colaboradores() ); + quantidadeOutrasOcorrenciasOutrosTrabalhadoresElement.setText( + outrasOcorrenciasOutrosTrabalhadores ? "" + analiseAcidente.getNr_acidentes_outros_colaboradores() : "0" ); + outrasOcorrenciasOutrosTrabalhadoresElement.addContent( quantidadeOutrasOcorrenciasOutrosTrabalhadoresElement ); + Element relatoriosOutrasOcorrenciasOutrosTrabalhadoresElement = new Element( "Relatorios" ); + Integer relatorioOtrosTrabalhadores1 = analiseAcidente.getNr_relatorio_acidente_outros_colaboradores1(); + Integer relatorioOtrosTrabalhadores2 = analiseAcidente.getNr_relatorio_acidente_outros_colaboradores2(); + Integer relatorioOtrosTrabalhadores3 = analiseAcidente.getNr_relatorio_acidente_outros_colaboradores3(); + Integer relatorioOtrosTrabalhadores4 = analiseAcidente.getNr_relatorio_acidente_outros_colaboradores4(); + String numerosRelatoriosOutrasOcorrenciasOutrosTrabalhadores[] = + new String[]{ + relatorioOtrosTrabalhadores1 != null ? "" + relatorioOtrosTrabalhadores1 : null, + relatorioOtrosTrabalhadores2 != null ? "" + relatorioOtrosTrabalhadores2 : null, + relatorioOtrosTrabalhadores3 != null ? "" + relatorioOtrosTrabalhadores3 : null, + relatorioOtrosTrabalhadores4 != null ? "" + relatorioOtrosTrabalhadores4 : null + }; + for( int r = 0; r < numerosRelatoriosOutrasOcorrenciasOutrosTrabalhadores.length; r++ ) + { + if( numerosRelatoriosOutrasOcorrenciasOutrosTrabalhadores[ r ] == null ) + { + continue; + } + String numeroRelatorio = numerosRelatoriosOutrasOcorrenciasOutrosTrabalhadores[ r ]; + Element relatorioElement = new Element( "Relatorio" ); + relatorioElement.setText( numeroRelatorio ); + relatoriosOutrasOcorrenciasOutrosTrabalhadoresElement.addContent( relatorioElement ); + } + outrasOcorrenciasOutrosTrabalhadoresElement.addContent( relatoriosOutrasOcorrenciasOutrosTrabalhadoresElement ); + acidenteElement.addContent( outrasOcorrenciasOutrosTrabalhadoresElement ); + Element lesaoElement = new Element( "Lesao" ); + Element areasLesaoElement = new Element( "Areas" ); + boolean cabeca = "y".equals( analiseAcidente.getLesao_cabeca() ); + boolean pescoco = "y".equals( analiseAcidente.getLesao_pescoco() ); + boolean tronco = "y".equals( analiseAcidente.getLesao_tronco() ); + boolean superiorDireito = "y".equals( analiseAcidente.getLesao_membro_sup_dir() ); + String detalheSuperiorDireito = analiseAcidente.getEspecif1(); + boolean superiorEsquerdo = "y".equals( analiseAcidente.getLesao_membro_sup_esq() ); + String detalheSuperiorEsquerdo = analiseAcidente.getEspecif2(); + boolean inferiorDireito = "y".equals( analiseAcidente.getLesao_membro_inf_dir() ); + String detalheInferiorDireito = analiseAcidente.getEspecif3(); + boolean inferiorEsquerdo = "y".equals( analiseAcidente.getLesao_membro_inf_esq() ); + String detalheInferiorEsquerdo = analiseAcidente.getEspecif4(); + String areasLesao[][] = + new String[][]{ + cabeca ? new String[] { "Cabe\u00e7a", "" } : null, + pescoco ? new String[] { "Pesco\u00e7o", "" } : null, + tronco ? new String[] { "Tronco", "" } : null, + superiorDireito ? new String[] { "Membro Superior Direito", detalheSuperiorDireito } : null, + superiorEsquerdo ? new String[] { "Membro Superior Esquerdo", detalheSuperiorEsquerdo } : null, + inferiorDireito ? new String[] { "Membro Inferior Direito", detalheInferiorDireito } : null, + inferiorEsquerdo ? new String[] { "Membro Inferior Esquerdo", detalheInferiorEsquerdo } : null, + }; + for( int a = 0; a < areasLesao.length; a++ ) + { + if( areasLesao[ a ] == null ) + { + continue; + } + String area[] = areasLesao[ a ]; + Element areaLesaoElement = new Element( "Area" ); + Element nomeAreaLesaoElement = new Element( "Nome" ); + nomeAreaLesaoElement.setText( area[ 0 ] ); + areaLesaoElement.addContent( nomeAreaLesaoElement ); + Element detalheAreaLesaoElement = new Element( "Detalhe" ); + detalheAreaLesaoElement.setText( area[ 1 ] ); + areaLesaoElement.addContent( detalheAreaLesaoElement ); + areasLesaoElement.addContent( areaLesaoElement ); + } + lesaoElement.addContent( areasLesaoElement ); + Element tipoLesaoElement = new Element( "Tipo" ); + tipoLesaoElement.setText( analiseAcidente.getTipo_lesao() ); + lesaoElement.addContent( tipoLesaoElement ); + acidenteElement.addContent( lesaoElement ); + Element incapacidadeElement = new Element( "Incapacidade" ); + Element tipoIncapacidadeElement = new Element( "Tipo" ); + String tipoIncapacidade = analiseAcidente.getTipo_incapacidade(); + if( "n".equals( tipoIncapacidade ) ) + { + tipoIncapacidade = "Nenhuma"; + } + else if( "t".equals( tipoIncapacidade ) ) + { + tipoIncapacidade = "Tempor\u00e1ria"; + } + else if( "p".equals( tipoIncapacidade ) ) + { + tipoIncapacidade = "Permanente"; + } + tipoIncapacidadeElement.setText( tipoIncapacidade ); + incapacidadeElement.addContent( tipoIncapacidadeElement ); + Element coeficienteIncapacidadeElement = new Element( "Coeficiente" ); + coeficienteIncapacidadeElement.setText( "" + analiseAcidente.getCoef_incapacidade() ); + incapacidadeElement.addContent( coeficienteIncapacidadeElement ); + Date dataAvaliacao = analiseAcidente.getData_aval_incapacidade(); + incapacidadeElement.addContent( createDataElement( "DataAvaliacao", dataAvaliacao ) ); + Date dataRevisao = analiseAcidente.getData_rev_incapacidade(); + incapacidadeElement.addContent( createDataElement( "DataRevisao", dataRevisao ) ); + Element periodoIncapacidadeElement = new Element( "PeriodoIncapacidade" ); + Date inicioIncapacidade = analiseAcidente.getPeriodo_incapacidade_de(); + periodoIncapacidadeElement.addContent( createDataElement( "Inicio", inicioIncapacidade ) ); + Date fimIncapacidade = analiseAcidente.getPeriodo_incapacidade_a(); + periodoIncapacidadeElement.addContent( createDataElement( "Fim", fimIncapacidade ) ); + incapacidadeElement.addContent( periodoIncapacidadeElement ); + acidenteElement.addContent( incapacidadeElement ); + return acidenteElement; + } + + protected Element createRecomendacoesSIPRPElement() + { + Element recomendacoesSIPRPElement = new Element( "RecomendacoesSIPRP" ); + for( int r = 0; r < recomendacoes.length; r++ ) + { + Element recomendacaoElement = new Element( "Recomendacao" ); + recomendacaoElement.setText( recomendacoes[ r ].getRecomendacao() ); + recomendacoesSIPRPElement.addContent( recomendacaoElement ); + } + + return recomendacoesSIPRPElement; + } + + protected Element createMedidasElement() + { + Element medidasElement = new Element( "MedidasAdoptar" ); + for( int m = 0; m < medidas.length; m++ ) + { + Element medidaElement = new Element( "Medida" ); + medidaElement.setText( medidas[ m ].getMedida() ); + medidasElement.addContent( medidaElement ); + } + return medidasElement; + } + + protected Element createTomadaConhecimentoElement() + { + Element tomadaConhecimentoElement = new Element( "TomadaConhecimento" ); + tomadaConhecimentoElement.addContent( + createAssinaturaElement( "DepartamentoSeguranca", + analiseAcidente.getAveriguador(), + analiseAcidente.getData_inicio_processo() ) ); + tomadaConhecimentoElement.addContent( + createAssinaturaElement( "TecnicoHST", + analiseAcidente.getNome_resp_consolidacao(), + analiseAcidente.getData_consolidacao() ) ); + tomadaConhecimentoElement.addContent( + createAssinaturaElement( "ResponsavelSeguranca", + analiseAcidente.getNome_resp_seg(), + analiseAcidente.getData_assinatura_seg() ) ); + tomadaConhecimentoElement.addContent( + createAssinaturaElement( "ResponsavelRH", + analiseAcidente.getNome_resp_rh(), + analiseAcidente.getData_assinatura_rh() ) ); + tomadaConhecimentoElement.addContent( + createAssinaturaElement( "SuperiorHierarquico", + acidentado.getNome_superior_hierarquico(), + acidentado.getData_email_superior_hierarquico() ) ); + return tomadaConhecimentoElement; + } + + protected Element createAssinaturaElement( String nome, String nomeStr, Date data ) + { + Element assinaturaElement = new Element( nome ); + Element nomeElement = new Element( "Nome" ); + nomeElement.setText( nomeStr ); + assinaturaElement.addContent( nomeElement ); + assinaturaElement.addContent( createDataElement( "Data", data ) ); + return assinaturaElement; + } + + protected Element createDataElement( String nome, Date data ) + { + Element dataElement = new Element( nome ); + + Element anoElement = new Element( "Ano" ); + dataElement.addContent( anoElement ); + Element mesElement = new Element( "Mes" ); + dataElement.addContent( mesElement ); + Element diaElement = new Element( "Dia" ); + dataElement.addContent( diaElement ); + + if( data != null ) + { + Calendar cal = Calendar.getInstance(); + cal.setTime( data ); + anoElement.setText( "" + cal.get( Calendar.YEAR ) ); + int mes = cal.get( Calendar.MONTH ) + 1; + mesElement.setText( mes > 9 ? ( "" + mes ) : ( "0" + mes ) ); + int dia = cal.get( Calendar.DAY_OF_MONTH ); + diaElement.setText( dia > 9 ? ( "" + dia ) : ( "0" + dia ) ); + } + + return dataElement; + } + + protected Element createHoraElement( String nome, Date hora ) + { + Element horaElement = new Element( nome ); + Element horasElement = new Element( "Horas" ); + horaElement.addContent( horasElement ); + Element minutosElement = new Element( "Minutos" ); + horaElement.addContent( minutosElement ); + if( hora != null ) + { + Calendar cal = Calendar.getInstance(); + cal.setTime( hora ); + int horas = cal.get( Calendar.HOUR_OF_DAY ); + horasElement.setText( horas > 9 ? ( "" + horas ) : ( "0" + horas ) ); + int minutos = cal.get( Calendar.MINUTE ); + minutosElement.setText( minutos > 9 ? ( "" + minutos ) : ( "0" + minutos ) ); + } + return horaElement; + } +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/analise_acidentes_trabalho.xsl b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/analise_acidentes_trabalho.xsl new file mode 100644 index 00000000..49436f02 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/analise_acidentes_trabalho.xsl @@ -0,0 +1,841 @@ + + + + + + + + + + + + + + + + Página + + + + de + + + + + + + + + + + + + + + + + + + + + + + ANÃLISE DE ACIDENTE DE TRABALHO + + + + + + + + + N.º + + + + + + DATA: + + / + + / + + + + + + + + + + + + + + + + + + + + + + + + IDENTIFICAÇÃO DA + ENTIDADE EMPREGADORA + + + + + + Identificação + completa: + + + + + + + + Actividade desenvolvida: + + + + + + + + Loja: + + + + + + + + + + + + + EMPRESA SEGURADORA + + + + + + Identificação + completa: + + + + + + + + Nº de Apólice: + + + + + + + + + + + + + + EMPRESA PRESTADORA DE + SERVIÇOS DE + SEGURANÇA, HIGIENE E + SAÚDE DO TRABALHO + + + + + + Identificação + completa: + + + + + + + + Técnico(a) Superior + de HST: + + + + + + C.A.P. nº: + + + + + + + + Médico(a) do + Trabalho: + + + + + + Cédula Prof. nº: + + + + + + + + + + + + + + ACIDENTADO (A) + + + + + + Nome: + + + + + + + + Estabelecimento de + origem: + + + + + + + + Data Nascimento: + + / + + / + + + + + + + + Bilhete de Identidade + N°: + + + + + + + + Morada: + + + + + + + + Contacto + telefónico: + + + + + + + + Data admissão: + + / + + / + + + + + + + + Função: + + + + + + + + Turno de Trabalho: + + + + + + + Identificação do superior + hierárquico/Responsável do + posto de trabalho + + + + + + Nome: + + + + + + E-mail: + + + + + + + + + + + + + + DADOS DO ACIDENTE DE + TRABALHO + + + + + + Averiguador: + + + + + + + + Data da ocorrência: + + / + + / + + + + + + Hora do acidente: + + h + + m + + + + + + + Nº horas trabalhadas no + turno: + + + + + + + + Secção: + + + + + + Local específico: + + + + + + + + Tarefa/Actividade que se + encontrava a realizar: + + + + + + + + Substâncias, + equipamentos, + ferramentas e objectos + utilizados: + + + + + + + + Condições que + contribuíram para o + acidente e respectiva + explicação da + sua existência: + + + + + + + + Testemunhas: + + + + + + + + Causas do acidente: + + + + + + + + Descrição do + acidente: + + + + + + + + Fotografia(s) e/ou + croqui(s) do local do + acidente: + + + Ver Anexo + + + Nenhum + + + + + + + + + + + + Conclusões: + + + + + + + + Acções Imediatas + tomadas: + + + + + + + + + + O colaborador + teve formação em SHST + + + O colaborador não + teve formação em SHST + + + + + + + Motivo: + + + + + + + + + + + + Verificaram-se outras + ocorrências/incidências + no mesmo posto de + trabalho com o + colaborador acidentado. + + + Não se verificaram outras + ocorrências/incidências + no mesmo posto de + trabalho com o + colaborador acidentado. + + + + + + + Quantidade: + + Relatórios de acidente nº: + + + ; + + + + + + + + + + + + Verificaram-se + ocorrências/incidentes + semelhantes com outros + colaboradores. + + + Não se verificaram + ocorrências/incidentes + semelhantes com outros + colaboradores. + + + + + + + Quantidade: + + Relatórios de acidente nº: + + + ; + + + + + + + + + + LESÃO + + + + + + + Ãreas corporais + específicas + lesionadas: + + + + + + + : + + + + + + + + Tipo de Lesão: + + + + + + + + + INCAPACIDADE + + + + + + + Tipo de Incapacidade: + + + + + + Coeficiente de + Incapacidade + + % + + + + + + + Avaliação de + Incapacidade realizada + em + + / + + / + + + + + + Revisão de + Incapacidade + + / + + / + + + + + + + + Período da Incapacidade + Temporária: de + + / + + / + + a + + / + + / + + + + + + + + + + + + + + RECOMENDAÇÕES PROPOSTAS + pela SIPRP + + + + + + + + + + . + + + + + + + + + + + + + + + + MEDIDAS A ADOPTAR PELA + ENTIDADE EMPREGADORA + + + + + + + + + + + + . + + + + + + + + + + + + + + + + + + TOMADA DE CONHECIMENTO / + TERMO DE + RESPONSABILIDADE + + + + + + + + + Averiguado por + + (Departamento de Segurança) + a + + / + + / + + . + + + Verificado por + + (Técnico + de HST) a + + / + + / + + . + + + Verificado por + + (Responsável de Segurança) a + + / + + / + + . + + + Verificado por + + (Responsável de RH) a + + / + + / + + . + + + Com conhecimento de + + (Superior hierárquico) a + + / + + / + + . + + - processamento informático + - acesso autenticado - + + + + + + + + + + + + + ANEXO - Imagens + + + + Página + + + + de + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/auchan_logo.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/auchan_logo.gif new file mode 100644 index 00000000..92ef1c5b Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/auchan_logo.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/siprp_logo.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/siprp_logo.gif new file mode 100644 index 00000000..073ad184 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/siprp_logo.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/teste.xml b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/teste.xml new file mode 100644 index 00000000..de26bcab --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/pdf/teste.xml @@ -0,0 +1,384 @@ + + + + 1 + + + + 2008 + + + 01 + + + 01 + + + + + Companhia Portuguesa de Hipermercados, S.A., com sede na Travessa Teixeira + Júnior, 1 - 1300-553 Lisboa + + + Comércio a Retalho em Supermercados e Hipermercados + + + Jumbo Alfragide + + + + + Mapfre Seguros Gerais, S.A. + + + 1500591100500 + + + + + SIPRP - Sociedade Ibérica de Prevenção de Riscos Profissionais Lda., + com sede no Edifício Atrium Saldanha, Praça Duque de Saldanha, 1 - 9º G + - 1050-094 Lisboa + + + + Tecnico HST teste + + + C1A2P3 + + + + + Medico Trabalho teste + + + C123 + + + + + + Trablhador acidentado + + + + Jumbo de Alfragide + + + + + 1980 + + + 11 + + + 08 + + + + + 1112225585 + + + + Rua de Cima, 3º dto + + + 215465981 + + + + 2004 + + + 10 + + + 01 + + + + Varredor + + + Tarde + + + + António Pedro + + + apedro@hotmail.com + + + + + + + João António + + + + + 2007 + + + 12 + + + 23 + + + + + 12 + + + 35 + + + + 4 + + + + Congelados + + + Corredor Esquerdo + + + + + A varrer + + + Vassoura + + + Chão molhado + + + + Pedro Silva, Marco Pedro + + + Sono + + + Escorregou e caiu + + + + + + + + + Conclusao sem indicios nenhuns q a suportem + + + gritar. correr as voltas em panico + + + + y + + + + + + + 3 + + + + 3487 + + + 23424 + + + + + + 0 + + + + + + + + + + + + + Cabeça + + + + + Tronco + + + + + Membro Superior Direito + + + Mão + + + + + Grave + + + + + Permanente + + + 10 + + + + 2005 + + + 01 + + + 01 + + + + + 2007 + + + 01 + + + 01 + + + + + + + + + + + + + + + + + + + + + + + + + beber mta agua + + + fazer aerobica + + + + + despedir o trabalhador + + + lamber sabao + + + + + + Joao + + + + 2007 + + + 01 + + + 01 + + + + + + Pedro + + + + 2007 + + + 01 + + + 02 + + + + + + Simao + + + + 2007 + + + 01 + + + 03 + + + + + + Rafael + + + + 2007 + + + 01 + + + 04 + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/phaselistener/MainPhaseListener.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/phaselistener/MainPhaseListener.java new file mode 100644 index 00000000..9f021f4e --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/phaselistener/MainPhaseListener.java @@ -0,0 +1,59 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package phaselistener; + +import analiseacidentestrabalho.Utilizador; +import global.Global; +import javax.faces.application.NavigationHandler; +import javax.faces.component.UIViewRoot; +import javax.faces.context.FacesContext; +import javax.faces.event.PhaseEvent; +import javax.faces.event.PhaseId; +import javax.faces.event.PhaseListener; +import javax.servlet.http.HttpServletRequest; +import analiseacidentestrabalho.SessionBean1; +import utils.JSFUtils; +import utils.Logos; + +/** + * + * @author lluis + */ +public class MainPhaseListener implements PhaseListener{ + private boolean firstEntry = true; + + public void afterPhase(PhaseEvent pe) { + + + } + + public void beforePhase(PhaseEvent pe) { + if(pe.getPhaseId() == PhaseId.RENDER_RESPONSE) + { + FacesContext fc = pe.getFacesContext(); + SessionBean1 session = JSFUtils.getSessionBean(fc); + + + Utilizador u = session.getCurrentUser(); + + + //insert logos + + //Integer empresaId = u.getEmpresa_id(); + Integer empresaId = new Integer(32); + //System.out.println("LOGO EMPRESA ID : " + empresaId.toString()); + Logos logos = new Logos(); + String logourl = logos.getLogo(fc, empresaId); + //System.out.println("LOGO URL : " + logourl); + session.setLogoEmpresaUrl(logourl); + } + } + + public PhaseId getPhaseId() { + return PhaseId.ANY_PHASE; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/utils/JSFUtils.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/utils/JSFUtils.java new file mode 100644 index 00000000..a10d6ad0 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/utils/JSFUtils.java @@ -0,0 +1,138 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package utils; + +import analiseacidentestrabalho.SessionBean1; +import java.util.Iterator; +import java.util.Map; +import javax.faces.application.Application; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; +import javax.servlet.RequestDispatcher; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +/** + * + * @author lluis + */ +public class JSFUtils { + + +// public static SessionBean1 getSessionBean(FacesContext fc) +// { +// FacesContext context = fc.getCurrentInstance(); +// SessionBean1 session = (SessionBean1) context.getApplication().getELResolver().getValue(context.getELContext(), null, "SessionBean1"); +// return session; +// } + + // + // isPostBack - JSF 1.1 implementation + // +// public static boolean isPostBack(FacesContext fc) +// { +// Map parameterMap = fc.getExternalContext().getRequestParameterMap(); +// if(parameterMap.size() > 0) +// { +// return true; +// } +// return false; +// } + + public static SessionBean1 getSessionBean(FacesContext fc) + { + FacesContext context = fc.getCurrentInstance(); + //HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true); + //SessionBean1 session = (SessionBean1) context.getApplication().getELResolver().getValue(context.getELContext(), null, "SessionBean1"); + //SessionBean1 session = (SessionBean1) context.getApplication().; + + final StringBuffer valueBinding = new StringBuffer(); + valueBinding.append('#'); + valueBinding.append('{'); + valueBinding.append("SessionBean1"); + valueBinding.append('}'); + SessionBean1 session = (SessionBean1) fc.getApplication(). + createValueBinding(valueBinding.toString()).getValue(fc); + return session; + } + + public static boolean isPostBack(FacesContext fc) + { + Map parameterMap = fc.getExternalContext().getRequestParameterMap(); + + if(parameterMap.size() > 0) + { + Iterator iter = parameterMap.keySet().iterator(); + while(iter.hasNext()) + { + String par = (String) iter.next(); + } + return true; + } + return false; + } + + // + // isPostBack - JSF 1.2 implementation + // +// public static boolean isPostBack12(FacesContext fc) +// { +// ResponseStateManager rsm = fc.getRenderKit().getResponseStateManager(); +// if(rsm.isPostback(fc)) +// { +// return true; +// } +// return false; +// } + + public static void logout(FacesContext fc) throws Exception + { + ExternalContext ectx = fc.getCurrentInstance().getExternalContext(); + HttpSession session = (HttpSession) ectx.getSession(false); + session.invalidate(); + } + + public static void navigateTo(FacesContext fc, String outcome) + { + FacesContext context = fc.getCurrentInstance(); + Application app = context.getApplication(); + app.getNavigationHandler().handleNavigation(context, null, outcome); + } + + public static void redirect(FacesContext context, String url) throws Exception + { + HttpServletResponse response = (HttpServletResponse) context.getCurrentInstance().getExternalContext().getResponse(); + response.sendRedirect(url); + context.responseComplete(); + } + + public static void dispatch(FacesContext context, String url) throws Exception + { + HttpServletResponse response = (HttpServletResponse) context.getCurrentInstance().getExternalContext().getResponse(); + HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest(); + RequestDispatcher rd = request.getRequestDispatcher(url); + rd.forward(request, response); + } + + public static String getRequestParameter(FacesContext fc, String parameter) + { + Map parameters = fc.getCurrentInstance().getExternalContext().getRequestParameterMap(); + return (String) parameters.get(parameter); + } + + public static boolean requestHasParameters(FacesContext fc) + { + int size = fc.getCurrentInstance().getExternalContext().getRequestParameterMap().size(); + if(size > 0) + { + return true; + } + return false; + } + + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/utils/Logos.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/utils/Logos.java new file mode 100644 index 00000000..ff459e24 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/utils/Logos.java @@ -0,0 +1,55 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package utils; + +import db.AnalisesDataProvider; +import global.Global; +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; +import javax.faces.context.FacesContext; +import javax.servlet.ServletContext; + +/** + * + * @author lluis + */ +public class Logos { + + public String getLogo(Integer empresaId) + { + return null; + } + + public String getLogo(FacesContext fc, Integer empresaId) + { + try + { + //get image from db : + AnalisesDataProvider adp = new AnalisesDataProvider(); + byte[] logo = adp.getLogoByEmpresa(empresaId); + int len = logo.length; + + ServletContext context = (ServletContext) fc.getExternalContext().getContext(); + File logoFolder = new File(context.getRealPath(Global.LOGOS_FOLDER)); + + String logoFilename = logoFolder + "/logo_empresa" + empresaId.toString() + ".jpg"; + + OutputStream outImej = new FileOutputStream(logoFilename); + outImej.write(logo, 0, len); + System.out.println("LOGO PATH : " + logoFilename); + outImej.close(); + return Global.LOGOS_FOLDER + "/logo_empresa" + empresaId.toString() + ".jpg"; + } + catch(Exception ex) + { + ex.printStackTrace(); + return null; + } + + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/utils/Strings.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/utils/Strings.java new file mode 100644 index 00000000..1fbfc2d0 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/utils/Strings.java @@ -0,0 +1,151 @@ +/* + * Strings.java + * + * Created on October 8, 2007, 9:17 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package utils; + +/** + * + * @author lluis + */ +public class Strings { + public static String unicodeToHTML( String text ) + { + if( text == null || text.length() < 6 ) + { + return text; + } + + String output = text; + output = output.replace( "\\u0009", " " ); + output = output.replace( "\\u000a", "
" ); + + output = output.replace( "\\u00a0", " " ); + output = output.replace( "\\u00aa", "ª" ); + output = output.replace( "\\u00ba", "º" ); + + output = output.replace( "\\u00c0", "À" ); + output = output.replace( "\\u00c1", "Ã" ); + output = output.replace( "\\u00c2", "Â" ); + output = output.replace( "\\u00c3", "Ã" ); + output = output.replace( "\\u00c7", "Ç" ); + output = output.replace( "\\u00c8", "È" ); + output = output.replace( "\\u00c9", "É" ); + + output = output.replace( "\\u00ca", "Ê" ); + output = output.replace( "\\u00cc", "ÃŒ" ); + output = output.replace( "\\u00cd", "Ã" ); + output = output.replace( "\\u00ce", "ÃŽ" ); + output = output.replace( "\\u00d2", "ò" ); + output = output.replace( "\\u00d3", "ó" ); + output = output.replace( "\\u00d4", "ô" ); + output = output.replace( "\\u00d5", "õ" ); + output = output.replace( "\\u00d9", "Ù" ); + output = output.replace( "\\u00da", "Ú" ); + output = output.replace( "\\u00db", "Û" ); + + output = output.replace( "\\u00e0", "à" ); + output = output.replace( "\\u00e1", "á" ); + output = output.replace( "\\u00e2", "â" ); + output = output.replace( "\\u00e3", "ã" ); + output = output.replace( "\\u00e7", "ç" ); + output = output.replace( "\\u00e8", "è" ); + output = output.replace( "\\u00e9", "é" ); + output = output.replace( "\\u00ea", "ê" ); + output = output.replace( "\\u00ec", "ì" ); + output = output.replace( "\\u00ed", "í" ); + output = output.replace( "\\u00ee", "î" ); + output = output.replace( "\\u00f2", "ò" ); + output = output.replace( "\\u00f3", "ó" ); + output = output.replace( "\\u00f4", "ô" ); + output = output.replace( "\\u00f5", "õ" ); + output = output.replace( "\\u00f9", "ù" ); + output = output.replace( "\\u00fa", "ú" ); + output = output.replace( "\\u00fb", "û" ); + + output = output.replace( "\\u0153", "œ" ); + + output = output.replace( "\\u2013", "-" ); + output = output.replace( "\\u2014", "-" ); + output = output.replace( "\\u2018|\\u2019", "'" ); + output = output.replace( "\\u201c|\\u201d", "\"" ); + + output = output.replace( "\\u2022", "*" ); + output = output.replace( "\\u2026", "..." ); + + return output; + } + + public static String textToUnicode( String text ) + { + String output = text; + output = output.replace( "À", "\\u00c0" ); + output = output.replace( "Ã", "\\u00c1" ); + output = output.replace( "Â", "\\u00c2" ); + output = output.replace( "Ã", "\\u00c3" ); + output = output.replace( "Ç", "\\u00c7" ); + output = output.replace( "È", "\\u00c8" ); + output = output.replace( "É", "\\u00c9" ); + + output = output.replace( "Ê", "\\u00ca" ); + output = output.replace( "ÃŒ", "\\u00cc" ); + output = output.replace( "Ã", "\\u00cd" ); + output = output.replace( "ÃŽ", "\\u00ce" ); + output = output.replace( "ò", "\\u00d2" ); + output = output.replace( "ó", "\\u00d3" ); + output = output.replace( "ô", "\\u00d4" ); + output = output.replace( "õ", "\\u00d5" ); + output = output.replace( "Ù", "\\u00d9" ); + output = output.replace( "Ú", "\\u00da" ); + output = output.replace( "Û", "\\u00db" ); + + output = output.replace( "à", "\\u00e0" ); + output = output.replace( "á", "\\u00e1" ); + output = output.replace( "â", "\\u00e2" ); + output = output.replace( "ã", "\\u00e3" ); + output = output.replace( "ç", "\\u00e7" ); + output = output.replace( "è", "\\u00e8" ); + output = output.replace( "é", "\\u00e9" ); + output = output.replace( "ê", "\\u00ea" ); + output = output.replace( "ì", "\\u00ec" ); + output = output.replace( "í", "\\u00ed" ); + output = output.replace( "î", "\\u00ee" ); + output = output.replace( "ò", "\\u00f2" ); + output = output.replace( "ó", "\\u00f3" ); + output = output.replace( "ô", "\\u00f4" ); + output = output.replace( "õ", "\\u00f5" ); + output = output.replace( "ù", "\\u00f9" ); + output = output.replace( "ú", "\\u00fa" ); + output = output.replace( "û", "\\u00fb" ); + + return output; + } + + public static String RTFToUnicode( String text ) + { + if( text == null || text.length() < 4 ) + { + return text; + } + String output = text; + output = output.replaceAll( "\\'", "\\u00" ); + return output; + } + + public static String unicodeToRTF( String text ) + { + if( text == null || text.length() < 6 ) + { + return text; + } + String output = text; + output = output.replaceAll( "\\\\u00", "\\\\'" ); + return output; + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/utils/Utils.java b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/utils/Utils.java new file mode 100644 index 00000000..6ff0fdb7 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/src/java/utils/Utils.java @@ -0,0 +1,385 @@ +/* + * Utils.java + * + * Created on October 12, 2007, 9:39 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package utils; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + +/** + * + * @author lluis + */ +public class Utils { + + /** Creates a new instance of Utils */ + public Utils() { + } + + public static String unicodeToHTML( String text ) + { + if( text == null || text.length() < 6 ) + { + return text; + } + + String output = text; + output = output.replaceAll( "\\\\u0009", " " ); + output = output.replaceAll( "\\\\u000a", "
" ); + + output = output.replaceAll( "\\\\u00a0", " " ); + output = output.replaceAll( "\\\\u00aa", "ª" ); + output = output.replaceAll( "\\\\u00ba", "º" ); + + output = output.replaceAll( "\\\\u00c0", "À" ); + output = output.replaceAll( "\\\\u00c1", "Ã" ); + output = output.replaceAll( "\\\\u00c2", "Â" ); + output = output.replaceAll( "\\\\u00c3", "Ã" ); + output = output.replaceAll( "\\\\u00c7", "Ç" ); + output = output.replaceAll( "\\\\u00c8", "È" ); + output = output.replaceAll( "\\\\u00c9", "É" ); + output = output.replaceAll( "\\\\u00d3", "Ó" ); + output = output.replaceAll( "\\\\u00d2", "Ã’" ); + + output = output.replaceAll( "\\\\u00ca", "Ê" ); + output = output.replaceAll( "\\\\u00cc", "ÃŒ" ); + output = output.replaceAll( "\\\\u00cd", "Ã" ); + output = output.replaceAll( "\\\\u00ce", "ÃŽ" ); + output = output.replaceAll( "\\\\u00d2", "ò" ); + output = output.replaceAll( "\\\\u00d3", "ó" ); + output = output.replaceAll( "\\\\u00d4", "ô" ); + output = output.replaceAll( "\\\\u00d5", "õ" ); + output = output.replaceAll( "\\\\u00d9", "Ù" ); + output = output.replaceAll( "\\\\u00da", "Ú" ); + output = output.replaceAll( "\\\\u00db", "Û" ); + + output = output.replaceAll( "\\\\u00e0", "à" ); + output = output.replaceAll( "\\\\u00e1", "á" ); + output = output.replaceAll( "\\\\u00e2", "â" ); + output = output.replaceAll( "\\\\u00e3", "ã" ); + output = output.replaceAll( "\\\\u00e7", "ç" ); + output = output.replaceAll( "\\\\u00e8", "è" ); + output = output.replaceAll( "\\\\u00e9", "é" ); + output = output.replaceAll( "\\\\u00ea", "ê" ); + output = output.replaceAll( "\\\\u00ec", "ì" ); + output = output.replaceAll( "\\\\u00ed", "í" ); + output = output.replaceAll( "\\\\u00ee", "î" ); + output = output.replaceAll( "\\\\u00f2", "ò" ); + output = output.replaceAll( "\\\\u00f3", "ó" ); + output = output.replaceAll( "\\\\u00f4", "ô" ); + output = output.replaceAll( "\\\\u00f5", "õ" ); + output = output.replaceAll( "\\\\u00f9", "ù" ); + output = output.replaceAll( "\\\\u00fa", "ú" ); + output = output.replaceAll( "\\\\u00fb", "û" ); + + output = output.replaceAll( "\\\\u0153", "œ" ); + + output = output.replaceAll( "\\\\u2013", "-" ); + output = output.replaceAll( "\\\\u2014", "-" ); + output = output.replaceAll( "\\\\u2018|\\\\u2019", "'" ); + output = output.replaceAll( "\\\\u201c|\\\\u201d", "\"" ); + + output = output.replaceAll( "\\\\u2022", "*" ); + output = output.replaceAll( "\\\\u2026", "..." ); + + return output; + } + + public static String textToUnicode( String text ) + { + String output = text; + + output = output.replaceAll( "À", "\\\\\\\\\\\\\\\\u00c0" ); + output = output.replaceAll( "Ã", "\\\\\\\\\\\\\\\\u00c1" ); + output = output.replaceAll( "Â", "\\\\\\\\\\\\\\\\u00c2" ); + output = output.replaceAll( "Ã", "\\\\\\\\\\\\\\\\u00c3" ); + output = output.replaceAll( "Ç", "\\\\\\\\\\\\\\\\u00c7" ); + output = output.replaceAll( "È", "\\\\\\\\\\\\\\\\u00c8" ); + output = output.replaceAll( "É", "\\\\\\\\\\\\\\\\u00c9" ); + output = output.replaceAll( "Ó", "\\\\\\\\\\\\\\\\u00d3" ); + output = output.replaceAll( "Ã’", "\\\\\\\\\\\\\\\\u00d2" ); + + output = output.replaceAll( "Ê", "\\\\\\\\\\\\\\\\u00ca" ); + output = output.replaceAll( "ÃŒ", "\\\\\\\\\\\\\\\\u00cc" ); + output = output.replaceAll( "Ã", "\\\\\\\\\\\\\\\\u00cd" ); + output = output.replaceAll( "ÃŽ", "\\\\\\\\\\\\\\\\u00ce" ); + output = output.replaceAll( "ò", "\\\\\\\\\\\\\\\\u00d2" ); + output = output.replaceAll( "ó", "\\\\\\\\\\\\\\\\u00d3" ); + output = output.replaceAll( "ô", "\\\\\\\\\\\\\\\\u00d4" ); + output = output.replaceAll( "õ", "\\\\\\\\\\\\\\\\u00d5" ); + output = output.replaceAll( "Ù", "\\\\\\\\\\\\\\\\u00d9" ); + output = output.replaceAll( "Ú", "\\\\\\\\\\\\\\\\u00da" ); + output = output.replaceAll( "Û", "\\\\\\\\\\\\\\\\u00db" ); + + output = output.replaceAll( "à", "\\\\\\\\\\\\\\\\u00e0" ); + output = output.replaceAll( "á", "\\\\\\\\\\\\\\\\u00e1" ); + output = output.replaceAll( "â", "\\\\\\\\\\\\\\\\u00e2" ); + output = output.replaceAll( "ã", "\\\\\\\\\\\\\\\\u00e3" ); + output = output.replaceAll( "ç", "\\\\\\\\\\\\\\\\u00e7" ); + output = output.replaceAll( "è", "\\\\\\\\\\\\\\\\u00e8" ); + output = output.replaceAll( "é", "\\\\\\\\\\\\\\\\u00e9" ); + output = output.replaceAll( "ê", "\\\\\\\\\\\\\\\\u00ea" ); + output = output.replaceAll( "ì", "\\\\\\\\\\\\\\\\u00ec" ); + output = output.replaceAll( "í", "\\\\\\\\\\\\\\\\u00ed" ); + output = output.replaceAll( "î", "\\\\\\\\\\\\\\\\u00ee" ); + output = output.replaceAll( "ò", "\\\\\\\\\\\\\\\\u00f2" ); + output = output.replaceAll( "ó", "\\\\\\\\\\\\\\\\u00f3" ); + output = output.replaceAll( "ô", "\\\\\\\\\\\\\\\\u00f4" ); + output = output.replaceAll( "õ", "\\\\\\\\\\\\\\\\u00f5" ); + output = output.replaceAll( "ù", "\\\\\\\\\\\\\\\\u00f9" ); + output = output.replaceAll( "ú", "\\\\\\\\\\\\\\\\u00fa" ); + output = output.replaceAll( "û", "\\\\\\\\\\\\\\\\u00fb" ); + + return output; + } + + public static String textToHtml( String text ) + { + String output = text; + + output = output.replaceAll( "À", "À" ); + output = output.replaceAll( "Ã", "Á" ); + output = output.replaceAll( "Â", "Â" ); + output = output.replaceAll( "Ã", "Ã" ); + output = output.replaceAll( "Ç", "Ç" ); + output = output.replaceAll( "È", "È" ); + output = output.replaceAll( "É", "É" ); + output = output.replaceAll( "Ó", "Ó" ); + output = output.replaceAll( "Ã’", "Ò" ); + + output = output.replaceAll( "Ê", "Ê" ); + output = output.replaceAll( "ÃŒ", "Ì" ); + output = output.replaceAll( "Ã", "Í" ); + output = output.replaceAll( "ÃŽ", "Î" ); + output = output.replaceAll( "ò", "ò" ); + output = output.replaceAll( "ó", "ó" ); + output = output.replaceAll( "ô", "ô" ); + output = output.replaceAll( "õ", "õ" ); + output = output.replaceAll( "Ù", "Ù" ); + output = output.replaceAll( "Ú", "Ú" ); + output = output.replaceAll( "Û", "Û" ); + + output = output.replaceAll( "à", "à" ); + output = output.replaceAll( "á", "á" ); + output = output.replaceAll( "â", "â" ); + output = output.replaceAll( "ã", "ã" ); + output = output.replaceAll( "ç", "ç" ); + output = output.replaceAll( "è", "è" ); + output = output.replaceAll( "é", "é" ); + output = output.replaceAll( "ê", "ê" ); + output = output.replaceAll( "ì", "ì" ); + output = output.replaceAll( "í", "í" ); + output = output.replaceAll( "î", "î" ); + output = output.replaceAll( "ò", "ò" ); + output = output.replaceAll( "ó", "ó" ); + output = output.replaceAll( "ô", "ô" ); + output = output.replaceAll( "õ", "õ" ); + output = output.replaceAll( "ù", "ù" ); + output = output.replaceAll( "ú", "ú" ); + output = output.replaceAll( "û", "û" ); + + return output; + } + + public static String getPageFrom(String referer) + { + String pageFrom = referer.substring(referer.lastIndexOf("/")+1); + return pageFrom; + } + + public static boolean isValidEmail(String email){ + boolean res = true; + System.out.println("IS VALID EMAIL"); + int indexOfAtChar=email.indexOf("@"); + + if(!isValidEmailCharacters(email)) + { + return false; + } + + if(indexOfAtChar > 0) + { + int indexOfDotChar = + email.indexOf(".",indexOfAtChar); + if(indexOfDotChar > 0) + { + res = true; + } + else + { + res = false; + } + } + else{ + res = false; + } + return res; + } + + private static boolean isValidEmailCharacters(String email) + { + if(email.indexOf("à") != -1) + { + return false; + } + else if(email.indexOf("á") != -1) + { + return false; + } + else if(email.indexOf("ã") != -1) + { + return false; + } + else if(email.indexOf("â") != -1) + { + return false; + } + else if(email.indexOf("è") != -1) + { + return false; + } + else if(email.indexOf("é") != -1) + { + return false; + } + else if(email.indexOf("ê") != -1) + { + return false; + } + else if(email.indexOf("ì") != -1) + { + return false; + } + else if(email.indexOf("í") != -1) + { + return false; + } + else if(email.indexOf("ò") != -1) + { + return false; + } + else if(email.indexOf("ó") != -1) + { + return false; + } + else if(email.indexOf("ô") != -1) + { + return false; + } + else if(email.indexOf("õ") != -1) + { + return false; + } + else if(email.indexOf("ù") != -1) + { + return false; + } + else if(email.indexOf("ú") != -1) + { + return false; + } + else if(email.indexOf("û") != -1) + { + return false; + } + else if(email.indexOf("ç") != -1) + { + return false; + } + else if(email.indexOf("À") != -1) + { + return false; + } + else if(email.indexOf("Ã") != -1) + { + return false; + } + else if(email.indexOf("Ã") != -1) + { + return false; + } + else if(email.indexOf("Â") != -1) + { + return false; + } + else if(email.indexOf("È") != -1) + { + return false; + } + else if(email.indexOf("É") != -1) + { + return false; + } + else if(email.indexOf("Ê") != -1) + { + return false; + } + else if(email.indexOf("ÃŒ") != -1) + { + return false; + } + else if(email.indexOf("Ã") != -1) + { + return false; + } + else if(email.indexOf("Ã’") != -1) + { + return false; + } + else if(email.indexOf("Ó") != -1) + { + return false; + } + else if(email.indexOf("Ô") != -1) + { + return false; + } + else if(email.indexOf("Õ") != -1) + { + return false; + } + else if(email.indexOf("Ù") != -1) + { + return false; + } + else if(email.indexOf("Ú") != -1) + { + return false; + } + else if(email.indexOf("Û") != -1) + { + return false; + } + else if(email.indexOf("Ç") != -1) + { + return false; + } + return true; + } + + public static String dateToYYYYMMDD(Date ddate) + { + Calendar cal = new GregorianCalendar(); + cal.setTime(ddate); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); + String date_str = dateFormat.format(cal.getTime()); + return date_str; + } + + public static String timeToHHMM(String ttime) throws Exception + { + SimpleDateFormat formatter = new SimpleDateFormat("HH:mm"); + //String s = formatter.format(date); + Date date = (Date)formatter.parse(ttime); + return formatter.format(date); + } + +} diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/Acesso.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/Acesso.jsp new file mode 100644 index 00000000..e2a639ab --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/Acesso.jsp @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/AnaliseAcidenteTrabalho.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/AnaliseAcidenteTrabalho.jsp new file mode 100644 index 00000000..63b58d41 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/AnaliseAcidenteTrabalho.jsp @@ -0,0 +1,1490 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &nbsp; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/Dummy.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/Dummy.jsp new file mode 100644 index 00000000..d8921857 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/Dummy.jsp @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/EnviarCorrecao.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/EnviarCorrecao.jsp new file mode 100644 index 00000000..a01067d1 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/EnviarCorrecao.jsp @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/Erro.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/Erro.jsp new file mode 100644 index 00000000..de4505dd --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/Erro.jsp @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/FichaUtilizador.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/FichaUtilizador.jsp new file mode 100644 index 00000000..1875c0c6 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/FichaUtilizador.jsp @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/Footer.jspf b/branches/SIPRP/AnaliseAcidentesTrabalho/web/Footer.jspf new file mode 100644 index 00000000..1bf9523a --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/Footer.jspf @@ -0,0 +1,12 @@ + +
+ + + + + + + + + +
diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormDirGerRh.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormDirGerRh.jsp new file mode 100644 index 00000000..f0374089 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormDirGerRh.jsp @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormDirSiprp.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormDirSiprp.jsp new file mode 100755 index 00000000..b1ffb955 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormDirSiprp.jsp @@ -0,0 +1,254 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormGestor.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormGestor.jsp new file mode 100644 index 00000000..6de105cd --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormGestor.jsp @@ -0,0 +1,247 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormHS.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormHS.jsp new file mode 100644 index 00000000..cbfdfaeb --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormHS.jsp @@ -0,0 +1,322 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormMedico.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormMedico.jsp new file mode 100644 index 00000000..d5bb4e45 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormMedico.jsp @@ -0,0 +1,263 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormRH.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormRH.jsp new file mode 100644 index 00000000..18894590 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormRH.jsp @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormSeguranca.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormSeguranca.jsp new file mode 100644 index 00000000..12d2db0e --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/FormSeguranca.jsp @@ -0,0 +1,326 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/GestaoUtilizadores.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/GestaoUtilizadores.jsp new file mode 100644 index 00000000..df6321c4 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/GestaoUtilizadores.jsp @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/Header.jspf b/branches/SIPRP/AnaliseAcidentesTrabalho/web/Header.jspf new file mode 100644 index 00000000..633668bb --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/Header.jspf @@ -0,0 +1,30 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/LoadImage.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/LoadImage.jsp new file mode 100644 index 00000000..56ad8634 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/LoadImage.jsp @@ -0,0 +1,42 @@ + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + +
+ + +
+
+
+
+
diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/Login.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/Login.jsp new file mode 100644 index 00000000..b4469c49 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/Login.jsp @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + +
+
+
+
+
diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/META-INF/context.xml b/branches/SIPRP/AnaliseAcidentesTrabalho/web/META-INF/context.xml new file mode 100644 index 00000000..e3929bc2 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/NovoUtilizador.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/NovoUtilizador.jsp new file mode 100644 index 00000000..d7b19f2d --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/NovoUtilizador.jsp @@ -0,0 +1,310 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/RecuperarPassword.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/RecuperarPassword.jsp new file mode 100644 index 00000000..639b924b --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/RecuperarPassword.jsp @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + +
+
+
+
+
diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/Top.jspf b/branches/SIPRP/AnaliseAcidentesTrabalho/web/Top.jspf new file mode 100644 index 00000000..a35f7542 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/Top.jspf @@ -0,0 +1,19 @@ + +
+ + + + + + + + + + + + + + + +
diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/UtilizadorFields.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/UtilizadorFields.jsp new file mode 100644 index 00000000..33783e37 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/UtilizadorFields.jsp @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/ViewAnaliseAcidenteTrabalho.jsp b/branches/SIPRP/AnaliseAcidentesTrabalho/web/ViewAnaliseAcidenteTrabalho.jsp new file mode 100644 index 00000000..3baf64e0 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/ViewAnaliseAcidenteTrabalho.jsp @@ -0,0 +1,485 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/WEB-INF/faces-config.xml b/branches/SIPRP/AnaliseAcidentesTrabalho/web/WEB-INF/faces-config.xml new file mode 100644 index 00000000..e4348f99 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/WEB-INF/faces-config.xml @@ -0,0 +1,34 @@ + + + + + + + + + + phaselistener.MainPhaseListener + + + Acesso + analiseacidentestrabalho.Acesso + request + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/WEB-INF/managed-beans.xml b/branches/SIPRP/AnaliseAcidentesTrabalho/web/WEB-INF/managed-beans.xml new file mode 100644 index 00000000..beec62ad --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/WEB-INF/managed-beans.xml @@ -0,0 +1,130 @@ + + + + + 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 + + + FichaUtilizador + analiseacidentestrabalho.FichaUtilizador + request + + + FormMedico + analiseacidentestrabalho.FormMedico + request + + + FormDirSiprp + analiseacidentestrabalho.FormDirSiprp + request + + + EnviarCorrecao + analiseacidentestrabalho.EnviarCorrecao + request + + + GestaoUtilizadores + analiseacidentestrabalho.GestaoUtilizadores + request + + + NovoUtilizador + analiseacidentestrabalho.NovoUtilizador + request + + + UtilizadorFields + analiseacidentestrabalho.UtilizadorFields + request + + + FormDirGerRh + analiseacidentestrabalho.FormDirGerRh + request + + + FormGestor + analiseacidentestrabalho.FormGestor + request + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/WEB-INF/navigation.xml b/branches/SIPRP/AnaliseAcidentesTrabalho/web/WEB-INF/navigation.xml new file mode 100644 index 00000000..5e0f02a0 --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/WEB-INF/navigation.xml @@ -0,0 +1,455 @@ + + + + + /Login.jsp + + recuperar_password + /RecuperarPassword.jsp + + + erro + /Erro.jsp + + + acesso + /Acesso.jsp + + + form_seguranca + /FormSeguranca.jsp + + + form_rh + /FormRH.jsp + + + form_hs + /FormHS.jsp + + + form_medico + /FormMedico.jsp + + + form_dir_ger_rh + /FormDirGerRh.jsp + + + form_dir_siprp + /FormDirSiprp.jsp + + + create_user + /FichaUtilizador.jsp + + + user + /FichaUtilizador.jsp + + + form_gestor + /FormGestor.jsp + + + + /RecuperarPassword.jsp + + login + /Login.jsp + + + + /FormSeguranca.jsp + + login + /Login.jsp + + + analise_acidente + /AnaliseAcidenteTrabalho.jsp + + + view_analise + /ViewAnaliseAcidenteTrabalho.jsp + + + user + /FichaUtilizador.jsp + + + + /FormRH.jsp + + login + /Login.jsp + + + analise_acidente + /AnaliseAcidenteTrabalho.jsp + + + view_analise + /ViewAnaliseAcidenteTrabalho.jsp + + + user + /FichaUtilizador.jsp + + + + /FormHS.jsp + + login + /Login.jsp + + + analise_acidente + /AnaliseAcidenteTrabalho.jsp + + + view_analise + /ViewAnaliseAcidenteTrabalho.jsp + + + user + /FichaUtilizador.jsp + + + + /FormMedico.jsp + + login + /Login.jsp + + + analise_acidente + /AnaliseAcidenteTrabalho.jsp + + + view_analise + /ViewAnaliseAcidenteTrabalho.jsp + + + user + /FichaUtilizador.jsp + + + + /FormGestor.jsp + + login + /Login.jsp + + + view_analise + /ViewAnaliseAcidenteTrabalho.jsp + + + user + /FichaUtilizador.jsp + + + + /FormDirGerRh.jsp + + view_analise + /ViewAnaliseAcidenteTrabalho.jsp + + + gestao_utilizadores + /GestaoUtilizadores.jsp + + + user + /FichaUtilizador.jsp + + + login + /Login.jsp + + + + /FormDirSiprp.jsp + + login + /Login.jsp + + + analise_acidente + /AnaliseAcidenteTrabalho.jsp + + + view_analise + /ViewAnaliseAcidenteTrabalho.jsp + + + user + /FichaUtilizador.jsp + + + gestao_utilizadores + /GestaoUtilizadores.jsp + + + + /AnaliseAcidenteTrabalho.jsp + + load_image + /LoadImage.jsp + + + form_seguranca + /FormSeguranca.jsp + + + form_rh + /FormRH.jsp + + + form_hs + /FormHS.jsp + + + form_medico + /FormMedico.jsp + + + correcao + /EnviarCorrecao.jsp + + + user + /FichaUtilizador.jsp + + + login + /Login.jsp + + + + /LoadImage.jsp + + analise_acidente + /AnaliseAcidenteTrabalho.jsp + + + + /FichaUtilizador.jsp + + form_seguranca + /FormSeguranca.jsp + + + form_rh + /FormRH.jsp + + + form_hs + /FormHS.jsp + + + form_medico + /FormMedico.jsp + + + form_gestor + /FormGestor.jsp + + + form_dir_ger_rh + /FormDirGerRh.jsp + + + form_dir_siprp + /FormDirSiprp.jsp + + + analise_acidente + /AnaliseAcidenteTrabalho.jsp + + + view_analise + /ViewAnaliseAcidenteTrabalho.jsp + + + gestao_utilizadores + /GestaoUtilizadores.jsp + + + novo_utilizador + /NovoUtilizador.jsp + + + login + /Login.jsp + + + + /ViewAnaliseAcidenteTrabalho.jsp + + login + /Login.jsp + + + user + /FichaUtilizador.jsp + + + form_seguranca + /FormSeguranca.jsp + + + form_rh + /FormRH.jsp + + + form_hs + /FormHS.jsp + + + form_medico + /FormMedico.jsp + + + form_gestor + /FormGestor.jsp + + + form_dir_ger_rh + /FormDirGerRh.jsp + + + form_dir_siprp + /FormDirSiprp.jsp + + + + /EnviarCorrecao.jsp + + analise_acidente + /AnaliseAcidenteTrabalho.jsp + + + form_hs + /FormHS.jsp + + + login + /Login.jsp + + + + /GestaoUtilizadores.jsp + + novo_utilizador + /NovoUtilizador.jsp + + + user_fields + /UtilizadorFields.jsp + + + user + /FichaUtilizador.jsp + + + form_dir_ger_rh + /FormDirGerRh.jsp + + + form_dir_siprp + /FormDirSiprp.jsp + + + login + /Login.jsp + + + + /NovoUtilizador.jsp + + new_user_fields + /UtilizadorFields.jsp + + + gestao_utilizadores + /GestaoUtilizadores.jsp + + + user + /FichaUtilizador.jsp + + + form_dir_ger_rh + /FormDirGerRh.jsp + + + form_dir_siprp + /FormDirSiprp.jsp + + + login + /Login.jsp + + + + /UtilizadorFields.jsp + + novo_utilizador + /NovoUtilizador.jsp + + + gestao_utilizadores + /GestaoUtilizadores.jsp + + + form_dir_ger_rh + /FormDirGerRh.jsp + + + form_dir_siprp + /FormDirSiprp.jsp + + + login + /Login.jsp + + + + /Acesso.jsp + + gestor + /FormGestor.jsp + + + form_rh + /FormRH.jsp + + + form_dir_ger_rh + /FormDirGerRh.jsp + + + form_hs + /FormHS.jsp + + + form_seguranca + /FormSeguranca.jsp + + + form_dir_siprp + /FormDirSiprp.jsp + + + form_gestor + /FormGestor.jsp + + + login + /Login.jsp + + + diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/WEB-INF/web.xml b/branches/SIPRP/AnaliseAcidentesTrabalho/web/WEB-INF/web.xml new file mode 100644 index 00000000..cd61087f --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/WEB-INF/web.xml @@ -0,0 +1,15 @@ + +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/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/1 b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/1 new file mode 100644 index 00000000..4720ac5e Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/1 differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/Logo_Auchan_novo.jpg b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/Logo_Auchan_novo.jpg new file mode 100644 index 00000000..1b79d4cb Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/Logo_Auchan_novo.jpg differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/SIPRP_logo_small.jpg b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/SIPRP_logo_small.jpg new file mode 100644 index 00000000..240f2358 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/SIPRP_logo_small.jpg differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/auchan_logo.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/auchan_logo.gif new file mode 100644 index 00000000..8fa06785 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/auchan_logo.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/auchan_logo_mini.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/auchan_logo_mini.gif new file mode 100644 index 00000000..c77c826c Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/auchan_logo_mini.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/black_spacer.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/black_spacer.gif new file mode 100644 index 00000000..d370e341 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/black_spacer.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/logo_auchan_small.jpg b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/logo_auchan_small.jpg new file mode 100644 index 00000000..376eee0e Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/logo_auchan_small.jpg differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/logo_auchan_small1.jpg b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/logo_auchan_small1.jpg new file mode 100644 index 00000000..f9e50690 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/logo_auchan_small1.jpg differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/logo_evolute_small.png b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/logo_evolute_small.png new file mode 100644 index 00000000..0198da2b Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/logo_evolute_small.png differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/ma1.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/ma1.gif new file mode 100755 index 00000000..6141cfcd Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/ma1.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ca1.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ca1.gif new file mode 100755 index 00000000..76ca9ac0 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ca1.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ca2.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ca2.gif new file mode 100644 index 00000000..97c08970 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ca2.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ca3.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ca3.gif new file mode 100644 index 00000000..07b00dc5 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ca3.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ca4.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ca4.gif new file mode 100755 index 00000000..baf6f2bd Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ca4.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ext1.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ext1.gif new file mode 100644 index 00000000..6278e9de Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ext1.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ext2.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ext2.gif new file mode 100644 index 00000000..d50ab9f5 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ext2.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ext3.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ext3.gif new file mode 100644 index 00000000..cb2a14e3 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ext3.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ext4.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ext4.gif new file mode 100755 index 00000000..fa96b7d5 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ext4.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/fle1.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/fle1.gif new file mode 100755 index 00000000..7ea7b35e Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/fle1.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/fle2.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/fle2.gif new file mode 100644 index 00000000..dbf9cb41 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/fle2.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/fle3.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/fle3.gif new file mode 100644 index 00000000..5406a2be Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/fle3.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/fle4.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/fle4.gif new file mode 100644 index 00000000..7342e330 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/fle4.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma1.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma1.gif new file mode 100755 index 00000000..6141cfcd Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma1.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma10.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma10.gif new file mode 100644 index 00000000..94748d7b Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma10.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma2.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma2.gif new file mode 100644 index 00000000..a1f65bf0 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma2.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma3.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma3.gif new file mode 100644 index 00000000..3ec7862b Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma3.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma4.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma4.gif new file mode 100755 index 00000000..9deb31a7 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma4.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma5.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma5.gif new file mode 100644 index 00000000..c6719c98 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma5.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma6.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma6.gif new file mode 100644 index 00000000..f1b5170b Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma6.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma7.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma7.gif new file mode 100755 index 00000000..98aa5304 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma7.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma8.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma8.gif new file mode 100644 index 00000000..b98a9b2a Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma8.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma9.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma9.gif new file mode 100755 index 00000000..ced4fc27 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/ma9.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/rot1.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/rot1.gif new file mode 100755 index 00000000..938aa4f5 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/rot1.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/rot2.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/rot2.gif new file mode 100755 index 00000000..eb785c9c Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/medico/rot2.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/plus_more.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/plus_more.gif new file mode 100644 index 00000000..f10da648 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/plus_more.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/siprp_logo.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/siprp_logo.gif new file mode 100644 index 00000000..9c64e995 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/siprp_logo.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/siprp_logo_mini.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/siprp_logo_mini.gif new file mode 100644 index 00000000..f24aa23f Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/images/siprp_logo_mini.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/pdfs/Ajuda.pdf b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/pdfs/Ajuda.pdf new file mode 100644 index 00000000..3adf0eee Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/pdfs/Ajuda.pdf differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/plus_more.gif b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/plus_more.gif new file mode 100644 index 00000000..f10da648 Binary files /dev/null and b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/plus_more.gif differ diff --git a/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/stylesheet.css b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/stylesheet.css new file mode 100644 index 00000000..e8a45dde --- /dev/null +++ b/branches/SIPRP/AnaliseAcidentesTrabalho/web/resources/stylesheet.css @@ -0,0 +1,204 @@ +/* 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; +} + +.gridColLeft5{ + text-align: left; + width: 5%; +} + +.gridColLeft10{ + text-align: left; + width: 10%; +} + +.gridColLeft15{ + text-align: left; + width: 15%; +} + +.gridColLeft20{ + text-align: left; + width: 20%; +} + +.gridColLeft25{ + text-align: left; + width: 25%; +} + +.gridColLeft30{ + text-align: left; + width: 30%; +} + +.gridColLeft50{ + text-align: left; + width: 50%; +} + +.gridColLeft70{ + text-align: left; + width: 70%; +} + +.gridColLeft75{ + text-align: left; + width: 75%; +} + +.gridColLeft85{ + text-align: left; + width: 85%; +} + +.gridColLeft90{ + text-align: left; + width: 90%; +} + +.gridColLeft95{ + text-align: left; + width: 95%; +} + +.gridColRight85{ + text-align: right; + width: 85%; +} + +.gridBlockHeader{ + background-color : #668597; + text-align: left; +} + +.restricoes{ + border-spacing: 0; + padding: 0px; +} + +.assinaturas{ + border-spacing: 0; + padding: 0px; +} +.gridColRestricoes{ + border_bottom: solid 1px #000000; +} + +.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: 95%; + width: 100% +} + +.centerBlock{ + text-align: center; + left: 0; + right: 0; + margin-left: auto; + margin-right: auto;} + +.labelBold{ + font-weight : bold; +} + +.labelMsg{ + font-weight : bold; + color: #cc0033; + font-size :14px ; +} +.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; +} + +.labelCSS{ + font-weight : bold; +} + + + +.show{ + display : inline; +} + +.hide{ + display : none ; +} + +.lnkRed{ + color : #990000 ; +} diff --git a/branches/SIPRP/GestaoSHST/.classpath b/branches/SIPRP/GestaoSHST/.classpath new file mode 100644 index 00000000..73ab0ad6 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/branches/SIPRP/GestaoSHST/.project b/branches/SIPRP/GestaoSHST/.project new file mode 100644 index 00000000..4d26bbe6 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/.project @@ -0,0 +1,29 @@ + + + GestaoSHST + + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.google.gwt.eclipse.core.gwtProjectValidator + + + + + com.google.gdt.eclipse.core.webAppProjectValidator + + + + + + org.eclipse.jdt.core.javanature + com.google.gwt.eclipse.core.gwtNature + com.google.gdt.eclipse.core.webAppNature + + diff --git a/branches/SIPRP/GestaoSHST/.settings/com.google.gwt.eclipse.core.prefs b/branches/SIPRP/GestaoSHST/.settings/com.google.gwt.eclipse.core.prefs new file mode 100644 index 00000000..310e537d --- /dev/null +++ b/branches/SIPRP/GestaoSHST/.settings/com.google.gwt.eclipse.core.prefs @@ -0,0 +1,3 @@ +#Fri Dec 11 10:46:39 WET 2009 +eclipse.preferences.version=1 +filesCopiedToWebInfLib=gwt-servlet.jar diff --git a/branches/SIPRP/GestaoSHST/lib/evolute.jar b/branches/SIPRP/GestaoSHST/lib/evolute.jar new file mode 100644 index 00000000..52b2c276 Binary files /dev/null and b/branches/SIPRP/GestaoSHST/lib/evolute.jar differ diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/GestaoSHST.gwt.xml b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/GestaoSHST.gwt.xml new file mode 100644 index 00000000..10faca4b --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/GestaoSHST.gwt.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/GestaoSHST.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/GestaoSHST.java new file mode 100644 index 00000000..8cee9e5c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/GestaoSHST.java @@ -0,0 +1,51 @@ +package com.evolute.siprp.client; + +import com.evolute.siprp.client.panels.footer.FooterPanel; +import com.evolute.siprp.client.panels.utils.navigation.NavigationConstants; +import com.evolute.siprp.client.panels.utils.navigation.PageNavigation; +import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.event.logical.shared.ValueChangeEvent; +import com.google.gwt.event.logical.shared.ValueChangeHandler; +import com.google.gwt.user.client.History; +import com.google.gwt.user.client.ui.RootPanel; + + + +public class GestaoSHST implements EntryPoint, ValueChangeHandler< String > +{ + + private String oldEvent = null; + + public void onModuleLoad() + { + PageNavigation.goPage( NavigationConstants.LOGIN_PANEL ); + + RootPanel.get( "footer" ).add( new FooterPanel() ); + + History.addValueChangeHandler( this ); + History.fireCurrentHistoryState(); + } + + @Override + public void onValueChange( ValueChangeEvent< String > newEvent ) + { + if ( oldEvent != null && newEvent.getValue().equals( oldEvent ) ) + { + return ; + } + + oldEvent = newEvent.getValue(); + Integer panelID = null; + try + { + panelID = Integer.parseInt( oldEvent ); + } + catch ( Exception e ) + { + return ; + } + + PageNavigation.goPage( panelID ); + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoPanel.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoPanel.java new file mode 100644 index 00000000..c5bd0fe2 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoPanel.java @@ -0,0 +1,109 @@ +package com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho; + +import com.evolute.siprp.client.panels.apps.AnchorSair; +import com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.actual.ActualPanel; +import com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.concluido.ConcluidoPanel; +import com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.seguimento.SeguimentoPanel; +import com.evolute.siprp.client.panels.utils.AppConstants; +import com.evolute.siprp.client.panels.utils.navigation.PageNavigation; +import com.evolute.siprp.client.panels.utils.permissoes.AccessConstants; +import com.evolute.siprp.client.panels.utils.permissoes.PermissionsController; +import com.evolute.siprp.client.vo.Utilizador; +import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.uibinder.client.UiHandler; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.ui.Anchor; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.Image; +import com.google.gwt.user.client.ui.InlineLabel; +import com.google.gwt.user.client.ui.Widget; + +public class AnaliseAcidentesTrabalhoPanel extends Composite +{ + + private static AnaliseAcidentesTrabalhoPanelUiBinder uiBinder = GWT.create( AnaliseAcidentesTrabalhoPanelUiBinder.class ); + interface AnaliseAcidentesTrabalhoPanelUiBinder extends UiBinder< Widget, AnaliseAcidentesTrabalhoPanel > { } + + + @UiField protected Image imgSiprp; + @UiField protected Image imgAuchan; + @UiField protected AnchorSair lnkSair; + @UiField protected Anchor lnkPlanosActuacao; + @UiField protected InlineLabel lblUsername; + + @UiField protected Anchor lnkGerirUtilizadores; + @UiField protected Anchor lnkAlterarDados; + @UiField protected Anchor lnkAjuda; + + @UiField protected ActualPanel panelActual; + @UiField protected SeguimentoPanel panelSeguimento; + @UiField protected ConcluidoPanel panelConcluido; + + + private Utilizador userLogged; + private PermissionsController permsController; + + + public AnaliseAcidentesTrabalhoPanel() + { + initWidget( uiBinder.createAndBindUi( this ) ); + permsController = PermissionsController.getController(); + + if ( ! permsController.hasPermissionTo( AccessConstants.VIEW_ACTUAL_PANEL ) ) + { + this.panelActual.setVisible( false ); + } + if ( ! permsController.hasPermissionTo( AccessConstants.VIEW_SEGUIMENTO_PANEL ) ) + { + this.panelSeguimento.setVisible( false ); + } + if ( ! permsController.hasPermissionTo( AccessConstants.VIEW_CONCLUIDO_PANEL ) ) + { + this.panelConcluido.setVisible( false ); + } + + initComponents(); + } + + private void initComponents() + { + userLogged = PageNavigation.getProvider().getUserLogged(); + lblUsername.setText( userLogged.getUsername() ); + + imgSiprp.setTitle( "SIPRP" ); + imgSiprp.setUrl( AppConstants.IMAGES_FOLDER + "SIPRP_logo_small.jpg" ); + imgAuchan.setTitle( "Auchan" ); + imgAuchan.setUrl( AppConstants.IMAGES_FOLDER + "logo_empresa32.jpg" ); + imgAuchan.setHeight( "40" ); + + lnkPlanosActuacao.setText( "planos actua\u00E7\u00E3o>>" ); + lnkGerirUtilizadores.setText( "gerir utilizadores" ); + lnkAlterarDados.setText( "alterar dados utilizador" ); + lnkAjuda.setText( "ajuda" ); + } + + @UiHandler( { "lnkPlanosActuacao", "lnkGerirUtilizadores", "lnkAlterarDados", "lnkAjuda" } ) + protected void onClick( ClickEvent e ) + { + if ( e.getSource().equals( lnkPlanosActuacao ) ) + { + Window.alert( "planos actuacao..." ); + } + else if ( e.getSource().equals( lnkGerirUtilizadores ) ) + { + Window.alert( "gerir utilizadores" ); + } + else if ( e.getSource().equals( lnkAlterarDados ) ) + { + Window.alert( "alterar dados" ); + } + else if ( e.getSource().equals( lnkAjuda ) ) + { + Window.alert( "ajuda" ); + } + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoPanel.ui.xml b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoPanel.ui.xml new file mode 100644 index 00000000..eef8203c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoPanel.ui.xml @@ -0,0 +1,70 @@ + + + + +.headerDiv { + width: 100%; + margin-top: 75px; +} + +.headerTable { + width: 100%; + border-bottom: 1px solid #000000; +} + +.bodyDiv { + margin-top: 10px; + + width: 100%; + border: 1px solid black; + background-color: rgb( 238, 238, 238 ); +} +.verticalSpacer { + margin-top: 20px; +} + +.lblUsername { + margin-right: 30px; +} + + + + +
+ +
+ + + + + + + + +
+ +
+ + + | + | + | +
+
+ + +
+ + + + +
+ +
+
\ No newline at end of file diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoService.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoService.java new file mode 100644 index 00000000..67ea4531 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoService.java @@ -0,0 +1,16 @@ +package com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho; + +import java.util.Vector; + +import com.evolute.siprp.client.vo.ActualTableRow; +import com.evolute.siprp.client.vo.Utilizador; +import com.google.gwt.user.client.rpc.RemoteService; + +public interface AnaliseAcidentesTrabalhoService extends RemoteService +{ + + public Vector< ActualTableRow > getActualTableData( Utilizador userLogged ); + + public Vector< ActualTableRow > getSeguimentoTableData( Utilizador userLogged ); + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoServiceAsync.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoServiceAsync.java new file mode 100644 index 00000000..fb8094d2 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoServiceAsync.java @@ -0,0 +1,16 @@ +package com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho; + +import java.util.Vector; + +import com.evolute.siprp.client.vo.ActualTableRow; +import com.evolute.siprp.client.vo.Utilizador; +import com.google.gwt.user.client.rpc.AsyncCallback; + +public interface AnaliseAcidentesTrabalhoServiceAsync +{ + + public void getActualTableData( Utilizador userLogged, AsyncCallback< Vector< ActualTableRow > > callback ); + + public void getSeguimentoTableData( Utilizador userLogged, AsyncCallback< Vector< ActualTableRow > > callback ); + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/actual/ActualPanel.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/actual/ActualPanel.java new file mode 100644 index 00000000..318fa53a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/actual/ActualPanel.java @@ -0,0 +1,65 @@ +package com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.actual; + +import com.evolute.siprp.client.panels.utils.permissoes.AccessConstants; +import com.evolute.siprp.client.panels.utils.permissoes.PermissionsController; +import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.uibinder.client.UiHandler; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.SimplePanel; +import com.google.gwt.user.client.ui.Widget; + +public class ActualPanel extends Composite +{ + + private static ActualPanelUiBinder uiBinder = GWT.create( ActualPanelUiBinder.class ); + interface ActualPanelUiBinder extends UiBinder< Widget, ActualPanel > { } + + private PermissionsController permsController; + + + @UiField protected Button btnNewAnalysis; + @UiField protected ActualTable tableActual; + + + public ActualPanel() + { + permsController = PermissionsController.getController(); + if ( permsController.hasPermissionTo( AccessConstants.VIEW_ACTUAL_PANEL ) ) + { + setupComponents(); + } + else + { + initWidget( new SimplePanel() ); + } + } + + + private void setupComponents() + { + initWidget( uiBinder.createAndBindUi( this ) ); + + btnNewAnalysis.setText( "Criar nova an\u00E1lise de acidentes de trabalho" ); + if ( ! permsController.hasPermissionTo( AccessConstants.VIEW_ACTUAL_PANEL_NOVA_ANALISE_BUTTON ) ) + { + btnNewAnalysis.setVisible( false ); + } + } + + + @UiHandler( { "btnNewAnalysis" } ) + protected void onClick( ClickEvent e ) + { + if ( e.getSource().equals( btnNewAnalysis ) ) + { + Window.alert( "new analysis" ); + } + + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/actual/ActualPanel.ui.xml b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/actual/ActualPanel.ui.xml new file mode 100644 index 00000000..8f9c3b1b --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/actual/ActualPanel.ui.xml @@ -0,0 +1,50 @@ + + + + +.bodyDiv { + margin-top: 20px; + + width: 100%; + border: 1px solid black; + background-color: rgb( 238, 238, 238 ); +} + +.divActual { + margin-top: 15px; +} + +.btnNewAnalysis { + width: 80%; + height: 30px; +} + +.actualTable { + width: 816px; + margin-top: 10px; + margin-bottom: 15px; + background-color: #FFFFFF; + border: 1px solid #000000; +} + + + + +
+
Actual
+
+ +
+
+ +
+
Processos com dados pendentes
+ +
+
+ +
+
\ No newline at end of file diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/actual/ActualTable.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/actual/ActualTable.java new file mode 100644 index 00000000..b91e6b62 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/actual/ActualTable.java @@ -0,0 +1,88 @@ +package com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.actual; + +import java.util.Vector; + +import com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.AnaliseAcidentesTrabalhoService; +import com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.AnaliseAcidentesTrabalhoServiceAsync; +import com.evolute.siprp.client.panels.utils.navigation.PageNavigation; +import com.evolute.siprp.client.vo.ActualTableRow; +import com.google.gwt.core.client.GWT; +import com.google.gwt.i18n.client.DateTimeFormat; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.rpc.ServiceDefTarget; +import com.google.gwt.user.client.ui.FlexTable; + +public class ActualTable extends FlexTable +{ + private final DateTimeFormat D_F = DateTimeFormat.getFormat( "yyyy-MM-dd" ); + + private AnaliseAcidentesTrabalhoServiceAsync aatService; + + public ActualTable() + { + super(); + + this.aatService = ( AnaliseAcidentesTrabalhoServiceAsync ) GWT.create( AnaliseAcidentesTrabalhoService.class ); + ServiceDefTarget serviceDef = ( ServiceDefTarget ) this.aatService; + serviceDef.setServiceEntryPoint( GWT.getModuleBaseURL() + "aatService" ); + + + this.setText( 0, 0, "Data do acidente" ); + this.setText( 0, 1, "Data da abertura" ); + this.setText( 0, 2, "Nº acidente" ); + this.setText( 0, 3, "POR" ); + this.setText( 0, 4, "Nome do acidentado" ); + this.setText( 0, 5, "Fase" ); + + CellFormatter cellFormatter = this.getCellFormatter(); + cellFormatter.setStyleName( 0, 0, "lblBold" ); + cellFormatter.setStyleName( 0, 1, "lblBold" ); + cellFormatter.setStyleName( 0, 2, "lblBold" ); + cellFormatter.setStyleName( 0, 3, "lblBold" ); + cellFormatter.setStyleName( 0, 4, "lblBold" ); + cellFormatter.setStyleName( 0, 5, "lblBold" ); + + this.setText( 1, 0, "loading ..." ); + this.getFlexCellFormatter().setColSpan( 1, 0, 6 ); + + this.aatService.getActualTableData( PageNavigation.getProvider().getUserLogged(), new AsyncCallback< Vector< ActualTableRow > >() { + @Override + public void onFailure( Throwable caught ) + { + Window.alert( "Oops ! unable to fetch 'Actual' table data." ); + } + + @Override + public void onSuccess( Vector< ActualTableRow > result ) + { + showTableData( result ); + } + }); + } + + private void showTableData( Vector< ActualTableRow > tableRows ) + { + if ( tableRows == null || tableRows.size() == 0 ) + { + this.setText( 1, 0, "No items found." ); + } + else + { + this.getFlexCellFormatter().setColSpan( 1, 0, 0 ); + + for ( int rowNumber = 0, columnNumber = 0; rowNumber < tableRows.size(); rowNumber++, columnNumber = 0 ) + { + ActualTableRow row = tableRows.get( rowNumber ); + + this.setText( (rowNumber+1), columnNumber++, D_F.format( row.getDataAcidente() ) ); + this.setText( (rowNumber+1), columnNumber++, D_F.format( row.getDataAbertura() ) ); + this.setText( (rowNumber+1), columnNumber++, row.getNrAcidente() ); + this.setText( (rowNumber+1), columnNumber++, row.getPOR() ); + this.setText( (rowNumber+1), columnNumber++, row.getNomeAcidentado() ); + this.setText( (rowNumber+1), columnNumber++, String.valueOf( row.getFase() ) ); + } + } + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/concluido/ConcluidoPanel.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/concluido/ConcluidoPanel.java new file mode 100644 index 00000000..bd0e1b13 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/concluido/ConcluidoPanel.java @@ -0,0 +1,38 @@ +package com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.concluido; + +import com.evolute.siprp.client.panels.utils.permissoes.AccessConstants; +import com.evolute.siprp.client.panels.utils.permissoes.PermissionsController; +import com.google.gwt.core.client.GWT; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.SimplePanel; +import com.google.gwt.user.client.ui.Widget; + +public class ConcluidoPanel extends Composite { + + private static ConcluidoPanelUiBinder uiBinder = GWT.create( ConcluidoPanelUiBinder.class ); + interface ConcluidoPanelUiBinder extends UiBinder< Widget, ConcluidoPanel > { } + + private PermissionsController permsController; + + + public ConcluidoPanel() + { + permsController = PermissionsController.getController(); + if ( permsController.hasPermissionTo( AccessConstants.VIEW_CONCLUIDO_PANEL ) ) + { + setupComponents(); + } + else + { + initWidget( new SimplePanel() ); + } + } + + private void setupComponents() + { + initWidget( uiBinder.createAndBindUi( this ) ); + + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/concluido/ConcluidoPanel.ui.xml b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/concluido/ConcluidoPanel.ui.xml new file mode 100644 index 00000000..e0194ce6 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/concluido/ConcluidoPanel.ui.xml @@ -0,0 +1,28 @@ + + + + +.bodyDiv { + margin-top: 10px; + + width: 100%; + border: 1px solid black; + background-color: rgb( 238, 238, 238 ); +} + +.divConcluido { + margin-top: 15px; +} + + + + +
+
Conclu\u00EDdos
+ + table +
+ +
+
\ No newline at end of file diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/seguimento/SeguimentoPanel.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/seguimento/SeguimentoPanel.java new file mode 100644 index 00000000..536cf4ae --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/seguimento/SeguimentoPanel.java @@ -0,0 +1,42 @@ +package com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.seguimento; + +import com.evolute.siprp.client.panels.utils.permissoes.AccessConstants; +import com.evolute.siprp.client.panels.utils.permissoes.PermissionsController; +import com.google.gwt.core.client.GWT; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.SimplePanel; +import com.google.gwt.user.client.ui.Widget; + +public class SeguimentoPanel extends Composite { + + private static SeguimentoPanelUiBinder uiBinder = GWT.create( SeguimentoPanelUiBinder.class ); + interface SeguimentoPanelUiBinder extends UiBinder< Widget, SeguimentoPanel > { } + + private PermissionsController permsController; + + @UiField protected SeguimentoTable tableSeguimento; + + + public SeguimentoPanel() + { + permsController = PermissionsController.getController(); + if ( permsController.hasPermissionTo( AccessConstants.VIEW_SEGUIMENTO_PANEL ) ) + { + setupComponents(); + } + else + { + initWidget( new SimplePanel() ); + } + } + + private void setupComponents() + { + initWidget( uiBinder.createAndBindUi( this ) ); + + + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/seguimento/SeguimentoPanel.ui.xml b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/seguimento/SeguimentoPanel.ui.xml new file mode 100644 index 00000000..69a7ffdf --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/seguimento/SeguimentoPanel.ui.xml @@ -0,0 +1,39 @@ + + + + +.bodyDiv { + margin-top: 20px; + + width: 100%; + border: 1px solid black; + background-color: rgb( 238, 238, 238 ); +} + +.divSeguimento { + margin-top: 15px; +} + +.seguimentoTable { + width: 816px; + margin-top: 10px; + margin-bottom: 15px; +} + + + + +
+
Em seguimento
+
+ +
+ +
+
+ +
+
\ No newline at end of file diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/seguimento/SeguimentoTable.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/seguimento/SeguimentoTable.java new file mode 100644 index 00000000..7627d845 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnaliseAcidentesTrabalho/seguimento/SeguimentoTable.java @@ -0,0 +1,88 @@ +package com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.seguimento; + +import java.util.Vector; + +import com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.AnaliseAcidentesTrabalhoService; +import com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.AnaliseAcidentesTrabalhoServiceAsync; +import com.evolute.siprp.client.panels.utils.navigation.PageNavigation; +import com.evolute.siprp.client.vo.ActualTableRow; +import com.google.gwt.core.client.GWT; +import com.google.gwt.i18n.client.DateTimeFormat; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.rpc.ServiceDefTarget; +import com.google.gwt.user.client.ui.FlexTable; + +public class SeguimentoTable extends FlexTable +{ + private final DateTimeFormat D_F = DateTimeFormat.getFormat( "yyyy-MM-dd" ); + + private AnaliseAcidentesTrabalhoServiceAsync aatService; + + public SeguimentoTable() + { + super(); + + this.aatService = ( AnaliseAcidentesTrabalhoServiceAsync ) GWT.create( AnaliseAcidentesTrabalhoService.class ); + ServiceDefTarget serviceDef = ( ServiceDefTarget ) this.aatService; + serviceDef.setServiceEntryPoint( GWT.getModuleBaseURL() + "aatService" ); + + this.setText( 0, 0, "Data do acidente" ); + this.setText( 0, 1, "Data da abertura" ); + this.setText( 0, 2, "Nº acidente" ); + this.setText( 0, 3, "POR" ); + this.setText( 0, 4, "Nome do acidentado" ); + this.setText( 0, 5, "Fase" ); + + CellFormatter cellFormatter = this.getCellFormatter(); + cellFormatter.setStyleName( 0, 0, "lblBold" ); + cellFormatter.setStyleName( 0, 1, "lblBold" ); + cellFormatter.setStyleName( 0, 2, "lblBold" ); + cellFormatter.setStyleName( 0, 3, "lblBold" ); + cellFormatter.setStyleName( 0, 4, "lblBold" ); + cellFormatter.setStyleName( 0, 5, "lblBold" ); + + this.setText( 1, 0, "loading ..." ); + this.getFlexCellFormatter().setColSpan( 1, 0, 6 ); + + this.aatService.getSeguimentoTableData( PageNavigation.getProvider().getUserLogged(), new AsyncCallback< Vector< ActualTableRow > >() { + @Override + public void onFailure( Throwable caught ) + { + Window.alert( "Oops ! unable to fetch 'Actual' table data." ); + } + + @Override + public void onSuccess( Vector< ActualTableRow > result ) + { + showTableData( result ); + } + }); + } + + + private void showTableData( Vector< ActualTableRow > tableRows ) + { + if ( tableRows == null || tableRows.size() == 0 ) + { + this.setText( 1, 0, "No items found." ); + } + else + { + this.getFlexCellFormatter().setColSpan( 1, 0, 0 ); + + for ( int rowNumber = 0, columnNumber = 0; rowNumber < tableRows.size(); rowNumber++, columnNumber = 0 ) + { + ActualTableRow row = tableRows.get( rowNumber ); + + this.setText( (rowNumber+1), columnNumber++, D_F.format( row.getDataAcidente() ) ); + this.setText( (rowNumber+1), columnNumber++, D_F.format( row.getDataAbertura() ) ); + this.setText( (rowNumber+1), columnNumber++, row.getNrAcidente() ); + this.setText( (rowNumber+1), columnNumber++, row.getPOR() ); + this.setText( (rowNumber+1), columnNumber++, row.getNomeAcidentado() ); + this.setText( (rowNumber+1), columnNumber++, String.valueOf( row.getFase() ) ); + } + } + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnchorSair.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnchorSair.java new file mode 100644 index 00000000..46afd9f4 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/AnchorSair.java @@ -0,0 +1,28 @@ +package com.evolute.siprp.client.panels.apps; + +import com.evolute.siprp.client.panels.utils.navigation.NavigationConstants; +import com.evolute.siprp.client.panels.utils.navigation.PageNavigation; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.user.client.ui.Anchor; + +public class AnchorSair extends Anchor implements ClickHandler +{ + + public AnchorSair() + { + super(); + + this.setText( "sair>>" ); + this.addClickHandler( this ); + } + + @Override + public void onClick( ClickEvent event ) + { + PageNavigation.getProvider().setUserLogged( null ); + PageNavigation.getProvider().clearCache(); + PageNavigation.goPage( NavigationConstants.LOGIN_PANEL ); + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/MainPanel.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/MainPanel.java new file mode 100644 index 00000000..7bd28577 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/MainPanel.java @@ -0,0 +1,69 @@ +package com.evolute.siprp.client.panels.apps; + +import com.evolute.siprp.client.panels.utils.AppConstants; +import com.evolute.siprp.client.panels.utils.navigation.NavigationConstants; +import com.evolute.siprp.client.panels.utils.navigation.PageNavigation; +import com.evolute.siprp.client.vo.Utilizador; +import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.uibinder.client.UiHandler; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.ui.Anchor; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.Image; +import com.google.gwt.user.client.ui.InlineLabel; +import com.google.gwt.user.client.ui.Widget; + +public class MainPanel extends Composite +{ + + private static MainPanelUiBinder uiBinder = GWT.create( MainPanelUiBinder.class ); + interface MainPanelUiBinder extends UiBinder< Widget, MainPanel > { } + + @UiField protected InlineLabel lblUsername; + @UiField protected InlineLabel lblName; + @UiField protected AnchorSair lnkSair; + @UiField protected Anchor lnkAnaliseAcidentesTrabalho; + @UiField protected Anchor lnkPlanosActuacao; + @UiField protected Image imgSiprp; + @UiField protected Image imgAuchan; + + private Utilizador userLogged; + + public MainPanel() + { + initWidget( uiBinder.createAndBindUi( this ) ); + + userLogged = PageNavigation.getProvider().getUserLogged(); + + lblUsername.setText( userLogged.getUsername() ); + + imgSiprp.setTitle( "SIPRP" ); + imgSiprp.setUrl( AppConstants.IMAGES_FOLDER + "SIPRP_logo_small.jpg" ); + imgAuchan.setTitle( "Auchan" ); + imgAuchan.setUrl( AppConstants.IMAGES_FOLDER + "logo_empresa32.jpg" ); + imgAuchan.setHeight( "40" ); + + lblName.setText( userLogged.getNome() ); + lnkAnaliseAcidentesTrabalho.setText( "An\u00E1lise de Acidentes de Trabalho" ); + lnkPlanosActuacao.setText( "Planos de Actua\u00E7\u00E3o" ); + } + + + @UiHandler( { "lnkAnaliseAcidentesTrabalho", "lnkPlanosActuacao" } ) + protected void onClick( ClickEvent e ) + { + if ( e.getSource().equals( lnkAnaliseAcidentesTrabalho ) ) + { + PageNavigation.goPage( NavigationConstants.ANALISE_ACIDENTES_TRABALHO_PANEL ); + } + else if ( e.getSource().equals( lnkPlanosActuacao ) ) + { + //TODO: + Window.alert( "TODO" ); + } + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/MainPanel.ui.xml b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/MainPanel.ui.xml new file mode 100644 index 00000000..244330b8 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/apps/MainPanel.ui.xml @@ -0,0 +1,71 @@ + + + + +.headerDiv { + width: 100%; + text-align: right; + margin-top: 75px; +} + +.bodyDiv { + margin-top: 75px; + + width: 100%; + border: 1px solid black; + background-color: rgb( 238, 238, 238 ); +} + +.logosDiv { + margin-top: 10px; +} + +.welcomeDiv { + margin-bottom: 50px; +} + +.linksDiv { + margin-top: 50px; + margin-bottom: 30px; +} + +.lblUsername { + margin-right: 30px; +} + + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ Bem vindo(a) +
+ + aceder a + +
+ + | + +
+ +
+ +
+ +
+
\ No newline at end of file diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/footer/FooterPanel.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/footer/FooterPanel.java new file mode 100644 index 00000000..1efff397 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/footer/FooterPanel.java @@ -0,0 +1,35 @@ +package com.evolute.siprp.client.panels.footer; + +import com.evolute.siprp.client.panels.utils.AppConstants; +import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.uibinder.client.UiHandler; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.Image; +import com.google.gwt.user.client.ui.Widget; + +public class FooterPanel extends Composite { + + private static FooterPanelUiBinder uiBinder = GWT.create( FooterPanelUiBinder.class ); + interface FooterPanelUiBinder extends UiBinder< Widget, FooterPanel > { } + + @UiField protected Image image; + + public FooterPanel() + { + initWidget( uiBinder.createAndBindUi( this ) ); + image.setUrl( AppConstants.IMAGES_FOLDER + "logo_evolute_small.png" ); + image.setTitle( "Evolute" ); + } + + + @UiHandler( "image" ) + protected void onClick( ClickEvent e ) + { + Window.Location.assign( "http://www.evolute.pt" ); + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/footer/FooterPanel.ui.xml b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/footer/FooterPanel.ui.xml new file mode 100644 index 00000000..2d623252 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/footer/FooterPanel.ui.xml @@ -0,0 +1,20 @@ + + + + .footer { + margin-top: 50px; + text-align: center; + } + .borderBottom { + border-bottom: 1px solid #FFFFFF; + } + + + +
+ Software desenvolvido por © 2009 +
+ +
+
\ No newline at end of file diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/login/LoginPanel.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/login/LoginPanel.java new file mode 100644 index 00000000..49933ca3 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/login/LoginPanel.java @@ -0,0 +1,123 @@ +package com.evolute.siprp.client.panels.index.login; + +import com.evolute.siprp.client.panels.utils.dialog.CDialogBox; +import com.evolute.siprp.client.panels.utils.navigation.NavigationConstants; +import com.evolute.siprp.client.panels.utils.navigation.PageNavigation; +import com.evolute.siprp.client.vo.Utilizador; +import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.event.dom.client.KeyUpEvent; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.uibinder.client.UiHandler; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.rpc.ServiceDefTarget; +import com.google.gwt.user.client.ui.Anchor; +import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.PasswordTextBox; +import com.google.gwt.user.client.ui.TextBox; +import com.google.gwt.user.client.ui.Widget; + +public class LoginPanel extends Composite +{ + + private static LoginPanelUiBinder uiBinder = GWT.create( LoginPanelUiBinder.class ); + interface LoginPanelUiBinder extends UiBinder< Widget, LoginPanel > { } + + @UiField protected TextBox txtUsername; + @UiField protected PasswordTextBox txtPassword; + @UiField protected Anchor lnkRecoverPwd; + @UiField protected Button btnLogin; + + private LoginServiceAsync loginService; + + + public LoginPanel() + { + initWidget( uiBinder.createAndBindUi( this ) ); + + this.loginService = ( LoginServiceAsync ) GWT.create( LoginService.class ); + ServiceDefTarget serviceDef = ( ServiceDefTarget ) this.loginService; + serviceDef.setServiceEntryPoint( GWT.getModuleBaseURL() + "loginService" ); + + lnkRecoverPwd.setText( "Recuperar palavra-chave" ); + btnLogin.setText( "Entrar" ); + } + + @UiHandler( {"btnLogin", "lnkRecoverPwd"} ) + protected void onClick( ClickEvent e ) + { + if ( e.getSource().equals( btnLogin ) ) + { + doLogin(); + } + else if ( e.getSource().equals( lnkRecoverPwd ) ) + { + gotoRecoverPwd(); + } + } + + @UiHandler( {"txtPassword", "txtUsername"} ) + protected void onKeyUp( KeyUpEvent e ) + { + if ( e.getNativeKeyCode() == KeyCodes.KEY_ENTER ) + { + doLogin(); + } + } + + private void doLogin() + { + String userName = txtUsername.getText().trim(); + String passwd = txtPassword.getText().trim(); + + if ( ! userName.equals( "" ) ) + { + if ( ! passwd.equals( "" ) ) + { + loginService.doLogin( txtUsername.getText(), txtPassword.getText(), new AsyncCallback< Utilizador >() { + @Override + public void onFailure( Throwable caught ) + { + Window.alert( "Oops ! Unable to perform login." ); + } + + @Override + public void onSuccess( Utilizador result ) + { + if ( result == null ) + { + CDialogBox box = new CDialogBox( "Dados inv\u00E1lidos", new String[] { "Utilizador e/ou palavra-chave incorrectos." } ); + box.center(); + } + else + { + PageNavigation.getProvider().setUserLogged( result ); + PageNavigation.goPage( NavigationConstants.APP_MAIN_PANEL ); + } + } + }); + } + else + { + CDialogBox box = new CDialogBox( "Erro ...", new String[] { "Tem de introduzir uma palavra-chave." } ); + box.center(); + } + } + else + { + CDialogBox box = new CDialogBox( "Erro ...", new String[] { "Tem de introduzir um nome de utilizador." } ); + box.center(); + } + } + + + private void gotoRecoverPwd() + { + PageNavigation.goPage( NavigationConstants.RECOVER_PWD_PANEL ); + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/login/LoginPanel.ui.xml b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/login/LoginPanel.ui.xml new file mode 100644 index 00000000..a55a0fbb --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/login/LoginPanel.ui.xml @@ -0,0 +1,34 @@ + + + + + +.loginBox { + height: 34px; +} + + + + + +
+ + + + + + + + + + + + + +
Utilizador:
Palavra-chave:
+
+ +
+
\ No newline at end of file diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/login/LoginService.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/login/LoginService.java new file mode 100644 index 00000000..22dc10a0 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/login/LoginService.java @@ -0,0 +1,9 @@ +package com.evolute.siprp.client.panels.index.login; + +import com.evolute.siprp.client.vo.Utilizador; +import com.google.gwt.user.client.rpc.RemoteService; + +public interface LoginService extends RemoteService +{ + public Utilizador doLogin( String username, String password ); +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/login/LoginServiceAsync.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/login/LoginServiceAsync.java new file mode 100644 index 00000000..25458646 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/login/LoginServiceAsync.java @@ -0,0 +1,9 @@ +package com.evolute.siprp.client.panels.index.login; + +import com.evolute.siprp.client.vo.Utilizador; +import com.google.gwt.user.client.rpc.AsyncCallback; + +public interface LoginServiceAsync +{ + public void doLogin( String username, String password, AsyncCallback< Utilizador > callback ); +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/recover_pwd/RecoverPwdPanel.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/recover_pwd/RecoverPwdPanel.java new file mode 100644 index 00000000..f9553154 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/recover_pwd/RecoverPwdPanel.java @@ -0,0 +1,72 @@ +package com.evolute.siprp.client.panels.index.recover_pwd; + +import com.evolute.siprp.client.panels.utils.navigation.NavigationConstants; +import com.evolute.siprp.client.panels.utils.navigation.PageNavigation; +import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.uibinder.client.UiHandler; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.rpc.ServiceDefTarget; +import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.TextBox; +import com.google.gwt.user.client.ui.Widget; + +public class RecoverPwdPanel extends Composite +{ + + private static RecoverPwdPanelUiBinder uiBinder = GWT.create( RecoverPwdPanelUiBinder.class ); + interface RecoverPwdPanelUiBinder extends UiBinder< Widget, RecoverPwdPanel > { } + + private RecoverServiceAsync recoverService; + + @UiField protected Button btnOK; + @UiField protected Button btnCancel; + @UiField protected TextBox txtUsername; + @UiField protected TextBox txtEmail; + + + public RecoverPwdPanel() + { + initWidget( uiBinder.createAndBindUi( this ) ); + + this.recoverService = ( RecoverServiceAsync ) GWT.create( RecoverService.class ); + ServiceDefTarget serviceDef = ( ServiceDefTarget ) this.recoverService; + serviceDef.setServiceEntryPoint( GWT.getModuleBaseURL() + "recoverService" ); + + btnOK.setText( "OK" ); + btnCancel.setText( "Cancelar" ); + } + + @UiHandler( {"btnOK", "btnCancel"} ) + protected void onClick( ClickEvent e ) + { + if ( e.getSource().equals( btnOK ) ) + { + String userName = txtUsername.getText().trim(); + String eMail = txtEmail.getText().trim(); + + this.recoverService.recoverPWD( userName, eMail, new AsyncCallback< String >() { + @Override + public void onFailure( Throwable caught ) + { + Window.alert( "Oops !" ); + } + + @Override + public void onSuccess( String result ) + { + Window.alert( result ); + } + }); + } + else if ( e.getSource().equals( btnCancel ) ) + { + PageNavigation.goPage( NavigationConstants.LOGIN_PANEL ); + } + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/recover_pwd/RecoverPwdPanel.ui.xml b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/recover_pwd/RecoverPwdPanel.ui.xml new file mode 100644 index 00000000..4346be9d --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/recover_pwd/RecoverPwdPanel.ui.xml @@ -0,0 +1,34 @@ + + + + + + + + + +
+ + + + + + + + + + + + + + + +
Preencha os seguintes dados pessoais
Utilizador:
E-mail:
+ + +
+
+ +
+
\ No newline at end of file diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/recover_pwd/RecoverService.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/recover_pwd/RecoverService.java new file mode 100644 index 00000000..c82136b4 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/recover_pwd/RecoverService.java @@ -0,0 +1,8 @@ +package com.evolute.siprp.client.panels.index.recover_pwd; + +import com.google.gwt.user.client.rpc.RemoteService; + +public interface RecoverService extends RemoteService +{ + public String recoverPWD( String username, String email ); +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/recover_pwd/RecoverServiceAsync.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/recover_pwd/RecoverServiceAsync.java new file mode 100644 index 00000000..30a8e897 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/index/recover_pwd/RecoverServiceAsync.java @@ -0,0 +1,8 @@ +package com.evolute.siprp.client.panels.index.recover_pwd; + +import com.google.gwt.user.client.rpc.AsyncCallback; + +public interface RecoverServiceAsync +{ + public void recoverPWD( String username, String email, AsyncCallback< String > callback ); +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/AppConstants.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/AppConstants.java new file mode 100644 index 00000000..fd3f40d7 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/AppConstants.java @@ -0,0 +1,24 @@ +package com.evolute.siprp.client.panels.utils; + +public interface AppConstants +{ + + public final String IMAGES_FOLDER = "gestaoshst/images/"; + + public final String MAIN_DIV = "main"; + + + public final static int ESTADO_SEG = 1; + public final static int ESTADO_RH1 = 2; + public final static int ESTADO_HS = 3; + public final static int ESTADO_RH2 = 4; + //public final static int ESTADO_MEDICINA = 5; + public final static int ESTADO_CONSOLIDACAO = 5; + //public final static int ESTADO_ASSINATURAS = 7; + public final static int ESTADO_ASSINATURA_SEG = 6; + public final static int ESTADO_ASSINATURA_RH = 7; + //public final static int ESTADO_IMPRESSAO = 8; + public final static int ESTADO_FECHAR = 8; + public final static int ESTADO_CONCLUIDO = 9; + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/dialog/CDialogBox.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/dialog/CDialogBox.java new file mode 100644 index 00000000..0e392fbd --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/dialog/CDialogBox.java @@ -0,0 +1,55 @@ +package com.evolute.siprp.client.panels.utils.dialog; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiFactory; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.uibinder.client.UiHandler; +import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.ui.DialogBox; +import com.google.gwt.user.client.ui.Widget; + +public class CDialogBox extends DialogBox +{ + + private static CDialogBoxUiBinder uiBinder = GWT.create( CDialogBoxUiBinder.class ); + interface CDialogBoxUiBinder extends UiBinder< Widget, CDialogBox > { } + + @UiField Button btnClose; + @UiField ErrorMsgs msgs; + + private String[] errorMsgs; + + public CDialogBox( String[] errorMsg ) + { + this( "Erro ...", errorMsg ); + } + + public CDialogBox( String title, String[] errorMsg ) + { + this.errorMsgs = errorMsg; + setWidget( uiBinder.createAndBindUi( this ) ); + + this.setText( title ); + btnClose.setText( "Fechar" ); + + this.setAnimationEnabled( true ); + this.setGlassEnabled( true ); + + this.setAutoHideEnabled( true ); + btnClose.setFocus( true ); + } + + @UiFactory ErrorMsgs makeErrorMsgs() + { + return new ErrorMsgs( errorMsgs ); + } + + @UiHandler( "btnClose" ) + void onClick( ClickEvent e ) + { + this.hide(); + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/dialog/CDialogBox.ui.xml b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/dialog/CDialogBox.ui.xml new file mode 100644 index 00000000..7e99279e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/dialog/CDialogBox.ui.xml @@ -0,0 +1,28 @@ + + + + + .lblError { + text-align: center; + margin-top: 30px; + margin-bottom: 30px; + } + + .btnClose { + float: right; + } + + + +
+ +
+
+ +
+ +
+
\ No newline at end of file diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/dialog/ErrorMsgs.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/dialog/ErrorMsgs.java new file mode 100644 index 00000000..cb49a82d --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/dialog/ErrorMsgs.java @@ -0,0 +1,29 @@ +package com.evolute.siprp.client.panels.utils.dialog; + +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.HTML; +import com.google.gwt.user.client.ui.HasHorizontalAlignment; +import com.google.gwt.user.client.ui.VerticalPanel; + +public class ErrorMsgs extends Composite +{ + private VerticalPanel panel; + private HTML[] msgElems; + + public ErrorMsgs( String[] msgs ) + { + super(); + + this.panel = new VerticalPanel(); + this.msgElems = new HTML[ msgs.length ]; + for ( int i = 0; i < msgs.length; i++ ) + { + this.msgElems[ i ] = new HTML( msgs[ i ] ); + this.panel.add( this.msgElems[ i ] ); + this.panel.setCellHorizontalAlignment( this.msgElems[ i ], HasHorizontalAlignment.ALIGN_LEFT ); + } + + this.initWidget( this.panel ); + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/navigation/NavigationConstants.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/navigation/NavigationConstants.java new file mode 100644 index 00000000..574d9248 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/navigation/NavigationConstants.java @@ -0,0 +1,11 @@ +package com.evolute.siprp.client.panels.utils.navigation; + +public interface NavigationConstants +{ + + public final int LOGIN_PANEL = 1; + public final int RECOVER_PWD_PANEL = 2; + public final int APP_MAIN_PANEL = 3; + public final int ANALISE_ACIDENTES_TRABALHO_PANEL = 4; + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/navigation/PageNavigation.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/navigation/PageNavigation.java new file mode 100644 index 00000000..27e18750 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/navigation/PageNavigation.java @@ -0,0 +1,164 @@ +package com.evolute.siprp.client.panels.utils.navigation; + +import java.util.HashMap; +import java.util.Map; + +import com.evolute.siprp.client.panels.apps.MainPanel; +import com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.AnaliseAcidentesTrabalhoPanel; +import com.evolute.siprp.client.panels.index.login.LoginPanel; +import com.evolute.siprp.client.panels.index.recover_pwd.RecoverPwdPanel; +import com.evolute.siprp.client.panels.utils.AppConstants; +import com.evolute.siprp.client.vo.Utilizador; +import com.google.gwt.user.client.History; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.RootPanel; + +public class PageNavigation +{ + private static PageNavigation instance = null; + + private RootPanel mainPanel; + private String containerID; + + private Map< Integer, Object > panelsCache; + + private Utilizador userLogged = null; + + + private PageNavigation() + { + this.containerID = AppConstants.MAIN_DIV; + + mainPanel = RootPanel.get( this.containerID ); + panelsCache = new HashMap< Integer, Object >(); + } + + + public static PageNavigation getProvider() + { + if ( instance == null ) + { + instance = new PageNavigation(); + } + return instance; + } + + + public static void goPage( Integer pageID ) + { + PageNavigation.getProvider().gotoPage( pageID ); + } + + + /** + * usado quando se faz logout ... + * manter login panel e recover se existir ... + */ + public void clearCache() + { + Map< Integer, Object > newCache = new HashMap< Integer, Object >(); + + if ( panelsCache.containsKey( NavigationConstants.LOGIN_PANEL ) ) + { + newCache.put( NavigationConstants.LOGIN_PANEL, panelsCache.get( NavigationConstants.LOGIN_PANEL ) ); + } +// if ( panelsCache.containsKey( NavigationConstants.RECOVER_PWD_PANEL ) ) +// { +// newCache.put( NavigationConstants.RECOVER_PWD_PANEL, panelsCache.get( NavigationConstants.RECOVER_PWD_PANEL ) ); +// } + + panelsCache = newCache; + } + + + public void gotoPage( Composite newWindow ) + { + if ( newWindow != null ) + { + mainPanel.clear(); + mainPanel.add( newWindow ); + } + } + + + public void gotoPage( Integer pageID ) + { + switch ( pageID.intValue() ) + { + case NavigationConstants.LOGIN_PANEL: + { + if ( ! panelsCache.containsKey( NavigationConstants.LOGIN_PANEL ) ) + { + panelsCache.put( NavigationConstants.LOGIN_PANEL, new LoginPanel() ); + } + gotoPage( ( LoginPanel ) panelsCache.get( NavigationConstants.LOGIN_PANEL ) ); + History.newItem( String.valueOf( NavigationConstants.LOGIN_PANEL ) ); + break; + } + case NavigationConstants.RECOVER_PWD_PANEL: + { + if ( ! panelsCache.containsKey( NavigationConstants.RECOVER_PWD_PANEL ) ) + { + panelsCache.put( NavigationConstants.RECOVER_PWD_PANEL, new RecoverPwdPanel() ); + } + gotoPage( ( RecoverPwdPanel ) panelsCache.get( NavigationConstants.RECOVER_PWD_PANEL ) ); + History.newItem( String.valueOf( NavigationConstants.RECOVER_PWD_PANEL ) ); + break; + } + case NavigationConstants.APP_MAIN_PANEL: + { + if ( ! isLoggedIn() ) + { + gotoPage( NavigationConstants.LOGIN_PANEL ); + break; + } + + if ( ! panelsCache.containsKey( NavigationConstants.APP_MAIN_PANEL ) ) + { + panelsCache.put( NavigationConstants.APP_MAIN_PANEL, new MainPanel() ); + } + gotoPage( ( MainPanel ) panelsCache.get( NavigationConstants.APP_MAIN_PANEL) ); + History.newItem( String.valueOf( NavigationConstants.APP_MAIN_PANEL ) ); + break; + } + case NavigationConstants.ANALISE_ACIDENTES_TRABALHO_PANEL: + { + if ( ! isLoggedIn() ) + { + gotoPage( NavigationConstants.LOGIN_PANEL ); + break; + } + + if ( ! panelsCache.containsKey( NavigationConstants.ANALISE_ACIDENTES_TRABALHO_PANEL ) ) + { + panelsCache.put( NavigationConstants.ANALISE_ACIDENTES_TRABALHO_PANEL, new AnaliseAcidentesTrabalhoPanel() ); + } + gotoPage( ( AnaliseAcidentesTrabalhoPanel ) panelsCache.get( NavigationConstants.ANALISE_ACIDENTES_TRABALHO_PANEL ) ); + History.newItem( String.valueOf( NavigationConstants.ANALISE_ACIDENTES_TRABALHO_PANEL ) ); + break; + } + default: + { + break; + } + } + } + + + //TODO: find a better place for this stuff ... + public boolean isLoggedIn() + { + return getUserLogged() != null; + } + + public Utilizador getUserLogged() + { + return this.userLogged; + } + + public void setUserLogged( Utilizador user ) + { + this.userLogged = user; + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/permissoes/AccessConstants.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/permissoes/AccessConstants.java new file mode 100644 index 00000000..b7f37ed2 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/permissoes/AccessConstants.java @@ -0,0 +1,12 @@ +package com.evolute.siprp.client.panels.utils.permissoes; + +public interface AccessConstants +{ + + public static final int VIEW_ACTUAL_PANEL = 1; + public static final int VIEW_ACTUAL_PANEL_NOVA_ANALISE_BUTTON = 2; + + public static final int VIEW_SEGUIMENTO_PANEL = 3; + + public static final int VIEW_CONCLUIDO_PANEL = 4; +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/permissoes/PermissionsController.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/permissoes/PermissionsController.java new file mode 100644 index 00000000..0a564494 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/permissoes/PermissionsController.java @@ -0,0 +1,76 @@ +package com.evolute.siprp.client.panels.utils.permissoes; + +import com.evolute.siprp.client.panels.utils.navigation.PageNavigation; +import com.evolute.siprp.client.vo.Utilizador; + +public class PermissionsController +{ + private static PermissionsController instance; + + private Utilizador userLogged = null; + private int userType; + + private PermissionsController() + { + + } + + public static PermissionsController getController() + { + if ( instance == null ) + { + instance = new PermissionsController(); + } + return instance; + } + + + public boolean hasPermissionTo( Integer accessConstant ) + { + userLogged = PageNavigation.getProvider().getUserLogged(); + userType = userLogged.getTipo_utilizador().intValue(); + + Boolean canAccess = false; + + switch ( accessConstant.intValue() ) + { + case AccessConstants.VIEW_ACTUAL_PANEL: + { + + if ( userType == RolesConstants.TIPO_SEGURANCA + || userType == RolesConstants.TIPO_RECURSOS_HUMANOS + || userType == RolesConstants.TIPO_HIGIENE_SEGURANCA ) + { + canAccess = true; + } + break; + } + case AccessConstants.VIEW_ACTUAL_PANEL_NOVA_ANALISE_BUTTON: + { + if ( userType == RolesConstants.TIPO_SEGURANCA ) + { + canAccess = true; + } + + break; + } + case AccessConstants.VIEW_SEGUIMENTO_PANEL: + { + canAccess = true; + break; + } + case AccessConstants.VIEW_CONCLUIDO_PANEL: + { + canAccess = true; + break; + } + default: + { + break; + } + } + + return canAccess; + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/permissoes/RolesConstants.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/permissoes/RolesConstants.java new file mode 100644 index 00000000..fecf5386 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/panels/utils/permissoes/RolesConstants.java @@ -0,0 +1,29 @@ +package com.evolute.siprp.client.panels.utils.permissoes; + +public interface RolesConstants +{ + /* + 1 - "Segurança" + 2 - "Recursos Humanos" + 3 - "Higiene e Segurança" + 5 - "Médico" + 6 - "Gestão" + 7 - "Direcção-Geral RH" + 8 - "Director Siprp" + 9 - "Director de Loja" + 10 - "Director Nacional de Segurança" + */ + + //campo 'tipo' em 'tipos_utilizadores' + + public static final Integer TIPO_SEGURANCA = 1; + public static final Integer TIPO_RECURSOS_HUMANOS = 2; + public static final Integer TIPO_HIGIENE_SEGURANCA = 3; + public static final Integer TIPO_MEDICO = 5; + public static final Integer TIPO_GESTOR = 6; + public static final Integer TIPO_DIRECTOR_GERAL_RECURSOS_HUMANOS = 7; + public static final Integer TIPO_DIRECTOR_SIPRP = 8; + public static final Integer TIPO_DIRECTOR_LOJA = 9; + public static final Integer TIPO_DIRECTOR_NACIONAL_SEGURANCA = 10; + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/vo/ActualTableRow.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/vo/ActualTableRow.java new file mode 100644 index 00000000..220da872 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/vo/ActualTableRow.java @@ -0,0 +1,90 @@ +package com.evolute.siprp.client.vo; + +import java.io.Serializable; +import java.util.Date; + +public class ActualTableRow implements Serializable +{ + private static final long serialVersionUID = -6271564752485792179L; + + private Integer id; + private Date dataAcidente; + private Date dataAbertura; + private String nrAcidente; + private String POR; + private String nomeAcidentado; + private Integer estado; + private String fase; + + + public ActualTableRow() + { + + } + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Date getDataAcidente() { + return dataAcidente; + } + + public void setDataAcidente(Date dataAcidente) { + this.dataAcidente = dataAcidente; + } + + public Date getDataAbertura() { + return dataAbertura; + } + + public void setDataAbertura(Date dataAbertura) { + this.dataAbertura = dataAbertura; + } + + public String getNrAcidente() { + return nrAcidente; + } + + public void setNrAcidente(String nrAcidente) { + this.nrAcidente = nrAcidente; + } + + public String getPOR() { + return POR; + } + + public void setPOR(String por) { + POR = por; + } + + public String getNomeAcidentado() { + return nomeAcidentado; + } + + public void setNomeAcidentado(String nomeAcidentado) { + this.nomeAcidentado = nomeAcidentado; + } + + public Integer getEstado() { + return estado; + } + + public void setEstado(Integer estado) { + this.estado = estado; + } + + public String getFase() { + return fase; + } + + public void setFase(String fase) { + this.fase = fase; + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/vo/Utilizador.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/vo/Utilizador.java new file mode 100644 index 00000000..a4e9282b --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/client/vo/Utilizador.java @@ -0,0 +1,99 @@ +package com.evolute.siprp.client.vo; + +import java.io.Serializable; +import java.util.Date; + +public class Utilizador implements Serializable +{ + private static final long serialVersionUID = -5152657979121031157L; + + private Integer userID = null; + private String username = null; + private String nome = null; + private String email = null; + + private Integer tipo_utilizador = null; + private Boolean primeiro_login = null; + private Date data_password = null; + + private Integer estabelecimento_id = null; + private Boolean responsavel_loja = null; + + public Utilizador() + { + + } + + public Integer getUserID() { + return userID; + } + + public void setUserID(Integer userID) { + this.userID = userID; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getNome() { + return nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Integer getTipo_utilizador() { + return tipo_utilizador; + } + + public void setTipo_utilizador(Integer tipo_utilizador) { + this.tipo_utilizador = tipo_utilizador; + } + + public Boolean getPrimeiro_login() { + return primeiro_login; + } + + public void setPrimeiro_login(Boolean primeiro_login) { + this.primeiro_login = primeiro_login; + } + + public Date getData_password() { + return data_password; + } + + public void setData_password(Date data_password) { + this.data_password = data_password; + } + + public Boolean getResponsavel_loja() { + return responsavel_loja; + } + + public void setResponsavel_loja(Boolean responsavel_loja) { + this.responsavel_loja = responsavel_loja; + } + + public Integer getEstabelecimento_id() { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_id) { + this.estabelecimento_id = estabelecimento_id; + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/public/GestaoSHST.css b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/public/GestaoSHST.css new file mode 100644 index 00000000..5838e564 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/public/GestaoSHST.css @@ -0,0 +1,89 @@ +/** Add css rules here for your application. */ + +body { + color: #000; + background-color: #BBD400; + margin: 0px; +} + +body, th, td, p, div, span, input, button, select, textarea, form, b, strong, i, u, h1, h2, h3, h4, h5, h6, dl, dd, dt, ul, li, ol, option, optgroup, a { + font-family: sans-serif; + font-size: 12px; +} + +a, a:visited { + color: #035899; + text-decoration: none; +} + +a:hover { + color: #035899; + text-decoration: underline; + cursor: pointer; +} + +.alignCenterText { + text-align: center; +} + +.alignCenter { + margin-left: auto; + margin-right: auto; +} +.alignLeft { + float: left; +} +.alignRight { + float: right; +} + +.font12 { + font-size: 12px; +} +.font14 { + font-size: 14px; +} +.font16 { + font-size: 16px; +} +.font18 { + font-size: 18px; +} + +.indexTable { + border: 1px solid #000000; + width: 432px; + padding: 5px; +} + +.lblBold { + font-weight: bold; +} + +.inputBox { + width: 220px; + height: 24px; +} + +.inputBoxRec { + width: 432px; + height: 24px; +} + +.button { + width: 120px; + height: 24px; + cursor: pointer; +} + +.indexDiv { + width: 100%; + margin-top: 300px; +} + +.mainDiv { + width: 80%; + margin-left: auto; + margin-right: auto; +} + diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/public/images/SIPRP_logo_small.jpg b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/public/images/SIPRP_logo_small.jpg new file mode 100644 index 00000000..240f2358 Binary files /dev/null and b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/public/images/SIPRP_logo_small.jpg differ diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/public/images/logo_empresa32.jpg b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/public/images/logo_empresa32.jpg new file mode 100644 index 00000000..2c5be6df Binary files /dev/null and b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/public/images/logo_empresa32.jpg differ diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/public/images/logo_evolute_small.png b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/public/images/logo_evolute_small.png new file mode 100644 index 00000000..0198da2b Binary files /dev/null and b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/public/images/logo_evolute_small.png differ diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/InitDB.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/InitDB.java new file mode 100644 index 00000000..e2d32803 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/InitDB.java @@ -0,0 +1,46 @@ +package com.evolute.siprp.server.db; + +import com.evolute.utils.Singleton; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.JDBCManager; +import com.evolute.utils.db.keyretrievers.PostgresqlAutoKeyRetriever; +import com.evolute.utils.jdbc.DBStatementExecuter; +import com.evolute.utils.jdbc.StatementExecuterFactory; +import com.evolute.utils.jdo.JDOProvider; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.SQLQuery; +import com.evolute.utils.strings.UnicodeChecker; + + +public class InitDB +{ + private static DBManager manager; + private static JDOProvider jdoProvider; + + private static String dbUsername = "postgres"; + private static String dbPassword = "Typein"; + private static String URL = "jdbc:postgresql://storage:5432/siprp_20091203"; + + public static void init() throws Exception + { + if ( manager == null && jdoProvider == null ) + { + System.out.println( "Initializing db manager ..." ); + + DBManager manager = new JDBCManager( URL, dbUsername, dbPassword, 100, 80, 80, new SQLQuery[]{} ); + Singleton.setInstance( Singleton.DEFAULT_DBMANAGER, manager ); + Insert.setDefaultKeyRetriever( PostgresqlAutoKeyRetriever.RETRIEVER ); + StatementExecuterFactory.initialize( new DBStatementExecuter( manager.getSharedExecuter( InitDB.class ) ) ); + UnicodeChecker.setUseDoubleSlash( true ); + + initJDOConnection( dbUsername, dbPassword ); + } + } + + private static void initJDOConnection( String username, String password ) + { + jdoProvider = JDOProviderFactory.createInstance( URL, username, password ); + Singleton.setInstance( Singleton.DEFAULT_JDO_PROVIDER, jdoProvider ); + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/JDOProviderFactory.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/JDOProviderFactory.java new file mode 100644 index 00000000..7f983f06 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/JDOProviderFactory.java @@ -0,0 +1,65 @@ +package com.evolute.siprp.server.db; + +import java.util.Date; +import java.util.Properties; + +import com.evolute.utils.jdo.JDOProvider; + +/** + * + * @author jneto + */ +public abstract class JDOProviderFactory +{ + public static JDOProvider createInstance(String url, String user, String password) + { + Date d = new Date(); + System.out.println("INIT: " + d); + + Properties jpoxProps; + jpoxProps = new Properties(); + jpoxProps.setProperty("javax.jdo.PersistenceManagerFactoryClass", "org.datanucleus.jdo.JDOPersistenceManagerFactory"); + jpoxProps.setProperty("javax.jdo.option.ConnectionDriverName", "org.postgresql.Driver"); + jpoxProps.setProperty("datanucleus.identifier.fullyQualifiedNames", "false"); + jpoxProps.setProperty("datanucleus.identifier.case", "PreserveCase"); + jpoxProps.setProperty("javax.jdo.option.ConnectionURL", url ); + jpoxProps.setProperty("javax.jdo.option.ConnectionUserName", user); + jpoxProps.setProperty("javax.jdo.option.ConnectionPassword", password); + jpoxProps.setProperty("javax.jdo.option.IgnoreCache", "false"); + jpoxProps.setProperty("javax.jdo.option.NontransactionalRead", "true"); + jpoxProps.setProperty("javax.jdo.option.RetainValues", "true"); + jpoxProps.setProperty("datanucleus.autoCreateTables", "false"); + jpoxProps.setProperty("datanucleus.autoCreateSchema", "false"); + jpoxProps.setProperty("datanucleus.autoCreateConstraints", "false"); + jpoxProps.setProperty("datanucleus.autoCreateColumns", "false"); + jpoxProps.setProperty("datanucleus.validateTables", "false"); + jpoxProps.setProperty("datanucleus.validateColumns", "false"); + jpoxProps.setProperty("datanucleus.validateConstraints", "false"); + jpoxProps.setProperty("datanucleus.rdbms.CheckExistTablesOrViews", "false"); + jpoxProps.setProperty("datanucleus.rdbms.initializeColumnInfo", "None"); +// jpoxProps.setProperty("datanucleus.fixedDatastore", "true"); + jpoxProps.setProperty("datanucleus.identifier.defaultSchemaName", "public"); + jpoxProps.setProperty("datanucleus.autoStartMechanismMode", "Ignored"); + jpoxProps.setProperty("datanucleus.autoStartMechanism", "None"); + jpoxProps.setProperty("datanucleus.poid.transactionAttribute", "UsePM"); + jpoxProps.setProperty("datanucleus.connectionPoolingType", "C3P0"); + jpoxProps.setProperty("datanucleus.connectionPool.maxPoolSize", "5"); + jpoxProps.setProperty("datanucleus.connectionPool.minPoolSize", "1"); + jpoxProps.setProperty("datanucleus.connectionPool.initialPoolSize", "1"); + jpoxProps.setProperty("datanucleus.catalogName", "siprp"); + + // System.setProperty( "datanucleus.schemaName", "public" ); + // PersistenceManagerFactory pmf = + // JDOHelper.getPersistenceManagerFactory( jpoxProps ); + // // pmf.setOptimistic( true ); + // System.out.print( "Loading PM: " + new Date() ); + // // ( ( PersistenceManagerFactoryImpl )pmf ).setTransactionIsolation( + // Connection.TRANSACTION_READ_UNCOMMITTED ); + // // Retrieve a PersistenceManager from the PersistenceManagerFactory. + // PersistenceManager pm = pmf.getPersistenceManager(); + // JDOObject.setPersistentManager( pm ); + // System.out.println( "PM done " + new Date() ); + JDOProvider defaultProvider = new JDOProvider( jpoxProps ); + return defaultProvider; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Acidentados.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Acidentados.java new file mode 100644 index 00000000..0b104fe6 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Acidentados.java @@ -0,0 +1,507 @@ +/* +* Acidentados.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class Acidentados implements JDOInnerObject +{ + private Integer id; + private String nome; + private java.util.Date data_nascimento; + private String bilhete_identidade; + private String morada; + private String cod_postal; + private String localidade; + private String contacto_telefonico; + private java.util.Date data_admissao; + private String funcao; + private Integer trabalhador_id; + private String turno; + private String numero_mecanografico; + private String nome_superior_hierarquico; + private String email_superior_hierarquico; + private String estabelecimento_origem; + private java.util.Date data_email_superior_hierarquico; + + public Acidentados() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == AcidentadosDataAuto.ID ) + { + return id; + } + else if( fieldName == AcidentadosDataAuto.NOME ) + { + return nome; + } + else if( fieldName == AcidentadosDataAuto.DATA_NASCIMENTO ) + { + return data_nascimento; + } + else if( fieldName == AcidentadosDataAuto.BILHETE_IDENTIDADE ) + { + return bilhete_identidade; + } + else if( fieldName == AcidentadosDataAuto.MORADA ) + { + return morada; + } + else if( fieldName == AcidentadosDataAuto.COD_POSTAL ) + { + return cod_postal; + } + else if( fieldName == AcidentadosDataAuto.LOCALIDADE ) + { + return localidade; + } + else if( fieldName == AcidentadosDataAuto.CONTACTO_TELEFONICO ) + { + return contacto_telefonico; + } + else if( fieldName == AcidentadosDataAuto.DATA_ADMISSAO ) + { + return data_admissao; + } + else if( fieldName == AcidentadosDataAuto.FUNCAO ) + { + return funcao; + } + else if( fieldName == AcidentadosDataAuto.TRABALHADOR_ID ) + { + return trabalhador_id; + } + else if( fieldName == AcidentadosDataAuto.TURNO ) + { + return turno; + } + else if( fieldName == AcidentadosDataAuto.NUMERO_MECANOGRAFICO ) + { + return numero_mecanografico; + } + else if( fieldName == AcidentadosDataAuto.NOME_SUPERIOR_HIERARQUICO ) + { + return nome_superior_hierarquico; + } + else if( fieldName == AcidentadosDataAuto.EMAIL_SUPERIOR_HIERARQUICO ) + { + return email_superior_hierarquico; + } + else if( fieldName == AcidentadosDataAuto.ESTABELECIMENTO_ORIGEM ) + { + return estabelecimento_origem; + } + else if( fieldName == AcidentadosDataAuto.DATA_EMAIL_SUPERIOR_HIERARQUICO ) + { + return data_email_superior_hierarquico; + } + else if( fieldName.equals( AcidentadosDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( AcidentadosDataAuto.NOME ) ) + { + return nome; + } + else if( fieldName.equals( AcidentadosDataAuto.DATA_NASCIMENTO ) ) + { + return data_nascimento; + } + else if( fieldName.equals( AcidentadosDataAuto.BILHETE_IDENTIDADE ) ) + { + return bilhete_identidade; + } + else if( fieldName.equals( AcidentadosDataAuto.MORADA ) ) + { + return morada; + } + else if( fieldName.equals( AcidentadosDataAuto.COD_POSTAL ) ) + { + return cod_postal; + } + else if( fieldName.equals( AcidentadosDataAuto.LOCALIDADE ) ) + { + return localidade; + } + else if( fieldName.equals( AcidentadosDataAuto.CONTACTO_TELEFONICO ) ) + { + return contacto_telefonico; + } + else if( fieldName.equals( AcidentadosDataAuto.DATA_ADMISSAO ) ) + { + return data_admissao; + } + else if( fieldName.equals( AcidentadosDataAuto.FUNCAO ) ) + { + return funcao; + } + else if( fieldName.equals( AcidentadosDataAuto.TRABALHADOR_ID ) ) + { + return trabalhador_id; + } + else if( fieldName.equals( AcidentadosDataAuto.TURNO ) ) + { + return turno; + } + else if( fieldName.equals( AcidentadosDataAuto.NUMERO_MECANOGRAFICO ) ) + { + return numero_mecanografico; + } + else if( fieldName.equals( AcidentadosDataAuto.NOME_SUPERIOR_HIERARQUICO ) ) + { + return nome_superior_hierarquico; + } + else if( fieldName.equals( AcidentadosDataAuto.EMAIL_SUPERIOR_HIERARQUICO ) ) + { + return email_superior_hierarquico; + } + else if( fieldName.equals( AcidentadosDataAuto.ESTABELECIMENTO_ORIGEM ) ) + { + return estabelecimento_origem; + } + else if( fieldName.equals( AcidentadosDataAuto.DATA_EMAIL_SUPERIOR_HIERARQUICO ) ) + { + return data_email_superior_hierarquico; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == AcidentadosDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == AcidentadosDataAuto.NOME ) + { + nome = ( String ) value; + } + else if( fieldName == AcidentadosDataAuto.DATA_NASCIMENTO ) + { + data_nascimento = ( java.util.Date ) value; + } + else if( fieldName == AcidentadosDataAuto.BILHETE_IDENTIDADE ) + { + bilhete_identidade = ( String ) value; + } + else if( fieldName == AcidentadosDataAuto.MORADA ) + { + morada = ( String ) value; + } + else if( fieldName == AcidentadosDataAuto.COD_POSTAL ) + { + cod_postal = ( String ) value; + } + else if( fieldName == AcidentadosDataAuto.LOCALIDADE ) + { + localidade = ( String ) value; + } + else if( fieldName == AcidentadosDataAuto.CONTACTO_TELEFONICO ) + { + contacto_telefonico = ( String ) value; + } + else if( fieldName == AcidentadosDataAuto.DATA_ADMISSAO ) + { + data_admissao = ( java.util.Date ) value; + } + else if( fieldName == AcidentadosDataAuto.FUNCAO ) + { + funcao = ( String ) value; + } + else if( fieldName == AcidentadosDataAuto.TRABALHADOR_ID ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName == AcidentadosDataAuto.TURNO ) + { + turno = ( String ) value; + } + else if( fieldName == AcidentadosDataAuto.NUMERO_MECANOGRAFICO ) + { + numero_mecanografico = ( String ) value; + } + else if( fieldName == AcidentadosDataAuto.NOME_SUPERIOR_HIERARQUICO ) + { + nome_superior_hierarquico = ( String ) value; + } + else if( fieldName == AcidentadosDataAuto.EMAIL_SUPERIOR_HIERARQUICO ) + { + email_superior_hierarquico = ( String ) value; + } + else if( fieldName == AcidentadosDataAuto.ESTABELECIMENTO_ORIGEM ) + { + estabelecimento_origem = ( String ) value; + } + else if( fieldName == AcidentadosDataAuto.DATA_EMAIL_SUPERIOR_HIERARQUICO ) + { + data_email_superior_hierarquico = ( java.util.Date ) value; + } + else if( fieldName.equals( AcidentadosDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( AcidentadosDataAuto.NOME ) ) + { + nome = ( String ) value; + } + else if( fieldName.equals( AcidentadosDataAuto.DATA_NASCIMENTO ) ) + { + data_nascimento = ( java.util.Date ) value; + } + else if( fieldName.equals( AcidentadosDataAuto.BILHETE_IDENTIDADE ) ) + { + bilhete_identidade = ( String ) value; + } + else if( fieldName.equals( AcidentadosDataAuto.MORADA ) ) + { + morada = ( String ) value; + } + else if( fieldName.equals( AcidentadosDataAuto.COD_POSTAL ) ) + { + cod_postal = ( String ) value; + } + else if( fieldName.equals( AcidentadosDataAuto.LOCALIDADE ) ) + { + localidade = ( String ) value; + } + else if( fieldName.equals( AcidentadosDataAuto.CONTACTO_TELEFONICO ) ) + { + contacto_telefonico = ( String ) value; + } + else if( fieldName.equals( AcidentadosDataAuto.DATA_ADMISSAO ) ) + { + data_admissao = ( java.util.Date ) value; + } + else if( fieldName.equals( AcidentadosDataAuto.FUNCAO ) ) + { + funcao = ( String ) value; + } + else if( fieldName.equals( AcidentadosDataAuto.TRABALHADOR_ID ) ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName.equals( AcidentadosDataAuto.TURNO ) ) + { + turno = ( String ) value; + } + else if( fieldName.equals( AcidentadosDataAuto.NUMERO_MECANOGRAFICO ) ) + { + numero_mecanografico = ( String ) value; + } + else if( fieldName.equals( AcidentadosDataAuto.NOME_SUPERIOR_HIERARQUICO ) ) + { + nome_superior_hierarquico = ( String ) value; + } + else if( fieldName.equals( AcidentadosDataAuto.EMAIL_SUPERIOR_HIERARQUICO ) ) + { + email_superior_hierarquico = ( String ) value; + } + else if( fieldName.equals( AcidentadosDataAuto.ESTABELECIMENTO_ORIGEM ) ) + { + estabelecimento_origem = ( String ) value; + } + else if( fieldName.equals( AcidentadosDataAuto.DATA_EMAIL_SUPERIOR_HIERARQUICO ) ) + { + data_email_superior_hierarquico = ( java.util.Date ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getNome() + { + return nome; + } + + public void setNome(String nomeValue ) + { + this.nome = nomeValue; + } + + public java.util.Date getData_nascimento() + { + return data_nascimento; + } + + public void setData_nascimento(java.util.Date data_nascimentoValue ) + { + this.data_nascimento = data_nascimentoValue; + } + + public String getBilhete_identidade() + { + return bilhete_identidade; + } + + public void setBilhete_identidade(String bilhete_identidadeValue ) + { + this.bilhete_identidade = bilhete_identidadeValue; + } + + public String getMorada() + { + return morada; + } + + public void setMorada(String moradaValue ) + { + this.morada = moradaValue; + } + + public String getCod_postal() + { + return cod_postal; + } + + public void setCod_postal(String cod_postalValue ) + { + this.cod_postal = cod_postalValue; + } + + public String getLocalidade() + { + return localidade; + } + + public void setLocalidade(String localidadeValue ) + { + this.localidade = localidadeValue; + } + + public String getContacto_telefonico() + { + return contacto_telefonico; + } + + public void setContacto_telefonico(String contacto_telefonicoValue ) + { + this.contacto_telefonico = contacto_telefonicoValue; + } + + public java.util.Date getData_admissao() + { + return data_admissao; + } + + public void setData_admissao(java.util.Date data_admissaoValue ) + { + this.data_admissao = data_admissaoValue; + } + + public String getFuncao() + { + return funcao; + } + + public void setFuncao(String funcaoValue ) + { + this.funcao = funcaoValue; + } + + public Integer getTrabalhador_id() + { + return trabalhador_id; + } + + public void setTrabalhador_id(Integer trabalhador_idValue ) + { + this.trabalhador_id = trabalhador_idValue; + } + + public String getTurno() + { + return turno; + } + + public void setTurno(String turnoValue ) + { + this.turno = turnoValue; + } + + public String getNumero_mecanografico() + { + return numero_mecanografico; + } + + public void setNumero_mecanografico(String numero_mecanograficoValue ) + { + this.numero_mecanografico = numero_mecanograficoValue; + } + + public String getNome_superior_hierarquico() + { + return nome_superior_hierarquico; + } + + public void setNome_superior_hierarquico(String nome_superior_hierarquicoValue ) + { + this.nome_superior_hierarquico = nome_superior_hierarquicoValue; + } + + public String getEmail_superior_hierarquico() + { + return email_superior_hierarquico; + } + + public void setEmail_superior_hierarquico(String email_superior_hierarquicoValue ) + { + this.email_superior_hierarquico = email_superior_hierarquicoValue; + } + + public String getEstabelecimento_origem() + { + return estabelecimento_origem; + } + + public void setEstabelecimento_origem(String estabelecimento_origemValue ) + { + this.estabelecimento_origem = estabelecimento_origemValue; + } + + public java.util.Date getData_email_superior_hierarquico() + { + return data_email_superior_hierarquico; + } + + public void setData_email_superior_hierarquico(java.util.Date data_email_superior_hierarquicoValue ) + { + this.data_email_superior_hierarquico = data_email_superior_hierarquicoValue; + } + + public Class getOuterClass() + { + return AcidentadosDataAuto.class; + } + + public AcidentadosDataAuto getOuterClassInstance() + { + AcidentadosDataAuto outerObj = new AcidentadosDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/AcidentadosData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/AcidentadosData.java new file mode 100644 index 00000000..1e0d1d88 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/AcidentadosData.java @@ -0,0 +1,18 @@ +/* +* AcidentadosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class AcidentadosData extends com.evolute.siprp.server.db.data.siprp.AcidentadosDataAuto +{ + + public AcidentadosData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/AcidentadosDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/AcidentadosDataAuto.java new file mode 100644 index 00000000..fc195305 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/AcidentadosDataAuto.java @@ -0,0 +1,283 @@ +/* +* AcidentadosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class AcidentadosDataAuto extends JDOObject +{ + + public static final String TABLENAME = "acidentados"; + + public static final String ID = "id"; + public static final String ID_FULL = "acidentados.id"; + public static final String NOME = "nome"; + public static final String NOME_FULL = "acidentados.nome"; + public static final String DATA_NASCIMENTO = "data_nascimento"; + public static final String DATA_NASCIMENTO_FULL = "acidentados.data_nascimento"; + public static final String BILHETE_IDENTIDADE = "bilhete_identidade"; + public static final String BILHETE_IDENTIDADE_FULL = "acidentados.bilhete_identidade"; + public static final String MORADA = "morada"; + public static final String MORADA_FULL = "acidentados.morada"; + public static final String COD_POSTAL = "cod_postal"; + public static final String COD_POSTAL_FULL = "acidentados.cod_postal"; + public static final String LOCALIDADE = "localidade"; + public static final String LOCALIDADE_FULL = "acidentados.localidade"; + public static final String CONTACTO_TELEFONICO = "contacto_telefonico"; + public static final String CONTACTO_TELEFONICO_FULL = "acidentados.contacto_telefonico"; + public static final String DATA_ADMISSAO = "data_admissao"; + public static final String DATA_ADMISSAO_FULL = "acidentados.data_admissao"; + public static final String FUNCAO = "funcao"; + public static final String FUNCAO_FULL = "acidentados.funcao"; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String TRABALHADOR_ID_FULL = "acidentados.trabalhador_id"; + public static final String TURNO = "turno"; + public static final String TURNO_FULL = "acidentados.turno"; + public static final String NUMERO_MECANOGRAFICO = "numero_mecanografico"; + public static final String NUMERO_MECANOGRAFICO_FULL = "acidentados.numero_mecanografico"; + public static final String NOME_SUPERIOR_HIERARQUICO = "nome_superior_hierarquico"; + public static final String NOME_SUPERIOR_HIERARQUICO_FULL = "acidentados.nome_superior_hierarquico"; + public static final String EMAIL_SUPERIOR_HIERARQUICO = "email_superior_hierarquico"; + public static final String EMAIL_SUPERIOR_HIERARQUICO_FULL = "acidentados.email_superior_hierarquico"; + public static final String ESTABELECIMENTO_ORIGEM = "estabelecimento_origem"; + public static final String ESTABELECIMENTO_ORIGEM_FULL = "acidentados.estabelecimento_origem"; + public static final String DATA_EMAIL_SUPERIOR_HIERARQUICO = "data_email_superior_hierarquico"; + public static final String DATA_EMAIL_SUPERIOR_HIERARQUICO_FULL = "acidentados.data_email_superior_hierarquico"; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, DATA_NASCIMENTO, BILHETE_IDENTIDADE, MORADA, COD_POSTAL, LOCALIDADE, + CONTACTO_TELEFONICO, DATA_ADMISSAO, FUNCAO, TRABALHADOR_ID, TURNO, + NUMERO_MECANOGRAFICO, NOME_SUPERIOR_HIERARQUICO, + EMAIL_SUPERIOR_HIERARQUICO, ESTABELECIMENTO_ORIGEM, + DATA_EMAIL_SUPERIOR_HIERARQUICO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, NOME, DATA_NASCIMENTO, BILHETE_IDENTIDADE, MORADA, COD_POSTAL, LOCALIDADE, + CONTACTO_TELEFONICO, DATA_ADMISSAO, FUNCAO, TRABALHADOR_ID, TURNO, + NUMERO_MECANOGRAFICO, NOME_SUPERIOR_HIERARQUICO, + EMAIL_SUPERIOR_HIERARQUICO, ESTABELECIMENTO_ORIGEM, + DATA_EMAIL_SUPERIOR_HIERARQUICO, }; + + private Map dataHash; + + public AcidentadosDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getNome() + { + return (String) get(NOME); + } + + public void setNome(String nomeValue ) + { + this.set(NOME, nomeValue ); + } + + public java.util.Date getData_nascimento() + { + return (java.util.Date) get(DATA_NASCIMENTO); + } + + public void setData_nascimento(java.util.Date data_nascimentoValue ) + { + this.set(DATA_NASCIMENTO, data_nascimentoValue ); + } + + public String getBilhete_identidade() + { + return (String) get(BILHETE_IDENTIDADE); + } + + public void setBilhete_identidade(String bilhete_identidadeValue ) + { + this.set(BILHETE_IDENTIDADE, bilhete_identidadeValue ); + } + + public String getMorada() + { + return (String) get(MORADA); + } + + public void setMorada(String moradaValue ) + { + this.set(MORADA, moradaValue ); + } + + public String getCod_postal() + { + return (String) get(COD_POSTAL); + } + + public void setCod_postal(String cod_postalValue ) + { + this.set(COD_POSTAL, cod_postalValue ); + } + + public String getLocalidade() + { + return (String) get(LOCALIDADE); + } + + public void setLocalidade(String localidadeValue ) + { + this.set(LOCALIDADE, localidadeValue ); + } + + public String getContacto_telefonico() + { + return (String) get(CONTACTO_TELEFONICO); + } + + public void setContacto_telefonico(String contacto_telefonicoValue ) + { + this.set(CONTACTO_TELEFONICO, contacto_telefonicoValue ); + } + + public java.util.Date getData_admissao() + { + return (java.util.Date) get(DATA_ADMISSAO); + } + + public void setData_admissao(java.util.Date data_admissaoValue ) + { + this.set(DATA_ADMISSAO, data_admissaoValue ); + } + + public String getFuncao() + { + return (String) get(FUNCAO); + } + + public void setFuncao(String funcaoValue ) + { + this.set(FUNCAO, funcaoValue ); + } + + public Integer getTrabalhador_id() + { + return (Integer) get(TRABALHADOR_ID); + } + + public void setTrabalhador_id(Integer trabalhador_idValue ) + { + this.set(TRABALHADOR_ID, trabalhador_idValue ); + } + + public String getTurno() + { + return (String) get(TURNO); + } + + public void setTurno(String turnoValue ) + { + this.set(TURNO, turnoValue ); + } + + public String getNumero_mecanografico() + { + return (String) get(NUMERO_MECANOGRAFICO); + } + + public void setNumero_mecanografico(String numero_mecanograficoValue ) + { + this.set(NUMERO_MECANOGRAFICO, numero_mecanograficoValue ); + } + + public String getNome_superior_hierarquico() + { + return (String) get(NOME_SUPERIOR_HIERARQUICO); + } + + public void setNome_superior_hierarquico(String nome_superior_hierarquicoValue ) + { + this.set(NOME_SUPERIOR_HIERARQUICO, nome_superior_hierarquicoValue ); + } + + public String getEmail_superior_hierarquico() + { + return (String) get(EMAIL_SUPERIOR_HIERARQUICO); + } + + public void setEmail_superior_hierarquico(String email_superior_hierarquicoValue ) + { + this.set(EMAIL_SUPERIOR_HIERARQUICO, email_superior_hierarquicoValue ); + } + + public String getEstabelecimento_origem() + { + return (String) get(ESTABELECIMENTO_ORIGEM); + } + + public void setEstabelecimento_origem(String estabelecimento_origemValue ) + { + this.set(ESTABELECIMENTO_ORIGEM, estabelecimento_origemValue ); + } + + public java.util.Date getData_email_superior_hierarquico() + { + return (java.util.Date) get(DATA_EMAIL_SUPERIOR_HIERARQUICO); + } + + public void setData_email_superior_hierarquico(java.util.Date data_email_superior_hierarquicoValue ) + { + this.set(DATA_EMAIL_SUPERIOR_HIERARQUICO, data_email_superior_hierarquicoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Acidentados.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Actualizacao.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Actualizacao.java new file mode 100644 index 00000000..9fd919c0 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Actualizacao.java @@ -0,0 +1,44 @@ +/* +* Actualizacao.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class Actualizacao implements JDOInnerObject +{ + + public Actualizacao() + { + } + + public Object getField( String fieldName ) + { + return null; + } + + public void setField( String fieldName, Object value ) + { + } + + public Class getOuterClass() + { + return ActualizacaoDataAuto.class; + } + + public ActualizacaoDataAuto getOuterClassInstance() + { + ActualizacaoDataAuto outerObj = new ActualizacaoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Object getJDOPrimaryKey() + { + return null; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ActualizacaoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ActualizacaoData.java new file mode 100644 index 00000000..2cad0c37 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ActualizacaoData.java @@ -0,0 +1,18 @@ +/* +* ActualizacaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class ActualizacaoData extends com.evolute.siprp.server.db.data.siprp.ActualizacaoDataAuto +{ + + public ActualizacaoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ActualizacaoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ActualizacaoDataAuto.java new file mode 100644 index 00000000..acabffc2 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ActualizacaoDataAuto.java @@ -0,0 +1,67 @@ +/* +* ActualizacaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class ActualizacaoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "actualizacao"; + + + public static final String FIELD_NAMES[] = new String[]{ + }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + }; + + private Map dataHash; + + public ActualizacaoDataAuto() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Actualizacao.class; + } + + public Object getJDOPrimaryKey() + { + return null; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/AnalisesAcidentes.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/AnalisesAcidentes.java new file mode 100644 index 00000000..f04bb8e8 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/AnalisesAcidentes.java @@ -0,0 +1,2775 @@ +/* +* AnalisesAcidentes.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class AnalisesAcidentes implements JDOInnerObject +{ + private Integer id; + private java.util.Date data_acidente; + private Integer acidentado_id; + private Integer estado; + private Integer estabelecimento_id; + private Integer horas_turno; + private String local_trabalho; + private String tarefa; + private String substancias; + private String condicoes; + private String testemunhas; + private String descricao; + private String conclusoes; + private String accoes; + private java.sql.Time hora_acidente; + private String formacao_shst; + private String formacao_shst_nao_porque; + private String outros_acidentes_com_colaborador; + private Integer nr_acidentes_com_colaborador; + private Integer nr_relatorio_acidente_colaborador1; + private Integer nr_relatorio_acidente_colaborador2; + private Integer nr_relatorio_acidente_colaborador3; + private Integer nr_relatorio_acidente_colaborador4; + private String acidentes_outros_colaboradores; + private Integer nr_acidentes_outros_colaboradores; + private Integer nr_relatorio_acidente_outros_colaboradores1; + private Integer nr_relatorio_acidente_outros_colaboradores2; + private Integer nr_relatorio_acidente_outros_colaboradores3; + private Integer nr_relatorio_acidente_outros_colaboradores4; + private String lesao_cabeca; + private String lesao_pescoco; + private String lesao_tronco; + private String lesao_membro_sup_dir; + private String lesao_membro_sup_esq; + private String lesao_membro_inf_dir; + private String lesao_membro_inf_esq; + private String especif1; + private String especif2; + private String especif3; + private String especif4; + private String tipo_incapacidade; + private Integer coef_incapacidade; + private java.util.Date data_aval_incapacidade; + private java.util.Date data_rev_incapacidade; + private java.util.Date periodo_incapacidade_de; + private java.util.Date periodo_incapacidade_a; + private String img_flexao; + private String img_ext1; + private String img_ext2; + private String img_cab2; + private String img_cab3; + private String img_ma2; + private String img_ma3; + private String img_ma5; + private String img_ma6; + private String img_ma8; + private String img_ma10; + private Integer restricao_carga; + private String restricao_motricidade; + private String restricao_conducao; + private String restricao_vibracoes; + private String restricao_outras; + private String med_observ; + private String tipo_lesao; + private String img_rot1; + private String img_rot2; + private String img_cab1; + private String img_cab4; + private String img_ma1; + private String img_ma4; + private String img_ma7; + private String img_ma9; + private Integer empresa_id; + private Integer medico_id; + private Integer tecnico_saude_id; + private String analise_nr; + private Integer estado_assinatura; + private String ass_resp_seg; + private String ass_resp_rh; + private java.util.Date data_consolidacao; + private java.util.Date data_assinatura_seg; + private java.util.Date data_assinatura_rh; + private String ass_consolidacao; + private String nome_resp_seg; + private String nome_resp_rh; + private Integer causas; + private Integer estado_antes_correcao; + private String observacoes_correcao; + private String correcao; + private String ass_superior; + private String nome_superior; + private java.util.Date data_assinatura_superior; + private String averiguador; + private String averiguacao_posterior; + private String averiguacao_obs; + private java.util.Date data_inicio_processo; + private String nome_resp_consolidacao; + private Integer seccao_id; + private Integer departamento_id; + private Integer rh_fase4; + private String apagada; + + public AnalisesAcidentes() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == AnalisesAcidentesDataAuto.ID ) + { + return id; + } + else if( fieldName == AnalisesAcidentesDataAuto.DATA_ACIDENTE ) + { + return data_acidente; + } + else if( fieldName == AnalisesAcidentesDataAuto.ACIDENTADO_ID ) + { + return acidentado_id; + } + else if( fieldName == AnalisesAcidentesDataAuto.ESTADO ) + { + return estado; + } + else if( fieldName == AnalisesAcidentesDataAuto.ESTABELECIMENTO_ID ) + { + return estabelecimento_id; + } + else if( fieldName == AnalisesAcidentesDataAuto.HORAS_TURNO ) + { + return horas_turno; + } + else if( fieldName == AnalisesAcidentesDataAuto.LOCAL_TRABALHO ) + { + return local_trabalho; + } + else if( fieldName == AnalisesAcidentesDataAuto.TAREFA ) + { + return tarefa; + } + else if( fieldName == AnalisesAcidentesDataAuto.SUBSTANCIAS ) + { + return substancias; + } + else if( fieldName == AnalisesAcidentesDataAuto.CONDICOES ) + { + return condicoes; + } + else if( fieldName == AnalisesAcidentesDataAuto.TESTEMUNHAS ) + { + return testemunhas; + } + else if( fieldName == AnalisesAcidentesDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName == AnalisesAcidentesDataAuto.CONCLUSOES ) + { + return conclusoes; + } + else if( fieldName == AnalisesAcidentesDataAuto.ACCOES ) + { + return accoes; + } + else if( fieldName == AnalisesAcidentesDataAuto.HORA_ACIDENTE ) + { + return hora_acidente; + } + else if( fieldName == AnalisesAcidentesDataAuto.FORMACAO_SHST ) + { + return formacao_shst; + } + else if( fieldName == AnalisesAcidentesDataAuto.FORMACAO_SHST_NAO_PORQUE ) + { + return formacao_shst_nao_porque; + } + else if( fieldName == AnalisesAcidentesDataAuto.OUTROS_ACIDENTES_COM_COLABORADOR ) + { + return outros_acidentes_com_colaborador; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_ACIDENTES_COM_COLABORADOR ) + { + return nr_acidentes_com_colaborador; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_COLABORADOR1 ) + { + return nr_relatorio_acidente_colaborador1; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_COLABORADOR2 ) + { + return nr_relatorio_acidente_colaborador2; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_COLABORADOR3 ) + { + return nr_relatorio_acidente_colaborador3; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_COLABORADOR4 ) + { + return nr_relatorio_acidente_colaborador4; + } + else if( fieldName == AnalisesAcidentesDataAuto.ACIDENTES_OUTROS_COLABORADORES ) + { + return acidentes_outros_colaboradores; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_ACIDENTES_OUTROS_COLABORADORES ) + { + return nr_acidentes_outros_colaboradores; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES1 ) + { + return nr_relatorio_acidente_outros_colaboradores1; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES2 ) + { + return nr_relatorio_acidente_outros_colaboradores2; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES3 ) + { + return nr_relatorio_acidente_outros_colaboradores3; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES4 ) + { + return nr_relatorio_acidente_outros_colaboradores4; + } + else if( fieldName == AnalisesAcidentesDataAuto.LESAO_CABECA ) + { + return lesao_cabeca; + } + else if( fieldName == AnalisesAcidentesDataAuto.LESAO_PESCOCO ) + { + return lesao_pescoco; + } + else if( fieldName == AnalisesAcidentesDataAuto.LESAO_TRONCO ) + { + return lesao_tronco; + } + else if( fieldName == AnalisesAcidentesDataAuto.LESAO_MEMBRO_SUP_DIR ) + { + return lesao_membro_sup_dir; + } + else if( fieldName == AnalisesAcidentesDataAuto.LESAO_MEMBRO_SUP_ESQ ) + { + return lesao_membro_sup_esq; + } + else if( fieldName == AnalisesAcidentesDataAuto.LESAO_MEMBRO_INF_DIR ) + { + return lesao_membro_inf_dir; + } + else if( fieldName == AnalisesAcidentesDataAuto.LESAO_MEMBRO_INF_ESQ ) + { + return lesao_membro_inf_esq; + } + else if( fieldName == AnalisesAcidentesDataAuto.ESPECIF1 ) + { + return especif1; + } + else if( fieldName == AnalisesAcidentesDataAuto.ESPECIF2 ) + { + return especif2; + } + else if( fieldName == AnalisesAcidentesDataAuto.ESPECIF3 ) + { + return especif3; + } + else if( fieldName == AnalisesAcidentesDataAuto.ESPECIF4 ) + { + return especif4; + } + else if( fieldName == AnalisesAcidentesDataAuto.TIPO_INCAPACIDADE ) + { + return tipo_incapacidade; + } + else if( fieldName == AnalisesAcidentesDataAuto.COEF_INCAPACIDADE ) + { + return coef_incapacidade; + } + else if( fieldName == AnalisesAcidentesDataAuto.DATA_AVAL_INCAPACIDADE ) + { + return data_aval_incapacidade; + } + else if( fieldName == AnalisesAcidentesDataAuto.DATA_REV_INCAPACIDADE ) + { + return data_rev_incapacidade; + } + else if( fieldName == AnalisesAcidentesDataAuto.PERIODO_INCAPACIDADE_DE ) + { + return periodo_incapacidade_de; + } + else if( fieldName == AnalisesAcidentesDataAuto.PERIODO_INCAPACIDADE_A ) + { + return periodo_incapacidade_a; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_FLEXAO ) + { + return img_flexao; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_EXT1 ) + { + return img_ext1; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_EXT2 ) + { + return img_ext2; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_CAB2 ) + { + return img_cab2; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_CAB3 ) + { + return img_cab3; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA2 ) + { + return img_ma2; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA3 ) + { + return img_ma3; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA5 ) + { + return img_ma5; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA6 ) + { + return img_ma6; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA8 ) + { + return img_ma8; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA10 ) + { + return img_ma10; + } + else if( fieldName == AnalisesAcidentesDataAuto.RESTRICAO_CARGA ) + { + return restricao_carga; + } + else if( fieldName == AnalisesAcidentesDataAuto.RESTRICAO_MOTRICIDADE ) + { + return restricao_motricidade; + } + else if( fieldName == AnalisesAcidentesDataAuto.RESTRICAO_CONDUCAO ) + { + return restricao_conducao; + } + else if( fieldName == AnalisesAcidentesDataAuto.RESTRICAO_VIBRACOES ) + { + return restricao_vibracoes; + } + else if( fieldName == AnalisesAcidentesDataAuto.RESTRICAO_OUTRAS ) + { + return restricao_outras; + } + else if( fieldName == AnalisesAcidentesDataAuto.MED_OBSERV ) + { + return med_observ; + } + else if( fieldName == AnalisesAcidentesDataAuto.TIPO_LESAO ) + { + return tipo_lesao; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_ROT1 ) + { + return img_rot1; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_ROT2 ) + { + return img_rot2; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_CAB1 ) + { + return img_cab1; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_CAB4 ) + { + return img_cab4; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA1 ) + { + return img_ma1; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA4 ) + { + return img_ma4; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA7 ) + { + return img_ma7; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA9 ) + { + return img_ma9; + } + else if( fieldName == AnalisesAcidentesDataAuto.EMPRESA_ID ) + { + return empresa_id; + } + else if( fieldName == AnalisesAcidentesDataAuto.MEDICO_ID ) + { + return medico_id; + } + else if( fieldName == AnalisesAcidentesDataAuto.TECNICO_SAUDE_ID ) + { + return tecnico_saude_id; + } + else if( fieldName == AnalisesAcidentesDataAuto.ANALISE_NR ) + { + return analise_nr; + } + else if( fieldName == AnalisesAcidentesDataAuto.ESTADO_ASSINATURA ) + { + return estado_assinatura; + } + else if( fieldName == AnalisesAcidentesDataAuto.ASS_RESP_SEG ) + { + return ass_resp_seg; + } + else if( fieldName == AnalisesAcidentesDataAuto.ASS_RESP_RH ) + { + return ass_resp_rh; + } + else if( fieldName == AnalisesAcidentesDataAuto.DATA_CONSOLIDACAO ) + { + return data_consolidacao; + } + else if( fieldName == AnalisesAcidentesDataAuto.DATA_ASSINATURA_SEG ) + { + return data_assinatura_seg; + } + else if( fieldName == AnalisesAcidentesDataAuto.DATA_ASSINATURA_RH ) + { + return data_assinatura_rh; + } + else if( fieldName == AnalisesAcidentesDataAuto.ASS_CONSOLIDACAO ) + { + return ass_consolidacao; + } + else if( fieldName == AnalisesAcidentesDataAuto.NOME_RESP_SEG ) + { + return nome_resp_seg; + } + else if( fieldName == AnalisesAcidentesDataAuto.NOME_RESP_RH ) + { + return nome_resp_rh; + } + else if( fieldName == AnalisesAcidentesDataAuto.CAUSAS ) + { + return causas; + } + else if( fieldName == AnalisesAcidentesDataAuto.ESTADO_ANTES_CORRECAO ) + { + return estado_antes_correcao; + } + else if( fieldName == AnalisesAcidentesDataAuto.OBSERVACOES_CORRECAO ) + { + return observacoes_correcao; + } + else if( fieldName == AnalisesAcidentesDataAuto.CORRECAO ) + { + return correcao; + } + else if( fieldName == AnalisesAcidentesDataAuto.ASS_SUPERIOR ) + { + return ass_superior; + } + else if( fieldName == AnalisesAcidentesDataAuto.NOME_SUPERIOR ) + { + return nome_superior; + } + else if( fieldName == AnalisesAcidentesDataAuto.DATA_ASSINATURA_SUPERIOR ) + { + return data_assinatura_superior; + } + else if( fieldName == AnalisesAcidentesDataAuto.AVERIGUADOR ) + { + return averiguador; + } + else if( fieldName == AnalisesAcidentesDataAuto.AVERIGUACAO_POSTERIOR ) + { + return averiguacao_posterior; + } + else if( fieldName == AnalisesAcidentesDataAuto.AVERIGUACAO_OBS ) + { + return averiguacao_obs; + } + else if( fieldName == AnalisesAcidentesDataAuto.DATA_INICIO_PROCESSO ) + { + return data_inicio_processo; + } + else if( fieldName == AnalisesAcidentesDataAuto.NOME_RESP_CONSOLIDACAO ) + { + return nome_resp_consolidacao; + } + else if( fieldName == AnalisesAcidentesDataAuto.SECCAO_ID ) + { + return seccao_id; + } + else if( fieldName == AnalisesAcidentesDataAuto.DEPARTAMENTO_ID ) + { + return departamento_id; + } + else if( fieldName == AnalisesAcidentesDataAuto.RH_FASE4 ) + { + return rh_fase4; + } + else if( fieldName == AnalisesAcidentesDataAuto.APAGADA ) + { + return apagada; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DATA_ACIDENTE ) ) + { + return data_acidente; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ACIDENTADO_ID ) ) + { + return acidentado_id; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ESTADO ) ) + { + return estado; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ESTABELECIMENTO_ID ) ) + { + return estabelecimento_id; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.HORAS_TURNO ) ) + { + return horas_turno; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.LOCAL_TRABALHO ) ) + { + return local_trabalho; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.TAREFA ) ) + { + return tarefa; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.SUBSTANCIAS ) ) + { + return substancias; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.CONDICOES ) ) + { + return condicoes; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.TESTEMUNHAS ) ) + { + return testemunhas; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.CONCLUSOES ) ) + { + return conclusoes; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ACCOES ) ) + { + return accoes; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.HORA_ACIDENTE ) ) + { + return hora_acidente; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.FORMACAO_SHST ) ) + { + return formacao_shst; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.FORMACAO_SHST_NAO_PORQUE ) ) + { + return formacao_shst_nao_porque; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.OUTROS_ACIDENTES_COM_COLABORADOR ) ) + { + return outros_acidentes_com_colaborador; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_ACIDENTES_COM_COLABORADOR ) ) + { + return nr_acidentes_com_colaborador; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_COLABORADOR1 ) ) + { + return nr_relatorio_acidente_colaborador1; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_COLABORADOR2 ) ) + { + return nr_relatorio_acidente_colaborador2; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_COLABORADOR3 ) ) + { + return nr_relatorio_acidente_colaborador3; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_COLABORADOR4 ) ) + { + return nr_relatorio_acidente_colaborador4; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ACIDENTES_OUTROS_COLABORADORES ) ) + { + return acidentes_outros_colaboradores; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_ACIDENTES_OUTROS_COLABORADORES ) ) + { + return nr_acidentes_outros_colaboradores; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES1 ) ) + { + return nr_relatorio_acidente_outros_colaboradores1; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES2 ) ) + { + return nr_relatorio_acidente_outros_colaboradores2; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES3 ) ) + { + return nr_relatorio_acidente_outros_colaboradores3; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES4 ) ) + { + return nr_relatorio_acidente_outros_colaboradores4; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.LESAO_CABECA ) ) + { + return lesao_cabeca; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.LESAO_PESCOCO ) ) + { + return lesao_pescoco; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.LESAO_TRONCO ) ) + { + return lesao_tronco; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.LESAO_MEMBRO_SUP_DIR ) ) + { + return lesao_membro_sup_dir; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.LESAO_MEMBRO_SUP_ESQ ) ) + { + return lesao_membro_sup_esq; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.LESAO_MEMBRO_INF_DIR ) ) + { + return lesao_membro_inf_dir; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.LESAO_MEMBRO_INF_ESQ ) ) + { + return lesao_membro_inf_esq; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ESPECIF1 ) ) + { + return especif1; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ESPECIF2 ) ) + { + return especif2; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ESPECIF3 ) ) + { + return especif3; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ESPECIF4 ) ) + { + return especif4; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.TIPO_INCAPACIDADE ) ) + { + return tipo_incapacidade; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.COEF_INCAPACIDADE ) ) + { + return coef_incapacidade; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DATA_AVAL_INCAPACIDADE ) ) + { + return data_aval_incapacidade; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DATA_REV_INCAPACIDADE ) ) + { + return data_rev_incapacidade; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.PERIODO_INCAPACIDADE_DE ) ) + { + return periodo_incapacidade_de; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.PERIODO_INCAPACIDADE_A ) ) + { + return periodo_incapacidade_a; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_FLEXAO ) ) + { + return img_flexao; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_EXT1 ) ) + { + return img_ext1; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_EXT2 ) ) + { + return img_ext2; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_CAB2 ) ) + { + return img_cab2; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_CAB3 ) ) + { + return img_cab3; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA2 ) ) + { + return img_ma2; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA3 ) ) + { + return img_ma3; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA5 ) ) + { + return img_ma5; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA6 ) ) + { + return img_ma6; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA8 ) ) + { + return img_ma8; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA10 ) ) + { + return img_ma10; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.RESTRICAO_CARGA ) ) + { + return restricao_carga; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.RESTRICAO_MOTRICIDADE ) ) + { + return restricao_motricidade; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.RESTRICAO_CONDUCAO ) ) + { + return restricao_conducao; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.RESTRICAO_VIBRACOES ) ) + { + return restricao_vibracoes; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.RESTRICAO_OUTRAS ) ) + { + return restricao_outras; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.MED_OBSERV ) ) + { + return med_observ; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.TIPO_LESAO ) ) + { + return tipo_lesao; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_ROT1 ) ) + { + return img_rot1; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_ROT2 ) ) + { + return img_rot2; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_CAB1 ) ) + { + return img_cab1; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_CAB4 ) ) + { + return img_cab4; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA1 ) ) + { + return img_ma1; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA4 ) ) + { + return img_ma4; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA7 ) ) + { + return img_ma7; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA9 ) ) + { + return img_ma9; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.EMPRESA_ID ) ) + { + return empresa_id; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.MEDICO_ID ) ) + { + return medico_id; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.TECNICO_SAUDE_ID ) ) + { + return tecnico_saude_id; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ANALISE_NR ) ) + { + return analise_nr; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ESTADO_ASSINATURA ) ) + { + return estado_assinatura; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ASS_RESP_SEG ) ) + { + return ass_resp_seg; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ASS_RESP_RH ) ) + { + return ass_resp_rh; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DATA_CONSOLIDACAO ) ) + { + return data_consolidacao; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DATA_ASSINATURA_SEG ) ) + { + return data_assinatura_seg; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DATA_ASSINATURA_RH ) ) + { + return data_assinatura_rh; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ASS_CONSOLIDACAO ) ) + { + return ass_consolidacao; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NOME_RESP_SEG ) ) + { + return nome_resp_seg; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NOME_RESP_RH ) ) + { + return nome_resp_rh; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.CAUSAS ) ) + { + return causas; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ESTADO_ANTES_CORRECAO ) ) + { + return estado_antes_correcao; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.OBSERVACOES_CORRECAO ) ) + { + return observacoes_correcao; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.CORRECAO ) ) + { + return correcao; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ASS_SUPERIOR ) ) + { + return ass_superior; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NOME_SUPERIOR ) ) + { + return nome_superior; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DATA_ASSINATURA_SUPERIOR ) ) + { + return data_assinatura_superior; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.AVERIGUADOR ) ) + { + return averiguador; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.AVERIGUACAO_POSTERIOR ) ) + { + return averiguacao_posterior; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.AVERIGUACAO_OBS ) ) + { + return averiguacao_obs; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DATA_INICIO_PROCESSO ) ) + { + return data_inicio_processo; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NOME_RESP_CONSOLIDACAO ) ) + { + return nome_resp_consolidacao; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.SECCAO_ID ) ) + { + return seccao_id; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DEPARTAMENTO_ID ) ) + { + return departamento_id; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.RH_FASE4 ) ) + { + return rh_fase4; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.APAGADA ) ) + { + return apagada; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == AnalisesAcidentesDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.DATA_ACIDENTE ) + { + data_acidente = ( java.util.Date ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.ACIDENTADO_ID ) + { + acidentado_id = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.ESTADO ) + { + estado = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.ESTABELECIMENTO_ID ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.HORAS_TURNO ) + { + horas_turno = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.LOCAL_TRABALHO ) + { + local_trabalho = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.TAREFA ) + { + tarefa = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.SUBSTANCIAS ) + { + substancias = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.CONDICOES ) + { + condicoes = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.TESTEMUNHAS ) + { + testemunhas = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.CONCLUSOES ) + { + conclusoes = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.ACCOES ) + { + accoes = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.HORA_ACIDENTE ) + { + hora_acidente = ( java.sql.Time ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.FORMACAO_SHST ) + { + formacao_shst = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.FORMACAO_SHST_NAO_PORQUE ) + { + formacao_shst_nao_porque = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.OUTROS_ACIDENTES_COM_COLABORADOR ) + { + outros_acidentes_com_colaborador = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_ACIDENTES_COM_COLABORADOR ) + { + nr_acidentes_com_colaborador = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_COLABORADOR1 ) + { + nr_relatorio_acidente_colaborador1 = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_COLABORADOR2 ) + { + nr_relatorio_acidente_colaborador2 = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_COLABORADOR3 ) + { + nr_relatorio_acidente_colaborador3 = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_COLABORADOR4 ) + { + nr_relatorio_acidente_colaborador4 = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.ACIDENTES_OUTROS_COLABORADORES ) + { + acidentes_outros_colaboradores = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_ACIDENTES_OUTROS_COLABORADORES ) + { + nr_acidentes_outros_colaboradores = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES1 ) + { + nr_relatorio_acidente_outros_colaboradores1 = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES2 ) + { + nr_relatorio_acidente_outros_colaboradores2 = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES3 ) + { + nr_relatorio_acidente_outros_colaboradores3 = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES4 ) + { + nr_relatorio_acidente_outros_colaboradores4 = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.LESAO_CABECA ) + { + lesao_cabeca = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.LESAO_PESCOCO ) + { + lesao_pescoco = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.LESAO_TRONCO ) + { + lesao_tronco = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.LESAO_MEMBRO_SUP_DIR ) + { + lesao_membro_sup_dir = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.LESAO_MEMBRO_SUP_ESQ ) + { + lesao_membro_sup_esq = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.LESAO_MEMBRO_INF_DIR ) + { + lesao_membro_inf_dir = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.LESAO_MEMBRO_INF_ESQ ) + { + lesao_membro_inf_esq = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.ESPECIF1 ) + { + especif1 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.ESPECIF2 ) + { + especif2 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.ESPECIF3 ) + { + especif3 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.ESPECIF4 ) + { + especif4 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.TIPO_INCAPACIDADE ) + { + tipo_incapacidade = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.COEF_INCAPACIDADE ) + { + coef_incapacidade = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.DATA_AVAL_INCAPACIDADE ) + { + data_aval_incapacidade = ( java.util.Date ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.DATA_REV_INCAPACIDADE ) + { + data_rev_incapacidade = ( java.util.Date ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.PERIODO_INCAPACIDADE_DE ) + { + periodo_incapacidade_de = ( java.util.Date ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.PERIODO_INCAPACIDADE_A ) + { + periodo_incapacidade_a = ( java.util.Date ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_FLEXAO ) + { + img_flexao = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_EXT1 ) + { + img_ext1 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_EXT2 ) + { + img_ext2 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_CAB2 ) + { + img_cab2 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_CAB3 ) + { + img_cab3 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA2 ) + { + img_ma2 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA3 ) + { + img_ma3 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA5 ) + { + img_ma5 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA6 ) + { + img_ma6 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA8 ) + { + img_ma8 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA10 ) + { + img_ma10 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.RESTRICAO_CARGA ) + { + restricao_carga = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.RESTRICAO_MOTRICIDADE ) + { + restricao_motricidade = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.RESTRICAO_CONDUCAO ) + { + restricao_conducao = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.RESTRICAO_VIBRACOES ) + { + restricao_vibracoes = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.RESTRICAO_OUTRAS ) + { + restricao_outras = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.MED_OBSERV ) + { + med_observ = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.TIPO_LESAO ) + { + tipo_lesao = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_ROT1 ) + { + img_rot1 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_ROT2 ) + { + img_rot2 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_CAB1 ) + { + img_cab1 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_CAB4 ) + { + img_cab4 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA1 ) + { + img_ma1 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA4 ) + { + img_ma4 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA7 ) + { + img_ma7 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.IMG_MA9 ) + { + img_ma9 = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.EMPRESA_ID ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.MEDICO_ID ) + { + medico_id = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.TECNICO_SAUDE_ID ) + { + tecnico_saude_id = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.ANALISE_NR ) + { + analise_nr = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.ESTADO_ASSINATURA ) + { + estado_assinatura = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.ASS_RESP_SEG ) + { + ass_resp_seg = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.ASS_RESP_RH ) + { + ass_resp_rh = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.DATA_CONSOLIDACAO ) + { + data_consolidacao = ( java.util.Date ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.DATA_ASSINATURA_SEG ) + { + data_assinatura_seg = ( java.util.Date ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.DATA_ASSINATURA_RH ) + { + data_assinatura_rh = ( java.util.Date ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.ASS_CONSOLIDACAO ) + { + ass_consolidacao = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.NOME_RESP_SEG ) + { + nome_resp_seg = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.NOME_RESP_RH ) + { + nome_resp_rh = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.CAUSAS ) + { + causas = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.ESTADO_ANTES_CORRECAO ) + { + estado_antes_correcao = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.OBSERVACOES_CORRECAO ) + { + observacoes_correcao = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.CORRECAO ) + { + correcao = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.ASS_SUPERIOR ) + { + ass_superior = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.NOME_SUPERIOR ) + { + nome_superior = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.DATA_ASSINATURA_SUPERIOR ) + { + data_assinatura_superior = ( java.util.Date ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.AVERIGUADOR ) + { + averiguador = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.AVERIGUACAO_POSTERIOR ) + { + averiguacao_posterior = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.AVERIGUACAO_OBS ) + { + averiguacao_obs = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.DATA_INICIO_PROCESSO ) + { + data_inicio_processo = ( java.util.Date ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.NOME_RESP_CONSOLIDACAO ) + { + nome_resp_consolidacao = ( String ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.SECCAO_ID ) + { + seccao_id = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.DEPARTAMENTO_ID ) + { + departamento_id = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.RH_FASE4 ) + { + rh_fase4 = ( Integer ) value; + } + else if( fieldName == AnalisesAcidentesDataAuto.APAGADA ) + { + apagada = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DATA_ACIDENTE ) ) + { + data_acidente = ( java.util.Date ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ACIDENTADO_ID ) ) + { + acidentado_id = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ESTADO ) ) + { + estado = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ESTABELECIMENTO_ID ) ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.HORAS_TURNO ) ) + { + horas_turno = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.LOCAL_TRABALHO ) ) + { + local_trabalho = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.TAREFA ) ) + { + tarefa = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.SUBSTANCIAS ) ) + { + substancias = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.CONDICOES ) ) + { + condicoes = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.TESTEMUNHAS ) ) + { + testemunhas = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.CONCLUSOES ) ) + { + conclusoes = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ACCOES ) ) + { + accoes = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.HORA_ACIDENTE ) ) + { + hora_acidente = ( java.sql.Time ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.FORMACAO_SHST ) ) + { + formacao_shst = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.FORMACAO_SHST_NAO_PORQUE ) ) + { + formacao_shst_nao_porque = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.OUTROS_ACIDENTES_COM_COLABORADOR ) ) + { + outros_acidentes_com_colaborador = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_ACIDENTES_COM_COLABORADOR ) ) + { + nr_acidentes_com_colaborador = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_COLABORADOR1 ) ) + { + nr_relatorio_acidente_colaborador1 = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_COLABORADOR2 ) ) + { + nr_relatorio_acidente_colaborador2 = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_COLABORADOR3 ) ) + { + nr_relatorio_acidente_colaborador3 = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_COLABORADOR4 ) ) + { + nr_relatorio_acidente_colaborador4 = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ACIDENTES_OUTROS_COLABORADORES ) ) + { + acidentes_outros_colaboradores = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_ACIDENTES_OUTROS_COLABORADORES ) ) + { + nr_acidentes_outros_colaboradores = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES1 ) ) + { + nr_relatorio_acidente_outros_colaboradores1 = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES2 ) ) + { + nr_relatorio_acidente_outros_colaboradores2 = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES3 ) ) + { + nr_relatorio_acidente_outros_colaboradores3 = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES4 ) ) + { + nr_relatorio_acidente_outros_colaboradores4 = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.LESAO_CABECA ) ) + { + lesao_cabeca = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.LESAO_PESCOCO ) ) + { + lesao_pescoco = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.LESAO_TRONCO ) ) + { + lesao_tronco = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.LESAO_MEMBRO_SUP_DIR ) ) + { + lesao_membro_sup_dir = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.LESAO_MEMBRO_SUP_ESQ ) ) + { + lesao_membro_sup_esq = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.LESAO_MEMBRO_INF_DIR ) ) + { + lesao_membro_inf_dir = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.LESAO_MEMBRO_INF_ESQ ) ) + { + lesao_membro_inf_esq = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ESPECIF1 ) ) + { + especif1 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ESPECIF2 ) ) + { + especif2 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ESPECIF3 ) ) + { + especif3 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ESPECIF4 ) ) + { + especif4 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.TIPO_INCAPACIDADE ) ) + { + tipo_incapacidade = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.COEF_INCAPACIDADE ) ) + { + coef_incapacidade = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DATA_AVAL_INCAPACIDADE ) ) + { + data_aval_incapacidade = ( java.util.Date ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DATA_REV_INCAPACIDADE ) ) + { + data_rev_incapacidade = ( java.util.Date ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.PERIODO_INCAPACIDADE_DE ) ) + { + periodo_incapacidade_de = ( java.util.Date ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.PERIODO_INCAPACIDADE_A ) ) + { + periodo_incapacidade_a = ( java.util.Date ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_FLEXAO ) ) + { + img_flexao = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_EXT1 ) ) + { + img_ext1 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_EXT2 ) ) + { + img_ext2 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_CAB2 ) ) + { + img_cab2 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_CAB3 ) ) + { + img_cab3 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA2 ) ) + { + img_ma2 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA3 ) ) + { + img_ma3 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA5 ) ) + { + img_ma5 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA6 ) ) + { + img_ma6 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA8 ) ) + { + img_ma8 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA10 ) ) + { + img_ma10 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.RESTRICAO_CARGA ) ) + { + restricao_carga = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.RESTRICAO_MOTRICIDADE ) ) + { + restricao_motricidade = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.RESTRICAO_CONDUCAO ) ) + { + restricao_conducao = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.RESTRICAO_VIBRACOES ) ) + { + restricao_vibracoes = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.RESTRICAO_OUTRAS ) ) + { + restricao_outras = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.MED_OBSERV ) ) + { + med_observ = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.TIPO_LESAO ) ) + { + tipo_lesao = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_ROT1 ) ) + { + img_rot1 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_ROT2 ) ) + { + img_rot2 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_CAB1 ) ) + { + img_cab1 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_CAB4 ) ) + { + img_cab4 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA1 ) ) + { + img_ma1 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA4 ) ) + { + img_ma4 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA7 ) ) + { + img_ma7 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.IMG_MA9 ) ) + { + img_ma9 = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.EMPRESA_ID ) ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.MEDICO_ID ) ) + { + medico_id = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.TECNICO_SAUDE_ID ) ) + { + tecnico_saude_id = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ANALISE_NR ) ) + { + analise_nr = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ESTADO_ASSINATURA ) ) + { + estado_assinatura = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ASS_RESP_SEG ) ) + { + ass_resp_seg = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ASS_RESP_RH ) ) + { + ass_resp_rh = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DATA_CONSOLIDACAO ) ) + { + data_consolidacao = ( java.util.Date ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DATA_ASSINATURA_SEG ) ) + { + data_assinatura_seg = ( java.util.Date ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DATA_ASSINATURA_RH ) ) + { + data_assinatura_rh = ( java.util.Date ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ASS_CONSOLIDACAO ) ) + { + ass_consolidacao = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NOME_RESP_SEG ) ) + { + nome_resp_seg = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NOME_RESP_RH ) ) + { + nome_resp_rh = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.CAUSAS ) ) + { + causas = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ESTADO_ANTES_CORRECAO ) ) + { + estado_antes_correcao = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.OBSERVACOES_CORRECAO ) ) + { + observacoes_correcao = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.CORRECAO ) ) + { + correcao = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.ASS_SUPERIOR ) ) + { + ass_superior = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NOME_SUPERIOR ) ) + { + nome_superior = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DATA_ASSINATURA_SUPERIOR ) ) + { + data_assinatura_superior = ( java.util.Date ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.AVERIGUADOR ) ) + { + averiguador = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.AVERIGUACAO_POSTERIOR ) ) + { + averiguacao_posterior = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.AVERIGUACAO_OBS ) ) + { + averiguacao_obs = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DATA_INICIO_PROCESSO ) ) + { + data_inicio_processo = ( java.util.Date ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.NOME_RESP_CONSOLIDACAO ) ) + { + nome_resp_consolidacao = ( String ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.SECCAO_ID ) ) + { + seccao_id = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.DEPARTAMENTO_ID ) ) + { + departamento_id = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.RH_FASE4 ) ) + { + rh_fase4 = ( Integer ) value; + } + else if( fieldName.equals( AnalisesAcidentesDataAuto.APAGADA ) ) + { + apagada = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public java.util.Date getData_acidente() + { + return data_acidente; + } + + public void setData_acidente(java.util.Date data_acidenteValue ) + { + this.data_acidente = data_acidenteValue; + } + + public Integer getAcidentado_id() + { + return acidentado_id; + } + + public void setAcidentado_id(Integer acidentado_idValue ) + { + this.acidentado_id = acidentado_idValue; + } + + public Integer getEstado() + { + return estado; + } + + public void setEstado(Integer estadoValue ) + { + this.estado = estadoValue; + } + + public Integer getEstabelecimento_id() + { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + this.estabelecimento_id = estabelecimento_idValue; + } + + public Integer getHoras_turno() + { + return horas_turno; + } + + public void setHoras_turno(Integer horas_turnoValue ) + { + this.horas_turno = horas_turnoValue; + } + + public String getLocal_trabalho() + { + return local_trabalho; + } + + public void setLocal_trabalho(String local_trabalhoValue ) + { + this.local_trabalho = local_trabalhoValue; + } + + public String getTarefa() + { + return tarefa; + } + + public void setTarefa(String tarefaValue ) + { + this.tarefa = tarefaValue; + } + + public String getSubstancias() + { + return substancias; + } + + public void setSubstancias(String substanciasValue ) + { + this.substancias = substanciasValue; + } + + public String getCondicoes() + { + return condicoes; + } + + public void setCondicoes(String condicoesValue ) + { + this.condicoes = condicoesValue; + } + + public String getTestemunhas() + { + return testemunhas; + } + + public void setTestemunhas(String testemunhasValue ) + { + this.testemunhas = testemunhasValue; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public String getConclusoes() + { + return conclusoes; + } + + public void setConclusoes(String conclusoesValue ) + { + this.conclusoes = conclusoesValue; + } + + public String getAccoes() + { + return accoes; + } + + public void setAccoes(String accoesValue ) + { + this.accoes = accoesValue; + } + + public java.sql.Time getHora_acidente() + { + return hora_acidente; + } + + public void setHora_acidente(java.sql.Time hora_acidenteValue ) + { + this.hora_acidente = hora_acidenteValue; + } + + public String getFormacao_shst() + { + return formacao_shst; + } + + public void setFormacao_shst(String formacao_shstValue ) + { + this.formacao_shst = formacao_shstValue; + } + + public String getFormacao_shst_nao_porque() + { + return formacao_shst_nao_porque; + } + + public void setFormacao_shst_nao_porque(String formacao_shst_nao_porqueValue ) + { + this.formacao_shst_nao_porque = formacao_shst_nao_porqueValue; + } + + public String getOutros_acidentes_com_colaborador() + { + return outros_acidentes_com_colaborador; + } + + public void setOutros_acidentes_com_colaborador(String outros_acidentes_com_colaboradorValue ) + { + this.outros_acidentes_com_colaborador = outros_acidentes_com_colaboradorValue; + } + + public Integer getNr_acidentes_com_colaborador() + { + return nr_acidentes_com_colaborador; + } + + public void setNr_acidentes_com_colaborador(Integer nr_acidentes_com_colaboradorValue ) + { + this.nr_acidentes_com_colaborador = nr_acidentes_com_colaboradorValue; + } + + public Integer getNr_relatorio_acidente_colaborador1() + { + return nr_relatorio_acidente_colaborador1; + } + + public void setNr_relatorio_acidente_colaborador1(Integer nr_relatorio_acidente_colaborador1Value ) + { + this.nr_relatorio_acidente_colaborador1 = nr_relatorio_acidente_colaborador1Value; + } + + public Integer getNr_relatorio_acidente_colaborador2() + { + return nr_relatorio_acidente_colaborador2; + } + + public void setNr_relatorio_acidente_colaborador2(Integer nr_relatorio_acidente_colaborador2Value ) + { + this.nr_relatorio_acidente_colaborador2 = nr_relatorio_acidente_colaborador2Value; + } + + public Integer getNr_relatorio_acidente_colaborador3() + { + return nr_relatorio_acidente_colaborador3; + } + + public void setNr_relatorio_acidente_colaborador3(Integer nr_relatorio_acidente_colaborador3Value ) + { + this.nr_relatorio_acidente_colaborador3 = nr_relatorio_acidente_colaborador3Value; + } + + public Integer getNr_relatorio_acidente_colaborador4() + { + return nr_relatorio_acidente_colaborador4; + } + + public void setNr_relatorio_acidente_colaborador4(Integer nr_relatorio_acidente_colaborador4Value ) + { + this.nr_relatorio_acidente_colaborador4 = nr_relatorio_acidente_colaborador4Value; + } + + public String getAcidentes_outros_colaboradores() + { + return acidentes_outros_colaboradores; + } + + public void setAcidentes_outros_colaboradores(String acidentes_outros_colaboradoresValue ) + { + this.acidentes_outros_colaboradores = acidentes_outros_colaboradoresValue; + } + + public Integer getNr_acidentes_outros_colaboradores() + { + return nr_acidentes_outros_colaboradores; + } + + public void setNr_acidentes_outros_colaboradores(Integer nr_acidentes_outros_colaboradoresValue ) + { + this.nr_acidentes_outros_colaboradores = nr_acidentes_outros_colaboradoresValue; + } + + public Integer getNr_relatorio_acidente_outros_colaboradores1() + { + return nr_relatorio_acidente_outros_colaboradores1; + } + + public void setNr_relatorio_acidente_outros_colaboradores1(Integer nr_relatorio_acidente_outros_colaboradores1Value ) + { + this.nr_relatorio_acidente_outros_colaboradores1 = nr_relatorio_acidente_outros_colaboradores1Value; + } + + public Integer getNr_relatorio_acidente_outros_colaboradores2() + { + return nr_relatorio_acidente_outros_colaboradores2; + } + + public void setNr_relatorio_acidente_outros_colaboradores2(Integer nr_relatorio_acidente_outros_colaboradores2Value ) + { + this.nr_relatorio_acidente_outros_colaboradores2 = nr_relatorio_acidente_outros_colaboradores2Value; + } + + public Integer getNr_relatorio_acidente_outros_colaboradores3() + { + return nr_relatorio_acidente_outros_colaboradores3; + } + + public void setNr_relatorio_acidente_outros_colaboradores3(Integer nr_relatorio_acidente_outros_colaboradores3Value ) + { + this.nr_relatorio_acidente_outros_colaboradores3 = nr_relatorio_acidente_outros_colaboradores3Value; + } + + public Integer getNr_relatorio_acidente_outros_colaboradores4() + { + return nr_relatorio_acidente_outros_colaboradores4; + } + + public void setNr_relatorio_acidente_outros_colaboradores4(Integer nr_relatorio_acidente_outros_colaboradores4Value ) + { + this.nr_relatorio_acidente_outros_colaboradores4 = nr_relatorio_acidente_outros_colaboradores4Value; + } + + public String getLesao_cabeca() + { + return lesao_cabeca; + } + + public void setLesao_cabeca(String lesao_cabecaValue ) + { + this.lesao_cabeca = lesao_cabecaValue; + } + + public String getLesao_pescoco() + { + return lesao_pescoco; + } + + public void setLesao_pescoco(String lesao_pescocoValue ) + { + this.lesao_pescoco = lesao_pescocoValue; + } + + public String getLesao_tronco() + { + return lesao_tronco; + } + + public void setLesao_tronco(String lesao_troncoValue ) + { + this.lesao_tronco = lesao_troncoValue; + } + + public String getLesao_membro_sup_dir() + { + return lesao_membro_sup_dir; + } + + public void setLesao_membro_sup_dir(String lesao_membro_sup_dirValue ) + { + this.lesao_membro_sup_dir = lesao_membro_sup_dirValue; + } + + public String getLesao_membro_sup_esq() + { + return lesao_membro_sup_esq; + } + + public void setLesao_membro_sup_esq(String lesao_membro_sup_esqValue ) + { + this.lesao_membro_sup_esq = lesao_membro_sup_esqValue; + } + + public String getLesao_membro_inf_dir() + { + return lesao_membro_inf_dir; + } + + public void setLesao_membro_inf_dir(String lesao_membro_inf_dirValue ) + { + this.lesao_membro_inf_dir = lesao_membro_inf_dirValue; + } + + public String getLesao_membro_inf_esq() + { + return lesao_membro_inf_esq; + } + + public void setLesao_membro_inf_esq(String lesao_membro_inf_esqValue ) + { + this.lesao_membro_inf_esq = lesao_membro_inf_esqValue; + } + + public String getEspecif1() + { + return especif1; + } + + public void setEspecif1(String especif1Value ) + { + this.especif1 = especif1Value; + } + + public String getEspecif2() + { + return especif2; + } + + public void setEspecif2(String especif2Value ) + { + this.especif2 = especif2Value; + } + + public String getEspecif3() + { + return especif3; + } + + public void setEspecif3(String especif3Value ) + { + this.especif3 = especif3Value; + } + + public String getEspecif4() + { + return especif4; + } + + public void setEspecif4(String especif4Value ) + { + this.especif4 = especif4Value; + } + + public String getTipo_incapacidade() + { + return tipo_incapacidade; + } + + public void setTipo_incapacidade(String tipo_incapacidadeValue ) + { + this.tipo_incapacidade = tipo_incapacidadeValue; + } + + public Integer getCoef_incapacidade() + { + return coef_incapacidade; + } + + public void setCoef_incapacidade(Integer coef_incapacidadeValue ) + { + this.coef_incapacidade = coef_incapacidadeValue; + } + + public java.util.Date getData_aval_incapacidade() + { + return data_aval_incapacidade; + } + + public void setData_aval_incapacidade(java.util.Date data_aval_incapacidadeValue ) + { + this.data_aval_incapacidade = data_aval_incapacidadeValue; + } + + public java.util.Date getData_rev_incapacidade() + { + return data_rev_incapacidade; + } + + public void setData_rev_incapacidade(java.util.Date data_rev_incapacidadeValue ) + { + this.data_rev_incapacidade = data_rev_incapacidadeValue; + } + + public java.util.Date getPeriodo_incapacidade_de() + { + return periodo_incapacidade_de; + } + + public void setPeriodo_incapacidade_de(java.util.Date periodo_incapacidade_deValue ) + { + this.periodo_incapacidade_de = periodo_incapacidade_deValue; + } + + public java.util.Date getPeriodo_incapacidade_a() + { + return periodo_incapacidade_a; + } + + public void setPeriodo_incapacidade_a(java.util.Date periodo_incapacidade_aValue ) + { + this.periodo_incapacidade_a = periodo_incapacidade_aValue; + } + + public String getImg_flexao() + { + return img_flexao; + } + + public void setImg_flexao(String img_flexaoValue ) + { + this.img_flexao = img_flexaoValue; + } + + public String getImg_ext1() + { + return img_ext1; + } + + public void setImg_ext1(String img_ext1Value ) + { + this.img_ext1 = img_ext1Value; + } + + public String getImg_ext2() + { + return img_ext2; + } + + public void setImg_ext2(String img_ext2Value ) + { + this.img_ext2 = img_ext2Value; + } + + public String getImg_cab2() + { + return img_cab2; + } + + public void setImg_cab2(String img_cab2Value ) + { + this.img_cab2 = img_cab2Value; + } + + public String getImg_cab3() + { + return img_cab3; + } + + public void setImg_cab3(String img_cab3Value ) + { + this.img_cab3 = img_cab3Value; + } + + public String getImg_ma2() + { + return img_ma2; + } + + public void setImg_ma2(String img_ma2Value ) + { + this.img_ma2 = img_ma2Value; + } + + public String getImg_ma3() + { + return img_ma3; + } + + public void setImg_ma3(String img_ma3Value ) + { + this.img_ma3 = img_ma3Value; + } + + public String getImg_ma5() + { + return img_ma5; + } + + public void setImg_ma5(String img_ma5Value ) + { + this.img_ma5 = img_ma5Value; + } + + public String getImg_ma6() + { + return img_ma6; + } + + public void setImg_ma6(String img_ma6Value ) + { + this.img_ma6 = img_ma6Value; + } + + public String getImg_ma8() + { + return img_ma8; + } + + public void setImg_ma8(String img_ma8Value ) + { + this.img_ma8 = img_ma8Value; + } + + public String getImg_ma10() + { + return img_ma10; + } + + public void setImg_ma10(String img_ma10Value ) + { + this.img_ma10 = img_ma10Value; + } + + public Integer getRestricao_carga() + { + return restricao_carga; + } + + public void setRestricao_carga(Integer restricao_cargaValue ) + { + this.restricao_carga = restricao_cargaValue; + } + + public String getRestricao_motricidade() + { + return restricao_motricidade; + } + + public void setRestricao_motricidade(String restricao_motricidadeValue ) + { + this.restricao_motricidade = restricao_motricidadeValue; + } + + public String getRestricao_conducao() + { + return restricao_conducao; + } + + public void setRestricao_conducao(String restricao_conducaoValue ) + { + this.restricao_conducao = restricao_conducaoValue; + } + + public String getRestricao_vibracoes() + { + return restricao_vibracoes; + } + + public void setRestricao_vibracoes(String restricao_vibracoesValue ) + { + this.restricao_vibracoes = restricao_vibracoesValue; + } + + public String getRestricao_outras() + { + return restricao_outras; + } + + public void setRestricao_outras(String restricao_outrasValue ) + { + this.restricao_outras = restricao_outrasValue; + } + + public String getMed_observ() + { + return med_observ; + } + + public void setMed_observ(String med_observValue ) + { + this.med_observ = med_observValue; + } + + public String getTipo_lesao() + { + return tipo_lesao; + } + + public void setTipo_lesao(String tipo_lesaoValue ) + { + this.tipo_lesao = tipo_lesaoValue; + } + + public String getImg_rot1() + { + return img_rot1; + } + + public void setImg_rot1(String img_rot1Value ) + { + this.img_rot1 = img_rot1Value; + } + + public String getImg_rot2() + { + return img_rot2; + } + + public void setImg_rot2(String img_rot2Value ) + { + this.img_rot2 = img_rot2Value; + } + + public String getImg_cab1() + { + return img_cab1; + } + + public void setImg_cab1(String img_cab1Value ) + { + this.img_cab1 = img_cab1Value; + } + + public String getImg_cab4() + { + return img_cab4; + } + + public void setImg_cab4(String img_cab4Value ) + { + this.img_cab4 = img_cab4Value; + } + + public String getImg_ma1() + { + return img_ma1; + } + + public void setImg_ma1(String img_ma1Value ) + { + this.img_ma1 = img_ma1Value; + } + + public String getImg_ma4() + { + return img_ma4; + } + + public void setImg_ma4(String img_ma4Value ) + { + this.img_ma4 = img_ma4Value; + } + + public String getImg_ma7() + { + return img_ma7; + } + + public void setImg_ma7(String img_ma7Value ) + { + this.img_ma7 = img_ma7Value; + } + + public String getImg_ma9() + { + return img_ma9; + } + + public void setImg_ma9(String img_ma9Value ) + { + this.img_ma9 = img_ma9Value; + } + + public Integer getEmpresa_id() + { + return empresa_id; + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + this.empresa_id = empresa_idValue; + } + + public Integer getMedico_id() + { + return medico_id; + } + + public void setMedico_id(Integer medico_idValue ) + { + this.medico_id = medico_idValue; + } + + public Integer getTecnico_saude_id() + { + return tecnico_saude_id; + } + + public void setTecnico_saude_id(Integer tecnico_saude_idValue ) + { + this.tecnico_saude_id = tecnico_saude_idValue; + } + + public String getAnalise_nr() + { + return analise_nr; + } + + public void setAnalise_nr(String analise_nrValue ) + { + this.analise_nr = analise_nrValue; + } + + public Integer getEstado_assinatura() + { + return estado_assinatura; + } + + public void setEstado_assinatura(Integer estado_assinaturaValue ) + { + this.estado_assinatura = estado_assinaturaValue; + } + + public String getAss_resp_seg() + { + return ass_resp_seg; + } + + public void setAss_resp_seg(String ass_resp_segValue ) + { + this.ass_resp_seg = ass_resp_segValue; + } + + public String getAss_resp_rh() + { + return ass_resp_rh; + } + + public void setAss_resp_rh(String ass_resp_rhValue ) + { + this.ass_resp_rh = ass_resp_rhValue; + } + + public java.util.Date getData_consolidacao() + { + return data_consolidacao; + } + + public void setData_consolidacao(java.util.Date data_consolidacaoValue ) + { + this.data_consolidacao = data_consolidacaoValue; + } + + public java.util.Date getData_assinatura_seg() + { + return data_assinatura_seg; + } + + public void setData_assinatura_seg(java.util.Date data_assinatura_segValue ) + { + this.data_assinatura_seg = data_assinatura_segValue; + } + + public java.util.Date getData_assinatura_rh() + { + return data_assinatura_rh; + } + + public void setData_assinatura_rh(java.util.Date data_assinatura_rhValue ) + { + this.data_assinatura_rh = data_assinatura_rhValue; + } + + public String getAss_consolidacao() + { + return ass_consolidacao; + } + + public void setAss_consolidacao(String ass_consolidacaoValue ) + { + this.ass_consolidacao = ass_consolidacaoValue; + } + + public String getNome_resp_seg() + { + return nome_resp_seg; + } + + public void setNome_resp_seg(String nome_resp_segValue ) + { + this.nome_resp_seg = nome_resp_segValue; + } + + public String getNome_resp_rh() + { + return nome_resp_rh; + } + + public void setNome_resp_rh(String nome_resp_rhValue ) + { + this.nome_resp_rh = nome_resp_rhValue; + } + + public Integer getCausas() + { + return causas; + } + + public void setCausas(Integer causasValue ) + { + this.causas = causasValue; + } + + public Integer getEstado_antes_correcao() + { + return estado_antes_correcao; + } + + public void setEstado_antes_correcao(Integer estado_antes_correcaoValue ) + { + this.estado_antes_correcao = estado_antes_correcaoValue; + } + + public String getObservacoes_correcao() + { + return observacoes_correcao; + } + + public void setObservacoes_correcao(String observacoes_correcaoValue ) + { + this.observacoes_correcao = observacoes_correcaoValue; + } + + public String getCorrecao() + { + return correcao; + } + + public void setCorrecao(String correcaoValue ) + { + this.correcao = correcaoValue; + } + + public String getAss_superior() + { + return ass_superior; + } + + public void setAss_superior(String ass_superiorValue ) + { + this.ass_superior = ass_superiorValue; + } + + public String getNome_superior() + { + return nome_superior; + } + + public void setNome_superior(String nome_superiorValue ) + { + this.nome_superior = nome_superiorValue; + } + + public java.util.Date getData_assinatura_superior() + { + return data_assinatura_superior; + } + + public void setData_assinatura_superior(java.util.Date data_assinatura_superiorValue ) + { + this.data_assinatura_superior = data_assinatura_superiorValue; + } + + public String getAveriguador() + { + return averiguador; + } + + public void setAveriguador(String averiguadorValue ) + { + this.averiguador = averiguadorValue; + } + + public String getAveriguacao_posterior() + { + return averiguacao_posterior; + } + + public void setAveriguacao_posterior(String averiguacao_posteriorValue ) + { + this.averiguacao_posterior = averiguacao_posteriorValue; + } + + public String getAveriguacao_obs() + { + return averiguacao_obs; + } + + public void setAveriguacao_obs(String averiguacao_obsValue ) + { + this.averiguacao_obs = averiguacao_obsValue; + } + + public java.util.Date getData_inicio_processo() + { + return data_inicio_processo; + } + + public void setData_inicio_processo(java.util.Date data_inicio_processoValue ) + { + this.data_inicio_processo = data_inicio_processoValue; + } + + public String getNome_resp_consolidacao() + { + return nome_resp_consolidacao; + } + + public void setNome_resp_consolidacao(String nome_resp_consolidacaoValue ) + { + this.nome_resp_consolidacao = nome_resp_consolidacaoValue; + } + + public Integer getSeccao_id() + { + return seccao_id; + } + + public void setSeccao_id(Integer seccao_idValue ) + { + this.seccao_id = seccao_idValue; + } + + public Integer getDepartamento_id() + { + return departamento_id; + } + + public void setDepartamento_id(Integer departamento_idValue ) + { + this.departamento_id = departamento_idValue; + } + + public Integer getRh_fase4() + { + return rh_fase4; + } + + public void setRh_fase4(Integer rh_fase4Value ) + { + this.rh_fase4 = rh_fase4Value; + } + + public String getApagada() + { + return apagada; + } + + public void setApagada(String apagadaValue ) + { + this.apagada = apagadaValue; + } + + public Class getOuterClass() + { + return AnalisesAcidentesDataAuto.class; + } + + public AnalisesAcidentesDataAuto getOuterClassInstance() + { + AnalisesAcidentesDataAuto outerObj = new AnalisesAcidentesDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/AnalisesAcidentesData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/AnalisesAcidentesData.java new file mode 100644 index 00000000..71728d0d --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/AnalisesAcidentesData.java @@ -0,0 +1,18 @@ +/* +* AnalisesAcidentesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class AnalisesAcidentesData extends com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesDataAuto +{ + + public AnalisesAcidentesData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/AnalisesAcidentesDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/AnalisesAcidentesDataAuto.java new file mode 100644 index 00000000..adc55a22 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/AnalisesAcidentesDataAuto.java @@ -0,0 +1,1393 @@ +/* +* AnalisesAcidentesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class AnalisesAcidentesDataAuto extends JDOObject +{ + + public static final String TABLENAME = "analises_acidentes"; + + public static final String ID = "id"; + public static final String ID_FULL = "analises_acidentes.id"; + public static final String DATA_ACIDENTE = "data_acidente"; + public static final String DATA_ACIDENTE_FULL = "analises_acidentes.data_acidente"; + public static final String ACIDENTADO_ID = "acidentado_id"; + public static final String ACIDENTADO_ID_FULL = "analises_acidentes.acidentado_id"; + public static final String TO_ACIDENTADO_ID = "to acidentado_id"; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "analises_acidentes.estado"; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "analises_acidentes.estabelecimento_id"; + public static final String HORAS_TURNO = "horas_turno"; + public static final String HORAS_TURNO_FULL = "analises_acidentes.horas_turno"; + public static final String LOCAL_TRABALHO = "local_trabalho"; + public static final String LOCAL_TRABALHO_FULL = "analises_acidentes.local_trabalho"; + public static final String TAREFA = "tarefa"; + public static final String TAREFA_FULL = "analises_acidentes.tarefa"; + public static final String SUBSTANCIAS = "substancias"; + public static final String SUBSTANCIAS_FULL = "analises_acidentes.substancias"; + public static final String CONDICOES = "condicoes"; + public static final String CONDICOES_FULL = "analises_acidentes.condicoes"; + public static final String TESTEMUNHAS = "testemunhas"; + public static final String TESTEMUNHAS_FULL = "analises_acidentes.testemunhas"; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "analises_acidentes.descricao"; + public static final String CONCLUSOES = "conclusoes"; + public static final String CONCLUSOES_FULL = "analises_acidentes.conclusoes"; + public static final String ACCOES = "accoes"; + public static final String ACCOES_FULL = "analises_acidentes.accoes"; + public static final String HORA_ACIDENTE = "hora_acidente"; + public static final String HORA_ACIDENTE_FULL = "analises_acidentes.hora_acidente"; + public static final String FORMACAO_SHST = "formacao_shst"; + public static final String FORMACAO_SHST_FULL = "analises_acidentes.formacao_shst"; + public static final String FORMACAO_SHST_NAO_PORQUE = "formacao_shst_nao_porque"; + public static final String FORMACAO_SHST_NAO_PORQUE_FULL = "analises_acidentes.formacao_shst_nao_porque"; + public static final String OUTROS_ACIDENTES_COM_COLABORADOR = "outros_acidentes_com_colaborador"; + public static final String OUTROS_ACIDENTES_COM_COLABORADOR_FULL = "analises_acidentes.outros_acidentes_com_colaborador"; + public static final String NR_ACIDENTES_COM_COLABORADOR = "nr_acidentes_com_colaborador"; + public static final String NR_ACIDENTES_COM_COLABORADOR_FULL = "analises_acidentes.nr_acidentes_com_colaborador"; + public static final String NR_RELATORIO_ACIDENTE_COLABORADOR1 = "nr_relatorio_acidente_colaborador1"; + public static final String NR_RELATORIO_ACIDENTE_COLABORADOR1_FULL = "analises_acidentes.nr_relatorio_acidente_colaborador1"; + public static final String NR_RELATORIO_ACIDENTE_COLABORADOR2 = "nr_relatorio_acidente_colaborador2"; + public static final String NR_RELATORIO_ACIDENTE_COLABORADOR2_FULL = "analises_acidentes.nr_relatorio_acidente_colaborador2"; + public static final String NR_RELATORIO_ACIDENTE_COLABORADOR3 = "nr_relatorio_acidente_colaborador3"; + public static final String NR_RELATORIO_ACIDENTE_COLABORADOR3_FULL = "analises_acidentes.nr_relatorio_acidente_colaborador3"; + public static final String NR_RELATORIO_ACIDENTE_COLABORADOR4 = "nr_relatorio_acidente_colaborador4"; + public static final String NR_RELATORIO_ACIDENTE_COLABORADOR4_FULL = "analises_acidentes.nr_relatorio_acidente_colaborador4"; + public static final String ACIDENTES_OUTROS_COLABORADORES = "acidentes_outros_colaboradores"; + public static final String ACIDENTES_OUTROS_COLABORADORES_FULL = "analises_acidentes.acidentes_outros_colaboradores"; + public static final String NR_ACIDENTES_OUTROS_COLABORADORES = "nr_acidentes_outros_colaboradores"; + public static final String NR_ACIDENTES_OUTROS_COLABORADORES_FULL = "analises_acidentes.nr_acidentes_outros_colaboradores"; + public static final String NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES1 = "nr_relatorio_acidente_outros_colaboradores1"; + public static final String NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES1_FULL = "analises_acidentes.nr_relatorio_acidente_outros_colaboradores1"; + public static final String NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES2 = "nr_relatorio_acidente_outros_colaboradores2"; + public static final String NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES2_FULL = "analises_acidentes.nr_relatorio_acidente_outros_colaboradores2"; + public static final String NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES3 = "nr_relatorio_acidente_outros_colaboradores3"; + public static final String NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES3_FULL = "analises_acidentes.nr_relatorio_acidente_outros_colaboradores3"; + public static final String NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES4 = "nr_relatorio_acidente_outros_colaboradores4"; + public static final String NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES4_FULL = "analises_acidentes.nr_relatorio_acidente_outros_colaboradores4"; + public static final String LESAO_CABECA = "lesao_cabeca"; + public static final String LESAO_CABECA_FULL = "analises_acidentes.lesao_cabeca"; + public static final String LESAO_PESCOCO = "lesao_pescoco"; + public static final String LESAO_PESCOCO_FULL = "analises_acidentes.lesao_pescoco"; + public static final String LESAO_TRONCO = "lesao_tronco"; + public static final String LESAO_TRONCO_FULL = "analises_acidentes.lesao_tronco"; + public static final String LESAO_MEMBRO_SUP_DIR = "lesao_membro_sup_dir"; + public static final String LESAO_MEMBRO_SUP_DIR_FULL = "analises_acidentes.lesao_membro_sup_dir"; + public static final String LESAO_MEMBRO_SUP_ESQ = "lesao_membro_sup_esq"; + public static final String LESAO_MEMBRO_SUP_ESQ_FULL = "analises_acidentes.lesao_membro_sup_esq"; + public static final String LESAO_MEMBRO_INF_DIR = "lesao_membro_inf_dir"; + public static final String LESAO_MEMBRO_INF_DIR_FULL = "analises_acidentes.lesao_membro_inf_dir"; + public static final String LESAO_MEMBRO_INF_ESQ = "lesao_membro_inf_esq"; + public static final String LESAO_MEMBRO_INF_ESQ_FULL = "analises_acidentes.lesao_membro_inf_esq"; + public static final String ESPECIF1 = "especif1"; + public static final String ESPECIF1_FULL = "analises_acidentes.especif1"; + public static final String ESPECIF2 = "especif2"; + public static final String ESPECIF2_FULL = "analises_acidentes.especif2"; + public static final String ESPECIF3 = "especif3"; + public static final String ESPECIF3_FULL = "analises_acidentes.especif3"; + public static final String ESPECIF4 = "especif4"; + public static final String ESPECIF4_FULL = "analises_acidentes.especif4"; + public static final String TIPO_INCAPACIDADE = "tipo_incapacidade"; + public static final String TIPO_INCAPACIDADE_FULL = "analises_acidentes.tipo_incapacidade"; + public static final String COEF_INCAPACIDADE = "coef_incapacidade"; + public static final String COEF_INCAPACIDADE_FULL = "analises_acidentes.coef_incapacidade"; + public static final String DATA_AVAL_INCAPACIDADE = "data_aval_incapacidade"; + public static final String DATA_AVAL_INCAPACIDADE_FULL = "analises_acidentes.data_aval_incapacidade"; + public static final String DATA_REV_INCAPACIDADE = "data_rev_incapacidade"; + public static final String DATA_REV_INCAPACIDADE_FULL = "analises_acidentes.data_rev_incapacidade"; + public static final String PERIODO_INCAPACIDADE_DE = "periodo_incapacidade_de"; + public static final String PERIODO_INCAPACIDADE_DE_FULL = "analises_acidentes.periodo_incapacidade_de"; + public static final String PERIODO_INCAPACIDADE_A = "periodo_incapacidade_a"; + public static final String PERIODO_INCAPACIDADE_A_FULL = "analises_acidentes.periodo_incapacidade_a"; + public static final String IMG_FLEXAO = "img_flexao"; + public static final String IMG_FLEXAO_FULL = "analises_acidentes.img_flexao"; + public static final String IMG_EXT1 = "img_ext1"; + public static final String IMG_EXT1_FULL = "analises_acidentes.img_ext1"; + public static final String IMG_EXT2 = "img_ext2"; + public static final String IMG_EXT2_FULL = "analises_acidentes.img_ext2"; + public static final String IMG_CAB2 = "img_cab2"; + public static final String IMG_CAB2_FULL = "analises_acidentes.img_cab2"; + public static final String IMG_CAB3 = "img_cab3"; + public static final String IMG_CAB3_FULL = "analises_acidentes.img_cab3"; + public static final String IMG_MA2 = "img_ma2"; + public static final String IMG_MA2_FULL = "analises_acidentes.img_ma2"; + public static final String IMG_MA3 = "img_ma3"; + public static final String IMG_MA3_FULL = "analises_acidentes.img_ma3"; + public static final String IMG_MA5 = "img_ma5"; + public static final String IMG_MA5_FULL = "analises_acidentes.img_ma5"; + public static final String IMG_MA6 = "img_ma6"; + public static final String IMG_MA6_FULL = "analises_acidentes.img_ma6"; + public static final String IMG_MA8 = "img_ma8"; + public static final String IMG_MA8_FULL = "analises_acidentes.img_ma8"; + public static final String IMG_MA10 = "img_ma10"; + public static final String IMG_MA10_FULL = "analises_acidentes.img_ma10"; + public static final String RESTRICAO_CARGA = "restricao_carga"; + public static final String RESTRICAO_CARGA_FULL = "analises_acidentes.restricao_carga"; + public static final String RESTRICAO_MOTRICIDADE = "restricao_motricidade"; + public static final String RESTRICAO_MOTRICIDADE_FULL = "analises_acidentes.restricao_motricidade"; + public static final String RESTRICAO_CONDUCAO = "restricao_conducao"; + public static final String RESTRICAO_CONDUCAO_FULL = "analises_acidentes.restricao_conducao"; + public static final String RESTRICAO_VIBRACOES = "restricao_vibracoes"; + public static final String RESTRICAO_VIBRACOES_FULL = "analises_acidentes.restricao_vibracoes"; + public static final String RESTRICAO_OUTRAS = "restricao_outras"; + public static final String RESTRICAO_OUTRAS_FULL = "analises_acidentes.restricao_outras"; + public static final String MED_OBSERV = "med_observ"; + public static final String MED_OBSERV_FULL = "analises_acidentes.med_observ"; + public static final String TIPO_LESAO = "tipo_lesao"; + public static final String TIPO_LESAO_FULL = "analises_acidentes.tipo_lesao"; + public static final String IMG_ROT1 = "img_rot1"; + public static final String IMG_ROT1_FULL = "analises_acidentes.img_rot1"; + public static final String IMG_ROT2 = "img_rot2"; + public static final String IMG_ROT2_FULL = "analises_acidentes.img_rot2"; + public static final String IMG_CAB1 = "img_cab1"; + public static final String IMG_CAB1_FULL = "analises_acidentes.img_cab1"; + public static final String IMG_CAB4 = "img_cab4"; + public static final String IMG_CAB4_FULL = "analises_acidentes.img_cab4"; + public static final String IMG_MA1 = "img_ma1"; + public static final String IMG_MA1_FULL = "analises_acidentes.img_ma1"; + public static final String IMG_MA4 = "img_ma4"; + public static final String IMG_MA4_FULL = "analises_acidentes.img_ma4"; + public static final String IMG_MA7 = "img_ma7"; + public static final String IMG_MA7_FULL = "analises_acidentes.img_ma7"; + public static final String IMG_MA9 = "img_ma9"; + public static final String IMG_MA9_FULL = "analises_acidentes.img_ma9"; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "analises_acidentes.empresa_id"; + public static final String MEDICO_ID = "medico_id"; + public static final String MEDICO_ID_FULL = "analises_acidentes.medico_id"; + public static final String TECNICO_SAUDE_ID = "tecnico_saude_id"; + public static final String TECNICO_SAUDE_ID_FULL = "analises_acidentes.tecnico_saude_id"; + public static final String ANALISE_NR = "analise_nr"; + public static final String ANALISE_NR_FULL = "analises_acidentes.analise_nr"; + public static final String ESTADO_ASSINATURA = "estado_assinatura"; + public static final String ESTADO_ASSINATURA_FULL = "analises_acidentes.estado_assinatura"; + public static final String ASS_RESP_SEG = "ass_resp_seg"; + public static final String ASS_RESP_SEG_FULL = "analises_acidentes.ass_resp_seg"; + public static final String ASS_RESP_RH = "ass_resp_rh"; + public static final String ASS_RESP_RH_FULL = "analises_acidentes.ass_resp_rh"; + public static final String DATA_CONSOLIDACAO = "data_consolidacao"; + public static final String DATA_CONSOLIDACAO_FULL = "analises_acidentes.data_consolidacao"; + public static final String DATA_ASSINATURA_SEG = "data_assinatura_seg"; + public static final String DATA_ASSINATURA_SEG_FULL = "analises_acidentes.data_assinatura_seg"; + public static final String DATA_ASSINATURA_RH = "data_assinatura_rh"; + public static final String DATA_ASSINATURA_RH_FULL = "analises_acidentes.data_assinatura_rh"; + public static final String ASS_CONSOLIDACAO = "ass_consolidacao"; + public static final String ASS_CONSOLIDACAO_FULL = "analises_acidentes.ass_consolidacao"; + public static final String NOME_RESP_SEG = "nome_resp_seg"; + public static final String NOME_RESP_SEG_FULL = "analises_acidentes.nome_resp_seg"; + public static final String NOME_RESP_RH = "nome_resp_rh"; + public static final String NOME_RESP_RH_FULL = "analises_acidentes.nome_resp_rh"; + public static final String CAUSAS = "causas"; + public static final String CAUSAS_FULL = "analises_acidentes.causas"; + public static final String ESTADO_ANTES_CORRECAO = "estado_antes_correcao"; + public static final String ESTADO_ANTES_CORRECAO_FULL = "analises_acidentes.estado_antes_correcao"; + public static final String OBSERVACOES_CORRECAO = "observacoes_correcao"; + public static final String OBSERVACOES_CORRECAO_FULL = "analises_acidentes.observacoes_correcao"; + public static final String CORRECAO = "correcao"; + public static final String CORRECAO_FULL = "analises_acidentes.correcao"; + public static final String ASS_SUPERIOR = "ass_superior"; + public static final String ASS_SUPERIOR_FULL = "analises_acidentes.ass_superior"; + public static final String NOME_SUPERIOR = "nome_superior"; + public static final String NOME_SUPERIOR_FULL = "analises_acidentes.nome_superior"; + public static final String DATA_ASSINATURA_SUPERIOR = "data_assinatura_superior"; + public static final String DATA_ASSINATURA_SUPERIOR_FULL = "analises_acidentes.data_assinatura_superior"; + public static final String AVERIGUADOR = "averiguador"; + public static final String AVERIGUADOR_FULL = "analises_acidentes.averiguador"; + public static final String AVERIGUACAO_POSTERIOR = "averiguacao_posterior"; + public static final String AVERIGUACAO_POSTERIOR_FULL = "analises_acidentes.averiguacao_posterior"; + public static final String AVERIGUACAO_OBS = "averiguacao_obs"; + public static final String AVERIGUACAO_OBS_FULL = "analises_acidentes.averiguacao_obs"; + public static final String DATA_INICIO_PROCESSO = "data_inicio_processo"; + public static final String DATA_INICIO_PROCESSO_FULL = "analises_acidentes.data_inicio_processo"; + public static final String NOME_RESP_CONSOLIDACAO = "nome_resp_consolidacao"; + public static final String NOME_RESP_CONSOLIDACAO_FULL = "analises_acidentes.nome_resp_consolidacao"; + public static final String SECCAO_ID = "seccao_id"; + public static final String SECCAO_ID_FULL = "analises_acidentes.seccao_id"; + public static final String DEPARTAMENTO_ID = "departamento_id"; + public static final String DEPARTAMENTO_ID_FULL = "analises_acidentes.departamento_id"; + public static final String RH_FASE4 = "rh_fase4"; + public static final String RH_FASE4_FULL = "analises_acidentes.rh_fase4"; + public static final String APAGADA = "apagada"; + public static final String APAGADA_FULL = "analises_acidentes.apagada"; + + public static final String FIELD_NAMES[] = new String[]{ + DATA_ACIDENTE, ACIDENTADO_ID, TO_ACIDENTADO_ID, ESTADO, ESTABELECIMENTO_ID, + HORAS_TURNO, LOCAL_TRABALHO, TAREFA, SUBSTANCIAS, CONDICOES, TESTEMUNHAS, + DESCRICAO, CONCLUSOES, ACCOES, HORA_ACIDENTE, FORMACAO_SHST, + FORMACAO_SHST_NAO_PORQUE, OUTROS_ACIDENTES_COM_COLABORADOR, + NR_ACIDENTES_COM_COLABORADOR, NR_RELATORIO_ACIDENTE_COLABORADOR1, + NR_RELATORIO_ACIDENTE_COLABORADOR2, NR_RELATORIO_ACIDENTE_COLABORADOR3, + NR_RELATORIO_ACIDENTE_COLABORADOR4, ACIDENTES_OUTROS_COLABORADORES, + NR_ACIDENTES_OUTROS_COLABORADORES, + NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES1, + NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES2, + NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES3, + NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES4, LESAO_CABECA, LESAO_PESCOCO, + LESAO_TRONCO, LESAO_MEMBRO_SUP_DIR, LESAO_MEMBRO_SUP_ESQ, + LESAO_MEMBRO_INF_DIR, LESAO_MEMBRO_INF_ESQ, ESPECIF1, ESPECIF2, ESPECIF3, + ESPECIF4, TIPO_INCAPACIDADE, COEF_INCAPACIDADE, DATA_AVAL_INCAPACIDADE, + DATA_REV_INCAPACIDADE, PERIODO_INCAPACIDADE_DE, PERIODO_INCAPACIDADE_A, + IMG_FLEXAO, IMG_EXT1, IMG_EXT2, IMG_CAB2, IMG_CAB3, IMG_MA2, IMG_MA3, IMG_MA5, IMG_MA6, + IMG_MA8, IMG_MA10, RESTRICAO_CARGA, RESTRICAO_MOTRICIDADE, RESTRICAO_CONDUCAO, + RESTRICAO_VIBRACOES, RESTRICAO_OUTRAS, MED_OBSERV, TIPO_LESAO, IMG_ROT1, + IMG_ROT2, IMG_CAB1, IMG_CAB4, IMG_MA1, IMG_MA4, IMG_MA7, IMG_MA9, EMPRESA_ID, + MEDICO_ID, TECNICO_SAUDE_ID, ANALISE_NR, ESTADO_ASSINATURA, ASS_RESP_SEG, + ASS_RESP_RH, DATA_CONSOLIDACAO, DATA_ASSINATURA_SEG, DATA_ASSINATURA_RH, + ASS_CONSOLIDACAO, NOME_RESP_SEG, NOME_RESP_RH, CAUSAS, ESTADO_ANTES_CORRECAO, + OBSERVACOES_CORRECAO, CORRECAO, ASS_SUPERIOR, NOME_SUPERIOR, + DATA_ASSINATURA_SUPERIOR, AVERIGUADOR, AVERIGUACAO_POSTERIOR, + AVERIGUACAO_OBS, DATA_INICIO_PROCESSO, NOME_RESP_CONSOLIDACAO, SECCAO_ID, + DEPARTAMENTO_ID, RH_FASE4, APAGADA, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATA_ACIDENTE, ACIDENTADO_ID, ESTADO, ESTABELECIMENTO_ID, HORAS_TURNO, + LOCAL_TRABALHO, TAREFA, SUBSTANCIAS, CONDICOES, TESTEMUNHAS, DESCRICAO, CONCLUSOES, + ACCOES, HORA_ACIDENTE, FORMACAO_SHST, FORMACAO_SHST_NAO_PORQUE, + OUTROS_ACIDENTES_COM_COLABORADOR, NR_ACIDENTES_COM_COLABORADOR, + NR_RELATORIO_ACIDENTE_COLABORADOR1, NR_RELATORIO_ACIDENTE_COLABORADOR2, + NR_RELATORIO_ACIDENTE_COLABORADOR3, NR_RELATORIO_ACIDENTE_COLABORADOR4, + ACIDENTES_OUTROS_COLABORADORES, NR_ACIDENTES_OUTROS_COLABORADORES, + NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES1, + NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES2, + NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES3, + NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES4, LESAO_CABECA, LESAO_PESCOCO, + LESAO_TRONCO, LESAO_MEMBRO_SUP_DIR, LESAO_MEMBRO_SUP_ESQ, + LESAO_MEMBRO_INF_DIR, LESAO_MEMBRO_INF_ESQ, ESPECIF1, ESPECIF2, ESPECIF3, + ESPECIF4, TIPO_INCAPACIDADE, COEF_INCAPACIDADE, DATA_AVAL_INCAPACIDADE, + DATA_REV_INCAPACIDADE, PERIODO_INCAPACIDADE_DE, PERIODO_INCAPACIDADE_A, + IMG_FLEXAO, IMG_EXT1, IMG_EXT2, IMG_CAB2, IMG_CAB3, IMG_MA2, IMG_MA3, IMG_MA5, IMG_MA6, + IMG_MA8, IMG_MA10, RESTRICAO_CARGA, RESTRICAO_MOTRICIDADE, RESTRICAO_CONDUCAO, + RESTRICAO_VIBRACOES, RESTRICAO_OUTRAS, MED_OBSERV, TIPO_LESAO, IMG_ROT1, + IMG_ROT2, IMG_CAB1, IMG_CAB4, IMG_MA1, IMG_MA4, IMG_MA7, IMG_MA9, EMPRESA_ID, + MEDICO_ID, TECNICO_SAUDE_ID, ANALISE_NR, ESTADO_ASSINATURA, ASS_RESP_SEG, + ASS_RESP_RH, DATA_CONSOLIDACAO, DATA_ASSINATURA_SEG, DATA_ASSINATURA_RH, + ASS_CONSOLIDACAO, NOME_RESP_SEG, NOME_RESP_RH, CAUSAS, ESTADO_ANTES_CORRECAO, + OBSERVACOES_CORRECAO, CORRECAO, ASS_SUPERIOR, NOME_SUPERIOR, + DATA_ASSINATURA_SUPERIOR, AVERIGUADOR, AVERIGUACAO_POSTERIOR, + AVERIGUACAO_OBS, DATA_INICIO_PROCESSO, NOME_RESP_CONSOLIDACAO, SECCAO_ID, + DEPARTAMENTO_ID, RH_FASE4, APAGADA, }; + + private Map dataHash; + + public AnalisesAcidentesDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public java.util.Date getData_acidente() + { + return (java.util.Date) get(DATA_ACIDENTE); + } + + public void setData_acidente(java.util.Date data_acidenteValue ) + { + this.set(DATA_ACIDENTE, data_acidenteValue ); + } + + public Integer getAcidentado_id() + { + return (Integer) dataHash.get(ACIDENTADO_ID); + } + + public void setAcidentado_id(Integer acidentado_idValue ) + { + dataHash.put(TO_ACIDENTADO_ID, null); + dataHash.put(ACIDENTADO_ID, acidentado_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp.AcidentadosData toAcidentado_id() + throws Exception + { + if( dataHash.get(TO_ACIDENTADO_ID) == null && getAcidentado_id() != null ) + { + dataHash.put(TO_ACIDENTADO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp.AcidentadosData.class, new Object[]{ getAcidentado_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp.AcidentadosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp.AcidentadosData) dataHash.get(TO_ACIDENTADO_ID); + } + + public void setToAcidentado_id(com.evolute.siprp.server.db.data.siprp.AcidentadosData acidentado_idObject ) + { + if( acidentado_idObject == null ) + { + dataHash.put(ACIDENTADO_ID, null); + } + else + { + dataHash.put(ACIDENTADO_ID, acidentado_idObject.get( com.evolute.siprp.server.db.data.siprp.AcidentadosData.ID )); + } + dataHash.put(TO_ACIDENTADO_ID, acidentado_idObject); + } + + public Integer getEstado() + { + return (Integer) get(ESTADO); + } + + public void setEstado(Integer estadoValue ) + { + this.set(ESTADO, estadoValue ); + } + + public Integer getEstabelecimento_id() + { + return (Integer) get(ESTABELECIMENTO_ID); + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + this.set(ESTABELECIMENTO_ID, estabelecimento_idValue ); + } + + public Integer getHoras_turno() + { + return (Integer) get(HORAS_TURNO); + } + + public void setHoras_turno(Integer horas_turnoValue ) + { + this.set(HORAS_TURNO, horas_turnoValue ); + } + + public String getLocal_trabalho() + { + return (String) get(LOCAL_TRABALHO); + } + + public void setLocal_trabalho(String local_trabalhoValue ) + { + this.set(LOCAL_TRABALHO, local_trabalhoValue ); + } + + public String getTarefa() + { + return (String) get(TAREFA); + } + + public void setTarefa(String tarefaValue ) + { + this.set(TAREFA, tarefaValue ); + } + + public String getSubstancias() + { + return (String) get(SUBSTANCIAS); + } + + public void setSubstancias(String substanciasValue ) + { + this.set(SUBSTANCIAS, substanciasValue ); + } + + public String getCondicoes() + { + return (String) get(CONDICOES); + } + + public void setCondicoes(String condicoesValue ) + { + this.set(CONDICOES, condicoesValue ); + } + + public String getTestemunhas() + { + return (String) get(TESTEMUNHAS); + } + + public void setTestemunhas(String testemunhasValue ) + { + this.set(TESTEMUNHAS, testemunhasValue ); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + public String getConclusoes() + { + return (String) get(CONCLUSOES); + } + + public void setConclusoes(String conclusoesValue ) + { + this.set(CONCLUSOES, conclusoesValue ); + } + + public String getAccoes() + { + return (String) get(ACCOES); + } + + public void setAccoes(String accoesValue ) + { + this.set(ACCOES, accoesValue ); + } + + public java.sql.Time getHora_acidente() + { + return (java.sql.Time) get(HORA_ACIDENTE); + } + + public void setHora_acidente(java.sql.Time hora_acidenteValue ) + { + this.set(HORA_ACIDENTE, hora_acidenteValue ); + } + + public String getFormacao_shst() + { + return (String) get(FORMACAO_SHST); + } + + public void setFormacao_shst(String formacao_shstValue ) + { + this.set(FORMACAO_SHST, formacao_shstValue ); + } + + public String getFormacao_shst_nao_porque() + { + return (String) get(FORMACAO_SHST_NAO_PORQUE); + } + + public void setFormacao_shst_nao_porque(String formacao_shst_nao_porqueValue ) + { + this.set(FORMACAO_SHST_NAO_PORQUE, formacao_shst_nao_porqueValue ); + } + + public String getOutros_acidentes_com_colaborador() + { + return (String) get(OUTROS_ACIDENTES_COM_COLABORADOR); + } + + public void setOutros_acidentes_com_colaborador(String outros_acidentes_com_colaboradorValue ) + { + this.set(OUTROS_ACIDENTES_COM_COLABORADOR, outros_acidentes_com_colaboradorValue ); + } + + public Integer getNr_acidentes_com_colaborador() + { + return (Integer) get(NR_ACIDENTES_COM_COLABORADOR); + } + + public void setNr_acidentes_com_colaborador(Integer nr_acidentes_com_colaboradorValue ) + { + this.set(NR_ACIDENTES_COM_COLABORADOR, nr_acidentes_com_colaboradorValue ); + } + + public Integer getNr_relatorio_acidente_colaborador1() + { + return (Integer) get(NR_RELATORIO_ACIDENTE_COLABORADOR1); + } + + public void setNr_relatorio_acidente_colaborador1(Integer nr_relatorio_acidente_colaborador1Value ) + { + this.set(NR_RELATORIO_ACIDENTE_COLABORADOR1, nr_relatorio_acidente_colaborador1Value ); + } + + public Integer getNr_relatorio_acidente_colaborador2() + { + return (Integer) get(NR_RELATORIO_ACIDENTE_COLABORADOR2); + } + + public void setNr_relatorio_acidente_colaborador2(Integer nr_relatorio_acidente_colaborador2Value ) + { + this.set(NR_RELATORIO_ACIDENTE_COLABORADOR2, nr_relatorio_acidente_colaborador2Value ); + } + + public Integer getNr_relatorio_acidente_colaborador3() + { + return (Integer) get(NR_RELATORIO_ACIDENTE_COLABORADOR3); + } + + public void setNr_relatorio_acidente_colaborador3(Integer nr_relatorio_acidente_colaborador3Value ) + { + this.set(NR_RELATORIO_ACIDENTE_COLABORADOR3, nr_relatorio_acidente_colaborador3Value ); + } + + public Integer getNr_relatorio_acidente_colaborador4() + { + return (Integer) get(NR_RELATORIO_ACIDENTE_COLABORADOR4); + } + + public void setNr_relatorio_acidente_colaborador4(Integer nr_relatorio_acidente_colaborador4Value ) + { + this.set(NR_RELATORIO_ACIDENTE_COLABORADOR4, nr_relatorio_acidente_colaborador4Value ); + } + + public String getAcidentes_outros_colaboradores() + { + return (String) get(ACIDENTES_OUTROS_COLABORADORES); + } + + public void setAcidentes_outros_colaboradores(String acidentes_outros_colaboradoresValue ) + { + this.set(ACIDENTES_OUTROS_COLABORADORES, acidentes_outros_colaboradoresValue ); + } + + public Integer getNr_acidentes_outros_colaboradores() + { + return (Integer) get(NR_ACIDENTES_OUTROS_COLABORADORES); + } + + public void setNr_acidentes_outros_colaboradores(Integer nr_acidentes_outros_colaboradoresValue ) + { + this.set(NR_ACIDENTES_OUTROS_COLABORADORES, nr_acidentes_outros_colaboradoresValue ); + } + + public Integer getNr_relatorio_acidente_outros_colaboradores1() + { + return (Integer) get(NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES1); + } + + public void setNr_relatorio_acidente_outros_colaboradores1(Integer nr_relatorio_acidente_outros_colaboradores1Value ) + { + this.set(NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES1, nr_relatorio_acidente_outros_colaboradores1Value ); + } + + public Integer getNr_relatorio_acidente_outros_colaboradores2() + { + return (Integer) get(NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES2); + } + + public void setNr_relatorio_acidente_outros_colaboradores2(Integer nr_relatorio_acidente_outros_colaboradores2Value ) + { + this.set(NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES2, nr_relatorio_acidente_outros_colaboradores2Value ); + } + + public Integer getNr_relatorio_acidente_outros_colaboradores3() + { + return (Integer) get(NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES3); + } + + public void setNr_relatorio_acidente_outros_colaboradores3(Integer nr_relatorio_acidente_outros_colaboradores3Value ) + { + this.set(NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES3, nr_relatorio_acidente_outros_colaboradores3Value ); + } + + public Integer getNr_relatorio_acidente_outros_colaboradores4() + { + return (Integer) get(NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES4); + } + + public void setNr_relatorio_acidente_outros_colaboradores4(Integer nr_relatorio_acidente_outros_colaboradores4Value ) + { + this.set(NR_RELATORIO_ACIDENTE_OUTROS_COLABORADORES4, nr_relatorio_acidente_outros_colaboradores4Value ); + } + + public String getLesao_cabeca() + { + return (String) get(LESAO_CABECA); + } + + public void setLesao_cabeca(String lesao_cabecaValue ) + { + this.set(LESAO_CABECA, lesao_cabecaValue ); + } + + public String getLesao_pescoco() + { + return (String) get(LESAO_PESCOCO); + } + + public void setLesao_pescoco(String lesao_pescocoValue ) + { + this.set(LESAO_PESCOCO, lesao_pescocoValue ); + } + + public String getLesao_tronco() + { + return (String) get(LESAO_TRONCO); + } + + public void setLesao_tronco(String lesao_troncoValue ) + { + this.set(LESAO_TRONCO, lesao_troncoValue ); + } + + public String getLesao_membro_sup_dir() + { + return (String) get(LESAO_MEMBRO_SUP_DIR); + } + + public void setLesao_membro_sup_dir(String lesao_membro_sup_dirValue ) + { + this.set(LESAO_MEMBRO_SUP_DIR, lesao_membro_sup_dirValue ); + } + + public String getLesao_membro_sup_esq() + { + return (String) get(LESAO_MEMBRO_SUP_ESQ); + } + + public void setLesao_membro_sup_esq(String lesao_membro_sup_esqValue ) + { + this.set(LESAO_MEMBRO_SUP_ESQ, lesao_membro_sup_esqValue ); + } + + public String getLesao_membro_inf_dir() + { + return (String) get(LESAO_MEMBRO_INF_DIR); + } + + public void setLesao_membro_inf_dir(String lesao_membro_inf_dirValue ) + { + this.set(LESAO_MEMBRO_INF_DIR, lesao_membro_inf_dirValue ); + } + + public String getLesao_membro_inf_esq() + { + return (String) get(LESAO_MEMBRO_INF_ESQ); + } + + public void setLesao_membro_inf_esq(String lesao_membro_inf_esqValue ) + { + this.set(LESAO_MEMBRO_INF_ESQ, lesao_membro_inf_esqValue ); + } + + public String getEspecif1() + { + return (String) get(ESPECIF1); + } + + public void setEspecif1(String especif1Value ) + { + this.set(ESPECIF1, especif1Value ); + } + + public String getEspecif2() + { + return (String) get(ESPECIF2); + } + + public void setEspecif2(String especif2Value ) + { + this.set(ESPECIF2, especif2Value ); + } + + public String getEspecif3() + { + return (String) get(ESPECIF3); + } + + public void setEspecif3(String especif3Value ) + { + this.set(ESPECIF3, especif3Value ); + } + + public String getEspecif4() + { + return (String) get(ESPECIF4); + } + + public void setEspecif4(String especif4Value ) + { + this.set(ESPECIF4, especif4Value ); + } + + public String getTipo_incapacidade() + { + return (String) get(TIPO_INCAPACIDADE); + } + + public void setTipo_incapacidade(String tipo_incapacidadeValue ) + { + this.set(TIPO_INCAPACIDADE, tipo_incapacidadeValue ); + } + + public Integer getCoef_incapacidade() + { + return (Integer) get(COEF_INCAPACIDADE); + } + + public void setCoef_incapacidade(Integer coef_incapacidadeValue ) + { + this.set(COEF_INCAPACIDADE, coef_incapacidadeValue ); + } + + public java.util.Date getData_aval_incapacidade() + { + return (java.util.Date) get(DATA_AVAL_INCAPACIDADE); + } + + public void setData_aval_incapacidade(java.util.Date data_aval_incapacidadeValue ) + { + this.set(DATA_AVAL_INCAPACIDADE, data_aval_incapacidadeValue ); + } + + public java.util.Date getData_rev_incapacidade() + { + return (java.util.Date) get(DATA_REV_INCAPACIDADE); + } + + public void setData_rev_incapacidade(java.util.Date data_rev_incapacidadeValue ) + { + this.set(DATA_REV_INCAPACIDADE, data_rev_incapacidadeValue ); + } + + public java.util.Date getPeriodo_incapacidade_de() + { + return (java.util.Date) get(PERIODO_INCAPACIDADE_DE); + } + + public void setPeriodo_incapacidade_de(java.util.Date periodo_incapacidade_deValue ) + { + this.set(PERIODO_INCAPACIDADE_DE, periodo_incapacidade_deValue ); + } + + public java.util.Date getPeriodo_incapacidade_a() + { + return (java.util.Date) get(PERIODO_INCAPACIDADE_A); + } + + public void setPeriodo_incapacidade_a(java.util.Date periodo_incapacidade_aValue ) + { + this.set(PERIODO_INCAPACIDADE_A, periodo_incapacidade_aValue ); + } + + public String getImg_flexao() + { + return (String) get(IMG_FLEXAO); + } + + public void setImg_flexao(String img_flexaoValue ) + { + this.set(IMG_FLEXAO, img_flexaoValue ); + } + + public String getImg_ext1() + { + return (String) get(IMG_EXT1); + } + + public void setImg_ext1(String img_ext1Value ) + { + this.set(IMG_EXT1, img_ext1Value ); + } + + public String getImg_ext2() + { + return (String) get(IMG_EXT2); + } + + public void setImg_ext2(String img_ext2Value ) + { + this.set(IMG_EXT2, img_ext2Value ); + } + + public String getImg_cab2() + { + return (String) get(IMG_CAB2); + } + + public void setImg_cab2(String img_cab2Value ) + { + this.set(IMG_CAB2, img_cab2Value ); + } + + public String getImg_cab3() + { + return (String) get(IMG_CAB3); + } + + public void setImg_cab3(String img_cab3Value ) + { + this.set(IMG_CAB3, img_cab3Value ); + } + + public String getImg_ma2() + { + return (String) get(IMG_MA2); + } + + public void setImg_ma2(String img_ma2Value ) + { + this.set(IMG_MA2, img_ma2Value ); + } + + public String getImg_ma3() + { + return (String) get(IMG_MA3); + } + + public void setImg_ma3(String img_ma3Value ) + { + this.set(IMG_MA3, img_ma3Value ); + } + + public String getImg_ma5() + { + return (String) get(IMG_MA5); + } + + public void setImg_ma5(String img_ma5Value ) + { + this.set(IMG_MA5, img_ma5Value ); + } + + public String getImg_ma6() + { + return (String) get(IMG_MA6); + } + + public void setImg_ma6(String img_ma6Value ) + { + this.set(IMG_MA6, img_ma6Value ); + } + + public String getImg_ma8() + { + return (String) get(IMG_MA8); + } + + public void setImg_ma8(String img_ma8Value ) + { + this.set(IMG_MA8, img_ma8Value ); + } + + public String getImg_ma10() + { + return (String) get(IMG_MA10); + } + + public void setImg_ma10(String img_ma10Value ) + { + this.set(IMG_MA10, img_ma10Value ); + } + + public Integer getRestricao_carga() + { + return (Integer) get(RESTRICAO_CARGA); + } + + public void setRestricao_carga(Integer restricao_cargaValue ) + { + this.set(RESTRICAO_CARGA, restricao_cargaValue ); + } + + public String getRestricao_motricidade() + { + return (String) get(RESTRICAO_MOTRICIDADE); + } + + public void setRestricao_motricidade(String restricao_motricidadeValue ) + { + this.set(RESTRICAO_MOTRICIDADE, restricao_motricidadeValue ); + } + + public String getRestricao_conducao() + { + return (String) get(RESTRICAO_CONDUCAO); + } + + public void setRestricao_conducao(String restricao_conducaoValue ) + { + this.set(RESTRICAO_CONDUCAO, restricao_conducaoValue ); + } + + public String getRestricao_vibracoes() + { + return (String) get(RESTRICAO_VIBRACOES); + } + + public void setRestricao_vibracoes(String restricao_vibracoesValue ) + { + this.set(RESTRICAO_VIBRACOES, restricao_vibracoesValue ); + } + + public String getRestricao_outras() + { + return (String) get(RESTRICAO_OUTRAS); + } + + public void setRestricao_outras(String restricao_outrasValue ) + { + this.set(RESTRICAO_OUTRAS, restricao_outrasValue ); + } + + public String getMed_observ() + { + return (String) get(MED_OBSERV); + } + + public void setMed_observ(String med_observValue ) + { + this.set(MED_OBSERV, med_observValue ); + } + + public String getTipo_lesao() + { + return (String) get(TIPO_LESAO); + } + + public void setTipo_lesao(String tipo_lesaoValue ) + { + this.set(TIPO_LESAO, tipo_lesaoValue ); + } + + public String getImg_rot1() + { + return (String) get(IMG_ROT1); + } + + public void setImg_rot1(String img_rot1Value ) + { + this.set(IMG_ROT1, img_rot1Value ); + } + + public String getImg_rot2() + { + return (String) get(IMG_ROT2); + } + + public void setImg_rot2(String img_rot2Value ) + { + this.set(IMG_ROT2, img_rot2Value ); + } + + public String getImg_cab1() + { + return (String) get(IMG_CAB1); + } + + public void setImg_cab1(String img_cab1Value ) + { + this.set(IMG_CAB1, img_cab1Value ); + } + + public String getImg_cab4() + { + return (String) get(IMG_CAB4); + } + + public void setImg_cab4(String img_cab4Value ) + { + this.set(IMG_CAB4, img_cab4Value ); + } + + public String getImg_ma1() + { + return (String) get(IMG_MA1); + } + + public void setImg_ma1(String img_ma1Value ) + { + this.set(IMG_MA1, img_ma1Value ); + } + + public String getImg_ma4() + { + return (String) get(IMG_MA4); + } + + public void setImg_ma4(String img_ma4Value ) + { + this.set(IMG_MA4, img_ma4Value ); + } + + public String getImg_ma7() + { + return (String) get(IMG_MA7); + } + + public void setImg_ma7(String img_ma7Value ) + { + this.set(IMG_MA7, img_ma7Value ); + } + + public String getImg_ma9() + { + return (String) get(IMG_MA9); + } + + public void setImg_ma9(String img_ma9Value ) + { + this.set(IMG_MA9, img_ma9Value ); + } + + public Integer getEmpresa_id() + { + return (Integer) get(EMPRESA_ID); + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + this.set(EMPRESA_ID, empresa_idValue ); + } + + public Integer getMedico_id() + { + return (Integer) get(MEDICO_ID); + } + + public void setMedico_id(Integer medico_idValue ) + { + this.set(MEDICO_ID, medico_idValue ); + } + + public Integer getTecnico_saude_id() + { + return (Integer) get(TECNICO_SAUDE_ID); + } + + public void setTecnico_saude_id(Integer tecnico_saude_idValue ) + { + this.set(TECNICO_SAUDE_ID, tecnico_saude_idValue ); + } + + public String getAnalise_nr() + { + return (String) get(ANALISE_NR); + } + + public void setAnalise_nr(String analise_nrValue ) + { + this.set(ANALISE_NR, analise_nrValue ); + } + + public Integer getEstado_assinatura() + { + return (Integer) get(ESTADO_ASSINATURA); + } + + public void setEstado_assinatura(Integer estado_assinaturaValue ) + { + this.set(ESTADO_ASSINATURA, estado_assinaturaValue ); + } + + public String getAss_resp_seg() + { + return (String) get(ASS_RESP_SEG); + } + + public void setAss_resp_seg(String ass_resp_segValue ) + { + this.set(ASS_RESP_SEG, ass_resp_segValue ); + } + + public String getAss_resp_rh() + { + return (String) get(ASS_RESP_RH); + } + + public void setAss_resp_rh(String ass_resp_rhValue ) + { + this.set(ASS_RESP_RH, ass_resp_rhValue ); + } + + public java.util.Date getData_consolidacao() + { + return (java.util.Date) get(DATA_CONSOLIDACAO); + } + + public void setData_consolidacao(java.util.Date data_consolidacaoValue ) + { + this.set(DATA_CONSOLIDACAO, data_consolidacaoValue ); + } + + public java.util.Date getData_assinatura_seg() + { + return (java.util.Date) get(DATA_ASSINATURA_SEG); + } + + public void setData_assinatura_seg(java.util.Date data_assinatura_segValue ) + { + this.set(DATA_ASSINATURA_SEG, data_assinatura_segValue ); + } + + public java.util.Date getData_assinatura_rh() + { + return (java.util.Date) get(DATA_ASSINATURA_RH); + } + + public void setData_assinatura_rh(java.util.Date data_assinatura_rhValue ) + { + this.set(DATA_ASSINATURA_RH, data_assinatura_rhValue ); + } + + public String getAss_consolidacao() + { + return (String) get(ASS_CONSOLIDACAO); + } + + public void setAss_consolidacao(String ass_consolidacaoValue ) + { + this.set(ASS_CONSOLIDACAO, ass_consolidacaoValue ); + } + + public String getNome_resp_seg() + { + return (String) get(NOME_RESP_SEG); + } + + public void setNome_resp_seg(String nome_resp_segValue ) + { + this.set(NOME_RESP_SEG, nome_resp_segValue ); + } + + public String getNome_resp_rh() + { + return (String) get(NOME_RESP_RH); + } + + public void setNome_resp_rh(String nome_resp_rhValue ) + { + this.set(NOME_RESP_RH, nome_resp_rhValue ); + } + + public Integer getCausas() + { + return (Integer) get(CAUSAS); + } + + public void setCausas(Integer causasValue ) + { + this.set(CAUSAS, causasValue ); + } + + public Integer getEstado_antes_correcao() + { + return (Integer) get(ESTADO_ANTES_CORRECAO); + } + + public void setEstado_antes_correcao(Integer estado_antes_correcaoValue ) + { + this.set(ESTADO_ANTES_CORRECAO, estado_antes_correcaoValue ); + } + + public String getObservacoes_correcao() + { + return (String) get(OBSERVACOES_CORRECAO); + } + + public void setObservacoes_correcao(String observacoes_correcaoValue ) + { + this.set(OBSERVACOES_CORRECAO, observacoes_correcaoValue ); + } + + public String getCorrecao() + { + return (String) get(CORRECAO); + } + + public void setCorrecao(String correcaoValue ) + { + this.set(CORRECAO, correcaoValue ); + } + + public String getAss_superior() + { + return (String) get(ASS_SUPERIOR); + } + + public void setAss_superior(String ass_superiorValue ) + { + this.set(ASS_SUPERIOR, ass_superiorValue ); + } + + public String getNome_superior() + { + return (String) get(NOME_SUPERIOR); + } + + public void setNome_superior(String nome_superiorValue ) + { + this.set(NOME_SUPERIOR, nome_superiorValue ); + } + + public java.util.Date getData_assinatura_superior() + { + return (java.util.Date) get(DATA_ASSINATURA_SUPERIOR); + } + + public void setData_assinatura_superior(java.util.Date data_assinatura_superiorValue ) + { + this.set(DATA_ASSINATURA_SUPERIOR, data_assinatura_superiorValue ); + } + + public String getAveriguador() + { + return (String) get(AVERIGUADOR); + } + + public void setAveriguador(String averiguadorValue ) + { + this.set(AVERIGUADOR, averiguadorValue ); + } + + public String getAveriguacao_posterior() + { + return (String) get(AVERIGUACAO_POSTERIOR); + } + + public void setAveriguacao_posterior(String averiguacao_posteriorValue ) + { + this.set(AVERIGUACAO_POSTERIOR, averiguacao_posteriorValue ); + } + + public String getAveriguacao_obs() + { + return (String) get(AVERIGUACAO_OBS); + } + + public void setAveriguacao_obs(String averiguacao_obsValue ) + { + this.set(AVERIGUACAO_OBS, averiguacao_obsValue ); + } + + public java.util.Date getData_inicio_processo() + { + return (java.util.Date) get(DATA_INICIO_PROCESSO); + } + + public void setData_inicio_processo(java.util.Date data_inicio_processoValue ) + { + this.set(DATA_INICIO_PROCESSO, data_inicio_processoValue ); + } + + public String getNome_resp_consolidacao() + { + return (String) get(NOME_RESP_CONSOLIDACAO); + } + + public void setNome_resp_consolidacao(String nome_resp_consolidacaoValue ) + { + this.set(NOME_RESP_CONSOLIDACAO, nome_resp_consolidacaoValue ); + } + + public Integer getSeccao_id() + { + return (Integer) get(SECCAO_ID); + } + + public void setSeccao_id(Integer seccao_idValue ) + { + this.set(SECCAO_ID, seccao_idValue ); + } + + public Integer getDepartamento_id() + { + return (Integer) get(DEPARTAMENTO_ID); + } + + public void setDepartamento_id(Integer departamento_idValue ) + { + this.set(DEPARTAMENTO_ID, departamento_idValue ); + } + + public Integer getRh_fase4() + { + return (Integer) get(RH_FASE4); + } + + public void setRh_fase4(Integer rh_fase4Value ) + { + this.set(RH_FASE4, rh_fase4Value ); + } + + public String getApagada() + { + return (String) get(APAGADA); + } + + public void setApagada(String apagadaValue ) + { + this.set(APAGADA, apagadaValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_ACIDENTADO_ID.equals( fieldName ) ) + { + value = toAcidentado_id(); + } + else if( ACIDENTADO_ID.equals( fieldName ) ) + { + value = getAcidentado_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_ACIDENTADO_ID.equals( fieldName ) ) + { + setToAcidentado_id( (com.evolute.siprp.server.db.data.siprp.AcidentadosData) value ); + } + else if( ACIDENTADO_ID.equals( fieldName ) ) + { + setAcidentado_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_ACIDENTADO_ID) != null ) + { + toAcidentado_id().save(); + dataHash.put(ACIDENTADO_ID, toAcidentado_id().get( com.evolute.siprp.server.db.data.siprp.AcidentadosData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return AnalisesAcidentes.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Causas.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Causas.java new file mode 100644 index 00000000..6dbbc1c5 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Causas.java @@ -0,0 +1,129 @@ +/* +* Causas.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class Causas implements JDOInnerObject +{ + private Integer id; + private String causa; + private String activa; + + public Causas() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == CausasDataAuto.ID ) + { + return id; + } + else if( fieldName == CausasDataAuto.CAUSA ) + { + return causa; + } + else if( fieldName == CausasDataAuto.ACTIVA ) + { + return activa; + } + else if( fieldName.equals( CausasDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( CausasDataAuto.CAUSA ) ) + { + return causa; + } + else if( fieldName.equals( CausasDataAuto.ACTIVA ) ) + { + return activa; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == CausasDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == CausasDataAuto.CAUSA ) + { + causa = ( String ) value; + } + else if( fieldName == CausasDataAuto.ACTIVA ) + { + activa = ( String ) value; + } + else if( fieldName.equals( CausasDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( CausasDataAuto.CAUSA ) ) + { + causa = ( String ) value; + } + else if( fieldName.equals( CausasDataAuto.ACTIVA ) ) + { + activa = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getCausa() + { + return causa; + } + + public void setCausa(String causaValue ) + { + this.causa = causaValue; + } + + public String getActiva() + { + return activa; + } + + public void setActiva(String activaValue ) + { + this.activa = activaValue; + } + + public Class getOuterClass() + { + return CausasDataAuto.class; + } + + public CausasDataAuto getOuterClassInstance() + { + CausasDataAuto outerObj = new CausasDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/CausasData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/CausasData.java new file mode 100644 index 00000000..c6bb0d37 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/CausasData.java @@ -0,0 +1,18 @@ +/* +* CausasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class CausasData extends com.evolute.siprp.server.db.data.siprp.CausasDataAuto +{ + + public CausasData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/CausasDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/CausasDataAuto.java new file mode 100644 index 00000000..7b8a0cf0 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/CausasDataAuto.java @@ -0,0 +1,107 @@ +/* +* CausasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class CausasDataAuto extends JDOObject +{ + + public static final String TABLENAME = "causas"; + + public static final String ID = "id"; + public static final String ID_FULL = "causas.id"; + public static final String CAUSA = "causa"; + public static final String CAUSA_FULL = "causas.causa"; + public static final String ACTIVA = "activa"; + public static final String ACTIVA_FULL = "causas.activa"; + + public static final String FIELD_NAMES[] = new String[]{ + CAUSA, ACTIVA, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, CAUSA, ACTIVA, }; + + private Map dataHash; + + public CausasDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getCausa() + { + return (String) get(CAUSA); + } + + public void setCausa(String causaValue ) + { + this.set(CAUSA, causaValue ); + } + + public String getActiva() + { + return (String) get(ACTIVA); + } + + public void setActiva(String activaValue ) + { + this.set(ACTIVA, activaValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Causas.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Controle.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Controle.java new file mode 100644 index 00000000..94c1be14 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Controle.java @@ -0,0 +1,129 @@ +/* +* Controle.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class Controle implements JDOInnerObject +{ + private Integer id; + private Integer analise_year; + private Integer last_analise_nr; + + public Controle() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == ControleDataAuto.ID ) + { + return id; + } + else if( fieldName == ControleDataAuto.ANALISE_YEAR ) + { + return analise_year; + } + else if( fieldName == ControleDataAuto.LAST_ANALISE_NR ) + { + return last_analise_nr; + } + else if( fieldName.equals( ControleDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( ControleDataAuto.ANALISE_YEAR ) ) + { + return analise_year; + } + else if( fieldName.equals( ControleDataAuto.LAST_ANALISE_NR ) ) + { + return last_analise_nr; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == ControleDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == ControleDataAuto.ANALISE_YEAR ) + { + analise_year = ( Integer ) value; + } + else if( fieldName == ControleDataAuto.LAST_ANALISE_NR ) + { + last_analise_nr = ( Integer ) value; + } + else if( fieldName.equals( ControleDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( ControleDataAuto.ANALISE_YEAR ) ) + { + analise_year = ( Integer ) value; + } + else if( fieldName.equals( ControleDataAuto.LAST_ANALISE_NR ) ) + { + last_analise_nr = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getAnalise_year() + { + return analise_year; + } + + public void setAnalise_year(Integer analise_yearValue ) + { + this.analise_year = analise_yearValue; + } + + public Integer getLast_analise_nr() + { + return last_analise_nr; + } + + public void setLast_analise_nr(Integer last_analise_nrValue ) + { + this.last_analise_nr = last_analise_nrValue; + } + + public Class getOuterClass() + { + return ControleDataAuto.class; + } + + public ControleDataAuto getOuterClassInstance() + { + ControleDataAuto outerObj = new ControleDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ControleData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ControleData.java new file mode 100644 index 00000000..9ebfa3e7 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ControleData.java @@ -0,0 +1,18 @@ +/* +* ControleDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class ControleData extends com.evolute.siprp.server.db.data.siprp.ControleDataAuto +{ + + public ControleData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ControleDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ControleDataAuto.java new file mode 100644 index 00000000..187cc4df --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ControleDataAuto.java @@ -0,0 +1,107 @@ +/* +* ControleDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class ControleDataAuto extends JDOObject +{ + + public static final String TABLENAME = "controle"; + + public static final String ID = "id"; + public static final String ID_FULL = "controle.id"; + public static final String ANALISE_YEAR = "analise_year"; + public static final String ANALISE_YEAR_FULL = "controle.analise_year"; + public static final String LAST_ANALISE_NR = "last_analise_nr"; + public static final String LAST_ANALISE_NR_FULL = "controle.last_analise_nr"; + + public static final String FIELD_NAMES[] = new String[]{ + ANALISE_YEAR, LAST_ANALISE_NR, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, ANALISE_YEAR, LAST_ANALISE_NR, }; + + private Map dataHash; + + public ControleDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getAnalise_year() + { + return (Integer) get(ANALISE_YEAR); + } + + public void setAnalise_year(Integer analise_yearValue ) + { + this.set(ANALISE_YEAR, analise_yearValue ); + } + + public Integer getLast_analise_nr() + { + return (Integer) get(LAST_ANALISE_NR); + } + + public void setLast_analise_nr(Integer last_analise_nrValue ) + { + this.set(LAST_ANALISE_NR, last_analise_nrValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Controle.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Departamentos.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Departamentos.java new file mode 100644 index 00000000..4236cfb6 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Departamentos.java @@ -0,0 +1,129 @@ +/* +* Departamentos.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class Departamentos implements JDOInnerObject +{ + private Integer id; + private String descricao; + private String activo; + + public Departamentos() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == DepartamentosDataAuto.ID ) + { + return id; + } + else if( fieldName == DepartamentosDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName == DepartamentosDataAuto.ACTIVO ) + { + return activo; + } + else if( fieldName.equals( DepartamentosDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( DepartamentosDataAuto.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( DepartamentosDataAuto.ACTIVO ) ) + { + return activo; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == DepartamentosDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == DepartamentosDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == DepartamentosDataAuto.ACTIVO ) + { + activo = ( String ) value; + } + else if( fieldName.equals( DepartamentosDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( DepartamentosDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( DepartamentosDataAuto.ACTIVO ) ) + { + activo = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public String getActivo() + { + return activo; + } + + public void setActivo(String activoValue ) + { + this.activo = activoValue; + } + + public Class getOuterClass() + { + return DepartamentosDataAuto.class; + } + + public DepartamentosDataAuto getOuterClassInstance() + { + DepartamentosDataAuto outerObj = new DepartamentosDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/DepartamentosData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/DepartamentosData.java new file mode 100644 index 00000000..33da6c5c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/DepartamentosData.java @@ -0,0 +1,18 @@ +/* +* DepartamentosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class DepartamentosData extends com.evolute.siprp.server.db.data.siprp.DepartamentosDataAuto +{ + + public DepartamentosData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/DepartamentosDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/DepartamentosDataAuto.java new file mode 100644 index 00000000..5dc9787e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/DepartamentosDataAuto.java @@ -0,0 +1,107 @@ +/* +* DepartamentosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class DepartamentosDataAuto extends JDOObject +{ + + public static final String TABLENAME = "departamentos"; + + public static final String ID = "id"; + public static final String ID_FULL = "departamentos.id"; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "departamentos.descricao"; + public static final String ACTIVO = "activo"; + public static final String ACTIVO_FULL = "departamentos.activo"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRICAO, ACTIVO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DESCRICAO, ACTIVO, }; + + private Map dataHash; + + public DepartamentosDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + public String getActivo() + { + return (String) get(ACTIVO); + } + + public void setActivo(String activoValue ) + { + this.set(ACTIVO, activoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Departamentos.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Errors.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Errors.java new file mode 100644 index 00000000..2dc748da --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Errors.java @@ -0,0 +1,183 @@ +/* +* Errors.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class Errors implements JDOInnerObject +{ + private Integer id; + private java.sql.Timestamp date; + private String type; + private String environment; + private String description; + + public Errors() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == ErrorsDataAuto.ID ) + { + return id; + } + else if( fieldName == ErrorsDataAuto.DATE ) + { + return date; + } + else if( fieldName == ErrorsDataAuto.TYPE ) + { + return type; + } + else if( fieldName == ErrorsDataAuto.ENVIRONMENT ) + { + return environment; + } + else if( fieldName == ErrorsDataAuto.DESCRIPTION ) + { + return description; + } + else if( fieldName.equals( ErrorsDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( ErrorsDataAuto.DATE ) ) + { + return date; + } + else if( fieldName.equals( ErrorsDataAuto.TYPE ) ) + { + return type; + } + else if( fieldName.equals( ErrorsDataAuto.ENVIRONMENT ) ) + { + return environment; + } + else if( fieldName.equals( ErrorsDataAuto.DESCRIPTION ) ) + { + return description; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == ErrorsDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == ErrorsDataAuto.DATE ) + { + date = ( java.sql.Timestamp ) value; + } + else if( fieldName == ErrorsDataAuto.TYPE ) + { + type = ( String ) value; + } + else if( fieldName == ErrorsDataAuto.ENVIRONMENT ) + { + environment = ( String ) value; + } + else if( fieldName == ErrorsDataAuto.DESCRIPTION ) + { + description = ( String ) value; + } + else if( fieldName.equals( ErrorsDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( ErrorsDataAuto.DATE ) ) + { + date = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( ErrorsDataAuto.TYPE ) ) + { + type = ( String ) value; + } + else if( fieldName.equals( ErrorsDataAuto.ENVIRONMENT ) ) + { + environment = ( String ) value; + } + else if( fieldName.equals( ErrorsDataAuto.DESCRIPTION ) ) + { + description = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public java.sql.Timestamp getDate() + { + return date; + } + + public void setDate(java.sql.Timestamp dateValue ) + { + this.date = dateValue; + } + + public String getType() + { + return type; + } + + public void setType(String typeValue ) + { + this.type = typeValue; + } + + public String getEnvironment() + { + return environment; + } + + public void setEnvironment(String environmentValue ) + { + this.environment = environmentValue; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String descriptionValue ) + { + this.description = descriptionValue; + } + + public Class getOuterClass() + { + return ErrorsDataAuto.class; + } + + public ErrorsDataAuto getOuterClassInstance() + { + ErrorsDataAuto outerObj = new ErrorsDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ErrorsData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ErrorsData.java new file mode 100644 index 00000000..647327f4 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ErrorsData.java @@ -0,0 +1,18 @@ +/* +* ErrorsDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class ErrorsData extends com.evolute.siprp.server.db.data.siprp.ErrorsDataAuto +{ + + public ErrorsData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ErrorsDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ErrorsDataAuto.java new file mode 100644 index 00000000..384d009d --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/ErrorsDataAuto.java @@ -0,0 +1,131 @@ +/* +* ErrorsDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class ErrorsDataAuto extends JDOObject +{ + + public static final String TABLENAME = "errors"; + + public static final String ID = "id"; + public static final String ID_FULL = "errors.id"; + public static final String DATE = "date"; + public static final String DATE_FULL = "errors.date"; + public static final String TYPE = "type"; + public static final String TYPE_FULL = "errors.type"; + public static final String ENVIRONMENT = "environment"; + public static final String ENVIRONMENT_FULL = "errors.environment"; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "errors.description"; + + public static final String FIELD_NAMES[] = new String[]{ + DATE, TYPE, ENVIRONMENT, DESCRIPTION, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATE, TYPE, ENVIRONMENT, DESCRIPTION, }; + + private Map dataHash; + + public ErrorsDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public java.sql.Timestamp getDate() + { + return (java.sql.Timestamp) get(DATE); + } + + public void setDate(java.sql.Timestamp dateValue ) + { + this.set(DATE, dateValue ); + } + + public String getType() + { + return (String) get(TYPE); + } + + public void setType(String typeValue ) + { + this.set(TYPE, typeValue ); + } + + public String getEnvironment() + { + return (String) get(ENVIRONMENT); + } + + public void setEnvironment(String environmentValue ) + { + this.set(ENVIRONMENT, environmentValue ); + } + + public String getDescription() + { + return (String) get(DESCRIPTION); + } + + public void setDescription(String descriptionValue ) + { + this.set(DESCRIPTION, descriptionValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Errors.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Medidas.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Medidas.java new file mode 100644 index 00000000..484f6468 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Medidas.java @@ -0,0 +1,129 @@ +/* +* Medidas.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class Medidas implements JDOInnerObject +{ + private Integer id; + private Integer analise_id; + private String medida; + + public Medidas() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == MedidasDataAuto.ID ) + { + return id; + } + else if( fieldName == MedidasDataAuto.ANALISE_ID ) + { + return analise_id; + } + else if( fieldName == MedidasDataAuto.MEDIDA ) + { + return medida; + } + else if( fieldName.equals( MedidasDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( MedidasDataAuto.ANALISE_ID ) ) + { + return analise_id; + } + else if( fieldName.equals( MedidasDataAuto.MEDIDA ) ) + { + return medida; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == MedidasDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == MedidasDataAuto.ANALISE_ID ) + { + analise_id = ( Integer ) value; + } + else if( fieldName == MedidasDataAuto.MEDIDA ) + { + medida = ( String ) value; + } + else if( fieldName.equals( MedidasDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( MedidasDataAuto.ANALISE_ID ) ) + { + analise_id = ( Integer ) value; + } + else if( fieldName.equals( MedidasDataAuto.MEDIDA ) ) + { + medida = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getAnalise_id() + { + return analise_id; + } + + public void setAnalise_id(Integer analise_idValue ) + { + this.analise_id = analise_idValue; + } + + public String getMedida() + { + return medida; + } + + public void setMedida(String medidaValue ) + { + this.medida = medidaValue; + } + + public Class getOuterClass() + { + return MedidasDataAuto.class; + } + + public MedidasDataAuto getOuterClassInstance() + { + MedidasDataAuto outerObj = new MedidasDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/MedidasData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/MedidasData.java new file mode 100644 index 00000000..b1070ead --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/MedidasData.java @@ -0,0 +1,18 @@ +/* +* MedidasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class MedidasData extends com.evolute.siprp.server.db.data.siprp.MedidasDataAuto +{ + + public MedidasData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/MedidasDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/MedidasDataAuto.java new file mode 100644 index 00000000..af9681da --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/MedidasDataAuto.java @@ -0,0 +1,166 @@ +/* +* MedidasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class MedidasDataAuto extends JDOObject +{ + + public static final String TABLENAME = "medidas"; + + public static final String ID = "id"; + public static final String ID_FULL = "medidas.id"; + public static final String ANALISE_ID = "analise_id"; + public static final String ANALISE_ID_FULL = "medidas.analise_id"; + public static final String TO_ANALISE_ID = "to analise_id"; + public static final String MEDIDA = "medida"; + public static final String MEDIDA_FULL = "medidas.medida"; + + public static final String FIELD_NAMES[] = new String[]{ + ANALISE_ID, TO_ANALISE_ID, MEDIDA, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, ANALISE_ID, MEDIDA, }; + + private Map dataHash; + + public MedidasDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getAnalise_id() + { + return (Integer) dataHash.get(ANALISE_ID); + } + + public void setAnalise_id(Integer analise_idValue ) + { + dataHash.put(TO_ANALISE_ID, null); + dataHash.put(ANALISE_ID, analise_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData toAnalise_id() + throws Exception + { + if( dataHash.get(TO_ANALISE_ID) == null && getAnalise_id() != null ) + { + dataHash.put(TO_ANALISE_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData.class, new Object[]{ getAnalise_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData) dataHash.get(TO_ANALISE_ID); + } + + public void setToAnalise_id(com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData analise_idObject ) + { + if( analise_idObject == null ) + { + dataHash.put(ANALISE_ID, null); + } + else + { + dataHash.put(ANALISE_ID, analise_idObject.get( com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData.ID )); + } + dataHash.put(TO_ANALISE_ID, analise_idObject); + } + + public String getMedida() + { + return (String) get(MEDIDA); + } + + public void setMedida(String medidaValue ) + { + this.set(MEDIDA, medidaValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_ANALISE_ID.equals( fieldName ) ) + { + value = toAnalise_id(); + } + else if( ANALISE_ID.equals( fieldName ) ) + { + value = getAnalise_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_ANALISE_ID.equals( fieldName ) ) + { + setToAnalise_id( (com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData) value ); + } + else if( ANALISE_ID.equals( fieldName ) ) + { + setAnalise_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_ANALISE_ID) != null ) + { + toAnalise_id().save(); + dataHash.put(ANALISE_ID, toAnalise_id().get( com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Medidas.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/NotNoticias.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/NotNoticias.java new file mode 100644 index 00000000..021af86a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/NotNoticias.java @@ -0,0 +1,183 @@ +/* +* NotNoticias.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class NotNoticias implements JDOInnerObject +{ + private Integer id; + private java.util.Date data; + private java.sql.Timestamp stamp; + private String utilizador; + private String noticia; + + public NotNoticias() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == NotNoticiasDataAuto.ID ) + { + return id; + } + else if( fieldName == NotNoticiasDataAuto.DATA ) + { + return data; + } + else if( fieldName == NotNoticiasDataAuto.STAMP ) + { + return stamp; + } + else if( fieldName == NotNoticiasDataAuto.UTILIZADOR ) + { + return utilizador; + } + else if( fieldName == NotNoticiasDataAuto.NOTICIA ) + { + return noticia; + } + else if( fieldName.equals( NotNoticiasDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( NotNoticiasDataAuto.DATA ) ) + { + return data; + } + else if( fieldName.equals( NotNoticiasDataAuto.STAMP ) ) + { + return stamp; + } + else if( fieldName.equals( NotNoticiasDataAuto.UTILIZADOR ) ) + { + return utilizador; + } + else if( fieldName.equals( NotNoticiasDataAuto.NOTICIA ) ) + { + return noticia; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == NotNoticiasDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == NotNoticiasDataAuto.DATA ) + { + data = ( java.util.Date ) value; + } + else if( fieldName == NotNoticiasDataAuto.STAMP ) + { + stamp = ( java.sql.Timestamp ) value; + } + else if( fieldName == NotNoticiasDataAuto.UTILIZADOR ) + { + utilizador = ( String ) value; + } + else if( fieldName == NotNoticiasDataAuto.NOTICIA ) + { + noticia = ( String ) value; + } + else if( fieldName.equals( NotNoticiasDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( NotNoticiasDataAuto.DATA ) ) + { + data = ( java.util.Date ) value; + } + else if( fieldName.equals( NotNoticiasDataAuto.STAMP ) ) + { + stamp = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( NotNoticiasDataAuto.UTILIZADOR ) ) + { + utilizador = ( String ) value; + } + else if( fieldName.equals( NotNoticiasDataAuto.NOTICIA ) ) + { + noticia = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public java.util.Date getData() + { + return data; + } + + public void setData(java.util.Date dataValue ) + { + this.data = dataValue; + } + + public java.sql.Timestamp getStamp() + { + return stamp; + } + + public void setStamp(java.sql.Timestamp stampValue ) + { + this.stamp = stampValue; + } + + public String getUtilizador() + { + return utilizador; + } + + public void setUtilizador(String utilizadorValue ) + { + this.utilizador = utilizadorValue; + } + + public String getNoticia() + { + return noticia; + } + + public void setNoticia(String noticiaValue ) + { + this.noticia = noticiaValue; + } + + public Class getOuterClass() + { + return NotNoticiasDataAuto.class; + } + + public NotNoticiasDataAuto getOuterClassInstance() + { + NotNoticiasDataAuto outerObj = new NotNoticiasDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/NotNoticiasData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/NotNoticiasData.java new file mode 100644 index 00000000..42d07f7c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/NotNoticiasData.java @@ -0,0 +1,18 @@ +/* +* NotNoticiasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class NotNoticiasData extends com.evolute.siprp.server.db.data.siprp.NotNoticiasDataAuto +{ + + public NotNoticiasData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/NotNoticiasDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/NotNoticiasDataAuto.java new file mode 100644 index 00000000..9ff5a4a3 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/NotNoticiasDataAuto.java @@ -0,0 +1,131 @@ +/* +* NotNoticiasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class NotNoticiasDataAuto extends JDOObject +{ + + public static final String TABLENAME = "not_noticias"; + + public static final String ID = "id"; + public static final String ID_FULL = "not_noticias.id"; + public static final String DATA = "data"; + public static final String DATA_FULL = "not_noticias.data"; + public static final String STAMP = "stamp"; + public static final String STAMP_FULL = "not_noticias.stamp"; + public static final String UTILIZADOR = "utilizador"; + public static final String UTILIZADOR_FULL = "not_noticias.utilizador"; + public static final String NOTICIA = "noticia"; + public static final String NOTICIA_FULL = "not_noticias.noticia"; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, STAMP, UTILIZADOR, NOTICIA, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATA, STAMP, UTILIZADOR, NOTICIA, }; + + private Map dataHash; + + public NotNoticiasDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public java.util.Date getData() + { + return (java.util.Date) get(DATA); + } + + public void setData(java.util.Date dataValue ) + { + this.set(DATA, dataValue ); + } + + public java.sql.Timestamp getStamp() + { + return (java.sql.Timestamp) get(STAMP); + } + + public void setStamp(java.sql.Timestamp stampValue ) + { + this.set(STAMP, stampValue ); + } + + public String getUtilizador() + { + return (String) get(UTILIZADOR); + } + + public void setUtilizador(String utilizadorValue ) + { + this.set(UTILIZADOR, utilizadorValue ); + } + + public String getNoticia() + { + return (String) get(NOTICIA); + } + + public void setNoticia(String noticiaValue ) + { + this.set(NOTICIA, noticiaValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return NotNoticias.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Permissoes.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Permissoes.java new file mode 100644 index 00000000..c7fe43d0 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Permissoes.java @@ -0,0 +1,129 @@ +/* +* Permissoes.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class Permissoes implements JDOInnerObject +{ + private Integer id; + private Integer user_id; + private Integer codigo_permissao; + + public Permissoes() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == PermissoesDataAuto.ID ) + { + return id; + } + else if( fieldName == PermissoesDataAuto.USER_ID ) + { + return user_id; + } + else if( fieldName == PermissoesDataAuto.CODIGO_PERMISSAO ) + { + return codigo_permissao; + } + else if( fieldName.equals( PermissoesDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( PermissoesDataAuto.USER_ID ) ) + { + return user_id; + } + else if( fieldName.equals( PermissoesDataAuto.CODIGO_PERMISSAO ) ) + { + return codigo_permissao; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == PermissoesDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == PermissoesDataAuto.USER_ID ) + { + user_id = ( Integer ) value; + } + else if( fieldName == PermissoesDataAuto.CODIGO_PERMISSAO ) + { + codigo_permissao = ( Integer ) value; + } + else if( fieldName.equals( PermissoesDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( PermissoesDataAuto.USER_ID ) ) + { + user_id = ( Integer ) value; + } + else if( fieldName.equals( PermissoesDataAuto.CODIGO_PERMISSAO ) ) + { + codigo_permissao = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getUser_id() + { + return user_id; + } + + public void setUser_id(Integer user_idValue ) + { + this.user_id = user_idValue; + } + + public Integer getCodigo_permissao() + { + return codigo_permissao; + } + + public void setCodigo_permissao(Integer codigo_permissaoValue ) + { + this.codigo_permissao = codigo_permissaoValue; + } + + public Class getOuterClass() + { + return PermissoesDataAuto.class; + } + + public PermissoesDataAuto getOuterClassInstance() + { + PermissoesDataAuto outerObj = new PermissoesDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PermissoesData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PermissoesData.java new file mode 100644 index 00000000..dcf3524d --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PermissoesData.java @@ -0,0 +1,18 @@ +/* +* PermissoesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class PermissoesData extends com.evolute.siprp.server.db.data.siprp.PermissoesDataAuto +{ + + public PermissoesData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PermissoesDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PermissoesDataAuto.java new file mode 100644 index 00000000..df826391 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PermissoesDataAuto.java @@ -0,0 +1,166 @@ +/* +* PermissoesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class PermissoesDataAuto extends JDOObject +{ + + public static final String TABLENAME = "permissoes"; + + public static final String ID = "id"; + public static final String ID_FULL = "permissoes.id"; + public static final String USER_ID = "user_id"; + public static final String USER_ID_FULL = "permissoes.user_id"; + public static final String TO_USER_ID = "to user_id"; + public static final String CODIGO_PERMISSAO = "codigo_permissao"; + public static final String CODIGO_PERMISSAO_FULL = "permissoes.codigo_permissao"; + + public static final String FIELD_NAMES[] = new String[]{ + USER_ID, TO_USER_ID, CODIGO_PERMISSAO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, USER_ID, CODIGO_PERMISSAO, }; + + private Map dataHash; + + public PermissoesDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getUser_id() + { + return (Integer) dataHash.get(USER_ID); + } + + public void setUser_id(Integer user_idValue ) + { + dataHash.put(TO_USER_ID, null); + dataHash.put(USER_ID, user_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp.UtilizadoresData toUser_id() + throws Exception + { + if( dataHash.get(TO_USER_ID) == null && getUser_id() != null ) + { + dataHash.put(TO_USER_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp.UtilizadoresData.class, new Object[]{ getUser_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp.UtilizadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp.UtilizadoresData) dataHash.get(TO_USER_ID); + } + + public void setToUser_id(com.evolute.siprp.server.db.data.siprp.UtilizadoresData user_idObject ) + { + if( user_idObject == null ) + { + dataHash.put(USER_ID, null); + } + else + { + dataHash.put(USER_ID, user_idObject.get( com.evolute.siprp.server.db.data.siprp.UtilizadoresData.ID )); + } + dataHash.put(TO_USER_ID, user_idObject); + } + + public Integer getCodigo_permissao() + { + return (Integer) get(CODIGO_PERMISSAO); + } + + public void setCodigo_permissao(Integer codigo_permissaoValue ) + { + this.set(CODIGO_PERMISSAO, codigo_permissaoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( USER_ID.equals( fieldName ) ) + { + value = getUser_id(); + } + else if( TO_USER_ID.equals( fieldName ) ) + { + value = toUser_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( USER_ID.equals( fieldName ) ) + { + setUser_id( (Integer) value ); + } + else if( TO_USER_ID.equals( fieldName ) ) + { + setToUser_id( (com.evolute.siprp.server.db.data.siprp.UtilizadoresData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_USER_ID) != null ) + { + toUser_id().save(); + dataHash.put(USER_ID, toUser_id().get( com.evolute.siprp.server.db.data.siprp.UtilizadoresData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Permissoes.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoAreas.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoAreas.java new file mode 100644 index 00000000..21a05fd7 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoAreas.java @@ -0,0 +1,156 @@ +/* +* PlanoAreas.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class PlanoAreas implements JDOInnerObject +{ + private String descricao; + private Integer plano_id; + private Integer id; + private Integer area_id; + + public PlanoAreas() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == PlanoAreasDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName == PlanoAreasDataAuto.PLANO_ID ) + { + return plano_id; + } + else if( fieldName == PlanoAreasDataAuto.ID ) + { + return id; + } + else if( fieldName == PlanoAreasDataAuto.AREA_ID ) + { + return area_id; + } + else if( fieldName.equals( PlanoAreasDataAuto.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( PlanoAreasDataAuto.PLANO_ID ) ) + { + return plano_id; + } + else if( fieldName.equals( PlanoAreasDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( PlanoAreasDataAuto.AREA_ID ) ) + { + return area_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == PlanoAreasDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == PlanoAreasDataAuto.PLANO_ID ) + { + plano_id = ( Integer ) value; + } + else if( fieldName == PlanoAreasDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == PlanoAreasDataAuto.AREA_ID ) + { + area_id = ( Integer ) value; + } + else if( fieldName.equals( PlanoAreasDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( PlanoAreasDataAuto.PLANO_ID ) ) + { + plano_id = ( Integer ) value; + } + else if( fieldName.equals( PlanoAreasDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( PlanoAreasDataAuto.AREA_ID ) ) + { + area_id = ( Integer ) value; + } + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public Integer getPlano_id() + { + return plano_id; + } + + public void setPlano_id(Integer plano_idValue ) + { + this.plano_id = plano_idValue; + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getArea_id() + { + return area_id; + } + + public void setArea_id(Integer area_idValue ) + { + this.area_id = area_idValue; + } + + public Class getOuterClass() + { + return PlanoAreasDataAuto.class; + } + + public PlanoAreasDataAuto getOuterClassInstance() + { + PlanoAreasDataAuto outerObj = new PlanoAreasDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoAreasData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoAreasData.java new file mode 100644 index 00000000..e91830bb --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoAreasData.java @@ -0,0 +1,18 @@ +/* +* PlanoAreasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class PlanoAreasData extends com.evolute.siprp.server.db.data.siprp.PlanoAreasDataAuto +{ + + public PlanoAreasData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoAreasDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoAreasDataAuto.java new file mode 100644 index 00000000..a9b1b6fd --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoAreasDataAuto.java @@ -0,0 +1,178 @@ +/* +* PlanoAreasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class PlanoAreasDataAuto extends JDOObject +{ + + public static final String TABLENAME = "plano_areas"; + + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "plano_areas.descricao"; + public static final String PLANO_ID = "plano_id"; + public static final String PLANO_ID_FULL = "plano_areas.plano_id"; + public static final String TO_PLANO_ID = "to plano_id"; + public static final String ID = "id"; + public static final String ID_FULL = "plano_areas.id"; + public static final String AREA_ID = "area_id"; + public static final String AREA_ID_FULL = "plano_areas.area_id"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRICAO, PLANO_ID, TO_PLANO_ID, AREA_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + DESCRICAO, PLANO_ID, ID, AREA_ID, }; + + private Map dataHash; + + public PlanoAreasDataAuto() + { + dataHash = new HashMap(); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + public Integer getPlano_id() + { + return (Integer) dataHash.get(PLANO_ID); + } + + public void setPlano_id(Integer plano_idValue ) + { + dataHash.put(TO_PLANO_ID, null); + dataHash.put(PLANO_ID, plano_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp.PlanosActuacaoData toPlano_id() + throws Exception + { + if( dataHash.get(TO_PLANO_ID) == null && getPlano_id() != null ) + { + dataHash.put(TO_PLANO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp.PlanosActuacaoData.class, new Object[]{ getPlano_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp.PlanosActuacaoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp.PlanosActuacaoData) dataHash.get(TO_PLANO_ID); + } + + public void setToPlano_id(com.evolute.siprp.server.db.data.siprp.PlanosActuacaoData plano_idObject ) + { + if( plano_idObject == null ) + { + dataHash.put(PLANO_ID, null); + } + else + { + dataHash.put(PLANO_ID, plano_idObject.get( com.evolute.siprp.server.db.data.siprp.PlanosActuacaoData.ID )); + } + dataHash.put(TO_PLANO_ID, plano_idObject); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getArea_id() + { + return (Integer) get(AREA_ID); + } + + public void setArea_id(Integer area_idValue ) + { + this.set(AREA_ID, area_idValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_PLANO_ID.equals( fieldName ) ) + { + value = toPlano_id(); + } + else if( PLANO_ID.equals( fieldName ) ) + { + value = getPlano_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_PLANO_ID.equals( fieldName ) ) + { + setToPlano_id( (com.evolute.siprp.server.db.data.siprp.PlanosActuacaoData) value ); + } + else if( PLANO_ID.equals( fieldName ) ) + { + setPlano_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_PLANO_ID) != null ) + { + toPlano_id().save(); + dataHash.put(PLANO_ID, toPlano_id().get( com.evolute.siprp.server.db.data.siprp.PlanosActuacaoData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return PlanoAreas.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoMedidas.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoMedidas.java new file mode 100644 index 00000000..0aec8ae8 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoMedidas.java @@ -0,0 +1,156 @@ +/* +* PlanoMedidas.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class PlanoMedidas implements JDOInnerObject +{ + private String descricao; + private Integer risco_id; + private Integer id; + private Integer medida_id; + + public PlanoMedidas() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == PlanoMedidasDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName == PlanoMedidasDataAuto.RISCO_ID ) + { + return risco_id; + } + else if( fieldName == PlanoMedidasDataAuto.ID ) + { + return id; + } + else if( fieldName == PlanoMedidasDataAuto.MEDIDA_ID ) + { + return medida_id; + } + else if( fieldName.equals( PlanoMedidasDataAuto.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( PlanoMedidasDataAuto.RISCO_ID ) ) + { + return risco_id; + } + else if( fieldName.equals( PlanoMedidasDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( PlanoMedidasDataAuto.MEDIDA_ID ) ) + { + return medida_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == PlanoMedidasDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == PlanoMedidasDataAuto.RISCO_ID ) + { + risco_id = ( Integer ) value; + } + else if( fieldName == PlanoMedidasDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == PlanoMedidasDataAuto.MEDIDA_ID ) + { + medida_id = ( Integer ) value; + } + else if( fieldName.equals( PlanoMedidasDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( PlanoMedidasDataAuto.RISCO_ID ) ) + { + risco_id = ( Integer ) value; + } + else if( fieldName.equals( PlanoMedidasDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( PlanoMedidasDataAuto.MEDIDA_ID ) ) + { + medida_id = ( Integer ) value; + } + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public Integer getRisco_id() + { + return risco_id; + } + + public void setRisco_id(Integer risco_idValue ) + { + this.risco_id = risco_idValue; + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getMedida_id() + { + return medida_id; + } + + public void setMedida_id(Integer medida_idValue ) + { + this.medida_id = medida_idValue; + } + + public Class getOuterClass() + { + return PlanoMedidasDataAuto.class; + } + + public PlanoMedidasDataAuto getOuterClassInstance() + { + PlanoMedidasDataAuto outerObj = new PlanoMedidasDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoMedidasData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoMedidasData.java new file mode 100644 index 00000000..6bf63707 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoMedidasData.java @@ -0,0 +1,18 @@ +/* +* PlanoMedidasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class PlanoMedidasData extends com.evolute.siprp.server.db.data.siprp.PlanoMedidasDataAuto +{ + + public PlanoMedidasData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoMedidasDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoMedidasDataAuto.java new file mode 100644 index 00000000..774b51cc --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoMedidasDataAuto.java @@ -0,0 +1,178 @@ +/* +* PlanoMedidasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class PlanoMedidasDataAuto extends JDOObject +{ + + public static final String TABLENAME = "plano_medidas"; + + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "plano_medidas.descricao"; + public static final String RISCO_ID = "risco_id"; + public static final String RISCO_ID_FULL = "plano_medidas.risco_id"; + public static final String TO_RISCO_ID = "to risco_id"; + public static final String ID = "id"; + public static final String ID_FULL = "plano_medidas.id"; + public static final String MEDIDA_ID = "medida_id"; + public static final String MEDIDA_ID_FULL = "plano_medidas.medida_id"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRICAO, RISCO_ID, TO_RISCO_ID, MEDIDA_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + DESCRICAO, RISCO_ID, ID, MEDIDA_ID, }; + + private Map dataHash; + + public PlanoMedidasDataAuto() + { + dataHash = new HashMap(); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + public Integer getRisco_id() + { + return (Integer) dataHash.get(RISCO_ID); + } + + public void setRisco_id(Integer risco_idValue ) + { + dataHash.put(TO_RISCO_ID, null); + dataHash.put(RISCO_ID, risco_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp.PlanoRiscosData toRisco_id() + throws Exception + { + if( dataHash.get(TO_RISCO_ID) == null && getRisco_id() != null ) + { + dataHash.put(TO_RISCO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp.PlanoRiscosData.class, new Object[]{ getRisco_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp.PlanoRiscosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp.PlanoRiscosData) dataHash.get(TO_RISCO_ID); + } + + public void setToRisco_id(com.evolute.siprp.server.db.data.siprp.PlanoRiscosData risco_idObject ) + { + if( risco_idObject == null ) + { + dataHash.put(RISCO_ID, null); + } + else + { + dataHash.put(RISCO_ID, risco_idObject.get( com.evolute.siprp.server.db.data.siprp.PlanoRiscosData.ID )); + } + dataHash.put(TO_RISCO_ID, risco_idObject); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getMedida_id() + { + return (Integer) get(MEDIDA_ID); + } + + public void setMedida_id(Integer medida_idValue ) + { + this.set(MEDIDA_ID, medida_idValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_RISCO_ID.equals( fieldName ) ) + { + value = toRisco_id(); + } + else if( RISCO_ID.equals( fieldName ) ) + { + value = getRisco_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_RISCO_ID.equals( fieldName ) ) + { + setToRisco_id( (com.evolute.siprp.server.db.data.siprp.PlanoRiscosData) value ); + } + else if( RISCO_ID.equals( fieldName ) ) + { + setRisco_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_RISCO_ID) != null ) + { + toRisco_id().save(); + dataHash.put(RISCO_ID, toRisco_id().get( com.evolute.siprp.server.db.data.siprp.PlanoRiscosData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return PlanoMedidas.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoPostosTrabalho.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoPostosTrabalho.java new file mode 100644 index 00000000..9c99caf3 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoPostosTrabalho.java @@ -0,0 +1,156 @@ +/* +* PlanoPostosTrabalho.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class PlanoPostosTrabalho implements JDOInnerObject +{ + private String descricao; + private Integer medida_id; + private Integer id; + private Integer posto_id; + + public PlanoPostosTrabalho() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == PlanoPostosTrabalhoDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName == PlanoPostosTrabalhoDataAuto.MEDIDA_ID ) + { + return medida_id; + } + else if( fieldName == PlanoPostosTrabalhoDataAuto.ID ) + { + return id; + } + else if( fieldName == PlanoPostosTrabalhoDataAuto.POSTO_ID ) + { + return posto_id; + } + else if( fieldName.equals( PlanoPostosTrabalhoDataAuto.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( PlanoPostosTrabalhoDataAuto.MEDIDA_ID ) ) + { + return medida_id; + } + else if( fieldName.equals( PlanoPostosTrabalhoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( PlanoPostosTrabalhoDataAuto.POSTO_ID ) ) + { + return posto_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == PlanoPostosTrabalhoDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == PlanoPostosTrabalhoDataAuto.MEDIDA_ID ) + { + medida_id = ( Integer ) value; + } + else if( fieldName == PlanoPostosTrabalhoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == PlanoPostosTrabalhoDataAuto.POSTO_ID ) + { + posto_id = ( Integer ) value; + } + else if( fieldName.equals( PlanoPostosTrabalhoDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( PlanoPostosTrabalhoDataAuto.MEDIDA_ID ) ) + { + medida_id = ( Integer ) value; + } + else if( fieldName.equals( PlanoPostosTrabalhoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( PlanoPostosTrabalhoDataAuto.POSTO_ID ) ) + { + posto_id = ( Integer ) value; + } + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public Integer getMedida_id() + { + return medida_id; + } + + public void setMedida_id(Integer medida_idValue ) + { + this.medida_id = medida_idValue; + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getPosto_id() + { + return posto_id; + } + + public void setPosto_id(Integer posto_idValue ) + { + this.posto_id = posto_idValue; + } + + public Class getOuterClass() + { + return PlanoPostosTrabalhoDataAuto.class; + } + + public PlanoPostosTrabalhoDataAuto getOuterClassInstance() + { + PlanoPostosTrabalhoDataAuto outerObj = new PlanoPostosTrabalhoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoPostosTrabalhoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoPostosTrabalhoData.java new file mode 100644 index 00000000..1106ee73 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoPostosTrabalhoData.java @@ -0,0 +1,18 @@ +/* +* PlanoPostosTrabalhoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class PlanoPostosTrabalhoData extends com.evolute.siprp.server.db.data.siprp.PlanoPostosTrabalhoDataAuto +{ + + public PlanoPostosTrabalhoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoPostosTrabalhoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoPostosTrabalhoDataAuto.java new file mode 100644 index 00000000..e4ca4469 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoPostosTrabalhoDataAuto.java @@ -0,0 +1,178 @@ +/* +* PlanoPostosTrabalhoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class PlanoPostosTrabalhoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "plano_postos_trabalho"; + + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "plano_postos_trabalho.descricao"; + public static final String MEDIDA_ID = "medida_id"; + public static final String MEDIDA_ID_FULL = "plano_postos_trabalho.medida_id"; + public static final String TO_MEDIDA_ID = "to medida_id"; + public static final String ID = "id"; + public static final String ID_FULL = "plano_postos_trabalho.id"; + public static final String POSTO_ID = "posto_id"; + public static final String POSTO_ID_FULL = "plano_postos_trabalho.posto_id"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRICAO, MEDIDA_ID, TO_MEDIDA_ID, POSTO_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + DESCRICAO, MEDIDA_ID, ID, POSTO_ID, }; + + private Map dataHash; + + public PlanoPostosTrabalhoDataAuto() + { + dataHash = new HashMap(); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + public Integer getMedida_id() + { + return (Integer) dataHash.get(MEDIDA_ID); + } + + public void setMedida_id(Integer medida_idValue ) + { + dataHash.put(TO_MEDIDA_ID, null); + dataHash.put(MEDIDA_ID, medida_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp.PlanoMedidasData toMedida_id() + throws Exception + { + if( dataHash.get(TO_MEDIDA_ID) == null && getMedida_id() != null ) + { + dataHash.put(TO_MEDIDA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp.PlanoMedidasData.class, new Object[]{ getMedida_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp.PlanoMedidasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp.PlanoMedidasData) dataHash.get(TO_MEDIDA_ID); + } + + public void setToMedida_id(com.evolute.siprp.server.db.data.siprp.PlanoMedidasData medida_idObject ) + { + if( medida_idObject == null ) + { + dataHash.put(MEDIDA_ID, null); + } + else + { + dataHash.put(MEDIDA_ID, medida_idObject.get( com.evolute.siprp.server.db.data.siprp.PlanoMedidasData.ID )); + } + dataHash.put(TO_MEDIDA_ID, medida_idObject); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getPosto_id() + { + return (Integer) get(POSTO_ID); + } + + public void setPosto_id(Integer posto_idValue ) + { + this.set(POSTO_ID, posto_idValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( MEDIDA_ID.equals( fieldName ) ) + { + value = getMedida_id(); + } + else if( TO_MEDIDA_ID.equals( fieldName ) ) + { + value = toMedida_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( MEDIDA_ID.equals( fieldName ) ) + { + setMedida_id( (Integer) value ); + } + else if( TO_MEDIDA_ID.equals( fieldName ) ) + { + setToMedida_id( (com.evolute.siprp.server.db.data.siprp.PlanoMedidasData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_MEDIDA_ID) != null ) + { + toMedida_id().save(); + dataHash.put(MEDIDA_ID, toMedida_id().get( com.evolute.siprp.server.db.data.siprp.PlanoMedidasData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return PlanoPostosTrabalho.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoRiscos.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoRiscos.java new file mode 100644 index 00000000..61804920 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoRiscos.java @@ -0,0 +1,426 @@ +/* +* PlanoRiscos.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class PlanoRiscos implements JDOInnerObject +{ + private String descricao; + private String activo; + private Integer area_id; + private Integer id; + private Integer valor; + private String responsavel_execucao; + private String recursos_necessarios; + private java.util.Date data_inicio; + private java.util.Date data_fim; + private String parecer_dl; + private String parecer_dns; + private String verificacao_siprp; + private Integer risco_id; + private String por; + + public PlanoRiscos() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == PlanoRiscosDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName == PlanoRiscosDataAuto.ACTIVO ) + { + return activo; + } + else if( fieldName == PlanoRiscosDataAuto.AREA_ID ) + { + return area_id; + } + else if( fieldName == PlanoRiscosDataAuto.ID ) + { + return id; + } + else if( fieldName == PlanoRiscosDataAuto.VALOR ) + { + return valor; + } + else if( fieldName == PlanoRiscosDataAuto.RESPONSAVEL_EXECUCAO ) + { + return responsavel_execucao; + } + else if( fieldName == PlanoRiscosDataAuto.RECURSOS_NECESSARIOS ) + { + return recursos_necessarios; + } + else if( fieldName == PlanoRiscosDataAuto.DATA_INICIO ) + { + return data_inicio; + } + else if( fieldName == PlanoRiscosDataAuto.DATA_FIM ) + { + return data_fim; + } + else if( fieldName == PlanoRiscosDataAuto.PARECER_DL ) + { + return parecer_dl; + } + else if( fieldName == PlanoRiscosDataAuto.PARECER_DNS ) + { + return parecer_dns; + } + else if( fieldName == PlanoRiscosDataAuto.VERIFICACAO_SIPRP ) + { + return verificacao_siprp; + } + else if( fieldName == PlanoRiscosDataAuto.RISCO_ID ) + { + return risco_id; + } + else if( fieldName == PlanoRiscosDataAuto.POR ) + { + return por; + } + else if( fieldName.equals( PlanoRiscosDataAuto.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( PlanoRiscosDataAuto.ACTIVO ) ) + { + return activo; + } + else if( fieldName.equals( PlanoRiscosDataAuto.AREA_ID ) ) + { + return area_id; + } + else if( fieldName.equals( PlanoRiscosDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( PlanoRiscosDataAuto.VALOR ) ) + { + return valor; + } + else if( fieldName.equals( PlanoRiscosDataAuto.RESPONSAVEL_EXECUCAO ) ) + { + return responsavel_execucao; + } + else if( fieldName.equals( PlanoRiscosDataAuto.RECURSOS_NECESSARIOS ) ) + { + return recursos_necessarios; + } + else if( fieldName.equals( PlanoRiscosDataAuto.DATA_INICIO ) ) + { + return data_inicio; + } + else if( fieldName.equals( PlanoRiscosDataAuto.DATA_FIM ) ) + { + return data_fim; + } + else if( fieldName.equals( PlanoRiscosDataAuto.PARECER_DL ) ) + { + return parecer_dl; + } + else if( fieldName.equals( PlanoRiscosDataAuto.PARECER_DNS ) ) + { + return parecer_dns; + } + else if( fieldName.equals( PlanoRiscosDataAuto.VERIFICACAO_SIPRP ) ) + { + return verificacao_siprp; + } + else if( fieldName.equals( PlanoRiscosDataAuto.RISCO_ID ) ) + { + return risco_id; + } + else if( fieldName.equals( PlanoRiscosDataAuto.POR ) ) + { + return por; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == PlanoRiscosDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == PlanoRiscosDataAuto.ACTIVO ) + { + activo = ( String ) value; + } + else if( fieldName == PlanoRiscosDataAuto.AREA_ID ) + { + area_id = ( Integer ) value; + } + else if( fieldName == PlanoRiscosDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == PlanoRiscosDataAuto.VALOR ) + { + valor = ( Integer ) value; + } + else if( fieldName == PlanoRiscosDataAuto.RESPONSAVEL_EXECUCAO ) + { + responsavel_execucao = ( String ) value; + } + else if( fieldName == PlanoRiscosDataAuto.RECURSOS_NECESSARIOS ) + { + recursos_necessarios = ( String ) value; + } + else if( fieldName == PlanoRiscosDataAuto.DATA_INICIO ) + { + data_inicio = ( java.util.Date ) value; + } + else if( fieldName == PlanoRiscosDataAuto.DATA_FIM ) + { + data_fim = ( java.util.Date ) value; + } + else if( fieldName == PlanoRiscosDataAuto.PARECER_DL ) + { + parecer_dl = ( String ) value; + } + else if( fieldName == PlanoRiscosDataAuto.PARECER_DNS ) + { + parecer_dns = ( String ) value; + } + else if( fieldName == PlanoRiscosDataAuto.VERIFICACAO_SIPRP ) + { + verificacao_siprp = ( String ) value; + } + else if( fieldName == PlanoRiscosDataAuto.RISCO_ID ) + { + risco_id = ( Integer ) value; + } + else if( fieldName == PlanoRiscosDataAuto.POR ) + { + por = ( String ) value; + } + else if( fieldName.equals( PlanoRiscosDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( PlanoRiscosDataAuto.ACTIVO ) ) + { + activo = ( String ) value; + } + else if( fieldName.equals( PlanoRiscosDataAuto.AREA_ID ) ) + { + area_id = ( Integer ) value; + } + else if( fieldName.equals( PlanoRiscosDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( PlanoRiscosDataAuto.VALOR ) ) + { + valor = ( Integer ) value; + } + else if( fieldName.equals( PlanoRiscosDataAuto.RESPONSAVEL_EXECUCAO ) ) + { + responsavel_execucao = ( String ) value; + } + else if( fieldName.equals( PlanoRiscosDataAuto.RECURSOS_NECESSARIOS ) ) + { + recursos_necessarios = ( String ) value; + } + else if( fieldName.equals( PlanoRiscosDataAuto.DATA_INICIO ) ) + { + data_inicio = ( java.util.Date ) value; + } + else if( fieldName.equals( PlanoRiscosDataAuto.DATA_FIM ) ) + { + data_fim = ( java.util.Date ) value; + } + else if( fieldName.equals( PlanoRiscosDataAuto.PARECER_DL ) ) + { + parecer_dl = ( String ) value; + } + else if( fieldName.equals( PlanoRiscosDataAuto.PARECER_DNS ) ) + { + parecer_dns = ( String ) value; + } + else if( fieldName.equals( PlanoRiscosDataAuto.VERIFICACAO_SIPRP ) ) + { + verificacao_siprp = ( String ) value; + } + else if( fieldName.equals( PlanoRiscosDataAuto.RISCO_ID ) ) + { + risco_id = ( Integer ) value; + } + else if( fieldName.equals( PlanoRiscosDataAuto.POR ) ) + { + por = ( String ) value; + } + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public String getActivo() + { + return activo; + } + + public void setActivo(String activoValue ) + { + this.activo = activoValue; + } + + public Integer getArea_id() + { + return area_id; + } + + public void setArea_id(Integer area_idValue ) + { + this.area_id = area_idValue; + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getValor() + { + return valor; + } + + public void setValor(Integer valorValue ) + { + this.valor = valorValue; + } + + public String getResponsavel_execucao() + { + return responsavel_execucao; + } + + public void setResponsavel_execucao(String responsavel_execucaoValue ) + { + this.responsavel_execucao = responsavel_execucaoValue; + } + + public String getRecursos_necessarios() + { + return recursos_necessarios; + } + + public void setRecursos_necessarios(String recursos_necessariosValue ) + { + this.recursos_necessarios = recursos_necessariosValue; + } + + public java.util.Date getData_inicio() + { + return data_inicio; + } + + public void setData_inicio(java.util.Date data_inicioValue ) + { + this.data_inicio = data_inicioValue; + } + + public java.util.Date getData_fim() + { + return data_fim; + } + + public void setData_fim(java.util.Date data_fimValue ) + { + this.data_fim = data_fimValue; + } + + public String getParecer_dl() + { + return parecer_dl; + } + + public void setParecer_dl(String parecer_dlValue ) + { + this.parecer_dl = parecer_dlValue; + } + + public String getParecer_dns() + { + return parecer_dns; + } + + public void setParecer_dns(String parecer_dnsValue ) + { + this.parecer_dns = parecer_dnsValue; + } + + public String getVerificacao_siprp() + { + return verificacao_siprp; + } + + public void setVerificacao_siprp(String verificacao_siprpValue ) + { + this.verificacao_siprp = verificacao_siprpValue; + } + + public Integer getRisco_id() + { + return risco_id; + } + + public void setRisco_id(Integer risco_idValue ) + { + this.risco_id = risco_idValue; + } + + public String getPor() + { + return por; + } + + public void setPor(String porValue ) + { + this.por = porValue; + } + + public Class getOuterClass() + { + return PlanoRiscosDataAuto.class; + } + + public PlanoRiscosDataAuto getOuterClassInstance() + { + PlanoRiscosDataAuto outerObj = new PlanoRiscosDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoRiscosData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoRiscosData.java new file mode 100644 index 00000000..a493cf37 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoRiscosData.java @@ -0,0 +1,18 @@ +/* +* PlanoRiscosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class PlanoRiscosData extends com.evolute.siprp.server.db.data.siprp.PlanoRiscosDataAuto +{ + + public PlanoRiscosData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoRiscosDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoRiscosDataAuto.java new file mode 100644 index 00000000..46b649ef --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanoRiscosDataAuto.java @@ -0,0 +1,301 @@ +/* +* PlanoRiscosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class PlanoRiscosDataAuto extends JDOObject +{ + + public static final String TABLENAME = "plano_riscos"; + + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "plano_riscos.descricao"; + public static final String ACTIVO = "activo"; + public static final String ACTIVO_FULL = "plano_riscos.activo"; + public static final String AREA_ID = "area_id"; + public static final String AREA_ID_FULL = "plano_riscos.area_id"; + public static final String TO_AREA_ID = "to area_id"; + public static final String ID = "id"; + public static final String ID_FULL = "plano_riscos.id"; + public static final String VALOR = "valor"; + public static final String VALOR_FULL = "plano_riscos.valor"; + public static final String RESPONSAVEL_EXECUCAO = "responsavel_execucao"; + public static final String RESPONSAVEL_EXECUCAO_FULL = "plano_riscos.responsavel_execucao"; + public static final String RECURSOS_NECESSARIOS = "recursos_necessarios"; + public static final String RECURSOS_NECESSARIOS_FULL = "plano_riscos.recursos_necessarios"; + public static final String DATA_INICIO = "data_inicio"; + public static final String DATA_INICIO_FULL = "plano_riscos.data_inicio"; + public static final String DATA_FIM = "data_fim"; + public static final String DATA_FIM_FULL = "plano_riscos.data_fim"; + public static final String PARECER_DL = "parecer_dl"; + public static final String PARECER_DL_FULL = "plano_riscos.parecer_dl"; + public static final String PARECER_DNS = "parecer_dns"; + public static final String PARECER_DNS_FULL = "plano_riscos.parecer_dns"; + public static final String VERIFICACAO_SIPRP = "verificacao_siprp"; + public static final String VERIFICACAO_SIPRP_FULL = "plano_riscos.verificacao_siprp"; + public static final String RISCO_ID = "risco_id"; + public static final String RISCO_ID_FULL = "plano_riscos.risco_id"; + public static final String POR = "por"; + public static final String POR_FULL = "plano_riscos.por"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRICAO, ACTIVO, AREA_ID, TO_AREA_ID, VALOR, RESPONSAVEL_EXECUCAO, + RECURSOS_NECESSARIOS, DATA_INICIO, DATA_FIM, PARECER_DL, PARECER_DNS, + VERIFICACAO_SIPRP, RISCO_ID, POR, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + DESCRICAO, ACTIVO, AREA_ID, ID, VALOR, RESPONSAVEL_EXECUCAO, RECURSOS_NECESSARIOS, + DATA_INICIO, DATA_FIM, PARECER_DL, PARECER_DNS, VERIFICACAO_SIPRP, RISCO_ID, POR, }; + + private Map dataHash; + + public PlanoRiscosDataAuto() + { + dataHash = new HashMap(); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + public String getActivo() + { + return (String) get(ACTIVO); + } + + public void setActivo(String activoValue ) + { + this.set(ACTIVO, activoValue ); + } + + public Integer getArea_id() + { + return (Integer) dataHash.get(AREA_ID); + } + + public void setArea_id(Integer area_idValue ) + { + dataHash.put(TO_AREA_ID, null); + dataHash.put(AREA_ID, area_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp.PlanoAreasData toArea_id() + throws Exception + { + if( dataHash.get(TO_AREA_ID) == null && getArea_id() != null ) + { + dataHash.put(TO_AREA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp.PlanoAreasData.class, new Object[]{ getArea_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp.PlanoAreasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp.PlanoAreasData) dataHash.get(TO_AREA_ID); + } + + public void setToArea_id(com.evolute.siprp.server.db.data.siprp.PlanoAreasData area_idObject ) + { + if( area_idObject == null ) + { + dataHash.put(AREA_ID, null); + } + else + { + dataHash.put(AREA_ID, area_idObject.get( com.evolute.siprp.server.db.data.siprp.PlanoAreasData.ID )); + } + dataHash.put(TO_AREA_ID, area_idObject); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getValor() + { + return (Integer) get(VALOR); + } + + public void setValor(Integer valorValue ) + { + this.set(VALOR, valorValue ); + } + + public String getResponsavel_execucao() + { + return (String) get(RESPONSAVEL_EXECUCAO); + } + + public void setResponsavel_execucao(String responsavel_execucaoValue ) + { + this.set(RESPONSAVEL_EXECUCAO, responsavel_execucaoValue ); + } + + public String getRecursos_necessarios() + { + return (String) get(RECURSOS_NECESSARIOS); + } + + public void setRecursos_necessarios(String recursos_necessariosValue ) + { + this.set(RECURSOS_NECESSARIOS, recursos_necessariosValue ); + } + + public java.util.Date getData_inicio() + { + return (java.util.Date) get(DATA_INICIO); + } + + public void setData_inicio(java.util.Date data_inicioValue ) + { + this.set(DATA_INICIO, data_inicioValue ); + } + + public java.util.Date getData_fim() + { + return (java.util.Date) get(DATA_FIM); + } + + public void setData_fim(java.util.Date data_fimValue ) + { + this.set(DATA_FIM, data_fimValue ); + } + + public String getParecer_dl() + { + return (String) get(PARECER_DL); + } + + public void setParecer_dl(String parecer_dlValue ) + { + this.set(PARECER_DL, parecer_dlValue ); + } + + public String getParecer_dns() + { + return (String) get(PARECER_DNS); + } + + public void setParecer_dns(String parecer_dnsValue ) + { + this.set(PARECER_DNS, parecer_dnsValue ); + } + + public String getVerificacao_siprp() + { + return (String) get(VERIFICACAO_SIPRP); + } + + public void setVerificacao_siprp(String verificacao_siprpValue ) + { + this.set(VERIFICACAO_SIPRP, verificacao_siprpValue ); + } + + public Integer getRisco_id() + { + return (Integer) get(RISCO_ID); + } + + public void setRisco_id(Integer risco_idValue ) + { + this.set(RISCO_ID, risco_idValue ); + } + + public String getPor() + { + return (String) get(POR); + } + + public void setPor(String porValue ) + { + this.set(POR, porValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_AREA_ID.equals( fieldName ) ) + { + value = toArea_id(); + } + else if( AREA_ID.equals( fieldName ) ) + { + value = getArea_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_AREA_ID.equals( fieldName ) ) + { + setToArea_id( (com.evolute.siprp.server.db.data.siprp.PlanoAreasData) value ); + } + else if( AREA_ID.equals( fieldName ) ) + { + setArea_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_AREA_ID) != null ) + { + toArea_id().save(); + dataHash.put(AREA_ID, toArea_id().get( com.evolute.siprp.server.db.data.siprp.PlanoAreasData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return PlanoRiscos.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanosActuacao.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanosActuacao.java new file mode 100644 index 00000000..6b486673 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanosActuacao.java @@ -0,0 +1,804 @@ +/* +* PlanosActuacao.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class PlanosActuacao implements JDOInnerObject +{ + private Integer estabelecimento_id; + private Integer fase; + private java.util.Date data_visita; + private String nome_estabelecimento; + private Boolean validacao_director_loja; + private Boolean validacao_dns; + private Boolean validacao_hs; + private String parecer_dns; + private String obs_correcao; + private java.util.Date data_validacao_dir_loja; + private Integer user_dir_loja; + private java.util.Date data_validacao_dns; + private Integer user_dns; + private java.util.Date data_validacao_hs; + private Integer user_hs; + private Integer fase_antes_correcao; + private String correcao; + private String observacoes_dl; + private String observacoes_dns; + private String verificacao_siprp; + private java.util.Date data_controlo; + private java.util.Date data_email_controlo; + private Integer empresa_id; + private String nome_empresa; + private Integer tecnico_hs_id; + private String tecnico_hs_nome; + private Integer id; + private java.util.Date data_relatorio; + + public PlanosActuacao() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == PlanosActuacaoDataAuto.ESTABELECIMENTO_ID ) + { + return estabelecimento_id; + } + else if( fieldName == PlanosActuacaoDataAuto.FASE ) + { + return fase; + } + else if( fieldName == PlanosActuacaoDataAuto.DATA_VISITA ) + { + return data_visita; + } + else if( fieldName == PlanosActuacaoDataAuto.NOME_ESTABELECIMENTO ) + { + return nome_estabelecimento; + } + else if( fieldName == PlanosActuacaoDataAuto.VALIDACAO_DIRECTOR_LOJA ) + { + return validacao_director_loja; + } + else if( fieldName == PlanosActuacaoDataAuto.VALIDACAO_DNS ) + { + return validacao_dns; + } + else if( fieldName == PlanosActuacaoDataAuto.VALIDACAO_HS ) + { + return validacao_hs; + } + else if( fieldName == PlanosActuacaoDataAuto.PARECER_DNS ) + { + return parecer_dns; + } + else if( fieldName == PlanosActuacaoDataAuto.OBS_CORRECAO ) + { + return obs_correcao; + } + else if( fieldName == PlanosActuacaoDataAuto.DATA_VALIDACAO_DIR_LOJA ) + { + return data_validacao_dir_loja; + } + else if( fieldName == PlanosActuacaoDataAuto.USER_DIR_LOJA ) + { + return user_dir_loja; + } + else if( fieldName == PlanosActuacaoDataAuto.DATA_VALIDACAO_DNS ) + { + return data_validacao_dns; + } + else if( fieldName == PlanosActuacaoDataAuto.USER_DNS ) + { + return user_dns; + } + else if( fieldName == PlanosActuacaoDataAuto.DATA_VALIDACAO_HS ) + { + return data_validacao_hs; + } + else if( fieldName == PlanosActuacaoDataAuto.USER_HS ) + { + return user_hs; + } + else if( fieldName == PlanosActuacaoDataAuto.FASE_ANTES_CORRECAO ) + { + return fase_antes_correcao; + } + else if( fieldName == PlanosActuacaoDataAuto.CORRECAO ) + { + return correcao; + } + else if( fieldName == PlanosActuacaoDataAuto.OBSERVACOES_DL ) + { + return observacoes_dl; + } + else if( fieldName == PlanosActuacaoDataAuto.OBSERVACOES_DNS ) + { + return observacoes_dns; + } + else if( fieldName == PlanosActuacaoDataAuto.VERIFICACAO_SIPRP ) + { + return verificacao_siprp; + } + else if( fieldName == PlanosActuacaoDataAuto.DATA_CONTROLO ) + { + return data_controlo; + } + else if( fieldName == PlanosActuacaoDataAuto.DATA_EMAIL_CONTROLO ) + { + return data_email_controlo; + } + else if( fieldName == PlanosActuacaoDataAuto.EMPRESA_ID ) + { + return empresa_id; + } + else if( fieldName == PlanosActuacaoDataAuto.NOME_EMPRESA ) + { + return nome_empresa; + } + else if( fieldName == PlanosActuacaoDataAuto.TECNICO_HS_ID ) + { + return tecnico_hs_id; + } + else if( fieldName == PlanosActuacaoDataAuto.TECNICO_HS_NOME ) + { + return tecnico_hs_nome; + } + else if( fieldName == PlanosActuacaoDataAuto.ID ) + { + return id; + } + else if( fieldName == PlanosActuacaoDataAuto.DATA_RELATORIO ) + { + return data_relatorio; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.ESTABELECIMENTO_ID ) ) + { + return estabelecimento_id; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.FASE ) ) + { + return fase; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.DATA_VISITA ) ) + { + return data_visita; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.NOME_ESTABELECIMENTO ) ) + { + return nome_estabelecimento; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.VALIDACAO_DIRECTOR_LOJA ) ) + { + return validacao_director_loja; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.VALIDACAO_DNS ) ) + { + return validacao_dns; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.VALIDACAO_HS ) ) + { + return validacao_hs; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.PARECER_DNS ) ) + { + return parecer_dns; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.OBS_CORRECAO ) ) + { + return obs_correcao; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.DATA_VALIDACAO_DIR_LOJA ) ) + { + return data_validacao_dir_loja; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.USER_DIR_LOJA ) ) + { + return user_dir_loja; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.DATA_VALIDACAO_DNS ) ) + { + return data_validacao_dns; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.USER_DNS ) ) + { + return user_dns; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.DATA_VALIDACAO_HS ) ) + { + return data_validacao_hs; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.USER_HS ) ) + { + return user_hs; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.FASE_ANTES_CORRECAO ) ) + { + return fase_antes_correcao; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.CORRECAO ) ) + { + return correcao; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.OBSERVACOES_DL ) ) + { + return observacoes_dl; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.OBSERVACOES_DNS ) ) + { + return observacoes_dns; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.VERIFICACAO_SIPRP ) ) + { + return verificacao_siprp; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.DATA_CONTROLO ) ) + { + return data_controlo; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.DATA_EMAIL_CONTROLO ) ) + { + return data_email_controlo; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.EMPRESA_ID ) ) + { + return empresa_id; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.NOME_EMPRESA ) ) + { + return nome_empresa; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.TECNICO_HS_ID ) ) + { + return tecnico_hs_id; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.TECNICO_HS_NOME ) ) + { + return tecnico_hs_nome; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.DATA_RELATORIO ) ) + { + return data_relatorio; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == PlanosActuacaoDataAuto.ESTABELECIMENTO_ID ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.FASE ) + { + fase = ( Integer ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.DATA_VISITA ) + { + data_visita = ( java.util.Date ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.NOME_ESTABELECIMENTO ) + { + nome_estabelecimento = ( String ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.VALIDACAO_DIRECTOR_LOJA ) + { + validacao_director_loja = ( Boolean ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.VALIDACAO_DNS ) + { + validacao_dns = ( Boolean ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.VALIDACAO_HS ) + { + validacao_hs = ( Boolean ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.PARECER_DNS ) + { + parecer_dns = ( String ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.OBS_CORRECAO ) + { + obs_correcao = ( String ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.DATA_VALIDACAO_DIR_LOJA ) + { + data_validacao_dir_loja = ( java.util.Date ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.USER_DIR_LOJA ) + { + user_dir_loja = ( Integer ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.DATA_VALIDACAO_DNS ) + { + data_validacao_dns = ( java.util.Date ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.USER_DNS ) + { + user_dns = ( Integer ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.DATA_VALIDACAO_HS ) + { + data_validacao_hs = ( java.util.Date ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.USER_HS ) + { + user_hs = ( Integer ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.FASE_ANTES_CORRECAO ) + { + fase_antes_correcao = ( Integer ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.CORRECAO ) + { + correcao = ( String ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.OBSERVACOES_DL ) + { + observacoes_dl = ( String ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.OBSERVACOES_DNS ) + { + observacoes_dns = ( String ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.VERIFICACAO_SIPRP ) + { + verificacao_siprp = ( String ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.DATA_CONTROLO ) + { + data_controlo = ( java.util.Date ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.DATA_EMAIL_CONTROLO ) + { + data_email_controlo = ( java.util.Date ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.EMPRESA_ID ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.NOME_EMPRESA ) + { + nome_empresa = ( String ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.TECNICO_HS_ID ) + { + tecnico_hs_id = ( Integer ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.TECNICO_HS_NOME ) + { + tecnico_hs_nome = ( String ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == PlanosActuacaoDataAuto.DATA_RELATORIO ) + { + data_relatorio = ( java.util.Date ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.ESTABELECIMENTO_ID ) ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.FASE ) ) + { + fase = ( Integer ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.DATA_VISITA ) ) + { + data_visita = ( java.util.Date ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.NOME_ESTABELECIMENTO ) ) + { + nome_estabelecimento = ( String ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.VALIDACAO_DIRECTOR_LOJA ) ) + { + validacao_director_loja = ( Boolean ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.VALIDACAO_DNS ) ) + { + validacao_dns = ( Boolean ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.VALIDACAO_HS ) ) + { + validacao_hs = ( Boolean ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.PARECER_DNS ) ) + { + parecer_dns = ( String ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.OBS_CORRECAO ) ) + { + obs_correcao = ( String ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.DATA_VALIDACAO_DIR_LOJA ) ) + { + data_validacao_dir_loja = ( java.util.Date ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.USER_DIR_LOJA ) ) + { + user_dir_loja = ( Integer ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.DATA_VALIDACAO_DNS ) ) + { + data_validacao_dns = ( java.util.Date ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.USER_DNS ) ) + { + user_dns = ( Integer ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.DATA_VALIDACAO_HS ) ) + { + data_validacao_hs = ( java.util.Date ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.USER_HS ) ) + { + user_hs = ( Integer ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.FASE_ANTES_CORRECAO ) ) + { + fase_antes_correcao = ( Integer ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.CORRECAO ) ) + { + correcao = ( String ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.OBSERVACOES_DL ) ) + { + observacoes_dl = ( String ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.OBSERVACOES_DNS ) ) + { + observacoes_dns = ( String ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.VERIFICACAO_SIPRP ) ) + { + verificacao_siprp = ( String ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.DATA_CONTROLO ) ) + { + data_controlo = ( java.util.Date ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.DATA_EMAIL_CONTROLO ) ) + { + data_email_controlo = ( java.util.Date ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.EMPRESA_ID ) ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.NOME_EMPRESA ) ) + { + nome_empresa = ( String ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.TECNICO_HS_ID ) ) + { + tecnico_hs_id = ( Integer ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.TECNICO_HS_NOME ) ) + { + tecnico_hs_nome = ( String ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( PlanosActuacaoDataAuto.DATA_RELATORIO ) ) + { + data_relatorio = ( java.util.Date ) value; + } + } + + public Integer getEstabelecimento_id() + { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + this.estabelecimento_id = estabelecimento_idValue; + } + + public Integer getFase() + { + return fase; + } + + public void setFase(Integer faseValue ) + { + this.fase = faseValue; + } + + public java.util.Date getData_visita() + { + return data_visita; + } + + public void setData_visita(java.util.Date data_visitaValue ) + { + this.data_visita = data_visitaValue; + } + + public String getNome_estabelecimento() + { + return nome_estabelecimento; + } + + public void setNome_estabelecimento(String nome_estabelecimentoValue ) + { + this.nome_estabelecimento = nome_estabelecimentoValue; + } + + public Boolean getValidacao_director_loja() + { + return validacao_director_loja; + } + + public void setValidacao_director_loja(Boolean validacao_director_lojaValue ) + { + this.validacao_director_loja = validacao_director_lojaValue; + } + + public Boolean getValidacao_dns() + { + return validacao_dns; + } + + public void setValidacao_dns(Boolean validacao_dnsValue ) + { + this.validacao_dns = validacao_dnsValue; + } + + public Boolean getValidacao_hs() + { + return validacao_hs; + } + + public void setValidacao_hs(Boolean validacao_hsValue ) + { + this.validacao_hs = validacao_hsValue; + } + + public String getParecer_dns() + { + return parecer_dns; + } + + public void setParecer_dns(String parecer_dnsValue ) + { + this.parecer_dns = parecer_dnsValue; + } + + public String getObs_correcao() + { + return obs_correcao; + } + + public void setObs_correcao(String obs_correcaoValue ) + { + this.obs_correcao = obs_correcaoValue; + } + + public java.util.Date getData_validacao_dir_loja() + { + return data_validacao_dir_loja; + } + + public void setData_validacao_dir_loja(java.util.Date data_validacao_dir_lojaValue ) + { + this.data_validacao_dir_loja = data_validacao_dir_lojaValue; + } + + public Integer getUser_dir_loja() + { + return user_dir_loja; + } + + public void setUser_dir_loja(Integer user_dir_lojaValue ) + { + this.user_dir_loja = user_dir_lojaValue; + } + + public java.util.Date getData_validacao_dns() + { + return data_validacao_dns; + } + + public void setData_validacao_dns(java.util.Date data_validacao_dnsValue ) + { + this.data_validacao_dns = data_validacao_dnsValue; + } + + public Integer getUser_dns() + { + return user_dns; + } + + public void setUser_dns(Integer user_dnsValue ) + { + this.user_dns = user_dnsValue; + } + + public java.util.Date getData_validacao_hs() + { + return data_validacao_hs; + } + + public void setData_validacao_hs(java.util.Date data_validacao_hsValue ) + { + this.data_validacao_hs = data_validacao_hsValue; + } + + public Integer getUser_hs() + { + return user_hs; + } + + public void setUser_hs(Integer user_hsValue ) + { + this.user_hs = user_hsValue; + } + + public Integer getFase_antes_correcao() + { + return fase_antes_correcao; + } + + public void setFase_antes_correcao(Integer fase_antes_correcaoValue ) + { + this.fase_antes_correcao = fase_antes_correcaoValue; + } + + public String getCorrecao() + { + return correcao; + } + + public void setCorrecao(String correcaoValue ) + { + this.correcao = correcaoValue; + } + + public String getObservacoes_dl() + { + return observacoes_dl; + } + + public void setObservacoes_dl(String observacoes_dlValue ) + { + this.observacoes_dl = observacoes_dlValue; + } + + public String getObservacoes_dns() + { + return observacoes_dns; + } + + public void setObservacoes_dns(String observacoes_dnsValue ) + { + this.observacoes_dns = observacoes_dnsValue; + } + + public String getVerificacao_siprp() + { + return verificacao_siprp; + } + + public void setVerificacao_siprp(String verificacao_siprpValue ) + { + this.verificacao_siprp = verificacao_siprpValue; + } + + public java.util.Date getData_controlo() + { + return data_controlo; + } + + public void setData_controlo(java.util.Date data_controloValue ) + { + this.data_controlo = data_controloValue; + } + + public java.util.Date getData_email_controlo() + { + return data_email_controlo; + } + + public void setData_email_controlo(java.util.Date data_email_controloValue ) + { + this.data_email_controlo = data_email_controloValue; + } + + public Integer getEmpresa_id() + { + return empresa_id; + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + this.empresa_id = empresa_idValue; + } + + public String getNome_empresa() + { + return nome_empresa; + } + + public void setNome_empresa(String nome_empresaValue ) + { + this.nome_empresa = nome_empresaValue; + } + + public Integer getTecnico_hs_id() + { + return tecnico_hs_id; + } + + public void setTecnico_hs_id(Integer tecnico_hs_idValue ) + { + this.tecnico_hs_id = tecnico_hs_idValue; + } + + public String getTecnico_hs_nome() + { + return tecnico_hs_nome; + } + + public void setTecnico_hs_nome(String tecnico_hs_nomeValue ) + { + this.tecnico_hs_nome = tecnico_hs_nomeValue; + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public java.util.Date getData_relatorio() + { + return data_relatorio; + } + + public void setData_relatorio(java.util.Date data_relatorioValue ) + { + this.data_relatorio = data_relatorioValue; + } + + public Class getOuterClass() + { + return PlanosActuacaoDataAuto.class; + } + + public PlanosActuacaoDataAuto getOuterClassInstance() + { + PlanosActuacaoDataAuto outerObj = new PlanosActuacaoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanosActuacaoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanosActuacaoData.java new file mode 100644 index 00000000..35ba9508 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanosActuacaoData.java @@ -0,0 +1,18 @@ +/* +* PlanosActuacaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class PlanosActuacaoData extends com.evolute.siprp.server.db.data.siprp.PlanosActuacaoDataAuto +{ + + public PlanosActuacaoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanosActuacaoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanosActuacaoDataAuto.java new file mode 100644 index 00000000..7414beec --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PlanosActuacaoDataAuto.java @@ -0,0 +1,572 @@ +/* +* PlanosActuacaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class PlanosActuacaoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "planos_actuacao"; + + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "planos_actuacao.estabelecimento_id"; + public static final String FASE = "fase"; + public static final String FASE_FULL = "planos_actuacao.fase"; + public static final String DATA_VISITA = "data_visita"; + public static final String DATA_VISITA_FULL = "planos_actuacao.data_visita"; + public static final String NOME_ESTABELECIMENTO = "nome_estabelecimento"; + public static final String NOME_ESTABELECIMENTO_FULL = "planos_actuacao.nome_estabelecimento"; + public static final String VALIDACAO_DIRECTOR_LOJA = "validacao_director_loja"; + public static final String VALIDACAO_DIRECTOR_LOJA_FULL = "planos_actuacao.validacao_director_loja"; + public static final String VALIDACAO_DNS = "validacao_dns"; + public static final String VALIDACAO_DNS_FULL = "planos_actuacao.validacao_dns"; + public static final String VALIDACAO_HS = "validacao_hs"; + public static final String VALIDACAO_HS_FULL = "planos_actuacao.validacao_hs"; + public static final String PARECER_DNS = "parecer_dns"; + public static final String PARECER_DNS_FULL = "planos_actuacao.parecer_dns"; + public static final String OBS_CORRECAO = "obs_correcao"; + public static final String OBS_CORRECAO_FULL = "planos_actuacao.obs_correcao"; + public static final String DATA_VALIDACAO_DIR_LOJA = "data_validacao_dir_loja"; + public static final String DATA_VALIDACAO_DIR_LOJA_FULL = "planos_actuacao.data_validacao_dir_loja"; + public static final String USER_DIR_LOJA = "user_dir_loja"; + public static final String USER_DIR_LOJA_FULL = "planos_actuacao.user_dir_loja"; + public static final String TO_USER_DIR_LOJA = "to user_dir_loja"; + public static final String DATA_VALIDACAO_DNS = "data_validacao_dns"; + public static final String DATA_VALIDACAO_DNS_FULL = "planos_actuacao.data_validacao_dns"; + public static final String USER_DNS = "user_dns"; + public static final String USER_DNS_FULL = "planos_actuacao.user_dns"; + public static final String TO_USER_DNS = "to user_dns"; + public static final String DATA_VALIDACAO_HS = "data_validacao_hs"; + public static final String DATA_VALIDACAO_HS_FULL = "planos_actuacao.data_validacao_hs"; + public static final String USER_HS = "user_hs"; + public static final String USER_HS_FULL = "planos_actuacao.user_hs"; + public static final String TO_USER_HS = "to user_hs"; + public static final String FASE_ANTES_CORRECAO = "fase_antes_correcao"; + public static final String FASE_ANTES_CORRECAO_FULL = "planos_actuacao.fase_antes_correcao"; + public static final String CORRECAO = "correcao"; + public static final String CORRECAO_FULL = "planos_actuacao.correcao"; + public static final String OBSERVACOES_DL = "observacoes_dl"; + public static final String OBSERVACOES_DL_FULL = "planos_actuacao.observacoes_dl"; + public static final String OBSERVACOES_DNS = "observacoes_dns"; + public static final String OBSERVACOES_DNS_FULL = "planos_actuacao.observacoes_dns"; + public static final String VERIFICACAO_SIPRP = "verificacao_siprp"; + public static final String VERIFICACAO_SIPRP_FULL = "planos_actuacao.verificacao_siprp"; + public static final String DATA_CONTROLO = "data_controlo"; + public static final String DATA_CONTROLO_FULL = "planos_actuacao.data_controlo"; + public static final String DATA_EMAIL_CONTROLO = "data_email_controlo"; + public static final String DATA_EMAIL_CONTROLO_FULL = "planos_actuacao.data_email_controlo"; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "planos_actuacao.empresa_id"; + public static final String NOME_EMPRESA = "nome_empresa"; + public static final String NOME_EMPRESA_FULL = "planos_actuacao.nome_empresa"; + public static final String TECNICO_HS_ID = "tecnico_hs_id"; + public static final String TECNICO_HS_ID_FULL = "planos_actuacao.tecnico_hs_id"; + public static final String TECNICO_HS_NOME = "tecnico_hs_nome"; + public static final String TECNICO_HS_NOME_FULL = "planos_actuacao.tecnico_hs_nome"; + public static final String ID = "id"; + public static final String ID_FULL = "planos_actuacao.id"; + public static final String DATA_RELATORIO = "data_relatorio"; + public static final String DATA_RELATORIO_FULL = "planos_actuacao.data_relatorio"; + + public static final String FIELD_NAMES[] = new String[]{ + ESTABELECIMENTO_ID, FASE, DATA_VISITA, NOME_ESTABELECIMENTO, + VALIDACAO_DIRECTOR_LOJA, VALIDACAO_DNS, VALIDACAO_HS, PARECER_DNS, + OBS_CORRECAO, DATA_VALIDACAO_DIR_LOJA, USER_DIR_LOJA, TO_USER_DIR_LOJA, + DATA_VALIDACAO_DNS, USER_DNS, TO_USER_DNS, DATA_VALIDACAO_HS, USER_HS, + TO_USER_HS, FASE_ANTES_CORRECAO, CORRECAO, OBSERVACOES_DL, OBSERVACOES_DNS, + VERIFICACAO_SIPRP, DATA_CONTROLO, DATA_EMAIL_CONTROLO, EMPRESA_ID, + NOME_EMPRESA, TECNICO_HS_ID, TECNICO_HS_NOME, DATA_RELATORIO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ESTABELECIMENTO_ID, FASE, DATA_VISITA, NOME_ESTABELECIMENTO, + VALIDACAO_DIRECTOR_LOJA, VALIDACAO_DNS, VALIDACAO_HS, PARECER_DNS, + OBS_CORRECAO, DATA_VALIDACAO_DIR_LOJA, USER_DIR_LOJA, DATA_VALIDACAO_DNS, + USER_DNS, DATA_VALIDACAO_HS, USER_HS, FASE_ANTES_CORRECAO, CORRECAO, + OBSERVACOES_DL, OBSERVACOES_DNS, VERIFICACAO_SIPRP, DATA_CONTROLO, + DATA_EMAIL_CONTROLO, EMPRESA_ID, NOME_EMPRESA, TECNICO_HS_ID, TECNICO_HS_NOME, + ID, DATA_RELATORIO, }; + + private Map dataHash; + + public PlanosActuacaoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getEstabelecimento_id() + { + return (Integer) get(ESTABELECIMENTO_ID); + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + this.set(ESTABELECIMENTO_ID, estabelecimento_idValue ); + } + + public Integer getFase() + { + return (Integer) get(FASE); + } + + public void setFase(Integer faseValue ) + { + this.set(FASE, faseValue ); + } + + public java.util.Date getData_visita() + { + return (java.util.Date) get(DATA_VISITA); + } + + public void setData_visita(java.util.Date data_visitaValue ) + { + this.set(DATA_VISITA, data_visitaValue ); + } + + public String getNome_estabelecimento() + { + return (String) get(NOME_ESTABELECIMENTO); + } + + public void setNome_estabelecimento(String nome_estabelecimentoValue ) + { + this.set(NOME_ESTABELECIMENTO, nome_estabelecimentoValue ); + } + + public Boolean getValidacao_director_loja() + { + return (Boolean) get(VALIDACAO_DIRECTOR_LOJA); + } + + public void setValidacao_director_loja(Boolean validacao_director_lojaValue ) + { + this.set(VALIDACAO_DIRECTOR_LOJA, validacao_director_lojaValue ); + } + + public Boolean getValidacao_dns() + { + return (Boolean) get(VALIDACAO_DNS); + } + + public void setValidacao_dns(Boolean validacao_dnsValue ) + { + this.set(VALIDACAO_DNS, validacao_dnsValue ); + } + + public Boolean getValidacao_hs() + { + return (Boolean) get(VALIDACAO_HS); + } + + public void setValidacao_hs(Boolean validacao_hsValue ) + { + this.set(VALIDACAO_HS, validacao_hsValue ); + } + + public String getParecer_dns() + { + return (String) get(PARECER_DNS); + } + + public void setParecer_dns(String parecer_dnsValue ) + { + this.set(PARECER_DNS, parecer_dnsValue ); + } + + public String getObs_correcao() + { + return (String) get(OBS_CORRECAO); + } + + public void setObs_correcao(String obs_correcaoValue ) + { + this.set(OBS_CORRECAO, obs_correcaoValue ); + } + + public java.util.Date getData_validacao_dir_loja() + { + return (java.util.Date) get(DATA_VALIDACAO_DIR_LOJA); + } + + public void setData_validacao_dir_loja(java.util.Date data_validacao_dir_lojaValue ) + { + this.set(DATA_VALIDACAO_DIR_LOJA, data_validacao_dir_lojaValue ); + } + + public Integer getUser_dir_loja() + { + return (Integer) dataHash.get(USER_DIR_LOJA); + } + + public void setUser_dir_loja(Integer user_dir_lojaValue ) + { + dataHash.put(TO_USER_DIR_LOJA, null); + dataHash.put(USER_DIR_LOJA, user_dir_lojaValue ); + } + + public com.evolute.siprp.server.db.data.siprp.UtilizadoresData toUser_dir_loja() + throws Exception + { + if( dataHash.get(TO_USER_DIR_LOJA) == null && getUser_dir_loja() != null ) + { + dataHash.put(TO_USER_DIR_LOJA, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp.UtilizadoresData.class, new Object[]{ getUser_dir_loja() }, new String[]{ com.evolute.siprp.server.db.data.siprp.UtilizadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp.UtilizadoresData) dataHash.get(TO_USER_DIR_LOJA); + } + + public void setToUser_dir_loja(com.evolute.siprp.server.db.data.siprp.UtilizadoresData user_dir_lojaObject ) + { + if( user_dir_lojaObject == null ) + { + dataHash.put(USER_DIR_LOJA, null); + } + else + { + dataHash.put(USER_DIR_LOJA, user_dir_lojaObject.get( com.evolute.siprp.server.db.data.siprp.UtilizadoresData.ID )); + } + dataHash.put(TO_USER_DIR_LOJA, user_dir_lojaObject); + } + + public java.util.Date getData_validacao_dns() + { + return (java.util.Date) get(DATA_VALIDACAO_DNS); + } + + public void setData_validacao_dns(java.util.Date data_validacao_dnsValue ) + { + this.set(DATA_VALIDACAO_DNS, data_validacao_dnsValue ); + } + + public Integer getUser_dns() + { + return (Integer) dataHash.get(USER_DNS); + } + + public void setUser_dns(Integer user_dnsValue ) + { + dataHash.put(TO_USER_DNS, null); + dataHash.put(USER_DNS, user_dnsValue ); + } + + public com.evolute.siprp.server.db.data.siprp.UtilizadoresData toUser_dns() + throws Exception + { + if( dataHash.get(TO_USER_DNS) == null && getUser_dns() != null ) + { + dataHash.put(TO_USER_DNS, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp.UtilizadoresData.class, new Object[]{ getUser_dns() }, new String[]{ com.evolute.siprp.server.db.data.siprp.UtilizadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp.UtilizadoresData) dataHash.get(TO_USER_DNS); + } + + public void setToUser_dns(com.evolute.siprp.server.db.data.siprp.UtilizadoresData user_dnsObject ) + { + if( user_dnsObject == null ) + { + dataHash.put(USER_DNS, null); + } + else + { + dataHash.put(USER_DNS, user_dnsObject.get( com.evolute.siprp.server.db.data.siprp.UtilizadoresData.ID )); + } + dataHash.put(TO_USER_DNS, user_dnsObject); + } + + public java.util.Date getData_validacao_hs() + { + return (java.util.Date) get(DATA_VALIDACAO_HS); + } + + public void setData_validacao_hs(java.util.Date data_validacao_hsValue ) + { + this.set(DATA_VALIDACAO_HS, data_validacao_hsValue ); + } + + public Integer getUser_hs() + { + return (Integer) dataHash.get(USER_HS); + } + + public void setUser_hs(Integer user_hsValue ) + { + dataHash.put(TO_USER_HS, null); + dataHash.put(USER_HS, user_hsValue ); + } + + public com.evolute.siprp.server.db.data.siprp.UtilizadoresData toUser_hs() + throws Exception + { + if( dataHash.get(TO_USER_HS) == null && getUser_hs() != null ) + { + dataHash.put(TO_USER_HS, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp.UtilizadoresData.class, new Object[]{ getUser_hs() }, new String[]{ com.evolute.siprp.server.db.data.siprp.UtilizadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp.UtilizadoresData) dataHash.get(TO_USER_HS); + } + + public void setToUser_hs(com.evolute.siprp.server.db.data.siprp.UtilizadoresData user_hsObject ) + { + if( user_hsObject == null ) + { + dataHash.put(USER_HS, null); + } + else + { + dataHash.put(USER_HS, user_hsObject.get( com.evolute.siprp.server.db.data.siprp.UtilizadoresData.ID )); + } + dataHash.put(TO_USER_HS, user_hsObject); + } + + public Integer getFase_antes_correcao() + { + return (Integer) get(FASE_ANTES_CORRECAO); + } + + public void setFase_antes_correcao(Integer fase_antes_correcaoValue ) + { + this.set(FASE_ANTES_CORRECAO, fase_antes_correcaoValue ); + } + + public String getCorrecao() + { + return (String) get(CORRECAO); + } + + public void setCorrecao(String correcaoValue ) + { + this.set(CORRECAO, correcaoValue ); + } + + public String getObservacoes_dl() + { + return (String) get(OBSERVACOES_DL); + } + + public void setObservacoes_dl(String observacoes_dlValue ) + { + this.set(OBSERVACOES_DL, observacoes_dlValue ); + } + + public String getObservacoes_dns() + { + return (String) get(OBSERVACOES_DNS); + } + + public void setObservacoes_dns(String observacoes_dnsValue ) + { + this.set(OBSERVACOES_DNS, observacoes_dnsValue ); + } + + public String getVerificacao_siprp() + { + return (String) get(VERIFICACAO_SIPRP); + } + + public void setVerificacao_siprp(String verificacao_siprpValue ) + { + this.set(VERIFICACAO_SIPRP, verificacao_siprpValue ); + } + + public java.util.Date getData_controlo() + { + return (java.util.Date) get(DATA_CONTROLO); + } + + public void setData_controlo(java.util.Date data_controloValue ) + { + this.set(DATA_CONTROLO, data_controloValue ); + } + + public java.util.Date getData_email_controlo() + { + return (java.util.Date) get(DATA_EMAIL_CONTROLO); + } + + public void setData_email_controlo(java.util.Date data_email_controloValue ) + { + this.set(DATA_EMAIL_CONTROLO, data_email_controloValue ); + } + + public Integer getEmpresa_id() + { + return (Integer) get(EMPRESA_ID); + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + this.set(EMPRESA_ID, empresa_idValue ); + } + + public String getNome_empresa() + { + return (String) get(NOME_EMPRESA); + } + + public void setNome_empresa(String nome_empresaValue ) + { + this.set(NOME_EMPRESA, nome_empresaValue ); + } + + public Integer getTecnico_hs_id() + { + return (Integer) get(TECNICO_HS_ID); + } + + public void setTecnico_hs_id(Integer tecnico_hs_idValue ) + { + this.set(TECNICO_HS_ID, tecnico_hs_idValue ); + } + + public String getTecnico_hs_nome() + { + return (String) get(TECNICO_HS_NOME); + } + + public void setTecnico_hs_nome(String tecnico_hs_nomeValue ) + { + this.set(TECNICO_HS_NOME, tecnico_hs_nomeValue ); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public java.util.Date getData_relatorio() + { + return (java.util.Date) get(DATA_RELATORIO); + } + + public void setData_relatorio(java.util.Date data_relatorioValue ) + { + this.set(DATA_RELATORIO, data_relatorioValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_USER_DIR_LOJA.equals( fieldName ) ) + { + value = toUser_dir_loja(); + } + else if( TO_USER_DNS.equals( fieldName ) ) + { + value = toUser_dns(); + } + else if( USER_DIR_LOJA.equals( fieldName ) ) + { + value = getUser_dir_loja(); + } + else if( TO_USER_HS.equals( fieldName ) ) + { + value = toUser_hs(); + } + else if( USER_HS.equals( fieldName ) ) + { + value = getUser_hs(); + } + else if( USER_DNS.equals( fieldName ) ) + { + value = getUser_dns(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_USER_DIR_LOJA.equals( fieldName ) ) + { + setToUser_dir_loja( (com.evolute.siprp.server.db.data.siprp.UtilizadoresData) value ); + } + else if( TO_USER_DNS.equals( fieldName ) ) + { + setToUser_dns( (com.evolute.siprp.server.db.data.siprp.UtilizadoresData) value ); + } + else if( USER_DIR_LOJA.equals( fieldName ) ) + { + setUser_dir_loja( (Integer) value ); + } + else if( TO_USER_HS.equals( fieldName ) ) + { + setToUser_hs( (com.evolute.siprp.server.db.data.siprp.UtilizadoresData) value ); + } + else if( USER_HS.equals( fieldName ) ) + { + setUser_hs( (Integer) value ); + } + else if( USER_DNS.equals( fieldName ) ) + { + setUser_dns( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_USER_DIR_LOJA) != null ) + { + toUser_dir_loja().save(); + dataHash.put(USER_DIR_LOJA, toUser_dir_loja().get( com.evolute.siprp.server.db.data.siprp.UtilizadoresData.ID )); + } + + if( dataHash.get(TO_USER_DNS) != null ) + { + toUser_dns().save(); + dataHash.put(USER_DNS, toUser_dns().get( com.evolute.siprp.server.db.data.siprp.UtilizadoresData.ID )); + } + + if( dataHash.get(TO_USER_HS) != null ) + { + toUser_hs().save(); + dataHash.put(USER_HS, toUser_hs().get( com.evolute.siprp.server.db.data.siprp.UtilizadoresData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return PlanosActuacao.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Properties.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Properties.java new file mode 100644 index 00000000..b326f079 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Properties.java @@ -0,0 +1,44 @@ +/* +* Properties.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class Properties implements JDOInnerObject +{ + + public Properties() + { + } + + public Object getField( String fieldName ) + { + return null; + } + + public void setField( String fieldName, Object value ) + { + } + + public Class getOuterClass() + { + return PropertiesDataAuto.class; + } + + public PropertiesDataAuto getOuterClassInstance() + { + PropertiesDataAuto outerObj = new PropertiesDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Object getJDOPrimaryKey() + { + return null; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PropertiesData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PropertiesData.java new file mode 100644 index 00000000..343f70d0 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PropertiesData.java @@ -0,0 +1,18 @@ +/* +* PropertiesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class PropertiesData extends com.evolute.siprp.server.db.data.siprp.PropertiesDataAuto +{ + + public PropertiesData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PropertiesDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PropertiesDataAuto.java new file mode 100644 index 00000000..c0d1d9b3 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/PropertiesDataAuto.java @@ -0,0 +1,67 @@ +/* +* PropertiesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class PropertiesDataAuto extends JDOObject +{ + + public static final String TABLENAME = "properties"; + + + public static final String FIELD_NAMES[] = new String[]{ + }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + }; + + private Map dataHash; + + public PropertiesDataAuto() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Properties.class; + } + + public Object getJDOPrimaryKey() + { + return null; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Recomendacoes.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Recomendacoes.java new file mode 100644 index 00000000..5c3636d7 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Recomendacoes.java @@ -0,0 +1,129 @@ +/* +* Recomendacoes.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class Recomendacoes implements JDOInnerObject +{ + private Integer id; + private Integer analise_id; + private String recomendacao; + + public Recomendacoes() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == RecomendacoesDataAuto.ID ) + { + return id; + } + else if( fieldName == RecomendacoesDataAuto.ANALISE_ID ) + { + return analise_id; + } + else if( fieldName == RecomendacoesDataAuto.RECOMENDACAO ) + { + return recomendacao; + } + else if( fieldName.equals( RecomendacoesDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( RecomendacoesDataAuto.ANALISE_ID ) ) + { + return analise_id; + } + else if( fieldName.equals( RecomendacoesDataAuto.RECOMENDACAO ) ) + { + return recomendacao; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == RecomendacoesDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == RecomendacoesDataAuto.ANALISE_ID ) + { + analise_id = ( Integer ) value; + } + else if( fieldName == RecomendacoesDataAuto.RECOMENDACAO ) + { + recomendacao = ( String ) value; + } + else if( fieldName.equals( RecomendacoesDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( RecomendacoesDataAuto.ANALISE_ID ) ) + { + analise_id = ( Integer ) value; + } + else if( fieldName.equals( RecomendacoesDataAuto.RECOMENDACAO ) ) + { + recomendacao = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getAnalise_id() + { + return analise_id; + } + + public void setAnalise_id(Integer analise_idValue ) + { + this.analise_id = analise_idValue; + } + + public String getRecomendacao() + { + return recomendacao; + } + + public void setRecomendacao(String recomendacaoValue ) + { + this.recomendacao = recomendacaoValue; + } + + public Class getOuterClass() + { + return RecomendacoesDataAuto.class; + } + + public RecomendacoesDataAuto getOuterClassInstance() + { + RecomendacoesDataAuto outerObj = new RecomendacoesDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/RecomendacoesData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/RecomendacoesData.java new file mode 100644 index 00000000..d76a5106 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/RecomendacoesData.java @@ -0,0 +1,18 @@ +/* +* RecomendacoesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class RecomendacoesData extends com.evolute.siprp.server.db.data.siprp.RecomendacoesDataAuto +{ + + public RecomendacoesData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/RecomendacoesDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/RecomendacoesDataAuto.java new file mode 100644 index 00000000..5fda16ca --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/RecomendacoesDataAuto.java @@ -0,0 +1,166 @@ +/* +* RecomendacoesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class RecomendacoesDataAuto extends JDOObject +{ + + public static final String TABLENAME = "recomendacoes"; + + public static final String ID = "id"; + public static final String ID_FULL = "recomendacoes.id"; + public static final String ANALISE_ID = "analise_id"; + public static final String ANALISE_ID_FULL = "recomendacoes.analise_id"; + public static final String TO_ANALISE_ID = "to analise_id"; + public static final String RECOMENDACAO = "recomendacao"; + public static final String RECOMENDACAO_FULL = "recomendacoes.recomendacao"; + + public static final String FIELD_NAMES[] = new String[]{ + ANALISE_ID, TO_ANALISE_ID, RECOMENDACAO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, ANALISE_ID, RECOMENDACAO, }; + + private Map dataHash; + + public RecomendacoesDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getAnalise_id() + { + return (Integer) dataHash.get(ANALISE_ID); + } + + public void setAnalise_id(Integer analise_idValue ) + { + dataHash.put(TO_ANALISE_ID, null); + dataHash.put(ANALISE_ID, analise_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData toAnalise_id() + throws Exception + { + if( dataHash.get(TO_ANALISE_ID) == null && getAnalise_id() != null ) + { + dataHash.put(TO_ANALISE_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData.class, new Object[]{ getAnalise_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData) dataHash.get(TO_ANALISE_ID); + } + + public void setToAnalise_id(com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData analise_idObject ) + { + if( analise_idObject == null ) + { + dataHash.put(ANALISE_ID, null); + } + else + { + dataHash.put(ANALISE_ID, analise_idObject.get( com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData.ID )); + } + dataHash.put(TO_ANALISE_ID, analise_idObject); + } + + public String getRecomendacao() + { + return (String) get(RECOMENDACAO); + } + + public void setRecomendacao(String recomendacaoValue ) + { + this.set(RECOMENDACAO, recomendacaoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_ANALISE_ID.equals( fieldName ) ) + { + value = toAnalise_id(); + } + else if( ANALISE_ID.equals( fieldName ) ) + { + value = getAnalise_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_ANALISE_ID.equals( fieldName ) ) + { + setToAnalise_id( (com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData) value ); + } + else if( ANALISE_ID.equals( fieldName ) ) + { + setAnalise_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_ANALISE_ID) != null ) + { + toAnalise_id().save(); + dataHash.put(ANALISE_ID, toAnalise_id().get( com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Recomendacoes.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Roles.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Roles.java new file mode 100644 index 00000000..d3247678 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Roles.java @@ -0,0 +1,44 @@ +/* +* Roles.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class Roles implements JDOInnerObject +{ + + public Roles() + { + } + + public Object getField( String fieldName ) + { + return null; + } + + public void setField( String fieldName, Object value ) + { + } + + public Class getOuterClass() + { + return RolesDataAuto.class; + } + + public RolesDataAuto getOuterClassInstance() + { + RolesDataAuto outerObj = new RolesDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Object getJDOPrimaryKey() + { + return null; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/RolesData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/RolesData.java new file mode 100644 index 00000000..91b99f67 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/RolesData.java @@ -0,0 +1,18 @@ +/* +* RolesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class RolesData extends com.evolute.siprp.server.db.data.siprp.RolesDataAuto +{ + + public RolesData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/RolesDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/RolesDataAuto.java new file mode 100644 index 00000000..628ecb46 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/RolesDataAuto.java @@ -0,0 +1,67 @@ +/* +* RolesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class RolesDataAuto extends JDOObject +{ + + public static final String TABLENAME = "roles"; + + + public static final String FIELD_NAMES[] = new String[]{ + }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + }; + + private Map dataHash; + + public RolesDataAuto() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Roles.class; + } + + public Object getJDOPrimaryKey() + { + return null; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Seccoes.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Seccoes.java new file mode 100644 index 00000000..17ef6967 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Seccoes.java @@ -0,0 +1,156 @@ +/* +* Seccoes.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class Seccoes implements JDOInnerObject +{ + private Integer id; + private String descricao; + private Integer departamento_id; + private String activo; + + public Seccoes() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == SeccoesDataAuto.ID ) + { + return id; + } + else if( fieldName == SeccoesDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName == SeccoesDataAuto.DEPARTAMENTO_ID ) + { + return departamento_id; + } + else if( fieldName == SeccoesDataAuto.ACTIVO ) + { + return activo; + } + else if( fieldName.equals( SeccoesDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( SeccoesDataAuto.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( SeccoesDataAuto.DEPARTAMENTO_ID ) ) + { + return departamento_id; + } + else if( fieldName.equals( SeccoesDataAuto.ACTIVO ) ) + { + return activo; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == SeccoesDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == SeccoesDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == SeccoesDataAuto.DEPARTAMENTO_ID ) + { + departamento_id = ( Integer ) value; + } + else if( fieldName == SeccoesDataAuto.ACTIVO ) + { + activo = ( String ) value; + } + else if( fieldName.equals( SeccoesDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( SeccoesDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( SeccoesDataAuto.DEPARTAMENTO_ID ) ) + { + departamento_id = ( Integer ) value; + } + else if( fieldName.equals( SeccoesDataAuto.ACTIVO ) ) + { + activo = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public Integer getDepartamento_id() + { + return departamento_id; + } + + public void setDepartamento_id(Integer departamento_idValue ) + { + this.departamento_id = departamento_idValue; + } + + public String getActivo() + { + return activo; + } + + public void setActivo(String activoValue ) + { + this.activo = activoValue; + } + + public Class getOuterClass() + { + return SeccoesDataAuto.class; + } + + public SeccoesDataAuto getOuterClassInstance() + { + SeccoesDataAuto outerObj = new SeccoesDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/SeccoesData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/SeccoesData.java new file mode 100644 index 00000000..25b3d70a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/SeccoesData.java @@ -0,0 +1,18 @@ +/* +* SeccoesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class SeccoesData extends com.evolute.siprp.server.db.data.siprp.SeccoesDataAuto +{ + + public SeccoesData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/SeccoesDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/SeccoesDataAuto.java new file mode 100644 index 00000000..7851d429 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/SeccoesDataAuto.java @@ -0,0 +1,178 @@ +/* +* SeccoesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class SeccoesDataAuto extends JDOObject +{ + + public static final String TABLENAME = "seccoes"; + + public static final String ID = "id"; + public static final String ID_FULL = "seccoes.id"; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "seccoes.descricao"; + public static final String DEPARTAMENTO_ID = "departamento_id"; + public static final String DEPARTAMENTO_ID_FULL = "seccoes.departamento_id"; + public static final String TO_DEPARTAMENTO_ID = "to departamento_id"; + public static final String ACTIVO = "activo"; + public static final String ACTIVO_FULL = "seccoes.activo"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRICAO, DEPARTAMENTO_ID, TO_DEPARTAMENTO_ID, ACTIVO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DESCRICAO, DEPARTAMENTO_ID, ACTIVO, }; + + private Map dataHash; + + public SeccoesDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + public Integer getDepartamento_id() + { + return (Integer) dataHash.get(DEPARTAMENTO_ID); + } + + public void setDepartamento_id(Integer departamento_idValue ) + { + dataHash.put(TO_DEPARTAMENTO_ID, null); + dataHash.put(DEPARTAMENTO_ID, departamento_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp.DepartamentosData toDepartamento_id() + throws Exception + { + if( dataHash.get(TO_DEPARTAMENTO_ID) == null && getDepartamento_id() != null ) + { + dataHash.put(TO_DEPARTAMENTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp.DepartamentosData.class, new Object[]{ getDepartamento_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp.DepartamentosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp.DepartamentosData) dataHash.get(TO_DEPARTAMENTO_ID); + } + + public void setToDepartamento_id(com.evolute.siprp.server.db.data.siprp.DepartamentosData departamento_idObject ) + { + if( departamento_idObject == null ) + { + dataHash.put(DEPARTAMENTO_ID, null); + } + else + { + dataHash.put(DEPARTAMENTO_ID, departamento_idObject.get( com.evolute.siprp.server.db.data.siprp.DepartamentosData.ID )); + } + dataHash.put(TO_DEPARTAMENTO_ID, departamento_idObject); + } + + public String getActivo() + { + return (String) get(ACTIVO); + } + + public void setActivo(String activoValue ) + { + this.set(ACTIVO, activoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( DEPARTAMENTO_ID.equals( fieldName ) ) + { + value = getDepartamento_id(); + } + else if( TO_DEPARTAMENTO_ID.equals( fieldName ) ) + { + value = toDepartamento_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( DEPARTAMENTO_ID.equals( fieldName ) ) + { + setDepartamento_id( (Integer) value ); + } + else if( TO_DEPARTAMENTO_ID.equals( fieldName ) ) + { + setToDepartamento_id( (com.evolute.siprp.server.db.data.siprp.DepartamentosData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_DEPARTAMENTO_ID) != null ) + { + toDepartamento_id().save(); + dataHash.put(DEPARTAMENTO_ID, toDepartamento_id().get( com.evolute.siprp.server.db.data.siprp.DepartamentosData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Seccoes.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/TiposUtilizadores.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/TiposUtilizadores.java new file mode 100644 index 00000000..d3ea0d91 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/TiposUtilizadores.java @@ -0,0 +1,183 @@ +/* +* TiposUtilizadores.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class TiposUtilizadores implements JDOInnerObject +{ + private Integer id; + private Integer tipo; + private String descricao; + private String activo; + private Integer ordem; + + public TiposUtilizadores() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TiposUtilizadoresDataAuto.ID ) + { + return id; + } + else if( fieldName == TiposUtilizadoresDataAuto.TIPO ) + { + return tipo; + } + else if( fieldName == TiposUtilizadoresDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName == TiposUtilizadoresDataAuto.ACTIVO ) + { + return activo; + } + else if( fieldName == TiposUtilizadoresDataAuto.ORDEM ) + { + return ordem; + } + else if( fieldName.equals( TiposUtilizadoresDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( TiposUtilizadoresDataAuto.TIPO ) ) + { + return tipo; + } + else if( fieldName.equals( TiposUtilizadoresDataAuto.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( TiposUtilizadoresDataAuto.ACTIVO ) ) + { + return activo; + } + else if( fieldName.equals( TiposUtilizadoresDataAuto.ORDEM ) ) + { + return ordem; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TiposUtilizadoresDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TiposUtilizadoresDataAuto.TIPO ) + { + tipo = ( Integer ) value; + } + else if( fieldName == TiposUtilizadoresDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == TiposUtilizadoresDataAuto.ACTIVO ) + { + activo = ( String ) value; + } + else if( fieldName == TiposUtilizadoresDataAuto.ORDEM ) + { + ordem = ( Integer ) value; + } + else if( fieldName.equals( TiposUtilizadoresDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TiposUtilizadoresDataAuto.TIPO ) ) + { + tipo = ( Integer ) value; + } + else if( fieldName.equals( TiposUtilizadoresDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( TiposUtilizadoresDataAuto.ACTIVO ) ) + { + activo = ( String ) value; + } + else if( fieldName.equals( TiposUtilizadoresDataAuto.ORDEM ) ) + { + ordem = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getTipo() + { + return tipo; + } + + public void setTipo(Integer tipoValue ) + { + this.tipo = tipoValue; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public String getActivo() + { + return activo; + } + + public void setActivo(String activoValue ) + { + this.activo = activoValue; + } + + public Integer getOrdem() + { + return ordem; + } + + public void setOrdem(Integer ordemValue ) + { + this.ordem = ordemValue; + } + + public Class getOuterClass() + { + return TiposUtilizadoresDataAuto.class; + } + + public TiposUtilizadoresDataAuto getOuterClassInstance() + { + TiposUtilizadoresDataAuto outerObj = new TiposUtilizadoresDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/TiposUtilizadoresData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/TiposUtilizadoresData.java new file mode 100644 index 00000000..6dbc7c71 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/TiposUtilizadoresData.java @@ -0,0 +1,18 @@ +/* +* TiposUtilizadoresDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class TiposUtilizadoresData extends com.evolute.siprp.server.db.data.siprp.TiposUtilizadoresDataAuto +{ + + public TiposUtilizadoresData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/TiposUtilizadoresDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/TiposUtilizadoresDataAuto.java new file mode 100644 index 00000000..ea29dd56 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/TiposUtilizadoresDataAuto.java @@ -0,0 +1,131 @@ +/* +* TiposUtilizadoresDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class TiposUtilizadoresDataAuto extends JDOObject +{ + + public static final String TABLENAME = "tipos_utilizadores"; + + public static final String ID = "id"; + public static final String ID_FULL = "tipos_utilizadores.id"; + public static final String TIPO = "tipo"; + public static final String TIPO_FULL = "tipos_utilizadores.tipo"; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "tipos_utilizadores.descricao"; + public static final String ACTIVO = "activo"; + public static final String ACTIVO_FULL = "tipos_utilizadores.activo"; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "tipos_utilizadores.ordem"; + + public static final String FIELD_NAMES[] = new String[]{ + TIPO, DESCRICAO, ACTIVO, ORDEM, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TIPO, DESCRICAO, ACTIVO, ORDEM, }; + + private Map dataHash; + + public TiposUtilizadoresDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getTipo() + { + return (Integer) get(TIPO); + } + + public void setTipo(Integer tipoValue ) + { + this.set(TIPO, tipoValue ); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + public String getActivo() + { + return (String) get(ACTIVO); + } + + public void setActivo(String activoValue ) + { + this.set(ACTIVO, activoValue ); + } + + public Integer getOrdem() + { + return (Integer) get(ORDEM); + } + + public void setOrdem(Integer ordemValue ) + { + this.set(ORDEM, ordemValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TiposUtilizadores.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Users.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Users.java new file mode 100644 index 00000000..52b1e5a5 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Users.java @@ -0,0 +1,44 @@ +/* +* Users.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class Users implements JDOInnerObject +{ + + public Users() + { + } + + public Object getField( String fieldName ) + { + return null; + } + + public void setField( String fieldName, Object value ) + { + } + + public Class getOuterClass() + { + return UsersDataAuto.class; + } + + public UsersDataAuto getOuterClassInstance() + { + UsersDataAuto outerObj = new UsersDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Object getJDOPrimaryKey() + { + return null; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/UsersData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/UsersData.java new file mode 100644 index 00000000..d95fd824 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/UsersData.java @@ -0,0 +1,18 @@ +/* +* UsersDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class UsersData extends com.evolute.siprp.server.db.data.siprp.UsersDataAuto +{ + + public UsersData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/UsersDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/UsersDataAuto.java new file mode 100644 index 00000000..bb8e7a32 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/UsersDataAuto.java @@ -0,0 +1,67 @@ +/* +* UsersDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class UsersDataAuto extends JDOObject +{ + + public static final String TABLENAME = "users"; + + + public static final String FIELD_NAMES[] = new String[]{ + }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + }; + + private Map dataHash; + + public UsersDataAuto() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Users.class; + } + + public Object getJDOPrimaryKey() + { + return null; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Utilizadores.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Utilizadores.java new file mode 100644 index 00000000..b253ed11 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/Utilizadores.java @@ -0,0 +1,588 @@ +/* +* Utilizadores.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; + +public final class Utilizadores implements JDOInnerObject +{ + 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 medico_id; + private Integer tipo; + private String numero_cedula; + private String cap; + private String nome; + private Integer funcionario_hst_id; + private String activo; + private String responsavel_loja; + private String numero_mecanografico; + private String gestor_geral; + private String primeiro_login; + private String apagado; + private java.util.Date data_password; + + public Utilizadores() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == UtilizadoresDataAuto.ID ) + { + return id; + } + else if( fieldName == UtilizadoresDataAuto.LOGIN ) + { + return login; + } + else if( fieldName == UtilizadoresDataAuto.PASSWORD ) + { + return password; + } + else if( fieldName == UtilizadoresDataAuto.EMAIL ) + { + return email; + } + else if( fieldName == UtilizadoresDataAuto.EMPRESA_ID ) + { + return empresa_id; + } + else if( fieldName == UtilizadoresDataAuto.ESTABELECIMENTO_ID ) + { + return estabelecimento_id; + } + else if( fieldName == UtilizadoresDataAuto.ADMINISTRADOR ) + { + return administrador; + } + else if( fieldName == UtilizadoresDataAuto.MEDICO_ID ) + { + return medico_id; + } + else if( fieldName == UtilizadoresDataAuto.TIPO ) + { + return tipo; + } + else if( fieldName == UtilizadoresDataAuto.NUMERO_CEDULA ) + { + return numero_cedula; + } + else if( fieldName == UtilizadoresDataAuto.CAP ) + { + return cap; + } + else if( fieldName == UtilizadoresDataAuto.NOME ) + { + return nome; + } + else if( fieldName == UtilizadoresDataAuto.FUNCIONARIO_HST_ID ) + { + return funcionario_hst_id; + } + else if( fieldName == UtilizadoresDataAuto.ACTIVO ) + { + return activo; + } + else if( fieldName == UtilizadoresDataAuto.RESPONSAVEL_LOJA ) + { + return responsavel_loja; + } + else if( fieldName == UtilizadoresDataAuto.NUMERO_MECANOGRAFICO ) + { + return numero_mecanografico; + } + else if( fieldName == UtilizadoresDataAuto.GESTOR_GERAL ) + { + return gestor_geral; + } + else if( fieldName == UtilizadoresDataAuto.PRIMEIRO_LOGIN ) + { + return primeiro_login; + } + else if( fieldName == UtilizadoresDataAuto.APAGADO ) + { + return apagado; + } + else if( fieldName == UtilizadoresDataAuto.DATA_PASSWORD ) + { + return data_password; + } + else if( fieldName.equals( UtilizadoresDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( UtilizadoresDataAuto.LOGIN ) ) + { + return login; + } + else if( fieldName.equals( UtilizadoresDataAuto.PASSWORD ) ) + { + return password; + } + else if( fieldName.equals( UtilizadoresDataAuto.EMAIL ) ) + { + return email; + } + else if( fieldName.equals( UtilizadoresDataAuto.EMPRESA_ID ) ) + { + return empresa_id; + } + else if( fieldName.equals( UtilizadoresDataAuto.ESTABELECIMENTO_ID ) ) + { + return estabelecimento_id; + } + else if( fieldName.equals( UtilizadoresDataAuto.ADMINISTRADOR ) ) + { + return administrador; + } + else if( fieldName.equals( UtilizadoresDataAuto.MEDICO_ID ) ) + { + return medico_id; + } + else if( fieldName.equals( UtilizadoresDataAuto.TIPO ) ) + { + return tipo; + } + else if( fieldName.equals( UtilizadoresDataAuto.NUMERO_CEDULA ) ) + { + return numero_cedula; + } + else if( fieldName.equals( UtilizadoresDataAuto.CAP ) ) + { + return cap; + } + else if( fieldName.equals( UtilizadoresDataAuto.NOME ) ) + { + return nome; + } + else if( fieldName.equals( UtilizadoresDataAuto.FUNCIONARIO_HST_ID ) ) + { + return funcionario_hst_id; + } + else if( fieldName.equals( UtilizadoresDataAuto.ACTIVO ) ) + { + return activo; + } + else if( fieldName.equals( UtilizadoresDataAuto.RESPONSAVEL_LOJA ) ) + { + return responsavel_loja; + } + else if( fieldName.equals( UtilizadoresDataAuto.NUMERO_MECANOGRAFICO ) ) + { + return numero_mecanografico; + } + else if( fieldName.equals( UtilizadoresDataAuto.GESTOR_GERAL ) ) + { + return gestor_geral; + } + else if( fieldName.equals( UtilizadoresDataAuto.PRIMEIRO_LOGIN ) ) + { + return primeiro_login; + } + else if( fieldName.equals( UtilizadoresDataAuto.APAGADO ) ) + { + return apagado; + } + else if( fieldName.equals( UtilizadoresDataAuto.DATA_PASSWORD ) ) + { + return data_password; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == UtilizadoresDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == UtilizadoresDataAuto.LOGIN ) + { + login = ( String ) value; + } + else if( fieldName == UtilizadoresDataAuto.PASSWORD ) + { + password = ( String ) value; + } + else if( fieldName == UtilizadoresDataAuto.EMAIL ) + { + email = ( String ) value; + } + else if( fieldName == UtilizadoresDataAuto.EMPRESA_ID ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName == UtilizadoresDataAuto.ESTABELECIMENTO_ID ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName == UtilizadoresDataAuto.ADMINISTRADOR ) + { + administrador = ( String ) value; + } + else if( fieldName == UtilizadoresDataAuto.MEDICO_ID ) + { + medico_id = ( Integer ) value; + } + else if( fieldName == UtilizadoresDataAuto.TIPO ) + { + tipo = ( Integer ) value; + } + else if( fieldName == UtilizadoresDataAuto.NUMERO_CEDULA ) + { + numero_cedula = ( String ) value; + } + else if( fieldName == UtilizadoresDataAuto.CAP ) + { + cap = ( String ) value; + } + else if( fieldName == UtilizadoresDataAuto.NOME ) + { + nome = ( String ) value; + } + else if( fieldName == UtilizadoresDataAuto.FUNCIONARIO_HST_ID ) + { + funcionario_hst_id = ( Integer ) value; + } + else if( fieldName == UtilizadoresDataAuto.ACTIVO ) + { + activo = ( String ) value; + } + else if( fieldName == UtilizadoresDataAuto.RESPONSAVEL_LOJA ) + { + responsavel_loja = ( String ) value; + } + else if( fieldName == UtilizadoresDataAuto.NUMERO_MECANOGRAFICO ) + { + numero_mecanografico = ( String ) value; + } + else if( fieldName == UtilizadoresDataAuto.GESTOR_GERAL ) + { + gestor_geral = ( String ) value; + } + else if( fieldName == UtilizadoresDataAuto.PRIMEIRO_LOGIN ) + { + primeiro_login = ( String ) value; + } + else if( fieldName == UtilizadoresDataAuto.APAGADO ) + { + apagado = ( String ) value; + } + else if( fieldName == UtilizadoresDataAuto.DATA_PASSWORD ) + { + data_password = ( java.util.Date ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.LOGIN ) ) + { + login = ( String ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.PASSWORD ) ) + { + password = ( String ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.EMAIL ) ) + { + email = ( String ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.EMPRESA_ID ) ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.ESTABELECIMENTO_ID ) ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.ADMINISTRADOR ) ) + { + administrador = ( String ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.MEDICO_ID ) ) + { + medico_id = ( Integer ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.TIPO ) ) + { + tipo = ( Integer ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.NUMERO_CEDULA ) ) + { + numero_cedula = ( String ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.CAP ) ) + { + cap = ( String ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.NOME ) ) + { + nome = ( String ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.FUNCIONARIO_HST_ID ) ) + { + funcionario_hst_id = ( Integer ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.ACTIVO ) ) + { + activo = ( String ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.RESPONSAVEL_LOJA ) ) + { + responsavel_loja = ( String ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.NUMERO_MECANOGRAFICO ) ) + { + numero_mecanografico = ( String ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.GESTOR_GERAL ) ) + { + gestor_geral = ( String ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.PRIMEIRO_LOGIN ) ) + { + primeiro_login = ( String ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.APAGADO ) ) + { + apagado = ( String ) value; + } + else if( fieldName.equals( UtilizadoresDataAuto.DATA_PASSWORD ) ) + { + data_password = ( java.util.Date ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getLogin() + { + return login; + } + + public void setLogin(String loginValue ) + { + this.login = loginValue; + } + + public String getPassword() + { + return password; + } + + public void setPassword(String passwordValue ) + { + this.password = passwordValue; + } + + public String getEmail() + { + return email; + } + + public void setEmail(String emailValue ) + { + this.email = emailValue; + } + + public Integer getEmpresa_id() + { + return empresa_id; + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + this.empresa_id = empresa_idValue; + } + + public Integer getEstabelecimento_id() + { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + this.estabelecimento_id = estabelecimento_idValue; + } + + public String getAdministrador() + { + return administrador; + } + + public void setAdministrador(String administradorValue ) + { + this.administrador = administradorValue; + } + + public Integer getMedico_id() + { + return medico_id; + } + + public void setMedico_id(Integer medico_idValue ) + { + this.medico_id = medico_idValue; + } + + public Integer getTipo() + { + return tipo; + } + + public void setTipo(Integer tipoValue ) + { + this.tipo = tipoValue; + } + + public String getNumero_cedula() + { + return numero_cedula; + } + + public void setNumero_cedula(String numero_cedulaValue ) + { + this.numero_cedula = numero_cedulaValue; + } + + public String getCap() + { + return cap; + } + + public void setCap(String capValue ) + { + this.cap = capValue; + } + + public String getNome() + { + return nome; + } + + public void setNome(String nomeValue ) + { + this.nome = nomeValue; + } + + public Integer getFuncionario_hst_id() + { + return funcionario_hst_id; + } + + public void setFuncionario_hst_id(Integer funcionario_hst_idValue ) + { + this.funcionario_hst_id = funcionario_hst_idValue; + } + + public String getActivo() + { + return activo; + } + + public void setActivo(String activoValue ) + { + this.activo = activoValue; + } + + public String getResponsavel_loja() + { + return responsavel_loja; + } + + public void setResponsavel_loja(String responsavel_lojaValue ) + { + this.responsavel_loja = responsavel_lojaValue; + } + + public String getNumero_mecanografico() + { + return numero_mecanografico; + } + + public void setNumero_mecanografico(String numero_mecanograficoValue ) + { + this.numero_mecanografico = numero_mecanograficoValue; + } + + public String getGestor_geral() + { + return gestor_geral; + } + + public void setGestor_geral(String gestor_geralValue ) + { + this.gestor_geral = gestor_geralValue; + } + + public String getPrimeiro_login() + { + return primeiro_login; + } + + public void setPrimeiro_login(String primeiro_loginValue ) + { + this.primeiro_login = primeiro_loginValue; + } + + public String getApagado() + { + return apagado; + } + + public void setApagado(String apagadoValue ) + { + this.apagado = apagadoValue; + } + + public java.util.Date getData_password() + { + return data_password; + } + + public void setData_password(java.util.Date data_passwordValue ) + { + this.data_password = data_passwordValue; + } + + public Class getOuterClass() + { + return UtilizadoresDataAuto.class; + } + + public UtilizadoresDataAuto getOuterClassInstance() + { + UtilizadoresDataAuto outerObj = new UtilizadoresDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/UtilizadoresData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/UtilizadoresData.java new file mode 100644 index 00000000..4057941e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/UtilizadoresData.java @@ -0,0 +1,18 @@ +/* +* UtilizadoresDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp; + + +public final class UtilizadoresData extends com.evolute.siprp.server.db.data.siprp.UtilizadoresDataAuto +{ + + public UtilizadoresData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/UtilizadoresDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/UtilizadoresDataAuto.java new file mode 100644 index 00000000..5700401c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/UtilizadoresDataAuto.java @@ -0,0 +1,315 @@ +/* +* UtilizadoresDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class UtilizadoresDataAuto extends JDOObject +{ + + public static final String TABLENAME = "utilizadores"; + + public static final String ID = "id"; + public static final String ID_FULL = "utilizadores.id"; + public static final String LOGIN = "login"; + public static final String LOGIN_FULL = "utilizadores.login"; + public static final String PASSWORD = "password"; + public static final String PASSWORD_FULL = "utilizadores.password"; + public static final String EMAIL = "email"; + public static final String EMAIL_FULL = "utilizadores.email"; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "utilizadores.empresa_id"; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "utilizadores.estabelecimento_id"; + public static final String ADMINISTRADOR = "administrador"; + public static final String ADMINISTRADOR_FULL = "utilizadores.administrador"; + public static final String MEDICO_ID = "medico_id"; + public static final String MEDICO_ID_FULL = "utilizadores.medico_id"; + public static final String TIPO = "tipo"; + public static final String TIPO_FULL = "utilizadores.tipo"; + public static final String NUMERO_CEDULA = "numero_cedula"; + public static final String NUMERO_CEDULA_FULL = "utilizadores.numero_cedula"; + public static final String CAP = "cap"; + public static final String CAP_FULL = "utilizadores.cap"; + public static final String NOME = "nome"; + public static final String NOME_FULL = "utilizadores.nome"; + public static final String FUNCIONARIO_HST_ID = "funcionario_hst_id"; + public static final String FUNCIONARIO_HST_ID_FULL = "utilizadores.funcionario_hst_id"; + public static final String ACTIVO = "activo"; + public static final String ACTIVO_FULL = "utilizadores.activo"; + public static final String RESPONSAVEL_LOJA = "responsavel_loja"; + public static final String RESPONSAVEL_LOJA_FULL = "utilizadores.responsavel_loja"; + public static final String NUMERO_MECANOGRAFICO = "numero_mecanografico"; + public static final String NUMERO_MECANOGRAFICO_FULL = "utilizadores.numero_mecanografico"; + public static final String GESTOR_GERAL = "gestor_geral"; + public static final String GESTOR_GERAL_FULL = "utilizadores.gestor_geral"; + public static final String PRIMEIRO_LOGIN = "primeiro_login"; + public static final String PRIMEIRO_LOGIN_FULL = "utilizadores.primeiro_login"; + public static final String APAGADO = "apagado"; + public static final String APAGADO_FULL = "utilizadores.apagado"; + public static final String DATA_PASSWORD = "data_password"; + public static final String DATA_PASSWORD_FULL = "utilizadores.data_password"; + + public static final String FIELD_NAMES[] = new String[]{ + LOGIN, PASSWORD, EMAIL, EMPRESA_ID, ESTABELECIMENTO_ID, ADMINISTRADOR, MEDICO_ID, + TIPO, NUMERO_CEDULA, CAP, NOME, FUNCIONARIO_HST_ID, ACTIVO, RESPONSAVEL_LOJA, + NUMERO_MECANOGRAFICO, GESTOR_GERAL, PRIMEIRO_LOGIN, APAGADO, DATA_PASSWORD, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, LOGIN, PASSWORD, EMAIL, EMPRESA_ID, ESTABELECIMENTO_ID, ADMINISTRADOR, MEDICO_ID, + TIPO, NUMERO_CEDULA, CAP, NOME, FUNCIONARIO_HST_ID, ACTIVO, RESPONSAVEL_LOJA, + NUMERO_MECANOGRAFICO, GESTOR_GERAL, PRIMEIRO_LOGIN, APAGADO, DATA_PASSWORD, }; + + private Map dataHash; + + public UtilizadoresDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getLogin() + { + return (String) get(LOGIN); + } + + public void setLogin(String loginValue ) + { + this.set(LOGIN, loginValue ); + } + + public String getPassword() + { + return (String) get(PASSWORD); + } + + public void setPassword(String passwordValue ) + { + this.set(PASSWORD, passwordValue ); + } + + public String getEmail() + { + return (String) get(EMAIL); + } + + public void setEmail(String emailValue ) + { + this.set(EMAIL, emailValue ); + } + + public Integer getEmpresa_id() + { + return (Integer) get(EMPRESA_ID); + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + this.set(EMPRESA_ID, empresa_idValue ); + } + + public Integer getEstabelecimento_id() + { + return (Integer) get(ESTABELECIMENTO_ID); + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + this.set(ESTABELECIMENTO_ID, estabelecimento_idValue ); + } + + public String getAdministrador() + { + return (String) get(ADMINISTRADOR); + } + + public void setAdministrador(String administradorValue ) + { + this.set(ADMINISTRADOR, administradorValue ); + } + + public Integer getMedico_id() + { + return (Integer) get(MEDICO_ID); + } + + public void setMedico_id(Integer medico_idValue ) + { + this.set(MEDICO_ID, medico_idValue ); + } + + public Integer getTipo() + { + return (Integer) get(TIPO); + } + + public void setTipo(Integer tipoValue ) + { + this.set(TIPO, tipoValue ); + } + + public String getNumero_cedula() + { + return (String) get(NUMERO_CEDULA); + } + + public void setNumero_cedula(String numero_cedulaValue ) + { + this.set(NUMERO_CEDULA, numero_cedulaValue ); + } + + public String getCap() + { + return (String) get(CAP); + } + + public void setCap(String capValue ) + { + this.set(CAP, capValue ); + } + + public String getNome() + { + return (String) get(NOME); + } + + public void setNome(String nomeValue ) + { + this.set(NOME, nomeValue ); + } + + public Integer getFuncionario_hst_id() + { + return (Integer) get(FUNCIONARIO_HST_ID); + } + + public void setFuncionario_hst_id(Integer funcionario_hst_idValue ) + { + this.set(FUNCIONARIO_HST_ID, funcionario_hst_idValue ); + } + + public String getActivo() + { + return (String) get(ACTIVO); + } + + public void setActivo(String activoValue ) + { + this.set(ACTIVO, activoValue ); + } + + public String getResponsavel_loja() + { + return (String) get(RESPONSAVEL_LOJA); + } + + public void setResponsavel_loja(String responsavel_lojaValue ) + { + this.set(RESPONSAVEL_LOJA, responsavel_lojaValue ); + } + + public String getNumero_mecanografico() + { + return (String) get(NUMERO_MECANOGRAFICO); + } + + public void setNumero_mecanografico(String numero_mecanograficoValue ) + { + this.set(NUMERO_MECANOGRAFICO, numero_mecanograficoValue ); + } + + public String getGestor_geral() + { + return (String) get(GESTOR_GERAL); + } + + public void setGestor_geral(String gestor_geralValue ) + { + this.set(GESTOR_GERAL, gestor_geralValue ); + } + + public String getPrimeiro_login() + { + return (String) get(PRIMEIRO_LOGIN); + } + + public void setPrimeiro_login(String primeiro_loginValue ) + { + this.set(PRIMEIRO_LOGIN, primeiro_loginValue ); + } + + public String getApagado() + { + return (String) get(APAGADO); + } + + public void setApagado(String apagadoValue ) + { + this.set(APAGADO, apagadoValue ); + } + + public java.util.Date getData_password() + { + return (java.util.Date) get(DATA_PASSWORD); + } + + public void setData_password(java.util.Date data_passwordValue ) + { + this.set(DATA_PASSWORD, data_passwordValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Utilizadores.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/package.jdo b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/package.jdo new file mode 100644 index 00000000..b3e7a108 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp/package.jdo @@ -0,0 +1,1001 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Actualizacao.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Actualizacao.java new file mode 100644 index 00000000..c2cf9d4c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Actualizacao.java @@ -0,0 +1,102 @@ +/* +* Actualizacao.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class Actualizacao implements JDOInnerObject +{ + private java.sql.Timestamp hora; + private Integer id; + + public Actualizacao() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == ActualizacaoDataAuto.HORA ) + { + return hora; + } + else if( fieldName == ActualizacaoDataAuto.ID ) + { + return id; + } + else if( fieldName.equals( ActualizacaoDataAuto.HORA ) ) + { + return hora; + } + else if( fieldName.equals( ActualizacaoDataAuto.ID ) ) + { + return id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == ActualizacaoDataAuto.HORA ) + { + hora = ( java.sql.Timestamp ) value; + } + else if( fieldName == ActualizacaoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( ActualizacaoDataAuto.HORA ) ) + { + hora = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( ActualizacaoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + } + + public java.sql.Timestamp getHora() + { + return hora; + } + + public void setHora(java.sql.Timestamp horaValue ) + { + this.hora = horaValue; + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Class getOuterClass() + { + return ActualizacaoDataAuto.class; + } + + public ActualizacaoDataAuto getOuterClassInstance() + { + ActualizacaoDataAuto outerObj = new ActualizacaoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ActualizacaoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ActualizacaoData.java new file mode 100644 index 00000000..b4609619 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ActualizacaoData.java @@ -0,0 +1,18 @@ +/* +* ActualizacaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class ActualizacaoData extends com.evolute.siprp.server.db.data.siprp_local3.ActualizacaoDataAuto +{ + + public ActualizacaoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ActualizacaoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ActualizacaoDataAuto.java new file mode 100644 index 00000000..476395c7 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ActualizacaoDataAuto.java @@ -0,0 +1,95 @@ +/* +* ActualizacaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class ActualizacaoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "actualizacao"; + + public static final String HORA = "hora"; + public static final String HORA_FULL = "actualizacao.hora"; + public static final String ID = "id"; + public static final String ID_FULL = "actualizacao.id"; + + public static final String FIELD_NAMES[] = new String[]{ + HORA, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + HORA, ID, }; + + private Map dataHash; + + public ActualizacaoDataAuto() + { + dataHash = new HashMap(); + } + + public java.sql.Timestamp getHora() + { + return (java.sql.Timestamp) get(HORA); + } + + public void setHora(java.sql.Timestamp horaValue ) + { + this.set(HORA, horaValue ); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Actualizacao.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Avisos.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Avisos.java new file mode 100644 index 00000000..70a6c4af --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Avisos.java @@ -0,0 +1,291 @@ +/* +* Avisos.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class Avisos implements JDOInnerObject +{ + private Integer id; + private Integer tipo; + private Integer empresa_id; + private Integer estabelecimento_id; + private Integer trabalhador_id; + private Integer evento_id; + private java.util.Date data_aviso; + private java.util.Date data_evento; + private String descricao; + + public Avisos() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == AvisosDataAuto.ID ) + { + return id; + } + else if( fieldName == AvisosDataAuto.TIPO ) + { + return tipo; + } + else if( fieldName == AvisosDataAuto.EMPRESA_ID ) + { + return empresa_id; + } + else if( fieldName == AvisosDataAuto.ESTABELECIMENTO_ID ) + { + return estabelecimento_id; + } + else if( fieldName == AvisosDataAuto.TRABALHADOR_ID ) + { + return trabalhador_id; + } + else if( fieldName == AvisosDataAuto.EVENTO_ID ) + { + return evento_id; + } + else if( fieldName == AvisosDataAuto.DATA_AVISO ) + { + return data_aviso; + } + else if( fieldName == AvisosDataAuto.DATA_EVENTO ) + { + return data_evento; + } + else if( fieldName == AvisosDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName.equals( AvisosDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( AvisosDataAuto.TIPO ) ) + { + return tipo; + } + else if( fieldName.equals( AvisosDataAuto.EMPRESA_ID ) ) + { + return empresa_id; + } + else if( fieldName.equals( AvisosDataAuto.ESTABELECIMENTO_ID ) ) + { + return estabelecimento_id; + } + else if( fieldName.equals( AvisosDataAuto.TRABALHADOR_ID ) ) + { + return trabalhador_id; + } + else if( fieldName.equals( AvisosDataAuto.EVENTO_ID ) ) + { + return evento_id; + } + else if( fieldName.equals( AvisosDataAuto.DATA_AVISO ) ) + { + return data_aviso; + } + else if( fieldName.equals( AvisosDataAuto.DATA_EVENTO ) ) + { + return data_evento; + } + else if( fieldName.equals( AvisosDataAuto.DESCRICAO ) ) + { + return descricao; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == AvisosDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == AvisosDataAuto.TIPO ) + { + tipo = ( Integer ) value; + } + else if( fieldName == AvisosDataAuto.EMPRESA_ID ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName == AvisosDataAuto.ESTABELECIMENTO_ID ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName == AvisosDataAuto.TRABALHADOR_ID ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName == AvisosDataAuto.EVENTO_ID ) + { + evento_id = ( Integer ) value; + } + else if( fieldName == AvisosDataAuto.DATA_AVISO ) + { + data_aviso = ( java.util.Date ) value; + } + else if( fieldName == AvisosDataAuto.DATA_EVENTO ) + { + data_evento = ( java.util.Date ) value; + } + else if( fieldName == AvisosDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( AvisosDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( AvisosDataAuto.TIPO ) ) + { + tipo = ( Integer ) value; + } + else if( fieldName.equals( AvisosDataAuto.EMPRESA_ID ) ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName.equals( AvisosDataAuto.ESTABELECIMENTO_ID ) ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName.equals( AvisosDataAuto.TRABALHADOR_ID ) ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName.equals( AvisosDataAuto.EVENTO_ID ) ) + { + evento_id = ( Integer ) value; + } + else if( fieldName.equals( AvisosDataAuto.DATA_AVISO ) ) + { + data_aviso = ( java.util.Date ) value; + } + else if( fieldName.equals( AvisosDataAuto.DATA_EVENTO ) ) + { + data_evento = ( java.util.Date ) value; + } + else if( fieldName.equals( AvisosDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getTipo() + { + return tipo; + } + + public void setTipo(Integer tipoValue ) + { + this.tipo = tipoValue; + } + + public Integer getEmpresa_id() + { + return empresa_id; + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + this.empresa_id = empresa_idValue; + } + + public Integer getEstabelecimento_id() + { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + this.estabelecimento_id = estabelecimento_idValue; + } + + public Integer getTrabalhador_id() + { + return trabalhador_id; + } + + public void setTrabalhador_id(Integer trabalhador_idValue ) + { + this.trabalhador_id = trabalhador_idValue; + } + + public Integer getEvento_id() + { + return evento_id; + } + + public void setEvento_id(Integer evento_idValue ) + { + this.evento_id = evento_idValue; + } + + public java.util.Date getData_aviso() + { + return data_aviso; + } + + public void setData_aviso(java.util.Date data_avisoValue ) + { + this.data_aviso = data_avisoValue; + } + + public java.util.Date getData_evento() + { + return data_evento; + } + + public void setData_evento(java.util.Date data_eventoValue ) + { + this.data_evento = data_eventoValue; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public Class getOuterClass() + { + return AvisosDataAuto.class; + } + + public AvisosDataAuto getOuterClassInstance() + { + AvisosDataAuto outerObj = new AvisosDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/AvisosData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/AvisosData.java new file mode 100644 index 00000000..b860d562 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/AvisosData.java @@ -0,0 +1,18 @@ +/* +* AvisosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class AvisosData extends com.evolute.siprp.server.db.data.siprp_local3.AvisosDataAuto +{ + + public AvisosData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/AvisosDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/AvisosDataAuto.java new file mode 100644 index 00000000..bddf66ac --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/AvisosDataAuto.java @@ -0,0 +1,287 @@ +/* +* AvisosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class AvisosDataAuto extends JDOObject +{ + + public static final String TABLENAME = "avisos"; + + public static final String ID = "id"; + public static final String ID_FULL = "avisos.id"; + public static final String TIPO = "tipo"; + public static final String TIPO_FULL = "avisos.tipo"; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "avisos.empresa_id"; + public static final String TO_EMPRESA_ID = "to empresa_id"; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "avisos.estabelecimento_id"; + public static final String TO_ESTABELECIMENTO_ID = "to estabelecimento_id"; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String TRABALHADOR_ID_FULL = "avisos.trabalhador_id"; + public static final String EVENTO_ID = "evento_id"; + public static final String EVENTO_ID_FULL = "avisos.evento_id"; + public static final String DATA_AVISO = "data_aviso"; + public static final String DATA_AVISO_FULL = "avisos.data_aviso"; + public static final String DATA_EVENTO = "data_evento"; + public static final String DATA_EVENTO_FULL = "avisos.data_evento"; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "avisos.descricao"; + + public static final String FIELD_NAMES[] = new String[]{ + TIPO, EMPRESA_ID, TO_EMPRESA_ID, ESTABELECIMENTO_ID, TO_ESTABELECIMENTO_ID, + TRABALHADOR_ID, EVENTO_ID, DATA_AVISO, DATA_EVENTO, DESCRICAO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TIPO, EMPRESA_ID, ESTABELECIMENTO_ID, TRABALHADOR_ID, EVENTO_ID, DATA_AVISO, + DATA_EVENTO, DESCRICAO, }; + + private Map dataHash; + + public AvisosDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getTipo() + { + return (Integer) get(TIPO); + } + + public void setTipo(Integer tipoValue ) + { + this.set(TIPO, tipoValue ); + } + + public Integer getEmpresa_id() + { + return (Integer) dataHash.get(EMPRESA_ID); + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + dataHash.put(TO_EMPRESA_ID, null); + dataHash.put(EMPRESA_ID, empresa_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EmpresasData toEmpresa_id() + throws Exception + { + if( dataHash.get(TO_EMPRESA_ID) == null && getEmpresa_id() != null ) + { + dataHash.put(TO_EMPRESA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.class, new Object[]{ getEmpresa_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) dataHash.get(TO_EMPRESA_ID); + } + + public void setToEmpresa_id(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData empresa_idObject ) + { + if( empresa_idObject == null ) + { + dataHash.put(EMPRESA_ID, null); + } + else + { + dataHash.put(EMPRESA_ID, empresa_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + dataHash.put(TO_EMPRESA_ID, empresa_idObject); + } + + public Integer getEstabelecimento_id() + { + return (Integer) dataHash.get(ESTABELECIMENTO_ID); + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, null); + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData toEstabelecimento_id() + throws Exception + { + if( dataHash.get(TO_ESTABELECIMENTO_ID) == null && getEstabelecimento_id() != null ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.class, new Object[]{ getEstabelecimento_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) dataHash.get(TO_ESTABELECIMENTO_ID); + } + + public void setToEstabelecimento_id(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData estabelecimento_idObject ) + { + if( estabelecimento_idObject == null ) + { + dataHash.put(ESTABELECIMENTO_ID, null); + } + else + { + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + dataHash.put(TO_ESTABELECIMENTO_ID, estabelecimento_idObject); + } + + public Integer getTrabalhador_id() + { + return (Integer) get(TRABALHADOR_ID); + } + + public void setTrabalhador_id(Integer trabalhador_idValue ) + { + this.set(TRABALHADOR_ID, trabalhador_idValue ); + } + + public Integer getEvento_id() + { + return (Integer) get(EVENTO_ID); + } + + public void setEvento_id(Integer evento_idValue ) + { + this.set(EVENTO_ID, evento_idValue ); + } + + public java.util.Date getData_aviso() + { + return (java.util.Date) get(DATA_AVISO); + } + + public void setData_aviso(java.util.Date data_avisoValue ) + { + this.set(DATA_AVISO, data_avisoValue ); + } + + public java.util.Date getData_evento() + { + return (java.util.Date) get(DATA_EVENTO); + } + + public void setData_evento(java.util.Date data_eventoValue ) + { + this.set(DATA_EVENTO, data_eventoValue ); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = getEstabelecimento_id(); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = toEstabelecimento_id(); + } + else if( TO_EMPRESA_ID.equals( fieldName ) ) + { + value = toEmpresa_id(); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + value = getEmpresa_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setEstabelecimento_id( (Integer) value ); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setToEstabelecimento_id( (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) value ); + } + else if( TO_EMPRESA_ID.equals( fieldName ) ) + { + setToEmpresa_id( (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) value ); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + setEmpresa_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_EMPRESA_ID) != null ) + { + toEmpresa_id().save(); + dataHash.put(EMPRESA_ID, toEmpresa_id().get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + + if( dataHash.get(TO_ESTABELECIMENTO_ID) != null ) + { + toEstabelecimento_id().save(); + dataHash.put(ESTABELECIMENTO_ID, toEstabelecimento_id().get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Avisos.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Contactos.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Contactos.java new file mode 100644 index 00000000..1b5191ba --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Contactos.java @@ -0,0 +1,237 @@ +/* +* Contactos.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class Contactos implements JDOInnerObject +{ + private Integer id; + private String nome; + private String telefone; + private String telemovel; + private String fax; + private String email; + private String cargo; + + public Contactos() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == ContactosDataAuto.ID ) + { + return id; + } + else if( fieldName == ContactosDataAuto.NOME ) + { + return nome; + } + else if( fieldName == ContactosDataAuto.TELEFONE ) + { + return telefone; + } + else if( fieldName == ContactosDataAuto.TELEMOVEL ) + { + return telemovel; + } + else if( fieldName == ContactosDataAuto.FAX ) + { + return fax; + } + else if( fieldName == ContactosDataAuto.EMAIL ) + { + return email; + } + else if( fieldName == ContactosDataAuto.CARGO ) + { + return cargo; + } + else if( fieldName.equals( ContactosDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( ContactosDataAuto.NOME ) ) + { + return nome; + } + else if( fieldName.equals( ContactosDataAuto.TELEFONE ) ) + { + return telefone; + } + else if( fieldName.equals( ContactosDataAuto.TELEMOVEL ) ) + { + return telemovel; + } + else if( fieldName.equals( ContactosDataAuto.FAX ) ) + { + return fax; + } + else if( fieldName.equals( ContactosDataAuto.EMAIL ) ) + { + return email; + } + else if( fieldName.equals( ContactosDataAuto.CARGO ) ) + { + return cargo; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == ContactosDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == ContactosDataAuto.NOME ) + { + nome = ( String ) value; + } + else if( fieldName == ContactosDataAuto.TELEFONE ) + { + telefone = ( String ) value; + } + else if( fieldName == ContactosDataAuto.TELEMOVEL ) + { + telemovel = ( String ) value; + } + else if( fieldName == ContactosDataAuto.FAX ) + { + fax = ( String ) value; + } + else if( fieldName == ContactosDataAuto.EMAIL ) + { + email = ( String ) value; + } + else if( fieldName == ContactosDataAuto.CARGO ) + { + cargo = ( String ) value; + } + else if( fieldName.equals( ContactosDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( ContactosDataAuto.NOME ) ) + { + nome = ( String ) value; + } + else if( fieldName.equals( ContactosDataAuto.TELEFONE ) ) + { + telefone = ( String ) value; + } + else if( fieldName.equals( ContactosDataAuto.TELEMOVEL ) ) + { + telemovel = ( String ) value; + } + else if( fieldName.equals( ContactosDataAuto.FAX ) ) + { + fax = ( String ) value; + } + else if( fieldName.equals( ContactosDataAuto.EMAIL ) ) + { + email = ( String ) value; + } + else if( fieldName.equals( ContactosDataAuto.CARGO ) ) + { + cargo = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getNome() + { + return nome; + } + + public void setNome(String nomeValue ) + { + this.nome = nomeValue; + } + + public String getTelefone() + { + return telefone; + } + + public void setTelefone(String telefoneValue ) + { + this.telefone = telefoneValue; + } + + public String getTelemovel() + { + return telemovel; + } + + public void setTelemovel(String telemovelValue ) + { + this.telemovel = telemovelValue; + } + + public String getFax() + { + return fax; + } + + public void setFax(String faxValue ) + { + this.fax = faxValue; + } + + public String getEmail() + { + return email; + } + + public void setEmail(String emailValue ) + { + this.email = emailValue; + } + + public String getCargo() + { + return cargo; + } + + public void setCargo(String cargoValue ) + { + this.cargo = cargoValue; + } + + public Class getOuterClass() + { + return ContactosDataAuto.class; + } + + public ContactosDataAuto getOuterClassInstance() + { + ContactosDataAuto outerObj = new ContactosDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ContactosData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ContactosData.java new file mode 100644 index 00000000..85378c6a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ContactosData.java @@ -0,0 +1,18 @@ +/* +* ContactosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class ContactosData extends com.evolute.siprp.server.db.data.siprp_local3.ContactosDataAuto +{ + + public ContactosData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ContactosDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ContactosDataAuto.java new file mode 100644 index 00000000..c452497f --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ContactosDataAuto.java @@ -0,0 +1,155 @@ +/* +* ContactosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class ContactosDataAuto extends JDOObject +{ + + public static final String TABLENAME = "contactos"; + + public static final String ID = "id"; + public static final String ID_FULL = "contactos.id"; + public static final String NOME = "nome"; + public static final String NOME_FULL = "contactos.nome"; + public static final String TELEFONE = "telefone"; + public static final String TELEFONE_FULL = "contactos.telefone"; + public static final String TELEMOVEL = "telemovel"; + public static final String TELEMOVEL_FULL = "contactos.telemovel"; + public static final String FAX = "fax"; + public static final String FAX_FULL = "contactos.fax"; + public static final String EMAIL = "email"; + public static final String EMAIL_FULL = "contactos.email"; + public static final String CARGO = "cargo"; + public static final String CARGO_FULL = "contactos.cargo"; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, TELEFONE, TELEMOVEL, FAX, EMAIL, CARGO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, NOME, TELEFONE, TELEMOVEL, FAX, EMAIL, CARGO, }; + + private Map dataHash; + + public ContactosDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getNome() + { + return (String) get(NOME); + } + + public void setNome(String nomeValue ) + { + this.set(NOME, nomeValue ); + } + + public String getTelefone() + { + return (String) get(TELEFONE); + } + + public void setTelefone(String telefoneValue ) + { + this.set(TELEFONE, telefoneValue ); + } + + public String getTelemovel() + { + return (String) get(TELEMOVEL); + } + + public void setTelemovel(String telemovelValue ) + { + this.set(TELEMOVEL, telemovelValue ); + } + + public String getFax() + { + return (String) get(FAX); + } + + public void setFax(String faxValue ) + { + this.set(FAX, faxValue ); + } + + public String getEmail() + { + return (String) get(EMAIL); + } + + public void setEmail(String emailValue ) + { + this.set(EMAIL, emailValue ); + } + + public String getCargo() + { + return (String) get(CARGO); + } + + public void setCargo(String cargoValue ) + { + this.set(CARGO, cargoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Contactos.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EcdOficial.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EcdOficial.java new file mode 100644 index 00000000..3405cbd4 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EcdOficial.java @@ -0,0 +1,183 @@ +/* +* EcdOficial.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class EcdOficial implements JDOInnerObject +{ + private Integer id; + private String descricao; + private String descricao_plain; + private Integer ordem; + private String activo; + + public EcdOficial() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == EcdOficialDataAuto.ID ) + { + return id; + } + else if( fieldName == EcdOficialDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName == EcdOficialDataAuto.DESCRICAO_PLAIN ) + { + return descricao_plain; + } + else if( fieldName == EcdOficialDataAuto.ORDEM ) + { + return ordem; + } + else if( fieldName == EcdOficialDataAuto.ACTIVO ) + { + return activo; + } + else if( fieldName.equals( EcdOficialDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( EcdOficialDataAuto.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( EcdOficialDataAuto.DESCRICAO_PLAIN ) ) + { + return descricao_plain; + } + else if( fieldName.equals( EcdOficialDataAuto.ORDEM ) ) + { + return ordem; + } + else if( fieldName.equals( EcdOficialDataAuto.ACTIVO ) ) + { + return activo; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == EcdOficialDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == EcdOficialDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == EcdOficialDataAuto.DESCRICAO_PLAIN ) + { + descricao_plain = ( String ) value; + } + else if( fieldName == EcdOficialDataAuto.ORDEM ) + { + ordem = ( Integer ) value; + } + else if( fieldName == EcdOficialDataAuto.ACTIVO ) + { + activo = ( String ) value; + } + else if( fieldName.equals( EcdOficialDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( EcdOficialDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( EcdOficialDataAuto.DESCRICAO_PLAIN ) ) + { + descricao_plain = ( String ) value; + } + else if( fieldName.equals( EcdOficialDataAuto.ORDEM ) ) + { + ordem = ( Integer ) value; + } + else if( fieldName.equals( EcdOficialDataAuto.ACTIVO ) ) + { + activo = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public String getDescricao_plain() + { + return descricao_plain; + } + + public void setDescricao_plain(String descricao_plainValue ) + { + this.descricao_plain = descricao_plainValue; + } + + public Integer getOrdem() + { + return ordem; + } + + public void setOrdem(Integer ordemValue ) + { + this.ordem = ordemValue; + } + + public String getActivo() + { + return activo; + } + + public void setActivo(String activoValue ) + { + this.activo = activoValue; + } + + public Class getOuterClass() + { + return EcdOficialDataAuto.class; + } + + public EcdOficialDataAuto getOuterClassInstance() + { + EcdOficialDataAuto outerObj = new EcdOficialDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EcdOficialData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EcdOficialData.java new file mode 100644 index 00000000..79d44702 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EcdOficialData.java @@ -0,0 +1,18 @@ +/* +* EcdOficialDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class EcdOficialData extends com.evolute.siprp.server.db.data.siprp_local3.EcdOficialDataAuto +{ + + public EcdOficialData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EcdOficialDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EcdOficialDataAuto.java new file mode 100644 index 00000000..b66c1d0f --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EcdOficialDataAuto.java @@ -0,0 +1,131 @@ +/* +* EcdOficialDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class EcdOficialDataAuto extends JDOObject +{ + + public static final String TABLENAME = "ecd_oficial"; + + public static final String ID = "id"; + public static final String ID_FULL = "ecd_oficial.id"; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "ecd_oficial.descricao"; + public static final String DESCRICAO_PLAIN = "descricao_plain"; + public static final String DESCRICAO_PLAIN_FULL = "ecd_oficial.descricao_plain"; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "ecd_oficial.ordem"; + public static final String ACTIVO = "activo"; + public static final String ACTIVO_FULL = "ecd_oficial.activo"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRICAO, DESCRICAO_PLAIN, ORDEM, ACTIVO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DESCRICAO, DESCRICAO_PLAIN, ORDEM, ACTIVO, }; + + private Map dataHash; + + public EcdOficialDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + public String getDescricao_plain() + { + return (String) get(DESCRICAO_PLAIN); + } + + public void setDescricao_plain(String descricao_plainValue ) + { + this.set(DESCRICAO_PLAIN, descricao_plainValue ); + } + + public Integer getOrdem() + { + return (Integer) get(ORDEM); + } + + public void setOrdem(Integer ordemValue ) + { + this.set(ORDEM, ordemValue ); + } + + public String getActivo() + { + return (String) get(ACTIVO); + } + + public void setActivo(String activoValue ) + { + this.set(ACTIVO, activoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return EcdOficial.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EmailPlanoDeActuacao.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EmailPlanoDeActuacao.java new file mode 100644 index 00000000..ef5cfc70 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EmailPlanoDeActuacao.java @@ -0,0 +1,129 @@ +/* +* EmailPlanoDeActuacao.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class EmailPlanoDeActuacao implements JDOInnerObject +{ + private Integer id; + private String description; + private Integer estabelecimento_id; + + public EmailPlanoDeActuacao() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == EmailPlanoDeActuacaoDataAuto.ID ) + { + return id; + } + else if( fieldName == EmailPlanoDeActuacaoDataAuto.DESCRIPTION ) + { + return description; + } + else if( fieldName == EmailPlanoDeActuacaoDataAuto.ESTABELECIMENTO_ID ) + { + return estabelecimento_id; + } + else if( fieldName.equals( EmailPlanoDeActuacaoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( EmailPlanoDeActuacaoDataAuto.DESCRIPTION ) ) + { + return description; + } + else if( fieldName.equals( EmailPlanoDeActuacaoDataAuto.ESTABELECIMENTO_ID ) ) + { + return estabelecimento_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == EmailPlanoDeActuacaoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == EmailPlanoDeActuacaoDataAuto.DESCRIPTION ) + { + description = ( String ) value; + } + else if( fieldName == EmailPlanoDeActuacaoDataAuto.ESTABELECIMENTO_ID ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName.equals( EmailPlanoDeActuacaoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( EmailPlanoDeActuacaoDataAuto.DESCRIPTION ) ) + { + description = ( String ) value; + } + else if( fieldName.equals( EmailPlanoDeActuacaoDataAuto.ESTABELECIMENTO_ID ) ) + { + estabelecimento_id = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String descriptionValue ) + { + this.description = descriptionValue; + } + + public Integer getEstabelecimento_id() + { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + this.estabelecimento_id = estabelecimento_idValue; + } + + public Class getOuterClass() + { + return EmailPlanoDeActuacaoDataAuto.class; + } + + public EmailPlanoDeActuacaoDataAuto getOuterClassInstance() + { + EmailPlanoDeActuacaoDataAuto outerObj = new EmailPlanoDeActuacaoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EmailPlanoDeActuacaoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EmailPlanoDeActuacaoData.java new file mode 100644 index 00000000..c9124dff --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EmailPlanoDeActuacaoData.java @@ -0,0 +1,18 @@ +/* +* EmailPlanoDeActuacaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class EmailPlanoDeActuacaoData extends com.evolute.siprp.server.db.data.siprp_local3.EmailPlanoDeActuacaoDataAuto +{ + + public EmailPlanoDeActuacaoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EmailPlanoDeActuacaoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EmailPlanoDeActuacaoDataAuto.java new file mode 100644 index 00000000..420b63a9 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EmailPlanoDeActuacaoDataAuto.java @@ -0,0 +1,166 @@ +/* +* EmailPlanoDeActuacaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class EmailPlanoDeActuacaoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "email_plano_de_actuacao"; + + public static final String ID = "id"; + public static final String ID_FULL = "email_plano_de_actuacao.id"; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "email_plano_de_actuacao.description"; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "email_plano_de_actuacao.estabelecimento_id"; + public static final String TO_ESTABELECIMENTO_ID = "to estabelecimento_id"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRIPTION, ESTABELECIMENTO_ID, TO_ESTABELECIMENTO_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DESCRIPTION, ESTABELECIMENTO_ID, }; + + private Map dataHash; + + public EmailPlanoDeActuacaoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getDescription() + { + return (String) get(DESCRIPTION); + } + + public void setDescription(String descriptionValue ) + { + this.set(DESCRIPTION, descriptionValue ); + } + + public Integer getEstabelecimento_id() + { + return (Integer) dataHash.get(ESTABELECIMENTO_ID); + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, null); + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData toEstabelecimento_id() + throws Exception + { + if( dataHash.get(TO_ESTABELECIMENTO_ID) == null && getEstabelecimento_id() != null ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.class, new Object[]{ getEstabelecimento_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) dataHash.get(TO_ESTABELECIMENTO_ID); + } + + public void setToEstabelecimento_id(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData estabelecimento_idObject ) + { + if( estabelecimento_idObject == null ) + { + dataHash.put(ESTABELECIMENTO_ID, null); + } + else + { + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + dataHash.put(TO_ESTABELECIMENTO_ID, estabelecimento_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = getEstabelecimento_id(); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = toEstabelecimento_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setEstabelecimento_id( (Integer) value ); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setToEstabelecimento_id( (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_ESTABELECIMENTO_ID) != null ) + { + toEstabelecimento_id().save(); + dataHash.put(ESTABELECIMENTO_ID, toEstabelecimento_id().get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return EmailPlanoDeActuacao.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Empresas.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Empresas.java new file mode 100644 index 00000000..e7abed30 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Empresas.java @@ -0,0 +1,1263 @@ +/* +* Empresas.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class Empresas implements JDOInnerObject +{ + private Integer id; + private String designacao_social; + private Integer servico_saude_tipo; + private String servico_saude_designacao; + private Integer servico_higiene_tipo; + private String servico_higiene_designacao; + private String inactivo; + private String morada; + private String codigo_postal; + private String localidade; + private String distrito; + private String concelho; + private Integer numero_trabalhadores; + private java.util.Date data_proposta; + private java.util.Date data_aceitacao; + private String perfil_1; + private String perfil_2; + private java.util.Date data_envio_contrato; + private java.util.Date data_recepcao_contrato; + private java.util.Date data_envio_idict; + private String cae; + private String contribuinte; + private String seguranca_social; + private String codigo_1; + private String codigo_2; + private String codigo_3; + private Integer servicos; + private Integer contacto_1; + private Integer contacto_2; + private java.util.Date data_relatorio_anual; + private Double preco_higiene; + private Double preco_medicina; + private String periodicidade; + private String actividade; + private java.sql.Timestamp actualizacao; + private String designacao_social_plain; + private String a_consultas; + private String a_exames; + private String b_consultas; + private String b_exames; + private java.util.Date data_cancelamento; + private Integer duracao; + private java.util.Date inicio_contrato; + private Integer empresa_logo_id; + private Boolean imprimir_tabela_alargada; + + public Empresas() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == EmpresasDataAuto.ID ) + { + return id; + } + else if( fieldName == EmpresasDataAuto.DESIGNACAO_SOCIAL ) + { + return designacao_social; + } + else if( fieldName == EmpresasDataAuto.SERVICO_SAUDE_TIPO ) + { + return servico_saude_tipo; + } + else if( fieldName == EmpresasDataAuto.SERVICO_SAUDE_DESIGNACAO ) + { + return servico_saude_designacao; + } + else if( fieldName == EmpresasDataAuto.SERVICO_HIGIENE_TIPO ) + { + return servico_higiene_tipo; + } + else if( fieldName == EmpresasDataAuto.SERVICO_HIGIENE_DESIGNACAO ) + { + return servico_higiene_designacao; + } + else if( fieldName == EmpresasDataAuto.INACTIVO ) + { + return inactivo; + } + else if( fieldName == EmpresasDataAuto.MORADA ) + { + return morada; + } + else if( fieldName == EmpresasDataAuto.CODIGO_POSTAL ) + { + return codigo_postal; + } + else if( fieldName == EmpresasDataAuto.LOCALIDADE ) + { + return localidade; + } + else if( fieldName == EmpresasDataAuto.DISTRITO ) + { + return distrito; + } + else if( fieldName == EmpresasDataAuto.CONCELHO ) + { + return concelho; + } + else if( fieldName == EmpresasDataAuto.NUMERO_TRABALHADORES ) + { + return numero_trabalhadores; + } + else if( fieldName == EmpresasDataAuto.DATA_PROPOSTA ) + { + return data_proposta; + } + else if( fieldName == EmpresasDataAuto.DATA_ACEITACAO ) + { + return data_aceitacao; + } + else if( fieldName == EmpresasDataAuto.PERFIL_1 ) + { + return perfil_1; + } + else if( fieldName == EmpresasDataAuto.PERFIL_2 ) + { + return perfil_2; + } + else if( fieldName == EmpresasDataAuto.DATA_ENVIO_CONTRATO ) + { + return data_envio_contrato; + } + else if( fieldName == EmpresasDataAuto.DATA_RECEPCAO_CONTRATO ) + { + return data_recepcao_contrato; + } + else if( fieldName == EmpresasDataAuto.DATA_ENVIO_IDICT ) + { + return data_envio_idict; + } + else if( fieldName == EmpresasDataAuto.CAE ) + { + return cae; + } + else if( fieldName == EmpresasDataAuto.CONTRIBUINTE ) + { + return contribuinte; + } + else if( fieldName == EmpresasDataAuto.SEGURANCA_SOCIAL ) + { + return seguranca_social; + } + else if( fieldName == EmpresasDataAuto.CODIGO_1 ) + { + return codigo_1; + } + else if( fieldName == EmpresasDataAuto.CODIGO_2 ) + { + return codigo_2; + } + else if( fieldName == EmpresasDataAuto.CODIGO_3 ) + { + return codigo_3; + } + else if( fieldName == EmpresasDataAuto.SERVICOS ) + { + return servicos; + } + else if( fieldName == EmpresasDataAuto.CONTACTO_1 ) + { + return contacto_1; + } + else if( fieldName == EmpresasDataAuto.CONTACTO_2 ) + { + return contacto_2; + } + else if( fieldName == EmpresasDataAuto.DATA_RELATORIO_ANUAL ) + { + return data_relatorio_anual; + } + else if( fieldName == EmpresasDataAuto.PRECO_HIGIENE ) + { + return preco_higiene; + } + else if( fieldName == EmpresasDataAuto.PRECO_MEDICINA ) + { + return preco_medicina; + } + else if( fieldName == EmpresasDataAuto.PERIODICIDADE ) + { + return periodicidade; + } + else if( fieldName == EmpresasDataAuto.ACTIVIDADE ) + { + return actividade; + } + else if( fieldName == EmpresasDataAuto.ACTUALIZACAO ) + { + return actualizacao; + } + else if( fieldName == EmpresasDataAuto.DESIGNACAO_SOCIAL_PLAIN ) + { + return designacao_social_plain; + } + else if( fieldName == EmpresasDataAuto.A_CONSULTAS ) + { + return a_consultas; + } + else if( fieldName == EmpresasDataAuto.A_EXAMES ) + { + return a_exames; + } + else if( fieldName == EmpresasDataAuto.B_CONSULTAS ) + { + return b_consultas; + } + else if( fieldName == EmpresasDataAuto.B_EXAMES ) + { + return b_exames; + } + else if( fieldName == EmpresasDataAuto.DATA_CANCELAMENTO ) + { + return data_cancelamento; + } + else if( fieldName == EmpresasDataAuto.DURACAO ) + { + return duracao; + } + else if( fieldName == EmpresasDataAuto.INICIO_CONTRATO ) + { + return inicio_contrato; + } + else if( fieldName == EmpresasDataAuto.EMPRESA_LOGO_ID ) + { + return empresa_logo_id; + } + else if( fieldName == EmpresasDataAuto.IMPRIMIR_TABELA_ALARGADA ) + { + return imprimir_tabela_alargada; + } + else if( fieldName.equals( EmpresasDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( EmpresasDataAuto.DESIGNACAO_SOCIAL ) ) + { + return designacao_social; + } + else if( fieldName.equals( EmpresasDataAuto.SERVICO_SAUDE_TIPO ) ) + { + return servico_saude_tipo; + } + else if( fieldName.equals( EmpresasDataAuto.SERVICO_SAUDE_DESIGNACAO ) ) + { + return servico_saude_designacao; + } + else if( fieldName.equals( EmpresasDataAuto.SERVICO_HIGIENE_TIPO ) ) + { + return servico_higiene_tipo; + } + else if( fieldName.equals( EmpresasDataAuto.SERVICO_HIGIENE_DESIGNACAO ) ) + { + return servico_higiene_designacao; + } + else if( fieldName.equals( EmpresasDataAuto.INACTIVO ) ) + { + return inactivo; + } + else if( fieldName.equals( EmpresasDataAuto.MORADA ) ) + { + return morada; + } + else if( fieldName.equals( EmpresasDataAuto.CODIGO_POSTAL ) ) + { + return codigo_postal; + } + else if( fieldName.equals( EmpresasDataAuto.LOCALIDADE ) ) + { + return localidade; + } + else if( fieldName.equals( EmpresasDataAuto.DISTRITO ) ) + { + return distrito; + } + else if( fieldName.equals( EmpresasDataAuto.CONCELHO ) ) + { + return concelho; + } + else if( fieldName.equals( EmpresasDataAuto.NUMERO_TRABALHADORES ) ) + { + return numero_trabalhadores; + } + else if( fieldName.equals( EmpresasDataAuto.DATA_PROPOSTA ) ) + { + return data_proposta; + } + else if( fieldName.equals( EmpresasDataAuto.DATA_ACEITACAO ) ) + { + return data_aceitacao; + } + else if( fieldName.equals( EmpresasDataAuto.PERFIL_1 ) ) + { + return perfil_1; + } + else if( fieldName.equals( EmpresasDataAuto.PERFIL_2 ) ) + { + return perfil_2; + } + else if( fieldName.equals( EmpresasDataAuto.DATA_ENVIO_CONTRATO ) ) + { + return data_envio_contrato; + } + else if( fieldName.equals( EmpresasDataAuto.DATA_RECEPCAO_CONTRATO ) ) + { + return data_recepcao_contrato; + } + else if( fieldName.equals( EmpresasDataAuto.DATA_ENVIO_IDICT ) ) + { + return data_envio_idict; + } + else if( fieldName.equals( EmpresasDataAuto.CAE ) ) + { + return cae; + } + else if( fieldName.equals( EmpresasDataAuto.CONTRIBUINTE ) ) + { + return contribuinte; + } + else if( fieldName.equals( EmpresasDataAuto.SEGURANCA_SOCIAL ) ) + { + return seguranca_social; + } + else if( fieldName.equals( EmpresasDataAuto.CODIGO_1 ) ) + { + return codigo_1; + } + else if( fieldName.equals( EmpresasDataAuto.CODIGO_2 ) ) + { + return codigo_2; + } + else if( fieldName.equals( EmpresasDataAuto.CODIGO_3 ) ) + { + return codigo_3; + } + else if( fieldName.equals( EmpresasDataAuto.SERVICOS ) ) + { + return servicos; + } + else if( fieldName.equals( EmpresasDataAuto.CONTACTO_1 ) ) + { + return contacto_1; + } + else if( fieldName.equals( EmpresasDataAuto.CONTACTO_2 ) ) + { + return contacto_2; + } + else if( fieldName.equals( EmpresasDataAuto.DATA_RELATORIO_ANUAL ) ) + { + return data_relatorio_anual; + } + else if( fieldName.equals( EmpresasDataAuto.PRECO_HIGIENE ) ) + { + return preco_higiene; + } + else if( fieldName.equals( EmpresasDataAuto.PRECO_MEDICINA ) ) + { + return preco_medicina; + } + else if( fieldName.equals( EmpresasDataAuto.PERIODICIDADE ) ) + { + return periodicidade; + } + else if( fieldName.equals( EmpresasDataAuto.ACTIVIDADE ) ) + { + return actividade; + } + else if( fieldName.equals( EmpresasDataAuto.ACTUALIZACAO ) ) + { + return actualizacao; + } + else if( fieldName.equals( EmpresasDataAuto.DESIGNACAO_SOCIAL_PLAIN ) ) + { + return designacao_social_plain; + } + else if( fieldName.equals( EmpresasDataAuto.A_CONSULTAS ) ) + { + return a_consultas; + } + else if( fieldName.equals( EmpresasDataAuto.A_EXAMES ) ) + { + return a_exames; + } + else if( fieldName.equals( EmpresasDataAuto.B_CONSULTAS ) ) + { + return b_consultas; + } + else if( fieldName.equals( EmpresasDataAuto.B_EXAMES ) ) + { + return b_exames; + } + else if( fieldName.equals( EmpresasDataAuto.DATA_CANCELAMENTO ) ) + { + return data_cancelamento; + } + else if( fieldName.equals( EmpresasDataAuto.DURACAO ) ) + { + return duracao; + } + else if( fieldName.equals( EmpresasDataAuto.INICIO_CONTRATO ) ) + { + return inicio_contrato; + } + else if( fieldName.equals( EmpresasDataAuto.EMPRESA_LOGO_ID ) ) + { + return empresa_logo_id; + } + else if( fieldName.equals( EmpresasDataAuto.IMPRIMIR_TABELA_ALARGADA ) ) + { + return imprimir_tabela_alargada; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == EmpresasDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == EmpresasDataAuto.DESIGNACAO_SOCIAL ) + { + designacao_social = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.SERVICO_SAUDE_TIPO ) + { + servico_saude_tipo = ( Integer ) value; + } + else if( fieldName == EmpresasDataAuto.SERVICO_SAUDE_DESIGNACAO ) + { + servico_saude_designacao = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.SERVICO_HIGIENE_TIPO ) + { + servico_higiene_tipo = ( Integer ) value; + } + else if( fieldName == EmpresasDataAuto.SERVICO_HIGIENE_DESIGNACAO ) + { + servico_higiene_designacao = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.INACTIVO ) + { + inactivo = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.MORADA ) + { + morada = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.CODIGO_POSTAL ) + { + codigo_postal = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.LOCALIDADE ) + { + localidade = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.DISTRITO ) + { + distrito = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.CONCELHO ) + { + concelho = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.NUMERO_TRABALHADORES ) + { + numero_trabalhadores = ( Integer ) value; + } + else if( fieldName == EmpresasDataAuto.DATA_PROPOSTA ) + { + data_proposta = ( java.util.Date ) value; + } + else if( fieldName == EmpresasDataAuto.DATA_ACEITACAO ) + { + data_aceitacao = ( java.util.Date ) value; + } + else if( fieldName == EmpresasDataAuto.PERFIL_1 ) + { + perfil_1 = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.PERFIL_2 ) + { + perfil_2 = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.DATA_ENVIO_CONTRATO ) + { + data_envio_contrato = ( java.util.Date ) value; + } + else if( fieldName == EmpresasDataAuto.DATA_RECEPCAO_CONTRATO ) + { + data_recepcao_contrato = ( java.util.Date ) value; + } + else if( fieldName == EmpresasDataAuto.DATA_ENVIO_IDICT ) + { + data_envio_idict = ( java.util.Date ) value; + } + else if( fieldName == EmpresasDataAuto.CAE ) + { + cae = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.CONTRIBUINTE ) + { + contribuinte = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.SEGURANCA_SOCIAL ) + { + seguranca_social = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.CODIGO_1 ) + { + codigo_1 = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.CODIGO_2 ) + { + codigo_2 = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.CODIGO_3 ) + { + codigo_3 = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.SERVICOS ) + { + servicos = ( Integer ) value; + } + else if( fieldName == EmpresasDataAuto.CONTACTO_1 ) + { + contacto_1 = ( Integer ) value; + } + else if( fieldName == EmpresasDataAuto.CONTACTO_2 ) + { + contacto_2 = ( Integer ) value; + } + else if( fieldName == EmpresasDataAuto.DATA_RELATORIO_ANUAL ) + { + data_relatorio_anual = ( java.util.Date ) value; + } + else if( fieldName == EmpresasDataAuto.PRECO_HIGIENE ) + { + preco_higiene = ( Double ) value; + } + else if( fieldName == EmpresasDataAuto.PRECO_MEDICINA ) + { + preco_medicina = ( Double ) value; + } + else if( fieldName == EmpresasDataAuto.PERIODICIDADE ) + { + periodicidade = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.ACTIVIDADE ) + { + actividade = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.ACTUALIZACAO ) + { + actualizacao = ( java.sql.Timestamp ) value; + } + else if( fieldName == EmpresasDataAuto.DESIGNACAO_SOCIAL_PLAIN ) + { + designacao_social_plain = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.A_CONSULTAS ) + { + a_consultas = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.A_EXAMES ) + { + a_exames = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.B_CONSULTAS ) + { + b_consultas = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.B_EXAMES ) + { + b_exames = ( String ) value; + } + else if( fieldName == EmpresasDataAuto.DATA_CANCELAMENTO ) + { + data_cancelamento = ( java.util.Date ) value; + } + else if( fieldName == EmpresasDataAuto.DURACAO ) + { + duracao = ( Integer ) value; + } + else if( fieldName == EmpresasDataAuto.INICIO_CONTRATO ) + { + inicio_contrato = ( java.util.Date ) value; + } + else if( fieldName == EmpresasDataAuto.EMPRESA_LOGO_ID ) + { + empresa_logo_id = ( Integer ) value; + } + else if( fieldName == EmpresasDataAuto.IMPRIMIR_TABELA_ALARGADA ) + { + imprimir_tabela_alargada = ( Boolean ) value; + } + else if( fieldName.equals( EmpresasDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( EmpresasDataAuto.DESIGNACAO_SOCIAL ) ) + { + designacao_social = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.SERVICO_SAUDE_TIPO ) ) + { + servico_saude_tipo = ( Integer ) value; + } + else if( fieldName.equals( EmpresasDataAuto.SERVICO_SAUDE_DESIGNACAO ) ) + { + servico_saude_designacao = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.SERVICO_HIGIENE_TIPO ) ) + { + servico_higiene_tipo = ( Integer ) value; + } + else if( fieldName.equals( EmpresasDataAuto.SERVICO_HIGIENE_DESIGNACAO ) ) + { + servico_higiene_designacao = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.INACTIVO ) ) + { + inactivo = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.MORADA ) ) + { + morada = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.CODIGO_POSTAL ) ) + { + codigo_postal = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.LOCALIDADE ) ) + { + localidade = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.DISTRITO ) ) + { + distrito = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.CONCELHO ) ) + { + concelho = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.NUMERO_TRABALHADORES ) ) + { + numero_trabalhadores = ( Integer ) value; + } + else if( fieldName.equals( EmpresasDataAuto.DATA_PROPOSTA ) ) + { + data_proposta = ( java.util.Date ) value; + } + else if( fieldName.equals( EmpresasDataAuto.DATA_ACEITACAO ) ) + { + data_aceitacao = ( java.util.Date ) value; + } + else if( fieldName.equals( EmpresasDataAuto.PERFIL_1 ) ) + { + perfil_1 = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.PERFIL_2 ) ) + { + perfil_2 = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.DATA_ENVIO_CONTRATO ) ) + { + data_envio_contrato = ( java.util.Date ) value; + } + else if( fieldName.equals( EmpresasDataAuto.DATA_RECEPCAO_CONTRATO ) ) + { + data_recepcao_contrato = ( java.util.Date ) value; + } + else if( fieldName.equals( EmpresasDataAuto.DATA_ENVIO_IDICT ) ) + { + data_envio_idict = ( java.util.Date ) value; + } + else if( fieldName.equals( EmpresasDataAuto.CAE ) ) + { + cae = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.CONTRIBUINTE ) ) + { + contribuinte = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.SEGURANCA_SOCIAL ) ) + { + seguranca_social = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.CODIGO_1 ) ) + { + codigo_1 = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.CODIGO_2 ) ) + { + codigo_2 = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.CODIGO_3 ) ) + { + codigo_3 = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.SERVICOS ) ) + { + servicos = ( Integer ) value; + } + else if( fieldName.equals( EmpresasDataAuto.CONTACTO_1 ) ) + { + contacto_1 = ( Integer ) value; + } + else if( fieldName.equals( EmpresasDataAuto.CONTACTO_2 ) ) + { + contacto_2 = ( Integer ) value; + } + else if( fieldName.equals( EmpresasDataAuto.DATA_RELATORIO_ANUAL ) ) + { + data_relatorio_anual = ( java.util.Date ) value; + } + else if( fieldName.equals( EmpresasDataAuto.PRECO_HIGIENE ) ) + { + preco_higiene = ( Double ) value; + } + else if( fieldName.equals( EmpresasDataAuto.PRECO_MEDICINA ) ) + { + preco_medicina = ( Double ) value; + } + else if( fieldName.equals( EmpresasDataAuto.PERIODICIDADE ) ) + { + periodicidade = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.ACTIVIDADE ) ) + { + actividade = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.ACTUALIZACAO ) ) + { + actualizacao = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( EmpresasDataAuto.DESIGNACAO_SOCIAL_PLAIN ) ) + { + designacao_social_plain = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.A_CONSULTAS ) ) + { + a_consultas = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.A_EXAMES ) ) + { + a_exames = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.B_CONSULTAS ) ) + { + b_consultas = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.B_EXAMES ) ) + { + b_exames = ( String ) value; + } + else if( fieldName.equals( EmpresasDataAuto.DATA_CANCELAMENTO ) ) + { + data_cancelamento = ( java.util.Date ) value; + } + else if( fieldName.equals( EmpresasDataAuto.DURACAO ) ) + { + duracao = ( Integer ) value; + } + else if( fieldName.equals( EmpresasDataAuto.INICIO_CONTRATO ) ) + { + inicio_contrato = ( java.util.Date ) value; + } + else if( fieldName.equals( EmpresasDataAuto.EMPRESA_LOGO_ID ) ) + { + empresa_logo_id = ( Integer ) value; + } + else if( fieldName.equals( EmpresasDataAuto.IMPRIMIR_TABELA_ALARGADA ) ) + { + imprimir_tabela_alargada = ( Boolean ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getDesignacao_social() + { + return designacao_social; + } + + public void setDesignacao_social(String designacao_socialValue ) + { + this.designacao_social = designacao_socialValue; + } + + public Integer getServico_saude_tipo() + { + return servico_saude_tipo; + } + + public void setServico_saude_tipo(Integer servico_saude_tipoValue ) + { + this.servico_saude_tipo = servico_saude_tipoValue; + } + + public String getServico_saude_designacao() + { + return servico_saude_designacao; + } + + public void setServico_saude_designacao(String servico_saude_designacaoValue ) + { + this.servico_saude_designacao = servico_saude_designacaoValue; + } + + public Integer getServico_higiene_tipo() + { + return servico_higiene_tipo; + } + + public void setServico_higiene_tipo(Integer servico_higiene_tipoValue ) + { + this.servico_higiene_tipo = servico_higiene_tipoValue; + } + + public String getServico_higiene_designacao() + { + return servico_higiene_designacao; + } + + public void setServico_higiene_designacao(String servico_higiene_designacaoValue ) + { + this.servico_higiene_designacao = servico_higiene_designacaoValue; + } + + public String getInactivo() + { + return inactivo; + } + + public void setInactivo(String inactivoValue ) + { + this.inactivo = inactivoValue; + } + + public String getMorada() + { + return morada; + } + + public void setMorada(String moradaValue ) + { + this.morada = moradaValue; + } + + public String getCodigo_postal() + { + return codigo_postal; + } + + public void setCodigo_postal(String codigo_postalValue ) + { + this.codigo_postal = codigo_postalValue; + } + + public String getLocalidade() + { + return localidade; + } + + public void setLocalidade(String localidadeValue ) + { + this.localidade = localidadeValue; + } + + public String getDistrito() + { + return distrito; + } + + public void setDistrito(String distritoValue ) + { + this.distrito = distritoValue; + } + + public String getConcelho() + { + return concelho; + } + + public void setConcelho(String concelhoValue ) + { + this.concelho = concelhoValue; + } + + public Integer getNumero_trabalhadores() + { + return numero_trabalhadores; + } + + public void setNumero_trabalhadores(Integer numero_trabalhadoresValue ) + { + this.numero_trabalhadores = numero_trabalhadoresValue; + } + + public java.util.Date getData_proposta() + { + return data_proposta; + } + + public void setData_proposta(java.util.Date data_propostaValue ) + { + this.data_proposta = data_propostaValue; + } + + public java.util.Date getData_aceitacao() + { + return data_aceitacao; + } + + public void setData_aceitacao(java.util.Date data_aceitacaoValue ) + { + this.data_aceitacao = data_aceitacaoValue; + } + + public String getPerfil_1() + { + return perfil_1; + } + + public void setPerfil_1(String perfil_1Value ) + { + this.perfil_1 = perfil_1Value; + } + + public String getPerfil_2() + { + return perfil_2; + } + + public void setPerfil_2(String perfil_2Value ) + { + this.perfil_2 = perfil_2Value; + } + + public java.util.Date getData_envio_contrato() + { + return data_envio_contrato; + } + + public void setData_envio_contrato(java.util.Date data_envio_contratoValue ) + { + this.data_envio_contrato = data_envio_contratoValue; + } + + public java.util.Date getData_recepcao_contrato() + { + return data_recepcao_contrato; + } + + public void setData_recepcao_contrato(java.util.Date data_recepcao_contratoValue ) + { + this.data_recepcao_contrato = data_recepcao_contratoValue; + } + + public java.util.Date getData_envio_idict() + { + return data_envio_idict; + } + + public void setData_envio_idict(java.util.Date data_envio_idictValue ) + { + this.data_envio_idict = data_envio_idictValue; + } + + public String getCae() + { + return cae; + } + + public void setCae(String caeValue ) + { + this.cae = caeValue; + } + + public String getContribuinte() + { + return contribuinte; + } + + public void setContribuinte(String contribuinteValue ) + { + this.contribuinte = contribuinteValue; + } + + public String getSeguranca_social() + { + return seguranca_social; + } + + public void setSeguranca_social(String seguranca_socialValue ) + { + this.seguranca_social = seguranca_socialValue; + } + + public String getCodigo_1() + { + return codigo_1; + } + + public void setCodigo_1(String codigo_1Value ) + { + this.codigo_1 = codigo_1Value; + } + + public String getCodigo_2() + { + return codigo_2; + } + + public void setCodigo_2(String codigo_2Value ) + { + this.codigo_2 = codigo_2Value; + } + + public String getCodigo_3() + { + return codigo_3; + } + + public void setCodigo_3(String codigo_3Value ) + { + this.codigo_3 = codigo_3Value; + } + + public Integer getServicos() + { + return servicos; + } + + public void setServicos(Integer servicosValue ) + { + this.servicos = servicosValue; + } + + public Integer getContacto_1() + { + return contacto_1; + } + + public void setContacto_1(Integer contacto_1Value ) + { + this.contacto_1 = contacto_1Value; + } + + public Integer getContacto_2() + { + return contacto_2; + } + + public void setContacto_2(Integer contacto_2Value ) + { + this.contacto_2 = contacto_2Value; + } + + public java.util.Date getData_relatorio_anual() + { + return data_relatorio_anual; + } + + public void setData_relatorio_anual(java.util.Date data_relatorio_anualValue ) + { + this.data_relatorio_anual = data_relatorio_anualValue; + } + + public Double getPreco_higiene() + { + return preco_higiene; + } + + public void setPreco_higiene(Double preco_higieneValue ) + { + this.preco_higiene = preco_higieneValue; + } + + public Double getPreco_medicina() + { + return preco_medicina; + } + + public void setPreco_medicina(Double preco_medicinaValue ) + { + this.preco_medicina = preco_medicinaValue; + } + + public String getPeriodicidade() + { + return periodicidade; + } + + public void setPeriodicidade(String periodicidadeValue ) + { + this.periodicidade = periodicidadeValue; + } + + public String getActividade() + { + return actividade; + } + + public void setActividade(String actividadeValue ) + { + this.actividade = actividadeValue; + } + + public java.sql.Timestamp getActualizacao() + { + return actualizacao; + } + + public void setActualizacao(java.sql.Timestamp actualizacaoValue ) + { + this.actualizacao = actualizacaoValue; + } + + public String getDesignacao_social_plain() + { + return designacao_social_plain; + } + + public void setDesignacao_social_plain(String designacao_social_plainValue ) + { + this.designacao_social_plain = designacao_social_plainValue; + } + + public String getA_consultas() + { + return a_consultas; + } + + public void setA_consultas(String a_consultasValue ) + { + this.a_consultas = a_consultasValue; + } + + public String getA_exames() + { + return a_exames; + } + + public void setA_exames(String a_examesValue ) + { + this.a_exames = a_examesValue; + } + + public String getB_consultas() + { + return b_consultas; + } + + public void setB_consultas(String b_consultasValue ) + { + this.b_consultas = b_consultasValue; + } + + public String getB_exames() + { + return b_exames; + } + + public void setB_exames(String b_examesValue ) + { + this.b_exames = b_examesValue; + } + + public java.util.Date getData_cancelamento() + { + return data_cancelamento; + } + + public void setData_cancelamento(java.util.Date data_cancelamentoValue ) + { + this.data_cancelamento = data_cancelamentoValue; + } + + public Integer getDuracao() + { + return duracao; + } + + public void setDuracao(Integer duracaoValue ) + { + this.duracao = duracaoValue; + } + + public java.util.Date getInicio_contrato() + { + return inicio_contrato; + } + + public void setInicio_contrato(java.util.Date inicio_contratoValue ) + { + this.inicio_contrato = inicio_contratoValue; + } + + public Integer getEmpresa_logo_id() + { + return empresa_logo_id; + } + + public void setEmpresa_logo_id(Integer empresa_logo_idValue ) + { + this.empresa_logo_id = empresa_logo_idValue; + } + + public Boolean getImprimir_tabela_alargada() + { + return imprimir_tabela_alargada; + } + + public void setImprimir_tabela_alargada(Boolean imprimir_tabela_alargadaValue ) + { + this.imprimir_tabela_alargada = imprimir_tabela_alargadaValue; + } + + public Class getOuterClass() + { + return EmpresasDataAuto.class; + } + + public EmpresasDataAuto getOuterClassInstance() + { + EmpresasDataAuto outerObj = new EmpresasDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EmpresasData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EmpresasData.java new file mode 100644 index 00000000..dc525cdb --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EmpresasData.java @@ -0,0 +1,18 @@ +/* +* EmpresasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class EmpresasData extends com.evolute.siprp.server.db.data.siprp_local3.EmpresasDataAuto +{ + + public EmpresasData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EmpresasDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EmpresasDataAuto.java new file mode 100644 index 00000000..a25597d4 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EmpresasDataAuto.java @@ -0,0 +1,782 @@ +/* +* EmpresasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class EmpresasDataAuto extends JDOObject +{ + + public static final String TABLENAME = "empresas"; + + public static final String ID = "id"; + public static final String ID_FULL = "empresas.id"; + public static final String DESIGNACAO_SOCIAL = "designacao_social"; + public static final String DESIGNACAO_SOCIAL_FULL = "empresas.designacao_social"; + public static final String SERVICO_SAUDE_TIPO = "servico_saude_tipo"; + public static final String SERVICO_SAUDE_TIPO_FULL = "empresas.servico_saude_tipo"; + public static final String SERVICO_SAUDE_DESIGNACAO = "servico_saude_designacao"; + public static final String SERVICO_SAUDE_DESIGNACAO_FULL = "empresas.servico_saude_designacao"; + public static final String SERVICO_HIGIENE_TIPO = "servico_higiene_tipo"; + public static final String SERVICO_HIGIENE_TIPO_FULL = "empresas.servico_higiene_tipo"; + public static final String SERVICO_HIGIENE_DESIGNACAO = "servico_higiene_designacao"; + public static final String SERVICO_HIGIENE_DESIGNACAO_FULL = "empresas.servico_higiene_designacao"; + public static final String INACTIVO = "inactivo"; + public static final String INACTIVO_FULL = "empresas.inactivo"; + public static final String MORADA = "morada"; + public static final String MORADA_FULL = "empresas.morada"; + public static final String CODIGO_POSTAL = "codigo_postal"; + public static final String CODIGO_POSTAL_FULL = "empresas.codigo_postal"; + public static final String LOCALIDADE = "localidade"; + public static final String LOCALIDADE_FULL = "empresas.localidade"; + public static final String DISTRITO = "distrito"; + public static final String DISTRITO_FULL = "empresas.distrito"; + public static final String CONCELHO = "concelho"; + public static final String CONCELHO_FULL = "empresas.concelho"; + public static final String NUMERO_TRABALHADORES = "numero_trabalhadores"; + public static final String NUMERO_TRABALHADORES_FULL = "empresas.numero_trabalhadores"; + public static final String DATA_PROPOSTA = "data_proposta"; + public static final String DATA_PROPOSTA_FULL = "empresas.data_proposta"; + public static final String DATA_ACEITACAO = "data_aceitacao"; + public static final String DATA_ACEITACAO_FULL = "empresas.data_aceitacao"; + public static final String PERFIL_1 = "perfil_1"; + public static final String PERFIL_1_FULL = "empresas.perfil_1"; + public static final String PERFIL_2 = "perfil_2"; + public static final String PERFIL_2_FULL = "empresas.perfil_2"; + public static final String DATA_ENVIO_CONTRATO = "data_envio_contrato"; + public static final String DATA_ENVIO_CONTRATO_FULL = "empresas.data_envio_contrato"; + public static final String DATA_RECEPCAO_CONTRATO = "data_recepcao_contrato"; + public static final String DATA_RECEPCAO_CONTRATO_FULL = "empresas.data_recepcao_contrato"; + public static final String DATA_ENVIO_IDICT = "data_envio_idict"; + public static final String DATA_ENVIO_IDICT_FULL = "empresas.data_envio_idict"; + public static final String CAE = "cae"; + public static final String CAE_FULL = "empresas.cae"; + public static final String CONTRIBUINTE = "contribuinte"; + public static final String CONTRIBUINTE_FULL = "empresas.contribuinte"; + public static final String SEGURANCA_SOCIAL = "seguranca_social"; + public static final String SEGURANCA_SOCIAL_FULL = "empresas.seguranca_social"; + public static final String CODIGO_1 = "codigo_1"; + public static final String CODIGO_1_FULL = "empresas.codigo_1"; + public static final String CODIGO_2 = "codigo_2"; + public static final String CODIGO_2_FULL = "empresas.codigo_2"; + public static final String CODIGO_3 = "codigo_3"; + public static final String CODIGO_3_FULL = "empresas.codigo_3"; + public static final String SERVICOS = "servicos"; + public static final String SERVICOS_FULL = "empresas.servicos"; + public static final String CONTACTO_1 = "contacto_1"; + public static final String CONTACTO_1_FULL = "empresas.contacto_1"; + public static final String TO_CONTACTO_1 = "to contacto_1"; + public static final String CONTACTO_2 = "contacto_2"; + public static final String CONTACTO_2_FULL = "empresas.contacto_2"; + public static final String TO_CONTACTO_2 = "to contacto_2"; + public static final String DATA_RELATORIO_ANUAL = "data_relatorio_anual"; + public static final String DATA_RELATORIO_ANUAL_FULL = "empresas.data_relatorio_anual"; + public static final String PRECO_HIGIENE = "preco_higiene"; + public static final String PRECO_HIGIENE_FULL = "empresas.preco_higiene"; + public static final String PRECO_MEDICINA = "preco_medicina"; + public static final String PRECO_MEDICINA_FULL = "empresas.preco_medicina"; + public static final String PERIODICIDADE = "periodicidade"; + public static final String PERIODICIDADE_FULL = "empresas.periodicidade"; + public static final String ACTIVIDADE = "actividade"; + public static final String ACTIVIDADE_FULL = "empresas.actividade"; + public static final String ACTUALIZACAO = "actualizacao"; + public static final String ACTUALIZACAO_FULL = "empresas.actualizacao"; + public static final String DESIGNACAO_SOCIAL_PLAIN = "designacao_social_plain"; + public static final String DESIGNACAO_SOCIAL_PLAIN_FULL = "empresas.designacao_social_plain"; + public static final String A_CONSULTAS = "a_consultas"; + public static final String A_CONSULTAS_FULL = "empresas.a_consultas"; + public static final String A_EXAMES = "a_exames"; + public static final String A_EXAMES_FULL = "empresas.a_exames"; + public static final String B_CONSULTAS = "b_consultas"; + public static final String B_CONSULTAS_FULL = "empresas.b_consultas"; + public static final String B_EXAMES = "b_exames"; + public static final String B_EXAMES_FULL = "empresas.b_exames"; + public static final String DATA_CANCELAMENTO = "data_cancelamento"; + public static final String DATA_CANCELAMENTO_FULL = "empresas.data_cancelamento"; + public static final String DURACAO = "duracao"; + public static final String DURACAO_FULL = "empresas.duracao"; + public static final String INICIO_CONTRATO = "inicio_contrato"; + public static final String INICIO_CONTRATO_FULL = "empresas.inicio_contrato"; + public static final String EMPRESA_LOGO_ID = "empresa_logo_id"; + public static final String EMPRESA_LOGO_ID_FULL = "empresas.empresa_logo_id"; + public static final String TO_EMPRESA_LOGO_ID = "to empresa_logo_id"; + public static final String IMPRIMIR_TABELA_ALARGADA = "imprimir_tabela_alargada"; + public static final String IMPRIMIR_TABELA_ALARGADA_FULL = "empresas.imprimir_tabela_alargada"; + + public static final String FIELD_NAMES[] = new String[]{ + DESIGNACAO_SOCIAL, SERVICO_SAUDE_TIPO, SERVICO_SAUDE_DESIGNACAO, + SERVICO_HIGIENE_TIPO, SERVICO_HIGIENE_DESIGNACAO, INACTIVO, MORADA, + CODIGO_POSTAL, LOCALIDADE, DISTRITO, CONCELHO, NUMERO_TRABALHADORES, + DATA_PROPOSTA, DATA_ACEITACAO, PERFIL_1, PERFIL_2, DATA_ENVIO_CONTRATO, + DATA_RECEPCAO_CONTRATO, DATA_ENVIO_IDICT, CAE, CONTRIBUINTE, SEGURANCA_SOCIAL, + CODIGO_1, CODIGO_2, CODIGO_3, SERVICOS, CONTACTO_1, TO_CONTACTO_1, CONTACTO_2, + TO_CONTACTO_2, DATA_RELATORIO_ANUAL, PRECO_HIGIENE, PRECO_MEDICINA, + PERIODICIDADE, ACTIVIDADE, ACTUALIZACAO, DESIGNACAO_SOCIAL_PLAIN, A_CONSULTAS, + A_EXAMES, B_CONSULTAS, B_EXAMES, DATA_CANCELAMENTO, DURACAO, INICIO_CONTRATO, + EMPRESA_LOGO_ID, TO_EMPRESA_LOGO_ID, IMPRIMIR_TABELA_ALARGADA, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DESIGNACAO_SOCIAL, SERVICO_SAUDE_TIPO, SERVICO_SAUDE_DESIGNACAO, + SERVICO_HIGIENE_TIPO, SERVICO_HIGIENE_DESIGNACAO, INACTIVO, MORADA, + CODIGO_POSTAL, LOCALIDADE, DISTRITO, CONCELHO, NUMERO_TRABALHADORES, + DATA_PROPOSTA, DATA_ACEITACAO, PERFIL_1, PERFIL_2, DATA_ENVIO_CONTRATO, + DATA_RECEPCAO_CONTRATO, DATA_ENVIO_IDICT, CAE, CONTRIBUINTE, SEGURANCA_SOCIAL, + CODIGO_1, CODIGO_2, CODIGO_3, SERVICOS, CONTACTO_1, CONTACTO_2, + DATA_RELATORIO_ANUAL, PRECO_HIGIENE, PRECO_MEDICINA, PERIODICIDADE, ACTIVIDADE, + ACTUALIZACAO, DESIGNACAO_SOCIAL_PLAIN, A_CONSULTAS, A_EXAMES, B_CONSULTAS, + B_EXAMES, DATA_CANCELAMENTO, DURACAO, INICIO_CONTRATO, EMPRESA_LOGO_ID, + IMPRIMIR_TABELA_ALARGADA, }; + + private Map dataHash; + + public EmpresasDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getDesignacao_social() + { + return (String) get(DESIGNACAO_SOCIAL); + } + + public void setDesignacao_social(String designacao_socialValue ) + { + this.set(DESIGNACAO_SOCIAL, designacao_socialValue ); + } + + public Integer getServico_saude_tipo() + { + return (Integer) get(SERVICO_SAUDE_TIPO); + } + + public void setServico_saude_tipo(Integer servico_saude_tipoValue ) + { + this.set(SERVICO_SAUDE_TIPO, servico_saude_tipoValue ); + } + + public String getServico_saude_designacao() + { + return (String) get(SERVICO_SAUDE_DESIGNACAO); + } + + public void setServico_saude_designacao(String servico_saude_designacaoValue ) + { + this.set(SERVICO_SAUDE_DESIGNACAO, servico_saude_designacaoValue ); + } + + public Integer getServico_higiene_tipo() + { + return (Integer) get(SERVICO_HIGIENE_TIPO); + } + + public void setServico_higiene_tipo(Integer servico_higiene_tipoValue ) + { + this.set(SERVICO_HIGIENE_TIPO, servico_higiene_tipoValue ); + } + + public String getServico_higiene_designacao() + { + return (String) get(SERVICO_HIGIENE_DESIGNACAO); + } + + public void setServico_higiene_designacao(String servico_higiene_designacaoValue ) + { + this.set(SERVICO_HIGIENE_DESIGNACAO, servico_higiene_designacaoValue ); + } + + public String getInactivo() + { + return (String) get(INACTIVO); + } + + public void setInactivo(String inactivoValue ) + { + this.set(INACTIVO, inactivoValue ); + } + + public String getMorada() + { + return (String) get(MORADA); + } + + public void setMorada(String moradaValue ) + { + this.set(MORADA, moradaValue ); + } + + public String getCodigo_postal() + { + return (String) get(CODIGO_POSTAL); + } + + public void setCodigo_postal(String codigo_postalValue ) + { + this.set(CODIGO_POSTAL, codigo_postalValue ); + } + + public String getLocalidade() + { + return (String) get(LOCALIDADE); + } + + public void setLocalidade(String localidadeValue ) + { + this.set(LOCALIDADE, localidadeValue ); + } + + public String getDistrito() + { + return (String) get(DISTRITO); + } + + public void setDistrito(String distritoValue ) + { + this.set(DISTRITO, distritoValue ); + } + + public String getConcelho() + { + return (String) get(CONCELHO); + } + + public void setConcelho(String concelhoValue ) + { + this.set(CONCELHO, concelhoValue ); + } + + public Integer getNumero_trabalhadores() + { + return (Integer) get(NUMERO_TRABALHADORES); + } + + public void setNumero_trabalhadores(Integer numero_trabalhadoresValue ) + { + this.set(NUMERO_TRABALHADORES, numero_trabalhadoresValue ); + } + + public java.util.Date getData_proposta() + { + return (java.util.Date) get(DATA_PROPOSTA); + } + + public void setData_proposta(java.util.Date data_propostaValue ) + { + this.set(DATA_PROPOSTA, data_propostaValue ); + } + + public java.util.Date getData_aceitacao() + { + return (java.util.Date) get(DATA_ACEITACAO); + } + + public void setData_aceitacao(java.util.Date data_aceitacaoValue ) + { + this.set(DATA_ACEITACAO, data_aceitacaoValue ); + } + + public String getPerfil_1() + { + return (String) get(PERFIL_1); + } + + public void setPerfil_1(String perfil_1Value ) + { + this.set(PERFIL_1, perfil_1Value ); + } + + public String getPerfil_2() + { + return (String) get(PERFIL_2); + } + + public void setPerfil_2(String perfil_2Value ) + { + this.set(PERFIL_2, perfil_2Value ); + } + + public java.util.Date getData_envio_contrato() + { + return (java.util.Date) get(DATA_ENVIO_CONTRATO); + } + + public void setData_envio_contrato(java.util.Date data_envio_contratoValue ) + { + this.set(DATA_ENVIO_CONTRATO, data_envio_contratoValue ); + } + + public java.util.Date getData_recepcao_contrato() + { + return (java.util.Date) get(DATA_RECEPCAO_CONTRATO); + } + + public void setData_recepcao_contrato(java.util.Date data_recepcao_contratoValue ) + { + this.set(DATA_RECEPCAO_CONTRATO, data_recepcao_contratoValue ); + } + + public java.util.Date getData_envio_idict() + { + return (java.util.Date) get(DATA_ENVIO_IDICT); + } + + public void setData_envio_idict(java.util.Date data_envio_idictValue ) + { + this.set(DATA_ENVIO_IDICT, data_envio_idictValue ); + } + + public String getCae() + { + return (String) get(CAE); + } + + public void setCae(String caeValue ) + { + this.set(CAE, caeValue ); + } + + public String getContribuinte() + { + return (String) get(CONTRIBUINTE); + } + + public void setContribuinte(String contribuinteValue ) + { + this.set(CONTRIBUINTE, contribuinteValue ); + } + + public String getSeguranca_social() + { + return (String) get(SEGURANCA_SOCIAL); + } + + public void setSeguranca_social(String seguranca_socialValue ) + { + this.set(SEGURANCA_SOCIAL, seguranca_socialValue ); + } + + public String getCodigo_1() + { + return (String) get(CODIGO_1); + } + + public void setCodigo_1(String codigo_1Value ) + { + this.set(CODIGO_1, codigo_1Value ); + } + + public String getCodigo_2() + { + return (String) get(CODIGO_2); + } + + public void setCodigo_2(String codigo_2Value ) + { + this.set(CODIGO_2, codigo_2Value ); + } + + public String getCodigo_3() + { + return (String) get(CODIGO_3); + } + + public void setCodigo_3(String codigo_3Value ) + { + this.set(CODIGO_3, codigo_3Value ); + } + + public Integer getServicos() + { + return (Integer) get(SERVICOS); + } + + public void setServicos(Integer servicosValue ) + { + this.set(SERVICOS, servicosValue ); + } + + public Integer getContacto_1() + { + return (Integer) dataHash.get(CONTACTO_1); + } + + public void setContacto_1(Integer contacto_1Value ) + { + dataHash.put(TO_CONTACTO_1, null); + dataHash.put(CONTACTO_1, contacto_1Value ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.ContactosData toContacto_1() + throws Exception + { + if( dataHash.get(TO_CONTACTO_1) == null && getContacto_1() != null ) + { + dataHash.put(TO_CONTACTO_1, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.ContactosData.class, new Object[]{ getContacto_1() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.ContactosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.ContactosData) dataHash.get(TO_CONTACTO_1); + } + + public void setToContacto_1(com.evolute.siprp.server.db.data.siprp_local3.ContactosData contacto_1Object ) + { + if( contacto_1Object == null ) + { + dataHash.put(CONTACTO_1, null); + } + else + { + dataHash.put(CONTACTO_1, contacto_1Object.get( com.evolute.siprp.server.db.data.siprp_local3.ContactosData.ID )); + } + dataHash.put(TO_CONTACTO_1, contacto_1Object); + } + + public Integer getContacto_2() + { + return (Integer) dataHash.get(CONTACTO_2); + } + + public void setContacto_2(Integer contacto_2Value ) + { + dataHash.put(TO_CONTACTO_2, null); + dataHash.put(CONTACTO_2, contacto_2Value ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.ContactosData toContacto_2() + throws Exception + { + if( dataHash.get(TO_CONTACTO_2) == null && getContacto_2() != null ) + { + dataHash.put(TO_CONTACTO_2, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.ContactosData.class, new Object[]{ getContacto_2() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.ContactosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.ContactosData) dataHash.get(TO_CONTACTO_2); + } + + public void setToContacto_2(com.evolute.siprp.server.db.data.siprp_local3.ContactosData contacto_2Object ) + { + if( contacto_2Object == null ) + { + dataHash.put(CONTACTO_2, null); + } + else + { + dataHash.put(CONTACTO_2, contacto_2Object.get( com.evolute.siprp.server.db.data.siprp_local3.ContactosData.ID )); + } + dataHash.put(TO_CONTACTO_2, contacto_2Object); + } + + public java.util.Date getData_relatorio_anual() + { + return (java.util.Date) get(DATA_RELATORIO_ANUAL); + } + + public void setData_relatorio_anual(java.util.Date data_relatorio_anualValue ) + { + this.set(DATA_RELATORIO_ANUAL, data_relatorio_anualValue ); + } + + public Double getPreco_higiene() + { + return (Double) get(PRECO_HIGIENE); + } + + public void setPreco_higiene(Double preco_higieneValue ) + { + this.set(PRECO_HIGIENE, preco_higieneValue ); + } + + public Double getPreco_medicina() + { + return (Double) get(PRECO_MEDICINA); + } + + public void setPreco_medicina(Double preco_medicinaValue ) + { + this.set(PRECO_MEDICINA, preco_medicinaValue ); + } + + public String getPeriodicidade() + { + return (String) get(PERIODICIDADE); + } + + public void setPeriodicidade(String periodicidadeValue ) + { + this.set(PERIODICIDADE, periodicidadeValue ); + } + + public String getActividade() + { + return (String) get(ACTIVIDADE); + } + + public void setActividade(String actividadeValue ) + { + this.set(ACTIVIDADE, actividadeValue ); + } + + public java.sql.Timestamp getActualizacao() + { + return (java.sql.Timestamp) get(ACTUALIZACAO); + } + + public void setActualizacao(java.sql.Timestamp actualizacaoValue ) + { + this.set(ACTUALIZACAO, actualizacaoValue ); + } + + public String getDesignacao_social_plain() + { + return (String) get(DESIGNACAO_SOCIAL_PLAIN); + } + + public void setDesignacao_social_plain(String designacao_social_plainValue ) + { + this.set(DESIGNACAO_SOCIAL_PLAIN, designacao_social_plainValue ); + } + + public String getA_consultas() + { + return (String) get(A_CONSULTAS); + } + + public void setA_consultas(String a_consultasValue ) + { + this.set(A_CONSULTAS, a_consultasValue ); + } + + public String getA_exames() + { + return (String) get(A_EXAMES); + } + + public void setA_exames(String a_examesValue ) + { + this.set(A_EXAMES, a_examesValue ); + } + + public String getB_consultas() + { + return (String) get(B_CONSULTAS); + } + + public void setB_consultas(String b_consultasValue ) + { + this.set(B_CONSULTAS, b_consultasValue ); + } + + public String getB_exames() + { + return (String) get(B_EXAMES); + } + + public void setB_exames(String b_examesValue ) + { + this.set(B_EXAMES, b_examesValue ); + } + + public java.util.Date getData_cancelamento() + { + return (java.util.Date) get(DATA_CANCELAMENTO); + } + + public void setData_cancelamento(java.util.Date data_cancelamentoValue ) + { + this.set(DATA_CANCELAMENTO, data_cancelamentoValue ); + } + + public Integer getDuracao() + { + return (Integer) get(DURACAO); + } + + public void setDuracao(Integer duracaoValue ) + { + this.set(DURACAO, duracaoValue ); + } + + public java.util.Date getInicio_contrato() + { + return (java.util.Date) get(INICIO_CONTRATO); + } + + public void setInicio_contrato(java.util.Date inicio_contratoValue ) + { + this.set(INICIO_CONTRATO, inicio_contratoValue ); + } + + public Integer getEmpresa_logo_id() + { + return (Integer) dataHash.get(EMPRESA_LOGO_ID); + } + + public void setEmpresa_logo_id(Integer empresa_logo_idValue ) + { + dataHash.put(TO_EMPRESA_LOGO_ID, null); + dataHash.put(EMPRESA_LOGO_ID, empresa_logo_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.ImageData toEmpresa_logo_id() + throws Exception + { + if( dataHash.get(TO_EMPRESA_LOGO_ID) == null && getEmpresa_logo_id() != null ) + { + dataHash.put(TO_EMPRESA_LOGO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.ImageData.class, new Object[]{ getEmpresa_logo_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.ImageData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.ImageData) dataHash.get(TO_EMPRESA_LOGO_ID); + } + + public void setToEmpresa_logo_id(com.evolute.siprp.server.db.data.siprp_local3.ImageData empresa_logo_idObject ) + { + if( empresa_logo_idObject == null ) + { + dataHash.put(EMPRESA_LOGO_ID, null); + } + else + { + dataHash.put(EMPRESA_LOGO_ID, empresa_logo_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.ImageData.ID )); + } + dataHash.put(TO_EMPRESA_LOGO_ID, empresa_logo_idObject); + } + + public Boolean getImprimir_tabela_alargada() + { + return (Boolean) get(IMPRIMIR_TABELA_ALARGADA); + } + + public void setImprimir_tabela_alargada(Boolean imprimir_tabela_alargadaValue ) + { + this.set(IMPRIMIR_TABELA_ALARGADA, imprimir_tabela_alargadaValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_CONTACTO_1.equals( fieldName ) ) + { + value = toContacto_1(); + } + else if( TO_CONTACTO_2.equals( fieldName ) ) + { + value = toContacto_2(); + } + else if( TO_EMPRESA_LOGO_ID.equals( fieldName ) ) + { + value = toEmpresa_logo_id(); + } + else if( EMPRESA_LOGO_ID.equals( fieldName ) ) + { + value = getEmpresa_logo_id(); + } + else if( CONTACTO_1.equals( fieldName ) ) + { + value = getContacto_1(); + } + else if( CONTACTO_2.equals( fieldName ) ) + { + value = getContacto_2(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_CONTACTO_1.equals( fieldName ) ) + { + setToContacto_1( (com.evolute.siprp.server.db.data.siprp_local3.ContactosData) value ); + } + else if( TO_CONTACTO_2.equals( fieldName ) ) + { + setToContacto_2( (com.evolute.siprp.server.db.data.siprp_local3.ContactosData) value ); + } + else if( TO_EMPRESA_LOGO_ID.equals( fieldName ) ) + { + setToEmpresa_logo_id( (com.evolute.siprp.server.db.data.siprp_local3.ImageData) value ); + } + else if( EMPRESA_LOGO_ID.equals( fieldName ) ) + { + setEmpresa_logo_id( (Integer) value ); + } + else if( CONTACTO_1.equals( fieldName ) ) + { + setContacto_1( (Integer) value ); + } + else if( CONTACTO_2.equals( fieldName ) ) + { + setContacto_2( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_CONTACTO_1) != null ) + { + toContacto_1().save(); + dataHash.put(CONTACTO_1, toContacto_1().get( com.evolute.siprp.server.db.data.siprp_local3.ContactosData.ID )); + } + + if( dataHash.get(TO_CONTACTO_2) != null ) + { + toContacto_2().save(); + dataHash.put(CONTACTO_2, toContacto_2().get( com.evolute.siprp.server.db.data.siprp_local3.ContactosData.ID )); + } + + if( dataHash.get(TO_EMPRESA_LOGO_ID) != null ) + { + toEmpresa_logo_id().save(); + dataHash.put(EMPRESA_LOGO_ID, toEmpresa_logo_id().get( com.evolute.siprp.server.db.data.siprp_local3.ImageData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Empresas.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Errors.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Errors.java new file mode 100644 index 00000000..6b0e8d8a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Errors.java @@ -0,0 +1,183 @@ +/* +* Errors.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class Errors implements JDOInnerObject +{ + private Integer id; + private java.sql.Timestamp date; + private String type; + private String environment; + private String description; + + public Errors() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == ErrorsDataAuto.ID ) + { + return id; + } + else if( fieldName == ErrorsDataAuto.DATE ) + { + return date; + } + else if( fieldName == ErrorsDataAuto.TYPE ) + { + return type; + } + else if( fieldName == ErrorsDataAuto.ENVIRONMENT ) + { + return environment; + } + else if( fieldName == ErrorsDataAuto.DESCRIPTION ) + { + return description; + } + else if( fieldName.equals( ErrorsDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( ErrorsDataAuto.DATE ) ) + { + return date; + } + else if( fieldName.equals( ErrorsDataAuto.TYPE ) ) + { + return type; + } + else if( fieldName.equals( ErrorsDataAuto.ENVIRONMENT ) ) + { + return environment; + } + else if( fieldName.equals( ErrorsDataAuto.DESCRIPTION ) ) + { + return description; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == ErrorsDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == ErrorsDataAuto.DATE ) + { + date = ( java.sql.Timestamp ) value; + } + else if( fieldName == ErrorsDataAuto.TYPE ) + { + type = ( String ) value; + } + else if( fieldName == ErrorsDataAuto.ENVIRONMENT ) + { + environment = ( String ) value; + } + else if( fieldName == ErrorsDataAuto.DESCRIPTION ) + { + description = ( String ) value; + } + else if( fieldName.equals( ErrorsDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( ErrorsDataAuto.DATE ) ) + { + date = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( ErrorsDataAuto.TYPE ) ) + { + type = ( String ) value; + } + else if( fieldName.equals( ErrorsDataAuto.ENVIRONMENT ) ) + { + environment = ( String ) value; + } + else if( fieldName.equals( ErrorsDataAuto.DESCRIPTION ) ) + { + description = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public java.sql.Timestamp getDate() + { + return date; + } + + public void setDate(java.sql.Timestamp dateValue ) + { + this.date = dateValue; + } + + public String getType() + { + return type; + } + + public void setType(String typeValue ) + { + this.type = typeValue; + } + + public String getEnvironment() + { + return environment; + } + + public void setEnvironment(String environmentValue ) + { + this.environment = environmentValue; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String descriptionValue ) + { + this.description = descriptionValue; + } + + public Class getOuterClass() + { + return ErrorsDataAuto.class; + } + + public ErrorsDataAuto getOuterClassInstance() + { + ErrorsDataAuto outerObj = new ErrorsDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ErrorsData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ErrorsData.java new file mode 100644 index 00000000..48187f9b --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ErrorsData.java @@ -0,0 +1,18 @@ +/* +* ErrorsDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class ErrorsData extends com.evolute.siprp.server.db.data.siprp_local3.ErrorsDataAuto +{ + + public ErrorsData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ErrorsDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ErrorsDataAuto.java new file mode 100644 index 00000000..93e4b325 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ErrorsDataAuto.java @@ -0,0 +1,131 @@ +/* +* ErrorsDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class ErrorsDataAuto extends JDOObject +{ + + public static final String TABLENAME = "errors"; + + public static final String ID = "id"; + public static final String ID_FULL = "errors.id"; + public static final String DATE = "date"; + public static final String DATE_FULL = "errors.date"; + public static final String TYPE = "type"; + public static final String TYPE_FULL = "errors.type"; + public static final String ENVIRONMENT = "environment"; + public static final String ENVIRONMENT_FULL = "errors.environment"; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "errors.description"; + + public static final String FIELD_NAMES[] = new String[]{ + DATE, TYPE, ENVIRONMENT, DESCRIPTION, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATE, TYPE, ENVIRONMENT, DESCRIPTION, }; + + private Map dataHash; + + public ErrorsDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public java.sql.Timestamp getDate() + { + return (java.sql.Timestamp) get(DATE); + } + + public void setDate(java.sql.Timestamp dateValue ) + { + this.set(DATE, dateValue ); + } + + public String getType() + { + return (String) get(TYPE); + } + + public void setType(String typeValue ) + { + this.set(TYPE, typeValue ); + } + + public String getEnvironment() + { + return (String) get(ENVIRONMENT); + } + + public void setEnvironment(String environmentValue ) + { + this.set(ENVIRONMENT, environmentValue ); + } + + public String getDescription() + { + return (String) get(DESCRIPTION); + } + + public void setDescription(String descriptionValue ) + { + this.set(DESCRIPTION, descriptionValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Errors.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Estabelecimentos.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Estabelecimentos.java new file mode 100644 index 00000000..7485cfd9 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Estabelecimentos.java @@ -0,0 +1,453 @@ +/* +* Estabelecimentos.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class Estabelecimentos implements JDOInnerObject +{ + private Integer id; + private String nome; + private String localidade; + private String inactivo; + private Integer empresa_id; + private String morada; + private String codigo_postal; + private String contacto_backup; + private String historico; + private java.sql.Timestamp actualizacao; + private String nome_plain; + private Integer medico_id; + private Integer prestador_consulta_id; + private Integer prestador_ecds_id; + private Integer contacto_id; + + public Estabelecimentos() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == EstabelecimentosDataAuto.ID ) + { + return id; + } + else if( fieldName == EstabelecimentosDataAuto.NOME ) + { + return nome; + } + else if( fieldName == EstabelecimentosDataAuto.LOCALIDADE ) + { + return localidade; + } + else if( fieldName == EstabelecimentosDataAuto.INACTIVO ) + { + return inactivo; + } + else if( fieldName == EstabelecimentosDataAuto.EMPRESA_ID ) + { + return empresa_id; + } + else if( fieldName == EstabelecimentosDataAuto.MORADA ) + { + return morada; + } + else if( fieldName == EstabelecimentosDataAuto.CODIGO_POSTAL ) + { + return codigo_postal; + } + else if( fieldName == EstabelecimentosDataAuto.CONTACTO_BACKUP ) + { + return contacto_backup; + } + else if( fieldName == EstabelecimentosDataAuto.HISTORICO ) + { + return historico; + } + else if( fieldName == EstabelecimentosDataAuto.ACTUALIZACAO ) + { + return actualizacao; + } + else if( fieldName == EstabelecimentosDataAuto.NOME_PLAIN ) + { + return nome_plain; + } + else if( fieldName == EstabelecimentosDataAuto.MEDICO_ID ) + { + return medico_id; + } + else if( fieldName == EstabelecimentosDataAuto.PRESTADOR_CONSULTA_ID ) + { + return prestador_consulta_id; + } + else if( fieldName == EstabelecimentosDataAuto.PRESTADOR_ECDS_ID ) + { + return prestador_ecds_id; + } + else if( fieldName == EstabelecimentosDataAuto.CONTACTO_ID ) + { + return contacto_id; + } + else if( fieldName.equals( EstabelecimentosDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( EstabelecimentosDataAuto.NOME ) ) + { + return nome; + } + else if( fieldName.equals( EstabelecimentosDataAuto.LOCALIDADE ) ) + { + return localidade; + } + else if( fieldName.equals( EstabelecimentosDataAuto.INACTIVO ) ) + { + return inactivo; + } + else if( fieldName.equals( EstabelecimentosDataAuto.EMPRESA_ID ) ) + { + return empresa_id; + } + else if( fieldName.equals( EstabelecimentosDataAuto.MORADA ) ) + { + return morada; + } + else if( fieldName.equals( EstabelecimentosDataAuto.CODIGO_POSTAL ) ) + { + return codigo_postal; + } + else if( fieldName.equals( EstabelecimentosDataAuto.CONTACTO_BACKUP ) ) + { + return contacto_backup; + } + else if( fieldName.equals( EstabelecimentosDataAuto.HISTORICO ) ) + { + return historico; + } + else if( fieldName.equals( EstabelecimentosDataAuto.ACTUALIZACAO ) ) + { + return actualizacao; + } + else if( fieldName.equals( EstabelecimentosDataAuto.NOME_PLAIN ) ) + { + return nome_plain; + } + else if( fieldName.equals( EstabelecimentosDataAuto.MEDICO_ID ) ) + { + return medico_id; + } + else if( fieldName.equals( EstabelecimentosDataAuto.PRESTADOR_CONSULTA_ID ) ) + { + return prestador_consulta_id; + } + else if( fieldName.equals( EstabelecimentosDataAuto.PRESTADOR_ECDS_ID ) ) + { + return prestador_ecds_id; + } + else if( fieldName.equals( EstabelecimentosDataAuto.CONTACTO_ID ) ) + { + return contacto_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == EstabelecimentosDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == EstabelecimentosDataAuto.NOME ) + { + nome = ( String ) value; + } + else if( fieldName == EstabelecimentosDataAuto.LOCALIDADE ) + { + localidade = ( String ) value; + } + else if( fieldName == EstabelecimentosDataAuto.INACTIVO ) + { + inactivo = ( String ) value; + } + else if( fieldName == EstabelecimentosDataAuto.EMPRESA_ID ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName == EstabelecimentosDataAuto.MORADA ) + { + morada = ( String ) value; + } + else if( fieldName == EstabelecimentosDataAuto.CODIGO_POSTAL ) + { + codigo_postal = ( String ) value; + } + else if( fieldName == EstabelecimentosDataAuto.CONTACTO_BACKUP ) + { + contacto_backup = ( String ) value; + } + else if( fieldName == EstabelecimentosDataAuto.HISTORICO ) + { + historico = ( String ) value; + } + else if( fieldName == EstabelecimentosDataAuto.ACTUALIZACAO ) + { + actualizacao = ( java.sql.Timestamp ) value; + } + else if( fieldName == EstabelecimentosDataAuto.NOME_PLAIN ) + { + nome_plain = ( String ) value; + } + else if( fieldName == EstabelecimentosDataAuto.MEDICO_ID ) + { + medico_id = ( Integer ) value; + } + else if( fieldName == EstabelecimentosDataAuto.PRESTADOR_CONSULTA_ID ) + { + prestador_consulta_id = ( Integer ) value; + } + else if( fieldName == EstabelecimentosDataAuto.PRESTADOR_ECDS_ID ) + { + prestador_ecds_id = ( Integer ) value; + } + else if( fieldName == EstabelecimentosDataAuto.CONTACTO_ID ) + { + contacto_id = ( Integer ) value; + } + else if( fieldName.equals( EstabelecimentosDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( EstabelecimentosDataAuto.NOME ) ) + { + nome = ( String ) value; + } + else if( fieldName.equals( EstabelecimentosDataAuto.LOCALIDADE ) ) + { + localidade = ( String ) value; + } + else if( fieldName.equals( EstabelecimentosDataAuto.INACTIVO ) ) + { + inactivo = ( String ) value; + } + else if( fieldName.equals( EstabelecimentosDataAuto.EMPRESA_ID ) ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName.equals( EstabelecimentosDataAuto.MORADA ) ) + { + morada = ( String ) value; + } + else if( fieldName.equals( EstabelecimentosDataAuto.CODIGO_POSTAL ) ) + { + codigo_postal = ( String ) value; + } + else if( fieldName.equals( EstabelecimentosDataAuto.CONTACTO_BACKUP ) ) + { + contacto_backup = ( String ) value; + } + else if( fieldName.equals( EstabelecimentosDataAuto.HISTORICO ) ) + { + historico = ( String ) value; + } + else if( fieldName.equals( EstabelecimentosDataAuto.ACTUALIZACAO ) ) + { + actualizacao = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( EstabelecimentosDataAuto.NOME_PLAIN ) ) + { + nome_plain = ( String ) value; + } + else if( fieldName.equals( EstabelecimentosDataAuto.MEDICO_ID ) ) + { + medico_id = ( Integer ) value; + } + else if( fieldName.equals( EstabelecimentosDataAuto.PRESTADOR_CONSULTA_ID ) ) + { + prestador_consulta_id = ( Integer ) value; + } + else if( fieldName.equals( EstabelecimentosDataAuto.PRESTADOR_ECDS_ID ) ) + { + prestador_ecds_id = ( Integer ) value; + } + else if( fieldName.equals( EstabelecimentosDataAuto.CONTACTO_ID ) ) + { + contacto_id = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getNome() + { + return nome; + } + + public void setNome(String nomeValue ) + { + this.nome = nomeValue; + } + + public String getLocalidade() + { + return localidade; + } + + public void setLocalidade(String localidadeValue ) + { + this.localidade = localidadeValue; + } + + public String getInactivo() + { + return inactivo; + } + + public void setInactivo(String inactivoValue ) + { + this.inactivo = inactivoValue; + } + + public Integer getEmpresa_id() + { + return empresa_id; + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + this.empresa_id = empresa_idValue; + } + + public String getMorada() + { + return morada; + } + + public void setMorada(String moradaValue ) + { + this.morada = moradaValue; + } + + public String getCodigo_postal() + { + return codigo_postal; + } + + public void setCodigo_postal(String codigo_postalValue ) + { + this.codigo_postal = codigo_postalValue; + } + + public String getContacto_backup() + { + return contacto_backup; + } + + public void setContacto_backup(String contacto_backupValue ) + { + this.contacto_backup = contacto_backupValue; + } + + public String getHistorico() + { + return historico; + } + + public void setHistorico(String historicoValue ) + { + this.historico = historicoValue; + } + + public java.sql.Timestamp getActualizacao() + { + return actualizacao; + } + + public void setActualizacao(java.sql.Timestamp actualizacaoValue ) + { + this.actualizacao = actualizacaoValue; + } + + public String getNome_plain() + { + return nome_plain; + } + + public void setNome_plain(String nome_plainValue ) + { + this.nome_plain = nome_plainValue; + } + + public Integer getMedico_id() + { + return medico_id; + } + + public void setMedico_id(Integer medico_idValue ) + { + this.medico_id = medico_idValue; + } + + public Integer getPrestador_consulta_id() + { + return prestador_consulta_id; + } + + public void setPrestador_consulta_id(Integer prestador_consulta_idValue ) + { + this.prestador_consulta_id = prestador_consulta_idValue; + } + + public Integer getPrestador_ecds_id() + { + return prestador_ecds_id; + } + + public void setPrestador_ecds_id(Integer prestador_ecds_idValue ) + { + this.prestador_ecds_id = prestador_ecds_idValue; + } + + public Integer getContacto_id() + { + return contacto_id; + } + + public void setContacto_id(Integer contacto_idValue ) + { + this.contacto_id = contacto_idValue; + } + + public Class getOuterClass() + { + return EstabelecimentosDataAuto.class; + } + + public EstabelecimentosDataAuto getOuterClassInstance() + { + EstabelecimentosDataAuto outerObj = new EstabelecimentosDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EstabelecimentosData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EstabelecimentosData.java new file mode 100644 index 00000000..a695b73a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EstabelecimentosData.java @@ -0,0 +1,18 @@ +/* +* EstabelecimentosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class EstabelecimentosData extends com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosDataAuto +{ + + public EstabelecimentosData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EstabelecimentosDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EstabelecimentosDataAuto.java new file mode 100644 index 00000000..038eeab5 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EstabelecimentosDataAuto.java @@ -0,0 +1,503 @@ +/* +* EstabelecimentosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class EstabelecimentosDataAuto extends JDOObject +{ + + public static final String TABLENAME = "estabelecimentos"; + + public static final String ID = "id"; + public static final String ID_FULL = "estabelecimentos.id"; + public static final String NOME = "nome"; + public static final String NOME_FULL = "estabelecimentos.nome"; + public static final String LOCALIDADE = "localidade"; + public static final String LOCALIDADE_FULL = "estabelecimentos.localidade"; + public static final String INACTIVO = "inactivo"; + public static final String INACTIVO_FULL = "estabelecimentos.inactivo"; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "estabelecimentos.empresa_id"; + public static final String TO_EMPRESA_ID = "to empresa_id"; + public static final String MORADA = "morada"; + public static final String MORADA_FULL = "estabelecimentos.morada"; + public static final String CODIGO_POSTAL = "codigo_postal"; + public static final String CODIGO_POSTAL_FULL = "estabelecimentos.codigo_postal"; + public static final String CONTACTO_BACKUP = "contacto_backup"; + public static final String CONTACTO_BACKUP_FULL = "estabelecimentos.contacto_backup"; + public static final String HISTORICO = "historico"; + public static final String HISTORICO_FULL = "estabelecimentos.historico"; + public static final String ACTUALIZACAO = "actualizacao"; + public static final String ACTUALIZACAO_FULL = "estabelecimentos.actualizacao"; + public static final String NOME_PLAIN = "nome_plain"; + public static final String NOME_PLAIN_FULL = "estabelecimentos.nome_plain"; + public static final String MEDICO_ID = "medico_id"; + public static final String MEDICO_ID_FULL = "estabelecimentos.medico_id"; + public static final String TO_MEDICO_ID = "to medico_id"; + public static final String PRESTADOR_CONSULTA_ID = "prestador_consulta_id"; + public static final String PRESTADOR_CONSULTA_ID_FULL = "estabelecimentos.prestador_consulta_id"; + public static final String TO_PRESTADOR_CONSULTA_ID = "to prestador_consulta_id"; + public static final String PRESTADOR_ECDS_ID = "prestador_ecds_id"; + public static final String PRESTADOR_ECDS_ID_FULL = "estabelecimentos.prestador_ecds_id"; + public static final String TO_PRESTADOR_ECDS_ID = "to prestador_ecds_id"; + public static final String CONTACTO_ID = "contacto_id"; + public static final String CONTACTO_ID_FULL = "estabelecimentos.contacto_id"; + public static final String TO_CONTACTO_ID = "to contacto_id"; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, LOCALIDADE, INACTIVO, EMPRESA_ID, TO_EMPRESA_ID, MORADA, CODIGO_POSTAL, + CONTACTO_BACKUP, HISTORICO, ACTUALIZACAO, NOME_PLAIN, MEDICO_ID, TO_MEDICO_ID, + PRESTADOR_CONSULTA_ID, TO_PRESTADOR_CONSULTA_ID, PRESTADOR_ECDS_ID, + TO_PRESTADOR_ECDS_ID, CONTACTO_ID, TO_CONTACTO_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, NOME, LOCALIDADE, INACTIVO, EMPRESA_ID, MORADA, CODIGO_POSTAL, CONTACTO_BACKUP, + HISTORICO, ACTUALIZACAO, NOME_PLAIN, MEDICO_ID, PRESTADOR_CONSULTA_ID, + PRESTADOR_ECDS_ID, CONTACTO_ID, }; + + private Map dataHash; + + public EstabelecimentosDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getNome() + { + return (String) get(NOME); + } + + public void setNome(String nomeValue ) + { + this.set(NOME, nomeValue ); + } + + public String getLocalidade() + { + return (String) get(LOCALIDADE); + } + + public void setLocalidade(String localidadeValue ) + { + this.set(LOCALIDADE, localidadeValue ); + } + + public String getInactivo() + { + return (String) get(INACTIVO); + } + + public void setInactivo(String inactivoValue ) + { + this.set(INACTIVO, inactivoValue ); + } + + public Integer getEmpresa_id() + { + return (Integer) dataHash.get(EMPRESA_ID); + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + dataHash.put(TO_EMPRESA_ID, null); + dataHash.put(EMPRESA_ID, empresa_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EmpresasData toEmpresa_id() + throws Exception + { + if( dataHash.get(TO_EMPRESA_ID) == null && getEmpresa_id() != null ) + { + dataHash.put(TO_EMPRESA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.class, new Object[]{ getEmpresa_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) dataHash.get(TO_EMPRESA_ID); + } + + public void setToEmpresa_id(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData empresa_idObject ) + { + if( empresa_idObject == null ) + { + dataHash.put(EMPRESA_ID, null); + } + else + { + dataHash.put(EMPRESA_ID, empresa_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + dataHash.put(TO_EMPRESA_ID, empresa_idObject); + } + + public String getMorada() + { + return (String) get(MORADA); + } + + public void setMorada(String moradaValue ) + { + this.set(MORADA, moradaValue ); + } + + public String getCodigo_postal() + { + return (String) get(CODIGO_POSTAL); + } + + public void setCodigo_postal(String codigo_postalValue ) + { + this.set(CODIGO_POSTAL, codigo_postalValue ); + } + + public String getContacto_backup() + { + return (String) get(CONTACTO_BACKUP); + } + + public void setContacto_backup(String contacto_backupValue ) + { + this.set(CONTACTO_BACKUP, contacto_backupValue ); + } + + public String getHistorico() + { + return (String) get(HISTORICO); + } + + public void setHistorico(String historicoValue ) + { + this.set(HISTORICO, historicoValue ); + } + + public java.sql.Timestamp getActualizacao() + { + return (java.sql.Timestamp) get(ACTUALIZACAO); + } + + public void setActualizacao(java.sql.Timestamp actualizacaoValue ) + { + this.set(ACTUALIZACAO, actualizacaoValue ); + } + + public String getNome_plain() + { + return (String) get(NOME_PLAIN); + } + + public void setNome_plain(String nome_plainValue ) + { + this.set(NOME_PLAIN, nome_plainValue ); + } + + public Integer getMedico_id() + { + return (Integer) dataHash.get(MEDICO_ID); + } + + public void setMedico_id(Integer medico_idValue ) + { + dataHash.put(TO_MEDICO_ID, null); + dataHash.put(MEDICO_ID, medico_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.MedicosData toMedico_id() + throws Exception + { + if( dataHash.get(TO_MEDICO_ID) == null && getMedico_id() != null ) + { + dataHash.put(TO_MEDICO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.MedicosData.class, new Object[]{ getMedico_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.MedicosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.MedicosData) dataHash.get(TO_MEDICO_ID); + } + + public void setToMedico_id(com.evolute.siprp.server.db.data.siprp_local3.MedicosData medico_idObject ) + { + if( medico_idObject == null ) + { + dataHash.put(MEDICO_ID, null); + } + else + { + dataHash.put(MEDICO_ID, medico_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.MedicosData.ID )); + } + dataHash.put(TO_MEDICO_ID, medico_idObject); + } + + public Integer getPrestador_consulta_id() + { + return (Integer) dataHash.get(PRESTADOR_CONSULTA_ID); + } + + public void setPrestador_consulta_id(Integer prestador_consulta_idValue ) + { + dataHash.put(TO_PRESTADOR_CONSULTA_ID, null); + dataHash.put(PRESTADOR_CONSULTA_ID, prestador_consulta_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData toPrestador_consulta_id() + throws Exception + { + if( dataHash.get(TO_PRESTADOR_CONSULTA_ID) == null && getPrestador_consulta_id() != null ) + { + dataHash.put(TO_PRESTADOR_CONSULTA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.class, new Object[]{ getPrestador_consulta_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) dataHash.get(TO_PRESTADOR_CONSULTA_ID); + } + + public void setToPrestador_consulta_id(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData prestador_consulta_idObject ) + { + if( prestador_consulta_idObject == null ) + { + dataHash.put(PRESTADOR_CONSULTA_ID, null); + } + else + { + dataHash.put(PRESTADOR_CONSULTA_ID, prestador_consulta_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + dataHash.put(TO_PRESTADOR_CONSULTA_ID, prestador_consulta_idObject); + } + + public Integer getPrestador_ecds_id() + { + return (Integer) dataHash.get(PRESTADOR_ECDS_ID); + } + + public void setPrestador_ecds_id(Integer prestador_ecds_idValue ) + { + dataHash.put(TO_PRESTADOR_ECDS_ID, null); + dataHash.put(PRESTADOR_ECDS_ID, prestador_ecds_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData toPrestador_ecds_id() + throws Exception + { + if( dataHash.get(TO_PRESTADOR_ECDS_ID) == null && getPrestador_ecds_id() != null ) + { + dataHash.put(TO_PRESTADOR_ECDS_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.class, new Object[]{ getPrestador_ecds_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) dataHash.get(TO_PRESTADOR_ECDS_ID); + } + + public void setToPrestador_ecds_id(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData prestador_ecds_idObject ) + { + if( prestador_ecds_idObject == null ) + { + dataHash.put(PRESTADOR_ECDS_ID, null); + } + else + { + dataHash.put(PRESTADOR_ECDS_ID, prestador_ecds_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + dataHash.put(TO_PRESTADOR_ECDS_ID, prestador_ecds_idObject); + } + + public Integer getContacto_id() + { + return (Integer) dataHash.get(CONTACTO_ID); + } + + public void setContacto_id(Integer contacto_idValue ) + { + dataHash.put(TO_CONTACTO_ID, null); + dataHash.put(CONTACTO_ID, contacto_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.ContactosData toContacto_id() + throws Exception + { + if( dataHash.get(TO_CONTACTO_ID) == null && getContacto_id() != null ) + { + dataHash.put(TO_CONTACTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.ContactosData.class, new Object[]{ getContacto_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.ContactosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.ContactosData) dataHash.get(TO_CONTACTO_ID); + } + + public void setToContacto_id(com.evolute.siprp.server.db.data.siprp_local3.ContactosData contacto_idObject ) + { + if( contacto_idObject == null ) + { + dataHash.put(CONTACTO_ID, null); + } + else + { + dataHash.put(CONTACTO_ID, contacto_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.ContactosData.ID )); + } + dataHash.put(TO_CONTACTO_ID, contacto_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( CONTACTO_ID.equals( fieldName ) ) + { + value = getContacto_id(); + } + else if( TO_PRESTADOR_ECDS_ID.equals( fieldName ) ) + { + value = toPrestador_ecds_id(); + } + else if( TO_PRESTADOR_CONSULTA_ID.equals( fieldName ) ) + { + value = toPrestador_consulta_id(); + } + else if( TO_CONTACTO_ID.equals( fieldName ) ) + { + value = toContacto_id(); + } + else if( TO_EMPRESA_ID.equals( fieldName ) ) + { + value = toEmpresa_id(); + } + else if( PRESTADOR_CONSULTA_ID.equals( fieldName ) ) + { + value = getPrestador_consulta_id(); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + value = getEmpresa_id(); + } + else if( TO_MEDICO_ID.equals( fieldName ) ) + { + value = toMedico_id(); + } + else if( PRESTADOR_ECDS_ID.equals( fieldName ) ) + { + value = getPrestador_ecds_id(); + } + else if( MEDICO_ID.equals( fieldName ) ) + { + value = getMedico_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( CONTACTO_ID.equals( fieldName ) ) + { + setContacto_id( (Integer) value ); + } + else if( TO_PRESTADOR_ECDS_ID.equals( fieldName ) ) + { + setToPrestador_ecds_id( (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) value ); + } + else if( TO_PRESTADOR_CONSULTA_ID.equals( fieldName ) ) + { + setToPrestador_consulta_id( (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) value ); + } + else if( TO_CONTACTO_ID.equals( fieldName ) ) + { + setToContacto_id( (com.evolute.siprp.server.db.data.siprp_local3.ContactosData) value ); + } + else if( TO_EMPRESA_ID.equals( fieldName ) ) + { + setToEmpresa_id( (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) value ); + } + else if( PRESTADOR_CONSULTA_ID.equals( fieldName ) ) + { + setPrestador_consulta_id( (Integer) value ); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + setEmpresa_id( (Integer) value ); + } + else if( TO_MEDICO_ID.equals( fieldName ) ) + { + setToMedico_id( (com.evolute.siprp.server.db.data.siprp_local3.MedicosData) value ); + } + else if( PRESTADOR_ECDS_ID.equals( fieldName ) ) + { + setPrestador_ecds_id( (Integer) value ); + } + else if( MEDICO_ID.equals( fieldName ) ) + { + setMedico_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_EMPRESA_ID) != null ) + { + toEmpresa_id().save(); + dataHash.put(EMPRESA_ID, toEmpresa_id().get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + + if( dataHash.get(TO_MEDICO_ID) != null ) + { + toMedico_id().save(); + dataHash.put(MEDICO_ID, toMedico_id().get( com.evolute.siprp.server.db.data.siprp_local3.MedicosData.ID )); + } + + if( dataHash.get(TO_PRESTADOR_CONSULTA_ID) != null ) + { + toPrestador_consulta_id().save(); + dataHash.put(PRESTADOR_CONSULTA_ID, toPrestador_consulta_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + + if( dataHash.get(TO_PRESTADOR_ECDS_ID) != null ) + { + toPrestador_ecds_id().save(); + dataHash.put(PRESTADOR_ECDS_ID, toPrestador_ecds_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + + if( dataHash.get(TO_CONTACTO_ID) != null ) + { + toContacto_id().save(); + dataHash.put(CONTACTO_ID, toContacto_id().get( com.evolute.siprp.server.db.data.siprp_local3.ContactosData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Estabelecimentos.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Etiquetas.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Etiquetas.java new file mode 100644 index 00000000..612e886b --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Etiquetas.java @@ -0,0 +1,426 @@ +/* +* Etiquetas.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class Etiquetas implements JDOInnerObject +{ + private Integer id; + private String descricao; + private String descricao_plain; + private Double altura; + private Double largura; + private Double margem_esquerda; + private Double margem_cima; + private Integer colunas; + private Integer linhas; + private String continua; + private Double altura_folha; + private Double largura_folha; + private Double margem_vertical_folha; + private Double margem_horizontal_folha; + + public Etiquetas() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == EtiquetasDataAuto.ID ) + { + return id; + } + else if( fieldName == EtiquetasDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName == EtiquetasDataAuto.DESCRICAO_PLAIN ) + { + return descricao_plain; + } + else if( fieldName == EtiquetasDataAuto.ALTURA ) + { + return altura; + } + else if( fieldName == EtiquetasDataAuto.LARGURA ) + { + return largura; + } + else if( fieldName == EtiquetasDataAuto.MARGEM_ESQUERDA ) + { + return margem_esquerda; + } + else if( fieldName == EtiquetasDataAuto.MARGEM_CIMA ) + { + return margem_cima; + } + else if( fieldName == EtiquetasDataAuto.COLUNAS ) + { + return colunas; + } + else if( fieldName == EtiquetasDataAuto.LINHAS ) + { + return linhas; + } + else if( fieldName == EtiquetasDataAuto.CONTINUA ) + { + return continua; + } + else if( fieldName == EtiquetasDataAuto.ALTURA_FOLHA ) + { + return altura_folha; + } + else if( fieldName == EtiquetasDataAuto.LARGURA_FOLHA ) + { + return largura_folha; + } + else if( fieldName == EtiquetasDataAuto.MARGEM_VERTICAL_FOLHA ) + { + return margem_vertical_folha; + } + else if( fieldName == EtiquetasDataAuto.MARGEM_HORIZONTAL_FOLHA ) + { + return margem_horizontal_folha; + } + else if( fieldName.equals( EtiquetasDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( EtiquetasDataAuto.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( EtiquetasDataAuto.DESCRICAO_PLAIN ) ) + { + return descricao_plain; + } + else if( fieldName.equals( EtiquetasDataAuto.ALTURA ) ) + { + return altura; + } + else if( fieldName.equals( EtiquetasDataAuto.LARGURA ) ) + { + return largura; + } + else if( fieldName.equals( EtiquetasDataAuto.MARGEM_ESQUERDA ) ) + { + return margem_esquerda; + } + else if( fieldName.equals( EtiquetasDataAuto.MARGEM_CIMA ) ) + { + return margem_cima; + } + else if( fieldName.equals( EtiquetasDataAuto.COLUNAS ) ) + { + return colunas; + } + else if( fieldName.equals( EtiquetasDataAuto.LINHAS ) ) + { + return linhas; + } + else if( fieldName.equals( EtiquetasDataAuto.CONTINUA ) ) + { + return continua; + } + else if( fieldName.equals( EtiquetasDataAuto.ALTURA_FOLHA ) ) + { + return altura_folha; + } + else if( fieldName.equals( EtiquetasDataAuto.LARGURA_FOLHA ) ) + { + return largura_folha; + } + else if( fieldName.equals( EtiquetasDataAuto.MARGEM_VERTICAL_FOLHA ) ) + { + return margem_vertical_folha; + } + else if( fieldName.equals( EtiquetasDataAuto.MARGEM_HORIZONTAL_FOLHA ) ) + { + return margem_horizontal_folha; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == EtiquetasDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == EtiquetasDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == EtiquetasDataAuto.DESCRICAO_PLAIN ) + { + descricao_plain = ( String ) value; + } + else if( fieldName == EtiquetasDataAuto.ALTURA ) + { + altura = ( Double ) value; + } + else if( fieldName == EtiquetasDataAuto.LARGURA ) + { + largura = ( Double ) value; + } + else if( fieldName == EtiquetasDataAuto.MARGEM_ESQUERDA ) + { + margem_esquerda = ( Double ) value; + } + else if( fieldName == EtiquetasDataAuto.MARGEM_CIMA ) + { + margem_cima = ( Double ) value; + } + else if( fieldName == EtiquetasDataAuto.COLUNAS ) + { + colunas = ( Integer ) value; + } + else if( fieldName == EtiquetasDataAuto.LINHAS ) + { + linhas = ( Integer ) value; + } + else if( fieldName == EtiquetasDataAuto.CONTINUA ) + { + continua = ( String ) value; + } + else if( fieldName == EtiquetasDataAuto.ALTURA_FOLHA ) + { + altura_folha = ( Double ) value; + } + else if( fieldName == EtiquetasDataAuto.LARGURA_FOLHA ) + { + largura_folha = ( Double ) value; + } + else if( fieldName == EtiquetasDataAuto.MARGEM_VERTICAL_FOLHA ) + { + margem_vertical_folha = ( Double ) value; + } + else if( fieldName == EtiquetasDataAuto.MARGEM_HORIZONTAL_FOLHA ) + { + margem_horizontal_folha = ( Double ) value; + } + else if( fieldName.equals( EtiquetasDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( EtiquetasDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( EtiquetasDataAuto.DESCRICAO_PLAIN ) ) + { + descricao_plain = ( String ) value; + } + else if( fieldName.equals( EtiquetasDataAuto.ALTURA ) ) + { + altura = ( Double ) value; + } + else if( fieldName.equals( EtiquetasDataAuto.LARGURA ) ) + { + largura = ( Double ) value; + } + else if( fieldName.equals( EtiquetasDataAuto.MARGEM_ESQUERDA ) ) + { + margem_esquerda = ( Double ) value; + } + else if( fieldName.equals( EtiquetasDataAuto.MARGEM_CIMA ) ) + { + margem_cima = ( Double ) value; + } + else if( fieldName.equals( EtiquetasDataAuto.COLUNAS ) ) + { + colunas = ( Integer ) value; + } + else if( fieldName.equals( EtiquetasDataAuto.LINHAS ) ) + { + linhas = ( Integer ) value; + } + else if( fieldName.equals( EtiquetasDataAuto.CONTINUA ) ) + { + continua = ( String ) value; + } + else if( fieldName.equals( EtiquetasDataAuto.ALTURA_FOLHA ) ) + { + altura_folha = ( Double ) value; + } + else if( fieldName.equals( EtiquetasDataAuto.LARGURA_FOLHA ) ) + { + largura_folha = ( Double ) value; + } + else if( fieldName.equals( EtiquetasDataAuto.MARGEM_VERTICAL_FOLHA ) ) + { + margem_vertical_folha = ( Double ) value; + } + else if( fieldName.equals( EtiquetasDataAuto.MARGEM_HORIZONTAL_FOLHA ) ) + { + margem_horizontal_folha = ( Double ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public String getDescricao_plain() + { + return descricao_plain; + } + + public void setDescricao_plain(String descricao_plainValue ) + { + this.descricao_plain = descricao_plainValue; + } + + public Double getAltura() + { + return altura; + } + + public void setAltura(Double alturaValue ) + { + this.altura = alturaValue; + } + + public Double getLargura() + { + return largura; + } + + public void setLargura(Double larguraValue ) + { + this.largura = larguraValue; + } + + public Double getMargem_esquerda() + { + return margem_esquerda; + } + + public void setMargem_esquerda(Double margem_esquerdaValue ) + { + this.margem_esquerda = margem_esquerdaValue; + } + + public Double getMargem_cima() + { + return margem_cima; + } + + public void setMargem_cima(Double margem_cimaValue ) + { + this.margem_cima = margem_cimaValue; + } + + public Integer getColunas() + { + return colunas; + } + + public void setColunas(Integer colunasValue ) + { + this.colunas = colunasValue; + } + + public Integer getLinhas() + { + return linhas; + } + + public void setLinhas(Integer linhasValue ) + { + this.linhas = linhasValue; + } + + public String getContinua() + { + return continua; + } + + public void setContinua(String continuaValue ) + { + this.continua = continuaValue; + } + + public Double getAltura_folha() + { + return altura_folha; + } + + public void setAltura_folha(Double altura_folhaValue ) + { + this.altura_folha = altura_folhaValue; + } + + public Double getLargura_folha() + { + return largura_folha; + } + + public void setLargura_folha(Double largura_folhaValue ) + { + this.largura_folha = largura_folhaValue; + } + + public Double getMargem_vertical_folha() + { + return margem_vertical_folha; + } + + public void setMargem_vertical_folha(Double margem_vertical_folhaValue ) + { + this.margem_vertical_folha = margem_vertical_folhaValue; + } + + public Double getMargem_horizontal_folha() + { + return margem_horizontal_folha; + } + + public void setMargem_horizontal_folha(Double margem_horizontal_folhaValue ) + { + this.margem_horizontal_folha = margem_horizontal_folhaValue; + } + + public Class getOuterClass() + { + return EtiquetasDataAuto.class; + } + + public EtiquetasDataAuto getOuterClassInstance() + { + EtiquetasDataAuto outerObj = new EtiquetasDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EtiquetasData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EtiquetasData.java new file mode 100644 index 00000000..9fcc0122 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EtiquetasData.java @@ -0,0 +1,18 @@ +/* +* EtiquetasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class EtiquetasData extends com.evolute.siprp.server.db.data.siprp_local3.EtiquetasDataAuto +{ + + public EtiquetasData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EtiquetasDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EtiquetasDataAuto.java new file mode 100644 index 00000000..650d0e17 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/EtiquetasDataAuto.java @@ -0,0 +1,243 @@ +/* +* EtiquetasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class EtiquetasDataAuto extends JDOObject +{ + + public static final String TABLENAME = "etiquetas"; + + public static final String ID = "id"; + public static final String ID_FULL = "etiquetas.id"; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "etiquetas.descricao"; + public static final String DESCRICAO_PLAIN = "descricao_plain"; + public static final String DESCRICAO_PLAIN_FULL = "etiquetas.descricao_plain"; + public static final String ALTURA = "altura"; + public static final String ALTURA_FULL = "etiquetas.altura"; + public static final String LARGURA = "largura"; + public static final String LARGURA_FULL = "etiquetas.largura"; + public static final String MARGEM_ESQUERDA = "margem_esquerda"; + public static final String MARGEM_ESQUERDA_FULL = "etiquetas.margem_esquerda"; + public static final String MARGEM_CIMA = "margem_cima"; + public static final String MARGEM_CIMA_FULL = "etiquetas.margem_cima"; + public static final String COLUNAS = "colunas"; + public static final String COLUNAS_FULL = "etiquetas.colunas"; + public static final String LINHAS = "linhas"; + public static final String LINHAS_FULL = "etiquetas.linhas"; + public static final String CONTINUA = "continua"; + public static final String CONTINUA_FULL = "etiquetas.continua"; + public static final String ALTURA_FOLHA = "altura_folha"; + public static final String ALTURA_FOLHA_FULL = "etiquetas.altura_folha"; + public static final String LARGURA_FOLHA = "largura_folha"; + public static final String LARGURA_FOLHA_FULL = "etiquetas.largura_folha"; + public static final String MARGEM_VERTICAL_FOLHA = "margem_vertical_folha"; + public static final String MARGEM_VERTICAL_FOLHA_FULL = "etiquetas.margem_vertical_folha"; + public static final String MARGEM_HORIZONTAL_FOLHA = "margem_horizontal_folha"; + public static final String MARGEM_HORIZONTAL_FOLHA_FULL = "etiquetas.margem_horizontal_folha"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRICAO, DESCRICAO_PLAIN, ALTURA, LARGURA, MARGEM_ESQUERDA, MARGEM_CIMA, COLUNAS, + LINHAS, CONTINUA, ALTURA_FOLHA, LARGURA_FOLHA, MARGEM_VERTICAL_FOLHA, + MARGEM_HORIZONTAL_FOLHA, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DESCRICAO, DESCRICAO_PLAIN, ALTURA, LARGURA, MARGEM_ESQUERDA, MARGEM_CIMA, + COLUNAS, LINHAS, CONTINUA, ALTURA_FOLHA, LARGURA_FOLHA, MARGEM_VERTICAL_FOLHA, + MARGEM_HORIZONTAL_FOLHA, }; + + private Map dataHash; + + public EtiquetasDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + public String getDescricao_plain() + { + return (String) get(DESCRICAO_PLAIN); + } + + public void setDescricao_plain(String descricao_plainValue ) + { + this.set(DESCRICAO_PLAIN, descricao_plainValue ); + } + + public Double getAltura() + { + return (Double) get(ALTURA); + } + + public void setAltura(Double alturaValue ) + { + this.set(ALTURA, alturaValue ); + } + + public Double getLargura() + { + return (Double) get(LARGURA); + } + + public void setLargura(Double larguraValue ) + { + this.set(LARGURA, larguraValue ); + } + + public Double getMargem_esquerda() + { + return (Double) get(MARGEM_ESQUERDA); + } + + public void setMargem_esquerda(Double margem_esquerdaValue ) + { + this.set(MARGEM_ESQUERDA, margem_esquerdaValue ); + } + + public Double getMargem_cima() + { + return (Double) get(MARGEM_CIMA); + } + + public void setMargem_cima(Double margem_cimaValue ) + { + this.set(MARGEM_CIMA, margem_cimaValue ); + } + + public Integer getColunas() + { + return (Integer) get(COLUNAS); + } + + public void setColunas(Integer colunasValue ) + { + this.set(COLUNAS, colunasValue ); + } + + public Integer getLinhas() + { + return (Integer) get(LINHAS); + } + + public void setLinhas(Integer linhasValue ) + { + this.set(LINHAS, linhasValue ); + } + + public String getContinua() + { + return (String) get(CONTINUA); + } + + public void setContinua(String continuaValue ) + { + this.set(CONTINUA, continuaValue ); + } + + public Double getAltura_folha() + { + return (Double) get(ALTURA_FOLHA); + } + + public void setAltura_folha(Double altura_folhaValue ) + { + this.set(ALTURA_FOLHA, altura_folhaValue ); + } + + public Double getLargura_folha() + { + return (Double) get(LARGURA_FOLHA); + } + + public void setLargura_folha(Double largura_folhaValue ) + { + this.set(LARGURA_FOLHA, largura_folhaValue ); + } + + public Double getMargem_vertical_folha() + { + return (Double) get(MARGEM_VERTICAL_FOLHA); + } + + public void setMargem_vertical_folha(Double margem_vertical_folhaValue ) + { + this.set(MARGEM_VERTICAL_FOLHA, margem_vertical_folhaValue ); + } + + public Double getMargem_horizontal_folha() + { + return (Double) get(MARGEM_HORIZONTAL_FOLHA); + } + + public void setMargem_horizontal_folha(Double margem_horizontal_folhaValue ) + { + this.set(MARGEM_HORIZONTAL_FOLHA, margem_horizontal_folhaValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Etiquetas.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Exames.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Exames.java new file mode 100644 index 00000000..db6ff331 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Exames.java @@ -0,0 +1,507 @@ +/* +* Exames.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class Exames implements JDOInnerObject +{ + private Integer id; + private java.util.Date data; + private Integer tipo; + private Integer ocasional; + private String outro_tipo; + private Integer resultado; + private String outra_funcao_1; + private String outra_funcao_2; + private String outra_funcao_3; + private String outra_funcao_4; + private java.util.Date proximo_exame; + private String outras_recomendacoes; + private String inactivo; + private Integer trabalhador_id; + private Integer medico_id; + private byte[] pdf; + private byte[] fo; + + public Exames() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == ExamesDataAuto.ID ) + { + return id; + } + else if( fieldName == ExamesDataAuto.DATA ) + { + return data; + } + else if( fieldName == ExamesDataAuto.TIPO ) + { + return tipo; + } + else if( fieldName == ExamesDataAuto.OCASIONAL ) + { + return ocasional; + } + else if( fieldName == ExamesDataAuto.OUTRO_TIPO ) + { + return outro_tipo; + } + else if( fieldName == ExamesDataAuto.RESULTADO ) + { + return resultado; + } + else if( fieldName == ExamesDataAuto.OUTRA_FUNCAO_1 ) + { + return outra_funcao_1; + } + else if( fieldName == ExamesDataAuto.OUTRA_FUNCAO_2 ) + { + return outra_funcao_2; + } + else if( fieldName == ExamesDataAuto.OUTRA_FUNCAO_3 ) + { + return outra_funcao_3; + } + else if( fieldName == ExamesDataAuto.OUTRA_FUNCAO_4 ) + { + return outra_funcao_4; + } + else if( fieldName == ExamesDataAuto.PROXIMO_EXAME ) + { + return proximo_exame; + } + else if( fieldName == ExamesDataAuto.OUTRAS_RECOMENDACOES ) + { + return outras_recomendacoes; + } + else if( fieldName == ExamesDataAuto.INACTIVO ) + { + return inactivo; + } + else if( fieldName == ExamesDataAuto.TRABALHADOR_ID ) + { + return trabalhador_id; + } + else if( fieldName == ExamesDataAuto.MEDICO_ID ) + { + return medico_id; + } + else if( fieldName == ExamesDataAuto.PDF ) + { + return pdf; + } + else if( fieldName == ExamesDataAuto.FO ) + { + return fo; + } + else if( fieldName.equals( ExamesDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( ExamesDataAuto.DATA ) ) + { + return data; + } + else if( fieldName.equals( ExamesDataAuto.TIPO ) ) + { + return tipo; + } + else if( fieldName.equals( ExamesDataAuto.OCASIONAL ) ) + { + return ocasional; + } + else if( fieldName.equals( ExamesDataAuto.OUTRO_TIPO ) ) + { + return outro_tipo; + } + else if( fieldName.equals( ExamesDataAuto.RESULTADO ) ) + { + return resultado; + } + else if( fieldName.equals( ExamesDataAuto.OUTRA_FUNCAO_1 ) ) + { + return outra_funcao_1; + } + else if( fieldName.equals( ExamesDataAuto.OUTRA_FUNCAO_2 ) ) + { + return outra_funcao_2; + } + else if( fieldName.equals( ExamesDataAuto.OUTRA_FUNCAO_3 ) ) + { + return outra_funcao_3; + } + else if( fieldName.equals( ExamesDataAuto.OUTRA_FUNCAO_4 ) ) + { + return outra_funcao_4; + } + else if( fieldName.equals( ExamesDataAuto.PROXIMO_EXAME ) ) + { + return proximo_exame; + } + else if( fieldName.equals( ExamesDataAuto.OUTRAS_RECOMENDACOES ) ) + { + return outras_recomendacoes; + } + else if( fieldName.equals( ExamesDataAuto.INACTIVO ) ) + { + return inactivo; + } + else if( fieldName.equals( ExamesDataAuto.TRABALHADOR_ID ) ) + { + return trabalhador_id; + } + else if( fieldName.equals( ExamesDataAuto.MEDICO_ID ) ) + { + return medico_id; + } + else if( fieldName.equals( ExamesDataAuto.PDF ) ) + { + return pdf; + } + else if( fieldName.equals( ExamesDataAuto.FO ) ) + { + return fo; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == ExamesDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == ExamesDataAuto.DATA ) + { + data = ( java.util.Date ) value; + } + else if( fieldName == ExamesDataAuto.TIPO ) + { + tipo = ( Integer ) value; + } + else if( fieldName == ExamesDataAuto.OCASIONAL ) + { + ocasional = ( Integer ) value; + } + else if( fieldName == ExamesDataAuto.OUTRO_TIPO ) + { + outro_tipo = ( String ) value; + } + else if( fieldName == ExamesDataAuto.RESULTADO ) + { + resultado = ( Integer ) value; + } + else if( fieldName == ExamesDataAuto.OUTRA_FUNCAO_1 ) + { + outra_funcao_1 = ( String ) value; + } + else if( fieldName == ExamesDataAuto.OUTRA_FUNCAO_2 ) + { + outra_funcao_2 = ( String ) value; + } + else if( fieldName == ExamesDataAuto.OUTRA_FUNCAO_3 ) + { + outra_funcao_3 = ( String ) value; + } + else if( fieldName == ExamesDataAuto.OUTRA_FUNCAO_4 ) + { + outra_funcao_4 = ( String ) value; + } + else if( fieldName == ExamesDataAuto.PROXIMO_EXAME ) + { + proximo_exame = ( java.util.Date ) value; + } + else if( fieldName == ExamesDataAuto.OUTRAS_RECOMENDACOES ) + { + outras_recomendacoes = ( String ) value; + } + else if( fieldName == ExamesDataAuto.INACTIVO ) + { + inactivo = ( String ) value; + } + else if( fieldName == ExamesDataAuto.TRABALHADOR_ID ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName == ExamesDataAuto.MEDICO_ID ) + { + medico_id = ( Integer ) value; + } + else if( fieldName == ExamesDataAuto.PDF ) + { + pdf = ( byte[] ) value; + } + else if( fieldName == ExamesDataAuto.FO ) + { + fo = ( byte[] ) value; + } + else if( fieldName.equals( ExamesDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( ExamesDataAuto.DATA ) ) + { + data = ( java.util.Date ) value; + } + else if( fieldName.equals( ExamesDataAuto.TIPO ) ) + { + tipo = ( Integer ) value; + } + else if( fieldName.equals( ExamesDataAuto.OCASIONAL ) ) + { + ocasional = ( Integer ) value; + } + else if( fieldName.equals( ExamesDataAuto.OUTRO_TIPO ) ) + { + outro_tipo = ( String ) value; + } + else if( fieldName.equals( ExamesDataAuto.RESULTADO ) ) + { + resultado = ( Integer ) value; + } + else if( fieldName.equals( ExamesDataAuto.OUTRA_FUNCAO_1 ) ) + { + outra_funcao_1 = ( String ) value; + } + else if( fieldName.equals( ExamesDataAuto.OUTRA_FUNCAO_2 ) ) + { + outra_funcao_2 = ( String ) value; + } + else if( fieldName.equals( ExamesDataAuto.OUTRA_FUNCAO_3 ) ) + { + outra_funcao_3 = ( String ) value; + } + else if( fieldName.equals( ExamesDataAuto.OUTRA_FUNCAO_4 ) ) + { + outra_funcao_4 = ( String ) value; + } + else if( fieldName.equals( ExamesDataAuto.PROXIMO_EXAME ) ) + { + proximo_exame = ( java.util.Date ) value; + } + else if( fieldName.equals( ExamesDataAuto.OUTRAS_RECOMENDACOES ) ) + { + outras_recomendacoes = ( String ) value; + } + else if( fieldName.equals( ExamesDataAuto.INACTIVO ) ) + { + inactivo = ( String ) value; + } + else if( fieldName.equals( ExamesDataAuto.TRABALHADOR_ID ) ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName.equals( ExamesDataAuto.MEDICO_ID ) ) + { + medico_id = ( Integer ) value; + } + else if( fieldName.equals( ExamesDataAuto.PDF ) ) + { + pdf = ( byte[] ) value; + } + else if( fieldName.equals( ExamesDataAuto.FO ) ) + { + fo = ( byte[] ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public java.util.Date getData() + { + return data; + } + + public void setData(java.util.Date dataValue ) + { + this.data = dataValue; + } + + public Integer getTipo() + { + return tipo; + } + + public void setTipo(Integer tipoValue ) + { + this.tipo = tipoValue; + } + + public Integer getOcasional() + { + return ocasional; + } + + public void setOcasional(Integer ocasionalValue ) + { + this.ocasional = ocasionalValue; + } + + public String getOutro_tipo() + { + return outro_tipo; + } + + public void setOutro_tipo(String outro_tipoValue ) + { + this.outro_tipo = outro_tipoValue; + } + + public Integer getResultado() + { + return resultado; + } + + public void setResultado(Integer resultadoValue ) + { + this.resultado = resultadoValue; + } + + public String getOutra_funcao_1() + { + return outra_funcao_1; + } + + public void setOutra_funcao_1(String outra_funcao_1Value ) + { + this.outra_funcao_1 = outra_funcao_1Value; + } + + public String getOutra_funcao_2() + { + return outra_funcao_2; + } + + public void setOutra_funcao_2(String outra_funcao_2Value ) + { + this.outra_funcao_2 = outra_funcao_2Value; + } + + public String getOutra_funcao_3() + { + return outra_funcao_3; + } + + public void setOutra_funcao_3(String outra_funcao_3Value ) + { + this.outra_funcao_3 = outra_funcao_3Value; + } + + public String getOutra_funcao_4() + { + return outra_funcao_4; + } + + public void setOutra_funcao_4(String outra_funcao_4Value ) + { + this.outra_funcao_4 = outra_funcao_4Value; + } + + public java.util.Date getProximo_exame() + { + return proximo_exame; + } + + public void setProximo_exame(java.util.Date proximo_exameValue ) + { + this.proximo_exame = proximo_exameValue; + } + + public String getOutras_recomendacoes() + { + return outras_recomendacoes; + } + + public void setOutras_recomendacoes(String outras_recomendacoesValue ) + { + this.outras_recomendacoes = outras_recomendacoesValue; + } + + public String getInactivo() + { + return inactivo; + } + + public void setInactivo(String inactivoValue ) + { + this.inactivo = inactivoValue; + } + + public Integer getTrabalhador_id() + { + return trabalhador_id; + } + + public void setTrabalhador_id(Integer trabalhador_idValue ) + { + this.trabalhador_id = trabalhador_idValue; + } + + public Integer getMedico_id() + { + return medico_id; + } + + public void setMedico_id(Integer medico_idValue ) + { + this.medico_id = medico_idValue; + } + + public byte[] getPdf() + { + return pdf; + } + + public void setPdf(byte[] pdfValue ) + { + this.pdf = pdfValue; + } + + public byte[] getFo() + { + return fo; + } + + public void setFo(byte[] foValue ) + { + this.fo = foValue; + } + + public Class getOuterClass() + { + return ExamesDataAuto.class; + } + + public ExamesDataAuto getOuterClassInstance() + { + ExamesDataAuto outerObj = new ExamesDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesData.java new file mode 100644 index 00000000..020efe58 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesData.java @@ -0,0 +1,18 @@ +/* +* ExamesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class ExamesData extends com.evolute.siprp.server.db.data.siprp_local3.ExamesDataAuto +{ + + public ExamesData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesDataAuto.java new file mode 100644 index 00000000..7e6e54c6 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesDataAuto.java @@ -0,0 +1,338 @@ +/* +* ExamesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class ExamesDataAuto extends JDOObject +{ + + public static final String TABLENAME = "exames"; + + public static final String ID = "id"; + public static final String ID_FULL = "exames.id"; + public static final String DATA = "data"; + public static final String DATA_FULL = "exames.data"; + public static final String TIPO = "tipo"; + public static final String TIPO_FULL = "exames.tipo"; + public static final String OCASIONAL = "ocasional"; + public static final String OCASIONAL_FULL = "exames.ocasional"; + public static final String OUTRO_TIPO = "outro_tipo"; + public static final String OUTRO_TIPO_FULL = "exames.outro_tipo"; + public static final String RESULTADO = "resultado"; + public static final String RESULTADO_FULL = "exames.resultado"; + public static final String OUTRA_FUNCAO_1 = "outra_funcao_1"; + public static final String OUTRA_FUNCAO_1_FULL = "exames.outra_funcao_1"; + public static final String OUTRA_FUNCAO_2 = "outra_funcao_2"; + public static final String OUTRA_FUNCAO_2_FULL = "exames.outra_funcao_2"; + public static final String OUTRA_FUNCAO_3 = "outra_funcao_3"; + public static final String OUTRA_FUNCAO_3_FULL = "exames.outra_funcao_3"; + public static final String OUTRA_FUNCAO_4 = "outra_funcao_4"; + public static final String OUTRA_FUNCAO_4_FULL = "exames.outra_funcao_4"; + public static final String PROXIMO_EXAME = "proximo_exame"; + public static final String PROXIMO_EXAME_FULL = "exames.proximo_exame"; + public static final String OUTRAS_RECOMENDACOES = "outras_recomendacoes"; + public static final String OUTRAS_RECOMENDACOES_FULL = "exames.outras_recomendacoes"; + public static final String INACTIVO = "inactivo"; + public static final String INACTIVO_FULL = "exames.inactivo"; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String TRABALHADOR_ID_FULL = "exames.trabalhador_id"; + public static final String MEDICO_ID = "medico_id"; + public static final String MEDICO_ID_FULL = "exames.medico_id"; + public static final String TO_MEDICO_ID = "to medico_id"; + public static final String PDF = "pdf"; + public static final String PDF_FULL = "exames.pdf"; + public static final String FO = "fo"; + public static final String FO_FULL = "exames.fo"; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, TIPO, OCASIONAL, OUTRO_TIPO, RESULTADO, OUTRA_FUNCAO_1, OUTRA_FUNCAO_2, + OUTRA_FUNCAO_3, OUTRA_FUNCAO_4, PROXIMO_EXAME, OUTRAS_RECOMENDACOES, INACTIVO, + TRABALHADOR_ID, MEDICO_ID, TO_MEDICO_ID, PDF, FO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATA, TIPO, OCASIONAL, OUTRO_TIPO, RESULTADO, OUTRA_FUNCAO_1, OUTRA_FUNCAO_2, + OUTRA_FUNCAO_3, OUTRA_FUNCAO_4, PROXIMO_EXAME, OUTRAS_RECOMENDACOES, INACTIVO, + TRABALHADOR_ID, MEDICO_ID, PDF, FO, }; + + private Map dataHash; + + public ExamesDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public java.util.Date getData() + { + return (java.util.Date) get(DATA); + } + + public void setData(java.util.Date dataValue ) + { + this.set(DATA, dataValue ); + } + + public Integer getTipo() + { + return (Integer) get(TIPO); + } + + public void setTipo(Integer tipoValue ) + { + this.set(TIPO, tipoValue ); + } + + public Integer getOcasional() + { + return (Integer) get(OCASIONAL); + } + + public void setOcasional(Integer ocasionalValue ) + { + this.set(OCASIONAL, ocasionalValue ); + } + + public String getOutro_tipo() + { + return (String) get(OUTRO_TIPO); + } + + public void setOutro_tipo(String outro_tipoValue ) + { + this.set(OUTRO_TIPO, outro_tipoValue ); + } + + public Integer getResultado() + { + return (Integer) get(RESULTADO); + } + + public void setResultado(Integer resultadoValue ) + { + this.set(RESULTADO, resultadoValue ); + } + + public String getOutra_funcao_1() + { + return (String) get(OUTRA_FUNCAO_1); + } + + public void setOutra_funcao_1(String outra_funcao_1Value ) + { + this.set(OUTRA_FUNCAO_1, outra_funcao_1Value ); + } + + public String getOutra_funcao_2() + { + return (String) get(OUTRA_FUNCAO_2); + } + + public void setOutra_funcao_2(String outra_funcao_2Value ) + { + this.set(OUTRA_FUNCAO_2, outra_funcao_2Value ); + } + + public String getOutra_funcao_3() + { + return (String) get(OUTRA_FUNCAO_3); + } + + public void setOutra_funcao_3(String outra_funcao_3Value ) + { + this.set(OUTRA_FUNCAO_3, outra_funcao_3Value ); + } + + public String getOutra_funcao_4() + { + return (String) get(OUTRA_FUNCAO_4); + } + + public void setOutra_funcao_4(String outra_funcao_4Value ) + { + this.set(OUTRA_FUNCAO_4, outra_funcao_4Value ); + } + + public java.util.Date getProximo_exame() + { + return (java.util.Date) get(PROXIMO_EXAME); + } + + public void setProximo_exame(java.util.Date proximo_exameValue ) + { + this.set(PROXIMO_EXAME, proximo_exameValue ); + } + + public String getOutras_recomendacoes() + { + return (String) get(OUTRAS_RECOMENDACOES); + } + + public void setOutras_recomendacoes(String outras_recomendacoesValue ) + { + this.set(OUTRAS_RECOMENDACOES, outras_recomendacoesValue ); + } + + public String getInactivo() + { + return (String) get(INACTIVO); + } + + public void setInactivo(String inactivoValue ) + { + this.set(INACTIVO, inactivoValue ); + } + + public Integer getTrabalhador_id() + { + return (Integer) get(TRABALHADOR_ID); + } + + public void setTrabalhador_id(Integer trabalhador_idValue ) + { + this.set(TRABALHADOR_ID, trabalhador_idValue ); + } + + public Integer getMedico_id() + { + return (Integer) dataHash.get(MEDICO_ID); + } + + public void setMedico_id(Integer medico_idValue ) + { + dataHash.put(TO_MEDICO_ID, null); + dataHash.put(MEDICO_ID, medico_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.MedicosData toMedico_id() + throws Exception + { + if( dataHash.get(TO_MEDICO_ID) == null && getMedico_id() != null ) + { + dataHash.put(TO_MEDICO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.MedicosData.class, new Object[]{ getMedico_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.MedicosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.MedicosData) dataHash.get(TO_MEDICO_ID); + } + + public void setToMedico_id(com.evolute.siprp.server.db.data.siprp_local3.MedicosData medico_idObject ) + { + if( medico_idObject == null ) + { + dataHash.put(MEDICO_ID, null); + } + else + { + dataHash.put(MEDICO_ID, medico_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.MedicosData.ID )); + } + dataHash.put(TO_MEDICO_ID, medico_idObject); + } + + public byte[] getPdf() + { + return (byte[]) get(PDF); + } + + public void setPdf(byte[] pdfValue ) + { + this.set(PDF, pdfValue ); + } + + public byte[] getFo() + { + return (byte[]) get(FO); + } + + public void setFo(byte[] foValue ) + { + this.set(FO, foValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_MEDICO_ID.equals( fieldName ) ) + { + value = toMedico_id(); + } + else if( MEDICO_ID.equals( fieldName ) ) + { + value = getMedico_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_MEDICO_ID.equals( fieldName ) ) + { + setToMedico_id( (com.evolute.siprp.server.db.data.siprp_local3.MedicosData) value ); + } + else if( MEDICO_ID.equals( fieldName ) ) + { + setMedico_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_MEDICO_ID) != null ) + { + toMedico_id().save(); + dataHash.put(MEDICO_ID, toMedico_id().get( com.evolute.siprp.server.db.data.siprp_local3.MedicosData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Exames.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPerfis.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPerfis.java new file mode 100644 index 00000000..831d47ab --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPerfis.java @@ -0,0 +1,156 @@ +/* +* ExamesPerfis.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class ExamesPerfis implements JDOInnerObject +{ + private Integer id; + private Integer perfil; + private Integer tipo; + private Integer multiplicador; + + public ExamesPerfis() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == ExamesPerfisDataAuto.ID ) + { + return id; + } + else if( fieldName == ExamesPerfisDataAuto.PERFIL ) + { + return perfil; + } + else if( fieldName == ExamesPerfisDataAuto.TIPO ) + { + return tipo; + } + else if( fieldName == ExamesPerfisDataAuto.MULTIPLICADOR ) + { + return multiplicador; + } + else if( fieldName.equals( ExamesPerfisDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( ExamesPerfisDataAuto.PERFIL ) ) + { + return perfil; + } + else if( fieldName.equals( ExamesPerfisDataAuto.TIPO ) ) + { + return tipo; + } + else if( fieldName.equals( ExamesPerfisDataAuto.MULTIPLICADOR ) ) + { + return multiplicador; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == ExamesPerfisDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == ExamesPerfisDataAuto.PERFIL ) + { + perfil = ( Integer ) value; + } + else if( fieldName == ExamesPerfisDataAuto.TIPO ) + { + tipo = ( Integer ) value; + } + else if( fieldName == ExamesPerfisDataAuto.MULTIPLICADOR ) + { + multiplicador = ( Integer ) value; + } + else if( fieldName.equals( ExamesPerfisDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( ExamesPerfisDataAuto.PERFIL ) ) + { + perfil = ( Integer ) value; + } + else if( fieldName.equals( ExamesPerfisDataAuto.TIPO ) ) + { + tipo = ( Integer ) value; + } + else if( fieldName.equals( ExamesPerfisDataAuto.MULTIPLICADOR ) ) + { + multiplicador = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getPerfil() + { + return perfil; + } + + public void setPerfil(Integer perfilValue ) + { + this.perfil = perfilValue; + } + + public Integer getTipo() + { + return tipo; + } + + public void setTipo(Integer tipoValue ) + { + this.tipo = tipoValue; + } + + public Integer getMultiplicador() + { + return multiplicador; + } + + public void setMultiplicador(Integer multiplicadorValue ) + { + this.multiplicador = multiplicadorValue; + } + + public Class getOuterClass() + { + return ExamesPerfisDataAuto.class; + } + + public ExamesPerfisDataAuto getOuterClassInstance() + { + ExamesPerfisDataAuto outerObj = new ExamesPerfisDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPerfisData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPerfisData.java new file mode 100644 index 00000000..f3926b39 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPerfisData.java @@ -0,0 +1,18 @@ +/* +* ExamesPerfisDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class ExamesPerfisData extends com.evolute.siprp.server.db.data.siprp_local3.ExamesPerfisDataAuto +{ + + public ExamesPerfisData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPerfisDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPerfisDataAuto.java new file mode 100644 index 00000000..75953d60 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPerfisDataAuto.java @@ -0,0 +1,178 @@ +/* +* ExamesPerfisDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class ExamesPerfisDataAuto extends JDOObject +{ + + public static final String TABLENAME = "exames_perfis"; + + public static final String ID = "id"; + public static final String ID_FULL = "exames_perfis.id"; + public static final String PERFIL = "perfil"; + public static final String PERFIL_FULL = "exames_perfis.perfil"; + public static final String TIPO = "tipo"; + public static final String TIPO_FULL = "exames_perfis.tipo"; + public static final String TO_TIPO = "to tipo"; + public static final String MULTIPLICADOR = "multiplicador"; + public static final String MULTIPLICADOR_FULL = "exames_perfis.multiplicador"; + + public static final String FIELD_NAMES[] = new String[]{ + PERFIL, TIPO, TO_TIPO, MULTIPLICADOR, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, PERFIL, TIPO, MULTIPLICADOR, }; + + private Map dataHash; + + public ExamesPerfisDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getPerfil() + { + return (Integer) get(PERFIL); + } + + public void setPerfil(Integer perfilValue ) + { + this.set(PERFIL, perfilValue ); + } + + public Integer getTipo() + { + return (Integer) dataHash.get(TIPO); + } + + public void setTipo(Integer tipoValue ) + { + dataHash.put(TO_TIPO, null); + dataHash.put(TIPO, tipoValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.TiposExamesCompData toTipo() + throws Exception + { + if( dataHash.get(TO_TIPO) == null && getTipo() != null ) + { + dataHash.put(TO_TIPO, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.TiposExamesCompData.class, new Object[]{ getTipo() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.TiposExamesCompData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.TiposExamesCompData) dataHash.get(TO_TIPO); + } + + public void setToTipo(com.evolute.siprp.server.db.data.siprp_local3.TiposExamesCompData tipoObject ) + { + if( tipoObject == null ) + { + dataHash.put(TIPO, null); + } + else + { + dataHash.put(TIPO, tipoObject.get( com.evolute.siprp.server.db.data.siprp_local3.TiposExamesCompData.ID )); + } + dataHash.put(TO_TIPO, tipoObject); + } + + public Integer getMultiplicador() + { + return (Integer) get(MULTIPLICADOR); + } + + public void setMultiplicador(Integer multiplicadorValue ) + { + this.set(MULTIPLICADOR, multiplicadorValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TIPO.equals( fieldName ) ) + { + value = getTipo(); + } + else if( TO_TIPO.equals( fieldName ) ) + { + value = toTipo(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TIPO.equals( fieldName ) ) + { + setTipo( (Integer) value ); + } + else if( TO_TIPO.equals( fieldName ) ) + { + setToTipo( (com.evolute.siprp.server.db.data.siprp_local3.TiposExamesCompData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_TIPO) != null ) + { + toTipo().save(); + dataHash.put(TIPO, toTipo().get( com.evolute.siprp.server.db.data.siprp_local3.TiposExamesCompData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return ExamesPerfis.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPortaria.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPortaria.java new file mode 100644 index 00000000..e02bd930 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPortaria.java @@ -0,0 +1,129 @@ +/* +* ExamesPortaria.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class ExamesPortaria implements JDOInnerObject +{ + private Integer id; + private String portaria; + private java.sql.Timestamp data_entrada; + + public ExamesPortaria() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == ExamesPortariaDataAuto.ID ) + { + return id; + } + else if( fieldName == ExamesPortariaDataAuto.PORTARIA ) + { + return portaria; + } + else if( fieldName == ExamesPortariaDataAuto.DATA_ENTRADA ) + { + return data_entrada; + } + else if( fieldName.equals( ExamesPortariaDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( ExamesPortariaDataAuto.PORTARIA ) ) + { + return portaria; + } + else if( fieldName.equals( ExamesPortariaDataAuto.DATA_ENTRADA ) ) + { + return data_entrada; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == ExamesPortariaDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == ExamesPortariaDataAuto.PORTARIA ) + { + portaria = ( String ) value; + } + else if( fieldName == ExamesPortariaDataAuto.DATA_ENTRADA ) + { + data_entrada = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( ExamesPortariaDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( ExamesPortariaDataAuto.PORTARIA ) ) + { + portaria = ( String ) value; + } + else if( fieldName.equals( ExamesPortariaDataAuto.DATA_ENTRADA ) ) + { + data_entrada = ( java.sql.Timestamp ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getPortaria() + { + return portaria; + } + + public void setPortaria(String portariaValue ) + { + this.portaria = portariaValue; + } + + public java.sql.Timestamp getData_entrada() + { + return data_entrada; + } + + public void setData_entrada(java.sql.Timestamp data_entradaValue ) + { + this.data_entrada = data_entradaValue; + } + + public Class getOuterClass() + { + return ExamesPortariaDataAuto.class; + } + + public ExamesPortariaDataAuto getOuterClassInstance() + { + ExamesPortariaDataAuto outerObj = new ExamesPortariaDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPortariaData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPortariaData.java new file mode 100644 index 00000000..cada00a5 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPortariaData.java @@ -0,0 +1,18 @@ +/* +* ExamesPortariaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class ExamesPortariaData extends com.evolute.siprp.server.db.data.siprp_local3.ExamesPortariaDataAuto +{ + + public ExamesPortariaData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPortariaDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPortariaDataAuto.java new file mode 100644 index 00000000..16c2c1c9 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ExamesPortariaDataAuto.java @@ -0,0 +1,107 @@ +/* +* ExamesPortariaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class ExamesPortariaDataAuto extends JDOObject +{ + + public static final String TABLENAME = "exames_portaria"; + + public static final String ID = "id"; + public static final String ID_FULL = "exames_portaria.id"; + public static final String PORTARIA = "portaria"; + public static final String PORTARIA_FULL = "exames_portaria.portaria"; + public static final String DATA_ENTRADA = "data_entrada"; + public static final String DATA_ENTRADA_FULL = "exames_portaria.data_entrada"; + + public static final String FIELD_NAMES[] = new String[]{ + PORTARIA, DATA_ENTRADA, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, PORTARIA, DATA_ENTRADA, }; + + private Map dataHash; + + public ExamesPortariaDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getPortaria() + { + return (String) get(PORTARIA); + } + + public void setPortaria(String portariaValue ) + { + this.set(PORTARIA, portariaValue ); + } + + public java.sql.Timestamp getData_entrada() + { + return (java.sql.Timestamp) get(DATA_ENTRADA); + } + + public void setData_entrada(java.sql.Timestamp data_entradaValue ) + { + this.set(DATA_ENTRADA, data_entradaValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return ExamesPortaria.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HistoricoEstabelecimento.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HistoricoEstabelecimento.java new file mode 100644 index 00000000..4c42d13b --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HistoricoEstabelecimento.java @@ -0,0 +1,156 @@ +/* +* HistoricoEstabelecimento.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HistoricoEstabelecimento implements JDOInnerObject +{ + private Integer id; + private Integer estabelecimento_id; + private java.util.Date data; + private String texto; + + public HistoricoEstabelecimento() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HistoricoEstabelecimentoDataAuto.ID ) + { + return id; + } + else if( fieldName == HistoricoEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) + { + return estabelecimento_id; + } + else if( fieldName == HistoricoEstabelecimentoDataAuto.DATA ) + { + return data; + } + else if( fieldName == HistoricoEstabelecimentoDataAuto.TEXTO ) + { + return texto; + } + else if( fieldName.equals( HistoricoEstabelecimentoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HistoricoEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) ) + { + return estabelecimento_id; + } + else if( fieldName.equals( HistoricoEstabelecimentoDataAuto.DATA ) ) + { + return data; + } + else if( fieldName.equals( HistoricoEstabelecimentoDataAuto.TEXTO ) ) + { + return texto; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HistoricoEstabelecimentoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HistoricoEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName == HistoricoEstabelecimentoDataAuto.DATA ) + { + data = ( java.util.Date ) value; + } + else if( fieldName == HistoricoEstabelecimentoDataAuto.TEXTO ) + { + texto = ( String ) value; + } + else if( fieldName.equals( HistoricoEstabelecimentoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HistoricoEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName.equals( HistoricoEstabelecimentoDataAuto.DATA ) ) + { + data = ( java.util.Date ) value; + } + else if( fieldName.equals( HistoricoEstabelecimentoDataAuto.TEXTO ) ) + { + texto = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getEstabelecimento_id() + { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + this.estabelecimento_id = estabelecimento_idValue; + } + + public java.util.Date getData() + { + return data; + } + + public void setData(java.util.Date dataValue ) + { + this.data = dataValue; + } + + public String getTexto() + { + return texto; + } + + public void setTexto(String textoValue ) + { + this.texto = textoValue; + } + + public Class getOuterClass() + { + return HistoricoEstabelecimentoDataAuto.class; + } + + public HistoricoEstabelecimentoDataAuto getOuterClassInstance() + { + HistoricoEstabelecimentoDataAuto outerObj = new HistoricoEstabelecimentoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HistoricoEstabelecimentoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HistoricoEstabelecimentoData.java new file mode 100644 index 00000000..d4b80f87 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HistoricoEstabelecimentoData.java @@ -0,0 +1,18 @@ +/* +* HistoricoEstabelecimentoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HistoricoEstabelecimentoData extends com.evolute.siprp.server.db.data.siprp_local3.HistoricoEstabelecimentoDataAuto +{ + + public HistoricoEstabelecimentoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HistoricoEstabelecimentoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HistoricoEstabelecimentoDataAuto.java new file mode 100644 index 00000000..a73cdcf0 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HistoricoEstabelecimentoDataAuto.java @@ -0,0 +1,178 @@ +/* +* HistoricoEstabelecimentoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HistoricoEstabelecimentoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "historico_estabelecimento"; + + public static final String ID = "id"; + public static final String ID_FULL = "historico_estabelecimento.id"; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "historico_estabelecimento.estabelecimento_id"; + public static final String TO_ESTABELECIMENTO_ID = "to estabelecimento_id"; + public static final String DATA = "data"; + public static final String DATA_FULL = "historico_estabelecimento.data"; + public static final String TEXTO = "texto"; + public static final String TEXTO_FULL = "historico_estabelecimento.texto"; + + public static final String FIELD_NAMES[] = new String[]{ + ESTABELECIMENTO_ID, TO_ESTABELECIMENTO_ID, DATA, TEXTO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, ESTABELECIMENTO_ID, DATA, TEXTO, }; + + private Map dataHash; + + public HistoricoEstabelecimentoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getEstabelecimento_id() + { + return (Integer) dataHash.get(ESTABELECIMENTO_ID); + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, null); + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData toEstabelecimento_id() + throws Exception + { + if( dataHash.get(TO_ESTABELECIMENTO_ID) == null && getEstabelecimento_id() != null ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.class, new Object[]{ getEstabelecimento_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) dataHash.get(TO_ESTABELECIMENTO_ID); + } + + public void setToEstabelecimento_id(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData estabelecimento_idObject ) + { + if( estabelecimento_idObject == null ) + { + dataHash.put(ESTABELECIMENTO_ID, null); + } + else + { + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + dataHash.put(TO_ESTABELECIMENTO_ID, estabelecimento_idObject); + } + + public java.util.Date getData() + { + return (java.util.Date) get(DATA); + } + + public void setData(java.util.Date dataValue ) + { + this.set(DATA, dataValue ); + } + + public String getTexto() + { + return (String) get(TEXTO); + } + + public void setTexto(String textoValue ) + { + this.set(TEXTO, textoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = getEstabelecimento_id(); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = toEstabelecimento_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setEstabelecimento_id( (Integer) value ); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setToEstabelecimento_id( (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_ESTABELECIMENTO_ID) != null ) + { + toEstabelecimento_id().save(); + dataHash.put(ESTABELECIMENTO_ID, toEstabelecimento_id().get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HistoricoEstabelecimento.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsArea.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsArea.java new file mode 100644 index 00000000..00a2b74b --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsArea.java @@ -0,0 +1,183 @@ +/* +* HsArea.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsArea implements JDOInnerObject +{ + private Integer id; + private Integer empresa_id; + private String description; + private java.sql.Timestamp deleted_date; + private Integer ordem; + + public HsArea() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsAreaDataAuto.ID ) + { + return id; + } + else if( fieldName == HsAreaDataAuto.EMPRESA_ID ) + { + return empresa_id; + } + else if( fieldName == HsAreaDataAuto.DESCRIPTION ) + { + return description; + } + else if( fieldName == HsAreaDataAuto.DELETED_DATE ) + { + return deleted_date; + } + else if( fieldName == HsAreaDataAuto.ORDEM ) + { + return ordem; + } + else if( fieldName.equals( HsAreaDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsAreaDataAuto.EMPRESA_ID ) ) + { + return empresa_id; + } + else if( fieldName.equals( HsAreaDataAuto.DESCRIPTION ) ) + { + return description; + } + else if( fieldName.equals( HsAreaDataAuto.DELETED_DATE ) ) + { + return deleted_date; + } + else if( fieldName.equals( HsAreaDataAuto.ORDEM ) ) + { + return ordem; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsAreaDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsAreaDataAuto.EMPRESA_ID ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName == HsAreaDataAuto.DESCRIPTION ) + { + description = ( String ) value; + } + else if( fieldName == HsAreaDataAuto.DELETED_DATE ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName == HsAreaDataAuto.ORDEM ) + { + ordem = ( Integer ) value; + } + else if( fieldName.equals( HsAreaDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsAreaDataAuto.EMPRESA_ID ) ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName.equals( HsAreaDataAuto.DESCRIPTION ) ) + { + description = ( String ) value; + } + else if( fieldName.equals( HsAreaDataAuto.DELETED_DATE ) ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( HsAreaDataAuto.ORDEM ) ) + { + ordem = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getEmpresa_id() + { + return empresa_id; + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + this.empresa_id = empresa_idValue; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String descriptionValue ) + { + this.description = descriptionValue; + } + + public java.sql.Timestamp getDeleted_date() + { + return deleted_date; + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.deleted_date = deleted_dateValue; + } + + public Integer getOrdem() + { + return ordem; + } + + public void setOrdem(Integer ordemValue ) + { + this.ordem = ordemValue; + } + + public Class getOuterClass() + { + return HsAreaDataAuto.class; + } + + public HsAreaDataAuto getOuterClassInstance() + { + HsAreaDataAuto outerObj = new HsAreaDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsAreaData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsAreaData.java new file mode 100644 index 00000000..370274f8 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsAreaData.java @@ -0,0 +1,18 @@ +/* +* HsAreaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsAreaData extends com.evolute.siprp.server.db.data.siprp_local3.HsAreaDataAuto +{ + + public HsAreaData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsAreaDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsAreaDataAuto.java new file mode 100644 index 00000000..a3c1020c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsAreaDataAuto.java @@ -0,0 +1,190 @@ +/* +* HsAreaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsAreaDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_area"; + + public static final String ID = "id"; + public static final String ID_FULL = "hs_area.id"; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "hs_area.empresa_id"; + public static final String TO_EMPRESA_ID = "to empresa_id"; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_area.description"; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_area.deleted_date"; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "hs_area.ordem"; + + public static final String FIELD_NAMES[] = new String[]{ + EMPRESA_ID, TO_EMPRESA_ID, DESCRIPTION, DELETED_DATE, ORDEM, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, EMPRESA_ID, DESCRIPTION, DELETED_DATE, ORDEM, }; + + private Map dataHash; + + public HsAreaDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getEmpresa_id() + { + return (Integer) dataHash.get(EMPRESA_ID); + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + dataHash.put(TO_EMPRESA_ID, null); + dataHash.put(EMPRESA_ID, empresa_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EmpresasData toEmpresa_id() + throws Exception + { + if( dataHash.get(TO_EMPRESA_ID) == null && getEmpresa_id() != null ) + { + dataHash.put(TO_EMPRESA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.class, new Object[]{ getEmpresa_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) dataHash.get(TO_EMPRESA_ID); + } + + public void setToEmpresa_id(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData empresa_idObject ) + { + if( empresa_idObject == null ) + { + dataHash.put(EMPRESA_ID, null); + } + else + { + dataHash.put(EMPRESA_ID, empresa_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + dataHash.put(TO_EMPRESA_ID, empresa_idObject); + } + + public String getDescription() + { + return (String) get(DESCRIPTION); + } + + public void setDescription(String descriptionValue ) + { + this.set(DESCRIPTION, descriptionValue ); + } + + public java.sql.Timestamp getDeleted_date() + { + return (java.sql.Timestamp) get(DELETED_DATE); + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.set(DELETED_DATE, deleted_dateValue ); + } + + public Integer getOrdem() + { + return (Integer) get(ORDEM); + } + + public void setOrdem(Integer ordemValue ) + { + this.set(ORDEM, ordemValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_EMPRESA_ID.equals( fieldName ) ) + { + value = toEmpresa_id(); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + value = getEmpresa_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_EMPRESA_ID.equals( fieldName ) ) + { + setToEmpresa_id( (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) value ); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + setEmpresa_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_EMPRESA_ID) != null ) + { + toEmpresa_id().save(); + dataHash.put(EMPRESA_ID, toEmpresa_id().get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsArea.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmail.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmail.java new file mode 100644 index 00000000..47fe8c47 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmail.java @@ -0,0 +1,102 @@ +/* +* HsEmail.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsEmail implements JDOInnerObject +{ + private Integer id; + private String email; + + public HsEmail() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsEmailDataAuto.ID ) + { + return id; + } + else if( fieldName == HsEmailDataAuto.EMAIL ) + { + return email; + } + else if( fieldName.equals( HsEmailDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsEmailDataAuto.EMAIL ) ) + { + return email; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsEmailDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsEmailDataAuto.EMAIL ) + { + email = ( String ) value; + } + else if( fieldName.equals( HsEmailDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsEmailDataAuto.EMAIL ) ) + { + email = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getEmail() + { + return email; + } + + public void setEmail(String emailValue ) + { + this.email = emailValue; + } + + public Class getOuterClass() + { + return HsEmailDataAuto.class; + } + + public HsEmailDataAuto getOuterClassInstance() + { + HsEmailDataAuto outerObj = new HsEmailDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailData.java new file mode 100644 index 00000000..000d7e1e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailData.java @@ -0,0 +1,18 @@ +/* +* HsEmailDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsEmailData extends com.evolute.siprp.server.db.data.siprp_local3.HsEmailDataAuto +{ + + public HsEmailData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailDataAuto.java new file mode 100644 index 00000000..8ddaf5a9 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailDataAuto.java @@ -0,0 +1,95 @@ +/* +* HsEmailDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsEmailDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_email"; + + public static final String ID = "id"; + public static final String ID_FULL = "hs_email.id"; + public static final String EMAIL = "email"; + public static final String EMAIL_FULL = "hs_email.email"; + + public static final String FIELD_NAMES[] = new String[]{ + EMAIL, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, EMAIL, }; + + private Map dataHash; + + public HsEmailDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getEmail() + { + return (String) get(EMAIL); + } + + public void setEmail(String emailValue ) + { + this.set(EMAIL, emailValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsEmail.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEmpresa.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEmpresa.java new file mode 100644 index 00000000..f1f6bd34 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEmpresa.java @@ -0,0 +1,114 @@ +/* +* HsEmailEmpresa.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsEmailEmpresa implements JDOInnerObject +{ + private Integer email_id; + private Integer empresa_id; + + public HsEmailEmpresa() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsEmailEmpresaDataAuto.EMAIL_ID ) + { + return email_id; + } + else if( fieldName == HsEmailEmpresaDataAuto.EMPRESA_ID ) + { + return empresa_id; + } + else if( fieldName.equals( HsEmailEmpresaDataAuto.EMAIL_ID ) ) + { + return email_id; + } + else if( fieldName.equals( HsEmailEmpresaDataAuto.EMPRESA_ID ) ) + { + return empresa_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsEmailEmpresaDataAuto.EMAIL_ID ) + { + email_id = ( Integer ) value; + } + else if( fieldName == HsEmailEmpresaDataAuto.EMPRESA_ID ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName.equals( HsEmailEmpresaDataAuto.EMAIL_ID ) ) + { + email_id = ( Integer ) value; + } + else if( fieldName.equals( HsEmailEmpresaDataAuto.EMPRESA_ID ) ) + { + empresa_id = ( Integer ) value; + } + } + + public Integer getEmail_id() + { + return email_id; + } + + public void setEmail_id(Integer email_idValue ) + { + this.email_id = email_idValue; + } + + public Integer getEmpresa_id() + { + return empresa_id; + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + this.empresa_id = empresa_idValue; + } + + public Class getOuterClass() + { + return HsEmailEmpresaDataAuto.class; + } + + public HsEmailEmpresaDataAuto getOuterClassInstance() + { + HsEmailEmpresaDataAuto outerObj = new HsEmailEmpresaDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsEmailEmpresaID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsEmailEmpresaID id = new com.evolute.siprp.server.db.data.siprp_local3.HsEmailEmpresaID(); + + Object obj; + obj = this.getEmail_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.email_id = (Integer)obj; + + obj = this.getEmpresa_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.empresa_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEmpresaData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEmpresaData.java new file mode 100644 index 00000000..8d62e893 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEmpresaData.java @@ -0,0 +1,18 @@ +/* +* HsEmailEmpresaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsEmailEmpresaData extends com.evolute.siprp.server.db.data.siprp_local3.HsEmailEmpresaDataAuto +{ + + public HsEmailEmpresaData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEmpresaDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEmpresaDataAuto.java new file mode 100644 index 00000000..e62e029b --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEmpresaDataAuto.java @@ -0,0 +1,213 @@ +/* +* HsEmailEmpresaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsEmailEmpresaDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_email_empresa"; + + public static final String EMAIL_ID = "email_id"; + public static final String EMAIL_ID_FULL = "hs_email_empresa.email_id"; + public static final String TO_EMAIL_ID = "to email_id"; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "hs_email_empresa.empresa_id"; + public static final String TO_EMPRESA_ID = "to empresa_id"; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + EMAIL_ID, EMPRESA_ID, }; + + private Map dataHash; + + public HsEmailEmpresaDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getEmail_id() + { + return (Integer) dataHash.get(EMAIL_ID); + } + + public void setEmail_id(Integer email_idValue ) + { + dataHash.put(TO_EMAIL_ID, null); + dataHash.put(EMAIL_ID, email_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsEmailData toEmail_id() + throws Exception + { + if( dataHash.get(TO_EMAIL_ID) == null && getEmail_id() != null ) + { + dataHash.put(TO_EMAIL_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsEmailData.class, new Object[]{ getEmail_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsEmailData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsEmailData) dataHash.get(TO_EMAIL_ID); + } + + public void setToEmail_id(com.evolute.siprp.server.db.data.siprp_local3.HsEmailData email_idObject ) + { + if( email_idObject == null ) + { + dataHash.put(EMAIL_ID, null); + } + else + { + dataHash.put(EMAIL_ID, email_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsEmailData.ID )); + } + dataHash.put(TO_EMAIL_ID, email_idObject); + } + + public Integer getEmpresa_id() + { + return (Integer) dataHash.get(EMPRESA_ID); + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + dataHash.put(TO_EMPRESA_ID, null); + dataHash.put(EMPRESA_ID, empresa_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EmpresasData toEmpresa_id() + throws Exception + { + if( dataHash.get(TO_EMPRESA_ID) == null && getEmpresa_id() != null ) + { + dataHash.put(TO_EMPRESA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.class, new Object[]{ getEmpresa_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) dataHash.get(TO_EMPRESA_ID); + } + + public void setToEmpresa_id(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData empresa_idObject ) + { + if( empresa_idObject == null ) + { + dataHash.put(EMPRESA_ID, null); + } + else + { + dataHash.put(EMPRESA_ID, empresa_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + dataHash.put(TO_EMPRESA_ID, empresa_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_EMAIL_ID.equals( fieldName ) ) + { + value = toEmail_id(); + } + else if( TO_EMPRESA_ID.equals( fieldName ) ) + { + value = toEmpresa_id(); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + value = getEmpresa_id(); + } + else if( EMAIL_ID.equals( fieldName ) ) + { + value = getEmail_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_EMAIL_ID.equals( fieldName ) ) + { + setToEmail_id( (com.evolute.siprp.server.db.data.siprp_local3.HsEmailData) value ); + } + else if( TO_EMPRESA_ID.equals( fieldName ) ) + { + setToEmpresa_id( (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) value ); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + setEmpresa_id( (Integer) value ); + } + else if( EMAIL_ID.equals( fieldName ) ) + { + setEmail_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_EMAIL_ID) != null ) + { + toEmail_id().save(); + dataHash.put(EMAIL_ID, toEmail_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsEmailData.ID )); + } + + if( dataHash.get(TO_EMPRESA_ID) != null ) + { + toEmpresa_id().save(); + dataHash.put(EMPRESA_ID, toEmpresa_id().get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsEmailEmpresa.class; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsEmailEmpresaID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsEmailEmpresaID id = new com.evolute.siprp.server.db.data.siprp_local3.HsEmailEmpresaID(); + + Object obj; + obj = this.getEmail_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.email_id = (Integer)obj; + + obj = this.getEmpresa_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.empresa_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEmpresaID.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEmpresaID.java new file mode 100644 index 00000000..e91ca3af --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEmpresaID.java @@ -0,0 +1,37 @@ +/* +* HsEmailEmpresaID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.JDOIDClass; + +public final class HsEmailEmpresaID extends JDOIDClass implements Serializable +{ + public Integer email_id; + public Integer empresa_id; + + public HsEmailEmpresaID() + { + } + + + public Object[] getValue() + { + Object value[] = new Object[ 2 ]; + value[ 0 ] = email_id; + value[ 1 ] = empresa_id; + return value; + } + + public void setValues( Object values[] ) + { + email_id = (Integer) values[ 0 ]; + empresa_id = (Integer) values[ 1 ]; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEstabelecimento.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEstabelecimento.java new file mode 100644 index 00000000..72604cbd --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEstabelecimento.java @@ -0,0 +1,114 @@ +/* +* HsEmailEstabelecimento.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsEmailEstabelecimento implements JDOInnerObject +{ + private Integer email_id; + private Integer estabelecimento_id; + + public HsEmailEstabelecimento() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsEmailEstabelecimentoDataAuto.EMAIL_ID ) + { + return email_id; + } + else if( fieldName == HsEmailEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) + { + return estabelecimento_id; + } + else if( fieldName.equals( HsEmailEstabelecimentoDataAuto.EMAIL_ID ) ) + { + return email_id; + } + else if( fieldName.equals( HsEmailEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) ) + { + return estabelecimento_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsEmailEstabelecimentoDataAuto.EMAIL_ID ) + { + email_id = ( Integer ) value; + } + else if( fieldName == HsEmailEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName.equals( HsEmailEstabelecimentoDataAuto.EMAIL_ID ) ) + { + email_id = ( Integer ) value; + } + else if( fieldName.equals( HsEmailEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) ) + { + estabelecimento_id = ( Integer ) value; + } + } + + public Integer getEmail_id() + { + return email_id; + } + + public void setEmail_id(Integer email_idValue ) + { + this.email_id = email_idValue; + } + + public Integer getEstabelecimento_id() + { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + this.estabelecimento_id = estabelecimento_idValue; + } + + public Class getOuterClass() + { + return HsEmailEstabelecimentoDataAuto.class; + } + + public HsEmailEstabelecimentoDataAuto getOuterClassInstance() + { + HsEmailEstabelecimentoDataAuto outerObj = new HsEmailEstabelecimentoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsEmailEstabelecimentoID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsEmailEstabelecimentoID id = new com.evolute.siprp.server.db.data.siprp_local3.HsEmailEstabelecimentoID(); + + Object obj; + obj = this.getEmail_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.email_id = (Integer)obj; + + obj = this.getEstabelecimento_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.estabelecimento_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEstabelecimentoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEstabelecimentoData.java new file mode 100644 index 00000000..61825778 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEstabelecimentoData.java @@ -0,0 +1,18 @@ +/* +* HsEmailEstabelecimentoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsEmailEstabelecimentoData extends com.evolute.siprp.server.db.data.siprp_local3.HsEmailEstabelecimentoDataAuto +{ + + public HsEmailEstabelecimentoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEstabelecimentoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEstabelecimentoDataAuto.java new file mode 100644 index 00000000..a8148460 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEstabelecimentoDataAuto.java @@ -0,0 +1,213 @@ +/* +* HsEmailEstabelecimentoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsEmailEstabelecimentoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_email_estabelecimento"; + + public static final String EMAIL_ID = "email_id"; + public static final String EMAIL_ID_FULL = "hs_email_estabelecimento.email_id"; + public static final String TO_EMAIL_ID = "to email_id"; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "hs_email_estabelecimento.estabelecimento_id"; + public static final String TO_ESTABELECIMENTO_ID = "to estabelecimento_id"; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + EMAIL_ID, ESTABELECIMENTO_ID, }; + + private Map dataHash; + + public HsEmailEstabelecimentoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getEmail_id() + { + return (Integer) dataHash.get(EMAIL_ID); + } + + public void setEmail_id(Integer email_idValue ) + { + dataHash.put(TO_EMAIL_ID, null); + dataHash.put(EMAIL_ID, email_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsEmailData toEmail_id() + throws Exception + { + if( dataHash.get(TO_EMAIL_ID) == null && getEmail_id() != null ) + { + dataHash.put(TO_EMAIL_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsEmailData.class, new Object[]{ getEmail_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsEmailData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsEmailData) dataHash.get(TO_EMAIL_ID); + } + + public void setToEmail_id(com.evolute.siprp.server.db.data.siprp_local3.HsEmailData email_idObject ) + { + if( email_idObject == null ) + { + dataHash.put(EMAIL_ID, null); + } + else + { + dataHash.put(EMAIL_ID, email_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsEmailData.ID )); + } + dataHash.put(TO_EMAIL_ID, email_idObject); + } + + public Integer getEstabelecimento_id() + { + return (Integer) dataHash.get(ESTABELECIMENTO_ID); + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, null); + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData toEstabelecimento_id() + throws Exception + { + if( dataHash.get(TO_ESTABELECIMENTO_ID) == null && getEstabelecimento_id() != null ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.class, new Object[]{ getEstabelecimento_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) dataHash.get(TO_ESTABELECIMENTO_ID); + } + + public void setToEstabelecimento_id(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData estabelecimento_idObject ) + { + if( estabelecimento_idObject == null ) + { + dataHash.put(ESTABELECIMENTO_ID, null); + } + else + { + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + dataHash.put(TO_ESTABELECIMENTO_ID, estabelecimento_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = getEstabelecimento_id(); + } + else if( TO_EMAIL_ID.equals( fieldName ) ) + { + value = toEmail_id(); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = toEstabelecimento_id(); + } + else if( EMAIL_ID.equals( fieldName ) ) + { + value = getEmail_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setEstabelecimento_id( (Integer) value ); + } + else if( TO_EMAIL_ID.equals( fieldName ) ) + { + setToEmail_id( (com.evolute.siprp.server.db.data.siprp_local3.HsEmailData) value ); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setToEstabelecimento_id( (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) value ); + } + else if( EMAIL_ID.equals( fieldName ) ) + { + setEmail_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_EMAIL_ID) != null ) + { + toEmail_id().save(); + dataHash.put(EMAIL_ID, toEmail_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsEmailData.ID )); + } + + if( dataHash.get(TO_ESTABELECIMENTO_ID) != null ) + { + toEstabelecimento_id().save(); + dataHash.put(ESTABELECIMENTO_ID, toEstabelecimento_id().get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsEmailEstabelecimento.class; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsEmailEstabelecimentoID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsEmailEstabelecimentoID id = new com.evolute.siprp.server.db.data.siprp_local3.HsEmailEstabelecimentoID(); + + Object obj; + obj = this.getEmail_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.email_id = (Integer)obj; + + obj = this.getEstabelecimento_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.estabelecimento_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEstabelecimentoID.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEstabelecimentoID.java new file mode 100644 index 00000000..b446e70b --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEmailEstabelecimentoID.java @@ -0,0 +1,37 @@ +/* +* HsEmailEstabelecimentoID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.JDOIDClass; + +public final class HsEmailEstabelecimentoID extends JDOIDClass implements Serializable +{ + public Integer email_id; + public Integer estabelecimento_id; + + public HsEmailEstabelecimentoID() + { + } + + + public Object[] getValue() + { + Object value[] = new Object[ 2 ]; + value[ 0 ] = email_id; + value[ 1 ] = estabelecimento_id; + return value; + } + + public void setValues( Object values[] ) + { + email_id = (Integer) values[ 0 ]; + estabelecimento_id = (Integer) values[ 1 ]; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEquipamento.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEquipamento.java new file mode 100644 index 00000000..93b1088e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEquipamento.java @@ -0,0 +1,183 @@ +/* +* HsEquipamento.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsEquipamento implements JDOInnerObject +{ + private Integer id; + private String tipo; + private String marca; + private String modelo; + private java.sql.Timestamp deleted_date; + + public HsEquipamento() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsEquipamentoDataAuto.ID ) + { + return id; + } + else if( fieldName == HsEquipamentoDataAuto.TIPO ) + { + return tipo; + } + else if( fieldName == HsEquipamentoDataAuto.MARCA ) + { + return marca; + } + else if( fieldName == HsEquipamentoDataAuto.MODELO ) + { + return modelo; + } + else if( fieldName == HsEquipamentoDataAuto.DELETED_DATE ) + { + return deleted_date; + } + else if( fieldName.equals( HsEquipamentoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsEquipamentoDataAuto.TIPO ) ) + { + return tipo; + } + else if( fieldName.equals( HsEquipamentoDataAuto.MARCA ) ) + { + return marca; + } + else if( fieldName.equals( HsEquipamentoDataAuto.MODELO ) ) + { + return modelo; + } + else if( fieldName.equals( HsEquipamentoDataAuto.DELETED_DATE ) ) + { + return deleted_date; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsEquipamentoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsEquipamentoDataAuto.TIPO ) + { + tipo = ( String ) value; + } + else if( fieldName == HsEquipamentoDataAuto.MARCA ) + { + marca = ( String ) value; + } + else if( fieldName == HsEquipamentoDataAuto.MODELO ) + { + modelo = ( String ) value; + } + else if( fieldName == HsEquipamentoDataAuto.DELETED_DATE ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( HsEquipamentoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsEquipamentoDataAuto.TIPO ) ) + { + tipo = ( String ) value; + } + else if( fieldName.equals( HsEquipamentoDataAuto.MARCA ) ) + { + marca = ( String ) value; + } + else if( fieldName.equals( HsEquipamentoDataAuto.MODELO ) ) + { + modelo = ( String ) value; + } + else if( fieldName.equals( HsEquipamentoDataAuto.DELETED_DATE ) ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getTipo() + { + return tipo; + } + + public void setTipo(String tipoValue ) + { + this.tipo = tipoValue; + } + + public String getMarca() + { + return marca; + } + + public void setMarca(String marcaValue ) + { + this.marca = marcaValue; + } + + public String getModelo() + { + return modelo; + } + + public void setModelo(String modeloValue ) + { + this.modelo = modeloValue; + } + + public java.sql.Timestamp getDeleted_date() + { + return deleted_date; + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.deleted_date = deleted_dateValue; + } + + public Class getOuterClass() + { + return HsEquipamentoDataAuto.class; + } + + public HsEquipamentoDataAuto getOuterClassInstance() + { + HsEquipamentoDataAuto outerObj = new HsEquipamentoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEquipamentoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEquipamentoData.java new file mode 100644 index 00000000..e1bc0c8e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEquipamentoData.java @@ -0,0 +1,18 @@ +/* +* HsEquipamentoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsEquipamentoData extends com.evolute.siprp.server.db.data.siprp_local3.HsEquipamentoDataAuto +{ + + public HsEquipamentoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEquipamentoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEquipamentoDataAuto.java new file mode 100644 index 00000000..fff3d566 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsEquipamentoDataAuto.java @@ -0,0 +1,131 @@ +/* +* HsEquipamentoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsEquipamentoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_equipamento"; + + public static final String ID = "id"; + public static final String ID_FULL = "hs_equipamento.id"; + public static final String TIPO = "tipo"; + public static final String TIPO_FULL = "hs_equipamento.tipo"; + public static final String MARCA = "marca"; + public static final String MARCA_FULL = "hs_equipamento.marca"; + public static final String MODELO = "modelo"; + public static final String MODELO_FULL = "hs_equipamento.modelo"; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_equipamento.deleted_date"; + + public static final String FIELD_NAMES[] = new String[]{ + TIPO, MARCA, MODELO, DELETED_DATE, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TIPO, MARCA, MODELO, DELETED_DATE, }; + + private Map dataHash; + + public HsEquipamentoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getTipo() + { + return (String) get(TIPO); + } + + public void setTipo(String tipoValue ) + { + this.set(TIPO, tipoValue ); + } + + public String getMarca() + { + return (String) get(MARCA); + } + + public void setMarca(String marcaValue ) + { + this.set(MARCA, marcaValue ); + } + + public String getModelo() + { + return (String) get(MODELO); + } + + public void setModelo(String modeloValue ) + { + this.set(MODELO, modeloValue ); + } + + public java.sql.Timestamp getDeleted_date() + { + return (java.sql.Timestamp) get(DELETED_DATE); + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.set(DELETED_DATE, deleted_dateValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsEquipamento.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacao.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacao.java new file mode 100644 index 00000000..9d907180 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacao.java @@ -0,0 +1,156 @@ +/* +* HsLegislacao.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsLegislacao implements JDOInnerObject +{ + private Integer id; + private String description; + private Integer categoria_id; + private java.sql.Timestamp deleted_date; + + public HsLegislacao() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsLegislacaoDataAuto.ID ) + { + return id; + } + else if( fieldName == HsLegislacaoDataAuto.DESCRIPTION ) + { + return description; + } + else if( fieldName == HsLegislacaoDataAuto.CATEGORIA_ID ) + { + return categoria_id; + } + else if( fieldName == HsLegislacaoDataAuto.DELETED_DATE ) + { + return deleted_date; + } + else if( fieldName.equals( HsLegislacaoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsLegislacaoDataAuto.DESCRIPTION ) ) + { + return description; + } + else if( fieldName.equals( HsLegislacaoDataAuto.CATEGORIA_ID ) ) + { + return categoria_id; + } + else if( fieldName.equals( HsLegislacaoDataAuto.DELETED_DATE ) ) + { + return deleted_date; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsLegislacaoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsLegislacaoDataAuto.DESCRIPTION ) + { + description = ( String ) value; + } + else if( fieldName == HsLegislacaoDataAuto.CATEGORIA_ID ) + { + categoria_id = ( Integer ) value; + } + else if( fieldName == HsLegislacaoDataAuto.DELETED_DATE ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( HsLegislacaoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsLegislacaoDataAuto.DESCRIPTION ) ) + { + description = ( String ) value; + } + else if( fieldName.equals( HsLegislacaoDataAuto.CATEGORIA_ID ) ) + { + categoria_id = ( Integer ) value; + } + else if( fieldName.equals( HsLegislacaoDataAuto.DELETED_DATE ) ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String descriptionValue ) + { + this.description = descriptionValue; + } + + public Integer getCategoria_id() + { + return categoria_id; + } + + public void setCategoria_id(Integer categoria_idValue ) + { + this.categoria_id = categoria_idValue; + } + + public java.sql.Timestamp getDeleted_date() + { + return deleted_date; + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.deleted_date = deleted_dateValue; + } + + public Class getOuterClass() + { + return HsLegislacaoDataAuto.class; + } + + public HsLegislacaoDataAuto getOuterClassInstance() + { + HsLegislacaoDataAuto outerObj = new HsLegislacaoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoCategoria.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoCategoria.java new file mode 100644 index 00000000..b5a12d2e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoCategoria.java @@ -0,0 +1,129 @@ +/* +* HsLegislacaoCategoria.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsLegislacaoCategoria implements JDOInnerObject +{ + private Integer id; + private String description; + private java.sql.Timestamp deleted_date; + + public HsLegislacaoCategoria() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsLegislacaoCategoriaDataAuto.ID ) + { + return id; + } + else if( fieldName == HsLegislacaoCategoriaDataAuto.DESCRIPTION ) + { + return description; + } + else if( fieldName == HsLegislacaoCategoriaDataAuto.DELETED_DATE ) + { + return deleted_date; + } + else if( fieldName.equals( HsLegislacaoCategoriaDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsLegislacaoCategoriaDataAuto.DESCRIPTION ) ) + { + return description; + } + else if( fieldName.equals( HsLegislacaoCategoriaDataAuto.DELETED_DATE ) ) + { + return deleted_date; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsLegislacaoCategoriaDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsLegislacaoCategoriaDataAuto.DESCRIPTION ) + { + description = ( String ) value; + } + else if( fieldName == HsLegislacaoCategoriaDataAuto.DELETED_DATE ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( HsLegislacaoCategoriaDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsLegislacaoCategoriaDataAuto.DESCRIPTION ) ) + { + description = ( String ) value; + } + else if( fieldName.equals( HsLegislacaoCategoriaDataAuto.DELETED_DATE ) ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String descriptionValue ) + { + this.description = descriptionValue; + } + + public java.sql.Timestamp getDeleted_date() + { + return deleted_date; + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.deleted_date = deleted_dateValue; + } + + public Class getOuterClass() + { + return HsLegislacaoCategoriaDataAuto.class; + } + + public HsLegislacaoCategoriaDataAuto getOuterClassInstance() + { + HsLegislacaoCategoriaDataAuto outerObj = new HsLegislacaoCategoriaDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoCategoriaData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoCategoriaData.java new file mode 100644 index 00000000..a67d8598 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoCategoriaData.java @@ -0,0 +1,18 @@ +/* +* HsLegislacaoCategoriaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsLegislacaoCategoriaData extends com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoCategoriaDataAuto +{ + + public HsLegislacaoCategoriaData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoCategoriaDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoCategoriaDataAuto.java new file mode 100644 index 00000000..cac6f64d --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoCategoriaDataAuto.java @@ -0,0 +1,107 @@ +/* +* HsLegislacaoCategoriaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsLegislacaoCategoriaDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_legislacao_categoria"; + + public static final String ID = "id"; + public static final String ID_FULL = "hs_legislacao_categoria.id"; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_legislacao_categoria.description"; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_legislacao_categoria.deleted_date"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRIPTION, DELETED_DATE, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DESCRIPTION, DELETED_DATE, }; + + private Map dataHash; + + public HsLegislacaoCategoriaDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getDescription() + { + return (String) get(DESCRIPTION); + } + + public void setDescription(String descriptionValue ) + { + this.set(DESCRIPTION, descriptionValue ); + } + + public java.sql.Timestamp getDeleted_date() + { + return (java.sql.Timestamp) get(DELETED_DATE); + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.set(DELETED_DATE, deleted_dateValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsLegislacaoCategoria.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoData.java new file mode 100644 index 00000000..fa0fd18e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoData.java @@ -0,0 +1,18 @@ +/* +* HsLegislacaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsLegislacaoData extends com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoDataAuto +{ + + public HsLegislacaoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoDataAuto.java new file mode 100644 index 00000000..f5ba2806 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoDataAuto.java @@ -0,0 +1,178 @@ +/* +* HsLegislacaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsLegislacaoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_legislacao"; + + public static final String ID = "id"; + public static final String ID_FULL = "hs_legislacao.id"; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_legislacao.description"; + public static final String CATEGORIA_ID = "categoria_id"; + public static final String CATEGORIA_ID_FULL = "hs_legislacao.categoria_id"; + public static final String TO_CATEGORIA_ID = "to categoria_id"; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_legislacao.deleted_date"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRIPTION, CATEGORIA_ID, TO_CATEGORIA_ID, DELETED_DATE, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DESCRIPTION, CATEGORIA_ID, DELETED_DATE, }; + + private Map dataHash; + + public HsLegislacaoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getDescription() + { + return (String) get(DESCRIPTION); + } + + public void setDescription(String descriptionValue ) + { + this.set(DESCRIPTION, descriptionValue ); + } + + public Integer getCategoria_id() + { + return (Integer) dataHash.get(CATEGORIA_ID); + } + + public void setCategoria_id(Integer categoria_idValue ) + { + dataHash.put(TO_CATEGORIA_ID, null); + dataHash.put(CATEGORIA_ID, categoria_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoCategoriaData toCategoria_id() + throws Exception + { + if( dataHash.get(TO_CATEGORIA_ID) == null && getCategoria_id() != null ) + { + dataHash.put(TO_CATEGORIA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoCategoriaData.class, new Object[]{ getCategoria_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoCategoriaData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoCategoriaData) dataHash.get(TO_CATEGORIA_ID); + } + + public void setToCategoria_id(com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoCategoriaData categoria_idObject ) + { + if( categoria_idObject == null ) + { + dataHash.put(CATEGORIA_ID, null); + } + else + { + dataHash.put(CATEGORIA_ID, categoria_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoCategoriaData.ID )); + } + dataHash.put(TO_CATEGORIA_ID, categoria_idObject); + } + + public java.sql.Timestamp getDeleted_date() + { + return (java.sql.Timestamp) get(DELETED_DATE); + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.set(DELETED_DATE, deleted_dateValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( CATEGORIA_ID.equals( fieldName ) ) + { + value = getCategoria_id(); + } + else if( TO_CATEGORIA_ID.equals( fieldName ) ) + { + value = toCategoria_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( CATEGORIA_ID.equals( fieldName ) ) + { + setCategoria_id( (Integer) value ); + } + else if( TO_CATEGORIA_ID.equals( fieldName ) ) + { + setToCategoria_id( (com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoCategoriaData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_CATEGORIA_ID) != null ) + { + toCategoria_id().save(); + dataHash.put(CATEGORIA_ID, toCategoria_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoCategoriaData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsLegislacao.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEmpresa.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEmpresa.java new file mode 100644 index 00000000..d924dd3a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEmpresa.java @@ -0,0 +1,114 @@ +/* +* HsLegislacaoEmpresa.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsLegislacaoEmpresa implements JDOInnerObject +{ + private Integer legislacao_id; + private Integer empresa_id; + + public HsLegislacaoEmpresa() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsLegislacaoEmpresaDataAuto.LEGISLACAO_ID ) + { + return legislacao_id; + } + else if( fieldName == HsLegislacaoEmpresaDataAuto.EMPRESA_ID ) + { + return empresa_id; + } + else if( fieldName.equals( HsLegislacaoEmpresaDataAuto.LEGISLACAO_ID ) ) + { + return legislacao_id; + } + else if( fieldName.equals( HsLegislacaoEmpresaDataAuto.EMPRESA_ID ) ) + { + return empresa_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsLegislacaoEmpresaDataAuto.LEGISLACAO_ID ) + { + legislacao_id = ( Integer ) value; + } + else if( fieldName == HsLegislacaoEmpresaDataAuto.EMPRESA_ID ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName.equals( HsLegislacaoEmpresaDataAuto.LEGISLACAO_ID ) ) + { + legislacao_id = ( Integer ) value; + } + else if( fieldName.equals( HsLegislacaoEmpresaDataAuto.EMPRESA_ID ) ) + { + empresa_id = ( Integer ) value; + } + } + + public Integer getLegislacao_id() + { + return legislacao_id; + } + + public void setLegislacao_id(Integer legislacao_idValue ) + { + this.legislacao_id = legislacao_idValue; + } + + public Integer getEmpresa_id() + { + return empresa_id; + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + this.empresa_id = empresa_idValue; + } + + public Class getOuterClass() + { + return HsLegislacaoEmpresaDataAuto.class; + } + + public HsLegislacaoEmpresaDataAuto getOuterClassInstance() + { + HsLegislacaoEmpresaDataAuto outerObj = new HsLegislacaoEmpresaDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoEmpresaID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoEmpresaID id = new com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoEmpresaID(); + + Object obj; + obj = this.getLegislacao_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.legislacao_id = (Integer)obj; + + obj = this.getEmpresa_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.empresa_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEmpresaData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEmpresaData.java new file mode 100644 index 00000000..a813f1e0 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEmpresaData.java @@ -0,0 +1,18 @@ +/* +* HsLegislacaoEmpresaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsLegislacaoEmpresaData extends com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoEmpresaDataAuto +{ + + public HsLegislacaoEmpresaData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEmpresaDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEmpresaDataAuto.java new file mode 100644 index 00000000..13eae314 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEmpresaDataAuto.java @@ -0,0 +1,213 @@ +/* +* HsLegislacaoEmpresaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsLegislacaoEmpresaDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_legislacao_empresa"; + + public static final String LEGISLACAO_ID = "legislacao_id"; + public static final String LEGISLACAO_ID_FULL = "hs_legislacao_empresa.legislacao_id"; + public static final String TO_LEGISLACAO_ID = "to legislacao_id"; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "hs_legislacao_empresa.empresa_id"; + public static final String TO_EMPRESA_ID = "to empresa_id"; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + LEGISLACAO_ID, EMPRESA_ID, }; + + private Map dataHash; + + public HsLegislacaoEmpresaDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getLegislacao_id() + { + return (Integer) dataHash.get(LEGISLACAO_ID); + } + + public void setLegislacao_id(Integer legislacao_idValue ) + { + dataHash.put(TO_LEGISLACAO_ID, null); + dataHash.put(LEGISLACAO_ID, legislacao_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoData toLegislacao_id() + throws Exception + { + if( dataHash.get(TO_LEGISLACAO_ID) == null && getLegislacao_id() != null ) + { + dataHash.put(TO_LEGISLACAO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoData.class, new Object[]{ getLegislacao_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoData) dataHash.get(TO_LEGISLACAO_ID); + } + + public void setToLegislacao_id(com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoData legislacao_idObject ) + { + if( legislacao_idObject == null ) + { + dataHash.put(LEGISLACAO_ID, null); + } + else + { + dataHash.put(LEGISLACAO_ID, legislacao_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoData.ID )); + } + dataHash.put(TO_LEGISLACAO_ID, legislacao_idObject); + } + + public Integer getEmpresa_id() + { + return (Integer) dataHash.get(EMPRESA_ID); + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + dataHash.put(TO_EMPRESA_ID, null); + dataHash.put(EMPRESA_ID, empresa_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EmpresasData toEmpresa_id() + throws Exception + { + if( dataHash.get(TO_EMPRESA_ID) == null && getEmpresa_id() != null ) + { + dataHash.put(TO_EMPRESA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.class, new Object[]{ getEmpresa_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) dataHash.get(TO_EMPRESA_ID); + } + + public void setToEmpresa_id(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData empresa_idObject ) + { + if( empresa_idObject == null ) + { + dataHash.put(EMPRESA_ID, null); + } + else + { + dataHash.put(EMPRESA_ID, empresa_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + dataHash.put(TO_EMPRESA_ID, empresa_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_LEGISLACAO_ID.equals( fieldName ) ) + { + value = toLegislacao_id(); + } + else if( TO_EMPRESA_ID.equals( fieldName ) ) + { + value = toEmpresa_id(); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + value = getEmpresa_id(); + } + else if( LEGISLACAO_ID.equals( fieldName ) ) + { + value = getLegislacao_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_LEGISLACAO_ID.equals( fieldName ) ) + { + setToLegislacao_id( (com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoData) value ); + } + else if( TO_EMPRESA_ID.equals( fieldName ) ) + { + setToEmpresa_id( (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) value ); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + setEmpresa_id( (Integer) value ); + } + else if( LEGISLACAO_ID.equals( fieldName ) ) + { + setLegislacao_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_LEGISLACAO_ID) != null ) + { + toLegislacao_id().save(); + dataHash.put(LEGISLACAO_ID, toLegislacao_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoData.ID )); + } + + if( dataHash.get(TO_EMPRESA_ID) != null ) + { + toEmpresa_id().save(); + dataHash.put(EMPRESA_ID, toEmpresa_id().get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsLegislacaoEmpresa.class; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoEmpresaID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoEmpresaID id = new com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoEmpresaID(); + + Object obj; + obj = this.getLegislacao_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.legislacao_id = (Integer)obj; + + obj = this.getEmpresa_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.empresa_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEmpresaID.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEmpresaID.java new file mode 100644 index 00000000..434b5896 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEmpresaID.java @@ -0,0 +1,37 @@ +/* +* HsLegislacaoEmpresaID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.JDOIDClass; + +public final class HsLegislacaoEmpresaID extends JDOIDClass implements Serializable +{ + public Integer legislacao_id; + public Integer empresa_id; + + public HsLegislacaoEmpresaID() + { + } + + + public Object[] getValue() + { + Object value[] = new Object[ 2 ]; + value[ 0 ] = legislacao_id; + value[ 1 ] = empresa_id; + return value; + } + + public void setValues( Object values[] ) + { + legislacao_id = (Integer) values[ 0 ]; + empresa_id = (Integer) values[ 1 ]; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEstabelecimento.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEstabelecimento.java new file mode 100644 index 00000000..1cfe7a33 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEstabelecimento.java @@ -0,0 +1,141 @@ +/* +* HsLegislacaoEstabelecimento.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsLegislacaoEstabelecimento implements JDOInnerObject +{ + private Integer legislacao_id; + private Integer estabelecimento_id; + private Integer ordem; + + public HsLegislacaoEstabelecimento() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsLegislacaoEstabelecimentoDataAuto.LEGISLACAO_ID ) + { + return legislacao_id; + } + else if( fieldName == HsLegislacaoEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) + { + return estabelecimento_id; + } + else if( fieldName == HsLegislacaoEstabelecimentoDataAuto.ORDEM ) + { + return ordem; + } + else if( fieldName.equals( HsLegislacaoEstabelecimentoDataAuto.LEGISLACAO_ID ) ) + { + return legislacao_id; + } + else if( fieldName.equals( HsLegislacaoEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) ) + { + return estabelecimento_id; + } + else if( fieldName.equals( HsLegislacaoEstabelecimentoDataAuto.ORDEM ) ) + { + return ordem; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsLegislacaoEstabelecimentoDataAuto.LEGISLACAO_ID ) + { + legislacao_id = ( Integer ) value; + } + else if( fieldName == HsLegislacaoEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName == HsLegislacaoEstabelecimentoDataAuto.ORDEM ) + { + ordem = ( Integer ) value; + } + else if( fieldName.equals( HsLegislacaoEstabelecimentoDataAuto.LEGISLACAO_ID ) ) + { + legislacao_id = ( Integer ) value; + } + else if( fieldName.equals( HsLegislacaoEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName.equals( HsLegislacaoEstabelecimentoDataAuto.ORDEM ) ) + { + ordem = ( Integer ) value; + } + } + + public Integer getLegislacao_id() + { + return legislacao_id; + } + + public void setLegislacao_id(Integer legislacao_idValue ) + { + this.legislacao_id = legislacao_idValue; + } + + public Integer getEstabelecimento_id() + { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + this.estabelecimento_id = estabelecimento_idValue; + } + + public Integer getOrdem() + { + return ordem; + } + + public void setOrdem(Integer ordemValue ) + { + this.ordem = ordemValue; + } + + public Class getOuterClass() + { + return HsLegislacaoEstabelecimentoDataAuto.class; + } + + public HsLegislacaoEstabelecimentoDataAuto getOuterClassInstance() + { + HsLegislacaoEstabelecimentoDataAuto outerObj = new HsLegislacaoEstabelecimentoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoEstabelecimentoID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoEstabelecimentoID id = new com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoEstabelecimentoID(); + + Object obj; + obj = this.getLegislacao_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.legislacao_id = (Integer)obj; + + obj = this.getEstabelecimento_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.estabelecimento_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEstabelecimentoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEstabelecimentoData.java new file mode 100644 index 00000000..1b59d4b5 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEstabelecimentoData.java @@ -0,0 +1,18 @@ +/* +* HsLegislacaoEstabelecimentoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsLegislacaoEstabelecimentoData extends com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoEstabelecimentoDataAuto +{ + + public HsLegislacaoEstabelecimentoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEstabelecimentoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEstabelecimentoDataAuto.java new file mode 100644 index 00000000..3a80bb57 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEstabelecimentoDataAuto.java @@ -0,0 +1,225 @@ +/* +* HsLegislacaoEstabelecimentoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsLegislacaoEstabelecimentoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_legislacao_estabelecimento"; + + public static final String LEGISLACAO_ID = "legislacao_id"; + public static final String LEGISLACAO_ID_FULL = "hs_legislacao_estabelecimento.legislacao_id"; + public static final String TO_LEGISLACAO_ID = "to legislacao_id"; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "hs_legislacao_estabelecimento.estabelecimento_id"; + public static final String TO_ESTABELECIMENTO_ID = "to estabelecimento_id"; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "hs_legislacao_estabelecimento.ordem"; + + public static final String FIELD_NAMES[] = new String[]{ + ORDEM, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + LEGISLACAO_ID, ESTABELECIMENTO_ID, ORDEM, }; + + private Map dataHash; + + public HsLegislacaoEstabelecimentoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getLegislacao_id() + { + return (Integer) dataHash.get(LEGISLACAO_ID); + } + + public void setLegislacao_id(Integer legislacao_idValue ) + { + dataHash.put(TO_LEGISLACAO_ID, null); + dataHash.put(LEGISLACAO_ID, legislacao_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoData toLegislacao_id() + throws Exception + { + if( dataHash.get(TO_LEGISLACAO_ID) == null && getLegislacao_id() != null ) + { + dataHash.put(TO_LEGISLACAO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoData.class, new Object[]{ getLegislacao_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoData) dataHash.get(TO_LEGISLACAO_ID); + } + + public void setToLegislacao_id(com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoData legislacao_idObject ) + { + if( legislacao_idObject == null ) + { + dataHash.put(LEGISLACAO_ID, null); + } + else + { + dataHash.put(LEGISLACAO_ID, legislacao_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoData.ID )); + } + dataHash.put(TO_LEGISLACAO_ID, legislacao_idObject); + } + + public Integer getEstabelecimento_id() + { + return (Integer) dataHash.get(ESTABELECIMENTO_ID); + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, null); + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData toEstabelecimento_id() + throws Exception + { + if( dataHash.get(TO_ESTABELECIMENTO_ID) == null && getEstabelecimento_id() != null ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.class, new Object[]{ getEstabelecimento_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) dataHash.get(TO_ESTABELECIMENTO_ID); + } + + public void setToEstabelecimento_id(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData estabelecimento_idObject ) + { + if( estabelecimento_idObject == null ) + { + dataHash.put(ESTABELECIMENTO_ID, null); + } + else + { + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + dataHash.put(TO_ESTABELECIMENTO_ID, estabelecimento_idObject); + } + + public Integer getOrdem() + { + return (Integer) get(ORDEM); + } + + public void setOrdem(Integer ordemValue ) + { + this.set(ORDEM, ordemValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = getEstabelecimento_id(); + } + else if( TO_LEGISLACAO_ID.equals( fieldName ) ) + { + value = toLegislacao_id(); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = toEstabelecimento_id(); + } + else if( LEGISLACAO_ID.equals( fieldName ) ) + { + value = getLegislacao_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setEstabelecimento_id( (Integer) value ); + } + else if( TO_LEGISLACAO_ID.equals( fieldName ) ) + { + setToLegislacao_id( (com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoData) value ); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setToEstabelecimento_id( (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) value ); + } + else if( LEGISLACAO_ID.equals( fieldName ) ) + { + setLegislacao_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_LEGISLACAO_ID) != null ) + { + toLegislacao_id().save(); + dataHash.put(LEGISLACAO_ID, toLegislacao_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoData.ID )); + } + + if( dataHash.get(TO_ESTABELECIMENTO_ID) != null ) + { + toEstabelecimento_id().save(); + dataHash.put(ESTABELECIMENTO_ID, toEstabelecimento_id().get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsLegislacaoEstabelecimento.class; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoEstabelecimentoID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoEstabelecimentoID id = new com.evolute.siprp.server.db.data.siprp_local3.HsLegislacaoEstabelecimentoID(); + + Object obj; + obj = this.getLegislacao_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.legislacao_id = (Integer)obj; + + obj = this.getEstabelecimento_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.estabelecimento_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEstabelecimentoID.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEstabelecimentoID.java new file mode 100644 index 00000000..4458495b --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsLegislacaoEstabelecimentoID.java @@ -0,0 +1,37 @@ +/* +* HsLegislacaoEstabelecimentoID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.JDOIDClass; + +public final class HsLegislacaoEstabelecimentoID extends JDOIDClass implements Serializable +{ + public Integer legislacao_id; + public Integer estabelecimento_id; + + public HsLegislacaoEstabelecimentoID() + { + } + + + public Object[] getValue() + { + Object value[] = new Object[ 2 ]; + value[ 0 ] = legislacao_id; + value[ 1 ] = estabelecimento_id; + return value; + } + + public void setValues( Object values[] ) + { + legislacao_id = (Integer) values[ 0 ]; + estabelecimento_id = (Integer) values[ 1 ]; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsMedida.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsMedida.java new file mode 100644 index 00000000..c7ca53da --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsMedida.java @@ -0,0 +1,156 @@ +/* +* HsMedida.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsMedida implements JDOInnerObject +{ + private Integer id; + private String description; + private String requesitos_legais; + private java.sql.Timestamp deleted_date; + + public HsMedida() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsMedidaDataAuto.ID ) + { + return id; + } + else if( fieldName == HsMedidaDataAuto.DESCRIPTION ) + { + return description; + } + else if( fieldName == HsMedidaDataAuto.REQUESITOS_LEGAIS ) + { + return requesitos_legais; + } + else if( fieldName == HsMedidaDataAuto.DELETED_DATE ) + { + return deleted_date; + } + else if( fieldName.equals( HsMedidaDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsMedidaDataAuto.DESCRIPTION ) ) + { + return description; + } + else if( fieldName.equals( HsMedidaDataAuto.REQUESITOS_LEGAIS ) ) + { + return requesitos_legais; + } + else if( fieldName.equals( HsMedidaDataAuto.DELETED_DATE ) ) + { + return deleted_date; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsMedidaDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsMedidaDataAuto.DESCRIPTION ) + { + description = ( String ) value; + } + else if( fieldName == HsMedidaDataAuto.REQUESITOS_LEGAIS ) + { + requesitos_legais = ( String ) value; + } + else if( fieldName == HsMedidaDataAuto.DELETED_DATE ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( HsMedidaDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsMedidaDataAuto.DESCRIPTION ) ) + { + description = ( String ) value; + } + else if( fieldName.equals( HsMedidaDataAuto.REQUESITOS_LEGAIS ) ) + { + requesitos_legais = ( String ) value; + } + else if( fieldName.equals( HsMedidaDataAuto.DELETED_DATE ) ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String descriptionValue ) + { + this.description = descriptionValue; + } + + public String getRequesitos_legais() + { + return requesitos_legais; + } + + public void setRequesitos_legais(String requesitos_legaisValue ) + { + this.requesitos_legais = requesitos_legaisValue; + } + + public java.sql.Timestamp getDeleted_date() + { + return deleted_date; + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.deleted_date = deleted_dateValue; + } + + public Class getOuterClass() + { + return HsMedidaDataAuto.class; + } + + public HsMedidaDataAuto getOuterClassInstance() + { + HsMedidaDataAuto outerObj = new HsMedidaDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsMedidaData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsMedidaData.java new file mode 100644 index 00000000..a8633b3e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsMedidaData.java @@ -0,0 +1,18 @@ +/* +* HsMedidaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsMedidaData extends com.evolute.siprp.server.db.data.siprp_local3.HsMedidaDataAuto +{ + + public HsMedidaData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsMedidaDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsMedidaDataAuto.java new file mode 100644 index 00000000..cb1fe621 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsMedidaDataAuto.java @@ -0,0 +1,119 @@ +/* +* HsMedidaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsMedidaDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_medida"; + + public static final String ID = "id"; + public static final String ID_FULL = "hs_medida.id"; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_medida.description"; + public static final String REQUESITOS_LEGAIS = "requesitos_legais"; + public static final String REQUESITOS_LEGAIS_FULL = "hs_medida.requesitos_legais"; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_medida.deleted_date"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRIPTION, REQUESITOS_LEGAIS, DELETED_DATE, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DESCRIPTION, REQUESITOS_LEGAIS, DELETED_DATE, }; + + private Map dataHash; + + public HsMedidaDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getDescription() + { + return (String) get(DESCRIPTION); + } + + public void setDescription(String descriptionValue ) + { + this.set(DESCRIPTION, descriptionValue ); + } + + public String getRequesitos_legais() + { + return (String) get(REQUESITOS_LEGAIS); + } + + public void setRequesitos_legais(String requesitos_legaisValue ) + { + this.set(REQUESITOS_LEGAIS, requesitos_legaisValue ); + } + + public java.sql.Timestamp getDeleted_date() + { + return (java.sql.Timestamp) get(DELETED_DATE); + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.set(DELETED_DATE, deleted_dateValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsMedida.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacao.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacao.java new file mode 100644 index 00000000..ad7d6895 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacao.java @@ -0,0 +1,183 @@ +/* +* HsNormalizacao.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsNormalizacao implements JDOInnerObject +{ + private Integer id; + private String codigo; + private String descricao; + private Boolean portuguesa; + private java.sql.Timestamp deleted_date; + + public HsNormalizacao() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsNormalizacaoDataAuto.ID ) + { + return id; + } + else if( fieldName == HsNormalizacaoDataAuto.CODIGO ) + { + return codigo; + } + else if( fieldName == HsNormalizacaoDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName == HsNormalizacaoDataAuto.PORTUGUESA ) + { + return portuguesa; + } + else if( fieldName == HsNormalizacaoDataAuto.DELETED_DATE ) + { + return deleted_date; + } + else if( fieldName.equals( HsNormalizacaoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsNormalizacaoDataAuto.CODIGO ) ) + { + return codigo; + } + else if( fieldName.equals( HsNormalizacaoDataAuto.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( HsNormalizacaoDataAuto.PORTUGUESA ) ) + { + return portuguesa; + } + else if( fieldName.equals( HsNormalizacaoDataAuto.DELETED_DATE ) ) + { + return deleted_date; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsNormalizacaoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsNormalizacaoDataAuto.CODIGO ) + { + codigo = ( String ) value; + } + else if( fieldName == HsNormalizacaoDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == HsNormalizacaoDataAuto.PORTUGUESA ) + { + portuguesa = ( Boolean ) value; + } + else if( fieldName == HsNormalizacaoDataAuto.DELETED_DATE ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( HsNormalizacaoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsNormalizacaoDataAuto.CODIGO ) ) + { + codigo = ( String ) value; + } + else if( fieldName.equals( HsNormalizacaoDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( HsNormalizacaoDataAuto.PORTUGUESA ) ) + { + portuguesa = ( Boolean ) value; + } + else if( fieldName.equals( HsNormalizacaoDataAuto.DELETED_DATE ) ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getCodigo() + { + return codigo; + } + + public void setCodigo(String codigoValue ) + { + this.codigo = codigoValue; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public Boolean getPortuguesa() + { + return portuguesa; + } + + public void setPortuguesa(Boolean portuguesaValue ) + { + this.portuguesa = portuguesaValue; + } + + public java.sql.Timestamp getDeleted_date() + { + return deleted_date; + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.deleted_date = deleted_dateValue; + } + + public Class getOuterClass() + { + return HsNormalizacaoDataAuto.class; + } + + public HsNormalizacaoDataAuto getOuterClassInstance() + { + HsNormalizacaoDataAuto outerObj = new HsNormalizacaoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoData.java new file mode 100644 index 00000000..4f3994c2 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoData.java @@ -0,0 +1,18 @@ +/* +* HsNormalizacaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsNormalizacaoData extends com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoDataAuto +{ + + public HsNormalizacaoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoDataAuto.java new file mode 100644 index 00000000..24cb1ffa --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoDataAuto.java @@ -0,0 +1,131 @@ +/* +* HsNormalizacaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsNormalizacaoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_normalizacao"; + + public static final String ID = "id"; + public static final String ID_FULL = "hs_normalizacao.id"; + public static final String CODIGO = "codigo"; + public static final String CODIGO_FULL = "hs_normalizacao.codigo"; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "hs_normalizacao.descricao"; + public static final String PORTUGUESA = "portuguesa"; + public static final String PORTUGUESA_FULL = "hs_normalizacao.portuguesa"; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_normalizacao.deleted_date"; + + public static final String FIELD_NAMES[] = new String[]{ + CODIGO, DESCRICAO, PORTUGUESA, DELETED_DATE, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, CODIGO, DESCRICAO, PORTUGUESA, DELETED_DATE, }; + + private Map dataHash; + + public HsNormalizacaoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getCodigo() + { + return (String) get(CODIGO); + } + + public void setCodigo(String codigoValue ) + { + this.set(CODIGO, codigoValue ); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + public Boolean getPortuguesa() + { + return (Boolean) get(PORTUGUESA); + } + + public void setPortuguesa(Boolean portuguesaValue ) + { + this.set(PORTUGUESA, portuguesaValue ); + } + + public java.sql.Timestamp getDeleted_date() + { + return (java.sql.Timestamp) get(DELETED_DATE); + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.set(DELETED_DATE, deleted_dateValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsNormalizacao.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEmpresa.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEmpresa.java new file mode 100644 index 00000000..f37ffcbc --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEmpresa.java @@ -0,0 +1,114 @@ +/* +* HsNormalizacaoEmpresa.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsNormalizacaoEmpresa implements JDOInnerObject +{ + private Integer normalizacao_id; + private Integer empresa_id; + + public HsNormalizacaoEmpresa() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsNormalizacaoEmpresaDataAuto.NORMALIZACAO_ID ) + { + return normalizacao_id; + } + else if( fieldName == HsNormalizacaoEmpresaDataAuto.EMPRESA_ID ) + { + return empresa_id; + } + else if( fieldName.equals( HsNormalizacaoEmpresaDataAuto.NORMALIZACAO_ID ) ) + { + return normalizacao_id; + } + else if( fieldName.equals( HsNormalizacaoEmpresaDataAuto.EMPRESA_ID ) ) + { + return empresa_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsNormalizacaoEmpresaDataAuto.NORMALIZACAO_ID ) + { + normalizacao_id = ( Integer ) value; + } + else if( fieldName == HsNormalizacaoEmpresaDataAuto.EMPRESA_ID ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName.equals( HsNormalizacaoEmpresaDataAuto.NORMALIZACAO_ID ) ) + { + normalizacao_id = ( Integer ) value; + } + else if( fieldName.equals( HsNormalizacaoEmpresaDataAuto.EMPRESA_ID ) ) + { + empresa_id = ( Integer ) value; + } + } + + public Integer getNormalizacao_id() + { + return normalizacao_id; + } + + public void setNormalizacao_id(Integer normalizacao_idValue ) + { + this.normalizacao_id = normalizacao_idValue; + } + + public Integer getEmpresa_id() + { + return empresa_id; + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + this.empresa_id = empresa_idValue; + } + + public Class getOuterClass() + { + return HsNormalizacaoEmpresaDataAuto.class; + } + + public HsNormalizacaoEmpresaDataAuto getOuterClassInstance() + { + HsNormalizacaoEmpresaDataAuto outerObj = new HsNormalizacaoEmpresaDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoEmpresaID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoEmpresaID id = new com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoEmpresaID(); + + Object obj; + obj = this.getNormalizacao_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.normalizacao_id = (Integer)obj; + + obj = this.getEmpresa_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.empresa_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEmpresaData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEmpresaData.java new file mode 100644 index 00000000..5ac28c2b --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEmpresaData.java @@ -0,0 +1,18 @@ +/* +* HsNormalizacaoEmpresaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsNormalizacaoEmpresaData extends com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoEmpresaDataAuto +{ + + public HsNormalizacaoEmpresaData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEmpresaDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEmpresaDataAuto.java new file mode 100644 index 00000000..d93ea9ab --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEmpresaDataAuto.java @@ -0,0 +1,213 @@ +/* +* HsNormalizacaoEmpresaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsNormalizacaoEmpresaDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_normalizacao_empresa"; + + public static final String NORMALIZACAO_ID = "normalizacao_id"; + public static final String NORMALIZACAO_ID_FULL = "hs_normalizacao_empresa.normalizacao_id"; + public static final String TO_NORMALIZACAO_ID = "to normalizacao_id"; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "hs_normalizacao_empresa.empresa_id"; + public static final String TO_EMPRESA_ID = "to empresa_id"; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + NORMALIZACAO_ID, EMPRESA_ID, }; + + private Map dataHash; + + public HsNormalizacaoEmpresaDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getNormalizacao_id() + { + return (Integer) dataHash.get(NORMALIZACAO_ID); + } + + public void setNormalizacao_id(Integer normalizacao_idValue ) + { + dataHash.put(TO_NORMALIZACAO_ID, null); + dataHash.put(NORMALIZACAO_ID, normalizacao_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoData toNormalizacao_id() + throws Exception + { + if( dataHash.get(TO_NORMALIZACAO_ID) == null && getNormalizacao_id() != null ) + { + dataHash.put(TO_NORMALIZACAO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoData.class, new Object[]{ getNormalizacao_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoData) dataHash.get(TO_NORMALIZACAO_ID); + } + + public void setToNormalizacao_id(com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoData normalizacao_idObject ) + { + if( normalizacao_idObject == null ) + { + dataHash.put(NORMALIZACAO_ID, null); + } + else + { + dataHash.put(NORMALIZACAO_ID, normalizacao_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoData.ID )); + } + dataHash.put(TO_NORMALIZACAO_ID, normalizacao_idObject); + } + + public Integer getEmpresa_id() + { + return (Integer) dataHash.get(EMPRESA_ID); + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + dataHash.put(TO_EMPRESA_ID, null); + dataHash.put(EMPRESA_ID, empresa_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EmpresasData toEmpresa_id() + throws Exception + { + if( dataHash.get(TO_EMPRESA_ID) == null && getEmpresa_id() != null ) + { + dataHash.put(TO_EMPRESA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.class, new Object[]{ getEmpresa_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) dataHash.get(TO_EMPRESA_ID); + } + + public void setToEmpresa_id(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData empresa_idObject ) + { + if( empresa_idObject == null ) + { + dataHash.put(EMPRESA_ID, null); + } + else + { + dataHash.put(EMPRESA_ID, empresa_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + dataHash.put(TO_EMPRESA_ID, empresa_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_EMPRESA_ID.equals( fieldName ) ) + { + value = toEmpresa_id(); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + value = getEmpresa_id(); + } + else if( NORMALIZACAO_ID.equals( fieldName ) ) + { + value = getNormalizacao_id(); + } + else if( TO_NORMALIZACAO_ID.equals( fieldName ) ) + { + value = toNormalizacao_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_EMPRESA_ID.equals( fieldName ) ) + { + setToEmpresa_id( (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) value ); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + setEmpresa_id( (Integer) value ); + } + else if( NORMALIZACAO_ID.equals( fieldName ) ) + { + setNormalizacao_id( (Integer) value ); + } + else if( TO_NORMALIZACAO_ID.equals( fieldName ) ) + { + setToNormalizacao_id( (com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_NORMALIZACAO_ID) != null ) + { + toNormalizacao_id().save(); + dataHash.put(NORMALIZACAO_ID, toNormalizacao_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoData.ID )); + } + + if( dataHash.get(TO_EMPRESA_ID) != null ) + { + toEmpresa_id().save(); + dataHash.put(EMPRESA_ID, toEmpresa_id().get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsNormalizacaoEmpresa.class; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoEmpresaID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoEmpresaID id = new com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoEmpresaID(); + + Object obj; + obj = this.getNormalizacao_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.normalizacao_id = (Integer)obj; + + obj = this.getEmpresa_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.empresa_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEmpresaID.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEmpresaID.java new file mode 100644 index 00000000..1a6529b1 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEmpresaID.java @@ -0,0 +1,37 @@ +/* +* HsNormalizacaoEmpresaID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.JDOIDClass; + +public final class HsNormalizacaoEmpresaID extends JDOIDClass implements Serializable +{ + public Integer normalizacao_id; + public Integer empresa_id; + + public HsNormalizacaoEmpresaID() + { + } + + + public Object[] getValue() + { + Object value[] = new Object[ 2 ]; + value[ 0 ] = normalizacao_id; + value[ 1 ] = empresa_id; + return value; + } + + public void setValues( Object values[] ) + { + normalizacao_id = (Integer) values[ 0 ]; + empresa_id = (Integer) values[ 1 ]; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEstabelecimento.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEstabelecimento.java new file mode 100644 index 00000000..97fb0089 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEstabelecimento.java @@ -0,0 +1,114 @@ +/* +* HsNormalizacaoEstabelecimento.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsNormalizacaoEstabelecimento implements JDOInnerObject +{ + private Integer normalizacao_id; + private Integer estabelecimento_id; + + public HsNormalizacaoEstabelecimento() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsNormalizacaoEstabelecimentoDataAuto.NORMALIZACAO_ID ) + { + return normalizacao_id; + } + else if( fieldName == HsNormalizacaoEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) + { + return estabelecimento_id; + } + else if( fieldName.equals( HsNormalizacaoEstabelecimentoDataAuto.NORMALIZACAO_ID ) ) + { + return normalizacao_id; + } + else if( fieldName.equals( HsNormalizacaoEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) ) + { + return estabelecimento_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsNormalizacaoEstabelecimentoDataAuto.NORMALIZACAO_ID ) + { + normalizacao_id = ( Integer ) value; + } + else if( fieldName == HsNormalizacaoEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName.equals( HsNormalizacaoEstabelecimentoDataAuto.NORMALIZACAO_ID ) ) + { + normalizacao_id = ( Integer ) value; + } + else if( fieldName.equals( HsNormalizacaoEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) ) + { + estabelecimento_id = ( Integer ) value; + } + } + + public Integer getNormalizacao_id() + { + return normalizacao_id; + } + + public void setNormalizacao_id(Integer normalizacao_idValue ) + { + this.normalizacao_id = normalizacao_idValue; + } + + public Integer getEstabelecimento_id() + { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + this.estabelecimento_id = estabelecimento_idValue; + } + + public Class getOuterClass() + { + return HsNormalizacaoEstabelecimentoDataAuto.class; + } + + public HsNormalizacaoEstabelecimentoDataAuto getOuterClassInstance() + { + HsNormalizacaoEstabelecimentoDataAuto outerObj = new HsNormalizacaoEstabelecimentoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoEstabelecimentoID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoEstabelecimentoID id = new com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoEstabelecimentoID(); + + Object obj; + obj = this.getNormalizacao_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.normalizacao_id = (Integer)obj; + + obj = this.getEstabelecimento_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.estabelecimento_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEstabelecimentoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEstabelecimentoData.java new file mode 100644 index 00000000..f3343c7a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEstabelecimentoData.java @@ -0,0 +1,18 @@ +/* +* HsNormalizacaoEstabelecimentoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsNormalizacaoEstabelecimentoData extends com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoEstabelecimentoDataAuto +{ + + public HsNormalizacaoEstabelecimentoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEstabelecimentoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEstabelecimentoDataAuto.java new file mode 100644 index 00000000..d0074e2d --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEstabelecimentoDataAuto.java @@ -0,0 +1,213 @@ +/* +* HsNormalizacaoEstabelecimentoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsNormalizacaoEstabelecimentoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_normalizacao_estabelecimento"; + + public static final String NORMALIZACAO_ID = "normalizacao_id"; + public static final String NORMALIZACAO_ID_FULL = "hs_normalizacao_estabelecimento.normalizacao_id"; + public static final String TO_NORMALIZACAO_ID = "to normalizacao_id"; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "hs_normalizacao_estabelecimento.estabelecimento_id"; + public static final String TO_ESTABELECIMENTO_ID = "to estabelecimento_id"; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + NORMALIZACAO_ID, ESTABELECIMENTO_ID, }; + + private Map dataHash; + + public HsNormalizacaoEstabelecimentoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getNormalizacao_id() + { + return (Integer) dataHash.get(NORMALIZACAO_ID); + } + + public void setNormalizacao_id(Integer normalizacao_idValue ) + { + dataHash.put(TO_NORMALIZACAO_ID, null); + dataHash.put(NORMALIZACAO_ID, normalizacao_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoData toNormalizacao_id() + throws Exception + { + if( dataHash.get(TO_NORMALIZACAO_ID) == null && getNormalizacao_id() != null ) + { + dataHash.put(TO_NORMALIZACAO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoData.class, new Object[]{ getNormalizacao_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoData) dataHash.get(TO_NORMALIZACAO_ID); + } + + public void setToNormalizacao_id(com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoData normalizacao_idObject ) + { + if( normalizacao_idObject == null ) + { + dataHash.put(NORMALIZACAO_ID, null); + } + else + { + dataHash.put(NORMALIZACAO_ID, normalizacao_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoData.ID )); + } + dataHash.put(TO_NORMALIZACAO_ID, normalizacao_idObject); + } + + public Integer getEstabelecimento_id() + { + return (Integer) dataHash.get(ESTABELECIMENTO_ID); + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, null); + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData toEstabelecimento_id() + throws Exception + { + if( dataHash.get(TO_ESTABELECIMENTO_ID) == null && getEstabelecimento_id() != null ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.class, new Object[]{ getEstabelecimento_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) dataHash.get(TO_ESTABELECIMENTO_ID); + } + + public void setToEstabelecimento_id(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData estabelecimento_idObject ) + { + if( estabelecimento_idObject == null ) + { + dataHash.put(ESTABELECIMENTO_ID, null); + } + else + { + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + dataHash.put(TO_ESTABELECIMENTO_ID, estabelecimento_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = getEstabelecimento_id(); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = toEstabelecimento_id(); + } + else if( NORMALIZACAO_ID.equals( fieldName ) ) + { + value = getNormalizacao_id(); + } + else if( TO_NORMALIZACAO_ID.equals( fieldName ) ) + { + value = toNormalizacao_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setEstabelecimento_id( (Integer) value ); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setToEstabelecimento_id( (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) value ); + } + else if( NORMALIZACAO_ID.equals( fieldName ) ) + { + setNormalizacao_id( (Integer) value ); + } + else if( TO_NORMALIZACAO_ID.equals( fieldName ) ) + { + setToNormalizacao_id( (com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_NORMALIZACAO_ID) != null ) + { + toNormalizacao_id().save(); + dataHash.put(NORMALIZACAO_ID, toNormalizacao_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoData.ID )); + } + + if( dataHash.get(TO_ESTABELECIMENTO_ID) != null ) + { + toEstabelecimento_id().save(); + dataHash.put(ESTABELECIMENTO_ID, toEstabelecimento_id().get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsNormalizacaoEstabelecimento.class; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoEstabelecimentoID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoEstabelecimentoID id = new com.evolute.siprp.server.db.data.siprp_local3.HsNormalizacaoEstabelecimentoID(); + + Object obj; + obj = this.getNormalizacao_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.normalizacao_id = (Integer)obj; + + obj = this.getEstabelecimento_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.estabelecimento_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEstabelecimentoID.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEstabelecimentoID.java new file mode 100644 index 00000000..76fbd4ae --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsNormalizacaoEstabelecimentoID.java @@ -0,0 +1,37 @@ +/* +* HsNormalizacaoEstabelecimentoID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.JDOIDClass; + +public final class HsNormalizacaoEstabelecimentoID extends JDOIDClass implements Serializable +{ + public Integer normalizacao_id; + public Integer estabelecimento_id; + + public HsNormalizacaoEstabelecimentoID() + { + } + + + public Object[] getValue() + { + Object value[] = new Object[ 2 ]; + value[ 0 ] = normalizacao_id; + value[ 1 ] = estabelecimento_id; + return value; + } + + public void setValues( Object values[] ) + { + normalizacao_id = (Integer) values[ 0 ]; + estabelecimento_id = (Integer) values[ 1 ]; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPosto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPosto.java new file mode 100644 index 00000000..8a45fd18 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPosto.java @@ -0,0 +1,183 @@ +/* +* HsPosto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsPosto implements JDOInnerObject +{ + private Integer id; + private Integer area_id; + private String description; + private java.sql.Timestamp deleted_date; + private Boolean is_principal; + + public HsPosto() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsPostoDataAuto.ID ) + { + return id; + } + else if( fieldName == HsPostoDataAuto.AREA_ID ) + { + return area_id; + } + else if( fieldName == HsPostoDataAuto.DESCRIPTION ) + { + return description; + } + else if( fieldName == HsPostoDataAuto.DELETED_DATE ) + { + return deleted_date; + } + else if( fieldName == HsPostoDataAuto.IS_PRINCIPAL ) + { + return is_principal; + } + else if( fieldName.equals( HsPostoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsPostoDataAuto.AREA_ID ) ) + { + return area_id; + } + else if( fieldName.equals( HsPostoDataAuto.DESCRIPTION ) ) + { + return description; + } + else if( fieldName.equals( HsPostoDataAuto.DELETED_DATE ) ) + { + return deleted_date; + } + else if( fieldName.equals( HsPostoDataAuto.IS_PRINCIPAL ) ) + { + return is_principal; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsPostoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsPostoDataAuto.AREA_ID ) + { + area_id = ( Integer ) value; + } + else if( fieldName == HsPostoDataAuto.DESCRIPTION ) + { + description = ( String ) value; + } + else if( fieldName == HsPostoDataAuto.DELETED_DATE ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName == HsPostoDataAuto.IS_PRINCIPAL ) + { + is_principal = ( Boolean ) value; + } + else if( fieldName.equals( HsPostoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsPostoDataAuto.AREA_ID ) ) + { + area_id = ( Integer ) value; + } + else if( fieldName.equals( HsPostoDataAuto.DESCRIPTION ) ) + { + description = ( String ) value; + } + else if( fieldName.equals( HsPostoDataAuto.DELETED_DATE ) ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( HsPostoDataAuto.IS_PRINCIPAL ) ) + { + is_principal = ( Boolean ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getArea_id() + { + return area_id; + } + + public void setArea_id(Integer area_idValue ) + { + this.area_id = area_idValue; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String descriptionValue ) + { + this.description = descriptionValue; + } + + public java.sql.Timestamp getDeleted_date() + { + return deleted_date; + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.deleted_date = deleted_dateValue; + } + + public Boolean getIs_principal() + { + return is_principal; + } + + public void setIs_principal(Boolean is_principalValue ) + { + this.is_principal = is_principalValue; + } + + public Class getOuterClass() + { + return HsPostoDataAuto.class; + } + + public HsPostoDataAuto getOuterClassInstance() + { + HsPostoDataAuto outerObj = new HsPostoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoData.java new file mode 100644 index 00000000..3097ac5a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoData.java @@ -0,0 +1,18 @@ +/* +* HsPostoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsPostoData extends com.evolute.siprp.server.db.data.siprp_local3.HsPostoDataAuto +{ + + public HsPostoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoDataAuto.java new file mode 100644 index 00000000..5842bb3d --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoDataAuto.java @@ -0,0 +1,190 @@ +/* +* HsPostoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsPostoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_posto"; + + public static final String ID = "id"; + public static final String ID_FULL = "hs_posto.id"; + public static final String AREA_ID = "area_id"; + public static final String AREA_ID_FULL = "hs_posto.area_id"; + public static final String TO_AREA_ID = "to area_id"; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_posto.description"; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_posto.deleted_date"; + public static final String IS_PRINCIPAL = "is_principal"; + public static final String IS_PRINCIPAL_FULL = "hs_posto.is_principal"; + + public static final String FIELD_NAMES[] = new String[]{ + AREA_ID, TO_AREA_ID, DESCRIPTION, DELETED_DATE, IS_PRINCIPAL, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, AREA_ID, DESCRIPTION, DELETED_DATE, IS_PRINCIPAL, }; + + private Map dataHash; + + public HsPostoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getArea_id() + { + return (Integer) dataHash.get(AREA_ID); + } + + public void setArea_id(Integer area_idValue ) + { + dataHash.put(TO_AREA_ID, null); + dataHash.put(AREA_ID, area_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsAreaData toArea_id() + throws Exception + { + if( dataHash.get(TO_AREA_ID) == null && getArea_id() != null ) + { + dataHash.put(TO_AREA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsAreaData.class, new Object[]{ getArea_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsAreaData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsAreaData) dataHash.get(TO_AREA_ID); + } + + public void setToArea_id(com.evolute.siprp.server.db.data.siprp_local3.HsAreaData area_idObject ) + { + if( area_idObject == null ) + { + dataHash.put(AREA_ID, null); + } + else + { + dataHash.put(AREA_ID, area_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsAreaData.ID )); + } + dataHash.put(TO_AREA_ID, area_idObject); + } + + public String getDescription() + { + return (String) get(DESCRIPTION); + } + + public void setDescription(String descriptionValue ) + { + this.set(DESCRIPTION, descriptionValue ); + } + + public java.sql.Timestamp getDeleted_date() + { + return (java.sql.Timestamp) get(DELETED_DATE); + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.set(DELETED_DATE, deleted_dateValue ); + } + + public Boolean getIs_principal() + { + return (Boolean) get(IS_PRINCIPAL); + } + + public void setIs_principal(Boolean is_principalValue ) + { + this.set(IS_PRINCIPAL, is_principalValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_AREA_ID.equals( fieldName ) ) + { + value = toArea_id(); + } + else if( AREA_ID.equals( fieldName ) ) + { + value = getArea_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_AREA_ID.equals( fieldName ) ) + { + setToArea_id( (com.evolute.siprp.server.db.data.siprp_local3.HsAreaData) value ); + } + else if( AREA_ID.equals( fieldName ) ) + { + setArea_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_AREA_ID) != null ) + { + toArea_id().save(); + dataHash.put(AREA_ID, toArea_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsAreaData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsPosto.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoEstabelecimento.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoEstabelecimento.java new file mode 100644 index 00000000..ae1afd80 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoEstabelecimento.java @@ -0,0 +1,114 @@ +/* +* HsPostoEstabelecimento.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsPostoEstabelecimento implements JDOInnerObject +{ + private Integer posto_id; + private Integer estabelecimento_id; + + public HsPostoEstabelecimento() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsPostoEstabelecimentoDataAuto.POSTO_ID ) + { + return posto_id; + } + else if( fieldName == HsPostoEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) + { + return estabelecimento_id; + } + else if( fieldName.equals( HsPostoEstabelecimentoDataAuto.POSTO_ID ) ) + { + return posto_id; + } + else if( fieldName.equals( HsPostoEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) ) + { + return estabelecimento_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsPostoEstabelecimentoDataAuto.POSTO_ID ) + { + posto_id = ( Integer ) value; + } + else if( fieldName == HsPostoEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName.equals( HsPostoEstabelecimentoDataAuto.POSTO_ID ) ) + { + posto_id = ( Integer ) value; + } + else if( fieldName.equals( HsPostoEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) ) + { + estabelecimento_id = ( Integer ) value; + } + } + + public Integer getPosto_id() + { + return posto_id; + } + + public void setPosto_id(Integer posto_idValue ) + { + this.posto_id = posto_idValue; + } + + public Integer getEstabelecimento_id() + { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + this.estabelecimento_id = estabelecimento_idValue; + } + + public Class getOuterClass() + { + return HsPostoEstabelecimentoDataAuto.class; + } + + public HsPostoEstabelecimentoDataAuto getOuterClassInstance() + { + HsPostoEstabelecimentoDataAuto outerObj = new HsPostoEstabelecimentoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsPostoEstabelecimentoID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsPostoEstabelecimentoID id = new com.evolute.siprp.server.db.data.siprp_local3.HsPostoEstabelecimentoID(); + + Object obj; + obj = this.getPosto_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.posto_id = (Integer)obj; + + obj = this.getEstabelecimento_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.estabelecimento_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoEstabelecimentoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoEstabelecimentoData.java new file mode 100644 index 00000000..988cf403 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoEstabelecimentoData.java @@ -0,0 +1,18 @@ +/* +* HsPostoEstabelecimentoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsPostoEstabelecimentoData extends com.evolute.siprp.server.db.data.siprp_local3.HsPostoEstabelecimentoDataAuto +{ + + public HsPostoEstabelecimentoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoEstabelecimentoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoEstabelecimentoDataAuto.java new file mode 100644 index 00000000..caa1037d --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoEstabelecimentoDataAuto.java @@ -0,0 +1,213 @@ +/* +* HsPostoEstabelecimentoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsPostoEstabelecimentoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_posto_estabelecimento"; + + public static final String POSTO_ID = "posto_id"; + public static final String POSTO_ID_FULL = "hs_posto_estabelecimento.posto_id"; + public static final String TO_POSTO_ID = "to posto_id"; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "hs_posto_estabelecimento.estabelecimento_id"; + public static final String TO_ESTABELECIMENTO_ID = "to estabelecimento_id"; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + POSTO_ID, ESTABELECIMENTO_ID, }; + + private Map dataHash; + + public HsPostoEstabelecimentoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getPosto_id() + { + return (Integer) dataHash.get(POSTO_ID); + } + + public void setPosto_id(Integer posto_idValue ) + { + dataHash.put(TO_POSTO_ID, null); + dataHash.put(POSTO_ID, posto_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsPostoData toPosto_id() + throws Exception + { + if( dataHash.get(TO_POSTO_ID) == null && getPosto_id() != null ) + { + dataHash.put(TO_POSTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsPostoData.class, new Object[]{ getPosto_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsPostoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsPostoData) dataHash.get(TO_POSTO_ID); + } + + public void setToPosto_id(com.evolute.siprp.server.db.data.siprp_local3.HsPostoData posto_idObject ) + { + if( posto_idObject == null ) + { + dataHash.put(POSTO_ID, null); + } + else + { + dataHash.put(POSTO_ID, posto_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsPostoData.ID )); + } + dataHash.put(TO_POSTO_ID, posto_idObject); + } + + public Integer getEstabelecimento_id() + { + return (Integer) dataHash.get(ESTABELECIMENTO_ID); + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, null); + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData toEstabelecimento_id() + throws Exception + { + if( dataHash.get(TO_ESTABELECIMENTO_ID) == null && getEstabelecimento_id() != null ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.class, new Object[]{ getEstabelecimento_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) dataHash.get(TO_ESTABELECIMENTO_ID); + } + + public void setToEstabelecimento_id(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData estabelecimento_idObject ) + { + if( estabelecimento_idObject == null ) + { + dataHash.put(ESTABELECIMENTO_ID, null); + } + else + { + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + dataHash.put(TO_ESTABELECIMENTO_ID, estabelecimento_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_POSTO_ID.equals( fieldName ) ) + { + value = toPosto_id(); + } + else if( POSTO_ID.equals( fieldName ) ) + { + value = getPosto_id(); + } + else if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = getEstabelecimento_id(); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = toEstabelecimento_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_POSTO_ID.equals( fieldName ) ) + { + setToPosto_id( (com.evolute.siprp.server.db.data.siprp_local3.HsPostoData) value ); + } + else if( POSTO_ID.equals( fieldName ) ) + { + setPosto_id( (Integer) value ); + } + else if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setEstabelecimento_id( (Integer) value ); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setToEstabelecimento_id( (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_POSTO_ID) != null ) + { + toPosto_id().save(); + dataHash.put(POSTO_ID, toPosto_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsPostoData.ID )); + } + + if( dataHash.get(TO_ESTABELECIMENTO_ID) != null ) + { + toEstabelecimento_id().save(); + dataHash.put(ESTABELECIMENTO_ID, toEstabelecimento_id().get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsPostoEstabelecimento.class; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsPostoEstabelecimentoID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsPostoEstabelecimentoID id = new com.evolute.siprp.server.db.data.siprp_local3.HsPostoEstabelecimentoID(); + + Object obj; + obj = this.getPosto_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.posto_id = (Integer)obj; + + obj = this.getEstabelecimento_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.estabelecimento_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoEstabelecimentoID.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoEstabelecimentoID.java new file mode 100644 index 00000000..444f59d1 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoEstabelecimentoID.java @@ -0,0 +1,37 @@ +/* +* HsPostoEstabelecimentoID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.JDOIDClass; + +public final class HsPostoEstabelecimentoID extends JDOIDClass implements Serializable +{ + public Integer posto_id; + public Integer estabelecimento_id; + + public HsPostoEstabelecimentoID() + { + } + + + public Object[] getValue() + { + Object value[] = new Object[ 2 ]; + value[ 0 ] = posto_id; + value[ 1 ] = estabelecimento_id; + return value; + } + + public void setValues( Object values[] ) + { + posto_id = (Integer) values[ 0 ]; + estabelecimento_id = (Integer) values[ 1 ]; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoMedida.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoMedida.java new file mode 100644 index 00000000..b1340cca --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoMedida.java @@ -0,0 +1,114 @@ +/* +* HsPostoMedida.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsPostoMedida implements JDOInnerObject +{ + private Integer posto_id; + private Integer medida_id; + + public HsPostoMedida() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsPostoMedidaDataAuto.POSTO_ID ) + { + return posto_id; + } + else if( fieldName == HsPostoMedidaDataAuto.MEDIDA_ID ) + { + return medida_id; + } + else if( fieldName.equals( HsPostoMedidaDataAuto.POSTO_ID ) ) + { + return posto_id; + } + else if( fieldName.equals( HsPostoMedidaDataAuto.MEDIDA_ID ) ) + { + return medida_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsPostoMedidaDataAuto.POSTO_ID ) + { + posto_id = ( Integer ) value; + } + else if( fieldName == HsPostoMedidaDataAuto.MEDIDA_ID ) + { + medida_id = ( Integer ) value; + } + else if( fieldName.equals( HsPostoMedidaDataAuto.POSTO_ID ) ) + { + posto_id = ( Integer ) value; + } + else if( fieldName.equals( HsPostoMedidaDataAuto.MEDIDA_ID ) ) + { + medida_id = ( Integer ) value; + } + } + + public Integer getPosto_id() + { + return posto_id; + } + + public void setPosto_id(Integer posto_idValue ) + { + this.posto_id = posto_idValue; + } + + public Integer getMedida_id() + { + return medida_id; + } + + public void setMedida_id(Integer medida_idValue ) + { + this.medida_id = medida_idValue; + } + + public Class getOuterClass() + { + return HsPostoMedidaDataAuto.class; + } + + public HsPostoMedidaDataAuto getOuterClassInstance() + { + HsPostoMedidaDataAuto outerObj = new HsPostoMedidaDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsPostoMedidaID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsPostoMedidaID id = new com.evolute.siprp.server.db.data.siprp_local3.HsPostoMedidaID(); + + Object obj; + obj = this.getPosto_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.posto_id = (Integer)obj; + + obj = this.getMedida_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.medida_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoMedidaData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoMedidaData.java new file mode 100644 index 00000000..508f7f12 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoMedidaData.java @@ -0,0 +1,18 @@ +/* +* HsPostoMedidaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsPostoMedidaData extends com.evolute.siprp.server.db.data.siprp_local3.HsPostoMedidaDataAuto +{ + + public HsPostoMedidaData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoMedidaDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoMedidaDataAuto.java new file mode 100644 index 00000000..daeb7a9a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoMedidaDataAuto.java @@ -0,0 +1,213 @@ +/* +* HsPostoMedidaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsPostoMedidaDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_posto_medida"; + + public static final String POSTO_ID = "posto_id"; + public static final String POSTO_ID_FULL = "hs_posto_medida.posto_id"; + public static final String TO_POSTO_ID = "to posto_id"; + public static final String MEDIDA_ID = "medida_id"; + public static final String MEDIDA_ID_FULL = "hs_posto_medida.medida_id"; + public static final String TO_MEDIDA_ID = "to medida_id"; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + POSTO_ID, MEDIDA_ID, }; + + private Map dataHash; + + public HsPostoMedidaDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getPosto_id() + { + return (Integer) dataHash.get(POSTO_ID); + } + + public void setPosto_id(Integer posto_idValue ) + { + dataHash.put(TO_POSTO_ID, null); + dataHash.put(POSTO_ID, posto_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsPostoData toPosto_id() + throws Exception + { + if( dataHash.get(TO_POSTO_ID) == null && getPosto_id() != null ) + { + dataHash.put(TO_POSTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsPostoData.class, new Object[]{ getPosto_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsPostoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsPostoData) dataHash.get(TO_POSTO_ID); + } + + public void setToPosto_id(com.evolute.siprp.server.db.data.siprp_local3.HsPostoData posto_idObject ) + { + if( posto_idObject == null ) + { + dataHash.put(POSTO_ID, null); + } + else + { + dataHash.put(POSTO_ID, posto_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsPostoData.ID )); + } + dataHash.put(TO_POSTO_ID, posto_idObject); + } + + public Integer getMedida_id() + { + return (Integer) dataHash.get(MEDIDA_ID); + } + + public void setMedida_id(Integer medida_idValue ) + { + dataHash.put(TO_MEDIDA_ID, null); + dataHash.put(MEDIDA_ID, medida_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsMedidaData toMedida_id() + throws Exception + { + if( dataHash.get(TO_MEDIDA_ID) == null && getMedida_id() != null ) + { + dataHash.put(TO_MEDIDA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsMedidaData.class, new Object[]{ getMedida_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsMedidaData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsMedidaData) dataHash.get(TO_MEDIDA_ID); + } + + public void setToMedida_id(com.evolute.siprp.server.db.data.siprp_local3.HsMedidaData medida_idObject ) + { + if( medida_idObject == null ) + { + dataHash.put(MEDIDA_ID, null); + } + else + { + dataHash.put(MEDIDA_ID, medida_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsMedidaData.ID )); + } + dataHash.put(TO_MEDIDA_ID, medida_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_POSTO_ID.equals( fieldName ) ) + { + value = toPosto_id(); + } + else if( POSTO_ID.equals( fieldName ) ) + { + value = getPosto_id(); + } + else if( MEDIDA_ID.equals( fieldName ) ) + { + value = getMedida_id(); + } + else if( TO_MEDIDA_ID.equals( fieldName ) ) + { + value = toMedida_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_POSTO_ID.equals( fieldName ) ) + { + setToPosto_id( (com.evolute.siprp.server.db.data.siprp_local3.HsPostoData) value ); + } + else if( POSTO_ID.equals( fieldName ) ) + { + setPosto_id( (Integer) value ); + } + else if( MEDIDA_ID.equals( fieldName ) ) + { + setMedida_id( (Integer) value ); + } + else if( TO_MEDIDA_ID.equals( fieldName ) ) + { + setToMedida_id( (com.evolute.siprp.server.db.data.siprp_local3.HsMedidaData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_POSTO_ID) != null ) + { + toPosto_id().save(); + dataHash.put(POSTO_ID, toPosto_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsPostoData.ID )); + } + + if( dataHash.get(TO_MEDIDA_ID) != null ) + { + toMedida_id().save(); + dataHash.put(MEDIDA_ID, toMedida_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsMedidaData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsPostoMedida.class; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsPostoMedidaID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsPostoMedidaID id = new com.evolute.siprp.server.db.data.siprp_local3.HsPostoMedidaID(); + + Object obj; + obj = this.getPosto_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.posto_id = (Integer)obj; + + obj = this.getMedida_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.medida_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoMedidaID.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoMedidaID.java new file mode 100644 index 00000000..788d3ad8 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoMedidaID.java @@ -0,0 +1,37 @@ +/* +* HsPostoMedidaID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.JDOIDClass; + +public final class HsPostoMedidaID extends JDOIDClass implements Serializable +{ + public Integer posto_id; + public Integer medida_id; + + public HsPostoMedidaID() + { + } + + + public Object[] getValue() + { + Object value[] = new Object[ 2 ]; + value[ 0 ] = posto_id; + value[ 1 ] = medida_id; + return value; + } + + public void setValues( Object values[] ) + { + posto_id = (Integer) values[ 0 ]; + medida_id = (Integer) values[ 1 ]; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoRisco.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoRisco.java new file mode 100644 index 00000000..3f0ebc14 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoRisco.java @@ -0,0 +1,249 @@ +/* +* HsPostoRisco.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsPostoRisco implements JDOInnerObject +{ + private Integer posto_id; + private Integer risco_id; + private Integer probabilidade; + private Integer severidade; + private Integer valor_qualitativo; + private String is_plano_actuacao; + private Integer ordem; + + public HsPostoRisco() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsPostoRiscoDataAuto.POSTO_ID ) + { + return posto_id; + } + else if( fieldName == HsPostoRiscoDataAuto.RISCO_ID ) + { + return risco_id; + } + else if( fieldName == HsPostoRiscoDataAuto.PROBABILIDADE ) + { + return probabilidade; + } + else if( fieldName == HsPostoRiscoDataAuto.SEVERIDADE ) + { + return severidade; + } + else if( fieldName == HsPostoRiscoDataAuto.VALOR_QUALITATIVO ) + { + return valor_qualitativo; + } + else if( fieldName == HsPostoRiscoDataAuto.IS_PLANO_ACTUACAO ) + { + return is_plano_actuacao; + } + else if( fieldName == HsPostoRiscoDataAuto.ORDEM ) + { + return ordem; + } + else if( fieldName.equals( HsPostoRiscoDataAuto.POSTO_ID ) ) + { + return posto_id; + } + else if( fieldName.equals( HsPostoRiscoDataAuto.RISCO_ID ) ) + { + return risco_id; + } + else if( fieldName.equals( HsPostoRiscoDataAuto.PROBABILIDADE ) ) + { + return probabilidade; + } + else if( fieldName.equals( HsPostoRiscoDataAuto.SEVERIDADE ) ) + { + return severidade; + } + else if( fieldName.equals( HsPostoRiscoDataAuto.VALOR_QUALITATIVO ) ) + { + return valor_qualitativo; + } + else if( fieldName.equals( HsPostoRiscoDataAuto.IS_PLANO_ACTUACAO ) ) + { + return is_plano_actuacao; + } + else if( fieldName.equals( HsPostoRiscoDataAuto.ORDEM ) ) + { + return ordem; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsPostoRiscoDataAuto.POSTO_ID ) + { + posto_id = ( Integer ) value; + } + else if( fieldName == HsPostoRiscoDataAuto.RISCO_ID ) + { + risco_id = ( Integer ) value; + } + else if( fieldName == HsPostoRiscoDataAuto.PROBABILIDADE ) + { + probabilidade = ( Integer ) value; + } + else if( fieldName == HsPostoRiscoDataAuto.SEVERIDADE ) + { + severidade = ( Integer ) value; + } + else if( fieldName == HsPostoRiscoDataAuto.VALOR_QUALITATIVO ) + { + valor_qualitativo = ( Integer ) value; + } + else if( fieldName == HsPostoRiscoDataAuto.IS_PLANO_ACTUACAO ) + { + is_plano_actuacao = ( String ) value; + } + else if( fieldName == HsPostoRiscoDataAuto.ORDEM ) + { + ordem = ( Integer ) value; + } + else if( fieldName.equals( HsPostoRiscoDataAuto.POSTO_ID ) ) + { + posto_id = ( Integer ) value; + } + else if( fieldName.equals( HsPostoRiscoDataAuto.RISCO_ID ) ) + { + risco_id = ( Integer ) value; + } + else if( fieldName.equals( HsPostoRiscoDataAuto.PROBABILIDADE ) ) + { + probabilidade = ( Integer ) value; + } + else if( fieldName.equals( HsPostoRiscoDataAuto.SEVERIDADE ) ) + { + severidade = ( Integer ) value; + } + else if( fieldName.equals( HsPostoRiscoDataAuto.VALOR_QUALITATIVO ) ) + { + valor_qualitativo = ( Integer ) value; + } + else if( fieldName.equals( HsPostoRiscoDataAuto.IS_PLANO_ACTUACAO ) ) + { + is_plano_actuacao = ( String ) value; + } + else if( fieldName.equals( HsPostoRiscoDataAuto.ORDEM ) ) + { + ordem = ( Integer ) value; + } + } + + public Integer getPosto_id() + { + return posto_id; + } + + public void setPosto_id(Integer posto_idValue ) + { + this.posto_id = posto_idValue; + } + + public Integer getRisco_id() + { + return risco_id; + } + + public void setRisco_id(Integer risco_idValue ) + { + this.risco_id = risco_idValue; + } + + public Integer getProbabilidade() + { + return probabilidade; + } + + public void setProbabilidade(Integer probabilidadeValue ) + { + this.probabilidade = probabilidadeValue; + } + + public Integer getSeveridade() + { + return severidade; + } + + public void setSeveridade(Integer severidadeValue ) + { + this.severidade = severidadeValue; + } + + public Integer getValor_qualitativo() + { + return valor_qualitativo; + } + + public void setValor_qualitativo(Integer valor_qualitativoValue ) + { + this.valor_qualitativo = valor_qualitativoValue; + } + + public String getIs_plano_actuacao() + { + return is_plano_actuacao; + } + + public void setIs_plano_actuacao(String is_plano_actuacaoValue ) + { + this.is_plano_actuacao = is_plano_actuacaoValue; + } + + public Integer getOrdem() + { + return ordem; + } + + public void setOrdem(Integer ordemValue ) + { + this.ordem = ordemValue; + } + + public Class getOuterClass() + { + return HsPostoRiscoDataAuto.class; + } + + public HsPostoRiscoDataAuto getOuterClassInstance() + { + HsPostoRiscoDataAuto outerObj = new HsPostoRiscoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsPostoRiscoID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsPostoRiscoID id = new com.evolute.siprp.server.db.data.siprp_local3.HsPostoRiscoID(); + + Object obj; + obj = this.getPosto_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.posto_id = (Integer)obj; + + obj = this.getRisco_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.risco_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoRiscoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoRiscoData.java new file mode 100644 index 00000000..46e1e2a4 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoRiscoData.java @@ -0,0 +1,18 @@ +/* +* HsPostoRiscoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsPostoRiscoData extends com.evolute.siprp.server.db.data.siprp_local3.HsPostoRiscoDataAuto +{ + + public HsPostoRiscoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoRiscoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoRiscoDataAuto.java new file mode 100644 index 00000000..6a729287 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoRiscoDataAuto.java @@ -0,0 +1,322 @@ +/* +* HsPostoRiscoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsPostoRiscoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_posto_risco"; + + public static final String POSTO_ID = "posto_id"; + public static final String POSTO_ID_FULL = "hs_posto_risco.posto_id"; + public static final String TO_POSTO_ID = "to posto_id"; + public static final String RISCO_ID = "risco_id"; + public static final String RISCO_ID_FULL = "hs_posto_risco.risco_id"; + public static final String TO_RISCO_ID = "to risco_id"; + public static final String PROBABILIDADE = "probabilidade"; + public static final String PROBABILIDADE_FULL = "hs_posto_risco.probabilidade"; + public static final String SEVERIDADE = "severidade"; + public static final String SEVERIDADE_FULL = "hs_posto_risco.severidade"; + public static final String VALOR_QUALITATIVO = "valor_qualitativo"; + public static final String VALOR_QUALITATIVO_FULL = "hs_posto_risco.valor_qualitativo"; + public static final String TO_VALOR_QUALITATIVO = "to valor_qualitativo"; + public static final String IS_PLANO_ACTUACAO = "is_plano_actuacao"; + public static final String IS_PLANO_ACTUACAO_FULL = "hs_posto_risco.is_plano_actuacao"; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "hs_posto_risco.ordem"; + + public static final String FIELD_NAMES[] = new String[]{ + PROBABILIDADE, SEVERIDADE, VALOR_QUALITATIVO, TO_VALOR_QUALITATIVO, + IS_PLANO_ACTUACAO, ORDEM, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + POSTO_ID, RISCO_ID, PROBABILIDADE, SEVERIDADE, VALOR_QUALITATIVO, + IS_PLANO_ACTUACAO, ORDEM, }; + + private Map dataHash; + + public HsPostoRiscoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getPosto_id() + { + return (Integer) dataHash.get(POSTO_ID); + } + + public void setPosto_id(Integer posto_idValue ) + { + dataHash.put(TO_POSTO_ID, null); + dataHash.put(POSTO_ID, posto_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsPostoData toPosto_id() + throws Exception + { + if( dataHash.get(TO_POSTO_ID) == null && getPosto_id() != null ) + { + dataHash.put(TO_POSTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsPostoData.class, new Object[]{ getPosto_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsPostoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsPostoData) dataHash.get(TO_POSTO_ID); + } + + public void setToPosto_id(com.evolute.siprp.server.db.data.siprp_local3.HsPostoData posto_idObject ) + { + if( posto_idObject == null ) + { + dataHash.put(POSTO_ID, null); + } + else + { + dataHash.put(POSTO_ID, posto_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsPostoData.ID )); + } + dataHash.put(TO_POSTO_ID, posto_idObject); + } + + public Integer getRisco_id() + { + return (Integer) dataHash.get(RISCO_ID); + } + + public void setRisco_id(Integer risco_idValue ) + { + dataHash.put(TO_RISCO_ID, null); + dataHash.put(RISCO_ID, risco_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData toRisco_id() + throws Exception + { + if( dataHash.get(TO_RISCO_ID) == null && getRisco_id() != null ) + { + dataHash.put(TO_RISCO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData.class, new Object[]{ getRisco_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData) dataHash.get(TO_RISCO_ID); + } + + public void setToRisco_id(com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData risco_idObject ) + { + if( risco_idObject == null ) + { + dataHash.put(RISCO_ID, null); + } + else + { + dataHash.put(RISCO_ID, risco_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData.ID )); + } + dataHash.put(TO_RISCO_ID, risco_idObject); + } + + public Integer getProbabilidade() + { + return (Integer) get(PROBABILIDADE); + } + + public void setProbabilidade(Integer probabilidadeValue ) + { + this.set(PROBABILIDADE, probabilidadeValue ); + } + + public Integer getSeveridade() + { + return (Integer) get(SEVERIDADE); + } + + public void setSeveridade(Integer severidadeValue ) + { + this.set(SEVERIDADE, severidadeValue ); + } + + public Integer getValor_qualitativo() + { + return (Integer) dataHash.get(VALOR_QUALITATIVO); + } + + public void setValor_qualitativo(Integer valor_qualitativoValue ) + { + dataHash.put(TO_VALOR_QUALITATIVO, null); + dataHash.put(VALOR_QUALITATIVO, valor_qualitativoValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoValorQualitativoData toValor_qualitativo() + throws Exception + { + if( dataHash.get(TO_VALOR_QUALITATIVO) == null && getValor_qualitativo() != null ) + { + dataHash.put(TO_VALOR_QUALITATIVO, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoValorQualitativoData.class, new Object[]{ getValor_qualitativo() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoValorQualitativoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoValorQualitativoData) dataHash.get(TO_VALOR_QUALITATIVO); + } + + public void setToValor_qualitativo(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoValorQualitativoData valor_qualitativoObject ) + { + if( valor_qualitativoObject == null ) + { + dataHash.put(VALOR_QUALITATIVO, null); + } + else + { + dataHash.put(VALOR_QUALITATIVO, valor_qualitativoObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoValorQualitativoData.ID )); + } + dataHash.put(TO_VALOR_QUALITATIVO, valor_qualitativoObject); + } + + public String getIs_plano_actuacao() + { + return (String) get(IS_PLANO_ACTUACAO); + } + + public void setIs_plano_actuacao(String is_plano_actuacaoValue ) + { + this.set(IS_PLANO_ACTUACAO, is_plano_actuacaoValue ); + } + + public Integer getOrdem() + { + return (Integer) get(ORDEM); + } + + public void setOrdem(Integer ordemValue ) + { + this.set(ORDEM, ordemValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_POSTO_ID.equals( fieldName ) ) + { + value = toPosto_id(); + } + else if( POSTO_ID.equals( fieldName ) ) + { + value = getPosto_id(); + } + else if( TO_VALOR_QUALITATIVO.equals( fieldName ) ) + { + value = toValor_qualitativo(); + } + else if( VALOR_QUALITATIVO.equals( fieldName ) ) + { + value = getValor_qualitativo(); + } + else if( TO_RISCO_ID.equals( fieldName ) ) + { + value = toRisco_id(); + } + else if( RISCO_ID.equals( fieldName ) ) + { + value = getRisco_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_POSTO_ID.equals( fieldName ) ) + { + setToPosto_id( (com.evolute.siprp.server.db.data.siprp_local3.HsPostoData) value ); + } + else if( POSTO_ID.equals( fieldName ) ) + { + setPosto_id( (Integer) value ); + } + else if( TO_VALOR_QUALITATIVO.equals( fieldName ) ) + { + setToValor_qualitativo( (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoValorQualitativoData) value ); + } + else if( VALOR_QUALITATIVO.equals( fieldName ) ) + { + setValor_qualitativo( (Integer) value ); + } + else if( TO_RISCO_ID.equals( fieldName ) ) + { + setToRisco_id( (com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData) value ); + } + else if( RISCO_ID.equals( fieldName ) ) + { + setRisco_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_POSTO_ID) != null ) + { + toPosto_id().save(); + dataHash.put(POSTO_ID, toPosto_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsPostoData.ID )); + } + + if( dataHash.get(TO_RISCO_ID) != null ) + { + toRisco_id().save(); + dataHash.put(RISCO_ID, toRisco_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData.ID )); + } + + if( dataHash.get(TO_VALOR_QUALITATIVO) != null ) + { + toValor_qualitativo().save(); + dataHash.put(VALOR_QUALITATIVO, toValor_qualitativo().get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoValorQualitativoData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsPostoRisco.class; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsPostoRiscoID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsPostoRiscoID id = new com.evolute.siprp.server.db.data.siprp_local3.HsPostoRiscoID(); + + Object obj; + obj = this.getPosto_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.posto_id = (Integer)obj; + + obj = this.getRisco_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.risco_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoRiscoID.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoRiscoID.java new file mode 100644 index 00000000..887d7c05 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsPostoRiscoID.java @@ -0,0 +1,37 @@ +/* +* HsPostoRiscoID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.JDOIDClass; + +public final class HsPostoRiscoID extends JDOIDClass implements Serializable +{ + public Integer posto_id; + public Integer risco_id; + + public HsPostoRiscoID() + { + } + + + public Object[] getValue() + { + Object value[] = new Object[ 2 ]; + value[ 0 ] = posto_id; + value[ 1 ] = risco_id; + return value; + } + + public void setValues( Object values[] ) + { + posto_id = (Integer) values[ 0 ]; + risco_id = (Integer) values[ 1 ]; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorio.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorio.java new file mode 100644 index 00000000..5a338fd5 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorio.java @@ -0,0 +1,399 @@ +/* +* HsRelatorio.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsRelatorio implements JDOInnerObject +{ + private Integer id; + private java.util.Date data; + private java.sql.Timestamp deleted_date; + private Integer marcacao_id; + private java.sql.Timestamp is_submetido; + private Boolean avaliacao_inicial; + private String acompanhante1; + private String funcao_acompanhante1; + private String acompanhante2; + private String funcao_acompanhante2; + private String acompanhante3; + private String funcao_acompanhante3; + private String funcionarios; + + public HsRelatorio() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsRelatorioDataAuto.ID ) + { + return id; + } + else if( fieldName == HsRelatorioDataAuto.DATA ) + { + return data; + } + else if( fieldName == HsRelatorioDataAuto.DELETED_DATE ) + { + return deleted_date; + } + else if( fieldName == HsRelatorioDataAuto.MARCACAO_ID ) + { + return marcacao_id; + } + else if( fieldName == HsRelatorioDataAuto.IS_SUBMETIDO ) + { + return is_submetido; + } + else if( fieldName == HsRelatorioDataAuto.AVALIACAO_INICIAL ) + { + return avaliacao_inicial; + } + else if( fieldName == HsRelatorioDataAuto.ACOMPANHANTE1 ) + { + return acompanhante1; + } + else if( fieldName == HsRelatorioDataAuto.FUNCAO_ACOMPANHANTE1 ) + { + return funcao_acompanhante1; + } + else if( fieldName == HsRelatorioDataAuto.ACOMPANHANTE2 ) + { + return acompanhante2; + } + else if( fieldName == HsRelatorioDataAuto.FUNCAO_ACOMPANHANTE2 ) + { + return funcao_acompanhante2; + } + else if( fieldName == HsRelatorioDataAuto.ACOMPANHANTE3 ) + { + return acompanhante3; + } + else if( fieldName == HsRelatorioDataAuto.FUNCAO_ACOMPANHANTE3 ) + { + return funcao_acompanhante3; + } + else if( fieldName == HsRelatorioDataAuto.FUNCIONARIOS ) + { + return funcionarios; + } + else if( fieldName.equals( HsRelatorioDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsRelatorioDataAuto.DATA ) ) + { + return data; + } + else if( fieldName.equals( HsRelatorioDataAuto.DELETED_DATE ) ) + { + return deleted_date; + } + else if( fieldName.equals( HsRelatorioDataAuto.MARCACAO_ID ) ) + { + return marcacao_id; + } + else if( fieldName.equals( HsRelatorioDataAuto.IS_SUBMETIDO ) ) + { + return is_submetido; + } + else if( fieldName.equals( HsRelatorioDataAuto.AVALIACAO_INICIAL ) ) + { + return avaliacao_inicial; + } + else if( fieldName.equals( HsRelatorioDataAuto.ACOMPANHANTE1 ) ) + { + return acompanhante1; + } + else if( fieldName.equals( HsRelatorioDataAuto.FUNCAO_ACOMPANHANTE1 ) ) + { + return funcao_acompanhante1; + } + else if( fieldName.equals( HsRelatorioDataAuto.ACOMPANHANTE2 ) ) + { + return acompanhante2; + } + else if( fieldName.equals( HsRelatorioDataAuto.FUNCAO_ACOMPANHANTE2 ) ) + { + return funcao_acompanhante2; + } + else if( fieldName.equals( HsRelatorioDataAuto.ACOMPANHANTE3 ) ) + { + return acompanhante3; + } + else if( fieldName.equals( HsRelatorioDataAuto.FUNCAO_ACOMPANHANTE3 ) ) + { + return funcao_acompanhante3; + } + else if( fieldName.equals( HsRelatorioDataAuto.FUNCIONARIOS ) ) + { + return funcionarios; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsRelatorioDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsRelatorioDataAuto.DATA ) + { + data = ( java.util.Date ) value; + } + else if( fieldName == HsRelatorioDataAuto.DELETED_DATE ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName == HsRelatorioDataAuto.MARCACAO_ID ) + { + marcacao_id = ( Integer ) value; + } + else if( fieldName == HsRelatorioDataAuto.IS_SUBMETIDO ) + { + is_submetido = ( java.sql.Timestamp ) value; + } + else if( fieldName == HsRelatorioDataAuto.AVALIACAO_INICIAL ) + { + avaliacao_inicial = ( Boolean ) value; + } + else if( fieldName == HsRelatorioDataAuto.ACOMPANHANTE1 ) + { + acompanhante1 = ( String ) value; + } + else if( fieldName == HsRelatorioDataAuto.FUNCAO_ACOMPANHANTE1 ) + { + funcao_acompanhante1 = ( String ) value; + } + else if( fieldName == HsRelatorioDataAuto.ACOMPANHANTE2 ) + { + acompanhante2 = ( String ) value; + } + else if( fieldName == HsRelatorioDataAuto.FUNCAO_ACOMPANHANTE2 ) + { + funcao_acompanhante2 = ( String ) value; + } + else if( fieldName == HsRelatorioDataAuto.ACOMPANHANTE3 ) + { + acompanhante3 = ( String ) value; + } + else if( fieldName == HsRelatorioDataAuto.FUNCAO_ACOMPANHANTE3 ) + { + funcao_acompanhante3 = ( String ) value; + } + else if( fieldName == HsRelatorioDataAuto.FUNCIONARIOS ) + { + funcionarios = ( String ) value; + } + else if( fieldName.equals( HsRelatorioDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioDataAuto.DATA ) ) + { + data = ( java.util.Date ) value; + } + else if( fieldName.equals( HsRelatorioDataAuto.DELETED_DATE ) ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( HsRelatorioDataAuto.MARCACAO_ID ) ) + { + marcacao_id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioDataAuto.IS_SUBMETIDO ) ) + { + is_submetido = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( HsRelatorioDataAuto.AVALIACAO_INICIAL ) ) + { + avaliacao_inicial = ( Boolean ) value; + } + else if( fieldName.equals( HsRelatorioDataAuto.ACOMPANHANTE1 ) ) + { + acompanhante1 = ( String ) value; + } + else if( fieldName.equals( HsRelatorioDataAuto.FUNCAO_ACOMPANHANTE1 ) ) + { + funcao_acompanhante1 = ( String ) value; + } + else if( fieldName.equals( HsRelatorioDataAuto.ACOMPANHANTE2 ) ) + { + acompanhante2 = ( String ) value; + } + else if( fieldName.equals( HsRelatorioDataAuto.FUNCAO_ACOMPANHANTE2 ) ) + { + funcao_acompanhante2 = ( String ) value; + } + else if( fieldName.equals( HsRelatorioDataAuto.ACOMPANHANTE3 ) ) + { + acompanhante3 = ( String ) value; + } + else if( fieldName.equals( HsRelatorioDataAuto.FUNCAO_ACOMPANHANTE3 ) ) + { + funcao_acompanhante3 = ( String ) value; + } + else if( fieldName.equals( HsRelatorioDataAuto.FUNCIONARIOS ) ) + { + funcionarios = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public java.util.Date getData() + { + return data; + } + + public void setData(java.util.Date dataValue ) + { + this.data = dataValue; + } + + public java.sql.Timestamp getDeleted_date() + { + return deleted_date; + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.deleted_date = deleted_dateValue; + } + + public Integer getMarcacao_id() + { + return marcacao_id; + } + + public void setMarcacao_id(Integer marcacao_idValue ) + { + this.marcacao_id = marcacao_idValue; + } + + public java.sql.Timestamp getIs_submetido() + { + return is_submetido; + } + + public void setIs_submetido(java.sql.Timestamp is_submetidoValue ) + { + this.is_submetido = is_submetidoValue; + } + + public Boolean getAvaliacao_inicial() + { + return avaliacao_inicial; + } + + public void setAvaliacao_inicial(Boolean avaliacao_inicialValue ) + { + this.avaliacao_inicial = avaliacao_inicialValue; + } + + public String getAcompanhante1() + { + return acompanhante1; + } + + public void setAcompanhante1(String acompanhante1Value ) + { + this.acompanhante1 = acompanhante1Value; + } + + public String getFuncao_acompanhante1() + { + return funcao_acompanhante1; + } + + public void setFuncao_acompanhante1(String funcao_acompanhante1Value ) + { + this.funcao_acompanhante1 = funcao_acompanhante1Value; + } + + public String getAcompanhante2() + { + return acompanhante2; + } + + public void setAcompanhante2(String acompanhante2Value ) + { + this.acompanhante2 = acompanhante2Value; + } + + public String getFuncao_acompanhante2() + { + return funcao_acompanhante2; + } + + public void setFuncao_acompanhante2(String funcao_acompanhante2Value ) + { + this.funcao_acompanhante2 = funcao_acompanhante2Value; + } + + public String getAcompanhante3() + { + return acompanhante3; + } + + public void setAcompanhante3(String acompanhante3Value ) + { + this.acompanhante3 = acompanhante3Value; + } + + public String getFuncao_acompanhante3() + { + return funcao_acompanhante3; + } + + public void setFuncao_acompanhante3(String funcao_acompanhante3Value ) + { + this.funcao_acompanhante3 = funcao_acompanhante3Value; + } + + public String getFuncionarios() + { + return funcionarios; + } + + public void setFuncionarios(String funcionariosValue ) + { + this.funcionarios = funcionariosValue; + } + + public Class getOuterClass() + { + return HsRelatorioDataAuto.class; + } + + public HsRelatorioDataAuto getOuterClassInstance() + { + HsRelatorioDataAuto outerObj = new HsRelatorioDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioArea.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioArea.java new file mode 100644 index 00000000..a8c808f4 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioArea.java @@ -0,0 +1,183 @@ +/* +* HsRelatorioArea.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsRelatorioArea implements JDOInnerObject +{ + private Integer id; + private String description; + private java.sql.Timestamp deleted_date; + private Integer relatorio_id; + private Integer ordem; + + public HsRelatorioArea() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsRelatorioAreaDataAuto.ID ) + { + return id; + } + else if( fieldName == HsRelatorioAreaDataAuto.DESCRIPTION ) + { + return description; + } + else if( fieldName == HsRelatorioAreaDataAuto.DELETED_DATE ) + { + return deleted_date; + } + else if( fieldName == HsRelatorioAreaDataAuto.RELATORIO_ID ) + { + return relatorio_id; + } + else if( fieldName == HsRelatorioAreaDataAuto.ORDEM ) + { + return ordem; + } + else if( fieldName.equals( HsRelatorioAreaDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsRelatorioAreaDataAuto.DESCRIPTION ) ) + { + return description; + } + else if( fieldName.equals( HsRelatorioAreaDataAuto.DELETED_DATE ) ) + { + return deleted_date; + } + else if( fieldName.equals( HsRelatorioAreaDataAuto.RELATORIO_ID ) ) + { + return relatorio_id; + } + else if( fieldName.equals( HsRelatorioAreaDataAuto.ORDEM ) ) + { + return ordem; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsRelatorioAreaDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsRelatorioAreaDataAuto.DESCRIPTION ) + { + description = ( String ) value; + } + else if( fieldName == HsRelatorioAreaDataAuto.DELETED_DATE ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName == HsRelatorioAreaDataAuto.RELATORIO_ID ) + { + relatorio_id = ( Integer ) value; + } + else if( fieldName == HsRelatorioAreaDataAuto.ORDEM ) + { + ordem = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioAreaDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioAreaDataAuto.DESCRIPTION ) ) + { + description = ( String ) value; + } + else if( fieldName.equals( HsRelatorioAreaDataAuto.DELETED_DATE ) ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( HsRelatorioAreaDataAuto.RELATORIO_ID ) ) + { + relatorio_id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioAreaDataAuto.ORDEM ) ) + { + ordem = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String descriptionValue ) + { + this.description = descriptionValue; + } + + public java.sql.Timestamp getDeleted_date() + { + return deleted_date; + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.deleted_date = deleted_dateValue; + } + + public Integer getRelatorio_id() + { + return relatorio_id; + } + + public void setRelatorio_id(Integer relatorio_idValue ) + { + this.relatorio_id = relatorio_idValue; + } + + public Integer getOrdem() + { + return ordem; + } + + public void setOrdem(Integer ordemValue ) + { + this.ordem = ordemValue; + } + + public Class getOuterClass() + { + return HsRelatorioAreaDataAuto.class; + } + + public HsRelatorioAreaDataAuto getOuterClassInstance() + { + HsRelatorioAreaDataAuto outerObj = new HsRelatorioAreaDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioAreaData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioAreaData.java new file mode 100644 index 00000000..d9640a30 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioAreaData.java @@ -0,0 +1,18 @@ +/* +* HsRelatorioAreaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsRelatorioAreaData extends com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioAreaDataAuto +{ + + public HsRelatorioAreaData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioAreaDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioAreaDataAuto.java new file mode 100644 index 00000000..6f84cb7a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioAreaDataAuto.java @@ -0,0 +1,190 @@ +/* +* HsRelatorioAreaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsRelatorioAreaDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_relatorio_area"; + + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio_area.id"; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_relatorio_area.description"; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_relatorio_area.deleted_date"; + public static final String RELATORIO_ID = "relatorio_id"; + public static final String RELATORIO_ID_FULL = "hs_relatorio_area.relatorio_id"; + public static final String TO_RELATORIO_ID = "to relatorio_id"; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "hs_relatorio_area.ordem"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRIPTION, DELETED_DATE, RELATORIO_ID, TO_RELATORIO_ID, ORDEM, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DESCRIPTION, DELETED_DATE, RELATORIO_ID, ORDEM, }; + + private Map dataHash; + + public HsRelatorioAreaDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getDescription() + { + return (String) get(DESCRIPTION); + } + + public void setDescription(String descriptionValue ) + { + this.set(DESCRIPTION, descriptionValue ); + } + + public java.sql.Timestamp getDeleted_date() + { + return (java.sql.Timestamp) get(DELETED_DATE); + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.set(DELETED_DATE, deleted_dateValue ); + } + + public Integer getRelatorio_id() + { + return (Integer) dataHash.get(RELATORIO_ID); + } + + public void setRelatorio_id(Integer relatorio_idValue ) + { + dataHash.put(TO_RELATORIO_ID, null); + dataHash.put(RELATORIO_ID, relatorio_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData toRelatorio_id() + throws Exception + { + if( dataHash.get(TO_RELATORIO_ID) == null && getRelatorio_id() != null ) + { + dataHash.put(TO_RELATORIO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.class, new Object[]{ getRelatorio_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData) dataHash.get(TO_RELATORIO_ID); + } + + public void setToRelatorio_id(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData relatorio_idObject ) + { + if( relatorio_idObject == null ) + { + dataHash.put(RELATORIO_ID, null); + } + else + { + dataHash.put(RELATORIO_ID, relatorio_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.ID )); + } + dataHash.put(TO_RELATORIO_ID, relatorio_idObject); + } + + public Integer getOrdem() + { + return (Integer) get(ORDEM); + } + + public void setOrdem(Integer ordemValue ) + { + this.set(ORDEM, ordemValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( RELATORIO_ID.equals( fieldName ) ) + { + value = getRelatorio_id(); + } + else if( TO_RELATORIO_ID.equals( fieldName ) ) + { + value = toRelatorio_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( RELATORIO_ID.equals( fieldName ) ) + { + setRelatorio_id( (Integer) value ); + } + else if( TO_RELATORIO_ID.equals( fieldName ) ) + { + setToRelatorio_id( (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_RELATORIO_ID) != null ) + { + toRelatorio_id().save(); + dataHash.put(RELATORIO_ID, toRelatorio_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsRelatorioArea.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioData.java new file mode 100644 index 00000000..2b6b80f3 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioData.java @@ -0,0 +1,18 @@ +/* +* HsRelatorioDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsRelatorioData extends com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioDataAuto +{ + + public HsRelatorioData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioDataAuto.java new file mode 100644 index 00000000..fa4a02ff --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioDataAuto.java @@ -0,0 +1,290 @@ +/* +* HsRelatorioDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsRelatorioDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_relatorio"; + + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio.id"; + public static final String DATA = "data"; + public static final String DATA_FULL = "hs_relatorio.data"; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_relatorio.deleted_date"; + public static final String MARCACAO_ID = "marcacao_id"; + public static final String MARCACAO_ID_FULL = "hs_relatorio.marcacao_id"; + public static final String TO_MARCACAO_ID = "to marcacao_id"; + public static final String IS_SUBMETIDO = "is_submetido"; + public static final String IS_SUBMETIDO_FULL = "hs_relatorio.is_submetido"; + public static final String AVALIACAO_INICIAL = "avaliacao_inicial"; + public static final String AVALIACAO_INICIAL_FULL = "hs_relatorio.avaliacao_inicial"; + public static final String ACOMPANHANTE1 = "acompanhante1"; + public static final String ACOMPANHANTE1_FULL = "hs_relatorio.acompanhante1"; + public static final String FUNCAO_ACOMPANHANTE1 = "funcao_acompanhante1"; + public static final String FUNCAO_ACOMPANHANTE1_FULL = "hs_relatorio.funcao_acompanhante1"; + public static final String ACOMPANHANTE2 = "acompanhante2"; + public static final String ACOMPANHANTE2_FULL = "hs_relatorio.acompanhante2"; + public static final String FUNCAO_ACOMPANHANTE2 = "funcao_acompanhante2"; + public static final String FUNCAO_ACOMPANHANTE2_FULL = "hs_relatorio.funcao_acompanhante2"; + public static final String ACOMPANHANTE3 = "acompanhante3"; + public static final String ACOMPANHANTE3_FULL = "hs_relatorio.acompanhante3"; + public static final String FUNCAO_ACOMPANHANTE3 = "funcao_acompanhante3"; + public static final String FUNCAO_ACOMPANHANTE3_FULL = "hs_relatorio.funcao_acompanhante3"; + public static final String FUNCIONARIOS = "funcionarios"; + public static final String FUNCIONARIOS_FULL = "hs_relatorio.funcionarios"; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, DELETED_DATE, MARCACAO_ID, TO_MARCACAO_ID, IS_SUBMETIDO, AVALIACAO_INICIAL, + ACOMPANHANTE1, FUNCAO_ACOMPANHANTE1, ACOMPANHANTE2, FUNCAO_ACOMPANHANTE2, + ACOMPANHANTE3, FUNCAO_ACOMPANHANTE3, FUNCIONARIOS, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATA, DELETED_DATE, MARCACAO_ID, IS_SUBMETIDO, AVALIACAO_INICIAL, + ACOMPANHANTE1, FUNCAO_ACOMPANHANTE1, ACOMPANHANTE2, FUNCAO_ACOMPANHANTE2, + ACOMPANHANTE3, FUNCAO_ACOMPANHANTE3, FUNCIONARIOS, }; + + private Map dataHash; + + public HsRelatorioDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public java.util.Date getData() + { + return (java.util.Date) get(DATA); + } + + public void setData(java.util.Date dataValue ) + { + this.set(DATA, dataValue ); + } + + public java.sql.Timestamp getDeleted_date() + { + return (java.sql.Timestamp) get(DELETED_DATE); + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.set(DELETED_DATE, deleted_dateValue ); + } + + public Integer getMarcacao_id() + { + return (Integer) dataHash.get(MARCACAO_ID); + } + + public void setMarcacao_id(Integer marcacao_idValue ) + { + dataHash.put(TO_MARCACAO_ID, null); + dataHash.put(MARCACAO_ID, marcacao_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEstabelecimentoData toMarcacao_id() + throws Exception + { + if( dataHash.get(TO_MARCACAO_ID) == null && getMarcacao_id() != null ) + { + dataHash.put(TO_MARCACAO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEstabelecimentoData.class, new Object[]{ getMarcacao_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEstabelecimentoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEstabelecimentoData) dataHash.get(TO_MARCACAO_ID); + } + + public void setToMarcacao_id(com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEstabelecimentoData marcacao_idObject ) + { + if( marcacao_idObject == null ) + { + dataHash.put(MARCACAO_ID, null); + } + else + { + dataHash.put(MARCACAO_ID, marcacao_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEstabelecimentoData.ID )); + } + dataHash.put(TO_MARCACAO_ID, marcacao_idObject); + } + + public java.sql.Timestamp getIs_submetido() + { + return (java.sql.Timestamp) get(IS_SUBMETIDO); + } + + public void setIs_submetido(java.sql.Timestamp is_submetidoValue ) + { + this.set(IS_SUBMETIDO, is_submetidoValue ); + } + + public Boolean getAvaliacao_inicial() + { + return (Boolean) get(AVALIACAO_INICIAL); + } + + public void setAvaliacao_inicial(Boolean avaliacao_inicialValue ) + { + this.set(AVALIACAO_INICIAL, avaliacao_inicialValue ); + } + + public String getAcompanhante1() + { + return (String) get(ACOMPANHANTE1); + } + + public void setAcompanhante1(String acompanhante1Value ) + { + this.set(ACOMPANHANTE1, acompanhante1Value ); + } + + public String getFuncao_acompanhante1() + { + return (String) get(FUNCAO_ACOMPANHANTE1); + } + + public void setFuncao_acompanhante1(String funcao_acompanhante1Value ) + { + this.set(FUNCAO_ACOMPANHANTE1, funcao_acompanhante1Value ); + } + + public String getAcompanhante2() + { + return (String) get(ACOMPANHANTE2); + } + + public void setAcompanhante2(String acompanhante2Value ) + { + this.set(ACOMPANHANTE2, acompanhante2Value ); + } + + public String getFuncao_acompanhante2() + { + return (String) get(FUNCAO_ACOMPANHANTE2); + } + + public void setFuncao_acompanhante2(String funcao_acompanhante2Value ) + { + this.set(FUNCAO_ACOMPANHANTE2, funcao_acompanhante2Value ); + } + + public String getAcompanhante3() + { + return (String) get(ACOMPANHANTE3); + } + + public void setAcompanhante3(String acompanhante3Value ) + { + this.set(ACOMPANHANTE3, acompanhante3Value ); + } + + public String getFuncao_acompanhante3() + { + return (String) get(FUNCAO_ACOMPANHANTE3); + } + + public void setFuncao_acompanhante3(String funcao_acompanhante3Value ) + { + this.set(FUNCAO_ACOMPANHANTE3, funcao_acompanhante3Value ); + } + + public String getFuncionarios() + { + return (String) get(FUNCIONARIOS); + } + + public void setFuncionarios(String funcionariosValue ) + { + this.set(FUNCIONARIOS, funcionariosValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_MARCACAO_ID.equals( fieldName ) ) + { + value = toMarcacao_id(); + } + else if( MARCACAO_ID.equals( fieldName ) ) + { + value = getMarcacao_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_MARCACAO_ID.equals( fieldName ) ) + { + setToMarcacao_id( (com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEstabelecimentoData) value ); + } + else if( MARCACAO_ID.equals( fieldName ) ) + { + setMarcacao_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_MARCACAO_ID) != null ) + { + toMarcacao_id().save(); + dataHash.put(MARCACAO_ID, toMarcacao_id().get( com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEstabelecimentoData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsRelatorio.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioEquipamento.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioEquipamento.java new file mode 100644 index 00000000..ee5abf9c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioEquipamento.java @@ -0,0 +1,210 @@ +/* +* HsRelatorioEquipamento.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsRelatorioEquipamento implements JDOInnerObject +{ + private Integer hs_relatorio_id; + private Integer hs_equipamento; + private Integer id; + private String tipo; + private String marca; + private String modelo; + + public HsRelatorioEquipamento() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsRelatorioEquipamentoDataAuto.HS_RELATORIO_ID ) + { + return hs_relatorio_id; + } + else if( fieldName == HsRelatorioEquipamentoDataAuto.HS_EQUIPAMENTO ) + { + return hs_equipamento; + } + else if( fieldName == HsRelatorioEquipamentoDataAuto.ID ) + { + return id; + } + else if( fieldName == HsRelatorioEquipamentoDataAuto.TIPO ) + { + return tipo; + } + else if( fieldName == HsRelatorioEquipamentoDataAuto.MARCA ) + { + return marca; + } + else if( fieldName == HsRelatorioEquipamentoDataAuto.MODELO ) + { + return modelo; + } + else if( fieldName.equals( HsRelatorioEquipamentoDataAuto.HS_RELATORIO_ID ) ) + { + return hs_relatorio_id; + } + else if( fieldName.equals( HsRelatorioEquipamentoDataAuto.HS_EQUIPAMENTO ) ) + { + return hs_equipamento; + } + else if( fieldName.equals( HsRelatorioEquipamentoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsRelatorioEquipamentoDataAuto.TIPO ) ) + { + return tipo; + } + else if( fieldName.equals( HsRelatorioEquipamentoDataAuto.MARCA ) ) + { + return marca; + } + else if( fieldName.equals( HsRelatorioEquipamentoDataAuto.MODELO ) ) + { + return modelo; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsRelatorioEquipamentoDataAuto.HS_RELATORIO_ID ) + { + hs_relatorio_id = ( Integer ) value; + } + else if( fieldName == HsRelatorioEquipamentoDataAuto.HS_EQUIPAMENTO ) + { + hs_equipamento = ( Integer ) value; + } + else if( fieldName == HsRelatorioEquipamentoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsRelatorioEquipamentoDataAuto.TIPO ) + { + tipo = ( String ) value; + } + else if( fieldName == HsRelatorioEquipamentoDataAuto.MARCA ) + { + marca = ( String ) value; + } + else if( fieldName == HsRelatorioEquipamentoDataAuto.MODELO ) + { + modelo = ( String ) value; + } + else if( fieldName.equals( HsRelatorioEquipamentoDataAuto.HS_RELATORIO_ID ) ) + { + hs_relatorio_id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioEquipamentoDataAuto.HS_EQUIPAMENTO ) ) + { + hs_equipamento = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioEquipamentoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioEquipamentoDataAuto.TIPO ) ) + { + tipo = ( String ) value; + } + else if( fieldName.equals( HsRelatorioEquipamentoDataAuto.MARCA ) ) + { + marca = ( String ) value; + } + else if( fieldName.equals( HsRelatorioEquipamentoDataAuto.MODELO ) ) + { + modelo = ( String ) value; + } + } + + public Integer getHs_relatorio_id() + { + return hs_relatorio_id; + } + + public void setHs_relatorio_id(Integer hs_relatorio_idValue ) + { + this.hs_relatorio_id = hs_relatorio_idValue; + } + + public Integer getHs_equipamento() + { + return hs_equipamento; + } + + public void setHs_equipamento(Integer hs_equipamentoValue ) + { + this.hs_equipamento = hs_equipamentoValue; + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getTipo() + { + return tipo; + } + + public void setTipo(String tipoValue ) + { + this.tipo = tipoValue; + } + + public String getMarca() + { + return marca; + } + + public void setMarca(String marcaValue ) + { + this.marca = marcaValue; + } + + public String getModelo() + { + return modelo; + } + + public void setModelo(String modeloValue ) + { + this.modelo = modeloValue; + } + + public Class getOuterClass() + { + return HsRelatorioEquipamentoDataAuto.class; + } + + public HsRelatorioEquipamentoDataAuto getOuterClassInstance() + { + HsRelatorioEquipamentoDataAuto outerObj = new HsRelatorioEquipamentoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioEquipamentoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioEquipamentoData.java new file mode 100644 index 00000000..fdf9a44c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioEquipamentoData.java @@ -0,0 +1,18 @@ +/* +* HsRelatorioEquipamentoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsRelatorioEquipamentoData extends com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioEquipamentoDataAuto +{ + + public HsRelatorioEquipamentoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioEquipamentoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioEquipamentoDataAuto.java new file mode 100644 index 00000000..1e94688b --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioEquipamentoDataAuto.java @@ -0,0 +1,202 @@ +/* +* HsRelatorioEquipamentoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsRelatorioEquipamentoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_relatorio_equipamento"; + + public static final String HS_RELATORIO_ID = "hs_relatorio_id"; + public static final String HS_RELATORIO_ID_FULL = "hs_relatorio_equipamento.hs_relatorio_id"; + public static final String TO_HS_RELATORIO_ID = "to hs_relatorio_id"; + public static final String HS_EQUIPAMENTO = "hs_equipamento"; + public static final String HS_EQUIPAMENTO_FULL = "hs_relatorio_equipamento.hs_equipamento"; + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio_equipamento.id"; + public static final String TIPO = "tipo"; + public static final String TIPO_FULL = "hs_relatorio_equipamento.tipo"; + public static final String MARCA = "marca"; + public static final String MARCA_FULL = "hs_relatorio_equipamento.marca"; + public static final String MODELO = "modelo"; + public static final String MODELO_FULL = "hs_relatorio_equipamento.modelo"; + + public static final String FIELD_NAMES[] = new String[]{ + HS_RELATORIO_ID, TO_HS_RELATORIO_ID, HS_EQUIPAMENTO, TIPO, MARCA, MODELO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + HS_RELATORIO_ID, HS_EQUIPAMENTO, ID, TIPO, MARCA, MODELO, }; + + private Map dataHash; + + public HsRelatorioEquipamentoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getHs_relatorio_id() + { + return (Integer) dataHash.get(HS_RELATORIO_ID); + } + + public void setHs_relatorio_id(Integer hs_relatorio_idValue ) + { + dataHash.put(TO_HS_RELATORIO_ID, null); + dataHash.put(HS_RELATORIO_ID, hs_relatorio_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData toHs_relatorio_id() + throws Exception + { + if( dataHash.get(TO_HS_RELATORIO_ID) == null && getHs_relatorio_id() != null ) + { + dataHash.put(TO_HS_RELATORIO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.class, new Object[]{ getHs_relatorio_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData) dataHash.get(TO_HS_RELATORIO_ID); + } + + public void setToHs_relatorio_id(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData hs_relatorio_idObject ) + { + if( hs_relatorio_idObject == null ) + { + dataHash.put(HS_RELATORIO_ID, null); + } + else + { + dataHash.put(HS_RELATORIO_ID, hs_relatorio_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.ID )); + } + dataHash.put(TO_HS_RELATORIO_ID, hs_relatorio_idObject); + } + + public Integer getHs_equipamento() + { + return (Integer) get(HS_EQUIPAMENTO); + } + + public void setHs_equipamento(Integer hs_equipamentoValue ) + { + this.set(HS_EQUIPAMENTO, hs_equipamentoValue ); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getTipo() + { + return (String) get(TIPO); + } + + public void setTipo(String tipoValue ) + { + this.set(TIPO, tipoValue ); + } + + public String getMarca() + { + return (String) get(MARCA); + } + + public void setMarca(String marcaValue ) + { + this.set(MARCA, marcaValue ); + } + + public String getModelo() + { + return (String) get(MODELO); + } + + public void setModelo(String modeloValue ) + { + this.set(MODELO, modeloValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_HS_RELATORIO_ID.equals( fieldName ) ) + { + value = toHs_relatorio_id(); + } + else if( HS_RELATORIO_ID.equals( fieldName ) ) + { + value = getHs_relatorio_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_HS_RELATORIO_ID.equals( fieldName ) ) + { + setToHs_relatorio_id( (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData) value ); + } + else if( HS_RELATORIO_ID.equals( fieldName ) ) + { + setHs_relatorio_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_HS_RELATORIO_ID) != null ) + { + toHs_relatorio_id().save(); + dataHash.put(HS_RELATORIO_ID, toHs_relatorio_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsRelatorioEquipamento.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioLegislacao.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioLegislacao.java new file mode 100644 index 00000000..27d7e9c2 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioLegislacao.java @@ -0,0 +1,210 @@ +/* +* HsRelatorioLegislacao.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsRelatorioLegislacao implements JDOInnerObject +{ + private Integer hs_relatorio_id; + private Integer hs_legislacao_id; + private Integer id; + private String categoria; + private String descricao; + private Integer ordem; + + public HsRelatorioLegislacao() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsRelatorioLegislacaoDataAuto.HS_RELATORIO_ID ) + { + return hs_relatorio_id; + } + else if( fieldName == HsRelatorioLegislacaoDataAuto.HS_LEGISLACAO_ID ) + { + return hs_legislacao_id; + } + else if( fieldName == HsRelatorioLegislacaoDataAuto.ID ) + { + return id; + } + else if( fieldName == HsRelatorioLegislacaoDataAuto.CATEGORIA ) + { + return categoria; + } + else if( fieldName == HsRelatorioLegislacaoDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName == HsRelatorioLegislacaoDataAuto.ORDEM ) + { + return ordem; + } + else if( fieldName.equals( HsRelatorioLegislacaoDataAuto.HS_RELATORIO_ID ) ) + { + return hs_relatorio_id; + } + else if( fieldName.equals( HsRelatorioLegislacaoDataAuto.HS_LEGISLACAO_ID ) ) + { + return hs_legislacao_id; + } + else if( fieldName.equals( HsRelatorioLegislacaoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsRelatorioLegislacaoDataAuto.CATEGORIA ) ) + { + return categoria; + } + else if( fieldName.equals( HsRelatorioLegislacaoDataAuto.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( HsRelatorioLegislacaoDataAuto.ORDEM ) ) + { + return ordem; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsRelatorioLegislacaoDataAuto.HS_RELATORIO_ID ) + { + hs_relatorio_id = ( Integer ) value; + } + else if( fieldName == HsRelatorioLegislacaoDataAuto.HS_LEGISLACAO_ID ) + { + hs_legislacao_id = ( Integer ) value; + } + else if( fieldName == HsRelatorioLegislacaoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsRelatorioLegislacaoDataAuto.CATEGORIA ) + { + categoria = ( String ) value; + } + else if( fieldName == HsRelatorioLegislacaoDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == HsRelatorioLegislacaoDataAuto.ORDEM ) + { + ordem = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioLegislacaoDataAuto.HS_RELATORIO_ID ) ) + { + hs_relatorio_id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioLegislacaoDataAuto.HS_LEGISLACAO_ID ) ) + { + hs_legislacao_id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioLegislacaoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioLegislacaoDataAuto.CATEGORIA ) ) + { + categoria = ( String ) value; + } + else if( fieldName.equals( HsRelatorioLegislacaoDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( HsRelatorioLegislacaoDataAuto.ORDEM ) ) + { + ordem = ( Integer ) value; + } + } + + public Integer getHs_relatorio_id() + { + return hs_relatorio_id; + } + + public void setHs_relatorio_id(Integer hs_relatorio_idValue ) + { + this.hs_relatorio_id = hs_relatorio_idValue; + } + + public Integer getHs_legislacao_id() + { + return hs_legislacao_id; + } + + public void setHs_legislacao_id(Integer hs_legislacao_idValue ) + { + this.hs_legislacao_id = hs_legislacao_idValue; + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getCategoria() + { + return categoria; + } + + public void setCategoria(String categoriaValue ) + { + this.categoria = categoriaValue; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public Integer getOrdem() + { + return ordem; + } + + public void setOrdem(Integer ordemValue ) + { + this.ordem = ordemValue; + } + + public Class getOuterClass() + { + return HsRelatorioLegislacaoDataAuto.class; + } + + public HsRelatorioLegislacaoDataAuto getOuterClassInstance() + { + HsRelatorioLegislacaoDataAuto outerObj = new HsRelatorioLegislacaoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioLegislacaoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioLegislacaoData.java new file mode 100644 index 00000000..e26436ce --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioLegislacaoData.java @@ -0,0 +1,18 @@ +/* +* HsRelatorioLegislacaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsRelatorioLegislacaoData extends com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioLegislacaoDataAuto +{ + + public HsRelatorioLegislacaoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioLegislacaoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioLegislacaoDataAuto.java new file mode 100644 index 00000000..d01cb04c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioLegislacaoDataAuto.java @@ -0,0 +1,203 @@ +/* +* HsRelatorioLegislacaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsRelatorioLegislacaoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_relatorio_legislacao"; + + public static final String HS_RELATORIO_ID = "hs_relatorio_id"; + public static final String HS_RELATORIO_ID_FULL = "hs_relatorio_legislacao.hs_relatorio_id"; + public static final String TO_HS_RELATORIO_ID = "to hs_relatorio_id"; + public static final String HS_LEGISLACAO_ID = "hs_legislacao_id"; + public static final String HS_LEGISLACAO_ID_FULL = "hs_relatorio_legislacao.hs_legislacao_id"; + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio_legislacao.id"; + public static final String CATEGORIA = "categoria"; + public static final String CATEGORIA_FULL = "hs_relatorio_legislacao.categoria"; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "hs_relatorio_legislacao.descricao"; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "hs_relatorio_legislacao.ordem"; + + public static final String FIELD_NAMES[] = new String[]{ + HS_RELATORIO_ID, TO_HS_RELATORIO_ID, HS_LEGISLACAO_ID, CATEGORIA, DESCRICAO, + ORDEM, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + HS_RELATORIO_ID, HS_LEGISLACAO_ID, ID, CATEGORIA, DESCRICAO, ORDEM, }; + + private Map dataHash; + + public HsRelatorioLegislacaoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getHs_relatorio_id() + { + return (Integer) dataHash.get(HS_RELATORIO_ID); + } + + public void setHs_relatorio_id(Integer hs_relatorio_idValue ) + { + dataHash.put(TO_HS_RELATORIO_ID, null); + dataHash.put(HS_RELATORIO_ID, hs_relatorio_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData toHs_relatorio_id() + throws Exception + { + if( dataHash.get(TO_HS_RELATORIO_ID) == null && getHs_relatorio_id() != null ) + { + dataHash.put(TO_HS_RELATORIO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.class, new Object[]{ getHs_relatorio_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData) dataHash.get(TO_HS_RELATORIO_ID); + } + + public void setToHs_relatorio_id(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData hs_relatorio_idObject ) + { + if( hs_relatorio_idObject == null ) + { + dataHash.put(HS_RELATORIO_ID, null); + } + else + { + dataHash.put(HS_RELATORIO_ID, hs_relatorio_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.ID )); + } + dataHash.put(TO_HS_RELATORIO_ID, hs_relatorio_idObject); + } + + public Integer getHs_legislacao_id() + { + return (Integer) get(HS_LEGISLACAO_ID); + } + + public void setHs_legislacao_id(Integer hs_legislacao_idValue ) + { + this.set(HS_LEGISLACAO_ID, hs_legislacao_idValue ); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getCategoria() + { + return (String) get(CATEGORIA); + } + + public void setCategoria(String categoriaValue ) + { + this.set(CATEGORIA, categoriaValue ); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + public Integer getOrdem() + { + return (Integer) get(ORDEM); + } + + public void setOrdem(Integer ordemValue ) + { + this.set(ORDEM, ordemValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_HS_RELATORIO_ID.equals( fieldName ) ) + { + value = toHs_relatorio_id(); + } + else if( HS_RELATORIO_ID.equals( fieldName ) ) + { + value = getHs_relatorio_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_HS_RELATORIO_ID.equals( fieldName ) ) + { + setToHs_relatorio_id( (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData) value ); + } + else if( HS_RELATORIO_ID.equals( fieldName ) ) + { + setHs_relatorio_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_HS_RELATORIO_ID) != null ) + { + toHs_relatorio_id().save(); + dataHash.put(HS_RELATORIO_ID, toHs_relatorio_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsRelatorioLegislacao.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioMedida.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioMedida.java new file mode 100644 index 00000000..4bee51d5 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioMedida.java @@ -0,0 +1,183 @@ +/* +* HsRelatorioMedida.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsRelatorioMedida implements JDOInnerObject +{ + private Integer id; + private Integer risco_id; + private String description; + private String requesitos_legais; + private java.sql.Timestamp deleted_date; + + public HsRelatorioMedida() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsRelatorioMedidaDataAuto.ID ) + { + return id; + } + else if( fieldName == HsRelatorioMedidaDataAuto.RISCO_ID ) + { + return risco_id; + } + else if( fieldName == HsRelatorioMedidaDataAuto.DESCRIPTION ) + { + return description; + } + else if( fieldName == HsRelatorioMedidaDataAuto.REQUESITOS_LEGAIS ) + { + return requesitos_legais; + } + else if( fieldName == HsRelatorioMedidaDataAuto.DELETED_DATE ) + { + return deleted_date; + } + else if( fieldName.equals( HsRelatorioMedidaDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsRelatorioMedidaDataAuto.RISCO_ID ) ) + { + return risco_id; + } + else if( fieldName.equals( HsRelatorioMedidaDataAuto.DESCRIPTION ) ) + { + return description; + } + else if( fieldName.equals( HsRelatorioMedidaDataAuto.REQUESITOS_LEGAIS ) ) + { + return requesitos_legais; + } + else if( fieldName.equals( HsRelatorioMedidaDataAuto.DELETED_DATE ) ) + { + return deleted_date; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsRelatorioMedidaDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsRelatorioMedidaDataAuto.RISCO_ID ) + { + risco_id = ( Integer ) value; + } + else if( fieldName == HsRelatorioMedidaDataAuto.DESCRIPTION ) + { + description = ( String ) value; + } + else if( fieldName == HsRelatorioMedidaDataAuto.REQUESITOS_LEGAIS ) + { + requesitos_legais = ( String ) value; + } + else if( fieldName == HsRelatorioMedidaDataAuto.DELETED_DATE ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( HsRelatorioMedidaDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioMedidaDataAuto.RISCO_ID ) ) + { + risco_id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioMedidaDataAuto.DESCRIPTION ) ) + { + description = ( String ) value; + } + else if( fieldName.equals( HsRelatorioMedidaDataAuto.REQUESITOS_LEGAIS ) ) + { + requesitos_legais = ( String ) value; + } + else if( fieldName.equals( HsRelatorioMedidaDataAuto.DELETED_DATE ) ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getRisco_id() + { + return risco_id; + } + + public void setRisco_id(Integer risco_idValue ) + { + this.risco_id = risco_idValue; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String descriptionValue ) + { + this.description = descriptionValue; + } + + public String getRequesitos_legais() + { + return requesitos_legais; + } + + public void setRequesitos_legais(String requesitos_legaisValue ) + { + this.requesitos_legais = requesitos_legaisValue; + } + + public java.sql.Timestamp getDeleted_date() + { + return deleted_date; + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.deleted_date = deleted_dateValue; + } + + public Class getOuterClass() + { + return HsRelatorioMedidaDataAuto.class; + } + + public HsRelatorioMedidaDataAuto getOuterClassInstance() + { + HsRelatorioMedidaDataAuto outerObj = new HsRelatorioMedidaDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioMedidaData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioMedidaData.java new file mode 100644 index 00000000..977b2091 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioMedidaData.java @@ -0,0 +1,18 @@ +/* +* HsRelatorioMedidaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsRelatorioMedidaData extends com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioMedidaDataAuto +{ + + public HsRelatorioMedidaData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioMedidaDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioMedidaDataAuto.java new file mode 100644 index 00000000..1d546c5a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioMedidaDataAuto.java @@ -0,0 +1,190 @@ +/* +* HsRelatorioMedidaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsRelatorioMedidaDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_relatorio_medida"; + + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio_medida.id"; + public static final String RISCO_ID = "risco_id"; + public static final String RISCO_ID_FULL = "hs_relatorio_medida.risco_id"; + public static final String TO_RISCO_ID = "to risco_id"; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_relatorio_medida.description"; + public static final String REQUESITOS_LEGAIS = "requesitos_legais"; + public static final String REQUESITOS_LEGAIS_FULL = "hs_relatorio_medida.requesitos_legais"; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_relatorio_medida.deleted_date"; + + public static final String FIELD_NAMES[] = new String[]{ + RISCO_ID, TO_RISCO_ID, DESCRIPTION, REQUESITOS_LEGAIS, DELETED_DATE, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, RISCO_ID, DESCRIPTION, REQUESITOS_LEGAIS, DELETED_DATE, }; + + private Map dataHash; + + public HsRelatorioMedidaDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getRisco_id() + { + return (Integer) dataHash.get(RISCO_ID); + } + + public void setRisco_id(Integer risco_idValue ) + { + dataHash.put(TO_RISCO_ID, null); + dataHash.put(RISCO_ID, risco_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoData toRisco_id() + throws Exception + { + if( dataHash.get(TO_RISCO_ID) == null && getRisco_id() != null ) + { + dataHash.put(TO_RISCO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoData.class, new Object[]{ getRisco_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoData) dataHash.get(TO_RISCO_ID); + } + + public void setToRisco_id(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoData risco_idObject ) + { + if( risco_idObject == null ) + { + dataHash.put(RISCO_ID, null); + } + else + { + dataHash.put(RISCO_ID, risco_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoData.ID )); + } + dataHash.put(TO_RISCO_ID, risco_idObject); + } + + public String getDescription() + { + return (String) get(DESCRIPTION); + } + + public void setDescription(String descriptionValue ) + { + this.set(DESCRIPTION, descriptionValue ); + } + + public String getRequesitos_legais() + { + return (String) get(REQUESITOS_LEGAIS); + } + + public void setRequesitos_legais(String requesitos_legaisValue ) + { + this.set(REQUESITOS_LEGAIS, requesitos_legaisValue ); + } + + public java.sql.Timestamp getDeleted_date() + { + return (java.sql.Timestamp) get(DELETED_DATE); + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.set(DELETED_DATE, deleted_dateValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_RISCO_ID.equals( fieldName ) ) + { + value = toRisco_id(); + } + else if( RISCO_ID.equals( fieldName ) ) + { + value = getRisco_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_RISCO_ID.equals( fieldName ) ) + { + setToRisco_id( (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoData) value ); + } + else if( RISCO_ID.equals( fieldName ) ) + { + setRisco_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_RISCO_ID) != null ) + { + toRisco_id().save(); + dataHash.put(RISCO_ID, toRisco_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsRelatorioMedida.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioNormalizacao.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioNormalizacao.java new file mode 100644 index 00000000..5cb7063e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioNormalizacao.java @@ -0,0 +1,210 @@ +/* +* HsRelatorioNormalizacao.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsRelatorioNormalizacao implements JDOInnerObject +{ + private Integer hs_relatorio_id; + private Integer hs_normalizacao_id; + private Integer id; + private String codigo; + private String descricao; + private Boolean portuguesa; + + public HsRelatorioNormalizacao() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsRelatorioNormalizacaoDataAuto.HS_RELATORIO_ID ) + { + return hs_relatorio_id; + } + else if( fieldName == HsRelatorioNormalizacaoDataAuto.HS_NORMALIZACAO_ID ) + { + return hs_normalizacao_id; + } + else if( fieldName == HsRelatorioNormalizacaoDataAuto.ID ) + { + return id; + } + else if( fieldName == HsRelatorioNormalizacaoDataAuto.CODIGO ) + { + return codigo; + } + else if( fieldName == HsRelatorioNormalizacaoDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName == HsRelatorioNormalizacaoDataAuto.PORTUGUESA ) + { + return portuguesa; + } + else if( fieldName.equals( HsRelatorioNormalizacaoDataAuto.HS_RELATORIO_ID ) ) + { + return hs_relatorio_id; + } + else if( fieldName.equals( HsRelatorioNormalizacaoDataAuto.HS_NORMALIZACAO_ID ) ) + { + return hs_normalizacao_id; + } + else if( fieldName.equals( HsRelatorioNormalizacaoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsRelatorioNormalizacaoDataAuto.CODIGO ) ) + { + return codigo; + } + else if( fieldName.equals( HsRelatorioNormalizacaoDataAuto.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( HsRelatorioNormalizacaoDataAuto.PORTUGUESA ) ) + { + return portuguesa; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsRelatorioNormalizacaoDataAuto.HS_RELATORIO_ID ) + { + hs_relatorio_id = ( Integer ) value; + } + else if( fieldName == HsRelatorioNormalizacaoDataAuto.HS_NORMALIZACAO_ID ) + { + hs_normalizacao_id = ( Integer ) value; + } + else if( fieldName == HsRelatorioNormalizacaoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsRelatorioNormalizacaoDataAuto.CODIGO ) + { + codigo = ( String ) value; + } + else if( fieldName == HsRelatorioNormalizacaoDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == HsRelatorioNormalizacaoDataAuto.PORTUGUESA ) + { + portuguesa = ( Boolean ) value; + } + else if( fieldName.equals( HsRelatorioNormalizacaoDataAuto.HS_RELATORIO_ID ) ) + { + hs_relatorio_id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioNormalizacaoDataAuto.HS_NORMALIZACAO_ID ) ) + { + hs_normalizacao_id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioNormalizacaoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioNormalizacaoDataAuto.CODIGO ) ) + { + codigo = ( String ) value; + } + else if( fieldName.equals( HsRelatorioNormalizacaoDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( HsRelatorioNormalizacaoDataAuto.PORTUGUESA ) ) + { + portuguesa = ( Boolean ) value; + } + } + + public Integer getHs_relatorio_id() + { + return hs_relatorio_id; + } + + public void setHs_relatorio_id(Integer hs_relatorio_idValue ) + { + this.hs_relatorio_id = hs_relatorio_idValue; + } + + public Integer getHs_normalizacao_id() + { + return hs_normalizacao_id; + } + + public void setHs_normalizacao_id(Integer hs_normalizacao_idValue ) + { + this.hs_normalizacao_id = hs_normalizacao_idValue; + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getCodigo() + { + return codigo; + } + + public void setCodigo(String codigoValue ) + { + this.codigo = codigoValue; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public Boolean getPortuguesa() + { + return portuguesa; + } + + public void setPortuguesa(Boolean portuguesaValue ) + { + this.portuguesa = portuguesaValue; + } + + public Class getOuterClass() + { + return HsRelatorioNormalizacaoDataAuto.class; + } + + public HsRelatorioNormalizacaoDataAuto getOuterClassInstance() + { + HsRelatorioNormalizacaoDataAuto outerObj = new HsRelatorioNormalizacaoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioNormalizacaoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioNormalizacaoData.java new file mode 100644 index 00000000..a7386050 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioNormalizacaoData.java @@ -0,0 +1,18 @@ +/* +* HsRelatorioNormalizacaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsRelatorioNormalizacaoData extends com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioNormalizacaoDataAuto +{ + + public HsRelatorioNormalizacaoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioNormalizacaoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioNormalizacaoDataAuto.java new file mode 100644 index 00000000..cb95f185 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioNormalizacaoDataAuto.java @@ -0,0 +1,203 @@ +/* +* HsRelatorioNormalizacaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsRelatorioNormalizacaoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_relatorio_normalizacao"; + + public static final String HS_RELATORIO_ID = "hs_relatorio_id"; + public static final String HS_RELATORIO_ID_FULL = "hs_relatorio_normalizacao.hs_relatorio_id"; + public static final String TO_HS_RELATORIO_ID = "to hs_relatorio_id"; + public static final String HS_NORMALIZACAO_ID = "hs_normalizacao_id"; + public static final String HS_NORMALIZACAO_ID_FULL = "hs_relatorio_normalizacao.hs_normalizacao_id"; + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio_normalizacao.id"; + public static final String CODIGO = "codigo"; + public static final String CODIGO_FULL = "hs_relatorio_normalizacao.codigo"; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "hs_relatorio_normalizacao.descricao"; + public static final String PORTUGUESA = "portuguesa"; + public static final String PORTUGUESA_FULL = "hs_relatorio_normalizacao.portuguesa"; + + public static final String FIELD_NAMES[] = new String[]{ + HS_RELATORIO_ID, TO_HS_RELATORIO_ID, HS_NORMALIZACAO_ID, CODIGO, DESCRICAO, + PORTUGUESA, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + HS_RELATORIO_ID, HS_NORMALIZACAO_ID, ID, CODIGO, DESCRICAO, PORTUGUESA, }; + + private Map dataHash; + + public HsRelatorioNormalizacaoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getHs_relatorio_id() + { + return (Integer) dataHash.get(HS_RELATORIO_ID); + } + + public void setHs_relatorio_id(Integer hs_relatorio_idValue ) + { + dataHash.put(TO_HS_RELATORIO_ID, null); + dataHash.put(HS_RELATORIO_ID, hs_relatorio_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData toHs_relatorio_id() + throws Exception + { + if( dataHash.get(TO_HS_RELATORIO_ID) == null && getHs_relatorio_id() != null ) + { + dataHash.put(TO_HS_RELATORIO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.class, new Object[]{ getHs_relatorio_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData) dataHash.get(TO_HS_RELATORIO_ID); + } + + public void setToHs_relatorio_id(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData hs_relatorio_idObject ) + { + if( hs_relatorio_idObject == null ) + { + dataHash.put(HS_RELATORIO_ID, null); + } + else + { + dataHash.put(HS_RELATORIO_ID, hs_relatorio_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.ID )); + } + dataHash.put(TO_HS_RELATORIO_ID, hs_relatorio_idObject); + } + + public Integer getHs_normalizacao_id() + { + return (Integer) get(HS_NORMALIZACAO_ID); + } + + public void setHs_normalizacao_id(Integer hs_normalizacao_idValue ) + { + this.set(HS_NORMALIZACAO_ID, hs_normalizacao_idValue ); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getCodigo() + { + return (String) get(CODIGO); + } + + public void setCodigo(String codigoValue ) + { + this.set(CODIGO, codigoValue ); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + public Boolean getPortuguesa() + { + return (Boolean) get(PORTUGUESA); + } + + public void setPortuguesa(Boolean portuguesaValue ) + { + this.set(PORTUGUESA, portuguesaValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_HS_RELATORIO_ID.equals( fieldName ) ) + { + value = toHs_relatorio_id(); + } + else if( HS_RELATORIO_ID.equals( fieldName ) ) + { + value = getHs_relatorio_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_HS_RELATORIO_ID.equals( fieldName ) ) + { + setToHs_relatorio_id( (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData) value ); + } + else if( HS_RELATORIO_ID.equals( fieldName ) ) + { + setHs_relatorio_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_HS_RELATORIO_ID) != null ) + { + toHs_relatorio_id().save(); + dataHash.put(HS_RELATORIO_ID, toHs_relatorio_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsRelatorioNormalizacao.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPosto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPosto.java new file mode 100644 index 00000000..966c2a5e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPosto.java @@ -0,0 +1,183 @@ +/* +* HsRelatorioPosto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsRelatorioPosto implements JDOInnerObject +{ + private Integer id; + private String description; + private Integer area_id; + private java.sql.Timestamp deleted_date; + private Boolean is_principal; + + public HsRelatorioPosto() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsRelatorioPostoDataAuto.ID ) + { + return id; + } + else if( fieldName == HsRelatorioPostoDataAuto.DESCRIPTION ) + { + return description; + } + else if( fieldName == HsRelatorioPostoDataAuto.AREA_ID ) + { + return area_id; + } + else if( fieldName == HsRelatorioPostoDataAuto.DELETED_DATE ) + { + return deleted_date; + } + else if( fieldName == HsRelatorioPostoDataAuto.IS_PRINCIPAL ) + { + return is_principal; + } + else if( fieldName.equals( HsRelatorioPostoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsRelatorioPostoDataAuto.DESCRIPTION ) ) + { + return description; + } + else if( fieldName.equals( HsRelatorioPostoDataAuto.AREA_ID ) ) + { + return area_id; + } + else if( fieldName.equals( HsRelatorioPostoDataAuto.DELETED_DATE ) ) + { + return deleted_date; + } + else if( fieldName.equals( HsRelatorioPostoDataAuto.IS_PRINCIPAL ) ) + { + return is_principal; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsRelatorioPostoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsRelatorioPostoDataAuto.DESCRIPTION ) + { + description = ( String ) value; + } + else if( fieldName == HsRelatorioPostoDataAuto.AREA_ID ) + { + area_id = ( Integer ) value; + } + else if( fieldName == HsRelatorioPostoDataAuto.DELETED_DATE ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName == HsRelatorioPostoDataAuto.IS_PRINCIPAL ) + { + is_principal = ( Boolean ) value; + } + else if( fieldName.equals( HsRelatorioPostoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioPostoDataAuto.DESCRIPTION ) ) + { + description = ( String ) value; + } + else if( fieldName.equals( HsRelatorioPostoDataAuto.AREA_ID ) ) + { + area_id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioPostoDataAuto.DELETED_DATE ) ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( HsRelatorioPostoDataAuto.IS_PRINCIPAL ) ) + { + is_principal = ( Boolean ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String descriptionValue ) + { + this.description = descriptionValue; + } + + public Integer getArea_id() + { + return area_id; + } + + public void setArea_id(Integer area_idValue ) + { + this.area_id = area_idValue; + } + + public java.sql.Timestamp getDeleted_date() + { + return deleted_date; + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.deleted_date = deleted_dateValue; + } + + public Boolean getIs_principal() + { + return is_principal; + } + + public void setIs_principal(Boolean is_principalValue ) + { + this.is_principal = is_principalValue; + } + + public Class getOuterClass() + { + return HsRelatorioPostoDataAuto.class; + } + + public HsRelatorioPostoDataAuto getOuterClassInstance() + { + HsRelatorioPostoDataAuto outerObj = new HsRelatorioPostoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoData.java new file mode 100644 index 00000000..b304fc7b --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoData.java @@ -0,0 +1,18 @@ +/* +* HsRelatorioPostoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsRelatorioPostoData extends com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoDataAuto +{ + + public HsRelatorioPostoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoDataAuto.java new file mode 100644 index 00000000..5d24162c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoDataAuto.java @@ -0,0 +1,190 @@ +/* +* HsRelatorioPostoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsRelatorioPostoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_relatorio_posto"; + + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio_posto.id"; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_relatorio_posto.description"; + public static final String AREA_ID = "area_id"; + public static final String AREA_ID_FULL = "hs_relatorio_posto.area_id"; + public static final String TO_AREA_ID = "to area_id"; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_relatorio_posto.deleted_date"; + public static final String IS_PRINCIPAL = "is_principal"; + public static final String IS_PRINCIPAL_FULL = "hs_relatorio_posto.is_principal"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRIPTION, AREA_ID, TO_AREA_ID, DELETED_DATE, IS_PRINCIPAL, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DESCRIPTION, AREA_ID, DELETED_DATE, IS_PRINCIPAL, }; + + private Map dataHash; + + public HsRelatorioPostoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getDescription() + { + return (String) get(DESCRIPTION); + } + + public void setDescription(String descriptionValue ) + { + this.set(DESCRIPTION, descriptionValue ); + } + + public Integer getArea_id() + { + return (Integer) dataHash.get(AREA_ID); + } + + public void setArea_id(Integer area_idValue ) + { + dataHash.put(TO_AREA_ID, null); + dataHash.put(AREA_ID, area_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioAreaData toArea_id() + throws Exception + { + if( dataHash.get(TO_AREA_ID) == null && getArea_id() != null ) + { + dataHash.put(TO_AREA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioAreaData.class, new Object[]{ getArea_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioAreaData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioAreaData) dataHash.get(TO_AREA_ID); + } + + public void setToArea_id(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioAreaData area_idObject ) + { + if( area_idObject == null ) + { + dataHash.put(AREA_ID, null); + } + else + { + dataHash.put(AREA_ID, area_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioAreaData.ID )); + } + dataHash.put(TO_AREA_ID, area_idObject); + } + + public java.sql.Timestamp getDeleted_date() + { + return (java.sql.Timestamp) get(DELETED_DATE); + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.set(DELETED_DATE, deleted_dateValue ); + } + + public Boolean getIs_principal() + { + return (Boolean) get(IS_PRINCIPAL); + } + + public void setIs_principal(Boolean is_principalValue ) + { + this.set(IS_PRINCIPAL, is_principalValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_AREA_ID.equals( fieldName ) ) + { + value = toArea_id(); + } + else if( AREA_ID.equals( fieldName ) ) + { + value = getArea_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_AREA_ID.equals( fieldName ) ) + { + setToArea_id( (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioAreaData) value ); + } + else if( AREA_ID.equals( fieldName ) ) + { + setArea_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_AREA_ID) != null ) + { + toArea_id().save(); + dataHash.put(AREA_ID, toArea_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioAreaData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsRelatorioPosto.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoMedida.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoMedida.java new file mode 100644 index 00000000..17841d62 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoMedida.java @@ -0,0 +1,141 @@ +/* +* HsRelatorioPostoMedida.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsRelatorioPostoMedida implements JDOInnerObject +{ + private Integer posto_id; + private Integer medida_id; + private Boolean is_plano_actuacao; + + public HsRelatorioPostoMedida() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsRelatorioPostoMedidaDataAuto.POSTO_ID ) + { + return posto_id; + } + else if( fieldName == HsRelatorioPostoMedidaDataAuto.MEDIDA_ID ) + { + return medida_id; + } + else if( fieldName == HsRelatorioPostoMedidaDataAuto.IS_PLANO_ACTUACAO ) + { + return is_plano_actuacao; + } + else if( fieldName.equals( HsRelatorioPostoMedidaDataAuto.POSTO_ID ) ) + { + return posto_id; + } + else if( fieldName.equals( HsRelatorioPostoMedidaDataAuto.MEDIDA_ID ) ) + { + return medida_id; + } + else if( fieldName.equals( HsRelatorioPostoMedidaDataAuto.IS_PLANO_ACTUACAO ) ) + { + return is_plano_actuacao; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsRelatorioPostoMedidaDataAuto.POSTO_ID ) + { + posto_id = ( Integer ) value; + } + else if( fieldName == HsRelatorioPostoMedidaDataAuto.MEDIDA_ID ) + { + medida_id = ( Integer ) value; + } + else if( fieldName == HsRelatorioPostoMedidaDataAuto.IS_PLANO_ACTUACAO ) + { + is_plano_actuacao = ( Boolean ) value; + } + else if( fieldName.equals( HsRelatorioPostoMedidaDataAuto.POSTO_ID ) ) + { + posto_id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioPostoMedidaDataAuto.MEDIDA_ID ) ) + { + medida_id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioPostoMedidaDataAuto.IS_PLANO_ACTUACAO ) ) + { + is_plano_actuacao = ( Boolean ) value; + } + } + + public Integer getPosto_id() + { + return posto_id; + } + + public void setPosto_id(Integer posto_idValue ) + { + this.posto_id = posto_idValue; + } + + public Integer getMedida_id() + { + return medida_id; + } + + public void setMedida_id(Integer medida_idValue ) + { + this.medida_id = medida_idValue; + } + + public Boolean getIs_plano_actuacao() + { + return is_plano_actuacao; + } + + public void setIs_plano_actuacao(Boolean is_plano_actuacaoValue ) + { + this.is_plano_actuacao = is_plano_actuacaoValue; + } + + public Class getOuterClass() + { + return HsRelatorioPostoMedidaDataAuto.class; + } + + public HsRelatorioPostoMedidaDataAuto getOuterClassInstance() + { + HsRelatorioPostoMedidaDataAuto outerObj = new HsRelatorioPostoMedidaDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoMedidaID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoMedidaID id = new com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoMedidaID(); + + Object obj; + obj = this.getPosto_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.posto_id = (Integer)obj; + + obj = this.getMedida_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.medida_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoMedidaData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoMedidaData.java new file mode 100644 index 00000000..d9f3aa8a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoMedidaData.java @@ -0,0 +1,18 @@ +/* +* HsRelatorioPostoMedidaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsRelatorioPostoMedidaData extends com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoMedidaDataAuto +{ + + public HsRelatorioPostoMedidaData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoMedidaDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoMedidaDataAuto.java new file mode 100644 index 00000000..dc07a4a2 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoMedidaDataAuto.java @@ -0,0 +1,225 @@ +/* +* HsRelatorioPostoMedidaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsRelatorioPostoMedidaDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_relatorio_posto_medida"; + + public static final String POSTO_ID = "posto_id"; + public static final String POSTO_ID_FULL = "hs_relatorio_posto_medida.posto_id"; + public static final String TO_POSTO_ID = "to posto_id"; + public static final String MEDIDA_ID = "medida_id"; + public static final String MEDIDA_ID_FULL = "hs_relatorio_posto_medida.medida_id"; + public static final String TO_MEDIDA_ID = "to medida_id"; + public static final String IS_PLANO_ACTUACAO = "is_plano_actuacao"; + public static final String IS_PLANO_ACTUACAO_FULL = "hs_relatorio_posto_medida.is_plano_actuacao"; + + public static final String FIELD_NAMES[] = new String[]{ + IS_PLANO_ACTUACAO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + POSTO_ID, MEDIDA_ID, IS_PLANO_ACTUACAO, }; + + private Map dataHash; + + public HsRelatorioPostoMedidaDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getPosto_id() + { + return (Integer) dataHash.get(POSTO_ID); + } + + public void setPosto_id(Integer posto_idValue ) + { + dataHash.put(TO_POSTO_ID, null); + dataHash.put(POSTO_ID, posto_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoData toPosto_id() + throws Exception + { + if( dataHash.get(TO_POSTO_ID) == null && getPosto_id() != null ) + { + dataHash.put(TO_POSTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoData.class, new Object[]{ getPosto_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoData) dataHash.get(TO_POSTO_ID); + } + + public void setToPosto_id(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoData posto_idObject ) + { + if( posto_idObject == null ) + { + dataHash.put(POSTO_ID, null); + } + else + { + dataHash.put(POSTO_ID, posto_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoData.ID )); + } + dataHash.put(TO_POSTO_ID, posto_idObject); + } + + public Integer getMedida_id() + { + return (Integer) dataHash.get(MEDIDA_ID); + } + + public void setMedida_id(Integer medida_idValue ) + { + dataHash.put(TO_MEDIDA_ID, null); + dataHash.put(MEDIDA_ID, medida_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioMedidaData toMedida_id() + throws Exception + { + if( dataHash.get(TO_MEDIDA_ID) == null && getMedida_id() != null ) + { + dataHash.put(TO_MEDIDA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioMedidaData.class, new Object[]{ getMedida_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioMedidaData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioMedidaData) dataHash.get(TO_MEDIDA_ID); + } + + public void setToMedida_id(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioMedidaData medida_idObject ) + { + if( medida_idObject == null ) + { + dataHash.put(MEDIDA_ID, null); + } + else + { + dataHash.put(MEDIDA_ID, medida_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioMedidaData.ID )); + } + dataHash.put(TO_MEDIDA_ID, medida_idObject); + } + + public Boolean getIs_plano_actuacao() + { + return (Boolean) get(IS_PLANO_ACTUACAO); + } + + public void setIs_plano_actuacao(Boolean is_plano_actuacaoValue ) + { + this.set(IS_PLANO_ACTUACAO, is_plano_actuacaoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_POSTO_ID.equals( fieldName ) ) + { + value = toPosto_id(); + } + else if( POSTO_ID.equals( fieldName ) ) + { + value = getPosto_id(); + } + else if( MEDIDA_ID.equals( fieldName ) ) + { + value = getMedida_id(); + } + else if( TO_MEDIDA_ID.equals( fieldName ) ) + { + value = toMedida_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_POSTO_ID.equals( fieldName ) ) + { + setToPosto_id( (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoData) value ); + } + else if( POSTO_ID.equals( fieldName ) ) + { + setPosto_id( (Integer) value ); + } + else if( MEDIDA_ID.equals( fieldName ) ) + { + setMedida_id( (Integer) value ); + } + else if( TO_MEDIDA_ID.equals( fieldName ) ) + { + setToMedida_id( (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioMedidaData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_POSTO_ID) != null ) + { + toPosto_id().save(); + dataHash.put(POSTO_ID, toPosto_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoData.ID )); + } + + if( dataHash.get(TO_MEDIDA_ID) != null ) + { + toMedida_id().save(); + dataHash.put(MEDIDA_ID, toMedida_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioMedidaData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsRelatorioPostoMedida.class; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoMedidaID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoMedidaID id = new com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoMedidaID(); + + Object obj; + obj = this.getPosto_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.posto_id = (Integer)obj; + + obj = this.getMedida_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.medida_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoMedidaID.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoMedidaID.java new file mode 100644 index 00000000..e1987682 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoMedidaID.java @@ -0,0 +1,37 @@ +/* +* HsRelatorioPostoMedidaID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.JDOIDClass; + +public final class HsRelatorioPostoMedidaID extends JDOIDClass implements Serializable +{ + public Integer posto_id; + public Integer medida_id; + + public HsRelatorioPostoMedidaID() + { + } + + + public Object[] getValue() + { + Object value[] = new Object[ 2 ]; + value[ 0 ] = posto_id; + value[ 1 ] = medida_id; + return value; + } + + public void setValues( Object values[] ) + { + posto_id = (Integer) values[ 0 ]; + medida_id = (Integer) values[ 1 ]; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoRisco.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoRisco.java new file mode 100644 index 00000000..ea04abe0 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoRisco.java @@ -0,0 +1,222 @@ +/* +* HsRelatorioPostoRisco.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsRelatorioPostoRisco implements JDOInnerObject +{ + private Integer posto_id; + private Integer risco_id; + private Integer probabilidade; + private Integer severidade; + private Integer valor_qualitativo_id; + private Integer ordem; + + public HsRelatorioPostoRisco() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsRelatorioPostoRiscoDataAuto.POSTO_ID ) + { + return posto_id; + } + else if( fieldName == HsRelatorioPostoRiscoDataAuto.RISCO_ID ) + { + return risco_id; + } + else if( fieldName == HsRelatorioPostoRiscoDataAuto.PROBABILIDADE ) + { + return probabilidade; + } + else if( fieldName == HsRelatorioPostoRiscoDataAuto.SEVERIDADE ) + { + return severidade; + } + else if( fieldName == HsRelatorioPostoRiscoDataAuto.VALOR_QUALITATIVO_ID ) + { + return valor_qualitativo_id; + } + else if( fieldName == HsRelatorioPostoRiscoDataAuto.ORDEM ) + { + return ordem; + } + else if( fieldName.equals( HsRelatorioPostoRiscoDataAuto.POSTO_ID ) ) + { + return posto_id; + } + else if( fieldName.equals( HsRelatorioPostoRiscoDataAuto.RISCO_ID ) ) + { + return risco_id; + } + else if( fieldName.equals( HsRelatorioPostoRiscoDataAuto.PROBABILIDADE ) ) + { + return probabilidade; + } + else if( fieldName.equals( HsRelatorioPostoRiscoDataAuto.SEVERIDADE ) ) + { + return severidade; + } + else if( fieldName.equals( HsRelatorioPostoRiscoDataAuto.VALOR_QUALITATIVO_ID ) ) + { + return valor_qualitativo_id; + } + else if( fieldName.equals( HsRelatorioPostoRiscoDataAuto.ORDEM ) ) + { + return ordem; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsRelatorioPostoRiscoDataAuto.POSTO_ID ) + { + posto_id = ( Integer ) value; + } + else if( fieldName == HsRelatorioPostoRiscoDataAuto.RISCO_ID ) + { + risco_id = ( Integer ) value; + } + else if( fieldName == HsRelatorioPostoRiscoDataAuto.PROBABILIDADE ) + { + probabilidade = ( Integer ) value; + } + else if( fieldName == HsRelatorioPostoRiscoDataAuto.SEVERIDADE ) + { + severidade = ( Integer ) value; + } + else if( fieldName == HsRelatorioPostoRiscoDataAuto.VALOR_QUALITATIVO_ID ) + { + valor_qualitativo_id = ( Integer ) value; + } + else if( fieldName == HsRelatorioPostoRiscoDataAuto.ORDEM ) + { + ordem = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioPostoRiscoDataAuto.POSTO_ID ) ) + { + posto_id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioPostoRiscoDataAuto.RISCO_ID ) ) + { + risco_id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioPostoRiscoDataAuto.PROBABILIDADE ) ) + { + probabilidade = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioPostoRiscoDataAuto.SEVERIDADE ) ) + { + severidade = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioPostoRiscoDataAuto.VALOR_QUALITATIVO_ID ) ) + { + valor_qualitativo_id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioPostoRiscoDataAuto.ORDEM ) ) + { + ordem = ( Integer ) value; + } + } + + public Integer getPosto_id() + { + return posto_id; + } + + public void setPosto_id(Integer posto_idValue ) + { + this.posto_id = posto_idValue; + } + + public Integer getRisco_id() + { + return risco_id; + } + + public void setRisco_id(Integer risco_idValue ) + { + this.risco_id = risco_idValue; + } + + public Integer getProbabilidade() + { + return probabilidade; + } + + public void setProbabilidade(Integer probabilidadeValue ) + { + this.probabilidade = probabilidadeValue; + } + + public Integer getSeveridade() + { + return severidade; + } + + public void setSeveridade(Integer severidadeValue ) + { + this.severidade = severidadeValue; + } + + public Integer getValor_qualitativo_id() + { + return valor_qualitativo_id; + } + + public void setValor_qualitativo_id(Integer valor_qualitativo_idValue ) + { + this.valor_qualitativo_id = valor_qualitativo_idValue; + } + + public Integer getOrdem() + { + return ordem; + } + + public void setOrdem(Integer ordemValue ) + { + this.ordem = ordemValue; + } + + public Class getOuterClass() + { + return HsRelatorioPostoRiscoDataAuto.class; + } + + public HsRelatorioPostoRiscoDataAuto getOuterClassInstance() + { + HsRelatorioPostoRiscoDataAuto outerObj = new HsRelatorioPostoRiscoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoRiscoID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoRiscoID id = new com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoRiscoID(); + + Object obj; + obj = this.getPosto_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.posto_id = (Integer)obj; + + obj = this.getRisco_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.risco_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoRiscoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoRiscoData.java new file mode 100644 index 00000000..d99b0975 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoRiscoData.java @@ -0,0 +1,18 @@ +/* +* HsRelatorioPostoRiscoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsRelatorioPostoRiscoData extends com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoRiscoDataAuto +{ + + public HsRelatorioPostoRiscoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoRiscoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoRiscoDataAuto.java new file mode 100644 index 00000000..0f4ccd7d --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoRiscoDataAuto.java @@ -0,0 +1,309 @@ +/* +* HsRelatorioPostoRiscoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsRelatorioPostoRiscoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_relatorio_posto_risco"; + + public static final String POSTO_ID = "posto_id"; + public static final String POSTO_ID_FULL = "hs_relatorio_posto_risco.posto_id"; + public static final String TO_POSTO_ID = "to posto_id"; + public static final String RISCO_ID = "risco_id"; + public static final String RISCO_ID_FULL = "hs_relatorio_posto_risco.risco_id"; + public static final String TO_RISCO_ID = "to risco_id"; + public static final String PROBABILIDADE = "probabilidade"; + public static final String PROBABILIDADE_FULL = "hs_relatorio_posto_risco.probabilidade"; + public static final String SEVERIDADE = "severidade"; + public static final String SEVERIDADE_FULL = "hs_relatorio_posto_risco.severidade"; + public static final String VALOR_QUALITATIVO_ID = "valor_qualitativo_id"; + public static final String VALOR_QUALITATIVO_ID_FULL = "hs_relatorio_posto_risco.valor_qualitativo_id"; + public static final String TO_VALOR_QUALITATIVO_ID = "to valor_qualitativo_id"; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "hs_relatorio_posto_risco.ordem"; + + public static final String FIELD_NAMES[] = new String[]{ + PROBABILIDADE, SEVERIDADE, VALOR_QUALITATIVO_ID, TO_VALOR_QUALITATIVO_ID, + ORDEM, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + POSTO_ID, RISCO_ID, PROBABILIDADE, SEVERIDADE, VALOR_QUALITATIVO_ID, ORDEM, }; + + private Map dataHash; + + public HsRelatorioPostoRiscoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getPosto_id() + { + return (Integer) dataHash.get(POSTO_ID); + } + + public void setPosto_id(Integer posto_idValue ) + { + dataHash.put(TO_POSTO_ID, null); + dataHash.put(POSTO_ID, posto_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoData toPosto_id() + throws Exception + { + if( dataHash.get(TO_POSTO_ID) == null && getPosto_id() != null ) + { + dataHash.put(TO_POSTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoData.class, new Object[]{ getPosto_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoData) dataHash.get(TO_POSTO_ID); + } + + public void setToPosto_id(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoData posto_idObject ) + { + if( posto_idObject == null ) + { + dataHash.put(POSTO_ID, null); + } + else + { + dataHash.put(POSTO_ID, posto_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoData.ID )); + } + dataHash.put(TO_POSTO_ID, posto_idObject); + } + + public Integer getRisco_id() + { + return (Integer) dataHash.get(RISCO_ID); + } + + public void setRisco_id(Integer risco_idValue ) + { + dataHash.put(TO_RISCO_ID, null); + dataHash.put(RISCO_ID, risco_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoData toRisco_id() + throws Exception + { + if( dataHash.get(TO_RISCO_ID) == null && getRisco_id() != null ) + { + dataHash.put(TO_RISCO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoData.class, new Object[]{ getRisco_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoData) dataHash.get(TO_RISCO_ID); + } + + public void setToRisco_id(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoData risco_idObject ) + { + if( risco_idObject == null ) + { + dataHash.put(RISCO_ID, null); + } + else + { + dataHash.put(RISCO_ID, risco_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoData.ID )); + } + dataHash.put(TO_RISCO_ID, risco_idObject); + } + + public Integer getProbabilidade() + { + return (Integer) get(PROBABILIDADE); + } + + public void setProbabilidade(Integer probabilidadeValue ) + { + this.set(PROBABILIDADE, probabilidadeValue ); + } + + public Integer getSeveridade() + { + return (Integer) get(SEVERIDADE); + } + + public void setSeveridade(Integer severidadeValue ) + { + this.set(SEVERIDADE, severidadeValue ); + } + + public Integer getValor_qualitativo_id() + { + return (Integer) dataHash.get(VALOR_QUALITATIVO_ID); + } + + public void setValor_qualitativo_id(Integer valor_qualitativo_idValue ) + { + dataHash.put(TO_VALOR_QUALITATIVO_ID, null); + dataHash.put(VALOR_QUALITATIVO_ID, valor_qualitativo_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoValorQualitativoData toValor_qualitativo_id() + throws Exception + { + if( dataHash.get(TO_VALOR_QUALITATIVO_ID) == null && getValor_qualitativo_id() != null ) + { + dataHash.put(TO_VALOR_QUALITATIVO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoValorQualitativoData.class, new Object[]{ getValor_qualitativo_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoValorQualitativoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoValorQualitativoData) dataHash.get(TO_VALOR_QUALITATIVO_ID); + } + + public void setToValor_qualitativo_id(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoValorQualitativoData valor_qualitativo_idObject ) + { + if( valor_qualitativo_idObject == null ) + { + dataHash.put(VALOR_QUALITATIVO_ID, null); + } + else + { + dataHash.put(VALOR_QUALITATIVO_ID, valor_qualitativo_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoValorQualitativoData.ID )); + } + dataHash.put(TO_VALOR_QUALITATIVO_ID, valor_qualitativo_idObject); + } + + public Integer getOrdem() + { + return (Integer) get(ORDEM); + } + + public void setOrdem(Integer ordemValue ) + { + this.set(ORDEM, ordemValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_POSTO_ID.equals( fieldName ) ) + { + value = toPosto_id(); + } + else if( POSTO_ID.equals( fieldName ) ) + { + value = getPosto_id(); + } + else if( TO_VALOR_QUALITATIVO_ID.equals( fieldName ) ) + { + value = toValor_qualitativo_id(); + } + else if( VALOR_QUALITATIVO_ID.equals( fieldName ) ) + { + value = getValor_qualitativo_id(); + } + else if( TO_RISCO_ID.equals( fieldName ) ) + { + value = toRisco_id(); + } + else if( RISCO_ID.equals( fieldName ) ) + { + value = getRisco_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_POSTO_ID.equals( fieldName ) ) + { + setToPosto_id( (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoData) value ); + } + else if( POSTO_ID.equals( fieldName ) ) + { + setPosto_id( (Integer) value ); + } + else if( TO_VALOR_QUALITATIVO_ID.equals( fieldName ) ) + { + setToValor_qualitativo_id( (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoValorQualitativoData) value ); + } + else if( VALOR_QUALITATIVO_ID.equals( fieldName ) ) + { + setValor_qualitativo_id( (Integer) value ); + } + else if( TO_RISCO_ID.equals( fieldName ) ) + { + setToRisco_id( (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoData) value ); + } + else if( RISCO_ID.equals( fieldName ) ) + { + setRisco_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_POSTO_ID) != null ) + { + toPosto_id().save(); + dataHash.put(POSTO_ID, toPosto_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoData.ID )); + } + + if( dataHash.get(TO_RISCO_ID) != null ) + { + toRisco_id().save(); + dataHash.put(RISCO_ID, toRisco_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoData.ID )); + } + + if( dataHash.get(TO_VALOR_QUALITATIVO_ID) != null ) + { + toValor_qualitativo_id().save(); + dataHash.put(VALOR_QUALITATIVO_ID, toValor_qualitativo_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoValorQualitativoData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsRelatorioPostoRisco.class; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoRiscoID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoRiscoID id = new com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioPostoRiscoID(); + + Object obj; + obj = this.getPosto_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.posto_id = (Integer)obj; + + obj = this.getRisco_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.risco_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoRiscoID.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoRiscoID.java new file mode 100644 index 00000000..00c6368d --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioPostoRiscoID.java @@ -0,0 +1,37 @@ +/* +* HsRelatorioPostoRiscoID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.JDOIDClass; + +public final class HsRelatorioPostoRiscoID extends JDOIDClass implements Serializable +{ + public Integer posto_id; + public Integer risco_id; + + public HsRelatorioPostoRiscoID() + { + } + + + public Object[] getValue() + { + Object value[] = new Object[ 2 ]; + value[ 0 ] = posto_id; + value[ 1 ] = risco_id; + return value; + } + + public void setValues( Object values[] ) + { + posto_id = (Integer) values[ 0 ]; + risco_id = (Integer) values[ 1 ]; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRisco.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRisco.java new file mode 100644 index 00000000..b043988a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRisco.java @@ -0,0 +1,156 @@ +/* +* HsRelatorioRisco.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsRelatorioRisco implements JDOInnerObject +{ + private Integer id; + private Integer relatorio_id; + private String description; + private java.sql.Timestamp deleted_date; + + public HsRelatorioRisco() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsRelatorioRiscoDataAuto.ID ) + { + return id; + } + else if( fieldName == HsRelatorioRiscoDataAuto.RELATORIO_ID ) + { + return relatorio_id; + } + else if( fieldName == HsRelatorioRiscoDataAuto.DESCRIPTION ) + { + return description; + } + else if( fieldName == HsRelatorioRiscoDataAuto.DELETED_DATE ) + { + return deleted_date; + } + else if( fieldName.equals( HsRelatorioRiscoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsRelatorioRiscoDataAuto.RELATORIO_ID ) ) + { + return relatorio_id; + } + else if( fieldName.equals( HsRelatorioRiscoDataAuto.DESCRIPTION ) ) + { + return description; + } + else if( fieldName.equals( HsRelatorioRiscoDataAuto.DELETED_DATE ) ) + { + return deleted_date; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsRelatorioRiscoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsRelatorioRiscoDataAuto.RELATORIO_ID ) + { + relatorio_id = ( Integer ) value; + } + else if( fieldName == HsRelatorioRiscoDataAuto.DESCRIPTION ) + { + description = ( String ) value; + } + else if( fieldName == HsRelatorioRiscoDataAuto.DELETED_DATE ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( HsRelatorioRiscoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioRiscoDataAuto.RELATORIO_ID ) ) + { + relatorio_id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioRiscoDataAuto.DESCRIPTION ) ) + { + description = ( String ) value; + } + else if( fieldName.equals( HsRelatorioRiscoDataAuto.DELETED_DATE ) ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getRelatorio_id() + { + return relatorio_id; + } + + public void setRelatorio_id(Integer relatorio_idValue ) + { + this.relatorio_id = relatorio_idValue; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String descriptionValue ) + { + this.description = descriptionValue; + } + + public java.sql.Timestamp getDeleted_date() + { + return deleted_date; + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.deleted_date = deleted_dateValue; + } + + public Class getOuterClass() + { + return HsRelatorioRiscoDataAuto.class; + } + + public HsRelatorioRiscoDataAuto getOuterClassInstance() + { + HsRelatorioRiscoDataAuto outerObj = new HsRelatorioRiscoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRiscoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRiscoData.java new file mode 100644 index 00000000..df560cc3 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRiscoData.java @@ -0,0 +1,18 @@ +/* +* HsRelatorioRiscoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsRelatorioRiscoData extends com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoDataAuto +{ + + public HsRelatorioRiscoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRiscoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRiscoDataAuto.java new file mode 100644 index 00000000..19c224a8 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRiscoDataAuto.java @@ -0,0 +1,178 @@ +/* +* HsRelatorioRiscoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsRelatorioRiscoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_relatorio_risco"; + + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio_risco.id"; + public static final String RELATORIO_ID = "relatorio_id"; + public static final String RELATORIO_ID_FULL = "hs_relatorio_risco.relatorio_id"; + public static final String TO_RELATORIO_ID = "to relatorio_id"; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_relatorio_risco.description"; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_relatorio_risco.deleted_date"; + + public static final String FIELD_NAMES[] = new String[]{ + RELATORIO_ID, TO_RELATORIO_ID, DESCRIPTION, DELETED_DATE, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, RELATORIO_ID, DESCRIPTION, DELETED_DATE, }; + + private Map dataHash; + + public HsRelatorioRiscoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getRelatorio_id() + { + return (Integer) dataHash.get(RELATORIO_ID); + } + + public void setRelatorio_id(Integer relatorio_idValue ) + { + dataHash.put(TO_RELATORIO_ID, null); + dataHash.put(RELATORIO_ID, relatorio_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData toRelatorio_id() + throws Exception + { + if( dataHash.get(TO_RELATORIO_ID) == null && getRelatorio_id() != null ) + { + dataHash.put(TO_RELATORIO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.class, new Object[]{ getRelatorio_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData) dataHash.get(TO_RELATORIO_ID); + } + + public void setToRelatorio_id(com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData relatorio_idObject ) + { + if( relatorio_idObject == null ) + { + dataHash.put(RELATORIO_ID, null); + } + else + { + dataHash.put(RELATORIO_ID, relatorio_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.ID )); + } + dataHash.put(TO_RELATORIO_ID, relatorio_idObject); + } + + public String getDescription() + { + return (String) get(DESCRIPTION); + } + + public void setDescription(String descriptionValue ) + { + this.set(DESCRIPTION, descriptionValue ); + } + + public java.sql.Timestamp getDeleted_date() + { + return (java.sql.Timestamp) get(DELETED_DATE); + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.set(DELETED_DATE, deleted_dateValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( RELATORIO_ID.equals( fieldName ) ) + { + value = getRelatorio_id(); + } + else if( TO_RELATORIO_ID.equals( fieldName ) ) + { + value = toRelatorio_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( RELATORIO_ID.equals( fieldName ) ) + { + setRelatorio_id( (Integer) value ); + } + else if( TO_RELATORIO_ID.equals( fieldName ) ) + { + setToRelatorio_id( (com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_RELATORIO_ID) != null ) + { + toRelatorio_id().save(); + dataHash.put(RELATORIO_ID, toRelatorio_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsRelatorioRisco.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRiscoValorQualitativo.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRiscoValorQualitativo.java new file mode 100644 index 00000000..d626f7e8 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRiscoValorQualitativo.java @@ -0,0 +1,102 @@ +/* +* HsRelatorioRiscoValorQualitativo.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsRelatorioRiscoValorQualitativo implements JDOInnerObject +{ + private Integer id; + private String description; + + public HsRelatorioRiscoValorQualitativo() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsRelatorioRiscoValorQualitativoDataAuto.ID ) + { + return id; + } + else if( fieldName == HsRelatorioRiscoValorQualitativoDataAuto.DESCRIPTION ) + { + return description; + } + else if( fieldName.equals( HsRelatorioRiscoValorQualitativoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsRelatorioRiscoValorQualitativoDataAuto.DESCRIPTION ) ) + { + return description; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsRelatorioRiscoValorQualitativoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsRelatorioRiscoValorQualitativoDataAuto.DESCRIPTION ) + { + description = ( String ) value; + } + else if( fieldName.equals( HsRelatorioRiscoValorQualitativoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsRelatorioRiscoValorQualitativoDataAuto.DESCRIPTION ) ) + { + description = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String descriptionValue ) + { + this.description = descriptionValue; + } + + public Class getOuterClass() + { + return HsRelatorioRiscoValorQualitativoDataAuto.class; + } + + public HsRelatorioRiscoValorQualitativoDataAuto getOuterClassInstance() + { + HsRelatorioRiscoValorQualitativoDataAuto outerObj = new HsRelatorioRiscoValorQualitativoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRiscoValorQualitativoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRiscoValorQualitativoData.java new file mode 100644 index 00000000..00f70eeb --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRiscoValorQualitativoData.java @@ -0,0 +1,18 @@ +/* +* HsRelatorioRiscoValorQualitativoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsRelatorioRiscoValorQualitativoData extends com.evolute.siprp.server.db.data.siprp_local3.HsRelatorioRiscoValorQualitativoDataAuto +{ + + public HsRelatorioRiscoValorQualitativoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRiscoValorQualitativoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRiscoValorQualitativoDataAuto.java new file mode 100644 index 00000000..97150c01 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRelatorioRiscoValorQualitativoDataAuto.java @@ -0,0 +1,95 @@ +/* +* HsRelatorioRiscoValorQualitativoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsRelatorioRiscoValorQualitativoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_relatorio_risco_valor_qualitativo"; + + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio_risco_valor_qualitativo.id"; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_relatorio_risco_valor_qualitativo.description"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRIPTION, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DESCRIPTION, }; + + private Map dataHash; + + public HsRelatorioRiscoValorQualitativoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getDescription() + { + return (String) get(DESCRIPTION); + } + + public void setDescription(String descriptionValue ) + { + this.set(DESCRIPTION, descriptionValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsRelatorioRiscoValorQualitativo.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRisco.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRisco.java new file mode 100644 index 00000000..1b0ab729 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRisco.java @@ -0,0 +1,156 @@ +/* +* HsRisco.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsRisco implements JDOInnerObject +{ + private Integer id; + private Integer tema_id; + private String description; + private java.sql.Timestamp deleted_date; + + public HsRisco() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsRiscoDataAuto.ID ) + { + return id; + } + else if( fieldName == HsRiscoDataAuto.TEMA_ID ) + { + return tema_id; + } + else if( fieldName == HsRiscoDataAuto.DESCRIPTION ) + { + return description; + } + else if( fieldName == HsRiscoDataAuto.DELETED_DATE ) + { + return deleted_date; + } + else if( fieldName.equals( HsRiscoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsRiscoDataAuto.TEMA_ID ) ) + { + return tema_id; + } + else if( fieldName.equals( HsRiscoDataAuto.DESCRIPTION ) ) + { + return description; + } + else if( fieldName.equals( HsRiscoDataAuto.DELETED_DATE ) ) + { + return deleted_date; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsRiscoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsRiscoDataAuto.TEMA_ID ) + { + tema_id = ( Integer ) value; + } + else if( fieldName == HsRiscoDataAuto.DESCRIPTION ) + { + description = ( String ) value; + } + else if( fieldName == HsRiscoDataAuto.DELETED_DATE ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( HsRiscoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsRiscoDataAuto.TEMA_ID ) ) + { + tema_id = ( Integer ) value; + } + else if( fieldName.equals( HsRiscoDataAuto.DESCRIPTION ) ) + { + description = ( String ) value; + } + else if( fieldName.equals( HsRiscoDataAuto.DELETED_DATE ) ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getTema_id() + { + return tema_id; + } + + public void setTema_id(Integer tema_idValue ) + { + this.tema_id = tema_idValue; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String descriptionValue ) + { + this.description = descriptionValue; + } + + public java.sql.Timestamp getDeleted_date() + { + return deleted_date; + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.deleted_date = deleted_dateValue; + } + + public Class getOuterClass() + { + return HsRiscoDataAuto.class; + } + + public HsRiscoDataAuto getOuterClassInstance() + { + HsRiscoDataAuto outerObj = new HsRiscoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoData.java new file mode 100644 index 00000000..55ce09d7 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoData.java @@ -0,0 +1,18 @@ +/* +* HsRiscoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsRiscoData extends com.evolute.siprp.server.db.data.siprp_local3.HsRiscoDataAuto +{ + + public HsRiscoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoDataAuto.java new file mode 100644 index 00000000..eb811187 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoDataAuto.java @@ -0,0 +1,178 @@ +/* +* HsRiscoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsRiscoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_risco"; + + public static final String ID = "id"; + public static final String ID_FULL = "hs_risco.id"; + public static final String TEMA_ID = "tema_id"; + public static final String TEMA_ID_FULL = "hs_risco.tema_id"; + public static final String TO_TEMA_ID = "to tema_id"; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_risco.description"; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_risco.deleted_date"; + + public static final String FIELD_NAMES[] = new String[]{ + TEMA_ID, TO_TEMA_ID, DESCRIPTION, DELETED_DATE, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TEMA_ID, DESCRIPTION, DELETED_DATE, }; + + private Map dataHash; + + public HsRiscoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getTema_id() + { + return (Integer) dataHash.get(TEMA_ID); + } + + public void setTema_id(Integer tema_idValue ) + { + dataHash.put(TO_TEMA_ID, null); + dataHash.put(TEMA_ID, tema_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRiscoTemaData toTema_id() + throws Exception + { + if( dataHash.get(TO_TEMA_ID) == null && getTema_id() != null ) + { + dataHash.put(TO_TEMA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsRiscoTemaData.class, new Object[]{ getTema_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsRiscoTemaData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsRiscoTemaData) dataHash.get(TO_TEMA_ID); + } + + public void setToTema_id(com.evolute.siprp.server.db.data.siprp_local3.HsRiscoTemaData tema_idObject ) + { + if( tema_idObject == null ) + { + dataHash.put(TEMA_ID, null); + } + else + { + dataHash.put(TEMA_ID, tema_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsRiscoTemaData.ID )); + } + dataHash.put(TO_TEMA_ID, tema_idObject); + } + + public String getDescription() + { + return (String) get(DESCRIPTION); + } + + public void setDescription(String descriptionValue ) + { + this.set(DESCRIPTION, descriptionValue ); + } + + public java.sql.Timestamp getDeleted_date() + { + return (java.sql.Timestamp) get(DELETED_DATE); + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.set(DELETED_DATE, deleted_dateValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_TEMA_ID.equals( fieldName ) ) + { + value = toTema_id(); + } + else if( TEMA_ID.equals( fieldName ) ) + { + value = getTema_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_TEMA_ID.equals( fieldName ) ) + { + setToTema_id( (com.evolute.siprp.server.db.data.siprp_local3.HsRiscoTemaData) value ); + } + else if( TEMA_ID.equals( fieldName ) ) + { + setTema_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_TEMA_ID) != null ) + { + toTema_id().save(); + dataHash.put(TEMA_ID, toTema_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsRiscoTemaData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsRisco.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoEmpresa.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoEmpresa.java new file mode 100644 index 00000000..f14ce1ad --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoEmpresa.java @@ -0,0 +1,114 @@ +/* +* HsRiscoEmpresa.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsRiscoEmpresa implements JDOInnerObject +{ + private Integer risco_id; + private Integer empresa_id; + + public HsRiscoEmpresa() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsRiscoEmpresaDataAuto.RISCO_ID ) + { + return risco_id; + } + else if( fieldName == HsRiscoEmpresaDataAuto.EMPRESA_ID ) + { + return empresa_id; + } + else if( fieldName.equals( HsRiscoEmpresaDataAuto.RISCO_ID ) ) + { + return risco_id; + } + else if( fieldName.equals( HsRiscoEmpresaDataAuto.EMPRESA_ID ) ) + { + return empresa_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsRiscoEmpresaDataAuto.RISCO_ID ) + { + risco_id = ( Integer ) value; + } + else if( fieldName == HsRiscoEmpresaDataAuto.EMPRESA_ID ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName.equals( HsRiscoEmpresaDataAuto.RISCO_ID ) ) + { + risco_id = ( Integer ) value; + } + else if( fieldName.equals( HsRiscoEmpresaDataAuto.EMPRESA_ID ) ) + { + empresa_id = ( Integer ) value; + } + } + + public Integer getRisco_id() + { + return risco_id; + } + + public void setRisco_id(Integer risco_idValue ) + { + this.risco_id = risco_idValue; + } + + public Integer getEmpresa_id() + { + return empresa_id; + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + this.empresa_id = empresa_idValue; + } + + public Class getOuterClass() + { + return HsRiscoEmpresaDataAuto.class; + } + + public HsRiscoEmpresaDataAuto getOuterClassInstance() + { + HsRiscoEmpresaDataAuto outerObj = new HsRiscoEmpresaDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRiscoEmpresaID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsRiscoEmpresaID id = new com.evolute.siprp.server.db.data.siprp_local3.HsRiscoEmpresaID(); + + Object obj; + obj = this.getRisco_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.risco_id = (Integer)obj; + + obj = this.getEmpresa_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.empresa_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoEmpresaData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoEmpresaData.java new file mode 100644 index 00000000..6553781b --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoEmpresaData.java @@ -0,0 +1,18 @@ +/* +* HsRiscoEmpresaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsRiscoEmpresaData extends com.evolute.siprp.server.db.data.siprp_local3.HsRiscoEmpresaDataAuto +{ + + public HsRiscoEmpresaData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoEmpresaDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoEmpresaDataAuto.java new file mode 100644 index 00000000..453a2c04 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoEmpresaDataAuto.java @@ -0,0 +1,213 @@ +/* +* HsRiscoEmpresaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsRiscoEmpresaDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_risco_empresa"; + + public static final String RISCO_ID = "risco_id"; + public static final String RISCO_ID_FULL = "hs_risco_empresa.risco_id"; + public static final String TO_RISCO_ID = "to risco_id"; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "hs_risco_empresa.empresa_id"; + public static final String TO_EMPRESA_ID = "to empresa_id"; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + RISCO_ID, EMPRESA_ID, }; + + private Map dataHash; + + public HsRiscoEmpresaDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getRisco_id() + { + return (Integer) dataHash.get(RISCO_ID); + } + + public void setRisco_id(Integer risco_idValue ) + { + dataHash.put(TO_RISCO_ID, null); + dataHash.put(RISCO_ID, risco_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData toRisco_id() + throws Exception + { + if( dataHash.get(TO_RISCO_ID) == null && getRisco_id() != null ) + { + dataHash.put(TO_RISCO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData.class, new Object[]{ getRisco_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData) dataHash.get(TO_RISCO_ID); + } + + public void setToRisco_id(com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData risco_idObject ) + { + if( risco_idObject == null ) + { + dataHash.put(RISCO_ID, null); + } + else + { + dataHash.put(RISCO_ID, risco_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData.ID )); + } + dataHash.put(TO_RISCO_ID, risco_idObject); + } + + public Integer getEmpresa_id() + { + return (Integer) dataHash.get(EMPRESA_ID); + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + dataHash.put(TO_EMPRESA_ID, null); + dataHash.put(EMPRESA_ID, empresa_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EmpresasData toEmpresa_id() + throws Exception + { + if( dataHash.get(TO_EMPRESA_ID) == null && getEmpresa_id() != null ) + { + dataHash.put(TO_EMPRESA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.class, new Object[]{ getEmpresa_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) dataHash.get(TO_EMPRESA_ID); + } + + public void setToEmpresa_id(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData empresa_idObject ) + { + if( empresa_idObject == null ) + { + dataHash.put(EMPRESA_ID, null); + } + else + { + dataHash.put(EMPRESA_ID, empresa_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + dataHash.put(TO_EMPRESA_ID, empresa_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_EMPRESA_ID.equals( fieldName ) ) + { + value = toEmpresa_id(); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + value = getEmpresa_id(); + } + else if( TO_RISCO_ID.equals( fieldName ) ) + { + value = toRisco_id(); + } + else if( RISCO_ID.equals( fieldName ) ) + { + value = getRisco_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_EMPRESA_ID.equals( fieldName ) ) + { + setToEmpresa_id( (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) value ); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + setEmpresa_id( (Integer) value ); + } + else if( TO_RISCO_ID.equals( fieldName ) ) + { + setToRisco_id( (com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData) value ); + } + else if( RISCO_ID.equals( fieldName ) ) + { + setRisco_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_RISCO_ID) != null ) + { + toRisco_id().save(); + dataHash.put(RISCO_ID, toRisco_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData.ID )); + } + + if( dataHash.get(TO_EMPRESA_ID) != null ) + { + toEmpresa_id().save(); + dataHash.put(EMPRESA_ID, toEmpresa_id().get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsRiscoEmpresa.class; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRiscoEmpresaID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsRiscoEmpresaID id = new com.evolute.siprp.server.db.data.siprp_local3.HsRiscoEmpresaID(); + + Object obj; + obj = this.getRisco_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.risco_id = (Integer)obj; + + obj = this.getEmpresa_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.empresa_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoEmpresaID.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoEmpresaID.java new file mode 100644 index 00000000..df99d74a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoEmpresaID.java @@ -0,0 +1,37 @@ +/* +* HsRiscoEmpresaID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.JDOIDClass; + +public final class HsRiscoEmpresaID extends JDOIDClass implements Serializable +{ + public Integer risco_id; + public Integer empresa_id; + + public HsRiscoEmpresaID() + { + } + + + public Object[] getValue() + { + Object value[] = new Object[ 2 ]; + value[ 0 ] = risco_id; + value[ 1 ] = empresa_id; + return value; + } + + public void setValues( Object values[] ) + { + risco_id = (Integer) values[ 0 ]; + empresa_id = (Integer) values[ 1 ]; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoMedida.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoMedida.java new file mode 100644 index 00000000..f8963be9 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoMedida.java @@ -0,0 +1,114 @@ +/* +* HsRiscoMedida.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsRiscoMedida implements JDOInnerObject +{ + private Integer risco_id; + private Integer medida_id; + + public HsRiscoMedida() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsRiscoMedidaDataAuto.RISCO_ID ) + { + return risco_id; + } + else if( fieldName == HsRiscoMedidaDataAuto.MEDIDA_ID ) + { + return medida_id; + } + else if( fieldName.equals( HsRiscoMedidaDataAuto.RISCO_ID ) ) + { + return risco_id; + } + else if( fieldName.equals( HsRiscoMedidaDataAuto.MEDIDA_ID ) ) + { + return medida_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsRiscoMedidaDataAuto.RISCO_ID ) + { + risco_id = ( Integer ) value; + } + else if( fieldName == HsRiscoMedidaDataAuto.MEDIDA_ID ) + { + medida_id = ( Integer ) value; + } + else if( fieldName.equals( HsRiscoMedidaDataAuto.RISCO_ID ) ) + { + risco_id = ( Integer ) value; + } + else if( fieldName.equals( HsRiscoMedidaDataAuto.MEDIDA_ID ) ) + { + medida_id = ( Integer ) value; + } + } + + public Integer getRisco_id() + { + return risco_id; + } + + public void setRisco_id(Integer risco_idValue ) + { + this.risco_id = risco_idValue; + } + + public Integer getMedida_id() + { + return medida_id; + } + + public void setMedida_id(Integer medida_idValue ) + { + this.medida_id = medida_idValue; + } + + public Class getOuterClass() + { + return HsRiscoMedidaDataAuto.class; + } + + public HsRiscoMedidaDataAuto getOuterClassInstance() + { + HsRiscoMedidaDataAuto outerObj = new HsRiscoMedidaDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRiscoMedidaID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsRiscoMedidaID id = new com.evolute.siprp.server.db.data.siprp_local3.HsRiscoMedidaID(); + + Object obj; + obj = this.getRisco_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.risco_id = (Integer)obj; + + obj = this.getMedida_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.medida_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoMedidaData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoMedidaData.java new file mode 100644 index 00000000..c686435f --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoMedidaData.java @@ -0,0 +1,18 @@ +/* +* HsRiscoMedidaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsRiscoMedidaData extends com.evolute.siprp.server.db.data.siprp_local3.HsRiscoMedidaDataAuto +{ + + public HsRiscoMedidaData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoMedidaDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoMedidaDataAuto.java new file mode 100644 index 00000000..640c8bce --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoMedidaDataAuto.java @@ -0,0 +1,213 @@ +/* +* HsRiscoMedidaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsRiscoMedidaDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_risco_medida"; + + public static final String RISCO_ID = "risco_id"; + public static final String RISCO_ID_FULL = "hs_risco_medida.risco_id"; + public static final String TO_RISCO_ID = "to risco_id"; + public static final String MEDIDA_ID = "medida_id"; + public static final String MEDIDA_ID_FULL = "hs_risco_medida.medida_id"; + public static final String TO_MEDIDA_ID = "to medida_id"; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + RISCO_ID, MEDIDA_ID, }; + + private Map dataHash; + + public HsRiscoMedidaDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getRisco_id() + { + return (Integer) dataHash.get(RISCO_ID); + } + + public void setRisco_id(Integer risco_idValue ) + { + dataHash.put(TO_RISCO_ID, null); + dataHash.put(RISCO_ID, risco_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData toRisco_id() + throws Exception + { + if( dataHash.get(TO_RISCO_ID) == null && getRisco_id() != null ) + { + dataHash.put(TO_RISCO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData.class, new Object[]{ getRisco_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData) dataHash.get(TO_RISCO_ID); + } + + public void setToRisco_id(com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData risco_idObject ) + { + if( risco_idObject == null ) + { + dataHash.put(RISCO_ID, null); + } + else + { + dataHash.put(RISCO_ID, risco_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData.ID )); + } + dataHash.put(TO_RISCO_ID, risco_idObject); + } + + public Integer getMedida_id() + { + return (Integer) dataHash.get(MEDIDA_ID); + } + + public void setMedida_id(Integer medida_idValue ) + { + dataHash.put(TO_MEDIDA_ID, null); + dataHash.put(MEDIDA_ID, medida_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsMedidaData toMedida_id() + throws Exception + { + if( dataHash.get(TO_MEDIDA_ID) == null && getMedida_id() != null ) + { + dataHash.put(TO_MEDIDA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.HsMedidaData.class, new Object[]{ getMedida_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.HsMedidaData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.HsMedidaData) dataHash.get(TO_MEDIDA_ID); + } + + public void setToMedida_id(com.evolute.siprp.server.db.data.siprp_local3.HsMedidaData medida_idObject ) + { + if( medida_idObject == null ) + { + dataHash.put(MEDIDA_ID, null); + } + else + { + dataHash.put(MEDIDA_ID, medida_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.HsMedidaData.ID )); + } + dataHash.put(TO_MEDIDA_ID, medida_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( MEDIDA_ID.equals( fieldName ) ) + { + value = getMedida_id(); + } + else if( TO_RISCO_ID.equals( fieldName ) ) + { + value = toRisco_id(); + } + else if( TO_MEDIDA_ID.equals( fieldName ) ) + { + value = toMedida_id(); + } + else if( RISCO_ID.equals( fieldName ) ) + { + value = getRisco_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( MEDIDA_ID.equals( fieldName ) ) + { + setMedida_id( (Integer) value ); + } + else if( TO_RISCO_ID.equals( fieldName ) ) + { + setToRisco_id( (com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData) value ); + } + else if( TO_MEDIDA_ID.equals( fieldName ) ) + { + setToMedida_id( (com.evolute.siprp.server.db.data.siprp_local3.HsMedidaData) value ); + } + else if( RISCO_ID.equals( fieldName ) ) + { + setRisco_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_RISCO_ID) != null ) + { + toRisco_id().save(); + dataHash.put(RISCO_ID, toRisco_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsRiscoData.ID )); + } + + if( dataHash.get(TO_MEDIDA_ID) != null ) + { + toMedida_id().save(); + dataHash.put(MEDIDA_ID, toMedida_id().get( com.evolute.siprp.server.db.data.siprp_local3.HsMedidaData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsRiscoMedida.class; + } + + public com.evolute.siprp.server.db.data.siprp_local3.HsRiscoMedidaID getJDOPrimaryKey() + { + com.evolute.siprp.server.db.data.siprp_local3.HsRiscoMedidaID id = new com.evolute.siprp.server.db.data.siprp_local3.HsRiscoMedidaID(); + + Object obj; + obj = this.getRisco_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.risco_id = (Integer)obj; + + obj = this.getMedida_id(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + id.medida_id = (Integer)obj; + + return id; + + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoMedidaID.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoMedidaID.java new file mode 100644 index 00000000..e0fbab20 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoMedidaID.java @@ -0,0 +1,37 @@ +/* +* HsRiscoMedidaID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.JDOIDClass; + +public final class HsRiscoMedidaID extends JDOIDClass implements Serializable +{ + public Integer risco_id; + public Integer medida_id; + + public HsRiscoMedidaID() + { + } + + + public Object[] getValue() + { + Object value[] = new Object[ 2 ]; + value[ 0 ] = risco_id; + value[ 1 ] = medida_id; + return value; + } + + public void setValues( Object values[] ) + { + risco_id = (Integer) values[ 0 ]; + medida_id = (Integer) values[ 1 ]; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoTema.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoTema.java new file mode 100644 index 00000000..85623dbf --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoTema.java @@ -0,0 +1,129 @@ +/* +* HsRiscoTema.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class HsRiscoTema implements JDOInnerObject +{ + private Integer id; + private String description; + private java.sql.Timestamp deleted_date; + + public HsRiscoTema() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HsRiscoTemaDataAuto.ID ) + { + return id; + } + else if( fieldName == HsRiscoTemaDataAuto.DESCRIPTION ) + { + return description; + } + else if( fieldName == HsRiscoTemaDataAuto.DELETED_DATE ) + { + return deleted_date; + } + else if( fieldName.equals( HsRiscoTemaDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( HsRiscoTemaDataAuto.DESCRIPTION ) ) + { + return description; + } + else if( fieldName.equals( HsRiscoTemaDataAuto.DELETED_DATE ) ) + { + return deleted_date; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HsRiscoTemaDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HsRiscoTemaDataAuto.DESCRIPTION ) + { + description = ( String ) value; + } + else if( fieldName == HsRiscoTemaDataAuto.DELETED_DATE ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( HsRiscoTemaDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HsRiscoTemaDataAuto.DESCRIPTION ) ) + { + description = ( String ) value; + } + else if( fieldName.equals( HsRiscoTemaDataAuto.DELETED_DATE ) ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String descriptionValue ) + { + this.description = descriptionValue; + } + + public java.sql.Timestamp getDeleted_date() + { + return deleted_date; + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.deleted_date = deleted_dateValue; + } + + public Class getOuterClass() + { + return HsRiscoTemaDataAuto.class; + } + + public HsRiscoTemaDataAuto getOuterClassInstance() + { + HsRiscoTemaDataAuto outerObj = new HsRiscoTemaDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoTemaData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoTemaData.java new file mode 100644 index 00000000..4fef3f72 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoTemaData.java @@ -0,0 +1,18 @@ +/* +* HsRiscoTemaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class HsRiscoTemaData extends com.evolute.siprp.server.db.data.siprp_local3.HsRiscoTemaDataAuto +{ + + public HsRiscoTemaData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoTemaDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoTemaDataAuto.java new file mode 100644 index 00000000..49b87030 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/HsRiscoTemaDataAuto.java @@ -0,0 +1,107 @@ +/* +* HsRiscoTemaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class HsRiscoTemaDataAuto extends JDOObject +{ + + public static final String TABLENAME = "hs_risco_tema"; + + public static final String ID = "id"; + public static final String ID_FULL = "hs_risco_tema.id"; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_risco_tema.description"; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_risco_tema.deleted_date"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRIPTION, DELETED_DATE, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DESCRIPTION, DELETED_DATE, }; + + private Map dataHash; + + public HsRiscoTemaDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getDescription() + { + return (String) get(DESCRIPTION); + } + + public void setDescription(String descriptionValue ) + { + this.set(DESCRIPTION, descriptionValue ); + } + + public java.sql.Timestamp getDeleted_date() + { + return (java.sql.Timestamp) get(DELETED_DATE); + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.set(DELETED_DATE, deleted_dateValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HsRiscoTema.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Ids.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Ids.java new file mode 100644 index 00000000..ff1f0f6c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Ids.java @@ -0,0 +1,75 @@ +/* +* Ids.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class Ids implements JDOInnerObject +{ + private Integer id; + + public Ids() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == IdsDataAuto.ID ) + { + return id; + } + else if( fieldName.equals( IdsDataAuto.ID ) ) + { + return id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == IdsDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( IdsDataAuto.ID ) ) + { + id = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Class getOuterClass() + { + return IdsDataAuto.class; + } + + public IdsDataAuto getOuterClassInstance() + { + IdsDataAuto outerObj = new IdsDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/IdsData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/IdsData.java new file mode 100644 index 00000000..b4ea12fc --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/IdsData.java @@ -0,0 +1,18 @@ +/* +* IdsDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class IdsData extends com.evolute.siprp.server.db.data.siprp_local3.IdsDataAuto +{ + + public IdsData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/IdsDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/IdsDataAuto.java new file mode 100644 index 00000000..43fb0afb --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/IdsDataAuto.java @@ -0,0 +1,83 @@ +/* +* IdsDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class IdsDataAuto extends JDOObject +{ + + public static final String TABLENAME = "ids"; + + public static final String ID = "id"; + public static final String ID_FULL = "ids.id"; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, }; + + private Map dataHash; + + public IdsDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Ids.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Image.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Image.java new file mode 100644 index 00000000..d9176ca6 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Image.java @@ -0,0 +1,129 @@ +/* +* Image.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class Image implements JDOInnerObject +{ + private Integer id; + private String name; + private byte[] image_data; + + public Image() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == ImageDataAuto.ID ) + { + return id; + } + else if( fieldName == ImageDataAuto.NAME ) + { + return name; + } + else if( fieldName == ImageDataAuto.IMAGE_DATA ) + { + return image_data; + } + else if( fieldName.equals( ImageDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( ImageDataAuto.NAME ) ) + { + return name; + } + else if( fieldName.equals( ImageDataAuto.IMAGE_DATA ) ) + { + return image_data; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == ImageDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == ImageDataAuto.NAME ) + { + name = ( String ) value; + } + else if( fieldName == ImageDataAuto.IMAGE_DATA ) + { + image_data = ( byte[] ) value; + } + else if( fieldName.equals( ImageDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( ImageDataAuto.NAME ) ) + { + name = ( String ) value; + } + else if( fieldName.equals( ImageDataAuto.IMAGE_DATA ) ) + { + image_data = ( byte[] ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getName() + { + return name; + } + + public void setName(String nameValue ) + { + this.name = nameValue; + } + + public byte[] getImage_data() + { + return image_data; + } + + public void setImage_data(byte[] image_dataValue ) + { + this.image_data = image_dataValue; + } + + public Class getOuterClass() + { + return ImageDataAuto.class; + } + + public ImageDataAuto getOuterClassInstance() + { + ImageDataAuto outerObj = new ImageDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ImageData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ImageData.java new file mode 100644 index 00000000..4cea4935 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ImageData.java @@ -0,0 +1,18 @@ +/* +* ImageDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class ImageData extends com.evolute.siprp.server.db.data.siprp_local3.ImageDataAuto +{ + + public ImageData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ImageDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ImageDataAuto.java new file mode 100644 index 00000000..c3a2730c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/ImageDataAuto.java @@ -0,0 +1,107 @@ +/* +* ImageDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class ImageDataAuto extends JDOObject +{ + + public static final String TABLENAME = "image"; + + public static final String ID = "id"; + public static final String ID_FULL = "image.id"; + public static final String NAME = "name"; + public static final String NAME_FULL = "image.name"; + public static final String IMAGE_DATA = "image_data"; + public static final String IMAGE_DATA_FULL = "image.image_data"; + + public static final String FIELD_NAMES[] = new String[]{ + NAME, IMAGE_DATA, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, NAME, IMAGE_DATA, }; + + private Map dataHash; + + public ImageDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getName() + { + return (String) get(NAME); + } + + public void setName(String nameValue ) + { + this.set(NAME, nameValue ); + } + + public byte[] getImage_data() + { + return (byte[]) get(IMAGE_DATA); + } + + public void setImage_data(byte[] image_dataValue ) + { + this.set(IMAGE_DATA, image_dataValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Image.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Lembretes.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Lembretes.java new file mode 100644 index 00000000..92adcc19 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Lembretes.java @@ -0,0 +1,507 @@ +/* +* Lembretes.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class Lembretes implements JDOInnerObject +{ + private Integer id; + private Integer tipo_id; + private java.util.Date data; + private String descricao; + private String texto; + private Integer empresa_id; + private Integer estabelecimento_id; + private Integer trabalhador_id; + private Integer marcacao_estabelecimento_id; + private Integer marcacao_trabalhador_id; + private String enviar_email; + private Integer periodicidade_dias; + private Integer periodicidade_meses; + private java.util.Date ultimo_envio; + private Integer trabalhadores_consultas_datas_id; + private Integer trabalhadores_ecds_datas_id; + private java.sql.Timestamp deleted_date; + + public Lembretes() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == LembretesDataAuto.ID ) + { + return id; + } + else if( fieldName == LembretesDataAuto.TIPO_ID ) + { + return tipo_id; + } + else if( fieldName == LembretesDataAuto.DATA ) + { + return data; + } + else if( fieldName == LembretesDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName == LembretesDataAuto.TEXTO ) + { + return texto; + } + else if( fieldName == LembretesDataAuto.EMPRESA_ID ) + { + return empresa_id; + } + else if( fieldName == LembretesDataAuto.ESTABELECIMENTO_ID ) + { + return estabelecimento_id; + } + else if( fieldName == LembretesDataAuto.TRABALHADOR_ID ) + { + return trabalhador_id; + } + else if( fieldName == LembretesDataAuto.MARCACAO_ESTABELECIMENTO_ID ) + { + return marcacao_estabelecimento_id; + } + else if( fieldName == LembretesDataAuto.MARCACAO_TRABALHADOR_ID ) + { + return marcacao_trabalhador_id; + } + else if( fieldName == LembretesDataAuto.ENVIAR_EMAIL ) + { + return enviar_email; + } + else if( fieldName == LembretesDataAuto.PERIODICIDADE_DIAS ) + { + return periodicidade_dias; + } + else if( fieldName == LembretesDataAuto.PERIODICIDADE_MESES ) + { + return periodicidade_meses; + } + else if( fieldName == LembretesDataAuto.ULTIMO_ENVIO ) + { + return ultimo_envio; + } + else if( fieldName == LembretesDataAuto.TRABALHADORES_CONSULTAS_DATAS_ID ) + { + return trabalhadores_consultas_datas_id; + } + else if( fieldName == LembretesDataAuto.TRABALHADORES_ECDS_DATAS_ID ) + { + return trabalhadores_ecds_datas_id; + } + else if( fieldName == LembretesDataAuto.DELETED_DATE ) + { + return deleted_date; + } + else if( fieldName.equals( LembretesDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( LembretesDataAuto.TIPO_ID ) ) + { + return tipo_id; + } + else if( fieldName.equals( LembretesDataAuto.DATA ) ) + { + return data; + } + else if( fieldName.equals( LembretesDataAuto.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( LembretesDataAuto.TEXTO ) ) + { + return texto; + } + else if( fieldName.equals( LembretesDataAuto.EMPRESA_ID ) ) + { + return empresa_id; + } + else if( fieldName.equals( LembretesDataAuto.ESTABELECIMENTO_ID ) ) + { + return estabelecimento_id; + } + else if( fieldName.equals( LembretesDataAuto.TRABALHADOR_ID ) ) + { + return trabalhador_id; + } + else if( fieldName.equals( LembretesDataAuto.MARCACAO_ESTABELECIMENTO_ID ) ) + { + return marcacao_estabelecimento_id; + } + else if( fieldName.equals( LembretesDataAuto.MARCACAO_TRABALHADOR_ID ) ) + { + return marcacao_trabalhador_id; + } + else if( fieldName.equals( LembretesDataAuto.ENVIAR_EMAIL ) ) + { + return enviar_email; + } + else if( fieldName.equals( LembretesDataAuto.PERIODICIDADE_DIAS ) ) + { + return periodicidade_dias; + } + else if( fieldName.equals( LembretesDataAuto.PERIODICIDADE_MESES ) ) + { + return periodicidade_meses; + } + else if( fieldName.equals( LembretesDataAuto.ULTIMO_ENVIO ) ) + { + return ultimo_envio; + } + else if( fieldName.equals( LembretesDataAuto.TRABALHADORES_CONSULTAS_DATAS_ID ) ) + { + return trabalhadores_consultas_datas_id; + } + else if( fieldName.equals( LembretesDataAuto.TRABALHADORES_ECDS_DATAS_ID ) ) + { + return trabalhadores_ecds_datas_id; + } + else if( fieldName.equals( LembretesDataAuto.DELETED_DATE ) ) + { + return deleted_date; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == LembretesDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == LembretesDataAuto.TIPO_ID ) + { + tipo_id = ( Integer ) value; + } + else if( fieldName == LembretesDataAuto.DATA ) + { + data = ( java.util.Date ) value; + } + else if( fieldName == LembretesDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == LembretesDataAuto.TEXTO ) + { + texto = ( String ) value; + } + else if( fieldName == LembretesDataAuto.EMPRESA_ID ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName == LembretesDataAuto.ESTABELECIMENTO_ID ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName == LembretesDataAuto.TRABALHADOR_ID ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName == LembretesDataAuto.MARCACAO_ESTABELECIMENTO_ID ) + { + marcacao_estabelecimento_id = ( Integer ) value; + } + else if( fieldName == LembretesDataAuto.MARCACAO_TRABALHADOR_ID ) + { + marcacao_trabalhador_id = ( Integer ) value; + } + else if( fieldName == LembretesDataAuto.ENVIAR_EMAIL ) + { + enviar_email = ( String ) value; + } + else if( fieldName == LembretesDataAuto.PERIODICIDADE_DIAS ) + { + periodicidade_dias = ( Integer ) value; + } + else if( fieldName == LembretesDataAuto.PERIODICIDADE_MESES ) + { + periodicidade_meses = ( Integer ) value; + } + else if( fieldName == LembretesDataAuto.ULTIMO_ENVIO ) + { + ultimo_envio = ( java.util.Date ) value; + } + else if( fieldName == LembretesDataAuto.TRABALHADORES_CONSULTAS_DATAS_ID ) + { + trabalhadores_consultas_datas_id = ( Integer ) value; + } + else if( fieldName == LembretesDataAuto.TRABALHADORES_ECDS_DATAS_ID ) + { + trabalhadores_ecds_datas_id = ( Integer ) value; + } + else if( fieldName == LembretesDataAuto.DELETED_DATE ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( LembretesDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( LembretesDataAuto.TIPO_ID ) ) + { + tipo_id = ( Integer ) value; + } + else if( fieldName.equals( LembretesDataAuto.DATA ) ) + { + data = ( java.util.Date ) value; + } + else if( fieldName.equals( LembretesDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( LembretesDataAuto.TEXTO ) ) + { + texto = ( String ) value; + } + else if( fieldName.equals( LembretesDataAuto.EMPRESA_ID ) ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName.equals( LembretesDataAuto.ESTABELECIMENTO_ID ) ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName.equals( LembretesDataAuto.TRABALHADOR_ID ) ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName.equals( LembretesDataAuto.MARCACAO_ESTABELECIMENTO_ID ) ) + { + marcacao_estabelecimento_id = ( Integer ) value; + } + else if( fieldName.equals( LembretesDataAuto.MARCACAO_TRABALHADOR_ID ) ) + { + marcacao_trabalhador_id = ( Integer ) value; + } + else if( fieldName.equals( LembretesDataAuto.ENVIAR_EMAIL ) ) + { + enviar_email = ( String ) value; + } + else if( fieldName.equals( LembretesDataAuto.PERIODICIDADE_DIAS ) ) + { + periodicidade_dias = ( Integer ) value; + } + else if( fieldName.equals( LembretesDataAuto.PERIODICIDADE_MESES ) ) + { + periodicidade_meses = ( Integer ) value; + } + else if( fieldName.equals( LembretesDataAuto.ULTIMO_ENVIO ) ) + { + ultimo_envio = ( java.util.Date ) value; + } + else if( fieldName.equals( LembretesDataAuto.TRABALHADORES_CONSULTAS_DATAS_ID ) ) + { + trabalhadores_consultas_datas_id = ( Integer ) value; + } + else if( fieldName.equals( LembretesDataAuto.TRABALHADORES_ECDS_DATAS_ID ) ) + { + trabalhadores_ecds_datas_id = ( Integer ) value; + } + else if( fieldName.equals( LembretesDataAuto.DELETED_DATE ) ) + { + deleted_date = ( java.sql.Timestamp ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getTipo_id() + { + return tipo_id; + } + + public void setTipo_id(Integer tipo_idValue ) + { + this.tipo_id = tipo_idValue; + } + + public java.util.Date getData() + { + return data; + } + + public void setData(java.util.Date dataValue ) + { + this.data = dataValue; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public String getTexto() + { + return texto; + } + + public void setTexto(String textoValue ) + { + this.texto = textoValue; + } + + public Integer getEmpresa_id() + { + return empresa_id; + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + this.empresa_id = empresa_idValue; + } + + public Integer getEstabelecimento_id() + { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + this.estabelecimento_id = estabelecimento_idValue; + } + + public Integer getTrabalhador_id() + { + return trabalhador_id; + } + + public void setTrabalhador_id(Integer trabalhador_idValue ) + { + this.trabalhador_id = trabalhador_idValue; + } + + public Integer getMarcacao_estabelecimento_id() + { + return marcacao_estabelecimento_id; + } + + public void setMarcacao_estabelecimento_id(Integer marcacao_estabelecimento_idValue ) + { + this.marcacao_estabelecimento_id = marcacao_estabelecimento_idValue; + } + + public Integer getMarcacao_trabalhador_id() + { + return marcacao_trabalhador_id; + } + + public void setMarcacao_trabalhador_id(Integer marcacao_trabalhador_idValue ) + { + this.marcacao_trabalhador_id = marcacao_trabalhador_idValue; + } + + public String getEnviar_email() + { + return enviar_email; + } + + public void setEnviar_email(String enviar_emailValue ) + { + this.enviar_email = enviar_emailValue; + } + + public Integer getPeriodicidade_dias() + { + return periodicidade_dias; + } + + public void setPeriodicidade_dias(Integer periodicidade_diasValue ) + { + this.periodicidade_dias = periodicidade_diasValue; + } + + public Integer getPeriodicidade_meses() + { + return periodicidade_meses; + } + + public void setPeriodicidade_meses(Integer periodicidade_mesesValue ) + { + this.periodicidade_meses = periodicidade_mesesValue; + } + + public java.util.Date getUltimo_envio() + { + return ultimo_envio; + } + + public void setUltimo_envio(java.util.Date ultimo_envioValue ) + { + this.ultimo_envio = ultimo_envioValue; + } + + public Integer getTrabalhadores_consultas_datas_id() + { + return trabalhadores_consultas_datas_id; + } + + public void setTrabalhadores_consultas_datas_id(Integer trabalhadores_consultas_datas_idValue ) + { + this.trabalhadores_consultas_datas_id = trabalhadores_consultas_datas_idValue; + } + + public Integer getTrabalhadores_ecds_datas_id() + { + return trabalhadores_ecds_datas_id; + } + + public void setTrabalhadores_ecds_datas_id(Integer trabalhadores_ecds_datas_idValue ) + { + this.trabalhadores_ecds_datas_id = trabalhadores_ecds_datas_idValue; + } + + public java.sql.Timestamp getDeleted_date() + { + return deleted_date; + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.deleted_date = deleted_dateValue; + } + + public Class getOuterClass() + { + return LembretesDataAuto.class; + } + + public LembretesDataAuto getOuterClassInstance() + { + LembretesDataAuto outerObj = new LembretesDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/LembretesData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/LembretesData.java new file mode 100644 index 00000000..a04f8810 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/LembretesData.java @@ -0,0 +1,18 @@ +/* +* LembretesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class LembretesData extends com.evolute.siprp.server.db.data.siprp_local3.LembretesDataAuto +{ + + public LembretesData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/LembretesDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/LembretesDataAuto.java new file mode 100644 index 00000000..19dd0dee --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/LembretesDataAuto.java @@ -0,0 +1,673 @@ +/* +* LembretesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class LembretesDataAuto extends JDOObject +{ + + public static final String TABLENAME = "lembretes"; + + public static final String ID = "id"; + public static final String ID_FULL = "lembretes.id"; + public static final String TIPO_ID = "tipo_id"; + public static final String TIPO_ID_FULL = "lembretes.tipo_id"; + public static final String TO_TIPO_ID = "to tipo_id"; + public static final String DATA = "data"; + public static final String DATA_FULL = "lembretes.data"; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "lembretes.descricao"; + public static final String TEXTO = "texto"; + public static final String TEXTO_FULL = "lembretes.texto"; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "lembretes.empresa_id"; + public static final String TO_EMPRESA_ID = "to empresa_id"; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "lembretes.estabelecimento_id"; + public static final String TO_ESTABELECIMENTO_ID = "to estabelecimento_id"; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String TRABALHADOR_ID_FULL = "lembretes.trabalhador_id"; + public static final String TO_TRABALHADOR_ID = "to trabalhador_id"; + public static final String MARCACAO_ESTABELECIMENTO_ID = "marcacao_estabelecimento_id"; + public static final String MARCACAO_ESTABELECIMENTO_ID_FULL = "lembretes.marcacao_estabelecimento_id"; + public static final String TO_MARCACAO_ESTABELECIMENTO_ID = "to marcacao_estabelecimento_id"; + public static final String MARCACAO_TRABALHADOR_ID = "marcacao_trabalhador_id"; + public static final String MARCACAO_TRABALHADOR_ID_FULL = "lembretes.marcacao_trabalhador_id"; + public static final String TO_MARCACAO_TRABALHADOR_ID = "to marcacao_trabalhador_id"; + public static final String ENVIAR_EMAIL = "enviar_email"; + public static final String ENVIAR_EMAIL_FULL = "lembretes.enviar_email"; + public static final String PERIODICIDADE_DIAS = "periodicidade_dias"; + public static final String PERIODICIDADE_DIAS_FULL = "lembretes.periodicidade_dias"; + public static final String PERIODICIDADE_MESES = "periodicidade_meses"; + public static final String PERIODICIDADE_MESES_FULL = "lembretes.periodicidade_meses"; + public static final String ULTIMO_ENVIO = "ultimo_envio"; + public static final String ULTIMO_ENVIO_FULL = "lembretes.ultimo_envio"; + public static final String TRABALHADORES_CONSULTAS_DATAS_ID = "trabalhadores_consultas_datas_id"; + public static final String TRABALHADORES_CONSULTAS_DATAS_ID_FULL = "lembretes.trabalhadores_consultas_datas_id"; + public static final String TO_TRABALHADORES_CONSULTAS_DATAS_ID = "to trabalhadores_consultas_datas_id"; + public static final String TRABALHADORES_ECDS_DATAS_ID = "trabalhadores_ecds_datas_id"; + public static final String TRABALHADORES_ECDS_DATAS_ID_FULL = "lembretes.trabalhadores_ecds_datas_id"; + public static final String TO_TRABALHADORES_ECDS_DATAS_ID = "to trabalhadores_ecds_datas_id"; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "lembretes.deleted_date"; + + public static final String FIELD_NAMES[] = new String[]{ + TIPO_ID, TO_TIPO_ID, DATA, DESCRICAO, TEXTO, EMPRESA_ID, TO_EMPRESA_ID, + ESTABELECIMENTO_ID, TO_ESTABELECIMENTO_ID, TRABALHADOR_ID, TO_TRABALHADOR_ID, + MARCACAO_ESTABELECIMENTO_ID, TO_MARCACAO_ESTABELECIMENTO_ID, + MARCACAO_TRABALHADOR_ID, TO_MARCACAO_TRABALHADOR_ID, ENVIAR_EMAIL, + PERIODICIDADE_DIAS, PERIODICIDADE_MESES, ULTIMO_ENVIO, + TRABALHADORES_CONSULTAS_DATAS_ID, TO_TRABALHADORES_CONSULTAS_DATAS_ID, + TRABALHADORES_ECDS_DATAS_ID, TO_TRABALHADORES_ECDS_DATAS_ID, DELETED_DATE, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TIPO_ID, DATA, DESCRICAO, TEXTO, EMPRESA_ID, ESTABELECIMENTO_ID, TRABALHADOR_ID, + MARCACAO_ESTABELECIMENTO_ID, MARCACAO_TRABALHADOR_ID, ENVIAR_EMAIL, + PERIODICIDADE_DIAS, PERIODICIDADE_MESES, ULTIMO_ENVIO, + TRABALHADORES_CONSULTAS_DATAS_ID, TRABALHADORES_ECDS_DATAS_ID, + DELETED_DATE, }; + + private Map dataHash; + + public LembretesDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getTipo_id() + { + return (Integer) dataHash.get(TIPO_ID); + } + + public void setTipo_id(Integer tipo_idValue ) + { + dataHash.put(TO_TIPO_ID, null); + dataHash.put(TIPO_ID, tipo_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.LembretesTiposData toTipo_id() + throws Exception + { + if( dataHash.get(TO_TIPO_ID) == null && getTipo_id() != null ) + { + dataHash.put(TO_TIPO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.LembretesTiposData.class, new Object[]{ getTipo_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.LembretesTiposData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.LembretesTiposData) dataHash.get(TO_TIPO_ID); + } + + public void setToTipo_id(com.evolute.siprp.server.db.data.siprp_local3.LembretesTiposData tipo_idObject ) + { + if( tipo_idObject == null ) + { + dataHash.put(TIPO_ID, null); + } + else + { + dataHash.put(TIPO_ID, tipo_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.LembretesTiposData.ID )); + } + dataHash.put(TO_TIPO_ID, tipo_idObject); + } + + public java.util.Date getData() + { + return (java.util.Date) get(DATA); + } + + public void setData(java.util.Date dataValue ) + { + this.set(DATA, dataValue ); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + public String getTexto() + { + return (String) get(TEXTO); + } + + public void setTexto(String textoValue ) + { + this.set(TEXTO, textoValue ); + } + + public Integer getEmpresa_id() + { + return (Integer) dataHash.get(EMPRESA_ID); + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + dataHash.put(TO_EMPRESA_ID, null); + dataHash.put(EMPRESA_ID, empresa_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EmpresasData toEmpresa_id() + throws Exception + { + if( dataHash.get(TO_EMPRESA_ID) == null && getEmpresa_id() != null ) + { + dataHash.put(TO_EMPRESA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.class, new Object[]{ getEmpresa_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) dataHash.get(TO_EMPRESA_ID); + } + + public void setToEmpresa_id(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData empresa_idObject ) + { + if( empresa_idObject == null ) + { + dataHash.put(EMPRESA_ID, null); + } + else + { + dataHash.put(EMPRESA_ID, empresa_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + dataHash.put(TO_EMPRESA_ID, empresa_idObject); + } + + public Integer getEstabelecimento_id() + { + return (Integer) dataHash.get(ESTABELECIMENTO_ID); + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, null); + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData toEstabelecimento_id() + throws Exception + { + if( dataHash.get(TO_ESTABELECIMENTO_ID) == null && getEstabelecimento_id() != null ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.class, new Object[]{ getEstabelecimento_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) dataHash.get(TO_ESTABELECIMENTO_ID); + } + + public void setToEstabelecimento_id(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData estabelecimento_idObject ) + { + if( estabelecimento_idObject == null ) + { + dataHash.put(ESTABELECIMENTO_ID, null); + } + else + { + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + dataHash.put(TO_ESTABELECIMENTO_ID, estabelecimento_idObject); + } + + public Integer getTrabalhador_id() + { + return (Integer) dataHash.get(TRABALHADOR_ID); + } + + public void setTrabalhador_id(Integer trabalhador_idValue ) + { + dataHash.put(TO_TRABALHADOR_ID, null); + dataHash.put(TRABALHADOR_ID, trabalhador_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData toTrabalhador_id() + throws Exception + { + if( dataHash.get(TO_TRABALHADOR_ID) == null && getTrabalhador_id() != null ) + { + dataHash.put(TO_TRABALHADOR_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData.class, new Object[]{ getTrabalhador_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData) dataHash.get(TO_TRABALHADOR_ID); + } + + public void setToTrabalhador_id(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData trabalhador_idObject ) + { + if( trabalhador_idObject == null ) + { + dataHash.put(TRABALHADOR_ID, null); + } + else + { + dataHash.put(TRABALHADOR_ID, trabalhador_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData.ID )); + } + dataHash.put(TO_TRABALHADOR_ID, trabalhador_idObject); + } + + public Integer getMarcacao_estabelecimento_id() + { + return (Integer) dataHash.get(MARCACAO_ESTABELECIMENTO_ID); + } + + public void setMarcacao_estabelecimento_id(Integer marcacao_estabelecimento_idValue ) + { + dataHash.put(TO_MARCACAO_ESTABELECIMENTO_ID, null); + dataHash.put(MARCACAO_ESTABELECIMENTO_ID, marcacao_estabelecimento_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEstabelecimentoData toMarcacao_estabelecimento_id() + throws Exception + { + if( dataHash.get(TO_MARCACAO_ESTABELECIMENTO_ID) == null && getMarcacao_estabelecimento_id() != null ) + { + dataHash.put(TO_MARCACAO_ESTABELECIMENTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEstabelecimentoData.class, new Object[]{ getMarcacao_estabelecimento_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEstabelecimentoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEstabelecimentoData) dataHash.get(TO_MARCACAO_ESTABELECIMENTO_ID); + } + + public void setToMarcacao_estabelecimento_id(com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEstabelecimentoData marcacao_estabelecimento_idObject ) + { + if( marcacao_estabelecimento_idObject == null ) + { + dataHash.put(MARCACAO_ESTABELECIMENTO_ID, null); + } + else + { + dataHash.put(MARCACAO_ESTABELECIMENTO_ID, marcacao_estabelecimento_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEstabelecimentoData.ID )); + } + dataHash.put(TO_MARCACAO_ESTABELECIMENTO_ID, marcacao_estabelecimento_idObject); + } + + public Integer getMarcacao_trabalhador_id() + { + return (Integer) dataHash.get(MARCACAO_TRABALHADOR_ID); + } + + public void setMarcacao_trabalhador_id(Integer marcacao_trabalhador_idValue ) + { + dataHash.put(TO_MARCACAO_TRABALHADOR_ID, null); + dataHash.put(MARCACAO_TRABALHADOR_ID, marcacao_trabalhador_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData toMarcacao_trabalhador_id() + throws Exception + { + if( dataHash.get(TO_MARCACAO_TRABALHADOR_ID) == null && getMarcacao_trabalhador_id() != null ) + { + dataHash.put(TO_MARCACAO_TRABALHADOR_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData.class, new Object[]{ getMarcacao_trabalhador_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData) dataHash.get(TO_MARCACAO_TRABALHADOR_ID); + } + + public void setToMarcacao_trabalhador_id(com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData marcacao_trabalhador_idObject ) + { + if( marcacao_trabalhador_idObject == null ) + { + dataHash.put(MARCACAO_TRABALHADOR_ID, null); + } + else + { + dataHash.put(MARCACAO_TRABALHADOR_ID, marcacao_trabalhador_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData.ID )); + } + dataHash.put(TO_MARCACAO_TRABALHADOR_ID, marcacao_trabalhador_idObject); + } + + public String getEnviar_email() + { + return (String) get(ENVIAR_EMAIL); + } + + public void setEnviar_email(String enviar_emailValue ) + { + this.set(ENVIAR_EMAIL, enviar_emailValue ); + } + + public Integer getPeriodicidade_dias() + { + return (Integer) get(PERIODICIDADE_DIAS); + } + + public void setPeriodicidade_dias(Integer periodicidade_diasValue ) + { + this.set(PERIODICIDADE_DIAS, periodicidade_diasValue ); + } + + public Integer getPeriodicidade_meses() + { + return (Integer) get(PERIODICIDADE_MESES); + } + + public void setPeriodicidade_meses(Integer periodicidade_mesesValue ) + { + this.set(PERIODICIDADE_MESES, periodicidade_mesesValue ); + } + + public java.util.Date getUltimo_envio() + { + return (java.util.Date) get(ULTIMO_ENVIO); + } + + public void setUltimo_envio(java.util.Date ultimo_envioValue ) + { + this.set(ULTIMO_ENVIO, ultimo_envioValue ); + } + + public Integer getTrabalhadores_consultas_datas_id() + { + return (Integer) dataHash.get(TRABALHADORES_CONSULTAS_DATAS_ID); + } + + public void setTrabalhadores_consultas_datas_id(Integer trabalhadores_consultas_datas_idValue ) + { + dataHash.put(TO_TRABALHADORES_CONSULTAS_DATAS_ID, null); + dataHash.put(TRABALHADORES_CONSULTAS_DATAS_ID, trabalhadores_consultas_datas_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData toTrabalhadores_consultas_datas_id() + throws Exception + { + if( dataHash.get(TO_TRABALHADORES_CONSULTAS_DATAS_ID) == null && getTrabalhadores_consultas_datas_id() != null ) + { + dataHash.put(TO_TRABALHADORES_CONSULTAS_DATAS_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData.class, new Object[]{ getTrabalhadores_consultas_datas_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData) dataHash.get(TO_TRABALHADORES_CONSULTAS_DATAS_ID); + } + + public void setToTrabalhadores_consultas_datas_id(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData trabalhadores_consultas_datas_idObject ) + { + if( trabalhadores_consultas_datas_idObject == null ) + { + dataHash.put(TRABALHADORES_CONSULTAS_DATAS_ID, null); + } + else + { + dataHash.put(TRABALHADORES_CONSULTAS_DATAS_ID, trabalhadores_consultas_datas_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData.ID )); + } + dataHash.put(TO_TRABALHADORES_CONSULTAS_DATAS_ID, trabalhadores_consultas_datas_idObject); + } + + public Integer getTrabalhadores_ecds_datas_id() + { + return (Integer) dataHash.get(TRABALHADORES_ECDS_DATAS_ID); + } + + public void setTrabalhadores_ecds_datas_id(Integer trabalhadores_ecds_datas_idValue ) + { + dataHash.put(TO_TRABALHADORES_ECDS_DATAS_ID, null); + dataHash.put(TRABALHADORES_ECDS_DATAS_ID, trabalhadores_ecds_datas_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData toTrabalhadores_ecds_datas_id() + throws Exception + { + if( dataHash.get(TO_TRABALHADORES_ECDS_DATAS_ID) == null && getTrabalhadores_ecds_datas_id() != null ) + { + dataHash.put(TO_TRABALHADORES_ECDS_DATAS_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData.class, new Object[]{ getTrabalhadores_ecds_datas_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData) dataHash.get(TO_TRABALHADORES_ECDS_DATAS_ID); + } + + public void setToTrabalhadores_ecds_datas_id(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData trabalhadores_ecds_datas_idObject ) + { + if( trabalhadores_ecds_datas_idObject == null ) + { + dataHash.put(TRABALHADORES_ECDS_DATAS_ID, null); + } + else + { + dataHash.put(TRABALHADORES_ECDS_DATAS_ID, trabalhadores_ecds_datas_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData.ID )); + } + dataHash.put(TO_TRABALHADORES_ECDS_DATAS_ID, trabalhadores_ecds_datas_idObject); + } + + public java.sql.Timestamp getDeleted_date() + { + return (java.sql.Timestamp) get(DELETED_DATE); + } + + public void setDeleted_date(java.sql.Timestamp deleted_dateValue ) + { + this.set(DELETED_DATE, deleted_dateValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_TRABALHADORES_ECDS_DATAS_ID.equals( fieldName ) ) + { + value = toTrabalhadores_ecds_datas_id(); + } + else if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = getEstabelecimento_id(); + } + else if( TIPO_ID.equals( fieldName ) ) + { + value = getTipo_id(); + } + else if( TRABALHADORES_ECDS_DATAS_ID.equals( fieldName ) ) + { + value = getTrabalhadores_ecds_datas_id(); + } + else if( TO_TRABALHADORES_CONSULTAS_DATAS_ID.equals( fieldName ) ) + { + value = toTrabalhadores_consultas_datas_id(); + } + else if( TO_TRABALHADOR_ID.equals( fieldName ) ) + { + value = toTrabalhador_id(); + } + else if( MARCACAO_TRABALHADOR_ID.equals( fieldName ) ) + { + value = getMarcacao_trabalhador_id(); + } + else if( TRABALHADORES_CONSULTAS_DATAS_ID.equals( fieldName ) ) + { + value = getTrabalhadores_consultas_datas_id(); + } + else if( TO_EMPRESA_ID.equals( fieldName ) ) + { + value = toEmpresa_id(); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + value = getEmpresa_id(); + } + else if( TO_MARCACAO_TRABALHADOR_ID.equals( fieldName ) ) + { + value = toMarcacao_trabalhador_id(); + } + else if( TO_MARCACAO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = toMarcacao_estabelecimento_id(); + } + else if( TRABALHADOR_ID.equals( fieldName ) ) + { + value = getTrabalhador_id(); + } + else if( MARCACAO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = getMarcacao_estabelecimento_id(); + } + else if( TO_TIPO_ID.equals( fieldName ) ) + { + value = toTipo_id(); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = toEstabelecimento_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_TRABALHADORES_ECDS_DATAS_ID.equals( fieldName ) ) + { + setToTrabalhadores_ecds_datas_id( (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData) value ); + } + else if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setEstabelecimento_id( (Integer) value ); + } + else if( TIPO_ID.equals( fieldName ) ) + { + setTipo_id( (Integer) value ); + } + else if( TRABALHADORES_ECDS_DATAS_ID.equals( fieldName ) ) + { + setTrabalhadores_ecds_datas_id( (Integer) value ); + } + else if( TO_TRABALHADORES_CONSULTAS_DATAS_ID.equals( fieldName ) ) + { + setToTrabalhadores_consultas_datas_id( (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData) value ); + } + else if( TO_TRABALHADOR_ID.equals( fieldName ) ) + { + setToTrabalhador_id( (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData) value ); + } + else if( MARCACAO_TRABALHADOR_ID.equals( fieldName ) ) + { + setMarcacao_trabalhador_id( (Integer) value ); + } + else if( TRABALHADORES_CONSULTAS_DATAS_ID.equals( fieldName ) ) + { + setTrabalhadores_consultas_datas_id( (Integer) value ); + } + else if( TO_EMPRESA_ID.equals( fieldName ) ) + { + setToEmpresa_id( (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) value ); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + setEmpresa_id( (Integer) value ); + } + else if( TO_MARCACAO_TRABALHADOR_ID.equals( fieldName ) ) + { + setToMarcacao_trabalhador_id( (com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData) value ); + } + else if( TO_MARCACAO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setToMarcacao_estabelecimento_id( (com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEstabelecimentoData) value ); + } + else if( TRABALHADOR_ID.equals( fieldName ) ) + { + setTrabalhador_id( (Integer) value ); + } + else if( MARCACAO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setMarcacao_estabelecimento_id( (Integer) value ); + } + else if( TO_TIPO_ID.equals( fieldName ) ) + { + setToTipo_id( (com.evolute.siprp.server.db.data.siprp_local3.LembretesTiposData) value ); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setToEstabelecimento_id( (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_TIPO_ID) != null ) + { + toTipo_id().save(); + dataHash.put(TIPO_ID, toTipo_id().get( com.evolute.siprp.server.db.data.siprp_local3.LembretesTiposData.ID )); + } + + if( dataHash.get(TO_EMPRESA_ID) != null ) + { + toEmpresa_id().save(); + dataHash.put(EMPRESA_ID, toEmpresa_id().get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + + if( dataHash.get(TO_ESTABELECIMENTO_ID) != null ) + { + toEstabelecimento_id().save(); + dataHash.put(ESTABELECIMENTO_ID, toEstabelecimento_id().get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + + if( dataHash.get(TO_TRABALHADOR_ID) != null ) + { + toTrabalhador_id().save(); + dataHash.put(TRABALHADOR_ID, toTrabalhador_id().get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData.ID )); + } + + if( dataHash.get(TO_MARCACAO_ESTABELECIMENTO_ID) != null ) + { + toMarcacao_estabelecimento_id().save(); + dataHash.put(MARCACAO_ESTABELECIMENTO_ID, toMarcacao_estabelecimento_id().get( com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEstabelecimentoData.ID )); + } + + if( dataHash.get(TO_MARCACAO_TRABALHADOR_ID) != null ) + { + toMarcacao_trabalhador_id().save(); + dataHash.put(MARCACAO_TRABALHADOR_ID, toMarcacao_trabalhador_id().get( com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData.ID )); + } + + if( dataHash.get(TO_TRABALHADORES_CONSULTAS_DATAS_ID) != null ) + { + toTrabalhadores_consultas_datas_id().save(); + dataHash.put(TRABALHADORES_CONSULTAS_DATAS_ID, toTrabalhadores_consultas_datas_id().get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData.ID )); + } + + if( dataHash.get(TO_TRABALHADORES_ECDS_DATAS_ID) != null ) + { + toTrabalhadores_ecds_datas_id().save(); + dataHash.put(TRABALHADORES_ECDS_DATAS_ID, toTrabalhadores_ecds_datas_id().get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Lembretes.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/LembretesTipos.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/LembretesTipos.java new file mode 100644 index 00000000..a01af137 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/LembretesTipos.java @@ -0,0 +1,183 @@ +/* +* LembretesTipos.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class LembretesTipos implements JDOInnerObject +{ + private Integer id; + private String codigo; + private String descricao; + private Integer ordem; + private String activo; + + public LembretesTipos() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == LembretesTiposDataAuto.ID ) + { + return id; + } + else if( fieldName == LembretesTiposDataAuto.CODIGO ) + { + return codigo; + } + else if( fieldName == LembretesTiposDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName == LembretesTiposDataAuto.ORDEM ) + { + return ordem; + } + else if( fieldName == LembretesTiposDataAuto.ACTIVO ) + { + return activo; + } + else if( fieldName.equals( LembretesTiposDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( LembretesTiposDataAuto.CODIGO ) ) + { + return codigo; + } + else if( fieldName.equals( LembretesTiposDataAuto.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( LembretesTiposDataAuto.ORDEM ) ) + { + return ordem; + } + else if( fieldName.equals( LembretesTiposDataAuto.ACTIVO ) ) + { + return activo; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == LembretesTiposDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == LembretesTiposDataAuto.CODIGO ) + { + codigo = ( String ) value; + } + else if( fieldName == LembretesTiposDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == LembretesTiposDataAuto.ORDEM ) + { + ordem = ( Integer ) value; + } + else if( fieldName == LembretesTiposDataAuto.ACTIVO ) + { + activo = ( String ) value; + } + else if( fieldName.equals( LembretesTiposDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( LembretesTiposDataAuto.CODIGO ) ) + { + codigo = ( String ) value; + } + else if( fieldName.equals( LembretesTiposDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( LembretesTiposDataAuto.ORDEM ) ) + { + ordem = ( Integer ) value; + } + else if( fieldName.equals( LembretesTiposDataAuto.ACTIVO ) ) + { + activo = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getCodigo() + { + return codigo; + } + + public void setCodigo(String codigoValue ) + { + this.codigo = codigoValue; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public Integer getOrdem() + { + return ordem; + } + + public void setOrdem(Integer ordemValue ) + { + this.ordem = ordemValue; + } + + public String getActivo() + { + return activo; + } + + public void setActivo(String activoValue ) + { + this.activo = activoValue; + } + + public Class getOuterClass() + { + return LembretesTiposDataAuto.class; + } + + public LembretesTiposDataAuto getOuterClassInstance() + { + LembretesTiposDataAuto outerObj = new LembretesTiposDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/LembretesTiposData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/LembretesTiposData.java new file mode 100644 index 00000000..50ed5bdc --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/LembretesTiposData.java @@ -0,0 +1,18 @@ +/* +* LembretesTiposDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class LembretesTiposData extends com.evolute.siprp.server.db.data.siprp_local3.LembretesTiposDataAuto +{ + + public LembretesTiposData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/LembretesTiposDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/LembretesTiposDataAuto.java new file mode 100644 index 00000000..7b108ea2 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/LembretesTiposDataAuto.java @@ -0,0 +1,131 @@ +/* +* LembretesTiposDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class LembretesTiposDataAuto extends JDOObject +{ + + public static final String TABLENAME = "lembretes_tipos"; + + public static final String ID = "id"; + public static final String ID_FULL = "lembretes_tipos.id"; + public static final String CODIGO = "codigo"; + public static final String CODIGO_FULL = "lembretes_tipos.codigo"; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "lembretes_tipos.descricao"; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "lembretes_tipos.ordem"; + public static final String ACTIVO = "activo"; + public static final String ACTIVO_FULL = "lembretes_tipos.activo"; + + public static final String FIELD_NAMES[] = new String[]{ + CODIGO, DESCRICAO, ORDEM, ACTIVO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, CODIGO, DESCRICAO, ORDEM, ACTIVO, }; + + private Map dataHash; + + public LembretesTiposDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getCodigo() + { + return (String) get(CODIGO); + } + + public void setCodigo(String codigoValue ) + { + this.set(CODIGO, codigoValue ); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + public Integer getOrdem() + { + return (Integer) get(ORDEM); + } + + public void setOrdem(Integer ordemValue ) + { + this.set(ORDEM, ordemValue ); + } + + public String getActivo() + { + return (String) get(ACTIVO); + } + + public void setActivo(String activoValue ) + { + this.set(ACTIVO, activoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return LembretesTipos.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEmpresa.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEmpresa.java new file mode 100644 index 00000000..36ef106b --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEmpresa.java @@ -0,0 +1,183 @@ +/* +* MarcacoesEmpresa.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class MarcacoesEmpresa implements JDOInnerObject +{ + private Integer id; + private java.util.Date data; + private String texto; + private Integer empresa_id; + private String realizada; + + public MarcacoesEmpresa() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == MarcacoesEmpresaDataAuto.ID ) + { + return id; + } + else if( fieldName == MarcacoesEmpresaDataAuto.DATA ) + { + return data; + } + else if( fieldName == MarcacoesEmpresaDataAuto.TEXTO ) + { + return texto; + } + else if( fieldName == MarcacoesEmpresaDataAuto.EMPRESA_ID ) + { + return empresa_id; + } + else if( fieldName == MarcacoesEmpresaDataAuto.REALIZADA ) + { + return realizada; + } + else if( fieldName.equals( MarcacoesEmpresaDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( MarcacoesEmpresaDataAuto.DATA ) ) + { + return data; + } + else if( fieldName.equals( MarcacoesEmpresaDataAuto.TEXTO ) ) + { + return texto; + } + else if( fieldName.equals( MarcacoesEmpresaDataAuto.EMPRESA_ID ) ) + { + return empresa_id; + } + else if( fieldName.equals( MarcacoesEmpresaDataAuto.REALIZADA ) ) + { + return realizada; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == MarcacoesEmpresaDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == MarcacoesEmpresaDataAuto.DATA ) + { + data = ( java.util.Date ) value; + } + else if( fieldName == MarcacoesEmpresaDataAuto.TEXTO ) + { + texto = ( String ) value; + } + else if( fieldName == MarcacoesEmpresaDataAuto.EMPRESA_ID ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName == MarcacoesEmpresaDataAuto.REALIZADA ) + { + realizada = ( String ) value; + } + else if( fieldName.equals( MarcacoesEmpresaDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesEmpresaDataAuto.DATA ) ) + { + data = ( java.util.Date ) value; + } + else if( fieldName.equals( MarcacoesEmpresaDataAuto.TEXTO ) ) + { + texto = ( String ) value; + } + else if( fieldName.equals( MarcacoesEmpresaDataAuto.EMPRESA_ID ) ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesEmpresaDataAuto.REALIZADA ) ) + { + realizada = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public java.util.Date getData() + { + return data; + } + + public void setData(java.util.Date dataValue ) + { + this.data = dataValue; + } + + public String getTexto() + { + return texto; + } + + public void setTexto(String textoValue ) + { + this.texto = textoValue; + } + + public Integer getEmpresa_id() + { + return empresa_id; + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + this.empresa_id = empresa_idValue; + } + + public String getRealizada() + { + return realizada; + } + + public void setRealizada(String realizadaValue ) + { + this.realizada = realizadaValue; + } + + public Class getOuterClass() + { + return MarcacoesEmpresaDataAuto.class; + } + + public MarcacoesEmpresaDataAuto getOuterClassInstance() + { + MarcacoesEmpresaDataAuto outerObj = new MarcacoesEmpresaDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEmpresaData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEmpresaData.java new file mode 100644 index 00000000..b2baef71 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEmpresaData.java @@ -0,0 +1,18 @@ +/* +* MarcacoesEmpresaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class MarcacoesEmpresaData extends com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEmpresaDataAuto +{ + + public MarcacoesEmpresaData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEmpresaDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEmpresaDataAuto.java new file mode 100644 index 00000000..4f42d349 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEmpresaDataAuto.java @@ -0,0 +1,190 @@ +/* +* MarcacoesEmpresaDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class MarcacoesEmpresaDataAuto extends JDOObject +{ + + public static final String TABLENAME = "marcacoes_empresa"; + + public static final String ID = "id"; + public static final String ID_FULL = "marcacoes_empresa.id"; + public static final String DATA = "data"; + public static final String DATA_FULL = "marcacoes_empresa.data"; + public static final String TEXTO = "texto"; + public static final String TEXTO_FULL = "marcacoes_empresa.texto"; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "marcacoes_empresa.empresa_id"; + public static final String TO_EMPRESA_ID = "to empresa_id"; + public static final String REALIZADA = "realizada"; + public static final String REALIZADA_FULL = "marcacoes_empresa.realizada"; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, TEXTO, EMPRESA_ID, TO_EMPRESA_ID, REALIZADA, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATA, TEXTO, EMPRESA_ID, REALIZADA, }; + + private Map dataHash; + + public MarcacoesEmpresaDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public java.util.Date getData() + { + return (java.util.Date) get(DATA); + } + + public void setData(java.util.Date dataValue ) + { + this.set(DATA, dataValue ); + } + + public String getTexto() + { + return (String) get(TEXTO); + } + + public void setTexto(String textoValue ) + { + this.set(TEXTO, textoValue ); + } + + public Integer getEmpresa_id() + { + return (Integer) dataHash.get(EMPRESA_ID); + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + dataHash.put(TO_EMPRESA_ID, null); + dataHash.put(EMPRESA_ID, empresa_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EmpresasData toEmpresa_id() + throws Exception + { + if( dataHash.get(TO_EMPRESA_ID) == null && getEmpresa_id() != null ) + { + dataHash.put(TO_EMPRESA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.class, new Object[]{ getEmpresa_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) dataHash.get(TO_EMPRESA_ID); + } + + public void setToEmpresa_id(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData empresa_idObject ) + { + if( empresa_idObject == null ) + { + dataHash.put(EMPRESA_ID, null); + } + else + { + dataHash.put(EMPRESA_ID, empresa_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + dataHash.put(TO_EMPRESA_ID, empresa_idObject); + } + + public String getRealizada() + { + return (String) get(REALIZADA); + } + + public void setRealizada(String realizadaValue ) + { + this.set(REALIZADA, realizadaValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_EMPRESA_ID.equals( fieldName ) ) + { + value = toEmpresa_id(); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + value = getEmpresa_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_EMPRESA_ID.equals( fieldName ) ) + { + setToEmpresa_id( (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) value ); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + setEmpresa_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_EMPRESA_ID) != null ) + { + toEmpresa_id().save(); + dataHash.put(EMPRESA_ID, toEmpresa_id().get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return MarcacoesEmpresa.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEstabelecimento.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEstabelecimento.java new file mode 100644 index 00000000..c5a6ff54 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEstabelecimento.java @@ -0,0 +1,291 @@ +/* +* MarcacoesEstabelecimento.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class MarcacoesEstabelecimento implements JDOInnerObject +{ + private Integer id; + private java.util.Date data; + private String realizada; + private java.util.Date data_email; + private java.util.Date data_relatorio; + private Integer estabelecimento_id; + private Integer estado; + private Integer tecnico_hst; + private String observacoes; + + public MarcacoesEstabelecimento() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == MarcacoesEstabelecimentoDataAuto.ID ) + { + return id; + } + else if( fieldName == MarcacoesEstabelecimentoDataAuto.DATA ) + { + return data; + } + else if( fieldName == MarcacoesEstabelecimentoDataAuto.REALIZADA ) + { + return realizada; + } + else if( fieldName == MarcacoesEstabelecimentoDataAuto.DATA_EMAIL ) + { + return data_email; + } + else if( fieldName == MarcacoesEstabelecimentoDataAuto.DATA_RELATORIO ) + { + return data_relatorio; + } + else if( fieldName == MarcacoesEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) + { + return estabelecimento_id; + } + else if( fieldName == MarcacoesEstabelecimentoDataAuto.ESTADO ) + { + return estado; + } + else if( fieldName == MarcacoesEstabelecimentoDataAuto.TECNICO_HST ) + { + return tecnico_hst; + } + else if( fieldName == MarcacoesEstabelecimentoDataAuto.OBSERVACOES ) + { + return observacoes; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.DATA ) ) + { + return data; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.REALIZADA ) ) + { + return realizada; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.DATA_EMAIL ) ) + { + return data_email; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.DATA_RELATORIO ) ) + { + return data_relatorio; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) ) + { + return estabelecimento_id; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.ESTADO ) ) + { + return estado; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.TECNICO_HST ) ) + { + return tecnico_hst; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.OBSERVACOES ) ) + { + return observacoes; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == MarcacoesEstabelecimentoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == MarcacoesEstabelecimentoDataAuto.DATA ) + { + data = ( java.util.Date ) value; + } + else if( fieldName == MarcacoesEstabelecimentoDataAuto.REALIZADA ) + { + realizada = ( String ) value; + } + else if( fieldName == MarcacoesEstabelecimentoDataAuto.DATA_EMAIL ) + { + data_email = ( java.util.Date ) value; + } + else if( fieldName == MarcacoesEstabelecimentoDataAuto.DATA_RELATORIO ) + { + data_relatorio = ( java.util.Date ) value; + } + else if( fieldName == MarcacoesEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName == MarcacoesEstabelecimentoDataAuto.ESTADO ) + { + estado = ( Integer ) value; + } + else if( fieldName == MarcacoesEstabelecimentoDataAuto.TECNICO_HST ) + { + tecnico_hst = ( Integer ) value; + } + else if( fieldName == MarcacoesEstabelecimentoDataAuto.OBSERVACOES ) + { + observacoes = ( String ) value; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.DATA ) ) + { + data = ( java.util.Date ) value; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.REALIZADA ) ) + { + realizada = ( String ) value; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.DATA_EMAIL ) ) + { + data_email = ( java.util.Date ) value; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.DATA_RELATORIO ) ) + { + data_relatorio = ( java.util.Date ) value; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.ESTABELECIMENTO_ID ) ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.ESTADO ) ) + { + estado = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.TECNICO_HST ) ) + { + tecnico_hst = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesEstabelecimentoDataAuto.OBSERVACOES ) ) + { + observacoes = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public java.util.Date getData() + { + return data; + } + + public void setData(java.util.Date dataValue ) + { + this.data = dataValue; + } + + public String getRealizada() + { + return realizada; + } + + public void setRealizada(String realizadaValue ) + { + this.realizada = realizadaValue; + } + + public java.util.Date getData_email() + { + return data_email; + } + + public void setData_email(java.util.Date data_emailValue ) + { + this.data_email = data_emailValue; + } + + public java.util.Date getData_relatorio() + { + return data_relatorio; + } + + public void setData_relatorio(java.util.Date data_relatorioValue ) + { + this.data_relatorio = data_relatorioValue; + } + + public Integer getEstabelecimento_id() + { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + this.estabelecimento_id = estabelecimento_idValue; + } + + public Integer getEstado() + { + return estado; + } + + public void setEstado(Integer estadoValue ) + { + this.estado = estadoValue; + } + + public Integer getTecnico_hst() + { + return tecnico_hst; + } + + public void setTecnico_hst(Integer tecnico_hstValue ) + { + this.tecnico_hst = tecnico_hstValue; + } + + public String getObservacoes() + { + return observacoes; + } + + public void setObservacoes(String observacoesValue ) + { + this.observacoes = observacoesValue; + } + + public Class getOuterClass() + { + return MarcacoesEstabelecimentoDataAuto.class; + } + + public MarcacoesEstabelecimentoDataAuto getOuterClassInstance() + { + MarcacoesEstabelecimentoDataAuto outerObj = new MarcacoesEstabelecimentoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEstabelecimentoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEstabelecimentoData.java new file mode 100644 index 00000000..a9adc304 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEstabelecimentoData.java @@ -0,0 +1,18 @@ +/* +* MarcacoesEstabelecimentoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class MarcacoesEstabelecimentoData extends com.evolute.siprp.server.db.data.siprp_local3.MarcacoesEstabelecimentoDataAuto +{ + + public MarcacoesEstabelecimentoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEstabelecimentoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEstabelecimentoDataAuto.java new file mode 100644 index 00000000..e98ecbe7 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesEstabelecimentoDataAuto.java @@ -0,0 +1,287 @@ +/* +* MarcacoesEstabelecimentoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class MarcacoesEstabelecimentoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "marcacoes_estabelecimento"; + + public static final String ID = "id"; + public static final String ID_FULL = "marcacoes_estabelecimento.id"; + public static final String DATA = "data"; + public static final String DATA_FULL = "marcacoes_estabelecimento.data"; + public static final String REALIZADA = "realizada"; + public static final String REALIZADA_FULL = "marcacoes_estabelecimento.realizada"; + public static final String DATA_EMAIL = "data_email"; + public static final String DATA_EMAIL_FULL = "marcacoes_estabelecimento.data_email"; + public static final String DATA_RELATORIO = "data_relatorio"; + public static final String DATA_RELATORIO_FULL = "marcacoes_estabelecimento.data_relatorio"; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "marcacoes_estabelecimento.estabelecimento_id"; + public static final String TO_ESTABELECIMENTO_ID = "to estabelecimento_id"; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "marcacoes_estabelecimento.estado"; + public static final String TECNICO_HST = "tecnico_hst"; + public static final String TECNICO_HST_FULL = "marcacoes_estabelecimento.tecnico_hst"; + public static final String TO_TECNICO_HST = "to tecnico_hst"; + public static final String OBSERVACOES = "observacoes"; + public static final String OBSERVACOES_FULL = "marcacoes_estabelecimento.observacoes"; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, REALIZADA, DATA_EMAIL, DATA_RELATORIO, ESTABELECIMENTO_ID, + TO_ESTABELECIMENTO_ID, ESTADO, TECNICO_HST, TO_TECNICO_HST, OBSERVACOES, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATA, REALIZADA, DATA_EMAIL, DATA_RELATORIO, ESTABELECIMENTO_ID, ESTADO, + TECNICO_HST, OBSERVACOES, }; + + private Map dataHash; + + public MarcacoesEstabelecimentoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public java.util.Date getData() + { + return (java.util.Date) get(DATA); + } + + public void setData(java.util.Date dataValue ) + { + this.set(DATA, dataValue ); + } + + public String getRealizada() + { + return (String) get(REALIZADA); + } + + public void setRealizada(String realizadaValue ) + { + this.set(REALIZADA, realizadaValue ); + } + + public java.util.Date getData_email() + { + return (java.util.Date) get(DATA_EMAIL); + } + + public void setData_email(java.util.Date data_emailValue ) + { + this.set(DATA_EMAIL, data_emailValue ); + } + + public java.util.Date getData_relatorio() + { + return (java.util.Date) get(DATA_RELATORIO); + } + + public void setData_relatorio(java.util.Date data_relatorioValue ) + { + this.set(DATA_RELATORIO, data_relatorioValue ); + } + + public Integer getEstabelecimento_id() + { + return (Integer) dataHash.get(ESTABELECIMENTO_ID); + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, null); + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData toEstabelecimento_id() + throws Exception + { + if( dataHash.get(TO_ESTABELECIMENTO_ID) == null && getEstabelecimento_id() != null ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.class, new Object[]{ getEstabelecimento_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) dataHash.get(TO_ESTABELECIMENTO_ID); + } + + public void setToEstabelecimento_id(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData estabelecimento_idObject ) + { + if( estabelecimento_idObject == null ) + { + dataHash.put(ESTABELECIMENTO_ID, null); + } + else + { + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + dataHash.put(TO_ESTABELECIMENTO_ID, estabelecimento_idObject); + } + + public Integer getEstado() + { + return (Integer) get(ESTADO); + } + + public void setEstado(Integer estadoValue ) + { + this.set(ESTADO, estadoValue ); + } + + public Integer getTecnico_hst() + { + return (Integer) dataHash.get(TECNICO_HST); + } + + public void setTecnico_hst(Integer tecnico_hstValue ) + { + dataHash.put(TO_TECNICO_HST, null); + dataHash.put(TECNICO_HST, tecnico_hstValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTecnicosHstData toTecnico_hst() + throws Exception + { + if( dataHash.get(TO_TECNICO_HST) == null && getTecnico_hst() != null ) + { + dataHash.put(TO_TECNICO_HST, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTecnicosHstData.class, new Object[]{ getTecnico_hst() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTecnicosHstData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTecnicosHstData) dataHash.get(TO_TECNICO_HST); + } + + public void setToTecnico_hst(com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTecnicosHstData tecnico_hstObject ) + { + if( tecnico_hstObject == null ) + { + dataHash.put(TECNICO_HST, null); + } + else + { + dataHash.put(TECNICO_HST, tecnico_hstObject.get( com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTecnicosHstData.ID )); + } + dataHash.put(TO_TECNICO_HST, tecnico_hstObject); + } + + public String getObservacoes() + { + return (String) get(OBSERVACOES); + } + + public void setObservacoes(String observacoesValue ) + { + this.set(OBSERVACOES, observacoesValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_TECNICO_HST.equals( fieldName ) ) + { + value = toTecnico_hst(); + } + else if( TECNICO_HST.equals( fieldName ) ) + { + value = getTecnico_hst(); + } + else if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = getEstabelecimento_id(); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = toEstabelecimento_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_TECNICO_HST.equals( fieldName ) ) + { + setToTecnico_hst( (com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTecnicosHstData) value ); + } + else if( TECNICO_HST.equals( fieldName ) ) + { + setTecnico_hst( (Integer) value ); + } + else if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setEstabelecimento_id( (Integer) value ); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setToEstabelecimento_id( (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_ESTABELECIMENTO_ID) != null ) + { + toEstabelecimento_id().save(); + dataHash.put(ESTABELECIMENTO_ID, toEstabelecimento_id().get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + + if( dataHash.get(TO_TECNICO_HST) != null ) + { + toTecnico_hst().save(); + dataHash.put(TECNICO_HST, toTecnico_hst().get( com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTecnicosHstData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return MarcacoesEstabelecimento.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesGruposRealizados.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesGruposRealizados.java new file mode 100644 index 00000000..45f62a1d --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesGruposRealizados.java @@ -0,0 +1,156 @@ +/* +* MarcacoesGruposRealizados.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class MarcacoesGruposRealizados implements JDOInnerObject +{ + private Integer id; + private Integer marcacao_trabalhador_id; + private Integer grupo_protocolo_id; + private Integer marcacoes_trabalhador_estado_id; + + public MarcacoesGruposRealizados() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == MarcacoesGruposRealizadosDataAuto.ID ) + { + return id; + } + else if( fieldName == MarcacoesGruposRealizadosDataAuto.MARCACAO_TRABALHADOR_ID ) + { + return marcacao_trabalhador_id; + } + else if( fieldName == MarcacoesGruposRealizadosDataAuto.GRUPO_PROTOCOLO_ID ) + { + return grupo_protocolo_id; + } + else if( fieldName == MarcacoesGruposRealizadosDataAuto.MARCACOES_TRABALHADOR_ESTADO_ID ) + { + return marcacoes_trabalhador_estado_id; + } + else if( fieldName.equals( MarcacoesGruposRealizadosDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( MarcacoesGruposRealizadosDataAuto.MARCACAO_TRABALHADOR_ID ) ) + { + return marcacao_trabalhador_id; + } + else if( fieldName.equals( MarcacoesGruposRealizadosDataAuto.GRUPO_PROTOCOLO_ID ) ) + { + return grupo_protocolo_id; + } + else if( fieldName.equals( MarcacoesGruposRealizadosDataAuto.MARCACOES_TRABALHADOR_ESTADO_ID ) ) + { + return marcacoes_trabalhador_estado_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == MarcacoesGruposRealizadosDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == MarcacoesGruposRealizadosDataAuto.MARCACAO_TRABALHADOR_ID ) + { + marcacao_trabalhador_id = ( Integer ) value; + } + else if( fieldName == MarcacoesGruposRealizadosDataAuto.GRUPO_PROTOCOLO_ID ) + { + grupo_protocolo_id = ( Integer ) value; + } + else if( fieldName == MarcacoesGruposRealizadosDataAuto.MARCACOES_TRABALHADOR_ESTADO_ID ) + { + marcacoes_trabalhador_estado_id = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesGruposRealizadosDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesGruposRealizadosDataAuto.MARCACAO_TRABALHADOR_ID ) ) + { + marcacao_trabalhador_id = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesGruposRealizadosDataAuto.GRUPO_PROTOCOLO_ID ) ) + { + grupo_protocolo_id = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesGruposRealizadosDataAuto.MARCACOES_TRABALHADOR_ESTADO_ID ) ) + { + marcacoes_trabalhador_estado_id = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getMarcacao_trabalhador_id() + { + return marcacao_trabalhador_id; + } + + public void setMarcacao_trabalhador_id(Integer marcacao_trabalhador_idValue ) + { + this.marcacao_trabalhador_id = marcacao_trabalhador_idValue; + } + + public Integer getGrupo_protocolo_id() + { + return grupo_protocolo_id; + } + + public void setGrupo_protocolo_id(Integer grupo_protocolo_idValue ) + { + this.grupo_protocolo_id = grupo_protocolo_idValue; + } + + public Integer getMarcacoes_trabalhador_estado_id() + { + return marcacoes_trabalhador_estado_id; + } + + public void setMarcacoes_trabalhador_estado_id(Integer marcacoes_trabalhador_estado_idValue ) + { + this.marcacoes_trabalhador_estado_id = marcacoes_trabalhador_estado_idValue; + } + + public Class getOuterClass() + { + return MarcacoesGruposRealizadosDataAuto.class; + } + + public MarcacoesGruposRealizadosDataAuto getOuterClassInstance() + { + MarcacoesGruposRealizadosDataAuto outerObj = new MarcacoesGruposRealizadosDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesGruposRealizadosData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesGruposRealizadosData.java new file mode 100644 index 00000000..7c605aed --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesGruposRealizadosData.java @@ -0,0 +1,18 @@ +/* +* MarcacoesGruposRealizadosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class MarcacoesGruposRealizadosData extends com.evolute.siprp.server.db.data.siprp_local3.MarcacoesGruposRealizadosDataAuto +{ + + public MarcacoesGruposRealizadosData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesGruposRealizadosDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesGruposRealizadosDataAuto.java new file mode 100644 index 00000000..2c0dd934 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesGruposRealizadosDataAuto.java @@ -0,0 +1,275 @@ +/* +* MarcacoesGruposRealizadosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class MarcacoesGruposRealizadosDataAuto extends JDOObject +{ + + public static final String TABLENAME = "marcacoes_grupos_realizados"; + + public static final String ID = "id"; + public static final String ID_FULL = "marcacoes_grupos_realizados.id"; + public static final String MARCACAO_TRABALHADOR_ID = "marcacao_trabalhador_id"; + public static final String MARCACAO_TRABALHADOR_ID_FULL = "marcacoes_grupos_realizados.marcacao_trabalhador_id"; + public static final String TO_MARCACAO_TRABALHADOR_ID = "to marcacao_trabalhador_id"; + public static final String GRUPO_PROTOCOLO_ID = "grupo_protocolo_id"; + public static final String GRUPO_PROTOCOLO_ID_FULL = "marcacoes_grupos_realizados.grupo_protocolo_id"; + public static final String TO_GRUPO_PROTOCOLO_ID = "to grupo_protocolo_id"; + public static final String MARCACOES_TRABALHADOR_ESTADO_ID = "marcacoes_trabalhador_estado_id"; + public static final String MARCACOES_TRABALHADOR_ESTADO_ID_FULL = "marcacoes_grupos_realizados.marcacoes_trabalhador_estado_id"; + public static final String TO_MARCACOES_TRABALHADOR_ESTADO_ID = "to marcacoes_trabalhador_estado_id"; + + public static final String FIELD_NAMES[] = new String[]{ + MARCACAO_TRABALHADOR_ID, TO_MARCACAO_TRABALHADOR_ID, GRUPO_PROTOCOLO_ID, + TO_GRUPO_PROTOCOLO_ID, MARCACOES_TRABALHADOR_ESTADO_ID, + TO_MARCACOES_TRABALHADOR_ESTADO_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, MARCACAO_TRABALHADOR_ID, GRUPO_PROTOCOLO_ID, + MARCACOES_TRABALHADOR_ESTADO_ID, }; + + private Map dataHash; + + public MarcacoesGruposRealizadosDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getMarcacao_trabalhador_id() + { + return (Integer) dataHash.get(MARCACAO_TRABALHADOR_ID); + } + + public void setMarcacao_trabalhador_id(Integer marcacao_trabalhador_idValue ) + { + dataHash.put(TO_MARCACAO_TRABALHADOR_ID, null); + dataHash.put(MARCACAO_TRABALHADOR_ID, marcacao_trabalhador_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData toMarcacao_trabalhador_id() + throws Exception + { + if( dataHash.get(TO_MARCACAO_TRABALHADOR_ID) == null && getMarcacao_trabalhador_id() != null ) + { + dataHash.put(TO_MARCACAO_TRABALHADOR_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData.class, new Object[]{ getMarcacao_trabalhador_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData) dataHash.get(TO_MARCACAO_TRABALHADOR_ID); + } + + public void setToMarcacao_trabalhador_id(com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData marcacao_trabalhador_idObject ) + { + if( marcacao_trabalhador_idObject == null ) + { + dataHash.put(MARCACAO_TRABALHADOR_ID, null); + } + else + { + dataHash.put(MARCACAO_TRABALHADOR_ID, marcacao_trabalhador_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData.ID )); + } + dataHash.put(TO_MARCACAO_TRABALHADOR_ID, marcacao_trabalhador_idObject); + } + + public Integer getGrupo_protocolo_id() + { + return (Integer) dataHash.get(GRUPO_PROTOCOLO_ID); + } + + public void setGrupo_protocolo_id(Integer grupo_protocolo_idValue ) + { + dataHash.put(TO_GRUPO_PROTOCOLO_ID, null); + dataHash.put(GRUPO_PROTOCOLO_ID, grupo_protocolo_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData toGrupo_protocolo_id() + throws Exception + { + if( dataHash.get(TO_GRUPO_PROTOCOLO_ID) == null && getGrupo_protocolo_id() != null ) + { + dataHash.put(TO_GRUPO_PROTOCOLO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData.class, new Object[]{ getGrupo_protocolo_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData) dataHash.get(TO_GRUPO_PROTOCOLO_ID); + } + + public void setToGrupo_protocolo_id(com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData grupo_protocolo_idObject ) + { + if( grupo_protocolo_idObject == null ) + { + dataHash.put(GRUPO_PROTOCOLO_ID, null); + } + else + { + dataHash.put(GRUPO_PROTOCOLO_ID, grupo_protocolo_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData.ID )); + } + dataHash.put(TO_GRUPO_PROTOCOLO_ID, grupo_protocolo_idObject); + } + + public Integer getMarcacoes_trabalhador_estado_id() + { + return (Integer) dataHash.get(MARCACOES_TRABALHADOR_ESTADO_ID); + } + + public void setMarcacoes_trabalhador_estado_id(Integer marcacoes_trabalhador_estado_idValue ) + { + dataHash.put(TO_MARCACOES_TRABALHADOR_ESTADO_ID, null); + dataHash.put(MARCACOES_TRABALHADOR_ESTADO_ID, marcacoes_trabalhador_estado_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorEstadosData toMarcacoes_trabalhador_estado_id() + throws Exception + { + if( dataHash.get(TO_MARCACOES_TRABALHADOR_ESTADO_ID) == null && getMarcacoes_trabalhador_estado_id() != null ) + { + dataHash.put(TO_MARCACOES_TRABALHADOR_ESTADO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorEstadosData.class, new Object[]{ getMarcacoes_trabalhador_estado_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorEstadosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorEstadosData) dataHash.get(TO_MARCACOES_TRABALHADOR_ESTADO_ID); + } + + public void setToMarcacoes_trabalhador_estado_id(com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorEstadosData marcacoes_trabalhador_estado_idObject ) + { + if( marcacoes_trabalhador_estado_idObject == null ) + { + dataHash.put(MARCACOES_TRABALHADOR_ESTADO_ID, null); + } + else + { + dataHash.put(MARCACOES_TRABALHADOR_ESTADO_ID, marcacoes_trabalhador_estado_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorEstadosData.ID )); + } + dataHash.put(TO_MARCACOES_TRABALHADOR_ESTADO_ID, marcacoes_trabalhador_estado_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_GRUPO_PROTOCOLO_ID.equals( fieldName ) ) + { + value = toGrupo_protocolo_id(); + } + else if( MARCACAO_TRABALHADOR_ID.equals( fieldName ) ) + { + value = getMarcacao_trabalhador_id(); + } + else if( MARCACOES_TRABALHADOR_ESTADO_ID.equals( fieldName ) ) + { + value = getMarcacoes_trabalhador_estado_id(); + } + else if( GRUPO_PROTOCOLO_ID.equals( fieldName ) ) + { + value = getGrupo_protocolo_id(); + } + else if( TO_MARCACAO_TRABALHADOR_ID.equals( fieldName ) ) + { + value = toMarcacao_trabalhador_id(); + } + else if( TO_MARCACOES_TRABALHADOR_ESTADO_ID.equals( fieldName ) ) + { + value = toMarcacoes_trabalhador_estado_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_GRUPO_PROTOCOLO_ID.equals( fieldName ) ) + { + setToGrupo_protocolo_id( (com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData) value ); + } + else if( MARCACAO_TRABALHADOR_ID.equals( fieldName ) ) + { + setMarcacao_trabalhador_id( (Integer) value ); + } + else if( MARCACOES_TRABALHADOR_ESTADO_ID.equals( fieldName ) ) + { + setMarcacoes_trabalhador_estado_id( (Integer) value ); + } + else if( GRUPO_PROTOCOLO_ID.equals( fieldName ) ) + { + setGrupo_protocolo_id( (Integer) value ); + } + else if( TO_MARCACAO_TRABALHADOR_ID.equals( fieldName ) ) + { + setToMarcacao_trabalhador_id( (com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData) value ); + } + else if( TO_MARCACOES_TRABALHADOR_ESTADO_ID.equals( fieldName ) ) + { + setToMarcacoes_trabalhador_estado_id( (com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorEstadosData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_MARCACAO_TRABALHADOR_ID) != null ) + { + toMarcacao_trabalhador_id().save(); + dataHash.put(MARCACAO_TRABALHADOR_ID, toMarcacao_trabalhador_id().get( com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData.ID )); + } + + if( dataHash.get(TO_GRUPO_PROTOCOLO_ID) != null ) + { + toGrupo_protocolo_id().save(); + dataHash.put(GRUPO_PROTOCOLO_ID, toGrupo_protocolo_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData.ID )); + } + + if( dataHash.get(TO_MARCACOES_TRABALHADOR_ESTADO_ID) != null ) + { + toMarcacoes_trabalhador_estado_id().save(); + dataHash.put(MARCACOES_TRABALHADOR_ESTADO_ID, toMarcacoes_trabalhador_estado_id().get( com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorEstadosData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return MarcacoesGruposRealizados.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTecnicosHst.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTecnicosHst.java new file mode 100644 index 00000000..2576cf30 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTecnicosHst.java @@ -0,0 +1,291 @@ +/* +* MarcacoesTecnicosHst.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class MarcacoesTecnicosHst implements JDOInnerObject +{ + private Integer id; + private String nome; + private String nome_plain; + private String iniciais; + private Integer identificador; + private String inactivo; + private String cap; + private String formacao; + private Integer assinatura; + + public MarcacoesTecnicosHst() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == MarcacoesTecnicosHstDataAuto.ID ) + { + return id; + } + else if( fieldName == MarcacoesTecnicosHstDataAuto.NOME ) + { + return nome; + } + else if( fieldName == MarcacoesTecnicosHstDataAuto.NOME_PLAIN ) + { + return nome_plain; + } + else if( fieldName == MarcacoesTecnicosHstDataAuto.INICIAIS ) + { + return iniciais; + } + else if( fieldName == MarcacoesTecnicosHstDataAuto.IDENTIFICADOR ) + { + return identificador; + } + else if( fieldName == MarcacoesTecnicosHstDataAuto.INACTIVO ) + { + return inactivo; + } + else if( fieldName == MarcacoesTecnicosHstDataAuto.CAP ) + { + return cap; + } + else if( fieldName == MarcacoesTecnicosHstDataAuto.FORMACAO ) + { + return formacao; + } + else if( fieldName == MarcacoesTecnicosHstDataAuto.ASSINATURA ) + { + return assinatura; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.NOME ) ) + { + return nome; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.NOME_PLAIN ) ) + { + return nome_plain; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.INICIAIS ) ) + { + return iniciais; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.IDENTIFICADOR ) ) + { + return identificador; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.INACTIVO ) ) + { + return inactivo; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.CAP ) ) + { + return cap; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.FORMACAO ) ) + { + return formacao; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.ASSINATURA ) ) + { + return assinatura; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == MarcacoesTecnicosHstDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == MarcacoesTecnicosHstDataAuto.NOME ) + { + nome = ( String ) value; + } + else if( fieldName == MarcacoesTecnicosHstDataAuto.NOME_PLAIN ) + { + nome_plain = ( String ) value; + } + else if( fieldName == MarcacoesTecnicosHstDataAuto.INICIAIS ) + { + iniciais = ( String ) value; + } + else if( fieldName == MarcacoesTecnicosHstDataAuto.IDENTIFICADOR ) + { + identificador = ( Integer ) value; + } + else if( fieldName == MarcacoesTecnicosHstDataAuto.INACTIVO ) + { + inactivo = ( String ) value; + } + else if( fieldName == MarcacoesTecnicosHstDataAuto.CAP ) + { + cap = ( String ) value; + } + else if( fieldName == MarcacoesTecnicosHstDataAuto.FORMACAO ) + { + formacao = ( String ) value; + } + else if( fieldName == MarcacoesTecnicosHstDataAuto.ASSINATURA ) + { + assinatura = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.NOME ) ) + { + nome = ( String ) value; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.NOME_PLAIN ) ) + { + nome_plain = ( String ) value; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.INICIAIS ) ) + { + iniciais = ( String ) value; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.IDENTIFICADOR ) ) + { + identificador = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.INACTIVO ) ) + { + inactivo = ( String ) value; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.CAP ) ) + { + cap = ( String ) value; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.FORMACAO ) ) + { + formacao = ( String ) value; + } + else if( fieldName.equals( MarcacoesTecnicosHstDataAuto.ASSINATURA ) ) + { + assinatura = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getNome() + { + return nome; + } + + public void setNome(String nomeValue ) + { + this.nome = nomeValue; + } + + public String getNome_plain() + { + return nome_plain; + } + + public void setNome_plain(String nome_plainValue ) + { + this.nome_plain = nome_plainValue; + } + + public String getIniciais() + { + return iniciais; + } + + public void setIniciais(String iniciaisValue ) + { + this.iniciais = iniciaisValue; + } + + public Integer getIdentificador() + { + return identificador; + } + + public void setIdentificador(Integer identificadorValue ) + { + this.identificador = identificadorValue; + } + + public String getInactivo() + { + return inactivo; + } + + public void setInactivo(String inactivoValue ) + { + this.inactivo = inactivoValue; + } + + public String getCap() + { + return cap; + } + + public void setCap(String capValue ) + { + this.cap = capValue; + } + + public String getFormacao() + { + return formacao; + } + + public void setFormacao(String formacaoValue ) + { + this.formacao = formacaoValue; + } + + public Integer getAssinatura() + { + return assinatura; + } + + public void setAssinatura(Integer assinaturaValue ) + { + this.assinatura = assinaturaValue; + } + + public Class getOuterClass() + { + return MarcacoesTecnicosHstDataAuto.class; + } + + public MarcacoesTecnicosHstDataAuto getOuterClassInstance() + { + MarcacoesTecnicosHstDataAuto outerObj = new MarcacoesTecnicosHstDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTecnicosHstData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTecnicosHstData.java new file mode 100644 index 00000000..2064652e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTecnicosHstData.java @@ -0,0 +1,18 @@ +/* +* MarcacoesTecnicosHstDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class MarcacoesTecnicosHstData extends com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTecnicosHstDataAuto +{ + + public MarcacoesTecnicosHstData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTecnicosHstDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTecnicosHstDataAuto.java new file mode 100644 index 00000000..42125218 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTecnicosHstDataAuto.java @@ -0,0 +1,239 @@ +/* +* MarcacoesTecnicosHstDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class MarcacoesTecnicosHstDataAuto extends JDOObject +{ + + public static final String TABLENAME = "marcacoes_tecnicos_hst"; + + public static final String ID = "id"; + public static final String ID_FULL = "marcacoes_tecnicos_hst.id"; + public static final String NOME = "nome"; + public static final String NOME_FULL = "marcacoes_tecnicos_hst.nome"; + public static final String NOME_PLAIN = "nome_plain"; + public static final String NOME_PLAIN_FULL = "marcacoes_tecnicos_hst.nome_plain"; + public static final String INICIAIS = "iniciais"; + public static final String INICIAIS_FULL = "marcacoes_tecnicos_hst.iniciais"; + public static final String IDENTIFICADOR = "identificador"; + public static final String IDENTIFICADOR_FULL = "marcacoes_tecnicos_hst.identificador"; + public static final String INACTIVO = "inactivo"; + public static final String INACTIVO_FULL = "marcacoes_tecnicos_hst.inactivo"; + public static final String CAP = "cap"; + public static final String CAP_FULL = "marcacoes_tecnicos_hst.cap"; + public static final String FORMACAO = "formacao"; + public static final String FORMACAO_FULL = "marcacoes_tecnicos_hst.formacao"; + public static final String ASSINATURA = "assinatura"; + public static final String ASSINATURA_FULL = "marcacoes_tecnicos_hst.assinatura"; + public static final String TO_ASSINATURA = "to assinatura"; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, NOME_PLAIN, INICIAIS, IDENTIFICADOR, INACTIVO, CAP, FORMACAO, ASSINATURA, + TO_ASSINATURA, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, NOME, NOME_PLAIN, INICIAIS, IDENTIFICADOR, INACTIVO, CAP, FORMACAO, ASSINATURA, }; + + private Map dataHash; + + public MarcacoesTecnicosHstDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getNome() + { + return (String) get(NOME); + } + + public void setNome(String nomeValue ) + { + this.set(NOME, nomeValue ); + } + + public String getNome_plain() + { + return (String) get(NOME_PLAIN); + } + + public void setNome_plain(String nome_plainValue ) + { + this.set(NOME_PLAIN, nome_plainValue ); + } + + public String getIniciais() + { + return (String) get(INICIAIS); + } + + public void setIniciais(String iniciaisValue ) + { + this.set(INICIAIS, iniciaisValue ); + } + + public Integer getIdentificador() + { + return (Integer) get(IDENTIFICADOR); + } + + public void setIdentificador(Integer identificadorValue ) + { + this.set(IDENTIFICADOR, identificadorValue ); + } + + public String getInactivo() + { + return (String) get(INACTIVO); + } + + public void setInactivo(String inactivoValue ) + { + this.set(INACTIVO, inactivoValue ); + } + + public String getCap() + { + return (String) get(CAP); + } + + public void setCap(String capValue ) + { + this.set(CAP, capValue ); + } + + public String getFormacao() + { + return (String) get(FORMACAO); + } + + public void setFormacao(String formacaoValue ) + { + this.set(FORMACAO, formacaoValue ); + } + + public Integer getAssinatura() + { + return (Integer) dataHash.get(ASSINATURA); + } + + public void setAssinatura(Integer assinaturaValue ) + { + dataHash.put(TO_ASSINATURA, null); + dataHash.put(ASSINATURA, assinaturaValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.ImageData toAssinatura() + throws Exception + { + if( dataHash.get(TO_ASSINATURA) == null && getAssinatura() != null ) + { + dataHash.put(TO_ASSINATURA, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.ImageData.class, new Object[]{ getAssinatura() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.ImageData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.ImageData) dataHash.get(TO_ASSINATURA); + } + + public void setToAssinatura(com.evolute.siprp.server.db.data.siprp_local3.ImageData assinaturaObject ) + { + if( assinaturaObject == null ) + { + dataHash.put(ASSINATURA, null); + } + else + { + dataHash.put(ASSINATURA, assinaturaObject.get( com.evolute.siprp.server.db.data.siprp_local3.ImageData.ID )); + } + dataHash.put(TO_ASSINATURA, assinaturaObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_ASSINATURA.equals( fieldName ) ) + { + value = toAssinatura(); + } + else if( ASSINATURA.equals( fieldName ) ) + { + value = getAssinatura(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_ASSINATURA.equals( fieldName ) ) + { + setToAssinatura( (com.evolute.siprp.server.db.data.siprp_local3.ImageData) value ); + } + else if( ASSINATURA.equals( fieldName ) ) + { + setAssinatura( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_ASSINATURA) != null ) + { + toAssinatura().save(); + dataHash.put(ASSINATURA, toAssinatura().get( com.evolute.siprp.server.db.data.siprp_local3.ImageData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return MarcacoesTecnicosHst.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhador.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhador.java new file mode 100644 index 00000000..9906bf74 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhador.java @@ -0,0 +1,345 @@ +/* +* MarcacoesTrabalhador.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class MarcacoesTrabalhador implements JDOInnerObject +{ + private Integer id; + private java.util.Date data; + private String realizada; + private java.util.Date data_email; + private java.util.Date data_relatorio; + private Integer tipo; + private Integer trabalhador_id; + private Integer motivo; + private Integer estado; + private String observacoes; + private Integer prestador_id; + + public MarcacoesTrabalhador() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == MarcacoesTrabalhadorDataAuto.ID ) + { + return id; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.DATA ) + { + return data; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.REALIZADA ) + { + return realizada; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.DATA_EMAIL ) + { + return data_email; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.DATA_RELATORIO ) + { + return data_relatorio; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.TIPO ) + { + return tipo; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.TRABALHADOR_ID ) + { + return trabalhador_id; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.MOTIVO ) + { + return motivo; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.ESTADO ) + { + return estado; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.OBSERVACOES ) + { + return observacoes; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.PRESTADOR_ID ) + { + return prestador_id; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.DATA ) ) + { + return data; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.REALIZADA ) ) + { + return realizada; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.DATA_EMAIL ) ) + { + return data_email; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.DATA_RELATORIO ) ) + { + return data_relatorio; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.TIPO ) ) + { + return tipo; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.TRABALHADOR_ID ) ) + { + return trabalhador_id; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.MOTIVO ) ) + { + return motivo; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.ESTADO ) ) + { + return estado; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.OBSERVACOES ) ) + { + return observacoes; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.PRESTADOR_ID ) ) + { + return prestador_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == MarcacoesTrabalhadorDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.DATA ) + { + data = ( java.util.Date ) value; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.REALIZADA ) + { + realizada = ( String ) value; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.DATA_EMAIL ) + { + data_email = ( java.util.Date ) value; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.DATA_RELATORIO ) + { + data_relatorio = ( java.util.Date ) value; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.TIPO ) + { + tipo = ( Integer ) value; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.TRABALHADOR_ID ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.MOTIVO ) + { + motivo = ( Integer ) value; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.ESTADO ) + { + estado = ( Integer ) value; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.OBSERVACOES ) + { + observacoes = ( String ) value; + } + else if( fieldName == MarcacoesTrabalhadorDataAuto.PRESTADOR_ID ) + { + prestador_id = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.DATA ) ) + { + data = ( java.util.Date ) value; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.REALIZADA ) ) + { + realizada = ( String ) value; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.DATA_EMAIL ) ) + { + data_email = ( java.util.Date ) value; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.DATA_RELATORIO ) ) + { + data_relatorio = ( java.util.Date ) value; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.TIPO ) ) + { + tipo = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.TRABALHADOR_ID ) ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.MOTIVO ) ) + { + motivo = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.ESTADO ) ) + { + estado = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.OBSERVACOES ) ) + { + observacoes = ( String ) value; + } + else if( fieldName.equals( MarcacoesTrabalhadorDataAuto.PRESTADOR_ID ) ) + { + prestador_id = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public java.util.Date getData() + { + return data; + } + + public void setData(java.util.Date dataValue ) + { + this.data = dataValue; + } + + public String getRealizada() + { + return realizada; + } + + public void setRealizada(String realizadaValue ) + { + this.realizada = realizadaValue; + } + + public java.util.Date getData_email() + { + return data_email; + } + + public void setData_email(java.util.Date data_emailValue ) + { + this.data_email = data_emailValue; + } + + public java.util.Date getData_relatorio() + { + return data_relatorio; + } + + public void setData_relatorio(java.util.Date data_relatorioValue ) + { + this.data_relatorio = data_relatorioValue; + } + + public Integer getTipo() + { + return tipo; + } + + public void setTipo(Integer tipoValue ) + { + this.tipo = tipoValue; + } + + public Integer getTrabalhador_id() + { + return trabalhador_id; + } + + public void setTrabalhador_id(Integer trabalhador_idValue ) + { + this.trabalhador_id = trabalhador_idValue; + } + + public Integer getMotivo() + { + return motivo; + } + + public void setMotivo(Integer motivoValue ) + { + this.motivo = motivoValue; + } + + public Integer getEstado() + { + return estado; + } + + public void setEstado(Integer estadoValue ) + { + this.estado = estadoValue; + } + + public String getObservacoes() + { + return observacoes; + } + + public void setObservacoes(String observacoesValue ) + { + this.observacoes = observacoesValue; + } + + public Integer getPrestador_id() + { + return prestador_id; + } + + public void setPrestador_id(Integer prestador_idValue ) + { + this.prestador_id = prestador_idValue; + } + + public Class getOuterClass() + { + return MarcacoesTrabalhadorDataAuto.class; + } + + public MarcacoesTrabalhadorDataAuto getOuterClassInstance() + { + MarcacoesTrabalhadorDataAuto outerObj = new MarcacoesTrabalhadorDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhadorData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhadorData.java new file mode 100644 index 00000000..f86c7f29 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhadorData.java @@ -0,0 +1,18 @@ +/* +* MarcacoesTrabalhadorDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class MarcacoesTrabalhadorData extends com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorDataAuto +{ + + public MarcacoesTrabalhadorData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhadorDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhadorDataAuto.java new file mode 100644 index 00000000..78cbc569 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhadorDataAuto.java @@ -0,0 +1,264 @@ +/* +* MarcacoesTrabalhadorDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class MarcacoesTrabalhadorDataAuto extends JDOObject +{ + + public static final String TABLENAME = "marcacoes_trabalhador"; + + public static final String ID = "id"; + public static final String ID_FULL = "marcacoes_trabalhador.id"; + public static final String DATA = "data"; + public static final String DATA_FULL = "marcacoes_trabalhador.data"; + public static final String REALIZADA = "realizada"; + public static final String REALIZADA_FULL = "marcacoes_trabalhador.realizada"; + public static final String DATA_EMAIL = "data_email"; + public static final String DATA_EMAIL_FULL = "marcacoes_trabalhador.data_email"; + public static final String DATA_RELATORIO = "data_relatorio"; + public static final String DATA_RELATORIO_FULL = "marcacoes_trabalhador.data_relatorio"; + public static final String TIPO = "tipo"; + public static final String TIPO_FULL = "marcacoes_trabalhador.tipo"; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String TRABALHADOR_ID_FULL = "marcacoes_trabalhador.trabalhador_id"; + public static final String MOTIVO = "motivo"; + public static final String MOTIVO_FULL = "marcacoes_trabalhador.motivo"; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "marcacoes_trabalhador.estado"; + public static final String OBSERVACOES = "observacoes"; + public static final String OBSERVACOES_FULL = "marcacoes_trabalhador.observacoes"; + public static final String PRESTADOR_ID = "prestador_id"; + public static final String PRESTADOR_ID_FULL = "marcacoes_trabalhador.prestador_id"; + public static final String TO_PRESTADOR_ID = "to prestador_id"; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, REALIZADA, DATA_EMAIL, DATA_RELATORIO, TIPO, TRABALHADOR_ID, MOTIVO, ESTADO, + OBSERVACOES, PRESTADOR_ID, TO_PRESTADOR_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATA, REALIZADA, DATA_EMAIL, DATA_RELATORIO, TIPO, TRABALHADOR_ID, MOTIVO, ESTADO, + OBSERVACOES, PRESTADOR_ID, }; + + private Map dataHash; + + public MarcacoesTrabalhadorDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public java.util.Date getData() + { + return (java.util.Date) get(DATA); + } + + public void setData(java.util.Date dataValue ) + { + this.set(DATA, dataValue ); + } + + public String getRealizada() + { + return (String) get(REALIZADA); + } + + public void setRealizada(String realizadaValue ) + { + this.set(REALIZADA, realizadaValue ); + } + + public java.util.Date getData_email() + { + return (java.util.Date) get(DATA_EMAIL); + } + + public void setData_email(java.util.Date data_emailValue ) + { + this.set(DATA_EMAIL, data_emailValue ); + } + + public java.util.Date getData_relatorio() + { + return (java.util.Date) get(DATA_RELATORIO); + } + + public void setData_relatorio(java.util.Date data_relatorioValue ) + { + this.set(DATA_RELATORIO, data_relatorioValue ); + } + + public Integer getTipo() + { + return (Integer) get(TIPO); + } + + public void setTipo(Integer tipoValue ) + { + this.set(TIPO, tipoValue ); + } + + public Integer getTrabalhador_id() + { + return (Integer) get(TRABALHADOR_ID); + } + + public void setTrabalhador_id(Integer trabalhador_idValue ) + { + this.set(TRABALHADOR_ID, trabalhador_idValue ); + } + + public Integer getMotivo() + { + return (Integer) get(MOTIVO); + } + + public void setMotivo(Integer motivoValue ) + { + this.set(MOTIVO, motivoValue ); + } + + public Integer getEstado() + { + return (Integer) get(ESTADO); + } + + public void setEstado(Integer estadoValue ) + { + this.set(ESTADO, estadoValue ); + } + + public String getObservacoes() + { + return (String) get(OBSERVACOES); + } + + public void setObservacoes(String observacoesValue ) + { + this.set(OBSERVACOES, observacoesValue ); + } + + public Integer getPrestador_id() + { + return (Integer) dataHash.get(PRESTADOR_ID); + } + + public void setPrestador_id(Integer prestador_idValue ) + { + dataHash.put(TO_PRESTADOR_ID, null); + dataHash.put(PRESTADOR_ID, prestador_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData toPrestador_id() + throws Exception + { + if( dataHash.get(TO_PRESTADOR_ID) == null && getPrestador_id() != null ) + { + dataHash.put(TO_PRESTADOR_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.class, new Object[]{ getPrestador_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) dataHash.get(TO_PRESTADOR_ID); + } + + public void setToPrestador_id(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData prestador_idObject ) + { + if( prestador_idObject == null ) + { + dataHash.put(PRESTADOR_ID, null); + } + else + { + dataHash.put(PRESTADOR_ID, prestador_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + dataHash.put(TO_PRESTADOR_ID, prestador_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_PRESTADOR_ID.equals( fieldName ) ) + { + value = toPrestador_id(); + } + else if( PRESTADOR_ID.equals( fieldName ) ) + { + value = getPrestador_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_PRESTADOR_ID.equals( fieldName ) ) + { + setToPrestador_id( (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) value ); + } + else if( PRESTADOR_ID.equals( fieldName ) ) + { + setPrestador_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_PRESTADOR_ID) != null ) + { + toPrestador_id().save(); + dataHash.put(PRESTADOR_ID, toPrestador_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return MarcacoesTrabalhador.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhadorEstados.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhadorEstados.java new file mode 100644 index 00000000..20b97980 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhadorEstados.java @@ -0,0 +1,183 @@ +/* +* MarcacoesTrabalhadorEstados.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class MarcacoesTrabalhadorEstados implements JDOInnerObject +{ + private Integer id; + private java.util.Date data; + private Integer estado; + private Integer marcacao_id; + private Integer prestador_id; + + public MarcacoesTrabalhadorEstados() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == MarcacoesTrabalhadorEstadosDataAuto.ID ) + { + return id; + } + else if( fieldName == MarcacoesTrabalhadorEstadosDataAuto.DATA ) + { + return data; + } + else if( fieldName == MarcacoesTrabalhadorEstadosDataAuto.ESTADO ) + { + return estado; + } + else if( fieldName == MarcacoesTrabalhadorEstadosDataAuto.MARCACAO_ID ) + { + return marcacao_id; + } + else if( fieldName == MarcacoesTrabalhadorEstadosDataAuto.PRESTADOR_ID ) + { + return prestador_id; + } + else if( fieldName.equals( MarcacoesTrabalhadorEstadosDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( MarcacoesTrabalhadorEstadosDataAuto.DATA ) ) + { + return data; + } + else if( fieldName.equals( MarcacoesTrabalhadorEstadosDataAuto.ESTADO ) ) + { + return estado; + } + else if( fieldName.equals( MarcacoesTrabalhadorEstadosDataAuto.MARCACAO_ID ) ) + { + return marcacao_id; + } + else if( fieldName.equals( MarcacoesTrabalhadorEstadosDataAuto.PRESTADOR_ID ) ) + { + return prestador_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == MarcacoesTrabalhadorEstadosDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == MarcacoesTrabalhadorEstadosDataAuto.DATA ) + { + data = ( java.util.Date ) value; + } + else if( fieldName == MarcacoesTrabalhadorEstadosDataAuto.ESTADO ) + { + estado = ( Integer ) value; + } + else if( fieldName == MarcacoesTrabalhadorEstadosDataAuto.MARCACAO_ID ) + { + marcacao_id = ( Integer ) value; + } + else if( fieldName == MarcacoesTrabalhadorEstadosDataAuto.PRESTADOR_ID ) + { + prestador_id = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesTrabalhadorEstadosDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesTrabalhadorEstadosDataAuto.DATA ) ) + { + data = ( java.util.Date ) value; + } + else if( fieldName.equals( MarcacoesTrabalhadorEstadosDataAuto.ESTADO ) ) + { + estado = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesTrabalhadorEstadosDataAuto.MARCACAO_ID ) ) + { + marcacao_id = ( Integer ) value; + } + else if( fieldName.equals( MarcacoesTrabalhadorEstadosDataAuto.PRESTADOR_ID ) ) + { + prestador_id = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public java.util.Date getData() + { + return data; + } + + public void setData(java.util.Date dataValue ) + { + this.data = dataValue; + } + + public Integer getEstado() + { + return estado; + } + + public void setEstado(Integer estadoValue ) + { + this.estado = estadoValue; + } + + public Integer getMarcacao_id() + { + return marcacao_id; + } + + public void setMarcacao_id(Integer marcacao_idValue ) + { + this.marcacao_id = marcacao_idValue; + } + + public Integer getPrestador_id() + { + return prestador_id; + } + + public void setPrestador_id(Integer prestador_idValue ) + { + this.prestador_id = prestador_idValue; + } + + public Class getOuterClass() + { + return MarcacoesTrabalhadorEstadosDataAuto.class; + } + + public MarcacoesTrabalhadorEstadosDataAuto getOuterClassInstance() + { + MarcacoesTrabalhadorEstadosDataAuto outerObj = new MarcacoesTrabalhadorEstadosDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhadorEstadosData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhadorEstadosData.java new file mode 100644 index 00000000..0a9157c1 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhadorEstadosData.java @@ -0,0 +1,18 @@ +/* +* MarcacoesTrabalhadorEstadosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class MarcacoesTrabalhadorEstadosData extends com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorEstadosDataAuto +{ + + public MarcacoesTrabalhadorEstadosData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhadorEstadosDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhadorEstadosDataAuto.java new file mode 100644 index 00000000..21ef871a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MarcacoesTrabalhadorEstadosDataAuto.java @@ -0,0 +1,237 @@ +/* +* MarcacoesTrabalhadorEstadosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class MarcacoesTrabalhadorEstadosDataAuto extends JDOObject +{ + + public static final String TABLENAME = "marcacoes_trabalhador_estados"; + + public static final String ID = "id"; + public static final String ID_FULL = "marcacoes_trabalhador_estados.id"; + public static final String DATA = "data"; + public static final String DATA_FULL = "marcacoes_trabalhador_estados.data"; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "marcacoes_trabalhador_estados.estado"; + public static final String MARCACAO_ID = "marcacao_id"; + public static final String MARCACAO_ID_FULL = "marcacoes_trabalhador_estados.marcacao_id"; + public static final String TO_MARCACAO_ID = "to marcacao_id"; + public static final String PRESTADOR_ID = "prestador_id"; + public static final String PRESTADOR_ID_FULL = "marcacoes_trabalhador_estados.prestador_id"; + public static final String TO_PRESTADOR_ID = "to prestador_id"; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, ESTADO, MARCACAO_ID, TO_MARCACAO_ID, PRESTADOR_ID, TO_PRESTADOR_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATA, ESTADO, MARCACAO_ID, PRESTADOR_ID, }; + + private Map dataHash; + + public MarcacoesTrabalhadorEstadosDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public java.util.Date getData() + { + return (java.util.Date) get(DATA); + } + + public void setData(java.util.Date dataValue ) + { + this.set(DATA, dataValue ); + } + + public Integer getEstado() + { + return (Integer) get(ESTADO); + } + + public void setEstado(Integer estadoValue ) + { + this.set(ESTADO, estadoValue ); + } + + public Integer getMarcacao_id() + { + return (Integer) dataHash.get(MARCACAO_ID); + } + + public void setMarcacao_id(Integer marcacao_idValue ) + { + dataHash.put(TO_MARCACAO_ID, null); + dataHash.put(MARCACAO_ID, marcacao_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData toMarcacao_id() + throws Exception + { + if( dataHash.get(TO_MARCACAO_ID) == null && getMarcacao_id() != null ) + { + dataHash.put(TO_MARCACAO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData.class, new Object[]{ getMarcacao_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData) dataHash.get(TO_MARCACAO_ID); + } + + public void setToMarcacao_id(com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData marcacao_idObject ) + { + if( marcacao_idObject == null ) + { + dataHash.put(MARCACAO_ID, null); + } + else + { + dataHash.put(MARCACAO_ID, marcacao_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData.ID )); + } + dataHash.put(TO_MARCACAO_ID, marcacao_idObject); + } + + public Integer getPrestador_id() + { + return (Integer) dataHash.get(PRESTADOR_ID); + } + + public void setPrestador_id(Integer prestador_idValue ) + { + dataHash.put(TO_PRESTADOR_ID, null); + dataHash.put(PRESTADOR_ID, prestador_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData toPrestador_id() + throws Exception + { + if( dataHash.get(TO_PRESTADOR_ID) == null && getPrestador_id() != null ) + { + dataHash.put(TO_PRESTADOR_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.class, new Object[]{ getPrestador_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) dataHash.get(TO_PRESTADOR_ID); + } + + public void setToPrestador_id(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData prestador_idObject ) + { + if( prestador_idObject == null ) + { + dataHash.put(PRESTADOR_ID, null); + } + else + { + dataHash.put(PRESTADOR_ID, prestador_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + dataHash.put(TO_PRESTADOR_ID, prestador_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_PRESTADOR_ID.equals( fieldName ) ) + { + value = toPrestador_id(); + } + else if( TO_MARCACAO_ID.equals( fieldName ) ) + { + value = toMarcacao_id(); + } + else if( PRESTADOR_ID.equals( fieldName ) ) + { + value = getPrestador_id(); + } + else if( MARCACAO_ID.equals( fieldName ) ) + { + value = getMarcacao_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_PRESTADOR_ID.equals( fieldName ) ) + { + setToPrestador_id( (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) value ); + } + else if( TO_MARCACAO_ID.equals( fieldName ) ) + { + setToMarcacao_id( (com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData) value ); + } + else if( PRESTADOR_ID.equals( fieldName ) ) + { + setPrestador_id( (Integer) value ); + } + else if( MARCACAO_ID.equals( fieldName ) ) + { + setMarcacao_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_MARCACAO_ID) != null ) + { + toMarcacao_id().save(); + dataHash.put(MARCACAO_ID, toMarcacao_id().get( com.evolute.siprp.server.db.data.siprp_local3.MarcacoesTrabalhadorData.ID )); + } + + if( dataHash.get(TO_PRESTADOR_ID) != null ) + { + toPrestador_id().save(); + dataHash.put(PRESTADOR_ID, toPrestador_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return MarcacoesTrabalhadorEstados.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Medicos.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Medicos.java new file mode 100644 index 00000000..c90b5f4e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Medicos.java @@ -0,0 +1,156 @@ +/* +* Medicos.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class Medicos implements JDOInnerObject +{ + private Integer id; + private String nome; + private String numero_cedula; + private String inactivo; + + public Medicos() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == MedicosDataAuto.ID ) + { + return id; + } + else if( fieldName == MedicosDataAuto.NOME ) + { + return nome; + } + else if( fieldName == MedicosDataAuto.NUMERO_CEDULA ) + { + return numero_cedula; + } + else if( fieldName == MedicosDataAuto.INACTIVO ) + { + return inactivo; + } + else if( fieldName.equals( MedicosDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( MedicosDataAuto.NOME ) ) + { + return nome; + } + else if( fieldName.equals( MedicosDataAuto.NUMERO_CEDULA ) ) + { + return numero_cedula; + } + else if( fieldName.equals( MedicosDataAuto.INACTIVO ) ) + { + return inactivo; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == MedicosDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == MedicosDataAuto.NOME ) + { + nome = ( String ) value; + } + else if( fieldName == MedicosDataAuto.NUMERO_CEDULA ) + { + numero_cedula = ( String ) value; + } + else if( fieldName == MedicosDataAuto.INACTIVO ) + { + inactivo = ( String ) value; + } + else if( fieldName.equals( MedicosDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( MedicosDataAuto.NOME ) ) + { + nome = ( String ) value; + } + else if( fieldName.equals( MedicosDataAuto.NUMERO_CEDULA ) ) + { + numero_cedula = ( String ) value; + } + else if( fieldName.equals( MedicosDataAuto.INACTIVO ) ) + { + inactivo = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getNome() + { + return nome; + } + + public void setNome(String nomeValue ) + { + this.nome = nomeValue; + } + + public String getNumero_cedula() + { + return numero_cedula; + } + + public void setNumero_cedula(String numero_cedulaValue ) + { + this.numero_cedula = numero_cedulaValue; + } + + public String getInactivo() + { + return inactivo; + } + + public void setInactivo(String inactivoValue ) + { + this.inactivo = inactivoValue; + } + + public Class getOuterClass() + { + return MedicosDataAuto.class; + } + + public MedicosDataAuto getOuterClassInstance() + { + MedicosDataAuto outerObj = new MedicosDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MedicosData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MedicosData.java new file mode 100644 index 00000000..63adb179 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MedicosData.java @@ -0,0 +1,18 @@ +/* +* MedicosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class MedicosData extends com.evolute.siprp.server.db.data.siprp_local3.MedicosDataAuto +{ + + public MedicosData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MedicosDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MedicosDataAuto.java new file mode 100644 index 00000000..93e01609 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/MedicosDataAuto.java @@ -0,0 +1,119 @@ +/* +* MedicosDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class MedicosDataAuto extends JDOObject +{ + + public static final String TABLENAME = "medicos"; + + public static final String ID = "id"; + public static final String ID_FULL = "medicos.id"; + public static final String NOME = "nome"; + public static final String NOME_FULL = "medicos.nome"; + public static final String NUMERO_CEDULA = "numero_cedula"; + public static final String NUMERO_CEDULA_FULL = "medicos.numero_cedula"; + public static final String INACTIVO = "inactivo"; + public static final String INACTIVO_FULL = "medicos.inactivo"; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, NUMERO_CEDULA, INACTIVO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, NOME, NUMERO_CEDULA, INACTIVO, }; + + private Map dataHash; + + public MedicosDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getNome() + { + return (String) get(NOME); + } + + public void setNome(String nomeValue ) + { + this.set(NOME, nomeValue ); + } + + public String getNumero_cedula() + { + return (String) get(NUMERO_CEDULA); + } + + public void setNumero_cedula(String numero_cedulaValue ) + { + this.set(NUMERO_CEDULA, numero_cedulaValue ); + } + + public String getInactivo() + { + return (String) get(INACTIVO); + } + + public void setInactivo(String inactivoValue ) + { + this.set(INACTIVO, inactivoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Medicos.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Prestadores.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Prestadores.java new file mode 100644 index 00000000..aa99dcb6 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Prestadores.java @@ -0,0 +1,399 @@ +/* +* Prestadores.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class Prestadores implements JDOInnerObject +{ + private Integer id; + private String nome; + private String nome_plain; + private String morada; + private String codigo_postal; + private String localidade; + private String localidade_cp; + private Integer contacto_id; + private String activo; + private String faz_consultas; + private String faz_ecds; + private String contribuinte; + private String observacoes; + + public Prestadores() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == PrestadoresDataAuto.ID ) + { + return id; + } + else if( fieldName == PrestadoresDataAuto.NOME ) + { + return nome; + } + else if( fieldName == PrestadoresDataAuto.NOME_PLAIN ) + { + return nome_plain; + } + else if( fieldName == PrestadoresDataAuto.MORADA ) + { + return morada; + } + else if( fieldName == PrestadoresDataAuto.CODIGO_POSTAL ) + { + return codigo_postal; + } + else if( fieldName == PrestadoresDataAuto.LOCALIDADE ) + { + return localidade; + } + else if( fieldName == PrestadoresDataAuto.LOCALIDADE_CP ) + { + return localidade_cp; + } + else if( fieldName == PrestadoresDataAuto.CONTACTO_ID ) + { + return contacto_id; + } + else if( fieldName == PrestadoresDataAuto.ACTIVO ) + { + return activo; + } + else if( fieldName == PrestadoresDataAuto.FAZ_CONSULTAS ) + { + return faz_consultas; + } + else if( fieldName == PrestadoresDataAuto.FAZ_ECDS ) + { + return faz_ecds; + } + else if( fieldName == PrestadoresDataAuto.CONTRIBUINTE ) + { + return contribuinte; + } + else if( fieldName == PrestadoresDataAuto.OBSERVACOES ) + { + return observacoes; + } + else if( fieldName.equals( PrestadoresDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( PrestadoresDataAuto.NOME ) ) + { + return nome; + } + else if( fieldName.equals( PrestadoresDataAuto.NOME_PLAIN ) ) + { + return nome_plain; + } + else if( fieldName.equals( PrestadoresDataAuto.MORADA ) ) + { + return morada; + } + else if( fieldName.equals( PrestadoresDataAuto.CODIGO_POSTAL ) ) + { + return codigo_postal; + } + else if( fieldName.equals( PrestadoresDataAuto.LOCALIDADE ) ) + { + return localidade; + } + else if( fieldName.equals( PrestadoresDataAuto.LOCALIDADE_CP ) ) + { + return localidade_cp; + } + else if( fieldName.equals( PrestadoresDataAuto.CONTACTO_ID ) ) + { + return contacto_id; + } + else if( fieldName.equals( PrestadoresDataAuto.ACTIVO ) ) + { + return activo; + } + else if( fieldName.equals( PrestadoresDataAuto.FAZ_CONSULTAS ) ) + { + return faz_consultas; + } + else if( fieldName.equals( PrestadoresDataAuto.FAZ_ECDS ) ) + { + return faz_ecds; + } + else if( fieldName.equals( PrestadoresDataAuto.CONTRIBUINTE ) ) + { + return contribuinte; + } + else if( fieldName.equals( PrestadoresDataAuto.OBSERVACOES ) ) + { + return observacoes; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == PrestadoresDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == PrestadoresDataAuto.NOME ) + { + nome = ( String ) value; + } + else if( fieldName == PrestadoresDataAuto.NOME_PLAIN ) + { + nome_plain = ( String ) value; + } + else if( fieldName == PrestadoresDataAuto.MORADA ) + { + morada = ( String ) value; + } + else if( fieldName == PrestadoresDataAuto.CODIGO_POSTAL ) + { + codigo_postal = ( String ) value; + } + else if( fieldName == PrestadoresDataAuto.LOCALIDADE ) + { + localidade = ( String ) value; + } + else if( fieldName == PrestadoresDataAuto.LOCALIDADE_CP ) + { + localidade_cp = ( String ) value; + } + else if( fieldName == PrestadoresDataAuto.CONTACTO_ID ) + { + contacto_id = ( Integer ) value; + } + else if( fieldName == PrestadoresDataAuto.ACTIVO ) + { + activo = ( String ) value; + } + else if( fieldName == PrestadoresDataAuto.FAZ_CONSULTAS ) + { + faz_consultas = ( String ) value; + } + else if( fieldName == PrestadoresDataAuto.FAZ_ECDS ) + { + faz_ecds = ( String ) value; + } + else if( fieldName == PrestadoresDataAuto.CONTRIBUINTE ) + { + contribuinte = ( String ) value; + } + else if( fieldName == PrestadoresDataAuto.OBSERVACOES ) + { + observacoes = ( String ) value; + } + else if( fieldName.equals( PrestadoresDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( PrestadoresDataAuto.NOME ) ) + { + nome = ( String ) value; + } + else if( fieldName.equals( PrestadoresDataAuto.NOME_PLAIN ) ) + { + nome_plain = ( String ) value; + } + else if( fieldName.equals( PrestadoresDataAuto.MORADA ) ) + { + morada = ( String ) value; + } + else if( fieldName.equals( PrestadoresDataAuto.CODIGO_POSTAL ) ) + { + codigo_postal = ( String ) value; + } + else if( fieldName.equals( PrestadoresDataAuto.LOCALIDADE ) ) + { + localidade = ( String ) value; + } + else if( fieldName.equals( PrestadoresDataAuto.LOCALIDADE_CP ) ) + { + localidade_cp = ( String ) value; + } + else if( fieldName.equals( PrestadoresDataAuto.CONTACTO_ID ) ) + { + contacto_id = ( Integer ) value; + } + else if( fieldName.equals( PrestadoresDataAuto.ACTIVO ) ) + { + activo = ( String ) value; + } + else if( fieldName.equals( PrestadoresDataAuto.FAZ_CONSULTAS ) ) + { + faz_consultas = ( String ) value; + } + else if( fieldName.equals( PrestadoresDataAuto.FAZ_ECDS ) ) + { + faz_ecds = ( String ) value; + } + else if( fieldName.equals( PrestadoresDataAuto.CONTRIBUINTE ) ) + { + contribuinte = ( String ) value; + } + else if( fieldName.equals( PrestadoresDataAuto.OBSERVACOES ) ) + { + observacoes = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getNome() + { + return nome; + } + + public void setNome(String nomeValue ) + { + this.nome = nomeValue; + } + + public String getNome_plain() + { + return nome_plain; + } + + public void setNome_plain(String nome_plainValue ) + { + this.nome_plain = nome_plainValue; + } + + public String getMorada() + { + return morada; + } + + public void setMorada(String moradaValue ) + { + this.morada = moradaValue; + } + + public String getCodigo_postal() + { + return codigo_postal; + } + + public void setCodigo_postal(String codigo_postalValue ) + { + this.codigo_postal = codigo_postalValue; + } + + public String getLocalidade() + { + return localidade; + } + + public void setLocalidade(String localidadeValue ) + { + this.localidade = localidadeValue; + } + + public String getLocalidade_cp() + { + return localidade_cp; + } + + public void setLocalidade_cp(String localidade_cpValue ) + { + this.localidade_cp = localidade_cpValue; + } + + public Integer getContacto_id() + { + return contacto_id; + } + + public void setContacto_id(Integer contacto_idValue ) + { + this.contacto_id = contacto_idValue; + } + + public String getActivo() + { + return activo; + } + + public void setActivo(String activoValue ) + { + this.activo = activoValue; + } + + public String getFaz_consultas() + { + return faz_consultas; + } + + public void setFaz_consultas(String faz_consultasValue ) + { + this.faz_consultas = faz_consultasValue; + } + + public String getFaz_ecds() + { + return faz_ecds; + } + + public void setFaz_ecds(String faz_ecdsValue ) + { + this.faz_ecds = faz_ecdsValue; + } + + public String getContribuinte() + { + return contribuinte; + } + + public void setContribuinte(String contribuinteValue ) + { + this.contribuinte = contribuinteValue; + } + + public String getObservacoes() + { + return observacoes; + } + + public void setObservacoes(String observacoesValue ) + { + this.observacoes = observacoesValue; + } + + public Class getOuterClass() + { + return PrestadoresDataAuto.class; + } + + public PrestadoresDataAuto getOuterClassInstance() + { + PrestadoresDataAuto outerObj = new PrestadoresDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrestadoresData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrestadoresData.java new file mode 100644 index 00000000..2b355493 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrestadoresData.java @@ -0,0 +1,18 @@ +/* +* PrestadoresDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class PrestadoresData extends com.evolute.siprp.server.db.data.siprp_local3.PrestadoresDataAuto +{ + + public PrestadoresData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrestadoresDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrestadoresDataAuto.java new file mode 100644 index 00000000..5f09b037 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrestadoresDataAuto.java @@ -0,0 +1,288 @@ +/* +* PrestadoresDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class PrestadoresDataAuto extends JDOObject +{ + + public static final String TABLENAME = "prestadores"; + + public static final String ID = "id"; + public static final String ID_FULL = "prestadores.id"; + public static final String NOME = "nome"; + public static final String NOME_FULL = "prestadores.nome"; + public static final String NOME_PLAIN = "nome_plain"; + public static final String NOME_PLAIN_FULL = "prestadores.nome_plain"; + public static final String MORADA = "morada"; + public static final String MORADA_FULL = "prestadores.morada"; + public static final String CODIGO_POSTAL = "codigo_postal"; + public static final String CODIGO_POSTAL_FULL = "prestadores.codigo_postal"; + public static final String LOCALIDADE = "localidade"; + public static final String LOCALIDADE_FULL = "prestadores.localidade"; + public static final String LOCALIDADE_CP = "localidade_cp"; + public static final String LOCALIDADE_CP_FULL = "prestadores.localidade_cp"; + public static final String CONTACTO_ID = "contacto_id"; + public static final String CONTACTO_ID_FULL = "prestadores.contacto_id"; + public static final String TO_CONTACTO_ID = "to contacto_id"; + public static final String ACTIVO = "activo"; + public static final String ACTIVO_FULL = "prestadores.activo"; + public static final String FAZ_CONSULTAS = "faz_consultas"; + public static final String FAZ_CONSULTAS_FULL = "prestadores.faz_consultas"; + public static final String FAZ_ECDS = "faz_ecds"; + public static final String FAZ_ECDS_FULL = "prestadores.faz_ecds"; + public static final String CONTRIBUINTE = "contribuinte"; + public static final String CONTRIBUINTE_FULL = "prestadores.contribuinte"; + public static final String OBSERVACOES = "observacoes"; + public static final String OBSERVACOES_FULL = "prestadores.observacoes"; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, NOME_PLAIN, MORADA, CODIGO_POSTAL, LOCALIDADE, LOCALIDADE_CP, CONTACTO_ID, + TO_CONTACTO_ID, ACTIVO, FAZ_CONSULTAS, FAZ_ECDS, CONTRIBUINTE, OBSERVACOES, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, NOME, NOME_PLAIN, MORADA, CODIGO_POSTAL, LOCALIDADE, LOCALIDADE_CP, CONTACTO_ID, + ACTIVO, FAZ_CONSULTAS, FAZ_ECDS, CONTRIBUINTE, OBSERVACOES, }; + + private Map dataHash; + + public PrestadoresDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getNome() + { + return (String) get(NOME); + } + + public void setNome(String nomeValue ) + { + this.set(NOME, nomeValue ); + } + + public String getNome_plain() + { + return (String) get(NOME_PLAIN); + } + + public void setNome_plain(String nome_plainValue ) + { + this.set(NOME_PLAIN, nome_plainValue ); + } + + public String getMorada() + { + return (String) get(MORADA); + } + + public void setMorada(String moradaValue ) + { + this.set(MORADA, moradaValue ); + } + + public String getCodigo_postal() + { + return (String) get(CODIGO_POSTAL); + } + + public void setCodigo_postal(String codigo_postalValue ) + { + this.set(CODIGO_POSTAL, codigo_postalValue ); + } + + public String getLocalidade() + { + return (String) get(LOCALIDADE); + } + + public void setLocalidade(String localidadeValue ) + { + this.set(LOCALIDADE, localidadeValue ); + } + + public String getLocalidade_cp() + { + return (String) get(LOCALIDADE_CP); + } + + public void setLocalidade_cp(String localidade_cpValue ) + { + this.set(LOCALIDADE_CP, localidade_cpValue ); + } + + public Integer getContacto_id() + { + return (Integer) dataHash.get(CONTACTO_ID); + } + + public void setContacto_id(Integer contacto_idValue ) + { + dataHash.put(TO_CONTACTO_ID, null); + dataHash.put(CONTACTO_ID, contacto_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.ContactosData toContacto_id() + throws Exception + { + if( dataHash.get(TO_CONTACTO_ID) == null && getContacto_id() != null ) + { + dataHash.put(TO_CONTACTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.ContactosData.class, new Object[]{ getContacto_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.ContactosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.ContactosData) dataHash.get(TO_CONTACTO_ID); + } + + public void setToContacto_id(com.evolute.siprp.server.db.data.siprp_local3.ContactosData contacto_idObject ) + { + if( contacto_idObject == null ) + { + dataHash.put(CONTACTO_ID, null); + } + else + { + dataHash.put(CONTACTO_ID, contacto_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.ContactosData.ID )); + } + dataHash.put(TO_CONTACTO_ID, contacto_idObject); + } + + public String getActivo() + { + return (String) get(ACTIVO); + } + + public void setActivo(String activoValue ) + { + this.set(ACTIVO, activoValue ); + } + + public String getFaz_consultas() + { + return (String) get(FAZ_CONSULTAS); + } + + public void setFaz_consultas(String faz_consultasValue ) + { + this.set(FAZ_CONSULTAS, faz_consultasValue ); + } + + public String getFaz_ecds() + { + return (String) get(FAZ_ECDS); + } + + public void setFaz_ecds(String faz_ecdsValue ) + { + this.set(FAZ_ECDS, faz_ecdsValue ); + } + + public String getContribuinte() + { + return (String) get(CONTRIBUINTE); + } + + public void setContribuinte(String contribuinteValue ) + { + this.set(CONTRIBUINTE, contribuinteValue ); + } + + public String getObservacoes() + { + return (String) get(OBSERVACOES); + } + + public void setObservacoes(String observacoesValue ) + { + this.set(OBSERVACOES, observacoesValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( CONTACTO_ID.equals( fieldName ) ) + { + value = getContacto_id(); + } + else if( TO_CONTACTO_ID.equals( fieldName ) ) + { + value = toContacto_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( CONTACTO_ID.equals( fieldName ) ) + { + setContacto_id( (Integer) value ); + } + else if( TO_CONTACTO_ID.equals( fieldName ) ) + { + setToContacto_id( (com.evolute.siprp.server.db.data.siprp_local3.ContactosData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_CONTACTO_ID) != null ) + { + toContacto_id().save(); + dataHash.put(CONTACTO_ID, toContacto_id().get( com.evolute.siprp.server.db.data.siprp_local3.ContactosData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Prestadores.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrestadoresGruposProtocolo.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrestadoresGruposProtocolo.java new file mode 100644 index 00000000..e90dd764 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrestadoresGruposProtocolo.java @@ -0,0 +1,129 @@ +/* +* PrestadoresGruposProtocolo.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class PrestadoresGruposProtocolo implements JDOInnerObject +{ + private Integer id; + private Integer prestador_id; + private Integer grupo_protocolo_id; + + public PrestadoresGruposProtocolo() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == PrestadoresGruposProtocoloDataAuto.ID ) + { + return id; + } + else if( fieldName == PrestadoresGruposProtocoloDataAuto.PRESTADOR_ID ) + { + return prestador_id; + } + else if( fieldName == PrestadoresGruposProtocoloDataAuto.GRUPO_PROTOCOLO_ID ) + { + return grupo_protocolo_id; + } + else if( fieldName.equals( PrestadoresGruposProtocoloDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( PrestadoresGruposProtocoloDataAuto.PRESTADOR_ID ) ) + { + return prestador_id; + } + else if( fieldName.equals( PrestadoresGruposProtocoloDataAuto.GRUPO_PROTOCOLO_ID ) ) + { + return grupo_protocolo_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == PrestadoresGruposProtocoloDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == PrestadoresGruposProtocoloDataAuto.PRESTADOR_ID ) + { + prestador_id = ( Integer ) value; + } + else if( fieldName == PrestadoresGruposProtocoloDataAuto.GRUPO_PROTOCOLO_ID ) + { + grupo_protocolo_id = ( Integer ) value; + } + else if( fieldName.equals( PrestadoresGruposProtocoloDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( PrestadoresGruposProtocoloDataAuto.PRESTADOR_ID ) ) + { + prestador_id = ( Integer ) value; + } + else if( fieldName.equals( PrestadoresGruposProtocoloDataAuto.GRUPO_PROTOCOLO_ID ) ) + { + grupo_protocolo_id = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getPrestador_id() + { + return prestador_id; + } + + public void setPrestador_id(Integer prestador_idValue ) + { + this.prestador_id = prestador_idValue; + } + + public Integer getGrupo_protocolo_id() + { + return grupo_protocolo_id; + } + + public void setGrupo_protocolo_id(Integer grupo_protocolo_idValue ) + { + this.grupo_protocolo_id = grupo_protocolo_idValue; + } + + public Class getOuterClass() + { + return PrestadoresGruposProtocoloDataAuto.class; + } + + public PrestadoresGruposProtocoloDataAuto getOuterClassInstance() + { + PrestadoresGruposProtocoloDataAuto outerObj = new PrestadoresGruposProtocoloDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrestadoresGruposProtocoloData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrestadoresGruposProtocoloData.java new file mode 100644 index 00000000..0fbe0698 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrestadoresGruposProtocoloData.java @@ -0,0 +1,18 @@ +/* +* PrestadoresGruposProtocoloDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class PrestadoresGruposProtocoloData extends com.evolute.siprp.server.db.data.siprp_local3.PrestadoresGruposProtocoloDataAuto +{ + + public PrestadoresGruposProtocoloData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrestadoresGruposProtocoloDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrestadoresGruposProtocoloDataAuto.java new file mode 100644 index 00000000..43c2f0fd --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrestadoresGruposProtocoloDataAuto.java @@ -0,0 +1,213 @@ +/* +* PrestadoresGruposProtocoloDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class PrestadoresGruposProtocoloDataAuto extends JDOObject +{ + + public static final String TABLENAME = "prestadores_grupos_protocolo"; + + public static final String ID = "id"; + public static final String ID_FULL = "prestadores_grupos_protocolo.id"; + public static final String PRESTADOR_ID = "prestador_id"; + public static final String PRESTADOR_ID_FULL = "prestadores_grupos_protocolo.prestador_id"; + public static final String TO_PRESTADOR_ID = "to prestador_id"; + public static final String GRUPO_PROTOCOLO_ID = "grupo_protocolo_id"; + public static final String GRUPO_PROTOCOLO_ID_FULL = "prestadores_grupos_protocolo.grupo_protocolo_id"; + public static final String TO_GRUPO_PROTOCOLO_ID = "to grupo_protocolo_id"; + + public static final String FIELD_NAMES[] = new String[]{ + PRESTADOR_ID, TO_PRESTADOR_ID, GRUPO_PROTOCOLO_ID, TO_GRUPO_PROTOCOLO_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, PRESTADOR_ID, GRUPO_PROTOCOLO_ID, }; + + private Map dataHash; + + public PrestadoresGruposProtocoloDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getPrestador_id() + { + return (Integer) dataHash.get(PRESTADOR_ID); + } + + public void setPrestador_id(Integer prestador_idValue ) + { + dataHash.put(TO_PRESTADOR_ID, null); + dataHash.put(PRESTADOR_ID, prestador_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData toPrestador_id() + throws Exception + { + if( dataHash.get(TO_PRESTADOR_ID) == null && getPrestador_id() != null ) + { + dataHash.put(TO_PRESTADOR_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.class, new Object[]{ getPrestador_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) dataHash.get(TO_PRESTADOR_ID); + } + + public void setToPrestador_id(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData prestador_idObject ) + { + if( prestador_idObject == null ) + { + dataHash.put(PRESTADOR_ID, null); + } + else + { + dataHash.put(PRESTADOR_ID, prestador_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + dataHash.put(TO_PRESTADOR_ID, prestador_idObject); + } + + public Integer getGrupo_protocolo_id() + { + return (Integer) dataHash.get(GRUPO_PROTOCOLO_ID); + } + + public void setGrupo_protocolo_id(Integer grupo_protocolo_idValue ) + { + dataHash.put(TO_GRUPO_PROTOCOLO_ID, null); + dataHash.put(GRUPO_PROTOCOLO_ID, grupo_protocolo_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData toGrupo_protocolo_id() + throws Exception + { + if( dataHash.get(TO_GRUPO_PROTOCOLO_ID) == null && getGrupo_protocolo_id() != null ) + { + dataHash.put(TO_GRUPO_PROTOCOLO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData.class, new Object[]{ getGrupo_protocolo_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData) dataHash.get(TO_GRUPO_PROTOCOLO_ID); + } + + public void setToGrupo_protocolo_id(com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData grupo_protocolo_idObject ) + { + if( grupo_protocolo_idObject == null ) + { + dataHash.put(GRUPO_PROTOCOLO_ID, null); + } + else + { + dataHash.put(GRUPO_PROTOCOLO_ID, grupo_protocolo_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData.ID )); + } + dataHash.put(TO_GRUPO_PROTOCOLO_ID, grupo_protocolo_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_PRESTADOR_ID.equals( fieldName ) ) + { + value = toPrestador_id(); + } + else if( TO_GRUPO_PROTOCOLO_ID.equals( fieldName ) ) + { + value = toGrupo_protocolo_id(); + } + else if( PRESTADOR_ID.equals( fieldName ) ) + { + value = getPrestador_id(); + } + else if( GRUPO_PROTOCOLO_ID.equals( fieldName ) ) + { + value = getGrupo_protocolo_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_PRESTADOR_ID.equals( fieldName ) ) + { + setToPrestador_id( (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) value ); + } + else if( TO_GRUPO_PROTOCOLO_ID.equals( fieldName ) ) + { + setToGrupo_protocolo_id( (com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData) value ); + } + else if( PRESTADOR_ID.equals( fieldName ) ) + { + setPrestador_id( (Integer) value ); + } + else if( GRUPO_PROTOCOLO_ID.equals( fieldName ) ) + { + setGrupo_protocolo_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_PRESTADOR_ID) != null ) + { + toPrestador_id().save(); + dataHash.put(PRESTADOR_ID, toPrestador_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + + if( dataHash.get(TO_GRUPO_PROTOCOLO_ID) != null ) + { + toGrupo_protocolo_id().save(); + dataHash.put(GRUPO_PROTOCOLO_ID, toGrupo_protocolo_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return PrestadoresGruposProtocolo.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtElementosProtocolo.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtElementosProtocolo.java new file mode 100644 index 00000000..60c44e84 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtElementosProtocolo.java @@ -0,0 +1,156 @@ +/* +* PrtElementosProtocolo.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class PrtElementosProtocolo implements JDOInnerObject +{ + private Integer id; + private Integer tipo_elemento_protocolo_id; + private Integer empresa_id; + private Integer numero_perfil; + + public PrtElementosProtocolo() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == PrtElementosProtocoloDataAuto.ID ) + { + return id; + } + else if( fieldName == PrtElementosProtocoloDataAuto.TIPO_ELEMENTO_PROTOCOLO_ID ) + { + return tipo_elemento_protocolo_id; + } + else if( fieldName == PrtElementosProtocoloDataAuto.EMPRESA_ID ) + { + return empresa_id; + } + else if( fieldName == PrtElementosProtocoloDataAuto.NUMERO_PERFIL ) + { + return numero_perfil; + } + else if( fieldName.equals( PrtElementosProtocoloDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( PrtElementosProtocoloDataAuto.TIPO_ELEMENTO_PROTOCOLO_ID ) ) + { + return tipo_elemento_protocolo_id; + } + else if( fieldName.equals( PrtElementosProtocoloDataAuto.EMPRESA_ID ) ) + { + return empresa_id; + } + else if( fieldName.equals( PrtElementosProtocoloDataAuto.NUMERO_PERFIL ) ) + { + return numero_perfil; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == PrtElementosProtocoloDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == PrtElementosProtocoloDataAuto.TIPO_ELEMENTO_PROTOCOLO_ID ) + { + tipo_elemento_protocolo_id = ( Integer ) value; + } + else if( fieldName == PrtElementosProtocoloDataAuto.EMPRESA_ID ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName == PrtElementosProtocoloDataAuto.NUMERO_PERFIL ) + { + numero_perfil = ( Integer ) value; + } + else if( fieldName.equals( PrtElementosProtocoloDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( PrtElementosProtocoloDataAuto.TIPO_ELEMENTO_PROTOCOLO_ID ) ) + { + tipo_elemento_protocolo_id = ( Integer ) value; + } + else if( fieldName.equals( PrtElementosProtocoloDataAuto.EMPRESA_ID ) ) + { + empresa_id = ( Integer ) value; + } + else if( fieldName.equals( PrtElementosProtocoloDataAuto.NUMERO_PERFIL ) ) + { + numero_perfil = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getTipo_elemento_protocolo_id() + { + return tipo_elemento_protocolo_id; + } + + public void setTipo_elemento_protocolo_id(Integer tipo_elemento_protocolo_idValue ) + { + this.tipo_elemento_protocolo_id = tipo_elemento_protocolo_idValue; + } + + public Integer getEmpresa_id() + { + return empresa_id; + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + this.empresa_id = empresa_idValue; + } + + public Integer getNumero_perfil() + { + return numero_perfil; + } + + public void setNumero_perfil(Integer numero_perfilValue ) + { + this.numero_perfil = numero_perfilValue; + } + + public Class getOuterClass() + { + return PrtElementosProtocoloDataAuto.class; + } + + public PrtElementosProtocoloDataAuto getOuterClassInstance() + { + PrtElementosProtocoloDataAuto outerObj = new PrtElementosProtocoloDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtElementosProtocoloData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtElementosProtocoloData.java new file mode 100644 index 00000000..65546aa6 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtElementosProtocoloData.java @@ -0,0 +1,18 @@ +/* +* PrtElementosProtocoloDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class PrtElementosProtocoloData extends com.evolute.siprp.server.db.data.siprp_local3.PrtElementosProtocoloDataAuto +{ + + public PrtElementosProtocoloData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtElementosProtocoloDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtElementosProtocoloDataAuto.java new file mode 100644 index 00000000..f359651d --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtElementosProtocoloDataAuto.java @@ -0,0 +1,226 @@ +/* +* PrtElementosProtocoloDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class PrtElementosProtocoloDataAuto extends JDOObject +{ + + public static final String TABLENAME = "prt_elementos_protocolo"; + + public static final String ID = "id"; + public static final String ID_FULL = "prt_elementos_protocolo.id"; + public static final String TIPO_ELEMENTO_PROTOCOLO_ID = "tipo_elemento_protocolo_id"; + public static final String TIPO_ELEMENTO_PROTOCOLO_ID_FULL = "prt_elementos_protocolo.tipo_elemento_protocolo_id"; + public static final String TO_TIPO_ELEMENTO_PROTOCOLO_ID = "to tipo_elemento_protocolo_id"; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "prt_elementos_protocolo.empresa_id"; + public static final String TO_EMPRESA_ID = "to empresa_id"; + public static final String NUMERO_PERFIL = "numero_perfil"; + public static final String NUMERO_PERFIL_FULL = "prt_elementos_protocolo.numero_perfil"; + + public static final String FIELD_NAMES[] = new String[]{ + TIPO_ELEMENTO_PROTOCOLO_ID, TO_TIPO_ELEMENTO_PROTOCOLO_ID, EMPRESA_ID, + TO_EMPRESA_ID, NUMERO_PERFIL, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TIPO_ELEMENTO_PROTOCOLO_ID, EMPRESA_ID, NUMERO_PERFIL, }; + + private Map dataHash; + + public PrtElementosProtocoloDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getTipo_elemento_protocolo_id() + { + return (Integer) dataHash.get(TIPO_ELEMENTO_PROTOCOLO_ID); + } + + public void setTipo_elemento_protocolo_id(Integer tipo_elemento_protocolo_idValue ) + { + dataHash.put(TO_TIPO_ELEMENTO_PROTOCOLO_ID, null); + dataHash.put(TIPO_ELEMENTO_PROTOCOLO_ID, tipo_elemento_protocolo_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrtTiposElementosProtocoloData toTipo_elemento_protocolo_id() + throws Exception + { + if( dataHash.get(TO_TIPO_ELEMENTO_PROTOCOLO_ID) == null && getTipo_elemento_protocolo_id() != null ) + { + dataHash.put(TO_TIPO_ELEMENTO_PROTOCOLO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrtTiposElementosProtocoloData.class, new Object[]{ getTipo_elemento_protocolo_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrtTiposElementosProtocoloData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrtTiposElementosProtocoloData) dataHash.get(TO_TIPO_ELEMENTO_PROTOCOLO_ID); + } + + public void setToTipo_elemento_protocolo_id(com.evolute.siprp.server.db.data.siprp_local3.PrtTiposElementosProtocoloData tipo_elemento_protocolo_idObject ) + { + if( tipo_elemento_protocolo_idObject == null ) + { + dataHash.put(TIPO_ELEMENTO_PROTOCOLO_ID, null); + } + else + { + dataHash.put(TIPO_ELEMENTO_PROTOCOLO_ID, tipo_elemento_protocolo_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrtTiposElementosProtocoloData.ID )); + } + dataHash.put(TO_TIPO_ELEMENTO_PROTOCOLO_ID, tipo_elemento_protocolo_idObject); + } + + public Integer getEmpresa_id() + { + return (Integer) dataHash.get(EMPRESA_ID); + } + + public void setEmpresa_id(Integer empresa_idValue ) + { + dataHash.put(TO_EMPRESA_ID, null); + dataHash.put(EMPRESA_ID, empresa_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EmpresasData toEmpresa_id() + throws Exception + { + if( dataHash.get(TO_EMPRESA_ID) == null && getEmpresa_id() != null ) + { + dataHash.put(TO_EMPRESA_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.class, new Object[]{ getEmpresa_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) dataHash.get(TO_EMPRESA_ID); + } + + public void setToEmpresa_id(com.evolute.siprp.server.db.data.siprp_local3.EmpresasData empresa_idObject ) + { + if( empresa_idObject == null ) + { + dataHash.put(EMPRESA_ID, null); + } + else + { + dataHash.put(EMPRESA_ID, empresa_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + dataHash.put(TO_EMPRESA_ID, empresa_idObject); + } + + public Integer getNumero_perfil() + { + return (Integer) get(NUMERO_PERFIL); + } + + public void setNumero_perfil(Integer numero_perfilValue ) + { + this.set(NUMERO_PERFIL, numero_perfilValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_EMPRESA_ID.equals( fieldName ) ) + { + value = toEmpresa_id(); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + value = getEmpresa_id(); + } + else if( TO_TIPO_ELEMENTO_PROTOCOLO_ID.equals( fieldName ) ) + { + value = toTipo_elemento_protocolo_id(); + } + else if( TIPO_ELEMENTO_PROTOCOLO_ID.equals( fieldName ) ) + { + value = getTipo_elemento_protocolo_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_EMPRESA_ID.equals( fieldName ) ) + { + setToEmpresa_id( (com.evolute.siprp.server.db.data.siprp_local3.EmpresasData) value ); + } + else if( EMPRESA_ID.equals( fieldName ) ) + { + setEmpresa_id( (Integer) value ); + } + else if( TO_TIPO_ELEMENTO_PROTOCOLO_ID.equals( fieldName ) ) + { + setToTipo_elemento_protocolo_id( (com.evolute.siprp.server.db.data.siprp_local3.PrtTiposElementosProtocoloData) value ); + } + else if( TIPO_ELEMENTO_PROTOCOLO_ID.equals( fieldName ) ) + { + setTipo_elemento_protocolo_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_TIPO_ELEMENTO_PROTOCOLO_ID) != null ) + { + toTipo_elemento_protocolo_id().save(); + dataHash.put(TIPO_ELEMENTO_PROTOCOLO_ID, toTipo_elemento_protocolo_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrtTiposElementosProtocoloData.ID )); + } + + if( dataHash.get(TO_EMPRESA_ID) != null ) + { + toEmpresa_id().save(); + dataHash.put(EMPRESA_ID, toEmpresa_id().get( com.evolute.siprp.server.db.data.siprp_local3.EmpresasData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return PrtElementosProtocolo.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtGruposProtocolo.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtGruposProtocolo.java new file mode 100644 index 00000000..eca6062a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtGruposProtocolo.java @@ -0,0 +1,210 @@ +/* +* PrtGruposProtocolo.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class PrtGruposProtocolo implements JDOInnerObject +{ + private Integer id; + private String descricao; + private String descricao_plain; + private String grupo_real; + private Integer ordem; + private Integer analisador_id; + + public PrtGruposProtocolo() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == PrtGruposProtocoloDataAuto.ID ) + { + return id; + } + else if( fieldName == PrtGruposProtocoloDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName == PrtGruposProtocoloDataAuto.DESCRICAO_PLAIN ) + { + return descricao_plain; + } + else if( fieldName == PrtGruposProtocoloDataAuto.GRUPO_REAL ) + { + return grupo_real; + } + else if( fieldName == PrtGruposProtocoloDataAuto.ORDEM ) + { + return ordem; + } + else if( fieldName == PrtGruposProtocoloDataAuto.ANALISADOR_ID ) + { + return analisador_id; + } + else if( fieldName.equals( PrtGruposProtocoloDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( PrtGruposProtocoloDataAuto.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( PrtGruposProtocoloDataAuto.DESCRICAO_PLAIN ) ) + { + return descricao_plain; + } + else if( fieldName.equals( PrtGruposProtocoloDataAuto.GRUPO_REAL ) ) + { + return grupo_real; + } + else if( fieldName.equals( PrtGruposProtocoloDataAuto.ORDEM ) ) + { + return ordem; + } + else if( fieldName.equals( PrtGruposProtocoloDataAuto.ANALISADOR_ID ) ) + { + return analisador_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == PrtGruposProtocoloDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == PrtGruposProtocoloDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == PrtGruposProtocoloDataAuto.DESCRICAO_PLAIN ) + { + descricao_plain = ( String ) value; + } + else if( fieldName == PrtGruposProtocoloDataAuto.GRUPO_REAL ) + { + grupo_real = ( String ) value; + } + else if( fieldName == PrtGruposProtocoloDataAuto.ORDEM ) + { + ordem = ( Integer ) value; + } + else if( fieldName == PrtGruposProtocoloDataAuto.ANALISADOR_ID ) + { + analisador_id = ( Integer ) value; + } + else if( fieldName.equals( PrtGruposProtocoloDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( PrtGruposProtocoloDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( PrtGruposProtocoloDataAuto.DESCRICAO_PLAIN ) ) + { + descricao_plain = ( String ) value; + } + else if( fieldName.equals( PrtGruposProtocoloDataAuto.GRUPO_REAL ) ) + { + grupo_real = ( String ) value; + } + else if( fieldName.equals( PrtGruposProtocoloDataAuto.ORDEM ) ) + { + ordem = ( Integer ) value; + } + else if( fieldName.equals( PrtGruposProtocoloDataAuto.ANALISADOR_ID ) ) + { + analisador_id = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public String getDescricao_plain() + { + return descricao_plain; + } + + public void setDescricao_plain(String descricao_plainValue ) + { + this.descricao_plain = descricao_plainValue; + } + + public String getGrupo_real() + { + return grupo_real; + } + + public void setGrupo_real(String grupo_realValue ) + { + this.grupo_real = grupo_realValue; + } + + public Integer getOrdem() + { + return ordem; + } + + public void setOrdem(Integer ordemValue ) + { + this.ordem = ordemValue; + } + + public Integer getAnalisador_id() + { + return analisador_id; + } + + public void setAnalisador_id(Integer analisador_idValue ) + { + this.analisador_id = analisador_idValue; + } + + public Class getOuterClass() + { + return PrtGruposProtocoloDataAuto.class; + } + + public PrtGruposProtocoloDataAuto getOuterClassInstance() + { + PrtGruposProtocoloDataAuto outerObj = new PrtGruposProtocoloDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtGruposProtocoloData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtGruposProtocoloData.java new file mode 100644 index 00000000..b075f667 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtGruposProtocoloData.java @@ -0,0 +1,18 @@ +/* +* PrtGruposProtocoloDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class PrtGruposProtocoloData extends com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloDataAuto +{ + + public PrtGruposProtocoloData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtGruposProtocoloDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtGruposProtocoloDataAuto.java new file mode 100644 index 00000000..5153a05e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtGruposProtocoloDataAuto.java @@ -0,0 +1,202 @@ +/* +* PrtGruposProtocoloDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class PrtGruposProtocoloDataAuto extends JDOObject +{ + + public static final String TABLENAME = "prt_grupos_protocolo"; + + public static final String ID = "id"; + public static final String ID_FULL = "prt_grupos_protocolo.id"; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "prt_grupos_protocolo.descricao"; + public static final String DESCRICAO_PLAIN = "descricao_plain"; + public static final String DESCRICAO_PLAIN_FULL = "prt_grupos_protocolo.descricao_plain"; + public static final String GRUPO_REAL = "grupo_real"; + public static final String GRUPO_REAL_FULL = "prt_grupos_protocolo.grupo_real"; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "prt_grupos_protocolo.ordem"; + public static final String ANALISADOR_ID = "analisador_id"; + public static final String ANALISADOR_ID_FULL = "prt_grupos_protocolo.analisador_id"; + public static final String TO_ANALISADOR_ID = "to analisador_id"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRICAO, DESCRICAO_PLAIN, GRUPO_REAL, ORDEM, ANALISADOR_ID, TO_ANALISADOR_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DESCRICAO, DESCRICAO_PLAIN, GRUPO_REAL, ORDEM, ANALISADOR_ID, }; + + private Map dataHash; + + public PrtGruposProtocoloDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + public String getDescricao_plain() + { + return (String) get(DESCRICAO_PLAIN); + } + + public void setDescricao_plain(String descricao_plainValue ) + { + this.set(DESCRICAO_PLAIN, descricao_plainValue ); + } + + public String getGrupo_real() + { + return (String) get(GRUPO_REAL); + } + + public void setGrupo_real(String grupo_realValue ) + { + this.set(GRUPO_REAL, grupo_realValue ); + } + + public Integer getOrdem() + { + return (Integer) get(ORDEM); + } + + public void setOrdem(Integer ordemValue ) + { + this.set(ORDEM, ordemValue ); + } + + public Integer getAnalisador_id() + { + return (Integer) dataHash.get(ANALISADOR_ID); + } + + public void setAnalisador_id(Integer analisador_idValue ) + { + dataHash.put(TO_ANALISADOR_ID, null); + dataHash.put(ANALISADOR_ID, analisador_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData toAnalisador_id() + throws Exception + { + if( dataHash.get(TO_ANALISADOR_ID) == null && getAnalisador_id() != null ) + { + dataHash.put(TO_ANALISADOR_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.class, new Object[]{ getAnalisador_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) dataHash.get(TO_ANALISADOR_ID); + } + + public void setToAnalisador_id(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData analisador_idObject ) + { + if( analisador_idObject == null ) + { + dataHash.put(ANALISADOR_ID, null); + } + else + { + dataHash.put(ANALISADOR_ID, analisador_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + dataHash.put(TO_ANALISADOR_ID, analisador_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( ANALISADOR_ID.equals( fieldName ) ) + { + value = getAnalisador_id(); + } + else if( TO_ANALISADOR_ID.equals( fieldName ) ) + { + value = toAnalisador_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( ANALISADOR_ID.equals( fieldName ) ) + { + setAnalisador_id( (Integer) value ); + } + else if( TO_ANALISADOR_ID.equals( fieldName ) ) + { + setToAnalisador_id( (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_ANALISADOR_ID) != null ) + { + toAnalisador_id().save(); + dataHash.put(ANALISADOR_ID, toAnalisador_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return PrtGruposProtocolo.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtTiposElementosProtocolo.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtTiposElementosProtocolo.java new file mode 100644 index 00000000..4ca19310 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtTiposElementosProtocolo.java @@ -0,0 +1,183 @@ +/* +* PrtTiposElementosProtocolo.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class PrtTiposElementosProtocolo implements JDOInnerObject +{ + private Integer id; + private String descricao_plain; + private String descricao; + private Integer grupo_protocolo_id; + private Integer ordem; + + public PrtTiposElementosProtocolo() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == PrtTiposElementosProtocoloDataAuto.ID ) + { + return id; + } + else if( fieldName == PrtTiposElementosProtocoloDataAuto.DESCRICAO_PLAIN ) + { + return descricao_plain; + } + else if( fieldName == PrtTiposElementosProtocoloDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName == PrtTiposElementosProtocoloDataAuto.GRUPO_PROTOCOLO_ID ) + { + return grupo_protocolo_id; + } + else if( fieldName == PrtTiposElementosProtocoloDataAuto.ORDEM ) + { + return ordem; + } + else if( fieldName.equals( PrtTiposElementosProtocoloDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( PrtTiposElementosProtocoloDataAuto.DESCRICAO_PLAIN ) ) + { + return descricao_plain; + } + else if( fieldName.equals( PrtTiposElementosProtocoloDataAuto.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( PrtTiposElementosProtocoloDataAuto.GRUPO_PROTOCOLO_ID ) ) + { + return grupo_protocolo_id; + } + else if( fieldName.equals( PrtTiposElementosProtocoloDataAuto.ORDEM ) ) + { + return ordem; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == PrtTiposElementosProtocoloDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == PrtTiposElementosProtocoloDataAuto.DESCRICAO_PLAIN ) + { + descricao_plain = ( String ) value; + } + else if( fieldName == PrtTiposElementosProtocoloDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == PrtTiposElementosProtocoloDataAuto.GRUPO_PROTOCOLO_ID ) + { + grupo_protocolo_id = ( Integer ) value; + } + else if( fieldName == PrtTiposElementosProtocoloDataAuto.ORDEM ) + { + ordem = ( Integer ) value; + } + else if( fieldName.equals( PrtTiposElementosProtocoloDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( PrtTiposElementosProtocoloDataAuto.DESCRICAO_PLAIN ) ) + { + descricao_plain = ( String ) value; + } + else if( fieldName.equals( PrtTiposElementosProtocoloDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( PrtTiposElementosProtocoloDataAuto.GRUPO_PROTOCOLO_ID ) ) + { + grupo_protocolo_id = ( Integer ) value; + } + else if( fieldName.equals( PrtTiposElementosProtocoloDataAuto.ORDEM ) ) + { + ordem = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getDescricao_plain() + { + return descricao_plain; + } + + public void setDescricao_plain(String descricao_plainValue ) + { + this.descricao_plain = descricao_plainValue; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public Integer getGrupo_protocolo_id() + { + return grupo_protocolo_id; + } + + public void setGrupo_protocolo_id(Integer grupo_protocolo_idValue ) + { + this.grupo_protocolo_id = grupo_protocolo_idValue; + } + + public Integer getOrdem() + { + return ordem; + } + + public void setOrdem(Integer ordemValue ) + { + this.ordem = ordemValue; + } + + public Class getOuterClass() + { + return PrtTiposElementosProtocoloDataAuto.class; + } + + public PrtTiposElementosProtocoloDataAuto getOuterClassInstance() + { + PrtTiposElementosProtocoloDataAuto outerObj = new PrtTiposElementosProtocoloDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtTiposElementosProtocoloData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtTiposElementosProtocoloData.java new file mode 100644 index 00000000..9c5b91d8 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtTiposElementosProtocoloData.java @@ -0,0 +1,18 @@ +/* +* PrtTiposElementosProtocoloDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class PrtTiposElementosProtocoloData extends com.evolute.siprp.server.db.data.siprp_local3.PrtTiposElementosProtocoloDataAuto +{ + + public PrtTiposElementosProtocoloData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtTiposElementosProtocoloDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtTiposElementosProtocoloDataAuto.java new file mode 100644 index 00000000..27b210ac --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/PrtTiposElementosProtocoloDataAuto.java @@ -0,0 +1,190 @@ +/* +* PrtTiposElementosProtocoloDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class PrtTiposElementosProtocoloDataAuto extends JDOObject +{ + + public static final String TABLENAME = "prt_tipos_elementos_protocolo"; + + public static final String ID = "id"; + public static final String ID_FULL = "prt_tipos_elementos_protocolo.id"; + public static final String DESCRICAO_PLAIN = "descricao_plain"; + public static final String DESCRICAO_PLAIN_FULL = "prt_tipos_elementos_protocolo.descricao_plain"; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "prt_tipos_elementos_protocolo.descricao"; + public static final String GRUPO_PROTOCOLO_ID = "grupo_protocolo_id"; + public static final String GRUPO_PROTOCOLO_ID_FULL = "prt_tipos_elementos_protocolo.grupo_protocolo_id"; + public static final String TO_GRUPO_PROTOCOLO_ID = "to grupo_protocolo_id"; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "prt_tipos_elementos_protocolo.ordem"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRICAO_PLAIN, DESCRICAO, GRUPO_PROTOCOLO_ID, TO_GRUPO_PROTOCOLO_ID, ORDEM, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DESCRICAO_PLAIN, DESCRICAO, GRUPO_PROTOCOLO_ID, ORDEM, }; + + private Map dataHash; + + public PrtTiposElementosProtocoloDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getDescricao_plain() + { + return (String) get(DESCRICAO_PLAIN); + } + + public void setDescricao_plain(String descricao_plainValue ) + { + this.set(DESCRICAO_PLAIN, descricao_plainValue ); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + public Integer getGrupo_protocolo_id() + { + return (Integer) dataHash.get(GRUPO_PROTOCOLO_ID); + } + + public void setGrupo_protocolo_id(Integer grupo_protocolo_idValue ) + { + dataHash.put(TO_GRUPO_PROTOCOLO_ID, null); + dataHash.put(GRUPO_PROTOCOLO_ID, grupo_protocolo_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData toGrupo_protocolo_id() + throws Exception + { + if( dataHash.get(TO_GRUPO_PROTOCOLO_ID) == null && getGrupo_protocolo_id() != null ) + { + dataHash.put(TO_GRUPO_PROTOCOLO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData.class, new Object[]{ getGrupo_protocolo_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData) dataHash.get(TO_GRUPO_PROTOCOLO_ID); + } + + public void setToGrupo_protocolo_id(com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData grupo_protocolo_idObject ) + { + if( grupo_protocolo_idObject == null ) + { + dataHash.put(GRUPO_PROTOCOLO_ID, null); + } + else + { + dataHash.put(GRUPO_PROTOCOLO_ID, grupo_protocolo_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData.ID )); + } + dataHash.put(TO_GRUPO_PROTOCOLO_ID, grupo_protocolo_idObject); + } + + public Integer getOrdem() + { + return (Integer) get(ORDEM); + } + + public void setOrdem(Integer ordemValue ) + { + this.set(ORDEM, ordemValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_GRUPO_PROTOCOLO_ID.equals( fieldName ) ) + { + value = toGrupo_protocolo_id(); + } + else if( GRUPO_PROTOCOLO_ID.equals( fieldName ) ) + { + value = getGrupo_protocolo_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_GRUPO_PROTOCOLO_ID.equals( fieldName ) ) + { + setToGrupo_protocolo_id( (com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData) value ); + } + else if( GRUPO_PROTOCOLO_ID.equals( fieldName ) ) + { + setGrupo_protocolo_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_GRUPO_PROTOCOLO_ID) != null ) + { + toGrupo_protocolo_id().save(); + dataHash.put(GRUPO_PROTOCOLO_ID, toGrupo_protocolo_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return PrtTiposElementosProtocolo.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TiposExamesComp.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TiposExamesComp.java new file mode 100644 index 00000000..df1c82a3 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TiposExamesComp.java @@ -0,0 +1,129 @@ +/* +* TiposExamesComp.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class TiposExamesComp implements JDOInnerObject +{ + private Integer id; + private Integer ordem; + private String descricao; + + public TiposExamesComp() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TiposExamesCompDataAuto.ID ) + { + return id; + } + else if( fieldName == TiposExamesCompDataAuto.ORDEM ) + { + return ordem; + } + else if( fieldName == TiposExamesCompDataAuto.DESCRICAO ) + { + return descricao; + } + else if( fieldName.equals( TiposExamesCompDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( TiposExamesCompDataAuto.ORDEM ) ) + { + return ordem; + } + else if( fieldName.equals( TiposExamesCompDataAuto.DESCRICAO ) ) + { + return descricao; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TiposExamesCompDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TiposExamesCompDataAuto.ORDEM ) + { + ordem = ( Integer ) value; + } + else if( fieldName == TiposExamesCompDataAuto.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( TiposExamesCompDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TiposExamesCompDataAuto.ORDEM ) ) + { + ordem = ( Integer ) value; + } + else if( fieldName.equals( TiposExamesCompDataAuto.DESCRICAO ) ) + { + descricao = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getOrdem() + { + return ordem; + } + + public void setOrdem(Integer ordemValue ) + { + this.ordem = ordemValue; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricaoValue ) + { + this.descricao = descricaoValue; + } + + public Class getOuterClass() + { + return TiposExamesCompDataAuto.class; + } + + public TiposExamesCompDataAuto getOuterClassInstance() + { + TiposExamesCompDataAuto outerObj = new TiposExamesCompDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TiposExamesCompData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TiposExamesCompData.java new file mode 100644 index 00000000..42cf3d41 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TiposExamesCompData.java @@ -0,0 +1,18 @@ +/* +* TiposExamesCompDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class TiposExamesCompData extends com.evolute.siprp.server.db.data.siprp_local3.TiposExamesCompDataAuto +{ + + public TiposExamesCompData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TiposExamesCompDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TiposExamesCompDataAuto.java new file mode 100644 index 00000000..2b340361 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TiposExamesCompDataAuto.java @@ -0,0 +1,107 @@ +/* +* TiposExamesCompDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class TiposExamesCompDataAuto extends JDOObject +{ + + public static final String TABLENAME = "tipos_exames_comp"; + + public static final String ID = "id"; + public static final String ID_FULL = "tipos_exames_comp.id"; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "tipos_exames_comp.ordem"; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "tipos_exames_comp.descricao"; + + public static final String FIELD_NAMES[] = new String[]{ + ORDEM, DESCRICAO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, ORDEM, DESCRICAO, }; + + private Map dataHash; + + public TiposExamesCompDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getOrdem() + { + return (Integer) get(ORDEM); + } + + public void setOrdem(Integer ordemValue ) + { + this.set(ORDEM, ordemValue ); + } + + public String getDescricao() + { + return (String) get(DESCRICAO); + } + + public void setDescricao(String descricaoValue ) + { + this.set(DESCRICAO, descricaoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TiposExamesComp.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Trabalhadores.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Trabalhadores.java new file mode 100644 index 00000000..6cac4452 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Trabalhadores.java @@ -0,0 +1,588 @@ +/* +* Trabalhadores.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class Trabalhadores implements JDOInnerObject +{ + private Integer id; + private String nome; + private String sexo; + private java.util.Date data_nascimento; + private String nacionalidade; + private String numero_mecanografico; + private java.util.Date data_admissao; + private String categoria; + private String local_trabalho; + private String funcao_proposta; + private java.util.Date data_admissao_funcao; + private String observacoes; + private String inactivo; + private Integer estabelecimento_id; + private java.util.Date data_demissao; + private String observacoes_gestao; + private Integer perfil; + private java.sql.Timestamp actualizacao; + private String nome_plain; + private String bi; + + public Trabalhadores() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresDataAuto.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresDataAuto.NOME ) + { + return nome; + } + else if( fieldName == TrabalhadoresDataAuto.SEXO ) + { + return sexo; + } + else if( fieldName == TrabalhadoresDataAuto.DATA_NASCIMENTO ) + { + return data_nascimento; + } + else if( fieldName == TrabalhadoresDataAuto.NACIONALIDADE ) + { + return nacionalidade; + } + else if( fieldName == TrabalhadoresDataAuto.NUMERO_MECANOGRAFICO ) + { + return numero_mecanografico; + } + else if( fieldName == TrabalhadoresDataAuto.DATA_ADMISSAO ) + { + return data_admissao; + } + else if( fieldName == TrabalhadoresDataAuto.CATEGORIA ) + { + return categoria; + } + else if( fieldName == TrabalhadoresDataAuto.LOCAL_TRABALHO ) + { + return local_trabalho; + } + else if( fieldName == TrabalhadoresDataAuto.FUNCAO_PROPOSTA ) + { + return funcao_proposta; + } + else if( fieldName == TrabalhadoresDataAuto.DATA_ADMISSAO_FUNCAO ) + { + return data_admissao_funcao; + } + else if( fieldName == TrabalhadoresDataAuto.OBSERVACOES ) + { + return observacoes; + } + else if( fieldName == TrabalhadoresDataAuto.INACTIVO ) + { + return inactivo; + } + else if( fieldName == TrabalhadoresDataAuto.ESTABELECIMENTO_ID ) + { + return estabelecimento_id; + } + else if( fieldName == TrabalhadoresDataAuto.DATA_DEMISSAO ) + { + return data_demissao; + } + else if( fieldName == TrabalhadoresDataAuto.OBSERVACOES_GESTAO ) + { + return observacoes_gestao; + } + else if( fieldName == TrabalhadoresDataAuto.PERFIL ) + { + return perfil; + } + else if( fieldName == TrabalhadoresDataAuto.ACTUALIZACAO ) + { + return actualizacao; + } + else if( fieldName == TrabalhadoresDataAuto.NOME_PLAIN ) + { + return nome_plain; + } + else if( fieldName == TrabalhadoresDataAuto.BI ) + { + return bi; + } + else if( fieldName.equals( TrabalhadoresDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresDataAuto.NOME ) ) + { + return nome; + } + else if( fieldName.equals( TrabalhadoresDataAuto.SEXO ) ) + { + return sexo; + } + else if( fieldName.equals( TrabalhadoresDataAuto.DATA_NASCIMENTO ) ) + { + return data_nascimento; + } + else if( fieldName.equals( TrabalhadoresDataAuto.NACIONALIDADE ) ) + { + return nacionalidade; + } + else if( fieldName.equals( TrabalhadoresDataAuto.NUMERO_MECANOGRAFICO ) ) + { + return numero_mecanografico; + } + else if( fieldName.equals( TrabalhadoresDataAuto.DATA_ADMISSAO ) ) + { + return data_admissao; + } + else if( fieldName.equals( TrabalhadoresDataAuto.CATEGORIA ) ) + { + return categoria; + } + else if( fieldName.equals( TrabalhadoresDataAuto.LOCAL_TRABALHO ) ) + { + return local_trabalho; + } + else if( fieldName.equals( TrabalhadoresDataAuto.FUNCAO_PROPOSTA ) ) + { + return funcao_proposta; + } + else if( fieldName.equals( TrabalhadoresDataAuto.DATA_ADMISSAO_FUNCAO ) ) + { + return data_admissao_funcao; + } + else if( fieldName.equals( TrabalhadoresDataAuto.OBSERVACOES ) ) + { + return observacoes; + } + else if( fieldName.equals( TrabalhadoresDataAuto.INACTIVO ) ) + { + return inactivo; + } + else if( fieldName.equals( TrabalhadoresDataAuto.ESTABELECIMENTO_ID ) ) + { + return estabelecimento_id; + } + else if( fieldName.equals( TrabalhadoresDataAuto.DATA_DEMISSAO ) ) + { + return data_demissao; + } + else if( fieldName.equals( TrabalhadoresDataAuto.OBSERVACOES_GESTAO ) ) + { + return observacoes_gestao; + } + else if( fieldName.equals( TrabalhadoresDataAuto.PERFIL ) ) + { + return perfil; + } + else if( fieldName.equals( TrabalhadoresDataAuto.ACTUALIZACAO ) ) + { + return actualizacao; + } + else if( fieldName.equals( TrabalhadoresDataAuto.NOME_PLAIN ) ) + { + return nome_plain; + } + else if( fieldName.equals( TrabalhadoresDataAuto.BI ) ) + { + return bi; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresDataAuto.NOME ) + { + nome = ( String ) value; + } + else if( fieldName == TrabalhadoresDataAuto.SEXO ) + { + sexo = ( String ) value; + } + else if( fieldName == TrabalhadoresDataAuto.DATA_NASCIMENTO ) + { + data_nascimento = ( java.util.Date ) value; + } + else if( fieldName == TrabalhadoresDataAuto.NACIONALIDADE ) + { + nacionalidade = ( String ) value; + } + else if( fieldName == TrabalhadoresDataAuto.NUMERO_MECANOGRAFICO ) + { + numero_mecanografico = ( String ) value; + } + else if( fieldName == TrabalhadoresDataAuto.DATA_ADMISSAO ) + { + data_admissao = ( java.util.Date ) value; + } + else if( fieldName == TrabalhadoresDataAuto.CATEGORIA ) + { + categoria = ( String ) value; + } + else if( fieldName == TrabalhadoresDataAuto.LOCAL_TRABALHO ) + { + local_trabalho = ( String ) value; + } + else if( fieldName == TrabalhadoresDataAuto.FUNCAO_PROPOSTA ) + { + funcao_proposta = ( String ) value; + } + else if( fieldName == TrabalhadoresDataAuto.DATA_ADMISSAO_FUNCAO ) + { + data_admissao_funcao = ( java.util.Date ) value; + } + else if( fieldName == TrabalhadoresDataAuto.OBSERVACOES ) + { + observacoes = ( String ) value; + } + else if( fieldName == TrabalhadoresDataAuto.INACTIVO ) + { + inactivo = ( String ) value; + } + else if( fieldName == TrabalhadoresDataAuto.ESTABELECIMENTO_ID ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresDataAuto.DATA_DEMISSAO ) + { + data_demissao = ( java.util.Date ) value; + } + else if( fieldName == TrabalhadoresDataAuto.OBSERVACOES_GESTAO ) + { + observacoes_gestao = ( String ) value; + } + else if( fieldName == TrabalhadoresDataAuto.PERFIL ) + { + perfil = ( Integer ) value; + } + else if( fieldName == TrabalhadoresDataAuto.ACTUALIZACAO ) + { + actualizacao = ( java.sql.Timestamp ) value; + } + else if( fieldName == TrabalhadoresDataAuto.NOME_PLAIN ) + { + nome_plain = ( String ) value; + } + else if( fieldName == TrabalhadoresDataAuto.BI ) + { + bi = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.NOME ) ) + { + nome = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.SEXO ) ) + { + sexo = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.DATA_NASCIMENTO ) ) + { + data_nascimento = ( java.util.Date ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.NACIONALIDADE ) ) + { + nacionalidade = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.NUMERO_MECANOGRAFICO ) ) + { + numero_mecanografico = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.DATA_ADMISSAO ) ) + { + data_admissao = ( java.util.Date ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.CATEGORIA ) ) + { + categoria = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.LOCAL_TRABALHO ) ) + { + local_trabalho = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.FUNCAO_PROPOSTA ) ) + { + funcao_proposta = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.DATA_ADMISSAO_FUNCAO ) ) + { + data_admissao_funcao = ( java.util.Date ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.OBSERVACOES ) ) + { + observacoes = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.INACTIVO ) ) + { + inactivo = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.ESTABELECIMENTO_ID ) ) + { + estabelecimento_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.DATA_DEMISSAO ) ) + { + data_demissao = ( java.util.Date ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.OBSERVACOES_GESTAO ) ) + { + observacoes_gestao = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.PERFIL ) ) + { + perfil = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.ACTUALIZACAO ) ) + { + actualizacao = ( java.sql.Timestamp ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.NOME_PLAIN ) ) + { + nome_plain = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresDataAuto.BI ) ) + { + bi = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public String getNome() + { + return nome; + } + + public void setNome(String nomeValue ) + { + this.nome = nomeValue; + } + + public String getSexo() + { + return sexo; + } + + public void setSexo(String sexoValue ) + { + this.sexo = sexoValue; + } + + public java.util.Date getData_nascimento() + { + return data_nascimento; + } + + public void setData_nascimento(java.util.Date data_nascimentoValue ) + { + this.data_nascimento = data_nascimentoValue; + } + + public String getNacionalidade() + { + return nacionalidade; + } + + public void setNacionalidade(String nacionalidadeValue ) + { + this.nacionalidade = nacionalidadeValue; + } + + public String getNumero_mecanografico() + { + return numero_mecanografico; + } + + public void setNumero_mecanografico(String numero_mecanograficoValue ) + { + this.numero_mecanografico = numero_mecanograficoValue; + } + + public java.util.Date getData_admissao() + { + return data_admissao; + } + + public void setData_admissao(java.util.Date data_admissaoValue ) + { + this.data_admissao = data_admissaoValue; + } + + public String getCategoria() + { + return categoria; + } + + public void setCategoria(String categoriaValue ) + { + this.categoria = categoriaValue; + } + + public String getLocal_trabalho() + { + return local_trabalho; + } + + public void setLocal_trabalho(String local_trabalhoValue ) + { + this.local_trabalho = local_trabalhoValue; + } + + public String getFuncao_proposta() + { + return funcao_proposta; + } + + public void setFuncao_proposta(String funcao_propostaValue ) + { + this.funcao_proposta = funcao_propostaValue; + } + + public java.util.Date getData_admissao_funcao() + { + return data_admissao_funcao; + } + + public void setData_admissao_funcao(java.util.Date data_admissao_funcaoValue ) + { + this.data_admissao_funcao = data_admissao_funcaoValue; + } + + public String getObservacoes() + { + return observacoes; + } + + public void setObservacoes(String observacoesValue ) + { + this.observacoes = observacoesValue; + } + + public String getInactivo() + { + return inactivo; + } + + public void setInactivo(String inactivoValue ) + { + this.inactivo = inactivoValue; + } + + public Integer getEstabelecimento_id() + { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + this.estabelecimento_id = estabelecimento_idValue; + } + + public java.util.Date getData_demissao() + { + return data_demissao; + } + + public void setData_demissao(java.util.Date data_demissaoValue ) + { + this.data_demissao = data_demissaoValue; + } + + public String getObservacoes_gestao() + { + return observacoes_gestao; + } + + public void setObservacoes_gestao(String observacoes_gestaoValue ) + { + this.observacoes_gestao = observacoes_gestaoValue; + } + + public Integer getPerfil() + { + return perfil; + } + + public void setPerfil(Integer perfilValue ) + { + this.perfil = perfilValue; + } + + public java.sql.Timestamp getActualizacao() + { + return actualizacao; + } + + public void setActualizacao(java.sql.Timestamp actualizacaoValue ) + { + this.actualizacao = actualizacaoValue; + } + + public String getNome_plain() + { + return nome_plain; + } + + public void setNome_plain(String nome_plainValue ) + { + this.nome_plain = nome_plainValue; + } + + public String getBi() + { + return bi; + } + + public void setBi(String biValue ) + { + this.bi = biValue; + } + + public Class getOuterClass() + { + return TrabalhadoresDataAuto.class; + } + + public TrabalhadoresDataAuto getOuterClassInstance() + { + TrabalhadoresDataAuto outerObj = new TrabalhadoresDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultas.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultas.java new file mode 100644 index 00000000..5a6f955e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultas.java @@ -0,0 +1,210 @@ +/* +* TrabalhadoresConsultas.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresConsultas implements JDOInnerObject +{ + private Integer id; + private Integer trabalhador_id; + private java.util.Date data; + private Integer estado; + private Integer prestador_id; + private Integer processo_id; + + public TrabalhadoresConsultas() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresConsultasDataAuto.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresConsultasDataAuto.TRABALHADOR_ID ) + { + return trabalhador_id; + } + else if( fieldName == TrabalhadoresConsultasDataAuto.DATA ) + { + return data; + } + else if( fieldName == TrabalhadoresConsultasDataAuto.ESTADO ) + { + return estado; + } + else if( fieldName == TrabalhadoresConsultasDataAuto.PRESTADOR_ID ) + { + return prestador_id; + } + else if( fieldName == TrabalhadoresConsultasDataAuto.PROCESSO_ID ) + { + return processo_id; + } + else if( fieldName.equals( TrabalhadoresConsultasDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresConsultasDataAuto.TRABALHADOR_ID ) ) + { + return trabalhador_id; + } + else if( fieldName.equals( TrabalhadoresConsultasDataAuto.DATA ) ) + { + return data; + } + else if( fieldName.equals( TrabalhadoresConsultasDataAuto.ESTADO ) ) + { + return estado; + } + else if( fieldName.equals( TrabalhadoresConsultasDataAuto.PRESTADOR_ID ) ) + { + return prestador_id; + } + else if( fieldName.equals( TrabalhadoresConsultasDataAuto.PROCESSO_ID ) ) + { + return processo_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresConsultasDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasDataAuto.TRABALHADOR_ID ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasDataAuto.DATA ) + { + data = ( java.util.Date ) value; + } + else if( fieldName == TrabalhadoresConsultasDataAuto.ESTADO ) + { + estado = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasDataAuto.PRESTADOR_ID ) + { + prestador_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasDataAuto.PROCESSO_ID ) + { + processo_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDataAuto.TRABALHADOR_ID ) ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDataAuto.DATA ) ) + { + data = ( java.util.Date ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDataAuto.ESTADO ) ) + { + estado = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDataAuto.PRESTADOR_ID ) ) + { + prestador_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDataAuto.PROCESSO_ID ) ) + { + processo_id = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getTrabalhador_id() + { + return trabalhador_id; + } + + public void setTrabalhador_id(Integer trabalhador_idValue ) + { + this.trabalhador_id = trabalhador_idValue; + } + + public java.util.Date getData() + { + return data; + } + + public void setData(java.util.Date dataValue ) + { + this.data = dataValue; + } + + public Integer getEstado() + { + return estado; + } + + public void setEstado(Integer estadoValue ) + { + this.estado = estadoValue; + } + + public Integer getPrestador_id() + { + return prestador_id; + } + + public void setPrestador_id(Integer prestador_idValue ) + { + this.prestador_id = prestador_idValue; + } + + public Integer getProcesso_id() + { + return processo_id; + } + + public void setProcesso_id(Integer processo_idValue ) + { + this.processo_id = processo_idValue; + } + + public Class getOuterClass() + { + return TrabalhadoresConsultasDataAuto.class; + } + + public TrabalhadoresConsultasDataAuto getOuterClassInstance() + { + TrabalhadoresConsultasDataAuto outerObj = new TrabalhadoresConsultasDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasData.java new file mode 100644 index 00000000..94f2718e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasData.java @@ -0,0 +1,18 @@ +/* +* TrabalhadoresConsultasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class TrabalhadoresConsultasData extends com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDataAuto +{ + + public TrabalhadoresConsultasData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDataAuto.java new file mode 100644 index 00000000..19e2916f --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDataAuto.java @@ -0,0 +1,297 @@ +/* +* TrabalhadoresConsultasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class TrabalhadoresConsultasDataAuto extends JDOObject +{ + + public static final String TABLENAME = "trabalhadores_consultas"; + + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_consultas.id"; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String TRABALHADOR_ID_FULL = "trabalhadores_consultas.trabalhador_id"; + public static final String TO_TRABALHADOR_ID = "to trabalhador_id"; + public static final String DATA = "data"; + public static final String DATA_FULL = "trabalhadores_consultas.data"; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "trabalhadores_consultas.estado"; + public static final String PRESTADOR_ID = "prestador_id"; + public static final String PRESTADOR_ID_FULL = "trabalhadores_consultas.prestador_id"; + public static final String TO_PRESTADOR_ID = "to prestador_id"; + public static final String PROCESSO_ID = "processo_id"; + public static final String PROCESSO_ID_FULL = "trabalhadores_consultas.processo_id"; + public static final String TO_PROCESSO_ID = "to processo_id"; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADOR_ID, TO_TRABALHADOR_ID, DATA, ESTADO, PRESTADOR_ID, TO_PRESTADOR_ID, + PROCESSO_ID, TO_PROCESSO_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TRABALHADOR_ID, DATA, ESTADO, PRESTADOR_ID, PROCESSO_ID, }; + + private Map dataHash; + + public TrabalhadoresConsultasDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getTrabalhador_id() + { + return (Integer) dataHash.get(TRABALHADOR_ID); + } + + public void setTrabalhador_id(Integer trabalhador_idValue ) + { + dataHash.put(TO_TRABALHADOR_ID, null); + dataHash.put(TRABALHADOR_ID, trabalhador_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData toTrabalhador_id() + throws Exception + { + if( dataHash.get(TO_TRABALHADOR_ID) == null && getTrabalhador_id() != null ) + { + dataHash.put(TO_TRABALHADOR_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData.class, new Object[]{ getTrabalhador_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData) dataHash.get(TO_TRABALHADOR_ID); + } + + public void setToTrabalhador_id(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData trabalhador_idObject ) + { + if( trabalhador_idObject == null ) + { + dataHash.put(TRABALHADOR_ID, null); + } + else + { + dataHash.put(TRABALHADOR_ID, trabalhador_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData.ID )); + } + dataHash.put(TO_TRABALHADOR_ID, trabalhador_idObject); + } + + public java.util.Date getData() + { + return (java.util.Date) get(DATA); + } + + public void setData(java.util.Date dataValue ) + { + this.set(DATA, dataValue ); + } + + public Integer getEstado() + { + return (Integer) get(ESTADO); + } + + public void setEstado(Integer estadoValue ) + { + this.set(ESTADO, estadoValue ); + } + + public Integer getPrestador_id() + { + return (Integer) dataHash.get(PRESTADOR_ID); + } + + public void setPrestador_id(Integer prestador_idValue ) + { + dataHash.put(TO_PRESTADOR_ID, null); + dataHash.put(PRESTADOR_ID, prestador_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData toPrestador_id() + throws Exception + { + if( dataHash.get(TO_PRESTADOR_ID) == null && getPrestador_id() != null ) + { + dataHash.put(TO_PRESTADOR_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.class, new Object[]{ getPrestador_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) dataHash.get(TO_PRESTADOR_ID); + } + + public void setToPrestador_id(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData prestador_idObject ) + { + if( prestador_idObject == null ) + { + dataHash.put(PRESTADOR_ID, null); + } + else + { + dataHash.put(PRESTADOR_ID, prestador_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + dataHash.put(TO_PRESTADOR_ID, prestador_idObject); + } + + public Integer getProcesso_id() + { + return (Integer) dataHash.get(PROCESSO_ID); + } + + public void setProcesso_id(Integer processo_idValue ) + { + dataHash.put(TO_PROCESSO_ID, null); + dataHash.put(PROCESSO_ID, processo_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData toProcesso_id() + throws Exception + { + if( dataHash.get(TO_PROCESSO_ID) == null && getProcesso_id() != null ) + { + dataHash.put(TO_PROCESSO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData.class, new Object[]{ getProcesso_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData) dataHash.get(TO_PROCESSO_ID); + } + + public void setToProcesso_id(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData processo_idObject ) + { + if( processo_idObject == null ) + { + dataHash.put(PROCESSO_ID, null); + } + else + { + dataHash.put(PROCESSO_ID, processo_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData.ID )); + } + dataHash.put(TO_PROCESSO_ID, processo_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_PRESTADOR_ID.equals( fieldName ) ) + { + value = toPrestador_id(); + } + else if( PROCESSO_ID.equals( fieldName ) ) + { + value = getProcesso_id(); + } + else if( TO_TRABALHADOR_ID.equals( fieldName ) ) + { + value = toTrabalhador_id(); + } + else if( PRESTADOR_ID.equals( fieldName ) ) + { + value = getPrestador_id(); + } + else if( TO_PROCESSO_ID.equals( fieldName ) ) + { + value = toProcesso_id(); + } + else if( TRABALHADOR_ID.equals( fieldName ) ) + { + value = getTrabalhador_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_PRESTADOR_ID.equals( fieldName ) ) + { + setToPrestador_id( (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) value ); + } + else if( PROCESSO_ID.equals( fieldName ) ) + { + setProcesso_id( (Integer) value ); + } + else if( TO_TRABALHADOR_ID.equals( fieldName ) ) + { + setToTrabalhador_id( (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData) value ); + } + else if( PRESTADOR_ID.equals( fieldName ) ) + { + setPrestador_id( (Integer) value ); + } + else if( TO_PROCESSO_ID.equals( fieldName ) ) + { + setToProcesso_id( (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData) value ); + } + else if( TRABALHADOR_ID.equals( fieldName ) ) + { + setTrabalhador_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_TRABALHADOR_ID) != null ) + { + toTrabalhador_id().save(); + dataHash.put(TRABALHADOR_ID, toTrabalhador_id().get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData.ID )); + } + + if( dataHash.get(TO_PRESTADOR_ID) != null ) + { + toPrestador_id().save(); + dataHash.put(PRESTADOR_ID, toPrestador_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + + if( dataHash.get(TO_PROCESSO_ID) != null ) + { + toProcesso_id().save(); + dataHash.put(PROCESSO_ID, toProcesso_id().get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresConsultas.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatas.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatas.java new file mode 100644 index 00000000..236f14ac --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatas.java @@ -0,0 +1,183 @@ +/* +* TrabalhadoresConsultasDatas.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresConsultasDatas implements JDOInnerObject +{ + private Integer id; + private java.util.Date data; + private Integer trabalhadores_consultas_id; + private Integer estado; + private Integer prestador_id; + + public TrabalhadoresConsultasDatas() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresConsultasDatasDataAuto.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresConsultasDatasDataAuto.DATA ) + { + return data; + } + else if( fieldName == TrabalhadoresConsultasDatasDataAuto.TRABALHADORES_CONSULTAS_ID ) + { + return trabalhadores_consultas_id; + } + else if( fieldName == TrabalhadoresConsultasDatasDataAuto.ESTADO ) + { + return estado; + } + else if( fieldName == TrabalhadoresConsultasDatasDataAuto.PRESTADOR_ID ) + { + return prestador_id; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasDataAuto.DATA ) ) + { + return data; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasDataAuto.TRABALHADORES_CONSULTAS_ID ) ) + { + return trabalhadores_consultas_id; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasDataAuto.ESTADO ) ) + { + return estado; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasDataAuto.PRESTADOR_ID ) ) + { + return prestador_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresConsultasDatasDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasDataAuto.DATA ) + { + data = ( java.util.Date ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasDataAuto.TRABALHADORES_CONSULTAS_ID ) + { + trabalhadores_consultas_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasDataAuto.ESTADO ) + { + estado = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasDataAuto.PRESTADOR_ID ) + { + prestador_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasDataAuto.DATA ) ) + { + data = ( java.util.Date ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasDataAuto.TRABALHADORES_CONSULTAS_ID ) ) + { + trabalhadores_consultas_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasDataAuto.ESTADO ) ) + { + estado = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasDataAuto.PRESTADOR_ID ) ) + { + prestador_id = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public java.util.Date getData() + { + return data; + } + + public void setData(java.util.Date dataValue ) + { + this.data = dataValue; + } + + public Integer getTrabalhadores_consultas_id() + { + return trabalhadores_consultas_id; + } + + public void setTrabalhadores_consultas_id(Integer trabalhadores_consultas_idValue ) + { + this.trabalhadores_consultas_id = trabalhadores_consultas_idValue; + } + + public Integer getEstado() + { + return estado; + } + + public void setEstado(Integer estadoValue ) + { + this.estado = estadoValue; + } + + public Integer getPrestador_id() + { + return prestador_id; + } + + public void setPrestador_id(Integer prestador_idValue ) + { + this.prestador_id = prestador_idValue; + } + + public Class getOuterClass() + { + return TrabalhadoresConsultasDatasDataAuto.class; + } + + public TrabalhadoresConsultasDatasDataAuto getOuterClassInstance() + { + TrabalhadoresConsultasDatasDataAuto outerObj = new TrabalhadoresConsultasDatasDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasData.java new file mode 100644 index 00000000..931d00ca --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasData.java @@ -0,0 +1,18 @@ +/* +* TrabalhadoresConsultasDatasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class TrabalhadoresConsultasDatasData extends com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasDataAuto +{ + + public TrabalhadoresConsultasDatasData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasDataAuto.java new file mode 100644 index 00000000..809ab7ae --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasDataAuto.java @@ -0,0 +1,238 @@ +/* +* TrabalhadoresConsultasDatasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class TrabalhadoresConsultasDatasDataAuto extends JDOObject +{ + + public static final String TABLENAME = "trabalhadores_consultas_datas"; + + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_consultas_datas.id"; + public static final String DATA = "data"; + public static final String DATA_FULL = "trabalhadores_consultas_datas.data"; + public static final String TRABALHADORES_CONSULTAS_ID = "trabalhadores_consultas_id"; + public static final String TRABALHADORES_CONSULTAS_ID_FULL = "trabalhadores_consultas_datas.trabalhadores_consultas_id"; + public static final String TO_TRABALHADORES_CONSULTAS_ID = "to trabalhadores_consultas_id"; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "trabalhadores_consultas_datas.estado"; + public static final String PRESTADOR_ID = "prestador_id"; + public static final String PRESTADOR_ID_FULL = "trabalhadores_consultas_datas.prestador_id"; + public static final String TO_PRESTADOR_ID = "to prestador_id"; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, TRABALHADORES_CONSULTAS_ID, TO_TRABALHADORES_CONSULTAS_ID, ESTADO, + PRESTADOR_ID, TO_PRESTADOR_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATA, TRABALHADORES_CONSULTAS_ID, ESTADO, PRESTADOR_ID, }; + + private Map dataHash; + + public TrabalhadoresConsultasDatasDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public java.util.Date getData() + { + return (java.util.Date) get(DATA); + } + + public void setData(java.util.Date dataValue ) + { + this.set(DATA, dataValue ); + } + + public Integer getTrabalhadores_consultas_id() + { + return (Integer) dataHash.get(TRABALHADORES_CONSULTAS_ID); + } + + public void setTrabalhadores_consultas_id(Integer trabalhadores_consultas_idValue ) + { + dataHash.put(TO_TRABALHADORES_CONSULTAS_ID, null); + dataHash.put(TRABALHADORES_CONSULTAS_ID, trabalhadores_consultas_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasData toTrabalhadores_consultas_id() + throws Exception + { + if( dataHash.get(TO_TRABALHADORES_CONSULTAS_ID) == null && getTrabalhadores_consultas_id() != null ) + { + dataHash.put(TO_TRABALHADORES_CONSULTAS_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasData.class, new Object[]{ getTrabalhadores_consultas_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasData) dataHash.get(TO_TRABALHADORES_CONSULTAS_ID); + } + + public void setToTrabalhadores_consultas_id(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasData trabalhadores_consultas_idObject ) + { + if( trabalhadores_consultas_idObject == null ) + { + dataHash.put(TRABALHADORES_CONSULTAS_ID, null); + } + else + { + dataHash.put(TRABALHADORES_CONSULTAS_ID, trabalhadores_consultas_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasData.ID )); + } + dataHash.put(TO_TRABALHADORES_CONSULTAS_ID, trabalhadores_consultas_idObject); + } + + public Integer getEstado() + { + return (Integer) get(ESTADO); + } + + public void setEstado(Integer estadoValue ) + { + this.set(ESTADO, estadoValue ); + } + + public Integer getPrestador_id() + { + return (Integer) dataHash.get(PRESTADOR_ID); + } + + public void setPrestador_id(Integer prestador_idValue ) + { + dataHash.put(TO_PRESTADOR_ID, null); + dataHash.put(PRESTADOR_ID, prestador_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData toPrestador_id() + throws Exception + { + if( dataHash.get(TO_PRESTADOR_ID) == null && getPrestador_id() != null ) + { + dataHash.put(TO_PRESTADOR_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.class, new Object[]{ getPrestador_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) dataHash.get(TO_PRESTADOR_ID); + } + + public void setToPrestador_id(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData prestador_idObject ) + { + if( prestador_idObject == null ) + { + dataHash.put(PRESTADOR_ID, null); + } + else + { + dataHash.put(PRESTADOR_ID, prestador_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + dataHash.put(TO_PRESTADOR_ID, prestador_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_PRESTADOR_ID.equals( fieldName ) ) + { + value = toPrestador_id(); + } + else if( PRESTADOR_ID.equals( fieldName ) ) + { + value = getPrestador_id(); + } + else if( TRABALHADORES_CONSULTAS_ID.equals( fieldName ) ) + { + value = getTrabalhadores_consultas_id(); + } + else if( TO_TRABALHADORES_CONSULTAS_ID.equals( fieldName ) ) + { + value = toTrabalhadores_consultas_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_PRESTADOR_ID.equals( fieldName ) ) + { + setToPrestador_id( (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) value ); + } + else if( PRESTADOR_ID.equals( fieldName ) ) + { + setPrestador_id( (Integer) value ); + } + else if( TRABALHADORES_CONSULTAS_ID.equals( fieldName ) ) + { + setTrabalhadores_consultas_id( (Integer) value ); + } + else if( TO_TRABALHADORES_CONSULTAS_ID.equals( fieldName ) ) + { + setToTrabalhadores_consultas_id( (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_TRABALHADORES_CONSULTAS_ID) != null ) + { + toTrabalhadores_consultas_id().save(); + dataHash.put(TRABALHADORES_CONSULTAS_ID, toTrabalhadores_consultas_id().get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasData.ID )); + } + + if( dataHash.get(TO_PRESTADOR_ID) != null ) + { + toPrestador_id().save(); + dataHash.put(PRESTADOR_ID, toPrestador_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresConsultasDatas.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasEmails.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasEmails.java new file mode 100644 index 00000000..ce6f5f28 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasEmails.java @@ -0,0 +1,210 @@ +/* +* TrabalhadoresConsultasDatasEmails.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresConsultasDatasEmails implements JDOInnerObject +{ + private Integer id; + private Integer trabalhadores_consultas_datas_id; + private String destination; + private java.util.Date data; + private String subject; + private String body; + + public TrabalhadoresConsultasDatasEmails() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresConsultasDatasEmailsDataAuto.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsDataAuto.TRABALHADORES_CONSULTAS_DATAS_ID ) + { + return trabalhadores_consultas_datas_id; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsDataAuto.DESTINATION ) + { + return destination; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsDataAuto.DATA ) + { + return data; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsDataAuto.SUBJECT ) + { + return subject; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsDataAuto.BODY ) + { + return body; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsDataAuto.TRABALHADORES_CONSULTAS_DATAS_ID ) ) + { + return trabalhadores_consultas_datas_id; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsDataAuto.DESTINATION ) ) + { + return destination; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsDataAuto.DATA ) ) + { + return data; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsDataAuto.SUBJECT ) ) + { + return subject; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsDataAuto.BODY ) ) + { + return body; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresConsultasDatasEmailsDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsDataAuto.TRABALHADORES_CONSULTAS_DATAS_ID ) + { + trabalhadores_consultas_datas_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsDataAuto.DESTINATION ) + { + destination = ( String ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsDataAuto.DATA ) + { + data = ( java.util.Date ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsDataAuto.SUBJECT ) + { + subject = ( String ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsDataAuto.BODY ) + { + body = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsDataAuto.TRABALHADORES_CONSULTAS_DATAS_ID ) ) + { + trabalhadores_consultas_datas_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsDataAuto.DESTINATION ) ) + { + destination = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsDataAuto.DATA ) ) + { + data = ( java.util.Date ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsDataAuto.SUBJECT ) ) + { + subject = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsDataAuto.BODY ) ) + { + body = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getTrabalhadores_consultas_datas_id() + { + return trabalhadores_consultas_datas_id; + } + + public void setTrabalhadores_consultas_datas_id(Integer trabalhadores_consultas_datas_idValue ) + { + this.trabalhadores_consultas_datas_id = trabalhadores_consultas_datas_idValue; + } + + public String getDestination() + { + return destination; + } + + public void setDestination(String destinationValue ) + { + this.destination = destinationValue; + } + + public java.util.Date getData() + { + return data; + } + + public void setData(java.util.Date dataValue ) + { + this.data = dataValue; + } + + public String getSubject() + { + return subject; + } + + public void setSubject(String subjectValue ) + { + this.subject = subjectValue; + } + + public String getBody() + { + return body; + } + + public void setBody(String bodyValue ) + { + this.body = bodyValue; + } + + public Class getOuterClass() + { + return TrabalhadoresConsultasDatasEmailsDataAuto.class; + } + + public TrabalhadoresConsultasDatasEmailsDataAuto getOuterClassInstance() + { + TrabalhadoresConsultasDatasEmailsDataAuto outerObj = new TrabalhadoresConsultasDatasEmailsDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasEmailsData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasEmailsData.java new file mode 100644 index 00000000..be4de22a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasEmailsData.java @@ -0,0 +1,18 @@ +/* +* TrabalhadoresConsultasDatasEmailsDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class TrabalhadoresConsultasDatasEmailsData extends com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasEmailsDataAuto +{ + + public TrabalhadoresConsultasDatasEmailsData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasEmailsDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasEmailsDataAuto.java new file mode 100644 index 00000000..ce63d238 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasEmailsDataAuto.java @@ -0,0 +1,203 @@ +/* +* TrabalhadoresConsultasDatasEmailsDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class TrabalhadoresConsultasDatasEmailsDataAuto extends JDOObject +{ + + public static final String TABLENAME = "trabalhadores_consultas_datas_emails"; + + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_consultas_datas_emails.id"; + public static final String TRABALHADORES_CONSULTAS_DATAS_ID = "trabalhadores_consultas_datas_id"; + public static final String TRABALHADORES_CONSULTAS_DATAS_ID_FULL = "trabalhadores_consultas_datas_emails.trabalhadores_consultas_datas_id"; + public static final String TO_TRABALHADORES_CONSULTAS_DATAS_ID = "to trabalhadores_consultas_datas_id"; + public static final String DESTINATION = "destination"; + public static final String DESTINATION_FULL = "trabalhadores_consultas_datas_emails.destination"; + public static final String DATA = "data"; + public static final String DATA_FULL = "trabalhadores_consultas_datas_emails.data"; + public static final String SUBJECT = "subject"; + public static final String SUBJECT_FULL = "trabalhadores_consultas_datas_emails.subject"; + public static final String BODY = "body"; + public static final String BODY_FULL = "trabalhadores_consultas_datas_emails.body"; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADORES_CONSULTAS_DATAS_ID, TO_TRABALHADORES_CONSULTAS_DATAS_ID, + DESTINATION, DATA, SUBJECT, BODY, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TRABALHADORES_CONSULTAS_DATAS_ID, DESTINATION, DATA, SUBJECT, BODY, }; + + private Map dataHash; + + public TrabalhadoresConsultasDatasEmailsDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getTrabalhadores_consultas_datas_id() + { + return (Integer) dataHash.get(TRABALHADORES_CONSULTAS_DATAS_ID); + } + + public void setTrabalhadores_consultas_datas_id(Integer trabalhadores_consultas_datas_idValue ) + { + dataHash.put(TO_TRABALHADORES_CONSULTAS_DATAS_ID, null); + dataHash.put(TRABALHADORES_CONSULTAS_DATAS_ID, trabalhadores_consultas_datas_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData toTrabalhadores_consultas_datas_id() + throws Exception + { + if( dataHash.get(TO_TRABALHADORES_CONSULTAS_DATAS_ID) == null && getTrabalhadores_consultas_datas_id() != null ) + { + dataHash.put(TO_TRABALHADORES_CONSULTAS_DATAS_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData.class, new Object[]{ getTrabalhadores_consultas_datas_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData) dataHash.get(TO_TRABALHADORES_CONSULTAS_DATAS_ID); + } + + public void setToTrabalhadores_consultas_datas_id(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData trabalhadores_consultas_datas_idObject ) + { + if( trabalhadores_consultas_datas_idObject == null ) + { + dataHash.put(TRABALHADORES_CONSULTAS_DATAS_ID, null); + } + else + { + dataHash.put(TRABALHADORES_CONSULTAS_DATAS_ID, trabalhadores_consultas_datas_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData.ID )); + } + dataHash.put(TO_TRABALHADORES_CONSULTAS_DATAS_ID, trabalhadores_consultas_datas_idObject); + } + + public String getDestination() + { + return (String) get(DESTINATION); + } + + public void setDestination(String destinationValue ) + { + this.set(DESTINATION, destinationValue ); + } + + public java.util.Date getData() + { + return (java.util.Date) get(DATA); + } + + public void setData(java.util.Date dataValue ) + { + this.set(DATA, dataValue ); + } + + public String getSubject() + { + return (String) get(SUBJECT); + } + + public void setSubject(String subjectValue ) + { + this.set(SUBJECT, subjectValue ); + } + + public String getBody() + { + return (String) get(BODY); + } + + public void setBody(String bodyValue ) + { + this.set(BODY, bodyValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_TRABALHADORES_CONSULTAS_DATAS_ID.equals( fieldName ) ) + { + value = toTrabalhadores_consultas_datas_id(); + } + else if( TRABALHADORES_CONSULTAS_DATAS_ID.equals( fieldName ) ) + { + value = getTrabalhadores_consultas_datas_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_TRABALHADORES_CONSULTAS_DATAS_ID.equals( fieldName ) ) + { + setToTrabalhadores_consultas_datas_id( (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData) value ); + } + else if( TRABALHADORES_CONSULTAS_DATAS_ID.equals( fieldName ) ) + { + setTrabalhadores_consultas_datas_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_TRABALHADORES_CONSULTAS_DATAS_ID) != null ) + { + toTrabalhadores_consultas_datas_id().save(); + dataHash.put(TRABALHADORES_CONSULTAS_DATAS_ID, toTrabalhadores_consultas_datas_id().get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresConsultasDatasEmails.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasObservacoes.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasObservacoes.java new file mode 100644 index 00000000..c6f1241e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasObservacoes.java @@ -0,0 +1,129 @@ +/* +* TrabalhadoresConsultasDatasObservacoes.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresConsultasDatasObservacoes implements JDOInnerObject +{ + private Integer id; + private Integer trabalhadores_consultas_datas_id; + private String observacao; + + public TrabalhadoresConsultasDatasObservacoes() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresConsultasDatasObservacoesDataAuto.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresConsultasDatasObservacoesDataAuto.TRABALHADORES_CONSULTAS_DATAS_ID ) + { + return trabalhadores_consultas_datas_id; + } + else if( fieldName == TrabalhadoresConsultasDatasObservacoesDataAuto.OBSERVACAO ) + { + return observacao; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasObservacoesDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasObservacoesDataAuto.TRABALHADORES_CONSULTAS_DATAS_ID ) ) + { + return trabalhadores_consultas_datas_id; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasObservacoesDataAuto.OBSERVACAO ) ) + { + return observacao; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresConsultasDatasObservacoesDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasObservacoesDataAuto.TRABALHADORES_CONSULTAS_DATAS_ID ) + { + trabalhadores_consultas_datas_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasObservacoesDataAuto.OBSERVACAO ) + { + observacao = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasObservacoesDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasObservacoesDataAuto.TRABALHADORES_CONSULTAS_DATAS_ID ) ) + { + trabalhadores_consultas_datas_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasObservacoesDataAuto.OBSERVACAO ) ) + { + observacao = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getTrabalhadores_consultas_datas_id() + { + return trabalhadores_consultas_datas_id; + } + + public void setTrabalhadores_consultas_datas_id(Integer trabalhadores_consultas_datas_idValue ) + { + this.trabalhadores_consultas_datas_id = trabalhadores_consultas_datas_idValue; + } + + public String getObservacao() + { + return observacao; + } + + public void setObservacao(String observacaoValue ) + { + this.observacao = observacaoValue; + } + + public Class getOuterClass() + { + return TrabalhadoresConsultasDatasObservacoesDataAuto.class; + } + + public TrabalhadoresConsultasDatasObservacoesDataAuto getOuterClassInstance() + { + TrabalhadoresConsultasDatasObservacoesDataAuto outerObj = new TrabalhadoresConsultasDatasObservacoesDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasObservacoesData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasObservacoesData.java new file mode 100644 index 00000000..6ef9f6c7 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasObservacoesData.java @@ -0,0 +1,18 @@ +/* +* TrabalhadoresConsultasDatasObservacoesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class TrabalhadoresConsultasDatasObservacoesData extends com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasObservacoesDataAuto +{ + + public TrabalhadoresConsultasDatasObservacoesData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasObservacoesDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasObservacoesDataAuto.java new file mode 100644 index 00000000..821b1a1c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresConsultasDatasObservacoesDataAuto.java @@ -0,0 +1,167 @@ +/* +* TrabalhadoresConsultasDatasObservacoesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class TrabalhadoresConsultasDatasObservacoesDataAuto extends JDOObject +{ + + public static final String TABLENAME = "trabalhadores_consultas_datas_observacoes"; + + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_consultas_datas_observacoes.id"; + public static final String TRABALHADORES_CONSULTAS_DATAS_ID = "trabalhadores_consultas_datas_id"; + public static final String TRABALHADORES_CONSULTAS_DATAS_ID_FULL = "trabalhadores_consultas_datas_observacoes.trabalhadores_consultas_datas_id"; + public static final String TO_TRABALHADORES_CONSULTAS_DATAS_ID = "to trabalhadores_consultas_datas_id"; + public static final String OBSERVACAO = "observacao"; + public static final String OBSERVACAO_FULL = "trabalhadores_consultas_datas_observacoes.observacao"; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADORES_CONSULTAS_DATAS_ID, TO_TRABALHADORES_CONSULTAS_DATAS_ID, + OBSERVACAO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TRABALHADORES_CONSULTAS_DATAS_ID, OBSERVACAO, }; + + private Map dataHash; + + public TrabalhadoresConsultasDatasObservacoesDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getTrabalhadores_consultas_datas_id() + { + return (Integer) dataHash.get(TRABALHADORES_CONSULTAS_DATAS_ID); + } + + public void setTrabalhadores_consultas_datas_id(Integer trabalhadores_consultas_datas_idValue ) + { + dataHash.put(TO_TRABALHADORES_CONSULTAS_DATAS_ID, null); + dataHash.put(TRABALHADORES_CONSULTAS_DATAS_ID, trabalhadores_consultas_datas_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData toTrabalhadores_consultas_datas_id() + throws Exception + { + if( dataHash.get(TO_TRABALHADORES_CONSULTAS_DATAS_ID) == null && getTrabalhadores_consultas_datas_id() != null ) + { + dataHash.put(TO_TRABALHADORES_CONSULTAS_DATAS_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData.class, new Object[]{ getTrabalhadores_consultas_datas_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData) dataHash.get(TO_TRABALHADORES_CONSULTAS_DATAS_ID); + } + + public void setToTrabalhadores_consultas_datas_id(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData trabalhadores_consultas_datas_idObject ) + { + if( trabalhadores_consultas_datas_idObject == null ) + { + dataHash.put(TRABALHADORES_CONSULTAS_DATAS_ID, null); + } + else + { + dataHash.put(TRABALHADORES_CONSULTAS_DATAS_ID, trabalhadores_consultas_datas_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData.ID )); + } + dataHash.put(TO_TRABALHADORES_CONSULTAS_DATAS_ID, trabalhadores_consultas_datas_idObject); + } + + public String getObservacao() + { + return (String) get(OBSERVACAO); + } + + public void setObservacao(String observacaoValue ) + { + this.set(OBSERVACAO, observacaoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_TRABALHADORES_CONSULTAS_DATAS_ID.equals( fieldName ) ) + { + value = toTrabalhadores_consultas_datas_id(); + } + else if( TRABALHADORES_CONSULTAS_DATAS_ID.equals( fieldName ) ) + { + value = getTrabalhadores_consultas_datas_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_TRABALHADORES_CONSULTAS_DATAS_ID.equals( fieldName ) ) + { + setToTrabalhadores_consultas_datas_id( (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData) value ); + } + else if( TRABALHADORES_CONSULTAS_DATAS_ID.equals( fieldName ) ) + { + setTrabalhadores_consultas_datas_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_TRABALHADORES_CONSULTAS_DATAS_ID) != null ) + { + toTrabalhadores_consultas_datas_id().save(); + dataHash.put(TRABALHADORES_CONSULTAS_DATAS_ID, toTrabalhadores_consultas_datas_id().get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresConsultasDatasData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresConsultasDatasObservacoes.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresData.java new file mode 100644 index 00000000..246726bf --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresData.java @@ -0,0 +1,18 @@ +/* +* TrabalhadoresDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class TrabalhadoresData extends com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresDataAuto +{ + + public TrabalhadoresData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresDataAuto.java new file mode 100644 index 00000000..8aab5192 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresDataAuto.java @@ -0,0 +1,376 @@ +/* +* TrabalhadoresDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class TrabalhadoresDataAuto extends JDOObject +{ + + public static final String TABLENAME = "trabalhadores"; + + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores.id"; + public static final String NOME = "nome"; + public static final String NOME_FULL = "trabalhadores.nome"; + public static final String SEXO = "sexo"; + public static final String SEXO_FULL = "trabalhadores.sexo"; + public static final String DATA_NASCIMENTO = "data_nascimento"; + public static final String DATA_NASCIMENTO_FULL = "trabalhadores.data_nascimento"; + public static final String NACIONALIDADE = "nacionalidade"; + public static final String NACIONALIDADE_FULL = "trabalhadores.nacionalidade"; + public static final String NUMERO_MECANOGRAFICO = "numero_mecanografico"; + public static final String NUMERO_MECANOGRAFICO_FULL = "trabalhadores.numero_mecanografico"; + public static final String DATA_ADMISSAO = "data_admissao"; + public static final String DATA_ADMISSAO_FULL = "trabalhadores.data_admissao"; + public static final String CATEGORIA = "categoria"; + public static final String CATEGORIA_FULL = "trabalhadores.categoria"; + public static final String LOCAL_TRABALHO = "local_trabalho"; + public static final String LOCAL_TRABALHO_FULL = "trabalhadores.local_trabalho"; + public static final String FUNCAO_PROPOSTA = "funcao_proposta"; + public static final String FUNCAO_PROPOSTA_FULL = "trabalhadores.funcao_proposta"; + public static final String DATA_ADMISSAO_FUNCAO = "data_admissao_funcao"; + public static final String DATA_ADMISSAO_FUNCAO_FULL = "trabalhadores.data_admissao_funcao"; + public static final String OBSERVACOES = "observacoes"; + public static final String OBSERVACOES_FULL = "trabalhadores.observacoes"; + public static final String INACTIVO = "inactivo"; + public static final String INACTIVO_FULL = "trabalhadores.inactivo"; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "trabalhadores.estabelecimento_id"; + public static final String TO_ESTABELECIMENTO_ID = "to estabelecimento_id"; + public static final String DATA_DEMISSAO = "data_demissao"; + public static final String DATA_DEMISSAO_FULL = "trabalhadores.data_demissao"; + public static final String OBSERVACOES_GESTAO = "observacoes_gestao"; + public static final String OBSERVACOES_GESTAO_FULL = "trabalhadores.observacoes_gestao"; + public static final String PERFIL = "perfil"; + public static final String PERFIL_FULL = "trabalhadores.perfil"; + public static final String ACTUALIZACAO = "actualizacao"; + public static final String ACTUALIZACAO_FULL = "trabalhadores.actualizacao"; + public static final String NOME_PLAIN = "nome_plain"; + public static final String NOME_PLAIN_FULL = "trabalhadores.nome_plain"; + public static final String BI = "bi"; + public static final String BI_FULL = "trabalhadores.bi"; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, SEXO, DATA_NASCIMENTO, NACIONALIDADE, NUMERO_MECANOGRAFICO, DATA_ADMISSAO, + CATEGORIA, LOCAL_TRABALHO, FUNCAO_PROPOSTA, DATA_ADMISSAO_FUNCAO, OBSERVACOES, + INACTIVO, ESTABELECIMENTO_ID, TO_ESTABELECIMENTO_ID, DATA_DEMISSAO, + OBSERVACOES_GESTAO, PERFIL, ACTUALIZACAO, NOME_PLAIN, BI, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, NOME, SEXO, DATA_NASCIMENTO, NACIONALIDADE, NUMERO_MECANOGRAFICO, + DATA_ADMISSAO, CATEGORIA, LOCAL_TRABALHO, FUNCAO_PROPOSTA, + DATA_ADMISSAO_FUNCAO, OBSERVACOES, INACTIVO, ESTABELECIMENTO_ID, DATA_DEMISSAO, + OBSERVACOES_GESTAO, PERFIL, ACTUALIZACAO, NOME_PLAIN, BI, }; + + private Map dataHash; + + public TrabalhadoresDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public String getNome() + { + return (String) get(NOME); + } + + public void setNome(String nomeValue ) + { + this.set(NOME, nomeValue ); + } + + public String getSexo() + { + return (String) get(SEXO); + } + + public void setSexo(String sexoValue ) + { + this.set(SEXO, sexoValue ); + } + + public java.util.Date getData_nascimento() + { + return (java.util.Date) get(DATA_NASCIMENTO); + } + + public void setData_nascimento(java.util.Date data_nascimentoValue ) + { + this.set(DATA_NASCIMENTO, data_nascimentoValue ); + } + + public String getNacionalidade() + { + return (String) get(NACIONALIDADE); + } + + public void setNacionalidade(String nacionalidadeValue ) + { + this.set(NACIONALIDADE, nacionalidadeValue ); + } + + public String getNumero_mecanografico() + { + return (String) get(NUMERO_MECANOGRAFICO); + } + + public void setNumero_mecanografico(String numero_mecanograficoValue ) + { + this.set(NUMERO_MECANOGRAFICO, numero_mecanograficoValue ); + } + + public java.util.Date getData_admissao() + { + return (java.util.Date) get(DATA_ADMISSAO); + } + + public void setData_admissao(java.util.Date data_admissaoValue ) + { + this.set(DATA_ADMISSAO, data_admissaoValue ); + } + + public String getCategoria() + { + return (String) get(CATEGORIA); + } + + public void setCategoria(String categoriaValue ) + { + this.set(CATEGORIA, categoriaValue ); + } + + public String getLocal_trabalho() + { + return (String) get(LOCAL_TRABALHO); + } + + public void setLocal_trabalho(String local_trabalhoValue ) + { + this.set(LOCAL_TRABALHO, local_trabalhoValue ); + } + + public String getFuncao_proposta() + { + return (String) get(FUNCAO_PROPOSTA); + } + + public void setFuncao_proposta(String funcao_propostaValue ) + { + this.set(FUNCAO_PROPOSTA, funcao_propostaValue ); + } + + public java.util.Date getData_admissao_funcao() + { + return (java.util.Date) get(DATA_ADMISSAO_FUNCAO); + } + + public void setData_admissao_funcao(java.util.Date data_admissao_funcaoValue ) + { + this.set(DATA_ADMISSAO_FUNCAO, data_admissao_funcaoValue ); + } + + public String getObservacoes() + { + return (String) get(OBSERVACOES); + } + + public void setObservacoes(String observacoesValue ) + { + this.set(OBSERVACOES, observacoesValue ); + } + + public String getInactivo() + { + return (String) get(INACTIVO); + } + + public void setInactivo(String inactivoValue ) + { + this.set(INACTIVO, inactivoValue ); + } + + public Integer getEstabelecimento_id() + { + return (Integer) dataHash.get(ESTABELECIMENTO_ID); + } + + public void setEstabelecimento_id(Integer estabelecimento_idValue ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, null); + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData toEstabelecimento_id() + throws Exception + { + if( dataHash.get(TO_ESTABELECIMENTO_ID) == null && getEstabelecimento_id() != null ) + { + dataHash.put(TO_ESTABELECIMENTO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.class, new Object[]{ getEstabelecimento_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) dataHash.get(TO_ESTABELECIMENTO_ID); + } + + public void setToEstabelecimento_id(com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData estabelecimento_idObject ) + { + if( estabelecimento_idObject == null ) + { + dataHash.put(ESTABELECIMENTO_ID, null); + } + else + { + dataHash.put(ESTABELECIMENTO_ID, estabelecimento_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + dataHash.put(TO_ESTABELECIMENTO_ID, estabelecimento_idObject); + } + + public java.util.Date getData_demissao() + { + return (java.util.Date) get(DATA_DEMISSAO); + } + + public void setData_demissao(java.util.Date data_demissaoValue ) + { + this.set(DATA_DEMISSAO, data_demissaoValue ); + } + + public String getObservacoes_gestao() + { + return (String) get(OBSERVACOES_GESTAO); + } + + public void setObservacoes_gestao(String observacoes_gestaoValue ) + { + this.set(OBSERVACOES_GESTAO, observacoes_gestaoValue ); + } + + public Integer getPerfil() + { + return (Integer) get(PERFIL); + } + + public void setPerfil(Integer perfilValue ) + { + this.set(PERFIL, perfilValue ); + } + + public java.sql.Timestamp getActualizacao() + { + return (java.sql.Timestamp) get(ACTUALIZACAO); + } + + public void setActualizacao(java.sql.Timestamp actualizacaoValue ) + { + this.set(ACTUALIZACAO, actualizacaoValue ); + } + + public String getNome_plain() + { + return (String) get(NOME_PLAIN); + } + + public void setNome_plain(String nome_plainValue ) + { + this.set(NOME_PLAIN, nome_plainValue ); + } + + public String getBi() + { + return (String) get(BI); + } + + public void setBi(String biValue ) + { + this.set(BI, biValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = getEstabelecimento_id(); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + value = toEstabelecimento_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setEstabelecimento_id( (Integer) value ); + } + else if( TO_ESTABELECIMENTO_ID.equals( fieldName ) ) + { + setToEstabelecimento_id( (com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_ESTABELECIMENTO_ID) != null ) + { + toEstabelecimento_id().save(); + dataHash.put(ESTABELECIMENTO_ID, toEstabelecimento_id().get( com.evolute.siprp.server.db.data.siprp_local3.EstabelecimentosData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Trabalhadores.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcd.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcd.java new file mode 100644 index 00000000..b1ededc2 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcd.java @@ -0,0 +1,291 @@ +/* +* TrabalhadoresEcd.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresEcd implements JDOInnerObject +{ + private Integer id; + private Integer ecd_id; + private Integer ecd_oficial_id; + private Integer estado; + private Integer trabalhadores_ecds_datas_id; + private String enviado; + private Integer analisador_id; + private java.util.Date data_envio; + private java.util.Date data_recepcao; + + public TrabalhadoresEcd() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresEcdDataAuto.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresEcdDataAuto.ECD_ID ) + { + return ecd_id; + } + else if( fieldName == TrabalhadoresEcdDataAuto.ECD_OFICIAL_ID ) + { + return ecd_oficial_id; + } + else if( fieldName == TrabalhadoresEcdDataAuto.ESTADO ) + { + return estado; + } + else if( fieldName == TrabalhadoresEcdDataAuto.TRABALHADORES_ECDS_DATAS_ID ) + { + return trabalhadores_ecds_datas_id; + } + else if( fieldName == TrabalhadoresEcdDataAuto.ENVIADO ) + { + return enviado; + } + else if( fieldName == TrabalhadoresEcdDataAuto.ANALISADOR_ID ) + { + return analisador_id; + } + else if( fieldName == TrabalhadoresEcdDataAuto.DATA_ENVIO ) + { + return data_envio; + } + else if( fieldName == TrabalhadoresEcdDataAuto.DATA_RECEPCAO ) + { + return data_recepcao; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.ECD_ID ) ) + { + return ecd_id; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.ECD_OFICIAL_ID ) ) + { + return ecd_oficial_id; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.ESTADO ) ) + { + return estado; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.TRABALHADORES_ECDS_DATAS_ID ) ) + { + return trabalhadores_ecds_datas_id; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.ENVIADO ) ) + { + return enviado; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.ANALISADOR_ID ) ) + { + return analisador_id; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.DATA_ENVIO ) ) + { + return data_envio; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.DATA_RECEPCAO ) ) + { + return data_recepcao; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresEcdDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdDataAuto.ECD_ID ) + { + ecd_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdDataAuto.ECD_OFICIAL_ID ) + { + ecd_oficial_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdDataAuto.ESTADO ) + { + estado = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdDataAuto.TRABALHADORES_ECDS_DATAS_ID ) + { + trabalhadores_ecds_datas_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdDataAuto.ENVIADO ) + { + enviado = ( String ) value; + } + else if( fieldName == TrabalhadoresEcdDataAuto.ANALISADOR_ID ) + { + analisador_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdDataAuto.DATA_ENVIO ) + { + data_envio = ( java.util.Date ) value; + } + else if( fieldName == TrabalhadoresEcdDataAuto.DATA_RECEPCAO ) + { + data_recepcao = ( java.util.Date ) value; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.ECD_ID ) ) + { + ecd_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.ECD_OFICIAL_ID ) ) + { + ecd_oficial_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.ESTADO ) ) + { + estado = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.TRABALHADORES_ECDS_DATAS_ID ) ) + { + trabalhadores_ecds_datas_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.ENVIADO ) ) + { + enviado = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.ANALISADOR_ID ) ) + { + analisador_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.DATA_ENVIO ) ) + { + data_envio = ( java.util.Date ) value; + } + else if( fieldName.equals( TrabalhadoresEcdDataAuto.DATA_RECEPCAO ) ) + { + data_recepcao = ( java.util.Date ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getEcd_id() + { + return ecd_id; + } + + public void setEcd_id(Integer ecd_idValue ) + { + this.ecd_id = ecd_idValue; + } + + public Integer getEcd_oficial_id() + { + return ecd_oficial_id; + } + + public void setEcd_oficial_id(Integer ecd_oficial_idValue ) + { + this.ecd_oficial_id = ecd_oficial_idValue; + } + + public Integer getEstado() + { + return estado; + } + + public void setEstado(Integer estadoValue ) + { + this.estado = estadoValue; + } + + public Integer getTrabalhadores_ecds_datas_id() + { + return trabalhadores_ecds_datas_id; + } + + public void setTrabalhadores_ecds_datas_id(Integer trabalhadores_ecds_datas_idValue ) + { + this.trabalhadores_ecds_datas_id = trabalhadores_ecds_datas_idValue; + } + + public String getEnviado() + { + return enviado; + } + + public void setEnviado(String enviadoValue ) + { + this.enviado = enviadoValue; + } + + public Integer getAnalisador_id() + { + return analisador_id; + } + + public void setAnalisador_id(Integer analisador_idValue ) + { + this.analisador_id = analisador_idValue; + } + + public java.util.Date getData_envio() + { + return data_envio; + } + + public void setData_envio(java.util.Date data_envioValue ) + { + this.data_envio = data_envioValue; + } + + public java.util.Date getData_recepcao() + { + return data_recepcao; + } + + public void setData_recepcao(java.util.Date data_recepcaoValue ) + { + this.data_recepcao = data_recepcaoValue; + } + + public Class getOuterClass() + { + return TrabalhadoresEcdDataAuto.class; + } + + public TrabalhadoresEcdDataAuto getOuterClassInstance() + { + TrabalhadoresEcdDataAuto outerObj = new TrabalhadoresEcdDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdData.java new file mode 100644 index 00000000..b4b06e0c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdData.java @@ -0,0 +1,18 @@ +/* +* TrabalhadoresEcdDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class TrabalhadoresEcdData extends com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdDataAuto +{ + + public TrabalhadoresEcdData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdDataAuto.java new file mode 100644 index 00000000..403848cb --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdDataAuto.java @@ -0,0 +1,382 @@ +/* +* TrabalhadoresEcdDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class TrabalhadoresEcdDataAuto extends JDOObject +{ + + public static final String TABLENAME = "trabalhadores_ecd"; + + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_ecd.id"; + public static final String ECD_ID = "ecd_id"; + public static final String ECD_ID_FULL = "trabalhadores_ecd.ecd_id"; + public static final String TO_ECD_ID = "to ecd_id"; + public static final String ECD_OFICIAL_ID = "ecd_oficial_id"; + public static final String ECD_OFICIAL_ID_FULL = "trabalhadores_ecd.ecd_oficial_id"; + public static final String TO_ECD_OFICIAL_ID = "to ecd_oficial_id"; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "trabalhadores_ecd.estado"; + public static final String TRABALHADORES_ECDS_DATAS_ID = "trabalhadores_ecds_datas_id"; + public static final String TRABALHADORES_ECDS_DATAS_ID_FULL = "trabalhadores_ecd.trabalhadores_ecds_datas_id"; + public static final String TO_TRABALHADORES_ECDS_DATAS_ID = "to trabalhadores_ecds_datas_id"; + public static final String ENVIADO = "enviado"; + public static final String ENVIADO_FULL = "trabalhadores_ecd.enviado"; + public static final String ANALISADOR_ID = "analisador_id"; + public static final String ANALISADOR_ID_FULL = "trabalhadores_ecd.analisador_id"; + public static final String TO_ANALISADOR_ID = "to analisador_id"; + public static final String DATA_ENVIO = "data_envio"; + public static final String DATA_ENVIO_FULL = "trabalhadores_ecd.data_envio"; + public static final String DATA_RECEPCAO = "data_recepcao"; + public static final String DATA_RECEPCAO_FULL = "trabalhadores_ecd.data_recepcao"; + + public static final String FIELD_NAMES[] = new String[]{ + ECD_ID, TO_ECD_ID, ECD_OFICIAL_ID, TO_ECD_OFICIAL_ID, ESTADO, + TRABALHADORES_ECDS_DATAS_ID, TO_TRABALHADORES_ECDS_DATAS_ID, ENVIADO, + ANALISADOR_ID, TO_ANALISADOR_ID, DATA_ENVIO, DATA_RECEPCAO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, ECD_ID, ECD_OFICIAL_ID, ESTADO, TRABALHADORES_ECDS_DATAS_ID, ENVIADO, + ANALISADOR_ID, DATA_ENVIO, DATA_RECEPCAO, }; + + private Map dataHash; + + public TrabalhadoresEcdDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getEcd_id() + { + return (Integer) dataHash.get(ECD_ID); + } + + public void setEcd_id(Integer ecd_idValue ) + { + dataHash.put(TO_ECD_ID, null); + dataHash.put(ECD_ID, ecd_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrtTiposElementosProtocoloData toEcd_id() + throws Exception + { + if( dataHash.get(TO_ECD_ID) == null && getEcd_id() != null ) + { + dataHash.put(TO_ECD_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrtTiposElementosProtocoloData.class, new Object[]{ getEcd_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrtTiposElementosProtocoloData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrtTiposElementosProtocoloData) dataHash.get(TO_ECD_ID); + } + + public void setToEcd_id(com.evolute.siprp.server.db.data.siprp_local3.PrtTiposElementosProtocoloData ecd_idObject ) + { + if( ecd_idObject == null ) + { + dataHash.put(ECD_ID, null); + } + else + { + dataHash.put(ECD_ID, ecd_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrtTiposElementosProtocoloData.ID )); + } + dataHash.put(TO_ECD_ID, ecd_idObject); + } + + public Integer getEcd_oficial_id() + { + return (Integer) dataHash.get(ECD_OFICIAL_ID); + } + + public void setEcd_oficial_id(Integer ecd_oficial_idValue ) + { + dataHash.put(TO_ECD_OFICIAL_ID, null); + dataHash.put(ECD_OFICIAL_ID, ecd_oficial_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.EcdOficialData toEcd_oficial_id() + throws Exception + { + if( dataHash.get(TO_ECD_OFICIAL_ID) == null && getEcd_oficial_id() != null ) + { + dataHash.put(TO_ECD_OFICIAL_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.EcdOficialData.class, new Object[]{ getEcd_oficial_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.EcdOficialData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.EcdOficialData) dataHash.get(TO_ECD_OFICIAL_ID); + } + + public void setToEcd_oficial_id(com.evolute.siprp.server.db.data.siprp_local3.EcdOficialData ecd_oficial_idObject ) + { + if( ecd_oficial_idObject == null ) + { + dataHash.put(ECD_OFICIAL_ID, null); + } + else + { + dataHash.put(ECD_OFICIAL_ID, ecd_oficial_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.EcdOficialData.ID )); + } + dataHash.put(TO_ECD_OFICIAL_ID, ecd_oficial_idObject); + } + + public Integer getEstado() + { + return (Integer) get(ESTADO); + } + + public void setEstado(Integer estadoValue ) + { + this.set(ESTADO, estadoValue ); + } + + public Integer getTrabalhadores_ecds_datas_id() + { + return (Integer) dataHash.get(TRABALHADORES_ECDS_DATAS_ID); + } + + public void setTrabalhadores_ecds_datas_id(Integer trabalhadores_ecds_datas_idValue ) + { + dataHash.put(TO_TRABALHADORES_ECDS_DATAS_ID, null); + dataHash.put(TRABALHADORES_ECDS_DATAS_ID, trabalhadores_ecds_datas_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData toTrabalhadores_ecds_datas_id() + throws Exception + { + if( dataHash.get(TO_TRABALHADORES_ECDS_DATAS_ID) == null && getTrabalhadores_ecds_datas_id() != null ) + { + dataHash.put(TO_TRABALHADORES_ECDS_DATAS_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData.class, new Object[]{ getTrabalhadores_ecds_datas_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData) dataHash.get(TO_TRABALHADORES_ECDS_DATAS_ID); + } + + public void setToTrabalhadores_ecds_datas_id(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData trabalhadores_ecds_datas_idObject ) + { + if( trabalhadores_ecds_datas_idObject == null ) + { + dataHash.put(TRABALHADORES_ECDS_DATAS_ID, null); + } + else + { + dataHash.put(TRABALHADORES_ECDS_DATAS_ID, trabalhadores_ecds_datas_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData.ID )); + } + dataHash.put(TO_TRABALHADORES_ECDS_DATAS_ID, trabalhadores_ecds_datas_idObject); + } + + public String getEnviado() + { + return (String) get(ENVIADO); + } + + public void setEnviado(String enviadoValue ) + { + this.set(ENVIADO, enviadoValue ); + } + + public Integer getAnalisador_id() + { + return (Integer) dataHash.get(ANALISADOR_ID); + } + + public void setAnalisador_id(Integer analisador_idValue ) + { + dataHash.put(TO_ANALISADOR_ID, null); + dataHash.put(ANALISADOR_ID, analisador_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData toAnalisador_id() + throws Exception + { + if( dataHash.get(TO_ANALISADOR_ID) == null && getAnalisador_id() != null ) + { + dataHash.put(TO_ANALISADOR_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.class, new Object[]{ getAnalisador_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) dataHash.get(TO_ANALISADOR_ID); + } + + public void setToAnalisador_id(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData analisador_idObject ) + { + if( analisador_idObject == null ) + { + dataHash.put(ANALISADOR_ID, null); + } + else + { + dataHash.put(ANALISADOR_ID, analisador_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + dataHash.put(TO_ANALISADOR_ID, analisador_idObject); + } + + public java.util.Date getData_envio() + { + return (java.util.Date) get(DATA_ENVIO); + } + + public void setData_envio(java.util.Date data_envioValue ) + { + this.set(DATA_ENVIO, data_envioValue ); + } + + public java.util.Date getData_recepcao() + { + return (java.util.Date) get(DATA_RECEPCAO); + } + + public void setData_recepcao(java.util.Date data_recepcaoValue ) + { + this.set(DATA_RECEPCAO, data_recepcaoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( ECD_OFICIAL_ID.equals( fieldName ) ) + { + value = getEcd_oficial_id(); + } + else if( TO_TRABALHADORES_ECDS_DATAS_ID.equals( fieldName ) ) + { + value = toTrabalhadores_ecds_datas_id(); + } + else if( ECD_ID.equals( fieldName ) ) + { + value = getEcd_id(); + } + else if( TO_ECD_ID.equals( fieldName ) ) + { + value = toEcd_id(); + } + else if( TRABALHADORES_ECDS_DATAS_ID.equals( fieldName ) ) + { + value = getTrabalhadores_ecds_datas_id(); + } + else if( TO_ECD_OFICIAL_ID.equals( fieldName ) ) + { + value = toEcd_oficial_id(); + } + else if( ANALISADOR_ID.equals( fieldName ) ) + { + value = getAnalisador_id(); + } + else if( TO_ANALISADOR_ID.equals( fieldName ) ) + { + value = toAnalisador_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( ECD_OFICIAL_ID.equals( fieldName ) ) + { + setEcd_oficial_id( (Integer) value ); + } + else if( TO_TRABALHADORES_ECDS_DATAS_ID.equals( fieldName ) ) + { + setToTrabalhadores_ecds_datas_id( (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData) value ); + } + else if( ECD_ID.equals( fieldName ) ) + { + setEcd_id( (Integer) value ); + } + else if( TO_ECD_ID.equals( fieldName ) ) + { + setToEcd_id( (com.evolute.siprp.server.db.data.siprp_local3.PrtTiposElementosProtocoloData) value ); + } + else if( TRABALHADORES_ECDS_DATAS_ID.equals( fieldName ) ) + { + setTrabalhadores_ecds_datas_id( (Integer) value ); + } + else if( TO_ECD_OFICIAL_ID.equals( fieldName ) ) + { + setToEcd_oficial_id( (com.evolute.siprp.server.db.data.siprp_local3.EcdOficialData) value ); + } + else if( ANALISADOR_ID.equals( fieldName ) ) + { + setAnalisador_id( (Integer) value ); + } + else if( TO_ANALISADOR_ID.equals( fieldName ) ) + { + setToAnalisador_id( (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_ECD_ID) != null ) + { + toEcd_id().save(); + dataHash.put(ECD_ID, toEcd_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrtTiposElementosProtocoloData.ID )); + } + + if( dataHash.get(TO_ECD_OFICIAL_ID) != null ) + { + toEcd_oficial_id().save(); + dataHash.put(ECD_OFICIAL_ID, toEcd_oficial_id().get( com.evolute.siprp.server.db.data.siprp_local3.EcdOficialData.ID )); + } + + if( dataHash.get(TO_TRABALHADORES_ECDS_DATAS_ID) != null ) + { + toTrabalhadores_ecds_datas_id().save(); + dataHash.put(TRABALHADORES_ECDS_DATAS_ID, toTrabalhadores_ecds_datas_id().get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData.ID )); + } + + if( dataHash.get(TO_ANALISADOR_ID) != null ) + { + toAnalisador_id().save(); + dataHash.put(ANALISADOR_ID, toAnalisador_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresEcd.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcds.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcds.java new file mode 100644 index 00000000..d101f69e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcds.java @@ -0,0 +1,183 @@ +/* +* TrabalhadoresEcds.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresEcds implements JDOInnerObject +{ + private Integer id; + private Integer trabalhador_id; + private Integer estado; + private java.util.Date data; + private Integer processo_id; + + public TrabalhadoresEcds() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresEcdsDataAuto.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresEcdsDataAuto.TRABALHADOR_ID ) + { + return trabalhador_id; + } + else if( fieldName == TrabalhadoresEcdsDataAuto.ESTADO ) + { + return estado; + } + else if( fieldName == TrabalhadoresEcdsDataAuto.DATA ) + { + return data; + } + else if( fieldName == TrabalhadoresEcdsDataAuto.PROCESSO_ID ) + { + return processo_id; + } + else if( fieldName.equals( TrabalhadoresEcdsDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresEcdsDataAuto.TRABALHADOR_ID ) ) + { + return trabalhador_id; + } + else if( fieldName.equals( TrabalhadoresEcdsDataAuto.ESTADO ) ) + { + return estado; + } + else if( fieldName.equals( TrabalhadoresEcdsDataAuto.DATA ) ) + { + return data; + } + else if( fieldName.equals( TrabalhadoresEcdsDataAuto.PROCESSO_ID ) ) + { + return processo_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresEcdsDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDataAuto.TRABALHADOR_ID ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDataAuto.ESTADO ) + { + estado = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDataAuto.DATA ) + { + data = ( java.util.Date ) value; + } + else if( fieldName == TrabalhadoresEcdsDataAuto.PROCESSO_ID ) + { + processo_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDataAuto.TRABALHADOR_ID ) ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDataAuto.ESTADO ) ) + { + estado = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDataAuto.DATA ) ) + { + data = ( java.util.Date ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDataAuto.PROCESSO_ID ) ) + { + processo_id = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getTrabalhador_id() + { + return trabalhador_id; + } + + public void setTrabalhador_id(Integer trabalhador_idValue ) + { + this.trabalhador_id = trabalhador_idValue; + } + + public Integer getEstado() + { + return estado; + } + + public void setEstado(Integer estadoValue ) + { + this.estado = estadoValue; + } + + public java.util.Date getData() + { + return data; + } + + public void setData(java.util.Date dataValue ) + { + this.data = dataValue; + } + + public Integer getProcesso_id() + { + return processo_id; + } + + public void setProcesso_id(Integer processo_idValue ) + { + this.processo_id = processo_idValue; + } + + public Class getOuterClass() + { + return TrabalhadoresEcdsDataAuto.class; + } + + public TrabalhadoresEcdsDataAuto getOuterClassInstance() + { + TrabalhadoresEcdsDataAuto outerObj = new TrabalhadoresEcdsDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsAnalise.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsAnalise.java new file mode 100644 index 00000000..fe5df3bc --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsAnalise.java @@ -0,0 +1,156 @@ +/* +* TrabalhadoresEcdsAnalise.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresEcdsAnalise implements JDOInnerObject +{ + private Integer id; + private java.util.Date data; + private Integer prestador_id; + private Integer grupo_ecds_id; + + public TrabalhadoresEcdsAnalise() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresEcdsAnaliseDataAuto.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresEcdsAnaliseDataAuto.DATA ) + { + return data; + } + else if( fieldName == TrabalhadoresEcdsAnaliseDataAuto.PRESTADOR_ID ) + { + return prestador_id; + } + else if( fieldName == TrabalhadoresEcdsAnaliseDataAuto.GRUPO_ECDS_ID ) + { + return grupo_ecds_id; + } + else if( fieldName.equals( TrabalhadoresEcdsAnaliseDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresEcdsAnaliseDataAuto.DATA ) ) + { + return data; + } + else if( fieldName.equals( TrabalhadoresEcdsAnaliseDataAuto.PRESTADOR_ID ) ) + { + return prestador_id; + } + else if( fieldName.equals( TrabalhadoresEcdsAnaliseDataAuto.GRUPO_ECDS_ID ) ) + { + return grupo_ecds_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresEcdsAnaliseDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsAnaliseDataAuto.DATA ) + { + data = ( java.util.Date ) value; + } + else if( fieldName == TrabalhadoresEcdsAnaliseDataAuto.PRESTADOR_ID ) + { + prestador_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsAnaliseDataAuto.GRUPO_ECDS_ID ) + { + grupo_ecds_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsAnaliseDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsAnaliseDataAuto.DATA ) ) + { + data = ( java.util.Date ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsAnaliseDataAuto.PRESTADOR_ID ) ) + { + prestador_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsAnaliseDataAuto.GRUPO_ECDS_ID ) ) + { + grupo_ecds_id = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public java.util.Date getData() + { + return data; + } + + public void setData(java.util.Date dataValue ) + { + this.data = dataValue; + } + + public Integer getPrestador_id() + { + return prestador_id; + } + + public void setPrestador_id(Integer prestador_idValue ) + { + this.prestador_id = prestador_idValue; + } + + public Integer getGrupo_ecds_id() + { + return grupo_ecds_id; + } + + public void setGrupo_ecds_id(Integer grupo_ecds_idValue ) + { + this.grupo_ecds_id = grupo_ecds_idValue; + } + + public Class getOuterClass() + { + return TrabalhadoresEcdsAnaliseDataAuto.class; + } + + public TrabalhadoresEcdsAnaliseDataAuto getOuterClassInstance() + { + TrabalhadoresEcdsAnaliseDataAuto outerObj = new TrabalhadoresEcdsAnaliseDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsAnaliseData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsAnaliseData.java new file mode 100644 index 00000000..ab22f4a9 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsAnaliseData.java @@ -0,0 +1,18 @@ +/* +* TrabalhadoresEcdsAnaliseDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class TrabalhadoresEcdsAnaliseData extends com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsAnaliseDataAuto +{ + + public TrabalhadoresEcdsAnaliseData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsAnaliseDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsAnaliseDataAuto.java new file mode 100644 index 00000000..addc7ef5 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsAnaliseDataAuto.java @@ -0,0 +1,225 @@ +/* +* TrabalhadoresEcdsAnaliseDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class TrabalhadoresEcdsAnaliseDataAuto extends JDOObject +{ + + public static final String TABLENAME = "trabalhadores_ecds_analise"; + + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_ecds_analise.id"; + public static final String DATA = "data"; + public static final String DATA_FULL = "trabalhadores_ecds_analise.data"; + public static final String PRESTADOR_ID = "prestador_id"; + public static final String PRESTADOR_ID_FULL = "trabalhadores_ecds_analise.prestador_id"; + public static final String TO_PRESTADOR_ID = "to prestador_id"; + public static final String GRUPO_ECDS_ID = "grupo_ecds_id"; + public static final String GRUPO_ECDS_ID_FULL = "trabalhadores_ecds_analise.grupo_ecds_id"; + public static final String TO_GRUPO_ECDS_ID = "to grupo_ecds_id"; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, PRESTADOR_ID, TO_PRESTADOR_ID, GRUPO_ECDS_ID, TO_GRUPO_ECDS_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATA, PRESTADOR_ID, GRUPO_ECDS_ID, }; + + private Map dataHash; + + public TrabalhadoresEcdsAnaliseDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public java.util.Date getData() + { + return (java.util.Date) get(DATA); + } + + public void setData(java.util.Date dataValue ) + { + this.set(DATA, dataValue ); + } + + public Integer getPrestador_id() + { + return (Integer) dataHash.get(PRESTADOR_ID); + } + + public void setPrestador_id(Integer prestador_idValue ) + { + dataHash.put(TO_PRESTADOR_ID, null); + dataHash.put(PRESTADOR_ID, prestador_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData toPrestador_id() + throws Exception + { + if( dataHash.get(TO_PRESTADOR_ID) == null && getPrestador_id() != null ) + { + dataHash.put(TO_PRESTADOR_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.class, new Object[]{ getPrestador_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) dataHash.get(TO_PRESTADOR_ID); + } + + public void setToPrestador_id(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData prestador_idObject ) + { + if( prestador_idObject == null ) + { + dataHash.put(PRESTADOR_ID, null); + } + else + { + dataHash.put(PRESTADOR_ID, prestador_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + dataHash.put(TO_PRESTADOR_ID, prestador_idObject); + } + + public Integer getGrupo_ecds_id() + { + return (Integer) dataHash.get(GRUPO_ECDS_ID); + } + + public void setGrupo_ecds_id(Integer grupo_ecds_idValue ) + { + dataHash.put(TO_GRUPO_ECDS_ID, null); + dataHash.put(GRUPO_ECDS_ID, grupo_ecds_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData toGrupo_ecds_id() + throws Exception + { + if( dataHash.get(TO_GRUPO_ECDS_ID) == null && getGrupo_ecds_id() != null ) + { + dataHash.put(TO_GRUPO_ECDS_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData.class, new Object[]{ getGrupo_ecds_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData) dataHash.get(TO_GRUPO_ECDS_ID); + } + + public void setToGrupo_ecds_id(com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData grupo_ecds_idObject ) + { + if( grupo_ecds_idObject == null ) + { + dataHash.put(GRUPO_ECDS_ID, null); + } + else + { + dataHash.put(GRUPO_ECDS_ID, grupo_ecds_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData.ID )); + } + dataHash.put(TO_GRUPO_ECDS_ID, grupo_ecds_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_PRESTADOR_ID.equals( fieldName ) ) + { + value = toPrestador_id(); + } + else if( TO_GRUPO_ECDS_ID.equals( fieldName ) ) + { + value = toGrupo_ecds_id(); + } + else if( GRUPO_ECDS_ID.equals( fieldName ) ) + { + value = getGrupo_ecds_id(); + } + else if( PRESTADOR_ID.equals( fieldName ) ) + { + value = getPrestador_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_PRESTADOR_ID.equals( fieldName ) ) + { + setToPrestador_id( (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) value ); + } + else if( TO_GRUPO_ECDS_ID.equals( fieldName ) ) + { + setToGrupo_ecds_id( (com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData) value ); + } + else if( GRUPO_ECDS_ID.equals( fieldName ) ) + { + setGrupo_ecds_id( (Integer) value ); + } + else if( PRESTADOR_ID.equals( fieldName ) ) + { + setPrestador_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_PRESTADOR_ID) != null ) + { + toPrestador_id().save(); + dataHash.put(PRESTADOR_ID, toPrestador_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + + if( dataHash.get(TO_GRUPO_ECDS_ID) != null ) + { + toGrupo_ecds_id().save(); + dataHash.put(GRUPO_ECDS_ID, toGrupo_ecds_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrtGruposProtocoloData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresEcdsAnalise.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsData.java new file mode 100644 index 00000000..49ff0612 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsData.java @@ -0,0 +1,18 @@ +/* +* TrabalhadoresEcdsDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class TrabalhadoresEcdsData extends com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDataAuto +{ + + public TrabalhadoresEcdsData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDataAuto.java new file mode 100644 index 00000000..2c247d98 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDataAuto.java @@ -0,0 +1,237 @@ +/* +* TrabalhadoresEcdsDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class TrabalhadoresEcdsDataAuto extends JDOObject +{ + + public static final String TABLENAME = "trabalhadores_ecds"; + + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_ecds.id"; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String TRABALHADOR_ID_FULL = "trabalhadores_ecds.trabalhador_id"; + public static final String TO_TRABALHADOR_ID = "to trabalhador_id"; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "trabalhadores_ecds.estado"; + public static final String DATA = "data"; + public static final String DATA_FULL = "trabalhadores_ecds.data"; + public static final String PROCESSO_ID = "processo_id"; + public static final String PROCESSO_ID_FULL = "trabalhadores_ecds.processo_id"; + public static final String TO_PROCESSO_ID = "to processo_id"; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADOR_ID, TO_TRABALHADOR_ID, ESTADO, DATA, PROCESSO_ID, TO_PROCESSO_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TRABALHADOR_ID, ESTADO, DATA, PROCESSO_ID, }; + + private Map dataHash; + + public TrabalhadoresEcdsDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getTrabalhador_id() + { + return (Integer) dataHash.get(TRABALHADOR_ID); + } + + public void setTrabalhador_id(Integer trabalhador_idValue ) + { + dataHash.put(TO_TRABALHADOR_ID, null); + dataHash.put(TRABALHADOR_ID, trabalhador_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData toTrabalhador_id() + throws Exception + { + if( dataHash.get(TO_TRABALHADOR_ID) == null && getTrabalhador_id() != null ) + { + dataHash.put(TO_TRABALHADOR_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData.class, new Object[]{ getTrabalhador_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData) dataHash.get(TO_TRABALHADOR_ID); + } + + public void setToTrabalhador_id(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData trabalhador_idObject ) + { + if( trabalhador_idObject == null ) + { + dataHash.put(TRABALHADOR_ID, null); + } + else + { + dataHash.put(TRABALHADOR_ID, trabalhador_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData.ID )); + } + dataHash.put(TO_TRABALHADOR_ID, trabalhador_idObject); + } + + public Integer getEstado() + { + return (Integer) get(ESTADO); + } + + public void setEstado(Integer estadoValue ) + { + this.set(ESTADO, estadoValue ); + } + + public java.util.Date getData() + { + return (java.util.Date) get(DATA); + } + + public void setData(java.util.Date dataValue ) + { + this.set(DATA, dataValue ); + } + + public Integer getProcesso_id() + { + return (Integer) dataHash.get(PROCESSO_ID); + } + + public void setProcesso_id(Integer processo_idValue ) + { + dataHash.put(TO_PROCESSO_ID, null); + dataHash.put(PROCESSO_ID, processo_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData toProcesso_id() + throws Exception + { + if( dataHash.get(TO_PROCESSO_ID) == null && getProcesso_id() != null ) + { + dataHash.put(TO_PROCESSO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData.class, new Object[]{ getProcesso_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData) dataHash.get(TO_PROCESSO_ID); + } + + public void setToProcesso_id(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData processo_idObject ) + { + if( processo_idObject == null ) + { + dataHash.put(PROCESSO_ID, null); + } + else + { + dataHash.put(PROCESSO_ID, processo_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData.ID )); + } + dataHash.put(TO_PROCESSO_ID, processo_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( PROCESSO_ID.equals( fieldName ) ) + { + value = getProcesso_id(); + } + else if( TO_TRABALHADOR_ID.equals( fieldName ) ) + { + value = toTrabalhador_id(); + } + else if( TO_PROCESSO_ID.equals( fieldName ) ) + { + value = toProcesso_id(); + } + else if( TRABALHADOR_ID.equals( fieldName ) ) + { + value = getTrabalhador_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( PROCESSO_ID.equals( fieldName ) ) + { + setProcesso_id( (Integer) value ); + } + else if( TO_TRABALHADOR_ID.equals( fieldName ) ) + { + setToTrabalhador_id( (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData) value ); + } + else if( TO_PROCESSO_ID.equals( fieldName ) ) + { + setToProcesso_id( (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData) value ); + } + else if( TRABALHADOR_ID.equals( fieldName ) ) + { + setTrabalhador_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_TRABALHADOR_ID) != null ) + { + toTrabalhador_id().save(); + dataHash.put(TRABALHADOR_ID, toTrabalhador_id().get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData.ID )); + } + + if( dataHash.get(TO_PROCESSO_ID) != null ) + { + toProcesso_id().save(); + dataHash.put(PROCESSO_ID, toProcesso_id().get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresEcds.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatas.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatas.java new file mode 100644 index 00000000..b1da8372 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatas.java @@ -0,0 +1,264 @@ +/* +* TrabalhadoresEcdsDatas.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresEcdsDatas implements JDOInnerObject +{ + private Integer id; + private Integer trabalhadores_ecds_id; + private java.util.Date data; + private Integer estado; + private Integer prestador_id; + private Integer analisador_id; + private java.util.Date data_envio; + private java.util.Date data_recepcao; + + public TrabalhadoresEcdsDatas() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresEcdsDatasDataAuto.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresEcdsDatasDataAuto.TRABALHADORES_ECDS_ID ) + { + return trabalhadores_ecds_id; + } + else if( fieldName == TrabalhadoresEcdsDatasDataAuto.DATA ) + { + return data; + } + else if( fieldName == TrabalhadoresEcdsDatasDataAuto.ESTADO ) + { + return estado; + } + else if( fieldName == TrabalhadoresEcdsDatasDataAuto.PRESTADOR_ID ) + { + return prestador_id; + } + else if( fieldName == TrabalhadoresEcdsDatasDataAuto.ANALISADOR_ID ) + { + return analisador_id; + } + else if( fieldName == TrabalhadoresEcdsDatasDataAuto.DATA_ENVIO ) + { + return data_envio; + } + else if( fieldName == TrabalhadoresEcdsDatasDataAuto.DATA_RECEPCAO ) + { + return data_recepcao; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasDataAuto.TRABALHADORES_ECDS_ID ) ) + { + return trabalhadores_ecds_id; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasDataAuto.DATA ) ) + { + return data; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasDataAuto.ESTADO ) ) + { + return estado; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasDataAuto.PRESTADOR_ID ) ) + { + return prestador_id; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasDataAuto.ANALISADOR_ID ) ) + { + return analisador_id; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasDataAuto.DATA_ENVIO ) ) + { + return data_envio; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasDataAuto.DATA_RECEPCAO ) ) + { + return data_recepcao; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresEcdsDatasDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasDataAuto.TRABALHADORES_ECDS_ID ) + { + trabalhadores_ecds_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasDataAuto.DATA ) + { + data = ( java.util.Date ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasDataAuto.ESTADO ) + { + estado = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasDataAuto.PRESTADOR_ID ) + { + prestador_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasDataAuto.ANALISADOR_ID ) + { + analisador_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasDataAuto.DATA_ENVIO ) + { + data_envio = ( java.util.Date ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasDataAuto.DATA_RECEPCAO ) + { + data_recepcao = ( java.util.Date ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasDataAuto.TRABALHADORES_ECDS_ID ) ) + { + trabalhadores_ecds_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasDataAuto.DATA ) ) + { + data = ( java.util.Date ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasDataAuto.ESTADO ) ) + { + estado = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasDataAuto.PRESTADOR_ID ) ) + { + prestador_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasDataAuto.ANALISADOR_ID ) ) + { + analisador_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasDataAuto.DATA_ENVIO ) ) + { + data_envio = ( java.util.Date ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasDataAuto.DATA_RECEPCAO ) ) + { + data_recepcao = ( java.util.Date ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getTrabalhadores_ecds_id() + { + return trabalhadores_ecds_id; + } + + public void setTrabalhadores_ecds_id(Integer trabalhadores_ecds_idValue ) + { + this.trabalhadores_ecds_id = trabalhadores_ecds_idValue; + } + + public java.util.Date getData() + { + return data; + } + + public void setData(java.util.Date dataValue ) + { + this.data = dataValue; + } + + public Integer getEstado() + { + return estado; + } + + public void setEstado(Integer estadoValue ) + { + this.estado = estadoValue; + } + + public Integer getPrestador_id() + { + return prestador_id; + } + + public void setPrestador_id(Integer prestador_idValue ) + { + this.prestador_id = prestador_idValue; + } + + public Integer getAnalisador_id() + { + return analisador_id; + } + + public void setAnalisador_id(Integer analisador_idValue ) + { + this.analisador_id = analisador_idValue; + } + + public java.util.Date getData_envio() + { + return data_envio; + } + + public void setData_envio(java.util.Date data_envioValue ) + { + this.data_envio = data_envioValue; + } + + public java.util.Date getData_recepcao() + { + return data_recepcao; + } + + public void setData_recepcao(java.util.Date data_recepcaoValue ) + { + this.data_recepcao = data_recepcaoValue; + } + + public Class getOuterClass() + { + return TrabalhadoresEcdsDatasDataAuto.class; + } + + public TrabalhadoresEcdsDatasDataAuto getOuterClassInstance() + { + TrabalhadoresEcdsDatasDataAuto outerObj = new TrabalhadoresEcdsDatasDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasData.java new file mode 100644 index 00000000..abb4cb1a --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasData.java @@ -0,0 +1,18 @@ +/* +* TrabalhadoresEcdsDatasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class TrabalhadoresEcdsDatasData extends com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasDataAuto +{ + + public TrabalhadoresEcdsDatasData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasDataAuto.java new file mode 100644 index 00000000..ed256936 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasDataAuto.java @@ -0,0 +1,322 @@ +/* +* TrabalhadoresEcdsDatasDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class TrabalhadoresEcdsDatasDataAuto extends JDOObject +{ + + public static final String TABLENAME = "trabalhadores_ecds_datas"; + + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_ecds_datas.id"; + public static final String TRABALHADORES_ECDS_ID = "trabalhadores_ecds_id"; + public static final String TRABALHADORES_ECDS_ID_FULL = "trabalhadores_ecds_datas.trabalhadores_ecds_id"; + public static final String TO_TRABALHADORES_ECDS_ID = "to trabalhadores_ecds_id"; + public static final String DATA = "data"; + public static final String DATA_FULL = "trabalhadores_ecds_datas.data"; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "trabalhadores_ecds_datas.estado"; + public static final String PRESTADOR_ID = "prestador_id"; + public static final String PRESTADOR_ID_FULL = "trabalhadores_ecds_datas.prestador_id"; + public static final String TO_PRESTADOR_ID = "to prestador_id"; + public static final String ANALISADOR_ID = "analisador_id"; + public static final String ANALISADOR_ID_FULL = "trabalhadores_ecds_datas.analisador_id"; + public static final String TO_ANALISADOR_ID = "to analisador_id"; + public static final String DATA_ENVIO = "data_envio"; + public static final String DATA_ENVIO_FULL = "trabalhadores_ecds_datas.data_envio"; + public static final String DATA_RECEPCAO = "data_recepcao"; + public static final String DATA_RECEPCAO_FULL = "trabalhadores_ecds_datas.data_recepcao"; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADORES_ECDS_ID, TO_TRABALHADORES_ECDS_ID, DATA, ESTADO, PRESTADOR_ID, + TO_PRESTADOR_ID, ANALISADOR_ID, TO_ANALISADOR_ID, DATA_ENVIO, DATA_RECEPCAO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TRABALHADORES_ECDS_ID, DATA, ESTADO, PRESTADOR_ID, ANALISADOR_ID, DATA_ENVIO, + DATA_RECEPCAO, }; + + private Map dataHash; + + public TrabalhadoresEcdsDatasDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getTrabalhadores_ecds_id() + { + return (Integer) dataHash.get(TRABALHADORES_ECDS_ID); + } + + public void setTrabalhadores_ecds_id(Integer trabalhadores_ecds_idValue ) + { + dataHash.put(TO_TRABALHADORES_ECDS_ID, null); + dataHash.put(TRABALHADORES_ECDS_ID, trabalhadores_ecds_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsData toTrabalhadores_ecds_id() + throws Exception + { + if( dataHash.get(TO_TRABALHADORES_ECDS_ID) == null && getTrabalhadores_ecds_id() != null ) + { + dataHash.put(TO_TRABALHADORES_ECDS_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsData.class, new Object[]{ getTrabalhadores_ecds_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsData) dataHash.get(TO_TRABALHADORES_ECDS_ID); + } + + public void setToTrabalhadores_ecds_id(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsData trabalhadores_ecds_idObject ) + { + if( trabalhadores_ecds_idObject == null ) + { + dataHash.put(TRABALHADORES_ECDS_ID, null); + } + else + { + dataHash.put(TRABALHADORES_ECDS_ID, trabalhadores_ecds_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsData.ID )); + } + dataHash.put(TO_TRABALHADORES_ECDS_ID, trabalhadores_ecds_idObject); + } + + public java.util.Date getData() + { + return (java.util.Date) get(DATA); + } + + public void setData(java.util.Date dataValue ) + { + this.set(DATA, dataValue ); + } + + public Integer getEstado() + { + return (Integer) get(ESTADO); + } + + public void setEstado(Integer estadoValue ) + { + this.set(ESTADO, estadoValue ); + } + + public Integer getPrestador_id() + { + return (Integer) dataHash.get(PRESTADOR_ID); + } + + public void setPrestador_id(Integer prestador_idValue ) + { + dataHash.put(TO_PRESTADOR_ID, null); + dataHash.put(PRESTADOR_ID, prestador_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData toPrestador_id() + throws Exception + { + if( dataHash.get(TO_PRESTADOR_ID) == null && getPrestador_id() != null ) + { + dataHash.put(TO_PRESTADOR_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.class, new Object[]{ getPrestador_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) dataHash.get(TO_PRESTADOR_ID); + } + + public void setToPrestador_id(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData prestador_idObject ) + { + if( prestador_idObject == null ) + { + dataHash.put(PRESTADOR_ID, null); + } + else + { + dataHash.put(PRESTADOR_ID, prestador_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + dataHash.put(TO_PRESTADOR_ID, prestador_idObject); + } + + public Integer getAnalisador_id() + { + return (Integer) dataHash.get(ANALISADOR_ID); + } + + public void setAnalisador_id(Integer analisador_idValue ) + { + dataHash.put(TO_ANALISADOR_ID, null); + dataHash.put(ANALISADOR_ID, analisador_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData toAnalisador_id() + throws Exception + { + if( dataHash.get(TO_ANALISADOR_ID) == null && getAnalisador_id() != null ) + { + dataHash.put(TO_ANALISADOR_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.class, new Object[]{ getAnalisador_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) dataHash.get(TO_ANALISADOR_ID); + } + + public void setToAnalisador_id(com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData analisador_idObject ) + { + if( analisador_idObject == null ) + { + dataHash.put(ANALISADOR_ID, null); + } + else + { + dataHash.put(ANALISADOR_ID, analisador_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + dataHash.put(TO_ANALISADOR_ID, analisador_idObject); + } + + public java.util.Date getData_envio() + { + return (java.util.Date) get(DATA_ENVIO); + } + + public void setData_envio(java.util.Date data_envioValue ) + { + this.set(DATA_ENVIO, data_envioValue ); + } + + public java.util.Date getData_recepcao() + { + return (java.util.Date) get(DATA_RECEPCAO); + } + + public void setData_recepcao(java.util.Date data_recepcaoValue ) + { + this.set(DATA_RECEPCAO, data_recepcaoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_PRESTADOR_ID.equals( fieldName ) ) + { + value = toPrestador_id(); + } + else if( TO_TRABALHADORES_ECDS_ID.equals( fieldName ) ) + { + value = toTrabalhadores_ecds_id(); + } + else if( PRESTADOR_ID.equals( fieldName ) ) + { + value = getPrestador_id(); + } + else if( TRABALHADORES_ECDS_ID.equals( fieldName ) ) + { + value = getTrabalhadores_ecds_id(); + } + else if( ANALISADOR_ID.equals( fieldName ) ) + { + value = getAnalisador_id(); + } + else if( TO_ANALISADOR_ID.equals( fieldName ) ) + { + value = toAnalisador_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_PRESTADOR_ID.equals( fieldName ) ) + { + setToPrestador_id( (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) value ); + } + else if( TO_TRABALHADORES_ECDS_ID.equals( fieldName ) ) + { + setToTrabalhadores_ecds_id( (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsData) value ); + } + else if( PRESTADOR_ID.equals( fieldName ) ) + { + setPrestador_id( (Integer) value ); + } + else if( TRABALHADORES_ECDS_ID.equals( fieldName ) ) + { + setTrabalhadores_ecds_id( (Integer) value ); + } + else if( ANALISADOR_ID.equals( fieldName ) ) + { + setAnalisador_id( (Integer) value ); + } + else if( TO_ANALISADOR_ID.equals( fieldName ) ) + { + setToAnalisador_id( (com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_TRABALHADORES_ECDS_ID) != null ) + { + toTrabalhadores_ecds_id().save(); + dataHash.put(TRABALHADORES_ECDS_ID, toTrabalhadores_ecds_id().get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsData.ID )); + } + + if( dataHash.get(TO_PRESTADOR_ID) != null ) + { + toPrestador_id().save(); + dataHash.put(PRESTADOR_ID, toPrestador_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + + if( dataHash.get(TO_ANALISADOR_ID) != null ) + { + toAnalisador_id().save(); + dataHash.put(ANALISADOR_ID, toAnalisador_id().get( com.evolute.siprp.server.db.data.siprp_local3.PrestadoresData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresEcdsDatas.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasEmails.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasEmails.java new file mode 100644 index 00000000..7bb286bf --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasEmails.java @@ -0,0 +1,210 @@ +/* +* TrabalhadoresEcdsDatasEmails.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresEcdsDatasEmails implements JDOInnerObject +{ + private Integer id; + private Integer trabalhadores_ecds_datas_id; + private String destination; + private java.util.Date data; + private String subject; + private String body; + + public TrabalhadoresEcdsDatasEmails() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresEcdsDatasEmailsDataAuto.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsDataAuto.TRABALHADORES_ECDS_DATAS_ID ) + { + return trabalhadores_ecds_datas_id; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsDataAuto.DESTINATION ) + { + return destination; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsDataAuto.DATA ) + { + return data; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsDataAuto.SUBJECT ) + { + return subject; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsDataAuto.BODY ) + { + return body; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsDataAuto.TRABALHADORES_ECDS_DATAS_ID ) ) + { + return trabalhadores_ecds_datas_id; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsDataAuto.DESTINATION ) ) + { + return destination; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsDataAuto.DATA ) ) + { + return data; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsDataAuto.SUBJECT ) ) + { + return subject; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsDataAuto.BODY ) ) + { + return body; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresEcdsDatasEmailsDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsDataAuto.TRABALHADORES_ECDS_DATAS_ID ) + { + trabalhadores_ecds_datas_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsDataAuto.DESTINATION ) + { + destination = ( String ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsDataAuto.DATA ) + { + data = ( java.util.Date ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsDataAuto.SUBJECT ) + { + subject = ( String ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsDataAuto.BODY ) + { + body = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsDataAuto.TRABALHADORES_ECDS_DATAS_ID ) ) + { + trabalhadores_ecds_datas_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsDataAuto.DESTINATION ) ) + { + destination = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsDataAuto.DATA ) ) + { + data = ( java.util.Date ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsDataAuto.SUBJECT ) ) + { + subject = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsDataAuto.BODY ) ) + { + body = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getTrabalhadores_ecds_datas_id() + { + return trabalhadores_ecds_datas_id; + } + + public void setTrabalhadores_ecds_datas_id(Integer trabalhadores_ecds_datas_idValue ) + { + this.trabalhadores_ecds_datas_id = trabalhadores_ecds_datas_idValue; + } + + public String getDestination() + { + return destination; + } + + public void setDestination(String destinationValue ) + { + this.destination = destinationValue; + } + + public java.util.Date getData() + { + return data; + } + + public void setData(java.util.Date dataValue ) + { + this.data = dataValue; + } + + public String getSubject() + { + return subject; + } + + public void setSubject(String subjectValue ) + { + this.subject = subjectValue; + } + + public String getBody() + { + return body; + } + + public void setBody(String bodyValue ) + { + this.body = bodyValue; + } + + public Class getOuterClass() + { + return TrabalhadoresEcdsDatasEmailsDataAuto.class; + } + + public TrabalhadoresEcdsDatasEmailsDataAuto getOuterClassInstance() + { + TrabalhadoresEcdsDatasEmailsDataAuto outerObj = new TrabalhadoresEcdsDatasEmailsDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasEmailsData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasEmailsData.java new file mode 100644 index 00000000..0e10bfc0 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasEmailsData.java @@ -0,0 +1,18 @@ +/* +* TrabalhadoresEcdsDatasEmailsDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class TrabalhadoresEcdsDatasEmailsData extends com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasEmailsDataAuto +{ + + public TrabalhadoresEcdsDatasEmailsData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasEmailsDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasEmailsDataAuto.java new file mode 100644 index 00000000..13e870b7 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasEmailsDataAuto.java @@ -0,0 +1,203 @@ +/* +* TrabalhadoresEcdsDatasEmailsDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class TrabalhadoresEcdsDatasEmailsDataAuto extends JDOObject +{ + + public static final String TABLENAME = "trabalhadores_ecds_datas_emails"; + + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_ecds_datas_emails.id"; + public static final String TRABALHADORES_ECDS_DATAS_ID = "trabalhadores_ecds_datas_id"; + public static final String TRABALHADORES_ECDS_DATAS_ID_FULL = "trabalhadores_ecds_datas_emails.trabalhadores_ecds_datas_id"; + public static final String TO_TRABALHADORES_ECDS_DATAS_ID = "to trabalhadores_ecds_datas_id"; + public static final String DESTINATION = "destination"; + public static final String DESTINATION_FULL = "trabalhadores_ecds_datas_emails.destination"; + public static final String DATA = "data"; + public static final String DATA_FULL = "trabalhadores_ecds_datas_emails.data"; + public static final String SUBJECT = "subject"; + public static final String SUBJECT_FULL = "trabalhadores_ecds_datas_emails.subject"; + public static final String BODY = "body"; + public static final String BODY_FULL = "trabalhadores_ecds_datas_emails.body"; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADORES_ECDS_DATAS_ID, TO_TRABALHADORES_ECDS_DATAS_ID, DESTINATION, + DATA, SUBJECT, BODY, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TRABALHADORES_ECDS_DATAS_ID, DESTINATION, DATA, SUBJECT, BODY, }; + + private Map dataHash; + + public TrabalhadoresEcdsDatasEmailsDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getTrabalhadores_ecds_datas_id() + { + return (Integer) dataHash.get(TRABALHADORES_ECDS_DATAS_ID); + } + + public void setTrabalhadores_ecds_datas_id(Integer trabalhadores_ecds_datas_idValue ) + { + dataHash.put(TO_TRABALHADORES_ECDS_DATAS_ID, null); + dataHash.put(TRABALHADORES_ECDS_DATAS_ID, trabalhadores_ecds_datas_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData toTrabalhadores_ecds_datas_id() + throws Exception + { + if( dataHash.get(TO_TRABALHADORES_ECDS_DATAS_ID) == null && getTrabalhadores_ecds_datas_id() != null ) + { + dataHash.put(TO_TRABALHADORES_ECDS_DATAS_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData.class, new Object[]{ getTrabalhadores_ecds_datas_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData) dataHash.get(TO_TRABALHADORES_ECDS_DATAS_ID); + } + + public void setToTrabalhadores_ecds_datas_id(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData trabalhadores_ecds_datas_idObject ) + { + if( trabalhadores_ecds_datas_idObject == null ) + { + dataHash.put(TRABALHADORES_ECDS_DATAS_ID, null); + } + else + { + dataHash.put(TRABALHADORES_ECDS_DATAS_ID, trabalhadores_ecds_datas_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData.ID )); + } + dataHash.put(TO_TRABALHADORES_ECDS_DATAS_ID, trabalhadores_ecds_datas_idObject); + } + + public String getDestination() + { + return (String) get(DESTINATION); + } + + public void setDestination(String destinationValue ) + { + this.set(DESTINATION, destinationValue ); + } + + public java.util.Date getData() + { + return (java.util.Date) get(DATA); + } + + public void setData(java.util.Date dataValue ) + { + this.set(DATA, dataValue ); + } + + public String getSubject() + { + return (String) get(SUBJECT); + } + + public void setSubject(String subjectValue ) + { + this.set(SUBJECT, subjectValue ); + } + + public String getBody() + { + return (String) get(BODY); + } + + public void setBody(String bodyValue ) + { + this.set(BODY, bodyValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_TRABALHADORES_ECDS_DATAS_ID.equals( fieldName ) ) + { + value = toTrabalhadores_ecds_datas_id(); + } + else if( TRABALHADORES_ECDS_DATAS_ID.equals( fieldName ) ) + { + value = getTrabalhadores_ecds_datas_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_TRABALHADORES_ECDS_DATAS_ID.equals( fieldName ) ) + { + setToTrabalhadores_ecds_datas_id( (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData) value ); + } + else if( TRABALHADORES_ECDS_DATAS_ID.equals( fieldName ) ) + { + setTrabalhadores_ecds_datas_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_TRABALHADORES_ECDS_DATAS_ID) != null ) + { + toTrabalhadores_ecds_datas_id().save(); + dataHash.put(TRABALHADORES_ECDS_DATAS_ID, toTrabalhadores_ecds_datas_id().get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresEcdsDatasEmails.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasObservacoes.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasObservacoes.java new file mode 100644 index 00000000..30c7f236 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasObservacoes.java @@ -0,0 +1,129 @@ +/* +* TrabalhadoresEcdsDatasObservacoes.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresEcdsDatasObservacoes implements JDOInnerObject +{ + private Integer id; + private Integer trabalhadores_ecds_datas_id; + private String observacao; + + public TrabalhadoresEcdsDatasObservacoes() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresEcdsDatasObservacoesDataAuto.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresEcdsDatasObservacoesDataAuto.TRABALHADORES_ECDS_DATAS_ID ) + { + return trabalhadores_ecds_datas_id; + } + else if( fieldName == TrabalhadoresEcdsDatasObservacoesDataAuto.OBSERVACAO ) + { + return observacao; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasObservacoesDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasObservacoesDataAuto.TRABALHADORES_ECDS_DATAS_ID ) ) + { + return trabalhadores_ecds_datas_id; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasObservacoesDataAuto.OBSERVACAO ) ) + { + return observacao; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresEcdsDatasObservacoesDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasObservacoesDataAuto.TRABALHADORES_ECDS_DATAS_ID ) + { + trabalhadores_ecds_datas_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasObservacoesDataAuto.OBSERVACAO ) + { + observacao = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasObservacoesDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasObservacoesDataAuto.TRABALHADORES_ECDS_DATAS_ID ) ) + { + trabalhadores_ecds_datas_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasObservacoesDataAuto.OBSERVACAO ) ) + { + observacao = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getTrabalhadores_ecds_datas_id() + { + return trabalhadores_ecds_datas_id; + } + + public void setTrabalhadores_ecds_datas_id(Integer trabalhadores_ecds_datas_idValue ) + { + this.trabalhadores_ecds_datas_id = trabalhadores_ecds_datas_idValue; + } + + public String getObservacao() + { + return observacao; + } + + public void setObservacao(String observacaoValue ) + { + this.observacao = observacaoValue; + } + + public Class getOuterClass() + { + return TrabalhadoresEcdsDatasObservacoesDataAuto.class; + } + + public TrabalhadoresEcdsDatasObservacoesDataAuto getOuterClassInstance() + { + TrabalhadoresEcdsDatasObservacoesDataAuto outerObj = new TrabalhadoresEcdsDatasObservacoesDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasObservacoesData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasObservacoesData.java new file mode 100644 index 00000000..46c9dbf2 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasObservacoesData.java @@ -0,0 +1,18 @@ +/* +* TrabalhadoresEcdsDatasObservacoesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class TrabalhadoresEcdsDatasObservacoesData extends com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasObservacoesDataAuto +{ + + public TrabalhadoresEcdsDatasObservacoesData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasObservacoesDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasObservacoesDataAuto.java new file mode 100644 index 00000000..2ec2503e --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresEcdsDatasObservacoesDataAuto.java @@ -0,0 +1,166 @@ +/* +* TrabalhadoresEcdsDatasObservacoesDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class TrabalhadoresEcdsDatasObservacoesDataAuto extends JDOObject +{ + + public static final String TABLENAME = "trabalhadores_ecds_datas_observacoes"; + + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_ecds_datas_observacoes.id"; + public static final String TRABALHADORES_ECDS_DATAS_ID = "trabalhadores_ecds_datas_id"; + public static final String TRABALHADORES_ECDS_DATAS_ID_FULL = "trabalhadores_ecds_datas_observacoes.trabalhadores_ecds_datas_id"; + public static final String TO_TRABALHADORES_ECDS_DATAS_ID = "to trabalhadores_ecds_datas_id"; + public static final String OBSERVACAO = "observacao"; + public static final String OBSERVACAO_FULL = "trabalhadores_ecds_datas_observacoes.observacao"; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADORES_ECDS_DATAS_ID, TO_TRABALHADORES_ECDS_DATAS_ID, OBSERVACAO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TRABALHADORES_ECDS_DATAS_ID, OBSERVACAO, }; + + private Map dataHash; + + public TrabalhadoresEcdsDatasObservacoesDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getTrabalhadores_ecds_datas_id() + { + return (Integer) dataHash.get(TRABALHADORES_ECDS_DATAS_ID); + } + + public void setTrabalhadores_ecds_datas_id(Integer trabalhadores_ecds_datas_idValue ) + { + dataHash.put(TO_TRABALHADORES_ECDS_DATAS_ID, null); + dataHash.put(TRABALHADORES_ECDS_DATAS_ID, trabalhadores_ecds_datas_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData toTrabalhadores_ecds_datas_id() + throws Exception + { + if( dataHash.get(TO_TRABALHADORES_ECDS_DATAS_ID) == null && getTrabalhadores_ecds_datas_id() != null ) + { + dataHash.put(TO_TRABALHADORES_ECDS_DATAS_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData.class, new Object[]{ getTrabalhadores_ecds_datas_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData) dataHash.get(TO_TRABALHADORES_ECDS_DATAS_ID); + } + + public void setToTrabalhadores_ecds_datas_id(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData trabalhadores_ecds_datas_idObject ) + { + if( trabalhadores_ecds_datas_idObject == null ) + { + dataHash.put(TRABALHADORES_ECDS_DATAS_ID, null); + } + else + { + dataHash.put(TRABALHADORES_ECDS_DATAS_ID, trabalhadores_ecds_datas_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData.ID )); + } + dataHash.put(TO_TRABALHADORES_ECDS_DATAS_ID, trabalhadores_ecds_datas_idObject); + } + + public String getObservacao() + { + return (String) get(OBSERVACAO); + } + + public void setObservacao(String observacaoValue ) + { + this.set(OBSERVACAO, observacaoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_TRABALHADORES_ECDS_DATAS_ID.equals( fieldName ) ) + { + value = toTrabalhadores_ecds_datas_id(); + } + else if( TRABALHADORES_ECDS_DATAS_ID.equals( fieldName ) ) + { + value = getTrabalhadores_ecds_datas_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_TRABALHADORES_ECDS_DATAS_ID.equals( fieldName ) ) + { + setToTrabalhadores_ecds_datas_id( (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData) value ); + } + else if( TRABALHADORES_ECDS_DATAS_ID.equals( fieldName ) ) + { + setTrabalhadores_ecds_datas_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_TRABALHADORES_ECDS_DATAS_ID) != null ) + { + toTrabalhadores_ecds_datas_id().save(); + dataHash.put(TRABALHADORES_ECDS_DATAS_ID, toTrabalhadores_ecds_datas_id().get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresEcdsDatasData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresEcdsDatasObservacoes.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresFichasAptidao.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresFichasAptidao.java new file mode 100644 index 00000000..d29befeb --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresFichasAptidao.java @@ -0,0 +1,129 @@ +/* +* TrabalhadoresFichasAptidao.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresFichasAptidao implements JDOInnerObject +{ + private Integer id; + private Integer processo_id; + private Integer exame_id; + + public TrabalhadoresFichasAptidao() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresFichasAptidaoDataAuto.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresFichasAptidaoDataAuto.PROCESSO_ID ) + { + return processo_id; + } + else if( fieldName == TrabalhadoresFichasAptidaoDataAuto.EXAME_ID ) + { + return exame_id; + } + else if( fieldName.equals( TrabalhadoresFichasAptidaoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresFichasAptidaoDataAuto.PROCESSO_ID ) ) + { + return processo_id; + } + else if( fieldName.equals( TrabalhadoresFichasAptidaoDataAuto.EXAME_ID ) ) + { + return exame_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresFichasAptidaoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresFichasAptidaoDataAuto.PROCESSO_ID ) + { + processo_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresFichasAptidaoDataAuto.EXAME_ID ) + { + exame_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresFichasAptidaoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresFichasAptidaoDataAuto.PROCESSO_ID ) ) + { + processo_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresFichasAptidaoDataAuto.EXAME_ID ) ) + { + exame_id = ( Integer ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getProcesso_id() + { + return processo_id; + } + + public void setProcesso_id(Integer processo_idValue ) + { + this.processo_id = processo_idValue; + } + + public Integer getExame_id() + { + return exame_id; + } + + public void setExame_id(Integer exame_idValue ) + { + this.exame_id = exame_idValue; + } + + public Class getOuterClass() + { + return TrabalhadoresFichasAptidaoDataAuto.class; + } + + public TrabalhadoresFichasAptidaoDataAuto getOuterClassInstance() + { + TrabalhadoresFichasAptidaoDataAuto outerObj = new TrabalhadoresFichasAptidaoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresFichasAptidaoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresFichasAptidaoData.java new file mode 100644 index 00000000..b6e38bc3 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresFichasAptidaoData.java @@ -0,0 +1,18 @@ +/* +* TrabalhadoresFichasAptidaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class TrabalhadoresFichasAptidaoData extends com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresFichasAptidaoDataAuto +{ + + public TrabalhadoresFichasAptidaoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresFichasAptidaoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresFichasAptidaoDataAuto.java new file mode 100644 index 00000000..154bcaa3 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresFichasAptidaoDataAuto.java @@ -0,0 +1,213 @@ +/* +* TrabalhadoresFichasAptidaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class TrabalhadoresFichasAptidaoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "trabalhadores_fichas_aptidao"; + + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_fichas_aptidao.id"; + public static final String PROCESSO_ID = "processo_id"; + public static final String PROCESSO_ID_FULL = "trabalhadores_fichas_aptidao.processo_id"; + public static final String TO_PROCESSO_ID = "to processo_id"; + public static final String EXAME_ID = "exame_id"; + public static final String EXAME_ID_FULL = "trabalhadores_fichas_aptidao.exame_id"; + public static final String TO_EXAME_ID = "to exame_id"; + + public static final String FIELD_NAMES[] = new String[]{ + PROCESSO_ID, TO_PROCESSO_ID, EXAME_ID, TO_EXAME_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, PROCESSO_ID, EXAME_ID, }; + + private Map dataHash; + + public TrabalhadoresFichasAptidaoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getProcesso_id() + { + return (Integer) dataHash.get(PROCESSO_ID); + } + + public void setProcesso_id(Integer processo_idValue ) + { + dataHash.put(TO_PROCESSO_ID, null); + dataHash.put(PROCESSO_ID, processo_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData toProcesso_id() + throws Exception + { + if( dataHash.get(TO_PROCESSO_ID) == null && getProcesso_id() != null ) + { + dataHash.put(TO_PROCESSO_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData.class, new Object[]{ getProcesso_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData) dataHash.get(TO_PROCESSO_ID); + } + + public void setToProcesso_id(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData processo_idObject ) + { + if( processo_idObject == null ) + { + dataHash.put(PROCESSO_ID, null); + } + else + { + dataHash.put(PROCESSO_ID, processo_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData.ID )); + } + dataHash.put(TO_PROCESSO_ID, processo_idObject); + } + + public Integer getExame_id() + { + return (Integer) dataHash.get(EXAME_ID); + } + + public void setExame_id(Integer exame_idValue ) + { + dataHash.put(TO_EXAME_ID, null); + dataHash.put(EXAME_ID, exame_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.ExamesData toExame_id() + throws Exception + { + if( dataHash.get(TO_EXAME_ID) == null && getExame_id() != null ) + { + dataHash.put(TO_EXAME_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.ExamesData.class, new Object[]{ getExame_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.ExamesData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.ExamesData) dataHash.get(TO_EXAME_ID); + } + + public void setToExame_id(com.evolute.siprp.server.db.data.siprp_local3.ExamesData exame_idObject ) + { + if( exame_idObject == null ) + { + dataHash.put(EXAME_ID, null); + } + else + { + dataHash.put(EXAME_ID, exame_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.ExamesData.ID )); + } + dataHash.put(TO_EXAME_ID, exame_idObject); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( EXAME_ID.equals( fieldName ) ) + { + value = getExame_id(); + } + else if( TO_EXAME_ID.equals( fieldName ) ) + { + value = toExame_id(); + } + else if( PROCESSO_ID.equals( fieldName ) ) + { + value = getProcesso_id(); + } + else if( TO_PROCESSO_ID.equals( fieldName ) ) + { + value = toProcesso_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( EXAME_ID.equals( fieldName ) ) + { + setExame_id( (Integer) value ); + } + else if( TO_EXAME_ID.equals( fieldName ) ) + { + setToExame_id( (com.evolute.siprp.server.db.data.siprp_local3.ExamesData) value ); + } + else if( PROCESSO_ID.equals( fieldName ) ) + { + setProcesso_id( (Integer) value ); + } + else if( TO_PROCESSO_ID.equals( fieldName ) ) + { + setToProcesso_id( (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_PROCESSO_ID) != null ) + { + toProcesso_id().save(); + dataHash.put(PROCESSO_ID, toProcesso_id().get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoData.ID )); + } + + if( dataHash.get(TO_EXAME_ID) != null ) + { + toExame_id().save(); + dataHash.put(EXAME_ID, toExame_id().get( com.evolute.siprp.server.db.data.siprp_local3.ExamesData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresFichasAptidao.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresProcesso.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresProcesso.java new file mode 100644 index 00000000..0b5bafce --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresProcesso.java @@ -0,0 +1,264 @@ +/* +* TrabalhadoresProcesso.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresProcesso implements JDOInnerObject +{ + private Integer id; + private Integer trabalhador_id; + private String estado; + private java.util.Date data_inicio; + private java.util.Date data_fim; + private Integer motivo; + private Integer sub_motivo; + private String activo; + + public TrabalhadoresProcesso() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresProcessoDataAuto.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresProcessoDataAuto.TRABALHADOR_ID ) + { + return trabalhador_id; + } + else if( fieldName == TrabalhadoresProcessoDataAuto.ESTADO ) + { + return estado; + } + else if( fieldName == TrabalhadoresProcessoDataAuto.DATA_INICIO ) + { + return data_inicio; + } + else if( fieldName == TrabalhadoresProcessoDataAuto.DATA_FIM ) + { + return data_fim; + } + else if( fieldName == TrabalhadoresProcessoDataAuto.MOTIVO ) + { + return motivo; + } + else if( fieldName == TrabalhadoresProcessoDataAuto.SUB_MOTIVO ) + { + return sub_motivo; + } + else if( fieldName == TrabalhadoresProcessoDataAuto.ACTIVO ) + { + return activo; + } + else if( fieldName.equals( TrabalhadoresProcessoDataAuto.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresProcessoDataAuto.TRABALHADOR_ID ) ) + { + return trabalhador_id; + } + else if( fieldName.equals( TrabalhadoresProcessoDataAuto.ESTADO ) ) + { + return estado; + } + else if( fieldName.equals( TrabalhadoresProcessoDataAuto.DATA_INICIO ) ) + { + return data_inicio; + } + else if( fieldName.equals( TrabalhadoresProcessoDataAuto.DATA_FIM ) ) + { + return data_fim; + } + else if( fieldName.equals( TrabalhadoresProcessoDataAuto.MOTIVO ) ) + { + return motivo; + } + else if( fieldName.equals( TrabalhadoresProcessoDataAuto.SUB_MOTIVO ) ) + { + return sub_motivo; + } + else if( fieldName.equals( TrabalhadoresProcessoDataAuto.ACTIVO ) ) + { + return activo; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresProcessoDataAuto.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresProcessoDataAuto.TRABALHADOR_ID ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresProcessoDataAuto.ESTADO ) + { + estado = ( String ) value; + } + else if( fieldName == TrabalhadoresProcessoDataAuto.DATA_INICIO ) + { + data_inicio = ( java.util.Date ) value; + } + else if( fieldName == TrabalhadoresProcessoDataAuto.DATA_FIM ) + { + data_fim = ( java.util.Date ) value; + } + else if( fieldName == TrabalhadoresProcessoDataAuto.MOTIVO ) + { + motivo = ( Integer ) value; + } + else if( fieldName == TrabalhadoresProcessoDataAuto.SUB_MOTIVO ) + { + sub_motivo = ( Integer ) value; + } + else if( fieldName == TrabalhadoresProcessoDataAuto.ACTIVO ) + { + activo = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresProcessoDataAuto.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresProcessoDataAuto.TRABALHADOR_ID ) ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresProcessoDataAuto.ESTADO ) ) + { + estado = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresProcessoDataAuto.DATA_INICIO ) ) + { + data_inicio = ( java.util.Date ) value; + } + else if( fieldName.equals( TrabalhadoresProcessoDataAuto.DATA_FIM ) ) + { + data_fim = ( java.util.Date ) value; + } + else if( fieldName.equals( TrabalhadoresProcessoDataAuto.MOTIVO ) ) + { + motivo = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresProcessoDataAuto.SUB_MOTIVO ) ) + { + sub_motivo = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresProcessoDataAuto.ACTIVO ) ) + { + activo = ( String ) value; + } + } + + public Integer getId() + { + return id; + } + + public void setId(Integer idValue ) + { + this.id = idValue; + } + + public Integer getTrabalhador_id() + { + return trabalhador_id; + } + + public void setTrabalhador_id(Integer trabalhador_idValue ) + { + this.trabalhador_id = trabalhador_idValue; + } + + public String getEstado() + { + return estado; + } + + public void setEstado(String estadoValue ) + { + this.estado = estadoValue; + } + + public java.util.Date getData_inicio() + { + return data_inicio; + } + + public void setData_inicio(java.util.Date data_inicioValue ) + { + this.data_inicio = data_inicioValue; + } + + public java.util.Date getData_fim() + { + return data_fim; + } + + public void setData_fim(java.util.Date data_fimValue ) + { + this.data_fim = data_fimValue; + } + + public Integer getMotivo() + { + return motivo; + } + + public void setMotivo(Integer motivoValue ) + { + this.motivo = motivoValue; + } + + public Integer getSub_motivo() + { + return sub_motivo; + } + + public void setSub_motivo(Integer sub_motivoValue ) + { + this.sub_motivo = sub_motivoValue; + } + + public String getActivo() + { + return activo; + } + + public void setActivo(String activoValue ) + { + this.activo = activoValue; + } + + public Class getOuterClass() + { + return TrabalhadoresProcessoDataAuto.class; + } + + public TrabalhadoresProcessoDataAuto getOuterClassInstance() + { + TrabalhadoresProcessoDataAuto outerObj = new TrabalhadoresProcessoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresProcessoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresProcessoData.java new file mode 100644 index 00000000..b8dae785 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresProcessoData.java @@ -0,0 +1,18 @@ +/* +* TrabalhadoresProcessoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class TrabalhadoresProcessoData extends com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresProcessoDataAuto +{ + + public TrabalhadoresProcessoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresProcessoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresProcessoDataAuto.java new file mode 100644 index 00000000..b1e393af --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/TrabalhadoresProcessoDataAuto.java @@ -0,0 +1,227 @@ +/* +* TrabalhadoresProcessoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class TrabalhadoresProcessoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "trabalhadores_processo"; + + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_processo.id"; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String TRABALHADOR_ID_FULL = "trabalhadores_processo.trabalhador_id"; + public static final String TO_TRABALHADOR_ID = "to trabalhador_id"; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "trabalhadores_processo.estado"; + public static final String DATA_INICIO = "data_inicio"; + public static final String DATA_INICIO_FULL = "trabalhadores_processo.data_inicio"; + public static final String DATA_FIM = "data_fim"; + public static final String DATA_FIM_FULL = "trabalhadores_processo.data_fim"; + public static final String MOTIVO = "motivo"; + public static final String MOTIVO_FULL = "trabalhadores_processo.motivo"; + public static final String SUB_MOTIVO = "sub_motivo"; + public static final String SUB_MOTIVO_FULL = "trabalhadores_processo.sub_motivo"; + public static final String ACTIVO = "activo"; + public static final String ACTIVO_FULL = "trabalhadores_processo.activo"; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADOR_ID, TO_TRABALHADOR_ID, ESTADO, DATA_INICIO, DATA_FIM, MOTIVO, + SUB_MOTIVO, ACTIVO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TRABALHADOR_ID, ESTADO, DATA_INICIO, DATA_FIM, MOTIVO, SUB_MOTIVO, ACTIVO, }; + + private Map dataHash; + + public TrabalhadoresProcessoDataAuto() + { + dataHash = new HashMap(); + } + + public Integer getId() + { + return (Integer) get(ID); + } + + public void setId(Integer idValue ) + { + this.set(ID, idValue ); + } + + public Integer getTrabalhador_id() + { + return (Integer) dataHash.get(TRABALHADOR_ID); + } + + public void setTrabalhador_id(Integer trabalhador_idValue ) + { + dataHash.put(TO_TRABALHADOR_ID, null); + dataHash.put(TRABALHADOR_ID, trabalhador_idValue ); + } + + public com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData toTrabalhador_id() + throws Exception + { + if( dataHash.get(TO_TRABALHADOR_ID) == null && getTrabalhador_id() != null ) + { + dataHash.put(TO_TRABALHADOR_ID, getJDOProvider().load(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData.class, new Object[]{ getTrabalhador_id() }, new String[]{ com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData.ID })); + } + return (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData) dataHash.get(TO_TRABALHADOR_ID); + } + + public void setToTrabalhador_id(com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData trabalhador_idObject ) + { + if( trabalhador_idObject == null ) + { + dataHash.put(TRABALHADOR_ID, null); + } + else + { + dataHash.put(TRABALHADOR_ID, trabalhador_idObject.get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData.ID )); + } + dataHash.put(TO_TRABALHADOR_ID, trabalhador_idObject); + } + + public String getEstado() + { + return (String) get(ESTADO); + } + + public void setEstado(String estadoValue ) + { + this.set(ESTADO, estadoValue ); + } + + public java.util.Date getData_inicio() + { + return (java.util.Date) get(DATA_INICIO); + } + + public void setData_inicio(java.util.Date data_inicioValue ) + { + this.set(DATA_INICIO, data_inicioValue ); + } + + public java.util.Date getData_fim() + { + return (java.util.Date) get(DATA_FIM); + } + + public void setData_fim(java.util.Date data_fimValue ) + { + this.set(DATA_FIM, data_fimValue ); + } + + public Integer getMotivo() + { + return (Integer) get(MOTIVO); + } + + public void setMotivo(Integer motivoValue ) + { + this.set(MOTIVO, motivoValue ); + } + + public Integer getSub_motivo() + { + return (Integer) get(SUB_MOTIVO); + } + + public void setSub_motivo(Integer sub_motivoValue ) + { + this.set(SUB_MOTIVO, sub_motivoValue ); + } + + public String getActivo() + { + return (String) get(ACTIVO); + } + + public void setActivo(String activoValue ) + { + this.set(ACTIVO, activoValue ); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + if( TO_TRABALHADOR_ID.equals( fieldName ) ) + { + value = toTrabalhador_id(); + } + else if( TRABALHADOR_ID.equals( fieldName ) ) + { + value = getTrabalhador_id(); + } + else + { + value = dataHash.get( fieldName ); + } + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + if( TO_TRABALHADOR_ID.equals( fieldName ) ) + { + setToTrabalhador_id( (com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData) value ); + } + else if( TRABALHADOR_ID.equals( fieldName ) ) + { + setTrabalhador_id( (Integer) value ); + } + else + { + dataHash.put( fieldName, value ); + } + } + + public void save() + throws Exception + { + if( dataHash.get(TO_TRABALHADOR_ID) != null ) + { + toTrabalhador_id().save(); + dataHash.put(TRABALHADOR_ID, toTrabalhador_id().get( com.evolute.siprp.server.db.data.siprp_local3.TrabalhadoresData.ID )); + } + + super.save(); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresProcesso.class; + } + + public Integer getJDOPrimaryKey() + { + Object obj = this.getId(); + if(obj instanceof JDOObject){ + obj = ((JDOObject) obj).getInnerObject(); + } + return (Integer) obj; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Versao.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Versao.java new file mode 100644 index 00000000..7546c595 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Versao.java @@ -0,0 +1,44 @@ +/* +* Versao.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class Versao implements JDOInnerObject +{ + + public Versao() + { + } + + public Object getField( String fieldName ) + { + return null; + } + + public void setField( String fieldName, Object value ) + { + } + + public Class getOuterClass() + { + return VersaoDataAuto.class; + } + + public VersaoDataAuto getOuterClassInstance() + { + VersaoDataAuto outerObj = new VersaoDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Object getJDOPrimaryKey() + { + return null; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/VersaoData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/VersaoData.java new file mode 100644 index 00000000..e0b34a1b --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/VersaoData.java @@ -0,0 +1,18 @@ +/* +* VersaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class VersaoData extends com.evolute.siprp.server.db.data.siprp_local3.VersaoDataAuto +{ + + public VersaoData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/VersaoDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/VersaoDataAuto.java new file mode 100644 index 00000000..061a6016 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/VersaoDataAuto.java @@ -0,0 +1,67 @@ +/* +* VersaoDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class VersaoDataAuto extends JDOObject +{ + + public static final String TABLENAME = "versao"; + + + public static final String FIELD_NAMES[] = new String[]{ + }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + }; + + private Map dataHash; + + public VersaoDataAuto() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Versao.class; + } + + public Object getJDOPrimaryKey() + { + return null; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Version.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Version.java new file mode 100644 index 00000000..58df9226 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/Version.java @@ -0,0 +1,44 @@ +/* +* Version.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; + +public final class Version implements JDOInnerObject +{ + + public Version() + { + } + + public Object getField( String fieldName ) + { + return null; + } + + public void setField( String fieldName, Object value ) + { + } + + public Class getOuterClass() + { + return VersionDataAuto.class; + } + + public VersionDataAuto getOuterClassInstance() + { + VersionDataAuto outerObj = new VersionDataAuto(); + outerObj.setInnerObject(this); + return outerObj; + } + + public Object getJDOPrimaryKey() + { + return null; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/VersionData.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/VersionData.java new file mode 100644 index 00000000..1858af61 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/VersionData.java @@ -0,0 +1,18 @@ +/* +* VersionDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Edit at will +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + + +public final class VersionData extends com.evolute.siprp.server.db.data.siprp_local3.VersionDataAuto +{ + + public VersionData() + { + super(); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/VersionDataAuto.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/VersionDataAuto.java new file mode 100644 index 00000000..8d8e4a33 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/VersionDataAuto.java @@ -0,0 +1,67 @@ +/* +* VersionDataAuto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator +* +* Use but DON'T TOUCH +*/ +package com.evolute.siprp.server.db.data.siprp_local3; + +import com.evolute.utils.jdo.*; +import java.util.HashMap; +import java.util.Map; + +class VersionDataAuto extends JDOObject +{ + + public static final String TABLENAME = "version"; + + + public static final String FIELD_NAMES[] = new String[]{ + }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + }; + + private Map dataHash; + + public VersionDataAuto() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + Object value = null; + value = dataHash.get( fieldName ); + return value; + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Version.class; + } + + public Object getJDOPrimaryKey() + { + return null; + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/package.jdo b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/package.jdo new file mode 100644 index 00000000..66d97264 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/db/data/siprp_local3/package.jdo @@ -0,0 +1,2272 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoLogic.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoLogic.java new file mode 100644 index 00000000..d30ed7af --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoLogic.java @@ -0,0 +1,193 @@ +package com.evolute.siprp.server.logic.AnaliseAcidentesTrabalho; + +import java.util.Date; +import java.util.Vector; + +import com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.AnaliseAcidentesTrabalhoService; +import com.evolute.siprp.client.panels.utils.AppConstants; +import com.evolute.siprp.client.panels.utils.permissoes.RolesConstants; +import com.evolute.siprp.client.vo.ActualTableRow; +import com.evolute.siprp.client.vo.Utilizador; +import com.evolute.siprp.server.logic.AnaliseAcidentesTrabalho.actual.ActualTableDataProvider; +import com.evolute.siprp.server.logic.AnaliseAcidentesTrabalho.seguimento.SeguimentoTableDataProvider; +import com.evolute.utils.arrays.Virtual2DArray; + +public class AnaliseAcidentesTrabalhoLogic implements AnaliseAcidentesTrabalhoService +{ + + private ActualTableDataProvider actualProvider = null; + private SeguimentoTableDataProvider seguimentoProvider = null; + + + public AnaliseAcidentesTrabalhoLogic() + { + try + { + actualProvider = ActualTableDataProvider.getProvider(); + seguimentoProvider = SeguimentoTableDataProvider.getProvider(); + } + catch ( Exception e ) + { + e.printStackTrace(); + } + } + + + public String getFase( int estado ) + { + String fase = null; + + if ( estado == AppConstants.ESTADO_SEG ) + { + fase = "FASE 1 - SEG - ABERTURA"; + } + else if ( estado == AppConstants.ESTADO_RH1 ) + { + fase = "FASE 2 - RH - ACOMPANHAMENTO"; + } + else if ( estado == AppConstants.ESTADO_HS ) + { + fase = "FASE 3 - SIPRP - RECOMENDA\u00C7\u00D5ES"; + } + else if ( estado == AppConstants.ESTADO_RH2 ) + { + fase = "FASE 4 - RH - MEDIDAS + LES\u00C3O"; + } + else if ( estado == AppConstants.ESTADO_CONSOLIDACAO ) + { + fase = "FASE 5 - SIPRP - CONSOLIDA\u00C7\u00C3O"; + } + else if ( estado == AppConstants.ESTADO_ASSINATURA_SEG ) + { + fase = "FASE 6 - SEG - VERIFICA\u00C7\u00C3O SEG."; + } + else if ( estado == AppConstants.ESTADO_ASSINATURA_RH ) + { + fase = "FASE 7 - RH - VERIFICA\u00C7\u00C3O RH"; + } + else if ( estado == AppConstants.ESTADO_FECHAR ) + { + fase = "FASE 8 - SIPRP - CONCLUS\u00C3O"; + } + + return fase; + } + + + @Override + public Vector< ActualTableRow > getActualTableData( Utilizador userLogged ) + { + Vector< ActualTableRow > result = null; + + try + { + int userType = userLogged.getTipo_utilizador().intValue(); + Virtual2DArray array = null; + + if ( userType == RolesConstants.TIPO_SEGURANCA ) + { + array = actualProvider.getAnalisesActuaisSeguranca( userLogged.getEstabelecimento_id(), userLogged.getResponsavel_loja() ); + } + else if ( userType == RolesConstants.TIPO_RECURSOS_HUMANOS ) + { + array = actualProvider.getAnalisesActuaisRH( userLogged.getEstabelecimento_id(), userLogged.getResponsavel_loja() ); + } + else if ( userType == RolesConstants.TIPO_HIGIENE_SEGURANCA ) + { + array = actualProvider.getAnalisesActuaisHS(); + } + + result = fillVector( array ); + } + catch ( Exception e ) + { + e.printStackTrace(); + } + + return result; + } + + + @Override + public Vector< ActualTableRow > getSeguimentoTableData( Utilizador userLogged ) + { + Vector< ActualTableRow > result = null; + + try + { + int userType = userLogged.getTipo_utilizador().intValue(); + Virtual2DArray array = null; + + if ( userType == RolesConstants.TIPO_DIRECTOR_GERAL_RECURSOS_HUMANOS + || userType == RolesConstants.TIPO_DIRECTOR_SIPRP ) + { + array = seguimentoProvider.getAnalisesSeguimento_DirGeralRH(); + } + else if ( userType == RolesConstants.TIPO_GESTOR ) + { + if ( userLogged.getEstabelecimento_id() == null ) + { + array = seguimentoProvider.getAnalisesSeguimento_DirGeralRH(); + } + else + { + array = seguimentoProvider.getAnalisesSeguimentoByEstabelecimentoID( userLogged.getEstabelecimento_id() ); + } + } + else if ( userType == RolesConstants.TIPO_HIGIENE_SEGURANCA ) + { + array = seguimentoProvider.getAnalisesSeguimento_HS(); + } + + result = fillVector( array ); + } + catch ( Exception e ) + { + e.printStackTrace(); + } + + return result; + } + + + /** + * fills vector with 'actual' or 'seguimento' data ... + * + * @param array + * @return + */ + private Vector< ActualTableRow > fillVector( Virtual2DArray array ) + { + Vector< ActualTableRow > result = null; + + if ( array != null ) + { + result = new Vector< ActualTableRow >(); + for ( int i = 0; i < array.columnLength(); i++ ) + { + Integer anaID = ( Integer ) array.get( i, 0 ); + Date dataAcidente = ( Date ) array.get( i, 1 ); + Date dataAbertura = ( Date ) array.get( i, 2 ); + String analiseNr = ( String ) array.get( i, 3 ); + String nrPOR = ( String ) array.get( i, 4 ); + String nomeTrabalhador = ( String ) array.get( i, 5 ); + Integer estado = ( Integer ) array.get( i, 6 ); + + ActualTableRow row = new ActualTableRow(); + row.setId( anaID ); + row.setDataAcidente( dataAcidente ); + row.setDataAbertura( dataAbertura ); + row.setNrAcidente( analiseNr ); + row.setPOR( nrPOR ); + row.setNomeAcidentado( nomeTrabalhador ); + row.setEstado( estado ); + row.setFase( getFase( estado ) ); + + result.add( row ); + } + } + + return result; + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoServiceImpl.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoServiceImpl.java new file mode 100644 index 00000000..fd7b0f24 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalhoServiceImpl.java @@ -0,0 +1,42 @@ +package com.evolute.siprp.server.logic.AnaliseAcidentesTrabalho; + +import java.util.Vector; + +import com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.AnaliseAcidentesTrabalhoService; +import com.evolute.siprp.client.vo.ActualTableRow; +import com.evolute.siprp.client.vo.Utilizador; +import com.google.gwt.user.server.rpc.RemoteServiceServlet; + +public class AnaliseAcidentesTrabalhoServiceImpl extends RemoteServiceServlet implements AnaliseAcidentesTrabalhoService +{ + private static final long serialVersionUID = -8785113866553581244L; + + private AnaliseAcidentesTrabalhoLogic logic; + + private void initLogic() + { + if ( logic == null ) + { + logic = new AnaliseAcidentesTrabalhoLogic(); + } + } + + + @Override + public Vector< ActualTableRow > getActualTableData( Utilizador userLogged ) + { + initLogic(); + + return logic.getActualTableData( userLogged ); + } + + @Override + public Vector< ActualTableRow > getSeguimentoTableData( Utilizador userLogged ) + { + initLogic(); + + return logic.getSeguimentoTableData( userLogged ); + } + + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/AnaliseAcidentesTrabalho/actual/ActualTableDataProvider.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/AnaliseAcidentesTrabalho/actual/ActualTableDataProvider.java new file mode 100644 index 00000000..aa406c3c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/AnaliseAcidentesTrabalho/actual/ActualTableDataProvider.java @@ -0,0 +1,155 @@ +package com.evolute.siprp.server.logic.AnaliseAcidentesTrabalho.actual; + +import com.evolute.siprp.client.panels.utils.AppConstants; +import com.evolute.siprp.server.db.InitDB; +import com.evolute.siprp.server.db.data.siprp.AcidentadosData; +import com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData; +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.jdo.JDOProvider; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; + +public class ActualTableDataProvider +{ + private static ActualTableDataProvider instance = null; + + private final Executer EXECUTER; + private final JDOProvider JDO_PROVIDER; + + private ActualTableDataProvider() throws Exception + { + InitDB.init(); + + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + JDO_PROVIDER = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + + + public static ActualTableDataProvider getProvider() throws Exception + { + if ( instance == null ) + { + instance = new ActualTableDataProvider(); + } + return instance; + } + + + + public Virtual2DArray getAnalisesActuaisSeguranca( Integer estabelecimento_id, Boolean responsavel_loja ) + throws Exception + { + Expression whereExpression = new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( AppConstants.ESTADO_SEG ).or( + new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "y" ).and( + new Field( AnalisesAcidentesData.AVERIGUACAO_OBS_FULL ).isEqual( "" ) + ) + ); + if ( responsavel_loja ) + { + whereExpression = whereExpression.or( + new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( AppConstants.ESTADO_ASSINATURA_SEG ) + ); + } + Select query = new Select2( + new String[] { AnalisesAcidentesData.TABLENAME, AcidentadosData.TABLENAME }, + new Integer[] { Select2.JOIN_INNER }, + new Expression[] { + new Field( AnalisesAcidentesData.ACIDENTADO_ID_FULL ).isEqual( new Field( AcidentadosData.ID_FULL ) ) + }, + new String[] { + AnalisesAcidentesData.ID_FULL, AnalisesAcidentesData.DATA_ACIDENTE_FULL, AnalisesAcidentesData.DATA_INICIO_PROCESSO_FULL, + AnalisesAcidentesData.ANALISE_NR_FULL, AcidentadosData.NUMERO_MECANOGRAFICO_FULL, AcidentadosData.NOME_FULL, + AnalisesAcidentesData.ESTADO_FULL + }, + new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" ).and( + new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ).and( + whereExpression + ) + ), + new String[] { AnalisesAcidentesData.ANALISE_NR_FULL }, + null, + null, + null + ); + System.out.println( "\n" + query.toString() ); + + return EXECUTER.executeQuery( query ); + } + + public Virtual2DArray getAnalisesActuaisRH( Integer estabelecimento_id, Boolean responsavel_loja ) + throws Exception + { + Expression whereExpression = new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( AppConstants.ESTADO_RH1 ).or( + new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( AppConstants.ESTADO_RH2 ) + ); + if ( responsavel_loja ) + { + whereExpression = whereExpression.or( + new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( AppConstants.ESTADO_ASSINATURA_RH ) + ); + } + + Select query = new Select2( + new String[] { AnalisesAcidentesData.TABLENAME, AcidentadosData.TABLENAME }, + new Integer[] { Select2.JOIN_INNER }, + new Expression[] { + new Field( AnalisesAcidentesData.ACIDENTADO_ID_FULL ).isEqual( new Field( AcidentadosData.ID_FULL ) ) + }, + new String[] { + AnalisesAcidentesData.ID_FULL, AnalisesAcidentesData.DATA_ACIDENTE_FULL, AnalisesAcidentesData.DATA_INICIO_PROCESSO_FULL, + AnalisesAcidentesData.ANALISE_NR_FULL, AcidentadosData.NUMERO_MECANOGRAFICO_FULL, AcidentadosData.NOME_FULL, + AnalisesAcidentesData.ESTADO_FULL + }, + new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" ).and( + new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ).and( + whereExpression + ) + ), + new String[] { AnalisesAcidentesData.ANALISE_NR_FULL }, + null, + null, + null + ); + System.out.println( "\n" + query.toString() ); + + return EXECUTER.executeQuery( query ); + } + + public Virtual2DArray getAnalisesActuaisHS() + throws Exception + { + Select query = new Select2( + new String[] { AnalisesAcidentesData.TABLENAME, AcidentadosData.TABLENAME }, + new Integer[] { Select2.JOIN_INNER }, + new Expression[] { + new Field( AnalisesAcidentesData.ACIDENTADO_ID_FULL ).isEqual( new Field( AcidentadosData.ID_FULL ) ) + }, + new String[] { + AnalisesAcidentesData.ID_FULL, AnalisesAcidentesData.DATA_ACIDENTE_FULL, AnalisesAcidentesData.DATA_INICIO_PROCESSO_FULL, + AnalisesAcidentesData.ANALISE_NR_FULL, AcidentadosData.NUMERO_MECANOGRAFICO_FULL, AcidentadosData.NOME_FULL, + AnalisesAcidentesData.ESTADO_FULL + }, + new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" ).and( + new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( AppConstants.ESTADO_HS ).or( + new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( AppConstants.ESTADO_FECHAR ).or( + new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( AppConstants.ESTADO_CONSOLIDACAO ) + ) + ) + ), + new String[] { AnalisesAcidentesData.ANALISE_NR_FULL }, + null, + null, + null + ); + System.out.println( "\n" + query.toString() ); + + return EXECUTER.executeQuery( query ); + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/AnaliseAcidentesTrabalho/seguimento/SeguimentoTableDataProvider.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/AnaliseAcidentesTrabalho/seguimento/SeguimentoTableDataProvider.java new file mode 100644 index 00000000..feee4e4d --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/AnaliseAcidentesTrabalho/seguimento/SeguimentoTableDataProvider.java @@ -0,0 +1,201 @@ +package com.evolute.siprp.server.logic.AnaliseAcidentesTrabalho.seguimento; + +import com.evolute.siprp.client.panels.utils.AppConstants; +import com.evolute.siprp.server.db.InitDB; +import com.evolute.siprp.server.db.data.siprp.AcidentadosData; +import com.evolute.siprp.server.db.data.siprp.AnalisesAcidentesData; +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.jdo.JDOProvider; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; + +public class SeguimentoTableDataProvider +{ + + private static SeguimentoTableDataProvider instance = null; + + private final Executer EXECUTER; + private final JDOProvider JDO_PROVIDER; + + private SeguimentoTableDataProvider() throws Exception + { + InitDB.init(); + + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + JDO_PROVIDER = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + + + public static SeguimentoTableDataProvider getProvider() throws Exception + { + if ( instance == null ) + { + instance = new SeguimentoTableDataProvider(); + } + return instance; + } + + + /** + * director geral RH e director siprp + * + * @return + * @throws Exception + */ + public Virtual2DArray getAnalisesSeguimento_DirGeralRH() throws Exception + { + Select query = new Select2( + new String[] { AnalisesAcidentesData.TABLENAME, AcidentadosData.TABLENAME }, + new Integer[] { Select2.JOIN_INNER }, + new Expression[] { + new Field( AnalisesAcidentesData.ACIDENTADO_ID_FULL ).isEqual( new Field( AcidentadosData.ID_FULL ) ) + }, + new String[] { + AnalisesAcidentesData.ID_FULL, AnalisesAcidentesData.DATA_ACIDENTE_FULL, AnalisesAcidentesData.DATA_INICIO_PROCESSO_FULL, + AnalisesAcidentesData.ANALISE_NR_FULL, AcidentadosData.NUMERO_MECANOGRAFICO_FULL, AcidentadosData.NOME_FULL, + AnalisesAcidentesData.ESTADO_FULL + }, + new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( AppConstants.ESTADO_CONCLUIDO ).and( + new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" ) + ), + new String[] { AnalisesAcidentesData.ANALISE_NR_FULL }, + null, + null, + null + ); + + return EXECUTER.executeQuery( query ); + } + + public Virtual2DArray getAnalisesSeguimentoByEstabelecimentoID( Integer estabelecimento_id ) throws Exception + { + Select query = new Select2( + new String[] { AnalisesAcidentesData.TABLENAME, AcidentadosData.TABLENAME }, + new Integer[] { Select2.JOIN_INNER }, + new Expression[] { + new Field( AnalisesAcidentesData.ACIDENTADO_ID_FULL ).isEqual( new Field( AcidentadosData.ID_FULL ) ) + }, + new String[] { + AnalisesAcidentesData.ID_FULL, AnalisesAcidentesData.DATA_ACIDENTE_FULL, AnalisesAcidentesData.DATA_INICIO_PROCESSO_FULL, + AnalisesAcidentesData.ANALISE_NR_FULL, AcidentadosData.NUMERO_MECANOGRAFICO_FULL, AcidentadosData.NOME_FULL, + AnalisesAcidentesData.ESTADO_FULL + }, + new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( AppConstants.ESTADO_CONCLUIDO ).and( + new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" ).and( + new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) + ) + ), + new String[] { AnalisesAcidentesData.ANALISE_NR_FULL }, + null, + null, + null + ); + + return EXECUTER.executeQuery( query ); + } + + public Virtual2DArray getAnalisesSeguimento_HS() throws Exception + { + /* + SELECT * + FROM analises_acidentes + WHERE + (estado < Global.ESTADO_HS OR (estado > Global.ESTADO_HS AND estado < Global.ESTADO_CONSOLIDACAO ) + OR (estado > Global.ESTADO_CONSOLIDACAO AND estado < Global.ESTADO_FECHAR )) + AND apagada = 'n' + ORDER BY analise_nr + */ + + Select query = new Select2( + new String[] { AnalisesAcidentesData.TABLENAME, AcidentadosData.TABLENAME }, + new Integer[] { Select2.JOIN_INNER }, + new Expression[] { + new Field( AnalisesAcidentesData.ACIDENTADO_ID_FULL ).isEqual( new Field( AcidentadosData.ID_FULL ) ) + }, + new String[] { + AnalisesAcidentesData.ID_FULL, AnalisesAcidentesData.DATA_ACIDENTE_FULL, AnalisesAcidentesData.DATA_INICIO_PROCESSO_FULL, + AnalisesAcidentesData.ANALISE_NR_FULL, AcidentadosData.NUMERO_MECANOGRAFICO_FULL, AcidentadosData.NOME_FULL, + AnalisesAcidentesData.ESTADO_FULL + }, + new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" ).and( + new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( AppConstants.ESTADO_HS ).or( + new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( AppConstants.ESTADO_HS ).and( + new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( AppConstants.ESTADO_CONSOLIDACAO ) + ) + ).or( + new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( AppConstants.ESTADO_CONSOLIDACAO ).and( + new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( AppConstants.ESTADO_FECHAR ) + ) + ) + ), + new String[] { AnalisesAcidentesData.ANALISE_NR_FULL }, + null, + null, + null + ); + System.out.println( "\n" + query.toString() ); + + return EXECUTER.executeQuery( query ); + } + +// public Virtual2DArray getAnalisesSeguimento_Medico( Integer estabelecimento_id ) throws Exception +// { +// /* +// SELECT * +// FROM analises_acidentes +// WHERE +// estado < 5 OR (estado = 6 AND estado_assinatura <> 2) +// OR (estado = 6 AND estado_assinatura = 2 AND ass_med = 'y') +// OR (estado > 6 AND estado < 9) +// AND estabelecimento_id = estabelecimento_id +// AND apagada = 'n' +// ORDER BY analise_nr +// */ +// +// Select query = new Select2( +// new String[] { AnalisesAcidentesData.TABLENAME, AcidentadosData.TABLENAME }, +// new Integer[] { Select2.JOIN_INNER }, +// new Expression[] { +// new Field( AnalisesAcidentesData.ACIDENTADO_ID_FULL ).isEqual( new Field( AcidentadosData.ID_FULL ) ) +// }, +// new String[] { +// AnalisesAcidentesData.ID_FULL, AnalisesAcidentesData.DATA_ACIDENTE_FULL, AnalisesAcidentesData.DATA_INICIO_PROCESSO_FULL, +// AnalisesAcidentesData.ANALISE_NR_FULL, AcidentadosData.NUMERO_MECANOGRAFICO_FULL, AcidentadosData.NOME_FULL, +// AnalisesAcidentesData.ESTADO_FULL +// }, +// new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" ).and( +// new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ).and( +// new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( 5 ).or( +// new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( 6 ).and( +// new Field( AnalisesAcidentesData.ESTADO_ASSINATURA_FULL ).isDifferent( 2 ) +// ) +// ).or( +// new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( 6 ).and( +// new Field( AnalisesAcidentesData.ESTADO_ASSINATURA_FULL ).isEqual( 2 ).and( +// new Field( AnalisesAcidentesData.ASS_MED_FULL ).isEqual( "y" ) +// ) +// ) +// ).or( +// new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( 6 ).and( +// new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( 9 ) +// ) +// ) +// ) +// ), +// new String[] { AnalisesAcidentesData.ANALISE_NR_FULL }, +// null, +// null, +// null +// ); +// System.out.println( "\n" + query.toString() ); +// +// return EXECUTER.executeQuery( query ); +// } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/login/LoginDataProvider.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/login/LoginDataProvider.java new file mode 100644 index 00000000..f5260079 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/login/LoginDataProvider.java @@ -0,0 +1,100 @@ +package com.evolute.siprp.server.logic.login; + +import com.evolute.siprp.client.vo.Utilizador; +import com.evolute.siprp.server.db.InitDB; +import com.evolute.siprp.server.db.data.siprp.UtilizadoresData; +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.jdo.JDOProvider; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; + +public class LoginDataProvider +{ + + private static LoginDataProvider instance = null; + + private final Executer EXECUTER; + private final JDOProvider JDO_PROVIDER; + + + private LoginDataProvider() throws Exception + { + System.out.println( "-- InitDB.init()" ); + InitDB.init(); + + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + JDO_PROVIDER = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + + + public static LoginDataProvider getProvider() throws Exception + { + if ( instance == null ) + { + instance = new LoginDataProvider(); + } + return instance; + } + + + public Utilizador loadUtilizadorByID( Integer userID ) + throws Exception + { + Utilizador user = null; + + UtilizadoresData usersData = JDO_PROVIDER.load( UtilizadoresData.class, userID ); + if ( usersData != null ) + { + user = new Utilizador(); + user.setUserID( usersData.getId() ); + user.setUsername( usersData.getLogin() ); + user.setEmail( usersData.getEmail() ); + user.setNome( usersData.getNome() ); + user.setData_password( usersData.getData_password() ); + user.setPrimeiro_login( usersData.getPrimeiro_login().equals( "y" ) ); + user.setTipo_utilizador( usersData.getTipo() ); + user.setResponsavel_loja( usersData.getResponsavel_loja().equals( "y" ) ); + user.setEstabelecimento_id( usersData.getEstabelecimento_id() ); + } + + return user; + } + + /** + * + * @param username + * @param password + * @return id, login, email, tipo, nome, primeiro_login, data_password + * @throws Exception + */ + public Virtual2DArray getUtilizador( String username, String password ) throws Exception + { + //id, login, email, tipo, nome, primeiro_login, data_password + + Select query = new Select2( + new String[] { UtilizadoresData.TABLENAME }, + new Integer[] {}, + new Expression[] {}, + new String[] { + UtilizadoresData.ID_FULL, UtilizadoresData.LOGIN_FULL, UtilizadoresData.EMAIL_FULL, + UtilizadoresData.TIPO_FULL, UtilizadoresData.NOME_FULL, UtilizadoresData.PRIMEIRO_LOGIN_FULL, + UtilizadoresData.DATA_PASSWORD_FULL, UtilizadoresData.RESPONSAVEL_LOJA_FULL, UtilizadoresData.ESTABELECIMENTO_ID_FULL + }, + new Field( UtilizadoresData.LOGIN_FULL ).isEqual( username ).and( + new Field( UtilizadoresData.PASSWORD_FULL ).isEqual( password ) + ), + null, + null, + null, + null + ); + + return EXECUTER.executeQuery( query ); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/login/LoginLogic.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/login/LoginLogic.java new file mode 100644 index 00000000..f0775f61 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/login/LoginLogic.java @@ -0,0 +1,57 @@ +package com.evolute.siprp.server.logic.login; + +import java.util.Date; + +import com.evolute.siprp.client.panels.index.login.LoginService; +import com.evolute.siprp.client.vo.Utilizador; +import com.evolute.utils.arrays.Virtual2DArray; + +public class LoginLogic implements LoginService +{ + + private LoginDataProvider loginProvider; + + public LoginLogic() + { + try + { + loginProvider = LoginDataProvider.getProvider(); + } + catch ( Exception e ) + { + e.printStackTrace(); + } + } + + + @Override + public Utilizador doLogin( String username, String password ) + { + Utilizador rUser = null; + + try + { + Virtual2DArray users = loginProvider.getUtilizador( username, password ); + if ( users.columnLength() == 1 ) + { + rUser = new Utilizador(); + rUser.setUserID( ( Integer ) users.get( 0, 0 ) ); + rUser.setUsername( ( String ) users.get( 0, 1 ) ); + rUser.setEmail( ( String ) users.get( 0, 2 ) ); + rUser.setTipo_utilizador( ( Integer ) users.get( 0, 3 ) ); + rUser.setNome( ( String ) users.get( 0, 4 ) ); + rUser.setPrimeiro_login( (( String ) users.get( 0, 5 )).equals( "y" ) ); + rUser.setData_password( ( Date ) users.get( 0, 6 ) ); + rUser.setResponsavel_loja( (( String ) users.get( 0, 7 )).equals( "y" ) ); + rUser.setEstabelecimento_id( ( Integer ) users.get( 0, 8 ) ); + } + } + catch ( Exception e ) + { + e.printStackTrace(); + } + + return rUser; + } + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/login/LoginServiceImpl.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/login/LoginServiceImpl.java new file mode 100644 index 00000000..8607f2a8 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/login/LoginServiceImpl.java @@ -0,0 +1,23 @@ +package com.evolute.siprp.server.logic.login; + +import com.evolute.siprp.client.panels.index.login.LoginService; +import com.evolute.siprp.client.vo.Utilizador; +import com.google.gwt.user.server.rpc.RemoteServiceServlet; + +public class LoginServiceImpl extends RemoteServiceServlet implements LoginService +{ + private static final long serialVersionUID = -950404179998079707L; + + private LoginLogic logic = null; + + @Override + public Utilizador doLogin( String username, String password ) + { + if ( logic == null ) + { + logic = new LoginLogic(); + } + + return logic.doLogin( username, password ); + } +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/recover_pwd/RecoverDataProvider.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/recover_pwd/RecoverDataProvider.java new file mode 100644 index 00000000..b3af10b2 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/recover_pwd/RecoverDataProvider.java @@ -0,0 +1,38 @@ +package com.evolute.siprp.server.logic.recover_pwd; + +import com.evolute.siprp.server.db.InitDB; +import com.evolute.utils.Singleton; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.jdo.JDOProvider; + +public class RecoverDataProvider +{ + private static RecoverDataProvider instance = null; + + private final Executer EXECUTER; + private final JDOProvider JDO_PROVIDER; + + + private RecoverDataProvider() throws Exception + { + System.out.println( "-- InitDB.init()" ); + InitDB.init(); + + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + JDO_PROVIDER = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + + + public static RecoverDataProvider getProvider() throws Exception + { + if ( instance == null ) + { + instance = new RecoverDataProvider(); + } + return instance; + } + + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/recover_pwd/RecoverLogic.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/recover_pwd/RecoverLogic.java new file mode 100644 index 00000000..c021d011 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/recover_pwd/RecoverLogic.java @@ -0,0 +1,20 @@ +package com.evolute.siprp.server.logic.recover_pwd; + +public class RecoverLogic +{ + private RecoverDataProvider recoverProvider; + + public RecoverLogic() + { + try + { + recoverProvider = RecoverDataProvider.getProvider(); + } + catch ( Exception e ) + { + e.printStackTrace(); + } + } + + +} diff --git a/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/recover_pwd/RecoverServiceImpl.java b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/recover_pwd/RecoverServiceImpl.java new file mode 100644 index 00000000..23a378a1 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/src/com/evolute/siprp/server/logic/recover_pwd/RecoverServiceImpl.java @@ -0,0 +1,25 @@ +package com.evolute.siprp.server.logic.recover_pwd; + +import com.evolute.siprp.client.panels.index.recover_pwd.RecoverService; +import com.google.gwt.user.server.rpc.RemoteServiceServlet; + +public class RecoverServiceImpl extends RemoteServiceServlet implements RecoverService +{ + private static final long serialVersionUID = -1868918536296790646L; + + private RecoverLogic recoverLogic = null; + + @Override + public String recoverPWD( String username, String email ) + { + if ( recoverLogic == null ) + { + recoverLogic = new RecoverLogic(); + } + + return "RECOVERING PWD..."; + } + + + +} diff --git a/branches/SIPRP/GestaoSHST/war/GestaoSHST.html b/branches/SIPRP/GestaoSHST/war/GestaoSHST.html new file mode 100644 index 00000000..378b01bc --- /dev/null +++ b/branches/SIPRP/GestaoSHST/war/GestaoSHST.html @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + SIPRP - Gestão SHST + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + diff --git a/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/c3p0-0.9.1.2.jar b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/c3p0-0.9.1.2.jar new file mode 100644 index 00000000..0f42d60e Binary files /dev/null and b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/c3p0-0.9.1.2.jar differ diff --git a/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/datanucleus-connectionpool-1.0.2.jar b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/datanucleus-connectionpool-1.0.2.jar new file mode 100644 index 00000000..dc7770b0 Binary files /dev/null and b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/datanucleus-connectionpool-1.0.2.jar differ diff --git a/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/datanucleus-core-1.1.5.jar b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/datanucleus-core-1.1.5.jar new file mode 100644 index 00000000..caac70e9 Binary files /dev/null and b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/datanucleus-core-1.1.5.jar differ diff --git a/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/datanucleus-java5-1.0.3.jar b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/datanucleus-java5-1.0.3.jar new file mode 100644 index 00000000..c4e07e65 Binary files /dev/null and b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/datanucleus-java5-1.0.3.jar differ diff --git a/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/datanucleus-rdbms-1.1.5.jar b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/datanucleus-rdbms-1.1.5.jar new file mode 100644 index 00000000..531693cc Binary files /dev/null and b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/datanucleus-rdbms-1.1.5.jar differ diff --git a/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/evolute.jar b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/evolute.jar new file mode 100644 index 00000000..52b2c276 Binary files /dev/null and b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/evolute.jar differ diff --git a/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/gwt-servlet.jar b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/gwt-servlet.jar new file mode 100644 index 00000000..50e2a81c Binary files /dev/null and b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/gwt-servlet.jar differ diff --git a/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/jdo2-api-2.3-eb.jar b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/jdo2-api-2.3-eb.jar new file mode 100644 index 00000000..ee1597ed Binary files /dev/null and b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/jdo2-api-2.3-eb.jar differ diff --git a/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/postgresql-8.4-701.jdbc3.jar b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/postgresql-8.4-701.jdbc3.jar new file mode 100644 index 00000000..c64b709e Binary files /dev/null and b/branches/SIPRP/GestaoSHST/war/WEB-INF/lib/postgresql-8.4-701.jdbc3.jar differ diff --git a/branches/SIPRP/GestaoSHST/war/WEB-INF/web.xml b/branches/SIPRP/GestaoSHST/war/WEB-INF/web.xml new file mode 100644 index 00000000..318f3b6c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/war/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + + + + loginServlet + com.evolute.siprp.server.logic.login.LoginServiceImpl + + + loginServlet + /gestaoshst/loginService + + + + recoverServlet + com.evolute.siprp.server.logic.recover_pwd.RecoverServiceImpl + + + recoverServlet + /gestaoshst/recoverService + + + + aatServlet + com.evolute.siprp.server.logic.AnaliseAcidentesTrabalho.AnaliseAcidentesTrabalhoServiceImpl + + + aatServlet + /gestaoshst/aatService + + + + + GestaoSHST.html + + + diff --git a/branches/SIPRP/GestaoSHST/war/gestaoshst/4219B3A1733D0EC54B4663A77B9340DB.gwt.rpc b/branches/SIPRP/GestaoSHST/war/gestaoshst/4219B3A1733D0EC54B4663A77B9340DB.gwt.rpc new file mode 100644 index 00000000..4d8383e7 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/war/gestaoshst/4219B3A1733D0EC54B4663A77B9340DB.gwt.rpc @@ -0,0 +1,15 @@ +com.evolute.siprp.client.panels.index.login.LoginService, false, false, false, false, _, 169399566 +com.evolute.siprp.client.vo.Utilizador, true, true, false, false, com.evolute.siprp.client.vo.Utilizador/746657206, 746657206 +com.google.gwt.i18n.client.impl.DateRecord, true, true, false, false, com.google.gwt.i18n.client.impl.DateRecord/112389920, 112389920 +com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException, true, true, true, true, com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533, 3936916533 +java.lang.Boolean, true, true, false, false, java.lang.Boolean/476441737, 476441737 +java.lang.Exception, true, false, true, false, java.lang.Exception/1920171873, 1920171873 +java.lang.Integer, true, true, false, false, java.lang.Integer/3438268394, 3438268394 +java.lang.Number, true, false, false, false, java.lang.Number/300033342, 300033342 +java.lang.RuntimeException, true, false, true, false, java.lang.RuntimeException/515124647, 515124647 +java.lang.String, true, true, true, true, java.lang.String/2004016611, 2004016611 +java.lang.Throwable, true, false, true, false, java.lang.Throwable/2953622131, 2953622131 +java.sql.Date, true, true, false, false, java.sql.Date/3996530531, 3996530531 +java.sql.Time, true, true, false, false, java.sql.Time/831929183, 831929183 +java.sql.Timestamp, true, true, false, false, java.sql.Timestamp/1769758459, 1769758459 +java.util.Date, true, true, false, false, java.util.Date/1659716317, 1659716317 diff --git a/branches/SIPRP/GestaoSHST/war/gestaoshst/5095A8AA70D559CD7F9F5C3C627245CC.gwt.rpc b/branches/SIPRP/GestaoSHST/war/gestaoshst/5095A8AA70D559CD7F9F5C3C627245CC.gwt.rpc new file mode 100644 index 00000000..9867e55d --- /dev/null +++ b/branches/SIPRP/GestaoSHST/war/gestaoshst/5095A8AA70D559CD7F9F5C3C627245CC.gwt.rpc @@ -0,0 +1,18 @@ +com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.actual.ActualTableService, false, false, false, false, _, 3616117345 +com.evolute.siprp.client.vo.ActualTableRow, true, true, false, false, com.evolute.siprp.client.vo.ActualTableRow/2706092442, 2706092442 +com.evolute.siprp.client.vo.Utilizador, false, false, true, true, com.evolute.siprp.client.vo.Utilizador/1525161409, 1525161409 +com.google.gwt.i18n.client.impl.DateRecord, true, true, true, true, com.google.gwt.i18n.client.impl.DateRecord/112389920, 112389920 +com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException, true, true, true, true, com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533, 3936916533 +java.lang.Boolean, false, false, true, true, java.lang.Boolean/476441737, 476441737 +java.lang.Exception, true, false, true, false, java.lang.Exception/1920171873, 1920171873 +java.lang.Integer, true, true, true, true, java.lang.Integer/3438268394, 3438268394 +java.lang.Number, true, false, true, false, java.lang.Number/300033342, 300033342 +java.lang.RuntimeException, true, false, true, false, java.lang.RuntimeException/515124647, 515124647 +java.lang.String, true, true, true, true, java.lang.String/2004016611, 2004016611 +java.lang.Throwable, true, false, true, false, java.lang.Throwable/2953622131, 2953622131 +java.sql.Date, true, true, true, true, java.sql.Date/3996530531, 3996530531 +java.sql.Time, true, true, true, true, java.sql.Time/831929183, 831929183 +java.sql.Timestamp, true, true, true, true, java.sql.Timestamp/1769758459, 1769758459 +java.util.Date, true, true, true, true, java.util.Date/1659716317, 1659716317 +java.util.Stack, true, true, false, false, java.util.Stack/1031431137, 1031431137 +java.util.Vector, true, true, false, false, java.util.Vector/3125574444, 3125574444 diff --git a/branches/SIPRP/GestaoSHST/war/gestaoshst/66B58610AC8FE0AF961E16F687F1CCCD.gwt.rpc b/branches/SIPRP/GestaoSHST/war/gestaoshst/66B58610AC8FE0AF961E16F687F1CCCD.gwt.rpc new file mode 100644 index 00000000..bb60140c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/war/gestaoshst/66B58610AC8FE0AF961E16F687F1CCCD.gwt.rpc @@ -0,0 +1,18 @@ +com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.actual.ActualTableService, false, false, false, false, _, 3616117345 +com.evolute.siprp.client.vo.ActualTableRow, true, true, false, false, com.evolute.siprp.client.vo.ActualTableRow/3536573623, 3536573623 +com.evolute.siprp.client.vo.Utilizador, false, false, true, true, com.evolute.siprp.client.vo.Utilizador/746657206, 746657206 +com.google.gwt.i18n.client.impl.DateRecord, true, true, true, true, com.google.gwt.i18n.client.impl.DateRecord/112389920, 112389920 +com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException, true, true, true, true, com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533, 3936916533 +java.lang.Boolean, false, false, true, true, java.lang.Boolean/476441737, 476441737 +java.lang.Exception, true, false, true, false, java.lang.Exception/1920171873, 1920171873 +java.lang.Integer, false, false, true, true, java.lang.Integer/3438268394, 3438268394 +java.lang.Number, false, false, true, false, java.lang.Number/300033342, 300033342 +java.lang.RuntimeException, true, false, true, false, java.lang.RuntimeException/515124647, 515124647 +java.lang.String, true, true, true, true, java.lang.String/2004016611, 2004016611 +java.lang.Throwable, true, false, true, false, java.lang.Throwable/2953622131, 2953622131 +java.sql.Date, true, true, true, true, java.sql.Date/3996530531, 3996530531 +java.sql.Time, true, true, true, true, java.sql.Time/831929183, 831929183 +java.sql.Timestamp, true, true, true, true, java.sql.Timestamp/1769758459, 1769758459 +java.util.Date, true, true, true, true, java.util.Date/1659716317, 1659716317 +java.util.Stack, true, true, false, false, java.util.Stack/1031431137, 1031431137 +java.util.Vector, true, true, false, false, java.util.Vector/3125574444, 3125574444 diff --git a/branches/SIPRP/GestaoSHST/war/gestaoshst/75169062F30CD22F885BEE830D67F983.gwt.rpc b/branches/SIPRP/GestaoSHST/war/gestaoshst/75169062F30CD22F885BEE830D67F983.gwt.rpc new file mode 100644 index 00000000..93118900 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/war/gestaoshst/75169062F30CD22F885BEE830D67F983.gwt.rpc @@ -0,0 +1,9 @@ +com.evolute.siprp.client.panels.index.login.LoginService, false, false, false, false, _, 169399566 +com.evolute.siprp.client.vo.Utilizador, true, true, false, false, com.evolute.siprp.client.vo.Utilizador/3153137530, 3153137530 +com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException, true, true, true, true, com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533, 3936916533 +java.lang.Exception, true, false, true, false, java.lang.Exception/1920171873, 1920171873 +java.lang.Integer, true, true, false, false, java.lang.Integer/3438268394, 3438268394 +java.lang.Number, true, false, false, false, java.lang.Number/300033342, 300033342 +java.lang.RuntimeException, true, false, true, false, java.lang.RuntimeException/515124647, 515124647 +java.lang.String, true, true, true, true, java.lang.String/2004016611, 2004016611 +java.lang.Throwable, true, false, true, false, java.lang.Throwable/2953622131, 2953622131 diff --git a/branches/SIPRP/GestaoSHST/war/gestaoshst/A7EEACAFA774B1BED367E6016B2EEC82.gwt.rpc b/branches/SIPRP/GestaoSHST/war/gestaoshst/A7EEACAFA774B1BED367E6016B2EEC82.gwt.rpc new file mode 100644 index 00000000..bc733cdf --- /dev/null +++ b/branches/SIPRP/GestaoSHST/war/gestaoshst/A7EEACAFA774B1BED367E6016B2EEC82.gwt.rpc @@ -0,0 +1,18 @@ +com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.actual.ActualTableService, false, false, false, false, _, 3616117345 +com.evolute.siprp.client.vo.ActualTableRow, true, true, false, false, com.evolute.siprp.client.vo.ActualTableRow/1540647138, 1540647138 +com.evolute.siprp.client.vo.Utilizador, false, false, true, true, com.evolute.siprp.client.vo.Utilizador/1525161409, 1525161409 +com.google.gwt.i18n.client.impl.DateRecord, true, true, true, true, com.google.gwt.i18n.client.impl.DateRecord/112389920, 112389920 +com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException, true, true, true, true, com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533, 3936916533 +java.lang.Boolean, false, false, true, true, java.lang.Boolean/476441737, 476441737 +java.lang.Exception, true, false, true, false, java.lang.Exception/1920171873, 1920171873 +java.lang.Integer, true, true, true, true, java.lang.Integer/3438268394, 3438268394 +java.lang.Number, true, false, true, false, java.lang.Number/300033342, 300033342 +java.lang.RuntimeException, true, false, true, false, java.lang.RuntimeException/515124647, 515124647 +java.lang.String, true, true, true, true, java.lang.String/2004016611, 2004016611 +java.lang.Throwable, true, false, true, false, java.lang.Throwable/2953622131, 2953622131 +java.sql.Date, true, true, true, true, java.sql.Date/3996530531, 3996530531 +java.sql.Time, true, true, true, true, java.sql.Time/831929183, 831929183 +java.sql.Timestamp, true, true, true, true, java.sql.Timestamp/1769758459, 1769758459 +java.util.Date, true, true, true, true, java.util.Date/1659716317, 1659716317 +java.util.Stack, true, true, false, false, java.util.Stack/1031431137, 1031431137 +java.util.Vector, true, true, false, false, java.util.Vector/3125574444, 3125574444 diff --git a/branches/SIPRP/GestaoSHST/war/gestaoshst/BFD25B17A1FC17E59D0C4584559BA44D.gwt.rpc b/branches/SIPRP/GestaoSHST/war/gestaoshst/BFD25B17A1FC17E59D0C4584559BA44D.gwt.rpc new file mode 100644 index 00000000..5d987c16 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/war/gestaoshst/BFD25B17A1FC17E59D0C4584559BA44D.gwt.rpc @@ -0,0 +1,9 @@ +com.evolute.siprp.client.panels.index.login.LoginService, false, false, false, false, _, 169399566 +com.evolute.siprp.client.vo.Utilizador, true, true, false, false, com.evolute.siprp.client.vo.Utilizador/2052945588, 2052945588 +com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException, true, true, true, true, com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533, 3936916533 +java.lang.Exception, true, false, true, false, java.lang.Exception/1920171873, 1920171873 +java.lang.Integer, true, true, false, false, java.lang.Integer/3438268394, 3438268394 +java.lang.Number, true, false, false, false, java.lang.Number/300033342, 300033342 +java.lang.RuntimeException, true, false, true, false, java.lang.RuntimeException/515124647, 515124647 +java.lang.String, true, true, true, true, java.lang.String/2004016611, 2004016611 +java.lang.Throwable, true, false, true, false, java.lang.Throwable/2953622131, 2953622131 diff --git a/branches/SIPRP/GestaoSHST/war/gestaoshst/D1336EDB1EDC2380AEBD5AD169B06026.gwt.rpc b/branches/SIPRP/GestaoSHST/war/gestaoshst/D1336EDB1EDC2380AEBD5AD169B06026.gwt.rpc new file mode 100644 index 00000000..92b41ae1 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/war/gestaoshst/D1336EDB1EDC2380AEBD5AD169B06026.gwt.rpc @@ -0,0 +1,18 @@ +com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.AnaliseAcidentesTrabalhoService, false, false, false, false, _, 1007557103 +com.evolute.siprp.client.vo.ActualTableRow, true, true, false, false, com.evolute.siprp.client.vo.ActualTableRow/1540647138, 1540647138 +com.evolute.siprp.client.vo.Utilizador, false, false, true, true, com.evolute.siprp.client.vo.Utilizador/1525161409, 1525161409 +com.google.gwt.i18n.client.impl.DateRecord, true, true, true, true, com.google.gwt.i18n.client.impl.DateRecord/112389920, 112389920 +com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException, true, true, true, true, com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533, 3936916533 +java.lang.Boolean, false, false, true, true, java.lang.Boolean/476441737, 476441737 +java.lang.Exception, true, false, true, false, java.lang.Exception/1920171873, 1920171873 +java.lang.Integer, true, true, true, true, java.lang.Integer/3438268394, 3438268394 +java.lang.Number, true, false, true, false, java.lang.Number/300033342, 300033342 +java.lang.RuntimeException, true, false, true, false, java.lang.RuntimeException/515124647, 515124647 +java.lang.String, true, true, true, true, java.lang.String/2004016611, 2004016611 +java.lang.Throwable, true, false, true, false, java.lang.Throwable/2953622131, 2953622131 +java.sql.Date, true, true, true, true, java.sql.Date/3996530531, 3996530531 +java.sql.Time, true, true, true, true, java.sql.Time/831929183, 831929183 +java.sql.Timestamp, true, true, true, true, java.sql.Timestamp/1769758459, 1769758459 +java.util.Date, true, true, true, true, java.util.Date/1659716317, 1659716317 +java.util.Stack, true, true, false, false, java.util.Stack/1031431137, 1031431137 +java.util.Vector, true, true, false, false, java.util.Vector/3125574444, 3125574444 diff --git a/branches/SIPRP/GestaoSHST/war/gestaoshst/D889F5BC27A3E71EDE373796E636F5BD.gwt.rpc b/branches/SIPRP/GestaoSHST/war/gestaoshst/D889F5BC27A3E71EDE373796E636F5BD.gwt.rpc new file mode 100644 index 00000000..a90d4d69 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/war/gestaoshst/D889F5BC27A3E71EDE373796E636F5BD.gwt.rpc @@ -0,0 +1,15 @@ +com.evolute.siprp.client.panels.index.login.LoginService, false, false, false, false, _, 169399566 +com.evolute.siprp.client.vo.Utilizador, true, true, false, false, com.evolute.siprp.client.vo.Utilizador/1525161409, 1525161409 +com.google.gwt.i18n.client.impl.DateRecord, true, true, false, false, com.google.gwt.i18n.client.impl.DateRecord/112389920, 112389920 +com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException, true, true, true, true, com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533, 3936916533 +java.lang.Boolean, true, true, false, false, java.lang.Boolean/476441737, 476441737 +java.lang.Exception, true, false, true, false, java.lang.Exception/1920171873, 1920171873 +java.lang.Integer, true, true, false, false, java.lang.Integer/3438268394, 3438268394 +java.lang.Number, true, false, false, false, java.lang.Number/300033342, 300033342 +java.lang.RuntimeException, true, false, true, false, java.lang.RuntimeException/515124647, 515124647 +java.lang.String, true, true, true, true, java.lang.String/2004016611, 2004016611 +java.lang.Throwable, true, false, true, false, java.lang.Throwable/2953622131, 2953622131 +java.sql.Date, true, true, false, false, java.sql.Date/3996530531, 3996530531 +java.sql.Time, true, true, false, false, java.sql.Time/831929183, 831929183 +java.sql.Timestamp, true, true, false, false, java.sql.Timestamp/1769758459, 1769758459 +java.util.Date, true, true, false, false, java.util.Date/1659716317, 1659716317 diff --git a/branches/SIPRP/GestaoSHST/war/gestaoshst/FFACA86B833A137B1CFBFE4003EC1D8A.gwt.rpc b/branches/SIPRP/GestaoSHST/war/gestaoshst/FFACA86B833A137B1CFBFE4003EC1D8A.gwt.rpc new file mode 100644 index 00000000..5b8deb3c --- /dev/null +++ b/branches/SIPRP/GestaoSHST/war/gestaoshst/FFACA86B833A137B1CFBFE4003EC1D8A.gwt.rpc @@ -0,0 +1,6 @@ +com.evolute.siprp.client.panels.index.recover_pwd.RecoverService, false, false, false, false, _, 3357099797 +com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException, true, true, true, true, com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533, 3936916533 +java.lang.Exception, true, false, true, false, java.lang.Exception/1920171873, 1920171873 +java.lang.RuntimeException, true, false, true, false, java.lang.RuntimeException/515124647, 515124647 +java.lang.String, true, true, true, true, java.lang.String/2004016611, 2004016611 +java.lang.Throwable, true, false, true, false, java.lang.Throwable/2953622131, 2953622131 diff --git a/branches/SIPRP/GestaoSHST/war/gestaoshst/GestaoSHST.css b/branches/SIPRP/GestaoSHST/war/gestaoshst/GestaoSHST.css new file mode 100644 index 00000000..5838e564 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/war/gestaoshst/GestaoSHST.css @@ -0,0 +1,89 @@ +/** Add css rules here for your application. */ + +body { + color: #000; + background-color: #BBD400; + margin: 0px; +} + +body, th, td, p, div, span, input, button, select, textarea, form, b, strong, i, u, h1, h2, h3, h4, h5, h6, dl, dd, dt, ul, li, ol, option, optgroup, a { + font-family: sans-serif; + font-size: 12px; +} + +a, a:visited { + color: #035899; + text-decoration: none; +} + +a:hover { + color: #035899; + text-decoration: underline; + cursor: pointer; +} + +.alignCenterText { + text-align: center; +} + +.alignCenter { + margin-left: auto; + margin-right: auto; +} +.alignLeft { + float: left; +} +.alignRight { + float: right; +} + +.font12 { + font-size: 12px; +} +.font14 { + font-size: 14px; +} +.font16 { + font-size: 16px; +} +.font18 { + font-size: 18px; +} + +.indexTable { + border: 1px solid #000000; + width: 432px; + padding: 5px; +} + +.lblBold { + font-weight: bold; +} + +.inputBox { + width: 220px; + height: 24px; +} + +.inputBoxRec { + width: 432px; + height: 24px; +} + +.button { + width: 120px; + height: 24px; + cursor: pointer; +} + +.indexDiv { + width: 100%; + margin-top: 300px; +} + +.mainDiv { + width: 80%; + margin-left: auto; + margin-right: auto; +} + diff --git a/branches/SIPRP/GestaoSHST/war/gestaoshst/clear.cache.gif b/branches/SIPRP/GestaoSHST/war/gestaoshst/clear.cache.gif new file mode 100644 index 00000000..e565824a Binary files /dev/null and b/branches/SIPRP/GestaoSHST/war/gestaoshst/clear.cache.gif differ diff --git a/branches/SIPRP/GestaoSHST/war/gestaoshst/gestaoshst.nocache.js b/branches/SIPRP/GestaoSHST/war/gestaoshst/gestaoshst.nocache.js new file mode 100644 index 00000000..8d0f1ac2 --- /dev/null +++ b/branches/SIPRP/GestaoSHST/war/gestaoshst/gestaoshst.nocache.js @@ -0,0 +1,10 @@ +function gestaoshst(){var M='',nb='" for "gwt:onLoadErrorFn"',lb='" for "gwt:onPropertyErrorFn"',Y='"><\/script>',$='#',Gb='.cache.html',ab='/',Pb=' + +This html file is for hosted mode support. + diff --git a/branches/SIPRP/GestaoSHST/war/gestaoshst/images/SIPRP_logo_small.jpg b/branches/SIPRP/GestaoSHST/war/gestaoshst/images/SIPRP_logo_small.jpg new file mode 100644 index 00000000..240f2358 Binary files /dev/null and b/branches/SIPRP/GestaoSHST/war/gestaoshst/images/SIPRP_logo_small.jpg differ diff --git a/branches/SIPRP/GestaoSHST/war/gestaoshst/images/logo_empresa32.jpg b/branches/SIPRP/GestaoSHST/war/gestaoshst/images/logo_empresa32.jpg new file mode 100644 index 00000000..2c5be6df Binary files /dev/null and b/branches/SIPRP/GestaoSHST/war/gestaoshst/images/logo_empresa32.jpg differ diff --git a/branches/SIPRP/GestaoSHST/war/gestaoshst/images/logo_evolute_small.png b/branches/SIPRP/GestaoSHST/war/gestaoshst/images/logo_evolute_small.png new file mode 100644 index 00000000..0198da2b Binary files /dev/null and b/branches/SIPRP/GestaoSHST/war/gestaoshst/images/logo_evolute_small.png differ diff --git a/branches/SIPRP/PlanosActuacao/build.xml b/branches/SIPRP/PlanosActuacao/build.xml new file mode 100644 index 00000000..053291e2 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/build.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + Builds, tests, and runs the project PlanosActuacao. + + + diff --git a/branches/SIPRP/PlanosActuacao/jars/activation.jar b/branches/SIPRP/PlanosActuacao/jars/activation.jar new file mode 100644 index 00000000..589b6749 Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/jars/activation.jar differ diff --git a/branches/SIPRP/PlanosActuacao/jars/mail.jar b/branches/SIPRP/PlanosActuacao/jars/mail.jar new file mode 100644 index 00000000..e6f70832 Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/jars/mail.jar differ diff --git a/branches/SIPRP/PlanosActuacao/jars/postgresql-8.0-315.jdbc3.jar b/branches/SIPRP/PlanosActuacao/jars/postgresql-8.0-315.jdbc3.jar new file mode 100644 index 00000000..777b3040 Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/jars/postgresql-8.0-315.jdbc3.jar differ diff --git a/branches/SIPRP/PlanosActuacao/jars/postgresql-8.1-407.jdbc3.jar b/branches/SIPRP/PlanosActuacao/jars/postgresql-8.1-407.jdbc3.jar new file mode 100644 index 00000000..ddf17862 Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/jars/postgresql-8.1-407.jdbc3.jar differ diff --git a/branches/SIPRP/PlanosActuacao/jars/postgresql-8.2-506.jdbc4.jar b/branches/SIPRP/PlanosActuacao/jars/postgresql-8.2-506.jdbc4.jar new file mode 100644 index 00000000..260a95eb Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/jars/postgresql-8.2-506.jdbc4.jar differ diff --git a/branches/SIPRP/PlanosActuacao/lib/SIPRP.jar b/branches/SIPRP/PlanosActuacao/lib/SIPRP.jar new file mode 100644 index 00000000..2f8fb8ed Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/lib/SIPRP.jar differ diff --git a/branches/SIPRP/PlanosActuacao/lib/avalon-framework-4.2.0.jar b/branches/SIPRP/PlanosActuacao/lib/avalon-framework-4.2.0.jar new file mode 100644 index 00000000..b1aa6d7c Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/lib/avalon-framework-4.2.0.jar differ diff --git a/branches/SIPRP/PlanosActuacao/lib/batik.jar b/branches/SIPRP/PlanosActuacao/lib/batik.jar new file mode 100644 index 00000000..28c8bac0 Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/lib/batik.jar differ diff --git a/branches/SIPRP/PlanosActuacao/lib/evologger.jar b/branches/SIPRP/PlanosActuacao/lib/evologger.jar new file mode 100644 index 00000000..f47c6fbe Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/lib/evologger.jar differ diff --git a/branches/SIPRP/PlanosActuacao/lib/jai_imageio.jar b/branches/SIPRP/PlanosActuacao/lib/jai_imageio.jar new file mode 100644 index 00000000..359551eb Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/lib/jai_imageio.jar differ diff --git a/branches/SIPRP/PlanosActuacao/lib/jdbcappender.jar b/branches/SIPRP/PlanosActuacao/lib/jdbcappender.jar new file mode 100644 index 00000000..fe9d3e67 Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/lib/jdbcappender.jar differ diff --git a/branches/SIPRP/PlanosActuacao/lib/jdom.jar b/branches/SIPRP/PlanosActuacao/lib/jdom.jar new file mode 100644 index 00000000..288e64cb Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/lib/jdom.jar differ diff --git a/branches/SIPRP/PlanosActuacao/nbproject/ant-deploy.xml b/branches/SIPRP/PlanosActuacao/nbproject/ant-deploy.xml new file mode 100644 index 00000000..a6f1480c --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/nbproject/ant-deploy.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/PlanosActuacao/nbproject/build-impl.xml b/branches/SIPRP/PlanosActuacao/nbproject/build-impl.xml new file mode 100644 index 00000000..511cbbcd --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/nbproject/build-impl.xml @@ -0,0 +1,878 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.src.dir + 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 + +The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) +or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at +<netbeans_installation>/java<version>/ant/extra folder. +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/branches/SIPRP/PlanosActuacao/nbproject/faces-config.NavData b/branches/SIPRP/PlanosActuacao/nbproject/faces-config.NavData new file mode 100644 index 00000000..1468899f --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/nbproject/faces-config.NavData @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/PlanosActuacao/nbproject/genfiles.properties b/branches/SIPRP/PlanosActuacao/nbproject/genfiles.properties new file mode 100644 index 00000000..c23198c7 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=d6fcc03c +build.xml.script.CRC32=50b8b881 +build.xml.stylesheet.CRC32=c0ebde35 +# 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=d6fcc03c +nbproject/build-impl.xml.script.CRC32=abe897d8 +nbproject/build-impl.xml.stylesheet.CRC32=174458fc diff --git a/branches/SIPRP/PlanosActuacao/nbproject/private/private.properties b/branches/SIPRP/PlanosActuacao/nbproject/private/private.properties new file mode 100644 index 00000000..36b9f129 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/nbproject/private/private.properties @@ -0,0 +1,12 @@ +auxiliary.org-netbeans-modules-web-client-tools-api.clientdebug=false +auxiliary.org-netbeans-modules-web-client-tools-api.dialogShowDebugPanel=false +auxiliary.org-netbeans-modules-web-client-tools-api.FIREFOX=true +auxiliary.org-netbeans-modules-web-client-tools-api.INTERNET_5f_EXPLORER=false +auxiliary.org-netbeans-modules-web-client-tools-api.serverdebug=true +deploy.ant.properties.file=/home/tsimao/.netbeans/6.5/tomcat60.properties +j2ee.platform.classpath=/usr/local/netbeans-6.5.1/apache-tomcat-6.0.18/lib/tomcat-dbcp.jar:/usr/local/netbeans-6.5.1/apache-tomcat-6.0.18/lib/servlet-api.jar:/usr/local/netbeans-6.5.1/apache-tomcat-6.0.18/lib/annotations-api.jar:/usr/local/netbeans-6.5.1/apache-tomcat-6.0.18/lib/tomcat-i18n-fr.jar:/usr/local/netbeans-6.5.1/apache-tomcat-6.0.18/lib/jasper.jar:/usr/local/netbeans-6.5.1/apache-tomcat-6.0.18/lib/tomcat-i18n-es.jar:/usr/local/netbeans-6.5.1/apache-tomcat-6.0.18/lib/catalina.jar:/usr/local/netbeans-6.5.1/apache-tomcat-6.0.18/lib/jasper-el.jar:/usr/local/netbeans-6.5.1/apache-tomcat-6.0.18/lib/catalina-ha.jar:/usr/local/netbeans-6.5.1/apache-tomcat-6.0.18/lib/tomcat-i18n-ja.jar:/usr/local/netbeans-6.5.1/apache-tomcat-6.0.18/lib/el-api.jar:/usr/local/netbeans-6.5.1/apache-tomcat-6.0.18/lib/catalina-ant.jar:/usr/local/netbeans-6.5.1/apache-tomcat-6.0.18/lib/jsp-api.jar:/usr/local/netbeans-6.5.1/apache-tomcat-6.0.18/lib/tomcat-coyote.jar:/usr/local/netbeans-6.5.1/apache-tomcat-6.0.18/lib/catalina-tribes.jar:/usr/local/netbeans-6.5.1/apache-tomcat-6.0.18/bin/tomcat-juli.jar +j2ee.server.instance=tomcat60:home=/usr/local/netbeans-6.5.1/apache-tomcat-6.0.18:base=apache-tomcat-6.0.18_base +javac.debug=true +javadoc.preview=true +jaxws.endorsed.dir=/usr/local/netbeans-6.5.1/java2/modules/ext/jaxws21/api:/usr/local/netbeans-6.5.1/ide10/modules/ext/jaxb/api +user.properties.file=/home/tsimao/.netbeans/6.5/build.properties diff --git a/branches/SIPRP/PlanosActuacao/nbproject/private/private.xml b/branches/SIPRP/PlanosActuacao/nbproject/private/private.xml new file mode 100644 index 00000000..c1f155a7 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/nbproject/private/private.xml @@ -0,0 +1,4 @@ + + + + diff --git a/branches/SIPRP/PlanosActuacao/nbproject/project.properties b/branches/SIPRP/PlanosActuacao/nbproject/project.properties new file mode 100644 index 00000000..6a898b15 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/nbproject/project.properties @@ -0,0 +1,129 @@ +build.classes.dir=${build.web.dir}/WEB-INF/classes +build.classes.excludes=**/*.java,**/*.form +build.dir=build +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 +debug.classpath=${build.classes.dir}:${javac.classpath} +debug.client=false +debug.server=true +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} +excludes= +file.reference.activation.jar=jars/activation.jar +file.reference.ashwood-1.1.jar=../common/lib/ashwood-1.1.jar +file.reference.avalon-framework-4.2.0.jar=lib/avalon-framework-4.2.0.jar +file.reference.avalon-framework-4.2.0.jar-1=../SIPRPSoft/lib/avalon-framework-4.2.0.jar +file.reference.batik-all-1.7.jar=../SIPRPSoft/lib/batik-all-1.7.jar +file.reference.cayenne-server-3.0M2.jar=../common/lib/cayenne-server-3.0M2.jar +file.reference.common-src=../common/src +file.reference.commons-collections-3.1.jar=../common/lib/commons-collections-3.1.jar +file.reference.commons-io-1.4.jar=../SIPRPSoft/lib/commons-io-1.4.jar +file.reference.commons-lang-2.1.jar=../common/lib/commons-lang-2.1.jar +file.reference.commons-logging-1.0.4.jar=../SIPRPSoft/lib/commons-logging-1.0.4.jar +file.reference.commons-logging-1.1.jar=../common/lib/commons-logging-1.1.jar +file.reference.evolute.jar=../common/lib/evolute.jar +file.reference.fop.jar=../SIPRPSoft/lib/fop.jar +file.reference.jai_imageio.jar=lib/jai_imageio.jar +file.reference.jcalendar-1.3.2.jar=../common/lib/jcalendar-1.3.2.jar +file.reference.jdom.jar=lib/jdom.jar +file.reference.log4j-1.2.8.jar=../common/lib/log4j-1.2.8.jar +file.reference.mail.jar=jars/mail.jar +file.reference.mail.jar-1=../common/lib/mail.jar +file.reference.postgresql-8.0-315.jdbc3.jar=jars/postgresql-8.0-315.jdbc3.jar +file.reference.postgresql-8.1-407.jdbc3.jar=jars/postgresql-8.1-407.jdbc3.jar +file.reference.postgresql-8.2-506.jdbc4.jar=jars/postgresql-8.2-506.jdbc4.jar +file.reference.SIPRP.jar=lib/SIPRP.jar +file.reference.TableLayout.jar=../common/lib/TableLayout.jar +file.reference.xmlgraphics-commons-1.3.1.jar=../SIPRPSoft/lib/xmlgraphics-commons-1.3.1.jar +includes=** +j2ee.deploy.on.save=false +j2ee.platform=1.5 +j2ee.server.type=Tomcat60 +jar.compress=false +javac.classpath=\ + ${libs.jsf12.classpath}:\ + ${libs.jstl11.classpath}:\ + ${libs.jsf12-support.classpath}:\ + ${libs.woodstock-components.classpath}:\ + ${libs.woodstock-theme-default.classpath}:\ + ${file.reference.activation.jar}:\ + ${file.reference.mail.jar}:\ + ${file.reference.postgresql-8.0-315.jdbc3.jar}:\ + ${file.reference.postgresql-8.1-407.jdbc3.jar}:\ + ${file.reference.postgresql-8.2-506.jdbc4.jar}:\ + ${file.reference.cayenne-server-3.0M2.jar}:\ + ${file.reference.commons-collections-3.1.jar}:\ + ${file.reference.commons-lang-2.1.jar}:\ + ${file.reference.commons-logging-1.1.jar}:\ + ${file.reference.evolute.jar}:\ + ${file.reference.jcalendar-1.3.2.jar}:\ + ${file.reference.log4j-1.2.8.jar}:\ + ${file.reference.mail.jar-1}:\ + ${file.reference.TableLayout.jar}:\ + ${file.reference.ashwood-1.1.jar}:\ + ${file.reference.SIPRP.jar}:\ + ${file.reference.jdom.jar}:\ + ${file.reference.avalon-framework-4.2.0.jar}:\ + ${file.reference.fop.jar}:\ + ${file.reference.jai_imageio.jar}:\ + ${file.reference.xmlgraphics-commons-1.3.1.jar}:\ + ${file.reference.avalon-framework-4.2.0.jar-1}:\ + ${file.reference.batik-all-1.7.jar}:\ + ${file.reference.commons-io-1.4.jar}:\ + ${file.reference.commons-logging-1.0.4.jar} +# Space-separated list of extra javac options +javac.compilerargs= +javac.debug=true +javac.deprecation=false +javac.source=1.5 +javac.target=1.5 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir}:\ + ${libs.junit.classpath}:\ + ${libs.junit_4.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.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 +persistence.xml.dir=${conf.dir} +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 a class with a main method +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): +runmain.jvmargs= +source.encoding=ISO-8859-1 +source.root=src +src.dir=${source.root}/java +src.src.dir=${file.reference.common-src} +test.src.dir=test +war.content.additional=\ + ${libs.exceptionhandler-runtime.classpath} +war.ear.name=PlanosActuacao.war +war.name=PlanosActuacao.war +web.docbase.dir=web +webinf.dir=web/WEB-INF diff --git a/branches/SIPRP/PlanosActuacao/nbproject/project.xml b/branches/SIPRP/PlanosActuacao/nbproject/project.xml new file mode 100644 index 00000000..22827dbe --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/nbproject/project.xml @@ -0,0 +1,146 @@ + + + org.netbeans.modules.web.project + + + + PlanosActuacao + 1.6 + + + ${libs.jsf12.classpath} + WEB-INF/lib + + + ${libs.jstl11.classpath} + WEB-INF/lib + + + ${libs.jsf12-support.classpath} + WEB-INF/lib + + + ${libs.woodstock-components.classpath} + WEB-INF/lib + + + ${libs.woodstock-theme-default.classpath} + WEB-INF/lib + + + ${file.reference.activation.jar} + WEB-INF/lib + + + ${file.reference.mail.jar} + WEB-INF/lib + + + ${file.reference.postgresql-8.0-315.jdbc3.jar} + WEB-INF/lib + + + ${file.reference.postgresql-8.1-407.jdbc3.jar} + WEB-INF/lib + + + ${file.reference.postgresql-8.2-506.jdbc4.jar} + WEB-INF/lib + + + ${file.reference.cayenne-server-3.0M2.jar} + WEB-INF/lib + + + ${file.reference.commons-collections-3.1.jar} + WEB-INF/lib + + + ${file.reference.commons-lang-2.1.jar} + WEB-INF/lib + + + ${file.reference.commons-logging-1.1.jar} + WEB-INF/lib + + + ${file.reference.evolute.jar} + WEB-INF/lib + + + ${file.reference.jcalendar-1.3.2.jar} + WEB-INF/lib + + + ${file.reference.log4j-1.2.8.jar} + WEB-INF/lib + + + ${file.reference.mail.jar-1} + WEB-INF/lib + + + ${file.reference.TableLayout.jar} + WEB-INF/lib + + + ${file.reference.ashwood-1.1.jar} + WEB-INF/lib + + + ${file.reference.SIPRP.jar} + WEB-INF/lib + + + ${file.reference.jdom.jar} + WEB-INF/lib + + + ${file.reference.avalon-framework-4.2.0.jar} + WEB-INF/lib + + + ${file.reference.fop.jar} + WEB-INF/lib + + + ${file.reference.jai_imageio.jar} + WEB-INF/lib + + + ${file.reference.xmlgraphics-commons-1.3.1.jar} + WEB-INF/lib + + + ${file.reference.avalon-framework-4.2.0.jar-1} + WEB-INF/lib + + + ${file.reference.batik-all-1.7.jar} + WEB-INF/lib + + + ${file.reference.commons-io-1.4.jar} + WEB-INF/lib + + + ${file.reference.commons-logging-1.0.4.jar} + WEB-INF/lib + + + + + ${libs.exceptionhandler-runtime.classpath} + WEB-INF/lib + + + + + + + + + + + + diff --git a/branches/SIPRP/PlanosActuacao/src/conf/MANIFEST.MF b/branches/SIPRP/PlanosActuacao/src/conf/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/branches/SIPRP/PlanosActuacao/src/java/SIPRPNode.driver.xml b/branches/SIPRP/PlanosActuacao/src/java/SIPRPNode.driver.xml new file mode 100644 index 00000000..396e9b6e --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/SIPRPNode.driver.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/branches/SIPRP/PlanosActuacao/src/java/db/Db.java b/branches/SIPRP/PlanosActuacao/src/java/db/Db.java new file mode 100644 index 00000000..8adf42c9 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/db/Db.java @@ -0,0 +1,79 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package db; + +import com.evolute.utils.error.ErrorLogger; +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://evoserver:5432/siprp"; //testes +// String connectionURL = "jdbc:postgresql://www.evolute.pt:5436/siprp"; //real + String connectionURL = "jdbc:postgresql://localhost:5436/siprp"; //real + + 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(); +// FacesContext fc = FacesContext.getCurrentInstance(); +// ApplicationBean1 application = JSFUtils.getApplicationBean(fc); +// if(application.getConnection() == null) +// { + connection = DriverManager.getConnection(connectionURL, User, Pass); +// application.setConnection(connection); +// } + + connection = DriverManager.getConnection(connectionURL, User, Pass); + HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(true); + session.setAttribute("connection", connection); + return connection; + } + + public Connection getConnection() + { +// FacesContext fc = FacesContext.getCurrentInstance(); +// ApplicationBean1 application = JSFUtils.getApplicationBean(fc); +// connection = application.getConnection(); + HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false); + connection = (Connection) session.getAttribute("connection"); + return connection; + } + + public Statement createStatement() + { + HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false); + connection = (Connection) session.getAttribute("connection"); +// FacesContext fc = FacesContext.getCurrentInstance(); +// ApplicationBean1 application = JSFUtils.getApplicationBean(fc); +// connection = application.getConnection(); + Statement st; + try + { + st = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + return st; + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + return null; + } + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/db/DbRelatorios.java b/branches/SIPRP/PlanosActuacao/src/java/db/DbRelatorios.java new file mode 100644 index 00000000..7d55a60a --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/db/DbRelatorios.java @@ -0,0 +1,73 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package db; + +import com.evolute.utils.error.ErrorLogger; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.Statement; + +/** + * + * @author lluis + */ +public class DbRelatorios { + //String connectionURL = "jdbc:postgresql://storage:5432/siprp"; //testes + String connectionURL = "jdbc:postgresql://localhost:5436/siprp"; //real + + + String User = "postgres"; + String Pass = null; + Connection connection = null; + + public Connection connect() throws Exception + { + Class.forName("org.postgresql.Driver").newInstance(); + //FacesContext fc = FacesContext.getCurrentInstance(); + //ApplicationBean1 application = JSFUtils.getApplicationBean(fc); + //if(application.getConnection() == null) + //{ + connection = DriverManager.getConnection(connectionURL, User, Pass); + //application.setConnection(connection); + //} + +// connection = DriverManager.getConnection(connectionURL, User, Pass); +// HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(true); +// session.setAttribute("connection", connection); + return connection; + } + + public Connection getConnection() + { + ////FacesContext fc = FacesContext.getCurrentInstance(); + ////ApplicationBean1 application = JSFUtils.getApplicationBean(fc); + ////connection = application.getConnection(); + //HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false); + //connection = (Connection) session.getAttribute("connection"); + return connection; + } + + public Statement createStatement() + { + //HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false); + //connection = (Connection) session.getAttribute("connection"); + ////FacesContext fc = FacesContext.getCurrentInstance(); + ////ApplicationBean1 application = JSFUtils.getApplicationBean(fc); + ////connection = application.getConnection(); + Statement st; + try + { + st = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + return st; + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + return null; + } + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/db/Dblocal.java b/branches/SIPRP/PlanosActuacao/src/java/db/Dblocal.java new file mode 100644 index 00000000..5c260b31 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/db/Dblocal.java @@ -0,0 +1,81 @@ +/* + * 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 com.evolute.utils.error.ErrorLogger; +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://evoserver:5432/siprp_local_3"; //testes +// String connectionURL = "jdbc:postgresql://www.evolute.pt:5436/siprp_local_3"; //testes local_3 + String connectionURL = "jdbc:postgresql://localhost:5436/siprp_local_3"; + + 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(); +// FacesContext fc = FacesContext.getCurrentInstance(); +// ApplicationBean1 application = JSFUtils.getApplicationBean(fc); +// if(application.getConnection() == null) +// { + connection = DriverManager.getConnection(connectionURL, User, Pass); +// application.setLocalConnection(connection); +// } + + + + 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"); +// FacesContext fc = FacesContext.getCurrentInstance(); +// ApplicationBean1 application = JSFUtils.getApplicationBean(fc); +// +// connection = application.getLocalConnection(); + Statement st; + try + { + st = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + return st; + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + return null; + } + } + + public void close() throws Exception + { + connection.close(); + } + +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/db/DblocalRelatorios.java b/branches/SIPRP/PlanosActuacao/src/java/db/DblocalRelatorios.java new file mode 100644 index 00000000..f7b8ce05 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/db/DblocalRelatorios.java @@ -0,0 +1,85 @@ +/* + * To change this template, choose Tools | Templates + * 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 org.apache.cayenne.access.DataDomain; +import org.apache.cayenne.access.DataNode; +import org.apache.cayenne.conf.DefaultConfiguration; +import org.apache.cayenne.conn.DriverDataSource; +import org.apache.cayenne.dba.AutoAdapter; +import org.apache.cayenne.map.DataMap; + +import com.evolute.utils.Singleton; + +import com.evolute.utils.error.ErrorLogger; +import siprp.SingletonConstants; + +/** + * + * @author lluis + */ +public class DblocalRelatorios { + //String connectionURL = "jdbc:postgresql://storage/siprp_local"; //testes + + //String connectionURL = "jdbc:postgresql://storage/siprp_local_3"; //testes local_3 + String connectionURL = "jdbc:postgresql://localhost:5436/siprp_local_3"; + + + + String User = "postgres"; + String Pass = null; + Connection connection = null; + + public Connection connect() throws Exception + { + Class.forName("org.postgresql.Driver").newInstance(); + connection = DriverManager.getConnection(connectionURL, User, Pass); + + DataDomain domain = DefaultConfiguration.getSharedConfiguration().getDomain(); + DataMap map = domain.getMap( "SIPRPMap" ); + DriverDataSource dataSource = new DriverDataSource((String) Singleton.getInstance( SingletonConstants.LOCAL_DRIVER_NAME ), connectionURL, User, Pass ); + DataNode node = new DataNode("SIPRPNode"); + node.setDataSource( dataSource ); + node.setAdapter( new AutoAdapter(dataSource) ); + node.addDataMap( map ); + node.setEntityResolver( domain.getEntityResolver() ); + domain.reset(); + domain.addNode( node ); + + //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) + { + ErrorLogger.logException( ex ); + return null; + } + } + + public void close() throws Exception + { + connection.close(); + } + +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/db/entidades/Area.java b/branches/SIPRP/PlanosActuacao/src/java/db/entidades/Area.java new file mode 100644 index 00000000..afa24255 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/db/entidades/Area.java @@ -0,0 +1,60 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package db.entidades; + +import java.util.List; + +/** + * + * @author lluis + */ +public class Area { + private Integer id; + private Integer area_id; //from relatorios + private Integer plano_id; + private String descricao; + private List riscos; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public List getRiscos() { + return riscos; + } + + public void setRiscos(List riscos) { + this.riscos = riscos; + } + + public Integer getPlano_id() { + return plano_id; + } + + public void setPlano_id(Integer plano_id) { + this.plano_id = plano_id; + } + + public Integer getArea_id() { + return area_id; + } + + public void setArea_id(Integer area_id) { + this.area_id = area_id; + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/db/entidades/EstadoMedida.java b/branches/SIPRP/PlanosActuacao/src/java/db/entidades/EstadoMedida.java new file mode 100644 index 00000000..91b5f3ea --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/db/entidades/EstadoMedida.java @@ -0,0 +1,39 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package db.entidades; + + +/** + * + * @author dneves + */ +public class EstadoMedida +{ + + private Integer id; + private String descricao; + + + public Integer getId() + { + return this.id; + } + + public void setId( Integer id ) + { + this.id = id; + } + + public String getDescricao() + { + return this.descricao; + } + + public void setDescricao( String desc ) + { + this.descricao = desc; + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/db/entidades/Medida.java b/branches/SIPRP/PlanosActuacao/src/java/db/entidades/Medida.java new file mode 100644 index 00000000..8ec8c538 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/db/entidades/Medida.java @@ -0,0 +1,89 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package db.entidades; + +import java.util.List; + +/** + * + * @author lluis + */ +public class Medida { + private Integer id; + private Integer medida_id; //from relatorios + private Integer valor_id; + private Integer risco_id; + private String descricao; + private String activa; + private Integer validarMedidaId = null; + private List postos; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public String getActiva() { + return activa; + } + + public void setActiva(String activa) { + this.activa = activa; + } + + public Integer getValor_id() { + return valor_id; + } + + public void setValor_id(Integer valor_id) { + this.valor_id = valor_id; + } + + public List getPostos() { + return postos; + } + + public void setPostos(List postos) { + this.postos = postos; + } + + public Integer getRisco_id() { + return risco_id; + } + + public void setRisco_id(Integer risco_id) { + this.risco_id = risco_id; + } + + public Integer getMedida_id() { + return medida_id; + } + + public void setMedida_id(Integer medida_id) { + this.medida_id = medida_id; + } + + public Integer getValidarMedidaId() + { + return validarMedidaId; + } + + public void setValidarMedidaId( Integer validarMedId ) + { + validarMedidaId = validarMedId; + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/db/entidades/PlanoActuacao.java b/branches/SIPRP/PlanosActuacao/src/java/db/entidades/PlanoActuacao.java new file mode 100644 index 00000000..080d1aa2 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/db/entidades/PlanoActuacao.java @@ -0,0 +1,466 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package db.entidades; + +import global.Global; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +/** + * + * @author lluis + */ +public class PlanoActuacao { + + private static final SimpleDateFormat D_F = new SimpleDateFormat( "dd-MM-yyyy" ); + + private Integer id; + private Integer estabelecimento_id; + private String nome_estabelecimento; + private Integer empresa_id; + private String nome_empresa; + private Integer fase; + private Integer fase_anterior; + private String descricao; + private List areas; + private List riscos; + + // + private Date data_visita; + private String data_visita_str; + private Date data_relatorio; + private Integer tecnico_hs_id; + private String fase_nome; + private String tecnico_hs_nome; + private String loja_nome; + + private Boolean validacao_director_loja; + private Boolean validacao_dns; + private Boolean validacao_hs; + private String observacoes_dl; + private String observacoes_dns; + private String obs_correcao; + + private int total_riscos; + + private String correcao; + private Integer fase_antes_correcao; + private Date data_validacao_dir_loja; + private Integer user_dir_loja; + private Date data_validacao_dns; + private Integer user_dns; + private Date data_validacao_hs; + private Integer user_hs; + + + private String data_validacao_dir_loja_str; + private String data_validacao_dns_str; + private String data_validacao_hs_str; + + private Date data_controlo; + private Date data_email_controlo; + + private Boolean concluido_por_desactivacao; + private Date data_desactivacao; + + private Integer tecnico_superior_hs_id; + private String tecnico_superior_hs_nome; + + private String tecnicos_nomes; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getEstabelecimento_id() { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_id) { + this.estabelecimento_id = estabelecimento_id; + } + + public Integer getFase() { + return fase; + } + + public void setFase(Integer fase) { + this.fase = fase; + fase_nome = Global.FASES_TEXTO[fase.intValue()-1]; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public List getRiscos() { + return riscos; + } + + public void setRiscos(List riscos) { + this.riscos = riscos; + } + + public Date getData_visita() { + return data_visita; + } + + public void setData_visita(Date data_visita) { + this.data_visita = data_visita; + SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); + data_visita_str = formatter.format(data_visita); + } + + public Integer getTecnico_hs_id() { + return tecnico_hs_id; + } + + public void setTecnico_hs_id(Integer tecnico_hs_id) { + this.tecnico_hs_id = tecnico_hs_id; + } + + public String getFase_nome() { + String fn = fase_nome; + + if ( fase.intValue() == Global.FASE_CONCLUIDO ) + { + if ( getConcluidoPorDesactivacao() != null && getConcluidoPorDesactivacao() ) + { + fn = "Prazo Expirado"; + + if ( getDataDesactivacao() != null ) + { + fn += " (em " + D_F.format( getDataDesactivacao() ) + ")"; + } + } + } + + return fn; +// if ( fase.intValue() == Global.FASE_CONCLUIDO && getConcluidoPorDesactivacao() != null && getConcluidoPorDesactivacao() ) +// { +// return "Prazo Expirado"; +// } +// return fase_nome; + } + + public void setFase_nome(String fase_nome) { + this.fase_nome = fase_nome; + } + + public String getTecnico_hs_nome() { + return tecnico_hs_nome; + } + + public void setTecnico_hs_nome(String tecnico_hs_nome) { + this.tecnico_hs_nome = tecnico_hs_nome; + } + + public String getLoja_nome() { + return loja_nome; + } + + public void setLoja_nome(String loja_nome) { + this.loja_nome = loja_nome; + } + + public String getData_visita_str() { + return data_visita_str; + } + + public void setData_visita_str(String data_visita_str) { + this.data_visita_str = data_visita_str; + } + + public String getNome_estabelecimento() { + return nome_estabelecimento; + } + + public void setNome_estabelecimento(String nome_estabelecimento) { + this.nome_estabelecimento = nome_estabelecimento; + } + + public List getAreas() { + return areas; + } + + public void setAreas(List areas) { + this.areas = areas; + } + + public int getTotal_riscos() { + return total_riscos; + } + + public void setTotal_riscos(int total_riscos) { + this.total_riscos = total_riscos; + } + + public Boolean getValidacao_director_loja() { + return validacao_director_loja; + } + + public void setValidacao_director_loja(Boolean validacao_director_loja) { + this.validacao_director_loja = validacao_director_loja; + } + + public Boolean getValidacao_dns() { + return validacao_dns; + } + + public void setValidacao_dns(Boolean validacao_dns) { + this.validacao_dns = validacao_dns; + } + + public Boolean getValidacao_hs() { + return validacao_hs; + } + + public void setValidacao_hs(Boolean validacao_hs) { + this.validacao_hs = validacao_hs; + } + + public String getObs_correcao() { + return obs_correcao; + } + + public void setObs_correcao(String obs_correcao) { + this.obs_correcao = obs_correcao; + } + + public String getCorrecao() { + return correcao; + } + + public void setCorrecao(String correcao) { + this.correcao = correcao; + } + + public Integer getFase_antes_correcao() { + return fase_antes_correcao; + } + + public void setFase_antes_correcao(Integer fase_antes_correcao) { + this.fase_antes_correcao = fase_antes_correcao; + } + + public Date getData_validacao_dir_loja() { + return data_validacao_dir_loja; + } + + public void setData_validacao_dir_loja(Date data_validacao_dir_loja) { + SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); + if(data_validacao_dir_loja != null) + { + data_validacao_dir_loja_str = formatter.format(data_validacao_dir_loja); + } + + this.data_validacao_dir_loja = data_validacao_dir_loja; + } + + public Integer getUser_dir_loja() { + return user_dir_loja; + } + + public void setUser_dir_loja(Integer user_dir_loja) { + this.user_dir_loja = user_dir_loja; + } + + public Date getData_validacao_dns() { + return data_validacao_dns; + } + + public void setData_validacao_dns(Date data_validacao_dns) { + SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); + if(data_validacao_dns != null) + { + data_validacao_dns_str = formatter.format(data_validacao_dns); + } + this.data_validacao_dns = data_validacao_dns; + } + + public Integer getUser_dns() { + return user_dns; + } + + public void setUser_dns(Integer user_dns) { + this.user_dns = user_dns; + } + + public Date getData_validacao_hs() { + return data_validacao_hs; + } + + public void setData_validacao_hs(Date data_validacao_hs) { + SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); + if(data_validacao_hs != null) + { + data_validacao_hs_str = formatter.format(data_validacao_hs); + } + + this.data_validacao_hs = data_validacao_hs; + } + + public Integer getUser_hs() { + return user_hs; + } + + public void setUser_hs(Integer user_hs) { + this.user_hs = user_hs; + } + + public String getData_validacao_dir_loja_str() { + return data_validacao_dir_loja_str; + } + + public void setData_validacao_dir_loja_str(String data_validacao_dir_loja_str) { + this.data_validacao_dir_loja_str = data_validacao_dir_loja_str; + } + + public String getData_validacao_dns_str() { + return data_validacao_dns_str; + } + + public void setData_validacao_dns_str(String data_validacao_dns_str) { + this.data_validacao_dns_str = data_validacao_dns_str; + } + + public String getData_validacao_hs_str() { + return data_validacao_hs_str; + } + + public void setData_validacao_hs_str(String data_validacao_hs_str) { + this.data_validacao_hs_str = data_validacao_hs_str; + } + + public String getObservacoes_dl() { + return observacoes_dl; + } + + public void setObservacoes_dl(String observacoes_dl) { + this.observacoes_dl = observacoes_dl; + } + + public String getObservacoes_dns() { + return observacoes_dns; + } + + public void setObservacoes_dns(String observacoes_dns) { + this.observacoes_dns = observacoes_dns; + } + + public Integer getFase_anterior() { + return fase_anterior; + } + + public void setFase_anterior(Integer fase_anterior) { + this.fase_anterior = fase_anterior; + } + + public Date getData_controlo() { + return data_controlo; + } + + public void setData_controlo(Date data_controlo) { + this.data_controlo = data_controlo; + } + + public Date getData_email_controlo() { + return data_email_controlo; + } + + public void setData_email_controlo(Date data_email_controlo) { + this.data_email_controlo = data_email_controlo; + } + + public Integer getEmpresa_id() { + return empresa_id; + } + + public void setEmpresa_id(Integer empresa_id) { + this.empresa_id = empresa_id; + } + + public String getNome_empresa() { + return nome_empresa; + } + + public void setNome_empresa(String nome_empresa) { + this.nome_empresa = nome_empresa; + } + + public Date getData_relatorio() { + return data_relatorio; + } + + public void setData_relatorio(Date data_relatorio) { + this.data_relatorio = data_relatorio; + } + + public Boolean getConcluidoPorDesactivacao() + { + return concluido_por_desactivacao; + } + + public void setConcluidoPorDesactivacao( boolean value ) + { + this.concluido_por_desactivacao = value; + } + + public Date getDataDesactivacao() + { + return data_desactivacao; + } + + public void setDataDesactivacao( Date data_desactivacao ) + { + this.data_desactivacao = data_desactivacao; + } + + public Integer getTecnico_superior_hs_id() + { + return tecnico_superior_hs_id; + } + + public void setTecnico_superior_hs_id( Integer tecnico_superior_hs_id ) + { + this.tecnico_superior_hs_id = tecnico_superior_hs_id; + } + + public String getTecnico_superior_hs_nome() { + return tecnico_superior_hs_nome; + } + + public void setTecnico_superior_hs_nome(String tecnico_superior_hs_nome) { + this.tecnico_superior_hs_nome = tecnico_superior_hs_nome; + } + + public String getTecnicos_nomes() + { + String nomes = getTecnico_hs_nome(); + if ( getTecnico_superior_hs_nome() != null ) + { + nomes = nomes == null ? getTecnico_superior_hs_nome() : nomes + ", " + getTecnico_superior_hs_nome(); + } + + setTecnicos_nomes( nomes ); + return tecnicos_nomes; + } + + public void setTecnicos_nomes(String tecnicos_nomes) { + this.tecnicos_nomes = tecnicos_nomes; + } + + +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/db/entidades/PostoTrabalho.java b/branches/SIPRP/PlanosActuacao/src/java/db/entidades/PostoTrabalho.java new file mode 100644 index 00000000..0d42aeae --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/db/entidades/PostoTrabalho.java @@ -0,0 +1,58 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package db.entidades; + +/** + * + * @author lluis + */ +public class PostoTrabalho { + private Integer id; + private Integer posto_id; //from relatorios + private Integer medida_id; + private String descricao; + private String activo; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public String getActivo() { + return activo; + } + + public void setActivo(String activo) { + this.activo = activo; + } + + public Integer getMedida_id() { + return medida_id; + } + + public void setMedida_id(Integer medida_id) { + this.medida_id = medida_id; + } + + public Integer getPosto_id() { + return posto_id; + } + + public void setPosto_id(Integer posto_id) { + this.posto_id = posto_id; + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/db/entidades/Risco.java b/branches/SIPRP/PlanosActuacao/src/java/db/entidades/Risco.java new file mode 100644 index 00000000..1c2821d5 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/db/entidades/Risco.java @@ -0,0 +1,178 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package db.entidades; + + +import java.util.Date; +import java.util.List; + +/** + * + * @author lluis + */ +public class Risco { + private Integer id; + private Integer area_id; + private String descricao; + private String activo; + //private Valor valor; + private Integer valor; + private String responsavel_execucao; + private String por; + private String recursos_necessarios; + private Date data_inicio; + private Date data_fim; + private Integer risco_id; + private String parecer_dns; + private String parecer_dl; + private String verificacao_siprp; + + private List valores; + private List medidas; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public String getActivo() { + return activo; + } + + public void setActivo(String activo) { + this.activo = activo; + } + + public Integer getArea_id() { + return area_id; + } + + public void setArea_id(Integer area_id) { + this.area_id = area_id; + } + +// public Valor getValor() { +// return valor; +// } +// +// public void setValor(Valor valor) { +// this.valor = valor; +// } + + public List getMedidas() { + return medidas; + } + + public void setMedidas(List medidas) { + this.medidas = medidas; + } + + public List getValores() { + return valores; + } + + public void setValores(List valores) { + this.valores = valores; + } + + public String getResponsavel_execucao() { + return responsavel_execucao; + } + + public void setResponsavel_execucao(String responsavel_execucao) { + this.responsavel_execucao = responsavel_execucao; + } + + public String getRecursos_necessarios() { + return recursos_necessarios; + } + + public void setRecursos_necessarios(String recursos_necessarios) { + this.recursos_necessarios = recursos_necessarios; + } + + public Date getData_inicio() { + return data_inicio; + } + + public void setData_inicio(Date data_inicio) { + this.data_inicio = data_inicio; + } + + public Date getData_fim() { + return data_fim; + } + + public void setData_fim(Date data_fim) { + this.data_fim = data_fim; + } + + public String getParecer_dns() { + return parecer_dns; + } + + public void setParecer_dns(String parecer_dns) { + this.parecer_dns = parecer_dns; + } + + public String getParecer_dl() { + return parecer_dl; + } + + public void setParecer_dl(String parecer_dl) { + this.parecer_dl = parecer_dl; + } + + public String getVerificacao_siprp() { + return verificacao_siprp; + } + + public void setVerificacao_siprp(String verificacao_siprp) { + this.verificacao_siprp = verificacao_siprp; + } + + public Integer getValor() { + return valor; + } + + public void setValor(Integer valor) { + this.valor = valor; + } + + public Integer getRisco_id() { + return risco_id; + } + + public void setRisco_id(Integer risco_id) { + this.risco_id = risco_id; + } + + /** + * @return the por + */ + public String getPor() { + return por; + } + + /** + * @param por the por to set + */ + public void setPor(String por) { + this.por = por; + } + +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/db/entidades/Utilizador.java b/branches/SIPRP/PlanosActuacao/src/java/db/entidades/Utilizador.java new file mode 100644 index 00000000..6614efce --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/db/entidades/Utilizador.java @@ -0,0 +1,247 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package db.entidades; + +import java.util.Date; + +/** + * + * @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 tipo; + private String numero_cedula; + private String cap; + private Integer codigo_permissao; + private String nome; + private Integer medico_id; + private Integer funcionario_hst_id; + private String activo; + private Integer acesso; + private String responsavel_loja; + private String gestor_geral; + private String numero_mecanografico; + private String categoria; //descricao do 'tipo'' + private String nome_estabelecimento; + private String primeiro_login; + private String apagado; + private Date data_password; + private Integer estabelecimento_gestor = null; + + 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 getTipo() { + return tipo; + } + + public void setTipo(Integer tipo) { + this.tipo = tipo; + } + + public String getNumero_cedula() { + return numero_cedula; + } + + public void setNumero_cedula(String numero_cedula) { + this.numero_cedula = numero_cedula; + } + + public String getCap() { + return cap; + } + + public void setCap(String cap) { + this.cap = cap; + } + + public Integer getCodigo_permissao() { + return codigo_permissao; + } + + public void setCodigo_permissao(Integer codigo_permissao) { + this.codigo_permissao = codigo_permissao; + } + + public String getNome() { + return nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public Integer getMedico_id() { + return medico_id; + } + + public void setMedico_id(Integer medico_id) { + this.medico_id = medico_id; + } + + public Integer getFuncionario_hst_id() { + return funcionario_hst_id; + } + + public void setFuncionario_hst_id(Integer funcionario_hst_id) { + this.funcionario_hst_id = funcionario_hst_id; + } + + public String getActivo() { + return activo; + } + + public void setActivo(String activo) { + this.activo = activo; + } + + public Integer getAcesso() { + return acesso; + } + + public void setAcesso(Integer acesso) { + this.acesso = acesso; + } + + public String getResponsavel_loja() { + return responsavel_loja; + } + + public void setResponsavel_loja(String responsavel_loja) { + this.responsavel_loja = responsavel_loja; + } + + public String getGestor_geral() { + return gestor_geral; + } + + public void setGestor_geral(String gestor_geral) { + this.gestor_geral = gestor_geral; + } + + public String getNumero_mecanografico() { + return numero_mecanografico; + } + + public void setNumero_mecanografico(String numero_mecanografico) { + this.numero_mecanografico = numero_mecanografico; + } + + public String getCategoria() { + return categoria; + } + + public void setCategoria(String categoria) { + this.categoria = categoria; + } + + public String getNome_estabelecimento() { + return nome_estabelecimento; + } + + public void setNome_estabelecimento(String nome_estabelecimento) { + this.nome_estabelecimento = nome_estabelecimento; + } + + public String getPrimeiro_login() { + return primeiro_login; + } + + public void setPrimeiro_login(String primeiro_login) { + this.primeiro_login = primeiro_login; + } + + public String getApagado() { + return apagado; + } + + public void setApagado(String apagado) { + this.apagado = apagado; + } + + public Date getData_password() { + return data_password; + } + + public void setData_password(Date data_password) { + this.data_password = data_password; + } + + /** + * @return the estabelecimento_gestor + */ + public Integer getEstabelecimento_gestor() { + return estabelecimento_gestor; + } + + /** + * @param estabelecimento_gestor the estabelecimento_gestor to set + */ + public void setEstabelecimento_gestor(Integer estabelecimento_gestor) { + this.estabelecimento_gestor = estabelecimento_gestor; + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/db/entidades/Valor.java b/branches/SIPRP/PlanosActuacao/src/java/db/entidades/Valor.java new file mode 100644 index 00000000..366a699f --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/db/entidades/Valor.java @@ -0,0 +1,116 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package db.entidades; + +import java.util.Date; +import java.util.List; + +/** + * + * @author lluis + */ +public class Valor { + private Integer id; + private Integer risco_id; + private Integer valor; + private List medidas; + + private String responsavel_execucao; + private String recursos_necessarios; + private Date data_inicio; + private Date data_fim; + private String parecer_dns; + private String parecer_dl; + private String verificacao_siprp; + + public Integer getValor() { + return valor; + } + + public void setValor(Integer valor) { + this.valor = valor; + } + + public List getMedidas() { + return medidas; + } + + public void setMedidas(List medidas) { + this.medidas = medidas; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getRisco_id() { + return risco_id; + } + + public void setRisco_id(Integer risco_id) { + this.risco_id = risco_id; + } + + public String getResponsavel_execucao() { + return responsavel_execucao; + } + + public void setResponsavel_execucao(String responsavel_execucao) { + this.responsavel_execucao = responsavel_execucao; + } + + public String getRecursos_necessarios() { + return recursos_necessarios; + } + + public void setRecursos_necessarios(String recursos_necessarios) { + this.recursos_necessarios = recursos_necessarios; + } + + public Date getData_inicio() { + return data_inicio; + } + + public void setData_inicio(Date data_inicio) { + this.data_inicio = data_inicio; + } + + public Date getData_fim() { + return data_fim; + } + + public void setData_fim(Date data_fim) { + this.data_fim = data_fim; + } + + public String getParecer_dns() { + return parecer_dns; + } + + public void setParecer_dns(String parecer_dns) { + this.parecer_dns = parecer_dns; + } + + public String getParecer_dl() { + return parecer_dl; + } + + public void setParecer_dl(String parecer_dl) { + this.parecer_dl = parecer_dl; + } + + public String getVerificacao_siprp() { + return verificacao_siprp; + } + + public void setVerificacao_siprp(String verificacao_siprp) { + this.verificacao_siprp = verificacao_siprp; + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/db/providers/CreatePlanosDataProvider.java b/branches/SIPRP/PlanosActuacao/src/java/db/providers/CreatePlanosDataProvider.java new file mode 100644 index 00000000..c9cdc119 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/db/providers/CreatePlanosDataProvider.java @@ -0,0 +1,649 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package db.providers; + +import com.evolute.utils.error.ErrorLogger; +import db.DbRelatorios; +import db.DblocalRelatorios; +import db.entidades.Area; +import db.entidades.Medida; +import db.entidades.PlanoActuacao; +import db.entidades.PostoTrabalho; +import db.entidades.Risco; +import db.entidades.Valor; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import utils.Utils; + +/** + * + * @author lluis + */ +public class CreatePlanosDataProvider { + DbRelatorios db; + DblocalRelatorios dblocal; + + public CreatePlanosDataProvider() + { + try + { + db = new DbRelatorios(); + db.connect(); + dblocal = new DblocalRelatorios(); + dblocal.connect(); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + } + + + protected Integer getMaxTableId(String table) + { + Statement st = createStatement(); + String id = table + ".id"; + String sql = "SELECT max(" + id + ")+1 AS MAXID FROM " + table; + try + { + ResultSet rs = st.executeQuery(sql); + rs.first(); + Integer newId = new Integer(rs.getInt("MAXID")); + if(newId.intValue() == 0) + { + newId = new Integer(1); + } + return newId; + } + catch(Exception ex) + { + return new Integer(1); + } + } + + public List getPlanosOnline( Integer estabelecimentoID ) throws Exception + { + ArrayList list = new ArrayList(); + Statement st = createStatement(); + String sql = "select data_visita from planos_actuacao where deleted_date is null"; + if( estabelecimentoID != null ) + { + sql += " and estabelecimento_id = " + estabelecimentoID; + } + ResultSet rs = st.executeQuery(sql); + + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + java.sql.Date sqlDate = rs.getDate("data_visita"); + java.util.Date data_visita = new java.util.Date(sqlDate.getTime()); + System.out.println("DATA PLANO : " + data_visita.toString()); + list.add(data_visita); + }while(rs.next()); + } + return list; + } + + public List getEstabelecimentosWithPlanos() + { + List result = new ArrayList(); + try + { + Statement st = createStatement(); + String sql = "select distinct estabelecimento_id from planos_actuacao where deleted_date is null"; + ResultSet rs = st.executeQuery(sql); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + result.add( rs.getInt("estabelecimento_id") ); + }while(rs.next()); + } + } + catch( Exception e ) + { + ErrorLogger.logException( e ); + } + return result; + } + + + + //=================== + + public PlanoActuacao getFullPlano(PlanoActuacao plano, Integer relatorioId) + { + try + { + plano = getAreasByPlano(plano, relatorioId); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + + return plano; + } + + private PlanoActuacao getAreasByPlano(PlanoActuacao plano, Integer relatorioId) throws Exception + { + Statement st = createLocalStatement(); + + String sql = "select distinct area_id, hs_relatorio_area.description as descricao from hs_relatorio_posto "; + sql += "inner join hs_relatorio_posto_medida on hs_relatorio_posto_medida.posto_id = hs_relatorio_posto.id "; + sql += "inner join hs_relatorio_medida on hs_relatorio_medida.id = hs_relatorio_posto_medida.medida_id "; + sql += "inner join hs_relatorio_risco on hs_relatorio_risco.id = hs_relatorio_medida.risco_id "; + sql += "inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id "; + sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; + sql += "where hs_relatorio.id = " + relatorioId + " "; + sql += "order by area_id "; + System.out.println("AREAS BY PLANO SQL : " + sql); + ResultSet rs = st.executeQuery(sql); + + List areas = new ArrayList(); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + Area a = new Area(); + a.setId(new Integer( rs.getInt("area_id") )); + a.setArea_id(a.getId()); + if(existemMedidasByArea(a.getId())) + { + a.setDescricao(Utils.unicodeToHTML(rs.getString("descricao"))); + try + { + a.setRiscos(getRiscosByArea(a)); + } + catch(Exception ex) + { + System.out.println("ERRO RISCOS BY AREA !!!!"); + ErrorLogger.logException( ex ); + a.setRiscos(null); + } + + areas.add(a); + } + + }while(rs.next()); + plano.setAreas(areas); + } + return plano; + } + + private List getRiscosByArea(Area a) throws Exception + { + Statement st = createLocalStatement(); + String sql = "select distinct hs_relatorio_risco.id, hs_relatorio_risco.description as descricao from hs_relatorio_posto "; + sql += "inner join hs_relatorio_posto_medida on hs_relatorio_posto_medida.posto_id = hs_relatorio_posto.id "; + sql += "inner join hs_relatorio_medida on hs_relatorio_medida.id = hs_relatorio_posto_medida.medida_id "; + sql += "inner join hs_relatorio_risco on hs_relatorio_risco.id = hs_relatorio_medida.risco_id "; + sql += "inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id "; + sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; + sql += "where area_id = " + a.getId() + " "; + sql += "order by hs_relatorio_risco.id "; + System.out.println("RISCOS BY AREA SQL : " + sql); + ResultSet rs = st.executeQuery(sql); + List riscos = new ArrayList(); + if(rs.isBeforeFirst()) + { + + rs.first(); + do + { + Risco r = new Risco(); + r.setId(new Integer( rs.getInt("id") )); + if(existemMedidasByRisco(r.getId())) + { + r.setDescricao(Utils.unicodeToHTML(rs.getString("descricao"))); + r.setValores(getValoresByRisco(r, a)); + //Integer valor = getValorByRisco(r, a); + //r.setValor(valor); + r.setRisco_id(new Integer( rs.getInt("id") )); + r.setMedidas(getMedidasByRisco( r, a)); + riscos.add(r); + } + + }while(rs.next()); + } + return riscos; + + } + + private List getValoresByRisco(Risco r, Area a) throws Exception + //private Integer getValorByRisco(Risco r, Area a) throws Exception + { + Statement st = createLocalStatement(); + String sql = "select valor from "; + sql += "(select distinct hs_relatorio_posto_risco.risco_id, "; + sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null "; + sql += "when hs_relatorio_posto_risco.valor_qualitativo_id isnull then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade "; + sql += "else null "; + sql += "end as valor "; + sql += "from hs_relatorio_posto "; + sql += "inner join hs_relatorio_posto_medida on hs_relatorio_posto_medida.posto_id = hs_relatorio_posto.id "; + sql += "inner join hs_relatorio_medida on hs_relatorio_medida.id = hs_relatorio_posto_medida.medida_id "; + sql += "inner join hs_relatorio_risco on hs_relatorio_risco.id = hs_relatorio_medida.risco_id "; + sql += "inner join hs_relatorio_posto_risco on (hs_relatorio_posto_risco.posto_id = hs_relatorio_posto.id and hs_relatorio_posto_risco.risco_id = hs_relatorio_risco.id) "; + sql += "inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id "; + sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; + sql += "where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + ") subquery "; + sql += "order by subquery.valor"; + System.out.println("VALORES BY RISCO : " + sql); + ResultSet rs = st.executeQuery(sql); + List valores = new ArrayList(); +// Integer valor = null; + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + Valor v = new Valor(); + Object oValor = rs.getObject("valor"); + + if(oValor == null) + { + v.setValor(null); + //r.setValor(null); +// valor = null; + } + else + { + v.setValor((Integer) oValor); + //r.setValor((Integer) oValor); +// valor = (Integer) oValor; + } +// System.out.println("RISCO : " + r.getId().toString() + "VALOR : " + oValor.toString()); + //int valor = rs.getInt("valor"); + //v.setValor(new Integer(valor)); + //v.setMedidas(getMedidasByValor(v, r, a)); + valores.add(v); + }while(rs.next()); + } + return valores; + //return valor; + } + +// private List getMedidasByValor(Valor v, Risco r, Area a) throws Exception +// { +// Statement st = dblocal.createStatement(); +// String sql = "select distinct medida_id, valor, descricao from "; +// sql += "( select distinct hs_relatorio_posto_medida.medida_id, hs_relatorio_posto_risco.risco_id, hs_relatorio_medida.description as descricao, "; +// sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null "; +// sql += "when hs_relatorio_posto_risco.valor_qualitativo_id isnull then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade "; +// sql += "else hs_relatorio_posto_risco.valor_qualitativo_id "; +// sql += "end as valor "; +// sql += "from hs_relatorio_posto "; +// sql += "inner join hs_relatorio_posto_medida on hs_relatorio_posto_medida.posto_id = hs_relatorio_posto.id "; +// sql += "inner join hs_relatorio_medida on hs_relatorio_medida.id = hs_relatorio_posto_medida.medida_id "; +// sql += "inner join hs_relatorio_risco on hs_relatorio_risco.id = hs_relatorio_medida.risco_id "; +// sql += "inner join hs_relatorio_posto_risco on (hs_relatorio_posto_risco.posto_id = hs_relatorio_posto.id and hs_relatorio_posto_risco.risco_id = hs_relatorio_risco.id) "; +// sql += "inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id "; +// sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; +// sql += "where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + " and hs_relatorio_posto_medida.is_plano_actuacao = true" + ") subquery "; +// //sql += "where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + ") subquery "; +// //sql += "where valor = " + v.getValor() + " "; +// sql += "order by subquery.medida_id, valor"; +// System.out.println("MEDIDAS BY VALOR SQL : " + sql); +// ResultSet rs = st.executeQuery(sql); +// List medidas = new ArrayList(); +// if(rs.isBeforeFirst()) +// { +// rs.first(); +// do +// { +// Medida m = new Medida(); +// //int valor = rs.getInt("valor"); +// //m.setValor(new Integer(valor)); +// m.setId(new Integer( rs.getInt("medida_id") )); +// m.setDescricao(Utils.unicodeToHTML(rs.getString("descricao"))); +// m.setPostos(getPostosByMedidaAndValor(m, v, a)); +// medidas.add(m); +// }while(rs.next()); +// } +// return medidas; +// } + + private List getMedidasByRisco(Risco r, Area a) throws Exception + { + Statement st = createLocalStatement(); + String sql = "select distinct medida_id, valor, descricao from "; + sql += "( select distinct hs_relatorio_posto_medida.medida_id, hs_relatorio_posto_risco.risco_id, hs_relatorio_medida.description as descricao, "; + sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null "; + sql += "when hs_relatorio_posto_risco.valor_qualitativo_id isnull then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade "; + sql += "else hs_relatorio_posto_risco.valor_qualitativo_id "; + sql += "end as valor "; + sql += "from hs_relatorio_posto "; + sql += "inner join hs_relatorio_posto_medida on hs_relatorio_posto_medida.posto_id = hs_relatorio_posto.id "; + sql += "inner join hs_relatorio_medida on hs_relatorio_medida.id = hs_relatorio_posto_medida.medida_id "; + sql += "inner join hs_relatorio_risco on hs_relatorio_risco.id = hs_relatorio_medida.risco_id "; + sql += "inner join hs_relatorio_posto_risco on (hs_relatorio_posto_risco.posto_id = hs_relatorio_posto.id and hs_relatorio_posto_risco.risco_id = hs_relatorio_risco.id) "; + sql += "inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id "; + sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; + sql += "where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + " and hs_relatorio_posto_medida.is_plano_actuacao = true" + ") subquery "; + //sql += "where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + ") subquery "; + //sql += "where valor = " + v.getValor() + " "; + sql += "order by subquery.medida_id, valor"; + System.out.println("MEDIDAS BY RISCO SQL : " + sql); + ResultSet rs = st.executeQuery(sql); + List medidas = new ArrayList(); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + Medida m = new Medida(); + //int valor = rs.getInt("valor"); + //m.setValor(new Integer(valor)); + m.setId(new Integer( rs.getInt("medida_id") )); + m.setMedida_id(m.getId()); + m.setDescricao(Utils.unicodeToHTML(rs.getString("descricao"))); + //m.setPostos(getPostosByMedidaAndValor(m, v, a)); + m.setPostos(getPostosByMedida(r, m, a)); + medidas.add(m); + }while(rs.next()); + } + return medidas; + } + +// private List getPostosByMedidaAndValor(Medida m, Valor v, Area a) throws Exception +// { +// Statement st = dblocal.createStatement(); +// String sql = "select subquery.posto_id, valor, descricao from "; +// sql += "(select hs_relatorio_posto_medida.posto_id, hs_relatorio_posto.description as descricao, "; +// sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null "; +// sql += "when hs_relatorio_posto_risco.valor_qualitativo_id isnull then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade "; +// sql += "else hs_relatorio_posto_risco.valor_qualitativo_id "; +// sql += "end as valor "; +// sql += "from hs_relatorio_posto_medida "; +// sql += "inner join hs_relatorio_posto_risco on hs_relatorio_posto_risco.posto_id = hs_relatorio_posto_medida.posto_id "; +// sql += "inner join hs_relatorio_posto on hs_relatorio_posto.id = hs_relatorio_posto_medida.posto_id "; +// sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; +// sql += "where medida_id = " + m.getId() + " and area_id = " + a.getId() + ") subquery "; +// //sql += "where valor = " + v.getValor(); +// System.out.println("POSTOS BY MEDIDA SQL : " + sql); +// ResultSet rs = st.executeQuery(sql); +// List postos = new ArrayList(); +// if(rs.isBeforeFirst()) +// { +// rs.first(); +// do +// { +// PostoTrabalho p = new PostoTrabalho(); +// p.setId(new Integer( rs.getInt("posto_id") )); +// p.setDescricao(Utils.unicodeToHTML(rs.getString("descricao"))); +// postos.add(p); +// }while(rs.next()); +// } +// return postos; +// } + + private List getPostosByMedida(Risco r, Medida m, Area a) throws Exception + { + Statement st = createLocalStatement(); + String sql = "select subquery.posto_id, valor, descricao from "; + sql += "(select hs_relatorio_posto_medida.posto_id, hs_relatorio_posto.description as descricao, "; + sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null "; + sql += "when hs_relatorio_posto_risco.valor_qualitativo_id isnull then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade "; + sql += "else hs_relatorio_posto_risco.valor_qualitativo_id "; + sql += "end as valor "; + sql += "from hs_relatorio_posto_medida "; + sql += "inner join hs_relatorio_posto_risco on hs_relatorio_posto_risco.posto_id = hs_relatorio_posto_medida.posto_id "; + sql += "inner join hs_relatorio_posto on hs_relatorio_posto.id = hs_relatorio_posto_medida.posto_id "; + sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; + sql += "where medida_id = " + m.getId() + " and area_id = " + a.getId() + " and risco_id = " + r.getId() + ") subquery "; + //sql += "where valor = " + v.getValor(); + System.out.println("POSTOS BY MEDIDA SQL : " + sql); + ResultSet rs = st.executeQuery(sql); + List postos = new ArrayList(); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + PostoTrabalho p = new PostoTrabalho(); + p.setId(new Integer( rs.getInt("posto_id") )); + p.setPosto_id(p.getId()); + p.setDescricao(Utils.unicodeToHTML(rs.getString("descricao"))); + postos.add(p); + }while(rs.next()); + } + return postos; + } + + + + private boolean existemMedidasByArea(Integer area_id) throws Exception + { + Statement st = createLocalStatement(); + String sql = "select distinct medida_id, valor, descricao "; + sql += "from ( select distinct hs_relatorio_posto_medida.medida_id, hs_relatorio_posto_risco.risco_id, hs_relatorio_medida.description as descricao, "; + sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null "; + sql += "when hs_relatorio_posto_risco.valor_qualitativo_id isnull then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade else hs_relatorio_posto_risco.valor_qualitativo_id end as valor from hs_relatorio_posto "; + sql += "inner join hs_relatorio_posto_medida on hs_relatorio_posto_medida.posto_id = hs_relatorio_posto.id "; + sql += "inner join hs_relatorio_medida on hs_relatorio_medida.id = hs_relatorio_posto_medida.medida_id "; + sql += "inner join hs_relatorio_risco on hs_relatorio_risco.id = hs_relatorio_medida.risco_id "; + sql += "inner join hs_relatorio_posto_risco on (hs_relatorio_posto_risco.posto_id = hs_relatorio_posto.id and hs_relatorio_posto_risco.risco_id = hs_relatorio_risco.id) "; + sql += "inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id "; + sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; + sql += "where area_id = " + area_id + " and hs_relatorio_posto_medida.is_plano_actuacao = true) subquery order by subquery.medida_id, valor"; + System.out.println("EXISTEM MEDIDAS BY AREA SQL : " + sql); + ResultSet rs = st.executeQuery(sql); + if(rs.isBeforeFirst()) + { + return true; + } + else + { + return false; + } + } + + private boolean existemMedidasByRisco(Integer risco_id) throws Exception + { + Statement st = createLocalStatement(); + String sql = "select distinct medida_id "; + sql += "from ( select distinct hs_relatorio_posto_medida.medida_id, hs_relatorio_posto_risco.risco_id, hs_relatorio_medida.description as descricao, "; + sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null "; + sql += "when hs_relatorio_posto_risco.valor_qualitativo_id isnull then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade else hs_relatorio_posto_risco.valor_qualitativo_id end as valor from hs_relatorio_posto "; + sql += "inner join hs_relatorio_posto_medida on hs_relatorio_posto_medida.posto_id = hs_relatorio_posto.id "; + sql += "inner join hs_relatorio_medida on hs_relatorio_medida.id = hs_relatorio_posto_medida.medida_id "; + sql += "inner join hs_relatorio_risco on hs_relatorio_risco.id = hs_relatorio_medida.risco_id "; + sql += "inner join hs_relatorio_posto_risco on (hs_relatorio_posto_risco.posto_id = hs_relatorio_posto.id and hs_relatorio_posto_risco.risco_id = hs_relatorio_risco.id) "; + sql += "inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id "; + sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; + sql += "where hs_relatorio_posto_risco.risco_id = " + risco_id + " and hs_relatorio_posto_medida.is_plano_actuacao = true) subquery order by medida_id"; + System.out.println("EXISTEM MEDIDAS BY RISCO SQL : " + sql); + ResultSet rs = st.executeQuery(sql); + if(rs.isBeforeFirst()) + { + return true; + } + else + { + return false; + } + + } + + + public Integer createPlano(PlanoActuacao p) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxTableId("planos_actuacao"); + String sql = "insert into planos_actuacao (id, estabelecimento_id, fase, data_visita, data_relatorio, nome_estabelecimento, empresa_id, nome_empresa, data_controlo, tecnico_hs_id, tecnico_hs_nome, tecnico_superior_hs_id, tecnico_superior_hs_nome, concluido_por_desactivacao, data_desactivacao) values ("; + sql += newId + ", "; + sql += p.getEstabelecimento_id() + ", "; + sql += p.getFase() + ", '"; + java.sql.Date sqlDate = new java.sql.Date(p.getData_visita().getTime()); + sql += sqlDate + "', '"; + sqlDate = new java.sql.Date(p.getData_relatorio().getTime()); + sql += sqlDate + "', '"; + sql += p.getNome_estabelecimento() + "', "; + sql += p.getEmpresa_id() + ", '"; + sql += p.getNome_empresa() + "', '"; + Date today = new Date(); + sqlDate = new java.sql.Date(today.getTime()); + sql += sqlDate + "', "; + + //tecnico + sql += p.getTecnico_hs_id() + ", "; + if(p.getTecnico_hs_nome() == null) + { + sql += null; + } + else + { + sql += "'" + p.getTecnico_hs_nome() + "'"; + } + + //tecnico_superior + sql += ", "; + sql += p.getTecnico_superior_hs_id() + ", "; + sql += p.getTecnico_superior_hs_nome() == null ? null : "'" + p.getTecnico_superior_hs_nome() + "'"; + + //concluido_por_desactivacao + sql += ", "; + sql += p.getConcluidoPorDesactivacao() == null ? "false" : p.getConcluidoPorDesactivacao(); + + //data_desactivacao + sql += ", "; + + java.sql.Date deactiveDate = null; + if ( p.getDataDesactivacao() != null ) + { + deactiveDate = new java.sql.Date( p.getDataDesactivacao().getTime() ); + } + else if ( p.getConcluidoPorDesactivacao() != null && p.getConcluidoPorDesactivacao() ) + { + deactiveDate = new java.sql.Date( new Date().getTime() ); + } + sql += deactiveDate == null ? "null" : "'" + deactiveDate + "'"; + + sql += ")"; + + System.out.println("SQL CREATE PLANO : " + sql); + st.execute(sql); + + return newId; + } + + + public Integer createArea(Area a) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxTableId("plano_areas"); + String sql = "insert into plano_areas (id, area_id, plano_id, descricao) values ("; + sql += newId + ", "; + sql += a.getArea_id() + ", "; + sql += a.getPlano_id() + ", '"; + sql += a.getDescricao() + "' "; + sql += ")"; + + System.out.println("SQL CREATE AREA : " + sql); + st.execute(sql); + return newId; + } + + public Integer createRisco(Risco r) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxTableId("plano_riscos"); + String sql = "insert into plano_riscos (id, area_id, descricao, valor, risco_id) values ("; + sql += newId + ", "; + sql += r.getArea_id() + ", '"; + sql += r.getDescricao() + "', "; + sql += r.getValor() + ", "; + sql += r.getId(); + sql += ")"; + + System.out.println("SQL CREATE RISCO : " + sql); + st.execute(sql); + return newId; + } + + public Integer createValor(Valor v) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxTableId("plano_valores"); + String sql = "insert into plano_valores (id, risco_id, valor) values ("; + sql += newId + ", "; + sql += v.getRisco_id() + ", "; + sql += v.getValor() + ""; + sql += ")"; + + System.out.println("SQL CREATE VALOR : " + sql); + st.execute(sql); + return newId; + } + + public Integer createMedida(Medida m) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxTableId("plano_medidas"); + String sql = "insert into plano_medidas (id, medida_id, risco_id, descricao) values ("; + sql += newId + ", "; + sql += m.getMedida_id() + ", "; + sql += m.getRisco_id() + ", '"; + sql += m.getDescricao() + "' "; + sql += ")"; + + System.out.println("SQL CREATE MEDIDA : " + sql); + st.execute(sql); + return newId; + } + + public void createPostoTrabalho(PostoTrabalho p) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxTableId("plano_postos_trabalho"); + String sql = "insert into plano_postos_trabalho (id, posto_id, medida_id, descricao) values ("; + sql += newId + ", "; + sql += p.getPosto_id() + ", "; + sql += p.getMedida_id() + ", '"; + sql += p.getDescricao() + "' "; + sql += ")"; + + System.out.println("SQL CREATE POSTO : " + sql); + st.execute(sql); + } + + + + //==================== + + + + public String getEmpresaNome(Integer empresa_id) throws Exception + { + Statement st = createLocalStatement(); + String sql ="SELECT designacao_social FROM empresas WHERE id = " + empresa_id; + ResultSet rslocal = st.executeQuery(sql); + rslocal.first(); + String nome = Utils.unicodeToHTML(rslocal.getString("designacao_social")); + return nome; + } + + + protected Statement createStatement() + { + + return db.createStatement(); + } + + protected Statement createLocalStatement() + { + + return dblocal.createStatement(); + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/db/providers/GenericDataProvider.java b/branches/SIPRP/PlanosActuacao/src/java/db/providers/GenericDataProvider.java new file mode 100644 index 00000000..a1a1470c --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/db/providers/GenericDataProvider.java @@ -0,0 +1,63 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package db.providers; + +import com.evolute.utils.error.ErrorLogger; +import db.Db; +import java.sql.ResultSet; +import java.sql.Statement; + +/** + * + * @author lluis + */ +public class GenericDataProvider { + + public void checkConnection() + { + Db db = new Db(); + if(db.getConnection() == null) + { + try + { + db.connect(); + + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + } + } + + protected Integer getMaxTableId(String table) + { + Statement st = createStatement(); + String id = table + ".id"; + String sql = "SELECT max(" + id + ")+1 AS MAXID FROM " + table; + try + { + ResultSet rs = st.executeQuery(sql); + rs.first(); + Integer newId = new Integer(rs.getInt("MAXID")); + if(newId.intValue() == 0) + { + newId = new Integer(1); + } + return newId; + } + catch(Exception ex) + { + return new Integer(1); + } + } + + protected Statement createStatement() + { + Db db = new Db(); + return db.createStatement(); + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/db/providers/PlanosDataProvider.java b/branches/SIPRP/PlanosActuacao/src/java/db/providers/PlanosDataProvider.java new file mode 100644 index 00000000..e603e72f --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/db/providers/PlanosDataProvider.java @@ -0,0 +1,1260 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package db.providers; + +import com.evolute.utils.error.ErrorLogger; +import com.evolute.utils.strings.StringPlainer; +import db.entidades.Area; +import db.entidades.EstadoMedida; +import db.entidades.Medida; +import db.entidades.PlanoActuacao; +import db.entidades.PostoTrabalho; +import db.entidades.Risco; +import db.entidades.Utilizador; +import db.entidades.Valor; +import global.Global; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Vector; +import utils.Utils; + +/** + * + * @author lluis + */ +public class PlanosDataProvider extends GenericDataProvider{ + + // PLANOS + public Integer createPlano(PlanoActuacao p) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxTableId("planos_actuacao"); + String sql = "insert into planos_actuacao (id, estabelecimento_id, fase, data_visita, data_relatorio, nome_estabelecimento, empresa_id, nome_empresa, data_controlo, tecnico_hs_id, tecnico_hs_nome, concluido_por_desactivacao, data_desactivacao, tecnico_superior_hs_id, tecnico_superior_hs_nome) values ("; + sql += newId + ", "; + sql += p.getEstabelecimento_id() + ", "; + sql += p.getFase() + ", '"; + java.sql.Date sqlDate = new java.sql.Date(p.getData_visita().getTime()); + sql += sqlDate + "', '"; + sqlDate = new java.sql.Date(p.getData_relatorio().getTime()); + sql += sqlDate + "', '"; + sql += p.getNome_estabelecimento() + "', "; + sql += p.getEmpresa_id() + ", '"; + sql += p.getNome_empresa() + "', '"; + Date today = new Date(); + sqlDate = new java.sql.Date(today.getTime()); + sql += sqlDate + "', "; + sql += p.getTecnico_hs_id() + ", "; + if(p.getTecnico_hs_nome() == null) + { + sql += null + ", "; + } + else + { + sql += "'" + p.getTecnico_hs_nome() + "', "; + } + + //concluido_por_desactivacao + if ( p.getConcluidoPorDesactivacao() == null ) + { + sql += Boolean.FALSE; + sql += ", null"; + } + else + { + sql += p.getConcluidoPorDesactivacao(); + if ( p.getConcluidoPorDesactivacao() ) + { + if ( p.getDataDesactivacao() == null ) + { + sql += ", now()"; + } + else + { + sql += ", '" + new java.sql.Date( p.getDataDesactivacao().getTime() ) + "'"; + } + } + else + { + sql += ", null"; + } + } + + sql += ", "; + sql += p.getTecnico_superior_hs_id() + ", "; + sql += p.getTecnico_superior_hs_nome() == null ? null : "'" + p.getTecnico_superior_hs_nome() + "'"; + + sql += ")"; + + System.out.println("SQL CREATE PLANO : " + sql); + st.execute(sql); + + return newId; + } + + public void updatePlano(PlanoActuacao p) throws Exception + { + if ( p.getConcluidoPorDesactivacao() == null ) + { + p.setConcluidoPorDesactivacao( false ); + } + if(p.getObs_correcao() == null) + { + p.setObs_correcao(""); + } + if(p.getObservacoes_dl() == null) + { + p.setObservacoes_dl(""); + } + if(p.getObservacoes_dns() == null) + { + p.setObservacoes_dns(""); + } + if(p.getUser_dir_loja() != null) + { + if(p.getUser_dir_loja().intValue() == 0) + { + p.setUser_dir_loja(null); + } + } + if(p.getUser_dns() != null) + { + if(p.getUser_dns().intValue() == 0) + { + p.setUser_dns(null); + } + } + if(p.getUser_hs() != null) + { + if(p.getUser_hs().intValue() == 0) + { + p.setUser_hs(null); + } + } + + Statement st = createStatement(); + String sql = ""; + + //To Do sql string here : + sql = "UPDATE planos_actuacao SET fase = " + p.getFase() + ", "; + sql += "validacao_director_loja = " + p.getValidacao_director_loja() + ", "; + sql += "validacao_dns = " + p.getValidacao_dns() + ", "; + sql += "validacao_hs = " + p.getValidacao_hs() + ", "; + sql += "observacoes_dl = '" + p.getObservacoes_dl() + "', "; + sql += "observacoes_dns = '" + p.getObservacoes_dns() + "', "; + sql += "obs_correcao = '" + p.getObs_correcao() + "', "; + sql += "correcao = '" + p.getCorrecao() + "', "; + sql += "fase_antes_correcao = " + p.getFase_antes_correcao() + ", "; + sql += "concluido_por_desactivacao = " + ( p.getConcluidoPorDesactivacao() == null ? "false" : p.getConcluidoPorDesactivacao() ) + ", "; + sql += "data_desactivacao = " + ( p.getDataDesactivacao() == null ? null : "'" + new java.sql.Date( p.getDataDesactivacao().getTime() ) + "'" ) + ", "; + + if(p.getData_validacao_dir_loja() == null) + { + sql += "data_validacao_dir_loja = " + null + ", "; + } + else + { + java.sql.Date sqlDate = new java.sql.Date(p.getData_validacao_dir_loja().getTime()); + sql += "data_validacao_dir_loja = '" + sqlDate + "', "; + } + sql += "user_dir_loja = " + p.getUser_dir_loja() + ", "; + if(p.getData_validacao_dns() == null) + { + sql += "data_validacao_dns = " + null + ", "; + } + else + { + java.sql.Date sqlDate = new java.sql.Date(p.getData_validacao_dns().getTime()); + sql += "data_validacao_dns = '" + sqlDate + "', "; + } + sql += "user_dns = " + p.getUser_dns() + ", "; + if(p.getData_validacao_hs() == null) + { + sql += "data_validacao_hs = " + null + ", "; + } + else + { + java.sql.Date sqlDate = new java.sql.Date(p.getData_validacao_hs().getTime()); + sql += "data_validacao_hs = '" + sqlDate + "', "; + } + sql += "user_hs = " + p.getUser_hs() + ", "; + if(p.getData_controlo() == null) + { + sql += "data_controlo = " + null + ", "; + } + else + { + java.sql.Date sqlDate = new java.sql.Date(p.getData_controlo().getTime()); + sql += "data_controlo = '" + sqlDate + "', "; + } + if(p.getData_email_controlo() == null) + { + sql += "data_email_controlo = " + null + " "; + } + else + { + java.sql.Date sqlDate = new java.sql.Date(p.getData_email_controlo().getTime()); + sql += "data_email_controlo = '" + sqlDate + "' "; + } + + sql += "WHERE id = " + p.getId(); + System.out.println("SQL UPDATE PLANO : " + sql); + + ErrorLogger.log( "SAVE : PlanosDataProvider.updatePlano( p ) : " + sql ); + st.execute(sql); + } + + public void updateRisco(Risco r) throws Exception + { + if(r.getResponsavel_execucao() == null) + { + r.setResponsavel_execucao(""); + } + + if(r.getPor() == null) + { + r.setPor(""); + } + + if(r.getRecursos_necessarios() == null) + { + r.setRecursos_necessarios(""); + } + if(r.getParecer_dl() == null) + { + r.setParecer_dl(""); + } + if(r.getParecer_dns() == null) + { + r.setParecer_dns(""); + } + if(r.getVerificacao_siprp() == null) + { + r.setVerificacao_siprp(""); + } + Statement st = createStatement(); + String sql = ""; + + //To Do sql string here : + sql = "UPDATE plano_riscos SET responsavel_execucao = '" + r.getResponsavel_execucao() + "', "; + sql += "por = '" + r.getPor() + "', "; + sql += "recursos_necessarios = '" + r.getRecursos_necessarios() + "', "; + if(r.getData_inicio() == null) + { + sql += "data_inicio = " + null + ", "; + } + else + { + java.sql.Date sqlDate = new java.sql.Date(r.getData_inicio().getTime()); + sql += "data_inicio = '" + sqlDate + "', "; + } + if(r.getData_fim() == null) + { + sql += "data_fim = " + null + ", "; + } + else + { + java.sql.Date sqlDate = new java.sql.Date(r.getData_fim().getTime()); + sql += "data_fim = '" + sqlDate + "', "; + } + sql += "parecer_dns = '" + r.getParecer_dns() + "', "; + sql += "parecer_dl = '" + r.getParecer_dl() + "', "; + sql += "verificacao_siprp = '" + r.getVerificacao_siprp() + "' "; + sql += "WHERE id = " + r.getId(); + System.out.println("SQL UPDATE RISCO : " + sql); + + ErrorLogger.log( "SAVE : PlanosDataProvider.updateRisco( r ) : " + sql ); + st.execute(sql); + } + + public void updateMedidas( Risco risco ) throws Exception + { + Statement st = createStatement(); + + List< Medida > medidas = risco.getMedidas(); + for ( Medida m : medidas ) + { + Integer emID = null; + if ( m.getValidarMedidaId() != null && m.getValidarMedidaId().intValue() != 0 ) + { + emID = m.getValidarMedidaId(); + } + + String sql = "UPDATE plano_medidas SET estado_medidas_id = " + emID + + " WHERE id = " + m.getId() + " AND risco_id = " + risco.getId(); + System.out.println( "SQL UPDATE MEDIDAS : " + sql ); + + ErrorLogger.log( "SAVE : PlanosDataProvider.updateMedidas( r ) : " + sql ); + st.execute( sql ); + } + } + + public void updateValor(Valor v) throws Exception + { + if(v.getResponsavel_execucao() == null) + { + v.setResponsavel_execucao(""); + } + + if(v.getRecursos_necessarios() == null) + { + v.setRecursos_necessarios(""); + } + if(v.getParecer_dl() == null) + { + v.setParecer_dl(""); + } + if(v.getParecer_dns() == null) + { + v.setParecer_dns(""); + } + if(v.getVerificacao_siprp() == null) + { + v.setVerificacao_siprp(""); + } + + Statement st = createStatement(); + String sql = ""; + + //To Do sql string here : + sql = "UPDATE plano_valores SET responsavel_execucao = '" + v.getResponsavel_execucao() + "', "; + sql += "recursos_necessarios = '" + v.getRecursos_necessarios() + "', "; + if(v.getData_inicio() == null) + { + sql += "data_inicio = " + null + ", "; + } + else + { + java.sql.Date sqlDate = new java.sql.Date(v.getData_inicio().getTime()); + sql += "data_inicio = '" + sqlDate + "', "; + } + if(v.getData_fim() == null) + { + sql += "data_fim = " + null + ", "; + } + else + { + java.sql.Date sqlDate = new java.sql.Date(v.getData_fim().getTime()); + sql += "data_fim = '" + sqlDate + "', "; + } + sql += "parecer_dns = '" + v.getParecer_dns() + "', "; + sql += "parecer_dl = '" + v.getParecer_dl() + "', "; + sql += "verificacao_siprp = '" + v.getVerificacao_siprp() + "' "; + sql += "WHERE id = " + v.getId(); + System.out.println("SQL UPDATE VALOR : " + sql); + + ErrorLogger.log( "SAVE : PlanosDataProvider.updateValor( v ) : " + sql ); + st.execute(sql); + } + + public Integer createArea(Area a) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxTableId("plano_areas"); + String sql = "insert into plano_areas (id, area_id, plano_id, descricao) values ("; + sql += newId + ", "; + sql += a.getArea_id() + ", "; + sql += a.getPlano_id() + ", '"; + sql += a.getDescricao() + "' "; + sql += ")"; + + System.out.println("SQL CREATE AREA : " + sql); + st.execute(sql); + return newId; + } + + public Integer createRisco(Risco r) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxTableId("plano_riscos"); + String sql = "insert into plano_riscos (id, area_id, descricao, valor, risco_id) values ("; + sql += newId + ", "; + sql += r.getArea_id() + ", '"; + sql += r.getDescricao() + "', "; + sql += r.getValor() + ", "; + sql += r.getId(); + sql += ")"; + + System.out.println("SQL CREATE RISCO : " + sql); + st.execute(sql); + return newId; + } + + public Integer createValor(Valor v) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxTableId("plano_valores"); + String sql = "insert into plano_valores (id, risco_id, valor) values ("; + sql += newId + ", "; + sql += v.getRisco_id() + ", "; + sql += v.getValor() + ""; + sql += ")"; + + System.out.println("SQL CREATE VALOR : " + sql); + st.execute(sql); + return newId; + } + + public Integer createMedida(Medida m) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxTableId("plano_medidas"); + String sql = "insert into plano_medidas (id, medida_id, risco_id, descricao, estado_medidas_id) values ("; + sql += newId + ", "; + sql += m.getMedida_id() + ", "; + sql += m.getRisco_id() + ", '"; + sql += m.getDescricao() + "', "; + sql += m.getValidarMedidaId(); + sql += ")"; + + System.out.println("SQL CREATE MEDIDA : " + sql); + st.execute(sql); + return newId; + } + + public void createPostoTrabalho(PostoTrabalho p) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxTableId("plano_postos_trabalho"); + String sql = "insert into plano_postos_trabalho (id, posto_id, medida_id, descricao) values ("; + sql += newId + ", "; + sql += p.getPosto_id() + ", "; + sql += p.getMedida_id() + ", '"; + sql += p.getDescricao() + "' "; + sql += ")"; + + System.out.println("SQL CREATE POSTO : " + sql); + st.execute(sql); + } + +// public List getPlanosOnline() throws Exception +// { +// GregorianCalendar xmas = new GregorianCalendar(1990, 11, 25); +// Date dummyDate = xmas.getTime(); +// ArrayList list = new ArrayList(); +// list.add(dummyDate); +// Statement st = createStatement(); +// String sql = "select data_visita from planos_actuacao"; +// ResultSet rs = st.executeQuery(sql); +// +// if(rs.isBeforeFirst()) +// { +// rs.first(); +// do +// { +// java.sql.Date sqlDate = rs.getDate("data_visita"); +// java.util.Date data_visita = new java.util.Date(sqlDate.getTime()); +// System.out.println("DATA PLANO : " + data_visita.toString()); +// list.add(data_visita); +// }while(rs.next()); +// } +// return list; +// } + + + public String getExpression( String nome, String estabelecimento, String dataVisita ) + { + String tables = "planos_actuacao"; + String whereExpression = "planos_actuacao.deleted_date IS NULL "; + + if ( nome != null ) + { + nome = StringPlainer.convertString( nome.trim() ); + nome = nome.replaceAll( " ", "%" ); + whereExpression += "AND ( plain_utf8( planos_actuacao.tecnico_hs_nome ) LIKE '%" + nome + "%' OR plain_utf8( planos_actuacao.tecnico_superior_hs_nome ) LIKE '%" + nome + "%' ) "; + } + if ( estabelecimento != null ) + { + estabelecimento = StringPlainer.convertString( estabelecimento.trim() ); + estabelecimento = estabelecimento.replaceAll( " ", "%" ); + whereExpression += "AND plain_utf8( planos_actuacao.nome_estabelecimento ) LIKE '%" + estabelecimento + "%' "; + } + if ( dataVisita != null ) + { + whereExpression += "AND planos_actuacao.data_visita = '" + dataVisita + "' "; + } + + return "SELECT * FROM " + tables + " WHERE " + whereExpression; + } + + + + private String getFaseActivos( Utilizador u ) + { + String sql = ""; + int userType = u.getTipo().intValue(); + switch ( userType ) + { + case Global.TECNICO_HS: + sql += "(fase = 1 OR fase = 5)"; + break; + + case Global.RESPONSAVEL_SEGURANCA: + sql += "fase = 2"; + break; + + case Global.DIRECTOR_LOJA: + sql += "fase = 3"; + break; + + case Global.DIRECTOR_NACIONAL_SEGURANCA: + sql += "fase = 4"; + break; + } + if ( userType != Global.DIRECTOR_SIPRP && userType != Global.TECNICO_HS && userType != Global.DIRECTOR_NACIONAL_SEGURANCA ) + { + sql += " AND estabelecimento_id = " + u.getEstabelecimento_id(); + } + + return sql; + } + + + public List< PlanoActuacao > searchPlanosActivos( Utilizador u, String nome, String estabelecimento, String dataVisita ) + throws Exception + { + Statement st = createStatement(); + String sql = getExpression( nome, estabelecimento, dataVisita ); + sql += " AND " + getFaseActivos( u ); + + System.out.println( "SEARCH ACTIVOS" ); + System.out.println( "SQL: " + sql ); + + ResultSet rs = st.executeQuery(sql); + List< PlanoActuacao > list = getFullPlanos( rs ); + return list; + } + +// public ArrayList getPlanosActivos(Utilizador u) throws Exception +// { +// Statement st = createStatement(); +// int userType = u.getTipo().intValue(); +// Statement st = createStatement(); +// String sql = "select * from planos_actuacao WHERE "; +// +// switch(userType) +// { +// case Global.TECNICO_HS: +// sql += "fase = 1 OR fase = 5"; +// break; +// +// case Global.RESPONSAVEL_SEGURANCA: +// sql += "fase = 2"; +// break; +// +// case Global.DIRECTOR_LOJA: +// sql += "fase = 3"; +// break; +// +// case Global.DIRECTOR_NACIONAL_SEGURANCA: +// sql += "fase = 4"; +// break; +// } +// if ( userType != Global.DIRECTOR_SIPRP && userType != Global.TECNICO_HS && userType != Global.DIRECTOR_NACIONAL_SEGURANCA ) +// { +// sql += " AND estabelecimento_id = " + u.getEstabelecimento_id(); +// } +// sql += " AND deleted_date IS NULL"; +// +// ResultSet rs = st.executeQuery(sql); +// ArrayList list = getFullPlanos(rs); +// +// return list; +// } + + + + private String getFaseSeguimento( Utilizador u ) + { + int userType = u.getTipo(); + String sql = ""; + switch( userType ) + { + case Global.TECNICO_HS: + sql = "(fase <> 1 AND fase <> 5 AND fase <> 6)"; + break; + case Global.RESPONSAVEL_SEGURANCA: + sql = "(fase <> 2 AND fase <> 6)"; + break; + case Global.DIRECTOR_LOJA: + sql = "(fase <> 3 AND fase <> 6)"; + break; + case Global.DIRECTOR_NACIONAL_SEGURANCA: + sql = "(fase <> 4 AND fase <> 6)"; + break; + case Global.DIRECTOR_SIPRP: + case Global.RH: + case Global.DIRECTOR_GERAL_RH: + case Global.GESTOR: + sql = "(fase > 1 AND fase < 6)"; + break; + default: + break; + } + + if ( userType != Global.DIRECTOR_SIPRP && userType != Global.TECNICO_HS + && userType != Global.DIRECTOR_NACIONAL_SEGURANCA && userType != Global.DIRECTOR_GERAL_RH + && userType != Global.GESTOR ) + { + sql += " AND estabelecimento_id = " + u.getEstabelecimento_id(); + } + if ( userType == Global.GESTOR ) + { + if ( u.getEstabelecimento_gestor().intValue() > 0 ) + { + sql += " AND estabelecimento_id = " + u.getEstabelecimento_gestor(); + } + } + return sql; + } + + public List< PlanoActuacao > searchPlanosSeguimento( Utilizador u, String nome, String estabelecimento, String dataVisita ) + throws Exception + { + Statement st = createStatement(); + + String sql = getExpression( nome, estabelecimento, dataVisita ); + sql += " AND " + getFaseSeguimento( u ); + + System.out.println( "SEARCH SEGUIMENTO" ); + System.out.println( "SQL: " + sql ); + + ResultSet rs = st.executeQuery(sql); + ArrayList list = getFullPlanos(rs); + return list; + } + +// public ArrayList getPlanosSeguimento(Utilizador u) throws Exception +// { +// Statement st = createStatement(); +// +// String sql = "select * from planos_actuacao "; +// switch(userType) +// { +// case Global.TECNICO_HS: +// sql += "WHERE fase <> 1 AND fase <> 5 AND fase <> 6"; +// break; +// +// case Global.RESPONSAVEL_SEGURANCA: +// sql += "WHERE fase <> 2 AND fase <> 6"; +// break; +// +// case Global.DIRECTOR_LOJA: +// sql += "WHERE fase <> 3 AND fase <> 6"; +// break; +// +// case Global.DIRECTOR_NACIONAL_SEGURANCA: +// sql += "WHERE fase <> 4 AND fase <> 6"; +// break; +// +// case Global.DIRECTOR_SIPRP: +// sql += "WHERE fase > 1 AND fase < 6"; +// break; +// +// case Global.RH: +// sql += "WHERE fase > 1 AND fase < 6"; +// break; +// +// case Global.DIRECTOR_GERAL_RH: +// sql += "WHERE fase > 1 AND fase < 6"; +// break; +// +// case Global.GESTOR: +// sql += "WHERE fase > 1 AND fase < 6"; +// break; +// } +// if(userType != Global.DIRECTOR_SIPRP && userType != Global.TECNICO_HS && userType != Global.DIRECTOR_NACIONAL_SEGURANCA && userType != Global.DIRECTOR_GERAL_RH && userType != Global.GESTOR) +// { +// sql += " and estabelecimento_id = " + u.getEstabelecimento_id(); +// } +// +// //System.out.println("USER ESTABELECIMENTO GESTOR : " + u.getEstabelecimento_gestor().intValue()); +// if(userType == Global.GESTOR) +// { +// if(u.getEstabelecimento_gestor().intValue() > 0) +// { +// sql += " and estabelecimento_id = " + u.getEstabelecimento_gestor(); +// } +// } +// sql += " and deleted_date is null"; +// +// System.out.println("PLANOS SEGUIMENTO SQL : " + sql); +// ResultSet rs = st.executeQuery(sql); +// ArrayList list = getFullPlanos(rs); +// return list; +// } + + + private String getFaseConcluidos( Utilizador u ) + { + int userType = u.getTipo().intValue(); + String sql = "fase = 6"; + + if ( userType != Global.DIRECTOR_SIPRP && userType != Global.TECNICO_HS + && userType != Global.DIRECTOR_NACIONAL_SEGURANCA && userType != Global.DIRECTOR_GERAL_RH ) + { + sql += " AND estabelecimento_id = " + u.getEstabelecimento_id(); + } + + return sql; + } + + public List< PlanoActuacao > searchPlanosConcluidos( Utilizador u, String nome, String estabelecimento, String dataVisita ) + throws Exception + { + String sql = getExpression( nome, estabelecimento, dataVisita ); + sql += " AND " + getFaseConcluidos( u ); + + System.out.println( "SEARCH CONCLUIDOS" ); + System.out.println( "SQL: " + sql ); + + Statement st = createStatement(); + ResultSet rs = st.executeQuery( sql ); + ArrayList< PlanoActuacao > list = getFullPlanos( rs ); + return list; + } + +// public ArrayList getPlanosConcluidos(Utilizador u) throws Exception +// { +// int userType = u.getTipo().intValue(); +// Statement st = createStatement(); +// String sql = "select * from planos_actuacao where fase = 6"; +// if(userType != Global.DIRECTOR_SIPRP && userType != Global.TECNICO_HS && userType != Global.DIRECTOR_NACIONAL_SEGURANCA && userType != Global.DIRECTOR_GERAL_RH) +// { +// sql += " and estabelecimento_id = " + u.getEstabelecimento_id(); +// } +// sql += " and deleted_date is null"; +// System.out.println("PLANOS CONCLUIDOS SQL : " + sql); +// ResultSet rs = st.executeQuery(sql); +// ArrayList list = getFullPlanos(rs); +// return list; +// } + + private ArrayList getFullPlanos(ResultSet rs) throws Exception + { + ArrayList list = new ArrayList(); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + PlanoActuacao pa = new PlanoActuacao(); + pa.setId( new Integer( rs.getInt("id") ) ); + pa.setEstabelecimento_id(new Integer(rs.getInt("estabelecimento_id"))); + pa.setNome_estabelecimento(rs.getString("nome_estabelecimento")); + pa.setNome_empresa(rs.getString("nome_empresa")); + pa.setFase( new Integer( rs.getInt("fase") ) ); + java.sql.Date sqlDate = rs.getDate("data_visita"); + pa.setData_visita(new java.util.Date(sqlDate.getTime())); + pa.setValidacao_director_loja(new Boolean( rs.getBoolean("validacao_director_loja") )); + pa.setValidacao_dns(new Boolean( rs.getBoolean("validacao_dns") )); + pa.setValidacao_hs(new Boolean( rs.getBoolean("validacao_hs") )); + pa.setObservacoes_dl(rs.getString("observacoes_dl")); + pa.setObservacoes_dns(rs.getString("observacoes_dns")); + pa.setObs_correcao(rs.getString("obs_correcao")); + pa.setAreas(getAreasByPlano(pa)); + pa.setTotal_riscos(getTotalRiscosByPlano(pa.getId())); + pa.setCorrecao(rs.getString("correcao")); + pa.setFase_antes_correcao(new Integer(rs.getInt("fase_antes_correcao"))); + pa.setData_validacao_dir_loja(rs.getDate("data_validacao_dir_loja")); + pa.setUser_dir_loja(new Integer(rs.getInt("user_dir_loja"))); + pa.setData_validacao_dns(rs.getDate("data_validacao_dns")); + pa.setUser_dns(new Integer(rs.getInt("user_dns"))); + pa.setData_validacao_hs(rs.getDate("data_validacao_hs")); + pa.setUser_hs(new Integer(rs.getInt("user_hs"))); + pa.setTecnico_hs_id(new Integer(rs.getInt("tecnico_hs_id"))); + pa.setTecnico_hs_nome(rs.getString("tecnico_hs_nome")); + pa.setConcluidoPorDesactivacao( new Boolean( rs.getBoolean( "concluido_por_desactivacao" ) ) ); + pa.setDataDesactivacao( rs.getDate( "data_desactivacao" ) ); + pa.setTecnico_superior_hs_id( new Integer( rs.getInt( "tecnico_superior_hs_id" ) ) ); + pa.setTecnico_superior_hs_nome( rs.getString( "tecnico_superior_hs_nome" ) ); + + list.add(pa); + + }while(rs.next()); + } + return list; + } + + private List getAreasByPlano(PlanoActuacao p) throws Exception + { + Statement st = createStatement(); + String sql = "SELECT * FROM plano_areas WHERE plano_id = " + p.getId() + " ORDER BY descricao"; + ResultSet rs = st.executeQuery(sql); + + List areas = new ArrayList(); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + Area a = new Area(); + a.setId( new Integer(rs.getInt("id")) ); + a.setPlano_id(new Integer( rs.getInt("plano_id") )); + a.setDescricao(Utils.unicodeToHTML(rs.getString("descricao"))); + a.setRiscos(getRiscosByArea(a)); + areas.add(a); + }while(rs.next()); + } + + return areas; + } + + private List getRiscosByArea(Area a) throws Exception + { + List riscos = new ArrayList(); + Statement st = createStatement(); +// String sql = "SELECT * FROM plano_riscos WHERE area_id = " + a.getId() + " ORDER BY valor DESC"; + String sql = "SELECT plano_riscos.*, coalesce(valor,-1) as ordem_valor FROM plano_riscos " + + "WHERE area_id = " + a.getId() + " ORDER BY ordem_valor DESC, area_id, risco_id;"; + ResultSet rs = st.executeQuery(sql); + + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + Risco r = new Risco(); + r.setId( new Integer(rs.getInt("id")) ); + r.setArea_id(new Integer( rs.getInt("area_id") )); + r.setDescricao(Utils.unicodeToHTML(rs.getString("descricao"))); +//// r.setResponsavel_execucao(rs.getString("responsavel_execucao")); +// r.setRecursos_necessarios(rs.getString("recursos_necessarios")); +// java.sql.Date sqlDataInicio = rs.getDate("data_inicio"); +// if(sqlDataInicio != null) +// { +// r.setData_inicio(new java.util.Date(sqlDataInicio.getTime())); +// } +// +// java.sql.Date sqlDataFim = rs.getDate("data_fim"); +// if(sqlDataFim != null) +// { +// r.setData_fim(new java.util.Date(sqlDataFim.getTime())); +// } + + //r.setValores(getValoresByRisco(r)); + + + r.setResponsavel_execucao(rs.getString("responsavel_execucao")); + r.setPor(rs.getString("por")); + r.setRecursos_necessarios(rs.getString("recursos_necessarios")); + java.sql.Date sqlDataInicio = rs.getDate("data_inicio"); + if(sqlDataInicio != null) + { + r.setData_inicio(new java.util.Date(sqlDataInicio.getTime())); + } + + java.sql.Date sqlDataFim = rs.getDate("data_fim"); + if(sqlDataFim != null) + { + r.setData_fim(new java.util.Date(sqlDataFim.getTime())); + } + r.setParecer_dl(rs.getString("parecer_dl")); + r.setParecer_dns(rs.getString("parecer_dns")); + r.setVerificacao_siprp(rs.getString("verificacao_siprp")); + r.setMedidas(getMedidasByRisco(r)); + Object valorObject = rs.getObject("valor"); + r.setValor( valorObject == null ? null : (Integer) valorObject ); + riscos.add(r); + }while(rs.next()); + } + return riscos; + } + +// private List getValoresByRisco(Risco r) throws Exception +// { +// List valores = new ArrayList(); +// +// Statement st = createStatement(); +// String sql = "SELECT * FROM plano_valores WHERE risco_id = " + r.getId() + " ORDER BY id"; +// ResultSet rs = st.executeQuery(sql); +// +// if(rs.isBeforeFirst()) +// { +// rs.first(); +// do +// { +// Valor v = new Valor(); +// v.setId( new Integer(rs.getInt("id")) ); +// v.setRisco_id(new Integer( rs.getInt("risco_id") )); +// Object oValor = rs.getObject("valor"); +// if(oValor == null) +// { +// v.setValor(null); +// } +// else +// { +// v.setValor(new Integer(rs.getInt("valor"))); +// } +// v.setMedidas(getMedidasByValor(v)); +// +// v.setResponsavel_execucao(rs.getString("responsavel_execucao")); +// v.setRecursos_necessarios(rs.getString("recursos_necessarios")); +// java.sql.Date sqlDataInicio = rs.getDate("data_inicio"); +// if(sqlDataInicio != null) +// { +// v.setData_inicio(new java.util.Date(sqlDataInicio.getTime())); +// } +// +// java.sql.Date sqlDataFim = rs.getDate("data_fim"); +// if(sqlDataFim != null) +// { +// v.setData_fim(new java.util.Date(sqlDataFim.getTime())); +// } +// v.setParecer_dl(rs.getString("parecer_dl")); +// v.setParecer_dns(rs.getString("parecer_dns")); +// v.setVerificacao_siprp(rs.getString("verificacao_siprp")); +// valores.add(v); +// }while(rs.next()); +// } +// return valores; +// } + + private List getMedidasByRisco(Risco r) throws Exception + { + List medidas = new ArrayList(); + + Statement st = createStatement(); + String sql = "SELECT * FROM plano_medidas WHERE risco_id = " + r.getId() + " ORDER BY id"; + ResultSet rs = st.executeQuery(sql); + + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + Medida m = new Medida(); + m.setId( new Integer(rs.getInt("id")) ); + //m.setValor_id(new Integer( rs.getInt("valor_id") )); + m.setDescricao(Utils.unicodeToHTML(rs.getString("descricao"))); + m.setPostos(getPostosByMedida(m)); + m.setValidarMedidaId( rs.getInt( "estado_medidas_id" ) ); + medidas.add(m); + }while(rs.next()); + } + return medidas; + } + + private List getPostosByMedida(Medida m) throws Exception + { + List postos = new ArrayList(); + + Statement st = createStatement(); + String sql = "SELECT * FROM plano_postos_trabalho WHERE medida_id = " + m.getId() + " ORDER BY id"; + ResultSet rs = st.executeQuery(sql); + + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + PostoTrabalho p = new PostoTrabalho(); + p.setId( new Integer(rs.getInt("id")) ); + p.setMedida_id(new Integer( rs.getInt("medida_id") )); + p.setDescricao(Utils.unicodeToHTML(rs.getString("descricao"))); + postos.add(p); + }while(rs.next()); + } + return postos; + } + + public int getTotalRiscosByPlano(Integer plano_id) + { + Statement st = createStatement(); + String sql = "select count(plano_riscos.id) as total_riscos from plano_riscos "; + sql += "inner join plano_areas on plano_riscos.area_id = plano_areas.id "; + sql += "inner join planos_actuacao on plano_areas.plano_id = planos_actuacao.id "; + sql += "where planos_actuacao.id = " + plano_id; + sql += " and planos_actuacao.deleted_date is null"; + int total_riscos = 0; + + try + { + ResultSet rs = st.executeQuery(sql); + if(rs.isBeforeFirst()) + { + rs.first(); + + total_riscos = rs.getInt("total_riscos"); + } + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + + return total_riscos; + } + + // POSTOS TRABALHO + public void createPostoTrabalhoByRisco(Integer postoTrabalhoId, Integer riscoId, Integer planoId) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxTableId("postos_trabalho_risco"); + + String sql = "INSERT INTO postos_trabalho_risco (id, posto_trabalho_id, risco_id, plano_id) VALUES ("; + sql += newId + ", "; + sql += postoTrabalhoId + ", "; + sql += riscoId + ", "; + sql += planoId + ")"; + + System.out.println("SQL CREATE POSTO TRABALHO BY RISCO : " + sql); + st.execute(sql); + } + + public PostoTrabalho getPostoTrabalho(Integer postoTrabalhoId) throws Exception + { + PostoTrabalho pt = null; + Statement st = createStatement(); + String sql = "SELECT * FROM postos_trabalho WHERE id = " + postoTrabalhoId + " AND activo = 'y'"; + ResultSet rs = st.executeQuery(sql); + + if(rs.isBeforeFirst()) + { + rs.first(); + pt = new PostoTrabalho(); + pt.setId( new Integer( rs.getInt("id") ) ); + pt.setDescricao( rs.getString("descricao") ); + pt.setActivo( rs.getString("activo") ); + } + return pt; + } + +// public ArrayList getPostosTrabalhoByRisco(Integer planoId, Integer riscoId) throws Exception +// { +// ArrayList list = new ArrayList(); +// Statement st = createStatement(); +// String sql = "SELECT * FROM postos_trabalho_risco WHERE plano_id = " + planoId + " AND risco_id = " + riscoId; +// +// ResultSet rs = st.executeQuery(sql); +// +// if(rs.isBeforeFirst()) +// { +// rs.first(); +// do +// { +// Integer postoTrabalhoId = new Integer( rs.getInt("posto_trabalho_id") ); +// PostoTrabalho pt = getPostoTrabalho(postoTrabalhoId); +// pt.setRisco_id(riscoId); +// list.add(pt); +// }while(rs.next()); +// } +// +// return list; +// } + + // RISCOS + public void createRiscoByPlano(Integer riscoId, Integer planoId) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxTableId("riscos_plano_actuacao"); + + String sql = "INSERT INTO riscos_plano_actuacao (id, risco_id, plano_id) VALUES ("; + sql += newId + ", "; + sql += riscoId + ", "; + sql += planoId + ")"; + + System.out.println("SQL CREATE RISCO BY PLANO : " + sql); + st.execute(sql); + } + + public Risco getRisco(Integer riscoId) throws Exception + { + Risco r = null; + Statement st = createStatement(); + String sql = "SELECT * FROM riscos WHERE id = " + riscoId + " AND activo = 'y'"; + ResultSet rs = st.executeQuery(sql); + + if(rs.isBeforeFirst()) + { + rs.first(); + r = new Risco(); + r.setId( new Integer( rs.getInt("id") ) ); + r.setDescricao( rs.getString("descricao") ); + r.setResponsavel_execucao(rs.getString("responsavel_execucao")); + r.setPor(rs.getString("por")); + r.setRecursos_necessarios(rs.getString("recursos_necessarios")); + java.sql.Date sqlDataInicio = rs.getDate("data_inicio"); + if(sqlDataInicio != null) + { + r.setData_inicio(new java.util.Date(sqlDataInicio.getTime())); + } + + java.sql.Date sqlDataFim = rs.getDate("data_fim"); + if(sqlDataFim != null) + { + r.setData_fim(new java.util.Date(sqlDataFim.getTime())); + } + r.setParecer_dl(rs.getString("parecer_dl")); + r.setParecer_dns(rs.getString("parecer_dns")); + r.setVerificacao_siprp(rs.getString("verificacao_siprp")); + r.setActivo( rs.getString("activo") ); + r.setValor(new Integer(rs.getInt("valor"))); + } + return r; + } + +// public ArrayList getRiscosByPlano(Integer planoId) throws Exception +// { +// ArrayList list = new ArrayList(); +// Statement st = createStatement(); +// String sql = "SELECT * FROM riscos_plano_actuacao WHERE plano_id = " + planoId; +// +// ResultSet rs = st.executeQuery(sql); +// +// if(rs.isBeforeFirst()) +// { +// rs.first(); +// do +// { +// Integer riscoId = new Integer( rs.getInt("risco_id") ); +// Risco r = getRisco(riscoId); +// r.setPlano_id(planoId); +// list.add(r); +// }while(rs.next()); +// } +// +// return list; +// } + + // MEDIDAS + public void createMedidaByRisco(Integer medidaId, Integer riscoId, Integer planoId) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxTableId("medidas_plano_actuacao_risco"); + + String sql = "INSERT INTO postos_trabalho_risco (id, medida_id, risco_id, plano_id) VALUES ("; + sql += newId + ", "; + sql += medidaId + ", "; + sql += riscoId + ", "; + sql += planoId + ")"; + + System.out.println("SQL CREATE MEDIDA BY RISCO : " + sql); + st.execute(sql); + } + + + public List< EstadoMedida > getEstadoMedidas() throws Exception + { + Statement st = createStatement(); + String sql = "SELECT * FROM estado_medidas WHERE activo = 'y' ORDER BY ordem ASC"; + ResultSet rs = st.executeQuery( sql ); + + List< EstadoMedida > list = new Vector< EstadoMedida >(); + while( rs.next() ) + { + Integer ID = rs.getInt( "id" ); + String desc = Utils.unicodeToHTML( rs.getString( "descricao" ) ); + + EstadoMedida estado = new EstadoMedida(); + estado.setId( ID ); + estado.setDescricao( desc ); + list.add( estado ); + } + + return list; + } + + public Medida getMedida(Integer medidaId) throws Exception + { + Medida m= null; + Statement st = createStatement(); + String sql = "SELECT * FROM medidas_plano_actuacao WHERE id = " + medidaId + " AND activo = 'y'"; + ResultSet rs = st.executeQuery(sql); + + if(rs.isBeforeFirst()) + { + rs.first(); + m = new Medida(); + m.setId( new Integer( rs.getInt("id") ) ); + m.setDescricao( rs.getString("descricao") ); + m.setActiva( rs.getString("activo") ); + } + return m; + } + +// public List getPlanosDelayed() throws Exception +// { +// Date today = new Date(); +// java.sql.Date sqlToday = new java.sql.Date(today.getTime()); +// Statement st = createStatement(); +// String sql = "select dias_atraso, dias_email_atraso from "; +// sql += "(select id, EXTRACT(DAY FROM (now()- data_controlo)) as dias_atraso, EXTRACT(DAY FROM (now()- data_email_controlo)) as dias_email_atraso from planos_actuacao) subquery "; +// sql += "where dias_atraso > 14 and (dias_email_atraso > 3 or dias_email_atraso isnull) and (fase = 2 or fase = 3) "; +// ResultSet rs = st.executeQuery(sql); +// +// ArrayList list = new ArrayList(); +// if(rs.isBeforeFirst()) +// { +// rs.first(); +// do +// { +// PlanoActuacao pa = new PlanoActuacao(); +// pa.setId( new Integer( rs.getInt("id") ) ); +// pa.setEstabelecimento_id(new Integer(rs.getInt("estabelecimento_id"))); +// pa.setNome_estabelecimento(rs.getString("nome_estabelecimento")); +// pa.setFase( new Integer( rs.getInt("fase") ) ); +// java.sql.Date sqlDate = rs.getDate("data_visita"); +// pa.setData_visita(new java.util.Date(sqlDate.getTime())); +// pa.setValidacao_director_loja(new Boolean( rs.getBoolean("validacao_director_loja") )); +// pa.setValidacao_dns(new Boolean( rs.getBoolean("validacao_dns") )); +// pa.setValidacao_hs(new Boolean( rs.getBoolean("validacao_hs") )); +// pa.setObservacoes_dl(rs.getString("observacoes_dl")); +// pa.setObservacoes_dns(rs.getString("observacoes_dns")); +// pa.setObs_correcao(rs.getString("obs_correcao")); +//// pa.setAreas(getAreasByPlano(pa)); +//// pa.setTotal_riscos(getTotalRiscosByPlano(pa.getId())); +// pa.setCorrecao(rs.getString("correcao")); +// pa.setFase_antes_correcao(new Integer(rs.getInt("fase_antes_correcao"))); +// pa.setData_validacao_dir_loja(rs.getDate("data_validacao_dir_loja")); +// pa.setUser_dir_loja(new Integer(rs.getInt("user_dir_loja"))); +// pa.setData_validacao_dns(rs.getDate("data_validacao_dns")); +// pa.setUser_dns(new Integer(rs.getInt("user_dns"))); +// pa.setData_validacao_hs(rs.getDate("data_validacao_hs")); +// pa.setUser_hs(new Integer(rs.getInt("user_hs"))); +// pa.setVerificacao_siprp(rs.getString("verificacao_siprp")); +// pa.setData_controlo(rs.getDate("data_controlo")); +// pa.setData_email_controlo(rs.getDate("data_email_controlo")); +// list.add(pa); +// +// }while(rs.next()); +// } +// return list; +// } +// +// public void updateControlo(PlanoActuacao p) throws Exception +// { +// Statement st = createStatement(); +// String sql = ""; +// +// //To Do sql string here : +// if(p.getData_controlo() == null) +// { +// sql = "UPDATE planos_actuacao SET data_controlo = " + null + ", "; +// } +// else +// { +// java.sql.Date sqlDate = new java.sql.Date(p.getData_controlo().getTime()); +// sql = "UPDATE planos_actuacao SET data_controlo = '" + sqlDate + "', "; +// } +// +// if(p.getData_email_controlo() == null) +// { +// sql += "data_email_controlo = " + null + " "; +// } +// else +// { +// java.sql.Date sqlDate = new java.sql.Date(p.getData_email_controlo().getTime()); +// sql += "data_email_controlo = '" + sqlDate + "' "; +// } +// +// sql += "WHERE id = " + p.getId(); +// System.out.println("SQL UPDATE CONTROLO : " + sql); +// st.execute(sql); +// } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/db/providers/RelatoriosDataProvider.java b/branches/SIPRP/PlanosActuacao/src/java/db/providers/RelatoriosDataProvider.java new file mode 100644 index 00000000..0ef537b3 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/db/providers/RelatoriosDataProvider.java @@ -0,0 +1,427 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package db.providers; + +import com.evolute.utils.error.ErrorLogger; +import db.Dblocal; +import db.entidades.Area; +import db.entidades.Medida; +import db.entidades.PlanoActuacao; +import db.entidades.PostoTrabalho; +import db.entidades.Risco; +import db.entidades.Valor; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import utils.Utils; + +/** + * + * @author lluis + */ +public class RelatoriosDataProvider extends GenericDataProvider { + Dblocal dblocal = new Dblocal(); + + public RelatoriosDataProvider() throws Exception + { + dblocal.connect(); + } + + public PlanoActuacao getFullPlano(PlanoActuacao plano, Integer relatorioId) + { + try + { + plano = getAreasByPlano(plano, relatorioId); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + + return plano; + } + + private PlanoActuacao getAreasByPlano(PlanoActuacao plano, Integer relatorioId) throws Exception + { + Statement st = dblocal.createStatement(); + + String sql = "select distinct area_id, hs_relatorio_area.description as descricao from hs_relatorio_posto "; + sql += "inner join hs_relatorio_posto_medida on hs_relatorio_posto_medida.posto_id = hs_relatorio_posto.id "; + sql += "inner join hs_relatorio_medida on hs_relatorio_medida.id = hs_relatorio_posto_medida.medida_id "; + sql += "inner join hs_relatorio_risco on hs_relatorio_risco.id = hs_relatorio_medida.risco_id "; + sql += "inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id "; + sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; + sql += "where hs_relatorio.id = " + relatorioId + " "; + sql += "order by area_id "; + System.out.println("AREAS BY PLANO SQL : " + sql); + ResultSet rs = st.executeQuery(sql); + + List areas = new ArrayList(); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + Area a = new Area(); + a.setId(new Integer( rs.getInt("area_id") )); + a.setArea_id(a.getId()); + if(existemMedidasByArea(a.getId())) + { + a.setDescricao(Utils.unicodeToHTML(rs.getString("descricao"))); + try + { + a.setRiscos(getRiscosByArea(a)); + } + catch(Exception ex) + { + System.out.println("ERRO RISCOS BY AREA !!!!"); + ErrorLogger.logException( ex ); + a.setRiscos(null); + } + + areas.add(a); + } + + }while(rs.next()); + plano.setAreas(areas); + } + return plano; + } + + private List getRiscosByArea(Area a) throws Exception + { + Statement st = dblocal.createStatement(); + String sql = "select distinct hs_relatorio_risco.id, hs_relatorio_risco.description as descricao from hs_relatorio_posto "; + sql += "inner join hs_relatorio_posto_medida on hs_relatorio_posto_medida.posto_id = hs_relatorio_posto.id "; + sql += "inner join hs_relatorio_medida on hs_relatorio_medida.id = hs_relatorio_posto_medida.medida_id "; + sql += "inner join hs_relatorio_risco on hs_relatorio_risco.id = hs_relatorio_medida.risco_id "; + sql += "inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id "; + sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; + sql += "where area_id = " + a.getId() + " "; + sql += "order by hs_relatorio_risco.id "; + System.out.println("RISCOS BY AREA SQL : " + sql); + ResultSet rs = st.executeQuery(sql); + List riscos = new ArrayList(); + if(rs.isBeforeFirst()) + { + + rs.first(); + do + { + Risco r = new Risco(); + r.setId(new Integer( rs.getInt("id") )); + if(existemMedidasByRisco(r.getId())) + { + r.setDescricao(Utils.unicodeToHTML(rs.getString("descricao"))); + r.setValores(getValoresByRisco(r, a)); + //Integer valor = getValorByRisco(r, a); + //r.setValor(valor); + r.setRisco_id(new Integer( rs.getInt("id") )); + r.setMedidas(getMedidasByRisco( r, a)); + riscos.add(r); + } + + }while(rs.next()); + } + return riscos; + + } + + private List getValoresByRisco(Risco r, Area a) throws Exception + //private Integer getValorByRisco(Risco r, Area a) throws Exception + { + Statement st = dblocal.createStatement(); + String sql = "select valor from "; + sql += "(select distinct hs_relatorio_posto_risco.risco_id, "; + sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null "; + sql += "when hs_relatorio_posto_risco.valor_qualitativo_id isnull then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade "; + sql += "else hs_relatorio_posto_risco.valor_qualitativo_id "; + sql += "end as valor "; + sql += "from hs_relatorio_posto "; + sql += "inner join hs_relatorio_posto_medida on hs_relatorio_posto_medida.posto_id = hs_relatorio_posto.id "; + sql += "inner join hs_relatorio_medida on hs_relatorio_medida.id = hs_relatorio_posto_medida.medida_id "; + sql += "inner join hs_relatorio_risco on hs_relatorio_risco.id = hs_relatorio_medida.risco_id "; + sql += "inner join hs_relatorio_posto_risco on (hs_relatorio_posto_risco.posto_id = hs_relatorio_posto.id and hs_relatorio_posto_risco.risco_id = hs_relatorio_risco.id) "; + sql += "inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id "; + sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; + sql += "where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + ") subquery "; + sql += "order by subquery.valor"; + System.out.println("VALORES BY RISCO : " + sql); + ResultSet rs = st.executeQuery(sql); + List valores = new ArrayList(); + Integer valor = null; + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + Valor v = new Valor(); + Object oValor = rs.getObject("valor"); + + if(oValor == null) + { + v.setValor(null); + //r.setValor(null); + valor = null; + } + else + { + v.setValor((Integer) oValor); + //r.setValor((Integer) oValor); + valor = (Integer) oValor; + } +// System.out.println("RISCO : " + r.getId().toString() + "VALOR : " + oValor.toString()); + //int valor = rs.getInt("valor"); + //v.setValor(new Integer(valor)); + //v.setMedidas(getMedidasByValor(v, r, a)); + valores.add(v); + }while(rs.next()); + } + return valores; + //return valor; + } + +// private List getMedidasByValor(Valor v, Risco r, Area a) throws Exception +// { +// Statement st = dblocal.createStatement(); +// String sql = "select distinct medida_id, valor, descricao from "; +// sql += "( select distinct hs_relatorio_posto_medida.medida_id, hs_relatorio_posto_risco.risco_id, hs_relatorio_medida.description as descricao, "; +// sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null "; +// sql += "when hs_relatorio_posto_risco.valor_qualitativo_id isnull then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade "; +// sql += "else hs_relatorio_posto_risco.valor_qualitativo_id "; +// sql += "end as valor "; +// sql += "from hs_relatorio_posto "; +// sql += "inner join hs_relatorio_posto_medida on hs_relatorio_posto_medida.posto_id = hs_relatorio_posto.id "; +// sql += "inner join hs_relatorio_medida on hs_relatorio_medida.id = hs_relatorio_posto_medida.medida_id "; +// sql += "inner join hs_relatorio_risco on hs_relatorio_risco.id = hs_relatorio_medida.risco_id "; +// sql += "inner join hs_relatorio_posto_risco on (hs_relatorio_posto_risco.posto_id = hs_relatorio_posto.id and hs_relatorio_posto_risco.risco_id = hs_relatorio_risco.id) "; +// sql += "inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id "; +// sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; +// sql += "where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + " and hs_relatorio_posto_medida.is_plano_actuacao = true" + ") subquery "; +// //sql += "where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + ") subquery "; +// //sql += "where valor = " + v.getValor() + " "; +// sql += "order by subquery.medida_id, valor"; +// System.out.println("MEDIDAS BY VALOR SQL : " + sql); +// ResultSet rs = st.executeQuery(sql); +// List medidas = new ArrayList(); +// if(rs.isBeforeFirst()) +// { +// rs.first(); +// do +// { +// Medida m = new Medida(); +// //int valor = rs.getInt("valor"); +// //m.setValor(new Integer(valor)); +// m.setId(new Integer( rs.getInt("medida_id") )); +// m.setDescricao(Utils.unicodeToHTML(rs.getString("descricao"))); +// m.setPostos(getPostosByMedidaAndValor(m, v, a)); +// medidas.add(m); +// }while(rs.next()); +// } +// return medidas; +// } + + private List getMedidasByRisco(Risco r, Area a) throws Exception + { + Statement st = dblocal.createStatement(); + String sql = "select distinct medida_id, valor, descricao from "; + sql += "( select distinct hs_relatorio_posto_medida.medida_id, hs_relatorio_posto_risco.risco_id, hs_relatorio_medida.description as descricao, "; + sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null "; + sql += "when hs_relatorio_posto_risco.valor_qualitativo_id isnull then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade "; + sql += "else hs_relatorio_posto_risco.valor_qualitativo_id "; + sql += "end as valor "; + sql += "from hs_relatorio_posto "; + sql += "inner join hs_relatorio_posto_medida on hs_relatorio_posto_medida.posto_id = hs_relatorio_posto.id "; + sql += "inner join hs_relatorio_medida on hs_relatorio_medida.id = hs_relatorio_posto_medida.medida_id "; + sql += "inner join hs_relatorio_risco on hs_relatorio_risco.id = hs_relatorio_medida.risco_id "; + sql += "inner join hs_relatorio_posto_risco on (hs_relatorio_posto_risco.posto_id = hs_relatorio_posto.id and hs_relatorio_posto_risco.risco_id = hs_relatorio_risco.id) "; + sql += "inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id "; + sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; + sql += "where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + " and hs_relatorio_posto_medida.is_plano_actuacao = true" + ") subquery "; + //sql += "where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + ") subquery "; + //sql += "where valor = " + v.getValor() + " "; + sql += "order by subquery.medida_id, valor"; + System.out.println("MEDIDAS BY RISCO SQL : " + sql); + ResultSet rs = st.executeQuery(sql); + List medidas = new ArrayList(); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + Medida m = new Medida(); + //int valor = rs.getInt("valor"); + //m.setValor(new Integer(valor)); + m.setId(new Integer( rs.getInt("medida_id") )); + m.setMedida_id(m.getId()); + m.setDescricao(Utils.unicodeToHTML(rs.getString("descricao"))); + //m.setPostos(getPostosByMedidaAndValor(m, v, a)); + m.setPostos(getPostosByMedida(r, m, a)); + medidas.add(m); + }while(rs.next()); + } + return medidas; + } + +// private List getPostosByMedidaAndValor(Medida m, Valor v, Area a) throws Exception +// { +// Statement st = dblocal.createStatement(); +// String sql = "select subquery.posto_id, valor, descricao from "; +// sql += "(select hs_relatorio_posto_medida.posto_id, hs_relatorio_posto.description as descricao, "; +// sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null "; +// sql += "when hs_relatorio_posto_risco.valor_qualitativo_id isnull then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade "; +// sql += "else hs_relatorio_posto_risco.valor_qualitativo_id "; +// sql += "end as valor "; +// sql += "from hs_relatorio_posto_medida "; +// sql += "inner join hs_relatorio_posto_risco on hs_relatorio_posto_risco.posto_id = hs_relatorio_posto_medida.posto_id "; +// sql += "inner join hs_relatorio_posto on hs_relatorio_posto.id = hs_relatorio_posto_medida.posto_id "; +// sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; +// sql += "where medida_id = " + m.getId() + " and area_id = " + a.getId() + ") subquery "; +// //sql += "where valor = " + v.getValor(); +// System.out.println("POSTOS BY MEDIDA SQL : " + sql); +// ResultSet rs = st.executeQuery(sql); +// List postos = new ArrayList(); +// if(rs.isBeforeFirst()) +// { +// rs.first(); +// do +// { +// PostoTrabalho p = new PostoTrabalho(); +// p.setId(new Integer( rs.getInt("posto_id") )); +// p.setDescricao(Utils.unicodeToHTML(rs.getString("descricao"))); +// postos.add(p); +// }while(rs.next()); +// } +// return postos; +// } + + private List getPostosByMedida(Risco r, Medida m, Area a) throws Exception + { + Statement st = dblocal.createStatement(); + String sql = "select subquery.posto_id, valor, descricao from "; + sql += "(select hs_relatorio_posto_medida.posto_id, hs_relatorio_posto.description as descricao, "; + sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null "; + sql += "when hs_relatorio_posto_risco.valor_qualitativo_id isnull then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade "; + sql += "else hs_relatorio_posto_risco.valor_qualitativo_id "; + sql += "end as valor "; + sql += "from hs_relatorio_posto_medida "; + sql += "inner join hs_relatorio_posto_risco on hs_relatorio_posto_risco.posto_id = hs_relatorio_posto_medida.posto_id "; + sql += "inner join hs_relatorio_posto on hs_relatorio_posto.id = hs_relatorio_posto_medida.posto_id "; + sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; + sql += "where medida_id = " + m.getId() + " and area_id = " + a.getId() + " and risco_id = " + r.getId() + ") subquery "; + //sql += "where valor = " + v.getValor(); + System.out.println("POSTOS BY MEDIDA SQL : " + sql); + ResultSet rs = st.executeQuery(sql); + List postos = new ArrayList(); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + PostoTrabalho p = new PostoTrabalho(); + p.setId(new Integer( rs.getInt("posto_id") )); + p.setPosto_id(p.getId()); + p.setDescricao(Utils.unicodeToHTML(rs.getString("descricao"))); + postos.add(p); + }while(rs.next()); + } + return postos; + } + + + + private boolean existemMedidasByArea(Integer area_id) throws Exception + { + Statement st = dblocal.createStatement(); + String sql = "select distinct medida_id, valor, descricao "; + sql += "from ( select distinct hs_relatorio_posto_medida.medida_id, hs_relatorio_posto_risco.risco_id, hs_relatorio_medida.description as descricao, "; + sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null "; + sql += "when hs_relatorio_posto_risco.valor_qualitativo_id isnull then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade else hs_relatorio_posto_risco.valor_qualitativo_id end as valor from hs_relatorio_posto "; + sql += "inner join hs_relatorio_posto_medida on hs_relatorio_posto_medida.posto_id = hs_relatorio_posto.id "; + sql += "inner join hs_relatorio_medida on hs_relatorio_medida.id = hs_relatorio_posto_medida.medida_id "; + sql += "inner join hs_relatorio_risco on hs_relatorio_risco.id = hs_relatorio_medida.risco_id "; + sql += "inner join hs_relatorio_posto_risco on (hs_relatorio_posto_risco.posto_id = hs_relatorio_posto.id and hs_relatorio_posto_risco.risco_id = hs_relatorio_risco.id) "; + sql += "inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id "; + sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; + sql += "where area_id = " + area_id + " and hs_relatorio_posto_medida.is_plano_actuacao = true) subquery order by subquery.medida_id, valor"; + System.out.println("EXISTEM MEDIDAS BY AREA SQL : " + sql); + ResultSet rs = st.executeQuery(sql); + if(rs.isBeforeFirst()) + { + return true; + } + else + { + return false; + } + } + + private boolean existemMedidasByRisco(Integer risco_id) throws Exception + { + Statement st = dblocal.createStatement(); + String sql = "select distinct medida_id "; + sql += "from ( select distinct hs_relatorio_posto_medida.medida_id, hs_relatorio_posto_risco.risco_id, hs_relatorio_medida.description as descricao, "; + sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null "; + sql += "when hs_relatorio_posto_risco.valor_qualitativo_id isnull then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade else hs_relatorio_posto_risco.valor_qualitativo_id end as valor from hs_relatorio_posto "; + sql += "inner join hs_relatorio_posto_medida on hs_relatorio_posto_medida.posto_id = hs_relatorio_posto.id "; + sql += "inner join hs_relatorio_medida on hs_relatorio_medida.id = hs_relatorio_posto_medida.medida_id "; + sql += "inner join hs_relatorio_risco on hs_relatorio_risco.id = hs_relatorio_medida.risco_id "; + sql += "inner join hs_relatorio_posto_risco on (hs_relatorio_posto_risco.posto_id = hs_relatorio_posto.id and hs_relatorio_posto_risco.risco_id = hs_relatorio_risco.id) "; + sql += "inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id "; + sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; + sql += "where hs_relatorio_posto_risco.risco_id = " + risco_id + " and hs_relatorio_posto_medida.is_plano_actuacao = true) subquery order by medida_id"; + System.out.println("EXISTEM MEDIDAS BY RISCO SQL : " + sql); + ResultSet rs = st.executeQuery(sql); + if(rs.isBeforeFirst()) + { + return true; + } + else + { + return false; + } + + } + + + public String getEmpresaNome(Integer empresa_id) throws Exception + { + Statement st = dblocal.createStatement(); + String sql ="SELECT designacao_social FROM empresas WHERE id = " + empresa_id; + ResultSet rslocal = st.executeQuery(sql); + rslocal.first(); + String nome = Utils.unicodeToHTML(rslocal.getString("designacao_social")); + return nome; + } + + public byte[] getLogoByEmpresa(Integer empresaId) throws Exception + { + Statement st = dblocal.createStatement(); + String sql = "select empresa_logo_id from empresas where id = " + empresaId; + ResultSet rslocal = st.executeQuery(sql); + if(rslocal.isBeforeFirst()) + { + rslocal.first(); + Integer logoId = new Integer(rslocal.getInt("empresa_logo_id")); + byte[] logo = getLogo(logoId); + return logo; + } + + return null; + } + + public byte[] getLogo(Integer logoId) throws Exception + { + Statement st = dblocal.createStatement(); + String sql = "select image_data from image where id = " + logoId; + ResultSet rslocal = st.executeQuery(sql); + rslocal.first(); + byte[] logo = rslocal.getBytes("image_data"); + System.out.println("LOGO SIZE : " + logo.length); + return logo; + } +} \ No newline at end of file diff --git a/branches/SIPRP/PlanosActuacao/src/java/db/providers/UtilizadoresDataProvider.java b/branches/SIPRP/PlanosActuacao/src/java/db/providers/UtilizadoresDataProvider.java new file mode 100644 index 00000000..9acee601 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/db/providers/UtilizadoresDataProvider.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package db.providers; + +import db.entidades.Utilizador; +import global.Global; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.ArrayList; + +/** + * + * @author lluis + */ +public class UtilizadoresDataProvider extends GenericDataProvider{ + + public Utilizador getUtilizador(Integer id) throws Exception + { + Utilizador u = new Utilizador(); + Statement st = createStatement(); + String sql = "SELECT * FROM utilizadores WHERE id = " + id; + 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.setData_password(rs.getDate("data_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")); + u.setTipo(new Integer(rs.getInt("tipo"))); + u.setNumero_cedula(rs.getString("numero_cedula")); + u.setCap(rs.getString("cap")); + u.setNome(rs.getString("nome")); + u.setMedico_id(new Integer(rs.getInt("medico_id"))); + u.setFuncionario_hst_id(new Integer(rs.getInt("funcionario_hst_id"))); + u.setActivo(rs.getString("activo")); + u.setResponsavel_loja(rs.getString("responsavel_loja")); + u.setGestor_geral(rs.getString("gestor_geral")); + u.setApagado(rs.getString("apagado")); + return u; + } + + public ArrayList getUtilizadoresListByTipo(Integer tipo, String responsavel_loja, Integer estabelecimento_id) throws Exception + { + ArrayList list = new ArrayList(); + Statement st = createStatement(); + String sql = ""; + String estabelecimento_constraint = ""; + if(tipo.intValue() == Global.DIRECTOR_LOJA || tipo.intValue() == Global.RESPONSAVEL_SEGURANCA || tipo.intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA) + { + estabelecimento_constraint = " AND estabelecimento_id = " + estabelecimento_id; + } + if(tipo.intValue() == Global.RESPONSAVEL_SEGURANCA && responsavel_loja.matches("y")) + { + sql = "SELECT * FROM utilizadores WHERE activo = 'y' AND apagado = 'n' AND responsavel_loja = 'y' AND tipo = " + tipo + estabelecimento_constraint; + } + else if(tipo.intValue() == Global.DIRECTOR_LOJA || tipo.intValue() == Global.TECNICO_HS || tipo.intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA) + { + sql = "SELECT * FROM utilizadores WHERE activo = 'y' AND apagado = 'n' AND tipo = " + tipo + estabelecimento_constraint; + } + + System.out.println("UTILIZADORES LIST BY TIPO SQL : " + sql); + ResultSet rs = st.executeQuery(sql); + if(rs.isBeforeFirst()) + { + rs.first(); + do + { + Utilizador u = new Utilizador(); + u.setId(new Integer(rs.getInt("id"))); + u.setLogin(rs.getString("login")); + u.setPassword(rs.getString("password")); + u.setData_password(rs.getDate("data_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")); + u.setTipo(new Integer(rs.getInt("tipo"))); + u.setNumero_cedula(rs.getString("numero_cedula")); + u.setCap(rs.getString("cap")); + u.setNome(rs.getString("nome")); + u.setMedico_id(new Integer(rs.getInt("medico_id"))); + u.setFuncionario_hst_id(new Integer(rs.getInt("funcionario_hst_id"))); + u.setActivo(rs.getString("activo")); + u.setResponsavel_loja(rs.getString("responsavel_loja")); + list.add(u); + }while(rs.next()); + } + + return list; + } + + public ArrayList getUtilizadoresList() throws Exception + { + ArrayList list = new ArrayList(); + Statement st = createStatement(); + String sql = "select * from utilizadores where activo = 'y' and apagado = 'n'"; + + ResultSet rs = st.executeQuery(sql); + rs.first(); + do + { + Utilizador u = new Utilizador(); + u.setId(new Integer(rs.getInt("id"))); + u.setLogin(rs.getString("login")); + u.setPassword(rs.getString("password")); + u.setData_password(rs.getDate("data_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")); + u.setTipo(new Integer(rs.getInt("tipo"))); + u.setNumero_cedula(rs.getString("numero_cedula")); + u.setCap(rs.getString("cap")); + u.setNome(rs.getString("nome")); + u.setMedico_id(new Integer(rs.getInt("medico_id"))); + u.setFuncionario_hst_id(new Integer(rs.getInt("funcionario_hst_id"))); + u.setActivo(rs.getString("activo")); + u.setResponsavel_loja(rs.getString("responsavel_loja")); + list.add(u); + }while(rs.next()); + return list; + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/global/Global.java b/branches/SIPRP/PlanosActuacao/src/java/global/Global.java new file mode 100644 index 00000000..ba2ab1a7 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/global/Global.java @@ -0,0 +1,48 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package global; + +/** + * + * @author lluis + */ +public class Global { + + //tipos utilizadores + public static final int RESPONSAVEL_SEGURANCA = 1; + public static final int RH = 2; + public static final int TECNICO_HS = 3; + public static final int GESTOR = 6; + public static final int DIRECTOR_GERAL_RH = 7; + public static final int DIRECTOR_SIPRP = 8; + public static final int DIRECTOR_LOJA = 9; + public static final int DIRECTOR_NACIONAL_SEGURANCA = 10; + + //Fases do plano + public static final int FASE_SIPRP_EMISSAO = 1; + public static final int FASE_SEGURANCA_PREENCHIMENTO = 2; + public static final int FASE_DIR_LOJA_VALIDACAO = 3; + public static final int FASE_DNS_PARECER = 4; + public static final int FASE_SIPRP_CONCLUSAO = 5; + public static final int FASE_CONCLUIDO = 6; + + //Fases do plano - texto + public static final String FASE_SIPRP_EMISSAO_TXT = "SIPRP(Emissão)"; + public static final String FASE_SEGURANCA_PREENCHIMENTO_TXT = "Segurança Auchan(Preenchimento)"; + public static final String FASE_DIR_LOJA_VALIDACAO_TXT = "Director de loja(Validação)"; + public static final String FASE_DNS_PARECER_TXT = "DNS(Parecer)"; + public static final String FASE_SIPRP_CONCLUSAO_TXT = "SIPRP(Verificação/Conclusão)"; + + public static final String[] FASES_TEXTO = new String[]{"SIPRP(Emissão)", "Segurança Auchan(Preenchimento)", "Director de loja(Validação)", "DNS(Parecer)", "SIPRP(Verificação/Conclusão)", "Concluído"}; + + //public static final String ANALISE_ACIDENTES_URL = "http://localhost:8084/AnaliseAcidentesTrabalho/faces/"; //testes + //public static final String ANALISE_ACIDENTES_URL = "http://192.168.111.24:8084/AnaliseAcidentesTrabalho/faces/"; //testes portatil + public static final String ANALISE_ACIDENTES_URL = "https://www.siprp.pt/AnaliseAcidentesTrabalho/faces/"; //real + + + public static final String LOGOS_FOLDER = "/resources/images"; + public static final String PDF_FOLDER_URL = "/resources/pdf"; +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/mail/Mail.java b/branches/SIPRP/PlanosActuacao/src/java/mail/Mail.java new file mode 100644 index 00000000..c043ab9f --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/mail/Mail.java @@ -0,0 +1,94 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package mail; + +import javax.mail.*; +import javax.mail.Authenticator; +import java.util.Date; +import java.util.Properties; +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; + +/** + * + * @author lluis + */ +public class Mail { + + + private final static String SMTP_HOST = "mail2.evolute.pt"; + private final static int SMTP_PORT = 587; + + private final String mail_username = "acidentes.auchan@siprp.pt"; + private final String mail_password = "47Ju6Vb"; + + public final static String ENDERECO_ENVIO = "planos.auchan@siprp.pt"; + //public final static String ENDERECO_ENVIO = "lluis@evolute.pt"; //testes + + + public void send(String emailTo, String emailFrom, String assunto, String texto_email) throws Exception + { + Properties props = new Properties(); + //props.put("mail.transport.protocol", "smtp"); + props.put("mail.smtp.host", SMTP_HOST ); + props.put("mail.from", emailFrom ); + props.put("mail.smtp.auth", "true" ); + props.put("mail.smtp.user", mail_username ); + props.put("mail.smtp.password", mail_password ); +// props.put("mail.smtp.user", "lluis"); +// props.put("mail.smtp.password", "654321"); + + + Session session = Session.getInstance( props ); +// Authenticator auth = new SMTPAuthenticator(); +// Session session = Session.getDefaultInstance(props, auth); + + Message msg = new MimeMessage( session ); + msg.setFrom( new InternetAddress( emailFrom ) ); + InternetAddress[] address = {new InternetAddress( emailTo )}; + msg.setRecipients( Message.RecipientType.TO, address ); + ((MimeMessage)msg).setSubject(assunto, "UTF-8"); + msg.setSentDate(new Date()); + Multipart multipart = new MimeMultipart(); + BodyPart msgBodyPart = new MimeBodyPart(); + String html; + html=" "; + html+=""; + html+= texto_email; + html+=""; + msgBodyPart.setContent(html, "text/html"); + multipart.addBodyPart(msgBodyPart); + msg.setContent(multipart); + +// Transport.send(msg); + Transport t; + t = session.getTransport( "smtp" ); + + t.connect( SMTP_HOST, SMTP_PORT, mail_username, mail_password ); + t.sendMessage( msg, msg.getAllRecipients() ); + + t.close(); + System.out.println("Email Enviado !!!! "); + + } + +// private class SMTPAuthenticator extends Authenticator { +// public PasswordAuthentication getPasswordAuthentication() { +// String username = "lluis"; +// String password = "654321"; +// return new PasswordAuthentication(username, password); +// } +// +// } +} + diff --git a/branches/SIPRP/PlanosActuacao/src/java/mail/SendMail.java b/branches/SIPRP/PlanosActuacao/src/java/mail/SendMail.java new file mode 100644 index 00000000..b0999602 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/mail/SendMail.java @@ -0,0 +1,39 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package mail; + +import db.entidades.PlanoActuacao; +import db.entidades.Utilizador; +import global.Global; + +/** + * + * @author lluis + */ +public class SendMail extends Mail{ + + public static void sendMail(Utilizador u, PlanoActuacao p) + { + int fase = p.getFase().intValue(); + switch(fase) + { + case Global.FASE_SIPRP_EMISSAO: + break; + + case Global.FASE_SEGURANCA_PREENCHIMENTO: + break; + + case Global.FASE_DIR_LOJA_VALIDACAO: + break; + + case Global.FASE_DNS_PARECER: + break; + + case Global.FASE_SIPRP_CONCLUSAO: + break; + } + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/pagination/Pagina.java b/branches/SIPRP/PlanosActuacao/src/java/pagination/Pagina.java new file mode 100644 index 00000000..1992b31b --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/pagination/Pagina.java @@ -0,0 +1,89 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package pagination; + +import com.sun.webui.jsf.component.Hyperlink; +import javax.faces.context.FacesContext; + +/** + * + * @author lluis + */ +public class Pagina extends Hyperlink{ + private Integer risco_id; + private Integer valor; + private Integer page_nr; + private Boolean previous = false; + private Boolean next = false; + + public Pagina(){ + super(); + } + + public Object saveState(FacesContext context) + { + Object values[] = new Object[7]; + values[0] = super.saveState(context); + values[1] = getRisco_id(); + values[2] = getValor(); + values[3] = getPage_nr(); + values[4] = isPrevious(); + values[5] = isNext(); +// values[2] = getId(); + return ((Object) (values)); + } + + public void restoreState(FacesContext context, Object state) + { + Object values[] = (Object[])state; + super.restoreState(context, values[0]); + risco_id = (Integer)values[1]; + valor = (Integer)values[2]; + page_nr = (Integer)values[3]; + previous = (Boolean)values[4]; + next = (Boolean)values[5]; + } + + public Integer getRisco_id() { + return risco_id; + } + + public void setRisco_id(Integer risco_id) { + this.risco_id = risco_id; + } + + public Boolean isPrevious() { + return previous; + } + + public void setPrevious(Boolean previous) { + this.previous = previous; + } + + public Boolean isNext() { + return next; + } + + public void setNext(Boolean next) { + this.next = next; + } + + public Integer getPage_nr() { + return page_nr; + } + + public void setPage_nr(Integer page_nr) { + this.page_nr = page_nr; + } + + public Integer getValor() { + return valor; + } + + public void setValor(Integer valor) { + this.valor = valor; + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/pagination/Pagination.java b/branches/SIPRP/PlanosActuacao/src/java/pagination/Pagination.java new file mode 100644 index 00000000..f2d1d822 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/pagination/Pagination.java @@ -0,0 +1,137 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package pagination; + +import db.entidades.Area; +import db.entidades.PlanoActuacao; +import db.entidades.Risco; +import db.entidades.Valor; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Vector; + +/** + * + * @author lluis + */ +public class Pagination { + private int TOTAL_PAGINAS; + //private HashMap riscosHash = new HashMap(); + private Vector riscosVector = new Vector(); + private Vector valoresVector = new Vector(); + private int current_page = 1; + + public Pagination(PlanoActuacao p) + { + initialize(p); + } + + public Vector getPaginas() + { + Vector paginas = new Vector(); + Pagina pagina = null; + + if(current_page > 1) + { + pagina = new Pagina(); + pagina.setId("prev"); + pagina.setPrevious(new Boolean(true)); + pagina.setText("<<"); + paginas.add(pagina); + } + + int i = 0; + //Iterator iter = valoresVector.iterator(); + Iterator iter = riscosVector.iterator(); + while(iter.hasNext()) + { + //Valor v = iter.next(); + Risco r = iter.next(); + pagina = new Pagina(); + //pagina.setId("valor" + v.getId().toString()); + pagina.setId("valor" + r.getId().toString()); + //pagina.setRisco_id(r.getId()); + i++; + pagina.setPage_nr(i); + if(i == current_page) + { + pagina.setDisabled(true); + } + pagina.setText(i); + paginas.add(pagina); + } + + if(current_page < TOTAL_PAGINAS) + { + pagina = new Pagina(); + pagina.setId("next"); + pagina.setNext(new Boolean(true)); + pagina.setText(">>"); + paginas.add(pagina); + } + + return paginas; + } + + public Risco getValor(Pagina p) + { + if(p.isNext()) + { + current_page++; + } + else if(p.isPrevious()) + { + current_page--; + } + else + { + current_page = p.getPage_nr().intValue(); + } + + //return valoresVector.get(current_page-1); + return riscosVector.get(current_page-1); + } + + public Risco nextValor() + { + // + //Valor v = null; + Risco r = null; + + if( current_page < TOTAL_PAGINAS) + { + current_page++; + r = riscosVector.get(current_page-1); + //v = valoresVector.get(current_page-1); + } + + return r; + } + + public int totalPaginas() + { + return TOTAL_PAGINAS; + } + + private void initialize(PlanoActuacao p) + { + for(Area a : p.getAreas()) + { + for(Risco r : a.getRiscos()) + { + ////for(Valor v : r.getValores()) + ////{ + //r.setValor(v); to see later + riscosVector.add(r); + //valoresVector.add(v); + ////} + } + } + TOTAL_PAGINAS = riscosVector.size(); + //TOTAL_PAGINAS = valoresVector.size(); + } + +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/phaselistener/MainPhaseListener.java b/branches/SIPRP/PlanosActuacao/src/java/phaselistener/MainPhaseListener.java new file mode 100644 index 00000000..4d5ee390 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/phaselistener/MainPhaseListener.java @@ -0,0 +1,228 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package phaselistener; + +import com.evolute.utils.error.ErrorLogger; +import db.entidades.Utilizador; +import db.providers.UtilizadoresDataProvider; +import global.Global; +import javax.faces.application.NavigationHandler; +import javax.faces.component.UIViewRoot; +import javax.faces.context.FacesContext; +import javax.faces.event.PhaseEvent; +import javax.faces.event.PhaseId; +import javax.faces.event.PhaseListener; +import javax.servlet.http.HttpServletRequest; +import planosactuacao.SessionBean1; +import utils.JSFHTTPUtils; +import utils.JSFUtils; +import utils.Logos; +import utils.PlanosActuacaoLogger; + +/** + * + * @author lluis + */ +public class MainPhaseListener implements PhaseListener{ + + private static Boolean loggerIsLoaded = Boolean.FALSE; + + static + { + try + { + if ( ! loggerIsLoaded ) + { + System.out.println( "\nInitializing logger ..." ); + PlanosActuacaoLogger.init(); + loggerIsLoaded = Boolean.TRUE; + } + } + catch ( Throwable e ) + { + e.printStackTrace( System.err ); + } + } + + private boolean firstEntry = true; + + public void afterPhase(PhaseEvent pe) { + if(pe.getPhaseId() == PhaseId.RENDER_RESPONSE) + { + FacesContext fc = pe.getFacesContext(); +// SessionBean1 session = JSFUtils.getSessionBean(fc); + String view = fc.getViewRoot().getViewId(); +// if(view.matches("/EditarPlano.jsp")) +// { +// session.setDisableMenu(true); +// } +// else +// { +// session.setDisableMenu(false); +// } + System.out.println("RENDER RESPONSE VIEW : " + view); + } + } + + public void beforePhase(PhaseEvent pe) { + if(pe.getPhaseId() == PhaseId.RENDER_RESPONSE) + { + FacesContext fc = pe.getFacesContext(); + SessionBean1 session = JSFUtils.getSessionBean(fc); + String referer = JSFHTTPUtils.getReferer(pe.getFacesContext()); + System.out.println("REFERER >>" + referer + "<<"); + + //check if comes from AnalisesAcidentes. If so, set loggedIn to true: + if(referer != null) + { + if(referer.indexOf("AnaliseAcidentes") != -1) + { + session.setLoggedIn(true); + String user = JSFUtils.getRequestParameter(fc, "user"); + System.out.println("USER >" + user.toString() + "<"); + } + + } + + + //Determin Session Time out + + HttpServletRequest req = (HttpServletRequest) fc.getExternalContext().getRequest(); + UIViewRoot view = fc.getViewRoot(); + + System.out.println("SESSION VALID : " + req.isRequestedSessionIdValid()); + + //if(!req.isRequestedSessionIdValid() && view.getViewId().indexOf("Login") == -1 ){ + if(!req.isRequestedSessionIdValid() && referer.indexOf("AnaliseAcidentes") == -1 ){ + System.out.println("VIEW ID :" + view.getViewId()); + //NavigationHandler nh = fc.getApplication().getNavigationHandler(); + //nh.handleNavigation(fc, null, "login"); + try + { + //JSFUtils.logout(fc); + //JSFUtils.navigateTo(fc, "login"); + try + { + //JSFUtils.redirect(fc, "http://localhost:8084/AnaliseAcidentesTrabalho/faces/Login.jsp"); + JSFUtils.redirect(fc, Global.ANALISE_ACIDENTES_URL + "Login.jsp"); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + + } + + //Determin if user is logged in + //HttpSession session = (HttpSession) fc.getExternalContext().getSession(false); + + //SessionBean1 session = JSFUtils.getSessionBean(fc); + boolean loggedIn = session.isLoggedIn(); + System.out.println("LOGGED IN : " + loggedIn); + if(!loggedIn && view.getViewId().indexOf("Login") == -1 ){ + NavigationHandler nh = fc.getApplication().getNavigationHandler(); + nh.handleNavigation(fc, null, "login"); + } + + //disable/enable EditarPlano menu + String sview = fc.getViewRoot().getViewId(); + session.setRenderTopMenuImages(true); + session.setRenderSubHeader(false); + + + ////////////// + String user_id = JSFUtils.getRequestParameter(fc, "user"); + System.out.println("PHASE LISTENER - USER ID : " + user_id); + Utilizador u = null; + try + { + Integer userId = new Integer(Integer.parseInt(user_id)); + + try + { + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + udp.checkConnection(); + u = udp.getUtilizador(userId); + session.setCurrentUser(u); + } + catch(Exception ex1) + { + ErrorLogger.logException( ex1 ); + } + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + + ///////////// + u = session.getCurrentUser(); + + if(sview.matches("/EditarPlano.jsp") || sview.matches("/EnviarCorrecao.jsp") || sview.matches("/ViewPlano.jsp")) + { + session.setDisableMenu(false); + session.setDisableMenuPlanos(false); + if(sview.matches("/ViewPlano.jsp")) + { + + if(u.getTipo().intValue() == Global.DIRECTOR_SIPRP) + { + //session.setDisableMenu(false); + session.setDisableMenuUtilizadores(false); + } + else + { + session.setDisableMenuUtilizadores(true); + } + session.setDisableMenuDadosUtilizador(false); + session.setRenderTopMenuImages(false); + session.setRenderSubHeader(true); + } + else if(sview.matches("/EditarPlano.jsp")) + { + //session.setDisableMenuPlanos(true); + session.setDisableMenuPlanos(false); + session.setRenderTopMenuImages(false); + session.setRenderSubHeader(true); + } + + } + else + { + session.setDisableMenu(false); + if(sview.matches("/ListaPlanos.jsp")) + { + if(u.getTipo().intValue() == Global.RH || u.getTipo().intValue() == Global.GESTOR) + { + session.setDisableMenuUtilizadores(true); + } + session.setDisableMenuPlanos(true); + } + } + + //insert logos + + Integer empresaId = u.getEmpresa_id(); + System.out.println("LOGO EMPRESA ID B : " + empresaId.toString()); + Logos logos = new Logos(); + String logourl = logos.getLogo(fc, empresaId); + session.setLogoEmpresaUrl(logourl); + System.out.println("LOGO URL : " + logourl); + System.out.println("VIEW : " + view); + } + } + + public PhaseId getPhaseId() { + return PhaseId.ANY_PHASE; + } + +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/ApplicationBean1.java b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/ApplicationBean1.java new file mode 100644 index 00000000..c1b27cb7 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/ApplicationBean1.java @@ -0,0 +1,151 @@ +/* + * ApplicationBean1.java + * + * Created on Aug 25, 2008, 11:20:16 AM + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import com.sun.rave.web.ui.appbase.AbstractApplicationBean; +import java.sql.Connection; +import javax.faces.FacesException; + +/** + *

Application 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.

+ * + * @author lluis + */ +public class ApplicationBean1 extends AbstractApplicationBean { + // + + /** + *

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 boolean timerStarted = false; + private Connection localConnection = null; + private Connection connection = null; + + /** + *

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.

+ */ + @Override + 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) { + ErrorLogger.logException( 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.

+ */ + @Override + 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.

+ */ + @Override + public String getLocaleCharacterEncoding() { + return super.getLocaleCharacterEncoding(); + } + + /** + * @return the timerStarted + */ + public boolean isTimerStarted() { + return timerStarted; + } + + /** + * @param timerStarted the timerStarted to set + */ + public void setTimerStarted(boolean timerStarted) { + this.timerStarted = timerStarted; + } + + /** + * @return the connection + */ + public Connection getConnection() { + return connection; + } + + /** + * @param connection the connection to set + */ + public void setConnection(Connection connection) { + this.connection = connection; + } + + public Connection getLocalConnection() { + return localConnection; + } + + /** + * @param connection the connection to set + */ + public void setLocalConnection(Connection connection) { + this.localConnection = connection; + } + +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Bundle.properties b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Bundle.properties new file mode 100644 index 00000000..57ed665a --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Bundle.properties @@ -0,0 +1,3 @@ +# To change this template, choose Tools | Templates +# and open the template in the editor. + diff --git a/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Dummy.java b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Dummy.java new file mode 100644 index 00000000..1c4aa85e --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Dummy.java @@ -0,0 +1,251 @@ +/* + * Dummy.java + * + * Created on Oct 6, 2008, 10:43:13 AM + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import com.sun.rave.web.ui.appbase.AbstractPageBean; + +import com.sun.webui.jsf.component.Hyperlink; +import db.entidades.Utilizador; +import db.providers.UtilizadoresDataProvider; +import java.sql.Connection; +import java.util.ArrayList; +import java.util.ListIterator; +import javax.faces.FacesException; +import javax.faces.event.ActionEvent; + +/** + *

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.

+ * + * @author lluis + */ +public class Dummy extends AbstractPageBean { + // + + /** + *

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 Hyperlink hyperlink1 = new Hyperlink(); + + public Hyperlink getHyperlink1() { + return hyperlink1; + } + + public void setHyperlink1(Hyperlink h) { + this.hyperlink1 = h; + } + private Hyperlink link = new Hyperlink(); + + public Hyperlink getLink() { + return link; + } + + public void setLink(Hyperlink h) { + this.link = h; + } + + //
+ + /** + *

Construct a new Page bean instance.

+ */ + public Dummy() { + 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.

+ */ + @Override + 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) { + ErrorLogger.logException( 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.

+ */ + @Override + 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.

+ */ + @Override + public void prerender() { + + //Verbatim verbatim = new Verbatim(); + //printUsers(); + + } + + /** + *

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).

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

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1) getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1) getBean("SessionBean1"); + } + + public String lnkAnaliseAcidentes_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + return null; + } + + public void lnk_actionListener(ActionEvent e) { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + System.out.print("DUMMY LINK"); + } + + + private void printUsers() + { + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + + try + { + ArrayList list = udp.getUtilizadoresList(); + ListIterator iter = list.listIterator(); + System.out.println("=================================================================================="); + System.out.println("LOGIN\tEMAIL\tTIPO\tESTABELECIMENTO\tRESP. LOJA\tACTIVO\tAPAGADO"); + while(iter.hasNext()) + { + Utilizador u = (Utilizador) iter.next(); + System.out.print(u.getLogin() + "\t"); + System.out.print(u.getEmail() + "\t"); + System.out.print(u.getTipo() + "\t"); + System.out.print(u.getEstabelecimento_id() + "\t"); + System.out.print(u.getResponsavel_loja() + "\t"); + System.out.print(u.getActivo() + "\t"); + System.out.print(u.getApagado() + "\t\n"); + } + System.out.println(""); + System.out.println("=================================================================================="); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + } + + 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 . . . + ErrorLogger.logException( e ); + } + ErrorLogger.logException( ex ); + } + } + + public String butImage_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + +// FacesContext fc = getFacesContext(); +// Logos logos = new Logos(); +// String logourl = logos.getLogo(fc); +// if(logourl != null) +// { +// image1.setUrl(logourl); +// } + + return null; + } + +} + diff --git a/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/EditarPlano.java b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/EditarPlano.java new file mode 100644 index 00000000..7caf2192 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/EditarPlano.java @@ -0,0 +1,2596 @@ +/* + * PlanoActuacao.java + * + * Created on Aug 26, 2008, 3:10:59 PM + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import com.sun.rave.web.ui.appbase.AbstractPageBean; + +import com.sun.webui.jsf.component.Button; +import com.sun.webui.jsf.component.Calendar; +import com.sun.webui.jsf.component.Checkbox; +import com.sun.webui.jsf.component.DropDown; +import com.sun.webui.jsf.component.PanelGroup; +import com.sun.webui.jsf.component.StaticText; +import com.sun.webui.jsf.component.TextArea; +import com.sun.webui.jsf.component.TextField; + +import com.sun.webui.jsf.model.Option; +import db.entidades.Area; +import db.entidades.EstadoMedida; +import db.entidades.Medida; +import db.entidades.PlanoActuacao; +import db.entidades.PostoTrabalho; +import db.entidades.Risco; +import db.entidades.Utilizador; +import db.entidades.Valor; +import db.providers.PlanosDataProvider; +import db.providers.UtilizadoresDataProvider; +import global.Global; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import java.util.Vector; +import javax.el.MethodExpression; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlInputHidden; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.context.FacesContext; +import javax.faces.event.ActionEvent; +import javax.faces.event.MethodExpressionActionListener; +import javax.faces.event.ValueChangeEvent; +import mail.Mail; +import pagination.Pagina; +import pagination.Pagination; +import utils.JSFUtils; +import utils.Utils; + +/** + *

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.

+ * + * @author lluis + */ +public class EditarPlano extends AbstractPageBean { + // + + /** + *

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 { + } + + //
+ PlanosDataProvider pdp = new PlanosDataProvider(); + HtmlPanelGrid grid; + PanelGroup pg; + StaticText st; + private HtmlPanelGrid gridLayout = new HtmlPanelGrid(); + + //Plano actuacao + PlanoActuacao plano; + + //HtmlPanelGrid gridPlano = new HtmlPanelGrid(); + HtmlPanelGrid gridArea; + HtmlPanelGrid gridRisco; + HtmlPanelGrid gridValor; + HtmlPanelGrid gridMedida; + HtmlPanelGrid gridPosto; + HtmlPanelGrid gridResponsavel; + + int risco_id = 0; + int medida_id = 0; + int posto_id = 0; + + //page components + TextField txtResponsavelExecucao; + TextField txtPor; + TextArea txtRecursos; + Calendar dtInicio; + Calendar dtFim; + TextArea txtParecerDns; + TextArea txtParecerDl; + TextArea txtVerificacaoSiprp; + + + public HtmlPanelGrid getGridLayout() { + return gridLayout; + } + + public void setGridLayout(HtmlPanelGrid hpg) { + this.gridLayout = hpg; + } + private Button butGravarPlano = new Button(); + + public Button getButGravarPlano() { + return butGravarPlano; + } + + public void setButGravarPlano(Button b) { + this.butGravarPlano = b; + } + private Button butGravarRisco = new Button(); + + public Button getButGravarRisco() { + return butGravarRisco; + } + + public void setButGravarRisco(Button b) { + this.butGravarRisco = b; + } + private Button butEnviar = new Button(); + + public Button getButEnviar() { + return butEnviar; + } + + public void setButEnviar(Button b) { + this.butEnviar = b; + } + private Button butLimparDados = new Button(); + + public Button getButLimparDados() { + return butLimparDados; + } + + public void setButLimparDados(Button b) { + this.butLimparDados = b; + } + private Button butCancelar = new Button(); + + public Button getButCancelar() { + return butCancelar; + } + + public void setButCancelar(Button b) { + this.butCancelar = b; + } + private StaticText lblMsg = new StaticText(); + + public StaticText getLblMsg() { + return lblMsg; + } + + public void setLblMsg(StaticText st) { + this.lblMsg = st; + } + private HtmlPanelGrid gridValidar = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridValidar() { + return gridValidar; + } + + public void setGridValidar(HtmlPanelGrid hpg) { + this.gridValidar = hpg; + } + private Checkbox chkValidacao = new Checkbox(); + + public Checkbox getChkValidacao() { + return chkValidacao; + } + + public void setChkValidacao(Checkbox c) { + this.chkValidacao = c; + } + + private Checkbox chkDesactivar = new Checkbox(); + + public Checkbox getChkDesactivar() { + return chkDesactivar; + } + + public void setChkDesactivar( Checkbox c ) { + this.chkDesactivar = c; + } + private HtmlInputHidden hidValidacao = new HtmlInputHidden(); + + public HtmlInputHidden getHidValidacao() { + return hidValidacao; + } + + public void setHidValidacao(HtmlInputHidden hih) { + this.hidValidacao = hih; + } + private PanelGroup grpPagination = new PanelGroup(); + + public PanelGroup getGrpPagination() { + return grpPagination; + } + + public void setGrpPagination(PanelGroup pg) { + this.grpPagination = pg; + } + private HtmlPanelGrid gridPagination = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPagination() { + return gridPagination; + } + + public void setGridPagination(HtmlPanelGrid hpg) { + this.gridPagination = hpg; + } + private Button butEnviarCorrecao = new Button(); + + public Button getButEnviarCorrecao() { + return butEnviarCorrecao; + } + + public void setButEnviarCorrecao(Button b) { + this.butEnviarCorrecao = b; + } + private StaticText lblObs = new StaticText(); + + public StaticText getLblObs() { + return lblObs; + } + + public void setLblObs(StaticText st) { + this.lblObs = st; + } + private HtmlPanelGrid gridPlano2 = new HtmlPanelGrid(); + + public HtmlPanelGrid getgridPlano2() { + return gridPlano2; + } + + public void setgridPlano2(HtmlPanelGrid hpg) { + this.gridPlano2 = hpg; + } + private HtmlPanelGrid gridPlano = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPlano() { + return gridPlano; + } + + public void setGridPlano(HtmlPanelGrid hpg) { + this.gridPlano = hpg; + } + private HtmlPanelGrid gridValidacoes = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridValidacoes() { + return gridValidacoes; + } + + public void setGridValidacoes(HtmlPanelGrid hpg) { + this.gridValidacoes = hpg; + } + private HtmlPanelGrid gridValidar2 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridValidar2() { + return gridValidar2; + } + + public void setGridValidar2(HtmlPanelGrid hpg) { + this.gridValidar2 = hpg; + } + private HtmlPanelGrid gridObservacoes = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridObservacoes() { + return gridObservacoes; + } + + public void setGridObservacoes(HtmlPanelGrid hpg) { + this.gridObservacoes = hpg; + } + private StaticText stNomeEmpresa = new StaticText(); + + public StaticText getStNomeEmpresa() { + return stNomeEmpresa; + } + + public void setStNomeEmpresa(StaticText st) { + this.stNomeEmpresa = st; + } + + /** + *

Construct a new Page bean instance.

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

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.

+ */ + @Override + 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) { + ErrorLogger.logException( e ); + log("PlanoActuacao 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 + Utilizador u = getSessionBean1().getCurrentUser(); + if(u.getTipo().intValue() != Global.DIRECTOR_NACIONAL_SEGURANCA && u.getTipo().intValue() != Global.DIRECTOR_LOJA) + { + butEnviarCorrecao.setStyleClass("hidden"); + } + + } + + /** + *

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.

+ */ + @Override + 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.

+ */ + @Override + public void prerender() { + FacesContext fc = getFacesContext(); + //boolean isPostback = JSFUtils.isPostBack12(fc); + //boolean isPostback = JSFUtils.isPostBack(fc); + boolean isPostback = JSFUtils.isPostback(); + System.out.println("POSTBACK : " + isPostback); + PlanoActuacao p = getSessionBean1().getPlanoActuacao(); + getRiscosByPlano(p); + if(!isPostback) + { + //initializePlano(); + fillValoresHash(p); + initialize(p); + showPlano(p); + //fillPlano(); + } + else + { + Boolean validacao = (Boolean) chkValidacao.getSelected(); + if(validacao != null) + { + if(validacao.booleanValue() == true) + { + butEnviarCorrecao.setDisabled(true); + butEnviar.setDisabled(false); + } + else + { +// gridParecer.setStyleClass("hidden"); + butEnviarCorrecao.setDisabled(false); + butEnviar.setDisabled(true); + } + + } + + } + //setPagination(p); + setPagination(); + if(p.getCorrecao().matches("y")) + { + lblObs.setText(p.getObs_correcao()); + } + lblMsg.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).

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

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1) getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1) getBean("SessionBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + + public String hyperlink1_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + return "lista_planos"; + } + + + + + private void initialize(PlanoActuacao p) + { + //Test.showPlanoTree(p); + //getSessionBean1().setPaginationPageNr(1); + Pagination pagination = new Pagination(p); + getSessionBean1().setPagination(pagination); + Utilizador u = getSessionBean1().getCurrentUser(); + if(u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA) + { + hidValidacao.setValue("dns"); + } + else if(u.getTipo().intValue() == Global.DIRECTOR_LOJA) + { + hidValidacao.setValue("dir_loja"); + } + if(u.getTipo().intValue() == Global.TECNICO_HS) + { + hidValidacao.setValue("hs"); + } + + //gridValidar.setStyleClass("hidden"); + + if(u.getTipo().intValue() != Global.DIRECTOR_LOJA && u.getTipo().intValue() != Global.DIRECTOR_NACIONAL_SEGURANCA && u.getTipo().intValue() != Global.TECNICO_HS) + { + //gridValidar.setStyleClass("visible"); + gridValidar.setRendered(false); + //txtParecer.setStyleClass("hidden"); + } + else + { + //txtParecer.setRendered(false); + if(u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA) + { +// gridParecer.setStyleClass(""); + } + else if(u.getTipo().intValue() == Global.DIRECTOR_LOJA || u.getTipo().intValue() == Global.TECNICO_HS) + { +// gridParecer.setStyleClass("hidden"); + } + } +// else +// { +// if(u.getTipo().intValue() != Global.DIRECTOR_NACIONAL_SEGURANCA) +// { +// //txtParecer.setStyleClass("visible"); +// txtParecer.setRendered(false); +// } +// } + + int fase = p.getFase().intValue(); + switch(fase) + { + case Global.FASE_SEGURANCA_PREENCHIMENTO: + if(p.getObservacoes_dl() != null) + { + if(p.getObservacoes_dl().trim().length() > 0) + { + pg = new PanelGroup(); + gridObservacoes.getChildren().add(pg); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Observações gerais DL: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(p.getObservacoes_dl()); + pg.getChildren().add(st); + } + } + + + if(p.getObservacoes_dns() != null) + { + if(p.getObservacoes_dns().trim().length() > 0) + { + pg = new PanelGroup(); + gridObservacoes.getChildren().add(pg); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Observações gerais DNS: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(p.getObservacoes_dns()); + pg.getChildren().add(st); + } + } + + + + if(p.getCorrecao().matches("n")) + { + butEnviar.setText("Enviar a Director de Loja>>"); + } + else + { + if(p.getFase_antes_correcao().intValue() == Global.FASE_DIR_LOJA_VALIDACAO) + { + butEnviar.setText("Enviar a Director de Loja>>"); + } + else if(p.getFase_antes_correcao().intValue() == Global.FASE_DNS_PARECER) + { + butEnviar.setText("Enviar a Director Nacional Segurança>>"); + } + } + + break; + + case Global.FASE_DIR_LOJA_VALIDACAO: + //butEnviar.setText("Enviar a Director de Loja"); + pg = new PanelGroup(); + pg.setId("pgObsDl"); + gridObservacoes.getChildren().add(pg); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Observações gerais DL: "); + pg.getChildren().add(st); + TextArea txtObservacoesDl = new TextArea(); + txtObservacoesDl.setId("txtObservacoesDl"); + txtObservacoesDl.setColumns(200); + txtObservacoesDl.setText(p.getObservacoes_dl()); + pg.getChildren().add(txtObservacoesDl); + + if(p.getObservacoes_dns() != null) + { + if(p.getObservacoes_dns().trim().length() > 0) + { + pg = new PanelGroup(); + gridObservacoes.getChildren().add(pg); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Observações gerais DNS: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(p.getObservacoes_dns()); + pg.getChildren().add(st); + + } + } + + if(p.getValidacao_director_loja().booleanValue() == true) + { + chkValidacao.setSelected(new Boolean(true)); +// gridParecer.setStyleClass(""); + butEnviarCorrecao.setDisabled(true); + butEnviar.setDisabled(false); + } + else + { +// gridParecer.setStyleClass("hidden"); + butEnviarCorrecao.setDisabled(false); + butEnviar.setDisabled(true); + } + butEnviar.setText("Enviar a Director Nacional Segurança>>"); + +// if(p.getValidacao_director_loja().booleanValue() == true) +// { +// chkValidacao.setSelected(new Boolean(true)); +// butEnviar.setText("Enviar a Director Nacional Segurança>>"); +// } +// else +// { +// butEnviar.setText("Enviar para Responsável de Segurança>>"); +// } + if(p.getCorrecao().matches("y")) + { + butEnviar.setText("Enviar a Director Nacional Segurança>>"); + } +// else +// { +// butEnviar.setText("Enviar a Director Nacional Segurança>>"); +// } + break; + + case Global.FASE_DNS_PARECER: + if(p.getObservacoes_dl() != null) + { + if(p.getObservacoes_dl().trim().length() > 0) + { + pg = new PanelGroup(); + pg.setId("pgObsDl"); + gridObservacoes.getChildren().add(pg); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Observações gerais DL: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(p.getObservacoes_dl()); + pg.getChildren().add(st); + } + } + + + pg = new PanelGroup(); + pg.setId("pgObsDns"); + gridObservacoes.getChildren().add(pg); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Observações gerais DNS: "); + pg.getChildren().add(st); + TextArea txtObservacoesDns = new TextArea(); + txtObservacoesDns.setId("txtObservacoesDns"); + txtObservacoesDns.setColumns(200); + txtObservacoesDns.setText(p.getObservacoes_dns()); + pg.getChildren().add(txtObservacoesDns); + if(p.getValidacao_dns().booleanValue() == true) + { + chkValidacao.setSelected(new Boolean(true)); +// gridParecer.setStyleClass(""); + butEnviarCorrecao.setDisabled(true); + butEnviar.setDisabled(false); + } + else + { +// gridParecer.setStyleClass("hidden"); + butEnviarCorrecao.setDisabled(false); + butEnviar.setDisabled(true); + } + +// com.sun.webui.jsf.model.Option[] listOptions = new com.sun.webui.jsf.model.Option[2]; +// +// listOptions[0] = new Option(new Integer(Global.FASE_SEGURANCA_PREENCHIMENTO), "Responsável de segurança"); +// listOptions[1] = new Option(new Integer(Global.FASE_DIR_LOJA_VALIDACAO), "Director de loja"); +// drpIrPara.setItems(listOptions); +// drpIrPara.setSelected(new Integer( Global.FASE_SEGURANCA_PREENCHIMENTO )); + butEnviar.setText("Enviar para Técnico de HS>>"); + break; + + case Global.FASE_SIPRP_CONCLUSAO: + if(p.getObservacoes_dl() != null) + { + if(p.getObservacoes_dl().trim().length() > 0) + { + pg = new PanelGroup(); + gridObservacoes.getChildren().add(pg); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Observações gerais DL: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(p.getObservacoes_dl()); + pg.getChildren().add(st); + } + } + + + if(p.getObservacoes_dns() != null) + { + if(p.getObservacoes_dns().trim().length() > 0) + { + pg = new PanelGroup(); + gridObservacoes.getChildren().add(pg); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Observações gerais DNS: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(p.getObservacoes_dns()); + pg.getChildren().add(st); + } + } + + +// pg = new PanelGroup(); +// pg.setId("pgVerSiprp"); +// gridObservacoes.getChildren().add(pg); +// st = new StaticText(); +// st.setEscape(false); +// st.setStyleClass("label"); +// st.setText("Verificação SIPRP: "); +// pg.getChildren().add(st); +// TextArea txtVerificacaoSiprp = new TextArea(); +// txtVerificacaoSiprp.setId("txtVerificacaoSiprp"); +// txtVerificacaoSiprp.setColumns(200); +// txtVerificacaoSiprp.setText(p.getVerificacao_siprp()); +// pg.getChildren().add(txtVerificacaoSiprp); + + if(p.getValidacao_hs().booleanValue() == true) + { + chkValidacao.setSelected(new Boolean(true)); + butEnviar.setDisabled(false); + } + else + { + butEnviar.setDisabled(true); + } + butEnviar.setText("Concluir"); + break; + } + + chkDesactivar.setSelected( Boolean.FALSE ); + + +// gridPlano.setId("gridPlano"); +// gridPlano.setWidth("100%"); +// gridPlano.setColumns(1); +// gridPlano.setColumnClasses("gridColCenter"); + //plano + //lblTop.setText("Plano de actuação da auditoria " + p.getData_visita_str()); + gridLayout.getChildren().add(gridPlano); + } + + private void showPlano(PlanoActuacao p) + { + //stNomeEmpresa.setText(p.getNome_empresa()); + gridArea = new HtmlPanelGrid(); + gridArea.setId("gridArea"); + gridArea.setColumns(1); + gridArea.setColumnClasses("gridColCenter"); + gridArea.setWidth("100%"); + gridArea.setStyle("background-color: #f6f4e8; border: solid 1px #766c6c"); + + gridPlano.getChildren().add(gridArea); + + if(p.getAreas().size() > 0) + { + Area a = p.getAreas().get(0); + showArea(a); + if(a.getRiscos().size() > 0) + { + Risco r = a.getRiscos().get(0); + showRisco(r); + //showValores(r); + ////if(r.getValores().size() > 0) + ////{ +// showValor(r.getValores().get(0)); + showValor(r); +// showResponsavel(r.getValores().get(0)); + showResponsavel(r); + ////} + + } + } + showPreviousValidacoes(p); + + //TODO: do this IFF userType is Rogerio or 'tecnico ?' + Utilizador currentUser = getSessionBean1().getCurrentUser(); + if ( currentUser.getTipo().intValue() == Global.TECNICO_HS + || currentUser.getTipo().intValue() == Global.DIRECTOR_SIPRP ) + { + chkDesactivar.setId( "chkDesactivarPlano" ); + chkDesactivar.setLabel( "Desactivar Plano" ); + chkDesactivar.setSelected( p.getConcluidoPorDesactivacao() ); + chkDesactivar.setStyle( "float: left;" ); + gridPlano.getChildren().add( chkDesactivar ); + } + } + + private void showArea(Area a) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Área: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(Utils.unicodeToHTML(a.getDescricao())); + pg.getChildren().add(st); + gridArea.getChildren().add(pg); + + + } + + private void showRisco(Risco r) + { + getSessionBean1().setCurrentRisco(r); + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setColumns(1); + grd.setWidth("100%"); + //grd.setStyleClass("centerBlock"); +// gridArea.getChildren().add(grd); + + gridRisco = new HtmlPanelGrid(); + //gridRisco.setStyleClass("centerBlock"); + gridRisco.setWidth("98%"); + gridRisco.setColumns(1); + gridRisco.setColumnClasses("gridColLeft"); + //grd.getChildren().add(gridRisco); + gridArea.getChildren().add(gridRisco); + + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Risco: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(r.getDescricao()); + pg.getChildren().add(st); + gridRisco.getChildren().add(pg); + + } + + private void showValores(Risco r) + { + List valores = r.getValores(); + + for(Valor v : valores) + { + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setColumns(1); + grd.setColumnClasses("gridColLeft"); + grd.setWidth("100%"); + //grd.setStyleClass("centerBlock"); + ////gridRisco.getChildren().add(grd); + + gridValor = new HtmlPanelGrid(); + gridRisco.getChildren().add(gridValor); + //gridValor.setStyleClass("centerBlock"); + gridValor.setWidth("100%"); + gridValor.setColumns(1); + gridValor.setColumnClasses("gridColLeft"); + //grd.getChildren().add(gridValor); + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Valor: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(v.getValor().toString()); + pg.getChildren().add(st); + gridValor.getChildren().add(pg); + + showMedidas(r); + } + } + +// private void showValor(Valor v) + private void showValor(Risco r) + { + //Valor v = r.getValores().get(0); +// getSessionBean1().setCurrentValor(v); + getSessionBean1().setCurrentRisco(r); + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setColumns(1); + grd.setColumnClasses("gridColLeft"); + grd.setWidth("100%"); + //grd.setStyleClass("centerBlock"); + ////gridRisco.getChildren().add(grd); + + gridValor = new HtmlPanelGrid(); + gridRisco.getChildren().add(gridValor); + //gridValor.setStyleClass("centerBlock"); + gridValor.setWidth("100%"); + gridValor.setColumns(1); + gridValor.setColumnClasses("gridColLeft"); + //grd.getChildren().add(gridValor); + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Valor: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + if(r.getValor() == null) + { + st.setText("IND"); + } + else + { + st.setText(r.getValor().toString()); + } + + pg.getChildren().add(st); + gridValor.getChildren().add(pg); + + showMedidas(r); + } + + private void showMedidas(Risco r) + { + List medidas = r.getMedidas(); + + for(Medida m : medidas) + { + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setColumns(1); + grd.setWidth("100%"); + grd.setStyleClass("centerBlock"); + gridValor.getChildren().add(grd); + + gridMedida = new HtmlPanelGrid(); + gridMedida.setId( "gridMedida_" + m.getId() ); + gridMedida.setStyleClass("centerBlock"); + gridMedida.setWidth("98%"); + gridMedida.setColumns(1); + gridMedida.setColumnClasses("gridColLeft"); + grd.getChildren().add(gridMedida); + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Medida:  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(m.getDescricao()); + pg.getChildren().add(st); + gridMedida.getChildren().add(pg); + + showPostos(m); + + Utilizador u = getSessionBean1().getCurrentUser(); + PlanoActuacao planoActual = getSessionBean1().getPlanoActuacao(); + if ( planoActual.getFase().intValue() == Global.FASE_SIPRP_CONCLUSAO ) + { + List< EstadoMedida > opts = null; + try + { + opts = pdp.getEstadoMedidas(); + } + catch ( Exception e ) + { + ErrorLogger.logException( e ); + } + + DropDown drop = new DropDown(); + Option opt[] = null; + if ( opts != null ) + { + opt = new Option[ (opts.size() + 1) ]; + opt[ 0 ] = new Option( 0, "" ); + for ( int i = 0; i < opts.size(); i++ ) + { + EstadoMedida em = opts.get( i ); + opt[ (i+1) ] = new Option( em.getId(), em.getDescricao() ); + } + } + else + { + opt = new Option[ 1 ]; + opt[ 0 ] = new Option( 0, "" ); + } + drop.setItems( opt ); + + drop.setId( "drop_" + r.getId() + "_" + m.getId() ); + drop.setSelected( m.getValidarMedidaId() == null ? 0 : m.getValidarMedidaId() ); + + StaticText dropLabel = new StaticText(); + dropLabel.setText( "Validar Medida: " ); + + PanelGroup valPG = new PanelGroup(); + valPG.setId( "valPG_" + m.getId() ); + valPG.getChildren().add( dropLabel ); + valPG.getChildren().add( drop ); + gridMedida.getChildren().add( valPG ); + } + } + + } + + private void showPostos(Medida m) + { + List postos = m.getPostos(); + + for(PostoTrabalho p : postos) + { + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setColumns(1); + grd.setWidth("100%"); + grd.setStyleClass("centerBlock"); + gridMedida.getChildren().add(grd); + + gridPosto = new HtmlPanelGrid(); + gridPosto.setStyleClass("centerBlock"); + gridPosto.setWidth("98%"); + gridPosto.setColumns(1); + gridPosto.setColumnClasses("gridColLeft"); + grd.getChildren().add(gridPosto); + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Posto de trabalho:  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(p.getDescricao()); + pg.getChildren().add(st); + gridPosto.getChildren().add(pg); + + } + } + +// private void showResponsavel(Valor v) + private void showResponsavel(Risco r) + { + System.out.println("RISCO : " + r.getDescricao() + " RESPONSAVEL : " + r.getResponsavel_execucao()); + Utilizador u = getSessionBean1().getCurrentUser(); + gridResponsavel = new HtmlPanelGrid(); + gridResponsavel.setId("gridResponsavel"); + gridResponsavel.setWidth("100%"); + gridResponsavel.setColumns(1); + gridResponsavel.setColumnClasses("gridColLeft"); + gridArea.getChildren().add(gridResponsavel); + + pg = new PanelGroup(); + pg.setId("pgResponsavel"); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Responsável de execução:"); + pg.getChildren().add(st); + if(u.getTipo().intValue() == Global.RESPONSAVEL_SEGURANCA) + { + txtResponsavelExecucao = new TextField(); + txtResponsavelExecucao.setId("txtResponsavel"); + txtResponsavelExecucao.setColumns(100); + txtResponsavelExecucao.setText(r.getResponsavel_execucao()); + pg.getChildren().add(txtResponsavelExecucao); + } + else + { + st = new StaticText(); + st.setEscape(false); + st.setText(r.getResponsavel_execucao()); + pg.getChildren().add(st); + } + + st = new StaticText(); + st.setEscape(false); + st.setText(" "); + pg.getChildren().add(st); + + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("POR:"); + pg.getChildren().add(st); + + if(u.getTipo().intValue() == Global.RESPONSAVEL_SEGURANCA) + { + txtPor = new TextField(); + txtPor.setId("txtPor"); + txtPor.setColumns(20); + txtPor.setText(r.getPor()); + pg.getChildren().add(txtPor); + } + else + { + st = new StaticText(); + st.setEscape(false); + st.setText(r.getPor()); + pg.getChildren().add(st); + } + + + + + gridResponsavel.getChildren().add(pg); + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Recursos necessários à implementação da medida: "); + pg.getChildren().add(st); + gridResponsavel.getChildren().add(pg); + if(u.getTipo().intValue() == Global.RESPONSAVEL_SEGURANCA) + { + txtRecursos = new TextArea(); + txtRecursos.setId("txtRecursos"); + txtRecursos.setColumns(200); + txtRecursos.setText(r.getRecursos_necessarios()); + gridResponsavel.getChildren().add(txtRecursos); + } + else + { + st = new StaticText(); + st.setEscape(false); + st.setText(r.getRecursos_necessarios()); + //gridResponsavel.getChildren().add(st); + pg.getChildren().add(st); + } + +// Anchor ancora = new Anchor(); +// ancora.setId("calendario"); +// gridResponsavel.getChildren().add(ancora); + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setColumns(2); + grd.setColumnClasses("gridCol15, gridCol85"); + grd.setId("gridDtInicio"); + grd.setStyle("width: 100%"); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Data prevista de início:"); + grd.getChildren().add(st); + if(u.getTipo().intValue() == Global.RESPONSAVEL_SEGURANCA) + { + dtInicio = new Calendar(); + dtInicio.setId("dtInicio"); + + dtInicio.setDateFormatPattern("dd-MM-yyyy"); + dtInicio.setValue(r.getData_inicio()); + java.util.GregorianCalendar gcalendar = new java.util.GregorianCalendar(); + gcalendar.set(2000,1,1); + dtInicio.setMinDate(gcalendar.getTime()); + grd.getChildren().add(dtInicio); + } + else + { + if(r.getData_inicio() != null) + { + st = new StaticText(); + st.setEscape(false); + SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); + String data_str = formatter.format(r.getData_inicio()); + st.setText(data_str); + grd.getChildren().add(st); + } + } + + gridResponsavel.getChildren().add(grd); + + + grd = new HtmlPanelGrid(); + grd.setColumns(2); + grd.setColumnClasses("gridCol15, gridCol85"); + grd.setId("gridDtFim"); + grd.setStyle("width: 100%"); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Data prevista de conclusão:"); + grd.getChildren().add(st); + if(u.getTipo().intValue() == Global.RESPONSAVEL_SEGURANCA) + { + dtFim = new Calendar(); + dtFim.setId("dtFim"); + dtFim.setDateFormatPattern("dd-MM-yyyy"); + java.util.GregorianCalendar gcalendar1 = new java.util.GregorianCalendar(); + gcalendar1.set(2099,1,1); + dtFim.setMaxDate(gcalendar1.getTime()); + dtFim.setValue(r.getData_fim()); + grd.getChildren().add(dtFim); + } + else + { + if(r.getData_fim() != null) + { + st = new StaticText(); + st.setEscape(false); + SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); + String data_str = formatter.format(r.getData_fim()); + st.setText(data_str); + grd.getChildren().add(st); + } + } + + gridResponsavel.getChildren().add(grd); + + if(u.getTipo().intValue() != Global.DIRECTOR_LOJA) + { + if(r.getParecer_dl() != null) + { + if(r.getParecer_dl().trim().length() > 0) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Parecer Director de Loja: "); + pg.getChildren().add(st); + gridResponsavel.getChildren().add(pg); + +// if(u.getTipo().intValue() == Global.DIRECTOR_LOJA) +// { +// txtParecerDl = new TextArea(); +// txtParecerDl.setId("txtParecerDl"); +// txtParecerDl.setColumns(200); +// txtParecerDl.setText(v.getParecer_dl()); +// gridResponsavel.getChildren().add(txtParecerDl); +// } +// else +// { + st = new StaticText(); + st.setEscape(false); + st.setText(r.getParecer_dl()); + //gridResponsavel.getChildren().add(st); + pg.getChildren().add(st); +// } + } + } + } + else + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Parecer Director de Loja: "); + pg.getChildren().add(st); + gridResponsavel.getChildren().add(pg); + + txtParecerDl = new TextArea(); + txtParecerDl.setId("txtParecerDl"); + txtParecerDl.setColumns(200); + txtParecerDl.setText(r.getParecer_dl()); + gridResponsavel.getChildren().add(txtParecerDl); + } + + + + if(u.getTipo().intValue() != Global.DIRECTOR_NACIONAL_SEGURANCA) + { + if(r.getParecer_dns() != null) + { + if(r.getParecer_dns().trim().length() > 0) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Parecer Director Nacional de Segurança: "); + pg.getChildren().add(st); + gridResponsavel.getChildren().add(pg); + +// if(u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA) +// { +// txtParecerDns = new TextArea(); +// txtParecerDns.setId("txtParecerDns"); +// txtParecerDns.setColumns(200); +// txtParecerDns.setText(v.getParecer_dns()); +// gridResponsavel.getChildren().add(txtParecerDns); +// } +// else +// { + st = new StaticText(); + st.setEscape(false); + st.setText(r.getParecer_dns()); + //gridResponsavel.getChildren().add(st); + pg.getChildren().add(st); +// } + } + } + + } + else + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Parecer Director Nacional de Segurança: "); + pg.getChildren().add(st); + gridResponsavel.getChildren().add(pg); + + txtParecerDns = new TextArea(); + txtParecerDns.setId("txtParecerDns"); + txtParecerDns.setColumns(200); + txtParecerDns.setText(r.getParecer_dns()); + gridResponsavel.getChildren().add(txtParecerDns); + + } + + //Verificacao SIPRP + if(u.getTipo().intValue() != Global.TECNICO_HS) + { + if(r.getVerificacao_siprp() != null) + { + if(r.getVerificacao_siprp().trim().length() > 0) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Verificação SIPRP: "); + pg.getChildren().add(st); + gridResponsavel.getChildren().add(pg); + +// if(u.getTipo().intValue() == Global.TECNICO_HS) +// { +// txtVerificacaoSiprp = new TextArea(); +// txtVerificacaoSiprp.setId("txtVerificacaoSiprp"); +// txtVerificacaoSiprp.setColumns(200); +// txtVerificacaoSiprp.setText(v.getVerificacao_siprp()); +// gridResponsavel.getChildren().add(txtVerificacaoSiprp); +// } +// else +// { + st = new StaticText(); + st.setEscape(false); + st.setText(r.getVerificacao_siprp()); + //gridResponsavel.getChildren().add(st); + pg.getChildren().add(st); +// } + } + } + + } + else + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Verificação SIPRP: "); + pg.getChildren().add(st); + gridResponsavel.getChildren().add(pg); + + txtVerificacaoSiprp = new TextArea(); + txtVerificacaoSiprp.setId("txtVerificacaoSiprp"); + txtVerificacaoSiprp.setColumns(200); + txtVerificacaoSiprp.setText(r.getVerificacao_siprp()); + gridResponsavel.getChildren().add(txtVerificacaoSiprp); + } + + + } + + private void showPreviousValidacoes(PlanoActuacao p) + { + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + Utilizador u = getSessionBean1().getCurrentUser(); + int tipo = u.getTipo().intValue(); + + switch(tipo) + { + case Global.DIRECTOR_NACIONAL_SEGURANCA: + if(p.getValidacao_director_loja().booleanValue()) + { + StaticText st = new StaticText(); + st.setEscape(false); + //st.setStyleClass("label"); + String nome = ""; + try + { + Utilizador user = udp.getUtilizador(p.getUser_dir_loja()); + nome = user.getNome(); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + st.setText("Validado por " + nome + " (Director de Loja) a " + p.getData_validacao_dir_loja_str()); + gridValidacoes.getChildren().add(st); + } + break; + + case Global.TECNICO_HS: + if(p.getValidacao_director_loja().booleanValue()) + { + StaticText st = new StaticText(); + st.setEscape(false); + //st.setStyleClass("label"); + String nome = ""; + try + { + Utilizador user = udp.getUtilizador(p.getUser_dir_loja()); + nome = user.getNome(); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + st.setText("Validado por " + nome + " (Director de Loja) a " + p.getData_validacao_dir_loja_str()); + gridValidacoes.getChildren().add(st); + } + + if(p.getValidacao_dns().booleanValue()) + { + StaticText st = new StaticText(); + st.setEscape(false); + //st.setStyleClass("label"); + String nome = ""; + try + { + Utilizador user = udp.getUtilizador(p.getUser_dns()); + nome = user.getNome(); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + st.setText("Validado por " + nome + " (Director Nacional de Segurança) a " + p.getData_validacao_dns_str()); + //st.setText("Validado por Director Nacional de Segurança"); + gridValidacoes.getChildren().add(st); + } + + break; + } + } + + private void setPagination() + { + StaticText st = null; + + Class[] argtypes = new Class[1]; + argtypes[0] = ActionEvent.class; + MethodExpression me = (MethodExpression)this.getApplication().getExpressionFactory().createMethodExpression( + getFacesContext().getELContext(), "#{EditarPlano.paginacao_actionListener}", null,argtypes); + + if(grpPagination.getChildCount() > 0) + { + grpPagination.getChildren().clear(); + } + + Pagination pagination = getSessionBean1().getPagination(); + Vector paginas = pagination.getPaginas(); + for(Pagina pagina : paginas) + { + if(pagina.isPrevious()) + { + pagina.addActionListener(new MethodExpressionActionListener(me)); + grpPagination.getChildren().add(pagina); + st = new StaticText(); + st.setEscape(false); + st.setText(" "); + grpPagination.getChildren().add(st); + } + else if(pagina.isNext()) + { + st = new StaticText(); + st.setEscape(false); + st.setText(" "); + grpPagination.getChildren().add(st); + pagina.addActionListener(new MethodExpressionActionListener(me)); + grpPagination.getChildren().add(pagina); + } + else + { + pagina.addActionListener(new MethodExpressionActionListener(me)); + grpPagination.getChildren().add(pagina); + if(pagina.getPage_nr().intValue() < pagination.totalPaginas() ) + { + st = new StaticText(); + st.setEscape(false); + st.setText(" | "); + grpPagination.getChildren().add(st); + } + + } + } + } + + public String butGravarPlano_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + String page = null; + try + { + page = gravarPlano(); + getSessionBean1().setMsg("Os dados do Plano de Actuação foram guardados"); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + getSessionBean1().setMsg("Erro na gravação do plano!"); + } + + return page; + } + + private String gravarPlano() throws Exception + { + String returnToPage = null; + PlanoActuacao p = getSessionBean1().getPlanoActuacao(); + int fase = p.getFase().intValue(); + switch(fase) + { + case Global.FASE_DIR_LOJA_VALIDACAO: + PanelGroup pg = (PanelGroup) gridObservacoes.findComponent("pgObsDl"); + if(pg != null) + { + TextArea txtObs = (TextArea) pg.findComponent("txtObservacoesDl"); + if(txtObs != null) + { + p.setObservacoes_dl(""); + if(txtObs.getText() != null) + { + p.setObservacoes_dl((String) txtObs.getText()); + } + } + } + + + Boolean validacao = (Boolean)chkValidacao.getSelected(); + if(validacao != null) + { + if(validacao.booleanValue()) + { + p.setValidacao_director_loja(new Boolean(true)); + } + } + break; + + case Global.FASE_DNS_PARECER: + pg = (PanelGroup) gridObservacoes.findComponent("pgObsDns"); + if(pg != null) + { + TextArea txtObs = (TextArea) pg.findComponent("txtObservacoesDns"); + if(txtObs != null) + { + p.setObservacoes_dns(""); + if(txtObs.getText() != null) + { + p.setObservacoes_dns((String) txtObs.getText()); + } + } + } + + validacao = (Boolean)chkValidacao.getSelected(); + if(validacao != null) + { + if(validacao.booleanValue()) + { + p.setValidacao_dns(new Boolean(true)); + } + } + break; + + case Global.FASE_SIPRP_CONCLUSAO: + validacao = (Boolean)chkValidacao.getSelected(); + if(validacao != null) + { + if(validacao.booleanValue()) + { + p.setValidacao_hs(new Boolean(true)); + } + } + } + + Utilizador currentUser = getSessionBean1().getCurrentUser(); + if ( currentUser.getTipo().intValue() == Global.TECNICO_HS + || currentUser.getTipo().intValue() == Global.DIRECTOR_SIPRP ) + { + Checkbox chkD = ( Checkbox ) gridPlano.findComponent( "form1:chkDesactivarPlano" ); + if ( chkD != null ) + { + Boolean desactivar = ( Boolean ) chkD.getSelected(); + if ( desactivar != null && desactivar ) + { + p.setFase( Global.FASE_CONCLUIDO ); + p.setConcluidoPorDesactivacao( Boolean.TRUE ); + returnToPage = "lista_planos"; + } + } + } + + pdp.updatePlano(p); + + //Valor curValor = getSessionBean1().getCurrentValor(); + Risco curValor = getSessionBean1().getCurrentRisco(); + curValor = fillValorFields(curValor); +// getSessionBean1().getValoresHash().remove(curValor.getId()); +// getSessionBean1().getValoresHash().put(curValor.getId(), curValor); + getSessionBean1().getRiscosHash().remove(curValor.getId()); + getSessionBean1().getRiscosHash().put(curValor.getId(), curValor); + +// HashMap valores = getSessionBean1().getValoresHash(); +// Iterator iter = valores.keySet().iterator(); +// while(iter.hasNext()) +// { +// Integer id = iter.next(); +// Valor v = valores.get(id); +// pdp.updateValor(v); +// } + + HashMap valores = getSessionBean1().getRiscosHash(); + Iterator iter = valores.keySet().iterator(); + while(iter.hasNext()) + { + Integer id = iter.next(); + Risco r = valores.get(id); + pdp.updateRisco(r); + + if ( fase == Global.FASE_SIPRP_CONCLUSAO ) + { + pdp.updateMedidas( r ); + } + } + + return returnToPage; + } + + public String butGravarRisco_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + PlanosDataProvider pdp = new PlanosDataProvider(); + PlanoActuacao p = getSessionBean1().getPlanoActuacao(); + int fase = p.getFase().intValue(); + switch(fase) + { + case Global.FASE_DIR_LOJA_VALIDACAO: + PanelGroup pg = (PanelGroup) gridObservacoes.findComponent("pgObsDl"); + if(pg != null) + { + TextArea txtObs = (TextArea) pg.findComponent("txtObservacoesDl"); + if(txtObs != null) + { + p.setObservacoes_dl(""); + if(txtObs.getText() != null) + { + p.setObservacoes_dl((String) txtObs.getText()); + } + } + } + + + Boolean validacao = (Boolean)chkValidacao.getSelected(); + if(validacao != null) + { + if(validacao.booleanValue()) + { + p.setValidacao_director_loja(new Boolean(true)); + } + } + break; + + case Global.FASE_DNS_PARECER: + pg = (PanelGroup) gridObservacoes.findComponent("pgObsDns"); + if(pg != null) + { + TextArea txtObs = (TextArea) pg.findComponent("txtObservacoesDns"); + if(txtObs != null) + { + p.setObservacoes_dns(""); + if(txtObs.getText() != null) + { + p.setObservacoes_dns((String) txtObs.getText()); + } + } + } + + validacao = (Boolean)chkValidacao.getSelected(); + if(validacao != null) + { + if(validacao.booleanValue()) + { + p.setValidacao_dns(new Boolean(true)); + } + } + break; + + case Global.FASE_SIPRP_CONCLUSAO: + validacao = (Boolean)chkValidacao.getSelected(); + if(validacao != null) + { + if(validacao.booleanValue()) + { + p.setValidacao_hs(new Boolean(true)); + } + } + } + try + { + pdp.updatePlano(p); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + + + try + { +// Risco r = getSessionBean1().getCurrentRisco(); +// r = fillRiscoFields(r); +// pdp.updateRisco(r); + + //Valor v = getSessionBean1().getCurrentValor(); + Risco r = getSessionBean1().getCurrentRisco(); + r = fillValorFields(r); + //pdp.updateValor(r); + pdp.updateRisco(r); + if ( fase == Global.FASE_SIPRP_CONCLUSAO ) + { + pdp.updateMedidas( r ); + } +// getSessionBean1().getValoresHash().remove(r.getId()); +// getSessionBean1().getValoresHash().put(r.getId(), r); + getSessionBean1().getRiscosHash().remove(r.getId()); + getSessionBean1().getRiscosHash().put(r.getId(), r); + + Pagination pagination = getSessionBean1().getPagination(); + + ////r = pagination.nextRisco(); + r = pagination.nextValor(); + //Risco r = getSessionBean1().getRiscosHash().get(r.getId()); + ///////r = getSessionBean1().getRiscosHash().get(r.getId()); + Area a = getSessionBean1().getAreasHash().get(r.getArea_id()); + //if(v != null) + if(r != null) + { + //gridPlano = (HtmlPanelGrid) gridLayout.findComponent("form1:gridPlano"); + gridArea = (HtmlPanelGrid) gridPlano.findComponent("form1:gridArea"); + if(gridArea.getChildren() != null) + { + gridArea.getChildren().clear(); + } + showArea(a); + showRisco(r); + showValor(r); + showResponsavel(r); + } + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + + //Risco r = getNextRisco(getSessionBean1().getPlanoId()); + //fillRisco(r); + return null; + } + + private void fillPlanoFields() + { + PlanoActuacao p = getSessionBean1().getPlanoActuacao(); + + int fase = p.getFase().intValue(); + switch(fase) + { + case Global.FASE_DIR_LOJA_VALIDACAO: + Boolean validacao = (Boolean)chkValidacao.getSelected(); + p.setValidacao_hs(validacao); + + TextArea txtObs = (TextArea) pg.findComponent("txtObservacoesDl"); + if(txtObs != null) + { + if(txtObs.getText() != null) + { + p.setObservacoes_dl((String) txtObs.getText()); + } + } + break; + + case Global.DIRECTOR_NACIONAL_SEGURANCA: + validacao = (Boolean)chkValidacao.getSelected(); + p.setValidacao_hs(validacao); + + txtObs = (TextArea) pg.findComponent("txtObservacoesDns"); + if(txtObs != null) + { + if(txtObs.getText() != null) + { + p.setObservacoes_dns((String) txtObs.getText()); + } + } + break; + + case Global.FASE_SIPRP_CONCLUSAO: + validacao = (Boolean)chkValidacao.getSelected(); + p.setValidacao_hs(validacao); + break; + + + } + } + +// private Valor fillValorFields(Valor v) + private Risco fillValorFields(Risco r) + { + //gridPlano = (HtmlPanelGrid) gridLayout.findComponent("form1:gridPlano"); + gridArea = (HtmlPanelGrid) gridPlano.findComponent("form1:gridArea"); + gridResponsavel = (HtmlPanelGrid) gridArea.findComponent("form1:gridResponsavel"); + + TextField txtResponsavel = (TextField) gridResponsavel.findComponent("form1:pgResponsavel:txtResponsavel"); + if(txtResponsavel != null) + { + if(txtResponsavel.getText() != null) + { + r.setResponsavel_execucao((String) txtResponsavel.getText()); + } + } + + TextField txtPor = (TextField) gridResponsavel.findComponent("form1:pgResponsavel:txtPor"); + if(txtPor != null) + { + if(txtPor.getText() != null) + { + r.setPor((String) txtPor.getText()); + } + } + + TextArea txtRecursos = (TextArea) gridResponsavel.findComponent("form1:txtRecursos"); + if(txtRecursos != null) + { + if(txtRecursos.getText() != null) + { + r.setRecursos_necessarios((String) txtRecursos.getText()); + } + } + + Calendar dtInicio = (Calendar) gridResponsavel.findComponent("form1:dtInicio:"); + if(dtInicio != null) + { + r.setData_inicio(dtInicio.getSelectedDate()); + } + + Calendar dtFim = (Calendar) gridResponsavel.findComponent("form1:dtFim"); + if(dtFim != null) + { + r.setData_fim(dtFim.getSelectedDate()); + } + + TextArea txtParecerDl = (TextArea) gridResponsavel.findComponent("form1:txtParecerDl"); + if(txtParecerDl != null) + { + if(txtParecerDl.getText() != null) + { + r.setParecer_dl((String) txtParecerDl.getText()); + } + } + + TextArea txtParecerDns = (TextArea) gridResponsavel.findComponent("form1:txtParecerDns"); + if(txtParecerDns != null) + { + if(txtParecerDns.getText() != null) + { + r.setParecer_dns((String) txtParecerDns.getText()); + } + } + + TextArea txtVerificacaoSiprp = (TextArea) gridResponsavel.findComponent("form1:txtVerificacaoSiprp"); + if(txtVerificacaoSiprp != null) + { + if(txtVerificacaoSiprp.getText() != null) + { + r.setVerificacao_siprp((String) txtVerificacaoSiprp.getText()); + } + } + + PlanoActuacao planoActual = getSessionBean1().getPlanoActuacao(); + if ( planoActual.getFase().intValue() == Global.FASE_SIPRP_CONCLUSAO ) + { + for( Medida m: r.getMedidas() ) + { + gridMedida = (HtmlPanelGrid) gridArea.findComponent("form1:gridMedida_" + m.getId() ); + if ( gridMedida != null ) + { + PanelGroup gridValPG = ( PanelGroup ) gridMedida.findComponent( "valPG_" + m.getId() ); + if ( gridValPG != null ) + { + DropDown drop = ( DropDown ) gridValPG.findComponent("drop_" + r.getId() + "_" + m.getId()); + if( drop != null ) + { + Integer optID = ( Integer ) drop.getSelected(); + m.setValidarMedidaId( optID.intValue() == 0 ? null : optID ); + } + } + } + } + } + + return r; + } + + public String butEnviar_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + PlanoActuacao p = getSessionBean1().getPlanoActuacao(); + + if(planoValidationOk(p)) + { + //Valor curValor = getSessionBean1().getCurrentValor(); + Risco curValor = getSessionBean1().getCurrentRisco(); + curValor = fillValorFields(curValor); + getSessionBean1().getRiscosHash().remove(curValor.getId()); + getSessionBean1().getRiscosHash().put(curValor.getId(), curValor); + if(!checkCamposObrigatorios()) + { + getSessionBean1().setMsg("Faltam preencher alguns riscos/valor. Por favor preencha todos os campos antes de prosseguir"); + return null; + } + try //save current valor + { +// Valor v = getSessionBean1().getCurrentValor(); +// v = fillValorFields(v); +// pdp.updateValor(v); + + HashMap valores = getSessionBean1().getRiscosHash(); + Iterator iter = valores.keySet().iterator(); + while(iter.hasNext()) + { + Integer id = iter.next(); + Risco r = valores.get(id); + pdp.updateRisco(r); + } + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + try + { + processEnviar(p); + return "lista_planos"; + } + catch(Exception ex) + { + getSessionBean1().setMsg("Erro no envio do Plano"); + ErrorLogger.logException( ex ); + } + } + + return null; + } + + private boolean planoValidationOk(PlanoActuacao p) + { + boolean ok = true; + boolean processo_validado = true; + int dns_next_fase = 2; + + int fase = p.getFase().intValue(); + p.setFase_anterior(new Integer(fase)); + switch(fase) + { +// case Global.FASE_SIPRP_EMISSAO: +// break; + + case Global.FASE_SEGURANCA_PREENCHIMENTO: + gridArea = (HtmlPanelGrid) gridPlano.findComponent("form1:gridArea"); + gridResponsavel = (HtmlPanelGrid) gridArea.findComponent("form1:gridResponsavel"); + HtmlPanelGrid gridDtInicio = (HtmlPanelGrid) gridResponsavel.findComponent("form1:gridDtInicio"); + Calendar calDtInicio = (Calendar) gridDtInicio.findComponent("form1:dtInicio"); + HtmlPanelGrid gridDtFim = (HtmlPanelGrid) gridResponsavel.findComponent("form1:gridDtFim"); + Calendar calDtFim = (Calendar) gridDtFim.findComponent("form1:dtFim"); + Date dtInicio = calDtInicio.getSelectedDate(); + Date dtFim = calDtFim.getSelectedDate(); + if(dtInicio != null && dtFim != null) + { + if(dtInicio.after(dtFim)) + { + getSessionBean1().setMsg("Data Início não pode ser superior à data fim!"); + ok = false; + } + else + { + fase++; + } + } + break; + case Global.FASE_SIPRP_CONCLUSAO: + Boolean validacao = (Boolean)chkValidacao.getSelected(); + if(validacao == null) + { + processo_validado = false; + ok = false; + } + else + { + processo_validado = false; + if(validacao.booleanValue()) + { + processo_validado = true; + p.setValidacao_hs(new Boolean(true)); + Date today = new Date(); + p.setData_validacao_hs(today); + p.setUser_hs(getSessionBean1().getCurrentUser().getId()); + +// PanelGroup pg = (PanelGroup) gridObservacoes.findComponent("pgVerSiprp"); +// if(pg != null) +// { +// TextArea txtVer = (TextArea) pg.findComponent("txtVerificacaoSiprp"); +// if(txtVer != null) +// { +// p.setVerificacao_siprp(""); +// if(txtVer.getText() != null) +// { +// p.setVerificacao_siprp((String) txtVer.getText()); +// } +// } +// } + } + } + + if(processo_validado) + { + fase++; + } + else + { + getSessionBean1().setMsg("É necessário validar o processo antes de dar seguimento para a fase seguinte!"); + ok = false; + } + break; + + case Global.FASE_DIR_LOJA_VALIDACAO: + validacao = (Boolean)chkValidacao.getSelected(); + if(validacao == null) + { + processo_validado = false; + } + else + { + processo_validado = false; + if(validacao.booleanValue()) + { + processo_validado = true; + p.setValidacao_director_loja(new Boolean(true)); + Date today = new Date(); + p.setData_validacao_dir_loja(today); + p.setUser_dir_loja(getSessionBean1().getCurrentUser().getId()); + + PanelGroup pg = (PanelGroup) gridObservacoes.findComponent("pgObsDl"); + if(pg != null) + { + TextArea txtObs = (TextArea) pg.findComponent("txtObservacoesDl"); + if(txtObs != null) + { + p.setObservacoes_dl(""); + if(txtObs.getText() != null) + { + p.setObservacoes_dl((String) txtObs.getText()); + } + } + } + + } + } + + if(processo_validado) + { + fase++; + } + else + { + fase = Global.FASE_SEGURANCA_PREENCHIMENTO; //fase 2 + } + break; + + case Global.FASE_DNS_PARECER: + validacao = (Boolean)chkValidacao.getSelected(); + if(validacao == null) + { + processo_validado = false; + } + else + { + processo_validado = false; + if(validacao.booleanValue()) + { + processo_validado = true; + p.setValidacao_dns(new Boolean(true)); + Date today = new Date(); + p.setData_validacao_dns(today); + p.setUser_dns(getSessionBean1().getCurrentUser().getId()); + + PanelGroup pg = (PanelGroup) gridObservacoes.findComponent("pgObsDns"); + if(pg != null) + { + TextArea txtObs = (TextArea) pg.findComponent("txtObservacoesDns"); + if(txtObs != null) + { + p.setObservacoes_dns(""); + if(txtObs.getText() != null) + { + p.setObservacoes_dns((String) txtObs.getText()); + } + } + } + } + } + + if(processo_validado) + { +// if(txtParecer.getText() == null) +// { +// getSessionBean1().setMsg("Tem de preencher parecer!"); +// ok = false; +// } +// else +// { +// String parecer = (String) txtParecer.getText(); +// if(parecer.trim().length() == 0) +// { +// getSessionBean1().setMsg("Tem de preencher parecer!"); +// ok = false; +// } +// else +// { +// p.setParecer_dns(parecer); +// fase++; +// } +// } + fase++; + } + else + { + getSessionBean1().setMsg("É necessário validar o processo antes de dar seguimento para a fase seguinte!"); + ok = false; + } +// else +// { +// Integer irPara = (Integer)drpIrPara.getSelected(); +// dns_next_fase = irPara.intValue(); +// fase = dns_next_fase; +// } + break; + } + +// if(!checkCamposObrigatorios()) +// { +// ok = false; +// getSessionBean1().setMsg("Faltam preencher alguns riscos/valor. Por favor preencha todos os campos antes de prosseguir"); +// } + + if(ok) + { + if(p.getCorrecao().matches("y")) + { + fase = p.getFase_antes_correcao().intValue(); + p.setCorrecao("n"); + p.setObs_correcao(""); + } + + p.setFase(new Integer(fase)); + } + + + return ok; + } + + private boolean checkCamposObrigatorios() + { + boolean res = true; + HashMap valores = getSessionBean1().getRiscosHash(); + Iterator iter = valores.keySet().iterator(); + while(iter.hasNext()) + { + Integer id = iter.next(); +// Valor v = valores.get(id); + Risco r = valores.get(id); + if(r.getResponsavel_execucao() == null) + { + res = false; + break; + } + else if(r.getResponsavel_execucao().trim().length() == 0) + { + res = false; + break; + } + + if(r.getPor() == null) + { + res = false; + break; + } + else if(r.getPor().trim().length() == 0) + { + res = false; + break; + } + + if(r.getRecursos_necessarios() == null) + { + res = false; + break; + } + else if(r.getRecursos_necessarios().trim().length() == 0) + { + res = false; + break; + } + + if(r.getData_inicio() == null) + { + res = false; + break; + } + + if(r.getData_fim() == null) + { + res = false; + break; + } + } + return res; + } + + + private void processEnviar(PlanoActuacao p) throws Exception + { + PlanosDataProvider pdp = new PlanosDataProvider(); + p.setObs_correcao(""); + pdp.updatePlano(p); + enviarMail(p); + } + + + public void enviarMail(PlanoActuacao p) + { + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + Mail mail = new Mail(); + String assunto = ""; + String mail_text = ""; + + int fase = p.getFase().intValue(); + int tipo_utilizador = 0; + switch(fase) + { +// case Global.FASE_SIPRP_EMISSAO: +// break; + + case Global.FASE_SEGURANCA_PREENCHIMENTO: + if(p.getFase_anterior() == null ) + { + assunto = "PLANOS - SEGURANÇA (PREENCHIMENTO)"; + mail_text = "Notifica-se que o Plano passou para a fase Segurança(Preenchimento)"; + } + else + { + switch(p.getFase_anterior().intValue()) + { + case Global.FASE_DIR_LOJA_VALIDACAO: + tipo_utilizador = Global.DIRECTOR_LOJA; + assunto = "Plano de Actuação da Avaliação de Riscos de " + p.getData_visita_str() + " - Pedido de Correcção"; + mail_text = "

Exmo. (a) Senhor (a),

"; + mail_text += "

O Plano de Actuação referente à auditoria de Avaliação de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " foi devolvido para correcção.

"; + mail_text += "

Proceda, por favor, em www.siprp.com à(s) respectiva(s) correcção(ões) de acordo com as indicações e volte a reenviar o processo para a fase seguinte.

"; + mail_text += "

Caso tenha alguma dúvida ou necessite de qualquer esclarecimento, contacte, por favor, a Área Técnica da SIPRP através do telefone 213 504 540.

"; + mail_text += "

Cumprimentos,

"; + mail_text += "

A equipa da SIPRP

"; + mail_text += "

Por favor não responda a esta mensagem, dado tratar-se de um e-mail automático

"; + break; + } + } + break; + + case Global.FASE_DIR_LOJA_VALIDACAO: + tipo_utilizador = Global.DIRECTOR_LOJA; + assunto = "Plano de Actuação da Avaliação de Riscos de " + p.getData_visita_str(); + mail_text = "

Exmo. (a) Senhor (a),

"; + mail_text += "

Encontra-se disponível em www.siprp.com o Plano de Actuação referente à auditoria de "; + mail_text += "Avaliação de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " para que possa "; + mail_text += "validar a informação preenchida.

"; + mail_text += "

Cumprimentos.

"; + mail_text += "

Por favor não responda a esta mensagem, dado tratar-se de um e-mail automático

"; + + break; + + case Global.FASE_DNS_PARECER: + tipo_utilizador = Global.DIRECTOR_NACIONAL_SEGURANCA; + assunto = "Plano de Actuação da Avaliação de Riscos de " + p.getData_visita_str() + " - " + p.getNome_estabelecimento(); + mail_text = "

Exmo. Senhor Silvestre Machado,

"; + mail_text += "

Encontra-se disponível em www.siprp.com o Plano de Actuação referente à auditoria de Avaliação de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " para que o possa validar.

"; + mail_text += "

Cumprimentos.

"; + mail_text += "

Por favor não responda a esta mensagem, dado tratar-se de um e-mail automático

"; + break; + + case Global.FASE_SIPRP_CONCLUSAO: + tipo_utilizador = Global.TECNICO_HS; + assunto = "Plano de Actuação da Avaliação de Riscos de " + p.getData_visita_str() + " - " + p.getNome_estabelecimento(); + mail_text = "

Exmo. (a) Senhor (a),

"; + mail_text += "

Encontra-se disponível em www.siprp.com o Plano de Actuação referente à auditoria de Avaliação de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " para que possa efectuar a sua verificação.

"; + mail_text += "

Por favor não responda a esta mensagem, dado tratar-se de um e-mail automático

"; + break; + + case Global.FASE_CONCLUIDO: + assunto = "Plano de Actuação da Avaliação de Riscos de " + p.getData_visita_str() + " - " + p.getNome_estabelecimento() + " - Processo finalizado"; + mail_text = "

Exmo. (a) Senhor (a),

"; + mail_text += "

Encontra-se disponível em www.siprp.com o Plano de Actuação referente à auditoria de Avaliação de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " finalizado após verificação pelos Técnicos Superiores de Higiene e Segurança da SIPRP.

"; + mail_text += "

Aproveitamos para agradecer toda a disponibilidade e ficamos ao vosso dispor, caso tenha alguma dúvida ou necessite de qualquer esclarecimento, através do telefone 213 504 540.

"; + mail_text += "

Cumprimentos,

"; + mail_text += "

Por favor não responda a esta mensagem, dado tratar-se de um e-mail automático

"; + break; + } + + if(fase < Global.FASE_CONCLUIDO) // nao envia para ninguem na fase Concluido + { + String responsavel_loja = "n"; + if(tipo_utilizador == Global.RESPONSAVEL_SEGURANCA) + { + responsavel_loja = "y"; + } + try + { + ArrayList list = udp.getUtilizadoresListByTipo(tipo_utilizador, responsavel_loja, p.getEstabelecimento_id()); + ListIterator iter = list.listIterator(); + while(iter.hasNext()) + { + Utilizador u = (Utilizador) iter.next(); + System.out.println("USER MAIL NEXT FASE : " + u.getLogin() + " ; " + u.getEmail()); + try + { + mail.send(u.getEmail(), Mail.ENDERECO_ENVIO, assunto, mail_text); + System.out.println("EMAIL ENVIADO !!"); + } + catch(Exception ex1) + { + ErrorLogger.logException( ex1 ); + System.out.println("MAIL ERROR : " + ex1.getMessage()); + } + + } + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + } + else //fase concluido + { + int[] users = new int[]{Global.RESPONSAVEL_SEGURANCA, Global.DIRECTOR_LOJA, Global.DIRECTOR_NACIONAL_SEGURANCA}; + for(int i=0; i < users.length; i++) + { + tipo_utilizador = users[i]; + + String responsavel_loja = "n"; + if(tipo_utilizador == Global.RESPONSAVEL_SEGURANCA) + { + responsavel_loja = "y"; + } + try + { + ArrayList list = udp.getUtilizadoresListByTipo(tipo_utilizador, responsavel_loja, p.getEstabelecimento_id()); + ListIterator iter = list.listIterator(); + while(iter.hasNext()) + { + Utilizador u = (Utilizador) iter.next(); + System.out.println("USER MAIL NEXT FASE : " + u.getLogin() + " ; " + u.getEmail()); + try + { + mail.send(u.getEmail(), Mail.ENDERECO_ENVIO, assunto, mail_text); + System.out.println("EMAIL ENVIADO !!"); + } + catch(Exception ex1) + { + ErrorLogger.logException( ex1 ); + System.out.println("MAIL ERROR : " + ex1.getMessage()); + } + + } + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + + } + } + +// catch(Exception ex) +// { +// //ErrorLogger.logException( ex ); +// } +// Mail mail = new Mail(); +// try +// { +// mail.send("lluis@evolute.pt", Mail.ENDERECO_ENVIO, assunto, mail_text); +// System.out.println("EMAIL ENVIADO !!"); +// } +// catch(Exception ex) +// { +// ErrorLogger.logException( ex ); +// System.out.println("ERRO NO ENVIO DO EMAIL !!"); +// } +// } + + + } + + public void chkValidacao_processValueChange(ValueChangeEvent event) { +// if(chkValidacao.getSelected() != null) +// { +// Boolean selected = (Boolean) chkValidacao.getSelected(); +// if(selected.booleanValue()) +// { +// //txtParecer.setRendered(true); +// gridParecer.setStyleClass("visible"); +// } +// else +// { +// //txtParecer.setRendered(false); +// gridParecer.setStyleClass("hidden"); +// } +// } +// else +// { +// //txtParecer.setRendered(false); +// gridParecer.setStyleClass("hidden"); +// } + } + + public void drpIrPara_processValueChange(ValueChangeEvent event) { + + } + + + private void getRiscosByPlano(PlanoActuacao p) + { + HashMap areasHash = new HashMap(); + HashMap riscosHash = new HashMap(); + + for(Area a : p.getAreas()) + { + areasHash.put(a.getId(), a); + for(Risco r : a.getRiscos()) + { + riscosHash.put(r.getId(), r); + } + } + + getSessionBean1().setAreasHash(areasHash); + getSessionBean1().setRiscosHash(riscosHash); + } + + private void fillValoresHash(PlanoActuacao p) + { + //HashMap valoresHash = new HashMap(); + HashMap riscosHash = new HashMap(); + for(Area a : p.getAreas()) + { + for(Risco r : a.getRiscos()) + { +// for(Valor v : r.getValores()) +// { +// valoresHash.put(v.getId(), v); +// } + riscosHash.put(r.getId(), r); + } + } + //getSessionBean1().setValoresHash(valoresHash); + getSessionBean1().setRiscosHash(riscosHash); + } + + public void paginacao_actionListener(ActionEvent e) + { + Risco curValor = getSessionBean1().getCurrentRisco(); + curValor = fillValorFields(curValor); +// getSessionBean1().getValoresHash().remove(curValor.getId()); +// getSessionBean1().getValoresHash().put(curValor.getId(), curValor); + getSessionBean1().getRiscosHash().remove(curValor.getId()); + getSessionBean1().getRiscosHash().put(curValor.getId(), curValor); + //gridPlano = (HtmlPanelGrid) gridLayout.findComponent("form1:gridPlano"); + gridArea = (HtmlPanelGrid) gridPlano.findComponent("form1:gridArea"); + if(gridArea.getChildren() != null) + { + gridArea.getChildren().clear(); + } + Pagina pagina = (Pagina) e.getSource(); + Pagination pagination = getSessionBean1().getPagination(); +// Valor v = pagination.getValor(pagina); +// v = getSessionBean1().getValoresHash().get(v.getId()); + Risco r = pagination.getValor(pagina); + r = getSessionBean1().getRiscosHash().get(r.getId()); + + //Risco r = getSessionBean1().getRiscosHash().get(v.getRisco_id()); + /////////Risco r = getSessionBean1().getRiscosHash().get(v.getRisco_id()); + //Risco r = pagination.getRisco(pagina); + Area a = getSessionBean1().getAreasHash().get( r.getArea_id() ); + showArea(a); + showRisco(r); + showValor(r); + showResponsavel(r); + } + + public String butCancelar_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + return "lista_planos"; + + } + + public String butLimparDados_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + gridArea = (HtmlPanelGrid) gridPlano.findComponent("form1:gridArea"); + gridResponsavel = (HtmlPanelGrid) gridArea.findComponent("form1:gridResponsavel"); + PlanoActuacao p = getSessionBean1().getPlanoActuacao(); + int fase = p.getFase().intValue(); + switch(fase) + { + case Global.FASE_SEGURANCA_PREENCHIMENTO: + TextField txtResponsavel = (TextField) gridResponsavel.findComponent("form1:pgResponsavel:txtResponsavel"); + TextArea txtRecursos = (TextArea) gridResponsavel.findComponent("form1:txtRecursos"); + Calendar dtInicio = (Calendar) gridResponsavel.findComponent("form1:dtInicio:"); + Calendar dtFim = (Calendar) gridResponsavel.findComponent("form1:dtFim"); + txtResponsavel.setText(""); + txtRecursos.setText(""); + dtInicio.setValue(null); + dtFim.setValue(null); + break; + + case Global.FASE_DIR_LOJA_VALIDACAO: + TextArea txtParecerDl = (TextArea) gridResponsavel.findComponent("form1:txtParecerDl"); + txtParecerDl.setText(""); + PanelGroup pg = (PanelGroup) gridObservacoes.findComponent("pgObsDl"); + if(pg != null) + { + TextArea txtObs = (TextArea) pg.findComponent("txtObservacoesDl"); + txtObs.setText(""); + } + break; + + case Global.FASE_DNS_PARECER: + TextArea txtParecerDns = (TextArea) gridResponsavel.findComponent("form1:txtParecerDns"); + txtParecerDns.setText(""); + pg = (PanelGroup) gridObservacoes.findComponent("pgObsDns"); + if(pg != null) + { + TextArea txtObs = (TextArea) pg.findComponent("txtObservacoesDns"); + txtObs.setText(""); + } + break; + + case Global.FASE_SIPRP_CONCLUSAO: + TextArea txtVerificacaoSiprp = (TextArea) gridResponsavel.findComponent("form1:txtVerificacaoSiprp"); + txtVerificacaoSiprp.setText(""); + break; + } + + return null; + } + + public String butEnviarCorrecao_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + System.out.println("BUT ENVIAR CORRECAO"); + return "enviar_correcao"; + } + + + +} + diff --git a/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/EnviarCorrecao.java b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/EnviarCorrecao.java new file mode 100644 index 00000000..a03d9d30 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/EnviarCorrecao.java @@ -0,0 +1,367 @@ +/* + * EnviarCorrecao.java + * + * Created on Nov 13, 2008, 11:26:00 AM + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import com.sun.rave.web.ui.appbase.AbstractPageBean; +import com.sun.webui.jsf.component.Button; +import com.sun.webui.jsf.component.DropDown; +import com.sun.webui.jsf.component.StaticText; +import com.sun.webui.jsf.component.TextArea; +import com.sun.webui.jsf.model.Option; +import db.entidades.PlanoActuacao; +import db.entidades.Utilizador; +import db.providers.PlanosDataProvider; +import db.providers.UtilizadoresDataProvider; +import global.Global; +import java.util.ArrayList; +import java.util.ListIterator; +import javax.faces.FacesException; +import javax.faces.event.ValueChangeEvent; +import mail.Mail; + +/** + *

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.

+ * + * @author lluis + */ +public class EnviarCorrecao extends AbstractPageBean { + // + + /** + *

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 StaticText lblMsg = new StaticText(); + + public StaticText getLblMsg() { + return lblMsg; + } + + public void setLblMsg(StaticText st) { + this.lblMsg = st; + } + private TextArea txtObservacoes = new TextArea(); + + public TextArea getTxtObservacoes() { + return txtObservacoes; + } + + public void setTxtObservacoes(TextArea ta) { + this.txtObservacoes = ta; + } + private DropDown drpIrPara = new DropDown(); + + public DropDown getDrpIrPara() { + return drpIrPara; + } + + public void setDrpIrPara(DropDown dd) { + this.drpIrPara = dd; + } + private Button butCancelar = new Button(); + + public Button getButCancelar() { + return butCancelar; + } + + public void setButCancelar(Button b) { + this.butCancelar = b; + } + private Button butEnviar = new Button(); + + public Button getButEnviar() { + return butEnviar; + } + + public void setButEnviar(Button b) { + this.butEnviar = b; + } + + //
+ + /** + *

Construct a new Page bean instance.

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

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.

+ */ + @Override + 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) { + ErrorLogger.logException( e ); + log("EnviarCorrecao 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.

+ */ + @Override + 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.

+ */ + @Override + public void prerender() { + initialize(); + lblMsg.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).

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

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1) getBean("SessionBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1) getBean("RequestBean1"); + } + + public void drpIrPara_processValueChange(ValueChangeEvent event) { + } + + private void initialize() + { + Utilizador u = getSessionBean1().getCurrentUser(); + com.sun.webui.jsf.model.Option[] listOptions = null; + + if(u.getTipo().intValue() == Global.DIRECTOR_LOJA) + { + listOptions = new com.sun.webui.jsf.model.Option[1]; + listOptions[0] = new Option(new Integer(Global.FASE_SEGURANCA_PREENCHIMENTO), "Responsável de segurança"); + } + else if(u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA) + { + listOptions = new com.sun.webui.jsf.model.Option[2]; + listOptions[0] = new Option(new Integer(Global.FASE_SEGURANCA_PREENCHIMENTO), "Responsável de segurança"); + listOptions[1] = new Option(new Integer(Global.FASE_DIR_LOJA_VALIDACAO), "Director de loja"); + } + + getSessionBean1().setIrParaOptions(listOptions); + getSessionBean1().setIrParaChoice(new Integer( Global.FASE_SEGURANCA_PREENCHIMENTO )); + //drpIrPara.setItems(listOptions); + //drpIrPara.setSelected(new Integer( Global.FASE_SEGURANCA_PREENCHIMENTO )); + } + + public String butCancelar_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + return "editar_plano"; + } + + public String butEnviar_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + Utilizador u = getSessionBean1().getCurrentUser(); + PlanosDataProvider pdp = new PlanosDataProvider(); + PlanoActuacao p = getSessionBean1().getPlanoActuacao(); + p.setFase_anterior(p.getFase()); + int dns_next_fase = 0; + int fase = 0; + Integer irPara = (Integer)drpIrPara.getSelected(); + fase = irPara.intValue(); + if(u.getTipo().intValue() == Global.DIRECTOR_LOJA) + { + p.setValidacao_director_loja(new Boolean(false)); + } + else if(u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA) + { + p.setValidacao_dns(new Boolean(false)); + } + p.setCorrecao("y"); + p.setFase_antes_correcao(p.getFase()); + p.setFase(new Integer(fase)); + String observacoes = ""; + if(txtObservacoes.getText() != null) + { + if(u.getTipo().intValue() == Global.DIRECTOR_LOJA) + { + observacoes = "Observações do Director de Loja: "; + } + else if(u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA) + { + observacoes = "Observações do Director Nacional de Segurança: "; + } + observacoes += (String)txtObservacoes.getText(); + p.setObs_correcao(observacoes); + } + try + { + pdp.updatePlano(p); + enviarMail(p); + return "lista_planos"; + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + getSessionBean1().setMsg("Erro no envio do plano para a fase " + Global.FASES_TEXTO[fase-1]); + } + return null; + } + + private void enviarMail(PlanoActuacao p) + { + String assunto = ""; + String mail_text = ""; + + int fase = p.getFase().intValue(); + int tipo_utilizador = 0; + switch(fase) + { + case Global.FASE_SEGURANCA_PREENCHIMENTO: + tipo_utilizador = Global.RESPONSAVEL_SEGURANCA; + assunto = "Plano de Actuação da Avaliação de Riscos de " + p.getData_visita_str() + " - Pedido de Correcção"; + mail_text = "

Exmo. (a) Senhor (a),

"; + mail_text += "

O Plano de Actuação referente à auditoria de Avaliação de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " foi devolvido para correcção.

"; + mail_text += "

Proceda, por favor, em www.siprp.com à(s) respectiva(s) correcção(ões) de acordo com as indicações e volte a reenviar o processo para a fase seguinte.

"; + mail_text += "

Caso tenha alguma dúvida ou necessite de qualquer esclarecimento, contacte, por favor, a Área Técnica da SIPRP através do telefone 213 504 540.

"; + mail_text += "

Cumprimentos,

"; + mail_text += "

A equipa da SIPRP

"; + mail_text += "

Por favor não responda a esta mensagem, dado tratar-se de um e-mail automático

"; + break; + + case Global.FASE_DIR_LOJA_VALIDACAO: + tipo_utilizador = Global.DIRECTOR_LOJA; + assunto = "Plano de Actuação da Avaliação de Riscos de " + p.getData_visita_str() + " - Pedido de Correcção"; + mail_text = "

Exmo. (a) Senhor (a),

"; + mail_text += "

O Plano de Actuação referente à auditoria de Avaliação de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " foi devolvido para correcção.

"; + mail_text += "

Proceda, por favor, em www.siprp.com à(s) respectiva(s) correcção(ões) de acordo com as indicações do Director Nacional de Segurança e volte a reenviar o processo para a fase seguinte.

"; + mail_text += "

Cumprimentos.

"; + mail_text += "

Por favor não responda a esta mensagem, dado tratar-se de um e-mail automático

"; + break; + } + + Mail mail = new Mail(); + + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + String responsavel_loja = "n"; + if(tipo_utilizador == Global.RESPONSAVEL_SEGURANCA) + { + responsavel_loja = "y"; + } + try + { + ArrayList list = udp.getUtilizadoresListByTipo(tipo_utilizador, responsavel_loja, p.getEstabelecimento_id()); + ListIterator iter = list.listIterator(); + while(iter.hasNext()) + { + Utilizador u = (Utilizador) iter.next(); + System.out.println("USER MAIL NEXT FASE : " + u.getLogin() + " ; " + u.getEmail()); + try + { + mail.send(u.getEmail(), Mail.ENDERECO_ENVIO, assunto, mail_text); + System.out.println("EMAIL ENVIADO !!"); + } + catch(Exception ex1) + { + ErrorLogger.logException( ex1 ); + System.out.println("MAIL ERROR : " + ex1.getMessage()); + } + + } + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + +// +// +// +// +// try +// { +// mail.send("lluis@evolute.pt", Mail.ENDERECO_ENVIO, assunto, mail_text); +// System.out.println("EMAIL ENVIADO !!"); +// } +// catch(Exception ex) +// { +// ErrorLogger.logException( ex ); +// System.out.println("ERRO NO ENVIO DO EMAIL !!"); +// } + } + +} + diff --git a/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Erro.java b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Erro.java new file mode 100644 index 00000000..895eaa51 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Erro.java @@ -0,0 +1,153 @@ +/* + * Erro.java + * + * Created on Aug 26, 2008, 10:54:11 AM + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import com.sun.rave.web.ui.appbase.AbstractPageBean; +import com.sun.webui.jsf.component.StaticText; +import javax.faces.FacesException; + +/** + *

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.

+ * + * @author lluis + */ +public class Erro extends AbstractPageBean { + // + + /** + *

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 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.

+ */ + @Override + 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) { + ErrorLogger.logException( e ); + log("Erro 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.

+ */ + @Override + 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.

+ */ + @Override + 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).

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

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1) getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1) getBean("SessionBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + +} + diff --git a/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Footer.java b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Footer.java new file mode 100644 index 00000000..1f529e12 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Footer.java @@ -0,0 +1,141 @@ +/* + * Footer.java + * + * Created on Oct 6, 2008, 3:01:32 PM + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import com.sun.rave.web.ui.appbase.AbstractPageBean; +import javax.faces.FacesException; + +/** + *

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.

+ * + * @author lluis + */ +public class Footer extends AbstractPageBean { + // + + /** + *

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 Page bean instance.

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

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.

+ */ + @Override + 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) { + ErrorLogger.logException( e ); + log("Footer 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.

+ */ + @Override + 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.

+ */ + @Override + 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).

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

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1) getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1) getBean("SessionBean1"); + } + +} + diff --git a/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Header.java b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Header.java new file mode 100644 index 00000000..ab06a77b --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Header.java @@ -0,0 +1,252 @@ +/* + * Header.java + * + * Created on Oct 6, 2008, 10:35:36 AM + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import com.sun.rave.web.ui.appbase.AbstractFragmentBean; +import com.sun.webui.jsf.component.ImageComponent; +import com.sun.webui.jsf.component.StaticText; +import db.entidades.Utilizador; +import global.Global; +import javax.faces.FacesException; +import javax.faces.context.FacesContext; +import utils.JSFHTTPUtils; +import utils.JSFUtils; + +/** + *

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.

+ * + * @author lluis + */ +public class Header extends AbstractFragmentBean { + // + + /** + *

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 StaticText stDataPlano = new StaticText(); + + public StaticText getStDataPlano() { + return stDataPlano; + } + + public void setStDataPlano(StaticText st) { + this.stDataPlano = st; + } + private ImageComponent imgLogoEmpresa = new ImageComponent(); + + public ImageComponent getImgLogoEmpresa() { + return imgLogoEmpresa; + } + + public void setImgLogoEmpresa(ImageComponent ic) { + this.imgLogoEmpresa = ic; + } + //
+ + 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.

+ */ + @Override + 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 + + FacesContext fc = getFacesContext(); + String referer = JSFHTTPUtils.getReferer(fc); + System.out.println("HEADER - REFERER : " + referer); + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + ErrorLogger.logException( 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.

+ */ + @Override + public void destroy() { + } + + public String lnkLogout_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + FacesContext fc = getFacesContext(); + try + { + JSFUtils.logout(fc); + //JSFUtils.navigateTo(fc, "login"); + try + { + //JSFUtils.redirect(fc, "http://localhost:8084/AnaliseAcidentesTrabalho/faces/Login.jsp"); + JSFUtils.redirect(fc, Global.ANALISE_ACIDENTES_URL + "Login.jsp"); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + return null; + } + + public String lnkAnaliseAcidentes_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + + FacesContext fc = getFacesContext(); + SessionBean1 session = JSFUtils.getSessionBean(fc); + Utilizador u = session.getCurrentUser(); + + String url = Global.ANALISE_ACIDENTES_URL; + int tipo = u.getTipo().intValue(); + switch(tipo) + { + case Global.RESPONSAVEL_SEGURANCA: + url += "FormSeguranca.jsp?user=" + u.getId().intValue(); + break; + + case Global.RH: + url += "FormRH.jsp?user=" + u.getId().intValue(); + break; + + case Global.TECNICO_HS: + url += "FormHS.jsp?user=" + u.getId().intValue(); + break; + + case Global.GESTOR: + url += "FormGestor.jsp?user=" + u.getId().intValue(); + break; + + case Global.DIRECTOR_LOJA: + url += "FormGestor.jsp?user=" + u.getId().intValue(); + break; + case Global.DIRECTOR_GERAL_RH: + url += "FormDirGerRh.jsp?user=" + u.getId().intValue(); + break; + + case Global.DIRECTOR_SIPRP: + url += "FormDirSiprp.jsp?user=" + u.getId().intValue(); + break; + + case Global.DIRECTOR_NACIONAL_SEGURANCA: + url += "FormGestor.jsp?user=" + u.getId().intValue(); + break; + } + + try + { + JSFUtils.redirect(fc.getCurrentInstance(), url); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + return null; + } + + public String lnkPlanosActuacao1_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + return "lista_planos"; + } + + public String lnkGerirUtilizadores1_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + FacesContext fc = getFacesContext(); + SessionBean1 session = JSFUtils.getSessionBean(fc); + Utilizador u = session.getCurrentUser(); + + String url = Global.ANALISE_ACIDENTES_URL; + int tipo = u.getTipo().intValue(); + + url += "GestaoUtilizadores.jsp?user=" + u.getId().intValue(); + try + { + JSFUtils.redirect(fc.getCurrentInstance(), url); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + + return null; + } + + public String lnkDadosUtilizador1_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + FacesContext fc = getFacesContext(); + SessionBean1 session = JSFUtils.getSessionBean(fc); + Utilizador u = session.getCurrentUser(); + + String url = Global.ANALISE_ACIDENTES_URL; + int tipo = u.getTipo().intValue(); + + url += "FichaUtilizador.jsp?user=" + u.getId().intValue() + "&mode=edit"; + try + { + JSFUtils.redirect(fc.getCurrentInstance(), url); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + + return null; + } + + public String lnkAjuda_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + return "planos_actuacao_ajuda.pdf"; + } + + +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/ListaPlanos.java b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/ListaPlanos.java new file mode 100644 index 00000000..4d615afb --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/ListaPlanos.java @@ -0,0 +1,1071 @@ +/* + * ListaPlanos.java + * + * Created on Aug 29, 2008, 2:57:16 PM + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import com.evolute.utils.timer.TimedEvent; +import com.evolute.utils.timer.Timer; +import com.sun.data.provider.RowKey; +import com.sun.rave.web.ui.appbase.AbstractPageBean; +import com.sun.webui.jsf.component.Button; +import com.sun.webui.jsf.component.PanelGroup; +import com.sun.webui.jsf.component.Table; +import com.sun.webui.jsf.component.TableColumn; +import com.sun.webui.jsf.component.TableRowGroup; +import com.sun.webui.jsf.component.TextField; +import db.Dblocal; +import db.entidades.PlanoActuacao; +import db.providers.UtilizadoresDataProvider; +import db.entidades.Utilizador; +import db.providers.PlanosDataProvider; +import global.Global; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; +import siprp.database.cayenne.providers.PlanoActuacaoDAO; +import siprp.planoactuacao.print.PlanoActuacaoPDFCreator; +import tabledataproviders.PlanosActualDataProvider; +import tabledataproviders.PlanosConcluidosDataProvider; +import tabledataproviders.PlanosSeguimentoDataProvider; +import utils.JSFUtils; + +/** + *

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.

+ * + * @author lluis + */ +public class ListaPlanos extends AbstractPageBean { + // + + /** + *

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 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 TableRowGroup tableRowGroup2 = new TableRowGroup(); + + public TableRowGroup getTableRowGroup2() { + return tableRowGroup2; + } + + public void setTableRowGroup2(TableRowGroup trg) { + this.tableRowGroup2 = trg; + } + private TableRowGroup tableRowGroup3 = new TableRowGroup(); + + public TableRowGroup getTableRowGroup3() { + return tableRowGroup3; + } + + public void setTableRowGroup3(TableRowGroup trg) { + this.tableRowGroup3 = trg; + } + + + private HtmlPanelGrid gridActual = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridActual() { + return gridActual; + } + + public void setGridActual(HtmlPanelGrid hpg) { + this.gridActual = hpg; + } + + private TableColumn tableColumn55 = new TableColumn(); + + public TableColumn getTableColumn55() + { + return tableColumn55; + } + + public void setTableColumn55( TableColumn c ) + { + this.tableColumn55 = c; + } + + private Button buttonDesactivar = new Button(); + + public Button getButtonDesactivar() { + return buttonDesactivar; + } + + public void setButtonDesactivar( Button b ) { + this.buttonDesactivar = b; + } + + + private TableColumn tableColumn56 = new TableColumn(); + + public TableColumn getTableColumn56() + { + return tableColumn56; + } + + public void setTableColumn56( TableColumn c ) + { + this.tableColumn56 = c; + } + + private Button buttonDesactivarSeguimento = new Button(); + + public Button getButtonDesactivarSeguimento() { + return buttonDesactivarSeguimento; + } + + public void setButtonDesactivarSeguimento( Button b ) { + this.buttonDesactivarSeguimento = b; + } + + private HtmlPanelGrid gridPanelFilterActual = new HtmlPanelGrid(); + public HtmlPanelGrid getGridPanelFilterActual() + { + return this.gridPanelFilterActual; + } + public void setGridPanelFilterActual( HtmlPanelGrid pg ) + { + this.gridPanelFilterActual = pg; + } + + private PanelGroup groupPanelFilterActual = new PanelGroup(); + public PanelGroup getGroupPanelFilterActual() + { + return this.groupPanelFilterActual; + } + public void setGroupPanelFilterActual( PanelGroup pg ) + { + this.groupPanelFilterActual = pg; + } + + private TextField textFilterNameActual = new TextField(); + public TextField getTextFilterNameActual() + { + return this.textFilterNameActual; + } + public void setTextFilterNameActual( TextField tf ) + { + this.textFilterNameActual = tf; + } + + private TextField textFilterEstabelecimentoActual = new TextField(); + + public TextField getTextFilterEstabelecimentoActual() { + return textFilterEstabelecimentoActual; + } + public void setTextFilterEstabelecimentoActual(TextField textFilterEstabelecimentoActual) { + this.textFilterEstabelecimentoActual = textFilterEstabelecimentoActual; + } + + private com.sun.webui.jsf.component.Calendar calFilterDateActual = new com.sun.webui.jsf.component.Calendar(); + public com.sun.webui.jsf.component.Calendar getCalFilterDateActual() { + return calFilterDateActual; + } + public void setCalFilterDateActual(com.sun.webui.jsf.component.Calendar calFilterDateActual) { + this.calFilterDateActual = calFilterDateActual; + } + + private Button buttonFilterActual = new Button(); + public Button getButtonFilterActual() + { + return this.buttonFilterActual; + } + public void setButtonFilterActual( Button b ) + { + this.buttonFilterActual = b; + } + + + + private HtmlPanelGrid gridPanelFilterSeg = new HtmlPanelGrid(); + public HtmlPanelGrid getGridPanelFilterSeg() + { + return this.gridPanelFilterSeg; + } + public void setGridPanelFilterSeg( HtmlPanelGrid pg ) + { + this.gridPanelFilterSeg = pg; + } + + private PanelGroup groupPanelFilterSeg = new PanelGroup(); + public PanelGroup getGroupPanelFilterSeg() + { + return this.groupPanelFilterSeg; + } + public void setGroupPanelFilterSeg( PanelGroup pg ) + { + this.groupPanelFilterSeg = pg; + } + + private TextField textFilterNameSeg = new TextField(); + public TextField getTextFilterNameSeg() + { + return this.textFilterNameSeg; + } + public void setTextFilterNameSeg( TextField tf ) + { + this.textFilterNameSeg = tf; + } + + private TextField textFilterEstabelecimentoSeg = new TextField(); + + public TextField getTextFilterEstabelecimentoSeg() { + return textFilterEstabelecimentoSeg; + } + public void setTextFilterEstabelecimentoSeg(TextField textFilterEstabelecimentoSeg) { + this.textFilterEstabelecimentoSeg = textFilterEstabelecimentoSeg; + } + + private com.sun.webui.jsf.component.Calendar calFilterDateSeg = new com.sun.webui.jsf.component.Calendar(); + public com.sun.webui.jsf.component.Calendar getCalFilterDateSeg() { + return calFilterDateSeg; + } + public void setCalFilterDateSeg(com.sun.webui.jsf.component.Calendar calFilterDateSeg) { + this.calFilterDateSeg = calFilterDateSeg; + } + + private Button buttonFilterSeg = new Button(); + public Button getButtonFilterSeg() + { + return this.buttonFilterSeg; + } + public void setButtonFilterSeg( Button b ) + { + this.buttonFilterSeg = b; + } + + + private HtmlPanelGrid gridPanelFilterConc = new HtmlPanelGrid(); + public HtmlPanelGrid getGridPanelFilterConc() + { + return this.gridPanelFilterConc; + } + public void setGridPanelFilterConc( HtmlPanelGrid pg ) + { + this.gridPanelFilterConc = pg; + } + + private PanelGroup groupPanelFilterConc = new PanelGroup(); + public PanelGroup getGroupPanelFilterConc() + { + return this.groupPanelFilterConc; + } + public void setGroupPanelFilterConc( PanelGroup pg ) + { + this.groupPanelFilterConc = pg; + } + + private TextField textFilterNameConc = new TextField(); + public TextField getTextFilterNameConc() + { + return this.textFilterNameConc; + } + public void setTextFilterNameConc( TextField tf ) + { + this.textFilterNameConc = tf; + } + + private TextField textFilterEstabelecimentoConc = new TextField(); + + public TextField getTextFilterEstabelecimentoConc() { + return textFilterEstabelecimentoConc; + } + public void setTextFilterEstabelecimentoConc(TextField textFilterEstabelecimentoConc) { + this.textFilterEstabelecimentoConc = textFilterEstabelecimentoConc; + } + + private com.sun.webui.jsf.component.Calendar calFilterDateConc = new com.sun.webui.jsf.component.Calendar(); + public com.sun.webui.jsf.component.Calendar getCalFilterDateConc() { + return calFilterDateConc; + } + public void setCalFilterDateConc(com.sun.webui.jsf.component.Calendar calFilterDateConc) { + this.calFilterDateConc = calFilterDateConc; + } + + private Button buttonFilterConc = new Button(); + public Button getButtonFilterConc() + { + return this.buttonFilterConc; + } + public void setButtonFilterConc( Button b ) + { + this.buttonFilterConc = b; + } + + private static final DateFormat D_F = new SimpleDateFormat( "yyyy-MM-dd" ); + //
+ + PlanosDataProvider pdp = new PlanosDataProvider(); + + /** + *

Construct a new Page bean instance.

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

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.

+ */ + @Override + 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) { + ErrorLogger.logException( e ); + log("ListaPlanos 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.

+ */ + @Override + 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.

+ */ + @Override + public void prerender() { + //UIComponent emptyCol = tableRowGroup1.getEmptyDataText(); + System.out.println("LISTA PLANOS - PRERENDER"); + + FacesContext fc = getFacesContext(); + String user_id = JSFUtils.getRequestParameter(fc, "user"); + String estab_gestor = JSFUtils.getRequestParameter(fc, "estab_gestor"); + System.out.println("LISTA PLANOS - USER ID : " + user_id); + Utilizador u = null; + if(user_id != null) + { + + try + { + Integer userId = new Integer(Integer.parseInt(user_id)); + + try + { + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + udp.checkConnection(); + u = udp.getUtilizador(userId); + if(u.getTipo().intValue() == Global.GESTOR) + { + try + { + Integer estabelecimento_gestor = new Integer(Integer.parseInt(estab_gestor)); + System.out.println("ESTABELECIMENTO GESTOR : " + estabelecimento_gestor.intValue()); + u.setEstabelecimento_gestor(estabelecimento_gestor); + } + catch(Exception ex2) + { + ErrorLogger.logException( ex2 ); + } + + } + getSessionBean1().setCurrentUser(u); + + + } + catch(Exception ex1) + { + ErrorLogger.logException( ex1 ); + } + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + + } + + u = getSessionBean1().getCurrentUser(); + if(u.getTipo().intValue() == Global.DIRECTOR_SIPRP || u.getTipo().intValue() == Global.RH || u.getTipo().intValue() == Global.DIRECTOR_GERAL_RH || u.getTipo().intValue() == Global.GESTOR) + { + gridActual.setRendered(false); + tableRowGroup2.setEmptyDataMsg("Sem registos"); + tableRowGroup3.setEmptyDataMsg("Sem registos"); + } + + if(u.getTipo().intValue() != Global.DIRECTOR_SIPRP && u.getTipo().intValue() != Global.RH && u.getTipo().intValue() != Global.DIRECTOR_GERAL_RH) + { + getSessionBean1().setDisableMenuUtilizadores(true); + tableRowGroup1.setEmptyDataMsg("Sem registos"); + tableRowGroup2.setEmptyDataMsg("Sem registos"); + tableRowGroup3.setEmptyDataMsg("Sem registos"); + } + + + //Column para desactivar plano - mostra se o utilizador for DIRECTOR SIPRP + int uType = u.getTipo().intValue(); + boolean renderOrNot = uType == Global.DIRECTOR_SIPRP || uType == Global.TECNICO_HS; + tableColumn55.setRendered( renderOrNot ); + buttonDesactivar.setRendered( renderOrNot ); + + tableColumn56.setRendered( renderOrNot ); + buttonDesactivarSeguimento.setRendered( renderOrNot ); + + + initialize(); + + } + + /** + *

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).

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

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1) getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1) getBean("SessionBean1"); + } + + public String hyperlink1_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + return "editar_plano"; + } + + //TODO: + public String goDesactivarPlano_action() + { + System.out.println( "\ngoDesactivarPlano_action():" ); + PlanoActuacao p = getTableActivosRowData(); + desactivarPlano( p ); +// System.out.println( "\tPlanoActuacao: " + p.getId() ); + return null; + } + + //TODO: + public String goDesactivarPlanoSeguimento_action() + { + System.out.println( "\ngoDesactivarPlanoSeguimento_action():" ); + PlanoActuacao p = getTableSeguimentoRowData(); + desactivarPlano( p ); +// System.out.println( "\tPlanoActuacao: " + p.getId() ); + return null; + } + + private void desactivarPlano( PlanoActuacao p ) + { + Utilizador currentUser = getSessionBean1().getCurrentUser(); + if ( currentUser.getTipo().intValue() == Global.DIRECTOR_SIPRP || currentUser.getTipo().intValue() == Global.TECNICO_HS ) + { + p.setFase( Global.FASE_CONCLUIDO ); + p.setConcluidoPorDesactivacao( Boolean.TRUE ); + p.setDataDesactivacao( new Date() ); + try + { + pdp.updatePlano( p ); + } + catch ( Exception e ) + { + ErrorLogger.logException( e ); + } + } + + + } + + + public String goEditarPlano_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + PlanoActuacao p = getTableActivosRowData(); + getSessionBean1().setPlanoActuacao(p); + + + //showPlano(p); + //dummy + //getSessionBean1().setFase(2); + return "editar_plano"; + } + + public String goVerPlanoFromSeguimento_action(){ + PlanoActuacao p = getTableSeguimentoRowData(); + getSessionBean1().setPlanoActuacao(p); + return "ver_plano"; + } + + public String goVerPlanoFromConcluidos_action(){ + PlanoActuacao p = getTableConcluidosRowData(); + getSessionBean1().setPlanoActuacao(p); + return "ver_plano"; + } + + private void createPdf( Integer pID ) + { + PlanoActuacaoPDFCreator pdfCreator = new PlanoActuacaoPDFCreator(); + try + { + byte[] pdf = pdfCreator.createPDF( pID, true ); + showPdf( pdf ); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + } + + public String goImprimirPlano_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + PlanoActuacao p = getTableActivosRowData(); + createPdf( p.getId() ); + + return null; + } + + public String goImprimirPlanoFromSeguimento_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + PlanoActuacao p = getTableSeguimentoRowData(); + createPdf( p.getId() ); + + return null; + } + + public String goImprimirPlanoFromConcluidos_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + PlanoActuacao p = getTableConcluidosRowData(); + if ( ! p.getConcluidoPorDesactivacao() ) + { + createPdf( p.getId() ); + } + + return null; + } + + private void showPdf(byte[] pdf) throws Exception + { +// FacesContext fc = getFacesContext(); +// HttpServletResponse response = (HttpServletResponse) fc.getExternalContext().getResponse(); +// response.setContentType("application/pdf"); +// //response.getOutputStream().flush(); +// response.flushBuffer(); +// response.getOutputStream().write(pdf, 0, pdf.length); +// fc.getResponseComplete(); + + System.out.println("PDF LEN : " + pdf.length); + +FacesContext context = FacesContext.getCurrentInstance(); + HttpServletResponse response = +(HttpServletResponse)context.getExternalContext().getResponse(); + + response.setHeader("Expires", "0"); + response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0"); +//response.setHeader("Content-disposition","inline; filename=kiran.pdf"); + response.setHeader("Pragma", "public"); + response.setContentType( "application/pdf" ); +//response.setHeader("Content-Disposition", "attachment;filename=\"ContactList.pdf\""); + response.addHeader("Content-disposition", "attachment;filename=\"Plano.pdf\""); + + //response.setHeader("Content-disposition", "filename=plano.pdf"); + response.setContentLength(pdf.length); + //try { + response.getOutputStream().write(pdf); + response.getOutputStream().flush(); + response.getOutputStream().close(); + context.responseComplete(); +// } catch (IOException e) { +// ErrorLogger.logException( e ); +// } + System.out.println("SHOW PDF"); + } + + + private void initialize() + { + try + { + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + + if(!getApplicationBean1().isTimerStarted()) + { + Timer.scheduleEvent(new TimedEvent(){ + public void executeAction() throws Exception + { + try + { + PlanosActuacao planos = new PlanosActuacao(); + } + catch( Exception ex ) + { + + } + Timer.resetEvent( this ); + } + }, 300); + getApplicationBean1().setTimerStarted(true); + + } + + + + + Utilizador u = getSessionBean1().getCurrentUser(); + + Integer estabelecimento_id = null; + if(u.getTipo().intValue() != Global.TECNICO_HS) + { + estabelecimento_id = u.getEstabelecimento_id(); + } + PlanoActuacaoDAO pa = new PlanoActuacaoDAO(); + + List list = new ArrayList(); + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.DAY_OF_MONTH, 27); + calendar.set(Calendar.MONTH, 9); + calendar.set(Calendar.YEAR, 2008); + java.util.Date date = new java.util.Date(calendar.getTimeInMillis()); + +// list.add(date); +// List listPlanos = pa.getRelatoriosNotIn(list); +// System.out.println("PLANOS = " + listPlanos.size()); +// Iterator iter = listPlanos.iterator(); +// while(iter.hasNext()) +// { +// HsRelatorio relatorio = (HsRelatorio) iter.next(); +// +// List relatorio_riscoList = relatorio.getHsRelatorioRiscoArray(); +// HsRelatorioRisco rr = null; +// HsRelatorioMedida rm = null; +// +// +// //next is to get estabelecimento from relatorio +// +//// MarcacoesEstabelecimento me = relatorio.getToHsMarcacoesEstabelecimento(); +//// Estabelecimentos es = me.getToEstabelecimentos(); +//// Integer id = es.getId(); // estabelecimento id ?? +// } + + ////PlanosActuacao planos = new PlanosActuacao(u); + + + + System.out.println( "INITIALIZE:" ); + + if ( ! getSessionBean1().getIsSearchingPlanosActuacao() ) + { + System.out.println( "\tGETTING INITIAL VALUES FOR EACH TABLE." ); + + List listPlanosActivos = getPlanosActivos(u); + getSessionBean1().getPlanosActualDataProvider().setList(listPlanosActivos); + + List listPlanosSeguimento = getPlanosSeguimento(u); + getSessionBean1().getPlanosSeguimentoDataProvider().setList(listPlanosSeguimento); + + List listPlanosConcluidos = getPlanosConcluidos(u); + getSessionBean1().getPlanosConcluidosDataProvider().setList(listPlanosConcluidos); + } + //checkPlanosDelayed(); + } + + + + + private PlanoActuacao getTableActivosRowData() + { + RowKey rk = tableRowGroup1.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + PlanosActualDataProvider provider = (PlanosActualDataProvider) tableRowGroup1.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + PlanoActuacao p = (PlanoActuacao)list.get(k); + return p; + } + + private PlanoActuacao getTableSeguimentoRowData() + { + RowKey rk = tableRowGroup2.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + PlanosSeguimentoDataProvider provider = (PlanosSeguimentoDataProvider) tableRowGroup2.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + PlanoActuacao p = (PlanoActuacao)list.get(k); + + return p; + } + + private PlanoActuacao getTableConcluidosRowData() + { + RowKey rk = tableRowGroup3.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + PlanosConcluidosDataProvider provider = (PlanosConcluidosDataProvider) tableRowGroup3.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + PlanoActuacao p = (PlanoActuacao)list.get(k); + return p; + } + + private void checkPlanosDelayed() + { + + } + + + +// private void showPlano(PlanoActuacao p) +// { +// System.out.println("PLANO : " + p.getData_visita_str() + " | " + p.getFase_nome() + " | " + p.getNome_estabelecimento()); +// System.out.println("================================================================="); +// showAreas(p.getAreas()); +// System.out.println("================================================================="); +// } +// +// private void showAreas(List areas) +// { +// for(Area a : areas) +// { +// System.out.println(" " + a.getDescricao()); +// showRiscos(a.getRiscos()); +// } +// } +// +// private void showRiscos(List riscos) +// { +// for(Risco r : riscos) +// { +// System.out.println(" " + r.getDescricao()); +// showValores(r.getValores()); +// } +// } +// +// private void showValores(List valores) +// { +// for(Valor v : valores) +// { +// System.out.println(" " + v.getValor()); +// showMedidas(v.getMedidas()); +// } +// } +// +// private void showMedidas(List medidas) +// { +// for(Medida m : medidas) +// { +// System.out.println(" " + m.getDescricao()); +// showPostos(m.getPostos()); +// } +// } +// +// private void showPostos(List postos) +// { +// for(PostoTrabalho p : postos) +// { +// System.out.println(" " + p.getDescricao()); +// } +// } + + public List< PlanoActuacao > searchPlanosActivos( Utilizador u, String nome, String estabelecimento, String dataVisita ) + { + List< PlanoActuacao > list = new ArrayList< PlanoActuacao >(); + try + { + if ( u.getTipo().intValue() != Global.DIRECTOR_SIPRP + && u.getTipo().intValue() != Global.GESTOR + && u.getTipo().intValue() != Global.DIRECTOR_GERAL_RH ) + { + list = pdp.searchPlanosActivos( u, nome, estabelecimento, dataVisita ); + } + } + catch ( Exception e ) + { + ErrorLogger.logException( e ); + } + return list; + } + + public List getPlanosActivos(Utilizador u) + { + return searchPlanosActivos( u, null, null, null ); +// List< PlanoActuacao > list = new ArrayList(); +// try +// { +// if ( u.getTipo().intValue() != Global.DIRECTOR_SIPRP +// && u.getTipo().intValue() != Global.GESTOR +// && u.getTipo().intValue() != Global.DIRECTOR_GERAL_RH ) +// { +//// list = pdp.getPlanosActivos(u); +// list = pdp.searchPlanosActivos( u, null, null ); +// } +// } +// catch(Exception ex) +// { +// ErrorLogger.logException( ex ); +// } +// return list; + } + + public List< PlanoActuacao > searchPlanosSeguimento( Utilizador u, String nome, String estabelecimento, String dataVisita ) + { + List< PlanoActuacao > list = new ArrayList(); + try + { + list = pdp.searchPlanosSeguimento( u, nome, estabelecimento, dataVisita ); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + return list; + } + + public List getPlanosSeguimento(Utilizador u) + { + return searchPlanosSeguimento( u, null, null, null ); +// List< PlanoActuacao > list = new ArrayList(); +// try +// { +//// list = pdp.getPlanosSeguimento(u); +// list = pdp.searchPlanosSeguimento( u, null, null ); +// } +// catch(Exception ex) +// { +// ErrorLogger.logException( ex ); +// } +// return list; + } + + public List< PlanoActuacao > searchPlanosConcluidos( Utilizador u, String nome, String estabelecimento, String dataVisita ) + { + List< PlanoActuacao > list = new ArrayList(); + try + { + list = pdp.searchPlanosConcluidos( u, nome, estabelecimento, dataVisita ); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + return list; + } + + public List getPlanosConcluidos(Utilizador u) + { + return searchPlanosConcluidos( u, null, null, null ); +// List< PlanoActuacao > list = new ArrayList(); +// try +// { +//// list = pdp.getPlanosConcluidos(u); +// list = pdp.searchPlanosConcluidos( u, null, null ); +// } +// catch(Exception ex) +// { +// ErrorLogger.logException( ex ); +// } +// return list; + } + + + + public String buttonFilterActual_action() + { + String nome = null; + if ( textFilterNameActual.getText() != null ) + { + nome = (( String ) textFilterNameActual.getText()).trim(); + if( nome.length() == 0 ) + { + nome = null; + } + } + + String estabelecimento = null; + if ( textFilterEstabelecimentoActual.getText() != null ) + { + estabelecimento = (( String ) textFilterEstabelecimentoActual.getText()).trim(); + if( estabelecimento.length() == 0 ) + { + estabelecimento = null; + } + } + + Date visitaDate = ( Date ) calFilterDateActual.getValue(); + String visitaDateStr = null; + if ( visitaDate != null ) + { + visitaDateStr = D_F.format( visitaDate ); + } + + getSessionBean1().setIsSearchingPlanosActuacao( Boolean.TRUE ); + getSessionBean1().getPlanosActualDataProvider().setList( + searchPlanosActivos( getSessionBean1().getCurrentUser(), nome, estabelecimento, visitaDateStr ) ); + + return null; + } + + public String buttonFilterSeg_action() + { + String nome = null; + if ( textFilterNameSeg.getText() != null ) + { + nome = (( String ) textFilterNameSeg.getText()).trim(); + if( nome.length() == 0 ) + { + nome = null; + } + } + + String estabelecimento = null; + if ( textFilterEstabelecimentoSeg.getText() != null ) + { + estabelecimento = (( String ) textFilterEstabelecimentoSeg.getText()).trim(); + if( estabelecimento.length() == 0 ) + { + estabelecimento = null; + } + } + + Date visitaDate = ( Date ) calFilterDateSeg.getValue(); + String visitaDateStr = null; + if ( visitaDate != null ) + { + visitaDateStr = D_F.format( visitaDate ); + } + + getSessionBean1().setIsSearchingPlanosActuacao( Boolean.TRUE ); + getSessionBean1().getPlanosSeguimentoDataProvider().setList( + searchPlanosSeguimento( getSessionBean1().getCurrentUser(), nome, estabelecimento, visitaDateStr ) ); + + return null; + } + + + public String buttonFilterConc_action() + { + String nome = null; + if ( textFilterNameConc.getText() != null ) + { + nome = (( String ) textFilterNameConc.getText()).trim(); + if( nome.length() == 0 ) + { + nome = null; + } + } + + String estabelecimento = null; + if ( textFilterEstabelecimentoConc.getText() != null ) + { + estabelecimento = (( String ) textFilterEstabelecimentoConc.getText()).trim(); + if( estabelecimento.length() == 0 ) + { + estabelecimento = null; + } + } + + Date visitaDate = ( Date ) calFilterDateConc.getValue(); + String visitaDateStr = null; + if ( visitaDate != null ) + { + visitaDateStr = D_F.format( visitaDate ); + } + + getSessionBean1().setIsSearchingPlanosActuacao( Boolean.TRUE ); + getSessionBean1().getPlanosConcluidosDataProvider().setList( + searchPlanosConcluidos( getSessionBean1().getCurrentUser(), nome, estabelecimento, visitaDateStr ) ); + + return null; + } + +} + diff --git a/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Login.java b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Login.java new file mode 100644 index 00000000..a884d3a5 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Login.java @@ -0,0 +1,206 @@ +/* + * Login.java + * + * Created on Aug 26, 2008, 11:21:02 AM + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import com.sun.rave.web.ui.appbase.AbstractPageBean; +import com.sun.webui.jsf.component.Button; +import com.sun.webui.jsf.component.PasswordField; +import com.sun.webui.jsf.component.TextField; +import java.sql.Connection; +import javax.faces.FacesException; + +/** + *

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.

+ * + * @author lluis + */ +public class Login extends AbstractPageBean { + // + + /** + *

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 TextField txtUtilizador = new TextField(); + + public TextField getTxtUtilizador() { + return txtUtilizador; + } + + public void setTxtUtilizador(TextField tf) { + this.txtUtilizador = tf; + } + private PasswordField txtPassword = new PasswordField(); + + public PasswordField getTxtPassword() { + return txtPassword; + } + + public void setTxtPassword(PasswordField pf) { + this.txtPassword = pf; + } + private Button butLogin = new Button(); + + public Button getButLogin() { + return butLogin; + } + + public void setButLogin(Button b) { + this.butLogin = b; + } + + //
+ + /** + *

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.

+ */ + @Override + 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) { + ErrorLogger.logException( e ); + log("Login 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.

+ */ + @Override + 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.

+ */ + @Override + 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).

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

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1) getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1) getBean("SessionBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + + 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 . . . + ErrorLogger.logException( e ); + } + ErrorLogger.logException( ex ); + } + } + + public String lnkPasswordRecovery_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + return null; + } + + public String butLogin_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + return "lista_planos"; + } + +} + diff --git a/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/PlanosActuacao.java b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/PlanosActuacao.java new file mode 100644 index 00000000..832793cb --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/PlanosActuacao.java @@ -0,0 +1,450 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import db.entidades.Area; +import db.entidades.Medida; +import db.entidades.PlanoActuacao; +import db.entidades.PostoTrabalho; +import db.entidades.Risco; +import db.entidades.Utilizador; +import db.entidades.Valor; +import db.providers.CreatePlanosDataProvider; +import db.providers.UtilizadoresDataProvider; +import global.Global; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import mail.Mail; +import siprp.database.cayenne.objects.HsRelatorio; +import siprp.database.cayenne.providers.PlanoActuacaoDAO; +import static com.evolute.utils.strings.UnicodeLatin1Map.*; + +/** + * + * @author lluis + */ +public class PlanosActuacao { + //PlanosDataProvider pdp = new PlanosDataProvider(); + CreatePlanosDataProvider cpdp = new CreatePlanosDataProvider(); + //RelatoriosDataProvider rdp; + List planosList; + List planosOnlineList; + PlanoActuacaoDAO pa = new PlanoActuacaoDAO(); + + + //DB + + + + + public PlanosActuacao() + { + try + { + System.out.println( "Importar planos de actua" + ccedil + atilde + "o" ); + //rdp = new RelatoriosDataProvider(); + // Integer estabelecimentoId = null; +// if(u.getTipo().intValue() != Global.TECNICO_HS && u.getTipo().intValue() != Global.DIRECTOR_SIPRP) +// { +// estabelecimentoId = u.getEstabelecimento_id(); +// } +// +// List planosOnlineList = getPlanosOnline(null); +// System.out.println("PLANOS ONLINE LIST : " + planosOnlineList.size()); + initRelatorios(null,null); +// System.out.println("LIST RELATORIOS : " + listRelatorios.size()); +// putPlanosOnline(listRelatorios); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + } + + public PlanosActuacao(Utilizador u){ + try + { + //rdp = new RelatoriosDataProvider(); + Integer estabelecimentoId = null; + if(u.getTipo().intValue() != Global.TECNICO_HS && u.getTipo().intValue() != Global.DIRECTOR_SIPRP) + { + estabelecimentoId = u.getEstabelecimento_id(); + } + List planosOnlineList = getPlanosOnline(estabelecimentoId); + System.out.println("PLANOS ONLINE LIST : " + planosOnlineList.size()); + initRelatorios(planosOnlineList, estabelecimentoId); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + } + + private List getPlanosOnline(Integer estabelecimentoId) + { + List list = new ArrayList(); + try + { + if( estabelecimentoId != null ) + { + list = cpdp.getPlanosOnline(estabelecimentoId); + } + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + return list; + } + + private void initRelatorios(List list, Integer estabelecimentoId) + { + System.out.println("initRelatorios for estabelecimento id: " + estabelecimentoId ); + if( estabelecimentoId == null ) + { + System.out.println("A adicionar planos de estabelecimentos novos"); + List estabelecimentos = cpdp.getEstabelecimentosWithPlanos(); + putPlanosOnline(pa.getRelatoriosNotIn(estabelecimentos)); + estabelecimentos = cpdp.getEstabelecimentosWithPlanos(); + System.out.println("A adicionar planos a estabelecimentos anteriores"); + for( Integer estabelecimentoID : estabelecimentos ) + { + try + { + System.out.println("A importar relatorio para o estabelecimento: " + estabelecimentoID ); + List datas = cpdp.getPlanosOnline(estabelecimentoID); + if( datas.isEmpty() ) + { + System.out.println("Nenhuma data de relatorio para o estabelecimento: " + estabelecimentoID ); + } + else + { + List relatorios = pa.getRelatoriosNotIn(datas, estabelecimentoID); + if( relatorios.isEmpty() ) + { + System.out.println("Nenhum relatorio novo para o estabelecimento: " + estabelecimentoID ); + } + else + { + putPlanosOnline(relatorios); + } + } + } + catch(Exception e ) + { + ErrorLogger.logException( e ); + } + } + } + else + { + putPlanosOnline(pa.getRelatoriosNotIn(list, estabelecimentoId)); + } + } + + private void putPlanosOnline(List listRelatorios) + { + System.out.println("putPlanosOnline (" + listRelatorios == null ? "null" : listRelatorios.size() ); + Iterator iter = listRelatorios.iterator(); + while(iter.hasNext()) + { + HsRelatorio relatorio = iter.next(); + System.out.println("RELATORIO ID : " + relatorio.getId().toString()); + try + { + PlanoActuacao p = createPlano(relatorio); + if(p != null) + { + enviarMail(p); + } + + //showPlano(p); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + System.out.println("ERRO NA CRIACAO DOS PLANOS : " + ex.getMessage()); + } + } + } + + private PlanoActuacao createPlano(HsRelatorio relatorio) throws Exception + { + System.out.println("CREATE PLANO - RELATORIO ID : " + relatorio.getId().toString()); + PlanoActuacao p = new PlanoActuacao(); + p.setData_visita(relatorio.getToHsMarcacoesEstabelecimento().getData()); + + ////////// + if(relatorio.getToHsMarcacoesEstabelecimento().getToMarcacoesTecnicosHst() != null) + { + p.setTecnico_hs_id(relatorio.getToHsMarcacoesEstabelecimento().getToMarcacoesTecnicosHst().getId()); + p.setTecnico_hs_nome(relatorio.getToHsMarcacoesEstabelecimento().getToMarcacoesTecnicosHst().getNome()); + } + + if ( relatorio.getToHsMarcacoesEstabelecimento().getToMarcacoesTecnicosSuperioresHst() != null ) + { + p.setTecnico_superior_hs_id( relatorio.getToHsMarcacoesEstabelecimento().getToMarcacoesTecnicosSuperioresHst().getId() ); + p.setTecnico_superior_hs_nome( relatorio.getToHsMarcacoesEstabelecimento().getToMarcacoesTecnicosSuperioresHst().getNome() ); + } + + ///////// + p.setFase(new Integer(Global.FASE_SEGURANCA_PREENCHIMENTO)); + p.setEstabelecimento_id(relatorio.getToHsMarcacoesEstabelecimento().getToEstabelecimentos().getId()); + p.setEmpresa_id(relatorio.getToHsMarcacoesEstabelecimento().getToEstabelecimentos().getToEmpresas().getId()); + try + { + //p.setNome_empresa(utils.Utils.unicodeToHTML(rdp.getEmpresaNome(p.getEmpresa_id()))); + p.setNome_empresa(utils.Utils.unicodeToHTML(cpdp.getEmpresaNome(p.getEmpresa_id()))); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + p.setNome_estabelecimento(relatorio.getToHsMarcacoesEstabelecimento().getToEstabelecimentos().getNome()); + p.setData_relatorio(relatorio.getData()); + //p = rdp.getFullPlano(p, relatorio.getId()); + p = cpdp.getFullPlano(p, relatorio.getId()); + + if(p.getAreas() != null) + { + if(p.getAreas().size() > 0) + { + p.setId(cpdp.createPlano(p)); + System.out.println("CREATE PLANO - PLANO ID : " + p.getId().toString()); + if(p.getAreas() != null) + { + createAreas(p.getId(), p.getAreas()); + } + } + else + { + p = null; + } + } + else + { + p = null; + } + + + + return p; + } + + private void createAreas(Integer plano_id, List areas) throws Exception + { + for(Area a : areas) + { + a.setPlano_id(plano_id); + a.setId(cpdp.createArea(a)); + System.out.println("AREA =: " + a.getId().toString()); + if(a.getRiscos() != null) + { + System.out.println("AREA RISCOS: " + a.getRiscos().size()); + createRiscos(a.getId(), a.getRiscos()); + } + + } + } + + private void createRiscos(Integer area_id, List riscos) throws Exception + { + for(Risco r : riscos) + { + r.setArea_id(area_id); + //r.setId(pdp.createRisco(r)); + System.out.println("CREATE RISCO:"); + if(r.getValores() != null) + { + for(Valor v : r.getValores()) + { + //System.out.println("RISCO -> " + r.getRisco_id().toString() + "VALOR -> " + v.getValor().toString()); + r.setValor(v.getValor()); + r.setId(cpdp.createRisco(r)); + + } + } + if(r.getMedidas() != null) + { + createMedidas(r.getId(), r.getMedidas()); + } +// if(r.getValores() != null) +// { +// createValores(r.getId(), r.getValores()); +// } + + } + } + +// private void createValores(Integer risco_id, List valores) throws Exception +// { +// for(Valor v : valores) +// { +// v.setRisco_id(risco_id); +// v.setId(pdp.createValor(v)); +// if(v.getMedidas() != null) +// { +// createMedidas(v.getId(), v.getMedidas()); +// } +// +// } +// } + + private void createMedidas(Integer risco_id, List medidas) throws Exception + { + for(Medida m : medidas) + { + m.setRisco_id(risco_id); + m.setId(cpdp.createMedida(m)); + if(m.getPostos() != null) + { + createPostos(m.getId(), m.getPostos()); + } + + } + } + + private void createPostos(Integer medida_id, List postos) throws Exception + { + for(PostoTrabalho p : postos) + { + p.setMedida_id(medida_id); + cpdp.createPostoTrabalho(p); + } + } + + + + + + private void showPlano(PlanoActuacao p) + { + System.out.println("================================================"); + System.out.println("PLANO : " + p.getData_visita_str() + " | " + p.getDescricao() + " | " + p.getFase_nome() + " | " + p.getNome_estabelecimento()); + showAreas(p.getAreas()); + System.out.println("================================================"); + } + + private void showAreas(List areas) + { + for(Area a : areas) + { + System.out.println(" " + a.getDescricao()); + showRiscos(a.getRiscos()); + } + } + + private void showRiscos(List riscos) + { + for(Risco r : riscos) + { + System.out.println(" " + r.getDescricao()); + showValores(r.getValores()); + } + } + + private void showValores(List valores) + { + for(Valor v : valores) + { + System.out.println(" " + v.getValor()); + showMedidas(v.getMedidas()); + } + } + + private void showMedidas(List medidas) + { + for(Medida m : medidas) + { + System.out.println(" " + m.getDescricao()); + showPostos(m.getPostos()); + } + } + + private void showPostos(List postos) + { + for(PostoTrabalho p : postos) + { + System.out.println(" " + p.getDescricao()); + } + } + + private void enviarMail(PlanoActuacao p) + { + String assunto = ""; + String mail_text = ""; + + int fase = p.getFase().intValue(); + int tipo_utilizador = 0; + switch(fase) + { + case Global.FASE_SEGURANCA_PREENCHIMENTO: + tipo_utilizador = Global.RESPONSAVEL_SEGURANCA; + assunto = "Plano de Actuação da Avaliação de Riscos de " + p.getData_visita_str() + " - " + p.getNome_estabelecimento(); + mail_text = "

Exmo. (a) Senhor (a),

"; + mail_text += "

Encontra-se disponível em www.siprp.com o Plano de Actuação referente à auditoria de Avaliação de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " para que possa efectuar o seu preenchimento.

"; + mail_text += "

Recordamos que dispõe de duas semanas para efectuar o seu preenchimento e passar o respectivo processo para a fase seguinte, ou seja, para o responsável pelo seu estabelecimento.

"; + mail_text += "

Caso tenha alguma dúvida ou necessite de qualquer esclarecimento, contacte, por favor, a área técnica da SIPRP através do telefone 213 504 540.

"; + mail_text += "

Cumprimentos,

"; + mail_text += "

A equipa da SIPRP

"; + mail_text += "

Por favor não responda a esta mensagem, dado tratar-se de um e-mail automático

"; + break; + } + + Mail mail = new Mail(); + + + + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + String responsavel_loja = "n"; + if(tipo_utilizador == Global.RESPONSAVEL_SEGURANCA) + { + responsavel_loja = "y"; + } + try + { + ArrayList list = udp.getUtilizadoresListByTipo(tipo_utilizador, responsavel_loja, p.getEstabelecimento_id()); + ListIterator iter = list.listIterator(); + while(iter.hasNext()) + { + Utilizador u = (Utilizador) iter.next(); + System.out.println("USER MAIL NEXT FASE : " + u.getLogin() + " ; " + u.getEmail()); + try + { + mail.send(u.getEmail(), Mail.ENDERECO_ENVIO, assunto, mail_text); + System.out.println("EMAIL ENVIADO !!"); + } + catch(Exception ex1) + { + ErrorLogger.logException( ex1 ); + System.out.println("MAIL ERROR : " + ex1.getMessage()); + } + + } + } + catch(Exception ex) + { + //ex.printStackTrace(); + ErrorLogger.logException( ex ); + } + + +// try +// { +// mail.send("lluis@evolute.pt", Mail.ENDERECO_ENVIO, assunto, mail_text); +// System.out.println("EMAIL ENVIADO !!"); +// } +// catch(Exception ex) +// { +// ErrorLogger.logException( ex ); +// System.out.println("ERRO NO ENVIO DO EMAIL !!"); +// } + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/RequestBean1.java b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/RequestBean1.java new file mode 100644 index 00000000..dd5b6d32 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/RequestBean1.java @@ -0,0 +1,110 @@ +/* + * RequestBean1.java + * + * Created on Aug 25, 2008, 11:20:16 AM + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +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.

+ * + * @author lluis + */ +public class RequestBean1 extends AbstractRequestBean { + // + + /** + *

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.

+ */ + @Override + 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) { + ErrorLogger.logException( 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.

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

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1) getBean("SessionBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/SessionBean1.java b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/SessionBean1.java new file mode 100644 index 00000000..5ac52af1 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/SessionBean1.java @@ -0,0 +1,396 @@ +/* + * SessionBean1.java + * + * Created on Aug 25, 2008, 11:20:16 AM + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import com.sun.rave.web.ui.appbase.AbstractSessionBean; +import db.entidades.Area; +import db.entidades.PlanoActuacao; +import db.entidades.Risco; +import db.entidades.Utilizador; +import db.entidades.Valor; +import java.util.HashMap; +import javax.faces.FacesException; +import pagination.Pagination; + +/** + *

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.

+ * + * @author lluis + */ +public class SessionBean1 extends AbstractSessionBean { + + private boolean loggedIn = false; + private Utilizador currentUser = null; + private String msg; + + private Integer planoId; + private PlanoActuacao planoActuacao = null; + private Risco currentRisco = null; + private Valor currentValor = null; + + + private tabledataproviders.PlanosActualDataProvider planosActualDataProvider; + private tabledataproviders.PlanosSeguimentoDataProvider planosSeguimentoDataProvider; + private tabledataproviders.PlanosConcluidosDataProvider planosConcluidosDataProvider; + // + + /** + *

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 { + } + //
+ + //menu + private boolean disableMenu = false; + private boolean disableMenuAnalises = false; + private boolean disableMenuPlanos = false; + private boolean disableMenuUtilizadores = false; + private boolean disableMenuDadosUtilizador = false; + + private boolean renderSubHeader = false; + private boolean renderTopMenuImages = true; + + //fase + private int fase = 1; + + private HashMap valoresHash; + private HashMap areasHash; + private HashMap riscosHash; + private Pagination pagination = null; + + private String logoEmpresaUrl = ""; + + private Boolean isSearchingPlanosActuacao = Boolean.FALSE; + + + /** + *

Construct a new session data bean instance.

+ */ + public SessionBean1() { + msg = ""; + + planosActualDataProvider = new tabledataproviders.PlanosActualDataProvider(); + planosSeguimentoDataProvider = new tabledataproviders.PlanosSeguimentoDataProvider(); + planosConcluidosDataProvider = new tabledataproviders.PlanosConcluidosDataProvider(); + planoId = null; + + } + + /** + *

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.

+ */ + @Override + 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) { + ErrorLogger.logException( 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.

+ */ + @Override + 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.

+ */ + @Override + 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.

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

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public boolean isLoggedIn() { + return loggedIn; + } + + public void setLoggedIn(boolean loggedIn) { + this.loggedIn = loggedIn; + } + + public tabledataproviders.PlanosActualDataProvider getPlanosActualDataProvider() { + return planosActualDataProvider; + } + + public void setPlanosActualDataProvider(tabledataproviders.PlanosActualDataProvider planosActualDataProvider) { + this.planosActualDataProvider = planosActualDataProvider; + } + + public tabledataproviders.PlanosSeguimentoDataProvider getPlanosSeguimentoDataProvider() { + return planosSeguimentoDataProvider; + } + + public void setPlanosSeguimentoDataProvider(tabledataproviders.PlanosSeguimentoDataProvider planosSeguimentoDataProvider) { + this.planosSeguimentoDataProvider = planosSeguimentoDataProvider; + } + + public tabledataproviders.PlanosConcluidosDataProvider getPlanosConcluidosDataProvider() { + return planosConcluidosDataProvider; + } + + public void setPlanosConcluidosDataProvider(tabledataproviders.PlanosConcluidosDataProvider planosConcluidosDataProvider) { + this.planosConcluidosDataProvider = planosConcluidosDataProvider; + } + + public Integer getPlanoId() { + return planoId; + } + + public void setPlanoId(Integer planoId) { + this.planoId = planoId; + } + + public Utilizador getCurrentUser() { + return currentUser; + } + + public void setCurrentUser(Utilizador currentUser) { + this.currentUser = currentUser; + } + + public boolean isDisableMenu() { + return disableMenu; + } + + public void setDisableMenu(boolean disableMenu) { + System.out.println("DISABLE MENU : " + disableMenu); + setDisableMenuAnalises(disableMenu); + //setDisableMenuPlanos(disableMenu); + setDisableMenuUtilizadores(disableMenu); + setDisableMenuDadosUtilizador(disableMenu); + this.disableMenu = disableMenu; + } + + public boolean isDisableMenuAnalises() { + return disableMenuAnalises; + } + + public void setDisableMenuAnalises(boolean disableMenuAnalises) { + this.disableMenuAnalises = disableMenuAnalises; + } + + public boolean isDisableMenuPlanos() { + return disableMenuPlanos; + } + + public void setDisableMenuPlanos(boolean disableMenuPlanos) { + this.disableMenuPlanos = disableMenuPlanos; + } + + public boolean isDisableMenuUtilizadores() { + return disableMenuUtilizadores; + } + + public void setDisableMenuUtilizadores(boolean disableMenuUtilizadores) { + this.disableMenuUtilizadores = disableMenuUtilizadores; + } + + public boolean isDisableMenuDadosUtilizador() { + return disableMenuDadosUtilizador; + } + + public void setDisableMenuDadosUtilizador(boolean disableMenuDadosUtilizador) { + this.disableMenuDadosUtilizador = disableMenuDadosUtilizador; + } + + public int getFase() { + return fase; + } + + public void setFase(int fase) { + this.fase = fase; + } + + public PlanoActuacao getPlanoActuacao() { + return planoActuacao; + } + + public void setPlanoActuacao(PlanoActuacao planoActuacao) { + this.planoActuacao = planoActuacao; + } + + private Integer irParaChoice; + + public Integer getIrParaChoice() { + return irParaChoice; + } + + public void setIrParaChoice(Integer irParaChoice) { + this.irParaChoice = irParaChoice; + } + + private com.sun.webui.jsf.model.Option[] irParaOptions; + + public com.sun.webui.jsf.model.Option[] getIrParaOptions() { + return irParaOptions; + } + + public void setIrParaOptions(com.sun.webui.jsf.model.Option[] irParaOptions) { + this.irParaOptions = irParaOptions; + } + + public HashMap getAreasHash() { + return areasHash; + } + + public void setAreasHash(HashMap areasHash) { + this.areasHash = areasHash; + } + + public HashMap getRiscosHash() { + return riscosHash; + } + + public void setRiscosHash(HashMap riscosHash) { + this.riscosHash = riscosHash; + } + + public Pagination getPagination() { + return pagination; + } + + public void setPagination(Pagination pagination) { + this.pagination = pagination; + } + + public Risco getCurrentRisco() { + return currentRisco; + } + + public void setCurrentRisco(Risco currentRisco) { + this.currentRisco = currentRisco; + } + + public boolean isRenderSubHeader() { + return renderSubHeader; + } + + public void setRenderSubHeader(boolean renderSubHeader) { + this.renderSubHeader = renderSubHeader; + } + + public boolean isRenderTopMenuImages() { + return renderTopMenuImages; + } + + public void setRenderTopMenuImages(boolean renderTopMenuImages) { + this.renderTopMenuImages = renderTopMenuImages; + } + + public Valor getCurrentValor() { + return currentValor; + } + + public void setCurrentValor(Valor currentValor) { + this.currentValor = currentValor; + } + + public HashMap getValoresHash() { + return valoresHash; + } + + public void setValoresHash(HashMap valoresHash) { + this.valoresHash = valoresHash; + } + + public String getLogoEmpresaUrl() { + return logoEmpresaUrl; + } + + public void setLogoEmpresaUrl(String logoEmpresaUrl) { + this.logoEmpresaUrl = logoEmpresaUrl; + } + + public Boolean getIsSearchingPlanosActuacao() { + return isSearchingPlanosActuacao; + } + + public void setIsSearchingPlanosActuacao(Boolean isSearchingPlanosActuacao) { + this.isSearchingPlanosActuacao = isSearchingPlanosActuacao; + } + + +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Test.java b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Test.java new file mode 100644 index 00000000..42b52ec1 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/Test.java @@ -0,0 +1,74 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package planosactuacao; + +import db.entidades.Area; +import db.entidades.Medida; +import db.entidades.PlanoActuacao; +import db.entidades.PostoTrabalho; +import db.entidades.Risco; +import db.entidades.Valor; +import java.util.List; + +/** + * + * @author lluis + */ +public class Test { + private PlanoActuacao p; + + public static void showPlanoTree(PlanoActuacao p) + { + System.out.println("====================================================="); + System.out.println(" PLANO : " + p.getData_visita_str()); + showAreas(p.getAreas()); + System.out.println("====================================================="); + } + + private static void showAreas(List areas) + { + for(Area a : areas) + { + System.out.println("\t" + a.getDescricao()); + showRiscos(a.getRiscos()); + } + } + + private static void showRiscos(List riscos) + { + for(Risco r : riscos) + { + System.out.println("\t\t" + r.getDescricao()); + showValores(r.getValores()); + } + } + + private static void showValores(List valores) + { + for(Valor v : valores) + { + System.out.println("\t\t\t" + v.getValor()); + showMedidas(v.getMedidas()); + } + } + + private static void showMedidas(List medidas) + { + for(Medida m : medidas) + { + System.out.println("\t\t\t" + m.getDescricao()); + showPostos(m.getPostos()); + } + } + + private static void showPostos(List postos) + { + for(PostoTrabalho p : postos) + { + System.out.println("\t\t\t\t" + p.getDescricao()); + } + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/ViewPlano.java b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/ViewPlano.java new file mode 100644 index 00000000..f1373dfb --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/planosactuacao/ViewPlano.java @@ -0,0 +1,900 @@ +/* + * ViewPlano.java + * + * Created on Oct 20, 2008, 10:39:31 AM + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import com.sun.rave.web.ui.appbase.AbstractPageBean; +import com.sun.webui.jsf.component.Button; +import com.sun.webui.jsf.component.PageSeparator; +import com.sun.webui.jsf.component.PanelGroup; +import com.sun.webui.jsf.component.StaticText; +import db.entidades.Area; +import db.entidades.Medida; +import db.entidades.PlanoActuacao; +import db.entidades.PostoTrabalho; +import db.entidades.Risco; +import db.entidades.Utilizador; +import db.entidades.Valor; +import db.providers.UtilizadoresDataProvider; +import java.text.SimpleDateFormat; +import java.util.List; +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.

+ * + * @author lluis + */ +public class ViewPlano extends AbstractPageBean { + // + + /** + *

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 Button butVoltar = new Button(); + + public Button getButVoltar() { + return butVoltar; + } + + public void setButVoltar(Button b) { + this.butVoltar = b; + } + private HtmlPanelGrid gridLayout = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLayout() { + return gridLayout; + } + + public void setGridLayout(HtmlPanelGrid hpg) { + this.gridLayout = hpg; + } + + //
+ HtmlPanelGrid gridPlano; + HtmlPanelGrid gridArea; + HtmlPanelGrid gridAreaContainer; + HtmlPanelGrid gridRisco; + HtmlPanelGrid gridValor; + HtmlPanelGrid gridMedida; + HtmlPanelGrid gridPosto; + HtmlPanelGrid gridResponsavel; + PanelGroup pg; + StaticText st; + + /** + *

Construct a new Page bean instance.

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

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.

+ */ + @Override + 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) { + ErrorLogger.logException( e ); + log("ViewPlano 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.

+ */ + @Override + 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.

+ */ + @Override + public void prerender() { + PlanoActuacao p = getSessionBean1().getPlanoActuacao(); + showPlano(p); + } + + /** + *

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).

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

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1) getBean("SessionBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ * + * @return reference to the scoped data bean + */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1) getBean("RequestBean1"); + } + + private void showPlano(PlanoActuacao p) + { + gridPlano = new HtmlPanelGrid(); + gridPlano.setId("gridPlano"); + gridPlano.setWidth("100%"); + gridPlano.setColumns(1); + gridPlano.setStyle("background-color: #f6f4e8; border: solid 1px #000000"); + gridPlano.setColumnClasses("gridColCenter"); + //plano + //lblTop.setText("Plano de actuação da auditoria " + p.getData_visita_str()); + + System.out.println( "VIEWPLANO - : " + p.getConcluidoPorDesactivacao() ); + if ( p.getConcluidoPorDesactivacao() ) + { + StaticText st = new StaticText(); + st.setText( "N\u00E3o realizado por falta de cumprimento do prazo." ); + st.setStyle( "color: #FF0000; font-weight: bold; font-size: 13px;" ); + gridPlano.getChildren().add( st ); + } + gridLayout.getChildren().add(gridPlano); + showAreas(p.getAreas()); + showValidacoes(gridPlano, p); + } + + private void showAreas(List areas) + { + int i = 0; + for(Area area : areas) + { + i++; + gridArea = new HtmlPanelGrid(); + gridArea.setColumns(1); + gridArea.setColumnClasses("gridColCenter"); + gridArea.setWidth("100%"); + + gridPlano.getChildren().add(gridArea); + + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Área: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setId("fakeLink" + i); + st.setStyleClass("fakeLink"); + st.setOnMouseOver("this.style.textDecoration = 'underline'"); + st.setOnMouseOut("this.style.textDecoration = 'none'"); + st.setOnClick("expand(this)"); + st.setEscape(false); + st.setText(area.getDescricao()); + pg.getChildren().add(st); + + gridArea.getChildren().add(pg); + + gridAreaContainer = new HtmlPanelGrid(); + gridAreaContainer.setId("area_container" + i); + ////gridAreaContainer.setStyle("border: solid 1px #000000; width: 100%;"); + gridAreaContainer.setStyleClass("hidden"); + //gridAreaContainer.setStyleClass("visible"); + gridAreaContainer.setColumns(1); + gridAreaContainer.setColumnClasses("gridColLeft"); + gridAreaContainer.setWidth("100%"); + +// st = new StaticText(); +// st.setEscape(false); +// st.setText("AAAAAAAAA"); +// gridAreaContainer.getChildren().add(st); + + gridArea.getChildren().add(gridAreaContainer); + showRiscos(area.getRiscos()); + } + } + + private void showRiscos(List riscos) + { + int rCount = 0; + for(Risco risco : riscos) + { + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setColumns(1); + grd.setColumnClasses("gridColLeft"); + //grd.setStyle("border: solid 1px #0000FF; display: inline; width: 100%"); + grd.setStyle("display: block; width: 100%"); + grd.setWidth("100%"); + //grd.setStyleClass("centerBlock"); + //gridArea.getChildren().add(grd); + gridAreaContainer.getChildren().add(grd); + + gridRisco = new HtmlPanelGrid(); + //gridRisco.setStyleClass("centerBlock"); + gridRisco.setStyle("display: block; width: 98%"); + gridRisco.setWidth("98%"); + gridRisco.setColumns(1); + gridRisco.setColumnClasses("gridColLeft"); + grd.getChildren().add(gridRisco); + + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Risco: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(risco.getDescricao()); + pg.getChildren().add(st); + gridRisco.getChildren().add(pg); + //showValores(risco.getValores()); + showValor(risco); + //showMedidas(risco.getMedidas()); + + if ( rCount < riscos.size() - 1 ) + { + showSeparator( ); + } + + rCount++; + } + } + + private void showValor(Risco r) + { + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setColumns(1); + grd.setWidth("100%"); + grd.setStyleClass("centerBlock"); + grd.setStyle("display: block"); + //gridRisco.getChildren().add(grd); + + gridValor = new HtmlPanelGrid(); + gridRisco.getChildren().add(gridValor); + //gridValor.setStyleClass("centerBlock"); + gridValor.setStyle("display: block"); + gridValor.setWidth("100%"); + gridValor.setColumns(1); + gridValor.setColumnClasses("gridColLeft"); + //grd.getChildren().add(gridValor); + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Valor: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + if(r.getValor() == null) + { + st.setText("IND"); + } + else + { + st.setText(r.getValor().toString()); + } + pg.getChildren().add(st); + gridValor.getChildren().add(pg); + + showMedidas(r.getMedidas()); + + grd = new HtmlPanelGrid(); + grd.setColumns(1); + grd.setWidth("100%"); + //grd.setStyleClass("centerBlock"); + gridValor.getChildren().add(grd); + HtmlPanelGrid gridParecer = new HtmlPanelGrid(); + gridParecer.setStyleClass("centerBlock"); + gridParecer.setStyle("display: block"); + gridParecer.setWidth("98%"); + gridParecer.setColumns(1); + gridParecer.setColumnClasses("gridColLeft"); + grd.getChildren().add(gridParecer); + + if(r.getResponsavel_execucao() != null) + { + if(r.getResponsavel_execucao().trim().length() > 0) + { + pg = new PanelGroup(); + + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Responsável de execução: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(r.getResponsavel_execucao().toString()); + pg.getChildren().add(st); + + + if(r.getPor() != null) + { + if(r.getPor().trim().length() > 0) + { + st = new StaticText(); + st.setEscape(false); + st.setText(" "); + pg.getChildren().add(st); + + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("POR:  "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(r.getPor().toString()); + pg.getChildren().add(st); + } + } + + gridParecer.getChildren().add(pg); + } + } + + if(r.getRecursos_necessarios() != null) + { + if(r.getRecursos_necessarios().trim().length() > 0) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Recursos necessários: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(r.getRecursos_necessarios().toString()); + pg.getChildren().add(st); + gridParecer.getChildren().add(pg); + } + } + + if(r.getData_inicio() != null) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Data início: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + String data_str = ""; + SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); + data_str = formatter.format(r.getData_inicio()); + st.setText(data_str); + pg.getChildren().add(st); + gridParecer.getChildren().add(pg); + } + + if(r.getData_fim() != null) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Data fim: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + String data_str = ""; + SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); + data_str = formatter.format(r.getData_fim()); + st.setText(data_str); + pg.getChildren().add(st); + gridParecer.getChildren().add(pg); + } + + if(r.getParecer_dl() != null) + { + if(r.getParecer_dl().trim().length() > 0) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Parecer DL: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(r.getParecer_dl().toString()); + pg.getChildren().add(st); + gridParecer.getChildren().add(pg); + + } + } + + if(r.getParecer_dns() != null) + { + if(r.getParecer_dns().trim().length() > 0) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Parecer DNS: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(r.getParecer_dns().toString()); + pg.getChildren().add(st); + gridParecer.getChildren().add(pg); + + } + } + + if(r.getVerificacao_siprp() != null) + { + if(r.getVerificacao_siprp().trim().length() > 0) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Verificação SIPRP: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(r.getVerificacao_siprp().toString()); + pg.getChildren().add(st); + gridParecer.getChildren().add(pg); + + } + } + } + + private void showValores(List valores) + { + for(Valor valor : valores) + { + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setColumns(1); + grd.setWidth("100%"); + //grd.setStyleClass("centerBlock"); + //gridRisco.getChildren().add(grd); + + gridValor = new HtmlPanelGrid(); + gridRisco.getChildren().add(gridValor); + ////gridValor.setStyleClass("centerBlock"); + gridValor.setWidth("100%"); + gridValor.setColumns(1); + gridValor.setColumnClasses("gridColLeft"); + //grd.getChildren().add(gridValor); + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Valor: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + if(valor.getValor() == null) + { + st.setText(" - "); + } + else + { + st.setText(valor.getValor().toString()); + } + pg.getChildren().add(st); + gridValor.getChildren().add(pg); + + showMedidas(valor.getMedidas()); + + grd = new HtmlPanelGrid(); + grd.setColumns(1); + grd.setWidth("100%"); + ////grd.setStyleClass("centerBlock"); + gridValor.getChildren().add(grd); + HtmlPanelGrid gridParecer = new HtmlPanelGrid(); + gridParecer.setStyleClass("centerBlock"); + gridParecer.setWidth("98%"); + gridParecer.setColumns(1); + gridParecer.setColumnClasses("gridColLeft"); + grd.getChildren().add(gridParecer); + + if(valor.getResponsavel_execucao() != null) + { + if(valor.getResponsavel_execucao().trim().length() > 0) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Responsável de execução: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(valor.getResponsavel_execucao().toString()); + pg.getChildren().add(st); + gridParecer.getChildren().add(pg); + } + } + + if(valor.getRecursos_necessarios() != null) + { + if(valor.getRecursos_necessarios().trim().length() > 0) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Recursos necessários: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(valor.getRecursos_necessarios().toString()); + pg.getChildren().add(st); + gridParecer.getChildren().add(pg); + } + } + + if(valor.getData_inicio() != null) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Data início: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + String data_str = ""; + SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); + data_str = formatter.format(valor.getData_inicio()); + st.setText(data_str); + pg.getChildren().add(st); + gridParecer.getChildren().add(pg); + } + + if(valor.getData_fim() != null) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Data fim: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + String data_str = ""; + SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); + data_str = formatter.format(valor.getData_fim()); + st.setText(data_str); + pg.getChildren().add(st); + gridParecer.getChildren().add(pg); + } + + if(valor.getParecer_dl() != null) + { + if(valor.getParecer_dl().trim().length() > 0) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Parecer DL: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(valor.getParecer_dl().toString()); + pg.getChildren().add(st); + gridParecer.getChildren().add(pg); + + } + } + + if(valor.getParecer_dns() != null) + { + if(valor.getParecer_dns().trim().length() > 0) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Parecer DNS: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(valor.getParecer_dns().toString()); + pg.getChildren().add(st); + gridParecer.getChildren().add(pg); + + } + } + + if(valor.getVerificacao_siprp() != null) + { + if(valor.getVerificacao_siprp().trim().length() > 0) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Verificação SIPRP: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(valor.getVerificacao_siprp().toString()); + pg.getChildren().add(st); + gridParecer.getChildren().add(pg); + + } + } + // + } + } + + private void showMedidas(List medidas) + { + for(Medida medida : medidas) + { + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setColumns(1); + grd.setWidth("100%"); + ////grd.setStyleClass("centerBlock"); + grd.setStyle("display: block"); + gridValor.getChildren().add(grd); + + gridMedida = new HtmlPanelGrid(); + ////gridMedida.setStyleClass("centerBlock"); + gridMedida.setStyle("display: block"); + gridMedida.setWidth("98%"); + gridMedida.setColumns(1); + gridMedida.setColumnClasses("gridColLeft"); + grd.getChildren().add(gridMedida); + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Medida: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(medida.getDescricao()); + pg.getChildren().add(st); + gridMedida.getChildren().add(pg); + + showPostos(medida.getPostos()); + } + } + + private void showPostos(List postos) + { + for(PostoTrabalho posto : postos) + { + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setColumns(1); + grd.setStyle("display: block"); + grd.setWidth("100%"); + ////grd.setStyleClass("centerBlock"); + gridMedida.getChildren().add(grd); + + gridPosto = new HtmlPanelGrid(); + ////gridPosto.setStyleClass("centerBlock"); + gridPosto.setStyle("display: block"); + gridPosto.setWidth("98%"); + gridPosto.setColumns(1); + gridPosto.setColumnClasses("gridColLeft"); + grd.getChildren().add(gridPosto); + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setStyleClass("label"); + st.setText("Posto de trabalho: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(posto.getDescricao()); + pg.getChildren().add(st); + gridPosto.getChildren().add(pg); + + } + } + + private void showValidacoes(HtmlPanelGrid grid, PlanoActuacao p) + { + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + boolean hasValidations = false; + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setColumns(1); + grd.setColumnClasses("gridColLeft"); + grd.setWidth("100%"); + if(p.getValidacao_director_loja().booleanValue()) + { + hasValidations = true; + StaticText st = new StaticText(); + st.setEscape(false); + //st.setStyleClass("label"); + String nome = ""; + try + { + Utilizador user = udp.getUtilizador(p.getUser_dir_loja()); + nome = user.getNome(); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + st.setText("Validado por " + nome + " (Director de Loja) a " + p.getData_validacao_dir_loja_str()); + grd.getChildren().add(st); + + if(p.getObservacoes_dl() != null) + { + if(p.getObservacoes_dl().trim().length() > 0) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setText("Observações gerais DL: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(p.getObservacoes_dl()); + pg.getChildren().add(st); + grd.getChildren().add(pg); + } + } + } + + if(p.getValidacao_dns().booleanValue()) + { + hasValidations = true; + StaticText st = new StaticText(); + st.setEscape(false); + //st.setStyleClass("label"); + String nome = ""; + try + { + Utilizador user = udp.getUtilizador(p.getUser_dns()); + nome = user.getNome(); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + st.setText("Validado por " + nome + " (Director Nacional de Segurança) a " + p.getData_validacao_dns_str()); + grd.getChildren().add(st); + + if(p.getObservacoes_dns() != null) + { + if(p.getObservacoes_dns().trim().length() > 0) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape(false); + st.setText("Observações gerais DNS: "); + pg.getChildren().add(st); + st = new StaticText(); + st.setEscape(false); + st.setText(p.getObservacoes_dns()); + pg.getChildren().add(st); + grd.getChildren().add(pg); + } + } + } + + if(p.getValidacao_hs().booleanValue()) + { + hasValidations = true; + StaticText st = new StaticText(); + st.setEscape(false); + //st.setStyleClass("label"); + String nome = ""; + try + { + Utilizador user = udp.getUtilizador(p.getUser_hs()); + nome = user.getNome(); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + st.setText("Validado por " + nome + " (Técnico de SHS) a " + p.getData_validacao_hs_str()); + grd.getChildren().add(st); + +// if(p.getVerificacao_siprp() != null) +// { +// if(p.getVerificacao_siprp().trim().length() > 0) +// { +// pg = new PanelGroup(); +// st = new StaticText(); +// st.setEscape(false); +// st.setText("Verificação SIPRP: "); +// pg.getChildren().add(st); +// st = new StaticText(); +// st.setEscape(false); +// st.setText(p.getVerificacao_siprp()); +// pg.getChildren().add(st); +// grd.getChildren().add(pg); +// } +// } + } + + if(hasValidations) + { + grid.getChildren().add(grd); + } + } + + + private void showSeparator() + { + PageSeparator separator = new PageSeparator(); +// separator.setStyle( "margin-bottom: 50px;" ); + gridAreaContainer.getChildren().add( separator ); + } + + public String butVoltar_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + return "lista_planos"; + } + +} + diff --git a/branches/SIPRP/PlanosActuacao/src/java/tabledataproviders/PlanosActualDataProvider.java b/branches/SIPRP/PlanosActuacao/src/java/tabledataproviders/PlanosActualDataProvider.java new file mode 100644 index 00000000..da83da58 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/tabledataproviders/PlanosActualDataProvider.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package tabledataproviders; + +import com.sun.data.provider.impl.ObjectListDataProvider; + +/** + * + * @author lluis + */ +public class PlanosActualDataProvider extends ObjectListDataProvider { + public PlanosActualDataProvider(){ + + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/tabledataproviders/PlanosConcluidosDataProvider.java b/branches/SIPRP/PlanosActuacao/src/java/tabledataproviders/PlanosConcluidosDataProvider.java new file mode 100644 index 00000000..2b6e511e --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/tabledataproviders/PlanosConcluidosDataProvider.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package tabledataproviders; + +import com.sun.data.provider.impl.ObjectListDataProvider; + +/** + * + * @author lluis + */ +public class PlanosConcluidosDataProvider extends ObjectListDataProvider { + public PlanosConcluidosDataProvider(){ + + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/tabledataproviders/PlanosSeguimentoDataProvider.java b/branches/SIPRP/PlanosActuacao/src/java/tabledataproviders/PlanosSeguimentoDataProvider.java new file mode 100644 index 00000000..2615d17d --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/tabledataproviders/PlanosSeguimentoDataProvider.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package tabledataproviders; + +import com.sun.data.provider.impl.ObjectListDataProvider; + +/** + * + * @author lluis + */ +public class PlanosSeguimentoDataProvider extends ObjectListDataProvider { + public PlanosSeguimentoDataProvider(){ + + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/utils/JSFHTTPUtils.java b/branches/SIPRP/PlanosActuacao/src/java/utils/JSFHTTPUtils.java new file mode 100644 index 00000000..51d05a2b --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/utils/JSFHTTPUtils.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package utils; + +import java.util.Map; +import javax.faces.context.FacesContext; + +/** + * + * @author lluis + */ +public class JSFHTTPUtils { + + public static String getReferer(FacesContext context) + { + Map headerMap = context.getCurrentInstance().getExternalContext().getRequestHeaderMap(); + String referer = (String) headerMap.get("referer"); + return referer; + } +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/utils/JSFUtils.java b/branches/SIPRP/PlanosActuacao/src/java/utils/JSFUtils.java new file mode 100644 index 00000000..1dd087f9 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/utils/JSFUtils.java @@ -0,0 +1,113 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package utils; + +import java.util.Iterator; +import java.util.Map; +import javax.faces.application.Application; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; +import javax.faces.render.ResponseStateManager; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import planosactuacao.ApplicationBean1; +import planosactuacao.SessionBean1; + +/** + * + * @author lluis + */ +public class JSFUtils { + + + public static SessionBean1 getSessionBean(FacesContext fc) + { + FacesContext context = fc.getCurrentInstance(); + SessionBean1 session = (SessionBean1) context.getApplication().getELResolver().getValue(context.getELContext(), null, "SessionBean1"); + return session; + } + + public static ApplicationBean1 getApplicationBean(FacesContext fc) + { + FacesContext context = fc.getCurrentInstance(); + System.out.println("CONTEXT : " + context); + ApplicationBean1 application = (ApplicationBean1) context.getApplication().getELResolver().getValue(context.getELContext(), null, "ApplicationBean1"); + return application; + } + + + // + // isPostBack - JSF 1.1 implementation + // + public static boolean isPostBack(FacesContext fc) + { + Map parameterMap = fc.getExternalContext().getRequestParameterMap(); + + if(parameterMap.size() > 0) + { + Iterator iter = parameterMap.keySet().iterator(); + while(iter.hasNext()) + { + String par = (String) iter.next(); + } + return true; + } + return false; + } + + public static boolean isPostback() { + FacesContext facesContext = FacesContext.getCurrentInstance(); + Map requestScope = (Map) facesContext.getApplication().getExpressionFactory().createValueExpression(facesContext.getELContext(), "#{requestScope}", Map.class).getValue(facesContext.getELContext()); + //Map requestScope = (Map)facesContext.getApplication().createValueBinding(?#{requestScope}?).getValue(facesContext); + boolean ispostback = ((Boolean)requestScope.get("ispostback")).booleanValue(); + System.out.println("POSTBACK A : " + ispostback); + return ispostback; + } + + // + // isPostBack - JSF 1.2 implementation + // + public static boolean isPostBack12(FacesContext fc) + { + ResponseStateManager rsm = fc.getRenderKit().getResponseStateManager(); + if(rsm.isPostback(fc)) + { + return true; + } + return false; + } + + public static void logout(FacesContext fc) throws Exception + { + ExternalContext ectx = fc.getCurrentInstance().getExternalContext(); + HttpSession session = (HttpSession) ectx.getSession(false); + session.invalidate(); + } + + public static void navigateTo(FacesContext fc, String outcome) + { + FacesContext context = fc.getCurrentInstance(); + Application app = context.getApplication(); + app.getNavigationHandler().handleNavigation(context, null, outcome); + } + + public static void redirect(FacesContext context, String url) throws Exception + { + HttpServletResponse response = (HttpServletResponse) context.getCurrentInstance().getExternalContext().getResponse(); + response.sendRedirect(url); + context.responseComplete(); + } + + public static String getRequestParameter(FacesContext fc, String parameter) + { + Map parameters = fc.getCurrentInstance().getExternalContext().getRequestParameterMap(); + return (String) parameters.get(parameter); + } + + + + +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/utils/Logos.java b/branches/SIPRP/PlanosActuacao/src/java/utils/Logos.java new file mode 100644 index 00000000..7d95e6c1 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/utils/Logos.java @@ -0,0 +1,56 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package utils; + +import com.evolute.utils.error.ErrorLogger; +import db.providers.RelatoriosDataProvider; +import global.Global; +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; +import javax.faces.context.FacesContext; +import javax.servlet.ServletContext; + +/** + * + * @author lluis + */ +public class Logos { + + public String getLogo(Integer empresaId) + { + return null; + } + + public String getLogo(FacesContext fc, Integer empresaId) + { + try + { + //get image from db : + RelatoriosDataProvider rdp = new RelatoriosDataProvider(); + byte[] logo = rdp.getLogoByEmpresa(empresaId); + int len = logo.length; + + ServletContext context = (ServletContext) fc.getExternalContext().getContext(); + File logoFolder = new File(context.getRealPath(Global.LOGOS_FOLDER)); + + String logoFilename = logoFolder + "/logo_empresa" + empresaId.toString() + ".jpg"; + + OutputStream outImej = new FileOutputStream(logoFilename); + outImej.write(logo, 0, len); + System.out.println("LOGO PATH : " + logoFilename); + outImej.close(); + return Global.LOGOS_FOLDER + "/logo_empresa" + empresaId.toString() + ".jpg"; + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + return null; + } + + } + +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/utils/PlanosActuacaoLogger.java b/branches/SIPRP/PlanosActuacao/src/java/utils/PlanosActuacaoLogger.java new file mode 100644 index 00000000..d45f4f94 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/utils/PlanosActuacaoLogger.java @@ -0,0 +1,39 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package utils; + +import com.evolute.utils.error.ErrorLogger; +import com.evolute.utils.error.LoggerProperties; +import com.evolute.utils.error.ProjectsEnum; +import com.evolute.utils.error.log4j.DBLogger; +import java.util.HashMap; +import java.util.Map; + +/** + * + * @author dneves + */ +public class PlanosActuacaoLogger +{ + + private static String EVO_LOGGER_DB = "jdbc:postgresql://www.evolute.pt:5436/evo_logging?logUnclosedConnections=true&loginTimeout=5&socketTimeout=5&tcpKeepAlive=true"; + private static String EVO_LOGGER_USER = "evo_logger"; + private static String EVO_LOGGER_PASSWD = "Typein1"; + + public static void init() + { + Map< LoggerProperties, String > map = new HashMap< LoggerProperties, String >(); + map.put( LoggerProperties.USERNAME, EVO_LOGGER_USER ); + map.put( LoggerProperties.PASSWORD, EVO_LOGGER_PASSWD ); + map.put( LoggerProperties.URL, EVO_LOGGER_DB ); + map.put( LoggerProperties.PROJECT, ProjectsEnum.PLANOS_ACTUACAO.toString() ); + map.put( LoggerProperties.SOFTWARE_VERSION, "1" ); + map.put( LoggerProperties.SOFTWARE_NAME, "SIPRP - Planos Actuacao" ); + // TODO - firewall - must be implemented over http (ws) + ErrorLogger.initializeLogger( new DBLogger( map ) ); + } + +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/utils/Utils.java b/branches/SIPRP/PlanosActuacao/src/java/utils/Utils.java new file mode 100644 index 00000000..01e30839 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/utils/Utils.java @@ -0,0 +1,83 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package utils; + +/** + * + * @author lluis + */ +public class Utils { + + public static String unicodeToHTML( String text ) + { + if( text == null || text.length() < 6 ) + { + return text; + } + + String output = text; + output = output.replaceAll( "\\\\u0009", " " ); + output = output.replaceAll( "\\\\u000a", "
" ); + + output = output.replaceAll( "\\\\u00a0", " " ); + output = output.replaceAll( "\\\\u00aa", "ª" ); + output = output.replaceAll( "\\\\u00ba", "º" ); + + output = output.replaceAll( "\\\\u00c0", "À" ); + output = output.replaceAll( "\\\\u00c1", "Á" ); + output = output.replaceAll( "\\\\u00c2", "Â" ); + output = output.replaceAll( "\\\\u00c3", "Ã" ); + output = output.replaceAll( "\\\\u00c7", "Ç" ); + output = output.replaceAll( "\\\\u00c8", "È" ); + output = output.replaceAll( "\\\\u00c9", "É" ); + output = output.replaceAll( "\\\\u00d3", "Ó" ); + output = output.replaceAll( "\\\\u00d2", "Ò" ); + + output = output.replaceAll( "\\\\u00ca", "Ê" ); + output = output.replaceAll( "\\\\u00cc", "Ì" ); + output = output.replaceAll( "\\\\u00cd", "Í" ); + output = output.replaceAll( "\\\\u00ce", "Î" ); + output = output.replaceAll( "\\\\u00d2", "ò" ); + output = output.replaceAll( "\\\\u00d3", "ó" ); + output = output.replaceAll( "\\\\u00d4", "ô" ); + output = output.replaceAll( "\\\\u00d5", "õ" ); + output = output.replaceAll( "\\\\u00d9", "Ù" ); + output = output.replaceAll( "\\\\u00da", "Ú" ); + output = output.replaceAll( "\\\\u00db", "Û" ); + + output = output.replaceAll( "\\\\u00e0", "à" ); + output = output.replaceAll( "\\\\u00e1", "á" ); + output = output.replaceAll( "\\\\u00e2", "â" ); + output = output.replaceAll( "\\\\u00e3", "ã" ); + output = output.replaceAll( "\\\\u00e7", "ç" ); + output = output.replaceAll( "\\\\u00e8", "è" ); + output = output.replaceAll( "\\\\u00e9", "é" ); + output = output.replaceAll( "\\\\u00ea", "ê" ); + output = output.replaceAll( "\\\\u00ec", "ì" ); + output = output.replaceAll( "\\\\u00ed", "í" ); + output = output.replaceAll( "\\\\u00ee", "î" ); + output = output.replaceAll( "\\\\u00f2", "ò" ); + output = output.replaceAll( "\\\\u00f3", "ó" ); + output = output.replaceAll( "\\\\u00f4", "ô" ); + output = output.replaceAll( "\\\\u00f5", "õ" ); + output = output.replaceAll( "\\\\u00f9", "ù" ); + output = output.replaceAll( "\\\\u00fa", "ú" ); + output = output.replaceAll( "\\\\u00fb", "û" ); + + output = output.replaceAll( "\\\\u0153", "œ" ); + + output = output.replaceAll( "\\\\u2013", "-" ); + output = output.replaceAll( "\\\\u2014", "-" ); + output = output.replaceAll( "\\\\u2018|\\\\u2019", "'" ); + output = output.replaceAll( "\\\\u201c|\\\\u201d", "\"" ); + + output = output.replaceAll( "\\\\u2022", "*" ); + output = output.replaceAll( "\\\\u2026", "..." ); + + return output; + } + +} diff --git a/branches/SIPRP/PlanosActuacao/src/java/viewhandler/CustomViewHandler.java b/branches/SIPRP/PlanosActuacao/src/java/viewhandler/CustomViewHandler.java new file mode 100644 index 00000000..83199b57 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/src/java/viewhandler/CustomViewHandler.java @@ -0,0 +1,75 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package viewhandler; + +import java.io.IOException; +import java.util.Locale; +import java.util.Map; +import javax.el.ValueExpression; +import javax.faces.FacesException; +import javax.faces.application.ViewHandler; +import javax.faces.component.UIViewRoot; +import javax.faces.context.FacesContext; + +/** + * + * @author lluis + */ +public class CustomViewHandler extends ViewHandler{ + protected ViewHandler baseViewHandler; + + public CustomViewHandler(ViewHandler viewHandler) { + super(); + this.baseViewHandler = viewHandler; + } + + public Locale calculateLocale(FacesContext facesContext) { + return baseViewHandler.calculateLocale(facesContext); + } + + public String calculateRenderKitId(FacesContext facesContext) { + return baseViewHandler.calculateRenderKitId(facesContext); + } + + public UIViewRoot createView(FacesContext facesContext, String arg1) { + setPostback(facesContext, false); + return baseViewHandler.createView(facesContext, arg1); + } + + public String getActionURL(FacesContext facesContext, String arg1) { + return baseViewHandler.getActionURL(facesContext, arg1); + } + + public String getResourceURL(FacesContext facesContext, String arg1) { + return baseViewHandler.getResourceURL(facesContext, arg1); + } + + public void renderView(FacesContext facesContext, UIViewRoot arg1) throws IOException, FacesException { + baseViewHandler.renderView(facesContext, arg1); + + } + + public UIViewRoot restoreView(FacesContext facesContext, String arg1) { + setPostback(facesContext, true); + return baseViewHandler.restoreView(facesContext, arg1); + } + + public void writeState(FacesContext facesContext) throws IOException { + baseViewHandler.writeState(facesContext); + } + + public Map getRequestScope(FacesContext facesContext) { + //return (Map)facesContext.getApplication().createValueBinding(?#{requestScope}?).getValue(facesContext); + //return (Map)facesContext.getApplication(). + return (Map) facesContext.getApplication().getExpressionFactory().createValueExpression(facesContext.getELContext(), "#{requestScope}", Map.class).getValue(facesContext.getELContext()); + } + + public void setPostback(FacesContext facesContext, boolean value) { + getRequestScope(facesContext).put("ispostback", new Boolean(value)); + } + + +} diff --git a/branches/SIPRP/PlanosActuacao/web/Dummy.jsp b/branches/SIPRP/PlanosActuacao/web/Dummy.jsp new file mode 100644 index 00000000..d857c45b --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/web/Dummy.jsp @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/PlanosActuacao/web/EditarPlano.jsp b/branches/SIPRP/PlanosActuacao/web/EditarPlano.jsp new file mode 100644 index 00000000..5b9efbfa --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/web/EditarPlano.jsp @@ -0,0 +1,280 @@ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+ + +
+
+
+
+
diff --git a/branches/SIPRP/PlanosActuacao/web/EnviarCorrecao.jsp b/branches/SIPRP/PlanosActuacao/web/EnviarCorrecao.jsp new file mode 100644 index 00000000..1d667e71 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/web/EnviarCorrecao.jsp @@ -0,0 +1,61 @@ + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+
+
+
diff --git a/branches/SIPRP/PlanosActuacao/web/Erro.jsp b/branches/SIPRP/PlanosActuacao/web/Erro.jsp new file mode 100644 index 00000000..0c699b2f --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/web/Erro.jsp @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/PlanosActuacao/web/Footer.jsp b/branches/SIPRP/PlanosActuacao/web/Footer.jsp new file mode 100644 index 00000000..9e3306f5 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/web/Footer.jsp @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/PlanosActuacao/web/Header.jspf b/branches/SIPRP/PlanosActuacao/web/Header.jspf new file mode 100644 index 00000000..3e543a9c --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/web/Header.jspf @@ -0,0 +1,60 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/branches/SIPRP/PlanosActuacao/web/ListaPlanos.jsp b/branches/SIPRP/PlanosActuacao/web/ListaPlanos.jsp new file mode 100644 index 00000000..07d05532 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/web/ListaPlanos.jsp @@ -0,0 +1,235 @@ + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
diff --git a/branches/SIPRP/PlanosActuacao/web/Login.jsp b/branches/SIPRP/PlanosActuacao/web/Login.jsp new file mode 100644 index 00000000..fb2c4c09 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/web/Login.jsp @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/PlanosActuacao/web/META-INF/context.xml b/branches/SIPRP/PlanosActuacao/web/META-INF/context.xml new file mode 100644 index 00000000..2ee21b55 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/branches/SIPRP/PlanosActuacao/web/ViewPlano.jsp b/branches/SIPRP/PlanosActuacao/web/ViewPlano.jsp new file mode 100644 index 00000000..aa62c1dc --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/web/ViewPlano.jsp @@ -0,0 +1,101 @@ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
diff --git a/branches/SIPRP/PlanosActuacao/web/WEB-INF/faces-config.xml b/branches/SIPRP/PlanosActuacao/web/WEB-INF/faces-config.xml new file mode 100644 index 00000000..37358dab --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/web/WEB-INF/faces-config.xml @@ -0,0 +1,132 @@ + + + + + + + viewhandler.CustomViewHandler + + pt_PT + + + + phaselistener.MainPhaseListener + + + SessionBean1 + planosactuacao.SessionBean1 + session + + + Login + planosactuacao.Login + request + + + ApplicationBean1 + planosactuacao.ApplicationBean1 + application + + + RequestBean1 + planosactuacao.RequestBean1 + request + + + Erro + planosactuacao.Erro + request + + + EditarPlano + planosactuacao.EditarPlano + request + + + ListaPlanos + planosactuacao.ListaPlanos + request + + + /Login.jsp + + lista_planos + /ListaPlanos.jsp + + + + /ListaPlanos.jsp + + editar_plano + /EditarPlano.jsp + + + ver_plano + /ViewPlano.jsp + + + + /EditarPlano.jsp + + lista_planos + /ListaPlanos.jsp + + + enviar_correcao + /EnviarCorrecao.jsp + + + + Header + planosactuacao.Header + request + + + /ViewPlano.jsp + + lista_planos + /ListaPlanos.jsp + + + + /EditarPlano.jsp + + lista_planos + /ListaPlanos.jsp + + + + Dummy + planosactuacao.Dummy + request + + + Footer + planosactuacao.Footer + request + + + ViewPlano + planosactuacao.ViewPlano + request + + + EnviarCorrecao + planosactuacao.EnviarCorrecao + request + + + /EnviarCorrecao.jsp + + editar_plano + /EditarPlano.jsp + + + lista_planos + /ListaPlanos.jsp + + + diff --git a/branches/SIPRP/PlanosActuacao/web/WEB-INF/web.xml b/branches/SIPRP/PlanosActuacao/web/WEB-INF/web.xml new file mode 100644 index 00000000..e90a22d0 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/web/WEB-INF/web.xml @@ -0,0 +1,98 @@ + + + + javax.faces.STATE_SAVING_METHOD + client + + + com.sun.faces.validateXml + true + + + com.sun.faces.verifyObjects + false + + + UploadFilter + com.sun.webui.jsf.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. + maxSize + 1000000 + + + 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. + sizeThreshold + 4096 + + + + UploadFilter + Faces Servlet + + + Faces Servlet + javax.faces.webapp.FacesServlet + + javax.faces.LIFECYCLE_ID + com.sun.faces.lifecycle.PARTIAL + + 1 + + + ExceptionHandlerServlet + com.sun.errorhandler.ExceptionHandler + + errorHost + localhost + + + errorPort + 24444 + + + + ThemeServlet + com.sun.webui.theme.ThemeServlet + + + Faces Servlet + /faces/* + + + ExceptionHandlerServlet + /error/ExceptionHandler + + + ThemeServlet + /theme/* + + + 30 + + + faces/Dummy.jsp + + + javax.servlet.ServletException + /error/ExceptionHandler + + + java.io.IOException + /error/ExceptionHandler + + + javax.faces.FacesException + /error/ExceptionHandler + + + com.sun.rave.web.ui.appbase.ApplicationException + /error/ExceptionHandler + + + + *.jspf + true + + + diff --git a/branches/SIPRP/PlanosActuacao/web/resources/images/Logo_Auchan_novo.jpg b/branches/SIPRP/PlanosActuacao/web/resources/images/Logo_Auchan_novo.jpg new file mode 100644 index 00000000..1b79d4cb Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/web/resources/images/Logo_Auchan_novo.jpg differ diff --git a/branches/SIPRP/PlanosActuacao/web/resources/images/SIPRP_logo_small.jpg b/branches/SIPRP/PlanosActuacao/web/resources/images/SIPRP_logo_small.jpg new file mode 100755 index 00000000..240f2358 Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/web/resources/images/SIPRP_logo_small.jpg differ diff --git a/branches/SIPRP/PlanosActuacao/web/resources/images/logo_auchan_small.jpg b/branches/SIPRP/PlanosActuacao/web/resources/images/logo_auchan_small.jpg new file mode 100755 index 00000000..376eee0e Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/web/resources/images/logo_auchan_small.jpg differ diff --git a/branches/SIPRP/PlanosActuacao/web/resources/images/logo_evolute_small.png b/branches/SIPRP/PlanosActuacao/web/resources/images/logo_evolute_small.png new file mode 100644 index 00000000..0198da2b Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/web/resources/images/logo_evolute_small.png differ diff --git a/branches/SIPRP/PlanosActuacao/web/resources/images/puls_more.gif b/branches/SIPRP/PlanosActuacao/web/resources/images/puls_more.gif new file mode 100755 index 00000000..f10da648 Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/web/resources/images/puls_more.gif differ diff --git a/branches/SIPRP/PlanosActuacao/web/resources/pdf/AAA.pdf b/branches/SIPRP/PlanosActuacao/web/resources/pdf/AAA.pdf new file mode 100644 index 00000000..9c205b33 Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/web/resources/pdf/AAA.pdf differ diff --git a/branches/SIPRP/PlanosActuacao/web/resources/pdf/planos_actuacao_ajuda.pdf b/branches/SIPRP/PlanosActuacao/web/resources/pdf/planos_actuacao_ajuda.pdf new file mode 100644 index 00000000..333e4938 Binary files /dev/null and b/branches/SIPRP/PlanosActuacao/web/resources/pdf/planos_actuacao_ajuda.pdf differ diff --git a/branches/SIPRP/PlanosActuacao/web/resources/stylesheet.css b/branches/SIPRP/PlanosActuacao/web/resources/stylesheet.css new file mode 100644 index 00000000..04b07f81 --- /dev/null +++ b/branches/SIPRP/PlanosActuacao/web/resources/stylesheet.css @@ -0,0 +1,189 @@ +/* + * After modifying this style sheet, refresh the page being designed to see the effect of the modification. + * Click the Refresh button in the Visual Designer toolbar to refresh the page. + */ + +/* Style rules to make Java Server faces Standarad data tables look better */ + +body {background-color: #f8f8f0;} + +.list-header { + background-color: #eeeeee; + font-size: larger; + font-weight: bold; +} + +.list-paging-header { + background-color: white; +} + +.list-paging-footer { + background-color: white; +} + +.list-row-even { +} + +.list-row-odd { + background-color: #eeeeee; +} + +/* Labels */ + +.label{ + font-size : 12px; + font-weight : bold; +} + +/* center blocks */ + +.centerBlock{ + text-align: center; + left: 0; + right: 0; + margin-left: auto; + margin-right: auto;} + +/* Grid panel column alignment */ + +.gridColLeft { + text-align : left; +} + +.gridColLeft10{ + text-align : left; + vertical-align: top; + width : 10%; +} + +.gridColLeft20{ + text-align : left; + vertical-align: top; + width : 20%; +} + +.gridColLeft30{ + text-align : left; + vertical-align: top; + width : 30%; +} + +.gridColLeft80{ + text-align : left; + vertical-align: top; + width : 80%; +} + +.gridColLeft90{ + text-align : left; + vertical-align: top; + width : 90%; +} + +.gridColCenter40 { + text-align: center; +} + +.gridColCenter { + text-align: center; + width : 40%; +} + +.gridColRight30 { + text-align: right; + width : 30%; +} + +.gridColRight { + text-align: right; +} + +.gridCol10{ + width: 10%; +} +.gridCol15{ + width: 15%; +} +.gridCol20{ + width: 20%; +} +.gridCol30{ + width: 30%; +} + +.gridCol40{ + width: 40%; +} + +.gridCol50{ + width: 50%; +} + +.gridCol60{ + width: 60%; +} + +.gridCol70{ + width: 70%; +} +.gridCol80{ + width: 80%; +} +.gridCol85{ + width: 85%; +} +.gridCol90{ + width: 90%; +} + +.gridPlanosList{ + background-color: #f6f4e8; + border: solid 1px #000000; +} + +/* Style rules for message severity levels */ +.labelMsg{ + font-weight : bold; + color: #cc0033; + font-size :14px ; +} + +.visible { + /* visibility: visible; */ + display : block; +} + +.hidden { + /* visibility: hidden; */ + display : none; +} + +.fakeLink{ + cursor: pointer; + color: #0000cc; +} + +.infoMessage { + font-size : 13px; + color: black; +} + +.warnMessage { + font-size : 13px; + color: orange; + font-weight: bold; +} + +.errorMessage { + color: #990000; + font-weight: bold; + font-size : 13px; +} + +.fatalMessage { + color: red; + font-style: italic; + font-size : 13px; + font-weight: bold; +} + diff --git a/branches/SIPRP/SIPRPSoft/.classpath b/branches/SIPRP/SIPRPSoft/.classpath new file mode 100644 index 00000000..95301e50 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/.classpath @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/.project b/branches/SIPRP/SIPRPSoft/.project new file mode 100644 index 00000000..a33bc2b6 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/.project @@ -0,0 +1,17 @@ + + + SIPRPSoft + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/branches/SIPRP/SIPRPSoft/.settings/org.eclipse.jdt.core.prefs b/branches/SIPRP/SIPRPSoft/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..3c586dc3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Wed Jun 23 14:57:38 WEST 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/branches/SIPRP/SIPRPSoft/ant/common/evo-app-build-common.xml b/branches/SIPRP/SIPRPSoft/ant/common/evo-app-build-common.xml new file mode 100644 index 00000000..fadecbb0 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/ant/common/evo-app-build-common.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/ant/common/evo-app-build-obfuscate-common.xml b/branches/SIPRP/SIPRPSoft/ant/common/evo-app-build-obfuscate-common.xml new file mode 100644 index 00000000..1c844aae --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/ant/common/evo-app-build-obfuscate-common.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + -printseeds + -verbose + -dontskipnonpubliclibraryclasses + + -keepclasseswithmembers public class * { + public static void main(java.lang.String[]); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/ant/common/evo-app-compile-common.xml b/branches/SIPRP/SIPRPSoft/ant/common/evo-app-compile-common.xml new file mode 100644 index 00000000..10f56152 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/ant/common/evo-app-compile-common.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/ant/common/evo-app-deploy-common.xml b/branches/SIPRP/SIPRPSoft/ant/common/evo-app-deploy-common.xml new file mode 100644 index 00000000..49b46ba0 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/ant/common/evo-app-deploy-common.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Deploy cancelled + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/ant/common/evo-app-load-properties.xml b/branches/SIPRP/SIPRPSoft/ant/common/evo-app-load-properties.xml new file mode 100644 index 00000000..c311b2cc --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/ant/common/evo-app-load-properties.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/ant/common/evo-app-multiple-client-common.xml b/branches/SIPRP/SIPRPSoft/ant/common/evo-app-multiple-client-common.xml new file mode 100644 index 00000000..84b2469a --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/ant/common/evo-app-multiple-client-common.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/ant/evo-app-build-java5.xml b/branches/SIPRP/SIPRPSoft/ant/evo-app-build-java5.xml new file mode 100644 index 00000000..3280e098 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/ant/evo-app-build-java5.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/ant/evo-app-build-jdo.xml b/branches/SIPRP/SIPRPSoft/ant/evo-app-build-jdo.xml new file mode 100644 index 00000000..d9d46f46 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/ant/evo-app-build-jdo.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/ant/evo-app-build-obfuscate-jdo.xml b/branches/SIPRP/SIPRPSoft/ant/evo-app-build-obfuscate-jdo.xml new file mode 100644 index 00000000..3b1f2ba1 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/ant/evo-app-build-obfuscate-jdo.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/ant/evo-app-build-obfuscate.xml b/branches/SIPRP/SIPRPSoft/ant/evo-app-build-obfuscate.xml new file mode 100644 index 00000000..168357f6 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/ant/evo-app-build-obfuscate.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/ant/evo-app-build.xml b/branches/SIPRP/SIPRPSoft/ant/evo-app-build.xml new file mode 100644 index 00000000..099651cb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/ant/evo-app-build.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/ant/evo-app-multiple-client-build.xml b/branches/SIPRP/SIPRPSoft/ant/evo-app-multiple-client-build.xml new file mode 100644 index 00000000..e50cb65f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/ant/evo-app-multiple-client-build.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/ant/evo-app-multiple-client-obfuscated-build.xml b/branches/SIPRP/SIPRPSoft/ant/evo-app-multiple-client-obfuscated-build.xml new file mode 100644 index 00000000..aaf21aed --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/ant/evo-app-multiple-client-obfuscated-build.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/ant/evo-app-ws-client-build.xml b/branches/SIPRP/SIPRPSoft/ant/evo-app-ws-client-build.xml new file mode 100644 index 00000000..9c9e3e96 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/ant/evo-app-ws-client-build.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/ant/evo-library-build.xml b/branches/SIPRP/SIPRPSoft/ant/evo-library-build.xml new file mode 100644 index 00000000..495899c5 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/ant/evo-library-build.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/ant/evo-tool-build.xml b/branches/SIPRP/SIPRPSoft/ant/evo-tool-build.xml new file mode 100644 index 00000000..043576b7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/ant/evo-tool-build.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/build.xml b/branches/SIPRP/SIPRPSoft/build.xml new file mode 100644 index 00000000..2ee97e0e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/build.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/jnlp/production/siprp_itext.jnlp b/branches/SIPRP/SIPRPSoft/jnlp/production/siprp_itext.jnlp new file mode 100644 index 00000000..0af1a639 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/jnlp/production/siprp_itext.jnlp @@ -0,0 +1,27 @@ + + + + SIPRP + EVOLUTE 2010 + + SIPRP, v11 + SIPRP + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/jnlp/production/siprp_mail.jnlp b/branches/SIPRP/SIPRPSoft/jnlp/production/siprp_mail.jnlp new file mode 100644 index 00000000..af448c62 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/jnlp/production/siprp_mail.jnlp @@ -0,0 +1,28 @@ + + + + SIPRP + EVOLUTE 2010 + + SIPRP, v11 + SIPRP + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/jnlp/production/siprp_pdfrenderer.jnlp b/branches/SIPRP/SIPRPSoft/jnlp/production/siprp_pdfrenderer.jnlp new file mode 100644 index 00000000..352ee212 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/jnlp/production/siprp_pdfrenderer.jnlp @@ -0,0 +1,29 @@ + + + + + SIPRP + EVOLUTE 2010 + + SIPRP, v11 + SIPRP + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/jnlp/production/siprpsoft-local3.jnlp b/branches/SIPRP/SIPRPSoft/jnlp/production/siprpsoft-local3.jnlp new file mode 100644 index 00000000..f2ba6a24 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/jnlp/production/siprpsoft-local3.jnlp @@ -0,0 +1,57 @@ + + + + SIPRP/local3 + EVOLUTE 2010 + + SIPRP, v11 + SIPRP/local3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/jnlp/production/siprpsoft.jnlp b/branches/SIPRP/SIPRPSoft/jnlp/production/siprpsoft.jnlp new file mode 100644 index 00000000..7be4d7e7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/jnlp/production/siprpsoft.jnlp @@ -0,0 +1,57 @@ + + + + SIPRP + EVOLUTE 2010 + + SIPRP, v11 + SIPRP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/lib.tools/ant-classloadertask.jar b/branches/SIPRP/SIPRPSoft/lib.tools/ant-classloadertask.jar new file mode 100644 index 00000000..d2f58d9f Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib.tools/ant-classloadertask.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib.tools/asm-all-3.1.jar b/branches/SIPRP/SIPRPSoft/lib.tools/asm-all-3.1.jar new file mode 100644 index 00000000..5f37af52 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib.tools/asm-all-3.1.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib.tools/datanucleus-enhancer-1.1.4.jar b/branches/SIPRP/SIPRPSoft/lib.tools/datanucleus-enhancer-1.1.4.jar new file mode 100644 index 00000000..6f7dd6c3 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib.tools/datanucleus-enhancer-1.1.4.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib.tools/evo-ant.jar b/branches/SIPRP/SIPRPSoft/lib.tools/evo-ant.jar new file mode 100644 index 00000000..c8ad8da1 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib.tools/evo-ant.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib.tools/evoservices.jar b/branches/SIPRP/SIPRPSoft/lib.tools/evoservices.jar new file mode 100644 index 00000000..f4e1417a Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib.tools/evoservices.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib.tools/jaxen-1.1.1.jar b/branches/SIPRP/SIPRPSoft/lib.tools/jaxen-1.1.1.jar new file mode 100644 index 00000000..b6336311 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib.tools/jaxen-1.1.1.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib.tools/jdom.jar b/branches/SIPRP/SIPRPSoft/lib.tools/jdom.jar new file mode 100644 index 00000000..288e64cb Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib.tools/jdom.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib.tools/jsch-0.1.41.jar b/branches/SIPRP/SIPRPSoft/lib.tools/jsch-0.1.41.jar new file mode 100644 index 00000000..eb1e7647 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib.tools/jsch-0.1.41.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib.tools/leaf.jar b/branches/SIPRP/SIPRPSoft/lib.tools/leaf.jar new file mode 100644 index 00000000..2e4d3c44 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib.tools/leaf.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib.tools/proguard.jar b/branches/SIPRP/SIPRPSoft/lib.tools/proguard.jar new file mode 100644 index 00000000..3a9aebcf Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib.tools/proguard.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib.tools/svnClientAdapter.jar b/branches/SIPRP/SIPRPSoft/lib.tools/svnClientAdapter.jar new file mode 100644 index 00000000..ed37ba46 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib.tools/svnClientAdapter.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib.tools/svnant.jar b/branches/SIPRP/SIPRPSoft/lib.tools/svnant.jar new file mode 100644 index 00000000..af52be0d Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib.tools/svnant.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib.tools/svnjavahl.jar b/branches/SIPRP/SIPRPSoft/lib.tools/svnjavahl.jar new file mode 100644 index 00000000..71873057 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib.tools/svnjavahl.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib.tools/truelicense.jar b/branches/SIPRP/SIPRPSoft/lib.tools/truelicense.jar new file mode 100644 index 00000000..8c56bd12 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib.tools/truelicense.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib.tools/truexml.jar b/branches/SIPRP/SIPRPSoft/lib.tools/truexml.jar new file mode 100644 index 00000000..6ce23e31 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib.tools/truexml.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/PDFRenderer.jar b/branches/SIPRP/SIPRPSoft/lib/PDFRenderer.jar new file mode 100644 index 00000000..1c3fed2f Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/PDFRenderer.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/TableLayout.jar b/branches/SIPRP/SIPRPSoft/lib/TableLayout.jar new file mode 100755 index 00000000..81c1fc3c Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/TableLayout.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/ashwood-2.0.jar b/branches/SIPRP/SIPRPSoft/lib/ashwood-2.0.jar new file mode 100644 index 00000000..55fcc9b1 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/ashwood-2.0.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/avalon-framework-4.2.0.jar b/branches/SIPRP/SIPRPSoft/lib/avalon-framework-4.2.0.jar new file mode 100644 index 00000000..22a7ab34 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/avalon-framework-4.2.0.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/batik-all-1.7.jar b/branches/SIPRP/SIPRPSoft/lib/batik-all-1.7.jar new file mode 100644 index 00000000..58932858 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/batik-all-1.7.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/cayenne-server-3.0M6.jar b/branches/SIPRP/SIPRPSoft/lib/cayenne-server-3.0M6.jar new file mode 100644 index 00000000..fdf0d056 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/cayenne-server-3.0M6.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/commons-collections-3.1.jar b/branches/SIPRP/SIPRPSoft/lib/commons-collections-3.1.jar new file mode 100644 index 00000000..41e230fe Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/commons-collections-3.1.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/commons-io-1.4.jar b/branches/SIPRP/SIPRPSoft/lib/commons-io-1.4.jar new file mode 100644 index 00000000..133dc6cb Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/commons-io-1.4.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/commons-lang-2.1.jar b/branches/SIPRP/SIPRPSoft/lib/commons-lang-2.1.jar new file mode 100644 index 00000000..87b80ab5 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/commons-lang-2.1.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/commons-logging-1.0.4.jar b/branches/SIPRP/SIPRPSoft/lib/commons-logging-1.0.4.jar new file mode 100644 index 00000000..b73a80fa Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/commons-logging-1.0.4.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/commons-logging-1.1.jar b/branches/SIPRP/SIPRPSoft/lib/commons-logging-1.1.jar new file mode 100644 index 00000000..2ff9bbd9 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/commons-logging-1.1.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/evologger.jar b/branches/SIPRP/SIPRPSoft/lib/evologger.jar new file mode 100644 index 00000000..65560ad4 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/evologger.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/evolute.jar b/branches/SIPRP/SIPRPSoft/lib/evolute.jar new file mode 100644 index 00000000..20967ce9 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/evolute.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/evospellchecker.jar b/branches/SIPRP/SIPRPSoft/lib/evospellchecker.jar new file mode 100644 index 00000000..c96d55b5 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/evospellchecker.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/fop.jar b/branches/SIPRP/SIPRPSoft/lib/fop.jar new file mode 100644 index 00000000..24419bcf Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/fop.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/iText-2.0.7.jar b/branches/SIPRP/SIPRPSoft/lib/iText-2.0.7.jar new file mode 100644 index 00000000..d6267523 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/iText-2.0.7.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/jai_imageio.jar b/branches/SIPRP/SIPRPSoft/lib/jai_imageio.jar new file mode 100644 index 00000000..359551eb Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/jai_imageio.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/jazzy-core.jar b/branches/SIPRP/SIPRPSoft/lib/jazzy-core.jar new file mode 100644 index 00000000..50d31354 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/jazzy-core.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/jcalendar-1.3.2.jar b/branches/SIPRP/SIPRPSoft/lib/jcalendar-1.3.2.jar new file mode 100755 index 00000000..b5e5a2d8 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/jcalendar-1.3.2.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/jdo.jar b/branches/SIPRP/SIPRPSoft/lib/jdo.jar new file mode 100755 index 00000000..2cee6e86 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/jdo.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/jdom.jar b/branches/SIPRP/SIPRPSoft/lib/jdom.jar new file mode 100644 index 00000000..288e64cb Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/jdom.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/jpox-1.0.4.jar b/branches/SIPRP/SIPRPSoft/lib/jpox-1.0.4.jar new file mode 100644 index 00000000..414e1525 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/jpox-1.0.4.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/jxl-2.6.jar b/branches/SIPRP/SIPRPSoft/lib/jxl-2.6.jar new file mode 100644 index 00000000..313cab7f Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/jxl-2.6.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/log4j-1.2.8.jar b/branches/SIPRP/SIPRPSoft/lib/log4j-1.2.8.jar new file mode 100644 index 00000000..493a3ccc Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/log4j-1.2.8.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/mail.jar b/branches/SIPRP/SIPRPSoft/lib/mail.jar new file mode 100644 index 00000000..59543774 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/mail.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/nlog4j-1.2.25.jar b/branches/SIPRP/SIPRPSoft/lib/nlog4j-1.2.25.jar new file mode 100644 index 00000000..e398699b Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/nlog4j-1.2.25.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/postgresql-8.4-701.jdbc4.jar b/branches/SIPRP/SIPRPSoft/lib/postgresql-8.4-701.jdbc4.jar new file mode 100644 index 00000000..e21beec5 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/postgresql-8.4-701.jdbc4.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/serializer-2.7.0.jar b/branches/SIPRP/SIPRPSoft/lib/serializer-2.7.0.jar new file mode 100644 index 00000000..7cd80696 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/serializer-2.7.0.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/shst.jar b/branches/SIPRP/SIPRPSoft/lib/shst.jar new file mode 100644 index 00000000..51cd85b6 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/shst.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/smtp.jar b/branches/SIPRP/SIPRPSoft/lib/smtp.jar new file mode 100644 index 00000000..1fb647ce Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/smtp.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/swingx.jar b/branches/SIPRP/SIPRPSoft/lib/swingx.jar new file mode 100644 index 00000000..dec67850 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/swingx.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/xalan-2.7.0.jar b/branches/SIPRP/SIPRPSoft/lib/xalan-2.7.0.jar new file mode 100644 index 00000000..979ee761 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/xalan-2.7.0.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/xercesImpl-2.7.1.jar b/branches/SIPRP/SIPRPSoft/lib/xercesImpl-2.7.1.jar new file mode 100644 index 00000000..eac75ae8 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/xercesImpl-2.7.1.jar differ diff --git a/branches/SIPRP/SIPRPSoft/lib/xmlgraphics-commons-1.3.1.jar b/branches/SIPRP/SIPRPSoft/lib/xmlgraphics-commons-1.3.1.jar new file mode 100644 index 00000000..81a485dc Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/lib/xmlgraphics-commons-1.3.1.jar differ diff --git a/branches/SIPRP/SIPRPSoft/print/open.bat b/branches/SIPRP/SIPRPSoft/print/open.bat new file mode 100644 index 00000000..c7bed697 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/print/open.bat @@ -0,0 +1 @@ +c:\temp\acrord32.lnk "%1" \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/print/print.bat b/branches/SIPRP/SIPRPSoft/print/print.bat new file mode 100644 index 00000000..757aee95 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/print/print.bat @@ -0,0 +1 @@ +c:\temp\acrord32.lnk /t "%1" %2 \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/properties/1-development/app.properties b/branches/SIPRP/SIPRPSoft/properties/1-development/app.properties new file mode 100644 index 00000000..2980b7ff --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/properties/1-development/app.properties @@ -0,0 +1,75 @@ +#APP level +app.appName = SIPRPSoft +app.main-class = siprp.Main +app.main = siprp.Main + +db.url.prefix = jdbc:postgresql:// +db.user = postgres +db.password = Typein +#rg2h-opksiprp +db.name = siprp_local_3_20100713 +db.connection.driver = org.postgresql.Driver + +jnlp.resources.property.server.address = evoserver +jnlp.resources.property.server.port = 5432 + + +#app.max.mem=512M +#app.run.args=test 1 2 3 + +#app.resources.j2se.version = 1.0+ +#app.resources.j2se.initial-heap-size = 4m +#app.resources.j2se.max-heap-size = 8m + +#app.ws.dest.package=com.evolute.test-project.stubs +#app.ws.wsdl.url=https://www.evolute.pt/test-project/test-endpoint?wsdl +#app.ws.wsdl.url.protocol=https +#app.ws.wsdl.url.host=www.evolute.pt +#app.ws.wsdl.url.port=443 +#app.ws.wsdl.url.path=/test-project/test-endpoint?wsdl + +#app.ssl.truststore.file=jssecacerts +#app.ssl.truststore.pass=changeit + +#JNLP level +#jnlp.app.appName = test-project +#jnlp.information.title = jnlp-Test Project +#jnlp.resources.j2se.version = 1.1+ +#jnlp.test.url=http://www.evolute.pt/~software/test-project + + +#JNLP + PRODUCTION level +#jnlp.production.app.main-class = !com.evolute.test-project.TestProject2 +#jnlp.production.app.appName = test-project +#jnlp.production.url=http://www.evolute.pt/~software/test-project + +#jnlp.production.information.title = prod-Test Project +#jnlp.production.information.vendor = prod-Evolute Lda +#jnlp.production.information.description = prod-Tester Project for JNLP Generator +#jnlp.production.information.description.short = prod-JNLP Tester +#jnlp.production.information.icon = prod-logo.png + +#jnlp.production.resources.j2se.version = 1.6.0+ +#jnlp.production.resources.j2se.initial-heap-size = 64m +#jnlp.production.resources.j2se.max-heap-size = 512m + +#jnlp.production.resources.property.jnlp.packEnabled = true +#jnlp.production.resources.property.apple.laf.useScreenMenuBar = true +#jnlp.production.resources.property.swing.defaultlaf = org.jvnet.substance.skin.SubstanceRavenGraphiteGlassLookAndFeel +#jnlp.production.resources.property.evolute.ui.overridePaint = false + + +#JNLP + TEST level +#jnlp.test.app.main-class = com.evolute.test-project.TestProject3 +#jnlp.test.app.appName = project-test +#jnlp.test.url=http://www.evolute.pt/~software/versoes_teste/test-project + +#jnlp.test.information.title = test-Test Project +#jnlp.test.information.vendor = test-Evolute Lda +#jnlp.test.information.description = test-Tester Project for JNLP Generator +#jnlp.test.information.description.short = test-JNLP Tester +#jnlp.test.information.icon = test-logo.png + +#jnlp.test.resources.j2se.version = 1.6.0+ +#jnlp.test.resources.j2se.initial-heap-size = 64m +#jnlp.test.resources.j2se.max-heap-size = 512m diff --git a/branches/SIPRP/SIPRPSoft/properties/2-testing/app.properties b/branches/SIPRP/SIPRPSoft/properties/2-testing/app.properties new file mode 100644 index 00000000..2bbd09e8 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/properties/2-testing/app.properties @@ -0,0 +1,74 @@ +#APP level +app.appName = SIPRPSoft +app.main-class = siprp.Main +app.main = siprp.Main + +db.url.prefix = jdbc:postgresql:// +db.user = siprp +db.password = rg2h-opksiprp +db.name = siprp_local_3 +db.connection.driver = org.postgresql.Driver + +jnlp.resources.property.server.address = www.evolute.pt +jnlp.resources.property.server.port = 5436 + + +#app.max.mem=512M +#app.run.args=test 1 2 3 + +#app.resources.j2se.version = 1.0+ +#app.resources.j2se.initial-heap-size = 4m +#app.resources.j2se.max-heap-size = 8m + +#app.ws.dest.package=com.evolute.test-project.stubs +#app.ws.wsdl.url=https://www.evolute.pt/test-project/test-endpoint?wsdl +#app.ws.wsdl.url.protocol=https +#app.ws.wsdl.url.host=www.evolute.pt +#app.ws.wsdl.url.port=443 +#app.ws.wsdl.url.path=/test-project/test-endpoint?wsdl + +#app.ssl.truststore.file=jssecacerts +#app.ssl.truststore.pass=changeit + +#JNLP level +#jnlp.app.appName = test-project +#jnlp.information.title = jnlp-Test Project +#jnlp.resources.j2se.version = 1.1+ +#jnlp.test.url=http://www.evolute.pt/~software/test-project + + +#JNLP + PRODUCTION level +#jnlp.production.app.main-class = !com.evolute.test-project.TestProject2 +#jnlp.production.app.appName = test-project +#jnlp.production.url=http://www.evolute.pt/~software/test-project + +#jnlp.production.information.title = prod-Test Project +#jnlp.production.information.vendor = prod-Evolute Lda +#jnlp.production.information.description = prod-Tester Project for JNLP Generator +#jnlp.production.information.description.short = prod-JNLP Tester +#jnlp.production.information.icon = prod-logo.png + +#jnlp.production.resources.j2se.version = 1.6.0+ +#jnlp.production.resources.j2se.initial-heap-size = 64m +#jnlp.production.resources.j2se.max-heap-size = 512m + +#jnlp.production.resources.property.jnlp.packEnabled = true +#jnlp.production.resources.property.apple.laf.useScreenMenuBar = true +#jnlp.production.resources.property.swing.defaultlaf = org.jvnet.substance.skin.SubstanceRavenGraphiteGlassLookAndFeel +#jnlp.production.resources.property.evolute.ui.overridePaint = false + + +#JNLP + TEST level +#jnlp.test.app.main-class = com.evolute.test-project.TestProject3 +#jnlp.test.app.appName = project-test +#jnlp.test.url=http://www.evolute.pt/~software/versoes_teste/test-project + +#jnlp.test.information.title = test-Test Project +#jnlp.test.information.vendor = test-Evolute Lda +#jnlp.test.information.description = test-Tester Project for JNLP Generator +#jnlp.test.information.description.short = test-JNLP Tester +#jnlp.test.information.icon = test-logo.png + +#jnlp.test.resources.j2se.version = 1.6.0+ +#jnlp.test.resources.j2se.initial-heap-size = 64m +#jnlp.test.resources.j2se.max-heap-size = 512m diff --git a/branches/SIPRP/SIPRPSoft/properties/3-production/app.properties b/branches/SIPRP/SIPRPSoft/properties/3-production/app.properties new file mode 100644 index 00000000..d6ef1447 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/properties/3-production/app.properties @@ -0,0 +1,73 @@ +#APP level +app.appName = SIPRPSoft +app.main-class = siprp.Main +app.main = siprp.Main + +db.url.prefix = jdbc:postgresql:// +db.user = postgres +db.password = Typein +db.name = siprp_local +db.connection.driver = org.postgresql.Driver + +jnlp.resources.property.server.address = 10.158.2.2:5432 +jnlp.resources.property.server.port = 5432 + +#app.max.mem=512M +#app.run.args=test 1 2 3 + +#app.resources.j2se.version = 1.0+ +#app.resources.j2se.initial-heap-size = 4m +#app.resources.j2se.max-heap-size = 8m + +#app.ws.dest.package=com.evolute.test-project.stubs +#app.ws.wsdl.url=https://www.evolute.pt/test-project/test-endpoint?wsdl +#app.ws.wsdl.url.protocol=https +#app.ws.wsdl.url.host=www.evolute.pt +#app.ws.wsdl.url.port=443 +#app.ws.wsdl.url.path=/test-project/test-endpoint?wsdl + +#app.ssl.truststore.file=jssecacerts +#app.ssl.truststore.pass=changeit + +#JNLP level +#jnlp.app.appName = test-project +#jnlp.information.title = jnlp-Test Project +#jnlp.resources.j2se.version = 1.1+ +#jnlp.test.url=http://www.evolute.pt/~software/test-project + + +#JNLP + PRODUCTION level +#jnlp.production.app.main-class = !com.evolute.test-project.TestProject2 +#jnlp.production.app.appName = test-project +#jnlp.production.url=http://www.evolute.pt/~software/test-project + +#jnlp.production.information.title = prod-Test Project +#jnlp.production.information.vendor = prod-Evolute Lda +#jnlp.production.information.description = prod-Tester Project for JNLP Generator +#jnlp.production.information.description.short = prod-JNLP Tester +#jnlp.production.information.icon = prod-logo.png + +#jnlp.production.resources.j2se.version = 1.6.0+ +#jnlp.production.resources.j2se.initial-heap-size = 64m +#jnlp.production.resources.j2se.max-heap-size = 512m + +#jnlp.production.resources.property.jnlp.packEnabled = true +#jnlp.production.resources.property.apple.laf.useScreenMenuBar = true +#jnlp.production.resources.property.swing.defaultlaf = org.jvnet.substance.skin.SubstanceRavenGraphiteGlassLookAndFeel +#jnlp.production.resources.property.evolute.ui.overridePaint = false + + +#JNLP + TEST level +#jnlp.test.app.main-class = com.evolute.test-project.TestProject3 +#jnlp.test.app.appName = project-test +#jnlp.test.url=http://www.evolute.pt/~software/versoes_teste/test-project + +#jnlp.test.information.title = test-Test Project +#jnlp.test.information.vendor = test-Evolute Lda +#jnlp.test.information.description = test-Tester Project for JNLP Generator +#jnlp.test.information.description.short = test-JNLP Tester +#jnlp.test.information.icon = test-logo.png + +#jnlp.test.resources.j2se.version = 1.6.0+ +#jnlp.test.resources.j2se.initial-heap-size = 64m +#jnlp.test.resources.j2se.max-heap-size = 512m diff --git a/branches/SIPRP/SIPRPSoft/properties/codegen.xml b/branches/SIPRP/SIPRPSoft/properties/codegen.xml new file mode 100644 index 00000000..6d6006d3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/properties/codegen.xml @@ -0,0 +1,399 @@ + + + + jdbc:postgresql://www.evolute.pt:5436/siprp_local_3 + postgres + Typein + + /home/tsimao/workspace/SIPRPSoft/src + siprp.data.inner + siprp.data.outer + siprp.data.BaseObject + package.xml + + actualizacao + Actualizacao + +
+ + avisos + Avisos + +
+ + contactos + Contactos + +
+ + ecd_oficial + EcdOficial + +
+ + email_plano_de_actuacao + EmailPlanoDeActuacao + +
+ + empresas + Empresas + +
+ + errors + Errors + +
+ + estabelecimentos + Estabelecimentos + +
+ + etiquetas + Etiquetas + +
+ + exames + Exames + +
+ + exames_perfis + ExamesPerfis + +
+ + exames_portaria + ExamesPortaria + +
+ + historico_estabelecimento + HistoricoEstabelecimento + siprp.data.Historico +
+ + hs_area + HsArea + +
+ + hs_email + HsEmail + +
+ + hs_email_empresa + HsEmailEmpresa + +
+ + hs_email_estabelecimento + HsEmailEstabelecimento + +
+ + hs_equipamento + HsEquipamento + +
+ + hs_legislacao + HsLegislacao + +
+ + hs_legislacao_categoria + HsLegislacaoCategoria + +
+ + hs_legislacao_empresa + HsLegislacaoEmpresa + +
+ + hs_legislacao_estabelecimento + HsLegislacaoEstabelecimento + +
+ + hs_medida + HsMedida + +
+ + hs_normalizacao + HsNormalizacao + +
+ + hs_normalizacao_empresa + HsNormalizacaoEmpresa + +
+ + hs_normalizacao_estabelecimento + HsNormalizacaoEstabelecimento + +
+ + hs_posto + HsPosto + +
+ + hs_posto_estabelecimento + HsPostoEstabelecimento + +
+ + hs_posto_medida + HsPostoMedida + +
+ + hs_posto_risco + HsPostoRisco + +
+ + hs_relatorio + HsRelatorio + +
+ + hs_relatorio_area + HsRelatorioArea + +
+ + hs_relatorio_equipamento + HsRelatorioEquipamento + +
+ + hs_relatorio_legislacao + HsRelatorioLegislacao + +
+ + hs_relatorio_medida + HsRelatorioMedida + +
+ + hs_relatorio_normalizacao + HsRelatorioNormalizacao + +
+ + hs_relatorio_posto + HsRelatorioPosto + +
+ + hs_relatorio_posto_medida + HsRelatorioPostoMedida + +
+ + hs_relatorio_posto_risco + HsRelatorioPostoRisco + +
+ + hs_relatorio_risco + HsRelatorioRisco + +
+ + hs_relatorio_risco_valor_qualitativo + HsRelatorioRiscoValorQualitativo + +
+ + hs_risco + HsRisco + +
+ + hs_risco_empresa + HsRiscoEmpresa + +
+ + hs_risco_medida + HsRiscoMedida + +
+ + hs_risco_tema + HsRiscoTema + +
+ + ids + Ids + +
+ + image + Image + +
+ + lembretes + Lembretes + +
+ + lembretes_tipos + LembretesTipos + +
+ + marcacoes_empresa + MarcacoesEmpresa + siprp.data.Marcacao +
+ + marcacoes_estabelecimento + MarcacoesEstabelecimento + siprp.data.Marcacao +
+ + marcacoes_grupos_realizados + MarcacoesGruposRealizados + +
+ + marcacoes_tecnicos_hst + MarcacoesTecnicosHst + +
+ + marcacoes_trabalhador + MarcacoesTrabalhador + siprp.data.Marcacao +
+ + marcacoes_trabalhador_estados + MarcacoesTrabalhadorEstados + +
+ + medicos + Medicos + +
+ + prestadores + Prestadores + +
+ + prestadores_grupos_protocolo + PrestadoresGruposProtocolo + +
+ + prt_elementos_protocolo + PrtElementosProtocolo + +
+ + prt_grupos_protocolo + PrtGruposProtocolo + +
+ + prt_tipos_elementos_protocolo + PrtTiposElementosProtocolo + +
+ + tipos_exames_comp + TiposExamesComp + +
+ + trabalhadores + Trabalhadores + +
+ + trabalhadores_consultas + TrabalhadoresConsultas + +
+ + trabalhadores_consultas_datas + TrabalhadoresConsultasDatas + +
+ + trabalhadores_consultas_datas_emails + TrabalhadoresConsultasDatasEmails + +
+ + trabalhadores_consultas_datas_observacoes + TrabalhadoresConsultasDatasObservacoes + +
+ + trabalhadores_ecd + TrabalhadoresEcd + +
+ + trabalhadores_ecds + TrabalhadoresEcds + +
+ + trabalhadores_ecds_analise + TrabalhadoresEcdsAnalise + +
+ + trabalhadores_ecds_datas + TrabalhadoresEcdsDatas + +
+ + trabalhadores_ecds_datas_emails + TrabalhadoresEcdsDatasEmails + +
+ + trabalhadores_ecds_datas_observacoes + TrabalhadoresEcdsDatasObservacoes + +
+ + trabalhadores_fichas_aptidao + TrabalhadoresFichasAptidao + +
+ + trabalhadores_processo + TrabalhadoresProcesso + +
+ + versao + Versao + +
+ + version + Version + +
+
+ diff --git a/branches/SIPRP/SIPRPSoft/properties/project.properties b/branches/SIPRP/SIPRPSoft/properties/project.properties new file mode 100644 index 00000000..5d747fdc --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/properties/project.properties @@ -0,0 +1,12 @@ +#app.jar.name= +#jnlp.dir= +#jnlp.extensions.dir= +#app.deploy.path= +#app.deploy.jnlp.path= +#app.version.file= +#app.version.comment= +#app.java.version=1.6 +#app.deploy.server=www.evolute.pt +#app.deploy.production.script=/home/software/auto_deploy.sh +#app.deploy.test.script=/home/software/auto_test_deploy.sh +#deploy.prepare.script=/home/software/auto_prepare_deploy.sh diff --git a/branches/SIPRP/SIPRPSoft/properties/version.properties b/branches/SIPRP/SIPRPSoft/properties/version.properties new file mode 100644 index 00000000..d40b8e9e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/properties/version.properties @@ -0,0 +1,6 @@ +#SIPRPSoft versioning file +#Fri Jun 25 17:32:18 WEST 2010 +major=0 +name=SIPRPSoft +minor=0 +build=1 diff --git a/branches/SIPRP/SIPRPSoft/src/SIPRPMap.map.xml b/branches/SIPRP/SIPRPSoft/src/SIPRPMap.map.xml new file mode 100644 index 00000000..af99153b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/SIPRPMap.map.xml @@ -0,0 +1,2117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + ORACLE + + + + + + + + + + ORACLE + ecd_oficial_id_seq + 1 + + + + + + + + ORACLE + email_plano_de_actuacao_id_seq + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ORACLE + etiquetas_id_seq + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ORACLE + exames_portaria_id_seq + 1 + + + + + + + + + + + + + + + + ORACLE + hs_area_id_seq + 1 + + + + + + + ORACLE + hs_email_id_seq + 1 + + + + + + + + + + + + + + + + + + ORACLE + hs_equipamento_id_seq + 1 + + + + + + + + + ORACLE + hs_legislacao_id_seq + 1 + + + + + + + + ORACLE + hs_legislacao_categoria_id_seq + 1 + + + + + + + + + + + + + + + + + + ORACLE + hs_medida_id_seq + 1 + + + + + + + + + + ORACLE + hs_normalizacao_id_seq + 1 + + + + + + + + + + + + + + + + + + ORACLE + hs_posto_id_seq + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ORACLE + hs_relatorio_id_seq + 1 + + + + + + + + + + + ORACLE + hs_relatorio_area_id_seq + 1 + + + + + + + + + + + + ORACLE + hs_relatorio_equipamento_id_seq + 1 + + + + + + + + + + + ORACLE + hs_relatorio_legislacao_id_seq + 1 + + + + + + + + + + + ORACLE + hs_relatorio_medida_id_seq + 1 + + + + + + + + + + + ORACLE + hs_relatorio_legislacao_id_seq + 1 + + + + + + + + + + + ORACLE + hs_relatorio_posto_id_seq + 1 + + + + + + + + + + + + + + + + ORACLE + hs_relatorio_posto_risco_id_seq + 1 + + + + + + + + + + ORACLE + hs_relatorio_risco_id_seq + 1 + + + + + + + + + + + + + ORACLE + hs_risco_id_seq + 1 + + + + + + + + + + + + + + + + ORACLE + hs_risco_tema_id_seq + 1 + + + + + + + + ORACLE + image_id_seq + 1 + + + + + + + + + + + + + + + + + + + ORACLE + lembretes_id_seq + 1 + + + + + + + + + + ORACLE + lembretes_tipos_id_seq + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ORACLE + marcacoes_grupos_realizados_id_seq + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ORACLE + marcacoes_trabalhador_estados_id_seq + 1 + + + + + + + + + + + + + + + + + + + + + + + + ORACLE + prestadores_id_seq + 1 + + + + + + + + ORACLE + prestadores_grupos_protocolo_id_seq + 1 + + + + + + + + + ORACLE + prt_elementos_protocolo_id_seq + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ORACLE + trabalhadores_consultas_id_seq + 1 + + + + + + + + + + ORACLE + trabalhadores_consultas_datas_id_seq + 1 + + + + + + + + + + + ORACLE + trabalhadores_consultas_datas_emails_id_seq + 1 + + + + + + + + ORACLE + trabalhadores_consultas_datas_observacoes_id_seq + 1 + + + + + + + + + + + + + + ORACLE + trabalhadores_ecd_id_seq + 1 + + + + + + + + + + ORACLE + trabalhadores_ecds_id_seq + 1 + + + + + + + + + + + + + + + + + + + ORACLE + trabalhadores_ecds_datas_id_seq + 1 + + + + + + + + + + + ORACLE + trabalhadores_ecds_datas_emails_id_seq + 1 + + + + + + + + ORACLE + trabalhadores_ecds_datas_observacoes_id_seq + 1 + + + + + + + + ORACLE + trabalhadores_fichas_aptidao_id_seq + 1 + + + + + + + + + + + + + ORACLE + trabalhadores_processo_id_seq + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/alter3.sql b/branches/SIPRP/SIPRPSoft/src/alter3.sql new file mode 100644 index 00000000..4bfea09d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/alter3.sql @@ -0,0 +1,32 @@ +UPDATE trabalhadores SET perfil=1 WHERE perfil IS NULL; +UPDATE marcacoes_trabalhador SET motivo = + ( SELECT tipo FROM exames WHERE exames.trabalhador_id = marcacoes_trabalhador.trabalhador_id AND + exames.data = marcacoes_trabalhador.data ) +WHERE motivo IS NULL AND realizada = 'y'; + +CREATE TABLE etiquetas +( + id serial NOT NULL, + descricao varchar(255) NOT NULL, + descricao_plain varchar, + altura float4, + largura float4, + margem_esquerda float4, + margem_cima float4, + colunas int4, + linhas int4, + continua char(1) NOT NULL DEFAULT 'n'::bpchar, + altura_folha float4, + largura_folha float4, + margem_vertical_folha float4, + margem_horizontal_folha float4, + CONSTRAINT etiquetas_pkey PRIMARY KEY (id) +) +WITHOUT OIDS; +ALTER TABLE etiquetas OWNER TO postgres; + +ALTER TABLE estabelecimentos ADD medico_id int4 REFERENCES medicos( id ); + +insert into etiquetas ( descricao, descricao_plain, altura, largura, margem_esquerda, margem_cima, colunas, linhas, continua, altura_folha, largura_folha, + margem_horizontal_folha, margem_vertical_folha ) + values( 'Etiquetas em folha A4', 'etiquetas em folha a4', 3.7125, 10.5, 0.0, 0.0, 2, 8, 'n', 29.7, 21.0, 0.7, 0.5 ); \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/alter_20060516.sql b/branches/SIPRP/SIPRPSoft/src/alter_20060516.sql new file mode 100644 index 00000000..3e76a52c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/alter_20060516.sql @@ -0,0 +1,2 @@ +alter table empresas add inicio_contrato date; +alter table empresas add duracao int; \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/alter_20070124.sql b/branches/SIPRP/SIPRPSoft/src/alter_20070124.sql new file mode 100644 index 00000000..0f7cfb06 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/alter_20070124.sql @@ -0,0 +1,154 @@ +-- Table: ecd_oficial + +-- DROP TABLE ecd_oficial; + +CREATE TABLE ecd_oficial +( + id serial NOT NULL, + descricao varchar(255), + descricao_plain varchar(255), + ordem int4, + activo char(1), + CONSTRAINT ecd_oficial_pkey PRIMARY KEY (id) +) +WITHOUT OIDS; +ALTER TABLE ecd_oficial OWNER TO postgres; + + +-- Table: prestadores + +-- DROP TABLE prestadores; + +CREATE TABLE prestadores +( + id serial NOT NULL, + nome varchar(255), + nome_plain varchar(255), + morada varchar(2048), + codigo_postal varchar(16), + localidade varchar(255), + localidade_cp varchar(255), + contacto_id int4, + activo char(1), + faz_consultas char(1), + faz_ecds char(1), + CONSTRAINT prestadores_pkey PRIMARY KEY (id), + CONSTRAINT prestadores_contacto_id_fkey FOREIGN KEY (contacto_id) + REFERENCES contactos (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION +) +WITHOUT OIDS; +ALTER TABLE prestadores OWNER TO postgres; + + +-- Table: prestadores_grupos_protocolo + +-- DROP TABLE prestadores_grupos_protocolo; + +CREATE TABLE prestadores_grupos_protocolo +( + id serial NOT NULL, + prestador_id int4 NOT NULL, + grupo_protocolo_id int4 NOT NULL, + CONSTRAINT prestadores_grupos_protocolo_pkey PRIMARY KEY (id), + CONSTRAINT prestadores_grupos_protocolo_grupo_protocolo_id_fkey FOREIGN KEY (grupo_protocolo_id) + REFERENCES prt_grupos_protocolo (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT prestadores_grupos_protocolo_prestador_id_fkey FOREIGN KEY (prestador_id) + REFERENCES prestadores (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION +) +WITHOUT OIDS; +ALTER TABLE prestadores_grupos_protocolo OWNER TO postgres; + + + +-- Table: marcacoes_trabalhador_estados + +-- DROP TABLE marcacoes_trabalhador_estados; + +CREATE TABLE marcacoes_trabalhador_estados +( + id serial NOT NULL, + data date, + estado int4, + marcacao_id int4, + CONSTRAINT marcacoes_trabalhador_estados_pkey PRIMARY KEY (id), + CONSTRAINT marcacoes_trabalhador_estados_marcacao_id_fkey FOREIGN KEY (marcacao_id) + REFERENCES marcacoes_trabalhador (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION +) +WITHOUT OIDS; +ALTER TABLE marcacoes_trabalhador_estados OWNER TO postgres; + +alter table marcacoes_grupos_realizados add marcacoes_trabalhador_estado_id int4 references marcacoes_trabalhador_estados(id); + +-- Table: lembretes_tipos + +-- DROP TABLE lembretes_tipos; + +CREATE TABLE lembretes_tipos +( + id serial NOT NULL, + codigo varchar(16) NOT NULL, + descricao varchar(255) NOT NULL, + ordem int4 NOT NULL, + activo char(1) NOT NULL DEFAULT 'y'::bpchar, + CONSTRAINT lembretes_tipos_pkey PRIMARY KEY (id) +) +WITHOUT OIDS; +ALTER TABLE lembretes_tipos OWNER TO postgres; + +INSERT INTO lembretes_tipos (codigo, descricao, ordem, activo ) + VALUES( 'EXTERNO','Avisos Externos', 1, 'y' ); +INSERT INTO lembretes_tipos (codigo, descricao, ordem, activo ) + VALUES( 'REMARCACOES', 'Remarca\\u00e7\\u00f5es', 3 , 'y' ); +INSERT INTO lembretes_tipos (codigo, descricao, ordem, activo ) + VALUES( 'MARCACOES', 'Marca\\u00e7\\u00f5es Pendentes', 2, 'y' ); +INSERT INTO lembretes_tipos (codigo, descricao, ordem, activo ) + VALUES( 'OUTROS','Outros',4,'y' ); + +-- Table: lembretes + +-- DROP TABLE lembretes; + +CREATE TABLE lembretes +( + id serial NOT NULL, + tipo_id int4 NOT NULL, + data date NOT NULL, + descricao varchar(255) NOT NULL, + texto varchar(16384), + empresa_id int4, + estabelecimento_id int4, + trabalhador_id int4, + marcacao_estabelecimento_id int4, + marcacao_trabalhador_id int4, + enviar_email char(1) DEFAULT 'n'::bpchar, + periodicidade_dias int4, + periodicidade_meses int4, + ultimo_envio date, + CONSTRAINT lembretes_pkey PRIMARY KEY (id), + CONSTRAINT lembretes_empresa_id_fkey FOREIGN KEY (empresa_id) + REFERENCES empresas (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT lembretes_estabelecimento_id_fkey FOREIGN KEY (estabelecimento_id) + REFERENCES estabelecimentos (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT lembretes_marcacao_estabelecimento_id_fkey FOREIGN KEY (marcacao_estabelecimento_id) + REFERENCES marcacoes_estabelecimento (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT lembretes_marcacao_trabalhador_id_fkey FOREIGN KEY (marcacao_trabalhador_id) + REFERENCES marcacoes_trabalhador (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT lembretes_tipo_id_fkey FOREIGN KEY (tipo_id) + REFERENCES lembretes_tipos (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT lembretes_trabalhador_id_fkey FOREIGN KEY (trabalhador_id) + REFERENCES trabalhadores (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION +) +WITHOUT OIDS; +ALTER TABLE lembretes OWNER TO postgres; + + diff --git a/branches/SIPRP/SIPRPSoft/src/alter_20070221.sql b/branches/SIPRP/SIPRPSoft/src/alter_20070221.sql new file mode 100644 index 00000000..722c7dd1 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/alter_20070221.sql @@ -0,0 +1,3 @@ +ALTER TABLE prestadores ADD contribuinte VARCHAR(64); +ALTER TABLE marcacoes_trabalhador ADD prestador_id int4 REFERENCES prestadores( id ); +ALTER TABLE marcacoes_trabalhador_estados ADD prestador_id int4 REFERENCES prestadores( id ); \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/avalon-framework-4.2.0.jar b/branches/SIPRP/SIPRPSoft/src/avalon-framework-4.2.0.jar new file mode 100644 index 00000000..22a7ab34 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/avalon-framework-4.2.0.jar differ diff --git a/branches/SIPRP/SIPRPSoft/src/build.xml b/branches/SIPRP/SIPRPSoft/src/build.xml new file mode 100644 index 00000000..d0a1900e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/build.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/cayenne.xml b/branches/SIPRP/SIPRPSoft/src/cayenne.xml new file mode 100644 index 00000000..2b962b58 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/cayenne.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/jpox_siprp.bat b/branches/SIPRP/SIPRPSoft/src/jpox_siprp.bat new file mode 100644 index 00000000..782060b7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/jpox_siprp.bat @@ -0,0 +1,7 @@ +cd build +cd classes +java -cp .;../../evutils;../../jpox;../../jpox/jpox-1.0.4.jar;../../jpox/jpox-enhancer-1.0.4.jar;../../jars/log4j-1.2.8.jar;../../jdo/jdo.jar;../../jdo;../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/data/package.jdo +java -cp .;../../evutils;../../jpox;../../jpox/jpox-1.0.4.jar;../../jpox/jpox-enhancer-1.0.4.jar;../../jars/log4j-1.2.8.jar;../../jdo/jdo.jar;../../jdo;../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/medicina/prestadores/data/package.jdo +java -cp .;../../evutils;../../jpox;../../jpox/jpox-1.0.4.jar;../../jpox/jpox-enhancer-1.0.4.jar;../../jars/log4j-1.2.8.jar;../../jdo/jdo.jar;../../jdo;../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/medicina/processo/data/package.jdo +cd .. +cd .. \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/jpox_siprp.sh b/branches/SIPRP/SIPRPSoft/src/jpox_siprp.sh new file mode 100644 index 00000000..10724bcc --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/jpox_siprp.sh @@ -0,0 +1,7 @@ +cd build +cd classes +java -cp .:../../evutils:../../jpox:../../jpox/jpox-1.0.4.jar:../../jpox/jpox-enhancer-1.0.4.jar:../../jars/log4j-1.2.8.jar:../../jdo/jdo.jar:../../jdo:../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/data/package.jdo +java -cp .:../../evutils:../../jpox:../../jpox/jpox-1.0.4.jar:../../jpox/jpox-enhancer-1.0.4.jar:../../jars/log4j-1.2.8.jar:../../jdo/jdo.jar:../../jdo:../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/medicina/prestadores/data/package.jdo +java -cp .:../../evutils:../../jpox:../../jpox/jpox-1.0.4.jar:../../jpox/jpox-enhancer-1.0.4.jar:../../jars/log4j-1.2.8.jar:../../jdo/jdo.jar:../../jdo:../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/medicina/processo/data/package.jdo +cd .. +cd .. \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/jws/siprp.jnlp b/branches/SIPRP/SIPRPSoft/src/jws/siprp.jnlp new file mode 100644 index 00000000..a944327f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/jws/siprp.jnlp @@ -0,0 +1,43 @@ + + + + + SIPRP + EVOLUTE 2005 + + SIPRP, v3.2 + SIPRP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafButton.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafButton.java new file mode 100644 index 00000000..45b947dd --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafButton.java @@ -0,0 +1,78 @@ +package leaf.ui; + +import java.awt.Color; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; + +import javax.swing.ImageIcon; +import javax.swing.JButton; + +public class LeafButton extends JButton +{ + private static final long serialVersionUID = 1L; + + private ImageIcon icon = null; + + public LeafButton(String text) + { + super( text ); + setOpaque( false ); + } + + public LeafButton( ImageIcon icon ) + { + super( icon ); + this.icon = icon; + setOpaque( false ); + } + + protected void paintComponent( Graphics g ) + { + if( icon == null ) + { + boolean pushed = getModel().isPressed(); +// Color borderColor = getBackground(); +// Color highlightColor = getBackground(); + Color textColor = isEnabled() ? getForeground() : getForeground().brighter().brighter().brighter(); + Color textAccent = getBackground(); + Color textAccentHot = getBackground(); + GradientPaint topGradientUp = new GradientPaint( 0, 0, getBackground().brighter(), 0, getHeight() / 2, getBackground() ); + GradientPaint topGradientDown = new GradientPaint( 0, 0, getBackground().brighter(), 0, getHeight() / 2, getBackground() ); + GradientPaint bottomGradientDown = new GradientPaint( 0, getHeight() / 2, getBackground(), 0, getHeight(), getBackground().darker() ); + GradientPaint bottomGradientUp = new GradientPaint( 0, getHeight() / 2, getBackground(), 0, getHeight(), getBackground().darker().darker() ); + Graphics2D g2 = (Graphics2D) g; + g2.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON ); + + int height = getHeight() / 2; + + g2.setPaint( pushed ? topGradientDown : topGradientUp ); + g2.fillRect( 0, 0, getWidth(), height ); + + g2.setPaint( pushed ? bottomGradientDown : bottomGradientUp ); + g2.fillRect( 0, height, getWidth(), height ); + + // g2.setColor( borderColor ); + // g2.drawRect( 0, 0, getWidth() - 1, getHeight() - 1 ); + // + // g2.setColor( highlightColor ); + // g2.drawRect( 1, 1, getWidth() - 3, getHeight() - 3 ); + + int x = (getWidth() - g2.getFontMetrics().stringWidth( getText() )) / 2; + int y = getHeight() - ((getHeight() - g2.getFontMetrics().getHeight()) / 2) - 3; + + y += 1; + g2.setColor( pushed ? textAccentHot : textAccent ); + g2.drawString( getText(), x, y ); + + y -= 1; + g2.setColor( textColor ); + g2.drawString( getText(), x, y ); + } + else + { + super.paintComponent( g ); + } + } +} \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafCalendarDialog.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafCalendarDialog.java new file mode 100644 index 00000000..d59eab18 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafCalendarDialog.java @@ -0,0 +1,149 @@ +package leaf.ui; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Calendar; +import java.util.Date; + +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.border.BevelBorder; + +import com.toedter.calendar.JCalendar; + +public class LeafCalendarDialog extends JDialog +{ + private static final long serialVersionUID = 1L; + public static final int ABOVE = 0; + public static final int BELOW = 1; + public static final int RIGHT = 0; + public static final int LEFT = 1; + + private boolean ok = false; + private boolean clear = false; + + private Calendar cal = null; + + private boolean enableClean = true; + + private boolean enableCancel = true; + + + private final JCalendar calendarPanel = new JCalendar( null, null, false, false ); + + /** Creates a new instance of JCalendarDialog */ + public LeafCalendarDialog( LeafWindow parentFrame ) + { + super(parentFrame); + this.enableClean = true; + setModal( true ); + setupComponents(); + setUndecorated( true ); + setLocationRelativeTo( null ); + setVisible( true ); + } + + + public LeafCalendarDialog( LeafWindow parentFrame, JComponent parent, boolean enableClean ) + { + super(parentFrame); + this.enableClean = enableClean; + setModal( true ); + setupComponents(); + setUndecorated( true ); + setLocationRelativeTo( parent ); + setVisible( true ); + } + + public LeafCalendarDialog( LeafWindow parentFrame, boolean enableClean, boolean enableCancel ) + { + super(parentFrame); + this.enableClean = enableClean; + this.enableCancel = enableCancel; + setModal( true ); + setupComponents(); + setUndecorated( true ); + setLocationRelativeTo( null ); + setVisible( true ); + } + + private void setupComponents() + { + TableLayout layout = new TableLayout(new double[]{TableLayout.FILL,TableLayout.FILL,TableLayout.FILL}, new double[]{TableLayout.FILL, TableLayout.MINIMUM}); + + getContentPane().setLayout( layout ); + + getContentPane().add( calendarPanel, new TableLayoutConstraints(0,0,2,0)); + + LeafButton okButton = new LeafButton( "OK" ); + okButton.addActionListener( new ActionListener() + { + public void actionPerformed( ActionEvent e ) + { + ok = true; + close(); + } + } ); + LeafButton cancelarButton = new LeafButton( "Cancelar" ); + cancelarButton.setEnabled( enableCancel ); + cancelarButton.addActionListener( new ActionListener() + { + public void actionPerformed( ActionEvent e ) + { + ok = false; + close(); + } + } ); + + LeafButton limparButton = new LeafButton( "Limpar" ); + limparButton.setEnabled(enableClean); + limparButton.addActionListener( new ActionListener() + { + public void actionPerformed( ActionEvent e ) + { + ok = false; + clear = true; + close(); + } + } ); + + + getContentPane().add( okButton, new TableLayoutConstraints(0,1) ); + getContentPane().add( cancelarButton, new TableLayoutConstraints(1,1) ); + getContentPane().add( limparButton, new TableLayoutConstraints(2,1) ); + + setSize( 250, 250 ); + + ((JComponent) getContentPane()).setBorder( BorderFactory.createBevelBorder( BevelBorder.RAISED ) ); + } + + public Date getDate() + { + Date result = null; + if( ok ) + { + cal = Calendar.getInstance(); + cal.set( Calendar.HOUR_OF_DAY, 12 ); + cal = calendarPanel.getCalendar(); + cal.set( Calendar.YEAR, calendarPanel.getYearChooser().getYear() ); + cal.set( Calendar.DAY_OF_MONTH, calendarPanel.getDayChooser().getDay() ); + result = cal != null ? cal.getTime() : null; + } + else if( clear ) + { + result = new Date( 0 ); + } + return result; + } + + public void close() + { + setVisible( false ); + dispose(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafDialog.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafDialog.java new file mode 100644 index 00000000..a48f0dbf --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafDialog.java @@ -0,0 +1,39 @@ +package leaf.ui; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; + +import javax.swing.JOptionPane; + +import com.evolute.utils.error.ErrorLogger; +import com.evolute.utils.ui.DialogException; + +public class LeafDialog +{ + + public static void error( Exception e ) + { + if( e != null ) + { + ErrorLogger.logException( e ); + e.printStackTrace( System.out ); + DialogException.showException( e ); + } + } + + public static boolean confirmDelete( boolean masculino, boolean plural, String nome ) + { + return JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog( + null, + "Tem a certeza que deseja remover " + + ( masculino ? "o" : "a" ) + + ( plural ? "s" : "" ) + + " " + nome + " seleccionad" + + ( masculino ? "o" : "a" ) + + ( plural ? "s" : "" ) + + "?", + "Confirmar remo" + ccedil + atilde + "o", + JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafGradientPanel.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafGradientPanel.java new file mode 100644 index 00000000..4a26e4a2 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafGradientPanel.java @@ -0,0 +1,29 @@ +package leaf.ui; + +import java.awt.Color; + +import javax.swing.JPanel; + +public class LeafGradientPanel extends JPanel +{ + private static final long serialVersionUID = 1L; + + public LeafGradientPanel() + { + setBackground( new Color(220,220,220) ); + } + +// @Override +// public void paintComponent( Graphics g ) +// { +// Graphics2D g2d = (Graphics2D) g; +// GradientPaint gradientIn = new GradientPaint( 0, 0, getBackground(), getWidth()/2, 0, Color.DARK_GRAY ); +// g2d.setPaint( gradientIn ); +// g2d.fillRect( 0, 0, getWidth()/2, getHeight() ); +// +// GradientPaint gradientOut = new GradientPaint( getWidth()/2, 0, Color.DARK_GRAY, getWidth(),0, getBackground() ); +// g2d.setPaint( gradientOut ); +// g2d.fillRect( getWidth()/2, 0, getWidth(), getHeight() ); +// } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafIconButton.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafIconButton.java new file mode 100644 index 00000000..b943d67f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafIconButton.java @@ -0,0 +1,65 @@ +package leaf.ui; + +import java.awt.Insets; + +import com.evolute.utils.images.ImageException; +import com.evolute.utils.images.ImageIconLoader; + +public class LeafIconButton extends LeafButton implements LeafUIConstants +{ + private static final long serialVersionUID = 1L; + + private LeafIconButton( String imagePath ) throws ImageException + { + super(ImageIconLoader.loadImageIcon( imagePath )); + } + + public static LeafIconButton createDefaultNewButton() + { + LeafIconButton result = createButton( ICON_NAME_CREATE ); + result.setToolTipText( "Criar" ); + return result; + } + + public static LeafIconButton createDefaultEditButton() + { + LeafIconButton result = createButton( ICON_NAME_EDIT ); + result.setToolTipText( "Editar" ); + return result; + } + + public static LeafIconButton createDefaultRemoveButton() + { + LeafIconButton result = createButton( ICON_NAME_REMOVE ); + result.setToolTipText( "Remover" ); + return result; + } + + public static LeafIconButton createButton( String imagePath ) + { + LeafIconButton result = null; + if( imagePath != null ) + { + try + { + result = new LeafIconButton(imagePath); + result.setMargin( new Insets(0,0,0,0) ); + } catch( ImageException e ) + { + e.printStackTrace(); + } + } + return result; + } + + public static LeafIconButton createButton( String title, String imagePath ) + { + LeafIconButton result = createButton( imagePath ); + if( result != null ) + { + result.setText( title ); + } + return result; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafInputField.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafInputField.java new file mode 100644 index 00000000..dc77b29a --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafInputField.java @@ -0,0 +1,631 @@ +package leaf.ui; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Color; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.text.DateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.SwingUtilities; + +import com.evolute.adt.OrderedMap; + + + +public class LeafInputField extends JPanel implements FocusListener, MouseListener, PropertyChangeListener +{ + + public static final String PROPERTY_CHANGED_CONSTANT = "LEAF_INPUT_PROPERTY_CHANGED"; + public static final String PROPERTY_CHANGED_CLICK = "LEAF_PROPERTY_CHANGED_CLICK"; + private static final long serialVersionUID = 1L; + + private static final DateFormat sdf = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); + + private static final int defaultColorDec = 20; + + private int colorDec = defaultColorDec; + + public Dimension size = null; + + private Color hot = null; + private Color cold = null; + private Color background = null; + private Color endColor = null; + private Color highLightColor = new Color( 180, 255, 180 ); + + private Object selectedOption = null; + + private boolean isEditable = false; + + private boolean isClickable = false; + + private boolean highLighted = false; + + private boolean collapseOptions = true; + + private ObjClass object = null; + + private GradientPaint outerContour = null; + private GradientPaint outerReversedContour = null; + private GradientPaint innerContour = null; + private GradientPaint innerReversedContour = null; + private GradientPaint gradient = null; + private TableLayout layout = null; + + private JComponent thiz = null; + + private List theeze = null; + + public LeafInputField() + { + super(); + setOpaque( false ); + setBorder( BorderFactory.createEmptyBorder( 3, 10, 3, 10 ) ); + setBackground( Color.WHITE ); + hot = getBackground(); + cold = new Color( hot.getRed() > colorDec ? hot.getRed() - colorDec : 0, hot.getGreen() > colorDec ? hot.getGreen() - colorDec : 0, hot.getBlue() > colorDec ? hot.getBlue() - colorDec : 0, hot.getAlpha() ); + background = cold; + setObject( null ); + } + + public boolean isCollapseOptions() + { + return collapseOptions; + } + + public void setCollapseOptions( boolean collapse ) + { + collapseOptions = collapse; + } + + private String getStringFromUser() + { + LeafTextDialog textDialog = new LeafTextDialog( getParentWindow(), this, (String) object, true ); + return textDialog.getText(); + } + + private Object getOptionFromUser() + { + if( object instanceof Map ) + { + if(((Map) object).size() > 0) + { + LeafOptionDialog optionDialog = new LeafOptionDialog( getParentWindow(), (Map) object, null ); + return optionDialog.getOption(); + } + } + else if( object instanceof OrderedMap ) + { + if(((OrderedMap) object).rows() > 0) + { + LeafOptionDialog optionDialog = new LeafOptionDialog( getParentWindow(), (OrderedMap) object, null, null, null, null ); + return optionDialog.getOption(); + } + } + return null; + } + + private Date getDateFromUser() + { + LeafCalendarDialog calendarDialog = new LeafCalendarDialog( getParentWindow() ); + return calendarDialog.getDate(); + } + + private LeafWindow getParentWindow() + { + LeafWindow result = null; + for( Container parent = this.getParent(); parent != null; parent = parent.getParent() ) + { + if( parent instanceof LeafWindow ) + { + result = (LeafWindow) parent; + } + } + return result; + } + + protected void paintComponent( Graphics g ) + { + Graphics2D g2d = (Graphics2D) g; + int width = getWidth(), height = getHeight(); + setColors( width, height ); + g2d.setPaint( outerReversedContour ); + g2d.fillRect( 15, 0, width / 4, height ); + g2d.setPaint( outerContour ); + g2d.fillRect( width / 4, 0, width, height ); + g2d.setPaint( innerReversedContour ); + g2d.fillRect( 15, 0, width / 4, height - 1 ); + g2d.setPaint( innerContour ); + g2d.fillRect( width / 4, 0, width, height - 1 ); + g2d.setPaint( gradient ); + g2d.fillRoundRect( 0, 2, width, height - 5, 15, 15 ); + super.paintComponent( g ); + } + + private void setColors( int width, int height ) + { + endColor = getGradientEndColor( background ); + outerContour = new GradientPaint( width / 4, 0, Color.GRAY, width, 0, this.getParent().getBackground() ); + outerReversedContour = new GradientPaint( 15, 0, this.getParent().getBackground(), width / 4, 0, Color.GRAY ); + innerContour = new GradientPaint( width / 4, 0, Color.LIGHT_GRAY, width, 0, this.getParent().getBackground() ); + innerReversedContour = new GradientPaint( 15, 0, this.getParent().getBackground(), width / 4, 0, Color.LIGHT_GRAY ); + gradient = new GradientPaint( 0, 0, background, width, height, endColor ); + } + + private Color getGradientEndColor( Color startColor ) + { + return getParent() != null ? getParent().getBackground() : startColor; + } + + public boolean getSelected() + { + return highLighted; + } + + public void setSelected( boolean selected ) + { + highLighted = selected; + background = selected ? highLightColor : cold; + repaint(); + } + + public void setEditable( boolean editable ) + { + isEditable = editable; + if( !editable ) + { + setMouseOver( false ); + } + setEnabled( editable ); + setObject( object, selectedOption ); + repaint(); + } + + public boolean isEditable() + { + return isEditable; + } + + public void setClickable( boolean clickable ) + { + isClickable = clickable; + if( !clickable ) + { + setMouseOver( false ); + } + repaint(); + } + + public boolean isClickable() + { + return isClickable; + } + + private void setupCollapsedPanel() + { + List values = ((OrderedMap) object).getValues( selectedOption ); + theeze = new ArrayList(); + if( values != null ) + { + double[] rows = new double[] { + TableLayout.MINIMUM + }; + double[] cols = new double[values.size() > 0 ? (values.size() * 2 - 1) : 0]; + for( int i = 0; i < cols.length; ++i ) + { + cols[i] = (i % 2 == 0) ? TableLayout.FILL : TableLayout.MINIMUM; + } + TableLayout layout = new TableLayout( cols, rows ); + layout.setHGap( 5 ); + thiz.setLayout( layout ); + for( int i = 0, a = 0; i < cols.length; ++i ) + { + JComponent comp = null; + if( i % 2 == 0 ) + { + Object value = values.get( a++ ); + comp = new JLabel( value == null ? " " : value.toString() ); + theeze.add( comp ); + } + else + { + comp = new JSeparator( JSeparator.VERTICAL ); + } + thiz.add( comp, new TableLayoutConstraints( i, 0 ) ); + } + } + } + + private void setupUncollapsedPanel() + { + theeze = new ArrayList(); + OrderedMap map = (OrderedMap) object; + double[] rows = new double[map.rows() > 0 ? (map.rows() * 2 - 1) : 0]; + double[] cols = new double[map.columns() > 0 ? (map.columns() * 2 - 1) : 0]; + for( int i = 0; i < rows.length; ++i ) + { + rows[i] = (i % 2 == 0) ? TableLayout.MINIMUM : TableLayout.MINIMUM; + } + for( int i = 0; i < cols.length; ++i ) + { + cols[i] = (i % 2 == 0) ? TableLayout.FILL : TableLayout.MINIMUM; + } + TableLayout layout = new TableLayout( cols, rows ); + layout.setHGap( 5 ); + thiz.setLayout( layout ); + + for( int i = 0, a = 0; i < rows.length; ++i ) + { + if( i % 2 == 0 ) + { + List values = map.getRow( a++ ); + for( int j = 0, b = 0; j < cols.length; ++j ) + { + JComponent comp = null; + if( j % 2 == 0 ) + { + Object value = values.get( b++ ); + + LeafInputField leaf; + if( value instanceof LeafInputField ) + { + leaf = (LeafInputField) value; + } + else + { + leaf = new LeafInputField(); + leaf.setObject( value ); + if( j > 1 ) + { + leaf.setEditable( isEditable ); + } + } + + comp = leaf; + theeze.add( comp ); + } + else + { + JSeparator sep = new JSeparator( JSeparator.VERTICAL ); + sep.setForeground( cold ); + comp = sep; + } + thiz.add( comp, new TableLayoutConstraints( j, i ) ); + } + } + else + { + JSeparator sep = new JSeparator(); + sep.setForeground( cold ); + thiz.add( sep, new TableLayoutConstraints( 0, i, cols.length - 1, i ) ); + } + } + } + + private void setSelectedObject( Object key ) + { + selectedOption = key; + if( object != null && thiz != null ) + { + if( object instanceof Map ) + { + Object value = null; + value = ((Map) object).get( selectedOption ); + String text = value == null ? " " : value.toString(); + if( thiz instanceof JTextArea ) + { + ((JTextArea) thiz).setText( text ); + } + else if( thiz instanceof JTextField ) + { + ((JTextField) thiz).setText( text ); + } + else if( thiz instanceof JLabel ) + { + ((JLabel) thiz).setText( text ); + } + } + else if( object instanceof OrderedMap ) + { + if( thiz instanceof JPanel && collapseOptions ) + { + setupCollapsedPanel(); + } + else if( thiz instanceof JPanel && !collapseOptions ) + { + setupUncollapsedPanel(); + } + } + } + } + + public Object getSelectedObject() + { + return selectedOption; + } + + public void setObject( ObjClass object, Object selected ) + { + this.selectedOption = selected; + setObject( object ); + } + + public void setObject( ObjClass object ) + { + this.object = object; + if( object != null ) + { + if( object instanceof Date ) + { + Date date = (Date) object; + String text = date.getTime() == 0 ? "" : sdf.format( object ); + thiz = isEditable ? new JLabel( text ) : new JTextArea( text ); + thiz.setEnabled( false ); + } + else if( object instanceof Map ) + { + thiz = isEditable ? new JLabel( " " ) : new JTextArea( " " ); + setSelectedObject( selectedOption ); + thiz.setEnabled( false ); + } + else if( object instanceof OrderedMap && collapseOptions ) + { + thiz = new JPanel(); + setSelectedObject( selectedOption ); + } + else if( object instanceof OrderedMap && !collapseOptions ) + { + thiz = new JPanel(); + setSelectedObject( selectedOption ); + } + else if( object instanceof LeafInputField ) + { + setObject( (ObjClass) ((LeafInputField) object).getObject(), ((LeafInputField) object).getSelectedObject() ); + } + else if( object instanceof String ) + { + JTextArea textArea = new JTextArea(); + textArea.setEditable( false ); + textArea.setText( object == null ? "" : object.toString() ); + thiz = textArea; + } + else + { + String toString = object.toString(); + if( "".equals( toString ) ) + { + toString = " "; + } + thiz = new JTextArea( toString ); + } + } + else + { + thiz = new JLabel( " " ); + } + reListen(); + reLayout(); + } + + public ObjClass getObject() + { + return this.object; + } + + private void reListen() + { + removeListeners(); + if( theeze != null && !collapseOptions && !theeze.isEmpty() ) + { + for( JComponent current : theeze ) + { + if( current instanceof LeafInputField ) + { + current.addFocusListener( (LeafInputField) current ); + current.addMouseListener( (LeafInputField) current ); + current.addPropertyChangeListener( PROPERTY_CHANGED_CONSTANT, this ); + } + } + } + else + { + thiz.addFocusListener( this ); + thiz.addMouseListener( this ); + } + } + + private void removeListeners() + { + removeListerensFrom( thiz ); + if( theeze != null ) + { + for( JComponent comp : theeze ) + { + removeListerensFrom( comp ); + } + } + } + + private void removeListerensFrom( JComponent comp ) + { + if( comp != null ) + { + FocusListener[] allFocus = thiz.getFocusListeners(); + if( allFocus != null ) + { + for( FocusListener focusListener : allFocus ) + { + comp.removeFocusListener( focusListener ); + } + } + MouseListener[] allMouse = thiz.getMouseListeners(); + if( allMouse != null ) + { + for( MouseListener mouseListener : allMouse ) + { + comp.removeMouseListener( mouseListener ); + } + } + } + } + + private void reLayout() + { + if( thiz != null ) + { + SwingUtilities.invokeLater( new Runnable() + { + @Override + public void run() + { + if( layout == null ) + { + layout = new TableLayout( new double[] { + TableLayout.FILL + }, new double[] { + TableLayout.FILL + } ); + LeafInputField.this.setLayout( layout ); + } + else + { + removeAll(); + } + LeafInputField.this.add( thiz, new TableLayoutConstraints( 0, 0 ) ); + revalidate(); + repaint(); + } + } ); + size = thiz.getPreferredSize(); + thiz.setOpaque( false ); + } + } + + @Override + public void focusLost( FocusEvent e ) + { + repaint(); + } + + @Override + public void focusGained( FocusEvent e ) + { + repaint(); + } + + @Override + public void mouseReleased( MouseEvent e ) + { + } + + @Override + public void mousePressed( MouseEvent e ) + { + Object old = null; + if( object != null && isEditable ) + { + if( object instanceof Date ) + { + old = object; + ObjClass newDate = (ObjClass) getDateFromUser(); + if( newDate != null ) + { + setObject( newDate ); + firePropertyChange( PROPERTY_CHANGED_CONSTANT, old, object ); + } + } + else if( object instanceof Map && collapseOptions ) + { + old = selectedOption; + ObjClass out = (ObjClass) getOptionFromUser(); + setObject( object, out ); + firePropertyChange( PROPERTY_CHANGED_CONSTANT, old, selectedOption ); + } + else if( object instanceof OrderedMap && collapseOptions ) + { + old = selectedOption; + ObjClass out = (ObjClass) getOptionFromUser(); + setObject( object, out ); + firePropertyChange( PROPERTY_CHANGED_CONSTANT, old, object ); + } + else if( object instanceof OrderedMap && !collapseOptions ) + { + // old = selectedOption; + // ObjClass out = (ObjClass) getOptionFromUser(); + // setObject( object, out ); + // firePropertyChange( PROPERTY_CHANGED_CONSTANT, old, object ); + } + else if( object instanceof String ) + { + old = object; + setObject( (ObjClass) getStringFromUser() ); + firePropertyChange( PROPERTY_CHANGED_CONSTANT, old, object ); + } + } + if( isClickable ) + { + firePropertyChange( PROPERTY_CHANGED_CLICK, false, true ); + } + // setObject( object, selectedOption ); + } + + @Override + public void mouseExited( MouseEvent e ) + { + setMouseOver( false ); + repaint(); + } + + @Override + public void mouseEntered( MouseEvent e ) + { + setMouseOver( true ); + repaint(); + } + + @Override + public void mouseClicked( MouseEvent e ) + { + } + + private void setMouseOver( boolean mouseOver ) + { + if( mouseOver ) + { + background = (!highLighted && (isEditable || isClickable)) ? hot : background; + } + else + { + background = (!highLighted && (isEditable || isClickable)) ? cold : background; + } + } + + @Override + public void propertyChange( PropertyChangeEvent evt ) + { + firePropertyChange( PROPERTY_CHANGED_CONSTANT, evt.getOldValue(), evt.getNewValue() ); + } +} \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafLogic.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafLogic.java new file mode 100755 index 00000000..f41714b6 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafLogic.java @@ -0,0 +1,106 @@ +package leaf.ui; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.util.ArrayList; +import java.util.List; + + +public class LeafLogic +{ + + /** + * Declares an Action + * + * @author tsimao + * + */ + @Retention(RetentionPolicy.RUNTIME) + public @interface Action + { + /** + * true - this action saves data to de database from the components + * false - this action reads from the database to the components + */ + boolean isSave(); + } + + /** + * Binds a UI method with an action + * + * @author tsimao + * + */ + @Retention(RetentionPolicy.RUNTIME) + public @interface LeafUIActionBinding + { + + /** + * The name of the action this method binds to + */ + String [] action(); + } + + /** + * Binds a logic methods with a group of actions + * + * @author tsimao + * + */ + @Retention(RetentionPolicy.RUNTIME) + public @interface LeafLogicActionBinding + { + + /** + * The name of the action this method binds to + */ + String [] actions(); + } + + @Action(isSave = false) + public static final String ACTION_STARTUP = "ACTION_STARTUP"; + + @Action(isSave = false) + public static final String ACTION_REFRESH = "ACTION_REFRESH"; + + @Action(isSave = false) + public static final String ACTION_CANCEL = "ACTION_CANCEL"; + + + private List registeredWindows = new ArrayList(); + + public void addWindow(LeafWindow window) + { + registeredWindows .add(window); + } + + public void runAction( String actionName ) + { + runAction( actionName, null ); + } + + public void runAction( String actionName, Object argument ) + { + for( LeafWindow window : registeredWindows ) + { + window.runAction( actionName, argument ); + } + } + + public void runActionLater( String actionName ) + { + for( LeafWindow window : registeredWindows ) + { + window.runActionLater( actionName ); + } + } + + public void runActionLater( String actionName, Object argument ) + { + for( LeafWindow window : registeredWindows ) + { + window.runActionLater( actionName, argument ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafLookAndFeel.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafLookAndFeel.java new file mode 100644 index 00000000..806acda4 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafLookAndFeel.java @@ -0,0 +1,22 @@ +package leaf.ui; + +import javax.swing.plaf.metal.MetalLookAndFeel; + +public class LeafLookAndFeel extends MetalLookAndFeel +{ + private static final long serialVersionUID = 1L; + + @Override + public String getName() + { + return "LEAF"; + } + + @Override + public String getDescription() + { + return "Evolute's LEAF Look And Feel"; + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafOptionDialog.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafOptionDialog.java new file mode 100644 index 00000000..99da214c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafOptionDialog.java @@ -0,0 +1,299 @@ +package leaf.ui; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Dimension; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRootPane; +import javax.swing.JScrollBar; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.ScrollPaneConstants; + +import com.evolute.adt.OrderedMap; + + + +public class LeafOptionDialog extends JDialog +{ + private Dimension OPTION_SIZE = new Dimension( 200, 20 ); + private Dimension BUTTON_SIZE = new Dimension( 200, 20 ); + + private int MAX_VISIBLE_OPTIONS = 20; + + private static final long serialVersionUID = 1L; + + private String CANCEL_LABEL = "Cancelar"; + + private String okLabel = null; + + private final JLabel labelMessage = new JLabel(); + + private final JPanel optionsPanel = new JPanel(); + + private final JScrollPane optionsScrollPane = new JScrollPane(); + + private boolean cancelActive = true; + + private LeafInputField submitButton = new LeafInputField(); + + private Map map = null; + + private OrderedMap orderedMap = null; + + private List selected = new ArrayList(); + + private Map mapEnabledForKey = null; + + private Map mapChosenForKey = null; + + private String message = null; + + private boolean ordered = false; + + public LeafOptionDialog( LeafWindow owner, Map map, String message) + { + super( owner ); + this.mapEnabledForKey = new HashMap(); + this.mapChosenForKey = new HashMap(); + this.message = message; + cancelActive = false; + for( KeyClass key : map.keySet() ) + { + mapEnabledForKey.put( key, true ); + } + startup( map, null ); + } + + public LeafOptionDialog( LeafWindow owner, OrderedMap orderedMap, Map chosen, Map enabled, String message, String okButton) + { + super( owner ); + ordered = true; + this.message = message; + okLabel = okButton; + cancelActive = okButton != null; + this.mapChosenForKey = chosen == null ? new HashMap() : chosen; + this.mapEnabledForKey = enabled == null ? new HashMap() : chosen; + if( chosen != null ) + { + for( KeyClass key : chosen.keySet() ) + { + Boolean isChosen = chosen.get( key ); + if( isChosen != null && isChosen ) + { + selected.add( key ); + } + } + } + startup( null, orderedMap ); + } + + private void startup( Map map, OrderedMap orderedMap ) + { + if( map == null ) + { + this.map = new HashMap(); + } + else + { + this.map = map; + } + if( orderedMap == null ) + { + this.orderedMap = new OrderedMap(); + } + else + { + this.orderedMap = orderedMap; + } + setupComponents( map == null ? orderedMap.iterator() : map.keySet().iterator(), map == null ? orderedMap.rows() : map.keySet().size(), map == null ? true : false ); + setUndecorated( true ); + setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + getRootPane().setWindowDecorationStyle(JRootPane.NONE); + setSize( getLayout().minimumLayoutSize( getRootPane() ) ); + setLocationRelativeTo( getParent() ); + setModal( true ); + setVisible( true ); + } + + private void setupComponents( Iterator iterator, Integer size, boolean ordered ) + { + double[] cols = new double[] { + TableLayout.PREFERRED + }; + double[] rows = new double[(message == null ? 0 : 2) + 1 + (cancelActive ? 2 : 0)]; + for( int i = 0; i < rows.length; ++i ) + { + rows[i] = TableLayout.PREFERRED; + } + TableLayout layout = new TableLayout( cols, rows ); + layout.setVGap( 3 ); + setContentPane( new LeafGradientPanel() ); + getContentPane().setLayout( layout ); + + int shift = 0; + if( message != null ) + { + labelMessage.setText( message ); + getContentPane().add( labelMessage, new TableLayoutConstraints( 0, shift++ ) ); + getContentPane().add( new JSeparator(), new TableLayoutConstraints( 0, shift++ ) ); + } + setupOptionsComponents( iterator, size ); + getContentPane().add( optionsScrollPane, new TableLayoutConstraints( 0, shift++ ) ); + if( cancelActive ) + { + getContentPane().add( new JSeparator(), new TableLayoutConstraints( 0, shift++ ) ); + submitButton.setObject( ordered ? okLabel : CANCEL_LABEL ); + submitButton.setClickable( true ); + submitButton.setPreferredSize( BUTTON_SIZE ); + getContentPane().add( submitButton, new TableLayoutConstraints( 0, shift++ ) ); + addListenerToComponent( submitButton ); + } + ((JComponent) getContentPane()).setBorder( BorderFactory.createRaisedBevelBorder() ); + } + + private void setupOptionsComponents( Iterator iterator, Integer size ) + { + int maxWidth = OPTION_SIZE.width; + double[] cols = new double[] { + TableLayout.PREFERRED + }; + double[] rows = new double[size]; + for( int i = 0; i < rows.length; ++i ) + { + rows[i] = TableLayout.PREFERRED; + } + TableLayout layout = new TableLayout( cols, rows ); + layout.setVGap( 3 ); + optionsPanel.setLayout( layout ); + KeyClass current = null; + for( int i = 0; i < size && iterator.hasNext(); ++i ) + { + current = iterator.next(); + LeafInputField component = new LeafInputField(); + Object value; + if( ordered ) + { + List values = orderedMap.getValues( current ); + value = (values == null || values.size() == 0) ? null : values.get( 0 ); + } + else + { + value = map.get( current ); + } + component.setObject( value ); + + Boolean isChosen = mapChosenForKey.get( current ); + component.setSelected( isChosen != null && isChosen ); + + Boolean isEnabled = mapEnabledForKey.get( current ); + component.setClickable( isEnabled == null || isEnabled ); + + if(component.size != null && component.size.width > maxWidth ) + { + maxWidth = component.size.width; + } + optionsPanel.add( component, new TableLayoutConstraints( 0, i ) ); + addListenerToComponent( component ); + } + + optionsScrollPane.setViewportView( optionsPanel ); + optionsScrollPane.setHorizontalScrollBarPolicy( ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER ); + JScrollBar verticalScrollBar = optionsScrollPane.getVerticalScrollBar(); + verticalScrollBar.setUnitIncrement( (int) OPTION_SIZE.getHeight() + 3 ); + optionsScrollPane.setVerticalScrollBar( verticalScrollBar ); + optionsScrollPane.setVerticalScrollBarPolicy( size > MAX_VISIBLE_OPTIONS ? ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS : ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER ); + optionsScrollPane.setPreferredSize( new Dimension( maxWidth + 30 , size > MAX_VISIBLE_OPTIONS ? (MAX_VISIBLE_OPTIONS * ((int) (OPTION_SIZE.getHeight() + 3 )) ) : (size * ((int) (OPTION_SIZE.getHeight() + 3 )) ) )); + } + + private KeyClass getKeyForValue( Object value ) + { + if( value != null && map.containsValue( value ) ) + { + for( KeyClass key : map.keySet() ) + { + if( map.get( key ).equals( value ) ) + { + return key; + } + } + } + else if( ordered ) + { + return orderedMap.getKeyForValue( value ); + } + return null; + } + + private void addListenerToComponent( JComponent component ) + { + component.addPropertyChangeListener( new PropertyChangeListener() + { + @Override + public void propertyChange( PropertyChangeEvent e ) + { + if( e.getSource() instanceof LeafInputField ) + { + LeafInputField source = (LeafInputField) e.getSource(); + if( LeafInputField.PROPERTY_CHANGED_CLICK.equals( e.getPropertyName() ) ) + { + if( !source.equals( submitButton ) ) + { + Object value = source.getObject(); + if( value != null ) + { + KeyClass key = getKeyForValue( value ); + if( selected.contains( key ) ) + { + selected.remove( key ); + source.setSelected( false ); + } + else + { + selected.add( key ); + source.setSelected( true ); + } + } + } + if( okLabel == null || source.equals( submitButton ) ) + { + close(); + } + } + } + } + + } ); + } + + public KeyClass getOption() + { + return selected.isEmpty() ? null : selected.get( 0 ); + } + + public List getSelected() + { + return selected; + } + + public void close() + { + setVisible( false ); + dispose(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafRuntimeException.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafRuntimeException.java new file mode 100644 index 00000000..c0451e9b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafRuntimeException.java @@ -0,0 +1,18 @@ +package leaf.ui; + +public class LeafRuntimeException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + private boolean abort = false; + + public LeafRuntimeException( boolean all ) + { + this.abort = all; + } + + public boolean isAbort() + { + return abort; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafScrollBar.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafScrollBar.java new file mode 100644 index 00000000..f3e5d4f7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafScrollBar.java @@ -0,0 +1,15 @@ +package leaf.ui; + +import javax.swing.JScrollPane; + +public class LeafScrollBar extends JScrollPane +{ + private static final long serialVersionUID = 1L; + + + public void paintComponent() + { + System.out.println(""); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTableModel.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTableModel.java new file mode 100644 index 00000000..66d22449 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTableModel.java @@ -0,0 +1,174 @@ +package leaf.ui; + +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import com.evolute.adt.OrderedMap; +import com.evolute.utils.tables.BaseTableModel; + +public class LeafTableModel extends BaseTableModel +{ + + private static final long serialVersionUID = 1L; + + private OrderedMap map = new OrderedMap(); + + public LeafTableModel(String n[]) + { + super( n, null ); + setChangeable( false ); + } + + public void clearAll() + { + int i = map.rows(); + if( i > 0 ) + { + map.clear(); + fireTableRowsDeleted( 0, i - 1 ); + } + } + + @Override + public int innerGetRowCount() + { + return map == null ? 0 : map.rows(); + } + + @Override + public Object innerGetValueAt( int row, int col ) + { + return map.getValueAt( row, col ); + } + + @Override + public void deleteRow( int row ) + { + map.deleteRow( row ); + } + + public Object getKey( int row ) + { + Object result = null; + if( row < map.rows() ) + { + result = map.getKeyForRow( row ); + } + return result; + } + + public void setValues( Collection v ) + { + Iterator iterator = v.iterator(); + while( iterator.hasNext() ) + { + Object value = iterator.next(); + map.putLast( value, value.toString() ); + } + fireTableDataChanged(); + } + + public void setValues( OrderedMap map ) + { + this.map = (OrderedMap) map; + fireTableDataChanged(); + } + + public void order(int ... colNumber ) + { + if(colNumber != null) + { + map.order(colNumber); + fireTableDataChanged(); + } + } + + @Override + public void appendEmptyRow() + { + map.putLast( map.rows(), (Object) null ); + } + + @Override + public void innerSetValueAt( Object obj, int row, int col ) + { + if( isCellEditable( row, col ) && map.getValueAt( row, col ) != null ) + { + map.setValueAt( row, col, obj ); + } + } + + @Override + public boolean isRowEmpty( int row ) + { + List line = map.getRow( row ); + return line != null && line.size() > 0; + } + + @Override + public boolean innerIsCellEditable( int row, int col ) + { + return false; + } + + public void printContents() + { + for( int r = 0; r < getRowCount(); r++ ) + { + for( int c = 0; c < getColumnCount(); c++ ) + { + Object val = getValueAt( r, c ); + if( val != null ) + { + System.out.print( val.toString() + "\t" ); + } + } + System.out.println( "" ); + } + } + + // public void insertRowAt( Object rowObj, int row ) + // { + // values.add( row, rowObj ); + // fireTableDataChanged(); + // } + // + // public void removeRowAt( int row ) + // { + // values.remove( row ); + // fireTableDataChanged(); + // } + // + // public Object getRowAt( int row ) + // { + // return values.elementAt( row ); + // } + + // public void swapRows( int row1, int row2 ) + // { + // if( row1 == row2 || row1 < 0 || row2 < 0 || row1 >= getRowCount() || row2 + // >= getRowCount() ) + // { + // return; + // } + // // Collections.swap( values, row1, row2 ); + // Object row1Data = getRowAt( row1 ); + // Object row2Data = getRowAt( row2 ); + // if( row1 < row2 ) + // { + // removeRowAt( row2 ); + // removeRowAt( row1 ); + // insertRowAt( row2Data, row1 ); + // insertRowAt( row1Data, row2 ); + // } + // else + // { + // removeRowAt( row1 ); + // removeRowAt( row2 ); + // insertRowAt( row1Data, row2 ); + // insertRowAt( row2Data, row1 ); + // } + // } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTextArea.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTextArea.java new file mode 100644 index 00000000..41d69586 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTextArea.java @@ -0,0 +1,70 @@ +package leaf.ui; + +import java.beans.PropertyChangeListener; + +import javax.swing.JTextArea; +import javax.swing.event.CaretEvent; +import javax.swing.event.CaretListener; + +public class LeafTextArea extends JTextArea +{ + + private static final long serialVersionUID = 1L; + + private static final String PROPERTY = "CHANGED"; + + private final ChangeThread thread = new ChangeThread(); + + private boolean isRunning = true; + + public LeafTextArea( PropertyChangeListener parent ) + { + this.addPropertyChangeListener( PROPERTY, parent ); + this.addCaretListener( new CaretListener() + { + @Override + public void caretUpdate( CaretEvent e ) + { + firePropertyChange( PROPERTY, false, true ); + } + } ); + } + + @Override + public void setEditable( boolean b ) + { + super.setEditable( b ); + if( b ) + { + startThread(); + } + else + { + stopThread(); + } + } + + private void startThread() + { + isRunning = true; + thread.start(); + } + + private void stopThread() + { + isRunning = false; + } + + private class ChangeThread extends Thread + { + @Override + public synchronized void start() + { + while( isRunning ) + { + + } + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTextAreaEditor.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTextAreaEditor.java new file mode 100644 index 00000000..ed0db935 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTextAreaEditor.java @@ -0,0 +1,180 @@ +package leaf.ui; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.event.CaretEvent; +import javax.swing.event.CaretListener; +import javax.swing.text.JTextComponent; + +import siprp.SIPRPSpellChecker; + +import com.evolute.adt.Validator; +import com.evolute.utils.ui.text.CopyPasteHandler; + + +public class LeafTextAreaEditor extends JPanel +{ + + public static final String ACTION_SAVE = "ACTION_SAVE"; + + public static final String ACTION_REVERT = "ACTION_REVERT"; + + private static final long serialVersionUID = 1L; + + private static final String ICON_NAME_SAVE = "leaf/ui/icons/save.png"; + + private static final String ICON_NAME_REVERT = "leaf/ui/icons/revert.png"; + + private final LeafButton buttonSave = LeafIconButton.createButton( ICON_NAME_SAVE ); + + private final LeafButton buttonRevert = LeafIconButton.createButton( ICON_NAME_REVERT ); + + private final JTextComponent fieldText; + + private final JScrollPane scroll; + + private final Validator validator; + + private String initialValue = ""; + + public LeafTextAreaEditor( Validator validator ) + { + + this( validator, false ); + } + + public LeafTextAreaEditor( Validator validator, boolean textField ) + { + this.validator = validator; + fieldText = textField ? new JTextField() : new JTextArea(); + scroll = new JScrollPane(fieldText); + startupComponents( textField ); + startupLayout( textField ); + placeComponents( textField ); + setupListeners(); + enableButtons( false ); + } + + public void setValue( String value ) + { + this.initialValue = value == null ? "" : value; + fieldText.setText( initialValue ); + } + + private void startupComponents( boolean textField ) + { + if( !textField ) + { + ((JTextArea) fieldText).setWrapStyleWord( true ); + ((JTextArea) fieldText).setLineWrap( true ); + } + new CopyPasteHandler(fieldText); + scroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + scroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + buttonSave.setMargin( new Insets(0,0,0,0) ); + buttonRevert.setMargin( new Insets(0,0,0,0) ); + SIPRPSpellChecker.getInstance().attachSpellCheckToComponent( fieldText ); + } + + private void startupLayout( boolean textField ) + { + TableLayout layout; + if( !textField ) + { + layout = new TableLayout( + new double[]{ TableLayout.FILL, TableLayout.MINIMUM, TableLayout.MINIMUM }, + new double[]{ TableLayout.MINIMUM, TableLayout.FILL } ); + } + else + { + layout = new TableLayout( + new double[]{ TableLayout.FILL, TableLayout.MINIMUM, TableLayout.MINIMUM }, + new double[]{ TableLayout.MINIMUM } ); + } + this.setLayout( layout ); + } + + private void placeComponents( boolean textField ) + { + if( ! textField ) + { + this.add( scroll, new TableLayoutConstraints( 0, 1, 2, 1) ); + this.add( buttonSave, new TableLayoutConstraints( 1, 0 ) ); + this.add( buttonRevert, new TableLayoutConstraints( 2, 0 ) ); + } + else + { + this.add( fieldText, new TableLayoutConstraints( 0, 0 ) ); + this.add( buttonSave, new TableLayoutConstraints( 1, 0 ) ); + this.add( buttonRevert, new TableLayoutConstraints( 2, 0 ) ); + } + } + + private void setupListeners() + { + buttonSave.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + save(); + } + } ); + buttonRevert.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + revert(); + } + } ); + fieldText.addCaretListener( new CaretListener() + { + @Override + public void caretUpdate( CaretEvent e ) + { + enableButtons( !initialValue.equals( fieldText.getText() ) && ( validator == null || validator.isValid( fieldText.getText() ) ) ); + } + } ); + } + + private void enableButtons( boolean enable ) + { + buttonRevert.setEnabled( enable ); + buttonSave.setEnabled( enable ); + } + + private void save() + { + enableButtons( false ); + firePropertyChange( ACTION_SAVE, initialValue, fieldText.getText() ); + initialValue = fieldText.getText(); + } + + private void revert() + { + fieldText.setText( initialValue ); + enableButtons( false ); + firePropertyChange( ACTION_REVERT, fieldText.getText(), initialValue ); + } + + @Override + public void setEnabled( boolean enabled ) + { + fieldText.setEnabled( enabled ); + if( enabled ) + { + fieldText.requestFocusInWindow(); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTextDialog.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTextDialog.java new file mode 100644 index 00000000..2f3d9f77 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTextDialog.java @@ -0,0 +1,169 @@ +package leaf.ui; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JRootPane; +import javax.swing.JTextArea; + +public class LeafTextDialog extends JDialog +{ + private static final long serialVersionUID = 1L; + + private static final Dimension buttonSize = new Dimension( 30, 20 ); + + private static final Dimension textSize = new Dimension( 200, 20 ); + + private static final Dimension expandedTextSize = new Dimension( 300, 200 ); + + private String text = null; + + private String defaultText = null; + + private boolean expanded = true; + + private final JTextArea textArea = new JTextArea(); + private final LeafButton expandButton = new LeafButton( "+" ); + private final LeafButton okButton = new LeafButton( "Ok" ); + private final LeafButton cancelButton = new LeafButton( "X" ); + + private TableLayout layout = null; + private TableLayout expandedLayout = null; + + /** Creates a new instance of JCalendarDialog */ + public LeafTextDialog( LeafWindow parentFrame, JComponent parent, String defaultText, boolean expanded ) + { + super( parentFrame ); + this.defaultText = defaultText == null ? "" : defaultText; + this.text = this.defaultText; + setModal( true ); + setContentPane( new LeafGradientPanel() ); + textArea.setText( text ); + expandButton.setPreferredSize( buttonSize ); + cancelButton.setPreferredSize( buttonSize ); + okButton.setPreferredSize( buttonSize ); + setupLayout(); + setUndecorated( true ); + setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG); + setLocationRelativeTo( null ); + this.expanded = expanded; + expand( expanded ); + addListeners(); + setVisible( true ); + } + + private void setupLayout() + { + double[] cols = new double[] { + TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED + }; + double[] rows = new double[] { + TableLayout.PREFERRED + }; + layout = new TableLayout( cols, rows ); + + cols = new double[] { + TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED + }; + rows = new double[] { + TableLayout.PREFERRED, TableLayout.FILL + }; + expandedLayout = new TableLayout( cols, rows ); + } + + private void placeComponents(boolean expand) + { + if(expand) + { + getContentPane().add( expandButton, new TableLayoutConstraints( 0, 0 ) ); + getContentPane().add( new JPanel(), new TableLayoutConstraints( 0, 1 ) ); + getContentPane().add( textArea, new TableLayoutConstraints( 1, 0,1,1 ) ); + getContentPane().add( okButton, new TableLayoutConstraints( 2, 0 ) ); + getContentPane().add( cancelButton, new TableLayoutConstraints( 3, 0 ) ); + getContentPane().add( new JPanel(), new TableLayoutConstraints( 2, 1,3,1 ) ); + } + else + { + getContentPane().add( expandButton, new TableLayoutConstraints( 0, 0 ) ); + getContentPane().add( textArea, new TableLayoutConstraints( 1, 0 ) ); + getContentPane().add( okButton, new TableLayoutConstraints( 2, 0 ) ); + getContentPane().add( cancelButton, new TableLayoutConstraints( 3, 0 ) ); + } + + ((JComponent) getContentPane()).setBorder( BorderFactory.createRaisedBevelBorder() ); + +// setSize( expand ? expandedLayout.preferredLayoutSize( this.getContentPane() ) : layout.preferredLayoutSize( this.getContentPane() ) ); + setSize( getLayout().preferredLayoutSize( getRootPane() ) ); + } + + private void setupComponents(boolean expand) + { + getContentPane().setLayout( expand ? expandedLayout : layout); + textArea.setPreferredSize( expand ? expandedTextSize : textSize ); + expandButton.setText( expand ? "-" : "+" ); + placeComponents(expand); + } + + private void expand( boolean expand ) + { + setupComponents(expand); + setResizable( expand ); + } + + private void addListeners() + { + expandButton.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + expanded = !expanded; + expand( expanded ); + } + } ); + + okButton.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + text = textArea.getText(); + close(); + } + } ); + + cancelButton.addActionListener( new ActionListener() + { + + @Override + public void actionPerformed( ActionEvent e ) + { + text = defaultText; + close(); + } + + } ); + } + + public String getText() + { + return text; + } + + public void close() + { + setVisible( false ); + dispose(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTransparentPanel.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTransparentPanel.java new file mode 100644 index 00000000..d6261e00 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTransparentPanel.java @@ -0,0 +1,47 @@ +package leaf.ui; + +import java.awt.AWTException; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.image.BufferedImage; + +import javax.swing.JPanel; + +public class LeafTransparentPanel extends JPanel +{ + private static final long serialVersionUID = 1L; + + private BufferedImage background = null; + + public LeafTransparentPanel() + { + updateBackground(); + } + + + private void updateBackground() + { + try + { + Robot rbt = new Robot(); + Toolkit tk = Toolkit.getDefaultToolkit(); + Dimension dim = tk.getScreenSize(); + background = rbt.createScreenCapture( new Rectangle( 0, 0, (int) dim.getWidth(), (int) dim.getHeight() ) ); + } catch( AWTException ex ) + { + ex.printStackTrace(); + } + } + + @Override + public void paintComponent( Graphics g ) + { + Point pos = this.getLocationOnScreen(); + Point offset = new Point( -pos.x, -pos.y ); + g.drawImage( background, offset.x, offset.y, null ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTree.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTree.java new file mode 100644 index 00000000..3059f5f6 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafTree.java @@ -0,0 +1,74 @@ +package leaf.ui; + +import java.util.Enumeration; +import java.util.LinkedList; +import java.util.List; + +import javax.swing.JTree; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreePath; + +import com.evolute.utils.ui.trees.TreeTools; + +public class LeafTree extends JTree +{ + + private static final long serialVersionUID = 1L; + + private final List expandedNodes = new LinkedList(); + + public LeafTree(TreeModel model) + { + super(model); + } + + public void saveExpansionState() + { + expandedNodes.clear(); + TreePath treePath = new TreePath(getRoot()); + savePath( treePath ); + } + + private DefaultMutableTreeNode getRoot() + { + return (DefaultMutableTreeNode) getModel().getRoot(); + } + + private void savePath( TreePath treePath ) + { + if( treePath != null ) + { + Enumeration expanded = getExpandedDescendants(treePath); + if( expanded != null ) + { + while( expanded.hasMoreElements() ) + { + TreePath path = expanded.nextElement(); + if( path != null ) + { + Object leaf = path.getLastPathComponent(); + if( leaf instanceof DefaultMutableTreeNode ) + { + Object userObject = ((DefaultMutableTreeNode)leaf).getUserObject(); + if( userObject != null ) + { + expandedNodes.add(userObject); + } + } + } + savePath(path); + } + } + } + } + + public void loadExpansionState() + { + for( Object userObject : expandedNodes ) + { + TreeTools.expandNodeForObject( userObject, this ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafUIConstants.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafUIConstants.java new file mode 100644 index 00000000..5e4817c6 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafUIConstants.java @@ -0,0 +1,15 @@ +package leaf.ui; + +public interface LeafUIConstants +{ + public static final String ICON_NAME_CREATE = "leaf/ui/icons/create.png"; + + public static final String ICON_NAME_EDIT = "leaf/ui/icons/edit.png"; + + public static final String ICON_NAME_REMOVE = "leaf/ui/icons/delete.png"; + + public static final String ICON_NAME_SAVE = "leaf/ui/icons/save.png"; + + public static final String ICON_NAME_REVERT = "leaf/ui/icons/revert.png"; + +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafWindow.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafWindow.java new file mode 100755 index 00000000..bbf62af3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/LeafWindow.java @@ -0,0 +1,940 @@ +package leaf.ui; + +import static info.clearthought.layout.TableLayoutConstants.FILL; +import static leaf.ui.LeafLogic.ACTION_CANCEL; +import static leaf.ui.LeafLogic.ACTION_STARTUP; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Cursor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.lang.annotation.Annotation; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Queue; + +import javax.swing.BorderFactory; +import javax.swing.DefaultListSelectionModel; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JTree; +import javax.swing.SwingUtilities; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.table.TableModel; + +import leaf.ui.LeafLogic.Action; +import leaf.ui.LeafLogic.LeafLogicActionBinding; +import leaf.ui.LeafLogic.LeafUIActionBinding; + +import com.evolute.adt.Pair; +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.ColumnizedMappable; +import com.evolute.utils.tables.VectorTableModel; +import com.evolute.utils.tracker.TrackableWindow; + +public class LeafWindow extends JFrame implements TrackableWindow, ListSelectionListener, TreeSelectionListener, ActionListener, PropertyChangeListener +{ + + private static final long serialVersionUID = 1L; + + private static final int DEFAULT_HEIGHT = 480; + + private static final int DEFAULT_WIDTH = 640; + + /** + * Registers DataComponent in a list of actions + * + * @author tsimao + * + */ + @Retention(RetentionPolicy.RUNTIME) + public @interface ActionActivation + { + /** + * Array of actions to execute when a select is listened in this + * JComponent + * + * @return + */ + String[] onSelect(); + + /** + * Array of actions to execute when a change is listened in this + * JComponent + * + * @return + */ + String[] onChange(); + + } + + /** + * Binds an Object to actions + * + * @author tsimao + * + */ + @Retention(RetentionPolicy.RUNTIME) + public @interface LeafObject + { + + /** + * Actions that use this field + */ + String[] useWith(); + } + + /** + * Declares a JPanel as a leaf + * + * @author tsimao + * + */ + @Retention(RetentionPolicy.RUNTIME) + public @interface LeafPanel + { + } + + /** + * This window's logic controller + */ + private final LeafLogic logicController; + + private List subPanels = new ArrayList(); + + /** + * Actions + */ + private Map mapActionByName = new HashMap(); + + /** + * Fields + */ + private Map> mapWindowOnSelectFieldByActionName = new HashMap>(); + private Map> mapWindowOnChangeFieldByActionName = new HashMap>(); + private Map mapLeafObjectByActionName = new HashMap(); + private Map mapInstanceByField = new HashMap(); + + /** + * Methods + */ + private Map> mapWindowMethodsByActionName = new HashMap>(); + private Map mapLogicMethodByActionName = new HashMap(); + private Map mapInstanceByMethod = new HashMap(); + + /** + * Meta-info + */ + private Map mapAnnotationByObject = new HashMap(); + + /** + * Run later actions + */ + private Queue> listRunLater = new LinkedList>(); + + /** + * Creates a new LeafWindow binded with given 'logicController' + * + * @param logicController + * @throws IllegalArgumentException + * @throws IllegalAccessException + */ + public LeafWindow(LeafLogic logicController) + { + super(); + setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); + this.logicController = logicController; + if( logicController != null ) + { + logicController.addWindow( this ); + } + } + + @Override + public void open() + { + setVisible( true ); + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable() + { + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + @Override + public boolean closeIfPossible() + { + close(); + return true; + } + + @Override + public void refresh() + { + } + + /** + * Aborts current action. Aborts pending actions as well if 'all' is true + * + * @param all + */ + public void abortAction( boolean all ) + { + runGivenAction( ACTION_CANCEL, null ); + throw new LeafRuntimeException( all ); + } + + protected boolean runAction( String actionName ) + { + return runAction( actionName, null ); + } + + /** + * Returns false if an error occurred + * + * @param actionName + * @param argument + * @return + */ + protected boolean runAction( String actionName, Object argument ) + { + boolean ok = true; + if( argument == null ) + { + Field field = mapLeafObjectByActionName.get( actionName ); + if(field != null) + { + Object instance = mapInstanceByField.get( field ); + if( instance != null) + { + try + { + argument = field.get( instance ); + } catch( IllegalArgumentException e ) + { + e.printStackTrace(System.out); + } catch( IllegalAccessException e ) + { + e.printStackTrace( System.out); + } + } + } + } + try + { + runGivenAction( actionName, argument ); + } catch( LeafRuntimeException leafRuntimeException ) + { + ok = !leafRuntimeException.isAbort(); + } + if( ok ) + { + runPendingActions(); + } + else + { + listRunLater.clear(); + } + return ok; + } + + public void runActionLater( String action ) + { + runActionLater( action, null ); + } + + public void runActionLater( String action, Object argument ) + { + if( action != null && mapActionByName.containsKey( action ) ) + { + listRunLater.add( new Pair( action, argument ) ); + } + } + + /** + * Fires ACTION_STARTUP + */ + public void completeSetup() + { + try + { + loadLeafs(); + loadActions(); + loadFields(); + loadMethods(); + runAction( ACTION_STARTUP, null ); + setVisible( true ); + } catch( Exception e ) + { + e.printStackTrace( System.out ); + } + } + + public static void setupTopBottomSimpleActionsPanel(JPanel where, JPanel top, JPanel bottom) + { + TableLayout layout = new TableLayout(new double[]{TableLayout.FILL}, new double[]{TableLayout.MINIMUM, TableLayout.FILL,TableLayout.MINIMUM}); + where.setLayout( layout ); + where.add( top, new TableLayoutConstraints(0,0) ); + where.add( new JPanel(), new TableLayoutConstraints(0,1) ); + where.add( bottom, new TableLayoutConstraints(0,2) ); + } + + public static void setupSimpleDataPanel( JPanel where, String name, JComponent... field ) + { + double[] cols = new double[] { + FILL + }; + double[] rows = new double[field.length]; + for( int i = 0; i < field.length; rows[i++] = TableLayout.PREFERRED ) + ; + rows[rows.length - 1] = FILL; + TableLayout layout = new TableLayout( cols, rows ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + where.setLayout( layout ); + if( name != null ) + { + where.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), name ) ); + } + + for( int i = 0; i < field.length; ++i ) + { + where.add( field[i], new TableLayoutConstraints( 0, i ) ); + } + } + + private void loadLeafs() throws IllegalArgumentException, IllegalAccessException + { + Field fields[] = this.getClass().getDeclaredFields(); + if( fields != null ) + { + for( Field field : fields ) + { + if( field.getAnnotation( LeafPanel.class ) != null && field.get( this ) != null ) + { + subPanels.add( (JPanel) field.get( this ) ); + } + } + } + } + + private void loadActions() throws IllegalArgumentException, IllegalAccessException + { + Field[] allLogicFields = this.logicController.getClass().getFields(); + for( Field field : allLogicFields ) + { + Action action = field.getAnnotation( Action.class ); + if( action != null ) + { + String value = (String) field.get( this ); + if( value != null ) + { + mapActionByName.put( value, action ); + mapWindowMethodsByActionName.put( value, new ArrayList() ); + mapWindowOnSelectFieldByActionName.put( value, new ArrayList() ); + mapWindowOnChangeFieldByActionName.put( value, new ArrayList() ); + } + } + } + } + + private void loadFields( Field[] fields, Object instance ) + { + try + { + for( Field field : fields ) + { + ActionActivation componentBehaviour = field.getAnnotation( ActionActivation.class ); + if( componentBehaviour != null ) + { + String[] allChanges = componentBehaviour.onChange(); + if( allChanges != null ) + { + for( String onChange : allChanges ) + { + if( mapActionByName.containsKey( onChange ) ) + { + // valid action + mapAnnotationByObject.put( field.get( instance ), componentBehaviour ); + mapWindowOnChangeFieldByActionName.get( onChange ).add( field.get( instance ) ); + if( !mapInstanceByField.containsKey( field ) ) + { + addListenerForField( componentBehaviour, field, instance ); + mapInstanceByField.put( field, instance ); + } + } + } + } + + String[] allSelect = componentBehaviour.onSelect(); + if( allSelect != null ) + { + for( String onSelect : allSelect ) + { + if( mapActionByName.containsKey( onSelect ) ) + { + // valid action + mapAnnotationByObject.put( field.get( instance ), componentBehaviour ); + mapWindowOnSelectFieldByActionName.get( onSelect ).add( field.get( instance ) ); + if( !mapInstanceByField.containsKey( field ) ) + { + addListenerForField( componentBehaviour, field, instance ); + mapInstanceByField.put( field, instance ); + } + } + } + } + } + + LeafObject leafObject = field.getAnnotation( LeafObject.class ); + if( leafObject != null ) + { + String[] useWith = leafObject.useWith(); + if( useWith != null ) + { + for( String current : useWith ) + { + if( mapActionByName.containsKey( current ) ) + { + // valid action + mapLeafObjectByActionName.put( current, field ); + mapInstanceByField.put( field, instance ); + } + } + } + } + } + } catch( IllegalAccessException exception ) + { + exception.printStackTrace( System.out ); + } + } + + private void loadFields() + { + Field[] allFields = this.getClass().getDeclaredFields(); + if( allFields != null ) + { + loadFields( allFields, this ); + + } + allFields = logicController.getClass().getDeclaredFields(); + if( allFields != null ) + { + loadFields( allFields, logicController ); + + } + for( JPanel panel : subPanels ) + { + allFields = panel.getClass().getDeclaredFields(); + if( allFields != null ) + { + loadFields( allFields, panel ); + } + } + } + + private void loadWindowMethods( Method[] windowMethods, Object instance ) + { + for( Method method : windowMethods ) + { + LeafUIActionBinding actionBinding = method.getAnnotation( LeafUIActionBinding.class ); + if( actionBinding != null ) + { + String[] actions = actionBinding.action(); + for( String actionName : actions ) + { + if( mapActionByName.containsKey( actionName ) ) + { + // valid action + mapWindowMethodsByActionName.get( actionName ).add( method ); + + mapAnnotationByObject.put( method, actionBinding ); + mapInstanceByMethod.put( method, instance ); + } + } + } + } + } + + private void loadLogicMethods() + { + Method[] allLogicMethods = this.logicController.getClass().getDeclaredMethods(); + if( allLogicMethods != null ) + { + for( Method method : allLogicMethods ) + { + LeafLogicActionBinding actionBinding = method.getAnnotation( LeafLogicActionBinding.class ); + if( actionBinding != null ) + { + String[] actions = actionBinding.actions(); + if( actions != null ) + { + for( String actionName : actions ) + { + if( mapActionByName.containsKey( actionName ) ) + { + // valid action + mapAnnotationByObject.put( method, actionBinding ); + mapLogicMethodByActionName.put( actionName, method ); + mapInstanceByMethod.put( method, logicController ); + } + } + } + } + } + } + } + + private void loadMethods() + { + loadLogicMethods(); + + Method[] allWindowMethods = this.getClass().getDeclaredMethods(); + if( allWindowMethods != null ) + { + loadWindowMethods( allWindowMethods, this ); + } + + for( JPanel panel : subPanels ) + { + allWindowMethods = panel.getClass().getDeclaredMethods(); + if( allWindowMethods != null ) + { + loadWindowMethods( allWindowMethods, panel ); + } + } + + } + + private Object getObjectForAction( String actionName ) + { + Object result = null; + Field field = mapLeafObjectByActionName.get( actionName ); + if( field != null ) + { + Object instance = mapInstanceByField.get( field ); + if( instance != null ) + { + try + { + result = field.get( instance ); + } catch( IllegalArgumentException e ) + { + e.printStackTrace(); + } catch( IllegalAccessException e ) + { + e.printStackTrace(); + } + } + } + return result; + } + + public void runPendingActions() + { + while( listRunLater.size() > 0 ) + { + Pair p = listRunLater.poll(); + runAction( p.getLeft(), p.getRight() ); + } + } + + /** + * Executes given action + */ + private void runGivenAction( String actionName, Object argument ) + { + System.out.println( "Running: " + actionName ); + try + { + this.setCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ) ); + if( actionName != null && mapActionByName.containsKey( actionName ) ) + { + Action action = mapActionByName.get( actionName ); + if( action.isSave() ) + { + Object windowArgument = getObjectForAction( actionName ); + if( windowArgument == null ) + { + windowArgument = argument; + } + Object logicArgument = windowArgument; + for( Method currentWindowMethod : mapWindowMethodsByActionName.get( actionName ) ) + { + Object currentLogicArgument = runWindowMethod( currentWindowMethod, windowArgument != null ? windowArgument : argument ); + logicArgument = logicArgument == null ? currentLogicArgument : logicArgument; + } + runLogicMethod( mapLogicMethodByActionName.get( actionName ), logicArgument ); + } + else + { + Object windowArgument = runLogicMethod( mapLogicMethodByActionName.get( actionName ), argument ); + for( Method currentWindowMethod : mapWindowMethodsByActionName.get( actionName ) ) + { + runWindowMethod( currentWindowMethod, windowArgument != null ? windowArgument : argument ); + } + } + } + } finally + { + this.setCursor( Cursor.getDefaultCursor() ); + } + } + + private Object runLogicMethod( Method logicMethod, Object argument ) throws LeafRuntimeException + { + Object result = null; + try + { + if( logicMethod != null ) + { + if( logicMethod.getParameterTypes().length > 0 ) + { + result = logicMethod.invoke( logicController, argument ); + } + else + { + result = logicMethod.invoke( logicController ); + } + } + } catch( IllegalArgumentException e ) + { + System.out.println("Error in: " + logicMethod.getName() ); + System.out.println("Got: " + argument + " expected: " + (logicMethod.getParameterTypes().length > 0 ? logicMethod.getParameterTypes()[0].getCanonicalName() : "(nothing)")); + e.printStackTrace( System.out ); + } catch( IllegalAccessException e ) + { + e.printStackTrace( System.out ); + } catch( InvocationTargetException e ) + { + if( e.getCause() instanceof LeafRuntimeException ) + { + throw (LeafRuntimeException) e.getCause(); + } + else + { + e.printStackTrace( System.out ); + } + } + return result; + } + + private Object runWindowMethod( Method windowMethod, Object argument ) throws LeafRuntimeException + { + Object result = null; + try + { + if( windowMethod != null ) + { + if( windowMethod.getParameterTypes().length > 0 ) + { + result = windowMethod.invoke( mapInstanceByMethod.get( windowMethod ), argument ); + } + else + { + result = windowMethod.invoke( mapInstanceByMethod.get( windowMethod ) ); + } + } + } catch( IllegalArgumentException e ) + { + System.out.println("Error in: " + windowMethod.getName() ); + System.out.println("Got: " + argument + " expected: " + (windowMethod.getParameterTypes().length > 0 ? windowMethod.getParameterTypes()[0].getCanonicalName() : "(nothing)")); + e.printStackTrace( System.out ); + } catch( IllegalAccessException e ) + { + e.printStackTrace( System.out ); + } catch( InvocationTargetException e ) + { + if( e.getCause() instanceof LeafRuntimeException ) + { + throw (LeafRuntimeException) e.getCause(); + } + else + { + e.printStackTrace( System.out ); + } + } + return result; + } + + private void addListenerForField( ActionActivation annotation, Field field, Object instance ) + { + if( instance instanceof JFrame || instance instanceof JPanel ) + { + try + { + Object value = field.get( instance ); + if( value instanceof BaseTable ) + { + ((BaseTable) value).getSelectionModel().addListSelectionListener( this ); + } + else if( value instanceof JTree ) + { + ((JTree) value).addTreeSelectionListener( this ); + } + else if( value instanceof JButton ) + { + ((JButton) value).addActionListener( this ); + } + else if( value instanceof LeafInputField ) + { + ((LeafInputField) value).addPropertyChangeListener( this ); + } + } catch( IllegalAccessException e ) + { + e.printStackTrace( System.out ); + } catch( NullPointerException e ) + { + e.printStackTrace( System.out ); + } + } + } + + private Object getArgumentListSelectionEvent( String actionName, ListSelectionEvent event ) + { + Object source = event.getSource(); + List allComponents = mapWindowOnSelectFieldByActionName.get( actionName ); + for( Object component : allComponents ) + { + if( component instanceof BaseTable && ((BaseTable) component).getSelectionModel().equals( source ) ) + { + int [] indexes = ((BaseTable) component).getSelectedRows(); + if( indexes != null && indexes.length > 0 ) + { + TableModel model = ((BaseTable) component).getModel(); + if( model instanceof VectorTableModel ) + { + if(indexes.length == 1 && indexes[0] > -1) + { + return ((ColumnizedMappable) ((VectorTableModel) model).getRowAt( indexes[0] )).getID(); + } + else + { + List allSelected = new ArrayList(); + for(int i = 0; i < indexes.length; ++i) + { + allSelected.add( ((ColumnizedMappable) ((VectorTableModel) model).getRowAt( indexes[0] )).getID() ); + } + return allSelected; + } + } + else if( model instanceof LeafTableModel ) + { + if(indexes.length == 1 && indexes[0] > -1) + { + return ((LeafTableModel) model).getKey( indexes[0] ); + } + else + { + List allSelected = new ArrayList(); + for(int i = 0; i < indexes.length; ++i) + { + allSelected.add( ((LeafTableModel) model).getKey( indexes[0] )); + } + return allSelected; + } + } + } + } + } + return null; + } + + private List getActionListSelectionEvent( ListSelectionEvent event ) + { + List result = new ArrayList(); + if( event.getSource() instanceof DefaultListSelectionModel ) + { + DefaultListSelectionModel model = (DefaultListSelectionModel) event.getSource(); + BaseTable table = null; + for( List allComponents : mapWindowOnSelectFieldByActionName.values() ) + { + // for each registered table + for( Object component : allComponents ) + { + if( component instanceof BaseTable && ((BaseTable) component).getSelectionModel().equals( model ) ) + { + table = (BaseTable) component; + } + if( table != null ) + { + break; + } + } + if( table != null ) + { + break; + } + } + Annotation an = mapAnnotationByObject.get( table ); + if( an != null && an instanceof ActionActivation ) + { + String[] actions = ((ActionActivation) an).onSelect(); + for( String actionName : actions ) + { + result.add( actionName ); + } + } + } + return result; + } + + // returns selected node + private Object getArgumentTreeSelectionEvent( String actionName, TreeSelectionEvent event ) + { + List components = mapWindowOnSelectFieldByActionName.get( actionName ); + for( Object component : components ) + { + if( component instanceof JTree && event.getPath() != null ) + { + Object[] nodes = event.getPath().getPath(); + if( nodes != null && nodes.length > 0 ) + { + return nodes[nodes.length - 1]; + } + } + } + return null; + } + + private List getActionTreeSelectionEvent( TreeSelectionEvent event ) + { + List result = new ArrayList(); + Annotation an = mapAnnotationByObject.get( event.getSource() ); + if( an != null && an instanceof ActionActivation ) + { + String[] actions = ((ActionActivation) an).onSelect(); + for( String actionName : actions ) + { + result.add( actionName ); + } + } + return result; + } + + private List getActionActionEvent( ActionEvent event ) + { + List result = new ArrayList(); + Annotation an = mapAnnotationByObject.get( event.getSource() ); + if( an != null && an instanceof ActionActivation ) + { + String[] actions = ((ActionActivation) an).onSelect(); + for( String actionName : actions ) + { + result.add( actionName ); + } + } + return result; + } + + private List getActionsForPropertyChangeEvent( PropertyChangeEvent evt ) + { + List result = new ArrayList(); + Annotation an = mapAnnotationByObject.get( evt.getSource() ); + if( an != null ) + { + if( an instanceof ActionActivation ) + { + if( evt.getSource() instanceof LeafInputField ) + { + if( LeafInputField.PROPERTY_CHANGED_CONSTANT.equals( evt.getPropertyName() ) ) + { + String[] actions = ((ActionActivation) an).onChange(); + for( String actionName : actions ) + { + result.add( actionName ); + } + } + } + } + } + return result; + } + + @Override + public void valueChanged( TreeSelectionEvent event ) + { + List actions = getActionTreeSelectionEvent( event ); + for( String action : actions ) + { + Object argument = getArgumentTreeSelectionEvent( action, event ); + if( !runAction( action, argument ) ) + { + break; + } + } + } + + /** + * Listens to ListSelectionEvents + */ + @Override + public void valueChanged( ListSelectionEvent event ) + { + if( !event.getValueIsAdjusting() ) + { + List actionNames = getActionListSelectionEvent( event ); + for( String action : actionNames ) + { + Object argument = getArgumentListSelectionEvent( action, event ); + if( !runAction( action, argument ) ) + { + break; + } + } + } + } + + @Override + public void actionPerformed( ActionEvent event ) + { + List actionNames = getActionActionEvent( event ); + if( actionNames.size() > 0 ) + { + for( int i = 1; i < actionNames.size(); ++i ) + { + runActionLater( actionNames.get( i ) ); + } + runAction( actionNames.get( 0 ) ); + } + } + + @Override + public void propertyChange( PropertyChangeEvent evt ) + { + List actionNames = getActionsForPropertyChangeEvent( evt ); + if( actionNames.size() > 0 ) + { + for( int i = 1; i < actionNames.size(); ++i ) + { + runActionLater( actionNames.get( i ) ); + } + runAction( actionNames.get( 0 ) ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/SimpleTable.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/SimpleTable.java new file mode 100644 index 00000000..756cbb51 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/SimpleTable.java @@ -0,0 +1,84 @@ +package leaf.ui; + +import java.util.List; +import java.util.Vector; + +import javax.swing.BorderFactory; +import javax.swing.JScrollPane; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionListener; + +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.VectorTableModel; + +public class SimpleTable extends JScrollPane +{ + + private static final long serialVersionUID = 1L; + + private final VectorTableModel model; + + private final BaseTable table; + + public SimpleTable( String ... columnName ) + { + model = new VectorTableModel( columnName ); + table = new BaseTable( model ); + setViewportView(table); + setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); + table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + } + + public VectorTableModel getModel() + { + return model; + } + + public BaseTable getTable() + { + return table; + } + + public void setTitle(String title) + { + setBorder(BorderFactory.createTitledBorder(title)); + } + + public void addListSelectionListener(ListSelectionListener listener){ + table.getSelectionModel().addListSelectionListener(listener); + } + + public void setRows( Vector rows ) + { + model.setValues( rows ); + } + + public ROW_CLASS getSelectedRow() + { + ROW_CLASS result = null; + int index = table.getSelectedRow(); + if( index > -1 ) + { + result = model.getRowAt( index ); + } + return result; + } + + public List getSelectedRows() + { + List result = null; + int [] index = table.getSelectedRows(); + for( int i = 0; i < index.length; ++i ) + { + result.add( model.getRowAt( index[i] ) ); + } + return result; + } + + public void clear() + { + model.clearAll(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/TreeInserterDialog.java b/branches/SIPRP/SIPRPSoft/src/leaf/ui/TreeInserterDialog.java new file mode 100644 index 00000000..38a59dfd --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/leaf/ui/TreeInserterDialog.java @@ -0,0 +1,329 @@ +package leaf.ui; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Dimension; +import java.awt.Insets; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Enumeration; +import java.util.LinkedList; +import java.util.List; + +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +import com.evolute.utils.error.ErrorLogger; +import com.evolute.utils.images.ImageException; +import com.evolute.utils.images.ImageIconLoader; +import com.evolute.utils.ui.trees.TreeTools; + + + +public class TreeInserterDialog extends JDialog +{ + + private static final long serialVersionUID = 1L; + + private static final Dimension DIALOG_DEFAULT_DIMENSIONS = new Dimension( 800, 500 ); + + private static final String ICON_NAME_ADD = "leaf/ui/icons/add.png"; + + private static final String ICON_NAME_REM = "leaf/ui/icons/rem.png"; + + private final DefaultMutableTreeNode newRoot = new DefaultMutableTreeNode(); + + private final DefaultTreeModel newModel = new DefaultTreeModel( newRoot ); + + private final JTree newTree = new JTree( newModel ); + + private final JScrollPane newScroll = new JScrollPane( newTree ); + + private final DefaultMutableTreeNode allRoot; + + private final DefaultTreeModel allModel; + + private final JTree allTree; + + private final JScrollPane allScroll; + + private LeafButton buttonAdd = null; + + private LeafButton buttonRemove = null; + + private final LeafButton buttonOK = new LeafButton( "OK" ); + + private final LeafButton buttonCancel = new LeafButton( "Cancelar" ); + + private static List expandedNodes = new LinkedList(); + + public TreeInserterDialog( String title, DefaultMutableTreeNode root ) + { + this.allRoot = root; + this.allModel = new DefaultTreeModel( allRoot ); + this.allTree = new JTree(allModel); + this.allScroll = new JScrollPane( allTree ); + this.setTitle( title ); + try + { + buttonAdd = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_ADD ) ); + buttonRemove = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_REM ) ); + } catch( ImageException e ) + { + ErrorLogger.logException( e ); + } + startupComponents(); + setupLayout(); + placeComponents(); + startupListeners(); + loadExpansionState(); + setEnabled(); + Toolkit tk = Toolkit.getDefaultToolkit(); + if( tk != null ) + { + this.setSize( tk.getScreenSize().width, DIALOG_DEFAULT_DIMENSIONS.height ); + } + else + { + this.setSize( DIALOG_DEFAULT_DIMENSIONS ); + } + this.setLocationRelativeTo( null ); + this.setModal( true ); + this.setVisible( true ); + } + + private void loadExpansionState() + { + TreeTools.refreshTree( allTree, allRoot, expandedNodes.isEmpty() ); + for( Object userObject : expandedNodes ) + { + TreeTools.expandNodeForObject( userObject, allTree ); + } + } + + private void startupComponents() + { + newTree.setRootVisible( false ); + newTree.getSelectionModel().setSelectionMode( TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION ); + allTree.setRootVisible( false ); + allTree.getSelectionModel().setSelectionMode( TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); + allScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + allScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + newScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + newScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + buttonAdd.setToolTipText( "Adicionar" ); + buttonRemove.setToolTipText( "Remover" ); + buttonAdd.setMargin( new Insets(0,0,0,0) ); + buttonRemove.setMargin( new Insets(0,0,0,0) ); + } + + private void setupLayout() + { + TableLayout layout = new TableLayout( + new double[]{ TableLayout.FILL, TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.MINIMUM }, + new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.MINIMUM } + ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + getContentPane().setLayout( layout ); + } + + private void placeComponents() + { + getContentPane().add( new JLabel("Todos"), new TableLayoutConstraints( 0,0 ) ); + getContentPane().add( new JLabel("a adicionar..."), new TableLayoutConstraints( 2,0,4,0 ) ); + getContentPane().add( allScroll, new TableLayoutConstraints( 0,1,0,4 ) ); + getContentPane().add( buttonAdd, new TableLayoutConstraints( 1,1 ) ); + getContentPane().add( buttonRemove, new TableLayoutConstraints( 1,3 ) ); + getContentPane().add( newScroll, new TableLayoutConstraints( 2,1,4,3 ) ); + getContentPane().add( buttonOK, new TableLayoutConstraints( 3,4 ) ); + getContentPane().add( buttonCancel, new TableLayoutConstraints( 4,4 ) ); + } + + private void startupListeners() + { + buttonAdd.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + move( allTree, newTree ); + } + } ); + buttonRemove.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + move( newTree, allTree ); + } + } ); + buttonOK.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + ok(); + } + } ); + buttonCancel.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + cancel(); + } + } ); + allTree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener(){ + @Override + public void valueChanged( TreeSelectionEvent e ) + { + setEnabled(); + } + } ); + newTree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener(){ + @Override + public void valueChanged( TreeSelectionEvent e ) + { + setEnabled(); + } + } ); + } + + private void move( JTree from, JTree to ) + { + TreePath [] paths = from.getSelectionPaths(); + if( paths != null ) + { + DefaultMutableTreeNode fromRoot = (DefaultMutableTreeNode) from.getModel().getRoot(); + DefaultMutableTreeNode toRoot = (DefaultMutableTreeNode) to.getModel().getRoot(); + for( TreePath path : paths ) + { + for( int i = 1; i < path.getPathCount(); ++i ) + { + DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getPathComponent( i ); + DefaultMutableTreeNode parent = (DefaultMutableTreeNode) path.getPathComponent( i-1 ); + if( node != null && parent != null ) + { + DefaultMutableTreeNode exists = TreeTools.findNodeWithUserObject( node.getUserObject(), toRoot ); + if( exists == null ) + { + add(node, parent.getUserObject(), toRoot, path.getPathCount() == i + 1 ); + } + else if( i + 1 == path.getPathCount() ) + { + TreeTools.merge( exists, node ); + } + } + } + removeNode( (DefaultMutableTreeNode) path.getLastPathComponent(), fromRoot ); + } + TreeTools.refreshTree( from, fromRoot, true ); + TreeTools.refreshTree( to, toRoot, true ); + } + } + + private void removeNode( DefaultMutableTreeNode node, DefaultMutableTreeNode root ) + { + DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node.getParent(); + node.removeFromParent(); + if( parent != null && parent.getChildCount() == 0 ) + { + removeNode( parent, root ); + } + } + + private void add( DefaultMutableTreeNode node, Object parent, DefaultMutableTreeNode where, boolean fullClone ) + { + DefaultMutableTreeNode parentNode = TreeTools.findNodeWithUserObject( parent, where ); + if( parentNode == null ) + { + parentNode = where; + } + parentNode.add( fullClone ? TreeTools.cloneFullNode(node) : (DefaultMutableTreeNode) node.clone() ); + } + + private void ok() + { + close(); + } + + private void cancel() + { + newRoot.removeAllChildren(); + close(); + } + + private void close() + { + saveExpandedState(); + setVisible( false ); + } + + private void setEnabled() + { + boolean allSelected = allTree.getSelectionPath() != null; + boolean newSelected = newTree.getSelectionPath() != null; + boolean somethingToAdd = newRoot.getChildCount() > 0; + buttonAdd.setEnabled( allSelected ); + buttonRemove.setEnabled( newSelected ); + buttonOK.setEnabled( somethingToAdd ); + } + + public DefaultMutableTreeNode getResult() + { + return newRoot; + } + + private void saveExpandedState( ) + { + expandedNodes.clear(); + if( allTree != null ) + { + Object root = allTree.getModel().getRoot(); + if( root != null ) + { + savePath( new TreePath(root) ); + } + } + } + + private void savePath( TreePath treePath ) + { + if( treePath != null ) + { + Enumeration expanded = allTree.getExpandedDescendants(treePath); + if( expanded != null ) + { + while( expanded.hasMoreElements() ) + { + TreePath path = expanded.nextElement(); + if( path != null ) + { + Object leaf = path.getLastPathComponent(); + if( leaf instanceof DefaultMutableTreeNode ) + { + Object userObject = ((DefaultMutableTreeNode)leaf).getUserObject(); + if( userObject != null ) + { + expandedNodes.add(userObject); + } + } + } + savePath(path); + } + } + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/add.png b/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/add.png new file mode 100644 index 00000000..c44a03ff Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/add.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/create.png b/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/create.png new file mode 100644 index 00000000..d149d546 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/create.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/delete.png b/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/delete.png new file mode 100644 index 00000000..312bb3f5 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/delete.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/edit.png b/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/edit.png new file mode 100644 index 00000000..35d01513 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/edit.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/rem.png b/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/rem.png new file mode 100644 index 00000000..450d81fc Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/rem.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/revert.png b/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/revert.png new file mode 100644 index 00000000..bd1d011a Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/revert.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/save.png b/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/save.png new file mode 100644 index 00000000..d2d0d6e1 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/leaf/ui/icons/save.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/log4j.properties b/branches/SIPRP/SIPRPSoft/src/log4j.properties new file mode 100644 index 00000000..3a9b9feb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/log4j.properties @@ -0,0 +1,3 @@ +log4j.rootCategory=ERROR, dest1 +log4j.appender.dest1=org.apache.log4j.ConsoleAppender +log4j.appender.dest1.layout=org.apache.log4j.PatternLayout diff --git a/branches/SIPRP/SIPRPSoft/src/logo/logo_combo.jpg b/branches/SIPRP/SIPRPSoft/src/logo/logo_combo.jpg new file mode 100644 index 00000000..24d6543a Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/logo/logo_combo.jpg differ diff --git a/branches/SIPRP/SIPRPSoft/src/logo/logo_w400.jpg b/branches/SIPRP/SIPRPSoft/src/logo/logo_w400.jpg new file mode 100644 index 00000000..97fa4634 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/logo/logo_w400.jpg differ diff --git a/branches/SIPRP/SIPRPSoft/src/logo/logo_w400.png b/branches/SIPRP/SIPRPSoft/src/logo/logo_w400.png new file mode 100644 index 00000000..2e9fe434 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/logo/logo_w400.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/logo_combo.jpg b/branches/SIPRP/SIPRPSoft/src/logo_combo.jpg new file mode 100644 index 00000000..24d6543a Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/logo_combo.jpg differ diff --git a/branches/SIPRP/SIPRPSoft/src/logo_evo.jpg b/branches/SIPRP/SIPRPSoft/src/logo_evo.jpg new file mode 100644 index 00000000..230ae585 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/logo_evo.jpg differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/CompanyDataLoader.java b/branches/SIPRP/SIPRPSoft/src/siprp/CompanyDataLoader.java new file mode 100644 index 00000000..645bc01f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/CompanyDataLoader.java @@ -0,0 +1,20 @@ +/* + * CompanyDataLoader.java + * + * Created on 25 de Janeiro de 2005, 13:18 + */ + +package siprp; + +/** + * + * @author fpalma + */ +public interface CompanyDataLoader +{ + public static final String DATA = "XDATAX"; + public static final String NOME = "XNOMEX"; + public static final String MORADA = "XMORADAX"; + public static final String HORA = "XHORAX"; + public void load(); +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/FichaDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/FichaDataProvider.java new file mode 100644 index 00000000..2f117e83 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/FichaDataProvider.java @@ -0,0 +1,750 @@ +/* + * FichaDataProvider.java + * + * Created on 30 de Marco de 2004, 11:31 + */ + +package siprp; + +import java.text.DateFormat; +import java.util.Date; +import java.util.Hashtable; + +import siprp.data.AvisoConstants; +import siprp.data.Marcacao; +import siprp.data.outer.MarcacoesTrabalhadorData; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.db.DBException; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; +import com.evolute.utils.sql.Update; +import com.evolute.utils.strings.StringPlainer; +import com.evolute.utils.ui.search.SearchDialog; +import com.evolute.utils.ui.search.SearchExecuter; + +/** + * + * @author pars + */ +public class FichaDataProvider + implements SearchExecuter { + + private static final Object LOCK = new Object(); + private static FichaDataProvider instance = null; + private final Executer executer; + + public static final String SIPRP = "SIPRP - Sociedade Ib\u00e9rica de Preven\u00e7\u00e3o de Riscos Profissionais"; + + // empresas + public static final String T_EMPRESAS = "empresas"; + public static final String ID = "id"; + public static final String DESIGNACAO_SOCIAL = "designacao_social"; + public static final String SERVICO_SAUDE_TIPO = "servico_saude_tipo"; + public static final String SERVICO_SAUDE_DESIGNACAO = "servico_saude_designacao"; + public static final String SERVICO_HIGIENE_TIPO = "servico_higiene_tipo"; + public static final String SERVICO_HIGIENE_DESIGNACAO = "servico_higiene_designacao"; + public static final String INACTIVO = "inactivo"; + +// public static final DBTable EMPRESAS = +// new DBTable( T_EMPRESAS, +// new String[]{ DESIGNACAO_SOCIAL, +// SERVICO_SAUDE_TIPO, +// SERVICO_SAUDE_DESIGNACAO, +// SERVICO_HIGIENE_TIPO, +// SERVICO_HIGIENE_DESIGNACAO, +// INACTIVO }, +// ID ); + + // estabelecimentos + public static final String T_ESTABELECIMENTOS = "estabelecimentos"; + // ID + public static final String NOME = "nome"; + public static final String LOCALIDADE = "localidade"; + public static final String EMPRESA_ID = "empresa_id"; + // INACTIVO + +// public static final DBTable ESTABELECIMENTOS = +// new DBTable( T_ESTABELECIMENTOS, +// new String[]{ NOME, LOCALIDADE, EMPRESA_ID, INACTIVO }, +// ID ); + + // trabalhadores + public static final String T_TRABALHADORES = "trabalhadores"; + // ID + // public static final String NOME = "nome"; + public static final String SEXO = "sexo"; + public static final String DATA_NASCIMENTO = "data_nascimento"; + public static final String NACIONALIDADE = "nacionalidade"; + public static final String NUMERO_MECANOGRAFICO = "numero_mecanografico"; + public static final String DATA_ADMISSAO = "data_admissao"; + public static final String CATEGORIA = "categoria"; + public static final String LOCAL_TRABALHO = "local_trabalho"; + public static final String FUNCAO_PROPOSTA = "funcao_proposta"; + public static final String DATA_ADMISSAO_FUNCAO = "data_admissao_funcao"; + public static final String OBSERVACOES = "observacoes"; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + // INACTIVO + +// public static final DBTable TRABALHADORES = +// new DBTable( T_TRABALHADORES, +// new String[]{ NOME, SEXO, DATA_NASCIMENTO, +// NACIONALIDADE, NUMERO_MECANOGRAFICO, +// DATA_ADMISSAO, CATEGORIA, LOCAL_TRABALHO, +// FUNCAO_PROPOSTA, DATA_ADMISSAO_FUNCAO, +// OBSERVACOES, ESTABELECIMENTO_ID, INACTIVO }, +// ID ); + + //medicos + public static final String T_MEDICOS = "medicos"; + + public static final String NUMERO_CEDULA = "numero_cedula"; + +// public static final DBTable MEDICOS = +// new DBTable( T_MEDICOS, +// new String[]{ NOME, NUMERO_CEDULA }, ID ); + + // exames + public static final String T_EXAMES = "exames"; + // ID + public static final String DATA = "data"; + public static final String TIPO = "tipo"; + public static final String OCASIONAL = "ocasional"; + public static final String OUTRO_TIPO = "outro_tipo"; + public static final String RESULTADO = "resultado"; + public static final String OUTRA_FUNCAO_1 = "outra_funcao_1"; + public static final String OUTRA_FUNCAO_2 = "outra_funcao_2"; + public static final String OUTRA_FUNCAO_3 = "outra_funcao_3"; + public static final String OUTRA_FUNCAO_4 = "outra_funcao_4"; + public static final String PROXIMO_EXAME = "proximo_exame"; + public static final String OUTRAS_RECOMENDACOES = "outras_recomendacoes"; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String MEDICO_ID = "medico_id"; + public static final String PDF = "pdf"; + +// public static final DBTable EXAMES = +// new DBTable( T_EXAMES, +// new String[]{ DATA, TIPO, OCASIONAL, +// OUTRO_TIPO, RESULTADO, OUTRA_FUNCAO_1, +// OUTRA_FUNCAO_2, OUTRA_FUNCAO_3, +// OUTRA_FUNCAO_4, PROXIMO_EXAME, +// OUTRAS_RECOMENDACOES, TRABALHADOR_ID, MEDICO_ID, PDF, INACTIVO }, +// ID ); +// +// public static DBReference R_ESTABELECIMENTO_EMPRESA = new DBReference( ESTABELECIMENTOS.getFieldByName( EMPRESA_ID ) ); +// public static DBReference R_TRABALHADOR_ESTABELECIMENTO = new DBReference( TRABALHADORES.getFieldByName( ESTABELECIMENTO_ID ) ); +// public static DBReference R_EXAME_TRABALHADOR = new DBReference( EXAMES.getFieldByName( TRABALHADOR_ID ) ); +// public static DBReference R_EXAME_MEDICO = new DBReference( EXAMES.getFieldByName( MEDICO_ID ) ); +// static +// { +// try +// { +// EXAMES.addRelation( MEDICOS, +// new DBField[]{ EXAMES.getFieldByName( MEDICO_ID ) }, +// "R_EXAMES_MEDICOS" ); +// EXAMES.addRelation( TRABALHADORES, +// new DBField[]{ EXAMES.getFieldByName( TRABALHADOR_ID ) }, +// "R_EXAMES_TRABALHADORES" ); +// TRABALHADORES.addRelation( ESTABELECIMENTOS, +// new DBField[]{ TRABALHADORES.getFieldByName( ESTABELECIMENTO_ID ) }, +// "R_TRABALHADORES_ESTABELECIMENTOS" ); +// ESTABELECIMENTOS.addRelation( EMPRESAS, +// new DBField[]{ ESTABELECIMENTOS.getFieldByName( EMPRESA_ID ) }, +// "R_ESTABELECIMENTOS_EMPRESAS" ); +// EMPRESAS.disableSave( INACTIVO ); +// ESTABELECIMENTOS.disableSave( INACTIVO ); +// TRABALHADORES.disableSave( INACTIVO ); +// EXAMES.disableSave( PDF ); +// } +// catch( Exception e ) +// { +// throw new RuntimeException( e ); +// } +// } + + public static final int SEARCH_EMPRESAS = 0; + public static final int SEARCH_ESTABELECIMENTOS = 1; + public static final int SEARCH_TRABALHADORES = 2; + public static final int SEARCH_EXAMES = 3; + private int SEARCH = 0; + private int SEARCH_EMPRESAS_ID = -1; + private int SEARCH_ESTABELECIMENTOS_ID = -1; + private int SEARCH_TRABALHADORES_ID = -1; + private int SEARCH_EXAMES_ID = -1; + + protected final Hashtable medicosEstabelecimentosHash = new Hashtable(); + + /** Creates a new instance of FichaDataProvider */ + public FichaDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + executer = dbm.getSharedExecuter( this ); + +// setDBTable( EXAMES ); + + } + +// public static MetaProvider getProvider() +// throws Exception +// { +// synchronized( LOCK ) +// { +// if( instance == null ) +// { +// instance = new FichaDataProvider(); +// } +// } +// return instance; +// } + + public static FichaDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new FichaDataProvider(); + } + } + return instance; + } + + public String[] getColumnNames() { + return new String[]{ "Nome" }; + } + + public String getSearchTitle() { + switch( SEARCH ) + { + case SEARCH_EMPRESAS: + return "Procurar empresa"; + case SEARCH_ESTABELECIMENTOS: + return "Procurar estabelecimento"; + case SEARCH_TRABALHADORES: + return "Procurar trabalhador"; + case SEARCH_EXAMES: + return "Procurar exame"; + } + return ""; + } + + public boolean hasDetails() { + return false; + } + + public void setSearch( int what ) + { + switch( what ) + { + case SEARCH_EMPRESAS: + case SEARCH_ESTABELECIMENTOS: + case SEARCH_TRABALHADORES: + case SEARCH_EXAMES: + SEARCH = what; + break; + } + } + + public void setSearchID( int what, int id ) + { + switch( what ) + { + case SEARCH_EMPRESAS: + SEARCH_EMPRESAS_ID = id; + break; + case SEARCH_ESTABELECIMENTOS: + SEARCH_ESTABELECIMENTOS_ID = id; + break; + case SEARCH_TRABALHADORES: + SEARCH_TRABALHADORES_ID = id; + break; + case SEARCH_EXAMES: + SEARCH_EXAMES_ID = id; + break; + } + } + + public Virtual2DArray search( String pattern ) throws Exception { + switch( SEARCH ) + { + case SEARCH_EMPRESAS: + return searchEmpresas( pattern ); + case SEARCH_ESTABELECIMENTOS: + return searchEstabelecimentos( pattern ); + case SEARCH_TRABALHADORES: + return searchTrabalhadores( pattern ); + case SEARCH_EXAMES: + return searchExames( pattern ); + } + return null; + } + + public Virtual2DArray searchEmpresas( String pattern ) throws Exception { + Select select = new Select( new String[]{ T_EMPRESAS }, + new String[]{ ID, DESIGNACAO_SOCIAL, "designacao_social_plain" }, + new Field( "designacao_social_plain" ).isLike( "%" + StringPlainer.convertString( pattern, false, false ) + "%" ).and( + new Field( INACTIVO ).isDifferent( "y" ) ), + new String[]{ "designacao_social_plain" }, null ); +// Select select = new Select( "SELECT e.id, e.designacao_social FROM empresas e ORDER BY lower( e.designacao_social );" ); + return executer.executeQuery( select ); + } + + public Virtual2DArray searchEstabelecimentos( String pattern ) throws Exception { +// Select select = new Select( "SELECT e.id, e.nome FROM estabelecimentos e WHERE empresa_id = " + SEARCH_EMPRESAS_ID +// + " ORDER BY lower( e.nome )"); + Select select = new Select( new String[]{ T_ESTABELECIMENTOS }, + new String[]{ ID, NOME, "nome_plain" }, + new Field( "nome_plain" ).isLike( "%" + StringPlainer.convertString( pattern, false, false ) + "%" ).and( + new Field( EMPRESA_ID ).isEqual( new Integer( SEARCH_EMPRESAS_ID ) ) ).and( + new Field( INACTIVO ).isDifferent( "y" ) ), + new String[]{ "nome_plain" }, null ); + return executer.executeQuery( select ); + } + + public Virtual2DArray searchTrabalhadores( String pattern ) throws Exception { +// Select select = +// new Select( "SELECT t.id, t.nome FROM trabalhadores t, estabelecimentos es " +// + " WHERE t.estabelecimento_id = es.id " +// + " AND es.empresa_id = " + SEARCH_EMPRESAS_ID + " ORDER BY lower(t.nome);" ); + Select select = new Select( new String[]{ T_TRABALHADORES, T_ESTABELECIMENTOS }, + new String[]{ T_TRABALHADORES + "." + ID, T_TRABALHADORES + "." + NOME }, + new Field( T_TRABALHADORES + ".nome_plain" ).isLike( "%" + StringPlainer.convertString( pattern, false, false ) + "%" ).and( + new Field( ESTABELECIMENTO_ID ).isEqual( new Field( T_ESTABELECIMENTOS + "." + ID ) ) ).and( + new Field( ESTABELECIMENTO_ID ).isEqual( new Integer( SEARCH_ESTABELECIMENTOS_ID ) ) ).and( + new Field( EMPRESA_ID ).isEqual( new Integer( SEARCH_EMPRESAS_ID ) ) ).and( + new Field( T_TRABALHADORES + "." + INACTIVO ).isDifferent( "y" ) ), + new String[]{ T_TRABALHADORES + ".nome_plain" }, null ); + return executer.executeQuery( select ); + } + + public Virtual2DArray searchExames( String pattern ) throws Exception { + Select select = new Select( "SELECT e.id, e.data FROM exames e " + + " WHERE e.trabalhador_id = " + SEARCH_TRABALHADORES_ID + + " ORDER BY e.data DESC;" ); + return executer.executeQuery( select ); + } + + public void showDetails(SearchDialog dialog, Object o) throws Exception { + } + + public Object [][]getAllMedicos() + throws Exception + { + Select select = new Select( new String[]{ T_MEDICOS }, + new String[]{ ID, NOME, NUMERO_CEDULA }, + null, new String[]{ NOME }, null ); + Virtual2DArray array = executer.executeQuery( select ); + return array.getObjects(); + } + +// public void savePDF( MetaObject exame ) +// throws Exception +// { +// if( exame == null ) +// { +// return; +// } +// DBKey key = exame.getPrimaryKeyValue(); +// DBField fields[] = EXAMES.getPrimaryKey(); +// Integer id = new Integer( ((Number)key.getFieldValue( fields[ 0 ] )).intValue() ); +// if( id == null ) +// { +// throw new Exception( "Error saving pdf: id is null" ); +// } +// byte []pdf = (byte[]) exame.getProperty( PDF ); +// BlobUpdate bUpdate = new BlobUpdate( T_EXAMES, PDF, pdf, new Field( ID ).isEqual( id ) ); +// executer.executeQuery( bUpdate ); +// } + + public Integer getLastExameIDForTrabalhador( Integer trabalhadorID ) + throws Exception + { + Select select = new Select( new String[]{ T_EXAMES }, + new String[]{ ID, DATA }, + new Field( TRABALHADOR_ID ).isEqual( trabalhadorID ), + new String[]{ DATA + " DESC", ID + " DESC" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 ) + { + return null; + } + return new Integer( ( (Number) array.get( 0, 0 ) ).intValue() ); + } + + public IDObject []getAllFichasForTrabalhador( Integer trabalhadorID ) + throws Exception + { + Select select = + new Select( new String[]{ T_EXAMES }, new String[]{ "MAX("+ID+")", DATA }, + new Field( TRABALHADOR_ID ).isEqual( trabalhadorID ).and( + new Field( INACTIVO ).isEqual( "n" ) ), + new String[]{ DATA + " DESC" }, new String[]{ DATA } ); + Virtual2DArray array = executer.executeQuery( select ); + IDObject exames[] = new IDObject[ array.columnLength() ]; + DateFormat df = DateFormat.getDateInstance( DateFormat.SHORT ); + for( int n = 0; n < exames.length; n++ ) + { + Date date = (Date)array.get( n, 1 ); + Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() ); + exames[ n ] = new MappableObject( id, date != null? df.format( date ): "" ); + } + return exames; + } + + public IDObject []getAllEstabelecimentosForEmpresa( Integer empresaID ) + throws Exception + { + Select select = new Select( new String[]{ T_ESTABELECIMENTOS }, + new String[]{ ID, NOME, "nome_plain" }, + new Field( EMPRESA_ID ).isEqual( empresaID ).and( + new Field( INACTIVO ).isDifferent( "y" ) ), + new String[]{ "nome_plain" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + IDObject objects[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < objects.length; n++ ) + { + Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() ); + String desc = (String)array.get( n, 1 ); + objects[ n ] = new MappableObject( id, desc ); + } + return objects; + } + + public IDObject []getAllTrabalhadoresForEmpresa( Integer empresaID ) + throws Exception + { + Select select = new Select( new String[]{ T_TRABALHADORES, T_ESTABELECIMENTOS }, + new String[]{ T_TRABALHADORES + "." + ID, + T_TRABALHADORES + "." + NOME, + T_TRABALHADORES + ".nome_plain" }, + new Field( T_ESTABELECIMENTOS + "." + EMPRESA_ID ).isEqual( empresaID ).and( + new Field( T_TRABALHADORES + "." + ESTABELECIMENTO_ID ).isEqual( + new Field( T_ESTABELECIMENTOS + "." + ID ) ) ), + new String[]{ T_TRABALHADORES + ".nome_plain" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + IDObject objects[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < objects.length; n++ ) + { + Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() ); + String desc = (String)array.get( n, 1 ); + objects[ n ] = new MappableObject( id, desc ); + } + return objects; + } + + public IDObject []getAllTrabalhadoresForEstabelecimento( Integer estabelecimentoID ) + throws Exception + { + Select select = new Select( new String[]{ T_TRABALHADORES }, + new String[]{ ID, NOME, "nome_plain" }, + new Field( ESTABELECIMENTO_ID ).isEqual( estabelecimentoID ).and( + new Field( INACTIVO ).isDifferent( "y" ) ), + new String[]{ "nome_plain" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + IDObject objects[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < objects.length; n++ ) + { + Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() ); + String desc = (String)array.get( n, 1 ); + objects[ n ] = new MappableObject( id, desc ); + } + return objects; + } + + public Integer getEstabelecimentoIDForTrabalhador( Integer trabalhadorID ) + throws Exception + { + Select select = new Select( new String[]{ T_TRABALHADORES }, + new String[]{ ESTABELECIMENTO_ID }, + new Field( ID ).isEqual( trabalhadorID ).and( + new Field( INACTIVO ).isDifferent( "y" ) ), + null, null ); + Virtual2DArray array = executer.executeQuery( select ); + Integer estabelecimentoID = null; + if( array != null && array.columnLength() > 0 ) + { + estabelecimentoID = ( Integer )array.get( 0, 0 ); + } + return estabelecimentoID; + } + + public Integer getEmpresaIDForEstabelecimento( Integer estabelecimentoID ) + throws Exception + { + Select select = new Select( new String[]{ T_ESTABELECIMENTOS }, + new String[]{ EMPRESA_ID }, + new Field( ID ).isEqual( estabelecimentoID ).and( + new Field( INACTIVO ).isDifferent( "y" ) ), + null, null ); + Virtual2DArray array = executer.executeQuery( select ); + Integer empresaID = null; + if( array != null && array.columnLength() > 0 ) + { + empresaID = ( Integer )array.get( 0, 0 ); + } + return empresaID; + } + + public Integer []getAvisosIDByTipoAndDate( Integer tipo, Date date ) + throws Exception + { + Select select = new Select( new String[]{ "avisos" }, new String[]{ "id", "data_evento" }, + new Field( "tipo" ).isEqual( tipo ).and( + new Field( "data_aviso" ).isLessOrEqual( date )), + new String[]{ "data_evento" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < ids.length; n++ ) + { + ids[ n ] = new Integer( ((Number)array.get( n, 0 )).intValue() ); + } + return ids; + } + + public Object [][]getAvisosTrabalhadorByDate( Date date ) + throws Exception + { + Select select = new Select( new String[]{ "avisos", "empresas", "estabelecimentos", "trabalhadores" }, + new String[]{ "avisos.id", "avisos.data_evento", "avisos.descricao", + "empresas.designacao_social", "estabelecimentos.nome", + "trabalhadores.nome", "data_aviso" }, + new Field( "tipo" ).isEqual( new Integer( AvisoConstants.TIPO_TRABALHADOR ) ).and( + new Field( "data_aviso" ).isLessOrEqual( date ) ).and( + new Field( "avisos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ).and( + new Field( "avisos.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "avisos.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ), + new String[]{ "data_evento" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + return array.getObjects(); + } + + public Object [][]getAvisosEstabelecimentoByDate( Date date ) + throws Exception + { + Select select = new Select( new String[]{ "avisos", "empresas", "estabelecimentos" }, + new String[]{ "avisos.id", "avisos.data_evento", "avisos.descricao", + "empresas.designacao_social", "estabelecimentos.nome", "data_aviso" }, + new Field( "tipo" ).isEqual( new Integer( AvisoConstants.TIPO_ESTABELECIMENTO ) ).and( + new Field( "data_aviso" ).isLessOrEqual( date ) ).and( + new Field( "avisos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ).and( + new Field( "avisos.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ), + new String[]{ "data_evento" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + return array.getObjects(); + } + + public Object [][]getAvisosEmpresaByDate( Date date ) + throws Exception + { + Select select = new Select( new String[]{ "avisos", "empresas" }, + new String[]{ "avisos.id", "avisos.data_evento", "avisos.descricao", + "empresas.designacao_social", "data_aviso" }, + new Field( "tipo" ).isEqual( new Integer( AvisoConstants.TIPO_EMPRESA ) ).and( + new Field( "data_aviso" ).isLessOrEqual( date ) ).and( + new Field( "avisos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ), + new String[]{ "data_evento" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + return array.getObjects(); + } + + public Integer getMarcacaoIDByTrabalhador( Integer trabalhadorID ) + throws Exception + { + Select realizadaSelect = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "MAX(data)" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "estado" ).isEqual( new Integer( 2 ) ) ).and( + new Field( "tipo" ).isEqual( new Integer( MarcacoesTrabalhadorData.TIPO_CONSULTA ) ) ) ); + Virtual2DArray realizadaArray = executer.executeQuery( realizadaSelect ); + Date realizada = (Date) realizadaArray.get( 0, 0 ); + Select select; + if( realizada == null ) + { + select = new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "MIN(id)" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "estado" ).isEqual( new Integer( 0 ) ) ).and( + new Field( "tipo" ).isEqual( new Integer( MarcacoesTrabalhadorData.TIPO_CONSULTA ) ) ) ); + } + else + { + select = new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "MIN(id)" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "estado" ).isEqual( new Integer( 0 ) ) ).and( + new Field( "data" ).isGreater( realizada ) ).and( + new Field( "tipo" ).isEqual( new Integer( MarcacoesTrabalhadorData.TIPO_CONSULTA ) ) ) ); + } + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return null; + } + return new Integer( ( ( Number ) array.get( 0, 0 ) ).intValue() ); + } + + public IDObject[] getAllEmpresasDeleted() + throws Exception + { + Select select = new Select( new String[]{ T_EMPRESAS }, + new String[]{ ID, DESIGNACAO_SOCIAL, "designacao_social_plain" }, + new Field( INACTIVO ).isEqual( "y" ), + new String[]{ "designacao_social_plain" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + IDObject empresas[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() ); + String designacao = ( String ) array.get( n, 1 ); + empresas[ n ] = new MappableObject( id, designacao ); + } + return empresas; + } + + public IDObject []getAllEstabelecimentosDeletedForEmpresa( Integer empresaID ) + throws Exception + { + Select select = new Select( new String[]{ T_ESTABELECIMENTOS }, + new String[]{ ID, NOME, "nome_plain" }, + new Field( EMPRESA_ID ).isEqual( empresaID ).and( + new Field( INACTIVO ).isEqual( "y" ) ), + new String[]{ "nome_plain" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + IDObject objects[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < objects.length; n++ ) + { + Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() ); + String desc = (String)array.get( n, 1 ); + objects[ n ] = new MappableObject( id, desc ); + } + return objects; + } + + public IDObject []getAllTrabalhadoresDeletedForEstabelecimento( Integer estabelecimentoID ) + throws Exception + { + Select select = new Select( new String[]{ T_TRABALHADORES }, + new String[]{ ID, NOME, "nome_plain" }, + new Field( ESTABELECIMENTO_ID ).isEqual( estabelecimentoID ).and( + new Field( INACTIVO ).isEqual( "y" ) ), + new String[]{ "nome_plain" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + IDObject objects[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < objects.length; n++ ) + { + Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() ); + String desc = (String)array.get( n, 1 ); + objects[ n ] = new MappableObject( id, desc ); + } + return objects; + } + + public Object[] getDadosUltimaMarcacao( Integer trabalhadorID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "MAX( data )" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "realizada" ).isEqual( "y" ).or( + new Field( "estado" ).isEqual( new Integer( 2 ) ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return new Object[]{ null, null }; + } + Date data = ( Date ) array.get( 0, 0 ); + select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "motivo", "id" }, + new Field( "data" ).isEqual( data ).and( + new Field( "trabalhador_id" ).isEqual( trabalhadorID ) ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "realizada" ).isEqual( "y" ).or( + new Field( "estado" ).isEqual( new Integer( 2 ) ) ) ), + new String[]{ "id" }, null ); + array = executer.executeQuery( select ); + Integer tipo = ( Integer ) array.get( 0, 0 ); + if( tipo.intValue() == 5 ) + { + tipo = new Integer( 2 ); + } + return new Object[]{ data, tipo }; + } + + public void setMedicoForEstabelecimento( Integer estabelecimentoID, Integer medicoID ) + throws Exception + { + Integer medicoAntigo = ( Integer ) medicosEstabelecimentosHash.get( estabelecimentoID ); + if( !medicoID.equals( medicoAntigo ) ) + { + Update update = + new Update( "estabelecimentos", + new Assignment[]{ + new Assignment( new Field( "medico_id" ), medicoID ) }, + new Field( "id" ).isEqual( estabelecimentoID ) ); + executer.executeQuery( update ); + medicosEstabelecimentosHash.put( estabelecimentoID, medicoID ); + } + } + + public Integer getMedicoForEstabelecimento( Integer estabelecimentoID ) + throws Exception + { + if( !medicosEstabelecimentosHash.containsKey( estabelecimentoID ) ) + { + Select select = + new Select( new String[]{ "estabelecimentos" }, + new String[]{ "medico_id" }, + new Field( "id" ).isEqual( estabelecimentoID ) ); + Virtual2DArray array = executer.executeQuery( select ); + Integer medicoID = ( Integer ) array.get( 0, 0 ); + if( medicoID == null ) + { + medicoID = new Integer( -1 ); + } + medicosEstabelecimentosHash.put( estabelecimentoID, medicoID ); + } + return ( Integer ) medicosEstabelecimentosHash.get( estabelecimentoID ); + } + + public Long countTrabalhadoresActivosForEmpresa( Integer empresaID ) + { + Long result = 0L; + try + { + Select2 query = new Select2( new String[]{ "trabalhadores", "estabelecimentos", "empresas" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field("estabelecimentos.id").isEqual(new Field("trabalhadores.estabelecimento_id")), + new Field("empresas.id").isEqual( new Field("estabelecimentos.empresa_id") ) }, + new String[]{"count(trabalhadores.id)" }, + new Field("empresas.id").isEqual( empresaID ). + and( new Field("trabalhadores.inactivo").isEqual( "n" ) ). + and( new Field("trabalhadores.data_demissao").isEqual( null ) ). + and( new Field("estabelecimentos.inactivo").isEqual( "n" ) ), + null, null, null, null ); + Virtual2DArray returned = executer.executeQuery( query ); + if( returned.columnLength() > 0 ) + { + result = (Long) returned.get( 0, 0 ); + } + } + catch (DBException e) { + e.printStackTrace(); + } + return result; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/Main.java b/branches/SIPRP/SIPRPSoft/src/siprp/Main.java new file mode 100644 index 00000000..fb832592 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/Main.java @@ -0,0 +1,319 @@ +package siprp; + +import static siprp.ProcessoConstants.ESTADO_PROCESSO_BY_CODE; +import static siprp.ProcessoConstants.PROCESSO_ABERTO_CODE; +import static siprp.ProcessoConstants.PROCESSO_ABERTO_DESCRIPTION; +import static siprp.ProcessoConstants.PROCESSO_CANCELADO_CODE; +import static siprp.ProcessoConstants.PROCESSO_CANCELADO_DESCRIPTION; +import static siprp.ProcessoConstants.PROCESSO_FECHADO_CODE; +import static siprp.ProcessoConstants.PROCESSO_FECHADO_DESCRIPTION; + +import java.awt.Color; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.sql.SQLException; +import java.util.Date; + +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.plaf.ColorUIResource; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.MutableTreeNode; + +import org.apache.cayenne.access.DataDomain; +import org.apache.cayenne.access.DataNode; +import org.apache.cayenne.conf.DefaultConfiguration; +import org.apache.cayenne.conn.DriverDataSource; +import org.apache.cayenne.dba.AutoAdapter; +import org.apache.cayenne.map.DataMap; + +import siprp.clientes.AvisosPanel; +import siprp.companydataloaders.SIPRPDataLoader; +import siprp.companydataloaders.SIPRPPropertiesLoader; +import siprp.lembretes.LembretesDemon; +import siprp.update.UpdateList; + +import com.evolute.module.updater.Updater; +import com.evolute.properties.EvoDefaultPropertiesLoader; +import com.evolute.properties.PropertiesException; +import com.evolute.utils.Singleton; +import com.evolute.utils.db.DBException; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.JDBCManager; +import com.evolute.utils.db.keyretrievers.JDBCAutoKeyRetriever; +import com.evolute.utils.error.ErrorLogger; +import com.evolute.utils.jdbc.DBStatementExecuter; +import com.evolute.utils.jdbc.StatementExecuterFactory; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.SQLQuery; +import com.evolute.utils.strings.UnicodeChecker; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.window.LoginWindow; + +public class Main implements com.evolute.utils.ui.window.Connector +{ + public final static String SHST_VERSION = "11.10.0"; + + private static String dbase; + private SIPRPTracker siprpTracker; + private static LoginWindow loginWindow; + + private static AvisosPanel avisos = null; + public static File fopConfigFile; + + static + { + + ESTADO_PROCESSO_BY_CODE.put( PROCESSO_ABERTO_CODE, PROCESSO_ABERTO_DESCRIPTION ); + ESTADO_PROCESSO_BY_CODE.put( PROCESSO_FECHADO_CODE, PROCESSO_FECHADO_DESCRIPTION ); + ESTADO_PROCESSO_BY_CODE.put( PROCESSO_CANCELADO_CODE, PROCESSO_CANCELADO_DESCRIPTION ); + } + + public static void main( String args[] ) + throws Exception + { + UIManager.put( "TextField.inactiveForeground", ColorUIResource.BLACK ); + UIManager.put( "TextField.foreground", ColorUIResource.RED.darker() ); + + UIManager.put( "TextArea.inactiveForeground", ColorUIResource.BLACK ); + UIManager.put( "TextArea.foreground", ColorUIResource.RED.darker() ); + + UIManager.put( "ComboBox.disabledForeground", ColorUIResource.BLACK ); + UIManager.put( "ComboBox.foreground", ColorUIResource.RED.darker() ); + + UIManager.put( "FormattedTextField.inactiveForeground", ColorUIResource.BLACK ); + UIManager.put( "FormattedTextField.foreground", ColorUIResource.RED.darker() ); + + SIPRPPropertiesLoader.getInstance().load(); + +// Singleton.setInstance( SingletonConstants.COMPANY_NAME, "Centro Cl\u00ednico Avenida" ); +// Singleton.setInstance( SingletonConstants.COMPANY_LOGO, "logo_evo.jpg" ); +// Singleton.setInstance( SingletonConstants.WEB_AWARE, Boolean.FALSE ); +// Singleton.setInstance( SingletonConstants.DB_NAME, "shst" ); + +// Singleton.setInstance( SingletonConstants.COMPANY_NAME, "SIPRP - Sociedade Ib\u00e9rica de Preven\u00e7\u00e3o de Riscos Profissionais" ); +// Singleton.setInstance( SingletonConstants.COMPANY_LOGO, "logo_combo.jpg" ); +// Singleton.setInstance( SingletonConstants.WEB_AWARE, Boolean.TRUE ); +// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp" ); + new SIPRPDataLoader().load(); +// new ClinicaAvenidaDataLoader().load(); +// new IBookDataLoader().load(); + + dbase = (String)Singleton.getInstance( SingletonConstants.LOCAL_DB_NAME ); +// dbase = "siprp_local3"; +/* Calendar cal = Calendar.getInstance(); + cal.set( 2004, 06, 14 ); + if( cal.before( Calendar.getInstance() ) ) + { + com.evolute.utils.ui.DialogException.showException( new RuntimeException( "Unknown error ocurred." ) ); + } + else + { +*/ Insert.setDefaultKeyRetriever( JDBCAutoKeyRetriever.DEFAULT ); + String server = System.getProperty( "server.address" ); +// if( server == null ) +// { +// server = "ws_fpalma"; +// } +// +// String user = "root"; +// String passwd = "UNIXLuvsU"; +// +// DBManager dbm = new JDBCManager( "jdbc:mysql://" + server + "/" + dbase, +// user, passwd , 10, 8, 8, null ); + + UnicodeChecker.setUseDoubleSlash( true ); +// Singleton.setInstance( Singleton.DEFAULT_DBMANAGER, dbm ); + +// StatementExecuterFactory.initialize( +// new DBStatementExecuter( dbm.getSharedExecuter() ) ); +// } +// FichaWindow window = new FichaWindow(); +/* window.setLogo( new ImageIcon( + new Main().getClass().getClassLoader().getResource( "logo/logo_w400.png" ) + ).getImage() );*/ +// window.show(); + avisos = new AvisosPanel(); + String logoFileName = ( String ) Singleton.getInstance( SingletonConstants.COMPANY_LOGO ); + loginWindow = new LoginWindow( new Main(), /*"logo"+File.separator +*/ logoFileName,//"logo"+File.separator + "logo_w400.jpg", + new String[] { (String) Singleton.getInstance( SingletonConstants.SOFTWARE_NAME ) }, + new String[] { "Vers\u00E3o " + SHST_VERSION, "(EVOLUTE 2004-2009)" }, "", + (String)Singleton.getInstance( SingletonConstants.LOCAL_USER ), + (String)Singleton.getInstance( SingletonConstants.LOCAL_PASSWORD ), avisos, false ); + loginWindow.setTitle( (String) Singleton.getInstance( SingletonConstants.SOFTWARE_NAME ) ); + JPanel left = loginWindow.getLeftPanel(); + left.setBackground( Color.white ); +// GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); + loginWindow.setExtendedState(loginWindow.getExtendedState() | LoginWindow.MAXIMIZED_BOTH); + loginWindow.setVisible( true ); + SwingUtilities.invokeLater( new Runnable(){ + public void run() + { + loginWindow.expandAll(); + } + } ); + + fopConfigFile = loadFopConfigFile(); + + } + + + private static File loadFopConfigFile() { + + try { + InputStream is = ClassLoader.getSystemClassLoader() + .getResourceAsStream("siprp/util/fop/fop.xconf"); + if (is != null) { + File tempFile = File.createTempFile("fop", ".xconf"); + FileOutputStream fos = new FileOutputStream(tempFile); + byte[] buf = new byte[256]; + int read = 0; + while ((read = is.read(buf)) > 0) { + fos.write(buf, 0, read); + } + return tempFile; + } + return null; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + public boolean connect( String user, String passwd ) + { + String url = null; + try + { + // run initialization SQL + SQLQuery initQuery[] = new SQLQuery[] {}; +// String server = System.getProperty( "server.address" ); + String server = null; + if( server == null ) + { + //server = "192.168.1.191"; + server = (String)Singleton.getInstance( SingletonConstants.LOCAL_URL ); +// server = "storage"; +// server = "ws_fpalma"; + } + String prefix = (String)Singleton.getInstance( SingletonConstants.LOCAL_URL_PREFIX ); + url = prefix + server + "/" + dbase; +// System.out.println( "url: " + url + " user: " + user + " ps: " + passwd ); + DBManager dbm = new JDBCManager( url, user, passwd , 10, 8, 8, null ); +// UnicodeChecker.setUseDoubleSlash( true ); + Singleton.setInstance( Singleton.DEFAULT_DBMANAGER, dbm ); + + StatementExecuterFactory.initialize( + new DBStatementExecuter( dbm.getSharedExecuter(this) ) ); + + Updater.getInstance().executeUpdate(true, true, UpdateList.UPDATE_LIST); + + new ORMInitializer().initializeORM( url, user, passwd ); + + Singleton.setInstance( Singleton.TODAY, new Date() ); + initializeCayenne( url, user, passwd); + +//cleanData( dbm.getSharedExecuter() ); +//msg( dbm.getSharedExecuter() ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "N\u00E3o foi poss\u00EDvel estabelecer" + + " a liga\u00E7\u00E3o \u00E0 base de dados.\n(" +url+ ")", false ); + return false; + } + Singleton.setInstance( Singleton.USERNAME, user ); + try + { + ErrorLogger.initializeLogger( new SHSTLogger() ); + } + catch( Exception ex ) + { + ex.printStackTrace( System.out ); + } + //Singleton.setInstance( Singleton.USERNAME, user ); + siprpTracker = new SIPRPTracker( avisos ); + + avisos.refresh(); +// new Exception().printStackTrace(); +// try +// { +// Thread.sleep( 1000 ); +// } +// catch( Exception ex ){} +// new Exception().printStackTrace(); + LembretesDemon.go(); + return true; + } + +// public static void reconnectJDO() +// { +// PersistenceManagerFactory pmf = ( PersistenceManagerFactory ) Singleton.getInstance( Singleton.DEFAULT_PERSISTENCE_MANAGER_FACTORY ); +// PersistenceManager pm = pmf.getPersistenceManager(); +// Singleton.setInstance( SingletonConstants.PERSISTENCE_MANAGER, pm ); +// com.evolute.utils.jdo.JDOObject.setPersistentManager( pm ); +// } + + public boolean disconnect() + { + if( siprpTracker.quit() ) + { + siprpTracker = null; + try + { + ( ( DBManager )Singleton.getInstance( + Singleton.DEFAULT_DBMANAGER ) ).close(); + Singleton.clear(); + } + catch( DBException ex ) + { + DialogException.showException( ex ); + } + return true; + } + return false; + } + + public void executeAction( DefaultMutableTreeNode node ) + { + try + { + siprpTracker.openWindow( ( String )node.getUserObject() ); + } + catch( Exception ex ) + { + DialogException.showException( ex ); + } + + } + + public void exit() + { + if( siprpTracker == null || siprpTracker.quit() ) + { + System.exit( 0 ); + } + } + + public MutableTreeNode getTree() + { + return siprpTracker.getRoot(); + } + + public void initializeCayenne(String url, String user, String password) throws SQLException + { + DataDomain domain = DefaultConfiguration.getSharedConfiguration().getDomain(); + DataMap map = domain.getMap( "SIPRPMap" ); + DriverDataSource dataSource = new DriverDataSource((String) Singleton.getInstance( SingletonConstants.LOCAL_DRIVER_NAME ), url, user, password ); + DataNode node = new DataNode("SIPRPNode"); + node.setDataSource( dataSource ); + node.setAdapter( new AutoAdapter(dataSource) ); + node.addDataMap( map ); + node.setEntityResolver( domain.getEntityResolver() ); + domain.reset(); + domain.addNode( node ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/MedicinaConstants.java b/branches/SIPRP/SIPRPSoft/src/siprp/MedicinaConstants.java new file mode 100755 index 00000000..4b0baf69 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/MedicinaConstants.java @@ -0,0 +1,82 @@ +/* + * MedicinaConstants.java + * + * Created on 6 de Julho de 2006, 15:22 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp; + +import com.evolute.utils.Singleton; + +/** + * + * @author fpalma + */ +public interface MedicinaConstants +{ + public static final int MOTIVO_ADMISSAO = 1; + public static final Integer MOTIVO_ADMISSAO_INTEGER = new Integer( MOTIVO_ADMISSAO ); + public static final String MOTIVO_ADMISSAO_STR = "Admiss\u00e3o"; + public static final int MOTIVO_PERIODICO = 2; + public static final Integer MOTIVO_PERIODICO_INTEGER = new Integer( MOTIVO_PERIODICO ); + public static final String MOTIVO_PERIODICO_STR = "Peri\u00f3dico"; + public static final int MOTIVO_OCASIONAL = 3; + public static final Integer MOTIVO_OCASIONAL_INTEGER = new Integer( MOTIVO_OCASIONAL ); + public static final String MOTIVO_OCASIONAL_STR = "Ocasional"; + public static final int MOTIVO_PERIODICO_INICIAL = 5; + public static final Integer MOTIVO_PERIODICO_INICIAL_INTEGER = new Integer( MOTIVO_PERIODICO_INICIAL ); + public static final String MOTIVO_PERIODICO_INICIAL_STR = "Peri\u00f3dico inicial"; + + public static final int SUB_MOTIVO_APOS_DOENCA = 1; + public static final Integer SUB_MOTIVO_APOS_DOENCA_INTEGER = new Integer( SUB_MOTIVO_APOS_DOENCA ); + public static final String SUB_MOTIVO_APOS_DOENCA_STR = "Ap\u00f3s doen\u00e7a"; + public static final int SUB_MOTIVO_APOS_ACIDENTE = 2; + public static final Integer SUB_MOTIVO_APOS_ACIDENTE_INTEGER = new Integer( SUB_MOTIVO_APOS_ACIDENTE ); + public static final String SUB_MOTIVO_APOS_ACIDENTE_STR = "Ap\u00f3s acidente"; + public static final int SUB_MOTIVO_PEDIDO_TRABALHADOR = 3; + public static final Integer SUB_MOTIVO_PEDIDO_TRABALHADOR_INTEGER = new Integer( SUB_MOTIVO_PEDIDO_TRABALHADOR ); + public static final String SUB_MOTIVO_PEDIDO_TRABALHADOR_STR = "A pedido do trabalhador"; + public static final int SUB_MOTIVO_PEDIDO_SERVICO = 4; + public static final Integer SUB_MOTIVO_PEDIDO_SERVICO_INTEGER = new Integer( SUB_MOTIVO_PEDIDO_SERVICO ); + public static final String SUB_MOTIVO_PEDIDO_SERVICO_STR = "A pedido do servi\u00e7o"; + public static final int SUB_MOTIVO_MUDANCA_FUNCAO = 5; + public static final Integer SUB_MOTIVO_MUDANCA_FUNCAO_INTEGER = new Integer( SUB_MOTIVO_MUDANCA_FUNCAO ); + public static final String SUB_MOTIVO_MUDANCA_FUNCAO_STR = "Por mudan\u00e7a de fun\u00e7\u00e3o"; + public static final int SUB_MOTIVO_ALTERACAO_CONDICOES = 6; + public static final Integer SUB_MOTIVO_ALTERACAO_CONDICOES_INTEGER = new Integer( SUB_MOTIVO_ALTERACAO_CONDICOES ); + public static final String SUB_MOTIVO_ALTERACAO_CONDICOES_STR = "Por altera\u00e7\u00e3o das condi\u00e7\u00f5es de trabalho"; + public static final int SUB_MOTIVO_OUTRO = 10; + public static final Integer SUB_MOTIVO_OUTRO_INTEGER = new Integer( SUB_MOTIVO_OUTRO ); + public static final String SUB_MOTIVO_OUTRO_STR = "Outro"; + + public static final int ESTADO_POR_REALIZAR = 0; + public static final int ESTADO_PARCIALMENTE_REALIZADO = 1; + public static final int ESTADO_REALIZADO = 2; + public static final int ESTADO_DESMARCADO_TRABALHADOR = 3; + public static final int ESTADO_DESMARCADO_EMPRESA = 4; + public static final int ESTADO_FALTOU = 5; + public static final int ESTADO_ANULADO = 6; + public static final int ESTADO_POR_MARCAR = 7; + + public static final String ESTADOS_CONSULTA_STR[] = + new String[]{ "Por Realizar", "Parcialmente Realizada", "Realizada", + "Desmarcada pelo Trabalhador", "Desmarcada pela " + Singleton.getInstance( SingletonConstants.COMPANY_ACRONYM ), + "Trabalhador Faltou", "Anulada", "Por Marcar" }; + + public static final String ESTADOS_EXAME_STR[] = + new String[]{ "Por Realizar", "Parcialmente Realizados", "Realizados", + "Desmarcados pelo Trabalhador", "Desmarcados pela " + Singleton.getInstance( SingletonConstants.COMPANY_ACRONYM ), + "Trabalhador Faltou", "Anulado", "Por Marcar" }; + + public static final String ESTADOS_STR[][] = + new String[][]{ ESTADOS_EXAME_STR, ESTADOS_CONSULTA_STR }; + + public static final String LEMBRETE_DESMARCOU_SIPRP_STRING = "SIPRP Desmarcou"; + public static final String LEMBRETE_DESMARCOU_TRABALHADOR_STRING = "Trabalhador Desmarcou"; + public static final String LEMBRETE_FALTOU_TRABALHADOR_STRING = "Trabalhador Faltou"; + public static final String LEMBRETE_RENOVACAO_FICHA_APTIDAO_STRING = "Marcar novos Exames"; + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ORMInitializer.java b/branches/SIPRP/SIPRPSoft/src/siprp/ORMInitializer.java new file mode 100644 index 00000000..8bae9da6 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ORMInitializer.java @@ -0,0 +1,82 @@ +package siprp; + +import com.evolute.entity.ProviderInterface; +import com.evolute.entity.ProviderRegistry; +import com.evolute.entity.evo.EvoDataProviderFactory; +import com.evolute.entity.utils.ConnectionIdentity; +import com.evolute.utils.Singleton; +import com.evolute.utils.db.keyretrievers.PostgresqlAutoKeyRetriever; +import com.evolute.utils.sql.Insert; + +public class ORMInitializer +{ + + public void initializeORM(String url, String user, String password) + { +// Date d = new Date(); +// System.out.println( "INIT: " + d ); +// +// +// Properties jpoxProps; +// jpoxProps = System.getProperties();//new Properties(); + // Set the PersistenceManagerFactoryClass to the TJDO class. +// jpoxProps.setProperty( "javax.jdo.PersistenceManagerFactoryClass", +// "org.jpox.PersistenceManagerFactoryImpl" ); + // Set the JDBC driver name. +// jpoxProps.setProperty( "javax.jdo.option.ConnectionDriverName", (String) Singleton.getInstance( SingletonConstants.LOCAL_DRIVER_NAME ) ); +// jpoxProps.setProperty( "org.jpox.identifier.fullyQualifiedNames", "false" ); + // props.setProperty("com.triactive.jdo.transactionIsolation", + // "read-uncommitted" ); + + // Set the connection URL +// jpoxProps.setProperty( "javax.jdo.option.ConnectionURL", "jdbc:informix-sqli://192.168.0.3:6666" +// + "/apdp_db:informixserver=server" ); +// jpoxProps.setProperty( "javax.jdo.option.ConnectionURL", url ); +// jpoxProps.setProperty( "javax.jdo.option.ConnectionUserName", user ); +// jpoxProps.setProperty( "javax.jdo.option.ConnectionPassword", password ); +// jpoxProps.setProperty( "javax.jdo.option.IgnoreCache", "true" ); +// jpoxProps.setProperty( "javax.jdo.option.NonTransactionalRead", "true" ); +// jpoxProps.setProperty( "javax.jdo.option.RetainValues", "true" ); +// +// jpoxProps.setProperty( "org.jpox.autoCreateTables", "false" ); +// jpoxProps.setProperty( "org.jpox.autoCreateSchema", "false" ); +// jpoxProps.setProperty( "org.jpox.autoCreateConstraints", "false" ); +// jpoxProps.setProperty( "org.jpox.validateTables", "false" ); +// jpoxProps.setProperty( "org.jpox.validateConstraints", "false" ); +// jpoxProps.setProperty( "org.jpox.autoStartMechanismMode", "Ignored" ); +// jpoxProps.setProperty( "org.jpox.autoStartMechanism", "None" ); + +// jpoxProps.setProperty( "javax.jdo.option.RetainValues", "true" ); +// jpoxProps.setProperty( "javax.jdo.option.Optimistic", "true" ); + +// jpoxProps.setProperty( "org.jpox.identifier.defaultSchemaName", "informix" ); +// jpoxProps.setProperty( "org.jpox.rdbms.CheckExistTablesOrViews", "false" ); +// +// System.setProperty( "org.jpox.catalogName", (String)Singleton.getInstance( SingletonConstants.LOCAL_DB_NAME ) ); +// System.setProperty( "org.jpox.schemaName", "" ); + +// PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory( jpoxProps ); +//// pmf.setOptimistic( true ); +//System.out.print( "Loading PM: " + new Date() ); +// // ( ( PersistenceManagerFactoryImpl )pmf ).setTransactionIsolation( Connection.TRANSACTION_READ_UNCOMMITTED ); +// // Retrieve a PersistenceManager from the PersistenceManagerFactory. +// PersistenceManager pm = pmf.getPersistenceManager(); +// JDOObject.setPersistentManager( pm ); +// Singleton.setInstance( Singleton.DEFAULT_PERSISTENCE_MANAGER_FACTORY, pmf ); +// Singleton.setInstance( SingletonConstants.PERSISTENCE_MANAGER, pm ); +// JDOProvider jdoProvider = new JDOProvider( jpoxProps ); +// Singleton.setInstance( Singleton.DEFAULT_JDO_PROVIDER, jdoProvider ); +//System.out.println( "PM done " + new Date() + "JDO: " + jdoProvider ); + + Insert.setDefaultKeyRetriever( PostgresqlAutoKeyRetriever.RETRIEVER ); + ProviderRegistry.registerDefaultProviderFactory( new EvoDataProviderFactory() ); + ConnectionIdentity conn = new ConnectionIdentity( url, user ); + conn.setPassword( password ); + ProviderRegistry.registerDefaultConnection( conn ); + ProviderInterface provider = ProviderRegistry.getDefaultProvider( conn ); + Singleton.setInstance( Singleton.DEFAULT_OBJECT_PROVIDER, provider ); + Singleton.setInstance( Singleton.DEFAULT_JDO_PROVIDER, provider ); + + + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ProcessoConstants.java b/branches/SIPRP/SIPRPSoft/src/siprp/ProcessoConstants.java new file mode 100644 index 00000000..072060f7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ProcessoConstants.java @@ -0,0 +1,42 @@ +/* + * ProcessoConstants.java + * + * Created on May 14, 2007, 10:08 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp; + +import java.util.HashMap; + +/** + * + * @author fpalma + */ +public interface ProcessoConstants +{ + public static final int TIPO_ECDS = 0; + public static final int TIPO_CONSULTA = 1; + public static final int TIPO_FICHA_APTIDAO = 2; + + public static final String PROCESSO_ABERTO_CODE = "a"; + public static final String PROCESSO_FECHADO_CODE = "f"; + public static final String PROCESSO_CANCELADO_CODE = "c"; + + public static final String PROCESSO_ABERTO_DESCRIPTION = "Aberto"; + public static final String PROCESSO_FECHADO_DESCRIPTION = "Fechado"; + public static final String PROCESSO_CANCELADO_DESCRIPTION = "Cancelado"; + public static final String PROCESSO_POR_ABRIR_DESCRIPTION = "Por Abrir"; + + public static final String ECDS_ICON_PATH = "siprp/medicina/processo/icons/ecds.png"; + public static final String CONSULTA_ICON_PATH = "siprp/medicina/processo/icons/consulta.png"; + public static final String FICHA_APTIDAO_ICON_PATH = "siprp/medicina/processo/icons/fichaaptidao.png"; + public static final String FECHAR_ICON_PATH = "siprp/medicina/processo/icons/lock.png"; + public static final String DATA_ICON_PATH = "siprp/medicina/processo/estrutura/icons/data.png"; + + public static final HashMap ESTADO_PROCESSO_BY_CODE = + new HashMap(); + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/SHSTLogger.java b/branches/SIPRP/SIPRPSoft/src/siprp/SHSTLogger.java new file mode 100644 index 00000000..4b7f67a3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/SHSTLogger.java @@ -0,0 +1,135 @@ +/* + * SIPRPLogger.java + * + * Created on 15 de Marco de 2005, 15:31 + */ + +package siprp; + +import com.evolute.utils.Singleton; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.db.SQLRetriever; +import com.evolute.utils.error.Logger; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Insert; + +/** + * + * @author lflores + + * MySQL +CREATE TABLE errors +( + id INT NOT NULL AUTO_INCREMENT, + PRIMARY KEY( id ), + date TIMESTAMP NOT NULL DEFAULT 'now()', + type VARCHAR(20), + environment VARCHAR( 255 ), + description TEXT +); + * + *PostgreSQL +CREATE TABLE errors +( + id SERIAL, + PRIMARY KEY( id ), + date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + type VARCHAR(20), + environment VARCHAR( 255 ), + description VARCHAR( 256000 ) +) + + */ +public class SHSTLogger implements Logger +{ + private final String java = System.getProperty( "java.version" ) + + "-" + System.getProperty( "java.vm.version" ); + private final String os = System.getProperty( "os.name" ) + " - " + + System.getProperty( "os.version" ); + private final String user = ( String )Singleton.getInstance( Singleton.USERNAME ); + private final String ENV = "Java: " + java + " \nOS: " + os + " \nUser: " + user + + "\n Software: " + ( String )Singleton.getInstance( SingletonConstants.SOFTWARE_NAME ) + + "\n Version: " + Main.SHST_VERSION; + private final Executer executer; + + /** Creates a new instance of SIPRPLogger */ + public SHSTLogger() + throws Exception + { + DBManager dbm = ( DBManager )Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + executer = dbm.getExclusiveExecuter( this ); + } + + @Override + public void log( String str ) + { + String mem = "(" + Runtime.getRuntime().freeMemory() + "/" + + Runtime.getRuntime().maxMemory() + ")"; + if( str.length() > 254000 ) + { + str = str.substring( 0, 254000 ) + " Message too big (" + str.length() + "), truncated."; + } + try + { + executer.executeQuery( new Insert( "errors", new Assignment[] { + new Assignment( new Field( "type" ), "LOG" ), + new Assignment( new Field( "environment" ), ENV + mem ), + new Assignment( new Field( "description" ), str ) + } ), null ); + } + catch( Exception ex ) + { + logException( ex ); + } + } + + @Override + public void logException( Throwable ex ) + { + StackTraceElement ste[] = ex.getStackTrace(); + StringBuffer sb = new StringBuffer(); + for( int i = 0; i < ste.length; ++i ) + { + sb.append( ste[ i ].toString() ); + } + String str = "Exception Message: " + ex.getMessage() + "\nStack Trace: " + sb.toString(); + String mem = "(" + Runtime.getRuntime().freeMemory() + "/" + + Runtime.getRuntime().maxMemory() + ")"; + if( str.length() > 254000 ) + { + str = str.substring( 0, 254000 ) + " Message too big (" + str.length() + "), truncated."; + } + try + { + executer.executeQuery( new Insert( "errors", new Assignment[] { + new Assignment( new Field( "type" ), "ERROR" ), + new Assignment( new Field( "environment" ), ENV + mem ), + new Assignment( new Field( "description" ), str ) + } ), new SQLRetriever() ); + } + catch( Exception ex1 ) + { + ex.printStackTrace(); + } + } + + @Override + public void close() { + + } + + @Override + public void log(String str, java.util.logging.Level level) { + // TODO Auto-generated method stub + + } + + @Override + public void logException(Throwable ex, java.util.logging.Level level) { + // TODO Auto-generated method stub + + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/SIPRPSpellChecker.java b/branches/SIPRP/SIPRPSoft/src/siprp/SIPRPSpellChecker.java new file mode 100644 index 00000000..c52b7e12 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/SIPRPSpellChecker.java @@ -0,0 +1,35 @@ +package siprp; + +import javax.swing.text.JTextComponent; + +import com.evolute.modules.spellchecker.EvoSpellChecker; +import com.evolute.modules.spellchecker.EvoSpellChecker.Dictionary; + + +public class SIPRPSpellChecker +{ + + private static SIPRPSpellChecker instance = null; + + private final EvoSpellChecker spellChecker; + + private SIPRPSpellChecker() + { + this.spellChecker = new EvoSpellChecker( Dictionary.PT_PT ); + } + + public static SIPRPSpellChecker getInstance() + { + if( instance == null ) + { + instance = new SIPRPSpellChecker(); + } + return instance; + } + + public void attachSpellCheckToComponent( JTextComponent fieldText ) + { + spellChecker.attachSpellCheckToComponent( fieldText ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/SIPRPTracker.java b/branches/SIPRP/SIPRPSoft/src/siprp/SIPRPTracker.java new file mode 100644 index 00000000..c07ed10c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/SIPRPTracker.java @@ -0,0 +1,365 @@ +/* + * SIPRPTracker.java + * + * Created on 18 de Maio de 2004, 19:46 + */ + +package siprp; + +import java.util.Hashtable; + +import javax.swing.tree.DefaultMutableTreeNode; + +import shst.SHSTTrackerInterface; +import shst.higiene.marcacoes.MarcacoesHigieneInterface; +import shst.medicina.MedicinaWindowInterface; +import shst.medicina.multi.MultiMarcacoesWindow; +import siprp.clientes.AvisosPanel; +import siprp.estatistica.EstatisticaWindow; +import siprp.ficha.FichaWindow; +import siprp.higiene.gestao.GestaoRelatorioWindow; +import siprp.higiene.mapa.MapaHigieneWindow; +import siprp.higiene.marcacoes.MarcacoesHigieneWindow; +import siprp.higiene.relatorio.RelatorioHigieneSegurancaWindow; +import siprp.impressaofichas.ImpressaoFichasWindow; +import siprp.lembretes.LembretesWindow; +import siprp.medicina.MedicinaWindow; +import siprp.medicina.exames.ui.RecepcaoExamesWindow; +import siprp.medicina.locais_analise.EnviarAnalisesWindow; +import siprp.medicina.locais_realizacao.LocaisRealizacaoWindow; +import siprp.medicina.presencas.RegistarPresencasWindow; +import siprp.medicina.prestadores.PrestadoresWindow; +import siprp.medicina.processo.ui.MedicinaProcessoWindow; +import siprp.pesquisas.PesquisasWindow; + +import com.evolute.utils.Singleton; +import com.evolute.utils.tracker.TrackableWindow; +import com.evolute.utils.tracker.WindowCreator; +import com.evolute.utils.tracker.WindowTracker; +/** + * + * @author fpalma + */ +public class SIPRPTracker extends WindowTracker implements SHSTTrackerInterface +{ + public static final String FICHA_APTIDAO = "Ficha de Aptid\u00e3o"; + public static final String CRIACAO_FICHA_APTIDAO = "Cria\u00e7\u00e3o de Fichas de Aptid\u00e3o"; + public static final String GESTAO_CLIENTES = "Gest\u00e3o de Clientes"; + public static final String MEDICINA = "Medicina"; + public static final String MEDICINA_MARCACOES = "Marca\u00e7\u00f5es"; + public static final String MEDICINA_MULTI_MARCACOES = MultiMarcacoesWindow.TITLE; + public static final String MEDICINA_LOCAIS = "Locais de Realiza\u00e7\u00e3o"; + public static final String MEDICINA_ENVIO_ANALISES= EnviarAnalisesWindow.TITLE; + public static final String MEDICINA_PRESENCAS = "Presen\u00e7as"; + public static final String HIGIENE_SEGURANCA = "Higiene e Seguran\u00e7a"; + public static final String RELATORIO_ANUAL = "Relat\u00f3rio Anual"; + public static final String LISTAGENS = "Listagens"; + + private final AvisosPanel avisos; + private shst.clientes.ClientesWindow clientesWindow; + private MedicinaWindowInterface medicinaWindow; + private MultiMarcacoesWindow multiMarcacoesWindow; + private MedicinaProcessoWindow medicinaProcessoWindow; + private MarcacoesHigieneInterface higieneWindow; + + /** Creates a new instance of SIPRPTracker */ + public SIPRPTracker( AvisosPanel avisosP ) + { + Singleton.setInstance( SingletonConstants.SIPRP_TRACKER, this ); + this.avisos = avisosP; + avisos.setTracker( this ); + Hashtable creators = new Hashtable(); + DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode( + Singleton.getInstance( SingletonConstants.COMPANY_ACRONYM ) ); + + boolean hasFicha = ( (Boolean)Singleton.getInstance( SingletonConstants.MODULE_FICHA ) ).booleanValue(); + boolean hasGestao = ( (Boolean)Singleton.getInstance( SingletonConstants.MODULE_CLIENTES ) ).booleanValue(); + boolean hasRelatorio = ( (Boolean)Singleton.getInstance( SingletonConstants.MODULE_RELATORIO ) ).booleanValue(); + boolean hasListagens = ( (Boolean)Singleton.getInstance( SingletonConstants.MODULE_LISTAGENS ) ).booleanValue(); + + if( hasGestao ) + { + try + { + clientesWindow = new shst.clientes.ClientesWindow( avisos ); + clientesWindow.setTracker( this ); + medicinaWindow = new MedicinaWindow(); + medicinaWindow.setTracker( this ); + higieneWindow = new MarcacoesHigieneWindow(); + higieneWindow.setTracker( this ); + } + catch( Exception ex ) + { + clientesWindow = null; + medicinaWindow = null; + higieneWindow = null; + ex.printStackTrace(); + } + } + else + { + clientesWindow = null; + medicinaWindow = null; + } + + if( hasFicha ) + { + DefaultMutableTreeNode fichaNode = new DefaultMutableTreeNode( FICHA_APTIDAO ); + + fichaNode.add( new DefaultMutableTreeNode( CRIACAO_FICHA_APTIDAO ) ); + creators.put( CRIACAO_FICHA_APTIDAO, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return FichaWindow.getWindow(); + } + } ); + + fichaNode.add( new DefaultMutableTreeNode( ImpressaoFichasWindow.TITLE ) ); + creators.put( ImpressaoFichasWindow.TITLE, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new ImpressaoFichasWindow(); + } + } ); + + rootNode.add( fichaNode ); + } + + if( hasGestao ) + { + rootNode.add( new DefaultMutableTreeNode( GESTAO_CLIENTES ) ); + creators.put( GESTAO_CLIENTES, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return getClientesWindow(); + } + } ); + + rootNode.add( new DefaultMutableTreeNode( LembretesWindow.TITLE ) ); + creators.put( LembretesWindow.TITLE, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new LembretesWindow(); + } + } ); + + DefaultMutableTreeNode medicinaNode = new DefaultMutableTreeNode( MEDICINA ); + + medicinaNode.add( new DefaultMutableTreeNode( MedicinaProcessoWindow.TITLE ) ); + creators.put( MedicinaProcessoWindow.TITLE, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + if( medicinaProcessoWindow == null ) + { + medicinaProcessoWindow = new MedicinaProcessoWindow(); + } + return medicinaProcessoWindow; + } + } ); + + medicinaNode.add( new DefaultMutableTreeNode( MEDICINA_MARCACOES ) ); + creators.put( MEDICINA_MARCACOES, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return getMedicinaWindow(); + } + } ); + + medicinaNode.add( new DefaultMutableTreeNode( MEDICINA_MULTI_MARCACOES ) ); + creators.put( MEDICINA_MULTI_MARCACOES, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return getMultiMarcacoesWindow(); + } + }); + + medicinaNode.add( new DefaultMutableTreeNode( MEDICINA_LOCAIS ) ); + creators.put( MEDICINA_LOCAIS, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new LocaisRealizacaoWindow(); + } + } ); + + medicinaNode.add( new DefaultMutableTreeNode( MEDICINA_ENVIO_ANALISES ) ); + creators.put( MEDICINA_ENVIO_ANALISES, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new EnviarAnalisesWindow(); + } + } ); + + medicinaNode.add( new DefaultMutableTreeNode( RecepcaoExamesWindow.TITLE ) ); + creators.put( RecepcaoExamesWindow.TITLE, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new RecepcaoExamesWindow(); + } + } ); + + medicinaNode.add( new DefaultMutableTreeNode( MEDICINA_PRESENCAS ) ); + creators.put( MEDICINA_PRESENCAS, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new RegistarPresencasWindow(); + } + } ); + + medicinaNode.add( new DefaultMutableTreeNode( PrestadoresWindow.TITLE ) ); + creators.put( PrestadoresWindow.TITLE, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new PrestadoresWindow(); + } + } ); + + rootNode.add( medicinaNode ); + + DefaultMutableTreeNode higieneNode = new DefaultMutableTreeNode( HIGIENE_SEGURANCA ); + + higieneNode.add( new DefaultMutableTreeNode( MarcacoesHigieneWindow.TITLE ) ); + creators.put( MarcacoesHigieneWindow.TITLE, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return getHigieneWindow(); + } + } ); + + higieneNode.add( new DefaultMutableTreeNode( MapaHigieneWindow.TITLE ) ); + creators.put( MapaHigieneWindow.TITLE, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new MapaHigieneWindow(); + } + } ); + higieneNode.add( new DefaultMutableTreeNode( GestaoRelatorioWindow.TITLE ) ); + creators.put( GestaoRelatorioWindow.TITLE, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new GestaoRelatorioWindow(); + } + } ); + higieneNode.add( new DefaultMutableTreeNode( RelatorioHigieneSegurancaWindow.TITLE ) ); + creators.put( RelatorioHigieneSegurancaWindow.TITLE, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new RelatorioHigieneSegurancaWindow(); + } + } ); + rootNode.add( higieneNode ); + } + + if( hasRelatorio ) + { + rootNode.add( new DefaultMutableTreeNode( RELATORIO_ANUAL ) ); + creators.put( RELATORIO_ANUAL, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new PesquisasWindow(); + } + } ); + } + + if( hasListagens ) + { + rootNode.add( new DefaultMutableTreeNode( LISTAGENS ) ); + creators.put( LISTAGENS, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new EstatisticaWindow(); + } + } ); + } + setRoot( rootNode ); + setCreators( creators ); + } + + public shst.clientes.ClientesWindow getClientesWindow() throws Exception + { + if( clientesWindow == null ) + { + clientesWindow = new shst.clientes.ClientesWindow( avisos ); + clientesWindow.setTracker( SIPRPTracker.this ); + } + return clientesWindow; + } + + private shst.clientes.ClientesWindow clientesWindow2 = null; + public shst.clientes.ClientesWindow getClientesWindow2() throws Exception + { + if( clientesWindow2 == null ) + { + clientesWindow2 = new shst.clientes.ClientesWindow( avisos ); + clientesWindow2.setTracker( SIPRPTracker.this ); + } + return clientesWindow2; + } + + public MedicinaWindowInterface getMedicinaWindow() throws Exception + { + if( medicinaWindow == null ) + { + medicinaWindow = new MedicinaWindow(); + medicinaWindow.setTracker( SIPRPTracker.this ); + } + return medicinaWindow; + } + + public MultiMarcacoesWindow getMultiMarcacoesWindow() throws Exception + { + if( multiMarcacoesWindow == null ) + { + multiMarcacoesWindow = new MultiMarcacoesWindow(); + multiMarcacoesWindow.setTracker( SIPRPTracker.this ); + } + return multiMarcacoesWindow; + } + + public MedicinaProcessoWindow getMedicinaProcessoWindow() + { + if( medicinaProcessoWindow == null ) + { + try + { + medicinaProcessoWindow = new MedicinaProcessoWindow(); + } catch( Exception e ) + { + e.printStackTrace(); + } + } + return medicinaProcessoWindow; + } + + public MarcacoesHigieneInterface getHigieneWindow() throws Exception + { + if( higieneWindow == null ) + { + higieneWindow = new MarcacoesHigieneWindow(); + higieneWindow.setTracker( SIPRPTracker.this ); + } + return higieneWindow; + } + + public AvisosPanel getAvisosPanel() + { + return avisos; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/SingletonConstants.java b/branches/SIPRP/SIPRPSoft/src/siprp/SingletonConstants.java new file mode 100644 index 00000000..6d2170fc --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/SingletonConstants.java @@ -0,0 +1,61 @@ +/* + * SingletonConstants.java + * + * Created on 25 de Maio de 2004, 13:34 + */ + +package siprp; + +/** + * + * @author fpalma + */ +public class SingletonConstants +{ + public static final String PERSISTENCE_MANAGER = "PERSISTENCE_MANAGER"; + public static final String SOFTWARE_NAME = "software_name"; + public static final String COMPANY_NAME = "company_name"; + public static final String COMPANY_LOGO = "company_logo"; + public static final String COMPANY_ACRONYM = "company_acronym"; + public static final String SUBJECT_CONSULTA = "subject_consulta"; + public static final String LETTER_CONSULTA = "letter_consulta"; + public static final String SUBJECT_CONSULTA_VACINAS = "subject_consulta_vacinas"; + public static final String LETTER_CONSULTA_VACINAS = "letter_consulta_vacinas"; + public static final String SUBJECT_EXAMES = "subject_exames"; + public static final String LETTER_EXAMES = "letter_exames"; + public static final String SUBJECT_VISITA = "subject_visita"; + public static final String LETTER_VISITA = "letter_visita"; + public static final String USES_HOUR = "uses_hour"; + public static final String CODIGO_EMPRESA_FORMAT = "codigo_empresa_format"; + public static final String FICHA_MARCA_EXAMES = "ficha_marca_exames"; + public static final String EXCEL_FORMAT = "excel_format"; + public static final String EXCEL_FORMAT_DEMISSAO = "excel_format_demissao"; + + public static final String MODULE_FICHA = "module_ficha"; + public static final String MODULE_CLIENTES = "module_clientes"; + public static final String WEB_AWARE = "web_aware"; + public static final String MODULE_RELATORIO = "module_relatorio"; + public static final String MODULE_LISTAGENS = "module_listagens"; + + public static final String WEB_USER = "web_user"; + public static final String WEB_PASSWORD = "web_password"; + public static final String WEB_URL_PREFIX = "web_url_prefix"; + public static final String WEB_URL = "web_url"; + public static final String WEB_DB_NAME = "web_db_name"; + public static final String WEB_DRIVER_NAME = "web_driver_name"; + + public static final String LOCAL_USER = "local_user"; + public static final String LOCAL_PASSWORD = "local_password"; + public static final String LOCAL_URL_PREFIX = "local_url_prefix"; + public static final String LOCAL_URL = "local_url"; + public static final String LOCAL_DB_NAME = "local_db_name"; + public static final String LOCAL_DRIVER_NAME = "local_driver_name"; + + public static final String SIPRP_TRACKER = "SIPRP_TRACKER"; + + /** Creates a new instance of SingletonConstants */ + private SingletonConstants() + { + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/analise_acidentes_trabalho.xsl b/branches/SIPRP/SIPRPSoft/src/siprp/analise_acidentes_trabalho.xsl new file mode 100644 index 00000000..d98488f3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/analise_acidentes_trabalho.xsl @@ -0,0 +1,797 @@ + + + + + + + + + + + + + + + Página + + + + de + + + + + + + + + + + + + + + + + + + imagem1 + + + + ANÃLISE DE ACIDENTE DE TRABALHO + + + + + + + + + N.º + + + + + + DATA: + + / + + / + + + + + + + + + + + imagem2 + + + + + + + + + + + + + IDENTIFICAÇÃO DA + ENTIDADE EMPREGADORA + + + + + + Identificação + completa: + + + + + + + + Actividade desenvolvida: + + + + + + + + Loja: + + + + + + + + + + + + + EMPRESA SEGURADORA + + + + + + Identificação + completa: + + + + + + + + Nº de Apólice: + + + + + + + + + + + + + + EMPRESA PRESTADORA DE + SERVIÇOS DE + SEGURANÇA, HIGIENE E + SAÚDE DO TRABALHO + + + + + + Identificação + completa: + + + + + + + + Técnico(a) Superior + de HST: + + + + + + C.A.P. nº:: + + + + + + + + Médico(a) do + Trabalho: + + + + + + Cédula Prof. nº: + + + + + + + + + + + + + + ACIDENTADO (A) + + + + + + Nome: + + + + + + + + Estabelecimento de + origem: + + + + + + + + Data Nascimento: + + / + + / + + + + + + + + Bilhete de Identidade + N°: + + + + + + + + Morada + + + + + + + + Contacto + telefónico: + + + + + + + + Data admissão: + + / + + / + + + + + + + + Função: + + + + + + + + Turno de Trabalho: + + + + + + + Identificação do superior + hierárquico/Responsável do + posto de trabalho + + + + + + Nome: + + + + + + E-mail: + + + + + + + + + + + + + + DADOS DO ACIDENTE DE + TRABALHO + + + + + + Averiguador: + + + + + + + + Data da ocorrência: + + / + + / + + + + + + Hora do acidente: + + h + + m + + + + + + + Nº horas trabalhadas no + turno: + + + + + + + + Secção: + + + + + + Local específico: + + + + + + + + Tarefa/Actividade que se + encontrava a realizar: + + + + + + + + Substâncias, + equipamentos, + ferramentas e objectos + utilizados: + + + + + + + + Condições que + contribuíram para o + acidente e respectiva + explicação da + sua existência: + + + + + + + + Testemunhas: + + + + + + + + Causas do acidente: + + + + + + + + Descrição do + acidente: + + + + + + + + Fotografia(s) e/ou + croqui(s) do local do + acidente: + + + + + + + + + + Conclusões: + + + + + + + + Acções Imediatas + tomadas: + + + + + + + + + + O colaborador + teve formação em SHST + + + O colaborador não + teve formação em SHST + + + + + + + Motivo: + + + + + + + + + + + + Verificaram-se outras + ocorrências/incidências + no mesmo posto de + trabalho com o + colaborador acidentado. + + + Não se verificaram outras + ocorrências/incidências + no mesmo posto de + trabalho com o + colaborador acidentado. + + + + + + + Quantidade: + + Relatórios de acidente nº: + + + ; + + + + + + + + + + + + Verificaram-se + ocorrências/incidentes + semelhantes com outros + colaboradores. + + + Não se verificaram + ocorrências/incidentes + semelhantes com outros + colaboradores. + + + + + + + Quantidade: + + Relatórios de acidente nº: + + + ; + + + + + + + + + + LESÃO + + + + + + + Ãreas corporais + específicas + lesionadas: + + + + + + + + + + Tipo de Lesão: + + + + + + + + + INCAPACIDADE + + + + + + + Tipo de Incapacidade: + + + + + + Coeficiente de + Incapacidade + + % + + + + + + + Avaliação de + Incapacidade realizada + em + + / + + / + + + + + + Revisão de + Incapacidade + + / + + / + + + + + + + + Período da Incapacidade + Temporária: de + + / + + / + + a + + / + + / + + + + + + + + + + + + + + RECOMENDAÇÕES PROPOSTAS + pela SIPRP + + + + + + + + + + . + + + + + + + + + + + + + + + + MEDIDAS A ADOPTAR PELA + ENTIDADE EMPREGADORA + + + + + + + + + + + + . + + + + + + + + + + + + + + + + + + TOMADA DE CONHECIMENTO / + TERMO DE + RESPONSABILIDADE + + + + + + + + + Averiguado por + + (Departamento de Segurança) + a + + / + + / + + . + + + Verificado por + + (Técnico + de HST) a + + / + + / + + . + + + Verificado por + + (Responsável de Segurança) a + + / + + / + + . + + + Verificado por + + (Responsável de RH) a + + / + + / + + . + + + Com conhecimento de + + (Superior hierárquico) a + + / + + / + + . + + - processamento informático + - acesso autenticado - + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/AvisosPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/AvisosPanel.java new file mode 100644 index 00000000..6e0ae256 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/AvisosPanel.java @@ -0,0 +1,608 @@ +/* + * AvisosPanel.java + * + * Created on 21 de Maio de 2004, 13:06 + */ + +package siprp.clientes; + +import java.awt.Color; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.DateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.Hashtable; +import java.util.Map; +import java.util.Set; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; + +import shst.clientes.AvisosPanelInterface; +import siprp.FichaDataProvider; +import siprp.SIPRPTracker; +import siprp.data.AvisoConstants; +import siprp.data.outer.AvisosData; +import siprp.data.outer.EmpresasData; +import siprp.data.outer.EstabelecimentosData; +import siprp.data.outer.TrabalhadoresData; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.ui.DialogException; + +/** + * + * @author fpalma + */ +public class AvisosPanel extends JPanel implements ActionListener, ControllableComponent, AvisosPanelInterface +{ + private static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( DateFormat.SHORT ); + private ProviderInterface JDO; + private FichaDataProvider provider; + private SIPRPTracker tracker; + + private JPanel empresaPanel; + private JPanel estabelecimentosPanel; + private JPanel trabalhadoresPanel; + +// private AvisosData avisos[]; +// private AvisosData avisosEmpresa[]; +// private AvisosData avisosEstabelecimento[]; +// private AvisosData avisosTrabalhador[]; + + private Object avisosEmpresa[][]; + private Object avisosEstabelecimento[][]; + private Object avisosTrabalhador[][]; + + private boolean refreshed = false; + + private Hashtable buttonHash; + private Hashtable buttonTypeHash; + + /** Creates a new instance of AvisosPanel */ + public AvisosPanel(/* AvisosData avisosEmpresa[], AvisosData avisosEstabelecimento[], AvisosData avisosTrabalhador[]*/ ) + throws Exception + { +// this.avisosEmpresa = new AvisosData[ 0 ]; +// this.avisosEstabelecimento = new AvisosData[ 0 ]; +// this.avisosTrabalhador = new AvisosData[ 0 ]; +// setupComponents(); + buttonHash = new Hashtable(); + buttonTypeHash = new Hashtable(); + JDO = (ProviderInterface) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); +// System.out.println( "public AvisosPanel() JDO: " + JDO ); + } + + private void setupComponents() + { + empresaPanel = new JPanel(); + empresaPanel.setBorder( + BorderFactory.createTitledBorder( + BorderFactory.createLineBorder( new Color( 0.0f, 0.0f, 0.0f, 0.0f ), 1 ), "Empresas" ) ); + empresaPanel.setLayout( new GridLayout( avisosEmpresa.length, 1 ) ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + for( int n = 0; n < avisosEmpresa.length; n++ ) + { + JPanel pan = new JPanel(); + GridBagLayout gridbag = new GridBagLayout(); + pan.setBorder( BorderFactory.createLineBorder( Color.black, 1 ) ); +// EmpresasData empresa = (EmpresasData)avisosEmpresa[ n ].get( AvisosData.EMPRESA ); + pan.setLayout( gridbag ); + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.gridx = 0; + constraints.weightx = 0; + constraints.gridwidth = 1; + JButton tratarButton = new JButton( "Tratar" ); + gridbag.setConstraints( tratarButton, constraints ); + pan.add( tratarButton ); + //buttonHash.put( tratarButton, avisosEmpresa[ n ] ); +// buttonHash.put( tratarButton, new Integer( n ) ); +// buttonHash.put( tratarButton, avisosEmpresa[ n ].get( AvisosData.ID ) ); + buttonHash.put( tratarButton, avisosEmpresa[ n ][ 0 ] ); + buttonTypeHash.put( tratarButton, new Integer( AvisoConstants.TIPO_EMPRESA ) ); + tratarButton.addActionListener( this ); + + constraints.gridx = 1; + constraints.weightx = 1; + constraints.gridheight = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; +// JLabel empresaLabel = new JLabel( "" + empresa.get( EmpresasData.DESIGNACAO_SOCIAL ) ); + JLabel empresaLabel = new JLabel( "" + avisosEmpresa[ n ][ 3 ] ); + gridbag.setConstraints( empresaLabel, constraints ); + pan.add( empresaLabel ); + + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + //JLabel descricaoLabel = new JLabel( (String)avisosEmpresa[ n ].get( AvisosData.DESCRICAO ) ); + JLabel descricaoLabel = criarDescricao( avisosEmpresa[ n ] ); + gridbag.setConstraints( descricaoLabel, constraints ); + pan.add( descricaoLabel ); + + empresaPanel.add( pan ); + } + + estabelecimentosPanel = new JPanel(); + estabelecimentosPanel.setBorder( + BorderFactory.createTitledBorder( + BorderFactory.createLineBorder( new Color( 0.0f, 0.0f, 0.0f, 0.0f ), 1 ), "Estabelecimentos" ) ); + estabelecimentosPanel.setLayout( new GridLayout( avisosEstabelecimento.length, 1 ) ); + + for( int n = 0; n < avisosEstabelecimento.length; n++ ) + { + Date dataAviso = ( Date ) avisosEstabelecimento[ n ][ 5 ]; + Date dataEvento = ( Date ) avisosEstabelecimento[ n ][ 1 ]; + Calendar calAviso = Calendar.getInstance(); + calAviso.setTime( dataAviso ); + Calendar calEvento = Calendar.getInstance(); + calEvento.setTime( dataEvento ); + boolean mesmoDia = + ( calAviso.get( Calendar.YEAR ) == calEvento.get( Calendar.YEAR ) ) && + ( calAviso.get( Calendar.MONTH ) == calEvento.get( Calendar.MONTH ) ) && + ( calAviso.get( Calendar.DAY_OF_MONTH ) == calEvento.get( Calendar.DAY_OF_MONTH ) ); + JPanel pan = new JPanel(); + GridBagLayout gridbag = new GridBagLayout(); + pan.setBorder( BorderFactory.createLineBorder( Color.black, 1 ) ); +// EstabelecimentosData estabelecimento = (EstabelecimentosData)avisosEstabelecimento[ n ].get( AvisosData.ESTABELECIMENTO ); +// EmpresasData empresa = (EmpresasData)estabelecimento.get( EstabelecimentosData.EMPRESA ); + pan.setLayout( gridbag ); + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.gridx = 0; + constraints.weightx = 0; + constraints.gridwidth = 1; + JButton tratarButton = new JButton( mesmoDia ? "Confirmar" : "Marcar" ); + gridbag.setConstraints( tratarButton, constraints ); + pan.add( tratarButton ); + //buttonHash.put( tratarButton, avisosEstabelecimento[ n ] ); +// buttonHash.put( tratarButton, new Integer( n + avisosEmpresa.length ) ); +// buttonHash.put( tratarButton, avisosEstabelecimento[ n ].get( AvisosData.ID ) ); + buttonHash.put( tratarButton, avisosEstabelecimento[ n ][ 0 ] ); + buttonTypeHash.put( tratarButton, new Integer( AvisoConstants.TIPO_ESTABELECIMENTO ) ); + tratarButton.addActionListener( this ); + + constraints.gridx = 1; + constraints.weightx = 1; + constraints.gridheight = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; +// JLabel empresaLabel = new JLabel( "" + empresa.get( EmpresasData.DESIGNACAO_SOCIAL ) ); + JLabel empresaLabel = new JLabel( "" + avisosEstabelecimento[ n ][ 3 ] ); + gridbag.setConstraints( empresaLabel, constraints ); + pan.add( empresaLabel ); + +// JLabel estabelecimentoLabel = new JLabel( "" + estabelecimento.get( EstabelecimentosData.NOME ) ); + JLabel estabelecimentoLabel = new JLabel( "" + avisosEstabelecimento[ n ][ 4 ] ); + gridbag.setConstraints( estabelecimentoLabel, constraints ); + pan.add( estabelecimentoLabel ); + + constraints.gridwidth = GridBagConstraints.REMAINDER; + //JLabel descricaoLabel = new JLabel( (String)avisosEstabelecimento[ n ].get( AvisosData.DESCRICAO ) ); + JLabel descricaoLabel = criarDescricao( avisosEstabelecimento[ n ] ); + gridbag.setConstraints( descricaoLabel, constraints ); + pan.add( descricaoLabel ); + + estabelecimentosPanel.add( pan ); + } + + trabalhadoresPanel = new JPanel(); + trabalhadoresPanel.setBorder( + BorderFactory.createTitledBorder( + BorderFactory.createLineBorder( new Color( 0.0f, 0.0f, 0.0f, 0.0f ), 1 ), "Trabalhadores" ) ); + trabalhadoresPanel.setLayout( new GridLayout( avisosTrabalhador.length, 1 ) ); + + for( int n = 0; n < avisosTrabalhador.length; n++ ) + { + Date dataAviso = ( Date ) avisosTrabalhador[ n ][ 6 ]; + Date dataEvento = ( Date ) avisosTrabalhador[ n ][ 1 ]; + Calendar calAviso = Calendar.getInstance(); + calAviso.setTime( dataAviso ); + Calendar calEvento = Calendar.getInstance(); + calEvento.setTime( dataEvento ); + boolean mesmoDia = + ( calAviso.get( Calendar.YEAR ) == calEvento.get( Calendar.YEAR ) ) && + ( calAviso.get( Calendar.MONTH ) == calEvento.get( Calendar.MONTH ) ) && + ( calAviso.get( Calendar.DAY_OF_MONTH ) == calEvento.get( Calendar.DAY_OF_MONTH ) ); + JPanel pan = new JPanel(); + GridBagLayout gridbag = new GridBagLayout(); + pan.setBorder( BorderFactory.createLineBorder( Color.black, 1 ) ); +// TrabalhadoresData trabalhador = (TrabalhadoresData)avisosTrabalhador[ n ].get( AvisosData.TRABALHADOR ); +// EstabelecimentosData estabelecimento = (EstabelecimentosData)trabalhador.get( TrabalhadoresData.ESTABELECIMENTO ); +// EmpresasData empresa = (EmpresasData)estabelecimento.get( EstabelecimentosData.EMPRESA ); + pan.setLayout( gridbag ); + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.gridx = 0; + constraints.weightx = 0; + constraints.gridwidth = 1; + JButton tratarButton = new JButton( mesmoDia ? "Confirmar" : "Marcar" ); + gridbag.setConstraints( tratarButton, constraints ); + pan.add( tratarButton ); + //buttonHash.put( tratarButton, avisosTrabalhador[ n ] ); +// buttonHash.put( tratarButton, new Integer( n + avisosEmpresa.length + avisosEstabelecimento.length ) ); +// buttonHash.put( tratarButton, avisosTrabalhador[ n ].get( AvisosData.ID ) ); + buttonHash.put( tratarButton, avisosTrabalhador[ n ][ 0 ] ); + buttonTypeHash.put( tratarButton, new Integer( AvisoConstants.TIPO_TRABALHADOR ) ); + tratarButton.addActionListener( this ); + + constraints.gridx = 1; + constraints.weightx = 1; + constraints.gridheight = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; +// JLabel empresaLabel = new JLabel( "" + empresa.get( EmpresasData.DESIGNACAO_SOCIAL ) ); + JLabel empresaLabel = new JLabel( "" + avisosTrabalhador[ n ][ 3 ] ); + gridbag.setConstraints( empresaLabel, constraints ); + pan.add( empresaLabel ); + +// JLabel estabelecimentoLabel = new JLabel( "" + estabelecimento.get( EstabelecimentosData.NOME ) ); + JLabel estabelecimentoLabel = new JLabel( "" + avisosTrabalhador[ n ][ 4 ] ); + gridbag.setConstraints( estabelecimentoLabel, constraints ); + pan.add( estabelecimentoLabel ); + +// JLabel trabalhadorLabel = new JLabel( "" + trabalhador.get( TrabalhadoresData.NOME ) ); + JLabel trabalhadorLabel = new JLabel( "" + avisosTrabalhador[ n ][ 5 ] ); + gridbag.setConstraints( trabalhadorLabel, constraints ); + pan.add( trabalhadorLabel ); + constraints.gridwidth = GridBagConstraints.REMAINDER; + //JLabel descricaoLabel = new JLabel( (String)avisosTrabalhador[ n ].get( AvisosData.DESCRICAO ) ); + JLabel descricaoLabel = criarDescricao( avisosTrabalhador[ n ] ); + gridbag.setConstraints( descricaoLabel, constraints ); + pan.add( descricaoLabel ); + + trabalhadoresPanel.add( pan ); + } + +// Vector v = new Vector( Arrays.asList( avisosEmpresa ) ); +// v.addAll( Arrays.asList( avisosTrabalhador ) ); +// v.addAll( Arrays.asList( avisosEstabelecimento ) ); +// avisos = (AvisosData []) v.toArray( new AvisosData[0] ); + + JScrollPane scp = new JScrollPane(); + setLayout( new GridLayout( 1, 1 ) ); + add( scp ); + JPanel contentPanel = new JPanel(); + scp.setViewportView( contentPanel ); +// contentPanel.setLayout( new BoxLayout( contentPanel, BoxLayout.Y_AXIS ) ); +// contentPanel.setLayout( new FlowLayout() ); + GridBagLayout gridbag = new GridBagLayout(); + contentPanel.setLayout( gridbag ); + constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1; + constraints.gridheight = 1; + constraints.weighty = 0; + if( avisosEmpresa.length > 0 ) + { + gridbag.setConstraints( empresaPanel, constraints ); + contentPanel.add( empresaPanel ); + } + if( avisosTrabalhador.length > 0 ) + { +// contentPanel.add( new JLabel( " " ) ); + gridbag.setConstraints( trabalhadoresPanel, constraints ); + contentPanel.add( trabalhadoresPanel ); + } + if( avisosEstabelecimento.length > 0 ) + { +// contentPanel.add( new JLabel( " " ) ); + gridbag.setConstraints( estabelecimentosPanel, constraints ); + contentPanel.add( estabelecimentosPanel ); + } + } + + public void refresh() + { + if( refreshed ) + { + return; + } + refreshed = true; + try + { + provider = ( FichaDataProvider ) FichaDataProvider.getProvider(); +// Collection c = AvisosData.load( AvisosData.class, " estabelecimento_id == \"null\" ", +// AvisosData.DATA_EVENTO + " ascending" ); + +// Collection c = AvisosData.load( AvisosData.class, "(tipo == " + AvisosData.TIPO_EMPRESA+")",// + ") && ( data_aviso <= CURRENT_DATE )", +// AvisosData.DATA_EVENTO + " ascending" ); +// Collection c = AvisosData.load( AvisosData.class, new Object[]{ /*new Integer( AvisosData.TIPO_EMPRESA ), */new Date() }, +// new String[]{ /*"tipo", */"data_aviso" }, +// new String[]{ "=="/*, "==" */}, +// new String[]{ AvisosData.DATA_EVENTO + " ascending" } ); + +// if( c == null ) +// { +// avisosEmpresa = new AvisosData[ 0 ]; +// } +// else +// { +// +// avisosEmpresa = ( AvisosData[] )c.toArray( new AvisosData[ c.size() ] ); +// } + +// Integer ids[] = provider.getAvisosIDByTipoAndDate( new Integer( AvisoConstants.TIPO_EMPRESA ), new Date() ); +// avisosEmpresa = new AvisosData[ ids.length ]; +// if( JDO == null ) +// { +// JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); +// } +//// System.out.println( "JDO: " + JDO ); +// for( int n = 0; n < avisosEmpresa.length; n++ ) +// { +// avisosEmpresa[ n ] = (AvisosData) JDO.load( AvisosData.class, ids[ n ] ); +// } +// +////System.out.println( "EmpresasData " + avisosEmpresa.length ); +//// c = AvisosData.load( AvisosData.class, " tipo == " + AvisosData.TIPO_ESTABELECIMENTO,// + ") && ( data_aviso <= new Date() )", +//// AvisosData.DATA_EVENTO + " ascending" ); +//// c = AvisosData.load( AvisosData.class, "estabelecimento_id != \"null\" " +//// + " && trabalhador_id == \"null\"", AvisosData.DATA_EVENTO + " ascending" ); +//// if( c == null ) +//// { +//// avisosEstabelecimento = new AvisosData[ 0 ]; +//// } +//// else +//// { +//// avisosEstabelecimento = ( AvisosData[] )c.toArray( new AvisosData[ c.size() ] ); +//// } +// +// ids = provider.getAvisosIDByTipoAndDate( new Integer( AvisoConstants.TIPO_ESTABELECIMENTO ), new Date() ); +// avisosEstabelecimento = new AvisosData[ ids.length ]; +// for( int n = 0; n < avisosEstabelecimento.length; n++ ) +// { +// avisosEstabelecimento[ n ] = (AvisosData) JDO.load( AvisosData.class, new Object[]{ids[ n ]}, new String[]{ "id" } ); +// } +////System.out.println( "EstabelecimentosData " + avisosEstabelecimento.length ); +//// c = AvisosData.load( AvisosData.class, " tipo == " + AvisosData.TIPO_TRABALHADOR,// + ") && ( data_aviso <= new Date() )", +//// AvisosData.DATA_EVENTO + " ascending" ); +//// c = AvisosData.load( AvisosData.class, "trabalhador_id != \"null\"", AvisosData.DATA_EVENTO + " ascending" ); +//// if( c == null ) +//// { +//// avisosTrabalhador = new AvisosData[ 0 ]; +//// } +//// else +//// { +//// avisosTrabalhador = ( AvisosData[] )c.toArray( new AvisosData[ c.size() ] ); +//// } +// ids = provider.getAvisosIDByTipoAndDate( new Integer( AvisoConstants.TIPO_TRABALHADOR ), new Date() ); +// +// avisosTrabalhador = new AvisosData[ ids.length ]; +// for( int n = 0; n < avisosTrabalhador.length; n++ ) +// { +// avisosTrabalhador[ n ] = (AvisosData) JDO.load( AvisosData.class, ids[ n ] ); +// } +//System.out.println( "trabalhador " + avisosTrabalhador.length ); + avisosEmpresa = provider.getAvisosEmpresaByDate( new Date() ); + avisosEstabelecimento = provider.getAvisosEstabelecimentoByDate( new Date() ); + avisosTrabalhador = provider.getAvisosTrabalhadorByDate( new Date() ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + setupComponents(); + setVisible( true ); + repaint(); + } + + private JLabel criarDescricao( Object aviso[] ) + { + Date dataEvento = ( Date )aviso[ 1 ]; + + String descricao = (String)aviso[ 2 ]; + Calendar cal = Calendar.getInstance(); + cal.setTime( dataEvento ); + cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 ); + cal.set( Calendar.MILLISECOND, 0 ); + dataEvento = cal.getTime(); + + cal = Calendar.getInstance(); + cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 ); + cal.set( Calendar.MILLISECOND, 0 ); + Date hoje = cal.getTime(); + + if( !hoje.after( dataEvento ) && !hoje.before( dataEvento ) ) + { + descricao += " hoje"; + } + else + { + descricao += " no dia " + DATE_FORMAT.format( dataEvento ); + } + JLabel descricaoLabel = new JLabel( descricao ); + if( hoje.after( dataEvento ) ) + { + descricaoLabel.setForeground( Color.red ); + } + else if( hoje.equals( dataEvento ) ) + { + descricaoLabel.setForeground( Color.green.darker() ); + } + return descricaoLabel; + } + +// private JLabel criarDescricao( AvisosData aviso ) +// { +// Date dataEvento = ( Date )aviso.get( AvisosData.DATA_EVENTO ); +// +// String descricao = (String)aviso.get( AvisosData.DESCRICAO ); +// String descricao2 = (String)aviso.get( AvisosData.DESCRICAO ); +// Calendar cal = Calendar.getInstance(); +// cal.setTime( dataEvento ); +// cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 ); +// cal.set( Calendar.MILLISECOND, 0 ); +// dataEvento = cal.getTime(); +// +// cal = Calendar.getInstance(); +// cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 ); +// cal.set( Calendar.MILLISECOND, 0 ); +// Date hoje = cal.getTime(); +// +// if( !hoje.after( dataEvento ) && !hoje.before( dataEvento ) ) +// { +// descricao += " hoje"; +// } +// else +// { +// descricao += " no dia " + DATE_FORMAT.format( dataEvento ); +// } +// JLabel descricaoLabel = new JLabel( descricao ); +// if( hoje.after( dataEvento ) ) +// { +// descricaoLabel.setForeground( Color.red ); +// } +// else if( hoje.equals( dataEvento ) ) +// { +// descricaoLabel.setForeground( Color.green.darker() ); +// } +// return descricaoLabel; +// } + + public void actionPerformed( ActionEvent e ) + { + if( JDO == null ) + { + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + Object source = e.getSource(); + if( source instanceof JButton ) + { +// AvisosData aviso = (AvisosData) buttonHash.get( source ); + try + { + ( (JButton) source ).setEnabled( false ); + Integer id = (Integer)buttonHash.get( source ); + if( id == null ) + { + return; + } + buttonHash.remove( source ); + AvisosData aviso = (AvisosData) JDO.load( AvisosData.class, id ); + if( aviso == null ) + { + JOptionPane.showMessageDialog( null, "Este aviso j\u00e1 foi tratado.", "J\u00e1 tratado", + JOptionPane.WARNING_MESSAGE ); + return; + } + Map dataHash = aviso.getHashData(); + Date dataEvento = (Date)dataHash.get( AvisosData.DATA_EVENTO ); + Calendar cal = Calendar.getInstance(); + cal.setTime( dataEvento ); + cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 ); + cal.set( Calendar.MILLISECOND, 0 ); + dataEvento = cal.getTime(); + + cal = Calendar.getInstance(); + cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 10, 0, 0 ); + cal.set( Calendar.MILLISECOND, 0 ); + Date hoje = cal.getTime(); + if( hoje.before( dataEvento ) ) + { + AvisosData novoAviso = new AvisosData(); + novoAviso.setHashData( dataHash ); + novoAviso.set( AvisosData.DATA_AVISO, dataEvento ); + novoAviso.save(); + } + + Integer tipo = (Integer) aviso.get( AvisosData.TIPO ); + TrabalhadoresData trabalhador; + EstabelecimentosData estabelecimento; + EmpresasData empresa; + + switch( tipo.intValue() ) + { + case AvisoConstants.TIPO_TRABALHADOR: + trabalhador = aviso.toTrabalhador_id(); + estabelecimento = trabalhador.toEstabelecimento_id(); + empresa = estabelecimento.toEmpresa_id(); + aviso.delete(); + tracker.getMedicinaWindow().setVisible( true ); + tracker.getMedicinaWindow().setEmpresaAndEstabelecimentoAndTrabalhador( (Integer) empresa.get( EmpresasData.ID ), + ( Integer ) estabelecimento.get( EstabelecimentosData.ID ), + ( Integer ) trabalhador.get( TrabalhadoresData.ID ) ); + break; + + case AvisoConstants.TIPO_ESTABELECIMENTO: + estabelecimento = aviso.toEstabelecimento_id(); + empresa = estabelecimento.toEmpresa_id(); + aviso.delete(); + tracker.getHigieneWindow().setVisible( true ); + tracker.getHigieneWindow().setEmpresaAndEstabelecimento( (Integer) empresa.get( EmpresasData.ID ), + ( Integer ) estabelecimento.get( EstabelecimentosData.ID ) ); + break; + + case AvisoConstants.TIPO_EMPRESA: + empresa = aviso.toEmpresa_id(); + aviso.delete(); + shst.clientes.ClientesWindow clientesWindow = tracker.getClientesWindow(); + clientesWindow.setVisible( true ); + clientesWindow.setJDOObject( empresa ); + break; + } +System.out.println( "delete aviso" ); +// aviso.set( AvisosData.TRABALHADOR, null ); +// aviso.set( AvisosData.ESTABELECIMENTO, null ); +// aviso.set( AvisosData.EMPRESA, null ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a limpar o aviso", true ); + } + } + } + + public void clear() + { + } + + public void fill(Object value) + { + } + + public Object save() + { + return null; + } + + public void setEnabled( boolean enable ) + { + Set buttonSet = buttonHash.keySet(); + JButton buttons[] = (JButton[]) buttonSet.toArray( new JButton[0] ); + for( int n = 0;n < buttons.length; n++ ) + { + buttons[ n ].setEnabled( enable ); + } + } + + public void setEnabled( boolean enable, int type ) + { + Set buttonSet = buttonHash.keySet(); + JButton buttons[] = (JButton[]) buttonSet.toArray( new JButton[0] ); + for( int n = 0;n < buttons.length; n++ ) + { + Integer buttonType = ( Integer ) buttonTypeHash.get( buttons[ n ] ); + if( buttonType.intValue() == type ) + { + buttons[ n ].setEnabled( enable ); + } + } + } + + public void setTracker( SIPRPTracker tracker ) + { + this.tracker = tracker; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/ClientesDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/ClientesDataProvider.java new file mode 100644 index 00000000..5ab25639 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/ClientesDataProvider.java @@ -0,0 +1,216 @@ +/* + * ClientesDataProvider.java + * + * Created on January 27, 2006, 12:50 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.clientes; + +import java.util.Hashtable; +import java.util.Vector; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.metadb.MetaProvider; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Delete; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.Select; + +/** + * + * @author fpalma + */ +public class ClientesDataProvider extends MetaProvider +{ + private static final Object LOCK = new Object(); + private static ClientesDataProvider instance = null; + private final Executer executer; + + private Integer etiquetaID; + + /** Creates a new instance of ClientesDataProvider */ + public ClientesDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + executer = dbm.getSharedExecuter( this ); + } + + public static MetaProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new ClientesDataProvider(); + } + } + return instance; + } + + public IDObject[] getAllGruposProtocoloReais() + throws Exception + { + return getAllGruposProtocoloPorTipo( true ); + } + + public IDObject[] getAllGruposProtocoloFalsos() + throws Exception + { + return getAllGruposProtocoloPorTipo( false ); + } + + public IDObject[] getAllGruposProtocoloPorTipo( boolean real ) + throws Exception + { + Select select = + new Select( new String[]{ "prt_grupos_protocolo" }, + new String[]{ "id", "descricao", "ordem" }, + new Field( "grupo_real" ).isEqual( real ? "y" : "n" ), + new String[]{ "ordem" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + IDObject grupos[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < grupos.length; n++ ) + { + grupos[ n ] = new MappableObject( ( Integer ) array.get( n, 0 ), ( String ) array.get( n, 1 ) ); + } + return grupos; + } + + public Hashtable getAllTiposElementosProtocoloByGrupo() + throws Exception + { + Select select = + new Select( new String[]{ "prt_tipos_elementos_protocolo" }, + new String[]{ "id", "descricao", "ordem", "grupo_protocolo_id" }, + null, + new String[]{ "grupo_protocolo_id", "ordem" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + Hashtable tipos = new Hashtable(); + for( int n = 0; n < array.columnLength(); n++ ) + { + IDObject tipo = new MappableObject( ( Integer ) array.get( n, 0 ), ( String ) array.get( n, 1 ) ); + Integer grupoID = ( Integer ) array.get( n, 3 ); + if( !tipos.containsKey( grupoID ) ) + { + tipos.put( grupoID, new Vector() ); + } + Vector tiposGrupo = ( Vector ) tipos.get( grupoID ); + tiposGrupo.add( tipo ); + } + return tipos; + } + + public void setElementosProtocoloForEmpresa( Integer empresaID, Integer elementos[][] ) + throws Exception + { +// executer.executeQuery( Begin.BEGIN ); + try + { + Delete delete = + new Delete( "prt_elementos_protocolo", + new Field( "empresa_id" ).isEqual( empresaID ) ); + executer.executeQuery( delete ); + for( int p = 0; p < elementos.length; p++ ) + { + Integer numeroPerfil = new Integer( p + 1 ); + for( int e = 0; e < elementos[ p ].length; e++ ) + { + Insert insert = + new Insert( "prt_elementos_protocolo", + new Assignment[]{ + new Assignment( new Field( "empresa_id" ), empresaID ), + new Assignment( new Field( "tipo_elemento_protocolo_id" ), elementos[ p ][ e ] ), + new Assignment( new Field( "numero_perfil" ), numeroPerfil ) } ); + executer.executeQuery( insert, null ); + } + } +// executer.executeQuery( Commit.COMMIT ); + } + catch( Exception ex ) + { +// executer.executeQuery( Rollback.ROLLBACK ); + throw ex; + } + } + + public Integer[][] getElementosProtocoloForEmpresa( Integer empresaID, int numeroPerfis ) + throws Exception + { + Select select = + new Select( new String[]{ "prt_elementos_protocolo" }, + new String[]{ "tipo_elemento_protocolo_id", "numero_perfil" }, + new Field( "empresa_id" ).isEqual( empresaID ) , + new String[]{ "numero_perfil" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + Vector data[] = new Vector[ numeroPerfis ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + int perfil = ( ( Integer ) array.get( n, 1 ) ).intValue() - 1; + Integer tipo = ( Integer ) array.get( n, 0 ); + if( data[ perfil ] == null ) + { + data[ perfil ] = new Vector(); + } + data[ perfil ].add( tipo ); + } + Integer elementos[][] = new Integer[ numeroPerfis ][]; + for( int n = 0; n < numeroPerfis; n++ ) + { + if( data[ n ] == null ) + { + elementos[ n ] = new Integer[ 0 ]; + } + else + { + elementos[ n ] = ( Integer [] ) data[ n ].toArray( new Integer[ data[ n ].size() ] ); + } + } + return elementos; + } + + public Integer getEtiquetaID() + throws Exception + { + if( etiquetaID == null ) + { + Select select = + new Select( new String[]{ "etiquetas" }, + new String[]{ "max(id)" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return null; + } + etiquetaID = ( Integer ) array.get( 0, 0 ); + } + return etiquetaID; + } + + public Integer getEmpresaIDByTrabalhadorID( Integer trabalhadorID ) + throws Exception + { + Select select = + new Select( new String[]{ "trabalhadores", "estabelecimentos" }, + new String[]{ "estabelecimentos.empresa_id" }, + new Field( "trabalhadores.id" ).isEqual( trabalhadorID ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( + new Field( "estabelecimentos.id" ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + return ( Integer ) array.get( 0, 0 ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/ClientesWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/ClientesWindow.java new file mode 100644 index 00000000..de0d3351 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/ClientesWindow.java @@ -0,0 +1,1478 @@ +/* + * ClientesWindow.java + * + * Created on 12 de Maio de 2004, 18:11 + */ + +package siprp.clientes; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; + +import java.awt.Dimension; +import java.awt.FileDialog; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.io.File; +import java.io.FilenameFilter; +import java.text.DateFormat; +import java.util.Arrays; +import java.util.Date; +import java.util.Hashtable; +import java.util.Locale; +import java.util.Vector; + +import javax.swing.BorderFactory; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTabbedPane; +import javax.swing.JTextField; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import siprp.FichaDataProvider; +import siprp.SIPRPTracker; +import siprp.SingletonConstants; +import siprp.data.AvisoConstants; +import siprp.data.SearchExecuterFactory; +import siprp.data.outer.ContactosData; +import siprp.data.outer.EmpresasData; +import siprp.data.outer.EstabelecimentosData; +import siprp.data.outer.EtiquetasData; +import siprp.data.outer.ExamesData; +import siprp.data.outer.TrabalhadoresData; +import siprp.ficha.ExamePDF; +import siprp.importer.Importer; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.dataedition.persistence.Persistent; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.date.DateUtils; +import com.evolute.utils.jdo.JDOObject; +import com.evolute.utils.strings.StringPlainer; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.dialog.ListAction; +import com.evolute.utils.ui.dialog.ListActionDialog; +import com.evolute.utils.ui.dialog.LongMessageDialog; +import com.evolute.utils.ui.search.SearchDialog; +import com.evolute.utils.ui.text.CopyPasteHandler; +import com.evolute.utils.ui.window.ActionHandler; +import com.evolute.utils.ui.window.EditorWindow; + +/** + * + * @author fpalma + */ +public class ClientesWindow extends EditorWindow + implements ListSelectionListener +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + private static final DateFormat DF = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); + + public static final Hashtable TR_IMPORT_NAMES_TO_TRAB = new Hashtable(); + public static final Hashtable TR_IMPORT_NAMES_TO_DEMISSOES = new Hashtable(); + + static + { + TR_IMPORT_NAMES_TO_TRAB.put( Importer.NOME, TrabalhadoresData.NOME ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.SEXO, TrabalhadoresData.SEXO ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.NACIONALIDADE, TrabalhadoresData.NACIONALIDADE ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.DATA_NASCIMENTO, TrabalhadoresData.DATA_NASCIMENTO ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.NUMERO_MECANOGRAFICO, TrabalhadoresData.NUMERO_MECANOGRAFICO ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.DATA_ADMISSAO, TrabalhadoresData.DATA_ADMISSAO ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.CATEGORIA, TrabalhadoresData.CATEGORIA ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.LOCAL_TRABALHO, TrabalhadoresData.LOCAL_TRABALHO ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.FUNCAO, TrabalhadoresData.FUNCAO_PROPOSTA ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.DATA_ADMISSAO_FUNCAO, TrabalhadoresData.DATA_ADMISSAO_FUNCAO ); + + TR_IMPORT_NAMES_TO_DEMISSOES.put( Importer.NOME, TrabalhadoresData.NOME ); + TR_IMPORT_NAMES_TO_DEMISSOES.put( Importer.DATA_DEMISSAO, TrabalhadoresData.DATA_DEMISSAO ); + +// JDOObject.registerOperationHandlerForClass( DisableDeleteHandler.INSTANCE, EmpresasData.class ); +// JDOObject.registerOperationHandlerForClass( DisableDeleteHandler.INSTANCE, EstabelecimentosData.class ); +// JDOObject.registerOperationHandlerForClass( DisableDeleteHandler.INSTANCE, TrabalhadoresData.class ); +// +// JDOObject.registerOperationHandlerForClass( MarcacaoSaveAndDeleteHandler.INSTANCE, MarcacaoEmpresasData.class ); +// JDOObject.registerOperationHandlerForClass( MarcacaoSaveAndDeleteHandler.INSTANCE, MarcacaoEstabelecimentosData.class ); +// JDOObject.registerOperationHandlerForClass( MarcacaoSaveAndDeleteHandler.INSTANCE, MarcacoesTrabalhadorData.class ); + } + + public static final int INDEX_EMPRESA = 0; + public static final int INDEX_ESTABELECIMENTO = 1; + public static final int INDEX_TRABALHADOR = 2; + + private static final String ESTABELECIMENTO_PLANO_ACTUACAO_TAB_NOME = "Plano de Actua"+ccedil+atilde+"o"; + + private static int hierarchy[] = new int[]{0,0,1}; + private static int permissions[][] = + new int[][]{ { NEW_INDEX, EDIT_INDEX, CANCEL_INDEX, SAVE_INDEX, SELECT_BYNAME_INDEX, DELETE_INDEX }, + { NEW_INDEX, EDIT_INDEX, CANCEL_INDEX, SAVE_INDEX, DELETE_INDEX }, + { NEW_INDEX, EDIT_INDEX, CANCEL_INDEX, SAVE_INDEX, DELETE_INDEX } }; + + private ProviderInterface JDO; + private ClientesDataProvider clientesProvider; + private ControllableComponent panels[] = new ControllableComponent[ 4 ]; + private EmpresaPanel empresaPanel; + private JPanel estabelecimentoOuterPanel; + private JTabbedPane tabbedPane; + private JTextField estabelecimentoText; + private EstabelecimentoPanel estabelecimentoPanel; + private TrabalhadorPanel trabalhadorPanel; + + private SIPRPTracker tracker; + + private EmpresasData empresa; + private Integer elementosProtocolo[][]; + private EstabelecimentosData estabelecimento; + private TrabalhadoresData trabalhador; + + private AvisosPanel avisos; + + protected boolean webAware; + +// private EstabelecimentoPlanoActuacaoPanel planoActuacaoPanel; + +// public static void main( String args[] ) +// throws Exception +// { +// ClientesWindow window = new ClientesWindow(); +// window.show(); +// } + + /** Creates a new instance of ClientesWindow */ + public ClientesWindow( AvisosPanel avisos ) + throws Exception + { + super( permissions ); + this.avisos = avisos; + webAware = ( ( Boolean ) Singleton.getInstance( SingletonConstants.WEB_AWARE ) ).booleanValue(); + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + clientesProvider = ( ClientesDataProvider ) ClientesDataProvider.getProvider(); + setEditorManagerHierarchy( hierarchy ); + setupComponents(); + this.setExtendedState(this.getExtendedState() | ClientesWindow.MAXIMIZED_BOTH); + } + + private void setupComponents() + throws Exception + { + setSize( 1000, 740 ); + setTitle( "Gest\u00e3o de Clientes" ); + + changeGroupName( INDEX_ESTABELECIMENTO, "Estabelecimento" ); + JPanel toolbarEstabelecimento = getToolbarPanel( INDEX_ESTABELECIMENTO ); + + changeGroupName( INDEX_TRABALHADOR, "Trabalhador" ); + JPanel toolbarTrabalhador = getToolbarPanel( INDEX_TRABALHADOR ); + + tabbedPane = new JTabbedPane(); + empresaPanel = new EmpresaPanel(); + empresaPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Empresa/Entidade" ) ); + estabelecimentoText = new JTextField(); + estabelecimentoPanel = new EstabelecimentoPanel( toolbarEstabelecimento, estabelecimentoText, empresaPanel.getEstabelecimentosTable() ); + estabelecimentoOuterPanel = new JPanel(); + estabelecimentoOuterPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Estabelecimento" ) ); + JLabel estabelecimentoLabel = new JLabel( "Designa\u00e7\u00e3o" ); + + trabalhadorPanel = new TrabalhadorPanel( toolbarTrabalhador, empresaPanel.getEstabelecimentosTable() ); + +// planoActuacaoPanel = new EstabelecimentoPlanoActuacaoPanel(); + + GridBagLayout gridbag = new GridBagLayout(); + getContentPane().setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + + constraints.weighty = 0.5; + constraints.gridheight = 1; + gridbag.setConstraints( empresaPanel, constraints ); + getContentPane().add( empresaPanel ); + + constraints.weighty = 0.5; + constraints.gridheight = GridBagConstraints.REMAINDER; + gridbag.setConstraints( estabelecimentoOuterPanel, constraints ); + getContentPane().add( estabelecimentoOuterPanel ); + + gridbag = new GridBagLayout(); + estabelecimentoOuterPanel.setLayout( gridbag ); + constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + + constraints.weightx = 0; + constraints.gridwidth = 1; + constraints.weighty = 0; + constraints.gridheight = 1; + gridbag.setConstraints( estabelecimentoLabel, constraints ); + estabelecimentoOuterPanel.add( estabelecimentoLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( estabelecimentoText, constraints ); + estabelecimentoOuterPanel.add( estabelecimentoText ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + gridbag.setConstraints( tabbedPane, constraints ); + estabelecimentoOuterPanel.add( tabbedPane ); + + tabbedPane.add( "Dados", estabelecimentoPanel ); + tabbedPane.add( "Trabalhadores", trabalhadorPanel ); +// tabbedPane.add( ESTABELECIMENTO_PLANO_ACTUACAO_TAB_NOME, planoActuacaoPanel ); + + panels[ INDEX_EMPRESA ] = empresaPanel; + panels[ INDEX_ESTABELECIMENTO ] = estabelecimentoPanel; + panels[ INDEX_TRABALHADOR ] = trabalhadorPanel; + //empresaPanel.addListSelectionListener( estabelecimentoPanel ); + empresaPanel.addListSelectionListener( trabalhadorPanel ); + empresaPanel.addListSelectionListener( this ); + trabalhadorPanel.addListSelectionListener( this ); + + registerAction( new ActionHandler(){ + public void execute() + { + excel(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return editAction; + } + }, "Importar", + "Importar de Excel", "excel", + 0, true ); + + registerAction( new ActionHandler(){ + public void execute() + { + excelDemissoes(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return editAction; + } + }, "Demiss\u00f5es", + "Demiss\u00f5es por Excel", null, + 0, true ); + + registerAction( new ActionHandler(){ + public void execute() + { + mudarEstabelecimento(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return editAction; + } + }, "Mudar Estabelecimento", + "Mudar Estabelecimento", null, + INDEX_TRABALHADOR, false ); + + registerAction( new ActionHandler(){ + public void execute() + { + imprimirFicha(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return editAction ; + } + }, "Imprimir Ficha de Aptid\u00e3o", + "Imprimir Ficha de Aptid\u00e3o", null, + INDEX_TRABALHADOR, false ); + + registerAction( new ActionHandler(){ + public void execute() + { + imprimirEtiquetaTrabalhador(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return editAction ; + } + }, "Imprimir Etiqueta", + "Imprimir Etiqueta de Trabalhador", null, + INDEX_TRABALHADOR, false ); + + registerAction( new ActionHandler(){ + public void execute() + { + imprimirEtiquetaEstabelecimento(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return editAction ; + } + }, "Imprimir Etiqueta", + "Imprimir Etiqueta de Estabelecimento", null, + INDEX_ESTABELECIMENTO, false ); + + registerAction( new ActionHandler(){ + public void execute() + { + restaurarEmpresa(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return true; + } + }, "Restaurar Empresa", + "Restaurar Empresa", null, + INDEX_EMPRESA, false ); + + if( webAware ) + { + registerAction( new ActionHandler(){ + public void execute() + { + utilizadorWeb( false ); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return editAction; + } + }, "Utilizador Web da Empresa", + "Utilizador Web da Empresa", null, + INDEX_EMPRESA, false ); + + registerAction( new ActionHandler(){ + public void execute() + { + utilizadorWeb( true ); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return true; + } + }, "Utilizador Web", + "Utilizador Web", null, + INDEX_EMPRESA, false ); + + registerAction( new ActionHandler(){ + public void execute() + { + noticias(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return true; + } + }, "Not\u00edcias", + "Not\u00edcias", null, + INDEX_EMPRESA, false ); + } + + registerAction( new ActionHandler(){ + public void execute() + { + restaurarEstabelecimento(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return newAction || saveAction; + } + }, "Restaurar Estabelecimento", + "Restaurar Estabelecimento", null, + INDEX_ESTABELECIMENTO, false ); + + registerAction( new ActionHandler(){ + public void execute() + { + restaurarTrabalhador(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return newAction || saveAction; + } + }, "Restaurar Trabalhador", + "Restaurar Trabalhador", null, + INDEX_TRABALHADOR, false ); + + new CopyPasteHandler( estabelecimentoText ); + } + + public boolean searchByName( ) + { + SearchDialog search; + Integer empresaID; +// switch( index ) +// { +// case INDEX_EMPRESA: + search = new SearchDialog( SearchExecuterFactory.getSearchExecuter( EmpresasData.class ), null, false, null, true ); + empresaID = ( Integer )search.getSelected(); + if( empresaID != null ) + { + try + { + empresa = (EmpresasData) JDO.load( EmpresasData.class, empresaID ); + elementosProtocolo = clientesProvider.getElementosProtocoloForEmpresa( empresaID, 2 ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar a empresa", true ); + empresa = null; + } + reload( INDEX_EMPRESA ); + } +// break; +// } + return true; + } + + public boolean newItem( int index ) + { + return true; + } + + public void reload( int index ) + { + // System.out.println( "RELOAD: " + index + " e: " + empresa + " e: " +estabelecimento + " t: " + trabalhador ); + switch( index ) + { + case INDEX_EMPRESA: + empresaPanel.fill( new Object[]{ empresa, elementosProtocolo } ); + estabelecimentoPanel.setEmpresa( empresa ); + break; + case INDEX_ESTABELECIMENTO: + // trabalhadorPanel.fill( null ); + estabelecimentoPanel.fill( estabelecimento ); + trabalhadorPanel.setEstabelecimento( estabelecimento ); +// planoActuacaoPanel.fill( estabelecimento == null ? null : estabelecimento.get( EstabelecimentosData.ID ) ); + break; + case INDEX_TRABALHADOR: + trabalhadorPanel.fill( trabalhador ); + // trabalhadorPanel.reload(); + break; + } + } + + public boolean save( int index ) + { + boolean isNew = false; + Object object = panels[ index ].save(); + try + { + switch( index ) + { + case INDEX_EMPRESA: + empresa = (EmpresasData) ( ( Object [] )object )[ 0 ]; + if( empresa.get( EmpresasData.ID ) == null ) + { + isNew = true; + } + elementosProtocolo = (Integer [][]) ( ( Object [] )object )[ 1 ]; + // System.out.println( empresa.debug() ); + ContactosData c1 = empresa.toContacto_1(); + ContactosData c2 = empresa.toContacto_2(); +// empresa.set( EmpresasData.CONTACTO_1, null ); +// empresa.set( EmpresasData.CONTACTO_2, null ); +// empresa.save(); + +// empresa.set( EmpresasData.CONTACTO_1, c1 ); + +// empresa.set( EmpresasData.CONTACTO_2, c2 ); + if( c1 != null ) + { + c1.save(); + } + if( c2 != null ) + { + c2.save(); + } + +// empresa.set( EmpresasData.INACTIVO, "n" ); + empresa.set( EmpresasData.DESIGNACAO_SOCIAL_PLAIN, + com.evolute.utils.strings.StringPlainer.convertString( ( String ) + empresa.get( EmpresasData.DESIGNACAO_SOCIAL ) ) ); + empresa.save(); + clientesProvider.setElementosProtocoloForEmpresa( + ( Integer ) empresa.get( EmpresasData.ID ), elementosProtocolo ); + + if( isNew ) + { + estabelecimentoPanel.setEmpresa( empresa ); + } + ( ( EmpresaPanel )panels[ INDEX_EMPRESA ] ).reloadMarcacoes(); + break; + + case INDEX_ESTABELECIMENTO: + estabelecimento = (EstabelecimentosData) object; + if( estabelecimento.get( EstabelecimentosData.ID ) == null ) + { + isNew = true; + } + ContactosData c = ( ContactosData )estabelecimento.toContacto_id(); + c.save(); + if( estabelecimento.toEmpresa_id() == null ) + { + JOptionPane.showMessageDialog( this, "Erro a guardar estabelecimento (NULL).", "Erro...", + JOptionPane.ERROR_MESSAGE ); + return false; + } + estabelecimento.set( EstabelecimentosData.NOME_PLAIN, + com.evolute.utils.strings.StringPlainer.convertString( ( String ) + estabelecimento.get( EstabelecimentosData.NOME ) ) ); + estabelecimento.save(); + estabelecimentoPanel.postSave(); + if( isNew ) + { + trabalhadorPanel.setEstabelecimento( estabelecimento ); + } + break; + + case INDEX_TRABALHADOR: + trabalhador = (TrabalhadoresData) object; + trabalhador.set( TrabalhadoresData.NOME_PLAIN, + com.evolute.utils.strings.StringPlainer.convertString( ( String ) + trabalhador.get( TrabalhadoresData.NOME ) ) ); + trabalhador.save(); + trabalhadorPanel.postSave(); + break; + + default: + ( ( JDOObject )object ).save(); + } +// object.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + return false; + } + //reload( index ); + return true; + } + + public void enableComponents( int index, boolean enable ) + { + panels[ index ].setEnabled( enable ); + avisos.setEnabled( !empresaPanel.isEnabled() && !estabelecimentoPanel.isEnabled() && !trabalhadorPanel.isEnabled(), + AvisoConstants.TIPO_EMPRESA ); + } + + public void clear( int index ) + { + panels[ index ].fill( null ); + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + Integer id; + if( source.equals( empresaPanel ) ) + { + id = empresaPanel.getSelectedEstabelecimento(); + if( id != null ) + { + select( INDEX_ESTABELECIMENTO ); + try + { + estabelecimento = ( EstabelecimentosData ) JDO.load( EstabelecimentosData.class, id ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar o estabelecimento", true ); + estabelecimento = null; + } + + } + else + { + estabelecimento = null; + } + reload( INDEX_ESTABELECIMENTO ); + } + else if( source.equals( trabalhadorPanel ) ) + { + id = trabalhadorPanel.getSelectedTrabalhador(); +//System.out.println( "trabalhadorid: " + id ); + if( id != null ) + { + try + { + trabalhador = (TrabalhadoresData) JDO.load( TrabalhadoresData.class, id ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar o trabalhador", true ); + trabalhador = null; + } + select( INDEX_TRABALHADOR ); + } + else + { + trabalhador = null; + } + + reload( INDEX_TRABALHADOR ); + } + } + + public boolean delete( int index ) + { + String yes = "Sim"; + String no = "N\u00e3o"; + switch( index ) + { + case INDEX_EMPRESA: + if( empresa == null ) + { + return false; + } + if( JOptionPane.showOptionDialog( + this, "Tem a certeza que quer apagar esta Empresa?", "Apagar Empresa...", + JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, new String[]{ no, yes }, no ) == 1 ) + { + try + { + empresa.delete(); + empresa = null; + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a apagar", true ); + return false; + } + return true; + } + break; + case INDEX_ESTABELECIMENTO: + if( estabelecimento == null ) + { + return false; + } + if( JOptionPane.showOptionDialog( + this, "Tem a certeza que quer apagar este Estabelecimento?", "Apagar Estabelecimento...", + JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, new String[]{ no, yes }, no ) == 1 ) + { + try + { + estabelecimento.delete(); + estabelecimento = null; + reload( INDEX_EMPRESA ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a apagar", true ); + return false; + } + return true; + } + break; + case INDEX_TRABALHADOR: + if( trabalhador == null ) + { + return false; + } + if( JOptionPane.showOptionDialog( + this, "Tem a certeza que quer apagar este Trabalhador?", "Apagar Trabalhador...", + JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, new String[]{ no, yes }, no ) == 1 ) + { + try + { + TrabalhadoresData trabalhadorAux = trabalhador; + trabalhador = null; + trabalhadorAux.delete(); + + reload( INDEX_ESTABELECIMENTO ); + try + { + trabalhadorPanel.reloaList(); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a apagar", true ); + return false; + } + return true; + } + break; + } + return false; + } + + private void excel() + { + FileDialog fd = new FileDialog( this, "Escolha um ficheiro Excel:", FileDialog.LOAD ); + fd.setDirectory( System.getProperty( "user.home" ) ); + fd.setFilenameFilter( new FilenameFilter() { + public boolean accept( File dir, String name ) + { + return (name!=null) && (name.indexOf( ".xls" ) != -1); + } + } ); + fd.setVisible( true ); + //String filename = "c:\\test.xls"; + String filename = fd.getFile(); + if( filename != null ) + { + filename = fd.getDirectory() + File.separator + filename; + try + { + Importer importer = new Importer( this, filename, true, Importer.TYPE_ADMISSAO ); + Hashtable hash[] = importer.getMultipleData(); + Vector activate = new Vector(); + if( hash != null ) + { + // load all (active) trabalhadores for this company + IDObject trab[] = ( ( FichaDataProvider )FichaDataProvider.getProvider() + ).getAllTrabalhadoresForEmpresa( + ( Integer )empresa.get( EmpresasData.ID ) ); + Hashtable trabalhadores = new Hashtable(); + for( int i = 0; i < trab.length; ++i ) + { + trabalhadores.put( trab[ i ].toString().trim().toLowerCase(), trab[ i ].getID() ); + } + // load all active estabelecimentos for this company + IDObject estab[] = ( ( FichaDataProvider )FichaDataProvider.getProvider() + ).getAllEstabelecimentosForEmpresa( + ( Integer )empresa.get( EmpresasData.ID ) ); + Hashtable estabelecimentos = new Hashtable(); + for( int i = 0; i < estab.length; ++i ) + { + estabelecimentos.put( estab[ i ].toString().trim().toLowerCase(), estab[ i ].getID() ); + } + Hashtable estabCache = new Hashtable(); + for( int i = 0; i < hash.length; ++i ) + { +// if( hash[ i ] == null ) +// { +// continue; +// } + for( int j = 0; j < Importer.NAMES.length; ++j ) + { + if( hash[ i ] == null ) + { + continue; + } + Object value = hash[ i ].remove( Importer.NAMES[ j ] ); + if( Importer.NAMES[ j ].equals( Importer.NOME ) ) + { + if( value != null + && trabalhadores.get( value.toString().trim().toLowerCase() ) == null ) + { + trabalhadores.put( value.toString().trim().toLowerCase(), value ); + + hash[ i ].put( TR_IMPORT_NAMES_TO_TRAB.get( Importer.NOME ), + value.toString().trim() ); + hash[ i ].put( TrabalhadoresData.NOME_PLAIN, + com.evolute.utils.strings.StringPlainer.convertString( value.toString().trim(), false, false ) ); + } + else + { + Integer tID = (Integer) trabalhadores.get( value.toString().trim().toLowerCase() ); + if( tID != null ) + { + activate.add( tID ); + } + hash[ i ] = null; + } + } + else if( Importer.NAMES[ j ].equals( Importer.LOCAL_TRABALHO ) ) + { + if( value == null ) + { + value = "sede"; + } + Integer eid = ( Integer )estabelecimentos.get( value.toString().trim().toLowerCase() ); + EstabelecimentosData esta; + if( eid == null ) + { + // save this estab + esta = new EstabelecimentosData(); + esta.setToEmpresa_id( empresa ); + esta.set( EstabelecimentosData.NOME, value.toString().trim() ); + esta.set( EstabelecimentosData.NOME_PLAIN, com.evolute.utils.strings.StringPlainer.convertString( value.toString().trim(), false, false ) ); + esta.save(); + estabelecimentos.put( value.toString().trim().toLowerCase(), + esta.get( EstabelecimentosData.ID ) ); + + } + else + { + esta = ( EstabelecimentosData )estabCache.get( value ); + if( esta == null ) + { + esta = (EstabelecimentosData) JDO.load( EstabelecimentosData.class, eid ); + estabCache.put( value, esta ); + } + } + hash[ i ].put( TrabalhadoresData.TO_ESTABELECIMENTO_ID, esta ); + hash[ i ].put( TR_IMPORT_NAMES_TO_TRAB.get( Importer.LOCAL_TRABALHO ), + value.toString().trim() ); + } + else + { + if( Importer.NAMES[ j ].indexOf( Importer.DATA_PREFIX ) == 0 ) + { + value = DateUtils.guessDate( (String)value ); + if( value != null ) + { + hash[ i ].put( TR_IMPORT_NAMES_TO_TRAB.get( Importer.NAMES[ j ] ), + value ); + } + } + else + { + if( Importer.NAMES[ j ].equals( Importer.SEXO ) ) + { + if( value == null || ( (String) value ).length() == 0 ) + { + value = "m"; + } + else + { + value = ( (String) value ).substring(0,1).toLowerCase(); + if( !value.equals( "m" ) && !value.equals( "f" ) ) + { + value = "m"; + } + } + } + if( value != null ) + { + hash[ i ].put( TR_IMPORT_NAMES_TO_TRAB.get( Importer.NAMES[ j ] ), + value.toString().trim() ); + } + } + } + } + } + for( int i = 0; i < hash.length; ++i ) + { + if( hash[ i ] == null ) + { + continue; + } + // save trab + TrabalhadoresData tr = new TrabalhadoresData(); + tr.setHashData( hash[ i ] ); +// o estabelecimento nao faz parte da lista por causa do UI + tr.set( TrabalhadoresData.TO_ESTABELECIMENTO_ID, hash[ i ].get( TrabalhadoresData.TO_ESTABELECIMENTO_ID ) ); + tr.set( TrabalhadoresData.PERFIL, new Integer( 1 ) ); +// System.out.println( "T: " + i + "\n" + tr.debug() ); + tr.save(); + } + for( int i = 0; i < activate.size(); i++ ) + { + TrabalhadoresData trabalhadorR = (TrabalhadoresData)JDO.load( TrabalhadoresData.class, ( Integer ) activate.elementAt( i ) ); + trabalhadorR.set( TrabalhadoresData.INACTIVO, "n" ); + trabalhadorR.save(); + } + } + reload( INDEX_EMPRESA ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + JOptionPane.showMessageDialog( this, "Erro a importar", "Erro...", JOptionPane.ERROR_MESSAGE ); + } + } + + } + + private void excelDemissoes() + { + FileDialog fd = new FileDialog( this, "Escolha um ficheiro Excel:", FileDialog.LOAD ); + fd.setDirectory( System.getProperty( "user.home" ) ); + fd.setFilenameFilter( new FilenameFilter() { + public boolean accept( File dir, String name ) + { + return (name!=null) && (name.indexOf( ".xls" ) != -1); + } + } ); + fd.setVisible( true ); + //String filename = "c:\\test.xls"; + String filename = fd.getFile(); + if( filename != null ) + { + filename = fd.getDirectory() + File.separator + filename; + try + { + Importer importer = new Importer( this, filename, true, Importer.TYPE_DEMISSAO ); + Hashtable hash[] = importer.getMultipleData(); + Vector invalidos = new Vector(); + Vector validos = new Vector(); + Vector semData = new Vector(); + if( hash != null ) + { + // load all (active) trabalhadores for this company + IDObject trab[] = ( ( FichaDataProvider )FichaDataProvider.getProvider() + ).getAllTrabalhadoresForEmpresa( + ( Integer )empresa.get( EmpresasData.ID ) ); + Hashtable trabalhadores = new Hashtable(); + for( int i = 0; i < trab.length; ++i ) + { + trabalhadores.put( StringPlainer.convertString( + trab[ i ].toString().trim().toLowerCase() ), trab[ i ].getID() ); + } + Hashtable estabCache = new Hashtable(); + for( int i = 0; i < hash.length; ++i ) + { +// if( hash[ i ] == null ) +// { +// continue; +// } + for( int j = 0; j < Importer.NAMES_DEMISSAO.length; ++j ) + { + if( hash[ i ] == null ) + { + continue; + } + Object value = hash[ i ].remove( Importer.NAMES_DEMISSAO[ j ] ); + if( Importer.NAMES_DEMISSAO[ j ].equals( Importer.NOME ) ) + { +System.out.println( "VALUE NOME: " + value ); + if( value != null + && !trabalhadores.containsKey( StringPlainer.convertString( value.toString().trim().toLowerCase() ) ) ) + { + invalidos.add( new String[]{ value.toString().trim(), + StringPlainer.convertString( value.toString().trim(), false, false ) } ); + hash[ i ] = null; + } + else if( value != null ) + { + Integer tID = (Integer) trabalhadores.get( StringPlainer.convertString( value.toString().trim().toLowerCase() ) ); + hash[ i ].put( TrabalhadoresData.ID, tID ); + validos.add( new String[]{ value.toString().trim(), + StringPlainer.convertString( value.toString().trim(), false, false ) } ); + } + else + { + hash[ i ] = null; + } + } + else if( Importer.NAMES_DEMISSAO[ j ].equals( Importer.DATA_DEMISSAO ) ) + { + value = DateUtils.guessDate( (String)value ); + if( value != null ) + { + hash[ i ].put( TR_IMPORT_NAMES_TO_DEMISSOES.get( Importer.NAMES_DEMISSAO[ j ] ), + value ); + } + else + { + hash[ i ] = null; + validos.removeElementAt( validos.size() - 1 ); + semData.add( new String[]{ value.toString().trim(), + StringPlainer.convertString( value.toString().trim(), false, false ) } ); + } + } + } + } +//System.out.println( "HASH.LENGTH: " + hash.length ); + for( int i = 0; i < hash.length; ++i ) + { +//System.out.println( "HASH[ " + i + " ]: " + hash[ i ] ); + if( hash[ i ] == null ) + { +//System.out.println( "TRABALHADOR:continue" ); + continue; + } +//System.out.println( "TRABALHADOR:not continue" ); + TrabalhadoresData tr = (TrabalhadoresData)JDO.load( TrabalhadoresData.class, ( Integer ) hash[ i ].get( TrabalhadoresData.ID ) ); +//System.out.println( "TRABALHADORID: " + tr.get( TrabalhadoresData.ID ) ); + tr.set( TrabalhadoresData.DATA_DEMISSAO, hash[ i ].get( TrabalhadoresData.DATA_DEMISSAO ) ); +//System.out.println( "TRABALHADORDEMISSAO: " + tr.get( TrabalhadoresData.DATA_DEMISSAO ) ); + tr.save(); + } + StringBuffer buff = new StringBuffer( "" ); + buff.append( "Demitidos:\n" ); + for( int i = 0; i < validos.size(); i++ ) + { + buff.append( ( ( String [] ) validos.elementAt( i ) )[ 1 ] + "\n" ); + } + buff.append( "\nSem data ou data inv\u00e1lida:\n" ); + for( int i = 0; i < semData.size(); i++ ) + { + buff.append( ( ( String [] ) semData.elementAt( i ) )[ 1 ] + "\n" ); + } + buff.append( "\nN\u00e3o encontrados na base de dados:\n" ); + for( int i = 0; i < invalidos.size(); i++ ) + { + buff.append( ( ( String [] ) invalidos.elementAt( i ) )[ 1 ] + "\n" ); + } + new LongMessageDialog( this, false, buff.toString(), new Dimension( 600, 500 ) ); + } + reload( INDEX_EMPRESA ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + JOptionPane.showMessageDialog( this, "Erro a importar", "Erro...", JOptionPane.ERROR_MESSAGE ); + } + } + + } + + public void mudarEstabelecimento() + { + ListAction lAction = new ListAction(){ + public String getListActionName() + { + return "Escolher"; + } + + public boolean executeListAction( int line, Object value ) + { + if( trabalhador == null ) + { + return false; + } + try + { + EstabelecimentosData eatabelecimentoNovo = (EstabelecimentosData)JDO.load( EstabelecimentosData.class, ( (IDObject)value ).getID() ); + trabalhador.set( TrabalhadoresData.TO_ESTABELECIMENTO_ID, eatabelecimentoNovo ); + trabalhador.save(); + trabalhador = null; + reload( INDEX_ESTABELECIMENTO ); + trabalhadorPanel.reloaList(); + } + catch( Exception ex ) + { + ex.printStackTrace(); + return false; + } + return true; + } + }; + + try + { + IDObject estab[] = ( ( FichaDataProvider )FichaDataProvider.getProvider() + ).getAllEstabelecimentosForEmpresa( + ( Integer )empresa.get( EmpresasData.ID ) ); + ListActionDialog dialog = new ListActionDialog( this, "Escolher Estabelecimento", new String []{ "Designa\u00e7\u00e3o" }, + new Vector( Arrays.asList( estab ) ), lAction ); + dialog.setSize( 250, 200 ); + dialog.setVisible( true ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + + public void setJDOObject( Persistent object ) + { + empresa = null; + estabelecimento = null; + trabalhador = null; + reload(0); + if( object instanceof TrabalhadoresData ) + { + tabbedPane.setSelectedIndex( 1 ); + trabalhador = (TrabalhadoresData) object; + estabelecimento = (EstabelecimentosData)trabalhador.toEstabelecimento_id(); + empresa = (EmpresasData)estabelecimento.toEmpresa_id(); + } + else if( object instanceof EstabelecimentosData ) + { + tabbedPane.setSelectedIndex( 0 ); + estabelecimento = (EstabelecimentosData)object; + empresa = (EmpresasData)estabelecimento.toEmpresa_id(); + } + else if( object instanceof EmpresasData ) + { + empresa = (EmpresasData)object; + } + if( empresa != null ) + { + try + { + elementosProtocolo = + clientesProvider.getElementosProtocoloForEmpresa( + ( Integer ) empresa.get( EmpresasData.ID ), 2 ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados do protocolo.", true ); + elementosProtocolo = new Integer[2][0]; + } + } + reload(0); + if( empresa != null ) + { + select( INDEX_EMPRESA ); + } + if( estabelecimento != null ) + { + empresaPanel.setSelectedEstabelecimento( estabelecimento ); + } + if( trabalhador != null ) + { + trabalhadorPanel.setSelectedTrabalhador( trabalhador ); + } + } + + public void postSetup() + { + } + + public void restaurarEmpresa() + { + ListAction lAction = new ListAction(){ + public String getListActionName() + { + return "Restaurar"; + } + + public boolean executeListAction( int line, Object value ) + { + try + { + EmpresasData empresaR = (EmpresasData)JDO.load( EmpresasData.class, ( (IDObject)value ).getID() ); + empresaR.set( EmpresasData.INACTIVO, "n" ); + empresaR.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a restaurar a Empresa", true ); + return false; + } + return true; + } + }; + + try + { + IDObject empresas[] = ( ( FichaDataProvider )FichaDataProvider.getProvider() + ).getAllEmpresasDeleted(); + ListActionDialog dialog = new ListActionDialog( this, "Restaurar Empresa", new String []{ "Designa\u00e7\u00e3o Social" }, + new Vector( Arrays.asList( empresas ) ), lAction ); + dialog.setSize( 250, 200 ); + dialog.setVisible( true ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a criar lista de Empresas", true ); + ex.printStackTrace(); + } + } + + public void restaurarEstabelecimento() + { + ListAction lAction = new ListAction(){ + public String getListActionName() + { + return "Restaurar"; + } + + public boolean executeListAction( int line, Object value ) + { + try + { + EstabelecimentosData estabelecimentoR = (EstabelecimentosData)JDO.load( EstabelecimentosData.class, ( (IDObject)value ).getID() ); + estabelecimentoR.set( EstabelecimentosData.INACTIVO, "n" ); + estabelecimentoR.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a restaurar o Estabelecimento", true ); + return false; + } + return true; + } + }; + if( empresa == null ) + { + return; + } + try + { + IDObject estabelecimentos[] = ( ( FichaDataProvider )FichaDataProvider.getProvider() + ).getAllEstabelecimentosDeletedForEmpresa( ( Integer ) empresa.get( EmpresasData.ID ) ); + ListActionDialog dialog = new ListActionDialog( this, "Restaurar Estabelecimento", new String []{ "Nome" }, + new Vector( Arrays.asList( estabelecimentos ) ), lAction ); + dialog.setSize( 250, 200 ); + dialog.setVisible( true ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a criar lista de Estabelecimentos", true ); + ex.printStackTrace(); + } + } + + public void restaurarTrabalhador() + { + ListAction lAction = new ListAction(){ + public String getListActionName() + { + return "Restaurar"; + } + + public boolean executeListAction( int line, Object value ) + { + try + { + TrabalhadoresData trabalhadorR = (TrabalhadoresData)JDO.load( TrabalhadoresData.class, ( (IDObject)value ).getID() ); + trabalhadorR.set( TrabalhadoresData.INACTIVO, "n" ); + trabalhadorR.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a restaurar o Trabalhador", true ); + return false; + } + return true; + } + }; + if( estabelecimento == null ) + { + return; + } + try + { + IDObject trabalhadores[] = ( ( FichaDataProvider )FichaDataProvider.getProvider() + ).getAllTrabalhadoresDeletedForEstabelecimento( ( Integer ) estabelecimento.get( EstabelecimentosData.ID ) ); + ListActionDialog dialog = new ListActionDialog( this, "Restaurar Trabalhador", new String []{ "Nome" }, + new Vector( Arrays.asList( trabalhadores ) ), lAction ); + dialog.setSize( 250, 200 ); + dialog.setVisible( true ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a criar lista de Trabalhadores", true ); + ex.printStackTrace(); + } + } + + protected void utilizadorWeb( boolean siprp ) + { +// new Exception().printStackTrace(); + if( !siprp && empresa == null ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher uma empresa", "Erro...", + JOptionPane.ERROR_MESSAGE ); + } + try + { + + UserWindow window = new UserWindow( this, siprp ? null : ( Integer ) empresa.get( EmpresasData.ID ) ); + window.setVisible( true ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a estabelecer a liga\u00e7\u00e3o com a p\u00e1gina", true ); + } + } + + public void noticias() + { + try + { + NoticiasDialog dialog = new NoticiasDialog( this ); + dialog.setVisible( true ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar not\u00edcias", true ); + } + } + + public void imprimirFicha() + { + ListAction lAction = new ListAction(){ + public String getListActionName() + { + return "Escolher"; + } + + public boolean executeListAction( int line, Object value ) + { + if( trabalhador == null ) + { + return false; + } + try + { + printFicha(( (IDObject)value ).getID() ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + return false; + } + return true; + } + }; + if( trabalhador == null ) + { + return; + } + Vector linhas; + try + { + IDObject fichas[] = ( ( FichaDataProvider )FichaDataProvider.getProvider() + ).getAllFichasForTrabalhador( ( Integer ) trabalhador.get( TrabalhadoresData.ID ) ); + linhas = new Vector( Arrays.asList( fichas ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a criar lista de Fichas anteriores", true ); + return; + } + ListActionDialog dialog = new ListActionDialog( this, "Imprimir Fichas Anteriores", new String[]{ "Data" }, + linhas, lAction ); + dialog.setSize( 250, 200 ); + dialog.setVisible( true ); + } + + private void printFicha( Integer exameID ) + throws Exception + { +// MetaObject exame = fdpProvider.load( fdpProvider.EXAMES, new DBKey( exameID ) ); + ExamesData exame = (ExamesData) JDO.load( ExamesData.class, exameID ); + byte pdf[] = (byte []) exame.get( ExamesData.PDF ); + if( exame == null ) + { + throw new Exception( "N\u00e3o existe exame" ); + } + TrabalhadoresData trabalhadorExame = exame.toTrabalhador_id(); + String nomeFicheiro = StringPlainer.convertString( ( String ) trabalhadorExame.get( TrabalhadoresData.NOME ) ); + nomeFicheiro.replaceAll( " ", "_" ); + ExamePDF ePDF = new ExamePDF(); + ePDF.print( pdf, nomeFicheiro ); + } + + public void setTracker( SIPRPTracker tracker ) + { + this.tracker = tracker; + estabelecimentoPanel.setTracker( tracker ); + trabalhadorPanel.setTracker( tracker ); + } + + public void imprimirEtiquetaTrabalhador() + { + if( trabalhador == null ) + { + return; + } + String nomeEmpresa = ( ( String ) empresa.get( EmpresasData.DESIGNACAO_SOCIAL ) ); + String nomeTrabalhador = ( ( String ) trabalhador.get( TrabalhadoresData.NOME ) ); + String numeroMecanografico = ( ( String ) trabalhador.get( TrabalhadoresData.NUMERO_MECANOGRAFICO ) ); + String sexo = "m".equals( trabalhador.get( TrabalhadoresData.SEXO ) ) ? "M" : "F"; + Date data = ( Date ) trabalhador.get( TrabalhadoresData.DATA_NASCIMENTO ); + String dataNascimento = data != null ? DF.format( data ) : "--"; + String nacionalidade = ( String ) trabalhador.get( TrabalhadoresData.NACIONALIDADE ); + data = ( Date ) trabalhador.get( TrabalhadoresData.DATA_ADMISSAO ); + String dataAdmissao = data != null ? DF.format( data ) : "--"; + String categoria = ( String ) trabalhador.get( TrabalhadoresData.CATEGORIA ); + String funcao = ( String ) trabalhador.get( TrabalhadoresData.FUNCAO_PROPOSTA ); + try + { + Integer id = clientesProvider.getEtiquetaID(); + EtiquetasData etiqueta = (EtiquetasData) JDO.load( EtiquetasData.class, id ); + EtiquetaPrinter printer = new EtiquetaPrinter( etiqueta ); + Vector linhas = new Vector(); + linhas.add( new Object[]{ nomeEmpresa, new Double( 1.0 ) } ); + linhas.add( new Object[]{ nomeTrabalhador, new Double( 1.0 ) } ); + linhas.add( new Object[]{ "N\u00ba mec.:" + ( numeroMecanografico != null ? numeroMecanografico.toString() : "" ), new Double( 0.80 ), + "Sexo:" + sexo, new Double( 0.20 ) } ); + linhas.add( new Object[]{ "Data nasc:" + dataNascimento, new Double( 0.4 ), + "Nacionalidade:" + nacionalidade, new Double( 0.85 ) } ); + linhas.add( new Object[]{ "Data adm.:" + dataAdmissao, new Double( 0.4 ), + "Categoria:" + categoria, new Double( 0.6 ) } ); + linhas.add( new Object[]{ "Fun\u00e7\u00e3o:" + funcao, new Double( 1.0 ) } ); + printer.print( linhas ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar etiqueta.", true ); + } + } + + public void imprimirEtiquetaEstabelecimento() + { + if( estabelecimento == null ) + { + return; + } + String nomeEmpresa = ( ( String ) empresa.get( EmpresasData.DESIGNACAO_SOCIAL ) ); + String nomeEstabelecimento = ( ( String ) estabelecimento.get( EstabelecimentosData.NOME ) ); + ContactosData contacto = estabelecimento.toContacto_id(); + String nomeContacto = ""; + if( contacto != null ) + { + nomeContacto = ( String )contacto.get( ContactosData.NOME ); + } + String morada = ( ( String ) estabelecimento.get( EstabelecimentosData.MORADA ) ); + String codigoPostal = ( ( String ) estabelecimento.get( EstabelecimentosData.CODIGO_POSTAL ) ); + String local = ( ( String ) estabelecimento.get( EstabelecimentosData.LOCALIDADE ) ); + + try + { + Integer id = clientesProvider.getEtiquetaID(); + EtiquetasData etiqueta = ( EtiquetasData ) JDO.load( EtiquetasData.class, id ); + EtiquetaPrinter printer = new EtiquetaPrinter( etiqueta ); + Vector linhas = new Vector(); + linhas.add( new Object[]{ nomeEmpresa, new Double( 1.0 ) } ); + linhas.add( new Object[]{ nomeContacto, new Double( 1.0 ) } ); + linhas.add( new Object[]{ morada, new Double( 1.0 ) } ); + linhas.add( new Object[]{ codigoPostal + " " + local, new Double( 1.0 ) } ); + printer.print( linhas ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar etiqueta.", true ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/ContactoPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/ContactoPanel.java new file mode 100644 index 00000000..7f53d204 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/ContactoPanel.java @@ -0,0 +1,191 @@ +/* + * ContactoPanel.java + * + * Created on 14 de Maio de 2004, 15:26 + */ + +package siprp.clientes; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.util.HashMap; +import java.util.Map; + +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import siprp.data.outer.ContactosData; + +import com.evolute.utils.dataui.ComponentController; +import com.evolute.utils.dataui.ComponentsHashtable; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.ui.text.CopyPasteHandler; +/** + * + * @author fpalma + */ +public class ContactoPanel extends JPanel implements ControllableComponent +{ + + private static final long serialVersionUID = 1L; + + private ContactosData contacto; + private ComponentsHashtable components; + + private JTextField nomeText; + private JTextField cargoText; + private JTextField telefoneText; + private JTextField telemovelText; + private JTextField faxText; + private JTextField emailText; + + /** Creates a new instance of ContactoPanel */ + public ContactoPanel() + { + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + { + JLabel nomeLabel = new JLabel( "Nome" ); + nomeText = new JTextField(); + JLabel cargoLabel = new JLabel( "Cargo" ); + cargoText = new JTextField(); + JLabel telefoneLabel = new JLabel( "Telef." ); + telefoneText = new JTextField(); + JLabel telemovelLabel = new JLabel( "Tlm." ); + telemovelText = new JTextField(); + JLabel faxLabel = new JLabel( "Fax" ); + faxText = new JTextField(); + JLabel emailLabel = new JLabel( "Email" ); + emailText = new JTextField(); + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridheight = 1; + constraints.weighty = 0; + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( nomeLabel, constraints ); + add( nomeLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( nomeText, constraints ); + add( nomeText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( cargoLabel, constraints ); + add( cargoLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( cargoText, constraints ); + add( cargoText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( telefoneLabel, constraints ); + add( telefoneLabel ); + + constraints.weightx = .5; + constraints.gridwidth = 1; + gridbag.setConstraints( telefoneText, constraints ); + add( telefoneText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( telemovelLabel, constraints ); + add( telemovelLabel ); + + constraints.weightx = .5; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( telemovelText, constraints ); + add( telemovelText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( faxLabel, constraints ); + add( faxLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( faxText, constraints ); + add( faxText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( emailLabel, constraints ); + add( emailLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( emailText, constraints ); + add( emailText ); + + new CopyPasteHandler( nomeText ); + new CopyPasteHandler( cargoText ); + new CopyPasteHandler( telefoneText ); + new CopyPasteHandler( telemovelText ); + new CopyPasteHandler( faxText ); + new CopyPasteHandler( emailText ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( ContactosData.NOME, nomeText ); + components.putComponent( ContactosData.CARGO, cargoText ); + components.putComponent( ContactosData.TELEFONE, telefoneText ); + components.putComponent( ContactosData.TELEMOVEL, telemovelText ); + components.putComponent( ContactosData.FAX, faxText ); + components.putComponent( ContactosData.EMAIL, emailText ); + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + contacto = null; + } + + public void fill(Object value) + { + clear(); + contacto = ( ContactosData ) value; + if( contacto == null ) + { + return; + } + String names[] = contacto.getFieldNames(); + ComponentController.fill( names, contacto.getHashData(), components ); + } + + public Object save() + { + if( contacto == null ) + { + contacto = new ContactosData(); + } + + String names[] = contacto.getFieldNames(); + Map hash = new HashMap(); + ComponentController.save( names, hash, components ); + contacto.setHashData( hash ); + return contacto; + } + + public void setEnabled( boolean enable ) + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/EmpresaPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/EmpresaPanel.java new file mode 100644 index 00000000..9c4f5d33 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/EmpresaPanel.java @@ -0,0 +1,989 @@ +/* + * EmpresaPanel.java + * + * Created on 12 de Maio de 2004, 19:08 + */ + +package siprp.clientes; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.Insets; +import java.util.Arrays; +import java.util.Collection; +import java.util.Map; +import java.util.Vector; + +import javax.swing.BorderFactory; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import siprp.FichaDataProvider; +import siprp.SingletonConstants; +import siprp.data.outer.EmpresasData; +import siprp.data.outer.EstabelecimentosData; +import siprp.data.outer.ImageData; +import siprp.data.outer.MarcacoesEmpresaData; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.dataui.ComponentController; +import com.evolute.utils.dataui.ComponentsHashtable; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.documents.DoubleDocument; +import com.evolute.utils.documents.IntegerDocument; +import com.evolute.utils.documents.MaximumLengthDocument; +import com.evolute.utils.error.ErrorLogger; +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.ColumnizedObject; +import com.evolute.utils.tables.VectorTableModel; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import com.evolute.utils.ui.text.CopyPasteHandler; +import com.evolute.utils.ui.text.StateTextField; + +/** + * + * @author fpalma + */ +public class EmpresaPanel extends JPanel + implements ControllableComponent, ListSelectionListener +{ + + private static final long serialVersionUID = 1L; + + private static final String STRING_TRABALHADORES_ACTIVOS = "Trabalhadores activos"; + + private ProviderInterface objectProvider; + + private FichaDataProvider provider; + private EmpresasData empresa; + private ComponentsHashtable components; + + private Integer id; + + private JTextField designacaoSocialText; + private JTextField moradaText; + private JTextField codigoPostalText; + private JTextField localText; + private JTextField distritoText; + private JTextField concelhoText; + private JTextField codigo1Text; + private JTextField codigo2Text; + private JTextField codigo3Text; +// private JTextField perfil1Text; +// private JTextField perfil2Text; + private JComboBox servicosCombo; + private JTextField precoHigieneText; + private JTextField precoMedicinaText; + private JTextField modalidadePagamentoText; + private ContactoPanel contacto1Panel; + private ContactoPanel contacto2Panel; + private JCalendarPanel envioPropostaPanel; + private JCalendarPanel aceitacaoPropostaPanel; + private JCalendarPanel inicioContratoPanel; + private JTextField duracaoContratoText; + private JCalendarPanel cancelamentoPanel; + private JCalendarPanel envioContratoPanel; + private JCalendarPanel recepcaoContratoPanel; + private JCalendarPanel envioIdictPanel; + private JCalendarPanel relatorioAnualPanel; + private JTextField caeText; + private JTextField actividadeText; + private JTextField contribuinteText; + private JTextField segSocialText; + private JPanel marcacoesPanel; + private JPanel listaMarcacoesPanel; + private BaseTable marcacoesTable; + private MarcacaoEmpresaPanel marcacaoPanel; + private CardLayout marcacoesCardLayout; + private ProtocoloPanel protocoloPanel; + + private final ImagePanel logotipo = new ImagePanel( true ); + private final JLabel labelTrabalhadoresActivos = new JLabel( getTextForTrabalhadoresActivos(0) ); +// private UserPanel userPanel; + + private BaseTable estabelecimentosTable; + private VectorTableModel estabelecimentosModel; + + private boolean webAware; + + private Vector listSelectionListeners; + + /** Creates a new instance of EmpresaPanel */ + public EmpresaPanel() + throws Exception + { + webAware = ( ( Boolean ) Singleton.getInstance( SingletonConstants.WEB_AWARE ) ).booleanValue(); + provider = (FichaDataProvider)FichaDataProvider.getProvider(); + listSelectionListeners = new Vector(); + objectProvider = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + setupComponentsHashtable(); + } + + private String getTextForTrabalhadoresActivos( long numTrabalhadoresActivos ) + { + return STRING_TRABALHADORES_ACTIVOS + " (" + numTrabalhadoresActivos + ")"; + } + + private void setupComponents() + throws Exception + { + String codeFormat = ( String ) Singleton.getInstance( SingletonConstants.CODIGO_EMPRESA_FORMAT ); + String formatElements[] = codeFormat.split( " " ); + int formatFieldLengths[] = new int[ formatElements.length ]; + String fieldSeparators[] = new String[ formatElements.length ]; + int n1 = 0; + int n2 = 0; + for( ; n1 < formatElements.length; n1++ ) + { + try + { + formatFieldLengths[ n2 ] = Integer.parseInt( formatElements[ n1 ] ); + n2++; + } + catch( NumberFormatException ex ) + { + fieldSeparators[ n2 - 1 ] = formatElements[ n1 ]; + } + } + int countFields = n2; + + JLabel designacaoSocialLabel = new JLabel( "Designa\u00e7\u00e3o Social" ); + designacaoSocialText = new StateTextField(); + JLabel codigoLabel = new JLabel( "C\u00f3digo" ); + JPanel codigoPanel = new JPanel(); + codigo1Text = new StateTextField(); + if( countFields > 0 && formatFieldLengths[ 0 ] > 0 ) + { + codigo1Text.setDocument( new MaximumLengthDocument( formatFieldLengths[ 0 ] ) ); + } + codigo2Text = new StateTextField(); + if( countFields > 1 && formatFieldLengths[ 1 ] > 0 ) + { + codigo2Text.setDocument( new MaximumLengthDocument( formatFieldLengths[ 1 ] ) ); + } + codigo3Text = new StateTextField(); + if( countFields > 2 && formatFieldLengths[ 2 ] > 0 ) + { + codigo3Text.setDocument( new MaximumLengthDocument( formatFieldLengths[ 2 ] ) ); + } +// JLabel perfisLabel = new JLabel( "Perfis (A/B)" ); +// perfil1Text = new JTextField(); +// JLabel perfil2Label = new JLabel( "/" ); +// perfil2Text = new JTextField(); + servicosCombo = new JComboBox(); + servicosCombo.setPreferredSize( new Dimension( 120, 20 ) ); + + JLabel precoLabel = new JLabel( "Pre\u00e7os" ); + JLabel precoHigieneLabel = new JLabel( " Higiene" ); + precoHigieneText = new JTextField(); + precoHigieneText.setDocument( new DoubleDocument( 15, true ) ); + JLabel higieneEuroLabel = new JLabel( "\u20ac" ); + JLabel precoMedicinaLabel = new JLabel( " Medicina" ); + precoMedicinaText = new JTextField(); + precoMedicinaText.setDocument( new DoubleDocument( 15, true ) ); + JLabel medicinaEuroLabel = new JLabel( "\u20ac" ); + JLabel modalidadePagamentoLabel = new JLabel( "Periodicidade" ); + modalidadePagamentoText = new JTextField(); + + JLabel moradaLabel = new JLabel( "Morada" ); + moradaText = new StateTextField(); + JLabel codigoPostalLabel = new JLabel( "C\u00f3digo Postal" ); + codigoPostalText = new StateTextField(); + codigoPostalText.setPreferredSize( new Dimension( 50, 20 ) ); + codigoPostalText.setDocument( new MaximumLengthDocument( 8 ) ); + JLabel localLabel = new JLabel( "Localidade" ); + localText = new StateTextField(); + JLabel distritoLabel = new JLabel( "Distrito" ); + distritoText = new JTextField(); + JLabel concelhoLabel = new JLabel( "Concelho" ); + concelhoText = new JTextField(); + contacto1Panel = new ContactoPanel(); + contacto1Panel.setBorder( BorderFactory.createEtchedBorder() ); + contacto2Panel = new ContactoPanel(); + contacto2Panel.setBorder( BorderFactory.createEtchedBorder() ); + JLabel envioPropostaLabel = new JLabel( "Proposta" ); + envioPropostaPanel = new JCalendarPanel( null ); + JLabel aceitacaoPropostaLabel = new JLabel( "Aceita\u00e7\u00e3o" ); + aceitacaoPropostaPanel = new JCalendarPanel( null ); + JLabel inicioContratoLabel = new JLabel( "In\u00edcio" ); + inicioContratoPanel = new JCalendarPanel( null ); + JLabel duracaoContratoLabel = new JLabel( "Dura\u00e7\u00e3o (meses)" ); + duracaoContratoText = new JTextField(); + duracaoContratoText.setDocument( new IntegerDocument( 5, false ) ); + JLabel cancelamentoLabel = new JLabel( "Cancelamento" ); + cancelamentoPanel = new JCalendarPanel( null ); + JLabel envioContratoLabel = new JLabel( "Envio Contrato" ); + envioContratoPanel = new JCalendarPanel( null ); + JLabel recepcaoContratoLabel = new JLabel( "Recep\u00e7\u00e3o" ); + recepcaoContratoPanel = new JCalendarPanel( null ); + JLabel envioIdictLabel = new JLabel( "Mod. 1360" ); + envioIdictPanel = new JCalendarPanel( null ); + JLabel relatorioAnualLabel = new JLabel( "Relat\u00f3rio Anual" ); + relatorioAnualPanel = new JCalendarPanel( null ); + JTabbedPane tabbedPane = new JTabbedPane(); + JLabel caeLabel = new JLabel( "CAE" ); + caeText = new JTextField(); + JLabel actividadeLabel = new JLabel( " - " ); + actividadeText = new JTextField(); + JLabel contribuinteLabel = new JLabel( "Contribuinte" ); + contribuinteText = new JTextField(); + JLabel segSocialLabel = new JLabel( "Seguran\u00e7a Social" ); + segSocialText = new JTextField(); + JPanel moradaPanel = new JPanel(); + marcacoesPanel = new JPanel(); + protocoloPanel = new ProtocoloPanel(); +// userPanel = new UserPanel(); + + JScrollPane estabelecimentosScroll = new JScrollPane(); + estabelecimentosScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + estabelecimentosModel = new VectorTableModel( new String[]{ "Estabelecimentos" } ); + estabelecimentosTable = new BaseTable( estabelecimentosModel ); + estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + estabelecimentosTable.getSelectionModel().addListSelectionListener( this ); + estabelecimentosScroll.setViewportView( estabelecimentosTable ); + + JPanel dadosEmpresaPanel = new JPanel(); + JPanel contactosPanel = new JPanel(); + JScrollPane contactosScroll = new JScrollPane(); + contactosScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + contactosScroll.setViewportView( contactosPanel ); + contactosScroll.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Contactos" ) ); + JPanel formalidadesPanel = new JPanel(); + + JPanel pad; + + JPanel upperPanel = new JPanel(); + + TableLayout tableLayout = new TableLayout( + new double[] + { + TableLayout.PREFERRED, TableLayout.MINIMUM, TableLayout.MINIMUM, + TableLayout.PREFERRED, TableLayout.MINIMUM, TableLayout.FILL, + TableLayout.MINIMUM, TableLayout.PREFERRED, + TableLayout.MINIMUM, TableLayout.PREFERRED + }, + new double[] + { + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.PREFERRED + } + ); + tableLayout.setHGap( 5 ); + tableLayout.setVGap( 3 ); + upperPanel.setLayout( tableLayout ); + + upperPanel.add( logotipo, new TableLayoutConstraints( 0, 0, 0, 2 ) ); + upperPanel.add( designacaoSocialLabel, new TableLayoutConstraints( 1, 0, 2, 0 ) ); + upperPanel.add( designacaoSocialText, new TableLayoutConstraints( 3, 0, 5, 0 ) ); + upperPanel.add( codigoLabel, new TableLayoutConstraints( 6, 0 ) ); + upperPanel.add( codigoPanel, new TableLayoutConstraints( 7, 0 ) ); + upperPanel.add( caeLabel, new TableLayoutConstraints( 1, 1 ) ); + caeText.setPreferredSize( new Dimension( 80, 0 ) ); + upperPanel.add( caeText, new TableLayoutConstraints( 2, 1, 3, 1 ) ); + upperPanel.add( actividadeLabel, new TableLayoutConstraints( 4, 1 ) ); + upperPanel.add( actividadeText, new TableLayoutConstraints( 5, 1 ) ); + upperPanel.add( contribuinteLabel, new TableLayoutConstraints( 6, 1 ) ); + contribuinteText.setPreferredSize( new Dimension( 120, 0 ) ); + upperPanel.add( contribuinteText, new TableLayoutConstraints( 7, 1 ) ); + upperPanel.add( segSocialLabel, new TableLayoutConstraints( 8, 1 ) ); + segSocialText.setPreferredSize( new Dimension(120,0) ); + upperPanel.add( segSocialText, new TableLayoutConstraints( 9, 1 ) ); + + + GridBagLayout gridbag = new GridBagLayout(); + dadosEmpresaPanel.setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + + contactosPanel.setLayout( new GridLayout( 1, 2 ) ); + contactosPanel.add( contacto1Panel ); + contactosPanel.add( contacto2Panel ); + + gridbag = new GridBagLayout(); + formalidadesPanel.setLayout( gridbag ); + constraints.weighty = 0; + constraints.gridheight = 1; + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( envioPropostaLabel, constraints ); + formalidadesPanel.add( envioPropostaLabel ); + + constraints.weightx = 0.3; + gridbag.setConstraints( envioPropostaPanel, constraints ); + formalidadesPanel.add( envioPropostaPanel ); + + constraints.weightx = 0; + gridbag.setConstraints( inicioContratoLabel, constraints ); + formalidadesPanel.add( inicioContratoLabel ); + + constraints.weightx = 0.2; + constraints.gridwidth = 1; +// JPanel perfisPanel = new JPanel(); + gridbag.setConstraints( inicioContratoPanel, constraints ); + formalidadesPanel.add( inicioContratoPanel ); + + constraints.weightx = 0.4; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( precoLabel, constraints ); + formalidadesPanel.add( precoLabel ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( aceitacaoPropostaLabel, constraints ); + formalidadesPanel.add( aceitacaoPropostaLabel ); + + constraints.weightx = 0.3; + constraints.gridwidth = 1; + gridbag.setConstraints( aceitacaoPropostaPanel, constraints ); + formalidadesPanel.add( aceitacaoPropostaPanel ); + + constraints.weightx = 0; + gridbag.setConstraints( duracaoContratoLabel, constraints ); + formalidadesPanel.add( duracaoContratoLabel ); + + constraints.weightx = 0.2; + constraints.gridwidth = 1; +// JPanel perfisPanel = new JPanel(); + gridbag.setConstraints( duracaoContratoText, constraints ); + formalidadesPanel.add( duracaoContratoText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( precoHigieneLabel, constraints ); + formalidadesPanel.add( precoHigieneLabel ); + + constraints.weightx = 0.4; + constraints.gridwidth = 1; + gridbag.setConstraints( precoHigieneText, constraints ); + formalidadesPanel.add( precoHigieneText ); + + constraints.weightx = 0; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( higieneEuroLabel, constraints ); + formalidadesPanel.add( higieneEuroLabel ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( envioContratoLabel, constraints ); + formalidadesPanel.add( envioContratoLabel ); + + constraints.weightx = 0.3; + gridbag.setConstraints( envioContratoPanel, constraints ); + formalidadesPanel.add( envioContratoPanel ); + + constraints.weightx = 0; + gridbag.setConstraints( cancelamentoLabel, constraints ); + formalidadesPanel.add( cancelamentoLabel ); + + constraints.weightx = 0.2; + constraints.gridwidth = 1; +// JPanel perfisPanel = new JPanel(); + gridbag.setConstraints( cancelamentoPanel, constraints ); + formalidadesPanel.add( cancelamentoPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( precoMedicinaLabel, constraints ); + formalidadesPanel.add( precoMedicinaLabel ); + + constraints.weightx = 0.4; + constraints.gridwidth = 1; + gridbag.setConstraints( precoMedicinaText, constraints ); + formalidadesPanel.add( precoMedicinaText ); + + constraints.weightx = 0; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( medicinaEuroLabel, constraints ); + formalidadesPanel.add( medicinaEuroLabel ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( recepcaoContratoLabel, constraints ); + formalidadesPanel.add( recepcaoContratoLabel ); + + constraints.weightx = 0.3; + constraints.gridwidth = 1; + gridbag.setConstraints( recepcaoContratoPanel, constraints ); + formalidadesPanel.add( recepcaoContratoPanel ); + + constraints.weightx = 0.2; + constraints.gridwidth = 2; + gridbag.setConstraints( servicosCombo, constraints ); + formalidadesPanel.add( servicosCombo ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( modalidadePagamentoLabel, constraints ); + formalidadesPanel.add( modalidadePagamentoLabel ); + + constraints.weightx = 0.4; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( modalidadePagamentoText, constraints ); + formalidadesPanel.add( modalidadePagamentoText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( envioIdictLabel, constraints ); + formalidadesPanel.add( envioIdictLabel ); + + constraints.weightx = 0.3; + gridbag.setConstraints( envioIdictPanel, constraints ); + formalidadesPanel.add( envioIdictPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( relatorioAnualLabel, constraints ); + formalidadesPanel.add( relatorioAnualLabel ); + + constraints.weightx = 0.2; + constraints.gridwidth = 1; + gridbag.setConstraints( relatorioAnualPanel, constraints ); + formalidadesPanel.add( relatorioAnualPanel ); + + constraints.weightx = 0.4; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( labelTrabalhadoresActivos, constraints ); + formalidadesPanel.add( labelTrabalhadoresActivos ); + +// constraints.weightx = 0.5; +// constraints.gridwidth = GridBagConstraints.REMAINDER; +// pad = new JPanel(); +// gridbag.setConstraints( pad, constraints ); +// formalidadesPanel.add( pad ); + + setLayout( new BorderLayout() ); + add( upperPanel, BorderLayout.NORTH ); + JPanel lowerPanel = new JPanel(); + add( lowerPanel, BorderLayout.CENTER ); + + gridbag = new GridBagLayout(); + lowerPanel.setLayout( gridbag ); + constraints.fill = GridBagConstraints.BOTH; + constraints.insets = new Insets( 0, 0, 0, 0 ); + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + + constraints.weightx = 0.55; + constraints.gridwidth = 1; +// lowerPanel.setLayout( new BorderLayout() ); + //lowerPanel.add( dadosEmpresaPanel ); + //lowerPanel.add( new JPanel() ); + gridbag.setConstraints( tabbedPane, constraints ); + lowerPanel.add( tabbedPane ); +// lowerPanel.add( tabbedPane, BorderLayout.CENTER ); + tabbedPane.add( "Contactos", contactosPanel ); + tabbedPane.add( "Morada", moradaPanel ); + tabbedPane.add( "Formalidades", formalidadesPanel ); + tabbedPane.add( "Protocolo", protocoloPanel ); + tabbedPane.add( "Tarefas", marcacoesPanel ); + +// if( webAware ) +// { +// tabbedPane.add( "Utilizador da P\u00e1gina", userPanel ); +// } + + constraints.weightx = 0.45; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( estabelecimentosScroll, constraints ); + lowerPanel.add( estabelecimentosScroll ); +// lowerPanel.add( estabelecimentosScroll, BorderLayout.EAST ); + + gridbag = new GridBagLayout(); + codigoPanel.setLayout( gridbag ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.insets = new Insets( 1, 0, 1, 2 ); + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + + if( countFields > 0 ) + { + constraints.weightx = 0.2; + constraints.gridwidth = 1; + gridbag.setConstraints( codigo1Text, constraints ); + codigoPanel.add( codigo1Text ); + + if( fieldSeparators[ 0 ] != null ) + { + constraints.weightx = 0; + JLabel divLabel = new JLabel( fieldSeparators[ 0 ] ); + gridbag.setConstraints( divLabel, constraints ); + codigoPanel.add( divLabel ); + } + } + + if( countFields > 1 ) + { + constraints.weightx = 0.5; + gridbag.setConstraints( codigo2Text, constraints ); + codigoPanel.add( codigo2Text ); + + if( fieldSeparators[ 1 ] != null ) + { + constraints.weightx = 0; + JLabel divLabel = new JLabel( fieldSeparators[ 1 ] ); + gridbag.setConstraints( divLabel, constraints ); + codigoPanel.add( divLabel ); + } +// constraints.weightx = 0; +// JLabel divLabel = new JLabel( "/" ); +// gridbag.setConstraints( divLabel, constraints ); +// codigoPanel.add( divLabel ); + } + + if( countFields > 2 ) + { + constraints.weightx = 0.2; +// constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( codigo3Text, constraints ); + codigoPanel.add( codigo3Text ); + + if( fieldSeparators[ 2 ] != null ) + { + constraints.weightx = 0; + JLabel divLabel = new JLabel( fieldSeparators[ 2 ] ); + gridbag.setConstraints( divLabel, constraints ); + codigoPanel.add( divLabel ); + } + } + + +// gridbag = new GridBagLayout(); +// perfisPanel.setLayout( gridbag ); +// constraints.fill = GridBagConstraints.HORIZONTAL; +// constraints.insets = new Insets( 1, 0, 1, 2 ); +// constraints.weighty = 1; +// constraints.gridheight = GridBagConstraints.REMAINDER; +// +// constraints.weightx = 0.5; +// constraints.gridwidth = 1; +// gridbag.setConstraints( perfil1Text, constraints ); +// perfisPanel.add( perfil1Text ); +// +// constraints.weightx = 0; +// constraints.gridwidth = 1; +// gridbag.setConstraints( perfil2Label, constraints ); +// perfisPanel.add( perfil2Label ); +// +// constraints.weightx = 0.5; +// //constraints.gridwidth = GridBagConstraints.REMAINDER; +// gridbag.setConstraints( perfil2Text, constraints ); +// perfisPanel.add( perfil2Text ); + + + gridbag = new GridBagLayout(); + moradaPanel.setLayout( gridbag ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( moradaLabel, constraints ); + moradaPanel.add( moradaLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( moradaText, constraints ); + moradaPanel.add( moradaText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( codigoPostalLabel, constraints ); + moradaPanel.add( codigoPostalLabel ); + + constraints.weightx = 0.3; + gridbag.setConstraints( codigoPostalText, constraints ); + moradaPanel.add( codigoPostalText ); + + constraints.weightx = 0.7; + constraints.gridwidth = GridBagConstraints.REMAINDER; + pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + moradaPanel.add( pad ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( localLabel, constraints ); + moradaPanel.add( localLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( localText, constraints ); + moradaPanel.add( localText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( distritoLabel, constraints ); + moradaPanel.add( distritoLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( distritoText, constraints ); + moradaPanel.add( distritoText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( concelhoLabel, constraints ); + moradaPanel.add( concelhoLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( concelhoText, constraints ); + moradaPanel.add( concelhoText ); + + + listaMarcacoesPanel = new JPanel(); + listaMarcacoesPanel.setLayout( new GridLayout( 1, 1 ) ); + VectorTableModel marcacoesModel = new VectorTableModel( new String[]{ "Data", "Realizada", "Texto" } ); + marcacoesTable = new BaseTable( marcacoesModel ); + marcacoesTable.setToolTipColumn( 2 ); + marcacoesTable.fixColumnWidth( 0, 150 ); + marcacoesTable.fixColumnWidth( 1, 80 ); + marcacoesTable.setNonResizableNorReordable(); + JScrollPane marcacoesScp = new JScrollPane( marcacoesTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + listaMarcacoesPanel.add( marcacoesScp ); + + marcacoesCardLayout = new CardLayout(); + marcacaoPanel = new MarcacaoEmpresaPanel( this ); + marcacoesPanel.setLayout( marcacoesCardLayout ); + marcacoesPanel.add( MarcacaoEmpresaPanel.LIST_PANEL, listaMarcacoesPanel ); + marcacoesPanel.add( MarcacaoEmpresaPanel.EDIT_PANEL, marcacaoPanel ); + + marcacoesTable.getSelectionModel().addListSelectionListener( new ListSelectionListener(){ + public void valueChanged( ListSelectionEvent e ) + { + int selected = marcacoesTable.getSelectedRow(); + if( selected == -1 || e.getValueIsAdjusting() ) + { + return; + } + Object row = ( (VectorTableModel)marcacoesTable.getModel() ).getRowAt( selected ); + marcacoesTable.clearSelection(); + marcacaoPanel.setEmpresa( empresa ); + if( row != null && row instanceof MarcacoesEmpresaData ) + { + marcacaoPanel.fill( row ); + } + else + { + marcacaoPanel.fill( null ); + } + marcacoesCardLayout.show( marcacoesPanel, MarcacaoEmpresaPanel.EDIT_PANEL ); + } + } ); + + servicosCombo.addItem( new MappableObject( new Integer( 1 ), "SHST" ) ); + servicosCombo.addItem( new MappableObject( new Integer( 2 ), "Medicina do Trabalho" ) ); + servicosCombo.addItem( new MappableObject( new Integer( 3 ), "Higiene e Seguran\u00e7a" ) ); + servicosCombo.addItem( new MappableObject( new Integer( 4 ), "Forma\u00e7\u00e3o" ) ); + servicosCombo.addItem( new MappableObject( new Integer( 5 ), "Estudos Especificos HS" ) ); + servicosCombo.addItem( new MappableObject( new Integer( 6 ), "Sinal\u00e9tica" ) ); + + new CopyPasteHandler( designacaoSocialText ); + new CopyPasteHandler( moradaText ); + new CopyPasteHandler( codigoPostalText ); + new CopyPasteHandler( localText ); + new CopyPasteHandler( distritoText ); + new CopyPasteHandler( concelhoText ); + new CopyPasteHandler( codigo1Text ); + new CopyPasteHandler( codigo2Text ); + new CopyPasteHandler( codigo3Text ); +// new CopyPasteHandler( perfil1Text ); +// new CopyPasteHandler( perfil2Text ); + new CopyPasteHandler( precoHigieneText ); + new CopyPasteHandler( precoMedicinaText ); + new CopyPasteHandler( modalidadePagamentoText ); + new CopyPasteHandler( caeText ); + new CopyPasteHandler( actividadeText ); + new CopyPasteHandler( contribuinteText ); + new CopyPasteHandler( segSocialText ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( EmpresasData.DESIGNACAO_SOCIAL, designacaoSocialText ); + components.putComponent( EmpresasData.MORADA, moradaText ); + components.putComponent( EmpresasData.CODIGO_POSTAL, codigoPostalText ); + components.putComponent( EmpresasData.LOCALIDADE, localText ); + components.putComponent( EmpresasData.DISTRITO, distritoText ); + components.putComponent( EmpresasData.CONCELHO, concelhoText ); + components.putComponent( EmpresasData.DATA_PROPOSTA, envioPropostaPanel ); + components.putComponent( EmpresasData.DATA_ACEITACAO, aceitacaoPropostaPanel ); + components.putComponent( EmpresasData.INICIO_CONTRATO, inicioContratoPanel ); + components.putComponent( EmpresasData.DURACAO, duracaoContratoText ); + components.putComponent( EmpresasData.DATA_CANCELAMENTO, cancelamentoPanel ); + components.putDummy( EmpresasData.PERFIL_1 ); + components.putDummy( EmpresasData.PERFIL_2); + components.putComponent( EmpresasData.DATA_ENVIO_CONTRATO, envioContratoPanel ); + components.putComponent( EmpresasData.DATA_RECEPCAO_CONTRATO, recepcaoContratoPanel ); + components.putComponent( EmpresasData.DATA_ENVIO_IDICT, envioIdictPanel ); + components.putComponent( EmpresasData.DATA_RELATORIO_ANUAL, relatorioAnualPanel ); + components.putComponent( EmpresasData.CODIGO_1, codigo1Text ); + components.putComponent( EmpresasData.CODIGO_2, codigo2Text ); + components.putComponent( EmpresasData.CODIGO_3, codigo3Text ); + components.putComponent( EmpresasData.CAE, caeText ); + components.putComponent( EmpresasData.ACTIVIDADE, actividadeText ); + components.putComponent( EmpresasData.CONTRIBUINTE, contribuinteText ); + components.putComponent( EmpresasData.SEGURANCA_SOCIAL, segSocialText ); + components.putComponent( EmpresasData.TO_CONTACTO_1, contacto1Panel ); + components.putComponent( EmpresasData.TO_CONTACTO_2, contacto2Panel ); + components.putComponent( EmpresasData.SERVICOS, servicosCombo ); +// components.putComponent( EmpresasData.PRECO_HIGIENE, precoHigieneText ); +// components.putComponent( EmpresasData.PRECO_MEDICINA, precoMedicinaText ); + components.putComponent( EmpresasData.PERIODICIDADE, modalidadePagamentoText ); + components.putDummy( EmpresasData.SERVICO_SAUDE_TIPO ); + components.putDummy( EmpresasData.SERVICO_SAUDE_DESIGNACAO ); + components.putDummy( EmpresasData.SERVICO_HIGIENE_TIPO ); + components.putDummy( EmpresasData.SERVICO_HIGIENE_DESIGNACAO ); + components.putDummy( EmpresasData.DESIGNACAO_SOCIAL_PLAIN ); + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + estabelecimentosModel.clearAll(); + protocoloPanel.clear(); + clearMarcacoes(); + empresa = null; + } + + public void fill(Object value) + { + clear(); + + if( value == null || ( ( Object[] )value )[ 0 ] == null ) + { +// userPanel.setEmpresaID( null ); + return; + } + empresa = ( EmpresasData ) ( ( Object [] )value )[ 0 ]; + Integer elementosProtocolo[][] = ( Integer [][] ) ( ( Object [] )value )[ 1 ]; + + String names[] = ( String[] ) components.keySet().toArray( new String[ components.size() ] ); + ComponentController.fill( names, empresa.getHashData(), components ); + id = (Integer) empresa.get( EmpresasData.ID ); + IDObject estabelecimentos[]; + try + { + estabelecimentos = provider.getAllEstabelecimentosForEmpresa( id ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar a lista de estabelecimentos", true ); + estabelecimentos = new IDObject[0]; + } + reloadMarcacoes(); + Vector v = new Vector( Arrays.asList( estabelecimentos ) ); + estabelecimentosModel.setValues( v ); + + Vector dadosProtocolo[] = new Vector[]{ new Vector(), new Vector() }; + boolean analisesExamesA[] = new boolean[2]; + analisesExamesA[ 0 ] = "y".equals( empresa.get( EmpresasData.A_CONSULTAS ) ); + analisesExamesA[ 1 ] = "y".equals( empresa.get( EmpresasData.A_EXAMES ) ); + dadosProtocolo[ 0 ].add( analisesExamesA ); + dadosProtocolo[ 0 ].add( elementosProtocolo[ 0 ] ); + boolean analisesExamesB[] = new boolean[2]; + analisesExamesB[ 0 ] = "y".equals( empresa.get( EmpresasData.B_CONSULTAS ) ); + analisesExamesB[ 1 ] = "y".equals( empresa.get( EmpresasData.B_EXAMES ) ); + dadosProtocolo[ 1 ].add( analisesExamesB ); + dadosProtocolo[ 1 ].add( elementosProtocolo[ 1 ] ); + protocoloPanel.fill( dadosProtocolo ); + Integer empresaID = empresa == null ? null : (Integer) empresa.get( EmpresasData.ID ); + if( empresaID != null ) + { + Long numTrabalhadoresActivos = provider.countTrabalhadoresActivosForEmpresa( empresaID ); + labelTrabalhadoresActivos.setText( getTextForTrabalhadoresActivos( numTrabalhadoresActivos ) ); + ImageData logo = empresa.toEmpresa_logo_id(); + logotipo.fill( logo == null ? null : logo.getImage_data() ); + } +// if( webAware ) +// { +// userPanel.setEmpresaID( (Integer) empresa.get( EmpresasData.ID ) ); +// userPanel.setEnabled( id != null ); +// } + + } + + public Object save() + { + if( empresa == null ) + { + empresa = new EmpresasData(); + } + + String names[] = ( String[] ) components.keySet().toArray( new String[ components.size() ] ); + Map hash = empresa.getHashData(); + ComponentController.save( names, hash, components ); + empresa.setHashData( hash ); + Vector dadosProtocolo[] = ( Vector[] ) protocoloPanel.save(); + boolean analisesExamesA[] = ( boolean [] ) dadosProtocolo[ 0 ].elementAt( 0 ); + empresa.set( EmpresasData.A_CONSULTAS, analisesExamesA[ 0 ] ? "y" : "n" ); + empresa.set( EmpresasData.A_EXAMES, analisesExamesA[ 1 ] ? "y" : "n" ); + boolean analisesExamesB[] = ( boolean [] ) dadosProtocolo[ 1 ].elementAt( 0 ); + empresa.set( EmpresasData.B_CONSULTAS, analisesExamesB[ 0 ] ? "y" : "n" ); + empresa.set( EmpresasData.B_EXAMES, analisesExamesB[ 1 ] ? "y" : "n" ); + Integer elementosProtocolo[][] = + new Integer[][]{ ( Integer [] ) dadosProtocolo[ 0 ].elementAt( 1 ), + ( Integer [] ) dadosProtocolo[ 1 ].elementAt( 1 ) }; + ImageData logo = empresa.toEmpresa_logo_id(); + try + { + if( logo != null ) + { + logo.delete(); + } + logo = new ImageData(); + logo.setImage_data( (byte[]) logotipo.save() ); + logo.setName( "Logotipo: " + empresa.getDesignacao_social() ); + empresa.setToEmpresa_logo_id(logo); + logo.save(); + } + catch (Exception e) + { + ErrorLogger.logExceptionAndShow( e ); + } + return new Object[] { empresa, elementosProtocolo }; + } + + public void setEnabled( boolean enable ) + { + super.setEnabled( enable ); + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + protocoloPanel.setEnabled( enable ); + logotipo.setEnabled( enable ); + //estabelecimentosTable.setEnabled( enable ); + } + + public void addListSelectionListener( ListSelectionListener listener ) + { + listSelectionListeners.add( listener ); + } + + public void removeListSelectionListener( ListSelectionListener listener ) + { + listSelectionListeners.remove( listener ); + } + + public void valueChanged( ListSelectionEvent e ) + { + for( int n = 0; n < listSelectionListeners.size(); n++ ) + { + ListSelectionEvent newEvent = + new ListSelectionEvent( this, e.getFirstIndex(), e.getLastIndex(), e.getValueIsAdjusting() ); + ( (ListSelectionListener) listSelectionListeners.elementAt( n ) ).valueChanged( newEvent ); + } + } + + public Integer getSelectedEstabelecimento() + { + int selected = estabelecimentosTable.getSelectedRow(); + if( selected == -1 ) + { + return null; + } + return ( (IDObject) estabelecimentosModel.getRowAt( selected ) ).getID(); + } + + public void reload() + { + int selected = estabelecimentosTable.getSelectedRow(); + fill( empresa ); + if( selected != -1 ) + { + estabelecimentosTable.setRowSelectionInterval( selected, selected ); + } + } + + public JTable getEstabelecimentosTable() + { + return estabelecimentosTable; + } + + public void setSelectedEstabelecimento( EstabelecimentosData estab ) + { + IDObject lista[] = (IDObject [])estabelecimentosModel.getValues().toArray( new IDObject[ 0 ] ); + Integer id = (Integer)estab.get( EstabelecimentosData.ID ); + for( int n = 0; n < lista.length; n++ ) + { + if( lista[ n ].getID().equals( id ) ) + { + estabelecimentosTable.setRowSelectionInterval( n, n ); + return; + } + } + estabelecimentosTable.clearSelection(); + } + + protected void reloadMarcacoes() + { + try + { + Collection marcacoesCollection = + objectProvider.listLoad( MarcacoesEmpresaData.class, new Object[]{ empresa.getId() }, + new String []{ MarcacoesEmpresaData.EMPRESA_ID }, new String[]{ "data desc" } ); + Vector marcacoes = new Vector(); + marcacoes.add( new ColumnizedObject(){ + public Object getValue( int col ) + { + switch( col ) + { + case 0: case 1: + return ""; + case 2: + return "NOVA TAREFA..."; + } + return null; + } + } ); + if( marcacoesCollection != null ) + { + marcacoes.addAll( marcacoesCollection ); + } + marcacoesTable.clearSelection(); + ( (VectorTableModel) marcacoesTable.getModel() ).setValues( marcacoes ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar as Marca\u00e7\u00f5es", true ); + } + showMarcacoes(); + } + + protected void showMarcacoes() + { + marcacoesCardLayout.show( marcacoesPanel, MarcacaoEmpresaPanel.LIST_PANEL ); + } + + protected void clearMarcacoes() + { + ( (VectorTableModel) marcacoesTable.getModel() ).clearAll(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/EstabelecimentoPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/EstabelecimentoPanel.java new file mode 100644 index 00000000..21bbbdfc --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/EstabelecimentoPanel.java @@ -0,0 +1,537 @@ +/* + * EstabelecimentoPanel.java + * + * Created on 14 de Maio de 2004, 12:21 + */ + +package siprp.clientes; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.CardLayout; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Collection; +import java.util.Hashtable; +import java.util.Vector; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import siprp.SIPRPTracker; +import siprp.SingletonConstants; +import siprp.data.outer.EmpresasData; +import siprp.data.outer.EstabelecimentosData; +import siprp.data.outer.HistoricoEstabelecimentoData; +import siprp.medicina.prestadores.PrestadoresDataProvider; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.dataui.ComponentController; +import com.evolute.utils.dataui.ComponentsHashtable; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.documents.MaximumLengthDocument; +import com.evolute.utils.error.ErrorLogger; +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.ColumnizedObject; +import com.evolute.utils.tables.VectorTableModel; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.text.CopyPasteHandler; +/** + * + * @author fpalma + */ +public class EstabelecimentoPanel extends JPanel + implements ControllableComponent, ListSelectionListener, ActionListener +{ + private static final long serialVersionUID = 1L; + + public static int disables = 0; + + private ProviderInterface objectProvider; + + private EstabelecimentosData estabelecimento; + private ComponentsHashtable components; + + private EmpresasData empresa; + + private JTable estabelecimentosTable; + private JPanel toolbarPanel; + + private JTextField designacaoText; + private JTextField moradaText; + private JTextField localText; + private JTextField codigoPostalText; + private ContactoPanel contactoPanel; + private JTextArea historicoText; + private JButton marcacoesButton; + private JPanel historicoPanel; + private JPanel listaHistoricoPanel; + private BaseTable historicoTable; + private HistoricoEstabelecimentoPanel edicaoHistoricoPanel; + private CardLayout historicoCardLayout; + private JComboBox prestadorConsultaCombo; + private JComboBox prestadorEcdsCombo; + + private PrestadoresDataProvider prestadoresProvider; + +// private MarcacaoPanel marcacaoPanel; + private SIPRPTracker tracker; + + private boolean lastEnable = false; + + /** Creates a new instance of EstabelecimentoPanel */ + public EstabelecimentoPanel( JPanel toolbarPanel, JTextField designacaoText, JTable estabelecimentosTable ) + throws Exception + { + this.toolbarPanel = toolbarPanel; + this.designacaoText = designacaoText; + this.estabelecimentosTable = estabelecimentosTable; + objectProvider = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + prestadoresProvider = PrestadoresDataProvider.getProvider(); + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + throws Exception + { + JPanel dadosEstabelecimentoPanel = new JPanel(); +// JLabel designacaoLabel = new JLabel( "Designa\u00e7\u00e3o" ); + //designacaoText = new JTextField(); + JLabel moradaLabel = new JLabel( "Morada" ); + moradaText = new JTextField(); + JLabel codigoPostalLabel = new JLabel( "C\u00f3digo Postal" ); + codigoPostalText = new JTextField(); + codigoPostalText.setDocument( new MaximumLengthDocument( 8 ) ); + JLabel localLabel = new JLabel( "Local" ); + localText = new JTextField(); + contactoPanel = new ContactoPanel(); + contactoPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Contacto" ) ); + marcacoesButton = new JButton( "Marca\u00e7\u00f5es" ); + marcacoesButton.addActionListener( this ); + JPanel pad; + historicoText = new JTextArea(); + new CopyPasteHandler( historicoText ); + historicoText.setLineWrap( true ); + historicoText.setWrapStyleWord( true ); + JScrollPane observacoesScp = new JScrollPane( historicoText, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + observacoesScp.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Observa\u00e7\u00f5es" ) ); + historicoPanel = new JPanel(); + historicoPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Hist\u00f3rico" ) ); +// marcacaoPanel = new MarcacaoPanel( true, "Realizada", "Relat\u00f3rio", Marcacao.TIPO_MARCACAO_ESTABELECIMENTO ); +// marcacaoPanel.setCalendarDialogOrientation( JCalendarDialog.ABOVE, JCalendarDialog.LEFT ); +// marcacaoPanel.setBorder( BorderFactory.createTitledBorder( +// BorderFactory.createEtchedBorder(), +// "Visita" ) ); + MappableObject prestadorDefaultGeral = new MappableObject( null, Singleton.getInstance( SingletonConstants.COMPANY_ACRONYM ) ); + prestadorDefaultGeral.nullEqualsNull( true ); + JLabel prestadorConsultaLabel = new JLabel( "Consultas" ); + prestadorConsultaCombo = new JComboBox(); + IDObject[] prestadoresConsultas = prestadoresProvider.getPrestadoresConsultasActivos(); + prestadorConsultaCombo.addItem( prestadorDefaultGeral ); + for( int n = 0; n < prestadoresConsultas.length; n++ ) + { + prestadorConsultaCombo.addItem( prestadoresConsultas[ n ] ); + } + JLabel prestadorEcdsLabel = new JLabel( "ECDs" ); + prestadorEcdsCombo = new JComboBox(); + IDObject[] prestadoresEcds = prestadoresProvider.getPrestadoresECDsActivos(); + prestadorEcdsCombo.addItem( prestadorDefaultGeral ); + for( int n = 0; n < prestadoresEcds.length; n++ ) + { + prestadorEcdsCombo.addItem( prestadoresEcds[ n ] ); + } + JPanel prestadoresPanel = new JPanel(); + prestadoresPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Prestadores" ) ); + + GridBagLayout gridbag = new GridBagLayout(); + dadosEstabelecimentoPanel.setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridheight = 1; + constraints.weighty = 0; + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( toolbarPanel, constraints ); + dadosEstabelecimentoPanel.add( toolbarPanel ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 1; + pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + dadosEstabelecimentoPanel.add( pad ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( moradaLabel, constraints ); + dadosEstabelecimentoPanel.add( moradaLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( moradaText, constraints ); + dadosEstabelecimentoPanel.add( moradaText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( codigoPostalLabel, constraints ); + dadosEstabelecimentoPanel.add( codigoPostalLabel ); + + constraints.weightx = 0.3; + constraints.gridwidth = 1; + gridbag.setConstraints( codigoPostalText, constraints ); + dadosEstabelecimentoPanel.add( codigoPostalText ); + + constraints.weightx = 0.7; + constraints.gridwidth = GridBagConstraints.REMAINDER; + pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + dadosEstabelecimentoPanel.add( pad ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( localLabel, constraints ); + dadosEstabelecimentoPanel.add( localLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( localText, constraints ); + dadosEstabelecimentoPanel.add( localText ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( marcacoesButton, constraints ); + dadosEstabelecimentoPanel.add( marcacoesButton ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( contactoPanel, constraints ); + + gridbag = new GridBagLayout(); + setLayout( gridbag ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 0.5; + constraints.gridwidth = 1; + gridbag.setConstraints( dadosEstabelecimentoPanel, constraints ); + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( contactoPanel, constraints ); + constraints.weightx = 0.5; + constraints.weighty = 1; + constraints.gridwidth = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + gridbag.setConstraints( historicoPanel, constraints ); + constraints.weightx = 0.25; + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.gridwidth = 1; + gridbag.setConstraints( observacoesScp, constraints ); + constraints.weightx = 0.25; + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.gridwidth = GridBagConstraints.REMAINDER;; + gridbag.setConstraints( prestadoresPanel, constraints ); + add( dadosEstabelecimentoPanel ); + add( contactoPanel ); + add( historicoPanel ); + add( observacoesScp ); + add( prestadoresPanel ); + + listaHistoricoPanel = new JPanel(); + listaHistoricoPanel.setLayout( new GridLayout( 1, 1 ) ); + VectorTableModel marcacoesModel = new VectorTableModel( new String[]{ "Data", "Texto" } ); + historicoTable = new BaseTable( marcacoesModel ); + historicoTable.setToolTipColumn( 1 ); + historicoTable.fixColumnWidth( 0, 150 ); + historicoTable.setNonResizableNorReordable(); + JScrollPane listaHistoricoScp = new JScrollPane( historicoTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + listaHistoricoPanel.add( listaHistoricoScp ); + + historicoCardLayout = new CardLayout(); + edicaoHistoricoPanel = new HistoricoEstabelecimentoPanel( this ); + historicoPanel.setLayout( historicoCardLayout ); + historicoPanel.add( HistoricoEstabelecimentoPanel.LIST_PANEL, listaHistoricoPanel ); + historicoPanel.add( HistoricoEstabelecimentoPanel.EDIT_PANEL, edicaoHistoricoPanel ); + + historicoTable.getSelectionModel().addListSelectionListener( new ListSelectionListener(){ + public void valueChanged( ListSelectionEvent e ) + { + int selected = historicoTable.getSelectedRow(); + if( selected == -1 || e.getValueIsAdjusting() ) + { + return; + } + Object row = ( (VectorTableModel)historicoTable.getModel() ).getRowAt( selected ); + historicoTable.clearSelection(); + edicaoHistoricoPanel.setEstabelecimento( estabelecimento ); + if( row != null && row instanceof HistoricoEstabelecimentoData ) + { + edicaoHistoricoPanel.fill( row ); + } + else + { + edicaoHistoricoPanel.fill( null ); + } + historicoCardLayout.show( historicoPanel, HistoricoEstabelecimentoPanel.EDIT_PANEL ); + } + } ); + + TableLayout prestadoresLayout = + new TableLayout( new double[]{ TableLayoutConstraints.FILL }, + new double[]{ TableLayoutConstraints.PREFERRED, TableLayoutConstraints.PREFERRED, + TableLayoutConstraints.PREFERRED, TableLayoutConstraints.PREFERRED, + TableLayoutConstraints.FILL } ); + prestadoresLayout.setHGap( 1 ); + prestadoresLayout.setVGap( 1 ); + prestadoresPanel.setLayout( prestadoresLayout ); + prestadoresPanel.add( prestadorConsultaLabel, new TableLayoutConstraints( 0, 0 ) ); + prestadoresPanel.add( prestadorConsultaCombo, new TableLayoutConstraints( 0, 1 ) ); + prestadoresPanel.add( prestadorEcdsLabel, new TableLayoutConstraints( 0, 2 ) ); + prestadoresPanel.add( prestadorEcdsCombo, new TableLayoutConstraints( 0, 3 ) ); + + new CopyPasteHandler( designacaoText ); + new CopyPasteHandler( moradaText ); + new CopyPasteHandler( localText ); + new CopyPasteHandler( codigoPostalText ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( EstabelecimentosData.NOME, designacaoText ); + components.putComponent( EstabelecimentosData.MORADA, moradaText ); + components.putComponent( EstabelecimentosData.LOCALIDADE, localText ); + components.putComponent( EstabelecimentosData.CODIGO_POSTAL, codigoPostalText ); + components.putComponent( EstabelecimentosData.CONTACTO_ID, contactoPanel ); +// components.putComponent( EstabelecimentosData.HISTORICO, historicoText ); + components.putComponent( EstabelecimentosData.HISTORICO, historicoText ); + components.putComponent( EstabelecimentosData.PRESTADOR_CONSULTA_ID, prestadorConsultaCombo ); + components.putComponent( EstabelecimentosData.PRESTADOR_ECDS_ID, prestadorEcdsCombo ); + components.putDummy( EstabelecimentosData.EMPRESA_ID ); + components.putDummy( EstabelecimentosData.NOME_PLAIN ); +// components.putDummy( EstabelecimentosData.INACTIVO ); + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); +// prestadorConsultaCombo.setSelectedIndex( 1 ); + clearHistorico(); + estabelecimento = null; + } + + public void fill(Object value) + { + clear(); + estabelecimento = ( EstabelecimentosData ) value; +// marcacaoPanel.setEnabled( estabelecimento != null ); +// marcacaoPanel.fill( estabelecimento ); + if( estabelecimento == null ) + { + estabelecimentosTable.clearSelection(); + return; + } + String names[] = estabelecimento.getFieldNames(); + ComponentController.fill( names, estabelecimento.getHashData(), components ); + reloadHistorico(); + } + + public Object save() + { + if( estabelecimento == null ) + { + estabelecimento = new EstabelecimentosData(); + } + + String names[] = estabelecimento.getFieldNames(); + Hashtable hash = new Hashtable(); + ComponentController.save( names, hash, components ); + estabelecimento.setHashData( hash ); + estabelecimento.setToEmpresa_id( empresa ); + return estabelecimento; + } + + public void postSave() + { + int selected = estabelecimentosTable.getSelectedRow(); + if( estabelecimento != null ) + { + IDObject obj = new MappableObject( (Integer) estabelecimento.get( EstabelecimentosData.ID ), estabelecimento.get( EstabelecimentosData.NOME ) ); + VectorTableModel model = (VectorTableModel)estabelecimentosTable.getModel(); + if( selected == -1 ) + { + model.insertRowAt( obj, estabelecimentosTable.getRowCount() ); + estabelecimentosTable.setRowSelectionInterval( estabelecimentosTable.getRowCount() - 1, estabelecimentosTable.getRowCount() - 1 ); + } + else + { + model.removeRowAt( selected ); + model.insertRowAt( obj, selected ); + estabelecimentosTable.setRowSelectionInterval( selected, selected ); + } + } + } + + public void setEnabled( boolean enable ) + { + super.setEnabled( enable ); + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + if( enable != lastEnable ) + { + if( enable ) + { + disables++; + } + else + { + disables--; + } + lastEnable = enable; + } + estabelecimentosTable.setEnabled( disables == 0 ); +// if( estabelecimento == null ) +// { +// marcacaoPanel.setEnabled( false ); +// } + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + if( source instanceof EmpresaPanel ) + { + Integer id = ( ( EmpresaPanel ) source ).getSelectedEstabelecimento(); + if( id != null ) + { + try + { + EstabelecimentosData estab = ( EstabelecimentosData ) objectProvider.load( EstabelecimentosData.class, id ); + fill( estab ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar o estabelecimento", true ); + clear(); + } + } + else + { + clear(); + } + } + } + + public void reload() + { + fill( estabelecimento ); + } + + public void setEmpresa( EmpresasData empresa ) + { + this.empresa = empresa; + } + + protected void reloadHistorico() + { + try + { + Collection historicoCollection = + objectProvider.listLoad( HistoricoEstabelecimentoData.class, new Object[]{ estabelecimento.get( EstabelecimentosData.ID ) }, + new String []{ "estabelecimento.id" }, new String[]{ "data descending" } ); + Vector historico = new Vector(); + historico.add( new ColumnizedObject(){ + public Object getValue( int col ) + { + switch( col ) + { + case 0: + return ""; + case 1: + return "NOVO EVENTO..."; + } + return null; + } + } ); + if( historicoCollection != null ) + { + historico.addAll( historicoCollection ); + } + historicoTable.clearSelection(); + ( (VectorTableModel) historicoTable.getModel() ).setValues( historico ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar as Marca\u00e7\u00f5es", true ); + } + showHistorico(); + } + + protected void showHistorico() + { + historicoCardLayout.show( historicoPanel, HistoricoEstabelecimentoPanel.LIST_PANEL ); + } + + protected void clearHistorico() + { + ( (VectorTableModel) historicoTable.getModel() ).clearAll(); + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( marcacoesButton ) ) + { + if( empresa == null || estabelecimento == null ) + { + return; + } + else + { + try + { + tracker.getHigieneWindow().setVisible( true ); + tracker.getHigieneWindow().setEmpresaAndEstabelecimento( (Integer) empresa.get( EmpresasData.ID ), + ( Integer ) estabelecimento.get( EstabelecimentosData.ID ) ); + } + catch (Exception ex) { + ErrorLogger.logException(ex); + } + } + } + } + + public void setTracker( SIPRPTracker tracker ) + { + this.tracker = tracker; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/EstabelecimentoPlanoActuacaoPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/EstabelecimentoPlanoActuacaoPanel.java new file mode 100644 index 00000000..3863a565 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/EstabelecimentoPlanoActuacaoPanel.java @@ -0,0 +1,471 @@ +package siprp.clientes; + +import javax.swing.JPanel; + +import com.evolute.utils.dataui.ControllableComponent; + +public class EstabelecimentoPlanoActuacaoPanel extends JPanel implements ControllableComponent +{ + +// private static final long serialVersionUID = 1L; +// +// private static final Dimension PREFERRED_DIMENSION_EMAIL = new Dimension(200,0); +// +// private static final Dimension PREFERRED_DIMENSION_LEGISLACAO = new Dimension(400,0); +// +// private static final Dimension PREFERRED_DIMENSION_POSTO_TRABALHO = new Dimension(300,0); +// +// private final VectorTableModel modelEmail = new VectorTableModel( new String[]{ "Endere" + ccedil + "o" } ); +// +// private final VectorTableModel modelLegislacao = new VectorTableModel( new String[]{ "Descri" + ccedil + atilde + "o" } ); +// +// private final VectorTableModel modelPostoTrabalho= new VectorTableModel( new String[]{ "Descri" + ccedil + atilde + "o" } ); +// +// private final JTable tableEmail = new JTable( modelEmail ); +// +// private final JTable tableLegislacao = new JTable( modelLegislacao ); +// +// private final JTable tablePostoTrabalho = new JTable( modelPostoTrabalho ); +// +// private final JScrollPane scrollEmail = new JScrollPane( tableEmail, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER ); +// +// private final JScrollPane scrollLegislacao = new JScrollPane( tableLegislacao, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER ); +// +// private final JScrollPane scrollPostoTrabalho = new JScrollPane( tablePostoTrabalho, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER ); +// +// private final JPanel panelEmail = new JPanel(); +// +// private final JPanel panelLegislacao = new JPanel(); +// +// private final JPanel panelPostoTrabalho = new JPanel(); +// +// private final JButton buttonEmailAdicionar = new JButton("Adicionar"); +// +// private final JButton buttonLegislacaoAdicionar = new JButton("Adicionar"); +// +// private final JButton buttonPostoTrabalhoCriar = new JButton("Criar"); +// +// private final JButton buttonPostoTrabalhoEditar = new JButton("Editar"); +// +// private final JButton buttonPostoTrabalhoAdicionar = new JButton("Adicionar"); +// +// private final JButton buttonEmailRemover = new JButton("Remover"); +// +// private final JButton buttonLegislacaoRemover = new JButton("Remover"); +// +// private final JButton buttonPostoTrabalhoRemover = new JButton("Remover"); +// +// private final PlanoActuacaoDAO provider = new PlanoActuacaoDAO(); +// +// private Estabelecimentos estabelecimento = null; +// + public EstabelecimentoPlanoActuacaoPanel() + { +// startupComponents(); +// startupLayout(); +// placeComponents(); +// startupListeners(); + } +// +// private void startupLayout() +// { +// startupEmailLayout(); +// startupPostoTrabalhoLayout(); +// startupLegislacaoLayout(); +// double [] cols = new double[]{ TableLayout.FILL, TableLayout.FILL, TableLayout.PREFERRED }; +// double [] rows = new double[]{ TableLayout.FILL }; +// TableLayout layout = new TableLayout(cols,rows); +// layout.setHGap( 5 ); +// layout.setVGap( 5 ); +// this.setLayout( layout ); +// } +// +// private void startupEmailLayout() +// { +// double [] cols = new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL }; +// double [] rows = new double[]{ TableLayout.FILL, TableLayout.MINIMUM }; +// TableLayout layout = new TableLayout(cols,rows); +// layout.setHGap( 5 ); +// layout.setVGap( 5 ); +// panelEmail.setLayout( layout ); +// } +// +// private void startupPostoTrabalhoLayout() +// { +// double [] cols = new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL }; +// double [] rows = new double[]{ TableLayout.FILL, TableLayout.MINIMUM }; +// TableLayout layout = new TableLayout(cols,rows); +// layout.setHGap( 5 ); +// layout.setVGap( 5 ); +// panelPostoTrabalho.setLayout( layout ); +// } +// +// private void startupLegislacaoLayout() +// { +// double [] cols = new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL }; +// double [] rows = new double[]{ TableLayout.FILL, TableLayout.MINIMUM }; +// TableLayout layout = new TableLayout(cols,rows); +// layout.setHGap( 5 ); +// layout.setVGap( 5 ); +// panelLegislacao.setLayout( layout ); +// } +// +// private void startupComponents() +// { +// panelLegislacao.setPreferredSize( PREFERRED_DIMENSION_LEGISLACAO ); +// panelLegislacao.setBorder( BorderFactory.createTitledBorder( "Legisla" + ccedil + otilde + "es" ) ); +// +// panelPostoTrabalho.setPreferredSize( PREFERRED_DIMENSION_POSTO_TRABALHO ); +// panelPostoTrabalho.setBorder( BorderFactory.createTitledBorder( "Postos de trabalho" ) ); +// +// panelEmail.setPreferredSize( PREFERRED_DIMENSION_EMAIL ); +// panelEmail.setBorder( BorderFactory.createTitledBorder( "E-mails" ) ); +// +// buttonEmailAdicionar.setEnabled( false ); +// buttonEmailRemover.setEnabled( false ); +// +// buttonLegislacaoAdicionar.setEnabled( false ); +// buttonLegislacaoRemover.setEnabled( false ); +// +// buttonPostoTrabalhoCriar.setEnabled( false ); +// buttonPostoTrabalhoEditar.setEnabled( false ); +// buttonPostoTrabalhoAdicionar.setEnabled( false ); +// buttonPostoTrabalhoRemover.setEnabled( false ); +// } +// +// private void placeComponents() +// { +// +// panelEmail.add( scrollEmail, new TableLayoutConstraints( 0, 0, 2, 0 ) ); +// panelEmail.add( buttonEmailAdicionar, new TableLayoutConstraints( 0, 1 ) ); +// panelEmail.add( buttonEmailRemover, new TableLayoutConstraints( 1, 1 ) ); +// +// panelLegislacao.add( scrollLegislacao, new TableLayoutConstraints( 0, 0, 2, 0 ) ); +// panelLegislacao.add( buttonLegislacaoAdicionar, new TableLayoutConstraints( 0, 1 ) ); +// panelLegislacao.add( buttonLegislacaoRemover, new TableLayoutConstraints( 1, 1 ) ); +// +// panelPostoTrabalho.add( scrollPostoTrabalho, new TableLayoutConstraints( 0, 0, 4, 0 ) ); +// panelPostoTrabalho.add( buttonPostoTrabalhoCriar, new TableLayoutConstraints( 0, 1 ) ); +// panelPostoTrabalho.add( buttonPostoTrabalhoEditar, new TableLayoutConstraints( 1, 1 ) ); +// panelPostoTrabalho.add( buttonPostoTrabalhoAdicionar, new TableLayoutConstraints( 2, 1 ) ); +// panelPostoTrabalho.add( buttonPostoTrabalhoRemover, new TableLayoutConstraints( 3, 1 ) ); +// +// this.add( panelLegislacao, new TableLayoutConstraints( 0,0 ) ); +// this.add( panelPostoTrabalho, new TableLayoutConstraints( 1,0 ) ); +// this.add( panelEmail, new TableLayoutConstraints( 2,0 ) ); +// +// } +// +// private void refresh() +// { +// clear(); +// load(); +// } +// +// private void load() +// { +// if( estabelecimento != null ) +// { +// modelEmail.setValues( new Vector( estabelecimento.getEmailPlanoDeActuacaoArray() ) ); +// modelLegislacao.setValues( new Vector( estabelecimento.getLegislacaoEstabelecimentoArray() ) ); +// modelPostoTrabalho.setValues( new Vector( estabelecimento.getPostoDeTrabalhoEstabelecimentoArray() ) ); +// } +// } +// +// private void startupListeners() +// { +// buttonEmailAdicionar.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// adicionarEmail(); +// } +// } ); +// buttonEmailRemover.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// removeSelected(tableEmail); +// } +// } ); +// buttonLegislacaoAdicionar.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// adicionarLegislacao(); +// } +// } ); +// buttonLegislacaoRemover.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// removeSelected(tableLegislacao); +// } +// } ); +// buttonPostoTrabalhoCriar.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// criarPostoTrabalho(); +// } +// } ); +// buttonPostoTrabalhoEditar.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// alterarPostoTrabalho(); +// } +// } ); +// buttonPostoTrabalhoAdicionar.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// adicionarPostoTrabalho(); +// } +// } ); +// buttonPostoTrabalhoRemover.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// removeSelected(tablePostoTrabalho); +// } +// } ); +// tableEmail.getSelectionModel().addListSelectionListener( new ListSelectionListener() +// { +// @Override +// public void valueChanged( ListSelectionEvent e ) +// { +// if( !e.getValueIsAdjusting() ) +// { +// buttonEmailRemover.setEnabled( tableEmail.getSelectedRowCount() > 0 ); +// } +// } +// } ); +// tableLegislacao.getSelectionModel().addListSelectionListener( new ListSelectionListener() +// { +// @Override +// public void valueChanged( ListSelectionEvent e ) +// { +// if( !e.getValueIsAdjusting() ) +// { +// buttonLegislacaoRemover.setEnabled( tableLegislacao.getSelectedRowCount() > 0 ); +// } +// } +// } ); +// tablePostoTrabalho.getSelectionModel().addListSelectionListener( new ListSelectionListener() +// { +// @Override +// public void valueChanged( ListSelectionEvent e ) +// { +// if( !e.getValueIsAdjusting() ) +// { +// buttonPostoTrabalhoEditar.setEnabled( tablePostoTrabalho.getSelectedRowCount() > 0 ); +// buttonPostoTrabalhoRemover.setEnabled( tablePostoTrabalho.getSelectedRowCount() > 0 ); +// } +// } +// } ); +// } +// +// private void adicionarLegislacao() +// { +// Legislacao [] legislacoes = provider.getAllLegislacoesNotInEstabelecimento( estabelecimento ); +// Legislacao legislacao = (Legislacao) JOptionPane.showInputDialog( +// this, +// "Legisla" + ccedil + otilde + "es", +// "Adicionar legisla" + ccedil + atilde + "o", JOptionPane.QUESTION_MESSAGE, null, legislacoes, null ); +// adicionarLegislacao( legislacao ); +// } +// +// private void adicionarLegislacao( Legislacao legislacao ) +// { +// if( legislacao != null ) +// { +// provider.addLegislacaoToEstabelecimento( legislacao, estabelecimento ); +// refresh(); +// } +// } +// +// private void criarPostoTrabalho() +// { +// String postoTrabalho = JOptionPane.showInputDialog( "Criar posto de trabalho" ); +// PostoDeTrabalho postoTrabalhoObject = criarPostoTrabalho( postoTrabalho ); +// if( postoTrabalhoObject != null ) +// { +// adicionarPostoTrabalho( postoTrabalhoObject ); +// } +// } +// +// private PostoDeTrabalho criarPostoTrabalho( String postoTrabalho ) +// { +// PostoDeTrabalho result = null; +// if( postoTrabalho != null ) +// { +// if( postoTrabalho.trim().length() > 0 ) +// { +// postoTrabalho = postoTrabalho.trim(); +// result = provider.createPostoTrabalho( postoTrabalho ); +// } +// else +// { +// JOptionPane.showMessageDialog( this, "Posto de trabalho inv" + aacute + "lido", "Erro", JOptionPane.ERROR_MESSAGE, null ); +// } +// } +// return result; +// } +// +// private PostoDeTrabalhoEstabelecimento getSelectedPostoTrabalhoRel() +// { +// PostoDeTrabalhoEstabelecimento result = null; +// int index = tablePostoTrabalho.getSelectedRow(); +// if( index != -1 ) +// { +// result = modelPostoTrabalho.getRowAt( index ); +// } +// return result; +// } +// +// private void alterarPostoTrabalho() +// { +// PostoDeTrabalhoEstabelecimento rel = getSelectedPostoTrabalhoRel(); +// if( rel != null ) +// { +// String newDescription = JOptionPane.showInputDialog( "Editar medida", rel.getToPostoDeTrabalho().getDescription() ); +// if( newDescription != null ) +// { +// if( newDescription.trim().length() > 0 ) +// { +// rel.getToPostoDeTrabalho().setDescription( newDescription ); +// provider.commit(); +// refresh(); +// } +// else +// { +// JOptionPane.showMessageDialog( this, "Medida inv" + aacute + "lida", "Erro", JOptionPane.ERROR_MESSAGE, null ); +// } +// } +// } +// } +// +// private void adicionarPostoTrabalho() +// { +// PostoDeTrabalho [] postos = provider.getAllPostosNotInEstabelecimento( estabelecimento ); +// PostoDeTrabalho postoDeTrabalho = (PostoDeTrabalho) JOptionPane.showInputDialog( +// this, +// "Postos de trabalho", +// "Adicionar posto de trabalho", +// JOptionPane.QUESTION_MESSAGE, +// null, +// postos, +// null +// ); +// adicionarPostoTrabalho( postoDeTrabalho ); +// } +// +// private void adicionarPostoTrabalho( PostoDeTrabalho postoTrabalho ) +// { +// if( postoTrabalho != null ) +// { +// provider.addPostoTrabalhoToEstabelecimento( postoTrabalho, estabelecimento ); +// refresh(); +// } +// } +// +// private void adicionarEmail() +// { +// adicionarEmail( JOptionPane.showInputDialog( "Inserir e-mail" ) ); +// } +// +// private void adicionarEmail( String email ) +// { +// if( email != null && email.trim().length() > 0 ) +// { +// email = email.trim(); +// boolean valid = email.toUpperCase().matches( "[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}" ); +// if( valid ) +// { +// provider.addEmailToEstabelecimento( email, estabelecimento); +// refresh(); +// } +// else +// { +// JOptionPane.showMessageDialog( this, "Endere" + ccedil + "o de e-mail inv" + aacute + "lido", "Erro", JOptionPane.ERROR_MESSAGE, null ); +// } +// } +// } +// +// private void removeSelected( JTable table ) +// { +// VectorTableModel model = (VectorTableModel) table.getModel(); +// int indexes [] = table.getSelectedRows(); +// if( indexes != null && indexes.length > 0 ) +// { +// for( int i = 0; i < indexes.length; ++i ) +// { +// removeSelected( model, indexes[i] ); +// } +// refresh(); +// } +// } +// +// private void removeSelected( VectorTableModel model, int index ) +// { +// provider.delete( model.getRowAt( index ) ); +// } + + @Override + public void clear() + { +// modelEmail.clearAll(); +// modelLegislacao.clearAll(); +// modelPostoTrabalho.clearAll(); + } + + @Override + public void fill( Object value ) + { +// if( value != null ) +// { +// if( value instanceof Integer ) +// { +// estabelecimento = provider.getEstabelecimentoByID( (Integer) value ); +// } +// setEnabled( true ); +// } +// else +// { +// estabelecimento = null; +// setEnabled( false ); +// } +// refresh(); + } + + @Override + public Object save() + { + return null; + } + + @Override + public void setEnabled( boolean enabled ) + { +// tableEmail.setEnabled( enabled ); +// tableLegislacao.setEnabled( enabled ); +// tablePostoTrabalho.setEnabled( enabled ); +// buttonEmailAdicionar.setEnabled( enabled ); +// buttonLegislacaoAdicionar.setEnabled( enabled ); +// buttonPostoTrabalhoAdicionar.setEnabled( enabled ); +// buttonPostoTrabalhoCriar.setEnabled( enabled ); +// tableEmail.clearSelection(); +// tableLegislacao.clearSelection(); +// tablePostoTrabalho.clearSelection(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/EtiquetaChooserDialog.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/EtiquetaChooserDialog.java new file mode 100644 index 00000000..34c90851 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/EtiquetaChooserDialog.java @@ -0,0 +1,93 @@ +/* + * EtiquetaChooserPanel.java + * + * Created on 27 de Fevereiro de 2006, 11:21 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.clientes; + +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Hashtable; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +import com.evolute.utils.ui.CustomJDialog; + +/** + * + * @author Frederico + */ +public class EtiquetaChooserDialog extends CustomJDialog + implements ActionListener +{ + private int rows; + private int cols; + private final Hashtable positionHash = new Hashtable(); + + private int choice[]; + + /** Creates a new instance of EtiquetaChooserPanel */ + public EtiquetaChooserDialog( JFrame owner, int rows, int cols ) + { + super( owner, true ); + this.rows = rows; + this.cols = cols; + setupComponents(); + if( owner != null ) + { + centerSuper(); + } + else + { + center(); + } + } + + private void setupComponents() + { + setTitle( "Escolha a posi\u00e7\u00e3o" ); + setSize( cols * 200, rows * 50 ); + setLayout( new GridLayout( rows, cols ) ); + for( int r = 0; r < rows; r++ ) + { + for( int c = 0; c < cols; c++ ) + { + JButton button = new JButton( "( " + ( r + 1 ) + " , " + ( c + 1 ) + " )" ); + add( button ); + positionHash.put( button, new int[]{ r, c } ); + button.addActionListener( this ); + } + } + } + + protected void close() + { + SwingUtilities.invokeLater( new Runnable(){ + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + public int[] choose() + { + setVisible( true ); + return choice; + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + choice = positionHash.get( ( JButton ) source ); + close(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/EtiquetaPrinter.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/EtiquetaPrinter.java new file mode 100644 index 00000000..db364bf6 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/EtiquetaPrinter.java @@ -0,0 +1,206 @@ +/* + * EtiquetaPrinter.java + * + * Created on 27 de Fevereiro de 2006, 14:41 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.clientes; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.Hashtable; +import java.util.Locale; +import java.util.Vector; + +import siprp.data.outer.EtiquetasData; +import siprp.util.fop.FOPCreator; +import siprp.util.fop.FOPPrinter; + +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.xml.SimpleXMLElement; + +/** + * + * @author Frederico + */ +public class EtiquetaPrinter +{ + protected static final DecimalFormat N_F = new DecimalFormat(); + + static + { + DecimalFormatSymbols dfs = new DecimalFormatSymbols( new Locale( "pt", "PT" ) ); + dfs.setDecimalSeparator( '.' ); + N_F.setDecimalFormatSymbols( dfs ); + N_F.setMaximumFractionDigits( 4 ); + N_F.setMinimumFractionDigits( 0 ); + } + + protected Double altura; + protected Double largura; + protected Double margemEsquerda; + protected Double margemCima; + protected Integer colunas; + protected Integer linhas; + protected boolean continua; + protected Double alturaFolha; + protected Double larguraFolha; + protected Double margemVerticalFolha; + protected Double margemHorizontalFolha; + + /** Creates a new instance of EtiquetaPrinter */ + public EtiquetaPrinter( EtiquetasData etiqueta ) + { + altura = ( Double ) etiqueta.get( EtiquetasData.ALTURA ); + largura = ( Double ) etiqueta.get( EtiquetasData.LARGURA ); + margemEsquerda = ( Double ) etiqueta.get( EtiquetasData.MARGEM_ESQUERDA ); + margemCima = ( Double ) etiqueta.get( EtiquetasData.MARGEM_CIMA ); + colunas = ( Integer ) etiqueta.get( EtiquetasData.COLUNAS ); + linhas = ( Integer ) etiqueta.get( EtiquetasData.LINHAS ); + continua = "y".equals( etiqueta.get( EtiquetasData.CONTINUA ) ); + alturaFolha = ( Double ) etiqueta.get( EtiquetasData.ALTURA_FOLHA ); + larguraFolha = ( Double ) etiqueta.get( EtiquetasData.LARGURA_FOLHA ); + margemVerticalFolha = ( Double ) etiqueta.get( EtiquetasData.MARGEM_VERTICAL_FOLHA ); + margemHorizontalFolha = ( Double ) etiqueta.get( EtiquetasData.MARGEM_HORIZONTAL_FOLHA ); + } + + public void print( Vector data ) + { + int pos[] = new EtiquetaChooserDialog( null, linhas.intValue(), colunas.intValue() ).choose(); + if( pos == null ) + { + return; + } + int row = pos[ 0 ]; + int col = pos[ 1 ]; + String header = ""; + SimpleXMLElement styleSheet = + new SimpleXMLElement( "xsl:stylesheet" ); + styleSheet.addAttribute( "version", "1.1" ); + styleSheet.addAttribute( "xmlns:xsl", "http://www.w3.org/1999/XSL/Transform" ); + styleSheet.addAttribute( "xmlns:fo", "http://www.w3.org/1999/XSL/Format" ); + styleSheet.addAttribute( "exclude-result-prefixes", "fo" ); + styleSheet.setCompact( false ); + + SimpleXMLElement output = + new SimpleXMLElement( "xsl:output" ); + styleSheet.addElement( output ); + output.addAttribute( "method", "xml" ); + output.addAttribute( "version", "1.0" ); + output.addAttribute( "omit-xml-declaration", "no" ); + output.addAttribute( "indent", "yes" ); + + SimpleXMLElement template = + new SimpleXMLElement( "xsl:template" ); + styleSheet.addElement( template ); + template.addAttribute( "match", "ETIQUETA" ); + + SimpleXMLElement root = + new SimpleXMLElement( "fo:root" ); + template.addElement( root ); + + SimpleXMLElement layoutMasterSet = + new SimpleXMLElement( "fo:layout-master-set" ); + root.addElement( layoutMasterSet ); + + SimpleXMLElement simplePageMaster = + new SimpleXMLElement( "fo:simple-page-master" ); + layoutMasterSet.addElement( simplePageMaster ); + simplePageMaster.addAttribute( "master-name", "simpleA4" ); + simplePageMaster.addAttribute( "page-height", N_F.format( alturaFolha ) + "cm" ); + simplePageMaster.addAttribute( "page-width", N_F.format( larguraFolha ) + "cm" ); + simplePageMaster.addAttribute( "margin-top", N_F.format( ( row == 0 ? margemVerticalFolha : 0.0 ) + row * ( altura + margemCima ) ) + "cm" ); + simplePageMaster.addAttribute( "margin-bottom", "0.5cm" ); + simplePageMaster.addAttribute( "margin-left", N_F.format( ( col == 0 ? margemHorizontalFolha : 0.0 ) + col * ( largura + margemEsquerda ) ) + "cm" ); + simplePageMaster.addAttribute( "margin-right", N_F.format( col == colunas - 1 ? margemHorizontalFolha : 0.0 ) ); + + SimpleXMLElement regionBody = + new SimpleXMLElement( "fo:region-body" ); + simplePageMaster.addElement( regionBody ); + + SimpleXMLElement pageSequence = + new SimpleXMLElement( "fo:page-sequence" ); + root.addElement( pageSequence ); + pageSequence.addAttribute( "master-reference", "simpleA4" ); + + SimpleXMLElement flow = + new SimpleXMLElement( "fo:flow" ); + pageSequence.addElement( flow ); + flow.addAttribute( "flow-name", "xsl-region-body" ); + + for( Object line[] : data ) + { + SimpleXMLElement lineXML = createLine( line, largura - ( col == 0 || col == colunas - 1 ? margemHorizontalFolha : 0.0 ) ); + flow.addElement( lineXML ); + } +//System.out.println( "XSL: " + styleSheet.toString() ); + String xml = ""; + ByteArrayOutputStream out = new ByteArrayOutputStream(); + FOPCreator creator = FOPCreator.getFOPCreator(); + InputStream xmlIn = new ByteArrayInputStream( xml.getBytes() ); + try + { + creator.createFOfromXML( xmlIn, new ByteArrayInputStream( (header+styleSheet).getBytes() ), out ); + ByteArrayInputStream in = new ByteArrayInputStream( out.toString().getBytes() ); + Hashtable printOptions = new Hashtable(); +//System.out.println( "OUT: " + out.toString() ); + FOPPrinter printer = FOPPrinter.getFOPPrinter(); + printer.printFO( in, false, true, printOptions ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a imprimir", true ); + } + } + + protected SimpleXMLElement createLine( Object[] line, Double larguraDisponival ) + { + SimpleXMLElement table = + new SimpleXMLElement( "fo:table" ); + table.addAttribute( "table-layout", "fixed" ); + table.addAttribute( "width", N_F.format( larguraDisponival ) + "cm" ); + table.addAttribute( "space-before.optimum", "0pt" ); + table.addAttribute( "space-after.optimum", "0pt" ); + + for( int n = 1; n < line.length; n += 2 ) + { + SimpleXMLElement tableColumn = + new SimpleXMLElement( "fo:table-column" ); + table.addElement( tableColumn ); + tableColumn.addAttribute( "column-width", N_F.format( ( ( Double ) line[ n ] ) * larguraDisponival ) + "cm" ); + } + + SimpleXMLElement tableBody = + new SimpleXMLElement( "fo:table-body" ); + table.addElement( tableBody ); + + SimpleXMLElement tableRow = + new SimpleXMLElement( "fo:table-row" ); + tableBody.addElement( tableRow ); + + for( int n = 0; n < line.length; n += 2 ) + { + SimpleXMLElement tableCell = + new SimpleXMLElement( "fo:table-cell" ); + tableRow.addElement( tableCell ); + + SimpleXMLElement block = + new SimpleXMLElement( "fo:block" ); + tableCell.addElement( block ); + block.addAttribute( "font-size", "10pt" ); + block.addAttribute( "text-align", "left" ); +// block.addAttribute( "wrap-option", "no-wrap" ); +// block.addAttribute( "overflow", "scroll" ); + + block.addTextElement( ( String ) line[ n ] ); + } + + return table; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/HistoricoEstabelecimentoPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/HistoricoEstabelecimentoPanel.java new file mode 100644 index 00000000..ec90aba6 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/HistoricoEstabelecimentoPanel.java @@ -0,0 +1,293 @@ +/* + * HistoricoEstabelecimentoPanel.java + * + * Created on 7 de Dezembro de 2004, 15:17 + */ + +package siprp.clientes; + +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Hashtable; + +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.DocumentListener; + +import siprp.data.outer.EstabelecimentosData; +import siprp.data.outer.HistoricoEstabelecimentoData; + +import com.evolute.utils.EVUtilsImageLib; +import com.evolute.utils.dataui.ComponentController; +import com.evolute.utils.dataui.ComponentsHashtable; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import com.evolute.utils.ui.text.CopyPasteHandler; + +/** + * + * @author fpalma + */ +public class HistoricoEstabelecimentoPanel extends JPanel + implements ControllableComponent, DocumentListener, ChangeListener, ActionListener +{ + protected static final String LIST_PANEL = "LIST_PANEL"; + protected static final String FULL_LIST_PANEL = "FULL_LIST_PANEL"; + protected static final String EDIT_PANEL = "EDIT_PANEL"; + + private ComponentsHashtable components; + private EstabelecimentoPanel owner; + + private JCalendarPanel calendarPanel; + private JTextArea text; + private JButton saveButton; + private JButton cancelButton; + + private EstabelecimentosData estabelecimento; + private boolean changed = false; + private boolean filling = false; + + private HistoricoEstabelecimentoData historico; + + public HistoricoEstabelecimentoPanel( EstabelecimentoPanel owner ) + { + this.owner = owner; + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + { + calendarPanel = new JCalendarPanel( null ); +// calendarPanel.addDocumentListener( this ); + text = new JTextArea(); + new CopyPasteHandler( text ); +// text.getDocument().addDocumentListener( this ); + text.setLineWrap( true ); + text.setWrapStyleWord( true ); + JScrollPane textScp = new JScrollPane( text, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + saveButton = new JButton( "Guardar" ); + saveButton.addActionListener( this ); + cancelButton = new JButton( "Voltar" ); + cancelButton.addActionListener( this ); + + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + + constraints.weightx = 0; + constraints.gridwidth = 1; + constraints.weighty = 0; + constraints.gridheight = 1; + calendarPanel.setPreferredSize( new Dimension( 130, 30 ) ); + gridbag.setConstraints( calendarPanel, constraints ); + add( calendarPanel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + JPanel buttonPanel = new JPanel(); + gridbag.setConstraints( buttonPanel, constraints ); + add( buttonPanel ); + + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1; + gridbag.setConstraints( textScp, constraints ); + add( textScp ); + + buttonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) ); + initButtons(); + buttonPanel.add( cancelButton ); + buttonPanel.add( saveButton ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( HistoricoEstabelecimentoData.DATA, calendarPanel ); + components.putComponent( HistoricoEstabelecimentoData.TEXTO, text ); + components.putDummy( HistoricoEstabelecimentoData.ESTABELECIMENTO_ID ); + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + historico = null; + } + + public void fill(Object value) + { + filling = true; + clear(); + initButtons(); + historico = (HistoricoEstabelecimentoData)value; + if( historico == null ) + { + filling = false; + return; + } + String names[] = historico.getFieldNames(); + ComponentController.fill( names, historico.getHashData(), components ); + filling = false; + } + + public Object save() + { + if( historico == null ) + { + historico = new HistoricoEstabelecimentoData(); + } + + String names[] = historico.getFieldNames(); + Hashtable hash = new Hashtable(); + + ComponentController.save( names, hash, components ); + hash.put( HistoricoEstabelecimentoData.TO_ESTABELECIMENTO_ID, estabelecimento ); + historico.setHashData( hash ); + return historico; + } + + public void setEnabled(boolean enable) + { + super.setEnabled( enable ); + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + } + + public void changedUpdate(javax.swing.event.DocumentEvent documentEvent) + { + startEditedState(); + } + + public void insertUpdate(javax.swing.event.DocumentEvent documentEvent) + { + startEditedState(); + } + + public void removeUpdate(javax.swing.event.DocumentEvent documentEvent) + { + startEditedState(); + } + + private void startEditedState() + { + if( !filling ) + { + calendarPanel.removeChangeListener( this ); + text.getDocument().removeDocumentListener( this ); + changed = true; + saveButton.setEnabled( true ); + changeButton(); + } + } + + private void initButtons() + { + saveButton.setEnabled( false ); + calendarPanel.addChangeListener( this ); + text.getDocument().addDocumentListener( this ); + ClassLoader cl = new EVUtilsImageLib().getClass().getClassLoader(); + Icon normal = new ImageIcon( cl.getResource( "buttons/save_normal.gif" ) ); + Icon rollover = new ImageIcon( cl.getResource( "buttons/save_rollover.gif" ) ); + Icon pressed = new ImageIcon( cl.getResource( "buttons/save_pressed.gif" ) ); + Icon disabled = new ImageIcon( cl.getResource( "buttons/save_disabled.gif" ) ); + saveButton.setIcon( normal ); + saveButton.setRolloverIcon( rollover ); + saveButton.setPressedIcon( pressed ); + saveButton.setDisabledIcon( disabled ); + saveButton.setText( null ); + saveButton.setBorderPainted( false ); + saveButton.setRequestFocusEnabled( false ); + saveButton.setMargin( new Insets( 0, 0, 0, 0 ) ); + saveButton.setToolTipText( "Gravar" ); + + normal = new ImageIcon( cl.getResource( "buttons/shiftl_normal.gif" ) ); + rollover = new ImageIcon( cl.getResource( "buttons/shiftl_rollover.gif" ) ); + pressed = new ImageIcon( cl.getResource( "buttons/shiftl_pressed.gif" ) ); + disabled = new ImageIcon( cl.getResource( "buttons/shiftl_disabled.gif" ) ); + cancelButton.setIcon( normal ); + cancelButton.setRolloverIcon( rollover ); + cancelButton.setPressedIcon( pressed ); + cancelButton.setDisabledIcon( disabled ); + cancelButton.setText( null ); + cancelButton.setBorderPainted( false ); + cancelButton.setRequestFocusEnabled( false ); + cancelButton.setMargin( new Insets( 0, 0, 0, 0 ) ); + cancelButton.setToolTipText( "Voltar \u00e0 lista" ); + + } + + private void changeButton() + { + ClassLoader cl = new EVUtilsImageLib().getClass().getClassLoader(); + Icon normal = new ImageIcon( cl.getResource( "buttons/cancel_normal.gif" ) ); + Icon rollover = new ImageIcon( cl.getResource( "buttons/cancel_rollover.gif" ) ); + Icon pressed = new ImageIcon( cl.getResource( "buttons/cancel_pressed.gif" ) ); + Icon disabled = new ImageIcon( cl.getResource( "buttons/cancel_disabled.gif" ) ); + cancelButton.setIcon( normal ); + cancelButton.setRolloverIcon( rollover ); + cancelButton.setPressedIcon( pressed ); + cancelButton.setDisabledIcon( disabled ); + cancelButton.setToolTipText( "Cancelar" ); + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( saveButton ) ) + { + if( calendarPanel.getDate() == null ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher uma data", "Erro...", JOptionPane.ERROR_MESSAGE ); + return; + } + HistoricoEstabelecimentoData hist = ( HistoricoEstabelecimentoData ) save(); + + try + { + hist.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + return; + } + owner.reloadHistorico(); + } + else if( source.equals( cancelButton ) ) + { + owner.showHistorico(); + } + + } + + public void setEstabelecimento( EstabelecimentosData estabelecimento ) + { + this.estabelecimento = estabelecimento; + } + + public void stateChanged(ChangeEvent e) + { + startEditedState(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/ImagePanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/ImagePanel.java new file mode 100644 index 00000000..2dc979c3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/ImagePanel.java @@ -0,0 +1,220 @@ +package siprp.clientes; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.geom.AffineTransform; +import java.awt.image.AffineTransformOp; +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; + +import javax.imageio.ImageIO; +import javax.swing.BorderFactory; +import javax.swing.JFileChooser; +import javax.swing.JPanel; + +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.error.ErrorLogger; + +public class ImagePanel extends JPanel implements MouseListener, ControllableComponent +{ + + private static final long serialVersionUID = 1L; + + public static final int WIDTH_THUMBNAIL = 64; + + public static final int HEIGHT_THUMBNAIL = 64; + + public static final int WIDTH_FULL = 512; + + public static final int HEIGHT_FULL = 512; + + private final int w; + + private final int h; + + private boolean thumb = false; + + private BufferedImage scaledImage = null; + + private BufferedImage image = null; + + public ImagePanel( boolean thumbnail ) + { + thumb = thumbnail; + w = thumb ? WIDTH_THUMBNAIL : WIDTH_FULL; + h = thumb ? HEIGHT_THUMBNAIL : HEIGHT_FULL; + this.setSize( new Dimension(w,h) ); + this.setPreferredSize( new Dimension(w,h) ); + this.setOpaque( false ); + this.setLayout( new BorderLayout() ); + this.addMouseListener( this ); + this.setToolTipText( "Alterar logotipo " ); + fill( null ); + } + + public void fill( Object object ) + { + byte[] array = (byte[]) object; + image = null; + scaledImage = null; + try + { + if( array != null ) + { + ByteArrayInputStream input = new ByteArrayInputStream( array ); + scaledImage = ImageIO.read( input ); + input = new ByteArrayInputStream( array ); + image = ImageIO.read( input ); + } + } catch( IOException e ) + { + e.printStackTrace(); + } + refresh(); + } + + private void changeImage( File file ) + { + image = null; + scaledImage = null; + try + { + if( file != null && file.exists() ) + { + scaledImage = ImageIO.read( file ); + image = ImageIO.read( file ); + } + } catch( IOException e ) + { + e.printStackTrace( System.out ); + ErrorLogger.logException( e ); + } + refresh(); + } + + private void scaleImage() + { + if( scaledImage != null ) + { + this.setBorder( BorderFactory.createEmptyBorder() ); + if( scaledImage.getWidth() > w ) + { + AffineTransform af = AffineTransform.getScaleInstance( ( (double) w) / ( (double) scaledImage.getWidth() ), ( (double) w ) / ( (double) scaledImage.getWidth() ) ); + AffineTransformOp afOp = new AffineTransformOp( af, AffineTransformOp.TYPE_BILINEAR ); + scaledImage = afOp.filter( scaledImage, null ); + } + if( scaledImage.getHeight() > h ) + { + AffineTransform af = AffineTransform.getScaleInstance( ( (double) h) / ( (double) scaledImage.getHeight() ), ( (double) h ) / ( (double) scaledImage.getHeight() ) ); + AffineTransformOp afOp = new AffineTransformOp( af, AffineTransformOp.TYPE_BILINEAR ); + scaledImage = afOp.filter( scaledImage, null ); + } + } + else + { + this.setBorder( BorderFactory.createLineBorder( Color.GRAY, 1 ) ); + } + } + + private void refresh() + { + scaleImage(); + repaint(); + } + + @Override + public boolean imageUpdate( Image img, int infoflags, int x, int y, int w, int h ) + { + boolean loaded = !imageUpdate( img, infoflags, x, y, w, h ); + if( !loaded ) + { + refresh(); + } + return !loaded; + } + + @Override + protected void paintComponent( Graphics g ) + { + super.paintComponent( g ); + if( scaledImage != null ) + { + int shiftX = ( w - scaledImage.getWidth() ) / 2; + int shiftY = ( h - scaledImage.getHeight() ) / 2; + g.drawImage( scaledImage, 0 + shiftX, 0 + shiftY, w - shiftX, h - shiftY, this ); + } + } + + @Override + public void mouseClicked( MouseEvent e ) + { + if( this.isEnabled() ) + { + JFileChooser fc = new JFileChooser(); + int returned = fc.showOpenDialog( this ); + if( JFileChooser.APPROVE_OPTION == returned ) + { + changeImage( fc.getSelectedFile() ); + } + + } + } + + @Override + public void mouseEntered( MouseEvent e ) + { + this.setCursor( new Cursor( Cursor.HAND_CURSOR ) ); + } + + @Override + public void mouseExited( MouseEvent e ) + { + this.setCursor( new Cursor( Cursor.DEFAULT_CURSOR ) ); + } + + @Override + public void mousePressed( MouseEvent e ) + { + } + + @Override + public void mouseReleased( MouseEvent e ) + { + } + + @Override + public void clear() + { + fill( null ); + } + + @Override + public Object save() + { + byte [] result = null; + try + { + if( image != null ) + { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + ImageIO.write( image, "PNG", out ); + result = out.toByteArray(); + } + } + catch( IOException e ) + { + e.printStackTrace(); + } + return result; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/MarcacaoEmpresaPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/MarcacaoEmpresaPanel.java new file mode 100644 index 00000000..33307cec --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/MarcacaoEmpresaPanel.java @@ -0,0 +1,302 @@ +/* + * MarcacaoEmpresaPanel.java + * + * Created on 25 de Junho de 2004, 20:32 + */ + +package siprp.clientes; + +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Hashtable; + +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.event.ChangeListener; +import javax.swing.event.DocumentListener; + +import siprp.data.outer.EmpresasData; +import siprp.data.outer.MarcacoesEmpresaData; + +import com.evolute.utils.EVUtilsImageLib; +import com.evolute.utils.dataui.ComponentController; +import com.evolute.utils.dataui.ComponentsHashtable; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import com.evolute.utils.ui.text.CopyPasteHandler; + +/** + * + * @author fpalma + */ +public class MarcacaoEmpresaPanel extends JPanel + implements ControllableComponent, DocumentListener, ActionListener, ChangeListener +{ + protected static final String LIST_PANEL = "LIST_PANEL"; + protected static final String EDIT_PANEL = "EDIT_PANEL"; + + private ComponentsHashtable components; + private EmpresaPanel owner; + + private JCalendarPanel calendarPanel; + private JTextArea text; + private JCheckBox realizadaCheck; + private JButton saveButton; + private JButton cancelButton; + + private EmpresasData empresa; + private boolean changed = false; + private boolean filling = false; + + private MarcacoesEmpresaData marcacao; + + /** Creates a new instance of MarcacaoEmpresaPanel */ + public MarcacaoEmpresaPanel( EmpresaPanel owner ) + { + this.owner = owner; + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + { + calendarPanel = new JCalendarPanel( null ); +// calendarPanel.addDocumentListener( this ); + text = new JTextArea(); + new CopyPasteHandler( text ); +// text.getDocument().addDocumentListener( this ); + text.setLineWrap( true ); + text.setWrapStyleWord( true ); + JScrollPane textScp = new JScrollPane( text, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + realizadaCheck = new JCheckBox( "Realizada" ); + saveButton = new JButton( "Guardar" ); + saveButton.addActionListener( this ); + cancelButton = new JButton( "Voltar" ); + cancelButton.addActionListener( this ); + + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + + constraints.weightx = 0; + constraints.gridwidth = 1; + constraints.weighty = 0; + constraints.gridheight = 1; + calendarPanel.setPreferredSize( new Dimension( 130, 30 ) ); + gridbag.setConstraints( calendarPanel, constraints ); + add( calendarPanel ); + + gridbag.setConstraints( realizadaCheck, constraints ); + add( realizadaCheck ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + JPanel buttonPanel = new JPanel(); + gridbag.setConstraints( buttonPanel, constraints ); + add( buttonPanel ); + + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1; + gridbag.setConstraints( textScp, constraints ); + add( textScp ); + + buttonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) ); + initButtons(); + buttonPanel.add( cancelButton ); + buttonPanel.add( saveButton ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( MarcacoesEmpresaData.DATA, calendarPanel ); + components.putComponent( MarcacoesEmpresaData.TEXTO, text ); + components.putComponent( MarcacoesEmpresaData.REALIZADA, realizadaCheck ); + components.putDummy( MarcacoesEmpresaData.EMPRESA_ID ); + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + marcacao = null; + } + + public void fill(Object value) + { + filling = true; + clear(); + initButtons(); + marcacao = (MarcacoesEmpresaData)value; + if( marcacao == null ) + { + filling = false; + return; + } + String names[] = marcacao.getFieldNames(); + ComponentController.fill( names, marcacao.getHashData(), components ); + filling = false; + } + + public Object save() + { + if( marcacao == null ) + { + marcacao = new MarcacoesEmpresaData(); + } + + String names[] = marcacao.getFieldNames(); + Hashtable hash = new Hashtable(); + + ComponentController.save( names, hash, components ); + hash.put( MarcacoesEmpresaData.TO_EMPRESA_ID, empresa ); + marcacao.setHashData( hash ); + return marcacao; + } + + public void setEnabled(boolean enable) + { + super.setEnabled( enable ); + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + } + + public void changedUpdate(javax.swing.event.DocumentEvent documentEvent) + { + startEditedState(); + } + + public void insertUpdate(javax.swing.event.DocumentEvent documentEvent) + { + startEditedState(); + } + + public void removeUpdate(javax.swing.event.DocumentEvent documentEvent) + { + startEditedState(); + } + + private void startEditedState() + { + if( !filling ) + { + calendarPanel.removeChangeListener( this ); + text.getDocument().removeDocumentListener( this ); + realizadaCheck.removeChangeListener( this ); + changed = true; + saveButton.setEnabled( true ); + changeButton(); + } + } + + private void initButtons() + { + saveButton.setEnabled( false ); + calendarPanel.addChangeListener( this ); + realizadaCheck.addChangeListener( this ); + text.getDocument().addDocumentListener( this ); + ClassLoader cl = new EVUtilsImageLib().getClass().getClassLoader(); + Icon normal = new ImageIcon( cl.getResource( "buttons/save_normal.gif" ) ); + Icon rollover = new ImageIcon( cl.getResource( "buttons/save_rollover.gif" ) ); + Icon pressed = new ImageIcon( cl.getResource( "buttons/save_pressed.gif" ) ); + Icon disabled = new ImageIcon( cl.getResource( "buttons/save_disabled.gif" ) ); + saveButton.setIcon( normal ); + saveButton.setRolloverIcon( rollover ); + saveButton.setPressedIcon( pressed ); + saveButton.setDisabledIcon( disabled ); + saveButton.setText( null ); + saveButton.setBorderPainted( false ); + saveButton.setRequestFocusEnabled( false ); + saveButton.setMargin( new Insets( 0, 0, 0, 0 ) ); + saveButton.setToolTipText( "Gravar" ); + + normal = new ImageIcon( cl.getResource( "buttons/shiftl_normal.gif" ) ); + rollover = new ImageIcon( cl.getResource( "buttons/shiftl_rollover.gif" ) ); + pressed = new ImageIcon( cl.getResource( "buttons/shiftl_pressed.gif" ) ); + disabled = new ImageIcon( cl.getResource( "buttons/shiftl_disabled.gif" ) ); + cancelButton.setIcon( normal ); + cancelButton.setRolloverIcon( rollover ); + cancelButton.setPressedIcon( pressed ); + cancelButton.setDisabledIcon( disabled ); + cancelButton.setText( null ); + cancelButton.setBorderPainted( false ); + cancelButton.setRequestFocusEnabled( false ); + cancelButton.setMargin( new Insets( 0, 0, 0, 0 ) ); + cancelButton.setToolTipText( "Voltar \u00e0 lista" ); + + } + + private void changeButton() + { + ClassLoader cl = new EVUtilsImageLib().getClass().getClassLoader(); + Icon normal = new ImageIcon( cl.getResource( "buttons/cancel_normal.gif" ) ); + Icon rollover = new ImageIcon( cl.getResource( "buttons/cancel_rollover.gif" ) ); + Icon pressed = new ImageIcon( cl.getResource( "buttons/cancel_pressed.gif" ) ); + Icon disabled = new ImageIcon( cl.getResource( "buttons/cancel_disabled.gif" ) ); + cancelButton.setIcon( normal ); + cancelButton.setRolloverIcon( rollover ); + cancelButton.setPressedIcon( pressed ); + cancelButton.setDisabledIcon( disabled ); + cancelButton.setToolTipText( "Cancelar" ); + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( saveButton ) ) + { + if( calendarPanel.getDate() == null ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher uma data", "Erro...", JOptionPane.ERROR_MESSAGE ); + return; + } + MarcacoesEmpresaData marc = ( MarcacoesEmpresaData ) save(); + + try + { + marc.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + return; + } + owner.reloadMarcacoes(); + } + else if( source.equals( cancelButton ) ) + { + owner.showMarcacoes(); + } + + } + + public void setEmpresa( EmpresasData empresa ) + { + this.empresa = empresa; + } + + public void stateChanged(javax.swing.event.ChangeEvent changeEvent) + { + startEditedState(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/MarcacaoPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/MarcacaoPanel.java new file mode 100644 index 00000000..8f660691 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/MarcacaoPanel.java @@ -0,0 +1,619 @@ +/* + * MarcacaoPanel.java + * + * Created on 14 de Maio de 2004, 15:52 + */ + +package siprp.clientes; + +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.DateFormat; +import java.util.Arrays; +import java.util.Date; +import java.util.Vector; + +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import siprp.CompanyDataLoader; +import siprp.SingletonConstants; +import siprp.data.Marcacao; +import siprp.data.MarcacaoListLoader; +import siprp.data.MarcacaoTrabalhadorConstants; +import siprp.data.outer.ContactosData; +import siprp.data.outer.EstabelecimentosData; +import siprp.data.outer.MarcacoesEstabelecimentoData; +import siprp.data.outer.MarcacoesTrabalhadorData; +import siprp.data.outer.TrabalhadoresData; + +import com.evolute.utils.Singleton; +import com.evolute.utils.dataui.ComponentController; +import com.evolute.utils.dataui.ComponentsHashtable; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import com.evolute.utils.ui.dialog.ListActionDialog; + +/** + * + * @author fpalma + */ +public class MarcacaoPanel extends JPanel + implements ControllableComponent, ActionListener +{ + private final String COLUMN_NAMES_REL[]; + private static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( DateFormat.SHORT ); + + private Marcacao marcacoes[]; + private ComponentsHashtable components; + private int tipo; + + private final boolean comRelatorio; + + private Box anteriorPanel; + private JPanel correntePanel; + + private String realizadoLabelText; + private String relatorioLabelText; + + private JLabel dataMarcacaoAnteriorLabel; + private JCheckBox realizadaCheckBox; + private JCalendarPanel dataRelatorioPanel; + private JCalendarPanel dataMarcacaoPanel; + private JButton enviarEmailButton; + private JLabel dataEnvioMailLabel; + private JButton historicoButton; + + private TrabalhadoresData trabalhador; + private EstabelecimentosData estabelecimento; + + private MarcacaoListLoader loader; + private Marcacao current; + private Marcacao last; + + private boolean filling = false; + + /** Creates a new instance of MarcacaoPanel */ + public MarcacaoPanel( boolean comRelatorio, String realizadoLabelText, String relatorioLabelText, int tipo ) + { + this.comRelatorio = comRelatorio; + this.realizadoLabelText = realizadoLabelText; + this.relatorioLabelText = relatorioLabelText; + this.tipo = tipo; + COLUMN_NAMES_REL = new String[ comRelatorio ? 3 : 2 ]; + COLUMN_NAMES_REL[ 0 ] = "Data"; + COLUMN_NAMES_REL[ 1 ] = realizadoLabelText; + if( comRelatorio ) + { + COLUMN_NAMES_REL[ 2 ] = relatorioLabelText; + } + loader = new MarcacaoListLoader(); + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + { + anteriorPanel = new Box( BoxLayout.X_AXIS ); + anteriorPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Anterior" ) ); + correntePanel = new JPanel(); +// correntePanel.setBorder( BorderFactory.createTitledBorder( +// BorderFactory.createEtchedBorder(), +// "Corrente" ) ); + JPanel dataPanel = new JPanel(); + Box relatorioBox = new Box( BoxLayout.X_AXIS ); + + dataMarcacaoAnteriorLabel = new JLabel( "-" ); + dataEnvioMailLabel = new JLabel( "" ); + realizadaCheckBox = new JCheckBox( realizadoLabelText + " " ); + realizadaCheckBox.addChangeListener( new ChangeListener(){ + public void stateChanged( ChangeEvent e ) + { +System.out.println( "stateChanged" ); + if( last != null && !filling ) + { +System.out.println( "stateChanged2" ); + last.set( Marcacao.REALIZADA, realizadaCheckBox.isSelected() ? "y": "n" ); + try + { + last.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + realizadaCheckBox.setSelected( realizadaCheckBox.isSelected() ); + } + } + } + } ); + JLabel relatorioLabel = new JLabel( relatorioLabelText ); + dataRelatorioPanel = new JCalendarPanel( null ); + dataRelatorioPanel.addChangeListener( new ChangeListener(){ + public void stateChanged(ChangeEvent e) + { + if( !filling ) + { + marcarRelatorio(); + } + } + + private void marcarRelatorio() + { + last.set( Marcacao.DATA_RELATORIO, dataRelatorioPanel.getDate() ); + try + { + last.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + } + } + } ); + + dataMarcacaoPanel = new JCalendarPanel( null ); + dataMarcacaoPanel.addChangeListener( new ChangeListener(){ + public void stateChanged(ChangeEvent e) + { + if( !filling ) + { + marcar(); + } + } + } ); + enviarEmailButton = new JButton( "Enviar Email" ); + enviarEmailButton.addActionListener( this ); + historicoButton = new JButton( "H" ); + historicoButton.addActionListener( this ); + + anteriorPanel.add( dataPanel ); + if( comRelatorio ) + { + anteriorPanel.add( relatorioBox ); + anteriorPanel.add( relatorioLabel ); + anteriorPanel.add( dataRelatorioPanel ); + } + + dataPanel.setLayout( new GridLayout( 1, 2 ) ); + dataPanel.add( dataMarcacaoAnteriorLabel ); + dataPanel.add( realizadaCheckBox ); + + correntePanel.setLayout( new GridLayout( 1, 2 ) ); + correntePanel.add( dataMarcacaoPanel ); + correntePanel.add( enviarEmailButton ); + + //setLayout( new BoxLayout( this, BoxLayout.Y_AXIS ) ); + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0.5; + constraints.gridheight = 1; + constraints.weightx = 1; + constraints.gridwidth = 1; + + gridbag.setConstraints( anteriorPanel, constraints ); + add( anteriorPanel ); + + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 1; + constraints.gridheight = 2; + constraints.weightx = 0; + constraints.gridwidth = GridBagConstraints.REMAINDER; + historicoButton.setPreferredSize( new Dimension( 20, 40 ) ); + gridbag.setConstraints( historicoButton, constraints ); + add( historicoButton ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0.5; + constraints.gridheight = 1; + constraints.weightx = 1; + constraints.gridwidth = 1; + constraints.gridx = 0; + gridbag.setConstraints( correntePanel, constraints ); + add( correntePanel ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( Marcacao.DATA, dataMarcacaoPanel ); + components.putComponent( Marcacao.REALIZADA, realizadaCheckBox ); + components.putComponent( Marcacao.DATA_RELATORIO, dataRelatorioPanel ); + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + dataMarcacaoAnteriorLabel.setText( "" ); + dataEnvioMailLabel.setText( "" ); + marcacoes = null; + trabalhador = null; + estabelecimento = null; + current = null; + last = null; + } + + public void fill( Object value ) + { + filling = true; + clear(); + if( value == null ) + { + setEnabled( false ); + filling = false; + return; + } + switch( tipo ) + { + case Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES: case Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA: + if( ! ( value instanceof TrabalhadoresData ) ) + { + filling = false; + return ; + } + trabalhador = (TrabalhadoresData) value; + try + { + marcacoes = loader.load( tipo, (Integer)trabalhador.get( TrabalhadoresData.ID ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar as marca\u00e7\u00f5es", true ); + marcacoes = null; + } + break; + + case Marcacao.TIPO_MARCACAO_ESTABELECIMENTO: + if( ! ( value instanceof EstabelecimentosData ) ) + { + filling = false; + return ; + } + estabelecimento = (EstabelecimentosData) value; + try + { + marcacoes = loader.load( tipo, (Integer)estabelecimento.get( EstabelecimentosData.ID ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar as marca\u00e7\u00f5es", true ); + marcacoes = null; + } + break; + } + if( marcacoes == null || marcacoes.length == 0 ) + { + filling = false; + return; + } + Date lastDate = (Date) marcacoes[ 0 ].get( Marcacao.DATA ); + current = null; + last = null; + if( !lastDate.after( new Date() ) ) + { + current = null; + last = marcacoes[ 0 ]; + } + else + { + current = marcacoes[ 0 ]; + if( marcacoes.length > 1 ) + { + last = marcacoes[ 1 ]; + } + } + fillCurrent(); + fillLast(); + filling = false; + } + + private void fillCurrent() + { + if( current != null ) + { + Date dataMarcacao = (Date) current.get( Marcacao.DATA ); + dataMarcacaoPanel.setDate( dataMarcacao ); + Date dataMail = (Date) current.get( Marcacao.DATA_EMAIL ); + if( dataMail == null ) + { + enviarEmailButton.setEnabled( dataMarcacao != null ); + dataEnvioMailLabel.setText( "" ); + } + else + { + enviarEmailButton.setEnabled( false ); + dataEnvioMailLabel.setText( DATE_FORMAT.format( dataMail ) ); + } + } + else + { + enviarEmailButton.setEnabled( false ); + } + } + + private void fillLast() + { + if( last != null ) + { + Date dataMarcacao = (Date) last.get( Marcacao.DATA ); + dataMarcacaoAnteriorLabel.setText( DATE_FORMAT.format( dataMarcacao ) ); + String realizada = (String) last.get( Marcacao.REALIZADA ); + boolean isRealizada = "y".equals( realizada ); + realizadaCheckBox.setSelected( isRealizada ); + realizadaCheckBox.setEnabled( !isRealizada ); + Date dataRelatorio = (Date) last.get( Marcacao.DATA_RELATORIO ); + dataRelatorioPanel.setDate( dataRelatorio ); + } + else + { + realizadaCheckBox.setEnabled( false ); + dataRelatorioPanel.setEnabled( false ); + } + } + + public Object save() + { +// if( marcacoes == null ) +// { +// marcacoes = new Marcacao[ 0 ]; +// } +// if( marcacoes[ marcacoes.length - 1 ] == null ) +// { +// marcacoes[ marcacoes.length - 1 ] = Marcacao.getMarcacao( tipo ); +// } +// if( marcacoes.length > 1 ) +// { +// } + return null; + } + + public void setEnabled( boolean enable ) + { + filling = true; + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + if( !enable ) + { + enviarEmailButton.setEnabled( false ); + } + if( last == null ) + { + realizadaCheckBox.setEnabled( false ); + dataRelatorioPanel.setEnabled( false ); + } + filling = false; + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( enviarEmailButton ) ) + { + Date today = new Date(); + current.set( Marcacao.DATA_EMAIL, today ); + String subject = "."; + String texto = ""; + EstabelecimentosData estab = null; + if( current instanceof MarcacoesTrabalhadorData ) + { + TrabalhadoresData trab = ((MarcacoesTrabalhadorData)current).toTrabalhador_id(); + String nome = ( String )trab.get( TrabalhadoresData.NOME ); + String data = DateFormat.getDateInstance( DateFormat.SHORT ).format( ( Date )current.get( MarcacoesTrabalhadorData.DATA ) ); + if( ( ( Number )current.get( MarcacoesTrabalhadorData.TIPO ) ).intValue() == MarcacaoTrabalhadorConstants.TIPO_EXAMES ) + { + subject = ( String ) Singleton.getInstance( SingletonConstants.SUBJECT_EXAMES ); + subject = subject.replaceAll( CompanyDataLoader.NOME, nome ); + texto = ( String ) Singleton.getInstance( SingletonConstants.LETTER_EXAMES ); + texto = texto.replaceAll( CompanyDataLoader.DATA, data ); + texto = texto.replaceAll( CompanyDataLoader.NOME, nome ); +// subject = "Marca\u00E7\u00E3o de exame"; +// texto = "Vimos pelo presente informar que '" + nome + "' dever\u00E1 comparecer " +// + "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o dos exames de Medicina " +// + "do Trabalho, no dia '" + data + "', pelas 08H30." +// + "%0A%0A" +// + "Relembramos que o colaborador dever\u00E1 comparecer em jejum." +// + "%0A%0A" +// + "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data " +// + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 350 45 40 " +//// + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 210 21 21 " +// + "ou respondendo ao remetente desta mensagem." +// + "%0A%0A%0A" +// + "Cumprimentos,%0A%0ASIPRP"; +//// + "Cumprimentos,"; + } + else + { + subject = ( String ) Singleton.getInstance( SingletonConstants.SUBJECT_CONSULTA ); + subject = subject.replaceAll( CompanyDataLoader.NOME, nome ); + texto = ( String ) Singleton.getInstance( SingletonConstants.LETTER_CONSULTA ); + texto = texto.replaceAll( CompanyDataLoader.DATA, data ); + texto = texto.replaceAll( CompanyDataLoader.NOME, nome ); +// subject = "Marca\u00E7\u00E3o de consulta"; +// texto = "Vimos pelo presente informar que '" + nome + "' dever\u00E1 comparecer " +// + "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o da consulta de Medicina " +// + "do Trabalho, no dia '" + data + "', pelas 08H30." +// + "%0A%0A" +// + "%0A%0A" +// + "Solicitamos, tamb\u00E9m, que o colaborador seja portador do Boletim de Vacinas e " +// + "dos \u00FAltimos exames complementares realizados." +// + "%0A%0A" +// + "%0A%0A" +// + "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data " +// + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 350 45 40 " +//// + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 210 21 21 " +// + "ou respondendo ao remetente desta mensagem." +// + "%0A%0A%0A" +// + "Cumprimentos," +// + "%0A%0ASIPRP" +// + "%0A%0AATRIUM SALDANHA" +// + "%0A%0APra\u00e7a Duque de Saldanha, 1 - 9\u00BAC" +// + "%0A%0A1050-094 Lisboa"; + } + estab = trab.toEstabelecimento_id(); + } + else + { + estab = ( EstabelecimentosData ) current.get( MarcacoesEstabelecimentoData.TO_ESTABELECIMENTO_ID ); + String sede = ( String )estab.get( EstabelecimentosData.NOME ); + subject = ( String ) Singleton.getInstance( SingletonConstants.SUBJECT_VISITA ); + subject = subject.replaceAll( CompanyDataLoader.NOME, sede ); + String morada = ( String )estab.get( EstabelecimentosData.MORADA ); + String data = DateFormat.getDateInstance( DateFormat.SHORT ).format( ( Date ) current.get( MarcacoesEstabelecimentoData.DATA ) ); + texto = ( String ) Singleton.getInstance( SingletonConstants.LETTER_VISITA ); + texto = texto.replaceAll( CompanyDataLoader.DATA, data ); + texto = texto.replaceAll( CompanyDataLoader.NOME, sede ); + texto = texto.replaceAll( CompanyDataLoader.MORADA, morada ); +// texto = "Vimos pelo presente informar que iremos efectuar a auditoria de Higiene e " +// + "Seguran\u00E7a \u00E0s vossas instala\u00E7\u00F5es de '" + sede + "', no dia '" + data + "'." +// + "%0A%0A" +// + "Agradecemos que nos confirme, pela mesma via, o nome do representante " +// + "da empresa que nos ir\u00E1 acompanhar e a vossa disponibilidade para a " +// + "realiza\u00E7\u00E3o da visita na data indicada." +// + "%0A%0A" +// + "Caso necessite de qualquer esclarecimento, contacte-nos, por favor, " +// + "atrav\u00E9s dos telefones 21 350 45 43 (Pedro Vieira), 21 350 45 44 " +// + "(Catarina Leonardo) ou responda ao remetente desta mensagem." +//// + "atrav\u00E9s dos telefones 21 210 21 21 (Colaborador), 21 210 21 21 " +//// + "(Outro Colaborador) ou responda ao remetente desta mensagem." +// + "%0A%0A%0A" +// + "Cumprimentos,%0A%0ASIPRP"; +//// + "Cumprimentos,"; + + + } + ContactosData cont = ( ContactosData )estab.toContacto_id(); + String mail = ""; + if( cont != null ) + { + mail = cont.getEmail(); + } + try + { + current.save(); + if( System.getProperty( "os.name" ).startsWith( "Windows" ) ) + { + mail = mail.replaceAll( " ", "%20" ); + subject = subject.replaceAll( " ", "%20" ); + texto = texto.replaceAll( " ", "%20" ); + Process proc = Runtime.getRuntime().exec( "cmd.exe /c start mailto:\"" + mail + + "?subject=" + subject + "&body=" +// + "?subject=" + subject + "&body=" + + texto + ); + } + else + { + mail = mail.replaceAll( " ", "%20" ); + subject = subject.replaceAll( " ", "%20" ); + texto = texto.replaceAll( " ", "%20" ); +// System.out.println( "mailto:" + mail +// // + "?subject=SIPRP - " + subject + "&body=" +// + "?subject=" + subject + "&body=" +// + texto ); + Process proc = Runtime.getRuntime().exec( new String[]{ "/usr/bin/open", "/Applications/Mail.app", "mailto:" + mail + // + "?subject=SIPRP - " + subject + "&body=" + + "?subject=" + subject + "&body=" + + texto } ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a enviar mail", true ); + } + dataEnvioMailLabel.setText( DATE_FORMAT.format( today ) ); + } + else if( source.equals( historicoButton ) ) + { + Vector v = new Vector(); + if( marcacoes != null ) + { + v.addAll( Arrays.asList( marcacoes ) ); + } + ListActionDialog dialog = + new ListActionDialog( null, "Anteriores", + COLUMN_NAMES_REL, + v, null ); + dialog.setVisible( true ); + } + } + + public void marcar() + { +System.out.println( "MARCAR" ); + Date data = dataMarcacaoPanel.getDate(); + Vector aux = new Vector(); + if( marcacoes != null ) + { + aux.addAll( Arrays.asList( marcacoes ) ); + } + if( current == null && data != null ) + { + current = Marcacao.getMarcacao( tipo ); + current.set( Marcacao.REALIZADA, "n" ); + + aux.insertElementAt( current, 0 ); + switch( tipo ) + { + case Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES: case Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA: + current.set( MarcacoesTrabalhadorData.TO_TRABALHADOR_ID, trabalhador ); + current.set( MarcacoesTrabalhadorData.TIPO, new Integer( tipo ) ); + break; + + case Marcacao.TIPO_MARCACAO_ESTABELECIMENTO: + current.set( MarcacoesEstabelecimentoData.TO_ESTABELECIMENTO_ID, estabelecimento ); + break; + } + marcacoes = ( Marcacao [])aux.toArray( new Marcacao[0] ); +// System.out.println( "INSERI ! !! ! ! !! ! " ); + } + else if( current != null && data == null ) + { + aux.remove( 0 ); + marcacoes = ( Marcacao [])aux.toArray( new Marcacao[0] ); +// System.out.println( "REMOVI ! !! ! ! !! ! " ); + } + current.set( Marcacao.DATA, data ); + + try + { + if( data != null ) + { + current.save(); + enviarEmailButton.setEnabled( true ); + } + else + { + System.out.println( "DELETE DA MARCACAO" ); + current.delete(); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + } + } + + public void setCalendarDialogOrientation( int vertical, int horizontal ) + { + dataRelatorioPanel.setOrientation( vertical, horizontal ); + dataMarcacaoPanel.setOrientation( vertical, horizontal ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/NoticiasDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/NoticiasDataProvider.java new file mode 100644 index 00000000..e4f23ccc --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/NoticiasDataProvider.java @@ -0,0 +1,99 @@ +/* + * NoticiasDataProvider.java + * + * Created on 24 de Maio de 2005, 15:39 + */ + +package siprp.clientes; + +import siprp.SingletonConstants; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.db.JDBCManager; +import com.evolute.utils.metadb.MetaProvider; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.Select; + +/** + * + * @author fpalma + */ +public class NoticiasDataProvider extends MetaProvider +{ + private static final Object LOCK = new Object(); + private static NoticiasDataProvider instance = null; + private final Executer executer; + + /** Creates a new instance of NoticiasDataProvider */ + public NoticiasDataProvider() + throws Exception + { + boolean webAware = ( ( Boolean ) Singleton.getInstance( SingletonConstants.WEB_AWARE ) ).booleanValue(); + DBManager dbm; + if( webAware ) + { + String url = ( String ) Singleton.getInstance( SingletonConstants.WEB_URL_PREFIX ); + url += ( String ) Singleton.getInstance( SingletonConstants.WEB_URL ) + "/"; + url += ( String ) Singleton.getInstance( SingletonConstants.WEB_DB_NAME ) + "/"; + String user = ( String ) Singleton.getInstance( SingletonConstants.WEB_USER ); + String pwd = ( String ) Singleton.getInstance( SingletonConstants.WEB_PASSWORD ); + dbm = new JDBCManager( url, user, pwd, 10, 8, 8, null ); + executer = dbm.getSharedExecuter( this ); + } + else + { + dbm = null; + executer = null; + } + } + + public static MetaProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new NoticiasDataProvider(); + } + } + return instance; + } + + public String getNoticias() + throws Exception + { + Select subSelect = + new Select( new String[]{ "not_noticias" }, + new String[]{ "MAX(id)" }, null ); + + Select select = + new Select( new String[]{ "not_noticias" }, + new String[]{ "noticia" }, + new Field( "id" ).isEqual( subSelect ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return ""; + } + return array.get( 0, 0 ).toString().trim(); + } + + public void saveNoticias( String noticias ) + throws Exception + { + + + Insert insert = + new Insert( "not_noticias", + new Assignment[]{ new Assignment( new Field( "utilizador" ), Singleton.getInstance( Singleton.USERNAME ) ), + new Assignment( new Field( "data" ), Singleton.getInstance( Singleton.TODAY ) ), + new Assignment( new Field( "noticia" ), noticias.trim() ) } ); + executer.executeQuery( insert ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/NoticiasDialog.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/NoticiasDialog.java new file mode 100644 index 00000000..6db2c3b7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/NoticiasDialog.java @@ -0,0 +1,108 @@ +/* + * NoticiasPanel.java + * + * Created on 24 de Maio de 2005, 15:12 + */ + +package siprp.clientes; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; + +import com.evolute.utils.ui.CustomJDialog; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.panel.HTMLEditorPanel; +/** + * + * @author fpalma + */ +public class NoticiasDialog extends CustomJDialog + implements ActionListener +{ + protected HTMLEditorPanel textText; + protected JButton okButton; + protected JButton cancelButton; + + protected NoticiasDataProvider provider; + + /** Creates a new instance of NoticiasPanel */ + public NoticiasDialog( JFrame owner ) + throws Exception + { + super( owner, true ); + provider = (NoticiasDataProvider)NoticiasDataProvider.getProvider(); + setupComponents(); + if( owner != null ) + { + centerSuper(); + } + else + { + center(); + } + textText.fill( provider.getNoticias() ); + } + + private void setupComponents() + { + setTitle( "Editar Texto das Not\u00edcias" ); + setSize( 300, 200 ); + + textText = new HTMLEditorPanel( true ); +// textText.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), +// "Texto" ) ); + okButton = new JButton( "OK" ); + okButton.addActionListener( this ); + cancelButton = new JButton( "Cancelar" ); + cancelButton.addActionListener( this ); + + getContentPane().setLayout( new BorderLayout() ); + getContentPane().add( textText, BorderLayout.CENTER ); + JPanel buttonPanel = new JPanel(); + getContentPane().add( buttonPanel, BorderLayout.SOUTH ); + + buttonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) ); + buttonPanel.add( okButton ); + buttonPanel.add( cancelButton ); + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( okButton ) ) + { + try + { + provider.saveNoticias( (String) textText.save() ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar not\u00edcias", true ); + return; + } + close(); + } + else if( source.equals( cancelButton ) ) + { + close(); + } + } + + public void close() + { + SwingUtilities.invokeLater( new Thread(){ + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/PerfilProtocoloPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/PerfilProtocoloPanel.java new file mode 100644 index 00000000..04ef1c6e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/PerfilProtocoloPanel.java @@ -0,0 +1,160 @@ +/* + * PerfilProtocoloPanel.java + * + * Created on January 27, 2006, 12:24 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.clientes; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.Arrays; +import java.util.Vector; + +import javax.swing.BorderFactory; +import javax.swing.JCheckBox; +import javax.swing.JPanel; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.ui.panel.CheckBoxPanel; + +/** + * + * @author fpalma + */ +public class PerfilProtocoloPanel extends JPanel + implements ControllableComponent, ItemListener +{ + protected JCheckBox consultasCheck; + protected JCheckBox examesCheck; + protected CheckBoxPanel tiposCheck[]; + + protected IDObject grupos[]; + protected IDObject tipos[][]; + + /** Creates a new instance of PerfilProtocoloPanel */ + public PerfilProtocoloPanel( IDObject grupos[], IDObject tipos[][] ) + { + this.grupos = grupos; + this.tipos = tipos; + setupComponents(); + } + + private void setupComponents() + { + consultasCheck = new JCheckBox( "Consultas" ); + examesCheck = new JCheckBox( "Exames" ); + examesCheck.addItemListener( this ); + tiposCheck = new CheckBoxPanel[ grupos.length ]; + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.weightx = 1; + constraints.gridheight = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( consultasCheck, constraints ); + gridbag.setConstraints( examesCheck, constraints ); + + add( consultasCheck ); + add( examesCheck ); + + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = grupos.length > 0 ? 1.0 / grupos.length : 0.0; + for( int n = 0; n < grupos.length; n++ ) + { + tiposCheck[ n ] = setupComponentsGrupo( n ); + gridbag.setConstraints( tiposCheck[ n ], constraints ); + add( tiposCheck[ n ] ); + tiposCheck[ n ].setEnabled( false ); + } + } + + private CheckBoxPanel setupComponentsGrupo( int indice ) + { + String desc = grupos[ indice ].toString(); + CheckBoxPanel panel = new CheckBoxPanel( tipos[ indice ] ); + panel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), desc ) ); + return panel; + } + + public void fill( Object data ) + { + clear(); + if( data != null ) + { + Vector list = ( Vector ) data; + boolean consultasExames[] = (boolean[]) list.elementAt( 0 ); + Integer tiposEscolhidos[] = ( Integer [] ) list.elementAt( 1 ); + consultasCheck.setSelected( consultasExames[ 0 ] ); + examesCheck.setSelected( consultasExames[ 1 ] ); + for( int n = 0; n < tiposCheck.length; n++ ) + { + tiposCheck[ n ].fill( tiposEscolhidos ); + } + } + } + + public Object save() + { + boolean consultasExames[] = new boolean[ 2 ]; + consultasExames[ 0 ] = consultasCheck.isSelected(); + consultasExames[ 1 ] = examesCheck.isSelected(); + Vector tiposEscolhidos = new Vector(); + if( consultasExames[ 1 ] ) + { + for( int n = 0; n < tiposCheck.length; n++ ) + { + tiposEscolhidos.addAll( Arrays.asList( tiposCheck[ n ].getSelected() ) ); + } + } + Vector list = new Vector(); + list.add( consultasExames ); + list.add( tiposEscolhidos.toArray( new Integer[ tiposEscolhidos.size() ] ) ); + return list; + } + + public void setEnabled( boolean enable ) + { + consultasCheck.setEnabled( enable ); + examesCheck.setEnabled( enable ); + for( int n = 0; n < tiposCheck.length; n++ ) + { + tiposCheck[ n ].setEnabled( enable && examesCheck.isSelected() ); + } + } + + public void clear() + { + consultasCheck.setSelected( false ); + examesCheck.setSelected( false ); + for( int n = 0; n < tiposCheck.length; n++ ) + { + tiposCheck[ n ].clear(); + } + } + + public void itemStateChanged( ItemEvent e ) + { + Object source = e.getSource(); + if( source.equals( examesCheck ) ) + { + for( int n = 0; n < tiposCheck.length; n++ ) + { + tiposCheck[ n ].setEnabled( examesCheck.isEnabled() && examesCheck.isSelected() ); + } + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/ProtocoloPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/ProtocoloPanel.java new file mode 100644 index 00000000..53544e40 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/ProtocoloPanel.java @@ -0,0 +1,117 @@ +/* + * ProtocoloPanel.java + * + * Created on January 27, 2006, 12:23 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.clientes; + +import java.awt.GridLayout; +import java.util.Arrays; +import java.util.Hashtable; +import java.util.Vector; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JScrollPane; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.dataui.ControllableComponent; + +/** + * + * @author fpalma + */ +public class ProtocoloPanel extends JPanel + implements ControllableComponent +{ + protected ClientesDataProvider provider; + + protected IDObject grupos[]; + protected IDObject tipos[][]; + + protected PerfilProtocoloPanel perfisPanels[]; + + /** Creates a new instance of ProtocoloPanel */ + public ProtocoloPanel() + throws Exception + { + provider = ( ClientesDataProvider ) ClientesDataProvider.getProvider(); + IDObject gruposReais[] = provider.getAllGruposProtocoloReais(); + Vector gruposAux = new Vector( Arrays.asList( gruposReais ) ); + gruposAux.add( new MappableObject( new Integer( 0 ), "Outros" ) ); + grupos = ( IDObject[] ) gruposAux.toArray( new IDObject[ gruposReais.length + 1 ] ); + + IDObject gruposFalsos[] = provider.getAllGruposProtocoloFalsos(); + + Hashtable tiposHash = provider.getAllTiposElementosProtocoloByGrupo(); + tipos = new IDObject[ grupos.length ][]; + for( int n = 0; n < gruposReais.length; n++ ) + { + Vector tiposGrupo = ( Vector ) tiposHash.get( gruposReais[ n ].getID() ); + tipos[ n ] = ( IDObject[] ) tiposGrupo.toArray( new IDObject[ tiposGrupo.size() ] ); + } + Vector outros = new Vector(); + for( int n = 0; n < gruposFalsos.length; n++ ) + { + Vector tiposGrupo = ( Vector ) tiposHash.get( gruposFalsos[ n ].getID() ); + outros.addAll( tiposGrupo ); + } + tipos[ gruposReais.length ] = ( IDObject[] ) outros.toArray( new IDObject[ outros.size() ] ); + setupComponents(); + } + + private void setupComponents() + { + perfisPanels = new PerfilProtocoloPanel[ 2 ]; + + setLayout( new GridLayout( 1, 2 ) ); + + perfisPanels[ 0 ] = new PerfilProtocoloPanel( grupos, tipos ); + JScrollPane perfilAScp = + new JScrollPane( perfisPanels[ 0 ], JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + perfilAScp.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Perfil A" ) ); + add( perfilAScp ); + + perfisPanels[ 1 ] = new PerfilProtocoloPanel( grupos, tipos ); + JScrollPane perfilBScp = + new JScrollPane( perfisPanels[ 1 ], JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + perfilBScp.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Perfil B" ) ); + add( perfilBScp ); + } + + public void fill( Object data ) + { + Vector lists[] = ( Vector [] ) data; + perfisPanels[ 0 ].fill( lists[ 0 ] ); + perfisPanels[ 1 ].fill( lists[ 1 ] ); + } + + public Object save() + { + Vector lists[] = new Vector[ 2 ]; + lists[ 0 ] = ( Vector ) perfisPanels[ 0 ].save(); + lists[ 1 ] = ( Vector ) perfisPanels[ 1 ].save(); + return lists; + } + + public void setEnabled( boolean enable ) + { + perfisPanels[ 0 ].setEnabled( enable ); + perfisPanels[ 1 ].setEnabled( enable ); + } + + public void clear() + { + perfisPanels[ 0 ].clear(); + perfisPanels[ 1 ].clear(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/TrabalhadorPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/TrabalhadorPanel.java new file mode 100644 index 00000000..40bbae28 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/TrabalhadorPanel.java @@ -0,0 +1,544 @@ +/* + * TrabalhadorPanel.java + * + * Created on 14 de Maio de 2004, 12:29 + */ + +package siprp.clientes; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Arrays; +import java.util.Hashtable; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import siprp.FichaDataProvider; +import siprp.SIPRPTracker; +import siprp.data.outer.EmpresasData; +import siprp.data.outer.EstabelecimentosData; +import siprp.data.outer.TrabalhadoresData; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.dataui.ComponentController; +import com.evolute.utils.dataui.ComponentsHashtable; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.error.ErrorLogger; +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.VectorTableModel; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import com.evolute.utils.ui.panel.RadioButtonFixedPanel; +import com.evolute.utils.ui.panel.RadioButtonPanel; +import com.evolute.utils.ui.text.CopyPasteHandler; + +/** + * + * @author fpalma + */ +public class TrabalhadorPanel extends JPanel + implements ControllableComponent, ListSelectionListener, ActionListener +{ + private FichaDataProvider provider; + private TrabalhadoresData trabalhador; + private ComponentsHashtable components; + + private EstabelecimentosData estabelecimento; + private JTable estabelecimentosTable; + + private JPanel toolbarPanel; + + private JPanel dadosTrabalhadorPanel; + + private JTextField nomeText; + private RadioButtonFixedPanel sexoPanel; + private JTextField biText; + private JCalendarPanel dataNascimentoPanel; + private JTextField nacionalidadeText; + private JTextField numeroMecanograficoText; + private JCalendarPanel dataAdmissaoPanel; + private JTextField categoriaText; + private JTextField localText; + private JTextField funcaoText; + private JCalendarPanel dataAdmissaoFuncaoPanel; + private JCalendarPanel dataDemissaoPanel; + private JTextField observacoesText; + //private JComboBox perfilCombo; + private RadioButtonFixedPanel perfilPanel; + + private SIPRPTracker tracker; + + private BaseTable trabalhadoresTable; + private VectorTableModel trabalhadoresModel; + + private JButton marcacoesButton; +// private MarcacaoPanel examesPanel; +// private MarcacaoPanel consultaPanel; + + private Vector listeners; + + private boolean lastEnable = false; + + /** Creates a new instance of TrabalhadorPanel */ + public TrabalhadorPanel( JPanel toolbarPanel, JTable estabelecimentosTable ) + throws Exception + { + this.toolbarPanel = toolbarPanel; + this.estabelecimentosTable = estabelecimentosTable; + provider = ( FichaDataProvider )FichaDataProvider.getProvider(); + listeners = new Vector(); + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + { + dadosTrabalhadorPanel = new JPanel(); +// JPanel marcacoesPanel = new JPanel(); + + JLabel nomeLabel = new JLabel( "Nome" ); + nomeText = new JTextField(); + JLabel sexoLabel = new JLabel( "Sexo" ); + sexoPanel = + new RadioButtonFixedPanel( + new IDObject[]{ new MappableObject( new Integer( 1 ), "M" ), + new MappableObject( new Integer( 2 ), "F" ) }, + 1, 2, RadioButtonPanel.ORIENTATION_HORIZONTAL, false ); + JLabel biLabel = new JLabel("B.I."); + biText = new JTextField(); + JLabel dataNascimentoLabel = new JLabel( "Data de Nascimento" ); + dataNascimentoPanel = new JCalendarPanel( null ); + JLabel nacionalidadeLabel = new JLabel( "Nacionalidade" ); + nacionalidadeText = new JTextField(); + JLabel numeroMecanograficoLabel = new JLabel( "N\u00famero Mecanogr\u00e1fico/Outro" ); + numeroMecanograficoText = new JTextField(); + JLabel dataAdmissaoLabel = new JLabel( "Data de Admiss\u00e3o" ); + dataAdmissaoPanel = new JCalendarPanel( null ); + JLabel categoriaLabel = new JLabel( "Categoria Profissional" ); + categoriaText = new JTextField(); + JLabel localLabel = new JLabel( "Local de Trabalho" ); + localText = new JTextField(); + JLabel funcaoLabel = new JLabel( "Fun\u00e7\u00e3o Proposta" ); + funcaoText = new JTextField(); + JLabel dataAdmissaoFuncaoLabel = new JLabel( "Data de Admiss\u00e3o na Fun\u00e7\u00e3o" ); + dataAdmissaoFuncaoPanel = new JCalendarPanel( null ); + JLabel perfilLabel = new JLabel( "Perfil" ); +// perfilCombo = new JComboBox(); +// perfilCombo.addItem( new MappableObject( new Integer( 1 ), "A" ) ); +// perfilCombo.addItem( new MappableObject( new Integer( 2 ), "B" ) ); + perfilPanel = new RadioButtonFixedPanel( + new IDObject[]{ new MappableObject( new Integer( 1 ), "A" ), + new MappableObject( new Integer( 2 ), "B" ) }, + 1, 2, RadioButtonPanel.ORIENTATION_HORIZONTAL, false ); + JLabel dataDemissaoLabel = new JLabel( "Data de Demiss\u00e3o" ); + dataDemissaoPanel = new JCalendarPanel( null ); + JLabel observacoesLabel = new JLabel( "Observa\u00e7\u00f5es" ); + observacoesText = new JTextField(); + marcacoesButton = new JButton( "Marca\u00e7\u00f5es" ); + marcacoesButton.addActionListener( this ); + + JScrollPane trabalhadoresScroll = new JScrollPane(); + trabalhadoresScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + trabalhadoresScroll.setPreferredSize( new Dimension( 250, 300 ) ); + trabalhadoresModel = new VectorTableModel( new String[]{ "Trabalhadores" } ); + trabalhadoresTable = new BaseTable( trabalhadoresModel ); + trabalhadoresTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + trabalhadoresTable.setNonResizableNorReordable(); + trabalhadoresScroll.setViewportView( trabalhadoresTable ); + + JPanel pad; + + double [] cols = new double[]{TableLayout.MINIMUM,TableLayout.FILL,TableLayout.MINIMUM,TableLayout.FILL}; + double [] rows = new double[]{TableLayout.MINIMUM, + TableLayout.MINIMUM, + TableLayout.MINIMUM, + TableLayout.MINIMUM, + TableLayout.MINIMUM, + TableLayout.MINIMUM, + TableLayout.MINIMUM, + TableLayout.MINIMUM, + TableLayout.FILL, + TableLayout.MINIMUM,}; + + TableLayout layout = new TableLayout(cols,rows); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + dadosTrabalhadorPanel.setLayout( layout ); + dadosTrabalhadorPanel.add( nomeLabel, new TableLayoutConstraints( 0,0 ) ); + dadosTrabalhadorPanel.add( nomeText, new TableLayoutConstraints( 1,0,3,0 ) ); + dadosTrabalhadorPanel.add( sexoLabel, new TableLayoutConstraints( 0,1 ) ); + JPanel sexoOuterPanel = new JPanel(); + sexoOuterPanel.setLayout( new GridLayout( 1, 2 ) ); + sexoOuterPanel.add( sexoPanel ); + sexoOuterPanel.add( new JPanel() ); + dadosTrabalhadorPanel.add( sexoOuterPanel, new TableLayoutConstraints( 1,1 ) ); + dadosTrabalhadorPanel.add( biLabel, new TableLayoutConstraints( 2,1 ) ); + dadosTrabalhadorPanel.add( biText, new TableLayoutConstraints( 3,1 ) ); + dadosTrabalhadorPanel.add( nacionalidadeLabel, new TableLayoutConstraints( 0,2 ) ); + dadosTrabalhadorPanel.add( nacionalidadeText, new TableLayoutConstraints( 1,2 ) ); + dadosTrabalhadorPanel.add( dataNascimentoLabel, new TableLayoutConstraints( 2,2 ) ); + dadosTrabalhadorPanel.add( dataNascimentoPanel, new TableLayoutConstraints( 3,2 ) ); + + dadosTrabalhadorPanel.add( numeroMecanograficoLabel, new TableLayoutConstraints( 0,3 ) ); + dadosTrabalhadorPanel.add( numeroMecanograficoText, new TableLayoutConstraints( 1,3 ) ); + dadosTrabalhadorPanel.add( dataAdmissaoLabel, new TableLayoutConstraints( 2,3 ) ); + dadosTrabalhadorPanel.add( dataAdmissaoPanel, new TableLayoutConstraints( 3,3 )); + dadosTrabalhadorPanel.add( categoriaLabel, new TableLayoutConstraints( 0,4 ) ); + dadosTrabalhadorPanel.add( categoriaText, new TableLayoutConstraints( 1,4 ) ); + dadosTrabalhadorPanel.add( localLabel, new TableLayoutConstraints( 2,4 ) ); + dadosTrabalhadorPanel.add( localText, new TableLayoutConstraints( 3,4 )); + dadosTrabalhadorPanel.add( funcaoLabel, new TableLayoutConstraints( 0,5 ) ); + dadosTrabalhadorPanel.add( funcaoText, new TableLayoutConstraints( 1,5 ) ); + dadosTrabalhadorPanel.add( dataAdmissaoFuncaoLabel, new TableLayoutConstraints( 2,5 ) ); + dadosTrabalhadorPanel.add( dataAdmissaoFuncaoPanel, new TableLayoutConstraints( 3,5 ) ); + dadosTrabalhadorPanel.add( perfilLabel, new TableLayoutConstraints( 0,6 ) ); + dadosTrabalhadorPanel.add( perfilPanel, new TableLayoutConstraints( 1,6 ) ); + dadosTrabalhadorPanel.add( dataDemissaoLabel, new TableLayoutConstraints( 2,6 ) ); + dadosTrabalhadorPanel.add( dataDemissaoPanel, new TableLayoutConstraints( 3,6 ) ); + dadosTrabalhadorPanel.add( observacoesLabel, new TableLayoutConstraints( 0,7 ) ); + dadosTrabalhadorPanel.add( observacoesText, new TableLayoutConstraints( 0,8, 3, 8 ) ); + dadosTrabalhadorPanel.add( marcacoesButton, new TableLayoutConstraints( 0,9,3,9 ) ); + +// examesPanel = new MarcacaoPanel( false, "Realizados", "", Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ); +// examesPanel.setCalendarDialogOrientation( JCalendarDialog.ABOVE, JCalendarDialog.RIGHT ); +// examesPanel.setBorder( BorderFactory.createTitledBorder( +// BorderFactory.createEtchedBorder(), +// "Exames" ) ); +// consultaPanel = new MarcacaoPanel( true, "Realizada", "Ficha de Aptid\u00e3o", Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ); +// consultaPanel.setCalendarDialogOrientation( JCalendarDialog.ABOVE, JCalendarDialog.LEFT ); +// consultaPanel.setBorder( BorderFactory.createTitledBorder( +// BorderFactory.createEtchedBorder(), +// "Consulta" ) ); +// //marcacoesPanel.setLayout( new BoxLayout( marcacoesPanel, BoxLayout.X_AXIS ) ); +// marcacoesPanel.setLayout( new GridLayout( 1, 2 ) ); +// marcacoesPanel.add( examesPanel ); +// marcacoesPanel.add( consultaPanel ); + + JPanel leftPanel = new JPanel(); + leftPanel.setLayout( new BorderLayout() ); + leftPanel.add( toolbarPanel, BorderLayout.NORTH ); + leftPanel.add( trabalhadoresScroll, BorderLayout.CENTER ); + + setLayout( new BorderLayout() ); + add( leftPanel, BorderLayout.WEST ); + add( dadosTrabalhadorPanel, BorderLayout.CENTER ); +// add( marcacoesPanel, BorderLayout.SOUTH ); + + trabalhadoresTable.getSelectionModel().addListSelectionListener( this ); + + new CopyPasteHandler( nomeText ); + new CopyPasteHandler( nacionalidadeText ); + new CopyPasteHandler( numeroMecanograficoText ); + new CopyPasteHandler( categoriaText ); + new CopyPasteHandler( localText ); + new CopyPasteHandler( funcaoText ); + new CopyPasteHandler( observacoesText ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( TrabalhadoresData.NOME, nomeText ); + components.putComponent( TrabalhadoresData.SEXO, new ControllableComponent() + { + public void fill( Object value ) + { + if( value != null && value.equals( "f" ) ) + { + sexoPanel.fill( new Integer(2) ); + } + else + { + sexoPanel.fill( new Integer(1) ); + } + } + + public Object save() + { + Integer id = (Integer)sexoPanel.save(); + if( id != null && id.intValue() == 1 ) + { + return "m"; + } + return "f"; + } + + public void clear() + { + sexoPanel.clear(); + } + + public void setEnabled( boolean enable ) + { + sexoPanel.setEnabled( enable ); + } + } ); + components.putComponent( TrabalhadoresData.BI , biText ); + components.putComponent( TrabalhadoresData.DATA_NASCIMENTO, dataNascimentoPanel ); + components.putComponent( TrabalhadoresData.NACIONALIDADE, nacionalidadeText ); + components.putComponent( TrabalhadoresData.NUMERO_MECANOGRAFICO, numeroMecanograficoText ); + components.putComponent( TrabalhadoresData.DATA_ADMISSAO, dataAdmissaoPanel ); + components.putComponent( TrabalhadoresData.CATEGORIA, categoriaText ); + components.putComponent( TrabalhadoresData.LOCAL_TRABALHO, localText ); + components.putComponent( TrabalhadoresData.FUNCAO_PROPOSTA, funcaoText ); + components.putComponent( TrabalhadoresData.DATA_ADMISSAO_FUNCAO, dataAdmissaoFuncaoPanel ); + components.putComponent( TrabalhadoresData.DATA_DEMISSAO, dataDemissaoPanel ); + components.putDummy( TrabalhadoresData.OBSERVACOES ); + components.putComponent( TrabalhadoresData.OBSERVACOES_GESTAO, observacoesText ); + components.putComponent( TrabalhadoresData.PERFIL, perfilPanel ); +// components.putDummy( TrabalhadoresData.INACTIVO ); + components.putDummy( TrabalhadoresData.ESTABELECIMENTO_ID ); + components.putDummy( TrabalhadoresData.NOME_PLAIN ); + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + trabalhador = null; + } + + public void fill(Object value) + { + clear(); + trabalhador = ( TrabalhadoresData ) value; +// examesPanel.setEnabled( trabalhador != null ); +// examesPanel.fill( trabalhador ); +// consultaPanel.setEnabled( trabalhador != null ); +// consultaPanel.fill( trabalhador ); + if( trabalhador == null ) + { + trabalhadoresTable.clearSelection(); + return; + } + String names[] = trabalhador.getFieldNames(); + ComponentController.fill( names, trabalhador.getHashData(), components ); + } + + public Object save() + { + + if( trabalhador == null ) + { + trabalhador = new TrabalhadoresData(); + } + + String names[] = trabalhador.getFieldNames(); + Hashtable hash = new Hashtable(); + ComponentController.save( names, hash, components ); + trabalhador.setHashData( hash ); + trabalhador.set( TrabalhadoresData.TO_ESTABELECIMENTO_ID, estabelecimento ); + return trabalhador; + } + + public void setEnabled( boolean enable ) + { + super.setEnabled( enable ); + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + trabalhadoresTable.setEnabled( !enable ); + if( lastEnable != enable ) + { + if( enable ) + { + EstabelecimentoPanel.disables++; + } + else + { + EstabelecimentoPanel.disables--; + } + lastEnable = enable; + } + estabelecimentosTable.setEnabled( EstabelecimentoPanel.disables == 0 ); +// if( trabalhador == null ) +// { +// examesPanel.setEnabled( false ); +// consultaPanel.setEnabled( false ); +// } + } + + public void reloaList() + throws Exception + { + if( estabelecimento == null ) + { + trabalhadoresModel.clearAll(); + } + else + { + Integer id = ( Integer )estabelecimento.get( EstabelecimentosData.ID ); + IDObject []trabalhadores = provider.getAllTrabalhadoresForEstabelecimento( id ); + trabalhadoresModel.setValues( new Vector( Arrays.asList( trabalhadores ) ) ); + } + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + if( source instanceof EmpresaPanel ) + { + Integer id = ( ( EmpresaPanel ) source ).getSelectedEstabelecimento(); + if( id != null ) + { + try + { + IDObject []trabalhadores = provider.getAllTrabalhadoresForEstabelecimento( id ); + trabalhadoresModel.setValues( new Vector( Arrays.asList( trabalhadores ) ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os trabalhadores", true ); + clear(); + } + } + else + { + trabalhadoresModel.clearAll(); + clear(); + } + } + else if( source.equals( trabalhadoresTable.getSelectionModel() ) ) + { +// int selected = trabalhadoresTable.getSelectedRow(); +// if( selected == -1 ) +// { +// clear(); +// +// } +// else +// { +// Integer id = ( ( IDObject ) trabalhadoresModel.getRowAt( selected ) ).getID();; +// try +// { +// TrabalhadoresData trabalhador = (TrabalhadoresData) TrabalhadoresData.load( TrabalhadoresData.class, id ); +// fill( trabalhador ); +// } +// catch( Exception ex ) +// { +// DialogException.showExceptionMessage( ex, "Erro a carregar o trabalhador", true ); +// clear(); +// } + for( int n = 0; n < listeners.size(); n++ ) + { + ListSelectionEvent newEvent = + new ListSelectionEvent( this, e.getFirstIndex(), e.getLastIndex(), e.getValueIsAdjusting() ); + ( (ListSelectionListener) listeners.elementAt( n ) ).valueChanged( newEvent ); + } +// } + } + } + + public void postSave() + { + int selected = trabalhadoresTable.getSelectedRow(); +//System.out.println( "postSave TRABALHADOR PANEL " + selected + " : " + ( trabalhador == null ) ); + if( trabalhador != null ) + { + IDObject obj = new MappableObject( (Integer) trabalhador.get( TrabalhadoresData.ID ), trabalhador.get( TrabalhadoresData.NOME ) ); + if( selected == -1 ) + { + trabalhadoresModel.insertRowAt( obj, trabalhadoresTable.getRowCount() ); + trabalhadoresTable.setRowSelectionInterval( trabalhadoresTable.getRowCount() - 1, trabalhadoresTable.getRowCount() - 1 ); + } + else + { + trabalhadoresModel.removeRowAt( selected ); + trabalhadoresModel.insertRowAt( obj, selected ); + trabalhadoresTable.setRowSelectionInterval( selected, selected ); + } + } + } + + public void reload() + { + fill( trabalhador ); + } + + public void addListSelectionListener( ListSelectionListener listener ) + { + listeners.add( listener ); + } + + public void removeListSelectionListener( ListSelectionListener listener ) + { + listeners.remove( listener ); + } + + public Integer getSelectedTrabalhador() + { + int selected = trabalhadoresTable.getSelectedRow(); + if( selected == -1 ) + { + return null; + } + return ( (IDObject) trabalhadoresModel.getRowAt( selected ) ).getID(); + } + + public void setEstabelecimento( EstabelecimentosData estabelecimento ) + { + this.estabelecimento = estabelecimento; + } + + public void setSelectedTrabalhador( TrabalhadoresData trab ) + { + IDObject lista[] = (IDObject [])trabalhadoresModel.getValues().toArray( new IDObject[ 0 ] ); + Integer id = (Integer)trab.get( TrabalhadoresData.ID ); + for( int n = 0; n < lista.length; n++ ) + { + if( lista[ n ].getID().equals( id ) ) + { + trabalhadoresTable.setRowSelectionInterval( n, n ); + return; + } + } + trabalhadoresTable.clearSelection(); + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( marcacoesButton ) ) + { + if( trabalhador == null ) + { + return; + } + else + { + try + { + EstabelecimentosData estabelecimento = trabalhador.toEstabelecimento_id(); + EmpresasData empresa = estabelecimento.toEmpresa_id(); + tracker.getMedicinaWindow().setVisible( true ); + tracker.getMedicinaWindow().setEmpresaAndEstabelecimentoAndTrabalhador( (Integer) empresa.get( EmpresasData.ID ), + ( Integer ) estabelecimento.get( EstabelecimentosData.ID ), + ( Integer ) trabalhador.get( TrabalhadoresData.ID ) ); + } + catch (Exception ex) { + ErrorLogger.logException(ex); + } + } + } + } + + public void setTracker( SIPRPTracker tracker ) + { + this.tracker = tracker; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/UserDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/UserDataProvider.java new file mode 100644 index 00000000..ee5a373a --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/UserDataProvider.java @@ -0,0 +1,159 @@ +/* + * UserDataProvider.java + * + * Created on 8 de Novembro de 2004, 18:38 + */ + +package siprp.clientes; + +import siprp.SingletonConstants; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.db.JDBCManager; +import com.evolute.utils.metadb.MetaProvider; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Update; +/** + * + * @author fpalma + */ +public class UserDataProvider extends MetaProvider +{ + private static final String RESERVED_ROLES_MANAGER = "manager"; + private static final String RESERVED_ROLES_ADMIN = "admin"; + private static final Object LOCK = new Object(); + private static UserDataProvider instance = null; + private final Executer executer; + + protected final Expression excludeReserved; + + /** Creates a new instance of UserDataProvider */ + public UserDataProvider() + throws Exception + { + boolean webAware = ( ( Boolean ) Singleton.getInstance( SingletonConstants.WEB_AWARE ) ).booleanValue(); + DBManager dbm; + if( webAware ) + { + String url = ( String ) Singleton.getInstance( SingletonConstants.WEB_URL_PREFIX ); + url += ( String ) Singleton.getInstance( SingletonConstants.WEB_URL ) + "/"; + url += ( String ) Singleton.getInstance( SingletonConstants.WEB_DB_NAME ) + "/"; + String user = ( String ) Singleton.getInstance( SingletonConstants.WEB_USER ); + String pwd = ( String ) Singleton.getInstance( SingletonConstants.WEB_PASSWORD ); + dbm = new JDBCManager( url, user, pwd, 10, 8, 8, null ); + executer = dbm.getSharedExecuter( this ); + } + else + { + dbm = null; + executer = null; + } + excludeReserved = new Field( "role" ).isDifferent( RESERVED_ROLES_MANAGER ).and( + new Field( "role" ).isDifferent( RESERVED_ROLES_ADMIN ) ); + } + + public static MetaProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new UserDataProvider(); + } + } + return instance; + } + + public String getUserName( Integer empresaID ) + throws Exception + { +System.out.println( "getUserName( " +empresaID+ " )" ) ; + Select select = new Select( new String[]{ "roles" }, new String[]{ "username" }, + new Field( "role" ).isEqual( empresaID == null ? "siprpuser" : empresaID.toString() ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 ) + { + return null; + } + return array.get( 0, 0 ).toString(); + } + + public void saveUser( String userName, String password, Integer empresaID, boolean isNew ) + throws Exception + { + if( isNew ) + { + Insert insert = + new Insert( "roles", + new Assignment[]{ new Assignment( new Field( "username" ), userName ), + new Assignment( new Field( "role" ), empresaID == null ? "siprpuser" : empresaID.toString() ) } ); + executer.executeQuery( insert, null ); + insert = + new Insert( "users", + new Assignment[]{ new Assignment( new Field( "username" ), userName ), + new Assignment( new Field( "password" ), password ) } ); + executer.executeQuery( insert, null ); + } + else + { + Select select = new Select( new String[]{ "roles" }, new String[]{ "username" }, + new Field( "role" ).isEqual( empresaID == null ? "siprpuser" : empresaID.toString() ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 ) + { + saveUser( userName, password, empresaID, true ); + return; + } + String oldName = array.get( 0, 0 ).toString(); + Update update = + new Update( "roles", + new Assignment[]{ new Assignment( new Field( "username" ), userName ), + new Assignment( new Field( "role" ), empresaID == null ? "siprpuser" : empresaID.toString() ) }, + new Field( "username" ).isEqual( oldName ).and( excludeReserved ) ); + executer.executeQuery( update ); + update = + new Update( "users", + new Assignment[]{ new Assignment( new Field( "username" ), userName ), + new Assignment( new Field( "password" ), password ) }, + new Field( "username" ).isEqual( oldName ) ); + executer.executeQuery( update ); + } + } + + public boolean checkNewName( String name, Integer empresaID ) + throws Exception + { + Select select = new Select( new String[]{ "roles" }, new String[]{ "username" }, + new Field( "role" ).isDifferent( empresaID == null ? "siprpuser" : empresaID.toString() ).and( + new Field( "lower( username )" ).isEqual( new Field( "lower( '" + name + "' )" ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() != 0 ) + { + if( empresaID != null ) + { + return false; + } + else + { + select = new Select( new String[]{ "roles" }, new String[]{ "username" }, + new Field( "role" ).isEqual( empresaID == null ? "siprpuser" : empresaID.toString() ).and( + new Field( "lower( username )" ).isEqual( new Field( "lower( '" + name + "' )" ) ) ) ); + array = executer.executeQuery( select ); + if( array.columnLength() == 0 ) + { + return false; + } + } + } + + return true; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/UserPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/UserPanel.java new file mode 100644 index 00000000..f518b16e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/UserPanel.java @@ -0,0 +1,242 @@ +/* + * UserPanel.java + * + * Created on 8 de Novembro de 2004, 17:03 + */ + +package siprp.clientes; + +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.event.ActionListener; +import java.awt.event.FocusListener; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.event.DocumentListener; + +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.text.CopyPasteHandler; +/** + * + * @author fpalma + */ +public class UserPanel extends JPanel + implements DocumentListener, FocusListener, ActionListener +{ + private UserDataProvider provider; + + private JTextField userNameText; + private JTextField passwordText; + private JButton applyButton; + private JButton cancelButton; + + private boolean passwordEdited = false; + private boolean hasPassword = false; + private boolean error = false; + private Integer empresaID; + +// public static void main( String args[] ) +// { +// JFrame frame = new JFrame(); +// frame.setSize( 300, 200 ); +// frame.getContentPane().setLayout( new GridLayout( 1, 1 ) ); +// frame.getContentPane().add( new UserPanel() ); +// frame.show(); +// } + + /** Creates a new instance of UserPanel */ + public UserPanel() + throws Exception + { + provider = ( UserDataProvider ) UserDataProvider.getProvider(); + setupComponents(); + } + + private void setupComponents() + { + JLabel userNameLabel = new JLabel( "Utilizador" ); + userNameText = new JTextField(); + JLabel passwordLabel = new JLabel( "Senha" ); + passwordText = new JTextField(); + applyButton = new JButton( "Actualizar" ); + cancelButton = new JButton( "Cancelar" ); + + userNameText.setPreferredSize( new Dimension( 200, 20 ) ); + passwordText.setPreferredSize( new Dimension( 200, 20 ) ); + passwordText.setText( "" ); + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( userNameLabel, constraints ); + gridbag.setConstraints( passwordLabel, constraints ); + gridbag.setConstraints( userNameText, constraints ); + gridbag.setConstraints( passwordText, constraints ); + JPanel buttonPanel = new JPanel(); + gridbag.setConstraints( buttonPanel, constraints ); + + add( userNameLabel ); + add( userNameText ); + add( passwordLabel ); + add( passwordText ); + add( buttonPanel ); + + buttonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) ); + buttonPanel.add( applyButton ); + buttonPanel.add( cancelButton ); + + passwordText.addFocusListener( this ); + passwordText.getDocument().addDocumentListener( this ); + + applyButton.addActionListener( this ); + cancelButton.addActionListener( this ); + + new CopyPasteHandler( userNameText ); + new CopyPasteHandler( passwordText ); + } + + public void changedUpdate(javax.swing.event.DocumentEvent documentEvent) + { + passwordEdited = true; + } + + public void insertUpdate(javax.swing.event.DocumentEvent documentEvent) + { + passwordEdited = true; + } + + public void removeUpdate(javax.swing.event.DocumentEvent documentEvent) + { + passwordEdited = true; + } + + public void focusGained(java.awt.event.FocusEvent focusEvent) + { + if( !passwordEdited ) + { + passwordText.getDocument().removeDocumentListener( this ); + passwordText.setText( "" ); + passwordText.getDocument().addDocumentListener( this ); + } + } + + public void focusLost(java.awt.event.FocusEvent focusEvent) + { + } + + public void actionPerformed(java.awt.event.ActionEvent actionEvent) + { + try + { + Object source = actionEvent.getSource(); + if( applyButton.equals( source ) ) + { + if( save() ) + { + hasPassword = true; + } + refresh(); + } + else if( cancelButton.equals( source ) ) + { + reload(); + refresh(); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro na liga\u00e7\u00e3o \u00e0 Base de Dados WEB", true ); + } + } + + private void refresh() + { + passwordText.getDocument().removeDocumentListener( this ); + if( !passwordEdited ) + { + if( hasPassword ) + { + passwordText.setText( "" ); + } + else + { + passwordText.setText( "" ); + } + } + passwordText.getDocument().addDocumentListener( this ); + } + + public void setEmpresaID( Integer empresaID ) + { + try + { + userNameText.setText( "" ); + passwordText.setText( "" ); + passwordEdited = false; + hasPassword = false; + this.empresaID = empresaID; +// if( empresaID == null ) +// { +// return; +// } + reload(); + refresh(); + error = false; + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro na liga\u00e7\u00e3o \u00e0 Base de Dados WEB", true ); + userNameText.setText( "Erro na liga\u00e7\u00e3o" ); + setEnabled( false ); + error = true; + } + } + + private boolean save() + throws Exception + { + if( !provider.checkNewName( userNameText.getText(), empresaID ) ) + { + JOptionPane.showMessageDialog( null, "O Utilizador " + userNameText.getText() + " j\u00e1 est\u00e1 em uso por outra entidade." ); + return false; + } + provider.saveUser( userNameText.getText(), passwordText.getText(), empresaID, !hasPassword ); + passwordEdited = false; + return true; + } + + private boolean reload() + throws Exception + { + String userName = provider.getUserName( empresaID ); + if( userName != null ) + { + userNameText.setText( userName ); + hasPassword = true; + } + passwordEdited = false; + return true; + } + + public void setEnabled( boolean enable ) + { + userNameText.setEnabled( enable && !error ); + passwordText.setEnabled( enable && !error ); + applyButton.setEnabled( enable && !error ); + cancelButton.setEnabled( enable && !error ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/UserWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/UserWindow.java new file mode 100644 index 00000000..5da41f72 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/UserWindow.java @@ -0,0 +1,67 @@ +/* + * UserWindow.java + * + * Created on 15 de Marco de 2005, 11:35 + */ + +package siprp.clientes; + +import java.awt.BorderLayout; + +import javax.swing.JFrame; + +import siprp.data.outer.EmpresasData; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.ui.CustomJDialog; +/** + * + * @author fpalma + */ +public class UserWindow extends CustomJDialog +{ + protected ProviderInterface JDO; +// protected JTextField empresaText; + protected UserPanel userPanel; + protected Integer empresaID; + + /** Creates a new instance of UserWindow */ + public UserWindow( JFrame owner, Integer empresaID ) + throws Exception + { + super( owner, true ); + this.empresaID = empresaID; + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + centerSuper(); + } + + private void setupComponents() + throws Exception + { + setSize( 500, 200 ); + userPanel = new UserPanel(); +// empresaText = new JTextField(); + getContentPane().setLayout( new BorderLayout() ); +// getContentPane().add( empresaText, BorderLayout.NORTH ); + getContentPane().add( userPanel, BorderLayout.CENTER ); + + if( empresaID == null ) + { +// empresaText.setText( "SIPRP" ); + setTitle( "SIPRP" ); + } + else + { + EmpresasData empresa = ( EmpresasData )JDO.load( EmpresasData.class, empresaID ); + if( empresa == null ) + { + return; + } +// empresaText.setText( (String)empresa.get( EmpresasData.DESIGNACAO_SOCIAL ) ); + setTitle( (String)empresa.get( EmpresasData.DESIGNACAO_SOCIAL ) ); + } + userPanel.setEmpresaID( empresaID ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/etiqueta.xsl b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/etiqueta.xsl new file mode 100644 index 00000000..339f753b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/etiqueta.xsl @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + Cuidado Prestado + + + Código + + + Valor + + + Benef. + + + Entidade + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/clientes/etiquetas.dtd b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/etiquetas.dtd new file mode 100644 index 00000000..69d2b4f1 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/clientes/etiquetas.dtd @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/companydataloaders/ClinicaAvenidaDataLoader.java b/branches/SIPRP/SIPRPSoft/src/siprp/companydataloaders/ClinicaAvenidaDataLoader.java new file mode 100644 index 00000000..bb636ad9 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/companydataloaders/ClinicaAvenidaDataLoader.java @@ -0,0 +1,94 @@ +/* + * ClinicaAvenidaDtaLoader.java + * + * Created on 25 de Janeiro de 2005, 13:27 + */ + +package siprp.companydataloaders; + +import siprp.CompanyDataLoader; +import siprp.SingletonConstants; + +import com.evolute.utils.Singleton; + +/** + * + * @author fpalma + */ +public class ClinicaAvenidaDataLoader implements CompanyDataLoader +{ + + /** Creates a new instance of ClinicaAvenidaDtaLoader */ + public ClinicaAvenidaDataLoader() + { + } + + public void load() + { + Singleton.setInstance( SingletonConstants.SOFTWARE_NAME, "SHSTSoft" ); + Singleton.setInstance( SingletonConstants.COMPANY_NAME, "Centro Cl\u00ednico Avenida" ); + Singleton.setInstance( SingletonConstants.COMPANY_LOGO, "logo_evo.jpg" ); + Singleton.setInstance( SingletonConstants.COMPANY_ACRONYM, "CCA" ); + Singleton.setInstance( SingletonConstants.SUBJECT_CONSULTA_VACINAS, "" ); + Singleton.setInstance( SingletonConstants.LETTER_CONSULTA_VACINAS, "" ); + Singleton.setInstance( SingletonConstants.SUBJECT_CONSULTA, "Centro Cl\u00ednico da Avenida - Marca\u00e7\u00e3o de consulta m\u00e9dica" ); + Singleton.setInstance( SingletonConstants.LETTER_CONSULTA, "Vimos por este meio informar que " + NOME + " " + + "dever\u00e1 comparecer no Centro Cl\u00ednico da Avenida para a realiza\u00e7\u00e3o da " + + "consulta de Medicina do Trabalho, no dia " + DATA + ".\n" + + "Caso n\u00e3o seja poss\u00edvel a compar\u00eancia do referido colaborador na " + + "data indicada, agradecemos que nos informem atrav\u00e9s do telefone 214928612 " + + "ou respondendo a esta mensagem.\n\n" + + "Departamento de Seguran\u00e7a e Higiene do Trabalho\n" + + "Centro Cl\u00ednico da Avenida\n" + + "Av. General Humberto Delgado 128 R/C D\n" + + "2700-419 Amadora" ); + Singleton.setInstance( SingletonConstants.SUBJECT_EXAMES, "Centro Cl\u00ednico da Avenida - Marca\u00e7\u00e3o de exames de Medicina do Trabalho" ); + Singleton.setInstance( SingletonConstants.LETTER_EXAMES, "Vimos por este meio informar que " + NOME + " " + + "dever\u00e1 comparecer no Centro Cl\u00ednico da Avenida para a realiza\u00e7\u00e3o " + + "de exames relativos \u00e0 Medicina do Trabalho, no dia " + DATA + ".\n" + + "Caso n\u00e3o seja poss\u00edvel a compar\u00eancia do referido colaborador na " + + "data indicada, agradecemos que nos informem atrav\u00e9s do telefone 214928612 " + + "ou respondendo a esta mensagem.\n\n" + + "Departamento de Seguran\u00e7a e Higiene do Trabalho\n" + + "Centro Cl\u00ednico da Avenida\n" + + "Av. General Humberto Delgado 128 R/C D\n" + + "2700-419 Amadora" ); + Singleton.setInstance( SingletonConstants.SUBJECT_VISITA, "Centro Cl\u00ednico da Avenida - Marca\u00e7\u00e3�o da Auditoria de Seguran\u00e7a e Higiene do Trabalho" ); + Singleton.setInstance( SingletonConstants.LETTER_VISITA, "Vimos por este meio informar que pretendemos " + + "realizar a auditoria de Seguran\u00e7a e Higiene do Trabalho \u00e0s vossas " + + "instala��es em " + MORADA + ", no dia " + DATA + ".\n" + + "Agradecemos que confirmem a vossa disponibilidade para a realiza\u00e7\u00e3o " + + "da visita na data indicada, atrav\u00e9s do telefone 214928612 ou " + + "respondendo a esta mensagem.\n\n" + + "Departamento de Seguran\u00e7a e Higiene do Trabalho\n" + + "Centro Cl\u00ednico da Avenida\n" + + "Av. General Humberto Delgado 128 R/C D\n" + + "2700-419 Amadora\n" + + "Tel.: 214928612" ); + Singleton.setInstance( SingletonConstants.USES_HOUR, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.CODIGO_EMPRESA_FORMAT, "15" ); + Singleton.setInstance( SingletonConstants.FICHA_MARCA_EXAMES, Boolean.FALSE ); + Singleton.setInstance( SingletonConstants.EXCEL_FORMAT, new int[]{ 0, 2, 3, 1, 4, 5, 6, 9, 7, 8 } ); + + Singleton.setInstance( SingletonConstants.MODULE_FICHA, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.MODULE_CLIENTES, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.WEB_AWARE, Boolean.FALSE ); + Singleton.setInstance( SingletonConstants.MODULE_RELATORIO, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.MODULE_LISTAGENS, Boolean.FALSE ); + + Singleton.setInstance( SingletonConstants.WEB_USER, "" ); + Singleton.setInstance( SingletonConstants.WEB_PASSWORD, "" ); + Singleton.setInstance( SingletonConstants.WEB_URL_PREFIX, "" ); + Singleton.setInstance( SingletonConstants.WEB_URL, "" ); + Singleton.setInstance( SingletonConstants.WEB_DB_NAME, "" ); + Singleton.setInstance( SingletonConstants.WEB_DRIVER_NAME, "" ); + + Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); + Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); + Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); + Singleton.setInstance( SingletonConstants.LOCAL_URL, "localhost" ); + Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "shst" ); + Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/companydataloaders/IBookDataLoader.java b/branches/SIPRP/SIPRPSoft/src/siprp/companydataloaders/IBookDataLoader.java new file mode 100644 index 00000000..97cec153 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/companydataloaders/IBookDataLoader.java @@ -0,0 +1,106 @@ +/* + * SIPRPDataLoader.java + * + * Created on 25 de Janeiro de 2005, 13:19 + */ + +package siprp.companydataloaders; + +import siprp.CompanyDataLoader; +import siprp.SingletonConstants; + +import com.evolute.utils.Singleton; + +/** + * + * @author fpalma + */ +public class IBookDataLoader implements CompanyDataLoader +{ + + /** Creates a new instance of SIPRPDataLoader */ + public IBookDataLoader() + { + } + + public void load() + { + Singleton.setInstance( SingletonConstants.SOFTWARE_NAME, "SHSTSoft" ); + Singleton.setInstance( SingletonConstants.COMPANY_NAME, "SHST" ); + Singleton.setInstance( SingletonConstants.COMPANY_LOGO, "logo_evo.jpg" ); + Singleton.setInstance( SingletonConstants.COMPANY_ACRONYM, "SHST" ); + Singleton.setInstance( SingletonConstants.SUBJECT_CONSULTA, "SHST - Marca\u00E7\u00E3o de consulta"); + Singleton.setInstance( SingletonConstants.LETTER_CONSULTA, "Vimos pelo presente informar que '" + NOME + "' dever\u00E1 comparecer " + + "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o da consulta de Medicina " + + "do Trabalho, no dia '" + DATA + "', pelas 08H30." + + "%0A%0A" + + "%0A%0A" + + "Solicitamos, tamb\u00E9m, que o colaborador seja portador do Boletim de Vacinas e " + + "dos \u00FAltimos exames complementares realizados." + + "%0A%0A" + + "%0A%0A" + + "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data " + + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 212 12 12 " + + "ou respondendo ao remetente desta mensagem." + + "%0A%0A%0A" + + "Cumprimentos," + + "%0A%0ASHST" ); + Singleton.setInstance( SingletonConstants.SUBJECT_EXAMES, "SHST - Marca\u00E7\u00E3o de exame"); + Singleton.setInstance( SingletonConstants.LETTER_EXAMES, "Vimos pelo presente informar que '" + NOME + "' dever\u00E1 comparecer " + + "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o dos exames de Medicina " + + "do Trabalho, no dia '" + DATA + "', pelas 08H30." + + "%0A%0A" + + "Relembramos que o colaborador dever\u00E1 comparecer em jejum." + + "%0A%0A" + + "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data " + + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 212 12 12 " + + "ou respondendo ao remetente desta mensagem." + + "%0A%0A%0A" + + "Cumprimentos,%0A%0ASHST" ); + Singleton.setInstance( SingletonConstants.SUBJECT_VISITA, "SHST - Marca\u00E7\u00E3o de visita de higiene e seguran\u00E7a"); + Singleton.setInstance( SingletonConstants.LETTER_VISITA, "Vimos pelo presente informar que iremos efectuar a auditoria de Higiene e " + + "Seguran\u00E7a \u00E0s vossas instala\u00E7\u00F5es de '" + NOME + "', no dia '" + DATA + "'." + + "%0A%0A" + + "Agradecemos que nos confirme, pela mesma via, o nome do representante " + + "da empresa que nos ir\u00E1 acompanhar e a vossa disponibilidade para a " + + "realiza\u00E7\u00E3o da visita na data indicada." + + "%0A%0A" + + "Caso necessite de qualquer esclarecimento, contacte-nos, por favor, " + + "atrav\u00E9s do telefone 21 212 12 12 " + + "ou responda ao remetente desta mensagem." + + "%0A%0A%0A" + + "Cumprimentos,%0A%0ASHST" ); + Singleton.setInstance( SingletonConstants.USES_HOUR, Boolean.FALSE ); + Singleton.setInstance( SingletonConstants.CODIGO_EMPRESA_FORMAT, "2 6 / 2" ); + Singleton.setInstance( SingletonConstants.FICHA_MARCA_EXAMES, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.EXCEL_FORMAT, new int[]{ 0, 2, 3, 1, -1, 4, 5, 7, 6, -1 } ); + + Singleton.setInstance( SingletonConstants.MODULE_FICHA, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.MODULE_CLIENTES, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.WEB_AWARE, Boolean.FALSE ); + Singleton.setInstance( SingletonConstants.MODULE_RELATORIO, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.MODULE_LISTAGENS, Boolean.TRUE ); + + Singleton.setInstance( SingletonConstants.WEB_USER, "" ); + Singleton.setInstance( SingletonConstants.WEB_PASSWORD, "" ); + Singleton.setInstance( SingletonConstants.WEB_URL_PREFIX, "" ); + Singleton.setInstance( SingletonConstants.WEB_URL, "" ); + Singleton.setInstance( SingletonConstants.WEB_DB_NAME, "" ); + Singleton.setInstance( SingletonConstants.WEB_DRIVER_NAME, "" ); + +// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); +// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL, "192.168.1.1:5432" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); + + Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); + Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); + Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); + Singleton.setInstance( SingletonConstants.LOCAL_URL, "localhost:5432" ); + Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" ); + Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/companydataloaders/SIPRPDataLoader.java b/branches/SIPRP/SIPRPSoft/src/siprp/companydataloaders/SIPRPDataLoader.java new file mode 100644 index 00000000..ad4c8d3a --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/companydataloaders/SIPRPDataLoader.java @@ -0,0 +1,159 @@ +package siprp.companydataloaders; + +import siprp.CompanyDataLoader; +import siprp.SingletonConstants; + +import com.evolute.properties.EvoPropertyKey; +import com.evolute.utils.Singleton; + +/** + * + * @author fpalma + */ +public class SIPRPDataLoader implements CompanyDataLoader +{ + + /** Creates a new instance of SIPRPDataLoader */ + public SIPRPDataLoader() + { + } + + public void load() + { + Singleton.setInstance( SingletonConstants.SOFTWARE_NAME, "SIPRPSoft" ); + Singleton.setInstance( SingletonConstants.COMPANY_NAME, "SIPRP - Sociedade Ib\u00e9rica de Preven\u00e7\u00e3o de Riscos Profissionais" ); + Singleton.setInstance( SingletonConstants.COMPANY_LOGO, "logo_combo.jpg" ); + Singleton.setInstance( SingletonConstants.COMPANY_ACRONYM, "SIPRP" ); + Singleton.setInstance( SingletonConstants.SUBJECT_CONSULTA, "SIPRP - Marca\u00E7\u00E3o de consulta de '" + NOME + "'"); + Singleton.setInstance( SingletonConstants.LETTER_CONSULTA, "Vimos pelo presente informar que '" + NOME + "' dever\u00E1 comparecer " + + "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o da consulta de Medicina " + + "do Trabalho, no dia '" + DATA + "', pelas 08H30." + + "%0A%0A" + + "%0A%0A" + + "Solicitamos, tamb\u00E9m, que o colaborador seja portador do Boletim de Vacinas e " + + "dos \u00FAltimos exames complementares realizados." + + "%0A%0A" + + "%0A%0A" + + "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data " + + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 350 45 40 " + + "ou respondendo ao remetente desta mensagem." + + "%0A%0A%0A" + + "Cumprimentos," + + "%0A%0ASIPRP" + + "%0A%0AATRIUM SALDANHA" + + "%0A%0APra\u00e7a Duque de Saldanha, 1 - 9\u00BAG" + + "%0A%0A1050-094 Lisboa" ); + Singleton.setInstance( SingletonConstants.SUBJECT_EXAMES, "SIPRP - Marca\u00E7\u00E3o de exame de '" + NOME + "'"); + Singleton.setInstance( SingletonConstants.LETTER_EXAMES, "Vimos pelo presente informar que '" + NOME + "' dever\u00E1 comparecer " + + "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o dos exames de Medicina " + + "do Trabalho, no dia '" + DATA + "', pelas 08H30." + + "%0A%0A" + + "Relembramos que o colaborador dever\u00E1 comparecer em jejum." + + "%0A%0A" + + "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data " + + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 350 45 40 " + + "ou respondendo ao remetente desta mensagem." + + "%0A%0A%0A" + + "Cumprimentos,%0A%0ASIPRP" ); + Singleton.setInstance( SingletonConstants.SUBJECT_VISITA, "SIPRP - Marca\u00E7\u00E3o de visita de higiene e seguran\u00E7a a '" + NOME + "'" ); + Singleton.setInstance( SingletonConstants.LETTER_VISITA, "Vimos pelo presente informar que iremos efectuar a auditoria de Higiene e " + + "Seguran\u00E7a \u00E0s vossas instala\u00E7\u00F5es de '" + NOME + "', no dia '" + DATA + "'." + + "%0A%0A" + + "Agradecemos que nos confirme, pela mesma via, o nome do representante " + + "da empresa que nos ir\u00E1 acompanhar e a vossa disponibilidade para a " + + "realiza\u00E7\u00E3o da visita na data indicada." + + "%0A%0A" + + "Caso necessite de qualquer esclarecimento, contacte-nos, por favor, " + + "atrav\u00E9s dos telefones 21 350 45 43 (Pedro Vieira), 21 350 45 44 " + + "(Catarina Leonardo) ou responda ao remetente desta mensagem." + + "%0A%0A%0A" + + "Cumprimentos,%0A%0ASIPRP" ); + Singleton.setInstance( SingletonConstants.USES_HOUR, Boolean.FALSE ); + Singleton.setInstance( SingletonConstants.CODIGO_EMPRESA_FORMAT, "2 6 / 2" ); + Singleton.setInstance( SingletonConstants.FICHA_MARCA_EXAMES, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.EXCEL_FORMAT, new int[]{ 0, 2, 3, 1, -1, 4, 5, 7, 6, -1 } ); + Singleton.setInstance( SingletonConstants.EXCEL_FORMAT_DEMISSAO, new int[]{ 0, 1 } ); + + Singleton.setInstance( SingletonConstants.MODULE_FICHA, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.MODULE_CLIENTES, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.WEB_AWARE, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.MODULE_RELATORIO, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.MODULE_LISTAGENS, Boolean.TRUE ); + + Singleton.setInstance( SingletonConstants.WEB_USER, "siprp" ); + Singleton.setInstance( SingletonConstants.WEB_PASSWORD, "rg2h-opksiprp" ); + Singleton.setInstance( SingletonConstants.WEB_URL_PREFIX, "jdbc:postgresql://" ); + Singleton.setInstance( SingletonConstants.WEB_URL, "www.evolute.pt:5436" ); + Singleton.setInstance( SingletonConstants.WEB_DB_NAME, "siprp" ); + Singleton.setInstance( SingletonConstants.WEB_DRIVER_NAME, "org.postgresql.Driver" ); + + Singleton.setInstance( SingletonConstants.LOCAL_USER, Singleton.getInstance( EvoPropertyKey.DB.USER ) ); + Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, Singleton.getInstance( EvoPropertyKey.DB.PASSWORD ) ); + Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, Singleton.getInstance( EvoPropertyKey.DB.CONNECTION.PREFIX ) ); + Singleton.setInstance( SingletonConstants.LOCAL_URL, + Singleton.getInstance( EvoPropertyKey.DB.CONNECTION.HOSTNAME ) + ":" + Singleton.getInstance( EvoPropertyKey.DB.CONNECTION.PORT ) + ); + Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, Singleton.getInstance( EvoPropertyKey.DB.NAME ) ); + Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, Singleton.getInstance( EvoPropertyKey.DB.CONNECTION.DRIVER_NAME ) ); + + + +// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); +// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL, "10.158.2.2:5432" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); + +// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); +// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL, "dbserver:5432" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local3" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); + +// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); +// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL, "dbserver:5432" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); + +// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); +// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL, "dbserver:5432" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); + +// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); +// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL, "dbserver:5432" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); + +// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); +// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL, "storage:5432" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local3" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); + +// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); +// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL, "ws-fpalma.redeapdp:5432" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); + +// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); +// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL, "192.168.1.1:5432" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); + + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/companydataloaders/SIPRPPropertiesLoader.java b/branches/SIPRP/SIPRPSoft/src/siprp/companydataloaders/SIPRPPropertiesLoader.java new file mode 100644 index 00000000..57d2563b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/companydataloaders/SIPRPPropertiesLoader.java @@ -0,0 +1,38 @@ +package siprp.companydataloaders; + +import com.evolute.properties.EvoAbstractPropertiesLoader; +import com.evolute.properties.PropertiesException; + +public class SIPRPPropertiesLoader extends EvoAbstractPropertiesLoader +{ + + private static SIPRPPropertiesLoader instance; + + private SIPRPPropertiesLoader() + { + this(null,null,null,null); + } + + public synchronized static SIPRPPropertiesLoader getInstance() + { + if (instance == null) + { + instance = new SIPRPPropertiesLoader(); + } + return instance; + } + + public SIPRPPropertiesLoader( + String[] mandatorySystemProperties, + String[] mandatorySingletonProperties, + String[] mandatoryJNLPProperties, + String[] mandatoryAPPProperties) + { + super(mandatorySystemProperties, mandatorySingletonProperties, mandatoryJNLPProperties, mandatoryAPPProperties); + } + + @Override + protected void postLoad() throws PropertiesException + { + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/AvisoConstants.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/AvisoConstants.java new file mode 100644 index 00000000..1f8ca61f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/AvisoConstants.java @@ -0,0 +1,18 @@ +/* + * AvisoConstants.java + * + * Created on 11 de Outubro de 2004, 13:03 + */ + +package siprp.data; + +/** + * + * @author fpalma + */ +public interface AvisoConstants +{ + public static final int TIPO_TRABALHADOR = 0; + public static final int TIPO_ESTABELECIMENTO = 1; + public static final int TIPO_EMPRESA = 2; +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/BaseObject.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/BaseObject.java new file mode 100644 index 00000000..46198449 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/BaseObject.java @@ -0,0 +1,46 @@ +package siprp.data; + +import java.text.DateFormat; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; + +import siprp.database.cayenne.providers.MainDAO; + +import com.evolute.entity.evo.EvoDataException; +import com.evolute.entity.evo.EvoDataObject; +import com.evolute.utils.strings.UnicodeChecker; + +public abstract class BaseObject extends EvoDataObject +{ + + static + { + UnicodeChecker.setUseDoubleSlash( true ); + } + + private static final long serialVersionUID = 1L; + + protected static MainDAO dao = new MainDAO(); + + public static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); + + protected static final String isNewMessage = " "; + + @Override + protected List fromReference(Class clazz, Integer id, String referingProperty, String... order) throws EvoDataException + { + List result = new LinkedList(); + for( Object o : super.fromReference(clazz, id, referingProperty, order) ) + { + Object inactivoString = ((EvoDataObject)o).get("inactivo"); + Object deletedDateValue = ((EvoDataObject)o).get("deleted_date"); + if( deletedDateValue == null && !"y".equals( inactivoString ) ) + { + result.add( o ); + } + } + return result; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/Historico.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/Historico.java new file mode 100644 index 00000000..79e41f50 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/Historico.java @@ -0,0 +1,55 @@ +/* + * Historico.java + * + * Created on 7 de Dezembro de 2004, 16:50 + */ + +package siprp.data; + +import java.text.DateFormat; +import java.util.Date; + +import com.evolute.utils.tables.ColumnizedObject; +/** + * + * @author fpalma + */ +public abstract class Historico extends BaseObject + implements ColumnizedObject +{ + protected static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( DateFormat.SHORT ); + + public static final String DATA = "data"; + public static final String TEXTO = "texto"; + + /** Creates a new instance of Historico */ + public Historico() + { + } + + public Object getValue(int col) + { + switch( col ) + { + case 0: + Date data = (Date) get( DATA ); + String dataStr = DATE_FORMAT.format( data ); + return dataStr; + + case 1: + String textoStr = (String ) get( TEXTO ); + if( textoStr == null ) + { + textoStr = ""; + } + textoStr = textoStr.trim(); + int index = textoStr.indexOf( "\n" ); + if( index != -1 ) + { + textoStr = textoStr.substring( 0, index ); + } + return textoStr; + } + return null; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/Marcacao.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/Marcacao.java new file mode 100644 index 00000000..950d33eb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/Marcacao.java @@ -0,0 +1,394 @@ +/* + * Marcacao.java + * + * Created on 21 de Maio de 2004, 16:59 + */ + +package siprp.data; + +import java.text.DateFormat; +import java.util.Calendar; +import java.util.Date; + +import siprp.FichaDataProvider; +import siprp.data.outer.AvisosData; +import siprp.data.outer.EmpresasData; +import siprp.data.outer.EstabelecimentosData; +import siprp.data.outer.MarcacoesEmpresaData; +import siprp.data.outer.MarcacoesEstabelecimentoData; +import siprp.data.outer.MarcacoesTrabalhadorData; +import siprp.data.outer.TrabalhadoresData; +import siprp.medicina.MedicinaDataProvider; + +import com.evolute.entity.ProviderInterface; +import com.evolute.entity.evo.EvoDataException; +import com.evolute.utils.Singleton; +import com.evolute.utils.tables.ColumnizedObject; +/** + * + * @author fpalma + */ +public abstract class Marcacao extends BaseObject + implements ColumnizedObject + //, JDOOperationHandlerInterface +{ + public static final int TIPO_MARCACAO_TRABALHADOR_EXAMES = 0; + public static final int TIPO_MARCACAO_TRABALHADOR_CONSULTA = 1; + public static final int TIPO_MARCACAO_ESTABELECIMENTO = 2; + public static final int TIPO_MARCACAO_EMPRESA = 3; + + public static final int ESTADO_POR_REALIZAR = 0; + public static final int ESTADO_PARCIALMENTE_REALIZADA = 1; + public static final int ESTADO_REALIZADA = 2; + public static final int ESTADO_DESMARCADA_TRABALHADOR = 3; + public static final int ESTADO_DESMARCADA_SHST = 4; + public static final int ESTADO_FALTOU = 5; + + public static final String DATA = "data"; + public static final String REALIZADA = "realizada"; + public static final String DATA_EMAIL = "data_email"; + public static final String DATA_RELATORIO = "data_relatorio"; + public static final String ANTECEDENCIA_AVISO = "antecedencia_aviso"; + + protected static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( DateFormat.SHORT ); + protected static ProviderInterface JDO; + + + public static Marcacao getMarcacao( int tipo ) + { + switch( tipo ) + { + case TIPO_MARCACAO_TRABALHADOR_EXAMES: + + case TIPO_MARCACAO_TRABALHADOR_CONSULTA: + return new MarcacoesTrabalhadorData(); + + case TIPO_MARCACAO_ESTABELECIMENTO: + return new MarcacoesEstabelecimentoData(); + + case TIPO_MARCACAO_EMPRESA: + return new MarcacoesEmpresaData(); + } + return null; + } + + public Object getValue( int col ) + { + switch( col ) + { + case 0: + Date data = (Date) get( DATA ); + String dataStr = DATE_FORMAT.format( data ); + return dataStr; + + case 1: + String realizada = (String) get( REALIZADA ); +// if( this instanceof MarcacoesEmpresaData ) +// { +// return new Boolean( "y".equals( realizada ) ); +// } +// else +// { + + realizada = "y".equals( realizada ) ? "Sim" : "N\u00e3o"; + return realizada; +// } + + case 2: + if( this instanceof MarcacoesEmpresaData ) + { + String textoStr = (String ) get( MarcacoesEmpresaData.TEXTO ); + if( textoStr == null ) + { + textoStr = ""; + } + textoStr = textoStr.trim(); + int index = textoStr.indexOf( "\n" ); + if( index != -1 ) + { + textoStr = textoStr.substring( 0, index ); + } + return textoStr; + } + else + { + Date dataRelatorio = (Date) get( DATA_RELATORIO ); + String dataRelatorioStr = ( dataRelatorio != null ? DATE_FORMAT.format( dataRelatorio ) : "" ); + return dataRelatorioStr; + } + + default: + return null; + } + } + + public static void saveMarcacaoConsultaForTrabalhadorID( Integer trabalhadorID, Date date ) + throws Exception + { + if( date != null ) + { + date = (Date)date.clone(); + } + FichaDataProvider provider = (FichaDataProvider) FichaDataProvider.getProvider(); + if( trabalhadorID == null ) + { + return; + } + Integer marcacaoID = provider.getMarcacaoIDByTrabalhador( trabalhadorID ); + MarcacoesTrabalhadorData marcacao; + if( marcacaoID == null ) + { + marcacao = null; + } + else + { + if( JDO == null ) + { + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + marcacao = ( MarcacoesTrabalhadorData ) JDO.load( MarcacoesTrabalhadorData.class, marcacaoID ); + } + if( date == null && marcacao != null ) + { + marcacao.delete(); + } + else if( date != null && marcacao != null ) + { + marcacao.set( Marcacao.DATA, date ); + marcacao.save(); + } + else if( date != null && marcacao == null ) + { + marcacao = new MarcacoesTrabalhadorData(); + if( JDO == null ) + { + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + TrabalhadoresData trab = (TrabalhadoresData)JDO.load( TrabalhadoresData.class, trabalhadorID ); + marcacao.set( MarcacoesTrabalhadorData.TO_TRABALHADOR_ID, trab ); + marcacao.set( MarcacoesTrabalhadorData.TIPO, new Integer( MarcacoesTrabalhadorData.TIPO_CONSULTA ) ); + marcacao.set( Marcacao.DATA, date ); + marcacao.set( Marcacao.REALIZADA, "n" ); + marcacao.set( MarcacoesTrabalhadorData.ESTADO, new Integer( siprp.medicina.MedicinaDataProvider.ESTADO_POR_REALIZAR ) ); + marcacao.set( MarcacoesTrabalhadorData.MOTIVO, new Integer( 2 ) ); + marcacao.save(); + } + } + + @Override + public void save() throws EvoDataException + { + super.save(); + postSave(this); + } + + @Override + public void delete() throws EvoDataException + { + if( preDelete(this) ) + { + super.delete(); + postDelete(this); + } + } + + protected boolean postSave( Marcacao object ) + throws EvoDataException + { + boolean result = false; + try + { + if( object instanceof MarcacoesEmpresaData ) + { + AvisosData aviso = (AvisosData) JDO.load( AvisosData.class, + new Object[]{ object.get( MarcacoesEmpresaData.ID ), new Integer( AvisosData.TIPO_EMPRESA ) }, + new String[]{ AvisosData.EVENTO_ID, AvisosData.TIPO } ); + if( aviso == null ) + { + aviso = new AvisosData(); + } + aviso.setTipo( AvisosData.TIPO_EMPRESA ); + EmpresasData empresa = ((MarcacoesEmpresaData)object).toEmpresa_id(); + aviso.setToEmpresa_id( empresa ); + aviso.set( AvisosData.EVENTO_ID, object.get( MarcacoesEmpresaData.ID ) ); + Date dataEvento = (Date) object.get( Marcacao.DATA ); + aviso.set( AvisosData.DATA_EVENTO, dataEvento ); + aviso.set( AvisosData.DATA_AVISO, dataEvento ); + String descricao = "Tarefa "; + aviso.set( AvisosData.DESCRICAO, descricao ); + aviso.save(); + + empresa.save(); + } + else if( object instanceof MarcacoesEstabelecimentoData ) + { + AvisosData aviso = (AvisosData) JDO.load( AvisosData.class, + new Object[]{ object.get( MarcacoesEstabelecimentoData.ID ), new Integer( AvisosData.TIPO_ESTABELECIMENTO ) }, + new String[]{ AvisosData.EVENTO_ID, AvisosData.TIPO } ); + if( aviso == null ) + { + aviso = new AvisosData(); + } + aviso.set( AvisosData.TIPO, new Integer( AvisosData.TIPO_ESTABELECIMENTO ) ); + EstabelecimentosData estabelecimento = ((MarcacoesEstabelecimentoData)object).toEstabelecimento_id(); + aviso.setToEstabelecimento_id( estabelecimento ); + EmpresasData empresa = estabelecimento.toEmpresa_id(); + aviso.setToEmpresa_id( empresa ); + aviso.set( AvisosData.EVENTO_ID, object.get( MarcacoesEstabelecimentoData.ID ) ); + Date dataEvento = (Date) object.get( Marcacao.DATA ); + Date dataAviso = new Date( dataEvento.getTime() ); + Calendar cal = Calendar.getInstance(); + cal.setTime( dataAviso ); + cal.add( Calendar.DAY_OF_MONTH, -14 ); + dataAviso = cal.getTime(); + aviso.set( AvisosData.DATA_AVISO, dataAviso ); + aviso.set( AvisosData.DATA_EVENTO, dataEvento ); + String descricao = "Visita "; + aviso.set( AvisosData.DESCRICAO, descricao ); + cal = Calendar.getInstance(); + cal.setTime( dataEvento ); + cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 ); + cal.set( Calendar.MILLISECOND, 0 ); + dataEvento = cal.getTime(); + + cal = Calendar.getInstance(); + cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 10, 0, 0 ); + cal.set( Calendar.MILLISECOND, 0 ); + Date hoje = cal.getTime(); + if( hoje.before( dataEvento ) ) + { + aviso.save(); + } + + estabelecimento.save(); + } + if( object instanceof MarcacoesTrabalhadorData ) + { + AvisosData aviso = (AvisosData) JDO.load( AvisosData.class, + new Object[]{ object.get( MarcacoesTrabalhadorData.ID ), new Integer( AvisosData.TIPO_TRABALHADOR ) }, + new String[]{ AvisosData.EVENTO_ID, AvisosData.TIPO } ); + if( aviso == null ) + { + aviso = new AvisosData(); + } + aviso.set( AvisosData.TIPO, new Integer( AvisosData.TIPO_TRABALHADOR ) ); + TrabalhadoresData trab = ((MarcacoesTrabalhadorData)object).toTrabalhador_id(); + aviso.setToTrabalhador_id( trab ); + EstabelecimentosData estabelecimento = trab.toEstabelecimento_id(); + aviso.setToEstabelecimento_id( estabelecimento ); + EmpresasData empresa = estabelecimento.toEmpresa_id(); + aviso.setToEmpresa_id( empresa ); + aviso.set( AvisosData.EVENTO_ID, object.get( MarcacoesTrabalhadorData.ID ) ); + Date dataEvento = (Date) object.get( Marcacao.DATA ); + Date dataAviso = new Date( dataEvento.getTime() ); + Calendar cal = Calendar.getInstance(); + cal.setTime( dataAviso ); + cal.add( Calendar.DAY_OF_MONTH, -14 ); + dataAviso = cal.getTime(); + aviso.set( AvisosData.DATA_AVISO, dataAviso ); + aviso.set( AvisosData.DATA_EVENTO, dataEvento.clone() ); + String descricao = ""; + switch( ( ( Integer ) object.get( MarcacoesTrabalhadorData.TIPO ) ).intValue() ) + { + case MarcacoesTrabalhadorData.TIPO_EXAMES: + descricao = "Exames"; + break; + + case MarcacoesTrabalhadorData.TIPO_CONSULTA: + Integer motivo = ( ( Integer ) object.get( MarcacoesTrabalhadorData.MOTIVO ) ); + descricao = "Consulta " + ( motivo == null ? "" : ("(" + MedicinaDataProvider.TIPOS_CONSULTAS[ motivo.intValue() ] + ")" ) ); + break; + } + aviso.set( AvisosData.DESCRICAO, descricao ); + cal = Calendar.getInstance(); + cal.setTime( dataEvento ); + cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 ); + cal.set( Calendar.MILLISECOND, 0 ); + dataEvento = cal.getTime(); + + cal = Calendar.getInstance(); + cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 10, 0, 0 ); + cal.set( Calendar.MILLISECOND, 0 ); + Date hoje = cal.getTime(); + if( hoje.before( dataEvento ) ) + { + if( !hoje.before( dataAviso ) ) + { + aviso.set( AvisosData.DATA_AVISO, dataEvento.clone() ); + } + aviso.save(); + } + + trab.save(); + } + else + { + result = false; + } + result = true; + } + catch (Exception e) + { + throw new EvoDataException( e ); + } + return result; + } + + protected boolean preDelete( Marcacao object ) + throws EvoDataException + { + try + { + if( object instanceof MarcacoesTrabalhadorData && + ( ( Integer ) object.get( MarcacoesTrabalhadorData.TIPO ) ).intValue() == MarcacoesTrabalhadorData.TIPO_EXAMES ) + { + ((MedicinaDataProvider)MedicinaDataProvider.getProvider()).deleteDetalhesRealizadosForMarcacao( ( Integer ) object.get( MarcacoesTrabalhadorData.ID ) ); + return true; + } + } + catch (Exception e) + { + throw new EvoDataException( e ); + } + return false; + } + + protected boolean postDelete( Marcacao object ) + throws EvoDataException + { + try + { + Integer tipo; + if( object instanceof MarcacoesEmpresaData ) + { + tipo = new Integer( AvisosData.TIPO_EMPRESA ); + } + else if( object instanceof MarcacoesEstabelecimentoData ) + { + tipo = new Integer( AvisosData.TIPO_ESTABELECIMENTO ); + } + if( object instanceof MarcacoesTrabalhadorData ) + { + tipo = new Integer( AvisosData.TIPO_TRABALHADOR ); + } + else + { + return false; + } + AvisosData aviso = (AvisosData) JDO.load( AvisosData.class, + new Object[]{ object.get( "id" ), tipo }, + new String[]{ AvisosData.EVENTO_ID, AvisosData.TIPO } ); + if( aviso != null ) + { + aviso.delete(); + } + + return true; + } + catch (Exception e) + { + throw new EvoDataException( e ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/MarcacaoListLoader.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/MarcacaoListLoader.java new file mode 100644 index 00000000..279d9a26 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/MarcacaoListLoader.java @@ -0,0 +1,82 @@ +/* + * MarcacaoListLoader.java + * + * Created on 27 de Maio de 2004, 16:18 + */ + +package siprp.data; + +import java.util.List; + +import siprp.data.outer.MarcacoesEstabelecimentoData; +import siprp.data.outer.MarcacoesTrabalhadorData; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +/** + * + * @author fpalma + */ +public class MarcacaoListLoader +{ +// private static PersistenceManager MANAGER = null; + private ProviderInterface JDO; + + /** Creates a new instance of MarcacaoListLoader */ + public MarcacaoListLoader() + { + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + + public Marcacao[] load( int tipo, Integer targetID ) throws Exception + { + List result = null; + Class theClass = null; + Object[] values = null; + String[] keys = null; + switch( tipo ) + { + case Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES: case Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA: + theClass = MarcacoesTrabalhadorData.class; + //"(trabalhador.id == " + targetID + ") && (tipo == " + tipo + ")"; + keys = new String[]{ MarcacoesTrabalhadorData.TRABALHADOR_ID_FULL, MarcacoesTrabalhadorData.TIPO_FULL }; + values = new Object[]{ targetID, tipo }; + break; + + case Marcacao.TIPO_MARCACAO_ESTABELECIMENTO: + theClass = MarcacoesEstabelecimentoData.class; + //"estabelecimento.id == " + targetID; + keys = new String[]{ MarcacoesEstabelecimentoData.ESTABELECIMENTO_ID_FULL }; + values = new Object[]{ targetID }; + break; + } + if( theClass != null ) + { + result = JDO.listLoad( theClass, values, keys, new String[]{ Marcacao.DATA + " descending" } ); + } +// Object sessionID = null; +// try +// { +// sessionID = JDO.begin(); +// Query q = JDO.getManager().newQuery( theClass, filterString ); +// q.setOrdering( Marcacao.DATA + " descending" ); +// Collection c = ( Collection )q.execute(); +// JDOInnerObject innerObjects[] = ( JDOInnerObject [] ) c.toArray( new JDOInnerObject[0] ); +// JDO.commit( sessionID ); +// Marcacao marcacoes[] = new Marcacao[ innerObjects.length ]; +// for( int n = 0; n < marcacoes.length; n++ ) +// { +// marcacoes[ n ] = ( Marcacao ) innerObjects[ n ].getOuterClass().newInstance(); +// marcacoes[ n ].setInnerObject( innerObjects[ n ] ); +// } +// return marcacoes; +// } +// catch( RuntimeException ex ) +// { +// JDO.rollback( sessionID ); +// Main.reconnectJDO(); +// throw ex; +// } + return result == null ? new Marcacao[0] : result.toArray( new Marcacao[result.size()] ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/MarcacaoTrabalhadorConstants.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/MarcacaoTrabalhadorConstants.java new file mode 100644 index 00000000..e0096a87 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/MarcacaoTrabalhadorConstants.java @@ -0,0 +1,17 @@ +/* + * MarcacaoTrabalhadorConstants.java + * + * Created on 11 de Outubro de 2004, 13:18 + */ + +package siprp.data; + +/** + * + * @author fpalma + */ +public interface MarcacaoTrabalhadorConstants +{ + public static final int TIPO_EXAMES = 0; + public static final int TIPO_CONSULTA = 1; +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/SearchExecuterFactory.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/SearchExecuterFactory.java new file mode 100644 index 00000000..3c7ff165 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/SearchExecuterFactory.java @@ -0,0 +1,186 @@ +/* + * SearchExecuterFactory.java + * + * Created on 24 de Maio de 2004, 19:30 + */ + +package siprp.data; + +import siprp.data.outer.EmpresasData; +import siprp.data.outer.EstabelecimentosData; +import siprp.data.outer.TrabalhadoresData; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +import com.evolute.utils.ui.search.SearchDialog; +import com.evolute.utils.ui.search.SearchExecuter; + +/** + * + * @author fpalma + */ +public class SearchExecuterFactory +{ + private static SearchExecuter empresaExecuter; + private static SearchExecuter estabelecimentoExecuter; + private static SearchExecuter trabalhadorExecuter; + + + + /** Creates a new instance of SearchExecuterFactory */ + private SearchExecuterFactory() + { + } + + public static SearchExecuter getSearchExecuter( Class objectClass ) + { + if( objectClass.equals( EmpresasData.class ) ) + { + return getEmpresaSearchExecuter(); + } + else if( objectClass == EstabelecimentosData.class ) + { + return getEstabelecimentoSearchExecuter(); + } + else if( objectClass == TrabalhadoresData.class ) + { + return getTrabalhadorSearchExecuter(); + } + return null; + } + + private static SearchExecuter getEmpresaSearchExecuter() + { + if( empresaExecuter == null ) + { + empresaExecuter = new SearchExecuter(){ + + private final DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + + public Virtual2DArray search( String pattern ) + throws Exception + { + + Executer executer = dbm.getSharedExecuter( this ); + Select select = new Select( new String[]{ "empresas" }, + new String[]{ EmpresasData.ID, EmpresasData.DESIGNACAO_SOCIAL, EmpresasData.DESIGNACAO_SOCIAL_PLAIN }, + new Field( EmpresasData.DESIGNACAO_SOCIAL_PLAIN ).isLike( "%" + com.evolute.utils.strings.StringPlainer.convertString( pattern, false, false ) + "%" ).and( + new Field( EmpresasData.INACTIVO ).isDifferent( "y" ) ), + new String[]{ EmpresasData.DESIGNACAO_SOCIAL_PLAIN }, null ); +System.out.println( "SELECT : " + select ); + return executer.executeQuery( select ); + } + + public boolean hasDetails() + { + return false; + } + + public void showDetails( SearchDialog dialog, Object o ) + throws Exception + { + } + + public String getSearchTitle() + { + return "Procurar Empresa"; + } + + public String[] getColumnNames() + { + return new String[]{ "Designa\u00e7\u00e3o Social" }; + } + }; + } + return empresaExecuter; + } + + private static SearchExecuter getEstabelecimentoSearchExecuter() + { + if( estabelecimentoExecuter == null ) + { + estabelecimentoExecuter = new SearchExecuter(){ + private final DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + + public Virtual2DArray search( String pattern ) + throws Exception + { + Executer executer = dbm.getSharedExecuter( this ); + Select select = new Select( new String[]{ "estabelecimentos" }, + new String[]{ EstabelecimentosData.ID, EstabelecimentosData.NOME, EstabelecimentosData.NOME_PLAIN }, + new Field( EstabelecimentosData.NOME_PLAIN ).isLike( "%" + com.evolute.utils.strings.StringPlainer.convertString( pattern, false, false ) + "%" ), + new String[]{ EstabelecimentosData.NOME_PLAIN }, null ); + return executer.executeQuery( select ); + } + + public boolean hasDetails() + { + return false; + } + + public void showDetails( SearchDialog dialog, Object o ) + throws Exception + { + } + + public String getSearchTitle() + { + return "Procurar Estabelecimento"; + } + + public String[] getColumnNames() + { + return new String[]{ "Designa\u00e7\u00e3o" }; + } + }; + } + return estabelecimentoExecuter; + } + + + private static SearchExecuter getTrabalhadorSearchExecuter() + { + if( trabalhadorExecuter == null ) + { + trabalhadorExecuter = new SearchExecuter(){ + private final DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + + public Virtual2DArray search( String pattern ) + throws Exception + { + Executer executer = dbm.getSharedExecuter( this ); + Select select = new Select( new String[]{ "trabalhadores" }, + new String[]{ TrabalhadoresData.ID, TrabalhadoresData.NOME, TrabalhadoresData.NOME_PLAIN }, + new Field( TrabalhadoresData.NOME_PLAIN ).isLike( "%" + com.evolute.utils.strings.StringPlainer.convertString( pattern, false, false ) + "%" ), + new String[]{ TrabalhadoresData.NOME_PLAIN }, null ); + return executer.executeQuery( select ); + } + + public boolean hasDetails() + { + return false; + } + + public void showDetails( SearchDialog dialog, Object o ) + throws Exception + { + } + + public String getSearchTitle() + { + return "Procurar Trablhador"; + } + + public String[] getColumnNames() + { + return new String[]{ "Nome" }; + } + }; + } + return trabalhadorExecuter; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Actualizacao.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Actualizacao.java new file mode 100644 index 00000000..2e713a99 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Actualizacao.java @@ -0,0 +1,280 @@ +/* +* Actualizacao.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class Actualizacao extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( Actualizacao.HORA, Actualizacao.HORA_INDEX ); + FIELD_INDEXES.put( Actualizacao.HORA_FULL, Actualizacao.HORA_INDEX ); + FIELD_INDEXES.put( Actualizacao.ID, Actualizacao.ID_INDEX ); + FIELD_INDEXES.put( Actualizacao.ID_FULL, Actualizacao.ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "actualizacao"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.actualizacao"; + + public static final int _INVALID__INDEX = -1; + public static final String HORA = "hora"; + public static final String HORA_FULL = "actualizacao.hora"; + public static final int HORA_INDEX = 0; + public static final String ID = "id"; + public static final String ID_FULL = "actualizacao.id"; + public static final int ID_INDEX = 1; + + public static final String FIELD_NAMES[] = new String[]{ + HORA, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + HORA, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + HORA, ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + HORA, ID, }; + + private java.sql.Timestamp hora; + private Integer id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public Actualizacao() + { + super(); + dirtyProperties = new boolean[]{ false, false }; + } + + public java.sql.Timestamp getHora() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( HORA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.hora; + } + + public void setHora( java.sql.Timestamp hora ) + { + try + { + setLockedForRefresh( true ); + preProcess( HORA, hora ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.hora = hora; + LAZY_LOADED_OBJECTS.put( HORA, Boolean.TRUE ); + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Actualizacao.HORA_INDEX: + value = getHora(); + break; + case Actualizacao.ID_INDEX: + value = getId(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Actualizacao.HORA_INDEX: + value = this.hora; + break; + case Actualizacao.ID_INDEX: + value = this.id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Actualizacao.HORA_INDEX: + setHora( ( java.sql.Timestamp ) value ); + break; + case Actualizacao.ID_INDEX: + setId( ( Integer ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Actualizacao.HORA_INDEX: + this.hora = ( java.sql.Timestamp ) value; + break; + case Actualizacao.ID_INDEX: + this.id = ( Integer ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case Actualizacao.HORA_INDEX: + theClass = java.sql.Timestamp.class; + break; + case Actualizacao.ID_INDEX: + theClass = Integer.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : Actualizacao._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, Actualizacao.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Avisos.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Avisos.java new file mode 100644 index 00000000..fd9a793b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Avisos.java @@ -0,0 +1,783 @@ +/* +* Avisos.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class Avisos extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( Avisos.ID, Avisos.ID_INDEX ); + FIELD_INDEXES.put( Avisos.ID_FULL, Avisos.ID_INDEX ); + FIELD_INDEXES.put( Avisos.TIPO, Avisos.TIPO_INDEX ); + FIELD_INDEXES.put( Avisos.TIPO_FULL, Avisos.TIPO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Avisos.CLASS_IDENTIFIER, Avisos.EMPRESA_ID, Avisos.TO_EMPRESA_ID ); + FIELD_INDEXES.put( Avisos.EMPRESA_ID, Avisos.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( Avisos.EMPRESA_ID_FULL, Avisos.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( Avisos.TO_EMPRESA_ID, Avisos.TO_EMPRESA_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Avisos.CLASS_IDENTIFIER, Avisos.ESTABELECIMENTO_ID, Avisos.TO_ESTABELECIMENTO_ID ); + FIELD_INDEXES.put( Avisos.ESTABELECIMENTO_ID, Avisos.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( Avisos.ESTABELECIMENTO_ID_FULL, Avisos.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( Avisos.TO_ESTABELECIMENTO_ID, Avisos.TO_ESTABELECIMENTO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Avisos.CLASS_IDENTIFIER, Avisos.TRABALHADOR_ID, Avisos.TO_TRABALHADOR_ID ); + FIELD_INDEXES.put( Avisos.TRABALHADOR_ID, Avisos.TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( Avisos.TRABALHADOR_ID_FULL, Avisos.TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( Avisos.TO_TRABALHADOR_ID, Avisos.TO_TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( Avisos.EVENTO_ID, Avisos.EVENTO_ID_INDEX ); + FIELD_INDEXES.put( Avisos.EVENTO_ID_FULL, Avisos.EVENTO_ID_INDEX ); + FIELD_INDEXES.put( Avisos.DATA_AVISO, Avisos.DATA_AVISO_INDEX ); + FIELD_INDEXES.put( Avisos.DATA_AVISO_FULL, Avisos.DATA_AVISO_INDEX ); + FIELD_INDEXES.put( Avisos.DATA_EVENTO, Avisos.DATA_EVENTO_INDEX ); + FIELD_INDEXES.put( Avisos.DATA_EVENTO_FULL, Avisos.DATA_EVENTO_INDEX ); + FIELD_INDEXES.put( Avisos.DESCRICAO, Avisos.DESCRICAO_INDEX ); + FIELD_INDEXES.put( Avisos.DESCRICAO_FULL, Avisos.DESCRICAO_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyempresa_idToempresas = + new com.evolute.entity.ForeignKey( Avisos.class, Avisos.EMPRESA_ID, siprp.data.outer.EmpresasData.class, siprp.data.outer.EmpresasData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyestabelecimento_idToestabelecimentos = + new com.evolute.entity.ForeignKey( Avisos.class, Avisos.ESTABELECIMENTO_ID, siprp.data.outer.EstabelecimentosData.class, siprp.data.outer.EstabelecimentosData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeytrabalhador_idTotrabalhadores = + new com.evolute.entity.ForeignKey( Avisos.class, Avisos.TRABALHADOR_ID, siprp.data.outer.TrabalhadoresData.class, siprp.data.outer.TrabalhadoresData.ID ); + + public static final String TABLENAME = "avisos"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.avisos"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "avisos.id"; + public static final int ID_INDEX = 0; + public static final String TIPO = "tipo"; + public static final String TIPO_FULL = "avisos.tipo"; + public static final int TIPO_INDEX = 1; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "avisos.empresa_id"; + public static final int EMPRESA_ID_INDEX = 2; + public static final String TO_EMPRESA_ID = "to_empresa_id"; + public static final int TO_EMPRESA_ID_INDEX = 3; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "avisos.estabelecimento_id"; + public static final int ESTABELECIMENTO_ID_INDEX = 4; + public static final String TO_ESTABELECIMENTO_ID = "to_estabelecimento_id"; + public static final int TO_ESTABELECIMENTO_ID_INDEX = 5; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String TRABALHADOR_ID_FULL = "avisos.trabalhador_id"; + public static final int TRABALHADOR_ID_INDEX = 6; + public static final String TO_TRABALHADOR_ID = "to_trabalhador_id"; + public static final int TO_TRABALHADOR_ID_INDEX = 7; + public static final String EVENTO_ID = "evento_id"; + public static final String EVENTO_ID_FULL = "avisos.evento_id"; + public static final int EVENTO_ID_INDEX = 8; + public static final String DATA_AVISO = "data_aviso"; + public static final String DATA_AVISO_FULL = "avisos.data_aviso"; + public static final int DATA_AVISO_INDEX = 9; + public static final String DATA_EVENTO = "data_evento"; + public static final String DATA_EVENTO_FULL = "avisos.data_evento"; + public static final int DATA_EVENTO_INDEX = 10; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "avisos.descricao"; + public static final int DESCRICAO_INDEX = 11; + + public static final String FIELD_NAMES[] = new String[]{ + TIPO, EMPRESA_ID, TO_EMPRESA_ID, ESTABELECIMENTO_ID, TO_ESTABELECIMENTO_ID, + TRABALHADOR_ID, TO_TRABALHADOR_ID, EVENTO_ID, DATA_AVISO, DATA_EVENTO, DESCRICAO, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + TIPO, TABLENAME + "." + EMPRESA_ID, TABLENAME + "." + TO_EMPRESA_ID, TABLENAME + "." + ESTABELECIMENTO_ID, TABLENAME + "." + TO_ESTABELECIMENTO_ID, + TABLENAME + "." + TRABALHADOR_ID, TABLENAME + "." + TO_TRABALHADOR_ID, TABLENAME + "." + EVENTO_ID, TABLENAME + "." + DATA_AVISO, TABLENAME + "." + DATA_EVENTO, TABLENAME + "." + DESCRICAO, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, TIPO, EMPRESA_ID, ESTABELECIMENTO_ID, TRABALHADOR_ID, EVENTO_ID, DATA_AVISO, + DATA_EVENTO, DESCRICAO, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, TIPO, EMPRESA_ID, ESTABELECIMENTO_ID, TRABALHADOR_ID, EVENTO_ID, DATA_AVISO, + DATA_EVENTO, DESCRICAO, }; + + private Integer id; + private Integer tipo; + private Integer empresa_id; + private siprp.data.outer.EmpresasData to_empresa_id; + private Integer estabelecimento_id; + private siprp.data.outer.EstabelecimentosData to_estabelecimento_id; + private Integer trabalhador_id; + private siprp.data.outer.TrabalhadoresData to_trabalhador_id; + private Integer evento_id; + private java.util.Date data_aviso; + private java.util.Date data_evento; + private String descricao; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public Avisos() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false, false, false, false, false, false, false, false, + false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public Integer getTipo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TIPO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.tipo; + } + + public void setTipo( Integer tipo ) + { + try + { + setLockedForRefresh( true ); + preProcess( TIPO, tipo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.tipo = tipo; + LAZY_LOADED_OBJECTS.put( TIPO, Boolean.TRUE ); + } + + public Integer getEmpresa_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMPRESA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.empresa_id; + } + + public void setEmpresa_id( Integer empresa_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMPRESA_ID, empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.empresa_id = empresa_id; + LAZY_LOADED_OBJECTS.put( EMPRESA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EmpresasData toEmpresa_id() + { + try + { + prepare( TO_EMPRESA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_empresa_id; + } + + public void setToEmpresa_id( siprp.data.outer.EmpresasData to_empresa_id ) + { + try + { + preProcess( TO_EMPRESA_ID, to_empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_empresa_id = to_empresa_id; + } + + public Integer getEstabelecimento_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTABELECIMENTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estabelecimento_id; + } + + public void setEstabelecimento_id( Integer estabelecimento_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTABELECIMENTO_ID, estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estabelecimento_id = estabelecimento_id; + LAZY_LOADED_OBJECTS.put( ESTABELECIMENTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EstabelecimentosData toEstabelecimento_id() + { + try + { + prepare( TO_ESTABELECIMENTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_estabelecimento_id; + } + + public void setToEstabelecimento_id( siprp.data.outer.EstabelecimentosData to_estabelecimento_id ) + { + try + { + preProcess( TO_ESTABELECIMENTO_ID, to_estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_estabelecimento_id = to_estabelecimento_id; + } + + public Integer getTrabalhador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TRABALHADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.trabalhador_id; + } + + public void setTrabalhador_id( Integer trabalhador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TRABALHADOR_ID, trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.trabalhador_id = trabalhador_id; + LAZY_LOADED_OBJECTS.put( TRABALHADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresData toTrabalhador_id() + { + try + { + prepare( TO_TRABALHADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_trabalhador_id; + } + + public void setToTrabalhador_id( siprp.data.outer.TrabalhadoresData to_trabalhador_id ) + { + try + { + preProcess( TO_TRABALHADOR_ID, to_trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_trabalhador_id = to_trabalhador_id; + } + + public Integer getEvento_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EVENTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.evento_id; + } + + public void setEvento_id( Integer evento_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EVENTO_ID, evento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.evento_id = evento_id; + LAZY_LOADED_OBJECTS.put( EVENTO_ID, Boolean.TRUE ); + } + + public java.util.Date getData_aviso() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_AVISO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_aviso; + } + + public void setData_aviso( java.util.Date data_aviso ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_AVISO, data_aviso ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_aviso = data_aviso; + LAZY_LOADED_OBJECTS.put( DATA_AVISO, Boolean.TRUE ); + } + + public java.util.Date getData_evento() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_EVENTO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_evento; + } + + public void setData_evento( java.util.Date data_evento ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_EVENTO, data_evento ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_evento = data_evento; + LAZY_LOADED_OBJECTS.put( DATA_EVENTO, Boolean.TRUE ); + } + + public String getDescricao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRICAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.descricao; + } + + public void setDescricao( String descricao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRICAO, descricao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.descricao = descricao; + LAZY_LOADED_OBJECTS.put( DESCRICAO, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Avisos.ID_INDEX: + value = getId(); + break; + case Avisos.TIPO_INDEX: + value = getTipo(); + break; + case Avisos.EMPRESA_ID_INDEX: + value = getEmpresa_id(); + break; + case Avisos.TO_EMPRESA_ID_INDEX: + value = toEmpresa_id(); + break; + case Avisos.ESTABELECIMENTO_ID_INDEX: + value = getEstabelecimento_id(); + break; + case Avisos.TO_ESTABELECIMENTO_ID_INDEX: + value = toEstabelecimento_id(); + break; + case Avisos.TRABALHADOR_ID_INDEX: + value = getTrabalhador_id(); + break; + case Avisos.TO_TRABALHADOR_ID_INDEX: + value = toTrabalhador_id(); + break; + case Avisos.EVENTO_ID_INDEX: + value = getEvento_id(); + break; + case Avisos.DATA_AVISO_INDEX: + value = getData_aviso(); + break; + case Avisos.DATA_EVENTO_INDEX: + value = getData_evento(); + break; + case Avisos.DESCRICAO_INDEX: + value = getDescricao(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Avisos.ID_INDEX: + value = this.id; + break; + case Avisos.TIPO_INDEX: + value = this.tipo; + break; + case Avisos.EMPRESA_ID_INDEX: + value = this.empresa_id; + break; + case Avisos.TO_EMPRESA_ID_INDEX: + value = this.to_empresa_id; + break; + case Avisos.ESTABELECIMENTO_ID_INDEX: + value = this.estabelecimento_id; + break; + case Avisos.TO_ESTABELECIMENTO_ID_INDEX: + value = this.to_estabelecimento_id; + break; + case Avisos.TRABALHADOR_ID_INDEX: + value = this.trabalhador_id; + break; + case Avisos.TO_TRABALHADOR_ID_INDEX: + value = this.to_trabalhador_id; + break; + case Avisos.EVENTO_ID_INDEX: + value = this.evento_id; + break; + case Avisos.DATA_AVISO_INDEX: + value = this.data_aviso; + break; + case Avisos.DATA_EVENTO_INDEX: + value = this.data_evento; + break; + case Avisos.DESCRICAO_INDEX: + value = this.descricao; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Avisos.ID_INDEX: + setId( ( Integer ) value ); + break; + case Avisos.TIPO_INDEX: + setTipo( ( Integer ) value ); + break; + case Avisos.EMPRESA_ID_INDEX: + setEmpresa_id( ( Integer ) value ); + break; + case Avisos.TO_EMPRESA_ID_INDEX: + setToEmpresa_id( ( siprp.data.outer.EmpresasData ) value ); + break; + case Avisos.ESTABELECIMENTO_ID_INDEX: + setEstabelecimento_id( ( Integer ) value ); + break; + case Avisos.TO_ESTABELECIMENTO_ID_INDEX: + setToEstabelecimento_id( ( siprp.data.outer.EstabelecimentosData ) value ); + break; + case Avisos.TRABALHADOR_ID_INDEX: + setTrabalhador_id( ( Integer ) value ); + break; + case Avisos.TO_TRABALHADOR_ID_INDEX: + setToTrabalhador_id( ( siprp.data.outer.TrabalhadoresData ) value ); + break; + case Avisos.EVENTO_ID_INDEX: + setEvento_id( ( Integer ) value ); + break; + case Avisos.DATA_AVISO_INDEX: + setData_aviso( ( java.util.Date ) value ); + break; + case Avisos.DATA_EVENTO_INDEX: + setData_evento( ( java.util.Date ) value ); + break; + case Avisos.DESCRICAO_INDEX: + setDescricao( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Avisos.ID_INDEX: + this.id = ( Integer ) value; + break; + case Avisos.TIPO_INDEX: + this.tipo = ( Integer ) value; + break; + case Avisos.EMPRESA_ID_INDEX: + this.empresa_id = ( Integer ) value; + break; + case Avisos.TO_EMPRESA_ID_INDEX: + this.to_empresa_id = ( siprp.data.outer.EmpresasData ) value; + break; + case Avisos.ESTABELECIMENTO_ID_INDEX: + this.estabelecimento_id = ( Integer ) value; + break; + case Avisos.TO_ESTABELECIMENTO_ID_INDEX: + this.to_estabelecimento_id = ( siprp.data.outer.EstabelecimentosData ) value; + break; + case Avisos.TRABALHADOR_ID_INDEX: + this.trabalhador_id = ( Integer ) value; + break; + case Avisos.TO_TRABALHADOR_ID_INDEX: + this.to_trabalhador_id = ( siprp.data.outer.TrabalhadoresData ) value; + break; + case Avisos.EVENTO_ID_INDEX: + this.evento_id = ( Integer ) value; + break; + case Avisos.DATA_AVISO_INDEX: + this.data_aviso = ( java.util.Date ) value; + break; + case Avisos.DATA_EVENTO_INDEX: + this.data_evento = ( java.util.Date ) value; + break; + case Avisos.DESCRICAO_INDEX: + this.descricao = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case Avisos.ID_INDEX: + theClass = Integer.class; + break; + case Avisos.TIPO_INDEX: + theClass = Integer.class; + break; + case Avisos.EMPRESA_ID_INDEX: + theClass = Integer.class; + break; + case Avisos.TO_EMPRESA_ID_INDEX: + theClass = siprp.data.outer.EmpresasData.class; + break; + case Avisos.ESTABELECIMENTO_ID_INDEX: + theClass = Integer.class; + break; + case Avisos.TO_ESTABELECIMENTO_ID_INDEX: + theClass = siprp.data.outer.EstabelecimentosData.class; + break; + case Avisos.TRABALHADOR_ID_INDEX: + theClass = Integer.class; + break; + case Avisos.TO_TRABALHADOR_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresData.class; + break; + case Avisos.EVENTO_ID_INDEX: + theClass = Integer.class; + break; + case Avisos.DATA_AVISO_INDEX: + theClass = java.util.Date.class; + break; + case Avisos.DATA_EVENTO_INDEX: + theClass = java.util.Date.class; + break; + case Avisos.DESCRICAO_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : Avisos._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, Avisos.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Contactos.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Contactos.java new file mode 100644 index 00000000..ce59d2db --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Contactos.java @@ -0,0 +1,637 @@ +/* +* Contactos.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class Contactos extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( Contactos.ID, Contactos.ID_INDEX ); + FIELD_INDEXES.put( Contactos.ID_FULL, Contactos.ID_INDEX ); + FIELD_INDEXES.put( Contactos.NOME, Contactos.NOME_INDEX ); + FIELD_INDEXES.put( Contactos.NOME_FULL, Contactos.NOME_INDEX ); + FIELD_INDEXES.put( Contactos.TELEFONE, Contactos.TELEFONE_INDEX ); + FIELD_INDEXES.put( Contactos.TELEFONE_FULL, Contactos.TELEFONE_INDEX ); + FIELD_INDEXES.put( Contactos.TELEMOVEL, Contactos.TELEMOVEL_INDEX ); + FIELD_INDEXES.put( Contactos.TELEMOVEL_FULL, Contactos.TELEMOVEL_INDEX ); + FIELD_INDEXES.put( Contactos.FAX, Contactos.FAX_INDEX ); + FIELD_INDEXES.put( Contactos.FAX_FULL, Contactos.FAX_INDEX ); + FIELD_INDEXES.put( Contactos.EMAIL, Contactos.EMAIL_INDEX ); + FIELD_INDEXES.put( Contactos.EMAIL_FULL, Contactos.EMAIL_INDEX ); + FIELD_INDEXES.put( Contactos.CARGO, Contactos.CARGO_INDEX ); + FIELD_INDEXES.put( Contactos.CARGO_FULL, Contactos.CARGO_INDEX ); + FIELD_INDEXES.put( Contactos.DEPARTAMENTO, Contactos.DEPARTAMENTO_INDEX ); + FIELD_INDEXES.put( Contactos.DEPARTAMENTO_FULL, Contactos.DEPARTAMENTO_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "contactos"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.contactos"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "contactos.id"; + public static final int ID_INDEX = 0; + public static final String NOME = "nome"; + public static final String NOME_FULL = "contactos.nome"; + public static final int NOME_INDEX = 1; + public static final String TELEFONE = "telefone"; + public static final String TELEFONE_FULL = "contactos.telefone"; + public static final int TELEFONE_INDEX = 2; + public static final String TELEMOVEL = "telemovel"; + public static final String TELEMOVEL_FULL = "contactos.telemovel"; + public static final int TELEMOVEL_INDEX = 3; + public static final String FAX = "fax"; + public static final String FAX_FULL = "contactos.fax"; + public static final int FAX_INDEX = 4; + public static final String EMAIL = "email"; + public static final String EMAIL_FULL = "contactos.email"; + public static final int EMAIL_INDEX = 5; + public static final String CARGO = "cargo"; + public static final String CARGO_FULL = "contactos.cargo"; + public static final int CARGO_INDEX = 6; + public static final String DEPARTAMENTO = "departamento"; + public static final String DEPARTAMENTO_FULL = "contactos.departamento"; + public static final int DEPARTAMENTO_INDEX = 7; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, TELEFONE, TELEMOVEL, FAX, EMAIL, CARGO, DEPARTAMENTO, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + NOME, TABLENAME + "." + TELEFONE, TABLENAME + "." + TELEMOVEL, TABLENAME + "." + FAX, TABLENAME + "." + EMAIL, TABLENAME + "." + CARGO, TABLENAME + "." + DEPARTAMENTO, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, NOME, TELEFONE, TELEMOVEL, FAX, EMAIL, CARGO, DEPARTAMENTO, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, NOME, TELEFONE, TELEMOVEL, FAX, EMAIL, CARGO, DEPARTAMENTO, }; + + private Integer id; + private String nome; + private String telefone; + private String telemovel; + private String fax; + private String email; + private String cargo; + private String departamento; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public Contactos() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromEmpresas_contacto_1() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.EmpresasData.class , getPrimaryKey().getMap().get("id"), "contacto_1" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromEmpresas_contacto_2() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.EmpresasData.class , getPrimaryKey().getMap().get("id"), "contacto_2" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromEstabelecimentos_contacto_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.EstabelecimentosData.class , getPrimaryKey().getMap().get("id"), "contacto_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromPrestadores_contacto_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.PrestadoresData.class , getPrimaryKey().getMap().get("id"), "contacto_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getNome() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NOME ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.nome; + } + + public void setNome( String nome ) + { + try + { + setLockedForRefresh( true ); + preProcess( NOME, nome ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.nome = nome; + LAZY_LOADED_OBJECTS.put( NOME, Boolean.TRUE ); + } + + public String getTelefone() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TELEFONE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.telefone; + } + + public void setTelefone( String telefone ) + { + try + { + setLockedForRefresh( true ); + preProcess( TELEFONE, telefone ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.telefone = telefone; + LAZY_LOADED_OBJECTS.put( TELEFONE, Boolean.TRUE ); + } + + public String getTelemovel() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TELEMOVEL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.telemovel; + } + + public void setTelemovel( String telemovel ) + { + try + { + setLockedForRefresh( true ); + preProcess( TELEMOVEL, telemovel ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.telemovel = telemovel; + LAZY_LOADED_OBJECTS.put( TELEMOVEL, Boolean.TRUE ); + } + + public String getFax() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( FAX ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.fax; + } + + public void setFax( String fax ) + { + try + { + setLockedForRefresh( true ); + preProcess( FAX, fax ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.fax = fax; + LAZY_LOADED_OBJECTS.put( FAX, Boolean.TRUE ); + } + + public String getEmail() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMAIL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.email; + } + + public void setEmail( String email ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMAIL, email ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.email = email; + LAZY_LOADED_OBJECTS.put( EMAIL, Boolean.TRUE ); + } + + public String getCargo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CARGO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.cargo; + } + + public void setCargo( String cargo ) + { + try + { + setLockedForRefresh( true ); + preProcess( CARGO, cargo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.cargo = cargo; + LAZY_LOADED_OBJECTS.put( CARGO, Boolean.TRUE ); + } + + public String getDepartamento() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DEPARTAMENTO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.departamento; + } + + public void setDepartamento( String departamento ) + { + try + { + setLockedForRefresh( true ); + preProcess( DEPARTAMENTO, departamento ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.departamento = departamento; + LAZY_LOADED_OBJECTS.put( DEPARTAMENTO, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Contactos.ID_INDEX: + value = getId(); + break; + case Contactos.NOME_INDEX: + value = getNome(); + break; + case Contactos.TELEFONE_INDEX: + value = getTelefone(); + break; + case Contactos.TELEMOVEL_INDEX: + value = getTelemovel(); + break; + case Contactos.FAX_INDEX: + value = getFax(); + break; + case Contactos.EMAIL_INDEX: + value = getEmail(); + break; + case Contactos.CARGO_INDEX: + value = getCargo(); + break; + case Contactos.DEPARTAMENTO_INDEX: + value = getDepartamento(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Contactos.ID_INDEX: + value = this.id; + break; + case Contactos.NOME_INDEX: + value = this.nome; + break; + case Contactos.TELEFONE_INDEX: + value = this.telefone; + break; + case Contactos.TELEMOVEL_INDEX: + value = this.telemovel; + break; + case Contactos.FAX_INDEX: + value = this.fax; + break; + case Contactos.EMAIL_INDEX: + value = this.email; + break; + case Contactos.CARGO_INDEX: + value = this.cargo; + break; + case Contactos.DEPARTAMENTO_INDEX: + value = this.departamento; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Contactos.ID_INDEX: + setId( ( Integer ) value ); + break; + case Contactos.NOME_INDEX: + setNome( ( String ) value ); + break; + case Contactos.TELEFONE_INDEX: + setTelefone( ( String ) value ); + break; + case Contactos.TELEMOVEL_INDEX: + setTelemovel( ( String ) value ); + break; + case Contactos.FAX_INDEX: + setFax( ( String ) value ); + break; + case Contactos.EMAIL_INDEX: + setEmail( ( String ) value ); + break; + case Contactos.CARGO_INDEX: + setCargo( ( String ) value ); + break; + case Contactos.DEPARTAMENTO_INDEX: + setDepartamento( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Contactos.ID_INDEX: + this.id = ( Integer ) value; + break; + case Contactos.NOME_INDEX: + this.nome = ( String ) value; + break; + case Contactos.TELEFONE_INDEX: + this.telefone = ( String ) value; + break; + case Contactos.TELEMOVEL_INDEX: + this.telemovel = ( String ) value; + break; + case Contactos.FAX_INDEX: + this.fax = ( String ) value; + break; + case Contactos.EMAIL_INDEX: + this.email = ( String ) value; + break; + case Contactos.CARGO_INDEX: + this.cargo = ( String ) value; + break; + case Contactos.DEPARTAMENTO_INDEX: + this.departamento = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case Contactos.ID_INDEX: + theClass = Integer.class; + break; + case Contactos.NOME_INDEX: + theClass = String.class; + break; + case Contactos.TELEFONE_INDEX: + theClass = String.class; + break; + case Contactos.TELEMOVEL_INDEX: + theClass = String.class; + break; + case Contactos.FAX_INDEX: + theClass = String.class; + break; + case Contactos.EMAIL_INDEX: + theClass = String.class; + break; + case Contactos.CARGO_INDEX: + theClass = String.class; + break; + case Contactos.DEPARTAMENTO_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : Contactos._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, Contactos.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/EcdOficial.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/EcdOficial.java new file mode 100644 index 00000000..1a8e3ec5 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/EcdOficial.java @@ -0,0 +1,445 @@ +/* +* EcdOficial.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class EcdOficial extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( EcdOficial.ID, EcdOficial.ID_INDEX ); + FIELD_INDEXES.put( EcdOficial.ID_FULL, EcdOficial.ID_INDEX ); + FIELD_INDEXES.put( EcdOficial.DESCRICAO, EcdOficial.DESCRICAO_INDEX ); + FIELD_INDEXES.put( EcdOficial.DESCRICAO_FULL, EcdOficial.DESCRICAO_INDEX ); + FIELD_INDEXES.put( EcdOficial.DESCRICAO_PLAIN, EcdOficial.DESCRICAO_PLAIN_INDEX ); + FIELD_INDEXES.put( EcdOficial.DESCRICAO_PLAIN_FULL, EcdOficial.DESCRICAO_PLAIN_INDEX ); + FIELD_INDEXES.put( EcdOficial.ORDEM, EcdOficial.ORDEM_INDEX ); + FIELD_INDEXES.put( EcdOficial.ORDEM_FULL, EcdOficial.ORDEM_INDEX ); + FIELD_INDEXES.put( EcdOficial.ACTIVO, EcdOficial.ACTIVO_INDEX ); + FIELD_INDEXES.put( EcdOficial.ACTIVO_FULL, EcdOficial.ACTIVO_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "ecd_oficial"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.ecd_oficial"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "ecd_oficial.id"; + public static final int ID_INDEX = 0; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "ecd_oficial.descricao"; + public static final int DESCRICAO_INDEX = 1; + public static final String DESCRICAO_PLAIN = "descricao_plain"; + public static final String DESCRICAO_PLAIN_FULL = "ecd_oficial.descricao_plain"; + public static final int DESCRICAO_PLAIN_INDEX = 2; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "ecd_oficial.ordem"; + public static final int ORDEM_INDEX = 3; + public static final String ACTIVO = "activo"; + public static final String ACTIVO_FULL = "ecd_oficial.activo"; + public static final int ACTIVO_INDEX = 4; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRICAO, DESCRICAO_PLAIN, ORDEM, ACTIVO, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DESCRICAO, TABLENAME + "." + DESCRICAO_PLAIN, TABLENAME + "." + ORDEM, TABLENAME + "." + ACTIVO, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DESCRICAO, DESCRICAO_PLAIN, ORDEM, ACTIVO, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DESCRICAO, DESCRICAO_PLAIN, ORDEM, ACTIVO, }; + + private Integer id; + private String descricao; + private String descricao_plain; + private Integer ordem; + private String activo; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public EcdOficial() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromTrabalhadoresEcd_ecd_oficial_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresEcdData.class , getPrimaryKey().getMap().get("id"), "ecd_oficial_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getDescricao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRICAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.descricao; + } + + public void setDescricao( String descricao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRICAO, descricao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.descricao = descricao; + LAZY_LOADED_OBJECTS.put( DESCRICAO, Boolean.TRUE ); + } + + public String getDescricao_plain() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRICAO_PLAIN ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.descricao_plain; + } + + public void setDescricao_plain( String descricao_plain ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRICAO_PLAIN, descricao_plain ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.descricao_plain = descricao_plain; + LAZY_LOADED_OBJECTS.put( DESCRICAO_PLAIN, Boolean.TRUE ); + } + + public Integer getOrdem() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ORDEM ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.ordem; + } + + public void setOrdem( Integer ordem ) + { + try + { + setLockedForRefresh( true ); + preProcess( ORDEM, ordem ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.ordem = ordem; + LAZY_LOADED_OBJECTS.put( ORDEM, Boolean.TRUE ); + } + + public String getActivo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ACTIVO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.activo; + } + + public void setActivo( String activo ) + { + try + { + setLockedForRefresh( true ); + preProcess( ACTIVO, activo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.activo = activo; + LAZY_LOADED_OBJECTS.put( ACTIVO, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EcdOficial.ID_INDEX: + value = getId(); + break; + case EcdOficial.DESCRICAO_INDEX: + value = getDescricao(); + break; + case EcdOficial.DESCRICAO_PLAIN_INDEX: + value = getDescricao_plain(); + break; + case EcdOficial.ORDEM_INDEX: + value = getOrdem(); + break; + case EcdOficial.ACTIVO_INDEX: + value = getActivo(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EcdOficial.ID_INDEX: + value = this.id; + break; + case EcdOficial.DESCRICAO_INDEX: + value = this.descricao; + break; + case EcdOficial.DESCRICAO_PLAIN_INDEX: + value = this.descricao_plain; + break; + case EcdOficial.ORDEM_INDEX: + value = this.ordem; + break; + case EcdOficial.ACTIVO_INDEX: + value = this.activo; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EcdOficial.ID_INDEX: + setId( ( Integer ) value ); + break; + case EcdOficial.DESCRICAO_INDEX: + setDescricao( ( String ) value ); + break; + case EcdOficial.DESCRICAO_PLAIN_INDEX: + setDescricao_plain( ( String ) value ); + break; + case EcdOficial.ORDEM_INDEX: + setOrdem( ( Integer ) value ); + break; + case EcdOficial.ACTIVO_INDEX: + setActivo( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EcdOficial.ID_INDEX: + this.id = ( Integer ) value; + break; + case EcdOficial.DESCRICAO_INDEX: + this.descricao = ( String ) value; + break; + case EcdOficial.DESCRICAO_PLAIN_INDEX: + this.descricao_plain = ( String ) value; + break; + case EcdOficial.ORDEM_INDEX: + this.ordem = ( Integer ) value; + break; + case EcdOficial.ACTIVO_INDEX: + this.activo = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case EcdOficial.ID_INDEX: + theClass = Integer.class; + break; + case EcdOficial.DESCRICAO_INDEX: + theClass = String.class; + break; + case EcdOficial.DESCRICAO_PLAIN_INDEX: + theClass = String.class; + break; + case EcdOficial.ORDEM_INDEX: + theClass = Integer.class; + break; + case EcdOficial.ACTIVO_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : EcdOficial._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, EcdOficial.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/EmailPlanoDeActuacao.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/EmailPlanoDeActuacao.java new file mode 100644 index 00000000..7d6141fc --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/EmailPlanoDeActuacao.java @@ -0,0 +1,380 @@ +/* +* EmailPlanoDeActuacao.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class EmailPlanoDeActuacao extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( EmailPlanoDeActuacao.ID, EmailPlanoDeActuacao.ID_INDEX ); + FIELD_INDEXES.put( EmailPlanoDeActuacao.ID_FULL, EmailPlanoDeActuacao.ID_INDEX ); + FIELD_INDEXES.put( EmailPlanoDeActuacao.DESCRIPTION, EmailPlanoDeActuacao.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( EmailPlanoDeActuacao.DESCRIPTION_FULL, EmailPlanoDeActuacao.DESCRIPTION_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( EmailPlanoDeActuacao.CLASS_IDENTIFIER, EmailPlanoDeActuacao.ESTABELECIMENTO_ID, EmailPlanoDeActuacao.TO_ESTABELECIMENTO_ID ); + FIELD_INDEXES.put( EmailPlanoDeActuacao.ESTABELECIMENTO_ID, EmailPlanoDeActuacao.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( EmailPlanoDeActuacao.ESTABELECIMENTO_ID_FULL, EmailPlanoDeActuacao.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( EmailPlanoDeActuacao.TO_ESTABELECIMENTO_ID, EmailPlanoDeActuacao.TO_ESTABELECIMENTO_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyestabelecimento_idToestabelecimentos = + new com.evolute.entity.ForeignKey( EmailPlanoDeActuacao.class, EmailPlanoDeActuacao.ESTABELECIMENTO_ID, siprp.data.outer.EstabelecimentosData.class, siprp.data.outer.EstabelecimentosData.ID ); + + public static final String TABLENAME = "email_plano_de_actuacao"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.email_plano_de_actuacao"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "email_plano_de_actuacao.id"; + public static final int ID_INDEX = 0; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "email_plano_de_actuacao.description"; + public static final int DESCRIPTION_INDEX = 1; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "email_plano_de_actuacao.estabelecimento_id"; + public static final int ESTABELECIMENTO_ID_INDEX = 2; + public static final String TO_ESTABELECIMENTO_ID = "to_estabelecimento_id"; + public static final int TO_ESTABELECIMENTO_ID_INDEX = 3; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRIPTION, ESTABELECIMENTO_ID, TO_ESTABELECIMENTO_ID, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DESCRIPTION, TABLENAME + "." + ESTABELECIMENTO_ID, TABLENAME + "." + TO_ESTABELECIMENTO_ID, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DESCRIPTION, ESTABELECIMENTO_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DESCRIPTION, ESTABELECIMENTO_ID, }; + + private Integer id; + private String description; + private Integer estabelecimento_id; + private siprp.data.outer.EstabelecimentosData to_estabelecimento_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public EmailPlanoDeActuacao() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public String getDescription() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRIPTION ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.description; + } + + public void setDescription( String description ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRIPTION, description ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.description = description; + LAZY_LOADED_OBJECTS.put( DESCRIPTION, Boolean.TRUE ); + } + + public Integer getEstabelecimento_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTABELECIMENTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estabelecimento_id; + } + + public void setEstabelecimento_id( Integer estabelecimento_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTABELECIMENTO_ID, estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estabelecimento_id = estabelecimento_id; + LAZY_LOADED_OBJECTS.put( ESTABELECIMENTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EstabelecimentosData toEstabelecimento_id() + { + try + { + prepare( TO_ESTABELECIMENTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_estabelecimento_id; + } + + public void setToEstabelecimento_id( siprp.data.outer.EstabelecimentosData to_estabelecimento_id ) + { + try + { + preProcess( TO_ESTABELECIMENTO_ID, to_estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_estabelecimento_id = to_estabelecimento_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EmailPlanoDeActuacao.ID_INDEX: + value = getId(); + break; + case EmailPlanoDeActuacao.DESCRIPTION_INDEX: + value = getDescription(); + break; + case EmailPlanoDeActuacao.ESTABELECIMENTO_ID_INDEX: + value = getEstabelecimento_id(); + break; + case EmailPlanoDeActuacao.TO_ESTABELECIMENTO_ID_INDEX: + value = toEstabelecimento_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EmailPlanoDeActuacao.ID_INDEX: + value = this.id; + break; + case EmailPlanoDeActuacao.DESCRIPTION_INDEX: + value = this.description; + break; + case EmailPlanoDeActuacao.ESTABELECIMENTO_ID_INDEX: + value = this.estabelecimento_id; + break; + case EmailPlanoDeActuacao.TO_ESTABELECIMENTO_ID_INDEX: + value = this.to_estabelecimento_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EmailPlanoDeActuacao.ID_INDEX: + setId( ( Integer ) value ); + break; + case EmailPlanoDeActuacao.DESCRIPTION_INDEX: + setDescription( ( String ) value ); + break; + case EmailPlanoDeActuacao.ESTABELECIMENTO_ID_INDEX: + setEstabelecimento_id( ( Integer ) value ); + break; + case EmailPlanoDeActuacao.TO_ESTABELECIMENTO_ID_INDEX: + setToEstabelecimento_id( ( siprp.data.outer.EstabelecimentosData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EmailPlanoDeActuacao.ID_INDEX: + this.id = ( Integer ) value; + break; + case EmailPlanoDeActuacao.DESCRIPTION_INDEX: + this.description = ( String ) value; + break; + case EmailPlanoDeActuacao.ESTABELECIMENTO_ID_INDEX: + this.estabelecimento_id = ( Integer ) value; + break; + case EmailPlanoDeActuacao.TO_ESTABELECIMENTO_ID_INDEX: + this.to_estabelecimento_id = ( siprp.data.outer.EstabelecimentosData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case EmailPlanoDeActuacao.ID_INDEX: + theClass = Integer.class; + break; + case EmailPlanoDeActuacao.DESCRIPTION_INDEX: + theClass = String.class; + break; + case EmailPlanoDeActuacao.ESTABELECIMENTO_ID_INDEX: + theClass = Integer.class; + break; + case EmailPlanoDeActuacao.TO_ESTABELECIMENTO_ID_INDEX: + theClass = siprp.data.outer.EstabelecimentosData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : EmailPlanoDeActuacao._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, EmailPlanoDeActuacao.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/EmpresaPrecoPeriodicidadeTipo.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/EmpresaPrecoPeriodicidadeTipo.java new file mode 100644 index 00000000..91c051af --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/EmpresaPrecoPeriodicidadeTipo.java @@ -0,0 +1,294 @@ +/* +* EmpresaPrecoPeriodicidadeTipo.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class EmpresaPrecoPeriodicidadeTipo extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( EmpresaPrecoPeriodicidadeTipo.ID, EmpresaPrecoPeriodicidadeTipo.ID_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoPeriodicidadeTipo.ID_FULL, EmpresaPrecoPeriodicidadeTipo.ID_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoPeriodicidadeTipo.NOME, EmpresaPrecoPeriodicidadeTipo.NOME_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoPeriodicidadeTipo.NOME_FULL, EmpresaPrecoPeriodicidadeTipo.NOME_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "empresa_preco_periodicidade_tipo"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.empresa_preco_periodicidade_tipo"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "empresa_preco_periodicidade_tipo.id"; + public static final int ID_INDEX = 0; + public static final String NOME = "nome"; + public static final String NOME_FULL = "empresa_preco_periodicidade_tipo.nome"; + public static final int NOME_INDEX = 1; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + NOME, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, NOME, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, NOME, }; + + private Integer id; + private String nome; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public EmpresaPrecoPeriodicidadeTipo() + { + super(); + dirtyProperties = new boolean[]{ false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromEmpresaPrecoServico_empresa_preco_periodicidade_tipo_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.EmpresaPrecoServicoData.class , getPrimaryKey().getMap().get("id"), "empresa_preco_periodicidade_tipo_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getNome() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NOME ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.nome; + } + + public void setNome( String nome ) + { + try + { + setLockedForRefresh( true ); + preProcess( NOME, nome ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.nome = nome; + LAZY_LOADED_OBJECTS.put( NOME, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EmpresaPrecoPeriodicidadeTipo.ID_INDEX: + value = getId(); + break; + case EmpresaPrecoPeriodicidadeTipo.NOME_INDEX: + value = getNome(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EmpresaPrecoPeriodicidadeTipo.ID_INDEX: + value = this.id; + break; + case EmpresaPrecoPeriodicidadeTipo.NOME_INDEX: + value = this.nome; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EmpresaPrecoPeriodicidadeTipo.ID_INDEX: + setId( ( Integer ) value ); + break; + case EmpresaPrecoPeriodicidadeTipo.NOME_INDEX: + setNome( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EmpresaPrecoPeriodicidadeTipo.ID_INDEX: + this.id = ( Integer ) value; + break; + case EmpresaPrecoPeriodicidadeTipo.NOME_INDEX: + this.nome = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case EmpresaPrecoPeriodicidadeTipo.ID_INDEX: + theClass = Integer.class; + break; + case EmpresaPrecoPeriodicidadeTipo.NOME_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : EmpresaPrecoPeriodicidadeTipo._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, EmpresaPrecoPeriodicidadeTipo.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/EmpresaPrecoServico.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/EmpresaPrecoServico.java new file mode 100644 index 00000000..9e7b621f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/EmpresaPrecoServico.java @@ -0,0 +1,736 @@ +/* +* EmpresaPrecoServico.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class EmpresaPrecoServico extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( EmpresaPrecoServico.ID, EmpresaPrecoServico.ID_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServico.ID_FULL, EmpresaPrecoServico.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( EmpresaPrecoServico.CLASS_IDENTIFIER, EmpresaPrecoServico.EMPRESA_PRECO_SERVICO_TIPO_ID, EmpresaPrecoServico.TO_EMPRESA_PRECO_SERVICO_TIPO_ID ); + FIELD_INDEXES.put( EmpresaPrecoServico.EMPRESA_PRECO_SERVICO_TIPO_ID, EmpresaPrecoServico.EMPRESA_PRECO_SERVICO_TIPO_ID_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServico.EMPRESA_PRECO_SERVICO_TIPO_ID_FULL, EmpresaPrecoServico.EMPRESA_PRECO_SERVICO_TIPO_ID_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServico.TO_EMPRESA_PRECO_SERVICO_TIPO_ID, EmpresaPrecoServico.TO_EMPRESA_PRECO_SERVICO_TIPO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( EmpresaPrecoServico.CLASS_IDENTIFIER, EmpresaPrecoServico.EMPRESA_PRECO_PERIODICIDADE_TIPO_ID, EmpresaPrecoServico.TO_EMPRESA_PRECO_PERIODICIDADE_TIPO_ID ); + FIELD_INDEXES.put( EmpresaPrecoServico.EMPRESA_PRECO_PERIODICIDADE_TIPO_ID, EmpresaPrecoServico.EMPRESA_PRECO_PERIODICIDADE_TIPO_ID_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServico.EMPRESA_PRECO_PERIODICIDADE_TIPO_ID_FULL, EmpresaPrecoServico.EMPRESA_PRECO_PERIODICIDADE_TIPO_ID_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServico.TO_EMPRESA_PRECO_PERIODICIDADE_TIPO_ID, EmpresaPrecoServico.TO_EMPRESA_PRECO_PERIODICIDADE_TIPO_ID_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServico.TIPO_OUTRO, EmpresaPrecoServico.TIPO_OUTRO_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServico.TIPO_OUTRO_FULL, EmpresaPrecoServico.TIPO_OUTRO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( EmpresaPrecoServico.CLASS_IDENTIFIER, EmpresaPrecoServico.EMPRESA_ID, EmpresaPrecoServico.TO_EMPRESA_ID ); + FIELD_INDEXES.put( EmpresaPrecoServico.EMPRESA_ID, EmpresaPrecoServico.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServico.EMPRESA_ID_FULL, EmpresaPrecoServico.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServico.TO_EMPRESA_ID, EmpresaPrecoServico.TO_EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServico.VALOR, EmpresaPrecoServico.VALOR_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServico.VALOR_FULL, EmpresaPrecoServico.VALOR_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServico.INICIADO, EmpresaPrecoServico.INICIADO_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServico.INICIADO_FULL, EmpresaPrecoServico.INICIADO_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServico.ACTIVO, EmpresaPrecoServico.ACTIVO_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServico.ACTIVO_FULL, EmpresaPrecoServico.ACTIVO_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyempresa_preco_servico_tipo_idToempresa_preco_servico_tipo = + new com.evolute.entity.ForeignKey( EmpresaPrecoServico.class, EmpresaPrecoServico.EMPRESA_PRECO_SERVICO_TIPO_ID, siprp.data.outer.EmpresaPrecoServicoTipoData.class, siprp.data.outer.EmpresaPrecoServicoTipoData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyempresa_preco_periodicidade_tipo_idToempresa_preco_periodicidade_tipo = + new com.evolute.entity.ForeignKey( EmpresaPrecoServico.class, EmpresaPrecoServico.EMPRESA_PRECO_PERIODICIDADE_TIPO_ID, siprp.data.outer.EmpresaPrecoPeriodicidadeTipoData.class, siprp.data.outer.EmpresaPrecoPeriodicidadeTipoData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyempresa_idToempresas = + new com.evolute.entity.ForeignKey( EmpresaPrecoServico.class, EmpresaPrecoServico.EMPRESA_ID, siprp.data.outer.EmpresasData.class, siprp.data.outer.EmpresasData.ID ); + + public static final String TABLENAME = "empresa_preco_servico"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.empresa_preco_servico"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "empresa_preco_servico.id"; + public static final int ID_INDEX = 0; + public static final String EMPRESA_PRECO_SERVICO_TIPO_ID = "empresa_preco_servico_tipo_id"; + public static final String EMPRESA_PRECO_SERVICO_TIPO_ID_FULL = "empresa_preco_servico.empresa_preco_servico_tipo_id"; + public static final int EMPRESA_PRECO_SERVICO_TIPO_ID_INDEX = 1; + public static final String TO_EMPRESA_PRECO_SERVICO_TIPO_ID = "to_empresa_preco_servico_tipo_id"; + public static final int TO_EMPRESA_PRECO_SERVICO_TIPO_ID_INDEX = 2; + public static final String EMPRESA_PRECO_PERIODICIDADE_TIPO_ID = "empresa_preco_periodicidade_tipo_id"; + public static final String EMPRESA_PRECO_PERIODICIDADE_TIPO_ID_FULL = "empresa_preco_servico.empresa_preco_periodicidade_tipo_id"; + public static final int EMPRESA_PRECO_PERIODICIDADE_TIPO_ID_INDEX = 3; + public static final String TO_EMPRESA_PRECO_PERIODICIDADE_TIPO_ID = "to_empresa_preco_periodicidade_tipo_id"; + public static final int TO_EMPRESA_PRECO_PERIODICIDADE_TIPO_ID_INDEX = 4; + public static final String TIPO_OUTRO = "tipo_outro"; + public static final String TIPO_OUTRO_FULL = "empresa_preco_servico.tipo_outro"; + public static final int TIPO_OUTRO_INDEX = 5; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "empresa_preco_servico.empresa_id"; + public static final int EMPRESA_ID_INDEX = 6; + public static final String TO_EMPRESA_ID = "to_empresa_id"; + public static final int TO_EMPRESA_ID_INDEX = 7; + public static final String VALOR = "valor"; + public static final String VALOR_FULL = "empresa_preco_servico.valor"; + public static final int VALOR_INDEX = 8; + public static final String INICIADO = "iniciado"; + public static final String INICIADO_FULL = "empresa_preco_servico.iniciado"; + public static final int INICIADO_INDEX = 9; + public static final String ACTIVO = "activo"; + public static final String ACTIVO_FULL = "empresa_preco_servico.activo"; + public static final int ACTIVO_INDEX = 10; + + public static final String FIELD_NAMES[] = new String[]{ + EMPRESA_PRECO_SERVICO_TIPO_ID, TO_EMPRESA_PRECO_SERVICO_TIPO_ID, + EMPRESA_PRECO_PERIODICIDADE_TIPO_ID, + TO_EMPRESA_PRECO_PERIODICIDADE_TIPO_ID, TIPO_OUTRO, EMPRESA_ID, + TO_EMPRESA_ID, VALOR, INICIADO, ACTIVO, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + EMPRESA_PRECO_SERVICO_TIPO_ID, TABLENAME + "." + TO_EMPRESA_PRECO_SERVICO_TIPO_ID, + TABLENAME + "." + EMPRESA_PRECO_PERIODICIDADE_TIPO_ID, + TABLENAME + "." + TO_EMPRESA_PRECO_PERIODICIDADE_TIPO_ID, TABLENAME + "." + TIPO_OUTRO, TABLENAME + "." + EMPRESA_ID, + TABLENAME + "." + TO_EMPRESA_ID, TABLENAME + "." + VALOR, TABLENAME + "." + INICIADO, TABLENAME + "." + ACTIVO, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, EMPRESA_PRECO_SERVICO_TIPO_ID, EMPRESA_PRECO_PERIODICIDADE_TIPO_ID, + TIPO_OUTRO, EMPRESA_ID, VALOR, INICIADO, ACTIVO, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, EMPRESA_PRECO_SERVICO_TIPO_ID, EMPRESA_PRECO_PERIODICIDADE_TIPO_ID, + TIPO_OUTRO, EMPRESA_ID, VALOR, INICIADO, ACTIVO, }; + + private Integer id; + private Integer empresa_preco_servico_tipo_id; + private siprp.data.outer.EmpresaPrecoServicoTipoData to_empresa_preco_servico_tipo_id; + private Integer empresa_preco_periodicidade_tipo_id; + private siprp.data.outer.EmpresaPrecoPeriodicidadeTipoData to_empresa_preco_periodicidade_tipo_id; + private String tipo_outro; + private Integer empresa_id; + private siprp.data.outer.EmpresasData to_empresa_id; + private Double valor; + private java.sql.Timestamp iniciado; + private Boolean activo; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public EmpresaPrecoServico() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public Integer getEmpresa_preco_servico_tipo_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMPRESA_PRECO_SERVICO_TIPO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.empresa_preco_servico_tipo_id; + } + + public void setEmpresa_preco_servico_tipo_id( Integer empresa_preco_servico_tipo_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMPRESA_PRECO_SERVICO_TIPO_ID, empresa_preco_servico_tipo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.empresa_preco_servico_tipo_id = empresa_preco_servico_tipo_id; + LAZY_LOADED_OBJECTS.put( EMPRESA_PRECO_SERVICO_TIPO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EmpresaPrecoServicoTipoData toEmpresa_preco_servico_tipo_id() + { + try + { + prepare( TO_EMPRESA_PRECO_SERVICO_TIPO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_empresa_preco_servico_tipo_id; + } + + public void setToEmpresa_preco_servico_tipo_id( siprp.data.outer.EmpresaPrecoServicoTipoData to_empresa_preco_servico_tipo_id ) + { + try + { + preProcess( TO_EMPRESA_PRECO_SERVICO_TIPO_ID, to_empresa_preco_servico_tipo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_empresa_preco_servico_tipo_id = to_empresa_preco_servico_tipo_id; + } + + public Integer getEmpresa_preco_periodicidade_tipo_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMPRESA_PRECO_PERIODICIDADE_TIPO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.empresa_preco_periodicidade_tipo_id; + } + + public void setEmpresa_preco_periodicidade_tipo_id( Integer empresa_preco_periodicidade_tipo_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMPRESA_PRECO_PERIODICIDADE_TIPO_ID, empresa_preco_periodicidade_tipo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.empresa_preco_periodicidade_tipo_id = empresa_preco_periodicidade_tipo_id; + LAZY_LOADED_OBJECTS.put( EMPRESA_PRECO_PERIODICIDADE_TIPO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EmpresaPrecoPeriodicidadeTipoData toEmpresa_preco_periodicidade_tipo_id() + { + try + { + prepare( TO_EMPRESA_PRECO_PERIODICIDADE_TIPO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_empresa_preco_periodicidade_tipo_id; + } + + public void setToEmpresa_preco_periodicidade_tipo_id( siprp.data.outer.EmpresaPrecoPeriodicidadeTipoData to_empresa_preco_periodicidade_tipo_id ) + { + try + { + preProcess( TO_EMPRESA_PRECO_PERIODICIDADE_TIPO_ID, to_empresa_preco_periodicidade_tipo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_empresa_preco_periodicidade_tipo_id = to_empresa_preco_periodicidade_tipo_id; + } + + public String getTipo_outro() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TIPO_OUTRO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.tipo_outro; + } + + public void setTipo_outro( String tipo_outro ) + { + try + { + setLockedForRefresh( true ); + preProcess( TIPO_OUTRO, tipo_outro ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.tipo_outro = tipo_outro; + LAZY_LOADED_OBJECTS.put( TIPO_OUTRO, Boolean.TRUE ); + } + + public Integer getEmpresa_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMPRESA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.empresa_id; + } + + public void setEmpresa_id( Integer empresa_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMPRESA_ID, empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.empresa_id = empresa_id; + LAZY_LOADED_OBJECTS.put( EMPRESA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EmpresasData toEmpresa_id() + { + try + { + prepare( TO_EMPRESA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_empresa_id; + } + + public void setToEmpresa_id( siprp.data.outer.EmpresasData to_empresa_id ) + { + try + { + preProcess( TO_EMPRESA_ID, to_empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_empresa_id = to_empresa_id; + } + + public Double getValor() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( VALOR ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.valor; + } + + public void setValor( Double valor ) + { + try + { + setLockedForRefresh( true ); + preProcess( VALOR, valor ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.valor = valor; + LAZY_LOADED_OBJECTS.put( VALOR, Boolean.TRUE ); + } + + public java.sql.Timestamp getIniciado() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( INICIADO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.iniciado; + } + + public void setIniciado( java.sql.Timestamp iniciado ) + { + try + { + setLockedForRefresh( true ); + preProcess( INICIADO, iniciado ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.iniciado = iniciado; + LAZY_LOADED_OBJECTS.put( INICIADO, Boolean.TRUE ); + } + + public Boolean getActivo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ACTIVO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.activo; + } + + public void setActivo( Boolean activo ) + { + try + { + setLockedForRefresh( true ); + preProcess( ACTIVO, activo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.activo = activo; + LAZY_LOADED_OBJECTS.put( ACTIVO, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EmpresaPrecoServico.ID_INDEX: + value = getId(); + break; + case EmpresaPrecoServico.EMPRESA_PRECO_SERVICO_TIPO_ID_INDEX: + value = getEmpresa_preco_servico_tipo_id(); + break; + case EmpresaPrecoServico.TO_EMPRESA_PRECO_SERVICO_TIPO_ID_INDEX: + value = toEmpresa_preco_servico_tipo_id(); + break; + case EmpresaPrecoServico.EMPRESA_PRECO_PERIODICIDADE_TIPO_ID_INDEX: + value = getEmpresa_preco_periodicidade_tipo_id(); + break; + case EmpresaPrecoServico.TO_EMPRESA_PRECO_PERIODICIDADE_TIPO_ID_INDEX: + value = toEmpresa_preco_periodicidade_tipo_id(); + break; + case EmpresaPrecoServico.TIPO_OUTRO_INDEX: + value = getTipo_outro(); + break; + case EmpresaPrecoServico.EMPRESA_ID_INDEX: + value = getEmpresa_id(); + break; + case EmpresaPrecoServico.TO_EMPRESA_ID_INDEX: + value = toEmpresa_id(); + break; + case EmpresaPrecoServico.VALOR_INDEX: + value = getValor(); + break; + case EmpresaPrecoServico.INICIADO_INDEX: + value = getIniciado(); + break; + case EmpresaPrecoServico.ACTIVO_INDEX: + value = getActivo(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EmpresaPrecoServico.ID_INDEX: + value = this.id; + break; + case EmpresaPrecoServico.EMPRESA_PRECO_SERVICO_TIPO_ID_INDEX: + value = this.empresa_preco_servico_tipo_id; + break; + case EmpresaPrecoServico.TO_EMPRESA_PRECO_SERVICO_TIPO_ID_INDEX: + value = this.to_empresa_preco_servico_tipo_id; + break; + case EmpresaPrecoServico.EMPRESA_PRECO_PERIODICIDADE_TIPO_ID_INDEX: + value = this.empresa_preco_periodicidade_tipo_id; + break; + case EmpresaPrecoServico.TO_EMPRESA_PRECO_PERIODICIDADE_TIPO_ID_INDEX: + value = this.to_empresa_preco_periodicidade_tipo_id; + break; + case EmpresaPrecoServico.TIPO_OUTRO_INDEX: + value = this.tipo_outro; + break; + case EmpresaPrecoServico.EMPRESA_ID_INDEX: + value = this.empresa_id; + break; + case EmpresaPrecoServico.TO_EMPRESA_ID_INDEX: + value = this.to_empresa_id; + break; + case EmpresaPrecoServico.VALOR_INDEX: + value = this.valor; + break; + case EmpresaPrecoServico.INICIADO_INDEX: + value = this.iniciado; + break; + case EmpresaPrecoServico.ACTIVO_INDEX: + value = this.activo; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EmpresaPrecoServico.ID_INDEX: + setId( ( Integer ) value ); + break; + case EmpresaPrecoServico.EMPRESA_PRECO_SERVICO_TIPO_ID_INDEX: + setEmpresa_preco_servico_tipo_id( ( Integer ) value ); + break; + case EmpresaPrecoServico.TO_EMPRESA_PRECO_SERVICO_TIPO_ID_INDEX: + setToEmpresa_preco_servico_tipo_id( ( siprp.data.outer.EmpresaPrecoServicoTipoData ) value ); + break; + case EmpresaPrecoServico.EMPRESA_PRECO_PERIODICIDADE_TIPO_ID_INDEX: + setEmpresa_preco_periodicidade_tipo_id( ( Integer ) value ); + break; + case EmpresaPrecoServico.TO_EMPRESA_PRECO_PERIODICIDADE_TIPO_ID_INDEX: + setToEmpresa_preco_periodicidade_tipo_id( ( siprp.data.outer.EmpresaPrecoPeriodicidadeTipoData ) value ); + break; + case EmpresaPrecoServico.TIPO_OUTRO_INDEX: + setTipo_outro( ( String ) value ); + break; + case EmpresaPrecoServico.EMPRESA_ID_INDEX: + setEmpresa_id( ( Integer ) value ); + break; + case EmpresaPrecoServico.TO_EMPRESA_ID_INDEX: + setToEmpresa_id( ( siprp.data.outer.EmpresasData ) value ); + break; + case EmpresaPrecoServico.VALOR_INDEX: + setValor( ( Double ) value ); + break; + case EmpresaPrecoServico.INICIADO_INDEX: + setIniciado( ( java.sql.Timestamp ) value ); + break; + case EmpresaPrecoServico.ACTIVO_INDEX: + setActivo( ( Boolean ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EmpresaPrecoServico.ID_INDEX: + this.id = ( Integer ) value; + break; + case EmpresaPrecoServico.EMPRESA_PRECO_SERVICO_TIPO_ID_INDEX: + this.empresa_preco_servico_tipo_id = ( Integer ) value; + break; + case EmpresaPrecoServico.TO_EMPRESA_PRECO_SERVICO_TIPO_ID_INDEX: + this.to_empresa_preco_servico_tipo_id = ( siprp.data.outer.EmpresaPrecoServicoTipoData ) value; + break; + case EmpresaPrecoServico.EMPRESA_PRECO_PERIODICIDADE_TIPO_ID_INDEX: + this.empresa_preco_periodicidade_tipo_id = ( Integer ) value; + break; + case EmpresaPrecoServico.TO_EMPRESA_PRECO_PERIODICIDADE_TIPO_ID_INDEX: + this.to_empresa_preco_periodicidade_tipo_id = ( siprp.data.outer.EmpresaPrecoPeriodicidadeTipoData ) value; + break; + case EmpresaPrecoServico.TIPO_OUTRO_INDEX: + this.tipo_outro = ( String ) value; + break; + case EmpresaPrecoServico.EMPRESA_ID_INDEX: + this.empresa_id = ( Integer ) value; + break; + case EmpresaPrecoServico.TO_EMPRESA_ID_INDEX: + this.to_empresa_id = ( siprp.data.outer.EmpresasData ) value; + break; + case EmpresaPrecoServico.VALOR_INDEX: + this.valor = ( Double ) value; + break; + case EmpresaPrecoServico.INICIADO_INDEX: + this.iniciado = ( java.sql.Timestamp ) value; + break; + case EmpresaPrecoServico.ACTIVO_INDEX: + this.activo = ( Boolean ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case EmpresaPrecoServico.ID_INDEX: + theClass = Integer.class; + break; + case EmpresaPrecoServico.EMPRESA_PRECO_SERVICO_TIPO_ID_INDEX: + theClass = Integer.class; + break; + case EmpresaPrecoServico.TO_EMPRESA_PRECO_SERVICO_TIPO_ID_INDEX: + theClass = siprp.data.outer.EmpresaPrecoServicoTipoData.class; + break; + case EmpresaPrecoServico.EMPRESA_PRECO_PERIODICIDADE_TIPO_ID_INDEX: + theClass = Integer.class; + break; + case EmpresaPrecoServico.TO_EMPRESA_PRECO_PERIODICIDADE_TIPO_ID_INDEX: + theClass = siprp.data.outer.EmpresaPrecoPeriodicidadeTipoData.class; + break; + case EmpresaPrecoServico.TIPO_OUTRO_INDEX: + theClass = String.class; + break; + case EmpresaPrecoServico.EMPRESA_ID_INDEX: + theClass = Integer.class; + break; + case EmpresaPrecoServico.TO_EMPRESA_ID_INDEX: + theClass = siprp.data.outer.EmpresasData.class; + break; + case EmpresaPrecoServico.VALOR_INDEX: + theClass = Double.class; + break; + case EmpresaPrecoServico.INICIADO_INDEX: + theClass = java.sql.Timestamp.class; + break; + case EmpresaPrecoServico.ACTIVO_INDEX: + theClass = Boolean.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : EmpresaPrecoServico._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, EmpresaPrecoServico.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/EmpresaPrecoServicoTipo.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/EmpresaPrecoServicoTipo.java new file mode 100644 index 00000000..7f0212f0 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/EmpresaPrecoServicoTipo.java @@ -0,0 +1,294 @@ +/* +* EmpresaPrecoServicoTipo.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class EmpresaPrecoServicoTipo extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( EmpresaPrecoServicoTipo.ID, EmpresaPrecoServicoTipo.ID_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServicoTipo.ID_FULL, EmpresaPrecoServicoTipo.ID_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServicoTipo.NOME, EmpresaPrecoServicoTipo.NOME_INDEX ); + FIELD_INDEXES.put( EmpresaPrecoServicoTipo.NOME_FULL, EmpresaPrecoServicoTipo.NOME_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "empresa_preco_servico_tipo"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.empresa_preco_servico_tipo"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "empresa_preco_servico_tipo.id"; + public static final int ID_INDEX = 0; + public static final String NOME = "nome"; + public static final String NOME_FULL = "empresa_preco_servico_tipo.nome"; + public static final int NOME_INDEX = 1; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + NOME, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, NOME, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, NOME, }; + + private Integer id; + private String nome; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public EmpresaPrecoServicoTipo() + { + super(); + dirtyProperties = new boolean[]{ false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromEmpresaPrecoServico_empresa_preco_servico_tipo_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.EmpresaPrecoServicoData.class , getPrimaryKey().getMap().get("id"), "empresa_preco_servico_tipo_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getNome() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NOME ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.nome; + } + + public void setNome( String nome ) + { + try + { + setLockedForRefresh( true ); + preProcess( NOME, nome ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.nome = nome; + LAZY_LOADED_OBJECTS.put( NOME, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EmpresaPrecoServicoTipo.ID_INDEX: + value = getId(); + break; + case EmpresaPrecoServicoTipo.NOME_INDEX: + value = getNome(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EmpresaPrecoServicoTipo.ID_INDEX: + value = this.id; + break; + case EmpresaPrecoServicoTipo.NOME_INDEX: + value = this.nome; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EmpresaPrecoServicoTipo.ID_INDEX: + setId( ( Integer ) value ); + break; + case EmpresaPrecoServicoTipo.NOME_INDEX: + setNome( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case EmpresaPrecoServicoTipo.ID_INDEX: + this.id = ( Integer ) value; + break; + case EmpresaPrecoServicoTipo.NOME_INDEX: + this.nome = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case EmpresaPrecoServicoTipo.ID_INDEX: + theClass = Integer.class; + break; + case EmpresaPrecoServicoTipo.NOME_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : EmpresaPrecoServicoTipo._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, EmpresaPrecoServicoTipo.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Empresas.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Empresas.java new file mode 100644 index 00000000..222e05a9 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Empresas.java @@ -0,0 +1,2723 @@ +/* +* Empresas.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class Empresas extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( Empresas.ID, Empresas.ID_INDEX ); + FIELD_INDEXES.put( Empresas.ID_FULL, Empresas.ID_INDEX ); + FIELD_INDEXES.put( Empresas.DESIGNACAO_SOCIAL, Empresas.DESIGNACAO_SOCIAL_INDEX ); + FIELD_INDEXES.put( Empresas.DESIGNACAO_SOCIAL_FULL, Empresas.DESIGNACAO_SOCIAL_INDEX ); + FIELD_INDEXES.put( Empresas.SERVICO_SAUDE_TIPO, Empresas.SERVICO_SAUDE_TIPO_INDEX ); + FIELD_INDEXES.put( Empresas.SERVICO_SAUDE_TIPO_FULL, Empresas.SERVICO_SAUDE_TIPO_INDEX ); + FIELD_INDEXES.put( Empresas.SERVICO_SAUDE_DESIGNACAO, Empresas.SERVICO_SAUDE_DESIGNACAO_INDEX ); + FIELD_INDEXES.put( Empresas.SERVICO_SAUDE_DESIGNACAO_FULL, Empresas.SERVICO_SAUDE_DESIGNACAO_INDEX ); + FIELD_INDEXES.put( Empresas.SERVICO_HIGIENE_TIPO, Empresas.SERVICO_HIGIENE_TIPO_INDEX ); + FIELD_INDEXES.put( Empresas.SERVICO_HIGIENE_TIPO_FULL, Empresas.SERVICO_HIGIENE_TIPO_INDEX ); + FIELD_INDEXES.put( Empresas.SERVICO_HIGIENE_DESIGNACAO, Empresas.SERVICO_HIGIENE_DESIGNACAO_INDEX ); + FIELD_INDEXES.put( Empresas.SERVICO_HIGIENE_DESIGNACAO_FULL, Empresas.SERVICO_HIGIENE_DESIGNACAO_INDEX ); + FIELD_INDEXES.put( Empresas.INACTIVO, Empresas.INACTIVO_INDEX ); + FIELD_INDEXES.put( Empresas.INACTIVO_FULL, Empresas.INACTIVO_INDEX ); + FIELD_INDEXES.put( Empresas.MORADA, Empresas.MORADA_INDEX ); + FIELD_INDEXES.put( Empresas.MORADA_FULL, Empresas.MORADA_INDEX ); + FIELD_INDEXES.put( Empresas.CODIGO_POSTAL, Empresas.CODIGO_POSTAL_INDEX ); + FIELD_INDEXES.put( Empresas.CODIGO_POSTAL_FULL, Empresas.CODIGO_POSTAL_INDEX ); + FIELD_INDEXES.put( Empresas.LOCALIDADE, Empresas.LOCALIDADE_INDEX ); + FIELD_INDEXES.put( Empresas.LOCALIDADE_FULL, Empresas.LOCALIDADE_INDEX ); + FIELD_INDEXES.put( Empresas.DISTRITO, Empresas.DISTRITO_INDEX ); + FIELD_INDEXES.put( Empresas.DISTRITO_FULL, Empresas.DISTRITO_INDEX ); + FIELD_INDEXES.put( Empresas.CONCELHO, Empresas.CONCELHO_INDEX ); + FIELD_INDEXES.put( Empresas.CONCELHO_FULL, Empresas.CONCELHO_INDEX ); + FIELD_INDEXES.put( Empresas.NUMERO_TRABALHADORES, Empresas.NUMERO_TRABALHADORES_INDEX ); + FIELD_INDEXES.put( Empresas.NUMERO_TRABALHADORES_FULL, Empresas.NUMERO_TRABALHADORES_INDEX ); + FIELD_INDEXES.put( Empresas.DATA_PROPOSTA, Empresas.DATA_PROPOSTA_INDEX ); + FIELD_INDEXES.put( Empresas.DATA_PROPOSTA_FULL, Empresas.DATA_PROPOSTA_INDEX ); + FIELD_INDEXES.put( Empresas.DATA_ACEITACAO, Empresas.DATA_ACEITACAO_INDEX ); + FIELD_INDEXES.put( Empresas.DATA_ACEITACAO_FULL, Empresas.DATA_ACEITACAO_INDEX ); + FIELD_INDEXES.put( Empresas.PERFIL_1, Empresas.PERFIL_1_INDEX ); + FIELD_INDEXES.put( Empresas.PERFIL_1_FULL, Empresas.PERFIL_1_INDEX ); + FIELD_INDEXES.put( Empresas.PERFIL_2, Empresas.PERFIL_2_INDEX ); + FIELD_INDEXES.put( Empresas.PERFIL_2_FULL, Empresas.PERFIL_2_INDEX ); + FIELD_INDEXES.put( Empresas.DATA_ENVIO_CONTRATO, Empresas.DATA_ENVIO_CONTRATO_INDEX ); + FIELD_INDEXES.put( Empresas.DATA_ENVIO_CONTRATO_FULL, Empresas.DATA_ENVIO_CONTRATO_INDEX ); + FIELD_INDEXES.put( Empresas.DATA_RECEPCAO_CONTRATO, Empresas.DATA_RECEPCAO_CONTRATO_INDEX ); + FIELD_INDEXES.put( Empresas.DATA_RECEPCAO_CONTRATO_FULL, Empresas.DATA_RECEPCAO_CONTRATO_INDEX ); + FIELD_INDEXES.put( Empresas.DATA_ENVIO_IDICT, Empresas.DATA_ENVIO_IDICT_INDEX ); + FIELD_INDEXES.put( Empresas.DATA_ENVIO_IDICT_FULL, Empresas.DATA_ENVIO_IDICT_INDEX ); + FIELD_INDEXES.put( Empresas.CAE, Empresas.CAE_INDEX ); + FIELD_INDEXES.put( Empresas.CAE_FULL, Empresas.CAE_INDEX ); + FIELD_INDEXES.put( Empresas.CONTRIBUINTE, Empresas.CONTRIBUINTE_INDEX ); + FIELD_INDEXES.put( Empresas.CONTRIBUINTE_FULL, Empresas.CONTRIBUINTE_INDEX ); + FIELD_INDEXES.put( Empresas.SEGURANCA_SOCIAL, Empresas.SEGURANCA_SOCIAL_INDEX ); + FIELD_INDEXES.put( Empresas.SEGURANCA_SOCIAL_FULL, Empresas.SEGURANCA_SOCIAL_INDEX ); + FIELD_INDEXES.put( Empresas.CODIGO_1, Empresas.CODIGO_1_INDEX ); + FIELD_INDEXES.put( Empresas.CODIGO_1_FULL, Empresas.CODIGO_1_INDEX ); + FIELD_INDEXES.put( Empresas.CODIGO_2, Empresas.CODIGO_2_INDEX ); + FIELD_INDEXES.put( Empresas.CODIGO_2_FULL, Empresas.CODIGO_2_INDEX ); + FIELD_INDEXES.put( Empresas.CODIGO_3, Empresas.CODIGO_3_INDEX ); + FIELD_INDEXES.put( Empresas.CODIGO_3_FULL, Empresas.CODIGO_3_INDEX ); + FIELD_INDEXES.put( Empresas.SERVICOS, Empresas.SERVICOS_INDEX ); + FIELD_INDEXES.put( Empresas.SERVICOS_FULL, Empresas.SERVICOS_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Empresas.CLASS_IDENTIFIER, Empresas.CONTACTO_1, Empresas.TO_CONTACTO_1 ); + FIELD_INDEXES.put( Empresas.CONTACTO_1, Empresas.CONTACTO_1_INDEX ); + FIELD_INDEXES.put( Empresas.CONTACTO_1_FULL, Empresas.CONTACTO_1_INDEX ); + FIELD_INDEXES.put( Empresas.TO_CONTACTO_1, Empresas.TO_CONTACTO_1_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Empresas.CLASS_IDENTIFIER, Empresas.CONTACTO_2, Empresas.TO_CONTACTO_2 ); + FIELD_INDEXES.put( Empresas.CONTACTO_2, Empresas.CONTACTO_2_INDEX ); + FIELD_INDEXES.put( Empresas.CONTACTO_2_FULL, Empresas.CONTACTO_2_INDEX ); + FIELD_INDEXES.put( Empresas.TO_CONTACTO_2, Empresas.TO_CONTACTO_2_INDEX ); + FIELD_INDEXES.put( Empresas.DATA_RELATORIO_ANUAL, Empresas.DATA_RELATORIO_ANUAL_INDEX ); + FIELD_INDEXES.put( Empresas.DATA_RELATORIO_ANUAL_FULL, Empresas.DATA_RELATORIO_ANUAL_INDEX ); + FIELD_INDEXES.put( Empresas.PERIODICIDADE, Empresas.PERIODICIDADE_INDEX ); + FIELD_INDEXES.put( Empresas.PERIODICIDADE_FULL, Empresas.PERIODICIDADE_INDEX ); + FIELD_INDEXES.put( Empresas.ACTIVIDADE, Empresas.ACTIVIDADE_INDEX ); + FIELD_INDEXES.put( Empresas.ACTIVIDADE_FULL, Empresas.ACTIVIDADE_INDEX ); + FIELD_INDEXES.put( Empresas.ACTUALIZACAO, Empresas.ACTUALIZACAO_INDEX ); + FIELD_INDEXES.put( Empresas.ACTUALIZACAO_FULL, Empresas.ACTUALIZACAO_INDEX ); + FIELD_INDEXES.put( Empresas.DESIGNACAO_SOCIAL_PLAIN, Empresas.DESIGNACAO_SOCIAL_PLAIN_INDEX ); + FIELD_INDEXES.put( Empresas.DESIGNACAO_SOCIAL_PLAIN_FULL, Empresas.DESIGNACAO_SOCIAL_PLAIN_INDEX ); + FIELD_INDEXES.put( Empresas.A_CONSULTAS, Empresas.A_CONSULTAS_INDEX ); + FIELD_INDEXES.put( Empresas.A_CONSULTAS_FULL, Empresas.A_CONSULTAS_INDEX ); + FIELD_INDEXES.put( Empresas.A_EXAMES, Empresas.A_EXAMES_INDEX ); + FIELD_INDEXES.put( Empresas.A_EXAMES_FULL, Empresas.A_EXAMES_INDEX ); + FIELD_INDEXES.put( Empresas.B_CONSULTAS, Empresas.B_CONSULTAS_INDEX ); + FIELD_INDEXES.put( Empresas.B_CONSULTAS_FULL, Empresas.B_CONSULTAS_INDEX ); + FIELD_INDEXES.put( Empresas.B_EXAMES, Empresas.B_EXAMES_INDEX ); + FIELD_INDEXES.put( Empresas.B_EXAMES_FULL, Empresas.B_EXAMES_INDEX ); + FIELD_INDEXES.put( Empresas.DATA_CANCELAMENTO, Empresas.DATA_CANCELAMENTO_INDEX ); + FIELD_INDEXES.put( Empresas.DATA_CANCELAMENTO_FULL, Empresas.DATA_CANCELAMENTO_INDEX ); + FIELD_INDEXES.put( Empresas.DURACAO, Empresas.DURACAO_INDEX ); + FIELD_INDEXES.put( Empresas.DURACAO_FULL, Empresas.DURACAO_INDEX ); + FIELD_INDEXES.put( Empresas.INICIO_CONTRATO, Empresas.INICIO_CONTRATO_INDEX ); + FIELD_INDEXES.put( Empresas.INICIO_CONTRATO_FULL, Empresas.INICIO_CONTRATO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Empresas.CLASS_IDENTIFIER, Empresas.EMPRESA_LOGO_ID, Empresas.TO_EMPRESA_LOGO_ID ); + FIELD_INDEXES.put( Empresas.EMPRESA_LOGO_ID, Empresas.EMPRESA_LOGO_ID_INDEX ); + FIELD_INDEXES.put( Empresas.EMPRESA_LOGO_ID_FULL, Empresas.EMPRESA_LOGO_ID_INDEX ); + FIELD_INDEXES.put( Empresas.TO_EMPRESA_LOGO_ID, Empresas.TO_EMPRESA_LOGO_ID_INDEX ); + FIELD_INDEXES.put( Empresas.IMPRIMIR_TABELA_ALARGADA, Empresas.IMPRIMIR_TABELA_ALARGADA_INDEX ); + FIELD_INDEXES.put( Empresas.IMPRIMIR_TABELA_ALARGADA_FULL, Empresas.IMPRIMIR_TABELA_ALARGADA_INDEX ); + FIELD_INDEXES.put( Empresas.CODIGO_RELATORIO_UNICO, Empresas.CODIGO_RELATORIO_UNICO_INDEX ); + FIELD_INDEXES.put( Empresas.CODIGO_RELATORIO_UNICO_FULL, Empresas.CODIGO_RELATORIO_UNICO_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeycontacto_1Tocontactos = + new com.evolute.entity.ForeignKey( Empresas.class, Empresas.CONTACTO_1, siprp.data.outer.ContactosData.class, siprp.data.outer.ContactosData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeycontacto_2Tocontactos = + new com.evolute.entity.ForeignKey( Empresas.class, Empresas.CONTACTO_2, siprp.data.outer.ContactosData.class, siprp.data.outer.ContactosData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyempresa_logo_idToimage = + new com.evolute.entity.ForeignKey( Empresas.class, Empresas.EMPRESA_LOGO_ID, siprp.data.outer.ImageData.class, siprp.data.outer.ImageData.ID ); + + public static final String TABLENAME = "empresas"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.empresas"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "empresas.id"; + public static final int ID_INDEX = 0; + public static final String DESIGNACAO_SOCIAL = "designacao_social"; + public static final String DESIGNACAO_SOCIAL_FULL = "empresas.designacao_social"; + public static final int DESIGNACAO_SOCIAL_INDEX = 1; + public static final String SERVICO_SAUDE_TIPO = "servico_saude_tipo"; + public static final String SERVICO_SAUDE_TIPO_FULL = "empresas.servico_saude_tipo"; + public static final int SERVICO_SAUDE_TIPO_INDEX = 2; + public static final String SERVICO_SAUDE_DESIGNACAO = "servico_saude_designacao"; + public static final String SERVICO_SAUDE_DESIGNACAO_FULL = "empresas.servico_saude_designacao"; + public static final int SERVICO_SAUDE_DESIGNACAO_INDEX = 3; + public static final String SERVICO_HIGIENE_TIPO = "servico_higiene_tipo"; + public static final String SERVICO_HIGIENE_TIPO_FULL = "empresas.servico_higiene_tipo"; + public static final int SERVICO_HIGIENE_TIPO_INDEX = 4; + public static final String SERVICO_HIGIENE_DESIGNACAO = "servico_higiene_designacao"; + public static final String SERVICO_HIGIENE_DESIGNACAO_FULL = "empresas.servico_higiene_designacao"; + public static final int SERVICO_HIGIENE_DESIGNACAO_INDEX = 5; + public static final String INACTIVO = "inactivo"; + public static final String INACTIVO_FULL = "empresas.inactivo"; + public static final int INACTIVO_INDEX = 6; + public static final String MORADA = "morada"; + public static final String MORADA_FULL = "empresas.morada"; + public static final int MORADA_INDEX = 7; + public static final String CODIGO_POSTAL = "codigo_postal"; + public static final String CODIGO_POSTAL_FULL = "empresas.codigo_postal"; + public static final int CODIGO_POSTAL_INDEX = 8; + public static final String LOCALIDADE = "localidade"; + public static final String LOCALIDADE_FULL = "empresas.localidade"; + public static final int LOCALIDADE_INDEX = 9; + public static final String DISTRITO = "distrito"; + public static final String DISTRITO_FULL = "empresas.distrito"; + public static final int DISTRITO_INDEX = 10; + public static final String CONCELHO = "concelho"; + public static final String CONCELHO_FULL = "empresas.concelho"; + public static final int CONCELHO_INDEX = 11; + public static final String NUMERO_TRABALHADORES = "numero_trabalhadores"; + public static final String NUMERO_TRABALHADORES_FULL = "empresas.numero_trabalhadores"; + public static final int NUMERO_TRABALHADORES_INDEX = 12; + public static final String DATA_PROPOSTA = "data_proposta"; + public static final String DATA_PROPOSTA_FULL = "empresas.data_proposta"; + public static final int DATA_PROPOSTA_INDEX = 13; + public static final String DATA_ACEITACAO = "data_aceitacao"; + public static final String DATA_ACEITACAO_FULL = "empresas.data_aceitacao"; + public static final int DATA_ACEITACAO_INDEX = 14; + public static final String PERFIL_1 = "perfil_1"; + public static final String PERFIL_1_FULL = "empresas.perfil_1"; + public static final int PERFIL_1_INDEX = 15; + public static final String PERFIL_2 = "perfil_2"; + public static final String PERFIL_2_FULL = "empresas.perfil_2"; + public static final int PERFIL_2_INDEX = 16; + public static final String DATA_ENVIO_CONTRATO = "data_envio_contrato"; + public static final String DATA_ENVIO_CONTRATO_FULL = "empresas.data_envio_contrato"; + public static final int DATA_ENVIO_CONTRATO_INDEX = 17; + public static final String DATA_RECEPCAO_CONTRATO = "data_recepcao_contrato"; + public static final String DATA_RECEPCAO_CONTRATO_FULL = "empresas.data_recepcao_contrato"; + public static final int DATA_RECEPCAO_CONTRATO_INDEX = 18; + public static final String DATA_ENVIO_IDICT = "data_envio_idict"; + public static final String DATA_ENVIO_IDICT_FULL = "empresas.data_envio_idict"; + public static final int DATA_ENVIO_IDICT_INDEX = 19; + public static final String CAE = "cae"; + public static final String CAE_FULL = "empresas.cae"; + public static final int CAE_INDEX = 20; + public static final String CONTRIBUINTE = "contribuinte"; + public static final String CONTRIBUINTE_FULL = "empresas.contribuinte"; + public static final int CONTRIBUINTE_INDEX = 21; + public static final String SEGURANCA_SOCIAL = "seguranca_social"; + public static final String SEGURANCA_SOCIAL_FULL = "empresas.seguranca_social"; + public static final int SEGURANCA_SOCIAL_INDEX = 22; + public static final String CODIGO_1 = "codigo_1"; + public static final String CODIGO_1_FULL = "empresas.codigo_1"; + public static final int CODIGO_1_INDEX = 23; + public static final String CODIGO_2 = "codigo_2"; + public static final String CODIGO_2_FULL = "empresas.codigo_2"; + public static final int CODIGO_2_INDEX = 24; + public static final String CODIGO_3 = "codigo_3"; + public static final String CODIGO_3_FULL = "empresas.codigo_3"; + public static final int CODIGO_3_INDEX = 25; + public static final String SERVICOS = "servicos"; + public static final String SERVICOS_FULL = "empresas.servicos"; + public static final int SERVICOS_INDEX = 26; + public static final String CONTACTO_1 = "contacto_1"; + public static final String CONTACTO_1_FULL = "empresas.contacto_1"; + public static final int CONTACTO_1_INDEX = 27; + public static final String TO_CONTACTO_1 = "to_contacto_1"; + public static final int TO_CONTACTO_1_INDEX = 28; + public static final String CONTACTO_2 = "contacto_2"; + public static final String CONTACTO_2_FULL = "empresas.contacto_2"; + public static final int CONTACTO_2_INDEX = 29; + public static final String TO_CONTACTO_2 = "to_contacto_2"; + public static final int TO_CONTACTO_2_INDEX = 30; + public static final String DATA_RELATORIO_ANUAL = "data_relatorio_anual"; + public static final String DATA_RELATORIO_ANUAL_FULL = "empresas.data_relatorio_anual"; + public static final int DATA_RELATORIO_ANUAL_INDEX = 31; + public static final String PERIODICIDADE = "periodicidade"; + public static final String PERIODICIDADE_FULL = "empresas.periodicidade"; + public static final int PERIODICIDADE_INDEX = 32; + public static final String ACTIVIDADE = "actividade"; + public static final String ACTIVIDADE_FULL = "empresas.actividade"; + public static final int ACTIVIDADE_INDEX = 33; + public static final String ACTUALIZACAO = "actualizacao"; + public static final String ACTUALIZACAO_FULL = "empresas.actualizacao"; + public static final int ACTUALIZACAO_INDEX = 34; + public static final String DESIGNACAO_SOCIAL_PLAIN = "designacao_social_plain"; + public static final String DESIGNACAO_SOCIAL_PLAIN_FULL = "empresas.designacao_social_plain"; + public static final int DESIGNACAO_SOCIAL_PLAIN_INDEX = 35; + public static final String A_CONSULTAS = "a_consultas"; + public static final String A_CONSULTAS_FULL = "empresas.a_consultas"; + public static final int A_CONSULTAS_INDEX = 36; + public static final String A_EXAMES = "a_exames"; + public static final String A_EXAMES_FULL = "empresas.a_exames"; + public static final int A_EXAMES_INDEX = 37; + public static final String B_CONSULTAS = "b_consultas"; + public static final String B_CONSULTAS_FULL = "empresas.b_consultas"; + public static final int B_CONSULTAS_INDEX = 38; + public static final String B_EXAMES = "b_exames"; + public static final String B_EXAMES_FULL = "empresas.b_exames"; + public static final int B_EXAMES_INDEX = 39; + public static final String DATA_CANCELAMENTO = "data_cancelamento"; + public static final String DATA_CANCELAMENTO_FULL = "empresas.data_cancelamento"; + public static final int DATA_CANCELAMENTO_INDEX = 40; + public static final String DURACAO = "duracao"; + public static final String DURACAO_FULL = "empresas.duracao"; + public static final int DURACAO_INDEX = 41; + public static final String INICIO_CONTRATO = "inicio_contrato"; + public static final String INICIO_CONTRATO_FULL = "empresas.inicio_contrato"; + public static final int INICIO_CONTRATO_INDEX = 42; + public static final String EMPRESA_LOGO_ID = "empresa_logo_id"; + public static final String EMPRESA_LOGO_ID_FULL = "empresas.empresa_logo_id"; + public static final int EMPRESA_LOGO_ID_INDEX = 43; + public static final String TO_EMPRESA_LOGO_ID = "to_empresa_logo_id"; + public static final int TO_EMPRESA_LOGO_ID_INDEX = 44; + public static final String IMPRIMIR_TABELA_ALARGADA = "imprimir_tabela_alargada"; + public static final String IMPRIMIR_TABELA_ALARGADA_FULL = "empresas.imprimir_tabela_alargada"; + public static final int IMPRIMIR_TABELA_ALARGADA_INDEX = 45; + public static final String CODIGO_RELATORIO_UNICO = "codigo_relatorio_unico"; + public static final String CODIGO_RELATORIO_UNICO_FULL = "empresas.codigo_relatorio_unico"; + public static final int CODIGO_RELATORIO_UNICO_INDEX = 46; + + public static final String FIELD_NAMES[] = new String[]{ + DESIGNACAO_SOCIAL, SERVICO_SAUDE_TIPO, SERVICO_SAUDE_DESIGNACAO, + SERVICO_HIGIENE_TIPO, SERVICO_HIGIENE_DESIGNACAO, INACTIVO, MORADA, + CODIGO_POSTAL, LOCALIDADE, DISTRITO, CONCELHO, NUMERO_TRABALHADORES, + DATA_PROPOSTA, DATA_ACEITACAO, PERFIL_1, PERFIL_2, DATA_ENVIO_CONTRATO, + DATA_RECEPCAO_CONTRATO, DATA_ENVIO_IDICT, CAE, CONTRIBUINTE, SEGURANCA_SOCIAL, + CODIGO_1, CODIGO_2, CODIGO_3, SERVICOS, CONTACTO_1, TO_CONTACTO_1, CONTACTO_2, + TO_CONTACTO_2, DATA_RELATORIO_ANUAL, PERIODICIDADE, ACTIVIDADE, ACTUALIZACAO, + DESIGNACAO_SOCIAL_PLAIN, A_CONSULTAS, A_EXAMES, B_CONSULTAS, B_EXAMES, + DATA_CANCELAMENTO, DURACAO, INICIO_CONTRATO, EMPRESA_LOGO_ID, + TO_EMPRESA_LOGO_ID, IMPRIMIR_TABELA_ALARGADA, CODIGO_RELATORIO_UNICO, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DESIGNACAO_SOCIAL, TABLENAME + "." + SERVICO_SAUDE_TIPO, TABLENAME + "." + SERVICO_SAUDE_DESIGNACAO, + TABLENAME + "." + SERVICO_HIGIENE_TIPO, TABLENAME + "." + SERVICO_HIGIENE_DESIGNACAO, TABLENAME + "." + INACTIVO, TABLENAME + "." + MORADA, + TABLENAME + "." + CODIGO_POSTAL, TABLENAME + "." + LOCALIDADE, TABLENAME + "." + DISTRITO, TABLENAME + "." + CONCELHO, TABLENAME + "." + NUMERO_TRABALHADORES, + TABLENAME + "." + DATA_PROPOSTA, TABLENAME + "." + DATA_ACEITACAO, TABLENAME + "." + PERFIL_1, TABLENAME + "." + PERFIL_2, TABLENAME + "." + DATA_ENVIO_CONTRATO, + TABLENAME + "." + DATA_RECEPCAO_CONTRATO, TABLENAME + "." + DATA_ENVIO_IDICT, TABLENAME + "." + CAE, TABLENAME + "." + CONTRIBUINTE, TABLENAME + "." + SEGURANCA_SOCIAL, + TABLENAME + "." + CODIGO_1, TABLENAME + "." + CODIGO_2, TABLENAME + "." + CODIGO_3, TABLENAME + "." + SERVICOS, TABLENAME + "." + CONTACTO_1, TABLENAME + "." + TO_CONTACTO_1, TABLENAME + "." + CONTACTO_2, + TABLENAME + "." + TO_CONTACTO_2, TABLENAME + "." + DATA_RELATORIO_ANUAL, TABLENAME + "." + PERIODICIDADE, TABLENAME + "." + ACTIVIDADE, TABLENAME + "." + ACTUALIZACAO, + TABLENAME + "." + DESIGNACAO_SOCIAL_PLAIN, TABLENAME + "." + A_CONSULTAS, TABLENAME + "." + A_EXAMES, TABLENAME + "." + B_CONSULTAS, TABLENAME + "." + B_EXAMES, + TABLENAME + "." + DATA_CANCELAMENTO, TABLENAME + "." + DURACAO, TABLENAME + "." + INICIO_CONTRATO, TABLENAME + "." + EMPRESA_LOGO_ID, + TABLENAME + "." + TO_EMPRESA_LOGO_ID, TABLENAME + "." + IMPRIMIR_TABELA_ALARGADA, TABLENAME + "." + CODIGO_RELATORIO_UNICO, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DESIGNACAO_SOCIAL, SERVICO_SAUDE_TIPO, SERVICO_SAUDE_DESIGNACAO, + SERVICO_HIGIENE_TIPO, SERVICO_HIGIENE_DESIGNACAO, INACTIVO, MORADA, + CODIGO_POSTAL, LOCALIDADE, DISTRITO, CONCELHO, NUMERO_TRABALHADORES, + DATA_PROPOSTA, DATA_ACEITACAO, PERFIL_1, PERFIL_2, DATA_ENVIO_CONTRATO, + DATA_RECEPCAO_CONTRATO, DATA_ENVIO_IDICT, CAE, CONTRIBUINTE, SEGURANCA_SOCIAL, + CODIGO_1, CODIGO_2, CODIGO_3, SERVICOS, CONTACTO_1, CONTACTO_2, + DATA_RELATORIO_ANUAL, PERIODICIDADE, ACTIVIDADE, ACTUALIZACAO, + DESIGNACAO_SOCIAL_PLAIN, A_CONSULTAS, A_EXAMES, B_CONSULTAS, B_EXAMES, + DATA_CANCELAMENTO, DURACAO, INICIO_CONTRATO, EMPRESA_LOGO_ID, + IMPRIMIR_TABELA_ALARGADA, CODIGO_RELATORIO_UNICO, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DESIGNACAO_SOCIAL, SERVICO_SAUDE_TIPO, SERVICO_SAUDE_DESIGNACAO, + SERVICO_HIGIENE_TIPO, SERVICO_HIGIENE_DESIGNACAO, INACTIVO, MORADA, + CODIGO_POSTAL, LOCALIDADE, DISTRITO, CONCELHO, NUMERO_TRABALHADORES, + DATA_PROPOSTA, DATA_ACEITACAO, PERFIL_1, PERFIL_2, DATA_ENVIO_CONTRATO, + DATA_RECEPCAO_CONTRATO, DATA_ENVIO_IDICT, CAE, CONTRIBUINTE, SEGURANCA_SOCIAL, + CODIGO_1, CODIGO_2, CODIGO_3, SERVICOS, CONTACTO_1, CONTACTO_2, + DATA_RELATORIO_ANUAL, PERIODICIDADE, ACTIVIDADE, ACTUALIZACAO, + DESIGNACAO_SOCIAL_PLAIN, A_CONSULTAS, A_EXAMES, B_CONSULTAS, B_EXAMES, + DATA_CANCELAMENTO, DURACAO, INICIO_CONTRATO, EMPRESA_LOGO_ID, + IMPRIMIR_TABELA_ALARGADA, CODIGO_RELATORIO_UNICO, }; + + private Integer id; + private String designacao_social; + private Integer servico_saude_tipo; + private String servico_saude_designacao; + private Integer servico_higiene_tipo; + private String servico_higiene_designacao; + private String inactivo; + private String morada; + private String codigo_postal; + private String localidade; + private String distrito; + private String concelho; + private Integer numero_trabalhadores; + private java.util.Date data_proposta; + private java.util.Date data_aceitacao; + private String perfil_1; + private String perfil_2; + private java.util.Date data_envio_contrato; + private java.util.Date data_recepcao_contrato; + private java.util.Date data_envio_idict; + private String cae; + private String contribuinte; + private String seguranca_social; + private String codigo_1; + private String codigo_2; + private String codigo_3; + private Integer servicos; + private Integer contacto_1; + private siprp.data.outer.ContactosData to_contacto_1; + private Integer contacto_2; + private siprp.data.outer.ContactosData to_contacto_2; + private java.util.Date data_relatorio_anual; + private String periodicidade; + private String actividade; + private java.sql.Timestamp actualizacao; + private String designacao_social_plain; + private String a_consultas; + private String a_exames; + private String b_consultas; + private String b_exames; + private java.util.Date data_cancelamento; + private Integer duracao; + private java.util.Date inicio_contrato; + private Integer empresa_logo_id; + private siprp.data.outer.ImageData to_empresa_logo_id; + private Boolean imprimir_tabela_alargada; + private String codigo_relatorio_unico; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public Empresas() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromAvisos_empresa_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.AvisosData.class , getPrimaryKey().getMap().get("id"), "empresa_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromEmpresaPrecoServico_empresa_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.EmpresaPrecoServicoData.class , getPrimaryKey().getMap().get("id"), "empresa_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromEstabelecimentos_empresa_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.EstabelecimentosData.class , getPrimaryKey().getMap().get("id"), "empresa_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsArea_empresa_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsAreaData.class , getPrimaryKey().getMap().get("id"), "empresa_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsEmailEmpresa_empresa_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsEmailEmpresaData.class , getPrimaryKey().getMap().get("id"), "empresa_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsLegislacaoEmpresa_empresa_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsLegislacaoEmpresaData.class , getPrimaryKey().getMap().get("id"), "empresa_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsNormalizacaoEmpresa_empresa_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsNormalizacaoEmpresaData.class , getPrimaryKey().getMap().get("id"), "empresa_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsRiscoEmpresa_empresa_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRiscoEmpresaData.class , getPrimaryKey().getMap().get("id"), "empresa_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromLembretes_empresa_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.LembretesData.class , getPrimaryKey().getMap().get("id"), "empresa_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromMarcacoesEmpresa_empresa_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.MarcacoesEmpresaData.class , getPrimaryKey().getMap().get("id"), "empresa_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromPrtElementosProtocolo_empresa_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.PrtElementosProtocoloData.class , getPrimaryKey().getMap().get("id"), "empresa_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getDesignacao_social() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESIGNACAO_SOCIAL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.designacao_social; + } + + public void setDesignacao_social( String designacao_social ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESIGNACAO_SOCIAL, designacao_social ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.designacao_social = designacao_social; + LAZY_LOADED_OBJECTS.put( DESIGNACAO_SOCIAL, Boolean.TRUE ); + } + + public Integer getServico_saude_tipo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( SERVICO_SAUDE_TIPO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.servico_saude_tipo; + } + + public void setServico_saude_tipo( Integer servico_saude_tipo ) + { + try + { + setLockedForRefresh( true ); + preProcess( SERVICO_SAUDE_TIPO, servico_saude_tipo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.servico_saude_tipo = servico_saude_tipo; + LAZY_LOADED_OBJECTS.put( SERVICO_SAUDE_TIPO, Boolean.TRUE ); + } + + public String getServico_saude_designacao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( SERVICO_SAUDE_DESIGNACAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.servico_saude_designacao; + } + + public void setServico_saude_designacao( String servico_saude_designacao ) + { + try + { + setLockedForRefresh( true ); + preProcess( SERVICO_SAUDE_DESIGNACAO, servico_saude_designacao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.servico_saude_designacao = servico_saude_designacao; + LAZY_LOADED_OBJECTS.put( SERVICO_SAUDE_DESIGNACAO, Boolean.TRUE ); + } + + public Integer getServico_higiene_tipo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( SERVICO_HIGIENE_TIPO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.servico_higiene_tipo; + } + + public void setServico_higiene_tipo( Integer servico_higiene_tipo ) + { + try + { + setLockedForRefresh( true ); + preProcess( SERVICO_HIGIENE_TIPO, servico_higiene_tipo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.servico_higiene_tipo = servico_higiene_tipo; + LAZY_LOADED_OBJECTS.put( SERVICO_HIGIENE_TIPO, Boolean.TRUE ); + } + + public String getServico_higiene_designacao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( SERVICO_HIGIENE_DESIGNACAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.servico_higiene_designacao; + } + + public void setServico_higiene_designacao( String servico_higiene_designacao ) + { + try + { + setLockedForRefresh( true ); + preProcess( SERVICO_HIGIENE_DESIGNACAO, servico_higiene_designacao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.servico_higiene_designacao = servico_higiene_designacao; + LAZY_LOADED_OBJECTS.put( SERVICO_HIGIENE_DESIGNACAO, Boolean.TRUE ); + } + + public String getInactivo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( INACTIVO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.inactivo; + } + + public void setInactivo( String inactivo ) + { + try + { + setLockedForRefresh( true ); + preProcess( INACTIVO, inactivo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.inactivo = inactivo; + LAZY_LOADED_OBJECTS.put( INACTIVO, Boolean.TRUE ); + } + + public String getMorada() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MORADA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.morada; + } + + public void setMorada( String morada ) + { + try + { + setLockedForRefresh( true ); + preProcess( MORADA, morada ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.morada = morada; + LAZY_LOADED_OBJECTS.put( MORADA, Boolean.TRUE ); + } + + public String getCodigo_postal() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CODIGO_POSTAL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.codigo_postal; + } + + public void setCodigo_postal( String codigo_postal ) + { + try + { + setLockedForRefresh( true ); + preProcess( CODIGO_POSTAL, codigo_postal ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.codigo_postal = codigo_postal; + LAZY_LOADED_OBJECTS.put( CODIGO_POSTAL, Boolean.TRUE ); + } + + public String getLocalidade() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( LOCALIDADE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.localidade; + } + + public void setLocalidade( String localidade ) + { + try + { + setLockedForRefresh( true ); + preProcess( LOCALIDADE, localidade ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.localidade = localidade; + LAZY_LOADED_OBJECTS.put( LOCALIDADE, Boolean.TRUE ); + } + + public String getDistrito() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DISTRITO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.distrito; + } + + public void setDistrito( String distrito ) + { + try + { + setLockedForRefresh( true ); + preProcess( DISTRITO, distrito ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.distrito = distrito; + LAZY_LOADED_OBJECTS.put( DISTRITO, Boolean.TRUE ); + } + + public String getConcelho() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CONCELHO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.concelho; + } + + public void setConcelho( String concelho ) + { + try + { + setLockedForRefresh( true ); + preProcess( CONCELHO, concelho ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.concelho = concelho; + LAZY_LOADED_OBJECTS.put( CONCELHO, Boolean.TRUE ); + } + + public Integer getNumero_trabalhadores() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NUMERO_TRABALHADORES ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.numero_trabalhadores; + } + + public void setNumero_trabalhadores( Integer numero_trabalhadores ) + { + try + { + setLockedForRefresh( true ); + preProcess( NUMERO_TRABALHADORES, numero_trabalhadores ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.numero_trabalhadores = numero_trabalhadores; + LAZY_LOADED_OBJECTS.put( NUMERO_TRABALHADORES, Boolean.TRUE ); + } + + public java.util.Date getData_proposta() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_PROPOSTA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_proposta; + } + + public void setData_proposta( java.util.Date data_proposta ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_PROPOSTA, data_proposta ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_proposta = data_proposta; + LAZY_LOADED_OBJECTS.put( DATA_PROPOSTA, Boolean.TRUE ); + } + + public java.util.Date getData_aceitacao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_ACEITACAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_aceitacao; + } + + public void setData_aceitacao( java.util.Date data_aceitacao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_ACEITACAO, data_aceitacao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_aceitacao = data_aceitacao; + LAZY_LOADED_OBJECTS.put( DATA_ACEITACAO, Boolean.TRUE ); + } + + public String getPerfil_1() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PERFIL_1 ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.perfil_1; + } + + public void setPerfil_1( String perfil_1 ) + { + try + { + setLockedForRefresh( true ); + preProcess( PERFIL_1, perfil_1 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.perfil_1 = perfil_1; + LAZY_LOADED_OBJECTS.put( PERFIL_1, Boolean.TRUE ); + } + + public String getPerfil_2() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PERFIL_2 ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.perfil_2; + } + + public void setPerfil_2( String perfil_2 ) + { + try + { + setLockedForRefresh( true ); + preProcess( PERFIL_2, perfil_2 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.perfil_2 = perfil_2; + LAZY_LOADED_OBJECTS.put( PERFIL_2, Boolean.TRUE ); + } + + public java.util.Date getData_envio_contrato() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_ENVIO_CONTRATO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_envio_contrato; + } + + public void setData_envio_contrato( java.util.Date data_envio_contrato ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_ENVIO_CONTRATO, data_envio_contrato ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_envio_contrato = data_envio_contrato; + LAZY_LOADED_OBJECTS.put( DATA_ENVIO_CONTRATO, Boolean.TRUE ); + } + + public java.util.Date getData_recepcao_contrato() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_RECEPCAO_CONTRATO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_recepcao_contrato; + } + + public void setData_recepcao_contrato( java.util.Date data_recepcao_contrato ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_RECEPCAO_CONTRATO, data_recepcao_contrato ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_recepcao_contrato = data_recepcao_contrato; + LAZY_LOADED_OBJECTS.put( DATA_RECEPCAO_CONTRATO, Boolean.TRUE ); + } + + public java.util.Date getData_envio_idict() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_ENVIO_IDICT ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_envio_idict; + } + + public void setData_envio_idict( java.util.Date data_envio_idict ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_ENVIO_IDICT, data_envio_idict ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_envio_idict = data_envio_idict; + LAZY_LOADED_OBJECTS.put( DATA_ENVIO_IDICT, Boolean.TRUE ); + } + + public String getCae() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CAE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.cae; + } + + public void setCae( String cae ) + { + try + { + setLockedForRefresh( true ); + preProcess( CAE, cae ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.cae = cae; + LAZY_LOADED_OBJECTS.put( CAE, Boolean.TRUE ); + } + + public String getContribuinte() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CONTRIBUINTE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.contribuinte; + } + + public void setContribuinte( String contribuinte ) + { + try + { + setLockedForRefresh( true ); + preProcess( CONTRIBUINTE, contribuinte ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.contribuinte = contribuinte; + LAZY_LOADED_OBJECTS.put( CONTRIBUINTE, Boolean.TRUE ); + } + + public String getSeguranca_social() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( SEGURANCA_SOCIAL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.seguranca_social; + } + + public void setSeguranca_social( String seguranca_social ) + { + try + { + setLockedForRefresh( true ); + preProcess( SEGURANCA_SOCIAL, seguranca_social ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.seguranca_social = seguranca_social; + LAZY_LOADED_OBJECTS.put( SEGURANCA_SOCIAL, Boolean.TRUE ); + } + + public String getCodigo_1() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CODIGO_1 ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.codigo_1; + } + + public void setCodigo_1( String codigo_1 ) + { + try + { + setLockedForRefresh( true ); + preProcess( CODIGO_1, codigo_1 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.codigo_1 = codigo_1; + LAZY_LOADED_OBJECTS.put( CODIGO_1, Boolean.TRUE ); + } + + public String getCodigo_2() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CODIGO_2 ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.codigo_2; + } + + public void setCodigo_2( String codigo_2 ) + { + try + { + setLockedForRefresh( true ); + preProcess( CODIGO_2, codigo_2 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.codigo_2 = codigo_2; + LAZY_LOADED_OBJECTS.put( CODIGO_2, Boolean.TRUE ); + } + + public String getCodigo_3() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CODIGO_3 ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.codigo_3; + } + + public void setCodigo_3( String codigo_3 ) + { + try + { + setLockedForRefresh( true ); + preProcess( CODIGO_3, codigo_3 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.codigo_3 = codigo_3; + LAZY_LOADED_OBJECTS.put( CODIGO_3, Boolean.TRUE ); + } + + public Integer getServicos() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( SERVICOS ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.servicos; + } + + public void setServicos( Integer servicos ) + { + try + { + setLockedForRefresh( true ); + preProcess( SERVICOS, servicos ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.servicos = servicos; + LAZY_LOADED_OBJECTS.put( SERVICOS, Boolean.TRUE ); + } + + public Integer getContacto_1() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CONTACTO_1 ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.contacto_1; + } + + public void setContacto_1( Integer contacto_1 ) + { + try + { + setLockedForRefresh( true ); + preProcess( CONTACTO_1, contacto_1 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.contacto_1 = contacto_1; + LAZY_LOADED_OBJECTS.put( CONTACTO_1, Boolean.TRUE ); + } + + public siprp.data.outer.ContactosData toContacto_1() + { + try + { + prepare( TO_CONTACTO_1 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_contacto_1; + } + + public void setToContacto_1( siprp.data.outer.ContactosData to_contacto_1 ) + { + try + { + preProcess( TO_CONTACTO_1, to_contacto_1 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_contacto_1 = to_contacto_1; + } + + public Integer getContacto_2() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CONTACTO_2 ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.contacto_2; + } + + public void setContacto_2( Integer contacto_2 ) + { + try + { + setLockedForRefresh( true ); + preProcess( CONTACTO_2, contacto_2 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.contacto_2 = contacto_2; + LAZY_LOADED_OBJECTS.put( CONTACTO_2, Boolean.TRUE ); + } + + public siprp.data.outer.ContactosData toContacto_2() + { + try + { + prepare( TO_CONTACTO_2 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_contacto_2; + } + + public void setToContacto_2( siprp.data.outer.ContactosData to_contacto_2 ) + { + try + { + preProcess( TO_CONTACTO_2, to_contacto_2 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_contacto_2 = to_contacto_2; + } + + public java.util.Date getData_relatorio_anual() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_RELATORIO_ANUAL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_relatorio_anual; + } + + public void setData_relatorio_anual( java.util.Date data_relatorio_anual ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_RELATORIO_ANUAL, data_relatorio_anual ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_relatorio_anual = data_relatorio_anual; + LAZY_LOADED_OBJECTS.put( DATA_RELATORIO_ANUAL, Boolean.TRUE ); + } + + public String getPeriodicidade() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PERIODICIDADE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.periodicidade; + } + + public void setPeriodicidade( String periodicidade ) + { + try + { + setLockedForRefresh( true ); + preProcess( PERIODICIDADE, periodicidade ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.periodicidade = periodicidade; + LAZY_LOADED_OBJECTS.put( PERIODICIDADE, Boolean.TRUE ); + } + + public String getActividade() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ACTIVIDADE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.actividade; + } + + public void setActividade( String actividade ) + { + try + { + setLockedForRefresh( true ); + preProcess( ACTIVIDADE, actividade ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.actividade = actividade; + LAZY_LOADED_OBJECTS.put( ACTIVIDADE, Boolean.TRUE ); + } + + public java.sql.Timestamp getActualizacao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ACTUALIZACAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.actualizacao; + } + + public void setActualizacao( java.sql.Timestamp actualizacao ) + { + try + { + setLockedForRefresh( true ); + preProcess( ACTUALIZACAO, actualizacao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.actualizacao = actualizacao; + LAZY_LOADED_OBJECTS.put( ACTUALIZACAO, Boolean.TRUE ); + } + + public String getDesignacao_social_plain() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESIGNACAO_SOCIAL_PLAIN ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.designacao_social_plain; + } + + public void setDesignacao_social_plain( String designacao_social_plain ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESIGNACAO_SOCIAL_PLAIN, designacao_social_plain ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.designacao_social_plain = designacao_social_plain; + LAZY_LOADED_OBJECTS.put( DESIGNACAO_SOCIAL_PLAIN, Boolean.TRUE ); + } + + public String getA_consultas() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( A_CONSULTAS ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.a_consultas; + } + + public void setA_consultas( String a_consultas ) + { + try + { + setLockedForRefresh( true ); + preProcess( A_CONSULTAS, a_consultas ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.a_consultas = a_consultas; + LAZY_LOADED_OBJECTS.put( A_CONSULTAS, Boolean.TRUE ); + } + + public String getA_exames() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( A_EXAMES ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.a_exames; + } + + public void setA_exames( String a_exames ) + { + try + { + setLockedForRefresh( true ); + preProcess( A_EXAMES, a_exames ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.a_exames = a_exames; + LAZY_LOADED_OBJECTS.put( A_EXAMES, Boolean.TRUE ); + } + + public String getB_consultas() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( B_CONSULTAS ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.b_consultas; + } + + public void setB_consultas( String b_consultas ) + { + try + { + setLockedForRefresh( true ); + preProcess( B_CONSULTAS, b_consultas ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.b_consultas = b_consultas; + LAZY_LOADED_OBJECTS.put( B_CONSULTAS, Boolean.TRUE ); + } + + public String getB_exames() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( B_EXAMES ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.b_exames; + } + + public void setB_exames( String b_exames ) + { + try + { + setLockedForRefresh( true ); + preProcess( B_EXAMES, b_exames ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.b_exames = b_exames; + LAZY_LOADED_OBJECTS.put( B_EXAMES, Boolean.TRUE ); + } + + public java.util.Date getData_cancelamento() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_CANCELAMENTO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_cancelamento; + } + + public void setData_cancelamento( java.util.Date data_cancelamento ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_CANCELAMENTO, data_cancelamento ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_cancelamento = data_cancelamento; + LAZY_LOADED_OBJECTS.put( DATA_CANCELAMENTO, Boolean.TRUE ); + } + + public Integer getDuracao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DURACAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.duracao; + } + + public void setDuracao( Integer duracao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DURACAO, duracao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.duracao = duracao; + LAZY_LOADED_OBJECTS.put( DURACAO, Boolean.TRUE ); + } + + public java.util.Date getInicio_contrato() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( INICIO_CONTRATO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.inicio_contrato; + } + + public void setInicio_contrato( java.util.Date inicio_contrato ) + { + try + { + setLockedForRefresh( true ); + preProcess( INICIO_CONTRATO, inicio_contrato ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.inicio_contrato = inicio_contrato; + LAZY_LOADED_OBJECTS.put( INICIO_CONTRATO, Boolean.TRUE ); + } + + public Integer getEmpresa_logo_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMPRESA_LOGO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.empresa_logo_id; + } + + public void setEmpresa_logo_id( Integer empresa_logo_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMPRESA_LOGO_ID, empresa_logo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.empresa_logo_id = empresa_logo_id; + LAZY_LOADED_OBJECTS.put( EMPRESA_LOGO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.ImageData toEmpresa_logo_id() + { + try + { + prepare( TO_EMPRESA_LOGO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_empresa_logo_id; + } + + public void setToEmpresa_logo_id( siprp.data.outer.ImageData to_empresa_logo_id ) + { + try + { + preProcess( TO_EMPRESA_LOGO_ID, to_empresa_logo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_empresa_logo_id = to_empresa_logo_id; + } + + public Boolean getImprimir_tabela_alargada() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( IMPRIMIR_TABELA_ALARGADA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.imprimir_tabela_alargada; + } + + public void setImprimir_tabela_alargada( Boolean imprimir_tabela_alargada ) + { + try + { + setLockedForRefresh( true ); + preProcess( IMPRIMIR_TABELA_ALARGADA, imprimir_tabela_alargada ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.imprimir_tabela_alargada = imprimir_tabela_alargada; + LAZY_LOADED_OBJECTS.put( IMPRIMIR_TABELA_ALARGADA, Boolean.TRUE ); + } + + public String getCodigo_relatorio_unico() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CODIGO_RELATORIO_UNICO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.codigo_relatorio_unico; + } + + public void setCodigo_relatorio_unico( String codigo_relatorio_unico ) + { + try + { + setLockedForRefresh( true ); + preProcess( CODIGO_RELATORIO_UNICO, codigo_relatorio_unico ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.codigo_relatorio_unico = codigo_relatorio_unico; + LAZY_LOADED_OBJECTS.put( CODIGO_RELATORIO_UNICO, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Empresas.ID_INDEX: + value = getId(); + break; + case Empresas.DESIGNACAO_SOCIAL_INDEX: + value = getDesignacao_social(); + break; + case Empresas.SERVICO_SAUDE_TIPO_INDEX: + value = getServico_saude_tipo(); + break; + case Empresas.SERVICO_SAUDE_DESIGNACAO_INDEX: + value = getServico_saude_designacao(); + break; + case Empresas.SERVICO_HIGIENE_TIPO_INDEX: + value = getServico_higiene_tipo(); + break; + case Empresas.SERVICO_HIGIENE_DESIGNACAO_INDEX: + value = getServico_higiene_designacao(); + break; + case Empresas.INACTIVO_INDEX: + value = getInactivo(); + break; + case Empresas.MORADA_INDEX: + value = getMorada(); + break; + case Empresas.CODIGO_POSTAL_INDEX: + value = getCodigo_postal(); + break; + case Empresas.LOCALIDADE_INDEX: + value = getLocalidade(); + break; + case Empresas.DISTRITO_INDEX: + value = getDistrito(); + break; + case Empresas.CONCELHO_INDEX: + value = getConcelho(); + break; + case Empresas.NUMERO_TRABALHADORES_INDEX: + value = getNumero_trabalhadores(); + break; + case Empresas.DATA_PROPOSTA_INDEX: + value = getData_proposta(); + break; + case Empresas.DATA_ACEITACAO_INDEX: + value = getData_aceitacao(); + break; + case Empresas.PERFIL_1_INDEX: + value = getPerfil_1(); + break; + case Empresas.PERFIL_2_INDEX: + value = getPerfil_2(); + break; + case Empresas.DATA_ENVIO_CONTRATO_INDEX: + value = getData_envio_contrato(); + break; + case Empresas.DATA_RECEPCAO_CONTRATO_INDEX: + value = getData_recepcao_contrato(); + break; + case Empresas.DATA_ENVIO_IDICT_INDEX: + value = getData_envio_idict(); + break; + case Empresas.CAE_INDEX: + value = getCae(); + break; + case Empresas.CONTRIBUINTE_INDEX: + value = getContribuinte(); + break; + case Empresas.SEGURANCA_SOCIAL_INDEX: + value = getSeguranca_social(); + break; + case Empresas.CODIGO_1_INDEX: + value = getCodigo_1(); + break; + case Empresas.CODIGO_2_INDEX: + value = getCodigo_2(); + break; + case Empresas.CODIGO_3_INDEX: + value = getCodigo_3(); + break; + case Empresas.SERVICOS_INDEX: + value = getServicos(); + break; + case Empresas.CONTACTO_1_INDEX: + value = getContacto_1(); + break; + case Empresas.TO_CONTACTO_1_INDEX: + value = toContacto_1(); + break; + case Empresas.CONTACTO_2_INDEX: + value = getContacto_2(); + break; + case Empresas.TO_CONTACTO_2_INDEX: + value = toContacto_2(); + break; + case Empresas.DATA_RELATORIO_ANUAL_INDEX: + value = getData_relatorio_anual(); + break; + case Empresas.PERIODICIDADE_INDEX: + value = getPeriodicidade(); + break; + case Empresas.ACTIVIDADE_INDEX: + value = getActividade(); + break; + case Empresas.ACTUALIZACAO_INDEX: + value = getActualizacao(); + break; + case Empresas.DESIGNACAO_SOCIAL_PLAIN_INDEX: + value = getDesignacao_social_plain(); + break; + case Empresas.A_CONSULTAS_INDEX: + value = getA_consultas(); + break; + case Empresas.A_EXAMES_INDEX: + value = getA_exames(); + break; + case Empresas.B_CONSULTAS_INDEX: + value = getB_consultas(); + break; + case Empresas.B_EXAMES_INDEX: + value = getB_exames(); + break; + case Empresas.DATA_CANCELAMENTO_INDEX: + value = getData_cancelamento(); + break; + case Empresas.DURACAO_INDEX: + value = getDuracao(); + break; + case Empresas.INICIO_CONTRATO_INDEX: + value = getInicio_contrato(); + break; + case Empresas.EMPRESA_LOGO_ID_INDEX: + value = getEmpresa_logo_id(); + break; + case Empresas.TO_EMPRESA_LOGO_ID_INDEX: + value = toEmpresa_logo_id(); + break; + case Empresas.IMPRIMIR_TABELA_ALARGADA_INDEX: + value = getImprimir_tabela_alargada(); + break; + case Empresas.CODIGO_RELATORIO_UNICO_INDEX: + value = getCodigo_relatorio_unico(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Empresas.ID_INDEX: + value = this.id; + break; + case Empresas.DESIGNACAO_SOCIAL_INDEX: + value = this.designacao_social; + break; + case Empresas.SERVICO_SAUDE_TIPO_INDEX: + value = this.servico_saude_tipo; + break; + case Empresas.SERVICO_SAUDE_DESIGNACAO_INDEX: + value = this.servico_saude_designacao; + break; + case Empresas.SERVICO_HIGIENE_TIPO_INDEX: + value = this.servico_higiene_tipo; + break; + case Empresas.SERVICO_HIGIENE_DESIGNACAO_INDEX: + value = this.servico_higiene_designacao; + break; + case Empresas.INACTIVO_INDEX: + value = this.inactivo; + break; + case Empresas.MORADA_INDEX: + value = this.morada; + break; + case Empresas.CODIGO_POSTAL_INDEX: + value = this.codigo_postal; + break; + case Empresas.LOCALIDADE_INDEX: + value = this.localidade; + break; + case Empresas.DISTRITO_INDEX: + value = this.distrito; + break; + case Empresas.CONCELHO_INDEX: + value = this.concelho; + break; + case Empresas.NUMERO_TRABALHADORES_INDEX: + value = this.numero_trabalhadores; + break; + case Empresas.DATA_PROPOSTA_INDEX: + value = this.data_proposta; + break; + case Empresas.DATA_ACEITACAO_INDEX: + value = this.data_aceitacao; + break; + case Empresas.PERFIL_1_INDEX: + value = this.perfil_1; + break; + case Empresas.PERFIL_2_INDEX: + value = this.perfil_2; + break; + case Empresas.DATA_ENVIO_CONTRATO_INDEX: + value = this.data_envio_contrato; + break; + case Empresas.DATA_RECEPCAO_CONTRATO_INDEX: + value = this.data_recepcao_contrato; + break; + case Empresas.DATA_ENVIO_IDICT_INDEX: + value = this.data_envio_idict; + break; + case Empresas.CAE_INDEX: + value = this.cae; + break; + case Empresas.CONTRIBUINTE_INDEX: + value = this.contribuinte; + break; + case Empresas.SEGURANCA_SOCIAL_INDEX: + value = this.seguranca_social; + break; + case Empresas.CODIGO_1_INDEX: + value = this.codigo_1; + break; + case Empresas.CODIGO_2_INDEX: + value = this.codigo_2; + break; + case Empresas.CODIGO_3_INDEX: + value = this.codigo_3; + break; + case Empresas.SERVICOS_INDEX: + value = this.servicos; + break; + case Empresas.CONTACTO_1_INDEX: + value = this.contacto_1; + break; + case Empresas.TO_CONTACTO_1_INDEX: + value = this.to_contacto_1; + break; + case Empresas.CONTACTO_2_INDEX: + value = this.contacto_2; + break; + case Empresas.TO_CONTACTO_2_INDEX: + value = this.to_contacto_2; + break; + case Empresas.DATA_RELATORIO_ANUAL_INDEX: + value = this.data_relatorio_anual; + break; + case Empresas.PERIODICIDADE_INDEX: + value = this.periodicidade; + break; + case Empresas.ACTIVIDADE_INDEX: + value = this.actividade; + break; + case Empresas.ACTUALIZACAO_INDEX: + value = this.actualizacao; + break; + case Empresas.DESIGNACAO_SOCIAL_PLAIN_INDEX: + value = this.designacao_social_plain; + break; + case Empresas.A_CONSULTAS_INDEX: + value = this.a_consultas; + break; + case Empresas.A_EXAMES_INDEX: + value = this.a_exames; + break; + case Empresas.B_CONSULTAS_INDEX: + value = this.b_consultas; + break; + case Empresas.B_EXAMES_INDEX: + value = this.b_exames; + break; + case Empresas.DATA_CANCELAMENTO_INDEX: + value = this.data_cancelamento; + break; + case Empresas.DURACAO_INDEX: + value = this.duracao; + break; + case Empresas.INICIO_CONTRATO_INDEX: + value = this.inicio_contrato; + break; + case Empresas.EMPRESA_LOGO_ID_INDEX: + value = this.empresa_logo_id; + break; + case Empresas.TO_EMPRESA_LOGO_ID_INDEX: + value = this.to_empresa_logo_id; + break; + case Empresas.IMPRIMIR_TABELA_ALARGADA_INDEX: + value = this.imprimir_tabela_alargada; + break; + case Empresas.CODIGO_RELATORIO_UNICO_INDEX: + value = this.codigo_relatorio_unico; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Empresas.ID_INDEX: + setId( ( Integer ) value ); + break; + case Empresas.DESIGNACAO_SOCIAL_INDEX: + setDesignacao_social( ( String ) value ); + break; + case Empresas.SERVICO_SAUDE_TIPO_INDEX: + setServico_saude_tipo( ( Integer ) value ); + break; + case Empresas.SERVICO_SAUDE_DESIGNACAO_INDEX: + setServico_saude_designacao( ( String ) value ); + break; + case Empresas.SERVICO_HIGIENE_TIPO_INDEX: + setServico_higiene_tipo( ( Integer ) value ); + break; + case Empresas.SERVICO_HIGIENE_DESIGNACAO_INDEX: + setServico_higiene_designacao( ( String ) value ); + break; + case Empresas.INACTIVO_INDEX: + setInactivo( ( String ) value ); + break; + case Empresas.MORADA_INDEX: + setMorada( ( String ) value ); + break; + case Empresas.CODIGO_POSTAL_INDEX: + setCodigo_postal( ( String ) value ); + break; + case Empresas.LOCALIDADE_INDEX: + setLocalidade( ( String ) value ); + break; + case Empresas.DISTRITO_INDEX: + setDistrito( ( String ) value ); + break; + case Empresas.CONCELHO_INDEX: + setConcelho( ( String ) value ); + break; + case Empresas.NUMERO_TRABALHADORES_INDEX: + setNumero_trabalhadores( ( Integer ) value ); + break; + case Empresas.DATA_PROPOSTA_INDEX: + setData_proposta( ( java.util.Date ) value ); + break; + case Empresas.DATA_ACEITACAO_INDEX: + setData_aceitacao( ( java.util.Date ) value ); + break; + case Empresas.PERFIL_1_INDEX: + setPerfil_1( ( String ) value ); + break; + case Empresas.PERFIL_2_INDEX: + setPerfil_2( ( String ) value ); + break; + case Empresas.DATA_ENVIO_CONTRATO_INDEX: + setData_envio_contrato( ( java.util.Date ) value ); + break; + case Empresas.DATA_RECEPCAO_CONTRATO_INDEX: + setData_recepcao_contrato( ( java.util.Date ) value ); + break; + case Empresas.DATA_ENVIO_IDICT_INDEX: + setData_envio_idict( ( java.util.Date ) value ); + break; + case Empresas.CAE_INDEX: + setCae( ( String ) value ); + break; + case Empresas.CONTRIBUINTE_INDEX: + setContribuinte( ( String ) value ); + break; + case Empresas.SEGURANCA_SOCIAL_INDEX: + setSeguranca_social( ( String ) value ); + break; + case Empresas.CODIGO_1_INDEX: + setCodigo_1( ( String ) value ); + break; + case Empresas.CODIGO_2_INDEX: + setCodigo_2( ( String ) value ); + break; + case Empresas.CODIGO_3_INDEX: + setCodigo_3( ( String ) value ); + break; + case Empresas.SERVICOS_INDEX: + setServicos( ( Integer ) value ); + break; + case Empresas.CONTACTO_1_INDEX: + setContacto_1( ( Integer ) value ); + break; + case Empresas.TO_CONTACTO_1_INDEX: + setToContacto_1( ( siprp.data.outer.ContactosData ) value ); + break; + case Empresas.CONTACTO_2_INDEX: + setContacto_2( ( Integer ) value ); + break; + case Empresas.TO_CONTACTO_2_INDEX: + setToContacto_2( ( siprp.data.outer.ContactosData ) value ); + break; + case Empresas.DATA_RELATORIO_ANUAL_INDEX: + setData_relatorio_anual( ( java.util.Date ) value ); + break; + case Empresas.PERIODICIDADE_INDEX: + setPeriodicidade( ( String ) value ); + break; + case Empresas.ACTIVIDADE_INDEX: + setActividade( ( String ) value ); + break; + case Empresas.ACTUALIZACAO_INDEX: + setActualizacao( ( java.sql.Timestamp ) value ); + break; + case Empresas.DESIGNACAO_SOCIAL_PLAIN_INDEX: + setDesignacao_social_plain( ( String ) value ); + break; + case Empresas.A_CONSULTAS_INDEX: + setA_consultas( ( String ) value ); + break; + case Empresas.A_EXAMES_INDEX: + setA_exames( ( String ) value ); + break; + case Empresas.B_CONSULTAS_INDEX: + setB_consultas( ( String ) value ); + break; + case Empresas.B_EXAMES_INDEX: + setB_exames( ( String ) value ); + break; + case Empresas.DATA_CANCELAMENTO_INDEX: + setData_cancelamento( ( java.util.Date ) value ); + break; + case Empresas.DURACAO_INDEX: + setDuracao( ( Integer ) value ); + break; + case Empresas.INICIO_CONTRATO_INDEX: + setInicio_contrato( ( java.util.Date ) value ); + break; + case Empresas.EMPRESA_LOGO_ID_INDEX: + setEmpresa_logo_id( ( Integer ) value ); + break; + case Empresas.TO_EMPRESA_LOGO_ID_INDEX: + setToEmpresa_logo_id( ( siprp.data.outer.ImageData ) value ); + break; + case Empresas.IMPRIMIR_TABELA_ALARGADA_INDEX: + setImprimir_tabela_alargada( ( Boolean ) value ); + break; + case Empresas.CODIGO_RELATORIO_UNICO_INDEX: + setCodigo_relatorio_unico( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Empresas.ID_INDEX: + this.id = ( Integer ) value; + break; + case Empresas.DESIGNACAO_SOCIAL_INDEX: + this.designacao_social = ( String ) value; + break; + case Empresas.SERVICO_SAUDE_TIPO_INDEX: + this.servico_saude_tipo = ( Integer ) value; + break; + case Empresas.SERVICO_SAUDE_DESIGNACAO_INDEX: + this.servico_saude_designacao = ( String ) value; + break; + case Empresas.SERVICO_HIGIENE_TIPO_INDEX: + this.servico_higiene_tipo = ( Integer ) value; + break; + case Empresas.SERVICO_HIGIENE_DESIGNACAO_INDEX: + this.servico_higiene_designacao = ( String ) value; + break; + case Empresas.INACTIVO_INDEX: + this.inactivo = ( String ) value; + break; + case Empresas.MORADA_INDEX: + this.morada = ( String ) value; + break; + case Empresas.CODIGO_POSTAL_INDEX: + this.codigo_postal = ( String ) value; + break; + case Empresas.LOCALIDADE_INDEX: + this.localidade = ( String ) value; + break; + case Empresas.DISTRITO_INDEX: + this.distrito = ( String ) value; + break; + case Empresas.CONCELHO_INDEX: + this.concelho = ( String ) value; + break; + case Empresas.NUMERO_TRABALHADORES_INDEX: + this.numero_trabalhadores = ( Integer ) value; + break; + case Empresas.DATA_PROPOSTA_INDEX: + this.data_proposta = ( java.util.Date ) value; + break; + case Empresas.DATA_ACEITACAO_INDEX: + this.data_aceitacao = ( java.util.Date ) value; + break; + case Empresas.PERFIL_1_INDEX: + this.perfil_1 = ( String ) value; + break; + case Empresas.PERFIL_2_INDEX: + this.perfil_2 = ( String ) value; + break; + case Empresas.DATA_ENVIO_CONTRATO_INDEX: + this.data_envio_contrato = ( java.util.Date ) value; + break; + case Empresas.DATA_RECEPCAO_CONTRATO_INDEX: + this.data_recepcao_contrato = ( java.util.Date ) value; + break; + case Empresas.DATA_ENVIO_IDICT_INDEX: + this.data_envio_idict = ( java.util.Date ) value; + break; + case Empresas.CAE_INDEX: + this.cae = ( String ) value; + break; + case Empresas.CONTRIBUINTE_INDEX: + this.contribuinte = ( String ) value; + break; + case Empresas.SEGURANCA_SOCIAL_INDEX: + this.seguranca_social = ( String ) value; + break; + case Empresas.CODIGO_1_INDEX: + this.codigo_1 = ( String ) value; + break; + case Empresas.CODIGO_2_INDEX: + this.codigo_2 = ( String ) value; + break; + case Empresas.CODIGO_3_INDEX: + this.codigo_3 = ( String ) value; + break; + case Empresas.SERVICOS_INDEX: + this.servicos = ( Integer ) value; + break; + case Empresas.CONTACTO_1_INDEX: + this.contacto_1 = ( Integer ) value; + break; + case Empresas.TO_CONTACTO_1_INDEX: + this.to_contacto_1 = ( siprp.data.outer.ContactosData ) value; + break; + case Empresas.CONTACTO_2_INDEX: + this.contacto_2 = ( Integer ) value; + break; + case Empresas.TO_CONTACTO_2_INDEX: + this.to_contacto_2 = ( siprp.data.outer.ContactosData ) value; + break; + case Empresas.DATA_RELATORIO_ANUAL_INDEX: + this.data_relatorio_anual = ( java.util.Date ) value; + break; + case Empresas.PERIODICIDADE_INDEX: + this.periodicidade = ( String ) value; + break; + case Empresas.ACTIVIDADE_INDEX: + this.actividade = ( String ) value; + break; + case Empresas.ACTUALIZACAO_INDEX: + this.actualizacao = ( java.sql.Timestamp ) value; + break; + case Empresas.DESIGNACAO_SOCIAL_PLAIN_INDEX: + this.designacao_social_plain = ( String ) value; + break; + case Empresas.A_CONSULTAS_INDEX: + this.a_consultas = ( String ) value; + break; + case Empresas.A_EXAMES_INDEX: + this.a_exames = ( String ) value; + break; + case Empresas.B_CONSULTAS_INDEX: + this.b_consultas = ( String ) value; + break; + case Empresas.B_EXAMES_INDEX: + this.b_exames = ( String ) value; + break; + case Empresas.DATA_CANCELAMENTO_INDEX: + this.data_cancelamento = ( java.util.Date ) value; + break; + case Empresas.DURACAO_INDEX: + this.duracao = ( Integer ) value; + break; + case Empresas.INICIO_CONTRATO_INDEX: + this.inicio_contrato = ( java.util.Date ) value; + break; + case Empresas.EMPRESA_LOGO_ID_INDEX: + this.empresa_logo_id = ( Integer ) value; + break; + case Empresas.TO_EMPRESA_LOGO_ID_INDEX: + this.to_empresa_logo_id = ( siprp.data.outer.ImageData ) value; + break; + case Empresas.IMPRIMIR_TABELA_ALARGADA_INDEX: + this.imprimir_tabela_alargada = ( Boolean ) value; + break; + case Empresas.CODIGO_RELATORIO_UNICO_INDEX: + this.codigo_relatorio_unico = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case Empresas.ID_INDEX: + theClass = Integer.class; + break; + case Empresas.DESIGNACAO_SOCIAL_INDEX: + theClass = String.class; + break; + case Empresas.SERVICO_SAUDE_TIPO_INDEX: + theClass = Integer.class; + break; + case Empresas.SERVICO_SAUDE_DESIGNACAO_INDEX: + theClass = String.class; + break; + case Empresas.SERVICO_HIGIENE_TIPO_INDEX: + theClass = Integer.class; + break; + case Empresas.SERVICO_HIGIENE_DESIGNACAO_INDEX: + theClass = String.class; + break; + case Empresas.INACTIVO_INDEX: + theClass = String.class; + break; + case Empresas.MORADA_INDEX: + theClass = String.class; + break; + case Empresas.CODIGO_POSTAL_INDEX: + theClass = String.class; + break; + case Empresas.LOCALIDADE_INDEX: + theClass = String.class; + break; + case Empresas.DISTRITO_INDEX: + theClass = String.class; + break; + case Empresas.CONCELHO_INDEX: + theClass = String.class; + break; + case Empresas.NUMERO_TRABALHADORES_INDEX: + theClass = Integer.class; + break; + case Empresas.DATA_PROPOSTA_INDEX: + theClass = java.util.Date.class; + break; + case Empresas.DATA_ACEITACAO_INDEX: + theClass = java.util.Date.class; + break; + case Empresas.PERFIL_1_INDEX: + theClass = String.class; + break; + case Empresas.PERFIL_2_INDEX: + theClass = String.class; + break; + case Empresas.DATA_ENVIO_CONTRATO_INDEX: + theClass = java.util.Date.class; + break; + case Empresas.DATA_RECEPCAO_CONTRATO_INDEX: + theClass = java.util.Date.class; + break; + case Empresas.DATA_ENVIO_IDICT_INDEX: + theClass = java.util.Date.class; + break; + case Empresas.CAE_INDEX: + theClass = String.class; + break; + case Empresas.CONTRIBUINTE_INDEX: + theClass = String.class; + break; + case Empresas.SEGURANCA_SOCIAL_INDEX: + theClass = String.class; + break; + case Empresas.CODIGO_1_INDEX: + theClass = String.class; + break; + case Empresas.CODIGO_2_INDEX: + theClass = String.class; + break; + case Empresas.CODIGO_3_INDEX: + theClass = String.class; + break; + case Empresas.SERVICOS_INDEX: + theClass = Integer.class; + break; + case Empresas.CONTACTO_1_INDEX: + theClass = Integer.class; + break; + case Empresas.TO_CONTACTO_1_INDEX: + theClass = siprp.data.outer.ContactosData.class; + break; + case Empresas.CONTACTO_2_INDEX: + theClass = Integer.class; + break; + case Empresas.TO_CONTACTO_2_INDEX: + theClass = siprp.data.outer.ContactosData.class; + break; + case Empresas.DATA_RELATORIO_ANUAL_INDEX: + theClass = java.util.Date.class; + break; + case Empresas.PERIODICIDADE_INDEX: + theClass = String.class; + break; + case Empresas.ACTIVIDADE_INDEX: + theClass = String.class; + break; + case Empresas.ACTUALIZACAO_INDEX: + theClass = java.sql.Timestamp.class; + break; + case Empresas.DESIGNACAO_SOCIAL_PLAIN_INDEX: + theClass = String.class; + break; + case Empresas.A_CONSULTAS_INDEX: + theClass = String.class; + break; + case Empresas.A_EXAMES_INDEX: + theClass = String.class; + break; + case Empresas.B_CONSULTAS_INDEX: + theClass = String.class; + break; + case Empresas.B_EXAMES_INDEX: + theClass = String.class; + break; + case Empresas.DATA_CANCELAMENTO_INDEX: + theClass = java.util.Date.class; + break; + case Empresas.DURACAO_INDEX: + theClass = Integer.class; + break; + case Empresas.INICIO_CONTRATO_INDEX: + theClass = java.util.Date.class; + break; + case Empresas.EMPRESA_LOGO_ID_INDEX: + theClass = Integer.class; + break; + case Empresas.TO_EMPRESA_LOGO_ID_INDEX: + theClass = siprp.data.outer.ImageData.class; + break; + case Empresas.IMPRIMIR_TABELA_ALARGADA_INDEX: + theClass = Boolean.class; + break; + case Empresas.CODIGO_RELATORIO_UNICO_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : Empresas._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, Empresas.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Errors.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Errors.java new file mode 100644 index 00000000..ee7f7b32 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Errors.java @@ -0,0 +1,431 @@ +/* +* Errors.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class Errors extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( Errors.ID, Errors.ID_INDEX ); + FIELD_INDEXES.put( Errors.ID_FULL, Errors.ID_INDEX ); + FIELD_INDEXES.put( Errors.DATE, Errors.DATE_INDEX ); + FIELD_INDEXES.put( Errors.DATE_FULL, Errors.DATE_INDEX ); + FIELD_INDEXES.put( Errors.TYPE, Errors.TYPE_INDEX ); + FIELD_INDEXES.put( Errors.TYPE_FULL, Errors.TYPE_INDEX ); + FIELD_INDEXES.put( Errors.ENVIRONMENT, Errors.ENVIRONMENT_INDEX ); + FIELD_INDEXES.put( Errors.ENVIRONMENT_FULL, Errors.ENVIRONMENT_INDEX ); + FIELD_INDEXES.put( Errors.DESCRIPTION, Errors.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( Errors.DESCRIPTION_FULL, Errors.DESCRIPTION_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "errors"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.errors"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "errors.id"; + public static final int ID_INDEX = 0; + public static final String DATE = "date"; + public static final String DATE_FULL = "errors.date"; + public static final int DATE_INDEX = 1; + public static final String TYPE = "type"; + public static final String TYPE_FULL = "errors.type"; + public static final int TYPE_INDEX = 2; + public static final String ENVIRONMENT = "environment"; + public static final String ENVIRONMENT_FULL = "errors.environment"; + public static final int ENVIRONMENT_INDEX = 3; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "errors.description"; + public static final int DESCRIPTION_INDEX = 4; + + public static final String FIELD_NAMES[] = new String[]{ + DATE, TYPE, ENVIRONMENT, DESCRIPTION, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DATE, TABLENAME + "." + TYPE, TABLENAME + "." + ENVIRONMENT, TABLENAME + "." + DESCRIPTION, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DATE, TYPE, ENVIRONMENT, DESCRIPTION, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DATE, TYPE, ENVIRONMENT, DESCRIPTION, }; + + private Integer id; + private java.sql.Timestamp date; + private String type; + private String environment; + private String description; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public Errors() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.sql.Timestamp getDate() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.date; + } + + public void setDate( java.sql.Timestamp date ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATE, date ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.date = date; + LAZY_LOADED_OBJECTS.put( DATE, Boolean.TRUE ); + } + + public String getType() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TYPE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.type; + } + + public void setType( String type ) + { + try + { + setLockedForRefresh( true ); + preProcess( TYPE, type ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.type = type; + LAZY_LOADED_OBJECTS.put( TYPE, Boolean.TRUE ); + } + + public String getEnvironment() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ENVIRONMENT ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.environment; + } + + public void setEnvironment( String environment ) + { + try + { + setLockedForRefresh( true ); + preProcess( ENVIRONMENT, environment ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.environment = environment; + LAZY_LOADED_OBJECTS.put( ENVIRONMENT, Boolean.TRUE ); + } + + public String getDescription() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRIPTION ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.description; + } + + public void setDescription( String description ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRIPTION, description ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.description = description; + LAZY_LOADED_OBJECTS.put( DESCRIPTION, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Errors.ID_INDEX: + value = getId(); + break; + case Errors.DATE_INDEX: + value = getDate(); + break; + case Errors.TYPE_INDEX: + value = getType(); + break; + case Errors.ENVIRONMENT_INDEX: + value = getEnvironment(); + break; + case Errors.DESCRIPTION_INDEX: + value = getDescription(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Errors.ID_INDEX: + value = this.id; + break; + case Errors.DATE_INDEX: + value = this.date; + break; + case Errors.TYPE_INDEX: + value = this.type; + break; + case Errors.ENVIRONMENT_INDEX: + value = this.environment; + break; + case Errors.DESCRIPTION_INDEX: + value = this.description; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Errors.ID_INDEX: + setId( ( Integer ) value ); + break; + case Errors.DATE_INDEX: + setDate( ( java.sql.Timestamp ) value ); + break; + case Errors.TYPE_INDEX: + setType( ( String ) value ); + break; + case Errors.ENVIRONMENT_INDEX: + setEnvironment( ( String ) value ); + break; + case Errors.DESCRIPTION_INDEX: + setDescription( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Errors.ID_INDEX: + this.id = ( Integer ) value; + break; + case Errors.DATE_INDEX: + this.date = ( java.sql.Timestamp ) value; + break; + case Errors.TYPE_INDEX: + this.type = ( String ) value; + break; + case Errors.ENVIRONMENT_INDEX: + this.environment = ( String ) value; + break; + case Errors.DESCRIPTION_INDEX: + this.description = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case Errors.ID_INDEX: + theClass = Integer.class; + break; + case Errors.DATE_INDEX: + theClass = java.sql.Timestamp.class; + break; + case Errors.TYPE_INDEX: + theClass = String.class; + break; + case Errors.ENVIRONMENT_INDEX: + theClass = String.class; + break; + case Errors.DESCRIPTION_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : Errors._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, Errors.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Estabelecimentos.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Estabelecimentos.java new file mode 100644 index 00000000..c346ebd0 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Estabelecimentos.java @@ -0,0 +1,1328 @@ +/* +* Estabelecimentos.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class Estabelecimentos extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( Estabelecimentos.ID, Estabelecimentos.ID_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.ID_FULL, Estabelecimentos.ID_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.NOME, Estabelecimentos.NOME_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.NOME_FULL, Estabelecimentos.NOME_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.LOCALIDADE, Estabelecimentos.LOCALIDADE_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.LOCALIDADE_FULL, Estabelecimentos.LOCALIDADE_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.INACTIVO, Estabelecimentos.INACTIVO_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.INACTIVO_FULL, Estabelecimentos.INACTIVO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Estabelecimentos.CLASS_IDENTIFIER, Estabelecimentos.EMPRESA_ID, Estabelecimentos.TO_EMPRESA_ID ); + FIELD_INDEXES.put( Estabelecimentos.EMPRESA_ID, Estabelecimentos.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.EMPRESA_ID_FULL, Estabelecimentos.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.TO_EMPRESA_ID, Estabelecimentos.TO_EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.MORADA, Estabelecimentos.MORADA_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.MORADA_FULL, Estabelecimentos.MORADA_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.CODIGO_POSTAL, Estabelecimentos.CODIGO_POSTAL_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.CODIGO_POSTAL_FULL, Estabelecimentos.CODIGO_POSTAL_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.CONTACTO_BACKUP, Estabelecimentos.CONTACTO_BACKUP_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.CONTACTO_BACKUP_FULL, Estabelecimentos.CONTACTO_BACKUP_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.HISTORICO, Estabelecimentos.HISTORICO_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.HISTORICO_FULL, Estabelecimentos.HISTORICO_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.ACTUALIZACAO, Estabelecimentos.ACTUALIZACAO_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.ACTUALIZACAO_FULL, Estabelecimentos.ACTUALIZACAO_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.NOME_PLAIN, Estabelecimentos.NOME_PLAIN_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.NOME_PLAIN_FULL, Estabelecimentos.NOME_PLAIN_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Estabelecimentos.CLASS_IDENTIFIER, Estabelecimentos.MEDICO_ID, Estabelecimentos.TO_MEDICO_ID ); + FIELD_INDEXES.put( Estabelecimentos.MEDICO_ID, Estabelecimentos.MEDICO_ID_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.MEDICO_ID_FULL, Estabelecimentos.MEDICO_ID_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.TO_MEDICO_ID, Estabelecimentos.TO_MEDICO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Estabelecimentos.CLASS_IDENTIFIER, Estabelecimentos.PRESTADOR_CONSULTA_ID, Estabelecimentos.TO_PRESTADOR_CONSULTA_ID ); + FIELD_INDEXES.put( Estabelecimentos.PRESTADOR_CONSULTA_ID, Estabelecimentos.PRESTADOR_CONSULTA_ID_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.PRESTADOR_CONSULTA_ID_FULL, Estabelecimentos.PRESTADOR_CONSULTA_ID_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.TO_PRESTADOR_CONSULTA_ID, Estabelecimentos.TO_PRESTADOR_CONSULTA_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Estabelecimentos.CLASS_IDENTIFIER, Estabelecimentos.PRESTADOR_ECDS_ID, Estabelecimentos.TO_PRESTADOR_ECDS_ID ); + FIELD_INDEXES.put( Estabelecimentos.PRESTADOR_ECDS_ID, Estabelecimentos.PRESTADOR_ECDS_ID_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.PRESTADOR_ECDS_ID_FULL, Estabelecimentos.PRESTADOR_ECDS_ID_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.TO_PRESTADOR_ECDS_ID, Estabelecimentos.TO_PRESTADOR_ECDS_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Estabelecimentos.CLASS_IDENTIFIER, Estabelecimentos.CONTACTO_ID, Estabelecimentos.TO_CONTACTO_ID ); + FIELD_INDEXES.put( Estabelecimentos.CONTACTO_ID, Estabelecimentos.CONTACTO_ID_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.CONTACTO_ID_FULL, Estabelecimentos.CONTACTO_ID_INDEX ); + FIELD_INDEXES.put( Estabelecimentos.TO_CONTACTO_ID, Estabelecimentos.TO_CONTACTO_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyempresa_idToempresas = + new com.evolute.entity.ForeignKey( Estabelecimentos.class, Estabelecimentos.EMPRESA_ID, siprp.data.outer.EmpresasData.class, siprp.data.outer.EmpresasData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeymedico_idTomedicos = + new com.evolute.entity.ForeignKey( Estabelecimentos.class, Estabelecimentos.MEDICO_ID, siprp.data.outer.MedicosData.class, siprp.data.outer.MedicosData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyprestador_consulta_idToprestadores = + new com.evolute.entity.ForeignKey( Estabelecimentos.class, Estabelecimentos.PRESTADOR_CONSULTA_ID, siprp.data.outer.PrestadoresData.class, siprp.data.outer.PrestadoresData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyprestador_ecds_idToprestadores = + new com.evolute.entity.ForeignKey( Estabelecimentos.class, Estabelecimentos.PRESTADOR_ECDS_ID, siprp.data.outer.PrestadoresData.class, siprp.data.outer.PrestadoresData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeycontacto_idTocontactos = + new com.evolute.entity.ForeignKey( Estabelecimentos.class, Estabelecimentos.CONTACTO_ID, siprp.data.outer.ContactosData.class, siprp.data.outer.ContactosData.ID ); + + public static final String TABLENAME = "estabelecimentos"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.estabelecimentos"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "estabelecimentos.id"; + public static final int ID_INDEX = 0; + public static final String NOME = "nome"; + public static final String NOME_FULL = "estabelecimentos.nome"; + public static final int NOME_INDEX = 1; + public static final String LOCALIDADE = "localidade"; + public static final String LOCALIDADE_FULL = "estabelecimentos.localidade"; + public static final int LOCALIDADE_INDEX = 2; + public static final String INACTIVO = "inactivo"; + public static final String INACTIVO_FULL = "estabelecimentos.inactivo"; + public static final int INACTIVO_INDEX = 3; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "estabelecimentos.empresa_id"; + public static final int EMPRESA_ID_INDEX = 4; + public static final String TO_EMPRESA_ID = "to_empresa_id"; + public static final int TO_EMPRESA_ID_INDEX = 5; + public static final String MORADA = "morada"; + public static final String MORADA_FULL = "estabelecimentos.morada"; + public static final int MORADA_INDEX = 6; + public static final String CODIGO_POSTAL = "codigo_postal"; + public static final String CODIGO_POSTAL_FULL = "estabelecimentos.codigo_postal"; + public static final int CODIGO_POSTAL_INDEX = 7; + public static final String CONTACTO_BACKUP = "contacto_backup"; + public static final String CONTACTO_BACKUP_FULL = "estabelecimentos.contacto_backup"; + public static final int CONTACTO_BACKUP_INDEX = 8; + public static final String HISTORICO = "historico"; + public static final String HISTORICO_FULL = "estabelecimentos.historico"; + public static final int HISTORICO_INDEX = 9; + public static final String ACTUALIZACAO = "actualizacao"; + public static final String ACTUALIZACAO_FULL = "estabelecimentos.actualizacao"; + public static final int ACTUALIZACAO_INDEX = 10; + public static final String NOME_PLAIN = "nome_plain"; + public static final String NOME_PLAIN_FULL = "estabelecimentos.nome_plain"; + public static final int NOME_PLAIN_INDEX = 11; + public static final String MEDICO_ID = "medico_id"; + public static final String MEDICO_ID_FULL = "estabelecimentos.medico_id"; + public static final int MEDICO_ID_INDEX = 12; + public static final String TO_MEDICO_ID = "to_medico_id"; + public static final int TO_MEDICO_ID_INDEX = 13; + public static final String PRESTADOR_CONSULTA_ID = "prestador_consulta_id"; + public static final String PRESTADOR_CONSULTA_ID_FULL = "estabelecimentos.prestador_consulta_id"; + public static final int PRESTADOR_CONSULTA_ID_INDEX = 14; + public static final String TO_PRESTADOR_CONSULTA_ID = "to_prestador_consulta_id"; + public static final int TO_PRESTADOR_CONSULTA_ID_INDEX = 15; + public static final String PRESTADOR_ECDS_ID = "prestador_ecds_id"; + public static final String PRESTADOR_ECDS_ID_FULL = "estabelecimentos.prestador_ecds_id"; + public static final int PRESTADOR_ECDS_ID_INDEX = 16; + public static final String TO_PRESTADOR_ECDS_ID = "to_prestador_ecds_id"; + public static final int TO_PRESTADOR_ECDS_ID_INDEX = 17; + public static final String CONTACTO_ID = "contacto_id"; + public static final String CONTACTO_ID_FULL = "estabelecimentos.contacto_id"; + public static final int CONTACTO_ID_INDEX = 18; + public static final String TO_CONTACTO_ID = "to_contacto_id"; + public static final int TO_CONTACTO_ID_INDEX = 19; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, LOCALIDADE, INACTIVO, EMPRESA_ID, TO_EMPRESA_ID, MORADA, CODIGO_POSTAL, + CONTACTO_BACKUP, HISTORICO, ACTUALIZACAO, NOME_PLAIN, MEDICO_ID, TO_MEDICO_ID, + PRESTADOR_CONSULTA_ID, TO_PRESTADOR_CONSULTA_ID, PRESTADOR_ECDS_ID, + TO_PRESTADOR_ECDS_ID, CONTACTO_ID, TO_CONTACTO_ID, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + NOME, TABLENAME + "." + LOCALIDADE, TABLENAME + "." + INACTIVO, TABLENAME + "." + EMPRESA_ID, TABLENAME + "." + TO_EMPRESA_ID, TABLENAME + "." + MORADA, TABLENAME + "." + CODIGO_POSTAL, + TABLENAME + "." + CONTACTO_BACKUP, TABLENAME + "." + HISTORICO, TABLENAME + "." + ACTUALIZACAO, TABLENAME + "." + NOME_PLAIN, TABLENAME + "." + MEDICO_ID, TABLENAME + "." + TO_MEDICO_ID, + TABLENAME + "." + PRESTADOR_CONSULTA_ID, TABLENAME + "." + TO_PRESTADOR_CONSULTA_ID, TABLENAME + "." + PRESTADOR_ECDS_ID, + TABLENAME + "." + TO_PRESTADOR_ECDS_ID, TABLENAME + "." + CONTACTO_ID, TABLENAME + "." + TO_CONTACTO_ID, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, NOME, LOCALIDADE, INACTIVO, EMPRESA_ID, MORADA, CODIGO_POSTAL, CONTACTO_BACKUP, + HISTORICO, ACTUALIZACAO, NOME_PLAIN, MEDICO_ID, PRESTADOR_CONSULTA_ID, + PRESTADOR_ECDS_ID, CONTACTO_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, NOME, LOCALIDADE, INACTIVO, EMPRESA_ID, MORADA, CODIGO_POSTAL, CONTACTO_BACKUP, + HISTORICO, ACTUALIZACAO, NOME_PLAIN, MEDICO_ID, PRESTADOR_CONSULTA_ID, + PRESTADOR_ECDS_ID, CONTACTO_ID, }; + + private Integer id; + private String nome; + private String localidade; + private String inactivo; + private Integer empresa_id; + private siprp.data.outer.EmpresasData to_empresa_id; + private String morada; + private String codigo_postal; + private String contacto_backup; + private String historico; + private java.sql.Timestamp actualizacao; + private String nome_plain; + private Integer medico_id; + private siprp.data.outer.MedicosData to_medico_id; + private Integer prestador_consulta_id; + private siprp.data.outer.PrestadoresData to_prestador_consulta_id; + private Integer prestador_ecds_id; + private siprp.data.outer.PrestadoresData to_prestador_ecds_id; + private Integer contacto_id; + private siprp.data.outer.ContactosData to_contacto_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public Estabelecimentos() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false + , false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromAvisos_estabelecimento_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.AvisosData.class , getPrimaryKey().getMap().get("id"), "estabelecimento_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromEmailPlanoDeActuacao_estabelecimento_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.EmailPlanoDeActuacaoData.class , getPrimaryKey().getMap().get("id"), "estabelecimento_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHistoricoEstabelecimento_estabelecimento_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HistoricoEstabelecimentoData.class , getPrimaryKey().getMap().get("id"), "estabelecimento_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsEmailEstabelecimento_estabelecimento_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsEmailEstabelecimentoData.class , getPrimaryKey().getMap().get("id"), "estabelecimento_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsLegislacaoEstabelecimento_estabelecimento_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsLegislacaoEstabelecimentoData.class , getPrimaryKey().getMap().get("id"), "estabelecimento_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsNormalizacaoEstabelecimento_estabelecimento_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsNormalizacaoEstabelecimentoData.class , getPrimaryKey().getMap().get("id"), "estabelecimento_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsPostoEstabelecimento_estabelecimento_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsPostoEstabelecimentoData.class , getPrimaryKey().getMap().get("id"), "estabelecimento_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromLembretes_estabelecimento_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.LembretesData.class , getPrimaryKey().getMap().get("id"), "estabelecimento_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromMarcacoesEstabelecimento_estabelecimento_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.MarcacoesEstabelecimentoData.class , getPrimaryKey().getMap().get("id"), "estabelecimento_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadores_estabelecimento_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresData.class , getPrimaryKey().getMap().get("id"), "estabelecimento_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getNome() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NOME ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.nome; + } + + public void setNome( String nome ) + { + try + { + setLockedForRefresh( true ); + preProcess( NOME, nome ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.nome = nome; + LAZY_LOADED_OBJECTS.put( NOME, Boolean.TRUE ); + } + + public String getLocalidade() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( LOCALIDADE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.localidade; + } + + public void setLocalidade( String localidade ) + { + try + { + setLockedForRefresh( true ); + preProcess( LOCALIDADE, localidade ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.localidade = localidade; + LAZY_LOADED_OBJECTS.put( LOCALIDADE, Boolean.TRUE ); + } + + public String getInactivo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( INACTIVO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.inactivo; + } + + public void setInactivo( String inactivo ) + { + try + { + setLockedForRefresh( true ); + preProcess( INACTIVO, inactivo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.inactivo = inactivo; + LAZY_LOADED_OBJECTS.put( INACTIVO, Boolean.TRUE ); + } + + public Integer getEmpresa_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMPRESA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.empresa_id; + } + + public void setEmpresa_id( Integer empresa_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMPRESA_ID, empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.empresa_id = empresa_id; + LAZY_LOADED_OBJECTS.put( EMPRESA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EmpresasData toEmpresa_id() + { + try + { + prepare( TO_EMPRESA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_empresa_id; + } + + public void setToEmpresa_id( siprp.data.outer.EmpresasData to_empresa_id ) + { + try + { + preProcess( TO_EMPRESA_ID, to_empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_empresa_id = to_empresa_id; + } + + public String getMorada() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MORADA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.morada; + } + + public void setMorada( String morada ) + { + try + { + setLockedForRefresh( true ); + preProcess( MORADA, morada ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.morada = morada; + LAZY_LOADED_OBJECTS.put( MORADA, Boolean.TRUE ); + } + + public String getCodigo_postal() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CODIGO_POSTAL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.codigo_postal; + } + + public void setCodigo_postal( String codigo_postal ) + { + try + { + setLockedForRefresh( true ); + preProcess( CODIGO_POSTAL, codigo_postal ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.codigo_postal = codigo_postal; + LAZY_LOADED_OBJECTS.put( CODIGO_POSTAL, Boolean.TRUE ); + } + + public String getContacto_backup() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CONTACTO_BACKUP ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.contacto_backup; + } + + public void setContacto_backup( String contacto_backup ) + { + try + { + setLockedForRefresh( true ); + preProcess( CONTACTO_BACKUP, contacto_backup ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.contacto_backup = contacto_backup; + LAZY_LOADED_OBJECTS.put( CONTACTO_BACKUP, Boolean.TRUE ); + } + + public String getHistorico() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( HISTORICO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.historico; + } + + public void setHistorico( String historico ) + { + try + { + setLockedForRefresh( true ); + preProcess( HISTORICO, historico ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.historico = historico; + LAZY_LOADED_OBJECTS.put( HISTORICO, Boolean.TRUE ); + } + + public java.sql.Timestamp getActualizacao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ACTUALIZACAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.actualizacao; + } + + public void setActualizacao( java.sql.Timestamp actualizacao ) + { + try + { + setLockedForRefresh( true ); + preProcess( ACTUALIZACAO, actualizacao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.actualizacao = actualizacao; + LAZY_LOADED_OBJECTS.put( ACTUALIZACAO, Boolean.TRUE ); + } + + public String getNome_plain() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NOME_PLAIN ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.nome_plain; + } + + public void setNome_plain( String nome_plain ) + { + try + { + setLockedForRefresh( true ); + preProcess( NOME_PLAIN, nome_plain ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.nome_plain = nome_plain; + LAZY_LOADED_OBJECTS.put( NOME_PLAIN, Boolean.TRUE ); + } + + public Integer getMedico_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MEDICO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.medico_id; + } + + public void setMedico_id( Integer medico_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( MEDICO_ID, medico_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.medico_id = medico_id; + LAZY_LOADED_OBJECTS.put( MEDICO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.MedicosData toMedico_id() + { + try + { + prepare( TO_MEDICO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_medico_id; + } + + public void setToMedico_id( siprp.data.outer.MedicosData to_medico_id ) + { + try + { + preProcess( TO_MEDICO_ID, to_medico_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_medico_id = to_medico_id; + } + + public Integer getPrestador_consulta_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PRESTADOR_CONSULTA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.prestador_consulta_id; + } + + public void setPrestador_consulta_id( Integer prestador_consulta_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( PRESTADOR_CONSULTA_ID, prestador_consulta_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.prestador_consulta_id = prestador_consulta_id; + LAZY_LOADED_OBJECTS.put( PRESTADOR_CONSULTA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrestadoresData toPrestador_consulta_id() + { + try + { + prepare( TO_PRESTADOR_CONSULTA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_prestador_consulta_id; + } + + public void setToPrestador_consulta_id( siprp.data.outer.PrestadoresData to_prestador_consulta_id ) + { + try + { + preProcess( TO_PRESTADOR_CONSULTA_ID, to_prestador_consulta_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_prestador_consulta_id = to_prestador_consulta_id; + } + + public Integer getPrestador_ecds_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PRESTADOR_ECDS_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.prestador_ecds_id; + } + + public void setPrestador_ecds_id( Integer prestador_ecds_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( PRESTADOR_ECDS_ID, prestador_ecds_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.prestador_ecds_id = prestador_ecds_id; + LAZY_LOADED_OBJECTS.put( PRESTADOR_ECDS_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrestadoresData toPrestador_ecds_id() + { + try + { + prepare( TO_PRESTADOR_ECDS_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_prestador_ecds_id; + } + + public void setToPrestador_ecds_id( siprp.data.outer.PrestadoresData to_prestador_ecds_id ) + { + try + { + preProcess( TO_PRESTADOR_ECDS_ID, to_prestador_ecds_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_prestador_ecds_id = to_prestador_ecds_id; + } + + public Integer getContacto_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CONTACTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.contacto_id; + } + + public void setContacto_id( Integer contacto_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( CONTACTO_ID, contacto_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.contacto_id = contacto_id; + LAZY_LOADED_OBJECTS.put( CONTACTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.ContactosData toContacto_id() + { + try + { + prepare( TO_CONTACTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_contacto_id; + } + + public void setToContacto_id( siprp.data.outer.ContactosData to_contacto_id ) + { + try + { + preProcess( TO_CONTACTO_ID, to_contacto_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_contacto_id = to_contacto_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Estabelecimentos.ID_INDEX: + value = getId(); + break; + case Estabelecimentos.NOME_INDEX: + value = getNome(); + break; + case Estabelecimentos.LOCALIDADE_INDEX: + value = getLocalidade(); + break; + case Estabelecimentos.INACTIVO_INDEX: + value = getInactivo(); + break; + case Estabelecimentos.EMPRESA_ID_INDEX: + value = getEmpresa_id(); + break; + case Estabelecimentos.TO_EMPRESA_ID_INDEX: + value = toEmpresa_id(); + break; + case Estabelecimentos.MORADA_INDEX: + value = getMorada(); + break; + case Estabelecimentos.CODIGO_POSTAL_INDEX: + value = getCodigo_postal(); + break; + case Estabelecimentos.CONTACTO_BACKUP_INDEX: + value = getContacto_backup(); + break; + case Estabelecimentos.HISTORICO_INDEX: + value = getHistorico(); + break; + case Estabelecimentos.ACTUALIZACAO_INDEX: + value = getActualizacao(); + break; + case Estabelecimentos.NOME_PLAIN_INDEX: + value = getNome_plain(); + break; + case Estabelecimentos.MEDICO_ID_INDEX: + value = getMedico_id(); + break; + case Estabelecimentos.TO_MEDICO_ID_INDEX: + value = toMedico_id(); + break; + case Estabelecimentos.PRESTADOR_CONSULTA_ID_INDEX: + value = getPrestador_consulta_id(); + break; + case Estabelecimentos.TO_PRESTADOR_CONSULTA_ID_INDEX: + value = toPrestador_consulta_id(); + break; + case Estabelecimentos.PRESTADOR_ECDS_ID_INDEX: + value = getPrestador_ecds_id(); + break; + case Estabelecimentos.TO_PRESTADOR_ECDS_ID_INDEX: + value = toPrestador_ecds_id(); + break; + case Estabelecimentos.CONTACTO_ID_INDEX: + value = getContacto_id(); + break; + case Estabelecimentos.TO_CONTACTO_ID_INDEX: + value = toContacto_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Estabelecimentos.ID_INDEX: + value = this.id; + break; + case Estabelecimentos.NOME_INDEX: + value = this.nome; + break; + case Estabelecimentos.LOCALIDADE_INDEX: + value = this.localidade; + break; + case Estabelecimentos.INACTIVO_INDEX: + value = this.inactivo; + break; + case Estabelecimentos.EMPRESA_ID_INDEX: + value = this.empresa_id; + break; + case Estabelecimentos.TO_EMPRESA_ID_INDEX: + value = this.to_empresa_id; + break; + case Estabelecimentos.MORADA_INDEX: + value = this.morada; + break; + case Estabelecimentos.CODIGO_POSTAL_INDEX: + value = this.codigo_postal; + break; + case Estabelecimentos.CONTACTO_BACKUP_INDEX: + value = this.contacto_backup; + break; + case Estabelecimentos.HISTORICO_INDEX: + value = this.historico; + break; + case Estabelecimentos.ACTUALIZACAO_INDEX: + value = this.actualizacao; + break; + case Estabelecimentos.NOME_PLAIN_INDEX: + value = this.nome_plain; + break; + case Estabelecimentos.MEDICO_ID_INDEX: + value = this.medico_id; + break; + case Estabelecimentos.TO_MEDICO_ID_INDEX: + value = this.to_medico_id; + break; + case Estabelecimentos.PRESTADOR_CONSULTA_ID_INDEX: + value = this.prestador_consulta_id; + break; + case Estabelecimentos.TO_PRESTADOR_CONSULTA_ID_INDEX: + value = this.to_prestador_consulta_id; + break; + case Estabelecimentos.PRESTADOR_ECDS_ID_INDEX: + value = this.prestador_ecds_id; + break; + case Estabelecimentos.TO_PRESTADOR_ECDS_ID_INDEX: + value = this.to_prestador_ecds_id; + break; + case Estabelecimentos.CONTACTO_ID_INDEX: + value = this.contacto_id; + break; + case Estabelecimentos.TO_CONTACTO_ID_INDEX: + value = this.to_contacto_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Estabelecimentos.ID_INDEX: + setId( ( Integer ) value ); + break; + case Estabelecimentos.NOME_INDEX: + setNome( ( String ) value ); + break; + case Estabelecimentos.LOCALIDADE_INDEX: + setLocalidade( ( String ) value ); + break; + case Estabelecimentos.INACTIVO_INDEX: + setInactivo( ( String ) value ); + break; + case Estabelecimentos.EMPRESA_ID_INDEX: + setEmpresa_id( ( Integer ) value ); + break; + case Estabelecimentos.TO_EMPRESA_ID_INDEX: + setToEmpresa_id( ( siprp.data.outer.EmpresasData ) value ); + break; + case Estabelecimentos.MORADA_INDEX: + setMorada( ( String ) value ); + break; + case Estabelecimentos.CODIGO_POSTAL_INDEX: + setCodigo_postal( ( String ) value ); + break; + case Estabelecimentos.CONTACTO_BACKUP_INDEX: + setContacto_backup( ( String ) value ); + break; + case Estabelecimentos.HISTORICO_INDEX: + setHistorico( ( String ) value ); + break; + case Estabelecimentos.ACTUALIZACAO_INDEX: + setActualizacao( ( java.sql.Timestamp ) value ); + break; + case Estabelecimentos.NOME_PLAIN_INDEX: + setNome_plain( ( String ) value ); + break; + case Estabelecimentos.MEDICO_ID_INDEX: + setMedico_id( ( Integer ) value ); + break; + case Estabelecimentos.TO_MEDICO_ID_INDEX: + setToMedico_id( ( siprp.data.outer.MedicosData ) value ); + break; + case Estabelecimentos.PRESTADOR_CONSULTA_ID_INDEX: + setPrestador_consulta_id( ( Integer ) value ); + break; + case Estabelecimentos.TO_PRESTADOR_CONSULTA_ID_INDEX: + setToPrestador_consulta_id( ( siprp.data.outer.PrestadoresData ) value ); + break; + case Estabelecimentos.PRESTADOR_ECDS_ID_INDEX: + setPrestador_ecds_id( ( Integer ) value ); + break; + case Estabelecimentos.TO_PRESTADOR_ECDS_ID_INDEX: + setToPrestador_ecds_id( ( siprp.data.outer.PrestadoresData ) value ); + break; + case Estabelecimentos.CONTACTO_ID_INDEX: + setContacto_id( ( Integer ) value ); + break; + case Estabelecimentos.TO_CONTACTO_ID_INDEX: + setToContacto_id( ( siprp.data.outer.ContactosData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Estabelecimentos.ID_INDEX: + this.id = ( Integer ) value; + break; + case Estabelecimentos.NOME_INDEX: + this.nome = ( String ) value; + break; + case Estabelecimentos.LOCALIDADE_INDEX: + this.localidade = ( String ) value; + break; + case Estabelecimentos.INACTIVO_INDEX: + this.inactivo = ( String ) value; + break; + case Estabelecimentos.EMPRESA_ID_INDEX: + this.empresa_id = ( Integer ) value; + break; + case Estabelecimentos.TO_EMPRESA_ID_INDEX: + this.to_empresa_id = ( siprp.data.outer.EmpresasData ) value; + break; + case Estabelecimentos.MORADA_INDEX: + this.morada = ( String ) value; + break; + case Estabelecimentos.CODIGO_POSTAL_INDEX: + this.codigo_postal = ( String ) value; + break; + case Estabelecimentos.CONTACTO_BACKUP_INDEX: + this.contacto_backup = ( String ) value; + break; + case Estabelecimentos.HISTORICO_INDEX: + this.historico = ( String ) value; + break; + case Estabelecimentos.ACTUALIZACAO_INDEX: + this.actualizacao = ( java.sql.Timestamp ) value; + break; + case Estabelecimentos.NOME_PLAIN_INDEX: + this.nome_plain = ( String ) value; + break; + case Estabelecimentos.MEDICO_ID_INDEX: + this.medico_id = ( Integer ) value; + break; + case Estabelecimentos.TO_MEDICO_ID_INDEX: + this.to_medico_id = ( siprp.data.outer.MedicosData ) value; + break; + case Estabelecimentos.PRESTADOR_CONSULTA_ID_INDEX: + this.prestador_consulta_id = ( Integer ) value; + break; + case Estabelecimentos.TO_PRESTADOR_CONSULTA_ID_INDEX: + this.to_prestador_consulta_id = ( siprp.data.outer.PrestadoresData ) value; + break; + case Estabelecimentos.PRESTADOR_ECDS_ID_INDEX: + this.prestador_ecds_id = ( Integer ) value; + break; + case Estabelecimentos.TO_PRESTADOR_ECDS_ID_INDEX: + this.to_prestador_ecds_id = ( siprp.data.outer.PrestadoresData ) value; + break; + case Estabelecimentos.CONTACTO_ID_INDEX: + this.contacto_id = ( Integer ) value; + break; + case Estabelecimentos.TO_CONTACTO_ID_INDEX: + this.to_contacto_id = ( siprp.data.outer.ContactosData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case Estabelecimentos.ID_INDEX: + theClass = Integer.class; + break; + case Estabelecimentos.NOME_INDEX: + theClass = String.class; + break; + case Estabelecimentos.LOCALIDADE_INDEX: + theClass = String.class; + break; + case Estabelecimentos.INACTIVO_INDEX: + theClass = String.class; + break; + case Estabelecimentos.EMPRESA_ID_INDEX: + theClass = Integer.class; + break; + case Estabelecimentos.TO_EMPRESA_ID_INDEX: + theClass = siprp.data.outer.EmpresasData.class; + break; + case Estabelecimentos.MORADA_INDEX: + theClass = String.class; + break; + case Estabelecimentos.CODIGO_POSTAL_INDEX: + theClass = String.class; + break; + case Estabelecimentos.CONTACTO_BACKUP_INDEX: + theClass = String.class; + break; + case Estabelecimentos.HISTORICO_INDEX: + theClass = String.class; + break; + case Estabelecimentos.ACTUALIZACAO_INDEX: + theClass = java.sql.Timestamp.class; + break; + case Estabelecimentos.NOME_PLAIN_INDEX: + theClass = String.class; + break; + case Estabelecimentos.MEDICO_ID_INDEX: + theClass = Integer.class; + break; + case Estabelecimentos.TO_MEDICO_ID_INDEX: + theClass = siprp.data.outer.MedicosData.class; + break; + case Estabelecimentos.PRESTADOR_CONSULTA_ID_INDEX: + theClass = Integer.class; + break; + case Estabelecimentos.TO_PRESTADOR_CONSULTA_ID_INDEX: + theClass = siprp.data.outer.PrestadoresData.class; + break; + case Estabelecimentos.PRESTADOR_ECDS_ID_INDEX: + theClass = Integer.class; + break; + case Estabelecimentos.TO_PRESTADOR_ECDS_ID_INDEX: + theClass = siprp.data.outer.PrestadoresData.class; + break; + case Estabelecimentos.CONTACTO_ID_INDEX: + theClass = Integer.class; + break; + case Estabelecimentos.TO_CONTACTO_ID_INDEX: + theClass = siprp.data.outer.ContactosData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : Estabelecimentos._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, Estabelecimentos.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Etiquetas.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Etiquetas.java new file mode 100644 index 00000000..1e238d13 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Etiquetas.java @@ -0,0 +1,890 @@ +/* +* Etiquetas.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class Etiquetas extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( Etiquetas.ID, Etiquetas.ID_INDEX ); + FIELD_INDEXES.put( Etiquetas.ID_FULL, Etiquetas.ID_INDEX ); + FIELD_INDEXES.put( Etiquetas.DESCRICAO, Etiquetas.DESCRICAO_INDEX ); + FIELD_INDEXES.put( Etiquetas.DESCRICAO_FULL, Etiquetas.DESCRICAO_INDEX ); + FIELD_INDEXES.put( Etiquetas.DESCRICAO_PLAIN, Etiquetas.DESCRICAO_PLAIN_INDEX ); + FIELD_INDEXES.put( Etiquetas.DESCRICAO_PLAIN_FULL, Etiquetas.DESCRICAO_PLAIN_INDEX ); + FIELD_INDEXES.put( Etiquetas.ALTURA, Etiquetas.ALTURA_INDEX ); + FIELD_INDEXES.put( Etiquetas.ALTURA_FULL, Etiquetas.ALTURA_INDEX ); + FIELD_INDEXES.put( Etiquetas.LARGURA, Etiquetas.LARGURA_INDEX ); + FIELD_INDEXES.put( Etiquetas.LARGURA_FULL, Etiquetas.LARGURA_INDEX ); + FIELD_INDEXES.put( Etiquetas.MARGEM_ESQUERDA, Etiquetas.MARGEM_ESQUERDA_INDEX ); + FIELD_INDEXES.put( Etiquetas.MARGEM_ESQUERDA_FULL, Etiquetas.MARGEM_ESQUERDA_INDEX ); + FIELD_INDEXES.put( Etiquetas.MARGEM_CIMA, Etiquetas.MARGEM_CIMA_INDEX ); + FIELD_INDEXES.put( Etiquetas.MARGEM_CIMA_FULL, Etiquetas.MARGEM_CIMA_INDEX ); + FIELD_INDEXES.put( Etiquetas.COLUNAS, Etiquetas.COLUNAS_INDEX ); + FIELD_INDEXES.put( Etiquetas.COLUNAS_FULL, Etiquetas.COLUNAS_INDEX ); + FIELD_INDEXES.put( Etiquetas.LINHAS, Etiquetas.LINHAS_INDEX ); + FIELD_INDEXES.put( Etiquetas.LINHAS_FULL, Etiquetas.LINHAS_INDEX ); + FIELD_INDEXES.put( Etiquetas.CONTINUA, Etiquetas.CONTINUA_INDEX ); + FIELD_INDEXES.put( Etiquetas.CONTINUA_FULL, Etiquetas.CONTINUA_INDEX ); + FIELD_INDEXES.put( Etiquetas.ALTURA_FOLHA, Etiquetas.ALTURA_FOLHA_INDEX ); + FIELD_INDEXES.put( Etiquetas.ALTURA_FOLHA_FULL, Etiquetas.ALTURA_FOLHA_INDEX ); + FIELD_INDEXES.put( Etiquetas.LARGURA_FOLHA, Etiquetas.LARGURA_FOLHA_INDEX ); + FIELD_INDEXES.put( Etiquetas.LARGURA_FOLHA_FULL, Etiquetas.LARGURA_FOLHA_INDEX ); + FIELD_INDEXES.put( Etiquetas.MARGEM_VERTICAL_FOLHA, Etiquetas.MARGEM_VERTICAL_FOLHA_INDEX ); + FIELD_INDEXES.put( Etiquetas.MARGEM_VERTICAL_FOLHA_FULL, Etiquetas.MARGEM_VERTICAL_FOLHA_INDEX ); + FIELD_INDEXES.put( Etiquetas.MARGEM_HORIZONTAL_FOLHA, Etiquetas.MARGEM_HORIZONTAL_FOLHA_INDEX ); + FIELD_INDEXES.put( Etiquetas.MARGEM_HORIZONTAL_FOLHA_FULL, Etiquetas.MARGEM_HORIZONTAL_FOLHA_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "etiquetas"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.etiquetas"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "etiquetas.id"; + public static final int ID_INDEX = 0; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "etiquetas.descricao"; + public static final int DESCRICAO_INDEX = 1; + public static final String DESCRICAO_PLAIN = "descricao_plain"; + public static final String DESCRICAO_PLAIN_FULL = "etiquetas.descricao_plain"; + public static final int DESCRICAO_PLAIN_INDEX = 2; + public static final String ALTURA = "altura"; + public static final String ALTURA_FULL = "etiquetas.altura"; + public static final int ALTURA_INDEX = 3; + public static final String LARGURA = "largura"; + public static final String LARGURA_FULL = "etiquetas.largura"; + public static final int LARGURA_INDEX = 4; + public static final String MARGEM_ESQUERDA = "margem_esquerda"; + public static final String MARGEM_ESQUERDA_FULL = "etiquetas.margem_esquerda"; + public static final int MARGEM_ESQUERDA_INDEX = 5; + public static final String MARGEM_CIMA = "margem_cima"; + public static final String MARGEM_CIMA_FULL = "etiquetas.margem_cima"; + public static final int MARGEM_CIMA_INDEX = 6; + public static final String COLUNAS = "colunas"; + public static final String COLUNAS_FULL = "etiquetas.colunas"; + public static final int COLUNAS_INDEX = 7; + public static final String LINHAS = "linhas"; + public static final String LINHAS_FULL = "etiquetas.linhas"; + public static final int LINHAS_INDEX = 8; + public static final String CONTINUA = "continua"; + public static final String CONTINUA_FULL = "etiquetas.continua"; + public static final int CONTINUA_INDEX = 9; + public static final String ALTURA_FOLHA = "altura_folha"; + public static final String ALTURA_FOLHA_FULL = "etiquetas.altura_folha"; + public static final int ALTURA_FOLHA_INDEX = 10; + public static final String LARGURA_FOLHA = "largura_folha"; + public static final String LARGURA_FOLHA_FULL = "etiquetas.largura_folha"; + public static final int LARGURA_FOLHA_INDEX = 11; + public static final String MARGEM_VERTICAL_FOLHA = "margem_vertical_folha"; + public static final String MARGEM_VERTICAL_FOLHA_FULL = "etiquetas.margem_vertical_folha"; + public static final int MARGEM_VERTICAL_FOLHA_INDEX = 12; + public static final String MARGEM_HORIZONTAL_FOLHA = "margem_horizontal_folha"; + public static final String MARGEM_HORIZONTAL_FOLHA_FULL = "etiquetas.margem_horizontal_folha"; + public static final int MARGEM_HORIZONTAL_FOLHA_INDEX = 13; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRICAO, DESCRICAO_PLAIN, ALTURA, LARGURA, MARGEM_ESQUERDA, MARGEM_CIMA, COLUNAS, + LINHAS, CONTINUA, ALTURA_FOLHA, LARGURA_FOLHA, MARGEM_VERTICAL_FOLHA, + MARGEM_HORIZONTAL_FOLHA, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DESCRICAO, TABLENAME + "." + DESCRICAO_PLAIN, TABLENAME + "." + ALTURA, TABLENAME + "." + LARGURA, TABLENAME + "." + MARGEM_ESQUERDA, TABLENAME + "." + MARGEM_CIMA, TABLENAME + "." + COLUNAS, + TABLENAME + "." + LINHAS, TABLENAME + "." + CONTINUA, TABLENAME + "." + ALTURA_FOLHA, TABLENAME + "." + LARGURA_FOLHA, TABLENAME + "." + MARGEM_VERTICAL_FOLHA, + TABLENAME + "." + MARGEM_HORIZONTAL_FOLHA, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DESCRICAO, DESCRICAO_PLAIN, ALTURA, LARGURA, MARGEM_ESQUERDA, MARGEM_CIMA, + COLUNAS, LINHAS, CONTINUA, ALTURA_FOLHA, LARGURA_FOLHA, MARGEM_VERTICAL_FOLHA, + MARGEM_HORIZONTAL_FOLHA, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DESCRICAO, DESCRICAO_PLAIN, ALTURA, LARGURA, MARGEM_ESQUERDA, MARGEM_CIMA, + COLUNAS, LINHAS, CONTINUA, ALTURA_FOLHA, LARGURA_FOLHA, MARGEM_VERTICAL_FOLHA, + MARGEM_HORIZONTAL_FOLHA, }; + + private Integer id; + private String descricao; + private String descricao_plain; + private Float altura; + private Float largura; + private Float margem_esquerda; + private Float margem_cima; + private Integer colunas; + private Integer linhas; + private String continua; + private Float altura_folha; + private Float largura_folha; + private Float margem_vertical_folha; + private Float margem_horizontal_folha; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public Etiquetas() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false, false, false, false, + false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public String getDescricao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRICAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.descricao; + } + + public void setDescricao( String descricao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRICAO, descricao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.descricao = descricao; + LAZY_LOADED_OBJECTS.put( DESCRICAO, Boolean.TRUE ); + } + + public String getDescricao_plain() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRICAO_PLAIN ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.descricao_plain; + } + + public void setDescricao_plain( String descricao_plain ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRICAO_PLAIN, descricao_plain ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.descricao_plain = descricao_plain; + LAZY_LOADED_OBJECTS.put( DESCRICAO_PLAIN, Boolean.TRUE ); + } + + public Float getAltura() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ALTURA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.altura; + } + + public void setAltura( Float altura ) + { + try + { + setLockedForRefresh( true ); + preProcess( ALTURA, altura ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.altura = altura; + LAZY_LOADED_OBJECTS.put( ALTURA, Boolean.TRUE ); + } + + public Float getLargura() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( LARGURA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.largura; + } + + public void setLargura( Float largura ) + { + try + { + setLockedForRefresh( true ); + preProcess( LARGURA, largura ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.largura = largura; + LAZY_LOADED_OBJECTS.put( LARGURA, Boolean.TRUE ); + } + + public Float getMargem_esquerda() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MARGEM_ESQUERDA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.margem_esquerda; + } + + public void setMargem_esquerda( Float margem_esquerda ) + { + try + { + setLockedForRefresh( true ); + preProcess( MARGEM_ESQUERDA, margem_esquerda ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.margem_esquerda = margem_esquerda; + LAZY_LOADED_OBJECTS.put( MARGEM_ESQUERDA, Boolean.TRUE ); + } + + public Float getMargem_cima() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MARGEM_CIMA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.margem_cima; + } + + public void setMargem_cima( Float margem_cima ) + { + try + { + setLockedForRefresh( true ); + preProcess( MARGEM_CIMA, margem_cima ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.margem_cima = margem_cima; + LAZY_LOADED_OBJECTS.put( MARGEM_CIMA, Boolean.TRUE ); + } + + public Integer getColunas() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( COLUNAS ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.colunas; + } + + public void setColunas( Integer colunas ) + { + try + { + setLockedForRefresh( true ); + preProcess( COLUNAS, colunas ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.colunas = colunas; + LAZY_LOADED_OBJECTS.put( COLUNAS, Boolean.TRUE ); + } + + public Integer getLinhas() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( LINHAS ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.linhas; + } + + public void setLinhas( Integer linhas ) + { + try + { + setLockedForRefresh( true ); + preProcess( LINHAS, linhas ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.linhas = linhas; + LAZY_LOADED_OBJECTS.put( LINHAS, Boolean.TRUE ); + } + + public String getContinua() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CONTINUA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.continua; + } + + public void setContinua( String continua ) + { + try + { + setLockedForRefresh( true ); + preProcess( CONTINUA, continua ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.continua = continua; + LAZY_LOADED_OBJECTS.put( CONTINUA, Boolean.TRUE ); + } + + public Float getAltura_folha() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ALTURA_FOLHA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.altura_folha; + } + + public void setAltura_folha( Float altura_folha ) + { + try + { + setLockedForRefresh( true ); + preProcess( ALTURA_FOLHA, altura_folha ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.altura_folha = altura_folha; + LAZY_LOADED_OBJECTS.put( ALTURA_FOLHA, Boolean.TRUE ); + } + + public Float getLargura_folha() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( LARGURA_FOLHA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.largura_folha; + } + + public void setLargura_folha( Float largura_folha ) + { + try + { + setLockedForRefresh( true ); + preProcess( LARGURA_FOLHA, largura_folha ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.largura_folha = largura_folha; + LAZY_LOADED_OBJECTS.put( LARGURA_FOLHA, Boolean.TRUE ); + } + + public Float getMargem_vertical_folha() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MARGEM_VERTICAL_FOLHA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.margem_vertical_folha; + } + + public void setMargem_vertical_folha( Float margem_vertical_folha ) + { + try + { + setLockedForRefresh( true ); + preProcess( MARGEM_VERTICAL_FOLHA, margem_vertical_folha ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.margem_vertical_folha = margem_vertical_folha; + LAZY_LOADED_OBJECTS.put( MARGEM_VERTICAL_FOLHA, Boolean.TRUE ); + } + + public Float getMargem_horizontal_folha() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MARGEM_HORIZONTAL_FOLHA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.margem_horizontal_folha; + } + + public void setMargem_horizontal_folha( Float margem_horizontal_folha ) + { + try + { + setLockedForRefresh( true ); + preProcess( MARGEM_HORIZONTAL_FOLHA, margem_horizontal_folha ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.margem_horizontal_folha = margem_horizontal_folha; + LAZY_LOADED_OBJECTS.put( MARGEM_HORIZONTAL_FOLHA, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Etiquetas.ID_INDEX: + value = getId(); + break; + case Etiquetas.DESCRICAO_INDEX: + value = getDescricao(); + break; + case Etiquetas.DESCRICAO_PLAIN_INDEX: + value = getDescricao_plain(); + break; + case Etiquetas.ALTURA_INDEX: + value = getAltura(); + break; + case Etiquetas.LARGURA_INDEX: + value = getLargura(); + break; + case Etiquetas.MARGEM_ESQUERDA_INDEX: + value = getMargem_esquerda(); + break; + case Etiquetas.MARGEM_CIMA_INDEX: + value = getMargem_cima(); + break; + case Etiquetas.COLUNAS_INDEX: + value = getColunas(); + break; + case Etiquetas.LINHAS_INDEX: + value = getLinhas(); + break; + case Etiquetas.CONTINUA_INDEX: + value = getContinua(); + break; + case Etiquetas.ALTURA_FOLHA_INDEX: + value = getAltura_folha(); + break; + case Etiquetas.LARGURA_FOLHA_INDEX: + value = getLargura_folha(); + break; + case Etiquetas.MARGEM_VERTICAL_FOLHA_INDEX: + value = getMargem_vertical_folha(); + break; + case Etiquetas.MARGEM_HORIZONTAL_FOLHA_INDEX: + value = getMargem_horizontal_folha(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Etiquetas.ID_INDEX: + value = this.id; + break; + case Etiquetas.DESCRICAO_INDEX: + value = this.descricao; + break; + case Etiquetas.DESCRICAO_PLAIN_INDEX: + value = this.descricao_plain; + break; + case Etiquetas.ALTURA_INDEX: + value = this.altura; + break; + case Etiquetas.LARGURA_INDEX: + value = this.largura; + break; + case Etiquetas.MARGEM_ESQUERDA_INDEX: + value = this.margem_esquerda; + break; + case Etiquetas.MARGEM_CIMA_INDEX: + value = this.margem_cima; + break; + case Etiquetas.COLUNAS_INDEX: + value = this.colunas; + break; + case Etiquetas.LINHAS_INDEX: + value = this.linhas; + break; + case Etiquetas.CONTINUA_INDEX: + value = this.continua; + break; + case Etiquetas.ALTURA_FOLHA_INDEX: + value = this.altura_folha; + break; + case Etiquetas.LARGURA_FOLHA_INDEX: + value = this.largura_folha; + break; + case Etiquetas.MARGEM_VERTICAL_FOLHA_INDEX: + value = this.margem_vertical_folha; + break; + case Etiquetas.MARGEM_HORIZONTAL_FOLHA_INDEX: + value = this.margem_horizontal_folha; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Etiquetas.ID_INDEX: + setId( ( Integer ) value ); + break; + case Etiquetas.DESCRICAO_INDEX: + setDescricao( ( String ) value ); + break; + case Etiquetas.DESCRICAO_PLAIN_INDEX: + setDescricao_plain( ( String ) value ); + break; + case Etiquetas.ALTURA_INDEX: + setAltura( ( Float ) value ); + break; + case Etiquetas.LARGURA_INDEX: + setLargura( ( Float ) value ); + break; + case Etiquetas.MARGEM_ESQUERDA_INDEX: + setMargem_esquerda( ( Float ) value ); + break; + case Etiquetas.MARGEM_CIMA_INDEX: + setMargem_cima( ( Float ) value ); + break; + case Etiquetas.COLUNAS_INDEX: + setColunas( ( Integer ) value ); + break; + case Etiquetas.LINHAS_INDEX: + setLinhas( ( Integer ) value ); + break; + case Etiquetas.CONTINUA_INDEX: + setContinua( ( String ) value ); + break; + case Etiquetas.ALTURA_FOLHA_INDEX: + setAltura_folha( ( Float ) value ); + break; + case Etiquetas.LARGURA_FOLHA_INDEX: + setLargura_folha( ( Float ) value ); + break; + case Etiquetas.MARGEM_VERTICAL_FOLHA_INDEX: + setMargem_vertical_folha( ( Float ) value ); + break; + case Etiquetas.MARGEM_HORIZONTAL_FOLHA_INDEX: + setMargem_horizontal_folha( ( Float ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Etiquetas.ID_INDEX: + this.id = ( Integer ) value; + break; + case Etiquetas.DESCRICAO_INDEX: + this.descricao = ( String ) value; + break; + case Etiquetas.DESCRICAO_PLAIN_INDEX: + this.descricao_plain = ( String ) value; + break; + case Etiquetas.ALTURA_INDEX: + this.altura = ( Float ) value; + break; + case Etiquetas.LARGURA_INDEX: + this.largura = ( Float ) value; + break; + case Etiquetas.MARGEM_ESQUERDA_INDEX: + this.margem_esquerda = ( Float ) value; + break; + case Etiquetas.MARGEM_CIMA_INDEX: + this.margem_cima = ( Float ) value; + break; + case Etiquetas.COLUNAS_INDEX: + this.colunas = ( Integer ) value; + break; + case Etiquetas.LINHAS_INDEX: + this.linhas = ( Integer ) value; + break; + case Etiquetas.CONTINUA_INDEX: + this.continua = ( String ) value; + break; + case Etiquetas.ALTURA_FOLHA_INDEX: + this.altura_folha = ( Float ) value; + break; + case Etiquetas.LARGURA_FOLHA_INDEX: + this.largura_folha = ( Float ) value; + break; + case Etiquetas.MARGEM_VERTICAL_FOLHA_INDEX: + this.margem_vertical_folha = ( Float ) value; + break; + case Etiquetas.MARGEM_HORIZONTAL_FOLHA_INDEX: + this.margem_horizontal_folha = ( Float ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case Etiquetas.ID_INDEX: + theClass = Integer.class; + break; + case Etiquetas.DESCRICAO_INDEX: + theClass = String.class; + break; + case Etiquetas.DESCRICAO_PLAIN_INDEX: + theClass = String.class; + break; + case Etiquetas.ALTURA_INDEX: + theClass = Float.class; + break; + case Etiquetas.LARGURA_INDEX: + theClass = Float.class; + break; + case Etiquetas.MARGEM_ESQUERDA_INDEX: + theClass = Float.class; + break; + case Etiquetas.MARGEM_CIMA_INDEX: + theClass = Float.class; + break; + case Etiquetas.COLUNAS_INDEX: + theClass = Integer.class; + break; + case Etiquetas.LINHAS_INDEX: + theClass = Integer.class; + break; + case Etiquetas.CONTINUA_INDEX: + theClass = String.class; + break; + case Etiquetas.ALTURA_FOLHA_INDEX: + theClass = Float.class; + break; + case Etiquetas.LARGURA_FOLHA_INDEX: + theClass = Float.class; + break; + case Etiquetas.MARGEM_VERTICAL_FOLHA_INDEX: + theClass = Float.class; + break; + case Etiquetas.MARGEM_HORIZONTAL_FOLHA_INDEX: + theClass = Float.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : Etiquetas._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, Etiquetas.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Exames.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Exames.java new file mode 100644 index 00000000..bcdacc90 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Exames.java @@ -0,0 +1,1219 @@ +/* +* Exames.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class Exames extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( Exames.ID, Exames.ID_INDEX ); + FIELD_INDEXES.put( Exames.ID_FULL, Exames.ID_INDEX ); + FIELD_INDEXES.put( Exames.DATA, Exames.DATA_INDEX ); + FIELD_INDEXES.put( Exames.DATA_FULL, Exames.DATA_INDEX ); + FIELD_INDEXES.put( Exames.TIPO, Exames.TIPO_INDEX ); + FIELD_INDEXES.put( Exames.TIPO_FULL, Exames.TIPO_INDEX ); + FIELD_INDEXES.put( Exames.OCASIONAL, Exames.OCASIONAL_INDEX ); + FIELD_INDEXES.put( Exames.OCASIONAL_FULL, Exames.OCASIONAL_INDEX ); + FIELD_INDEXES.put( Exames.OUTRO_TIPO, Exames.OUTRO_TIPO_INDEX ); + FIELD_INDEXES.put( Exames.OUTRO_TIPO_FULL, Exames.OUTRO_TIPO_INDEX ); + FIELD_INDEXES.put( Exames.RESULTADO, Exames.RESULTADO_INDEX ); + FIELD_INDEXES.put( Exames.RESULTADO_FULL, Exames.RESULTADO_INDEX ); + FIELD_INDEXES.put( Exames.OUTRA_FUNCAO_1, Exames.OUTRA_FUNCAO_1_INDEX ); + FIELD_INDEXES.put( Exames.OUTRA_FUNCAO_1_FULL, Exames.OUTRA_FUNCAO_1_INDEX ); + FIELD_INDEXES.put( Exames.OUTRA_FUNCAO_2, Exames.OUTRA_FUNCAO_2_INDEX ); + FIELD_INDEXES.put( Exames.OUTRA_FUNCAO_2_FULL, Exames.OUTRA_FUNCAO_2_INDEX ); + FIELD_INDEXES.put( Exames.OUTRA_FUNCAO_3, Exames.OUTRA_FUNCAO_3_INDEX ); + FIELD_INDEXES.put( Exames.OUTRA_FUNCAO_3_FULL, Exames.OUTRA_FUNCAO_3_INDEX ); + FIELD_INDEXES.put( Exames.OUTRA_FUNCAO_4, Exames.OUTRA_FUNCAO_4_INDEX ); + FIELD_INDEXES.put( Exames.OUTRA_FUNCAO_4_FULL, Exames.OUTRA_FUNCAO_4_INDEX ); + FIELD_INDEXES.put( Exames.PROXIMO_EXAME, Exames.PROXIMO_EXAME_INDEX ); + FIELD_INDEXES.put( Exames.PROXIMO_EXAME_FULL, Exames.PROXIMO_EXAME_INDEX ); + FIELD_INDEXES.put( Exames.OUTRAS_RECOMENDACOES, Exames.OUTRAS_RECOMENDACOES_INDEX ); + FIELD_INDEXES.put( Exames.OUTRAS_RECOMENDACOES_FULL, Exames.OUTRAS_RECOMENDACOES_INDEX ); + FIELD_INDEXES.put( Exames.INACTIVO, Exames.INACTIVO_INDEX ); + FIELD_INDEXES.put( Exames.INACTIVO_FULL, Exames.INACTIVO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Exames.CLASS_IDENTIFIER, Exames.TRABALHADOR_ID, Exames.TO_TRABALHADOR_ID ); + FIELD_INDEXES.put( Exames.TRABALHADOR_ID, Exames.TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( Exames.TRABALHADOR_ID_FULL, Exames.TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( Exames.TO_TRABALHADOR_ID, Exames.TO_TRABALHADOR_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Exames.CLASS_IDENTIFIER, Exames.MEDICO_ID, Exames.TO_MEDICO_ID ); + FIELD_INDEXES.put( Exames.MEDICO_ID, Exames.MEDICO_ID_INDEX ); + FIELD_INDEXES.put( Exames.MEDICO_ID_FULL, Exames.MEDICO_ID_INDEX ); + FIELD_INDEXES.put( Exames.TO_MEDICO_ID, Exames.TO_MEDICO_ID_INDEX ); + FIELD_INDEXES.put( Exames.PDF, Exames.PDF_INDEX ); + FIELD_INDEXES.put( Exames.PDF_FULL, Exames.PDF_INDEX ); + FIELD_INDEXES.put( Exames.FO, Exames.FO_INDEX ); + FIELD_INDEXES.put( Exames.FO_FULL, Exames.FO_INDEX ); + FIELD_INDEXES.put( Exames.IMPRESSO_STAMP, Exames.IMPRESSO_STAMP_INDEX ); + FIELD_INDEXES.put( Exames.IMPRESSO_STAMP_FULL, Exames.IMPRESSO_STAMP_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeytrabalhador_idTotrabalhadores = + new com.evolute.entity.ForeignKey( Exames.class, Exames.TRABALHADOR_ID, siprp.data.outer.TrabalhadoresData.class, siprp.data.outer.TrabalhadoresData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeymedico_idTomedicos = + new com.evolute.entity.ForeignKey( Exames.class, Exames.MEDICO_ID, siprp.data.outer.MedicosData.class, siprp.data.outer.MedicosData.ID ); + + public static final String TABLENAME = "exames"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.exames"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "exames.id"; + public static final int ID_INDEX = 0; + public static final String DATA = "data"; + public static final String DATA_FULL = "exames.data"; + public static final int DATA_INDEX = 1; + public static final String TIPO = "tipo"; + public static final String TIPO_FULL = "exames.tipo"; + public static final int TIPO_INDEX = 2; + public static final String OCASIONAL = "ocasional"; + public static final String OCASIONAL_FULL = "exames.ocasional"; + public static final int OCASIONAL_INDEX = 3; + public static final String OUTRO_TIPO = "outro_tipo"; + public static final String OUTRO_TIPO_FULL = "exames.outro_tipo"; + public static final int OUTRO_TIPO_INDEX = 4; + public static final String RESULTADO = "resultado"; + public static final String RESULTADO_FULL = "exames.resultado"; + public static final int RESULTADO_INDEX = 5; + public static final String OUTRA_FUNCAO_1 = "outra_funcao_1"; + public static final String OUTRA_FUNCAO_1_FULL = "exames.outra_funcao_1"; + public static final int OUTRA_FUNCAO_1_INDEX = 6; + public static final String OUTRA_FUNCAO_2 = "outra_funcao_2"; + public static final String OUTRA_FUNCAO_2_FULL = "exames.outra_funcao_2"; + public static final int OUTRA_FUNCAO_2_INDEX = 7; + public static final String OUTRA_FUNCAO_3 = "outra_funcao_3"; + public static final String OUTRA_FUNCAO_3_FULL = "exames.outra_funcao_3"; + public static final int OUTRA_FUNCAO_3_INDEX = 8; + public static final String OUTRA_FUNCAO_4 = "outra_funcao_4"; + public static final String OUTRA_FUNCAO_4_FULL = "exames.outra_funcao_4"; + public static final int OUTRA_FUNCAO_4_INDEX = 9; + public static final String PROXIMO_EXAME = "proximo_exame"; + public static final String PROXIMO_EXAME_FULL = "exames.proximo_exame"; + public static final int PROXIMO_EXAME_INDEX = 10; + public static final String OUTRAS_RECOMENDACOES = "outras_recomendacoes"; + public static final String OUTRAS_RECOMENDACOES_FULL = "exames.outras_recomendacoes"; + public static final int OUTRAS_RECOMENDACOES_INDEX = 11; + public static final String INACTIVO = "inactivo"; + public static final String INACTIVO_FULL = "exames.inactivo"; + public static final int INACTIVO_INDEX = 12; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String TRABALHADOR_ID_FULL = "exames.trabalhador_id"; + public static final int TRABALHADOR_ID_INDEX = 13; + public static final String TO_TRABALHADOR_ID = "to_trabalhador_id"; + public static final int TO_TRABALHADOR_ID_INDEX = 14; + public static final String MEDICO_ID = "medico_id"; + public static final String MEDICO_ID_FULL = "exames.medico_id"; + public static final int MEDICO_ID_INDEX = 15; + public static final String TO_MEDICO_ID = "to_medico_id"; + public static final int TO_MEDICO_ID_INDEX = 16; + public static final String PDF = "pdf"; + public static final String PDF_FULL = "exames.pdf"; + public static final int PDF_INDEX = 17; + public static final String FO = "fo"; + public static final String FO_FULL = "exames.fo"; + public static final int FO_INDEX = 18; + public static final String IMPRESSO_STAMP = "impresso_stamp"; + public static final String IMPRESSO_STAMP_FULL = "exames.impresso_stamp"; + public static final int IMPRESSO_STAMP_INDEX = 19; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, TIPO, OCASIONAL, OUTRO_TIPO, RESULTADO, OUTRA_FUNCAO_1, OUTRA_FUNCAO_2, + OUTRA_FUNCAO_3, OUTRA_FUNCAO_4, PROXIMO_EXAME, OUTRAS_RECOMENDACOES, INACTIVO, + TRABALHADOR_ID, TO_TRABALHADOR_ID, MEDICO_ID, TO_MEDICO_ID, PDF, FO, + IMPRESSO_STAMP, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DATA, TABLENAME + "." + TIPO, TABLENAME + "." + OCASIONAL, TABLENAME + "." + OUTRO_TIPO, TABLENAME + "." + RESULTADO, TABLENAME + "." + OUTRA_FUNCAO_1, TABLENAME + "." + OUTRA_FUNCAO_2, + TABLENAME + "." + OUTRA_FUNCAO_3, TABLENAME + "." + OUTRA_FUNCAO_4, TABLENAME + "." + PROXIMO_EXAME, TABLENAME + "." + OUTRAS_RECOMENDACOES, TABLENAME + "." + INACTIVO, + TABLENAME + "." + TRABALHADOR_ID, TABLENAME + "." + TO_TRABALHADOR_ID, TABLENAME + "." + MEDICO_ID, TABLENAME + "." + TO_MEDICO_ID, TABLENAME + "." + PDF, TABLENAME + "." + FO, + TABLENAME + "." + IMPRESSO_STAMP, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DATA, TIPO, OCASIONAL, OUTRO_TIPO, RESULTADO, OUTRA_FUNCAO_1, OUTRA_FUNCAO_2, + OUTRA_FUNCAO_3, OUTRA_FUNCAO_4, PROXIMO_EXAME, OUTRAS_RECOMENDACOES, INACTIVO, + TRABALHADOR_ID, MEDICO_ID, PDF, FO, IMPRESSO_STAMP, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DATA, TIPO, OCASIONAL, OUTRO_TIPO, RESULTADO, OUTRA_FUNCAO_1, OUTRA_FUNCAO_2, + OUTRA_FUNCAO_3, OUTRA_FUNCAO_4, PROXIMO_EXAME, OUTRAS_RECOMENDACOES, INACTIVO, + TRABALHADOR_ID, MEDICO_ID, IMPRESSO_STAMP, }; + + private Integer id; + private java.util.Date data; + private Integer tipo; + private Integer ocasional; + private String outro_tipo; + private Integer resultado; + private String outra_funcao_1; + private String outra_funcao_2; + private String outra_funcao_3; + private String outra_funcao_4; + private java.util.Date proximo_exame; + private String outras_recomendacoes; + private String inactivo; + private Integer trabalhador_id; + private siprp.data.outer.TrabalhadoresData to_trabalhador_id; + private Integer medico_id; + private siprp.data.outer.MedicosData to_medico_id; + private byte[] pdf; + private byte[] fo; + private java.sql.Timestamp impresso_stamp; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public Exames() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromTrabalhadoresFichasAptidao_exame_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresFichasAptidaoData.class , getPrimaryKey().getMap().get("id"), "exame_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.Date getData() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data; + } + + public void setData( java.util.Date data ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA, data ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data = data; + LAZY_LOADED_OBJECTS.put( DATA, Boolean.TRUE ); + } + + public Integer getTipo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TIPO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.tipo; + } + + public void setTipo( Integer tipo ) + { + try + { + setLockedForRefresh( true ); + preProcess( TIPO, tipo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.tipo = tipo; + LAZY_LOADED_OBJECTS.put( TIPO, Boolean.TRUE ); + } + + public Integer getOcasional() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( OCASIONAL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.ocasional; + } + + public void setOcasional( Integer ocasional ) + { + try + { + setLockedForRefresh( true ); + preProcess( OCASIONAL, ocasional ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.ocasional = ocasional; + LAZY_LOADED_OBJECTS.put( OCASIONAL, Boolean.TRUE ); + } + + public String getOutro_tipo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( OUTRO_TIPO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.outro_tipo; + } + + public void setOutro_tipo( String outro_tipo ) + { + try + { + setLockedForRefresh( true ); + preProcess( OUTRO_TIPO, outro_tipo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.outro_tipo = outro_tipo; + LAZY_LOADED_OBJECTS.put( OUTRO_TIPO, Boolean.TRUE ); + } + + public Integer getResultado() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( RESULTADO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.resultado; + } + + public void setResultado( Integer resultado ) + { + try + { + setLockedForRefresh( true ); + preProcess( RESULTADO, resultado ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.resultado = resultado; + LAZY_LOADED_OBJECTS.put( RESULTADO, Boolean.TRUE ); + } + + public String getOutra_funcao_1() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( OUTRA_FUNCAO_1 ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.outra_funcao_1; + } + + public void setOutra_funcao_1( String outra_funcao_1 ) + { + try + { + setLockedForRefresh( true ); + preProcess( OUTRA_FUNCAO_1, outra_funcao_1 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.outra_funcao_1 = outra_funcao_1; + LAZY_LOADED_OBJECTS.put( OUTRA_FUNCAO_1, Boolean.TRUE ); + } + + public String getOutra_funcao_2() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( OUTRA_FUNCAO_2 ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.outra_funcao_2; + } + + public void setOutra_funcao_2( String outra_funcao_2 ) + { + try + { + setLockedForRefresh( true ); + preProcess( OUTRA_FUNCAO_2, outra_funcao_2 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.outra_funcao_2 = outra_funcao_2; + LAZY_LOADED_OBJECTS.put( OUTRA_FUNCAO_2, Boolean.TRUE ); + } + + public String getOutra_funcao_3() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( OUTRA_FUNCAO_3 ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.outra_funcao_3; + } + + public void setOutra_funcao_3( String outra_funcao_3 ) + { + try + { + setLockedForRefresh( true ); + preProcess( OUTRA_FUNCAO_3, outra_funcao_3 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.outra_funcao_3 = outra_funcao_3; + LAZY_LOADED_OBJECTS.put( OUTRA_FUNCAO_3, Boolean.TRUE ); + } + + public String getOutra_funcao_4() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( OUTRA_FUNCAO_4 ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.outra_funcao_4; + } + + public void setOutra_funcao_4( String outra_funcao_4 ) + { + try + { + setLockedForRefresh( true ); + preProcess( OUTRA_FUNCAO_4, outra_funcao_4 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.outra_funcao_4 = outra_funcao_4; + LAZY_LOADED_OBJECTS.put( OUTRA_FUNCAO_4, Boolean.TRUE ); + } + + public java.util.Date getProximo_exame() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PROXIMO_EXAME ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.proximo_exame; + } + + public void setProximo_exame( java.util.Date proximo_exame ) + { + try + { + setLockedForRefresh( true ); + preProcess( PROXIMO_EXAME, proximo_exame ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.proximo_exame = proximo_exame; + LAZY_LOADED_OBJECTS.put( PROXIMO_EXAME, Boolean.TRUE ); + } + + public String getOutras_recomendacoes() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( OUTRAS_RECOMENDACOES ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.outras_recomendacoes; + } + + public void setOutras_recomendacoes( String outras_recomendacoes ) + { + try + { + setLockedForRefresh( true ); + preProcess( OUTRAS_RECOMENDACOES, outras_recomendacoes ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.outras_recomendacoes = outras_recomendacoes; + LAZY_LOADED_OBJECTS.put( OUTRAS_RECOMENDACOES, Boolean.TRUE ); + } + + public String getInactivo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( INACTIVO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.inactivo; + } + + public void setInactivo( String inactivo ) + { + try + { + setLockedForRefresh( true ); + preProcess( INACTIVO, inactivo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.inactivo = inactivo; + LAZY_LOADED_OBJECTS.put( INACTIVO, Boolean.TRUE ); + } + + public Integer getTrabalhador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TRABALHADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.trabalhador_id; + } + + public void setTrabalhador_id( Integer trabalhador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TRABALHADOR_ID, trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.trabalhador_id = trabalhador_id; + LAZY_LOADED_OBJECTS.put( TRABALHADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresData toTrabalhador_id() + { + try + { + prepare( TO_TRABALHADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_trabalhador_id; + } + + public void setToTrabalhador_id( siprp.data.outer.TrabalhadoresData to_trabalhador_id ) + { + try + { + preProcess( TO_TRABALHADOR_ID, to_trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_trabalhador_id = to_trabalhador_id; + } + + public Integer getMedico_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MEDICO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.medico_id; + } + + public void setMedico_id( Integer medico_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( MEDICO_ID, medico_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.medico_id = medico_id; + LAZY_LOADED_OBJECTS.put( MEDICO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.MedicosData toMedico_id() + { + try + { + prepare( TO_MEDICO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_medico_id; + } + + public void setToMedico_id( siprp.data.outer.MedicosData to_medico_id ) + { + try + { + preProcess( TO_MEDICO_ID, to_medico_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_medico_id = to_medico_id; + } + + public byte[] getPdf() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PDF ); + Boolean isLazyLoaded = isPropertyLoaded( PDF ); + if ( ! isLazyLoaded ) + { + this.pdf = ( byte[] ) getProvider().loadFieldFromDatabase( PDF, this ); + LAZY_LOADED_OBJECTS.put( PDF, Boolean.TRUE ); + } + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.pdf; + } + + public void setPdf( byte[] pdf ) + { + try + { + setLockedForRefresh( true ); + preProcess( PDF, pdf ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.pdf = pdf; + LAZY_LOADED_OBJECTS.put( PDF, Boolean.TRUE ); + } + + public byte[] getFo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( FO ); + Boolean isLazyLoaded = isPropertyLoaded( FO ); + if ( ! isLazyLoaded ) + { + this.fo = ( byte[] ) getProvider().loadFieldFromDatabase( FO, this ); + LAZY_LOADED_OBJECTS.put( FO, Boolean.TRUE ); + } + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.fo; + } + + public void setFo( byte[] fo ) + { + try + { + setLockedForRefresh( true ); + preProcess( FO, fo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.fo = fo; + LAZY_LOADED_OBJECTS.put( FO, Boolean.TRUE ); + } + + public java.sql.Timestamp getImpresso_stamp() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( IMPRESSO_STAMP ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.impresso_stamp; + } + + public void setImpresso_stamp( java.sql.Timestamp impresso_stamp ) + { + try + { + setLockedForRefresh( true ); + preProcess( IMPRESSO_STAMP, impresso_stamp ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.impresso_stamp = impresso_stamp; + LAZY_LOADED_OBJECTS.put( IMPRESSO_STAMP, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Exames.ID_INDEX: + value = getId(); + break; + case Exames.DATA_INDEX: + value = getData(); + break; + case Exames.TIPO_INDEX: + value = getTipo(); + break; + case Exames.OCASIONAL_INDEX: + value = getOcasional(); + break; + case Exames.OUTRO_TIPO_INDEX: + value = getOutro_tipo(); + break; + case Exames.RESULTADO_INDEX: + value = getResultado(); + break; + case Exames.OUTRA_FUNCAO_1_INDEX: + value = getOutra_funcao_1(); + break; + case Exames.OUTRA_FUNCAO_2_INDEX: + value = getOutra_funcao_2(); + break; + case Exames.OUTRA_FUNCAO_3_INDEX: + value = getOutra_funcao_3(); + break; + case Exames.OUTRA_FUNCAO_4_INDEX: + value = getOutra_funcao_4(); + break; + case Exames.PROXIMO_EXAME_INDEX: + value = getProximo_exame(); + break; + case Exames.OUTRAS_RECOMENDACOES_INDEX: + value = getOutras_recomendacoes(); + break; + case Exames.INACTIVO_INDEX: + value = getInactivo(); + break; + case Exames.TRABALHADOR_ID_INDEX: + value = getTrabalhador_id(); + break; + case Exames.TO_TRABALHADOR_ID_INDEX: + value = toTrabalhador_id(); + break; + case Exames.MEDICO_ID_INDEX: + value = getMedico_id(); + break; + case Exames.TO_MEDICO_ID_INDEX: + value = toMedico_id(); + break; + case Exames.PDF_INDEX: + value = getPdf(); + break; + case Exames.FO_INDEX: + value = getFo(); + break; + case Exames.IMPRESSO_STAMP_INDEX: + value = getImpresso_stamp(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Exames.ID_INDEX: + value = this.id; + break; + case Exames.DATA_INDEX: + value = this.data; + break; + case Exames.TIPO_INDEX: + value = this.tipo; + break; + case Exames.OCASIONAL_INDEX: + value = this.ocasional; + break; + case Exames.OUTRO_TIPO_INDEX: + value = this.outro_tipo; + break; + case Exames.RESULTADO_INDEX: + value = this.resultado; + break; + case Exames.OUTRA_FUNCAO_1_INDEX: + value = this.outra_funcao_1; + break; + case Exames.OUTRA_FUNCAO_2_INDEX: + value = this.outra_funcao_2; + break; + case Exames.OUTRA_FUNCAO_3_INDEX: + value = this.outra_funcao_3; + break; + case Exames.OUTRA_FUNCAO_4_INDEX: + value = this.outra_funcao_4; + break; + case Exames.PROXIMO_EXAME_INDEX: + value = this.proximo_exame; + break; + case Exames.OUTRAS_RECOMENDACOES_INDEX: + value = this.outras_recomendacoes; + break; + case Exames.INACTIVO_INDEX: + value = this.inactivo; + break; + case Exames.TRABALHADOR_ID_INDEX: + value = this.trabalhador_id; + break; + case Exames.TO_TRABALHADOR_ID_INDEX: + value = this.to_trabalhador_id; + break; + case Exames.MEDICO_ID_INDEX: + value = this.medico_id; + break; + case Exames.TO_MEDICO_ID_INDEX: + value = this.to_medico_id; + break; + case Exames.PDF_INDEX: + value = this.pdf; + break; + case Exames.FO_INDEX: + value = this.fo; + break; + case Exames.IMPRESSO_STAMP_INDEX: + value = this.impresso_stamp; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Exames.ID_INDEX: + setId( ( Integer ) value ); + break; + case Exames.DATA_INDEX: + setData( ( java.util.Date ) value ); + break; + case Exames.TIPO_INDEX: + setTipo( ( Integer ) value ); + break; + case Exames.OCASIONAL_INDEX: + setOcasional( ( Integer ) value ); + break; + case Exames.OUTRO_TIPO_INDEX: + setOutro_tipo( ( String ) value ); + break; + case Exames.RESULTADO_INDEX: + setResultado( ( Integer ) value ); + break; + case Exames.OUTRA_FUNCAO_1_INDEX: + setOutra_funcao_1( ( String ) value ); + break; + case Exames.OUTRA_FUNCAO_2_INDEX: + setOutra_funcao_2( ( String ) value ); + break; + case Exames.OUTRA_FUNCAO_3_INDEX: + setOutra_funcao_3( ( String ) value ); + break; + case Exames.OUTRA_FUNCAO_4_INDEX: + setOutra_funcao_4( ( String ) value ); + break; + case Exames.PROXIMO_EXAME_INDEX: + setProximo_exame( ( java.util.Date ) value ); + break; + case Exames.OUTRAS_RECOMENDACOES_INDEX: + setOutras_recomendacoes( ( String ) value ); + break; + case Exames.INACTIVO_INDEX: + setInactivo( ( String ) value ); + break; + case Exames.TRABALHADOR_ID_INDEX: + setTrabalhador_id( ( Integer ) value ); + break; + case Exames.TO_TRABALHADOR_ID_INDEX: + setToTrabalhador_id( ( siprp.data.outer.TrabalhadoresData ) value ); + break; + case Exames.MEDICO_ID_INDEX: + setMedico_id( ( Integer ) value ); + break; + case Exames.TO_MEDICO_ID_INDEX: + setToMedico_id( ( siprp.data.outer.MedicosData ) value ); + break; + case Exames.PDF_INDEX: + setPdf( ( byte[] ) value ); + break; + case Exames.FO_INDEX: + setFo( ( byte[] ) value ); + break; + case Exames.IMPRESSO_STAMP_INDEX: + setImpresso_stamp( ( java.sql.Timestamp ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Exames.ID_INDEX: + this.id = ( Integer ) value; + break; + case Exames.DATA_INDEX: + this.data = ( java.util.Date ) value; + break; + case Exames.TIPO_INDEX: + this.tipo = ( Integer ) value; + break; + case Exames.OCASIONAL_INDEX: + this.ocasional = ( Integer ) value; + break; + case Exames.OUTRO_TIPO_INDEX: + this.outro_tipo = ( String ) value; + break; + case Exames.RESULTADO_INDEX: + this.resultado = ( Integer ) value; + break; + case Exames.OUTRA_FUNCAO_1_INDEX: + this.outra_funcao_1 = ( String ) value; + break; + case Exames.OUTRA_FUNCAO_2_INDEX: + this.outra_funcao_2 = ( String ) value; + break; + case Exames.OUTRA_FUNCAO_3_INDEX: + this.outra_funcao_3 = ( String ) value; + break; + case Exames.OUTRA_FUNCAO_4_INDEX: + this.outra_funcao_4 = ( String ) value; + break; + case Exames.PROXIMO_EXAME_INDEX: + this.proximo_exame = ( java.util.Date ) value; + break; + case Exames.OUTRAS_RECOMENDACOES_INDEX: + this.outras_recomendacoes = ( String ) value; + break; + case Exames.INACTIVO_INDEX: + this.inactivo = ( String ) value; + break; + case Exames.TRABALHADOR_ID_INDEX: + this.trabalhador_id = ( Integer ) value; + break; + case Exames.TO_TRABALHADOR_ID_INDEX: + this.to_trabalhador_id = ( siprp.data.outer.TrabalhadoresData ) value; + break; + case Exames.MEDICO_ID_INDEX: + this.medico_id = ( Integer ) value; + break; + case Exames.TO_MEDICO_ID_INDEX: + this.to_medico_id = ( siprp.data.outer.MedicosData ) value; + break; + case Exames.PDF_INDEX: + this.pdf = ( byte[] ) value; + break; + case Exames.FO_INDEX: + this.fo = ( byte[] ) value; + break; + case Exames.IMPRESSO_STAMP_INDEX: + this.impresso_stamp = ( java.sql.Timestamp ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case Exames.ID_INDEX: + theClass = Integer.class; + break; + case Exames.DATA_INDEX: + theClass = java.util.Date.class; + break; + case Exames.TIPO_INDEX: + theClass = Integer.class; + break; + case Exames.OCASIONAL_INDEX: + theClass = Integer.class; + break; + case Exames.OUTRO_TIPO_INDEX: + theClass = String.class; + break; + case Exames.RESULTADO_INDEX: + theClass = Integer.class; + break; + case Exames.OUTRA_FUNCAO_1_INDEX: + theClass = String.class; + break; + case Exames.OUTRA_FUNCAO_2_INDEX: + theClass = String.class; + break; + case Exames.OUTRA_FUNCAO_3_INDEX: + theClass = String.class; + break; + case Exames.OUTRA_FUNCAO_4_INDEX: + theClass = String.class; + break; + case Exames.PROXIMO_EXAME_INDEX: + theClass = java.util.Date.class; + break; + case Exames.OUTRAS_RECOMENDACOES_INDEX: + theClass = String.class; + break; + case Exames.INACTIVO_INDEX: + theClass = String.class; + break; + case Exames.TRABALHADOR_ID_INDEX: + theClass = Integer.class; + break; + case Exames.TO_TRABALHADOR_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresData.class; + break; + case Exames.MEDICO_ID_INDEX: + theClass = Integer.class; + break; + case Exames.TO_MEDICO_ID_INDEX: + theClass = siprp.data.outer.MedicosData.class; + break; + case Exames.PDF_INDEX: + theClass = byte[].class; + break; + case Exames.FO_INDEX: + theClass = byte[].class; + break; + case Exames.IMPRESSO_STAMP_INDEX: + theClass = java.sql.Timestamp.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : Exames._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, Exames.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + LAZY_LOADED_OBJECTS.put( PDF, Boolean.FALSE ); + LAZY_LOADED_OBJECTS.put( FO, Boolean.FALSE ); + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/ExamesPerfis.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/ExamesPerfis.java new file mode 100644 index 00000000..c0bf267d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/ExamesPerfis.java @@ -0,0 +1,430 @@ +/* +* ExamesPerfis.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class ExamesPerfis extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( ExamesPerfis.ID, ExamesPerfis.ID_INDEX ); + FIELD_INDEXES.put( ExamesPerfis.ID_FULL, ExamesPerfis.ID_INDEX ); + FIELD_INDEXES.put( ExamesPerfis.PERFIL, ExamesPerfis.PERFIL_INDEX ); + FIELD_INDEXES.put( ExamesPerfis.PERFIL_FULL, ExamesPerfis.PERFIL_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( ExamesPerfis.CLASS_IDENTIFIER, ExamesPerfis.TIPO, ExamesPerfis.TO_TIPO ); + FIELD_INDEXES.put( ExamesPerfis.TIPO, ExamesPerfis.TIPO_INDEX ); + FIELD_INDEXES.put( ExamesPerfis.TIPO_FULL, ExamesPerfis.TIPO_INDEX ); + FIELD_INDEXES.put( ExamesPerfis.TO_TIPO, ExamesPerfis.TO_TIPO_INDEX ); + FIELD_INDEXES.put( ExamesPerfis.MULTIPLICADOR, ExamesPerfis.MULTIPLICADOR_INDEX ); + FIELD_INDEXES.put( ExamesPerfis.MULTIPLICADOR_FULL, ExamesPerfis.MULTIPLICADOR_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeytipoTotipos_exames_comp = + new com.evolute.entity.ForeignKey( ExamesPerfis.class, ExamesPerfis.TIPO, siprp.data.outer.TiposExamesCompData.class, siprp.data.outer.TiposExamesCompData.ID ); + + public static final String TABLENAME = "exames_perfis"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.exames_perfis"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "exames_perfis.id"; + public static final int ID_INDEX = 0; + public static final String PERFIL = "perfil"; + public static final String PERFIL_FULL = "exames_perfis.perfil"; + public static final int PERFIL_INDEX = 1; + public static final String TIPO = "tipo"; + public static final String TIPO_FULL = "exames_perfis.tipo"; + public static final int TIPO_INDEX = 2; + public static final String TO_TIPO = "to_tipo"; + public static final int TO_TIPO_INDEX = 3; + public static final String MULTIPLICADOR = "multiplicador"; + public static final String MULTIPLICADOR_FULL = "exames_perfis.multiplicador"; + public static final int MULTIPLICADOR_INDEX = 4; + + public static final String FIELD_NAMES[] = new String[]{ + PERFIL, TIPO, TO_TIPO, MULTIPLICADOR, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + PERFIL, TABLENAME + "." + TIPO, TABLENAME + "." + TO_TIPO, TABLENAME + "." + MULTIPLICADOR, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, PERFIL, TIPO, MULTIPLICADOR, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, PERFIL, TIPO, MULTIPLICADOR, }; + + private Integer id; + private Integer perfil; + private Integer tipo; + private siprp.data.outer.TiposExamesCompData to_tipo; + private Integer multiplicador; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public ExamesPerfis() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public Integer getPerfil() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PERFIL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.perfil; + } + + public void setPerfil( Integer perfil ) + { + try + { + setLockedForRefresh( true ); + preProcess( PERFIL, perfil ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.perfil = perfil; + LAZY_LOADED_OBJECTS.put( PERFIL, Boolean.TRUE ); + } + + public Integer getTipo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TIPO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.tipo; + } + + public void setTipo( Integer tipo ) + { + try + { + setLockedForRefresh( true ); + preProcess( TIPO, tipo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.tipo = tipo; + LAZY_LOADED_OBJECTS.put( TIPO, Boolean.TRUE ); + } + + public siprp.data.outer.TiposExamesCompData toTipo() + { + try + { + prepare( TO_TIPO ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_tipo; + } + + public void setToTipo( siprp.data.outer.TiposExamesCompData to_tipo ) + { + try + { + preProcess( TO_TIPO, to_tipo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_tipo = to_tipo; + } + + public Integer getMultiplicador() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MULTIPLICADOR ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.multiplicador; + } + + public void setMultiplicador( Integer multiplicador ) + { + try + { + setLockedForRefresh( true ); + preProcess( MULTIPLICADOR, multiplicador ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.multiplicador = multiplicador; + LAZY_LOADED_OBJECTS.put( MULTIPLICADOR, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case ExamesPerfis.ID_INDEX: + value = getId(); + break; + case ExamesPerfis.PERFIL_INDEX: + value = getPerfil(); + break; + case ExamesPerfis.TIPO_INDEX: + value = getTipo(); + break; + case ExamesPerfis.TO_TIPO_INDEX: + value = toTipo(); + break; + case ExamesPerfis.MULTIPLICADOR_INDEX: + value = getMultiplicador(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case ExamesPerfis.ID_INDEX: + value = this.id; + break; + case ExamesPerfis.PERFIL_INDEX: + value = this.perfil; + break; + case ExamesPerfis.TIPO_INDEX: + value = this.tipo; + break; + case ExamesPerfis.TO_TIPO_INDEX: + value = this.to_tipo; + break; + case ExamesPerfis.MULTIPLICADOR_INDEX: + value = this.multiplicador; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case ExamesPerfis.ID_INDEX: + setId( ( Integer ) value ); + break; + case ExamesPerfis.PERFIL_INDEX: + setPerfil( ( Integer ) value ); + break; + case ExamesPerfis.TIPO_INDEX: + setTipo( ( Integer ) value ); + break; + case ExamesPerfis.TO_TIPO_INDEX: + setToTipo( ( siprp.data.outer.TiposExamesCompData ) value ); + break; + case ExamesPerfis.MULTIPLICADOR_INDEX: + setMultiplicador( ( Integer ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case ExamesPerfis.ID_INDEX: + this.id = ( Integer ) value; + break; + case ExamesPerfis.PERFIL_INDEX: + this.perfil = ( Integer ) value; + break; + case ExamesPerfis.TIPO_INDEX: + this.tipo = ( Integer ) value; + break; + case ExamesPerfis.TO_TIPO_INDEX: + this.to_tipo = ( siprp.data.outer.TiposExamesCompData ) value; + break; + case ExamesPerfis.MULTIPLICADOR_INDEX: + this.multiplicador = ( Integer ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case ExamesPerfis.ID_INDEX: + theClass = Integer.class; + break; + case ExamesPerfis.PERFIL_INDEX: + theClass = Integer.class; + break; + case ExamesPerfis.TIPO_INDEX: + theClass = Integer.class; + break; + case ExamesPerfis.TO_TIPO_INDEX: + theClass = siprp.data.outer.TiposExamesCompData.class; + break; + case ExamesPerfis.MULTIPLICADOR_INDEX: + theClass = Integer.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : ExamesPerfis._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, ExamesPerfis.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/ExamesPortaria.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/ExamesPortaria.java new file mode 100644 index 00000000..7e4799eb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/ExamesPortaria.java @@ -0,0 +1,330 @@ +/* +* ExamesPortaria.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class ExamesPortaria extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( ExamesPortaria.ID, ExamesPortaria.ID_INDEX ); + FIELD_INDEXES.put( ExamesPortaria.ID_FULL, ExamesPortaria.ID_INDEX ); + FIELD_INDEXES.put( ExamesPortaria.PORTARIA, ExamesPortaria.PORTARIA_INDEX ); + FIELD_INDEXES.put( ExamesPortaria.PORTARIA_FULL, ExamesPortaria.PORTARIA_INDEX ); + FIELD_INDEXES.put( ExamesPortaria.DATA_ENTRADA, ExamesPortaria.DATA_ENTRADA_INDEX ); + FIELD_INDEXES.put( ExamesPortaria.DATA_ENTRADA_FULL, ExamesPortaria.DATA_ENTRADA_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "exames_portaria"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.exames_portaria"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "exames_portaria.id"; + public static final int ID_INDEX = 0; + public static final String PORTARIA = "portaria"; + public static final String PORTARIA_FULL = "exames_portaria.portaria"; + public static final int PORTARIA_INDEX = 1; + public static final String DATA_ENTRADA = "data_entrada"; + public static final String DATA_ENTRADA_FULL = "exames_portaria.data_entrada"; + public static final int DATA_ENTRADA_INDEX = 2; + + public static final String FIELD_NAMES[] = new String[]{ + PORTARIA, DATA_ENTRADA, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + PORTARIA, TABLENAME + "." + DATA_ENTRADA, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, PORTARIA, DATA_ENTRADA, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, PORTARIA, DATA_ENTRADA, }; + + private Integer id; + private String portaria; + private java.sql.Timestamp data_entrada; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public ExamesPortaria() + { + super(); + dirtyProperties = new boolean[]{ false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public String getPortaria() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PORTARIA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.portaria; + } + + public void setPortaria( String portaria ) + { + try + { + setLockedForRefresh( true ); + preProcess( PORTARIA, portaria ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.portaria = portaria; + LAZY_LOADED_OBJECTS.put( PORTARIA, Boolean.TRUE ); + } + + public java.sql.Timestamp getData_entrada() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_ENTRADA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_entrada; + } + + public void setData_entrada( java.sql.Timestamp data_entrada ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_ENTRADA, data_entrada ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_entrada = data_entrada; + LAZY_LOADED_OBJECTS.put( DATA_ENTRADA, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case ExamesPortaria.ID_INDEX: + value = getId(); + break; + case ExamesPortaria.PORTARIA_INDEX: + value = getPortaria(); + break; + case ExamesPortaria.DATA_ENTRADA_INDEX: + value = getData_entrada(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case ExamesPortaria.ID_INDEX: + value = this.id; + break; + case ExamesPortaria.PORTARIA_INDEX: + value = this.portaria; + break; + case ExamesPortaria.DATA_ENTRADA_INDEX: + value = this.data_entrada; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case ExamesPortaria.ID_INDEX: + setId( ( Integer ) value ); + break; + case ExamesPortaria.PORTARIA_INDEX: + setPortaria( ( String ) value ); + break; + case ExamesPortaria.DATA_ENTRADA_INDEX: + setData_entrada( ( java.sql.Timestamp ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case ExamesPortaria.ID_INDEX: + this.id = ( Integer ) value; + break; + case ExamesPortaria.PORTARIA_INDEX: + this.portaria = ( String ) value; + break; + case ExamesPortaria.DATA_ENTRADA_INDEX: + this.data_entrada = ( java.sql.Timestamp ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case ExamesPortaria.ID_INDEX: + theClass = Integer.class; + break; + case ExamesPortaria.PORTARIA_INDEX: + theClass = String.class; + break; + case ExamesPortaria.DATA_ENTRADA_INDEX: + theClass = java.sql.Timestamp.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : ExamesPortaria._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, ExamesPortaria.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HistoricoEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HistoricoEstabelecimento.java new file mode 100644 index 00000000..4bfee75a --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HistoricoEstabelecimento.java @@ -0,0 +1,430 @@ +/* +* HistoricoEstabelecimento.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HistoricoEstabelecimento extends siprp.data.Historico +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( HistoricoEstabelecimento.ID, HistoricoEstabelecimento.ID_INDEX ); + FIELD_INDEXES.put( HistoricoEstabelecimento.ID_FULL, HistoricoEstabelecimento.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HistoricoEstabelecimento.CLASS_IDENTIFIER, HistoricoEstabelecimento.ESTABELECIMENTO_ID, HistoricoEstabelecimento.TO_ESTABELECIMENTO_ID ); + FIELD_INDEXES.put( HistoricoEstabelecimento.ESTABELECIMENTO_ID, HistoricoEstabelecimento.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( HistoricoEstabelecimento.ESTABELECIMENTO_ID_FULL, HistoricoEstabelecimento.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( HistoricoEstabelecimento.TO_ESTABELECIMENTO_ID, HistoricoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( HistoricoEstabelecimento.DATA, HistoricoEstabelecimento.DATA_INDEX ); + FIELD_INDEXES.put( HistoricoEstabelecimento.DATA_FULL, HistoricoEstabelecimento.DATA_INDEX ); + FIELD_INDEXES.put( HistoricoEstabelecimento.TEXTO, HistoricoEstabelecimento.TEXTO_INDEX ); + FIELD_INDEXES.put( HistoricoEstabelecimento.TEXTO_FULL, HistoricoEstabelecimento.TEXTO_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyestabelecimento_idToestabelecimentos = + new com.evolute.entity.ForeignKey( HistoricoEstabelecimento.class, HistoricoEstabelecimento.ESTABELECIMENTO_ID, siprp.data.outer.EstabelecimentosData.class, siprp.data.outer.EstabelecimentosData.ID ); + + public static final String TABLENAME = "historico_estabelecimento"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.historico_estabelecimento"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "historico_estabelecimento.id"; + public static final int ID_INDEX = 0; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "historico_estabelecimento.estabelecimento_id"; + public static final int ESTABELECIMENTO_ID_INDEX = 1; + public static final String TO_ESTABELECIMENTO_ID = "to_estabelecimento_id"; + public static final int TO_ESTABELECIMENTO_ID_INDEX = 2; + public static final String DATA = "data"; + public static final String DATA_FULL = "historico_estabelecimento.data"; + public static final int DATA_INDEX = 3; + public static final String TEXTO = "texto"; + public static final String TEXTO_FULL = "historico_estabelecimento.texto"; + public static final int TEXTO_INDEX = 4; + + public static final String FIELD_NAMES[] = new String[]{ + ESTABELECIMENTO_ID, TO_ESTABELECIMENTO_ID, DATA, TEXTO, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + ESTABELECIMENTO_ID, TABLENAME + "." + TO_ESTABELECIMENTO_ID, TABLENAME + "." + DATA, TABLENAME + "." + TEXTO, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, ESTABELECIMENTO_ID, DATA, TEXTO, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, ESTABELECIMENTO_ID, DATA, TEXTO, }; + + private Integer id; + private Integer estabelecimento_id; + private siprp.data.outer.EstabelecimentosData to_estabelecimento_id; + private java.util.Date data; + private String texto; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HistoricoEstabelecimento() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public Integer getEstabelecimento_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTABELECIMENTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estabelecimento_id; + } + + public void setEstabelecimento_id( Integer estabelecimento_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTABELECIMENTO_ID, estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estabelecimento_id = estabelecimento_id; + LAZY_LOADED_OBJECTS.put( ESTABELECIMENTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EstabelecimentosData toEstabelecimento_id() + { + try + { + prepare( TO_ESTABELECIMENTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_estabelecimento_id; + } + + public void setToEstabelecimento_id( siprp.data.outer.EstabelecimentosData to_estabelecimento_id ) + { + try + { + preProcess( TO_ESTABELECIMENTO_ID, to_estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_estabelecimento_id = to_estabelecimento_id; + } + + public java.util.Date getData() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data; + } + + public void setData( java.util.Date data ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA, data ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data = data; + LAZY_LOADED_OBJECTS.put( DATA, Boolean.TRUE ); + } + + public String getTexto() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TEXTO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.texto; + } + + public void setTexto( String texto ) + { + try + { + setLockedForRefresh( true ); + preProcess( TEXTO, texto ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.texto = texto; + LAZY_LOADED_OBJECTS.put( TEXTO, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HistoricoEstabelecimento.ID_INDEX: + value = getId(); + break; + case HistoricoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + value = getEstabelecimento_id(); + break; + case HistoricoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + value = toEstabelecimento_id(); + break; + case HistoricoEstabelecimento.DATA_INDEX: + value = getData(); + break; + case HistoricoEstabelecimento.TEXTO_INDEX: + value = getTexto(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HistoricoEstabelecimento.ID_INDEX: + value = this.id; + break; + case HistoricoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + value = this.estabelecimento_id; + break; + case HistoricoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + value = this.to_estabelecimento_id; + break; + case HistoricoEstabelecimento.DATA_INDEX: + value = this.data; + break; + case HistoricoEstabelecimento.TEXTO_INDEX: + value = this.texto; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HistoricoEstabelecimento.ID_INDEX: + setId( ( Integer ) value ); + break; + case HistoricoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + setEstabelecimento_id( ( Integer ) value ); + break; + case HistoricoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + setToEstabelecimento_id( ( siprp.data.outer.EstabelecimentosData ) value ); + break; + case HistoricoEstabelecimento.DATA_INDEX: + setData( ( java.util.Date ) value ); + break; + case HistoricoEstabelecimento.TEXTO_INDEX: + setTexto( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HistoricoEstabelecimento.ID_INDEX: + this.id = ( Integer ) value; + break; + case HistoricoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + this.estabelecimento_id = ( Integer ) value; + break; + case HistoricoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + this.to_estabelecimento_id = ( siprp.data.outer.EstabelecimentosData ) value; + break; + case HistoricoEstabelecimento.DATA_INDEX: + this.data = ( java.util.Date ) value; + break; + case HistoricoEstabelecimento.TEXTO_INDEX: + this.texto = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HistoricoEstabelecimento.ID_INDEX: + theClass = Integer.class; + break; + case HistoricoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + theClass = Integer.class; + break; + case HistoricoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + theClass = siprp.data.outer.EstabelecimentosData.class; + break; + case HistoricoEstabelecimento.DATA_INDEX: + theClass = java.util.Date.class; + break; + case HistoricoEstabelecimento.TEXTO_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HistoricoEstabelecimento._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HistoricoEstabelecimento.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsArea.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsArea.java new file mode 100644 index 00000000..8b3d5e2c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsArea.java @@ -0,0 +1,494 @@ +/* +* HsArea.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsArea extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( HsArea.ID, HsArea.ID_INDEX ); + FIELD_INDEXES.put( HsArea.ID_FULL, HsArea.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsArea.CLASS_IDENTIFIER, HsArea.EMPRESA_ID, HsArea.TO_EMPRESA_ID ); + FIELD_INDEXES.put( HsArea.EMPRESA_ID, HsArea.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( HsArea.EMPRESA_ID_FULL, HsArea.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( HsArea.TO_EMPRESA_ID, HsArea.TO_EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( HsArea.DESCRIPTION, HsArea.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsArea.DESCRIPTION_FULL, HsArea.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsArea.DELETED_DATE, HsArea.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsArea.DELETED_DATE_FULL, HsArea.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsArea.ORDEM, HsArea.ORDEM_INDEX ); + FIELD_INDEXES.put( HsArea.ORDEM_FULL, HsArea.ORDEM_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyempresa_idToempresas = + new com.evolute.entity.ForeignKey( HsArea.class, HsArea.EMPRESA_ID, siprp.data.outer.EmpresasData.class, siprp.data.outer.EmpresasData.ID ); + + public static final String TABLENAME = "hs_area"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_area"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "hs_area.id"; + public static final int ID_INDEX = 0; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "hs_area.empresa_id"; + public static final int EMPRESA_ID_INDEX = 1; + public static final String TO_EMPRESA_ID = "to_empresa_id"; + public static final int TO_EMPRESA_ID_INDEX = 2; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_area.description"; + public static final int DESCRIPTION_INDEX = 3; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_area.deleted_date"; + public static final int DELETED_DATE_INDEX = 4; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "hs_area.ordem"; + public static final int ORDEM_INDEX = 5; + + public static final String FIELD_NAMES[] = new String[]{ + EMPRESA_ID, TO_EMPRESA_ID, DESCRIPTION, DELETED_DATE, ORDEM, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + EMPRESA_ID, TABLENAME + "." + TO_EMPRESA_ID, TABLENAME + "." + DESCRIPTION, TABLENAME + "." + DELETED_DATE, TABLENAME + "." + ORDEM, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, EMPRESA_ID, DESCRIPTION, DELETED_DATE, ORDEM, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, EMPRESA_ID, DESCRIPTION, DELETED_DATE, ORDEM, }; + + private Integer id; + private Integer empresa_id; + private siprp.data.outer.EmpresasData to_empresa_id; + private String description; + private java.sql.Timestamp deleted_date; + private Integer ordem; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsArea() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromHsPosto_area_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsPostoData.class , getPrimaryKey().getMap().get("id"), "area_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public Integer getEmpresa_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMPRESA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.empresa_id; + } + + public void setEmpresa_id( Integer empresa_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMPRESA_ID, empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.empresa_id = empresa_id; + LAZY_LOADED_OBJECTS.put( EMPRESA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EmpresasData toEmpresa_id() + { + try + { + prepare( TO_EMPRESA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_empresa_id; + } + + public void setToEmpresa_id( siprp.data.outer.EmpresasData to_empresa_id ) + { + try + { + preProcess( TO_EMPRESA_ID, to_empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_empresa_id = to_empresa_id; + } + + public String getDescription() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRIPTION ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.description; + } + + public void setDescription( String description ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRIPTION, description ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.description = description; + LAZY_LOADED_OBJECTS.put( DESCRIPTION, Boolean.TRUE ); + } + + public java.sql.Timestamp getDeleted_date() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DELETED_DATE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.deleted_date; + } + + public void setDeleted_date( java.sql.Timestamp deleted_date ) + { + try + { + setLockedForRefresh( true ); + preProcess( DELETED_DATE, deleted_date ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.deleted_date = deleted_date; + LAZY_LOADED_OBJECTS.put( DELETED_DATE, Boolean.TRUE ); + } + + public Integer getOrdem() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ORDEM ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.ordem; + } + + public void setOrdem( Integer ordem ) + { + try + { + setLockedForRefresh( true ); + preProcess( ORDEM, ordem ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.ordem = ordem; + LAZY_LOADED_OBJECTS.put( ORDEM, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsArea.ID_INDEX: + value = getId(); + break; + case HsArea.EMPRESA_ID_INDEX: + value = getEmpresa_id(); + break; + case HsArea.TO_EMPRESA_ID_INDEX: + value = toEmpresa_id(); + break; + case HsArea.DESCRIPTION_INDEX: + value = getDescription(); + break; + case HsArea.DELETED_DATE_INDEX: + value = getDeleted_date(); + break; + case HsArea.ORDEM_INDEX: + value = getOrdem(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsArea.ID_INDEX: + value = this.id; + break; + case HsArea.EMPRESA_ID_INDEX: + value = this.empresa_id; + break; + case HsArea.TO_EMPRESA_ID_INDEX: + value = this.to_empresa_id; + break; + case HsArea.DESCRIPTION_INDEX: + value = this.description; + break; + case HsArea.DELETED_DATE_INDEX: + value = this.deleted_date; + break; + case HsArea.ORDEM_INDEX: + value = this.ordem; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsArea.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsArea.EMPRESA_ID_INDEX: + setEmpresa_id( ( Integer ) value ); + break; + case HsArea.TO_EMPRESA_ID_INDEX: + setToEmpresa_id( ( siprp.data.outer.EmpresasData ) value ); + break; + case HsArea.DESCRIPTION_INDEX: + setDescription( ( String ) value ); + break; + case HsArea.DELETED_DATE_INDEX: + setDeleted_date( ( java.sql.Timestamp ) value ); + break; + case HsArea.ORDEM_INDEX: + setOrdem( ( Integer ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsArea.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsArea.EMPRESA_ID_INDEX: + this.empresa_id = ( Integer ) value; + break; + case HsArea.TO_EMPRESA_ID_INDEX: + this.to_empresa_id = ( siprp.data.outer.EmpresasData ) value; + break; + case HsArea.DESCRIPTION_INDEX: + this.description = ( String ) value; + break; + case HsArea.DELETED_DATE_INDEX: + this.deleted_date = ( java.sql.Timestamp ) value; + break; + case HsArea.ORDEM_INDEX: + this.ordem = ( Integer ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsArea.ID_INDEX: + theClass = Integer.class; + break; + case HsArea.EMPRESA_ID_INDEX: + theClass = Integer.class; + break; + case HsArea.TO_EMPRESA_ID_INDEX: + theClass = siprp.data.outer.EmpresasData.class; + break; + case HsArea.DESCRIPTION_INDEX: + theClass = String.class; + break; + case HsArea.DELETED_DATE_INDEX: + theClass = java.sql.Timestamp.class; + break; + case HsArea.ORDEM_INDEX: + theClass = Integer.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsArea._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsArea.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsEmail.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsEmail.java new file mode 100644 index 00000000..9b685ba0 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsEmail.java @@ -0,0 +1,308 @@ +/* +* HsEmail.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsEmail extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( HsEmail.ID, HsEmail.ID_INDEX ); + FIELD_INDEXES.put( HsEmail.ID_FULL, HsEmail.ID_INDEX ); + FIELD_INDEXES.put( HsEmail.EMAIL, HsEmail.EMAIL_INDEX ); + FIELD_INDEXES.put( HsEmail.EMAIL_FULL, HsEmail.EMAIL_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "hs_email"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_email"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "hs_email.id"; + public static final int ID_INDEX = 0; + public static final String EMAIL = "email"; + public static final String EMAIL_FULL = "hs_email.email"; + public static final int EMAIL_INDEX = 1; + + public static final String FIELD_NAMES[] = new String[]{ + EMAIL, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + EMAIL, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, EMAIL, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, EMAIL, }; + + private Integer id; + private String email; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsEmail() + { + super(); + dirtyProperties = new boolean[]{ false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromHsEmailEmpresa_email_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsEmailEmpresaData.class , getPrimaryKey().getMap().get("id"), "email_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsEmailEstabelecimento_email_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsEmailEstabelecimentoData.class , getPrimaryKey().getMap().get("id"), "email_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getEmail() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMAIL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.email; + } + + public void setEmail( String email ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMAIL, email ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.email = email; + LAZY_LOADED_OBJECTS.put( EMAIL, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsEmail.ID_INDEX: + value = getId(); + break; + case HsEmail.EMAIL_INDEX: + value = getEmail(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsEmail.ID_INDEX: + value = this.id; + break; + case HsEmail.EMAIL_INDEX: + value = this.email; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsEmail.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsEmail.EMAIL_INDEX: + setEmail( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsEmail.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsEmail.EMAIL_INDEX: + this.email = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsEmail.ID_INDEX: + theClass = Integer.class; + break; + case HsEmail.EMAIL_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsEmail._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsEmail.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsEmailEmpresa.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsEmailEmpresa.java new file mode 100644 index 00000000..5a111df8 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsEmailEmpresa.java @@ -0,0 +1,379 @@ +/* +* HsEmailEmpresa.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsEmailEmpresa extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + com.evolute.entity.evo.EvoDataObject.register( HsEmailEmpresa.CLASS_IDENTIFIER, HsEmailEmpresa.EMAIL_ID, HsEmailEmpresa.TO_EMAIL_ID ); + FIELD_INDEXES.put( HsEmailEmpresa.EMAIL_ID, HsEmailEmpresa.EMAIL_ID_INDEX ); + FIELD_INDEXES.put( HsEmailEmpresa.EMAIL_ID_FULL, HsEmailEmpresa.EMAIL_ID_INDEX ); + FIELD_INDEXES.put( HsEmailEmpresa.TO_EMAIL_ID, HsEmailEmpresa.TO_EMAIL_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsEmailEmpresa.CLASS_IDENTIFIER, HsEmailEmpresa.EMPRESA_ID, HsEmailEmpresa.TO_EMPRESA_ID ); + FIELD_INDEXES.put( HsEmailEmpresa.EMPRESA_ID, HsEmailEmpresa.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( HsEmailEmpresa.EMPRESA_ID_FULL, HsEmailEmpresa.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( HsEmailEmpresa.TO_EMPRESA_ID, HsEmailEmpresa.TO_EMPRESA_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyemail_idTohs_email = + new com.evolute.entity.ForeignKey( HsEmailEmpresa.class, HsEmailEmpresa.EMAIL_ID, siprp.data.outer.HsEmailData.class, siprp.data.outer.HsEmailData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyempresa_idToempresas = + new com.evolute.entity.ForeignKey( HsEmailEmpresa.class, HsEmailEmpresa.EMPRESA_ID, siprp.data.outer.EmpresasData.class, siprp.data.outer.EmpresasData.ID ); + + public static final String TABLENAME = "hs_email_empresa"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_email_empresa"; + + public static final int _INVALID__INDEX = -1; + public static final String EMAIL_ID = "email_id"; + public static final String EMAIL_ID_FULL = "hs_email_empresa.email_id"; + public static final int EMAIL_ID_INDEX = 0; + public static final String TO_EMAIL_ID = "to_email_id"; + public static final int TO_EMAIL_ID_INDEX = 1; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "hs_email_empresa.empresa_id"; + public static final int EMPRESA_ID_INDEX = 2; + public static final String TO_EMPRESA_ID = "to_empresa_id"; + public static final int TO_EMPRESA_ID_INDEX = 3; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + EMAIL_ID, EMPRESA_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + EMAIL_ID, EMPRESA_ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + EMAIL_ID, EMPRESA_ID, }; + + private Integer email_id; + private siprp.data.outer.HsEmailData to_email_id; + private Integer empresa_id; + private siprp.data.outer.EmpresasData to_empresa_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsEmailEmpresa() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false }; + } + + public Integer getEmail_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMAIL_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.email_id; + } + + public void setEmail_id( Integer email_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMAIL_ID, email_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.email_id = email_id; + LAZY_LOADED_OBJECTS.put( EMAIL_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsEmailData toEmail_id() + { + try + { + prepare( TO_EMAIL_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_email_id; + } + + public void setToEmail_id( siprp.data.outer.HsEmailData to_email_id ) + { + try + { + preProcess( TO_EMAIL_ID, to_email_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_email_id = to_email_id; + } + + public Integer getEmpresa_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMPRESA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.empresa_id; + } + + public void setEmpresa_id( Integer empresa_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMPRESA_ID, empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.empresa_id = empresa_id; + LAZY_LOADED_OBJECTS.put( EMPRESA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EmpresasData toEmpresa_id() + { + try + { + prepare( TO_EMPRESA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_empresa_id; + } + + public void setToEmpresa_id( siprp.data.outer.EmpresasData to_empresa_id ) + { + try + { + preProcess( TO_EMPRESA_ID, to_empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_empresa_id = to_empresa_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsEmailEmpresa.EMAIL_ID_INDEX: + value = getEmail_id(); + break; + case HsEmailEmpresa.TO_EMAIL_ID_INDEX: + value = toEmail_id(); + break; + case HsEmailEmpresa.EMPRESA_ID_INDEX: + value = getEmpresa_id(); + break; + case HsEmailEmpresa.TO_EMPRESA_ID_INDEX: + value = toEmpresa_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsEmailEmpresa.EMAIL_ID_INDEX: + value = this.email_id; + break; + case HsEmailEmpresa.TO_EMAIL_ID_INDEX: + value = this.to_email_id; + break; + case HsEmailEmpresa.EMPRESA_ID_INDEX: + value = this.empresa_id; + break; + case HsEmailEmpresa.TO_EMPRESA_ID_INDEX: + value = this.to_empresa_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsEmailEmpresa.EMAIL_ID_INDEX: + setEmail_id( ( Integer ) value ); + break; + case HsEmailEmpresa.TO_EMAIL_ID_INDEX: + setToEmail_id( ( siprp.data.outer.HsEmailData ) value ); + break; + case HsEmailEmpresa.EMPRESA_ID_INDEX: + setEmpresa_id( ( Integer ) value ); + break; + case HsEmailEmpresa.TO_EMPRESA_ID_INDEX: + setToEmpresa_id( ( siprp.data.outer.EmpresasData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsEmailEmpresa.EMAIL_ID_INDEX: + this.email_id = ( Integer ) value; + break; + case HsEmailEmpresa.TO_EMAIL_ID_INDEX: + this.to_email_id = ( siprp.data.outer.HsEmailData ) value; + break; + case HsEmailEmpresa.EMPRESA_ID_INDEX: + this.empresa_id = ( Integer ) value; + break; + case HsEmailEmpresa.TO_EMPRESA_ID_INDEX: + this.to_empresa_id = ( siprp.data.outer.EmpresasData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + throw new RuntimeException( "getPrimaryKeyName on HsEmailEmpresa is invalid" ); + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsEmailEmpresa.EMAIL_ID_INDEX: + theClass = Integer.class; + break; + case HsEmailEmpresa.TO_EMAIL_ID_INDEX: + theClass = siprp.data.outer.HsEmailData.class; + break; + case HsEmailEmpresa.EMPRESA_ID_INDEX: + theClass = Integer.class; + break; + case HsEmailEmpresa.TO_EMPRESA_ID_INDEX: + theClass = siprp.data.outer.EmpresasData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsEmailEmpresa._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsEmailEmpresa.PK_FIELD_NAMES ); + primaryKey.set( 0, getEmail_id() ); + primaryKey.set( 1, getEmpresa_id() ); + } + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsEmailEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsEmailEstabelecimento.java new file mode 100644 index 00000000..9c62ca86 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsEmailEstabelecimento.java @@ -0,0 +1,379 @@ +/* +* HsEmailEstabelecimento.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsEmailEstabelecimento extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + com.evolute.entity.evo.EvoDataObject.register( HsEmailEstabelecimento.CLASS_IDENTIFIER, HsEmailEstabelecimento.EMAIL_ID, HsEmailEstabelecimento.TO_EMAIL_ID ); + FIELD_INDEXES.put( HsEmailEstabelecimento.EMAIL_ID, HsEmailEstabelecimento.EMAIL_ID_INDEX ); + FIELD_INDEXES.put( HsEmailEstabelecimento.EMAIL_ID_FULL, HsEmailEstabelecimento.EMAIL_ID_INDEX ); + FIELD_INDEXES.put( HsEmailEstabelecimento.TO_EMAIL_ID, HsEmailEstabelecimento.TO_EMAIL_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsEmailEstabelecimento.CLASS_IDENTIFIER, HsEmailEstabelecimento.ESTABELECIMENTO_ID, HsEmailEstabelecimento.TO_ESTABELECIMENTO_ID ); + FIELD_INDEXES.put( HsEmailEstabelecimento.ESTABELECIMENTO_ID, HsEmailEstabelecimento.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( HsEmailEstabelecimento.ESTABELECIMENTO_ID_FULL, HsEmailEstabelecimento.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( HsEmailEstabelecimento.TO_ESTABELECIMENTO_ID, HsEmailEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyemail_idTohs_email = + new com.evolute.entity.ForeignKey( HsEmailEstabelecimento.class, HsEmailEstabelecimento.EMAIL_ID, siprp.data.outer.HsEmailData.class, siprp.data.outer.HsEmailData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyestabelecimento_idToestabelecimentos = + new com.evolute.entity.ForeignKey( HsEmailEstabelecimento.class, HsEmailEstabelecimento.ESTABELECIMENTO_ID, siprp.data.outer.EstabelecimentosData.class, siprp.data.outer.EstabelecimentosData.ID ); + + public static final String TABLENAME = "hs_email_estabelecimento"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_email_estabelecimento"; + + public static final int _INVALID__INDEX = -1; + public static final String EMAIL_ID = "email_id"; + public static final String EMAIL_ID_FULL = "hs_email_estabelecimento.email_id"; + public static final int EMAIL_ID_INDEX = 0; + public static final String TO_EMAIL_ID = "to_email_id"; + public static final int TO_EMAIL_ID_INDEX = 1; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "hs_email_estabelecimento.estabelecimento_id"; + public static final int ESTABELECIMENTO_ID_INDEX = 2; + public static final String TO_ESTABELECIMENTO_ID = "to_estabelecimento_id"; + public static final int TO_ESTABELECIMENTO_ID_INDEX = 3; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + EMAIL_ID, ESTABELECIMENTO_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + EMAIL_ID, ESTABELECIMENTO_ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + EMAIL_ID, ESTABELECIMENTO_ID, }; + + private Integer email_id; + private siprp.data.outer.HsEmailData to_email_id; + private Integer estabelecimento_id; + private siprp.data.outer.EstabelecimentosData to_estabelecimento_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsEmailEstabelecimento() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false }; + } + + public Integer getEmail_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMAIL_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.email_id; + } + + public void setEmail_id( Integer email_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMAIL_ID, email_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.email_id = email_id; + LAZY_LOADED_OBJECTS.put( EMAIL_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsEmailData toEmail_id() + { + try + { + prepare( TO_EMAIL_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_email_id; + } + + public void setToEmail_id( siprp.data.outer.HsEmailData to_email_id ) + { + try + { + preProcess( TO_EMAIL_ID, to_email_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_email_id = to_email_id; + } + + public Integer getEstabelecimento_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTABELECIMENTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estabelecimento_id; + } + + public void setEstabelecimento_id( Integer estabelecimento_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTABELECIMENTO_ID, estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estabelecimento_id = estabelecimento_id; + LAZY_LOADED_OBJECTS.put( ESTABELECIMENTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EstabelecimentosData toEstabelecimento_id() + { + try + { + prepare( TO_ESTABELECIMENTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_estabelecimento_id; + } + + public void setToEstabelecimento_id( siprp.data.outer.EstabelecimentosData to_estabelecimento_id ) + { + try + { + preProcess( TO_ESTABELECIMENTO_ID, to_estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_estabelecimento_id = to_estabelecimento_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsEmailEstabelecimento.EMAIL_ID_INDEX: + value = getEmail_id(); + break; + case HsEmailEstabelecimento.TO_EMAIL_ID_INDEX: + value = toEmail_id(); + break; + case HsEmailEstabelecimento.ESTABELECIMENTO_ID_INDEX: + value = getEstabelecimento_id(); + break; + case HsEmailEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + value = toEstabelecimento_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsEmailEstabelecimento.EMAIL_ID_INDEX: + value = this.email_id; + break; + case HsEmailEstabelecimento.TO_EMAIL_ID_INDEX: + value = this.to_email_id; + break; + case HsEmailEstabelecimento.ESTABELECIMENTO_ID_INDEX: + value = this.estabelecimento_id; + break; + case HsEmailEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + value = this.to_estabelecimento_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsEmailEstabelecimento.EMAIL_ID_INDEX: + setEmail_id( ( Integer ) value ); + break; + case HsEmailEstabelecimento.TO_EMAIL_ID_INDEX: + setToEmail_id( ( siprp.data.outer.HsEmailData ) value ); + break; + case HsEmailEstabelecimento.ESTABELECIMENTO_ID_INDEX: + setEstabelecimento_id( ( Integer ) value ); + break; + case HsEmailEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + setToEstabelecimento_id( ( siprp.data.outer.EstabelecimentosData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsEmailEstabelecimento.EMAIL_ID_INDEX: + this.email_id = ( Integer ) value; + break; + case HsEmailEstabelecimento.TO_EMAIL_ID_INDEX: + this.to_email_id = ( siprp.data.outer.HsEmailData ) value; + break; + case HsEmailEstabelecimento.ESTABELECIMENTO_ID_INDEX: + this.estabelecimento_id = ( Integer ) value; + break; + case HsEmailEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + this.to_estabelecimento_id = ( siprp.data.outer.EstabelecimentosData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + throw new RuntimeException( "getPrimaryKeyName on HsEmailEstabelecimento is invalid" ); + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsEmailEstabelecimento.EMAIL_ID_INDEX: + theClass = Integer.class; + break; + case HsEmailEstabelecimento.TO_EMAIL_ID_INDEX: + theClass = siprp.data.outer.HsEmailData.class; + break; + case HsEmailEstabelecimento.ESTABELECIMENTO_ID_INDEX: + theClass = Integer.class; + break; + case HsEmailEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + theClass = siprp.data.outer.EstabelecimentosData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsEmailEstabelecimento._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsEmailEstabelecimento.PK_FIELD_NAMES ); + primaryKey.set( 0, getEmail_id() ); + primaryKey.set( 1, getEstabelecimento_id() ); + } + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsEquipamento.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsEquipamento.java new file mode 100644 index 00000000..f68203f9 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsEquipamento.java @@ -0,0 +1,431 @@ +/* +* HsEquipamento.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsEquipamento extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( HsEquipamento.ID, HsEquipamento.ID_INDEX ); + FIELD_INDEXES.put( HsEquipamento.ID_FULL, HsEquipamento.ID_INDEX ); + FIELD_INDEXES.put( HsEquipamento.TIPO, HsEquipamento.TIPO_INDEX ); + FIELD_INDEXES.put( HsEquipamento.TIPO_FULL, HsEquipamento.TIPO_INDEX ); + FIELD_INDEXES.put( HsEquipamento.MARCA, HsEquipamento.MARCA_INDEX ); + FIELD_INDEXES.put( HsEquipamento.MARCA_FULL, HsEquipamento.MARCA_INDEX ); + FIELD_INDEXES.put( HsEquipamento.MODELO, HsEquipamento.MODELO_INDEX ); + FIELD_INDEXES.put( HsEquipamento.MODELO_FULL, HsEquipamento.MODELO_INDEX ); + FIELD_INDEXES.put( HsEquipamento.DELETED_DATE, HsEquipamento.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsEquipamento.DELETED_DATE_FULL, HsEquipamento.DELETED_DATE_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "hs_equipamento"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_equipamento"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "hs_equipamento.id"; + public static final int ID_INDEX = 0; + public static final String TIPO = "tipo"; + public static final String TIPO_FULL = "hs_equipamento.tipo"; + public static final int TIPO_INDEX = 1; + public static final String MARCA = "marca"; + public static final String MARCA_FULL = "hs_equipamento.marca"; + public static final int MARCA_INDEX = 2; + public static final String MODELO = "modelo"; + public static final String MODELO_FULL = "hs_equipamento.modelo"; + public static final int MODELO_INDEX = 3; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_equipamento.deleted_date"; + public static final int DELETED_DATE_INDEX = 4; + + public static final String FIELD_NAMES[] = new String[]{ + TIPO, MARCA, MODELO, DELETED_DATE, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + TIPO, TABLENAME + "." + MARCA, TABLENAME + "." + MODELO, TABLENAME + "." + DELETED_DATE, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, TIPO, MARCA, MODELO, DELETED_DATE, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, TIPO, MARCA, MODELO, DELETED_DATE, }; + + private Integer id; + private String tipo; + private String marca; + private String modelo; + private java.sql.Timestamp deleted_date; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsEquipamento() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public String getTipo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TIPO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.tipo; + } + + public void setTipo( String tipo ) + { + try + { + setLockedForRefresh( true ); + preProcess( TIPO, tipo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.tipo = tipo; + LAZY_LOADED_OBJECTS.put( TIPO, Boolean.TRUE ); + } + + public String getMarca() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MARCA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.marca; + } + + public void setMarca( String marca ) + { + try + { + setLockedForRefresh( true ); + preProcess( MARCA, marca ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.marca = marca; + LAZY_LOADED_OBJECTS.put( MARCA, Boolean.TRUE ); + } + + public String getModelo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MODELO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.modelo; + } + + public void setModelo( String modelo ) + { + try + { + setLockedForRefresh( true ); + preProcess( MODELO, modelo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.modelo = modelo; + LAZY_LOADED_OBJECTS.put( MODELO, Boolean.TRUE ); + } + + public java.sql.Timestamp getDeleted_date() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DELETED_DATE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.deleted_date; + } + + public void setDeleted_date( java.sql.Timestamp deleted_date ) + { + try + { + setLockedForRefresh( true ); + preProcess( DELETED_DATE, deleted_date ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.deleted_date = deleted_date; + LAZY_LOADED_OBJECTS.put( DELETED_DATE, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsEquipamento.ID_INDEX: + value = getId(); + break; + case HsEquipamento.TIPO_INDEX: + value = getTipo(); + break; + case HsEquipamento.MARCA_INDEX: + value = getMarca(); + break; + case HsEquipamento.MODELO_INDEX: + value = getModelo(); + break; + case HsEquipamento.DELETED_DATE_INDEX: + value = getDeleted_date(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsEquipamento.ID_INDEX: + value = this.id; + break; + case HsEquipamento.TIPO_INDEX: + value = this.tipo; + break; + case HsEquipamento.MARCA_INDEX: + value = this.marca; + break; + case HsEquipamento.MODELO_INDEX: + value = this.modelo; + break; + case HsEquipamento.DELETED_DATE_INDEX: + value = this.deleted_date; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsEquipamento.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsEquipamento.TIPO_INDEX: + setTipo( ( String ) value ); + break; + case HsEquipamento.MARCA_INDEX: + setMarca( ( String ) value ); + break; + case HsEquipamento.MODELO_INDEX: + setModelo( ( String ) value ); + break; + case HsEquipamento.DELETED_DATE_INDEX: + setDeleted_date( ( java.sql.Timestamp ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsEquipamento.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsEquipamento.TIPO_INDEX: + this.tipo = ( String ) value; + break; + case HsEquipamento.MARCA_INDEX: + this.marca = ( String ) value; + break; + case HsEquipamento.MODELO_INDEX: + this.modelo = ( String ) value; + break; + case HsEquipamento.DELETED_DATE_INDEX: + this.deleted_date = ( java.sql.Timestamp ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsEquipamento.ID_INDEX: + theClass = Integer.class; + break; + case HsEquipamento.TIPO_INDEX: + theClass = String.class; + break; + case HsEquipamento.MARCA_INDEX: + theClass = String.class; + break; + case HsEquipamento.MODELO_INDEX: + theClass = String.class; + break; + case HsEquipamento.DELETED_DATE_INDEX: + theClass = java.sql.Timestamp.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsEquipamento._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsEquipamento.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsLegislacao.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsLegislacao.java new file mode 100644 index 00000000..d79eb715 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsLegislacao.java @@ -0,0 +1,458 @@ +/* +* HsLegislacao.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsLegislacao extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( HsLegislacao.ID, HsLegislacao.ID_INDEX ); + FIELD_INDEXES.put( HsLegislacao.ID_FULL, HsLegislacao.ID_INDEX ); + FIELD_INDEXES.put( HsLegislacao.DESCRIPTION, HsLegislacao.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsLegislacao.DESCRIPTION_FULL, HsLegislacao.DESCRIPTION_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsLegislacao.CLASS_IDENTIFIER, HsLegislacao.CATEGORIA_ID, HsLegislacao.TO_CATEGORIA_ID ); + FIELD_INDEXES.put( HsLegislacao.CATEGORIA_ID, HsLegislacao.CATEGORIA_ID_INDEX ); + FIELD_INDEXES.put( HsLegislacao.CATEGORIA_ID_FULL, HsLegislacao.CATEGORIA_ID_INDEX ); + FIELD_INDEXES.put( HsLegislacao.TO_CATEGORIA_ID, HsLegislacao.TO_CATEGORIA_ID_INDEX ); + FIELD_INDEXES.put( HsLegislacao.DELETED_DATE, HsLegislacao.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsLegislacao.DELETED_DATE_FULL, HsLegislacao.DELETED_DATE_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeycategoria_idTohs_legislacao_categoria = + new com.evolute.entity.ForeignKey( HsLegislacao.class, HsLegislacao.CATEGORIA_ID, siprp.data.outer.HsLegislacaoCategoriaData.class, siprp.data.outer.HsLegislacaoCategoriaData.ID ); + + public static final String TABLENAME = "hs_legislacao"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_legislacao"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "hs_legislacao.id"; + public static final int ID_INDEX = 0; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_legislacao.description"; + public static final int DESCRIPTION_INDEX = 1; + public static final String CATEGORIA_ID = "categoria_id"; + public static final String CATEGORIA_ID_FULL = "hs_legislacao.categoria_id"; + public static final int CATEGORIA_ID_INDEX = 2; + public static final String TO_CATEGORIA_ID = "to_categoria_id"; + public static final int TO_CATEGORIA_ID_INDEX = 3; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_legislacao.deleted_date"; + public static final int DELETED_DATE_INDEX = 4; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRIPTION, CATEGORIA_ID, TO_CATEGORIA_ID, DELETED_DATE, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DESCRIPTION, TABLENAME + "." + CATEGORIA_ID, TABLENAME + "." + TO_CATEGORIA_ID, TABLENAME + "." + DELETED_DATE, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DESCRIPTION, CATEGORIA_ID, DELETED_DATE, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DESCRIPTION, CATEGORIA_ID, DELETED_DATE, }; + + private Integer id; + private String description; + private Integer categoria_id; + private siprp.data.outer.HsLegislacaoCategoriaData to_categoria_id; + private java.sql.Timestamp deleted_date; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsLegislacao() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromHsLegislacaoEmpresa_legislacao_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsLegislacaoEmpresaData.class , getPrimaryKey().getMap().get("id"), "legislacao_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsLegislacaoEstabelecimento_legislacao_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsLegislacaoEstabelecimentoData.class , getPrimaryKey().getMap().get("id"), "legislacao_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getDescription() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRIPTION ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.description; + } + + public void setDescription( String description ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRIPTION, description ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.description = description; + LAZY_LOADED_OBJECTS.put( DESCRIPTION, Boolean.TRUE ); + } + + public Integer getCategoria_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CATEGORIA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.categoria_id; + } + + public void setCategoria_id( Integer categoria_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( CATEGORIA_ID, categoria_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.categoria_id = categoria_id; + LAZY_LOADED_OBJECTS.put( CATEGORIA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsLegislacaoCategoriaData toCategoria_id() + { + try + { + prepare( TO_CATEGORIA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_categoria_id; + } + + public void setToCategoria_id( siprp.data.outer.HsLegislacaoCategoriaData to_categoria_id ) + { + try + { + preProcess( TO_CATEGORIA_ID, to_categoria_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_categoria_id = to_categoria_id; + } + + public java.sql.Timestamp getDeleted_date() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DELETED_DATE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.deleted_date; + } + + public void setDeleted_date( java.sql.Timestamp deleted_date ) + { + try + { + setLockedForRefresh( true ); + preProcess( DELETED_DATE, deleted_date ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.deleted_date = deleted_date; + LAZY_LOADED_OBJECTS.put( DELETED_DATE, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsLegislacao.ID_INDEX: + value = getId(); + break; + case HsLegislacao.DESCRIPTION_INDEX: + value = getDescription(); + break; + case HsLegislacao.CATEGORIA_ID_INDEX: + value = getCategoria_id(); + break; + case HsLegislacao.TO_CATEGORIA_ID_INDEX: + value = toCategoria_id(); + break; + case HsLegislacao.DELETED_DATE_INDEX: + value = getDeleted_date(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsLegislacao.ID_INDEX: + value = this.id; + break; + case HsLegislacao.DESCRIPTION_INDEX: + value = this.description; + break; + case HsLegislacao.CATEGORIA_ID_INDEX: + value = this.categoria_id; + break; + case HsLegislacao.TO_CATEGORIA_ID_INDEX: + value = this.to_categoria_id; + break; + case HsLegislacao.DELETED_DATE_INDEX: + value = this.deleted_date; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsLegislacao.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsLegislacao.DESCRIPTION_INDEX: + setDescription( ( String ) value ); + break; + case HsLegislacao.CATEGORIA_ID_INDEX: + setCategoria_id( ( Integer ) value ); + break; + case HsLegislacao.TO_CATEGORIA_ID_INDEX: + setToCategoria_id( ( siprp.data.outer.HsLegislacaoCategoriaData ) value ); + break; + case HsLegislacao.DELETED_DATE_INDEX: + setDeleted_date( ( java.sql.Timestamp ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsLegislacao.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsLegislacao.DESCRIPTION_INDEX: + this.description = ( String ) value; + break; + case HsLegislacao.CATEGORIA_ID_INDEX: + this.categoria_id = ( Integer ) value; + break; + case HsLegislacao.TO_CATEGORIA_ID_INDEX: + this.to_categoria_id = ( siprp.data.outer.HsLegislacaoCategoriaData ) value; + break; + case HsLegislacao.DELETED_DATE_INDEX: + this.deleted_date = ( java.sql.Timestamp ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsLegislacao.ID_INDEX: + theClass = Integer.class; + break; + case HsLegislacao.DESCRIPTION_INDEX: + theClass = String.class; + break; + case HsLegislacao.CATEGORIA_ID_INDEX: + theClass = Integer.class; + break; + case HsLegislacao.TO_CATEGORIA_ID_INDEX: + theClass = siprp.data.outer.HsLegislacaoCategoriaData.class; + break; + case HsLegislacao.DELETED_DATE_INDEX: + theClass = java.sql.Timestamp.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsLegislacao._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsLegislacao.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsLegislacaoCategoria.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsLegislacaoCategoria.java new file mode 100644 index 00000000..4f775d87 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsLegislacaoCategoria.java @@ -0,0 +1,344 @@ +/* +* HsLegislacaoCategoria.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsLegislacaoCategoria extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( HsLegislacaoCategoria.ID, HsLegislacaoCategoria.ID_INDEX ); + FIELD_INDEXES.put( HsLegislacaoCategoria.ID_FULL, HsLegislacaoCategoria.ID_INDEX ); + FIELD_INDEXES.put( HsLegislacaoCategoria.DESCRIPTION, HsLegislacaoCategoria.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsLegislacaoCategoria.DESCRIPTION_FULL, HsLegislacaoCategoria.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsLegislacaoCategoria.DELETED_DATE, HsLegislacaoCategoria.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsLegislacaoCategoria.DELETED_DATE_FULL, HsLegislacaoCategoria.DELETED_DATE_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "hs_legislacao_categoria"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_legislacao_categoria"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "hs_legislacao_categoria.id"; + public static final int ID_INDEX = 0; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_legislacao_categoria.description"; + public static final int DESCRIPTION_INDEX = 1; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_legislacao_categoria.deleted_date"; + public static final int DELETED_DATE_INDEX = 2; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRIPTION, DELETED_DATE, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DESCRIPTION, TABLENAME + "." + DELETED_DATE, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DESCRIPTION, DELETED_DATE, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DESCRIPTION, DELETED_DATE, }; + + private Integer id; + private String description; + private java.sql.Timestamp deleted_date; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsLegislacaoCategoria() + { + super(); + dirtyProperties = new boolean[]{ false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromHsLegislacao_categoria_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsLegislacaoData.class , getPrimaryKey().getMap().get("id"), "categoria_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getDescription() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRIPTION ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.description; + } + + public void setDescription( String description ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRIPTION, description ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.description = description; + LAZY_LOADED_OBJECTS.put( DESCRIPTION, Boolean.TRUE ); + } + + public java.sql.Timestamp getDeleted_date() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DELETED_DATE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.deleted_date; + } + + public void setDeleted_date( java.sql.Timestamp deleted_date ) + { + try + { + setLockedForRefresh( true ); + preProcess( DELETED_DATE, deleted_date ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.deleted_date = deleted_date; + LAZY_LOADED_OBJECTS.put( DELETED_DATE, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsLegislacaoCategoria.ID_INDEX: + value = getId(); + break; + case HsLegislacaoCategoria.DESCRIPTION_INDEX: + value = getDescription(); + break; + case HsLegislacaoCategoria.DELETED_DATE_INDEX: + value = getDeleted_date(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsLegislacaoCategoria.ID_INDEX: + value = this.id; + break; + case HsLegislacaoCategoria.DESCRIPTION_INDEX: + value = this.description; + break; + case HsLegislacaoCategoria.DELETED_DATE_INDEX: + value = this.deleted_date; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsLegislacaoCategoria.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsLegislacaoCategoria.DESCRIPTION_INDEX: + setDescription( ( String ) value ); + break; + case HsLegislacaoCategoria.DELETED_DATE_INDEX: + setDeleted_date( ( java.sql.Timestamp ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsLegislacaoCategoria.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsLegislacaoCategoria.DESCRIPTION_INDEX: + this.description = ( String ) value; + break; + case HsLegislacaoCategoria.DELETED_DATE_INDEX: + this.deleted_date = ( java.sql.Timestamp ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsLegislacaoCategoria.ID_INDEX: + theClass = Integer.class; + break; + case HsLegislacaoCategoria.DESCRIPTION_INDEX: + theClass = String.class; + break; + case HsLegislacaoCategoria.DELETED_DATE_INDEX: + theClass = java.sql.Timestamp.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsLegislacaoCategoria._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsLegislacaoCategoria.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsLegislacaoEmpresa.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsLegislacaoEmpresa.java new file mode 100644 index 00000000..4e865817 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsLegislacaoEmpresa.java @@ -0,0 +1,379 @@ +/* +* HsLegislacaoEmpresa.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsLegislacaoEmpresa extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + com.evolute.entity.evo.EvoDataObject.register( HsLegislacaoEmpresa.CLASS_IDENTIFIER, HsLegislacaoEmpresa.LEGISLACAO_ID, HsLegislacaoEmpresa.TO_LEGISLACAO_ID ); + FIELD_INDEXES.put( HsLegislacaoEmpresa.LEGISLACAO_ID, HsLegislacaoEmpresa.LEGISLACAO_ID_INDEX ); + FIELD_INDEXES.put( HsLegislacaoEmpresa.LEGISLACAO_ID_FULL, HsLegislacaoEmpresa.LEGISLACAO_ID_INDEX ); + FIELD_INDEXES.put( HsLegislacaoEmpresa.TO_LEGISLACAO_ID, HsLegislacaoEmpresa.TO_LEGISLACAO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsLegislacaoEmpresa.CLASS_IDENTIFIER, HsLegislacaoEmpresa.EMPRESA_ID, HsLegislacaoEmpresa.TO_EMPRESA_ID ); + FIELD_INDEXES.put( HsLegislacaoEmpresa.EMPRESA_ID, HsLegislacaoEmpresa.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( HsLegislacaoEmpresa.EMPRESA_ID_FULL, HsLegislacaoEmpresa.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( HsLegislacaoEmpresa.TO_EMPRESA_ID, HsLegislacaoEmpresa.TO_EMPRESA_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeylegislacao_idTohs_legislacao = + new com.evolute.entity.ForeignKey( HsLegislacaoEmpresa.class, HsLegislacaoEmpresa.LEGISLACAO_ID, siprp.data.outer.HsLegislacaoData.class, siprp.data.outer.HsLegislacaoData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyempresa_idToempresas = + new com.evolute.entity.ForeignKey( HsLegislacaoEmpresa.class, HsLegislacaoEmpresa.EMPRESA_ID, siprp.data.outer.EmpresasData.class, siprp.data.outer.EmpresasData.ID ); + + public static final String TABLENAME = "hs_legislacao_empresa"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_legislacao_empresa"; + + public static final int _INVALID__INDEX = -1; + public static final String LEGISLACAO_ID = "legislacao_id"; + public static final String LEGISLACAO_ID_FULL = "hs_legislacao_empresa.legislacao_id"; + public static final int LEGISLACAO_ID_INDEX = 0; + public static final String TO_LEGISLACAO_ID = "to_legislacao_id"; + public static final int TO_LEGISLACAO_ID_INDEX = 1; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "hs_legislacao_empresa.empresa_id"; + public static final int EMPRESA_ID_INDEX = 2; + public static final String TO_EMPRESA_ID = "to_empresa_id"; + public static final int TO_EMPRESA_ID_INDEX = 3; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + LEGISLACAO_ID, EMPRESA_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + LEGISLACAO_ID, EMPRESA_ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + LEGISLACAO_ID, EMPRESA_ID, }; + + private Integer legislacao_id; + private siprp.data.outer.HsLegislacaoData to_legislacao_id; + private Integer empresa_id; + private siprp.data.outer.EmpresasData to_empresa_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsLegislacaoEmpresa() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false }; + } + + public Integer getLegislacao_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( LEGISLACAO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.legislacao_id; + } + + public void setLegislacao_id( Integer legislacao_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( LEGISLACAO_ID, legislacao_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.legislacao_id = legislacao_id; + LAZY_LOADED_OBJECTS.put( LEGISLACAO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsLegislacaoData toLegislacao_id() + { + try + { + prepare( TO_LEGISLACAO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_legislacao_id; + } + + public void setToLegislacao_id( siprp.data.outer.HsLegislacaoData to_legislacao_id ) + { + try + { + preProcess( TO_LEGISLACAO_ID, to_legislacao_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_legislacao_id = to_legislacao_id; + } + + public Integer getEmpresa_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMPRESA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.empresa_id; + } + + public void setEmpresa_id( Integer empresa_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMPRESA_ID, empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.empresa_id = empresa_id; + LAZY_LOADED_OBJECTS.put( EMPRESA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EmpresasData toEmpresa_id() + { + try + { + prepare( TO_EMPRESA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_empresa_id; + } + + public void setToEmpresa_id( siprp.data.outer.EmpresasData to_empresa_id ) + { + try + { + preProcess( TO_EMPRESA_ID, to_empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_empresa_id = to_empresa_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsLegislacaoEmpresa.LEGISLACAO_ID_INDEX: + value = getLegislacao_id(); + break; + case HsLegislacaoEmpresa.TO_LEGISLACAO_ID_INDEX: + value = toLegislacao_id(); + break; + case HsLegislacaoEmpresa.EMPRESA_ID_INDEX: + value = getEmpresa_id(); + break; + case HsLegislacaoEmpresa.TO_EMPRESA_ID_INDEX: + value = toEmpresa_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsLegislacaoEmpresa.LEGISLACAO_ID_INDEX: + value = this.legislacao_id; + break; + case HsLegislacaoEmpresa.TO_LEGISLACAO_ID_INDEX: + value = this.to_legislacao_id; + break; + case HsLegislacaoEmpresa.EMPRESA_ID_INDEX: + value = this.empresa_id; + break; + case HsLegislacaoEmpresa.TO_EMPRESA_ID_INDEX: + value = this.to_empresa_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsLegislacaoEmpresa.LEGISLACAO_ID_INDEX: + setLegislacao_id( ( Integer ) value ); + break; + case HsLegislacaoEmpresa.TO_LEGISLACAO_ID_INDEX: + setToLegislacao_id( ( siprp.data.outer.HsLegislacaoData ) value ); + break; + case HsLegislacaoEmpresa.EMPRESA_ID_INDEX: + setEmpresa_id( ( Integer ) value ); + break; + case HsLegislacaoEmpresa.TO_EMPRESA_ID_INDEX: + setToEmpresa_id( ( siprp.data.outer.EmpresasData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsLegislacaoEmpresa.LEGISLACAO_ID_INDEX: + this.legislacao_id = ( Integer ) value; + break; + case HsLegislacaoEmpresa.TO_LEGISLACAO_ID_INDEX: + this.to_legislacao_id = ( siprp.data.outer.HsLegislacaoData ) value; + break; + case HsLegislacaoEmpresa.EMPRESA_ID_INDEX: + this.empresa_id = ( Integer ) value; + break; + case HsLegislacaoEmpresa.TO_EMPRESA_ID_INDEX: + this.to_empresa_id = ( siprp.data.outer.EmpresasData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + throw new RuntimeException( "getPrimaryKeyName on HsLegislacaoEmpresa is invalid" ); + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsLegislacaoEmpresa.LEGISLACAO_ID_INDEX: + theClass = Integer.class; + break; + case HsLegislacaoEmpresa.TO_LEGISLACAO_ID_INDEX: + theClass = siprp.data.outer.HsLegislacaoData.class; + break; + case HsLegislacaoEmpresa.EMPRESA_ID_INDEX: + theClass = Integer.class; + break; + case HsLegislacaoEmpresa.TO_EMPRESA_ID_INDEX: + theClass = siprp.data.outer.EmpresasData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsLegislacaoEmpresa._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsLegislacaoEmpresa.PK_FIELD_NAMES ); + primaryKey.set( 0, getLegislacao_id() ); + primaryKey.set( 1, getEmpresa_id() ); + } + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsLegislacaoEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsLegislacaoEstabelecimento.java new file mode 100644 index 00000000..4aae42f8 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsLegislacaoEstabelecimento.java @@ -0,0 +1,429 @@ +/* +* HsLegislacaoEstabelecimento.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsLegislacaoEstabelecimento extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + com.evolute.entity.evo.EvoDataObject.register( HsLegislacaoEstabelecimento.CLASS_IDENTIFIER, HsLegislacaoEstabelecimento.LEGISLACAO_ID, HsLegislacaoEstabelecimento.TO_LEGISLACAO_ID ); + FIELD_INDEXES.put( HsLegislacaoEstabelecimento.LEGISLACAO_ID, HsLegislacaoEstabelecimento.LEGISLACAO_ID_INDEX ); + FIELD_INDEXES.put( HsLegislacaoEstabelecimento.LEGISLACAO_ID_FULL, HsLegislacaoEstabelecimento.LEGISLACAO_ID_INDEX ); + FIELD_INDEXES.put( HsLegislacaoEstabelecimento.TO_LEGISLACAO_ID, HsLegislacaoEstabelecimento.TO_LEGISLACAO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsLegislacaoEstabelecimento.CLASS_IDENTIFIER, HsLegislacaoEstabelecimento.ESTABELECIMENTO_ID, HsLegislacaoEstabelecimento.TO_ESTABELECIMENTO_ID ); + FIELD_INDEXES.put( HsLegislacaoEstabelecimento.ESTABELECIMENTO_ID, HsLegislacaoEstabelecimento.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( HsLegislacaoEstabelecimento.ESTABELECIMENTO_ID_FULL, HsLegislacaoEstabelecimento.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( HsLegislacaoEstabelecimento.TO_ESTABELECIMENTO_ID, HsLegislacaoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( HsLegislacaoEstabelecimento.ORDEM, HsLegislacaoEstabelecimento.ORDEM_INDEX ); + FIELD_INDEXES.put( HsLegislacaoEstabelecimento.ORDEM_FULL, HsLegislacaoEstabelecimento.ORDEM_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeylegislacao_idTohs_legislacao = + new com.evolute.entity.ForeignKey( HsLegislacaoEstabelecimento.class, HsLegislacaoEstabelecimento.LEGISLACAO_ID, siprp.data.outer.HsLegislacaoData.class, siprp.data.outer.HsLegislacaoData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyestabelecimento_idToestabelecimentos = + new com.evolute.entity.ForeignKey( HsLegislacaoEstabelecimento.class, HsLegislacaoEstabelecimento.ESTABELECIMENTO_ID, siprp.data.outer.EstabelecimentosData.class, siprp.data.outer.EstabelecimentosData.ID ); + + public static final String TABLENAME = "hs_legislacao_estabelecimento"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_legislacao_estabelecimento"; + + public static final int _INVALID__INDEX = -1; + public static final String LEGISLACAO_ID = "legislacao_id"; + public static final String LEGISLACAO_ID_FULL = "hs_legislacao_estabelecimento.legislacao_id"; + public static final int LEGISLACAO_ID_INDEX = 0; + public static final String TO_LEGISLACAO_ID = "to_legislacao_id"; + public static final int TO_LEGISLACAO_ID_INDEX = 1; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "hs_legislacao_estabelecimento.estabelecimento_id"; + public static final int ESTABELECIMENTO_ID_INDEX = 2; + public static final String TO_ESTABELECIMENTO_ID = "to_estabelecimento_id"; + public static final int TO_ESTABELECIMENTO_ID_INDEX = 3; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "hs_legislacao_estabelecimento.ordem"; + public static final int ORDEM_INDEX = 4; + + public static final String FIELD_NAMES[] = new String[]{ + ORDEM, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + ORDEM, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + LEGISLACAO_ID, ESTABELECIMENTO_ID, ORDEM, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + LEGISLACAO_ID, ESTABELECIMENTO_ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + LEGISLACAO_ID, ESTABELECIMENTO_ID, ORDEM, }; + + private Integer legislacao_id; + private siprp.data.outer.HsLegislacaoData to_legislacao_id; + private Integer estabelecimento_id; + private siprp.data.outer.EstabelecimentosData to_estabelecimento_id; + private Integer ordem; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsLegislacaoEstabelecimento() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false, false }; + } + + public Integer getLegislacao_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( LEGISLACAO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.legislacao_id; + } + + public void setLegislacao_id( Integer legislacao_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( LEGISLACAO_ID, legislacao_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.legislacao_id = legislacao_id; + LAZY_LOADED_OBJECTS.put( LEGISLACAO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsLegislacaoData toLegislacao_id() + { + try + { + prepare( TO_LEGISLACAO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_legislacao_id; + } + + public void setToLegislacao_id( siprp.data.outer.HsLegislacaoData to_legislacao_id ) + { + try + { + preProcess( TO_LEGISLACAO_ID, to_legislacao_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_legislacao_id = to_legislacao_id; + } + + public Integer getEstabelecimento_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTABELECIMENTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estabelecimento_id; + } + + public void setEstabelecimento_id( Integer estabelecimento_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTABELECIMENTO_ID, estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estabelecimento_id = estabelecimento_id; + LAZY_LOADED_OBJECTS.put( ESTABELECIMENTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EstabelecimentosData toEstabelecimento_id() + { + try + { + prepare( TO_ESTABELECIMENTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_estabelecimento_id; + } + + public void setToEstabelecimento_id( siprp.data.outer.EstabelecimentosData to_estabelecimento_id ) + { + try + { + preProcess( TO_ESTABELECIMENTO_ID, to_estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_estabelecimento_id = to_estabelecimento_id; + } + + public Integer getOrdem() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ORDEM ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.ordem; + } + + public void setOrdem( Integer ordem ) + { + try + { + setLockedForRefresh( true ); + preProcess( ORDEM, ordem ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.ordem = ordem; + LAZY_LOADED_OBJECTS.put( ORDEM, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsLegislacaoEstabelecimento.LEGISLACAO_ID_INDEX: + value = getLegislacao_id(); + break; + case HsLegislacaoEstabelecimento.TO_LEGISLACAO_ID_INDEX: + value = toLegislacao_id(); + break; + case HsLegislacaoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + value = getEstabelecimento_id(); + break; + case HsLegislacaoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + value = toEstabelecimento_id(); + break; + case HsLegislacaoEstabelecimento.ORDEM_INDEX: + value = getOrdem(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsLegislacaoEstabelecimento.LEGISLACAO_ID_INDEX: + value = this.legislacao_id; + break; + case HsLegislacaoEstabelecimento.TO_LEGISLACAO_ID_INDEX: + value = this.to_legislacao_id; + break; + case HsLegislacaoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + value = this.estabelecimento_id; + break; + case HsLegislacaoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + value = this.to_estabelecimento_id; + break; + case HsLegislacaoEstabelecimento.ORDEM_INDEX: + value = this.ordem; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsLegislacaoEstabelecimento.LEGISLACAO_ID_INDEX: + setLegislacao_id( ( Integer ) value ); + break; + case HsLegislacaoEstabelecimento.TO_LEGISLACAO_ID_INDEX: + setToLegislacao_id( ( siprp.data.outer.HsLegislacaoData ) value ); + break; + case HsLegislacaoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + setEstabelecimento_id( ( Integer ) value ); + break; + case HsLegislacaoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + setToEstabelecimento_id( ( siprp.data.outer.EstabelecimentosData ) value ); + break; + case HsLegislacaoEstabelecimento.ORDEM_INDEX: + setOrdem( ( Integer ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsLegislacaoEstabelecimento.LEGISLACAO_ID_INDEX: + this.legislacao_id = ( Integer ) value; + break; + case HsLegislacaoEstabelecimento.TO_LEGISLACAO_ID_INDEX: + this.to_legislacao_id = ( siprp.data.outer.HsLegislacaoData ) value; + break; + case HsLegislacaoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + this.estabelecimento_id = ( Integer ) value; + break; + case HsLegislacaoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + this.to_estabelecimento_id = ( siprp.data.outer.EstabelecimentosData ) value; + break; + case HsLegislacaoEstabelecimento.ORDEM_INDEX: + this.ordem = ( Integer ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + throw new RuntimeException( "getPrimaryKeyName on HsLegislacaoEstabelecimento is invalid" ); + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsLegislacaoEstabelecimento.LEGISLACAO_ID_INDEX: + theClass = Integer.class; + break; + case HsLegislacaoEstabelecimento.TO_LEGISLACAO_ID_INDEX: + theClass = siprp.data.outer.HsLegislacaoData.class; + break; + case HsLegislacaoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + theClass = Integer.class; + break; + case HsLegislacaoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + theClass = siprp.data.outer.EstabelecimentosData.class; + break; + case HsLegislacaoEstabelecimento.ORDEM_INDEX: + theClass = Integer.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsLegislacaoEstabelecimento._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsLegislacaoEstabelecimento.PK_FIELD_NAMES ); + primaryKey.set( 0, getLegislacao_id() ); + primaryKey.set( 1, getEstabelecimento_id() ); + } + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsMedida.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsMedida.java new file mode 100644 index 00000000..aa68685e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsMedida.java @@ -0,0 +1,409 @@ +/* +* HsMedida.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsMedida extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( HsMedida.ID, HsMedida.ID_INDEX ); + FIELD_INDEXES.put( HsMedida.ID_FULL, HsMedida.ID_INDEX ); + FIELD_INDEXES.put( HsMedida.DESCRIPTION, HsMedida.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsMedida.DESCRIPTION_FULL, HsMedida.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsMedida.REQUESITOS_LEGAIS, HsMedida.REQUESITOS_LEGAIS_INDEX ); + FIELD_INDEXES.put( HsMedida.REQUESITOS_LEGAIS_FULL, HsMedida.REQUESITOS_LEGAIS_INDEX ); + FIELD_INDEXES.put( HsMedida.DELETED_DATE, HsMedida.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsMedida.DELETED_DATE_FULL, HsMedida.DELETED_DATE_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "hs_medida"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_medida"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "hs_medida.id"; + public static final int ID_INDEX = 0; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_medida.description"; + public static final int DESCRIPTION_INDEX = 1; + public static final String REQUESITOS_LEGAIS = "requesitos_legais"; + public static final String REQUESITOS_LEGAIS_FULL = "hs_medida.requesitos_legais"; + public static final int REQUESITOS_LEGAIS_INDEX = 2; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_medida.deleted_date"; + public static final int DELETED_DATE_INDEX = 3; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRIPTION, REQUESITOS_LEGAIS, DELETED_DATE, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DESCRIPTION, TABLENAME + "." + REQUESITOS_LEGAIS, TABLENAME + "." + DELETED_DATE, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DESCRIPTION, REQUESITOS_LEGAIS, DELETED_DATE, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DESCRIPTION, REQUESITOS_LEGAIS, DELETED_DATE, }; + + private Integer id; + private String description; + private String requesitos_legais; + private java.sql.Timestamp deleted_date; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsMedida() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromHsPostoMedida_medida_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsPostoMedidaData.class , getPrimaryKey().getMap().get("id"), "medida_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsRiscoMedida_medida_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRiscoMedidaData.class , getPrimaryKey().getMap().get("id"), "medida_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getDescription() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRIPTION ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.description; + } + + public void setDescription( String description ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRIPTION, description ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.description = description; + LAZY_LOADED_OBJECTS.put( DESCRIPTION, Boolean.TRUE ); + } + + public String getRequesitos_legais() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( REQUESITOS_LEGAIS ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.requesitos_legais; + } + + public void setRequesitos_legais( String requesitos_legais ) + { + try + { + setLockedForRefresh( true ); + preProcess( REQUESITOS_LEGAIS, requesitos_legais ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.requesitos_legais = requesitos_legais; + LAZY_LOADED_OBJECTS.put( REQUESITOS_LEGAIS, Boolean.TRUE ); + } + + public java.sql.Timestamp getDeleted_date() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DELETED_DATE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.deleted_date; + } + + public void setDeleted_date( java.sql.Timestamp deleted_date ) + { + try + { + setLockedForRefresh( true ); + preProcess( DELETED_DATE, deleted_date ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.deleted_date = deleted_date; + LAZY_LOADED_OBJECTS.put( DELETED_DATE, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsMedida.ID_INDEX: + value = getId(); + break; + case HsMedida.DESCRIPTION_INDEX: + value = getDescription(); + break; + case HsMedida.REQUESITOS_LEGAIS_INDEX: + value = getRequesitos_legais(); + break; + case HsMedida.DELETED_DATE_INDEX: + value = getDeleted_date(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsMedida.ID_INDEX: + value = this.id; + break; + case HsMedida.DESCRIPTION_INDEX: + value = this.description; + break; + case HsMedida.REQUESITOS_LEGAIS_INDEX: + value = this.requesitos_legais; + break; + case HsMedida.DELETED_DATE_INDEX: + value = this.deleted_date; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsMedida.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsMedida.DESCRIPTION_INDEX: + setDescription( ( String ) value ); + break; + case HsMedida.REQUESITOS_LEGAIS_INDEX: + setRequesitos_legais( ( String ) value ); + break; + case HsMedida.DELETED_DATE_INDEX: + setDeleted_date( ( java.sql.Timestamp ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsMedida.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsMedida.DESCRIPTION_INDEX: + this.description = ( String ) value; + break; + case HsMedida.REQUESITOS_LEGAIS_INDEX: + this.requesitos_legais = ( String ) value; + break; + case HsMedida.DELETED_DATE_INDEX: + this.deleted_date = ( java.sql.Timestamp ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsMedida.ID_INDEX: + theClass = Integer.class; + break; + case HsMedida.DESCRIPTION_INDEX: + theClass = String.class; + break; + case HsMedida.REQUESITOS_LEGAIS_INDEX: + theClass = String.class; + break; + case HsMedida.DELETED_DATE_INDEX: + theClass = java.sql.Timestamp.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsMedida._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsMedida.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsNormalizacao.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsNormalizacao.java new file mode 100644 index 00000000..ea261051 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsNormalizacao.java @@ -0,0 +1,459 @@ +/* +* HsNormalizacao.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsNormalizacao extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( HsNormalizacao.ID, HsNormalizacao.ID_INDEX ); + FIELD_INDEXES.put( HsNormalizacao.ID_FULL, HsNormalizacao.ID_INDEX ); + FIELD_INDEXES.put( HsNormalizacao.CODIGO, HsNormalizacao.CODIGO_INDEX ); + FIELD_INDEXES.put( HsNormalizacao.CODIGO_FULL, HsNormalizacao.CODIGO_INDEX ); + FIELD_INDEXES.put( HsNormalizacao.DESCRICAO, HsNormalizacao.DESCRICAO_INDEX ); + FIELD_INDEXES.put( HsNormalizacao.DESCRICAO_FULL, HsNormalizacao.DESCRICAO_INDEX ); + FIELD_INDEXES.put( HsNormalizacao.PORTUGUESA, HsNormalizacao.PORTUGUESA_INDEX ); + FIELD_INDEXES.put( HsNormalizacao.PORTUGUESA_FULL, HsNormalizacao.PORTUGUESA_INDEX ); + FIELD_INDEXES.put( HsNormalizacao.DELETED_DATE, HsNormalizacao.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsNormalizacao.DELETED_DATE_FULL, HsNormalizacao.DELETED_DATE_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "hs_normalizacao"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_normalizacao"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "hs_normalizacao.id"; + public static final int ID_INDEX = 0; + public static final String CODIGO = "codigo"; + public static final String CODIGO_FULL = "hs_normalizacao.codigo"; + public static final int CODIGO_INDEX = 1; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "hs_normalizacao.descricao"; + public static final int DESCRICAO_INDEX = 2; + public static final String PORTUGUESA = "portuguesa"; + public static final String PORTUGUESA_FULL = "hs_normalizacao.portuguesa"; + public static final int PORTUGUESA_INDEX = 3; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_normalizacao.deleted_date"; + public static final int DELETED_DATE_INDEX = 4; + + public static final String FIELD_NAMES[] = new String[]{ + CODIGO, DESCRICAO, PORTUGUESA, DELETED_DATE, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + CODIGO, TABLENAME + "." + DESCRICAO, TABLENAME + "." + PORTUGUESA, TABLENAME + "." + DELETED_DATE, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, CODIGO, DESCRICAO, PORTUGUESA, DELETED_DATE, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, CODIGO, DESCRICAO, PORTUGUESA, DELETED_DATE, }; + + private Integer id; + private String codigo; + private String descricao; + private Boolean portuguesa; + private java.sql.Timestamp deleted_date; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsNormalizacao() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromHsNormalizacaoEmpresa_normalizacao_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsNormalizacaoEmpresaData.class , getPrimaryKey().getMap().get("id"), "normalizacao_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsNormalizacaoEstabelecimento_normalizacao_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsNormalizacaoEstabelecimentoData.class , getPrimaryKey().getMap().get("id"), "normalizacao_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getCodigo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CODIGO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.codigo; + } + + public void setCodigo( String codigo ) + { + try + { + setLockedForRefresh( true ); + preProcess( CODIGO, codigo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.codigo = codigo; + LAZY_LOADED_OBJECTS.put( CODIGO, Boolean.TRUE ); + } + + public String getDescricao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRICAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.descricao; + } + + public void setDescricao( String descricao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRICAO, descricao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.descricao = descricao; + LAZY_LOADED_OBJECTS.put( DESCRICAO, Boolean.TRUE ); + } + + public Boolean getPortuguesa() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PORTUGUESA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.portuguesa; + } + + public void setPortuguesa( Boolean portuguesa ) + { + try + { + setLockedForRefresh( true ); + preProcess( PORTUGUESA, portuguesa ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.portuguesa = portuguesa; + LAZY_LOADED_OBJECTS.put( PORTUGUESA, Boolean.TRUE ); + } + + public java.sql.Timestamp getDeleted_date() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DELETED_DATE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.deleted_date; + } + + public void setDeleted_date( java.sql.Timestamp deleted_date ) + { + try + { + setLockedForRefresh( true ); + preProcess( DELETED_DATE, deleted_date ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.deleted_date = deleted_date; + LAZY_LOADED_OBJECTS.put( DELETED_DATE, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsNormalizacao.ID_INDEX: + value = getId(); + break; + case HsNormalizacao.CODIGO_INDEX: + value = getCodigo(); + break; + case HsNormalizacao.DESCRICAO_INDEX: + value = getDescricao(); + break; + case HsNormalizacao.PORTUGUESA_INDEX: + value = getPortuguesa(); + break; + case HsNormalizacao.DELETED_DATE_INDEX: + value = getDeleted_date(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsNormalizacao.ID_INDEX: + value = this.id; + break; + case HsNormalizacao.CODIGO_INDEX: + value = this.codigo; + break; + case HsNormalizacao.DESCRICAO_INDEX: + value = this.descricao; + break; + case HsNormalizacao.PORTUGUESA_INDEX: + value = this.portuguesa; + break; + case HsNormalizacao.DELETED_DATE_INDEX: + value = this.deleted_date; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsNormalizacao.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsNormalizacao.CODIGO_INDEX: + setCodigo( ( String ) value ); + break; + case HsNormalizacao.DESCRICAO_INDEX: + setDescricao( ( String ) value ); + break; + case HsNormalizacao.PORTUGUESA_INDEX: + setPortuguesa( ( Boolean ) value ); + break; + case HsNormalizacao.DELETED_DATE_INDEX: + setDeleted_date( ( java.sql.Timestamp ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsNormalizacao.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsNormalizacao.CODIGO_INDEX: + this.codigo = ( String ) value; + break; + case HsNormalizacao.DESCRICAO_INDEX: + this.descricao = ( String ) value; + break; + case HsNormalizacao.PORTUGUESA_INDEX: + this.portuguesa = ( Boolean ) value; + break; + case HsNormalizacao.DELETED_DATE_INDEX: + this.deleted_date = ( java.sql.Timestamp ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsNormalizacao.ID_INDEX: + theClass = Integer.class; + break; + case HsNormalizacao.CODIGO_INDEX: + theClass = String.class; + break; + case HsNormalizacao.DESCRICAO_INDEX: + theClass = String.class; + break; + case HsNormalizacao.PORTUGUESA_INDEX: + theClass = Boolean.class; + break; + case HsNormalizacao.DELETED_DATE_INDEX: + theClass = java.sql.Timestamp.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsNormalizacao._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsNormalizacao.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsNormalizacaoEmpresa.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsNormalizacaoEmpresa.java new file mode 100644 index 00000000..8ffcfd0e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsNormalizacaoEmpresa.java @@ -0,0 +1,379 @@ +/* +* HsNormalizacaoEmpresa.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsNormalizacaoEmpresa extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + com.evolute.entity.evo.EvoDataObject.register( HsNormalizacaoEmpresa.CLASS_IDENTIFIER, HsNormalizacaoEmpresa.NORMALIZACAO_ID, HsNormalizacaoEmpresa.TO_NORMALIZACAO_ID ); + FIELD_INDEXES.put( HsNormalizacaoEmpresa.NORMALIZACAO_ID, HsNormalizacaoEmpresa.NORMALIZACAO_ID_INDEX ); + FIELD_INDEXES.put( HsNormalizacaoEmpresa.NORMALIZACAO_ID_FULL, HsNormalizacaoEmpresa.NORMALIZACAO_ID_INDEX ); + FIELD_INDEXES.put( HsNormalizacaoEmpresa.TO_NORMALIZACAO_ID, HsNormalizacaoEmpresa.TO_NORMALIZACAO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsNormalizacaoEmpresa.CLASS_IDENTIFIER, HsNormalizacaoEmpresa.EMPRESA_ID, HsNormalizacaoEmpresa.TO_EMPRESA_ID ); + FIELD_INDEXES.put( HsNormalizacaoEmpresa.EMPRESA_ID, HsNormalizacaoEmpresa.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( HsNormalizacaoEmpresa.EMPRESA_ID_FULL, HsNormalizacaoEmpresa.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( HsNormalizacaoEmpresa.TO_EMPRESA_ID, HsNormalizacaoEmpresa.TO_EMPRESA_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeynormalizacao_idTohs_normalizacao = + new com.evolute.entity.ForeignKey( HsNormalizacaoEmpresa.class, HsNormalizacaoEmpresa.NORMALIZACAO_ID, siprp.data.outer.HsNormalizacaoData.class, siprp.data.outer.HsNormalizacaoData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyempresa_idToempresas = + new com.evolute.entity.ForeignKey( HsNormalizacaoEmpresa.class, HsNormalizacaoEmpresa.EMPRESA_ID, siprp.data.outer.EmpresasData.class, siprp.data.outer.EmpresasData.ID ); + + public static final String TABLENAME = "hs_normalizacao_empresa"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_normalizacao_empresa"; + + public static final int _INVALID__INDEX = -1; + public static final String NORMALIZACAO_ID = "normalizacao_id"; + public static final String NORMALIZACAO_ID_FULL = "hs_normalizacao_empresa.normalizacao_id"; + public static final int NORMALIZACAO_ID_INDEX = 0; + public static final String TO_NORMALIZACAO_ID = "to_normalizacao_id"; + public static final int TO_NORMALIZACAO_ID_INDEX = 1; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "hs_normalizacao_empresa.empresa_id"; + public static final int EMPRESA_ID_INDEX = 2; + public static final String TO_EMPRESA_ID = "to_empresa_id"; + public static final int TO_EMPRESA_ID_INDEX = 3; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + NORMALIZACAO_ID, EMPRESA_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + NORMALIZACAO_ID, EMPRESA_ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + NORMALIZACAO_ID, EMPRESA_ID, }; + + private Integer normalizacao_id; + private siprp.data.outer.HsNormalizacaoData to_normalizacao_id; + private Integer empresa_id; + private siprp.data.outer.EmpresasData to_empresa_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsNormalizacaoEmpresa() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false }; + } + + public Integer getNormalizacao_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NORMALIZACAO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.normalizacao_id; + } + + public void setNormalizacao_id( Integer normalizacao_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( NORMALIZACAO_ID, normalizacao_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.normalizacao_id = normalizacao_id; + LAZY_LOADED_OBJECTS.put( NORMALIZACAO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsNormalizacaoData toNormalizacao_id() + { + try + { + prepare( TO_NORMALIZACAO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_normalizacao_id; + } + + public void setToNormalizacao_id( siprp.data.outer.HsNormalizacaoData to_normalizacao_id ) + { + try + { + preProcess( TO_NORMALIZACAO_ID, to_normalizacao_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_normalizacao_id = to_normalizacao_id; + } + + public Integer getEmpresa_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMPRESA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.empresa_id; + } + + public void setEmpresa_id( Integer empresa_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMPRESA_ID, empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.empresa_id = empresa_id; + LAZY_LOADED_OBJECTS.put( EMPRESA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EmpresasData toEmpresa_id() + { + try + { + prepare( TO_EMPRESA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_empresa_id; + } + + public void setToEmpresa_id( siprp.data.outer.EmpresasData to_empresa_id ) + { + try + { + preProcess( TO_EMPRESA_ID, to_empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_empresa_id = to_empresa_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsNormalizacaoEmpresa.NORMALIZACAO_ID_INDEX: + value = getNormalizacao_id(); + break; + case HsNormalizacaoEmpresa.TO_NORMALIZACAO_ID_INDEX: + value = toNormalizacao_id(); + break; + case HsNormalizacaoEmpresa.EMPRESA_ID_INDEX: + value = getEmpresa_id(); + break; + case HsNormalizacaoEmpresa.TO_EMPRESA_ID_INDEX: + value = toEmpresa_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsNormalizacaoEmpresa.NORMALIZACAO_ID_INDEX: + value = this.normalizacao_id; + break; + case HsNormalizacaoEmpresa.TO_NORMALIZACAO_ID_INDEX: + value = this.to_normalizacao_id; + break; + case HsNormalizacaoEmpresa.EMPRESA_ID_INDEX: + value = this.empresa_id; + break; + case HsNormalizacaoEmpresa.TO_EMPRESA_ID_INDEX: + value = this.to_empresa_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsNormalizacaoEmpresa.NORMALIZACAO_ID_INDEX: + setNormalizacao_id( ( Integer ) value ); + break; + case HsNormalizacaoEmpresa.TO_NORMALIZACAO_ID_INDEX: + setToNormalizacao_id( ( siprp.data.outer.HsNormalizacaoData ) value ); + break; + case HsNormalizacaoEmpresa.EMPRESA_ID_INDEX: + setEmpresa_id( ( Integer ) value ); + break; + case HsNormalizacaoEmpresa.TO_EMPRESA_ID_INDEX: + setToEmpresa_id( ( siprp.data.outer.EmpresasData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsNormalizacaoEmpresa.NORMALIZACAO_ID_INDEX: + this.normalizacao_id = ( Integer ) value; + break; + case HsNormalizacaoEmpresa.TO_NORMALIZACAO_ID_INDEX: + this.to_normalizacao_id = ( siprp.data.outer.HsNormalizacaoData ) value; + break; + case HsNormalizacaoEmpresa.EMPRESA_ID_INDEX: + this.empresa_id = ( Integer ) value; + break; + case HsNormalizacaoEmpresa.TO_EMPRESA_ID_INDEX: + this.to_empresa_id = ( siprp.data.outer.EmpresasData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + throw new RuntimeException( "getPrimaryKeyName on HsNormalizacaoEmpresa is invalid" ); + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsNormalizacaoEmpresa.NORMALIZACAO_ID_INDEX: + theClass = Integer.class; + break; + case HsNormalizacaoEmpresa.TO_NORMALIZACAO_ID_INDEX: + theClass = siprp.data.outer.HsNormalizacaoData.class; + break; + case HsNormalizacaoEmpresa.EMPRESA_ID_INDEX: + theClass = Integer.class; + break; + case HsNormalizacaoEmpresa.TO_EMPRESA_ID_INDEX: + theClass = siprp.data.outer.EmpresasData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsNormalizacaoEmpresa._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsNormalizacaoEmpresa.PK_FIELD_NAMES ); + primaryKey.set( 0, getNormalizacao_id() ); + primaryKey.set( 1, getEmpresa_id() ); + } + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsNormalizacaoEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsNormalizacaoEstabelecimento.java new file mode 100644 index 00000000..5e6b5e5b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsNormalizacaoEstabelecimento.java @@ -0,0 +1,379 @@ +/* +* HsNormalizacaoEstabelecimento.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsNormalizacaoEstabelecimento extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + com.evolute.entity.evo.EvoDataObject.register( HsNormalizacaoEstabelecimento.CLASS_IDENTIFIER, HsNormalizacaoEstabelecimento.NORMALIZACAO_ID, HsNormalizacaoEstabelecimento.TO_NORMALIZACAO_ID ); + FIELD_INDEXES.put( HsNormalizacaoEstabelecimento.NORMALIZACAO_ID, HsNormalizacaoEstabelecimento.NORMALIZACAO_ID_INDEX ); + FIELD_INDEXES.put( HsNormalizacaoEstabelecimento.NORMALIZACAO_ID_FULL, HsNormalizacaoEstabelecimento.NORMALIZACAO_ID_INDEX ); + FIELD_INDEXES.put( HsNormalizacaoEstabelecimento.TO_NORMALIZACAO_ID, HsNormalizacaoEstabelecimento.TO_NORMALIZACAO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsNormalizacaoEstabelecimento.CLASS_IDENTIFIER, HsNormalizacaoEstabelecimento.ESTABELECIMENTO_ID, HsNormalizacaoEstabelecimento.TO_ESTABELECIMENTO_ID ); + FIELD_INDEXES.put( HsNormalizacaoEstabelecimento.ESTABELECIMENTO_ID, HsNormalizacaoEstabelecimento.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( HsNormalizacaoEstabelecimento.ESTABELECIMENTO_ID_FULL, HsNormalizacaoEstabelecimento.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( HsNormalizacaoEstabelecimento.TO_ESTABELECIMENTO_ID, HsNormalizacaoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeynormalizacao_idTohs_normalizacao = + new com.evolute.entity.ForeignKey( HsNormalizacaoEstabelecimento.class, HsNormalizacaoEstabelecimento.NORMALIZACAO_ID, siprp.data.outer.HsNormalizacaoData.class, siprp.data.outer.HsNormalizacaoData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyestabelecimento_idToestabelecimentos = + new com.evolute.entity.ForeignKey( HsNormalizacaoEstabelecimento.class, HsNormalizacaoEstabelecimento.ESTABELECIMENTO_ID, siprp.data.outer.EstabelecimentosData.class, siprp.data.outer.EstabelecimentosData.ID ); + + public static final String TABLENAME = "hs_normalizacao_estabelecimento"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_normalizacao_estabelecimento"; + + public static final int _INVALID__INDEX = -1; + public static final String NORMALIZACAO_ID = "normalizacao_id"; + public static final String NORMALIZACAO_ID_FULL = "hs_normalizacao_estabelecimento.normalizacao_id"; + public static final int NORMALIZACAO_ID_INDEX = 0; + public static final String TO_NORMALIZACAO_ID = "to_normalizacao_id"; + public static final int TO_NORMALIZACAO_ID_INDEX = 1; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "hs_normalizacao_estabelecimento.estabelecimento_id"; + public static final int ESTABELECIMENTO_ID_INDEX = 2; + public static final String TO_ESTABELECIMENTO_ID = "to_estabelecimento_id"; + public static final int TO_ESTABELECIMENTO_ID_INDEX = 3; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + NORMALIZACAO_ID, ESTABELECIMENTO_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + NORMALIZACAO_ID, ESTABELECIMENTO_ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + NORMALIZACAO_ID, ESTABELECIMENTO_ID, }; + + private Integer normalizacao_id; + private siprp.data.outer.HsNormalizacaoData to_normalizacao_id; + private Integer estabelecimento_id; + private siprp.data.outer.EstabelecimentosData to_estabelecimento_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsNormalizacaoEstabelecimento() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false }; + } + + public Integer getNormalizacao_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NORMALIZACAO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.normalizacao_id; + } + + public void setNormalizacao_id( Integer normalizacao_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( NORMALIZACAO_ID, normalizacao_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.normalizacao_id = normalizacao_id; + LAZY_LOADED_OBJECTS.put( NORMALIZACAO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsNormalizacaoData toNormalizacao_id() + { + try + { + prepare( TO_NORMALIZACAO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_normalizacao_id; + } + + public void setToNormalizacao_id( siprp.data.outer.HsNormalizacaoData to_normalizacao_id ) + { + try + { + preProcess( TO_NORMALIZACAO_ID, to_normalizacao_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_normalizacao_id = to_normalizacao_id; + } + + public Integer getEstabelecimento_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTABELECIMENTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estabelecimento_id; + } + + public void setEstabelecimento_id( Integer estabelecimento_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTABELECIMENTO_ID, estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estabelecimento_id = estabelecimento_id; + LAZY_LOADED_OBJECTS.put( ESTABELECIMENTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EstabelecimentosData toEstabelecimento_id() + { + try + { + prepare( TO_ESTABELECIMENTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_estabelecimento_id; + } + + public void setToEstabelecimento_id( siprp.data.outer.EstabelecimentosData to_estabelecimento_id ) + { + try + { + preProcess( TO_ESTABELECIMENTO_ID, to_estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_estabelecimento_id = to_estabelecimento_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsNormalizacaoEstabelecimento.NORMALIZACAO_ID_INDEX: + value = getNormalizacao_id(); + break; + case HsNormalizacaoEstabelecimento.TO_NORMALIZACAO_ID_INDEX: + value = toNormalizacao_id(); + break; + case HsNormalizacaoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + value = getEstabelecimento_id(); + break; + case HsNormalizacaoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + value = toEstabelecimento_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsNormalizacaoEstabelecimento.NORMALIZACAO_ID_INDEX: + value = this.normalizacao_id; + break; + case HsNormalizacaoEstabelecimento.TO_NORMALIZACAO_ID_INDEX: + value = this.to_normalizacao_id; + break; + case HsNormalizacaoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + value = this.estabelecimento_id; + break; + case HsNormalizacaoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + value = this.to_estabelecimento_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsNormalizacaoEstabelecimento.NORMALIZACAO_ID_INDEX: + setNormalizacao_id( ( Integer ) value ); + break; + case HsNormalizacaoEstabelecimento.TO_NORMALIZACAO_ID_INDEX: + setToNormalizacao_id( ( siprp.data.outer.HsNormalizacaoData ) value ); + break; + case HsNormalizacaoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + setEstabelecimento_id( ( Integer ) value ); + break; + case HsNormalizacaoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + setToEstabelecimento_id( ( siprp.data.outer.EstabelecimentosData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsNormalizacaoEstabelecimento.NORMALIZACAO_ID_INDEX: + this.normalizacao_id = ( Integer ) value; + break; + case HsNormalizacaoEstabelecimento.TO_NORMALIZACAO_ID_INDEX: + this.to_normalizacao_id = ( siprp.data.outer.HsNormalizacaoData ) value; + break; + case HsNormalizacaoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + this.estabelecimento_id = ( Integer ) value; + break; + case HsNormalizacaoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + this.to_estabelecimento_id = ( siprp.data.outer.EstabelecimentosData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + throw new RuntimeException( "getPrimaryKeyName on HsNormalizacaoEstabelecimento is invalid" ); + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsNormalizacaoEstabelecimento.NORMALIZACAO_ID_INDEX: + theClass = Integer.class; + break; + case HsNormalizacaoEstabelecimento.TO_NORMALIZACAO_ID_INDEX: + theClass = siprp.data.outer.HsNormalizacaoData.class; + break; + case HsNormalizacaoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + theClass = Integer.class; + break; + case HsNormalizacaoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + theClass = siprp.data.outer.EstabelecimentosData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsNormalizacaoEstabelecimento._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsNormalizacaoEstabelecimento.PK_FIELD_NAMES ); + primaryKey.set( 0, getNormalizacao_id() ); + primaryKey.set( 1, getEstabelecimento_id() ); + } + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsPosto.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsPosto.java new file mode 100644 index 00000000..903ea39d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsPosto.java @@ -0,0 +1,522 @@ +/* +* HsPosto.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsPosto extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( HsPosto.ID, HsPosto.ID_INDEX ); + FIELD_INDEXES.put( HsPosto.ID_FULL, HsPosto.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsPosto.CLASS_IDENTIFIER, HsPosto.AREA_ID, HsPosto.TO_AREA_ID ); + FIELD_INDEXES.put( HsPosto.AREA_ID, HsPosto.AREA_ID_INDEX ); + FIELD_INDEXES.put( HsPosto.AREA_ID_FULL, HsPosto.AREA_ID_INDEX ); + FIELD_INDEXES.put( HsPosto.TO_AREA_ID, HsPosto.TO_AREA_ID_INDEX ); + FIELD_INDEXES.put( HsPosto.DESCRIPTION, HsPosto.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsPosto.DESCRIPTION_FULL, HsPosto.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsPosto.DELETED_DATE, HsPosto.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsPosto.DELETED_DATE_FULL, HsPosto.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsPosto.IS_PRINCIPAL, HsPosto.IS_PRINCIPAL_INDEX ); + FIELD_INDEXES.put( HsPosto.IS_PRINCIPAL_FULL, HsPosto.IS_PRINCIPAL_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyarea_idTohs_area = + new com.evolute.entity.ForeignKey( HsPosto.class, HsPosto.AREA_ID, siprp.data.outer.HsAreaData.class, siprp.data.outer.HsAreaData.ID ); + + public static final String TABLENAME = "hs_posto"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_posto"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "hs_posto.id"; + public static final int ID_INDEX = 0; + public static final String AREA_ID = "area_id"; + public static final String AREA_ID_FULL = "hs_posto.area_id"; + public static final int AREA_ID_INDEX = 1; + public static final String TO_AREA_ID = "to_area_id"; + public static final int TO_AREA_ID_INDEX = 2; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_posto.description"; + public static final int DESCRIPTION_INDEX = 3; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_posto.deleted_date"; + public static final int DELETED_DATE_INDEX = 4; + public static final String IS_PRINCIPAL = "is_principal"; + public static final String IS_PRINCIPAL_FULL = "hs_posto.is_principal"; + public static final int IS_PRINCIPAL_INDEX = 5; + + public static final String FIELD_NAMES[] = new String[]{ + AREA_ID, TO_AREA_ID, DESCRIPTION, DELETED_DATE, IS_PRINCIPAL, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + AREA_ID, TABLENAME + "." + TO_AREA_ID, TABLENAME + "." + DESCRIPTION, TABLENAME + "." + DELETED_DATE, TABLENAME + "." + IS_PRINCIPAL, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, AREA_ID, DESCRIPTION, DELETED_DATE, IS_PRINCIPAL, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, AREA_ID, DESCRIPTION, DELETED_DATE, IS_PRINCIPAL, }; + + private Integer id; + private Integer area_id; + private siprp.data.outer.HsAreaData to_area_id; + private String description; + private java.sql.Timestamp deleted_date; + private Boolean is_principal; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsPosto() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromHsPostoEstabelecimento_posto_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsPostoEstabelecimentoData.class , getPrimaryKey().getMap().get("id"), "posto_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsPostoMedida_posto_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsPostoMedidaData.class , getPrimaryKey().getMap().get("id"), "posto_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsPostoRisco_posto_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsPostoRiscoData.class , getPrimaryKey().getMap().get("id"), "posto_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public Integer getArea_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( AREA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.area_id; + } + + public void setArea_id( Integer area_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( AREA_ID, area_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.area_id = area_id; + LAZY_LOADED_OBJECTS.put( AREA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsAreaData toArea_id() + { + try + { + prepare( TO_AREA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_area_id; + } + + public void setToArea_id( siprp.data.outer.HsAreaData to_area_id ) + { + try + { + preProcess( TO_AREA_ID, to_area_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_area_id = to_area_id; + } + + public String getDescription() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRIPTION ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.description; + } + + public void setDescription( String description ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRIPTION, description ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.description = description; + LAZY_LOADED_OBJECTS.put( DESCRIPTION, Boolean.TRUE ); + } + + public java.sql.Timestamp getDeleted_date() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DELETED_DATE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.deleted_date; + } + + public void setDeleted_date( java.sql.Timestamp deleted_date ) + { + try + { + setLockedForRefresh( true ); + preProcess( DELETED_DATE, deleted_date ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.deleted_date = deleted_date; + LAZY_LOADED_OBJECTS.put( DELETED_DATE, Boolean.TRUE ); + } + + public Boolean getIs_principal() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( IS_PRINCIPAL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.is_principal; + } + + public void setIs_principal( Boolean is_principal ) + { + try + { + setLockedForRefresh( true ); + preProcess( IS_PRINCIPAL, is_principal ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.is_principal = is_principal; + LAZY_LOADED_OBJECTS.put( IS_PRINCIPAL, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsPosto.ID_INDEX: + value = getId(); + break; + case HsPosto.AREA_ID_INDEX: + value = getArea_id(); + break; + case HsPosto.TO_AREA_ID_INDEX: + value = toArea_id(); + break; + case HsPosto.DESCRIPTION_INDEX: + value = getDescription(); + break; + case HsPosto.DELETED_DATE_INDEX: + value = getDeleted_date(); + break; + case HsPosto.IS_PRINCIPAL_INDEX: + value = getIs_principal(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsPosto.ID_INDEX: + value = this.id; + break; + case HsPosto.AREA_ID_INDEX: + value = this.area_id; + break; + case HsPosto.TO_AREA_ID_INDEX: + value = this.to_area_id; + break; + case HsPosto.DESCRIPTION_INDEX: + value = this.description; + break; + case HsPosto.DELETED_DATE_INDEX: + value = this.deleted_date; + break; + case HsPosto.IS_PRINCIPAL_INDEX: + value = this.is_principal; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsPosto.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsPosto.AREA_ID_INDEX: + setArea_id( ( Integer ) value ); + break; + case HsPosto.TO_AREA_ID_INDEX: + setToArea_id( ( siprp.data.outer.HsAreaData ) value ); + break; + case HsPosto.DESCRIPTION_INDEX: + setDescription( ( String ) value ); + break; + case HsPosto.DELETED_DATE_INDEX: + setDeleted_date( ( java.sql.Timestamp ) value ); + break; + case HsPosto.IS_PRINCIPAL_INDEX: + setIs_principal( ( Boolean ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsPosto.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsPosto.AREA_ID_INDEX: + this.area_id = ( Integer ) value; + break; + case HsPosto.TO_AREA_ID_INDEX: + this.to_area_id = ( siprp.data.outer.HsAreaData ) value; + break; + case HsPosto.DESCRIPTION_INDEX: + this.description = ( String ) value; + break; + case HsPosto.DELETED_DATE_INDEX: + this.deleted_date = ( java.sql.Timestamp ) value; + break; + case HsPosto.IS_PRINCIPAL_INDEX: + this.is_principal = ( Boolean ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsPosto.ID_INDEX: + theClass = Integer.class; + break; + case HsPosto.AREA_ID_INDEX: + theClass = Integer.class; + break; + case HsPosto.TO_AREA_ID_INDEX: + theClass = siprp.data.outer.HsAreaData.class; + break; + case HsPosto.DESCRIPTION_INDEX: + theClass = String.class; + break; + case HsPosto.DELETED_DATE_INDEX: + theClass = java.sql.Timestamp.class; + break; + case HsPosto.IS_PRINCIPAL_INDEX: + theClass = Boolean.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsPosto._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsPosto.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsPostoEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsPostoEstabelecimento.java new file mode 100644 index 00000000..05856729 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsPostoEstabelecimento.java @@ -0,0 +1,379 @@ +/* +* HsPostoEstabelecimento.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsPostoEstabelecimento extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + com.evolute.entity.evo.EvoDataObject.register( HsPostoEstabelecimento.CLASS_IDENTIFIER, HsPostoEstabelecimento.POSTO_ID, HsPostoEstabelecimento.TO_POSTO_ID ); + FIELD_INDEXES.put( HsPostoEstabelecimento.POSTO_ID, HsPostoEstabelecimento.POSTO_ID_INDEX ); + FIELD_INDEXES.put( HsPostoEstabelecimento.POSTO_ID_FULL, HsPostoEstabelecimento.POSTO_ID_INDEX ); + FIELD_INDEXES.put( HsPostoEstabelecimento.TO_POSTO_ID, HsPostoEstabelecimento.TO_POSTO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsPostoEstabelecimento.CLASS_IDENTIFIER, HsPostoEstabelecimento.ESTABELECIMENTO_ID, HsPostoEstabelecimento.TO_ESTABELECIMENTO_ID ); + FIELD_INDEXES.put( HsPostoEstabelecimento.ESTABELECIMENTO_ID, HsPostoEstabelecimento.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( HsPostoEstabelecimento.ESTABELECIMENTO_ID_FULL, HsPostoEstabelecimento.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( HsPostoEstabelecimento.TO_ESTABELECIMENTO_ID, HsPostoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyposto_idTohs_posto = + new com.evolute.entity.ForeignKey( HsPostoEstabelecimento.class, HsPostoEstabelecimento.POSTO_ID, siprp.data.outer.HsPostoData.class, siprp.data.outer.HsPostoData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyestabelecimento_idToestabelecimentos = + new com.evolute.entity.ForeignKey( HsPostoEstabelecimento.class, HsPostoEstabelecimento.ESTABELECIMENTO_ID, siprp.data.outer.EstabelecimentosData.class, siprp.data.outer.EstabelecimentosData.ID ); + + public static final String TABLENAME = "hs_posto_estabelecimento"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_posto_estabelecimento"; + + public static final int _INVALID__INDEX = -1; + public static final String POSTO_ID = "posto_id"; + public static final String POSTO_ID_FULL = "hs_posto_estabelecimento.posto_id"; + public static final int POSTO_ID_INDEX = 0; + public static final String TO_POSTO_ID = "to_posto_id"; + public static final int TO_POSTO_ID_INDEX = 1; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "hs_posto_estabelecimento.estabelecimento_id"; + public static final int ESTABELECIMENTO_ID_INDEX = 2; + public static final String TO_ESTABELECIMENTO_ID = "to_estabelecimento_id"; + public static final int TO_ESTABELECIMENTO_ID_INDEX = 3; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + POSTO_ID, ESTABELECIMENTO_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + POSTO_ID, ESTABELECIMENTO_ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + POSTO_ID, ESTABELECIMENTO_ID, }; + + private Integer posto_id; + private siprp.data.outer.HsPostoData to_posto_id; + private Integer estabelecimento_id; + private siprp.data.outer.EstabelecimentosData to_estabelecimento_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsPostoEstabelecimento() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false }; + } + + public Integer getPosto_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( POSTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.posto_id; + } + + public void setPosto_id( Integer posto_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( POSTO_ID, posto_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.posto_id = posto_id; + LAZY_LOADED_OBJECTS.put( POSTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsPostoData toPosto_id() + { + try + { + prepare( TO_POSTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_posto_id; + } + + public void setToPosto_id( siprp.data.outer.HsPostoData to_posto_id ) + { + try + { + preProcess( TO_POSTO_ID, to_posto_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_posto_id = to_posto_id; + } + + public Integer getEstabelecimento_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTABELECIMENTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estabelecimento_id; + } + + public void setEstabelecimento_id( Integer estabelecimento_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTABELECIMENTO_ID, estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estabelecimento_id = estabelecimento_id; + LAZY_LOADED_OBJECTS.put( ESTABELECIMENTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EstabelecimentosData toEstabelecimento_id() + { + try + { + prepare( TO_ESTABELECIMENTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_estabelecimento_id; + } + + public void setToEstabelecimento_id( siprp.data.outer.EstabelecimentosData to_estabelecimento_id ) + { + try + { + preProcess( TO_ESTABELECIMENTO_ID, to_estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_estabelecimento_id = to_estabelecimento_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsPostoEstabelecimento.POSTO_ID_INDEX: + value = getPosto_id(); + break; + case HsPostoEstabelecimento.TO_POSTO_ID_INDEX: + value = toPosto_id(); + break; + case HsPostoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + value = getEstabelecimento_id(); + break; + case HsPostoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + value = toEstabelecimento_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsPostoEstabelecimento.POSTO_ID_INDEX: + value = this.posto_id; + break; + case HsPostoEstabelecimento.TO_POSTO_ID_INDEX: + value = this.to_posto_id; + break; + case HsPostoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + value = this.estabelecimento_id; + break; + case HsPostoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + value = this.to_estabelecimento_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsPostoEstabelecimento.POSTO_ID_INDEX: + setPosto_id( ( Integer ) value ); + break; + case HsPostoEstabelecimento.TO_POSTO_ID_INDEX: + setToPosto_id( ( siprp.data.outer.HsPostoData ) value ); + break; + case HsPostoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + setEstabelecimento_id( ( Integer ) value ); + break; + case HsPostoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + setToEstabelecimento_id( ( siprp.data.outer.EstabelecimentosData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsPostoEstabelecimento.POSTO_ID_INDEX: + this.posto_id = ( Integer ) value; + break; + case HsPostoEstabelecimento.TO_POSTO_ID_INDEX: + this.to_posto_id = ( siprp.data.outer.HsPostoData ) value; + break; + case HsPostoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + this.estabelecimento_id = ( Integer ) value; + break; + case HsPostoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + this.to_estabelecimento_id = ( siprp.data.outer.EstabelecimentosData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + throw new RuntimeException( "getPrimaryKeyName on HsPostoEstabelecimento is invalid" ); + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsPostoEstabelecimento.POSTO_ID_INDEX: + theClass = Integer.class; + break; + case HsPostoEstabelecimento.TO_POSTO_ID_INDEX: + theClass = siprp.data.outer.HsPostoData.class; + break; + case HsPostoEstabelecimento.ESTABELECIMENTO_ID_INDEX: + theClass = Integer.class; + break; + case HsPostoEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + theClass = siprp.data.outer.EstabelecimentosData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsPostoEstabelecimento._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsPostoEstabelecimento.PK_FIELD_NAMES ); + primaryKey.set( 0, getPosto_id() ); + primaryKey.set( 1, getEstabelecimento_id() ); + } + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsPostoMedida.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsPostoMedida.java new file mode 100644 index 00000000..a9a5dd68 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsPostoMedida.java @@ -0,0 +1,379 @@ +/* +* HsPostoMedida.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsPostoMedida extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + com.evolute.entity.evo.EvoDataObject.register( HsPostoMedida.CLASS_IDENTIFIER, HsPostoMedida.POSTO_ID, HsPostoMedida.TO_POSTO_ID ); + FIELD_INDEXES.put( HsPostoMedida.POSTO_ID, HsPostoMedida.POSTO_ID_INDEX ); + FIELD_INDEXES.put( HsPostoMedida.POSTO_ID_FULL, HsPostoMedida.POSTO_ID_INDEX ); + FIELD_INDEXES.put( HsPostoMedida.TO_POSTO_ID, HsPostoMedida.TO_POSTO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsPostoMedida.CLASS_IDENTIFIER, HsPostoMedida.MEDIDA_ID, HsPostoMedida.TO_MEDIDA_ID ); + FIELD_INDEXES.put( HsPostoMedida.MEDIDA_ID, HsPostoMedida.MEDIDA_ID_INDEX ); + FIELD_INDEXES.put( HsPostoMedida.MEDIDA_ID_FULL, HsPostoMedida.MEDIDA_ID_INDEX ); + FIELD_INDEXES.put( HsPostoMedida.TO_MEDIDA_ID, HsPostoMedida.TO_MEDIDA_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyposto_idTohs_posto = + new com.evolute.entity.ForeignKey( HsPostoMedida.class, HsPostoMedida.POSTO_ID, siprp.data.outer.HsPostoData.class, siprp.data.outer.HsPostoData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeymedida_idTohs_medida = + new com.evolute.entity.ForeignKey( HsPostoMedida.class, HsPostoMedida.MEDIDA_ID, siprp.data.outer.HsMedidaData.class, siprp.data.outer.HsMedidaData.ID ); + + public static final String TABLENAME = "hs_posto_medida"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_posto_medida"; + + public static final int _INVALID__INDEX = -1; + public static final String POSTO_ID = "posto_id"; + public static final String POSTO_ID_FULL = "hs_posto_medida.posto_id"; + public static final int POSTO_ID_INDEX = 0; + public static final String TO_POSTO_ID = "to_posto_id"; + public static final int TO_POSTO_ID_INDEX = 1; + public static final String MEDIDA_ID = "medida_id"; + public static final String MEDIDA_ID_FULL = "hs_posto_medida.medida_id"; + public static final int MEDIDA_ID_INDEX = 2; + public static final String TO_MEDIDA_ID = "to_medida_id"; + public static final int TO_MEDIDA_ID_INDEX = 3; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + POSTO_ID, MEDIDA_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + POSTO_ID, MEDIDA_ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + POSTO_ID, MEDIDA_ID, }; + + private Integer posto_id; + private siprp.data.outer.HsPostoData to_posto_id; + private Integer medida_id; + private siprp.data.outer.HsMedidaData to_medida_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsPostoMedida() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false }; + } + + public Integer getPosto_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( POSTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.posto_id; + } + + public void setPosto_id( Integer posto_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( POSTO_ID, posto_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.posto_id = posto_id; + LAZY_LOADED_OBJECTS.put( POSTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsPostoData toPosto_id() + { + try + { + prepare( TO_POSTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_posto_id; + } + + public void setToPosto_id( siprp.data.outer.HsPostoData to_posto_id ) + { + try + { + preProcess( TO_POSTO_ID, to_posto_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_posto_id = to_posto_id; + } + + public Integer getMedida_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MEDIDA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.medida_id; + } + + public void setMedida_id( Integer medida_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( MEDIDA_ID, medida_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.medida_id = medida_id; + LAZY_LOADED_OBJECTS.put( MEDIDA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsMedidaData toMedida_id() + { + try + { + prepare( TO_MEDIDA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_medida_id; + } + + public void setToMedida_id( siprp.data.outer.HsMedidaData to_medida_id ) + { + try + { + preProcess( TO_MEDIDA_ID, to_medida_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_medida_id = to_medida_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsPostoMedida.POSTO_ID_INDEX: + value = getPosto_id(); + break; + case HsPostoMedida.TO_POSTO_ID_INDEX: + value = toPosto_id(); + break; + case HsPostoMedida.MEDIDA_ID_INDEX: + value = getMedida_id(); + break; + case HsPostoMedida.TO_MEDIDA_ID_INDEX: + value = toMedida_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsPostoMedida.POSTO_ID_INDEX: + value = this.posto_id; + break; + case HsPostoMedida.TO_POSTO_ID_INDEX: + value = this.to_posto_id; + break; + case HsPostoMedida.MEDIDA_ID_INDEX: + value = this.medida_id; + break; + case HsPostoMedida.TO_MEDIDA_ID_INDEX: + value = this.to_medida_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsPostoMedida.POSTO_ID_INDEX: + setPosto_id( ( Integer ) value ); + break; + case HsPostoMedida.TO_POSTO_ID_INDEX: + setToPosto_id( ( siprp.data.outer.HsPostoData ) value ); + break; + case HsPostoMedida.MEDIDA_ID_INDEX: + setMedida_id( ( Integer ) value ); + break; + case HsPostoMedida.TO_MEDIDA_ID_INDEX: + setToMedida_id( ( siprp.data.outer.HsMedidaData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsPostoMedida.POSTO_ID_INDEX: + this.posto_id = ( Integer ) value; + break; + case HsPostoMedida.TO_POSTO_ID_INDEX: + this.to_posto_id = ( siprp.data.outer.HsPostoData ) value; + break; + case HsPostoMedida.MEDIDA_ID_INDEX: + this.medida_id = ( Integer ) value; + break; + case HsPostoMedida.TO_MEDIDA_ID_INDEX: + this.to_medida_id = ( siprp.data.outer.HsMedidaData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + throw new RuntimeException( "getPrimaryKeyName on HsPostoMedida is invalid" ); + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsPostoMedida.POSTO_ID_INDEX: + theClass = Integer.class; + break; + case HsPostoMedida.TO_POSTO_ID_INDEX: + theClass = siprp.data.outer.HsPostoData.class; + break; + case HsPostoMedida.MEDIDA_ID_INDEX: + theClass = Integer.class; + break; + case HsPostoMedida.TO_MEDIDA_ID_INDEX: + theClass = siprp.data.outer.HsMedidaData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsPostoMedida._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsPostoMedida.PK_FIELD_NAMES ); + primaryKey.set( 0, getPosto_id() ); + primaryKey.set( 1, getMedida_id() ); + } + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsPostoRisco.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsPostoRisco.java new file mode 100644 index 00000000..f49985f1 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsPostoRisco.java @@ -0,0 +1,682 @@ +/* +* HsPostoRisco.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsPostoRisco extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + com.evolute.entity.evo.EvoDataObject.register( HsPostoRisco.CLASS_IDENTIFIER, HsPostoRisco.POSTO_ID, HsPostoRisco.TO_POSTO_ID ); + FIELD_INDEXES.put( HsPostoRisco.POSTO_ID, HsPostoRisco.POSTO_ID_INDEX ); + FIELD_INDEXES.put( HsPostoRisco.POSTO_ID_FULL, HsPostoRisco.POSTO_ID_INDEX ); + FIELD_INDEXES.put( HsPostoRisco.TO_POSTO_ID, HsPostoRisco.TO_POSTO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsPostoRisco.CLASS_IDENTIFIER, HsPostoRisco.RISCO_ID, HsPostoRisco.TO_RISCO_ID ); + FIELD_INDEXES.put( HsPostoRisco.RISCO_ID, HsPostoRisco.RISCO_ID_INDEX ); + FIELD_INDEXES.put( HsPostoRisco.RISCO_ID_FULL, HsPostoRisco.RISCO_ID_INDEX ); + FIELD_INDEXES.put( HsPostoRisco.TO_RISCO_ID, HsPostoRisco.TO_RISCO_ID_INDEX ); + FIELD_INDEXES.put( HsPostoRisco.PROBABILIDADE, HsPostoRisco.PROBABILIDADE_INDEX ); + FIELD_INDEXES.put( HsPostoRisco.PROBABILIDADE_FULL, HsPostoRisco.PROBABILIDADE_INDEX ); + FIELD_INDEXES.put( HsPostoRisco.SEVERIDADE, HsPostoRisco.SEVERIDADE_INDEX ); + FIELD_INDEXES.put( HsPostoRisco.SEVERIDADE_FULL, HsPostoRisco.SEVERIDADE_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsPostoRisco.CLASS_IDENTIFIER, HsPostoRisco.VALOR_QUALITATIVO, HsPostoRisco.TO_VALOR_QUALITATIVO ); + FIELD_INDEXES.put( HsPostoRisco.VALOR_QUALITATIVO, HsPostoRisco.VALOR_QUALITATIVO_INDEX ); + FIELD_INDEXES.put( HsPostoRisco.VALOR_QUALITATIVO_FULL, HsPostoRisco.VALOR_QUALITATIVO_INDEX ); + FIELD_INDEXES.put( HsPostoRisco.TO_VALOR_QUALITATIVO, HsPostoRisco.TO_VALOR_QUALITATIVO_INDEX ); + FIELD_INDEXES.put( HsPostoRisco.IS_PLANO_ACTUACAO, HsPostoRisco.IS_PLANO_ACTUACAO_INDEX ); + FIELD_INDEXES.put( HsPostoRisco.IS_PLANO_ACTUACAO_FULL, HsPostoRisco.IS_PLANO_ACTUACAO_INDEX ); + FIELD_INDEXES.put( HsPostoRisco.ORDEM, HsPostoRisco.ORDEM_INDEX ); + FIELD_INDEXES.put( HsPostoRisco.ORDEM_FULL, HsPostoRisco.ORDEM_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyposto_idTohs_posto = + new com.evolute.entity.ForeignKey( HsPostoRisco.class, HsPostoRisco.POSTO_ID, siprp.data.outer.HsPostoData.class, siprp.data.outer.HsPostoData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyrisco_idTohs_risco = + new com.evolute.entity.ForeignKey( HsPostoRisco.class, HsPostoRisco.RISCO_ID, siprp.data.outer.HsRiscoData.class, siprp.data.outer.HsRiscoData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyvalor_qualitativoTohs_relatorio_risco_valor_qualitativo = + new com.evolute.entity.ForeignKey( HsPostoRisco.class, HsPostoRisco.VALOR_QUALITATIVO, siprp.data.outer.HsRelatorioRiscoValorQualitativoData.class, siprp.data.outer.HsRelatorioRiscoValorQualitativoData.ID ); + + public static final String TABLENAME = "hs_posto_risco"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_posto_risco"; + + public static final int _INVALID__INDEX = -1; + public static final String POSTO_ID = "posto_id"; + public static final String POSTO_ID_FULL = "hs_posto_risco.posto_id"; + public static final int POSTO_ID_INDEX = 0; + public static final String TO_POSTO_ID = "to_posto_id"; + public static final int TO_POSTO_ID_INDEX = 1; + public static final String RISCO_ID = "risco_id"; + public static final String RISCO_ID_FULL = "hs_posto_risco.risco_id"; + public static final int RISCO_ID_INDEX = 2; + public static final String TO_RISCO_ID = "to_risco_id"; + public static final int TO_RISCO_ID_INDEX = 3; + public static final String PROBABILIDADE = "probabilidade"; + public static final String PROBABILIDADE_FULL = "hs_posto_risco.probabilidade"; + public static final int PROBABILIDADE_INDEX = 4; + public static final String SEVERIDADE = "severidade"; + public static final String SEVERIDADE_FULL = "hs_posto_risco.severidade"; + public static final int SEVERIDADE_INDEX = 5; + public static final String VALOR_QUALITATIVO = "valor_qualitativo"; + public static final String VALOR_QUALITATIVO_FULL = "hs_posto_risco.valor_qualitativo"; + public static final int VALOR_QUALITATIVO_INDEX = 6; + public static final String TO_VALOR_QUALITATIVO = "to_valor_qualitativo"; + public static final int TO_VALOR_QUALITATIVO_INDEX = 7; + public static final String IS_PLANO_ACTUACAO = "is_plano_actuacao"; + public static final String IS_PLANO_ACTUACAO_FULL = "hs_posto_risco.is_plano_actuacao"; + public static final int IS_PLANO_ACTUACAO_INDEX = 8; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "hs_posto_risco.ordem"; + public static final int ORDEM_INDEX = 9; + + public static final String FIELD_NAMES[] = new String[]{ + PROBABILIDADE, SEVERIDADE, VALOR_QUALITATIVO, TO_VALOR_QUALITATIVO, + IS_PLANO_ACTUACAO, ORDEM, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + PROBABILIDADE, TABLENAME + "." + SEVERIDADE, TABLENAME + "." + VALOR_QUALITATIVO, TABLENAME + "." + TO_VALOR_QUALITATIVO, + TABLENAME + "." + IS_PLANO_ACTUACAO, TABLENAME + "." + ORDEM, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + POSTO_ID, RISCO_ID, PROBABILIDADE, SEVERIDADE, VALOR_QUALITATIVO, + IS_PLANO_ACTUACAO, ORDEM, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + POSTO_ID, RISCO_ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + POSTO_ID, RISCO_ID, PROBABILIDADE, SEVERIDADE, VALOR_QUALITATIVO, + IS_PLANO_ACTUACAO, ORDEM, }; + + private Integer posto_id; + private siprp.data.outer.HsPostoData to_posto_id; + private Integer risco_id; + private siprp.data.outer.HsRiscoData to_risco_id; + private Integer probabilidade; + private Integer severidade; + private Integer valor_qualitativo; + private siprp.data.outer.HsRelatorioRiscoValorQualitativoData to_valor_qualitativo; + private String is_plano_actuacao; + private Integer ordem; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsPostoRisco() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false, false, false, false, false, false, false }; + } + + public Integer getPosto_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( POSTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.posto_id; + } + + public void setPosto_id( Integer posto_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( POSTO_ID, posto_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.posto_id = posto_id; + LAZY_LOADED_OBJECTS.put( POSTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsPostoData toPosto_id() + { + try + { + prepare( TO_POSTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_posto_id; + } + + public void setToPosto_id( siprp.data.outer.HsPostoData to_posto_id ) + { + try + { + preProcess( TO_POSTO_ID, to_posto_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_posto_id = to_posto_id; + } + + public Integer getRisco_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( RISCO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.risco_id; + } + + public void setRisco_id( Integer risco_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( RISCO_ID, risco_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.risco_id = risco_id; + LAZY_LOADED_OBJECTS.put( RISCO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsRiscoData toRisco_id() + { + try + { + prepare( TO_RISCO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_risco_id; + } + + public void setToRisco_id( siprp.data.outer.HsRiscoData to_risco_id ) + { + try + { + preProcess( TO_RISCO_ID, to_risco_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_risco_id = to_risco_id; + } + + public Integer getProbabilidade() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PROBABILIDADE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.probabilidade; + } + + public void setProbabilidade( Integer probabilidade ) + { + try + { + setLockedForRefresh( true ); + preProcess( PROBABILIDADE, probabilidade ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.probabilidade = probabilidade; + LAZY_LOADED_OBJECTS.put( PROBABILIDADE, Boolean.TRUE ); + } + + public Integer getSeveridade() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( SEVERIDADE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.severidade; + } + + public void setSeveridade( Integer severidade ) + { + try + { + setLockedForRefresh( true ); + preProcess( SEVERIDADE, severidade ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.severidade = severidade; + LAZY_LOADED_OBJECTS.put( SEVERIDADE, Boolean.TRUE ); + } + + public Integer getValor_qualitativo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( VALOR_QUALITATIVO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.valor_qualitativo; + } + + public void setValor_qualitativo( Integer valor_qualitativo ) + { + try + { + setLockedForRefresh( true ); + preProcess( VALOR_QUALITATIVO, valor_qualitativo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.valor_qualitativo = valor_qualitativo; + LAZY_LOADED_OBJECTS.put( VALOR_QUALITATIVO, Boolean.TRUE ); + } + + public siprp.data.outer.HsRelatorioRiscoValorQualitativoData toValor_qualitativo() + { + try + { + prepare( TO_VALOR_QUALITATIVO ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_valor_qualitativo; + } + + public void setToValor_qualitativo( siprp.data.outer.HsRelatorioRiscoValorQualitativoData to_valor_qualitativo ) + { + try + { + preProcess( TO_VALOR_QUALITATIVO, to_valor_qualitativo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_valor_qualitativo = to_valor_qualitativo; + } + + public String getIs_plano_actuacao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( IS_PLANO_ACTUACAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.is_plano_actuacao; + } + + public void setIs_plano_actuacao( String is_plano_actuacao ) + { + try + { + setLockedForRefresh( true ); + preProcess( IS_PLANO_ACTUACAO, is_plano_actuacao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.is_plano_actuacao = is_plano_actuacao; + LAZY_LOADED_OBJECTS.put( IS_PLANO_ACTUACAO, Boolean.TRUE ); + } + + public Integer getOrdem() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ORDEM ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.ordem; + } + + public void setOrdem( Integer ordem ) + { + try + { + setLockedForRefresh( true ); + preProcess( ORDEM, ordem ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.ordem = ordem; + LAZY_LOADED_OBJECTS.put( ORDEM, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsPostoRisco.POSTO_ID_INDEX: + value = getPosto_id(); + break; + case HsPostoRisco.TO_POSTO_ID_INDEX: + value = toPosto_id(); + break; + case HsPostoRisco.RISCO_ID_INDEX: + value = getRisco_id(); + break; + case HsPostoRisco.TO_RISCO_ID_INDEX: + value = toRisco_id(); + break; + case HsPostoRisco.PROBABILIDADE_INDEX: + value = getProbabilidade(); + break; + case HsPostoRisco.SEVERIDADE_INDEX: + value = getSeveridade(); + break; + case HsPostoRisco.VALOR_QUALITATIVO_INDEX: + value = getValor_qualitativo(); + break; + case HsPostoRisco.TO_VALOR_QUALITATIVO_INDEX: + value = toValor_qualitativo(); + break; + case HsPostoRisco.IS_PLANO_ACTUACAO_INDEX: + value = getIs_plano_actuacao(); + break; + case HsPostoRisco.ORDEM_INDEX: + value = getOrdem(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsPostoRisco.POSTO_ID_INDEX: + value = this.posto_id; + break; + case HsPostoRisco.TO_POSTO_ID_INDEX: + value = this.to_posto_id; + break; + case HsPostoRisco.RISCO_ID_INDEX: + value = this.risco_id; + break; + case HsPostoRisco.TO_RISCO_ID_INDEX: + value = this.to_risco_id; + break; + case HsPostoRisco.PROBABILIDADE_INDEX: + value = this.probabilidade; + break; + case HsPostoRisco.SEVERIDADE_INDEX: + value = this.severidade; + break; + case HsPostoRisco.VALOR_QUALITATIVO_INDEX: + value = this.valor_qualitativo; + break; + case HsPostoRisco.TO_VALOR_QUALITATIVO_INDEX: + value = this.to_valor_qualitativo; + break; + case HsPostoRisco.IS_PLANO_ACTUACAO_INDEX: + value = this.is_plano_actuacao; + break; + case HsPostoRisco.ORDEM_INDEX: + value = this.ordem; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsPostoRisco.POSTO_ID_INDEX: + setPosto_id( ( Integer ) value ); + break; + case HsPostoRisco.TO_POSTO_ID_INDEX: + setToPosto_id( ( siprp.data.outer.HsPostoData ) value ); + break; + case HsPostoRisco.RISCO_ID_INDEX: + setRisco_id( ( Integer ) value ); + break; + case HsPostoRisco.TO_RISCO_ID_INDEX: + setToRisco_id( ( siprp.data.outer.HsRiscoData ) value ); + break; + case HsPostoRisco.PROBABILIDADE_INDEX: + setProbabilidade( ( Integer ) value ); + break; + case HsPostoRisco.SEVERIDADE_INDEX: + setSeveridade( ( Integer ) value ); + break; + case HsPostoRisco.VALOR_QUALITATIVO_INDEX: + setValor_qualitativo( ( Integer ) value ); + break; + case HsPostoRisco.TO_VALOR_QUALITATIVO_INDEX: + setToValor_qualitativo( ( siprp.data.outer.HsRelatorioRiscoValorQualitativoData ) value ); + break; + case HsPostoRisco.IS_PLANO_ACTUACAO_INDEX: + setIs_plano_actuacao( ( String ) value ); + break; + case HsPostoRisco.ORDEM_INDEX: + setOrdem( ( Integer ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsPostoRisco.POSTO_ID_INDEX: + this.posto_id = ( Integer ) value; + break; + case HsPostoRisco.TO_POSTO_ID_INDEX: + this.to_posto_id = ( siprp.data.outer.HsPostoData ) value; + break; + case HsPostoRisco.RISCO_ID_INDEX: + this.risco_id = ( Integer ) value; + break; + case HsPostoRisco.TO_RISCO_ID_INDEX: + this.to_risco_id = ( siprp.data.outer.HsRiscoData ) value; + break; + case HsPostoRisco.PROBABILIDADE_INDEX: + this.probabilidade = ( Integer ) value; + break; + case HsPostoRisco.SEVERIDADE_INDEX: + this.severidade = ( Integer ) value; + break; + case HsPostoRisco.VALOR_QUALITATIVO_INDEX: + this.valor_qualitativo = ( Integer ) value; + break; + case HsPostoRisco.TO_VALOR_QUALITATIVO_INDEX: + this.to_valor_qualitativo = ( siprp.data.outer.HsRelatorioRiscoValorQualitativoData ) value; + break; + case HsPostoRisco.IS_PLANO_ACTUACAO_INDEX: + this.is_plano_actuacao = ( String ) value; + break; + case HsPostoRisco.ORDEM_INDEX: + this.ordem = ( Integer ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + throw new RuntimeException( "getPrimaryKeyName on HsPostoRisco is invalid" ); + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsPostoRisco.POSTO_ID_INDEX: + theClass = Integer.class; + break; + case HsPostoRisco.TO_POSTO_ID_INDEX: + theClass = siprp.data.outer.HsPostoData.class; + break; + case HsPostoRisco.RISCO_ID_INDEX: + theClass = Integer.class; + break; + case HsPostoRisco.TO_RISCO_ID_INDEX: + theClass = siprp.data.outer.HsRiscoData.class; + break; + case HsPostoRisco.PROBABILIDADE_INDEX: + theClass = Integer.class; + break; + case HsPostoRisco.SEVERIDADE_INDEX: + theClass = Integer.class; + break; + case HsPostoRisco.VALOR_QUALITATIVO_INDEX: + theClass = Integer.class; + break; + case HsPostoRisco.TO_VALOR_QUALITATIVO_INDEX: + theClass = siprp.data.outer.HsRelatorioRiscoValorQualitativoData.class; + break; + case HsPostoRisco.IS_PLANO_ACTUACAO_INDEX: + theClass = String.class; + break; + case HsPostoRisco.ORDEM_INDEX: + theClass = Integer.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsPostoRisco._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsPostoRisco.PK_FIELD_NAMES ); + primaryKey.set( 0, getPosto_id() ); + primaryKey.set( 1, getRisco_id() ); + } + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorio.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorio.java new file mode 100644 index 00000000..59deaeb4 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorio.java @@ -0,0 +1,959 @@ +/* +* HsRelatorio.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsRelatorio extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( HsRelatorio.ID, HsRelatorio.ID_INDEX ); + FIELD_INDEXES.put( HsRelatorio.ID_FULL, HsRelatorio.ID_INDEX ); + FIELD_INDEXES.put( HsRelatorio.DATA, HsRelatorio.DATA_INDEX ); + FIELD_INDEXES.put( HsRelatorio.DATA_FULL, HsRelatorio.DATA_INDEX ); + FIELD_INDEXES.put( HsRelatorio.DELETED_DATE, HsRelatorio.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsRelatorio.DELETED_DATE_FULL, HsRelatorio.DELETED_DATE_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsRelatorio.CLASS_IDENTIFIER, HsRelatorio.MARCACAO_ID, HsRelatorio.TO_MARCACAO_ID ); + FIELD_INDEXES.put( HsRelatorio.MARCACAO_ID, HsRelatorio.MARCACAO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorio.MARCACAO_ID_FULL, HsRelatorio.MARCACAO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorio.TO_MARCACAO_ID, HsRelatorio.TO_MARCACAO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorio.IS_SUBMETIDO, HsRelatorio.IS_SUBMETIDO_INDEX ); + FIELD_INDEXES.put( HsRelatorio.IS_SUBMETIDO_FULL, HsRelatorio.IS_SUBMETIDO_INDEX ); + FIELD_INDEXES.put( HsRelatorio.AVALIACAO_INICIAL, HsRelatorio.AVALIACAO_INICIAL_INDEX ); + FIELD_INDEXES.put( HsRelatorio.AVALIACAO_INICIAL_FULL, HsRelatorio.AVALIACAO_INICIAL_INDEX ); + FIELD_INDEXES.put( HsRelatorio.ACOMPANHANTE1, HsRelatorio.ACOMPANHANTE1_INDEX ); + FIELD_INDEXES.put( HsRelatorio.ACOMPANHANTE1_FULL, HsRelatorio.ACOMPANHANTE1_INDEX ); + FIELD_INDEXES.put( HsRelatorio.FUNCAO_ACOMPANHANTE1, HsRelatorio.FUNCAO_ACOMPANHANTE1_INDEX ); + FIELD_INDEXES.put( HsRelatorio.FUNCAO_ACOMPANHANTE1_FULL, HsRelatorio.FUNCAO_ACOMPANHANTE1_INDEX ); + FIELD_INDEXES.put( HsRelatorio.ACOMPANHANTE2, HsRelatorio.ACOMPANHANTE2_INDEX ); + FIELD_INDEXES.put( HsRelatorio.ACOMPANHANTE2_FULL, HsRelatorio.ACOMPANHANTE2_INDEX ); + FIELD_INDEXES.put( HsRelatorio.FUNCAO_ACOMPANHANTE2, HsRelatorio.FUNCAO_ACOMPANHANTE2_INDEX ); + FIELD_INDEXES.put( HsRelatorio.FUNCAO_ACOMPANHANTE2_FULL, HsRelatorio.FUNCAO_ACOMPANHANTE2_INDEX ); + FIELD_INDEXES.put( HsRelatorio.ACOMPANHANTE3, HsRelatorio.ACOMPANHANTE3_INDEX ); + FIELD_INDEXES.put( HsRelatorio.ACOMPANHANTE3_FULL, HsRelatorio.ACOMPANHANTE3_INDEX ); + FIELD_INDEXES.put( HsRelatorio.FUNCAO_ACOMPANHANTE3, HsRelatorio.FUNCAO_ACOMPANHANTE3_INDEX ); + FIELD_INDEXES.put( HsRelatorio.FUNCAO_ACOMPANHANTE3_FULL, HsRelatorio.FUNCAO_ACOMPANHANTE3_INDEX ); + FIELD_INDEXES.put( HsRelatorio.FUNCIONARIOS, HsRelatorio.FUNCIONARIOS_INDEX ); + FIELD_INDEXES.put( HsRelatorio.FUNCIONARIOS_FULL, HsRelatorio.FUNCIONARIOS_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeymarcacao_idTomarcacoes_estabelecimento = + new com.evolute.entity.ForeignKey( HsRelatorio.class, HsRelatorio.MARCACAO_ID, siprp.data.outer.MarcacoesEstabelecimentoData.class, siprp.data.outer.MarcacoesEstabelecimentoData.ID ); + + public static final String TABLENAME = "hs_relatorio"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_relatorio"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio.id"; + public static final int ID_INDEX = 0; + public static final String DATA = "data"; + public static final String DATA_FULL = "hs_relatorio.data"; + public static final int DATA_INDEX = 1; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_relatorio.deleted_date"; + public static final int DELETED_DATE_INDEX = 2; + public static final String MARCACAO_ID = "marcacao_id"; + public static final String MARCACAO_ID_FULL = "hs_relatorio.marcacao_id"; + public static final int MARCACAO_ID_INDEX = 3; + public static final String TO_MARCACAO_ID = "to_marcacao_id"; + public static final int TO_MARCACAO_ID_INDEX = 4; + public static final String IS_SUBMETIDO = "is_submetido"; + public static final String IS_SUBMETIDO_FULL = "hs_relatorio.is_submetido"; + public static final int IS_SUBMETIDO_INDEX = 5; + public static final String AVALIACAO_INICIAL = "avaliacao_inicial"; + public static final String AVALIACAO_INICIAL_FULL = "hs_relatorio.avaliacao_inicial"; + public static final int AVALIACAO_INICIAL_INDEX = 6; + public static final String ACOMPANHANTE1 = "acompanhante1"; + public static final String ACOMPANHANTE1_FULL = "hs_relatorio.acompanhante1"; + public static final int ACOMPANHANTE1_INDEX = 7; + public static final String FUNCAO_ACOMPANHANTE1 = "funcao_acompanhante1"; + public static final String FUNCAO_ACOMPANHANTE1_FULL = "hs_relatorio.funcao_acompanhante1"; + public static final int FUNCAO_ACOMPANHANTE1_INDEX = 8; + public static final String ACOMPANHANTE2 = "acompanhante2"; + public static final String ACOMPANHANTE2_FULL = "hs_relatorio.acompanhante2"; + public static final int ACOMPANHANTE2_INDEX = 9; + public static final String FUNCAO_ACOMPANHANTE2 = "funcao_acompanhante2"; + public static final String FUNCAO_ACOMPANHANTE2_FULL = "hs_relatorio.funcao_acompanhante2"; + public static final int FUNCAO_ACOMPANHANTE2_INDEX = 10; + public static final String ACOMPANHANTE3 = "acompanhante3"; + public static final String ACOMPANHANTE3_FULL = "hs_relatorio.acompanhante3"; + public static final int ACOMPANHANTE3_INDEX = 11; + public static final String FUNCAO_ACOMPANHANTE3 = "funcao_acompanhante3"; + public static final String FUNCAO_ACOMPANHANTE3_FULL = "hs_relatorio.funcao_acompanhante3"; + public static final int FUNCAO_ACOMPANHANTE3_INDEX = 12; + public static final String FUNCIONARIOS = "funcionarios"; + public static final String FUNCIONARIOS_FULL = "hs_relatorio.funcionarios"; + public static final int FUNCIONARIOS_INDEX = 13; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, DELETED_DATE, MARCACAO_ID, TO_MARCACAO_ID, IS_SUBMETIDO, AVALIACAO_INICIAL, + ACOMPANHANTE1, FUNCAO_ACOMPANHANTE1, ACOMPANHANTE2, FUNCAO_ACOMPANHANTE2, + ACOMPANHANTE3, FUNCAO_ACOMPANHANTE3, FUNCIONARIOS, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DATA, TABLENAME + "." + DELETED_DATE, TABLENAME + "." + MARCACAO_ID, TABLENAME + "." + TO_MARCACAO_ID, TABLENAME + "." + IS_SUBMETIDO, TABLENAME + "." + AVALIACAO_INICIAL, + TABLENAME + "." + ACOMPANHANTE1, TABLENAME + "." + FUNCAO_ACOMPANHANTE1, TABLENAME + "." + ACOMPANHANTE2, TABLENAME + "." + FUNCAO_ACOMPANHANTE2, + TABLENAME + "." + ACOMPANHANTE3, TABLENAME + "." + FUNCAO_ACOMPANHANTE3, TABLENAME + "." + FUNCIONARIOS, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DATA, DELETED_DATE, MARCACAO_ID, IS_SUBMETIDO, AVALIACAO_INICIAL, + ACOMPANHANTE1, FUNCAO_ACOMPANHANTE1, ACOMPANHANTE2, FUNCAO_ACOMPANHANTE2, + ACOMPANHANTE3, FUNCAO_ACOMPANHANTE3, FUNCIONARIOS, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DATA, DELETED_DATE, MARCACAO_ID, IS_SUBMETIDO, AVALIACAO_INICIAL, + ACOMPANHANTE1, FUNCAO_ACOMPANHANTE1, ACOMPANHANTE2, FUNCAO_ACOMPANHANTE2, + ACOMPANHANTE3, FUNCAO_ACOMPANHANTE3, FUNCIONARIOS, }; + + private Integer id; + private java.util.Date data; + private java.sql.Timestamp deleted_date; + private Integer marcacao_id; + private siprp.data.outer.MarcacoesEstabelecimentoData to_marcacao_id; + private java.sql.Timestamp is_submetido; + private Boolean avaliacao_inicial; + private String acompanhante1; + private String funcao_acompanhante1; + private String acompanhante2; + private String funcao_acompanhante2; + private String acompanhante3; + private String funcao_acompanhante3; + private String funcionarios; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsRelatorio() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false, false, false, false, + false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromHsRelatorioArea_relatorio_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRelatorioAreaData.class , getPrimaryKey().getMap().get("id"), "relatorio_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsRelatorioEquipamento_hs_relatorio_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRelatorioEquipamentoData.class , getPrimaryKey().getMap().get("id"), "hs_relatorio_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsRelatorioLegislacao_hs_relatorio_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRelatorioLegislacaoData.class , getPrimaryKey().getMap().get("id"), "hs_relatorio_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsRelatorioNormalizacao_hs_relatorio_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRelatorioNormalizacaoData.class , getPrimaryKey().getMap().get("id"), "hs_relatorio_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsRelatorioRisco_relatorio_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRelatorioRiscoData.class , getPrimaryKey().getMap().get("id"), "relatorio_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.Date getData() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data; + } + + public void setData( java.util.Date data ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA, data ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data = data; + LAZY_LOADED_OBJECTS.put( DATA, Boolean.TRUE ); + } + + public java.sql.Timestamp getDeleted_date() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DELETED_DATE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.deleted_date; + } + + public void setDeleted_date( java.sql.Timestamp deleted_date ) + { + try + { + setLockedForRefresh( true ); + preProcess( DELETED_DATE, deleted_date ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.deleted_date = deleted_date; + LAZY_LOADED_OBJECTS.put( DELETED_DATE, Boolean.TRUE ); + } + + public Integer getMarcacao_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MARCACAO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.marcacao_id; + } + + public void setMarcacao_id( Integer marcacao_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( MARCACAO_ID, marcacao_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.marcacao_id = marcacao_id; + LAZY_LOADED_OBJECTS.put( MARCACAO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.MarcacoesEstabelecimentoData toMarcacao_id() + { + try + { + prepare( TO_MARCACAO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_marcacao_id; + } + + public void setToMarcacao_id( siprp.data.outer.MarcacoesEstabelecimentoData to_marcacao_id ) + { + try + { + preProcess( TO_MARCACAO_ID, to_marcacao_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_marcacao_id = to_marcacao_id; + } + + public java.sql.Timestamp getIs_submetido() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( IS_SUBMETIDO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.is_submetido; + } + + public void setIs_submetido( java.sql.Timestamp is_submetido ) + { + try + { + setLockedForRefresh( true ); + preProcess( IS_SUBMETIDO, is_submetido ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.is_submetido = is_submetido; + LAZY_LOADED_OBJECTS.put( IS_SUBMETIDO, Boolean.TRUE ); + } + + public Boolean getAvaliacao_inicial() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( AVALIACAO_INICIAL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.avaliacao_inicial; + } + + public void setAvaliacao_inicial( Boolean avaliacao_inicial ) + { + try + { + setLockedForRefresh( true ); + preProcess( AVALIACAO_INICIAL, avaliacao_inicial ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.avaliacao_inicial = avaliacao_inicial; + LAZY_LOADED_OBJECTS.put( AVALIACAO_INICIAL, Boolean.TRUE ); + } + + public String getAcompanhante1() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ACOMPANHANTE1 ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.acompanhante1; + } + + public void setAcompanhante1( String acompanhante1 ) + { + try + { + setLockedForRefresh( true ); + preProcess( ACOMPANHANTE1, acompanhante1 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.acompanhante1 = acompanhante1; + LAZY_LOADED_OBJECTS.put( ACOMPANHANTE1, Boolean.TRUE ); + } + + public String getFuncao_acompanhante1() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( FUNCAO_ACOMPANHANTE1 ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.funcao_acompanhante1; + } + + public void setFuncao_acompanhante1( String funcao_acompanhante1 ) + { + try + { + setLockedForRefresh( true ); + preProcess( FUNCAO_ACOMPANHANTE1, funcao_acompanhante1 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.funcao_acompanhante1 = funcao_acompanhante1; + LAZY_LOADED_OBJECTS.put( FUNCAO_ACOMPANHANTE1, Boolean.TRUE ); + } + + public String getAcompanhante2() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ACOMPANHANTE2 ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.acompanhante2; + } + + public void setAcompanhante2( String acompanhante2 ) + { + try + { + setLockedForRefresh( true ); + preProcess( ACOMPANHANTE2, acompanhante2 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.acompanhante2 = acompanhante2; + LAZY_LOADED_OBJECTS.put( ACOMPANHANTE2, Boolean.TRUE ); + } + + public String getFuncao_acompanhante2() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( FUNCAO_ACOMPANHANTE2 ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.funcao_acompanhante2; + } + + public void setFuncao_acompanhante2( String funcao_acompanhante2 ) + { + try + { + setLockedForRefresh( true ); + preProcess( FUNCAO_ACOMPANHANTE2, funcao_acompanhante2 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.funcao_acompanhante2 = funcao_acompanhante2; + LAZY_LOADED_OBJECTS.put( FUNCAO_ACOMPANHANTE2, Boolean.TRUE ); + } + + public String getAcompanhante3() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ACOMPANHANTE3 ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.acompanhante3; + } + + public void setAcompanhante3( String acompanhante3 ) + { + try + { + setLockedForRefresh( true ); + preProcess( ACOMPANHANTE3, acompanhante3 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.acompanhante3 = acompanhante3; + LAZY_LOADED_OBJECTS.put( ACOMPANHANTE3, Boolean.TRUE ); + } + + public String getFuncao_acompanhante3() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( FUNCAO_ACOMPANHANTE3 ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.funcao_acompanhante3; + } + + public void setFuncao_acompanhante3( String funcao_acompanhante3 ) + { + try + { + setLockedForRefresh( true ); + preProcess( FUNCAO_ACOMPANHANTE3, funcao_acompanhante3 ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.funcao_acompanhante3 = funcao_acompanhante3; + LAZY_LOADED_OBJECTS.put( FUNCAO_ACOMPANHANTE3, Boolean.TRUE ); + } + + public String getFuncionarios() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( FUNCIONARIOS ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.funcionarios; + } + + public void setFuncionarios( String funcionarios ) + { + try + { + setLockedForRefresh( true ); + preProcess( FUNCIONARIOS, funcionarios ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.funcionarios = funcionarios; + LAZY_LOADED_OBJECTS.put( FUNCIONARIOS, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorio.ID_INDEX: + value = getId(); + break; + case HsRelatorio.DATA_INDEX: + value = getData(); + break; + case HsRelatorio.DELETED_DATE_INDEX: + value = getDeleted_date(); + break; + case HsRelatorio.MARCACAO_ID_INDEX: + value = getMarcacao_id(); + break; + case HsRelatorio.TO_MARCACAO_ID_INDEX: + value = toMarcacao_id(); + break; + case HsRelatorio.IS_SUBMETIDO_INDEX: + value = getIs_submetido(); + break; + case HsRelatorio.AVALIACAO_INICIAL_INDEX: + value = getAvaliacao_inicial(); + break; + case HsRelatorio.ACOMPANHANTE1_INDEX: + value = getAcompanhante1(); + break; + case HsRelatorio.FUNCAO_ACOMPANHANTE1_INDEX: + value = getFuncao_acompanhante1(); + break; + case HsRelatorio.ACOMPANHANTE2_INDEX: + value = getAcompanhante2(); + break; + case HsRelatorio.FUNCAO_ACOMPANHANTE2_INDEX: + value = getFuncao_acompanhante2(); + break; + case HsRelatorio.ACOMPANHANTE3_INDEX: + value = getAcompanhante3(); + break; + case HsRelatorio.FUNCAO_ACOMPANHANTE3_INDEX: + value = getFuncao_acompanhante3(); + break; + case HsRelatorio.FUNCIONARIOS_INDEX: + value = getFuncionarios(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorio.ID_INDEX: + value = this.id; + break; + case HsRelatorio.DATA_INDEX: + value = this.data; + break; + case HsRelatorio.DELETED_DATE_INDEX: + value = this.deleted_date; + break; + case HsRelatorio.MARCACAO_ID_INDEX: + value = this.marcacao_id; + break; + case HsRelatorio.TO_MARCACAO_ID_INDEX: + value = this.to_marcacao_id; + break; + case HsRelatorio.IS_SUBMETIDO_INDEX: + value = this.is_submetido; + break; + case HsRelatorio.AVALIACAO_INICIAL_INDEX: + value = this.avaliacao_inicial; + break; + case HsRelatorio.ACOMPANHANTE1_INDEX: + value = this.acompanhante1; + break; + case HsRelatorio.FUNCAO_ACOMPANHANTE1_INDEX: + value = this.funcao_acompanhante1; + break; + case HsRelatorio.ACOMPANHANTE2_INDEX: + value = this.acompanhante2; + break; + case HsRelatorio.FUNCAO_ACOMPANHANTE2_INDEX: + value = this.funcao_acompanhante2; + break; + case HsRelatorio.ACOMPANHANTE3_INDEX: + value = this.acompanhante3; + break; + case HsRelatorio.FUNCAO_ACOMPANHANTE3_INDEX: + value = this.funcao_acompanhante3; + break; + case HsRelatorio.FUNCIONARIOS_INDEX: + value = this.funcionarios; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorio.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsRelatorio.DATA_INDEX: + setData( ( java.util.Date ) value ); + break; + case HsRelatorio.DELETED_DATE_INDEX: + setDeleted_date( ( java.sql.Timestamp ) value ); + break; + case HsRelatorio.MARCACAO_ID_INDEX: + setMarcacao_id( ( Integer ) value ); + break; + case HsRelatorio.TO_MARCACAO_ID_INDEX: + setToMarcacao_id( ( siprp.data.outer.MarcacoesEstabelecimentoData ) value ); + break; + case HsRelatorio.IS_SUBMETIDO_INDEX: + setIs_submetido( ( java.sql.Timestamp ) value ); + break; + case HsRelatorio.AVALIACAO_INICIAL_INDEX: + setAvaliacao_inicial( ( Boolean ) value ); + break; + case HsRelatorio.ACOMPANHANTE1_INDEX: + setAcompanhante1( ( String ) value ); + break; + case HsRelatorio.FUNCAO_ACOMPANHANTE1_INDEX: + setFuncao_acompanhante1( ( String ) value ); + break; + case HsRelatorio.ACOMPANHANTE2_INDEX: + setAcompanhante2( ( String ) value ); + break; + case HsRelatorio.FUNCAO_ACOMPANHANTE2_INDEX: + setFuncao_acompanhante2( ( String ) value ); + break; + case HsRelatorio.ACOMPANHANTE3_INDEX: + setAcompanhante3( ( String ) value ); + break; + case HsRelatorio.FUNCAO_ACOMPANHANTE3_INDEX: + setFuncao_acompanhante3( ( String ) value ); + break; + case HsRelatorio.FUNCIONARIOS_INDEX: + setFuncionarios( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorio.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsRelatorio.DATA_INDEX: + this.data = ( java.util.Date ) value; + break; + case HsRelatorio.DELETED_DATE_INDEX: + this.deleted_date = ( java.sql.Timestamp ) value; + break; + case HsRelatorio.MARCACAO_ID_INDEX: + this.marcacao_id = ( Integer ) value; + break; + case HsRelatorio.TO_MARCACAO_ID_INDEX: + this.to_marcacao_id = ( siprp.data.outer.MarcacoesEstabelecimentoData ) value; + break; + case HsRelatorio.IS_SUBMETIDO_INDEX: + this.is_submetido = ( java.sql.Timestamp ) value; + break; + case HsRelatorio.AVALIACAO_INICIAL_INDEX: + this.avaliacao_inicial = ( Boolean ) value; + break; + case HsRelatorio.ACOMPANHANTE1_INDEX: + this.acompanhante1 = ( String ) value; + break; + case HsRelatorio.FUNCAO_ACOMPANHANTE1_INDEX: + this.funcao_acompanhante1 = ( String ) value; + break; + case HsRelatorio.ACOMPANHANTE2_INDEX: + this.acompanhante2 = ( String ) value; + break; + case HsRelatorio.FUNCAO_ACOMPANHANTE2_INDEX: + this.funcao_acompanhante2 = ( String ) value; + break; + case HsRelatorio.ACOMPANHANTE3_INDEX: + this.acompanhante3 = ( String ) value; + break; + case HsRelatorio.FUNCAO_ACOMPANHANTE3_INDEX: + this.funcao_acompanhante3 = ( String ) value; + break; + case HsRelatorio.FUNCIONARIOS_INDEX: + this.funcionarios = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsRelatorio.ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorio.DATA_INDEX: + theClass = java.util.Date.class; + break; + case HsRelatorio.DELETED_DATE_INDEX: + theClass = java.sql.Timestamp.class; + break; + case HsRelatorio.MARCACAO_ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorio.TO_MARCACAO_ID_INDEX: + theClass = siprp.data.outer.MarcacoesEstabelecimentoData.class; + break; + case HsRelatorio.IS_SUBMETIDO_INDEX: + theClass = java.sql.Timestamp.class; + break; + case HsRelatorio.AVALIACAO_INICIAL_INDEX: + theClass = Boolean.class; + break; + case HsRelatorio.ACOMPANHANTE1_INDEX: + theClass = String.class; + break; + case HsRelatorio.FUNCAO_ACOMPANHANTE1_INDEX: + theClass = String.class; + break; + case HsRelatorio.ACOMPANHANTE2_INDEX: + theClass = String.class; + break; + case HsRelatorio.FUNCAO_ACOMPANHANTE2_INDEX: + theClass = String.class; + break; + case HsRelatorio.ACOMPANHANTE3_INDEX: + theClass = String.class; + break; + case HsRelatorio.FUNCAO_ACOMPANHANTE3_INDEX: + theClass = String.class; + break; + case HsRelatorio.FUNCIONARIOS_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsRelatorio._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsRelatorio.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioArea.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioArea.java new file mode 100644 index 00000000..d7ce9513 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioArea.java @@ -0,0 +1,544 @@ +/* +* HsRelatorioArea.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsRelatorioArea extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( HsRelatorioArea.ID, HsRelatorioArea.ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioArea.ID_FULL, HsRelatorioArea.ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioArea.DESCRIPTION, HsRelatorioArea.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsRelatorioArea.DESCRIPTION_FULL, HsRelatorioArea.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsRelatorioArea.DELETED_DATE, HsRelatorioArea.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsRelatorioArea.DELETED_DATE_FULL, HsRelatorioArea.DELETED_DATE_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsRelatorioArea.CLASS_IDENTIFIER, HsRelatorioArea.RELATORIO_ID, HsRelatorioArea.TO_RELATORIO_ID ); + FIELD_INDEXES.put( HsRelatorioArea.RELATORIO_ID, HsRelatorioArea.RELATORIO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioArea.RELATORIO_ID_FULL, HsRelatorioArea.RELATORIO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioArea.TO_RELATORIO_ID, HsRelatorioArea.TO_RELATORIO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioArea.ORDEM, HsRelatorioArea.ORDEM_INDEX ); + FIELD_INDEXES.put( HsRelatorioArea.ORDEM_FULL, HsRelatorioArea.ORDEM_INDEX ); + FIELD_INDEXES.put( HsRelatorioArea.HS_AREA_ID, HsRelatorioArea.HS_AREA_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioArea.HS_AREA_ID_FULL, HsRelatorioArea.HS_AREA_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyrelatorio_idTohs_relatorio = + new com.evolute.entity.ForeignKey( HsRelatorioArea.class, HsRelatorioArea.RELATORIO_ID, siprp.data.outer.HsRelatorioData.class, siprp.data.outer.HsRelatorioData.ID ); + + public static final String TABLENAME = "hs_relatorio_area"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_relatorio_area"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio_area.id"; + public static final int ID_INDEX = 0; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_relatorio_area.description"; + public static final int DESCRIPTION_INDEX = 1; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_relatorio_area.deleted_date"; + public static final int DELETED_DATE_INDEX = 2; + public static final String RELATORIO_ID = "relatorio_id"; + public static final String RELATORIO_ID_FULL = "hs_relatorio_area.relatorio_id"; + public static final int RELATORIO_ID_INDEX = 3; + public static final String TO_RELATORIO_ID = "to_relatorio_id"; + public static final int TO_RELATORIO_ID_INDEX = 4; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "hs_relatorio_area.ordem"; + public static final int ORDEM_INDEX = 5; + public static final String HS_AREA_ID = "hs_area_id"; + public static final String HS_AREA_ID_FULL = "hs_relatorio_area.hs_area_id"; + public static final int HS_AREA_ID_INDEX = 6; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRIPTION, DELETED_DATE, RELATORIO_ID, TO_RELATORIO_ID, ORDEM, HS_AREA_ID, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DESCRIPTION, TABLENAME + "." + DELETED_DATE, TABLENAME + "." + RELATORIO_ID, TABLENAME + "." + TO_RELATORIO_ID, TABLENAME + "." + ORDEM, TABLENAME + "." + HS_AREA_ID, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DESCRIPTION, DELETED_DATE, RELATORIO_ID, ORDEM, HS_AREA_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DESCRIPTION, DELETED_DATE, RELATORIO_ID, ORDEM, HS_AREA_ID, }; + + private Integer id; + private String description; + private java.sql.Timestamp deleted_date; + private Integer relatorio_id; + private siprp.data.outer.HsRelatorioData to_relatorio_id; + private Integer ordem; + private Integer hs_area_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsRelatorioArea() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromHsRelatorioPosto_area_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRelatorioPostoData.class , getPrimaryKey().getMap().get("id"), "area_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getDescription() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRIPTION ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.description; + } + + public void setDescription( String description ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRIPTION, description ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.description = description; + LAZY_LOADED_OBJECTS.put( DESCRIPTION, Boolean.TRUE ); + } + + public java.sql.Timestamp getDeleted_date() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DELETED_DATE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.deleted_date; + } + + public void setDeleted_date( java.sql.Timestamp deleted_date ) + { + try + { + setLockedForRefresh( true ); + preProcess( DELETED_DATE, deleted_date ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.deleted_date = deleted_date; + LAZY_LOADED_OBJECTS.put( DELETED_DATE, Boolean.TRUE ); + } + + public Integer getRelatorio_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( RELATORIO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.relatorio_id; + } + + public void setRelatorio_id( Integer relatorio_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( RELATORIO_ID, relatorio_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.relatorio_id = relatorio_id; + LAZY_LOADED_OBJECTS.put( RELATORIO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsRelatorioData toRelatorio_id() + { + try + { + prepare( TO_RELATORIO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_relatorio_id; + } + + public void setToRelatorio_id( siprp.data.outer.HsRelatorioData to_relatorio_id ) + { + try + { + preProcess( TO_RELATORIO_ID, to_relatorio_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_relatorio_id = to_relatorio_id; + } + + public Integer getOrdem() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ORDEM ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.ordem; + } + + public void setOrdem( Integer ordem ) + { + try + { + setLockedForRefresh( true ); + preProcess( ORDEM, ordem ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.ordem = ordem; + LAZY_LOADED_OBJECTS.put( ORDEM, Boolean.TRUE ); + } + + public Integer getHs_area_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( HS_AREA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.hs_area_id; + } + + public void setHs_area_id( Integer hs_area_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( HS_AREA_ID, hs_area_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.hs_area_id = hs_area_id; + LAZY_LOADED_OBJECTS.put( HS_AREA_ID, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioArea.ID_INDEX: + value = getId(); + break; + case HsRelatorioArea.DESCRIPTION_INDEX: + value = getDescription(); + break; + case HsRelatorioArea.DELETED_DATE_INDEX: + value = getDeleted_date(); + break; + case HsRelatorioArea.RELATORIO_ID_INDEX: + value = getRelatorio_id(); + break; + case HsRelatorioArea.TO_RELATORIO_ID_INDEX: + value = toRelatorio_id(); + break; + case HsRelatorioArea.ORDEM_INDEX: + value = getOrdem(); + break; + case HsRelatorioArea.HS_AREA_ID_INDEX: + value = getHs_area_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioArea.ID_INDEX: + value = this.id; + break; + case HsRelatorioArea.DESCRIPTION_INDEX: + value = this.description; + break; + case HsRelatorioArea.DELETED_DATE_INDEX: + value = this.deleted_date; + break; + case HsRelatorioArea.RELATORIO_ID_INDEX: + value = this.relatorio_id; + break; + case HsRelatorioArea.TO_RELATORIO_ID_INDEX: + value = this.to_relatorio_id; + break; + case HsRelatorioArea.ORDEM_INDEX: + value = this.ordem; + break; + case HsRelatorioArea.HS_AREA_ID_INDEX: + value = this.hs_area_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioArea.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsRelatorioArea.DESCRIPTION_INDEX: + setDescription( ( String ) value ); + break; + case HsRelatorioArea.DELETED_DATE_INDEX: + setDeleted_date( ( java.sql.Timestamp ) value ); + break; + case HsRelatorioArea.RELATORIO_ID_INDEX: + setRelatorio_id( ( Integer ) value ); + break; + case HsRelatorioArea.TO_RELATORIO_ID_INDEX: + setToRelatorio_id( ( siprp.data.outer.HsRelatorioData ) value ); + break; + case HsRelatorioArea.ORDEM_INDEX: + setOrdem( ( Integer ) value ); + break; + case HsRelatorioArea.HS_AREA_ID_INDEX: + setHs_area_id( ( Integer ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioArea.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsRelatorioArea.DESCRIPTION_INDEX: + this.description = ( String ) value; + break; + case HsRelatorioArea.DELETED_DATE_INDEX: + this.deleted_date = ( java.sql.Timestamp ) value; + break; + case HsRelatorioArea.RELATORIO_ID_INDEX: + this.relatorio_id = ( Integer ) value; + break; + case HsRelatorioArea.TO_RELATORIO_ID_INDEX: + this.to_relatorio_id = ( siprp.data.outer.HsRelatorioData ) value; + break; + case HsRelatorioArea.ORDEM_INDEX: + this.ordem = ( Integer ) value; + break; + case HsRelatorioArea.HS_AREA_ID_INDEX: + this.hs_area_id = ( Integer ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsRelatorioArea.ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioArea.DESCRIPTION_INDEX: + theClass = String.class; + break; + case HsRelatorioArea.DELETED_DATE_INDEX: + theClass = java.sql.Timestamp.class; + break; + case HsRelatorioArea.RELATORIO_ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioArea.TO_RELATORIO_ID_INDEX: + theClass = siprp.data.outer.HsRelatorioData.class; + break; + case HsRelatorioArea.ORDEM_INDEX: + theClass = Integer.class; + break; + case HsRelatorioArea.HS_AREA_ID_INDEX: + theClass = Integer.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsRelatorioArea._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsRelatorioArea.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioEquipamento.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioEquipamento.java new file mode 100644 index 00000000..f7086155 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioEquipamento.java @@ -0,0 +1,582 @@ +/* +* HsRelatorioEquipamento.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsRelatorioEquipamento extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + com.evolute.entity.evo.EvoDataObject.register( HsRelatorioEquipamento.CLASS_IDENTIFIER, HsRelatorioEquipamento.HS_RELATORIO_ID, HsRelatorioEquipamento.TO_HS_RELATORIO_ID ); + FIELD_INDEXES.put( HsRelatorioEquipamento.HS_RELATORIO_ID, HsRelatorioEquipamento.HS_RELATORIO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioEquipamento.HS_RELATORIO_ID_FULL, HsRelatorioEquipamento.HS_RELATORIO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioEquipamento.TO_HS_RELATORIO_ID, HsRelatorioEquipamento.TO_HS_RELATORIO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioEquipamento.HS_EQUIPAMENTO, HsRelatorioEquipamento.HS_EQUIPAMENTO_INDEX ); + FIELD_INDEXES.put( HsRelatorioEquipamento.HS_EQUIPAMENTO_FULL, HsRelatorioEquipamento.HS_EQUIPAMENTO_INDEX ); + FIELD_INDEXES.put( HsRelatorioEquipamento.ID, HsRelatorioEquipamento.ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioEquipamento.ID_FULL, HsRelatorioEquipamento.ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioEquipamento.TIPO, HsRelatorioEquipamento.TIPO_INDEX ); + FIELD_INDEXES.put( HsRelatorioEquipamento.TIPO_FULL, HsRelatorioEquipamento.TIPO_INDEX ); + FIELD_INDEXES.put( HsRelatorioEquipamento.MARCA, HsRelatorioEquipamento.MARCA_INDEX ); + FIELD_INDEXES.put( HsRelatorioEquipamento.MARCA_FULL, HsRelatorioEquipamento.MARCA_INDEX ); + FIELD_INDEXES.put( HsRelatorioEquipamento.MODELO, HsRelatorioEquipamento.MODELO_INDEX ); + FIELD_INDEXES.put( HsRelatorioEquipamento.MODELO_FULL, HsRelatorioEquipamento.MODELO_INDEX ); + FIELD_INDEXES.put( HsRelatorioEquipamento.HS_EQUIPAMENTO_ID, HsRelatorioEquipamento.HS_EQUIPAMENTO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioEquipamento.HS_EQUIPAMENTO_ID_FULL, HsRelatorioEquipamento.HS_EQUIPAMENTO_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyhs_relatorio_idTohs_relatorio = + new com.evolute.entity.ForeignKey( HsRelatorioEquipamento.class, HsRelatorioEquipamento.HS_RELATORIO_ID, siprp.data.outer.HsRelatorioData.class, siprp.data.outer.HsRelatorioData.ID ); + + public static final String TABLENAME = "hs_relatorio_equipamento"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_relatorio_equipamento"; + + public static final int _INVALID__INDEX = -1; + public static final String HS_RELATORIO_ID = "hs_relatorio_id"; + public static final String HS_RELATORIO_ID_FULL = "hs_relatorio_equipamento.hs_relatorio_id"; + public static final int HS_RELATORIO_ID_INDEX = 0; + public static final String TO_HS_RELATORIO_ID = "to_hs_relatorio_id"; + public static final int TO_HS_RELATORIO_ID_INDEX = 1; + public static final String HS_EQUIPAMENTO = "hs_equipamento"; + public static final String HS_EQUIPAMENTO_FULL = "hs_relatorio_equipamento.hs_equipamento"; + public static final int HS_EQUIPAMENTO_INDEX = 2; + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio_equipamento.id"; + public static final int ID_INDEX = 3; + public static final String TIPO = "tipo"; + public static final String TIPO_FULL = "hs_relatorio_equipamento.tipo"; + public static final int TIPO_INDEX = 4; + public static final String MARCA = "marca"; + public static final String MARCA_FULL = "hs_relatorio_equipamento.marca"; + public static final int MARCA_INDEX = 5; + public static final String MODELO = "modelo"; + public static final String MODELO_FULL = "hs_relatorio_equipamento.modelo"; + public static final int MODELO_INDEX = 6; + public static final String HS_EQUIPAMENTO_ID = "hs_equipamento_id"; + public static final String HS_EQUIPAMENTO_ID_FULL = "hs_relatorio_equipamento.hs_equipamento_id"; + public static final int HS_EQUIPAMENTO_ID_INDEX = 7; + + public static final String FIELD_NAMES[] = new String[]{ + HS_RELATORIO_ID, TO_HS_RELATORIO_ID, HS_EQUIPAMENTO, TIPO, MARCA, MODELO, + HS_EQUIPAMENTO_ID, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + HS_RELATORIO_ID, TABLENAME + "." + TO_HS_RELATORIO_ID, TABLENAME + "." + HS_EQUIPAMENTO, TABLENAME + "." + TIPO, TABLENAME + "." + MARCA, TABLENAME + "." + MODELO, + TABLENAME + "." + HS_EQUIPAMENTO_ID, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + HS_RELATORIO_ID, HS_EQUIPAMENTO, ID, TIPO, MARCA, MODELO, HS_EQUIPAMENTO_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + HS_RELATORIO_ID, HS_EQUIPAMENTO, ID, TIPO, MARCA, MODELO, HS_EQUIPAMENTO_ID, }; + + private Integer hs_relatorio_id; + private siprp.data.outer.HsRelatorioData to_hs_relatorio_id; + private Integer hs_equipamento; + private Integer id; + private String tipo; + private String marca; + private String modelo; + private Integer hs_equipamento_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsRelatorioEquipamento() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false }; + } + + public Integer getHs_relatorio_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( HS_RELATORIO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.hs_relatorio_id; + } + + public void setHs_relatorio_id( Integer hs_relatorio_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( HS_RELATORIO_ID, hs_relatorio_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.hs_relatorio_id = hs_relatorio_id; + LAZY_LOADED_OBJECTS.put( HS_RELATORIO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsRelatorioData toHs_relatorio_id() + { + try + { + prepare( TO_HS_RELATORIO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_hs_relatorio_id; + } + + public void setToHs_relatorio_id( siprp.data.outer.HsRelatorioData to_hs_relatorio_id ) + { + try + { + preProcess( TO_HS_RELATORIO_ID, to_hs_relatorio_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_hs_relatorio_id = to_hs_relatorio_id; + } + + public Integer getHs_equipamento() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( HS_EQUIPAMENTO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.hs_equipamento; + } + + public void setHs_equipamento( Integer hs_equipamento ) + { + try + { + setLockedForRefresh( true ); + preProcess( HS_EQUIPAMENTO, hs_equipamento ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.hs_equipamento = hs_equipamento; + LAZY_LOADED_OBJECTS.put( HS_EQUIPAMENTO, Boolean.TRUE ); + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public String getTipo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TIPO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.tipo; + } + + public void setTipo( String tipo ) + { + try + { + setLockedForRefresh( true ); + preProcess( TIPO, tipo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.tipo = tipo; + LAZY_LOADED_OBJECTS.put( TIPO, Boolean.TRUE ); + } + + public String getMarca() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MARCA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.marca; + } + + public void setMarca( String marca ) + { + try + { + setLockedForRefresh( true ); + preProcess( MARCA, marca ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.marca = marca; + LAZY_LOADED_OBJECTS.put( MARCA, Boolean.TRUE ); + } + + public String getModelo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MODELO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.modelo; + } + + public void setModelo( String modelo ) + { + try + { + setLockedForRefresh( true ); + preProcess( MODELO, modelo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.modelo = modelo; + LAZY_LOADED_OBJECTS.put( MODELO, Boolean.TRUE ); + } + + public Integer getHs_equipamento_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( HS_EQUIPAMENTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.hs_equipamento_id; + } + + public void setHs_equipamento_id( Integer hs_equipamento_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( HS_EQUIPAMENTO_ID, hs_equipamento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.hs_equipamento_id = hs_equipamento_id; + LAZY_LOADED_OBJECTS.put( HS_EQUIPAMENTO_ID, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioEquipamento.HS_RELATORIO_ID_INDEX: + value = getHs_relatorio_id(); + break; + case HsRelatorioEquipamento.TO_HS_RELATORIO_ID_INDEX: + value = toHs_relatorio_id(); + break; + case HsRelatorioEquipamento.HS_EQUIPAMENTO_INDEX: + value = getHs_equipamento(); + break; + case HsRelatorioEquipamento.ID_INDEX: + value = getId(); + break; + case HsRelatorioEquipamento.TIPO_INDEX: + value = getTipo(); + break; + case HsRelatorioEquipamento.MARCA_INDEX: + value = getMarca(); + break; + case HsRelatorioEquipamento.MODELO_INDEX: + value = getModelo(); + break; + case HsRelatorioEquipamento.HS_EQUIPAMENTO_ID_INDEX: + value = getHs_equipamento_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioEquipamento.HS_RELATORIO_ID_INDEX: + value = this.hs_relatorio_id; + break; + case HsRelatorioEquipamento.TO_HS_RELATORIO_ID_INDEX: + value = this.to_hs_relatorio_id; + break; + case HsRelatorioEquipamento.HS_EQUIPAMENTO_INDEX: + value = this.hs_equipamento; + break; + case HsRelatorioEquipamento.ID_INDEX: + value = this.id; + break; + case HsRelatorioEquipamento.TIPO_INDEX: + value = this.tipo; + break; + case HsRelatorioEquipamento.MARCA_INDEX: + value = this.marca; + break; + case HsRelatorioEquipamento.MODELO_INDEX: + value = this.modelo; + break; + case HsRelatorioEquipamento.HS_EQUIPAMENTO_ID_INDEX: + value = this.hs_equipamento_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioEquipamento.HS_RELATORIO_ID_INDEX: + setHs_relatorio_id( ( Integer ) value ); + break; + case HsRelatorioEquipamento.TO_HS_RELATORIO_ID_INDEX: + setToHs_relatorio_id( ( siprp.data.outer.HsRelatorioData ) value ); + break; + case HsRelatorioEquipamento.HS_EQUIPAMENTO_INDEX: + setHs_equipamento( ( Integer ) value ); + break; + case HsRelatorioEquipamento.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsRelatorioEquipamento.TIPO_INDEX: + setTipo( ( String ) value ); + break; + case HsRelatorioEquipamento.MARCA_INDEX: + setMarca( ( String ) value ); + break; + case HsRelatorioEquipamento.MODELO_INDEX: + setModelo( ( String ) value ); + break; + case HsRelatorioEquipamento.HS_EQUIPAMENTO_ID_INDEX: + setHs_equipamento_id( ( Integer ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioEquipamento.HS_RELATORIO_ID_INDEX: + this.hs_relatorio_id = ( Integer ) value; + break; + case HsRelatorioEquipamento.TO_HS_RELATORIO_ID_INDEX: + this.to_hs_relatorio_id = ( siprp.data.outer.HsRelatorioData ) value; + break; + case HsRelatorioEquipamento.HS_EQUIPAMENTO_INDEX: + this.hs_equipamento = ( Integer ) value; + break; + case HsRelatorioEquipamento.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsRelatorioEquipamento.TIPO_INDEX: + this.tipo = ( String ) value; + break; + case HsRelatorioEquipamento.MARCA_INDEX: + this.marca = ( String ) value; + break; + case HsRelatorioEquipamento.MODELO_INDEX: + this.modelo = ( String ) value; + break; + case HsRelatorioEquipamento.HS_EQUIPAMENTO_ID_INDEX: + this.hs_equipamento_id = ( Integer ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsRelatorioEquipamento.HS_RELATORIO_ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioEquipamento.TO_HS_RELATORIO_ID_INDEX: + theClass = siprp.data.outer.HsRelatorioData.class; + break; + case HsRelatorioEquipamento.HS_EQUIPAMENTO_INDEX: + theClass = Integer.class; + break; + case HsRelatorioEquipamento.ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioEquipamento.TIPO_INDEX: + theClass = String.class; + break; + case HsRelatorioEquipamento.MARCA_INDEX: + theClass = String.class; + break; + case HsRelatorioEquipamento.MODELO_INDEX: + theClass = String.class; + break; + case HsRelatorioEquipamento.HS_EQUIPAMENTO_ID_INDEX: + theClass = Integer.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsRelatorioEquipamento._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsRelatorioEquipamento.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioLegislacao.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioLegislacao.java new file mode 100644 index 00000000..1e1d3039 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioLegislacao.java @@ -0,0 +1,532 @@ +/* +* HsRelatorioLegislacao.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsRelatorioLegislacao extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + com.evolute.entity.evo.EvoDataObject.register( HsRelatorioLegislacao.CLASS_IDENTIFIER, HsRelatorioLegislacao.HS_RELATORIO_ID, HsRelatorioLegislacao.TO_HS_RELATORIO_ID ); + FIELD_INDEXES.put( HsRelatorioLegislacao.HS_RELATORIO_ID, HsRelatorioLegislacao.HS_RELATORIO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioLegislacao.HS_RELATORIO_ID_FULL, HsRelatorioLegislacao.HS_RELATORIO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioLegislacao.TO_HS_RELATORIO_ID, HsRelatorioLegislacao.TO_HS_RELATORIO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioLegislacao.HS_LEGISLACAO_ID, HsRelatorioLegislacao.HS_LEGISLACAO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioLegislacao.HS_LEGISLACAO_ID_FULL, HsRelatorioLegislacao.HS_LEGISLACAO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioLegislacao.ID, HsRelatorioLegislacao.ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioLegislacao.ID_FULL, HsRelatorioLegislacao.ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioLegislacao.CATEGORIA, HsRelatorioLegislacao.CATEGORIA_INDEX ); + FIELD_INDEXES.put( HsRelatorioLegislacao.CATEGORIA_FULL, HsRelatorioLegislacao.CATEGORIA_INDEX ); + FIELD_INDEXES.put( HsRelatorioLegislacao.DESCRICAO, HsRelatorioLegislacao.DESCRICAO_INDEX ); + FIELD_INDEXES.put( HsRelatorioLegislacao.DESCRICAO_FULL, HsRelatorioLegislacao.DESCRICAO_INDEX ); + FIELD_INDEXES.put( HsRelatorioLegislacao.ORDEM, HsRelatorioLegislacao.ORDEM_INDEX ); + FIELD_INDEXES.put( HsRelatorioLegislacao.ORDEM_FULL, HsRelatorioLegislacao.ORDEM_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyhs_relatorio_idTohs_relatorio = + new com.evolute.entity.ForeignKey( HsRelatorioLegislacao.class, HsRelatorioLegislacao.HS_RELATORIO_ID, siprp.data.outer.HsRelatorioData.class, siprp.data.outer.HsRelatorioData.ID ); + + public static final String TABLENAME = "hs_relatorio_legislacao"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_relatorio_legislacao"; + + public static final int _INVALID__INDEX = -1; + public static final String HS_RELATORIO_ID = "hs_relatorio_id"; + public static final String HS_RELATORIO_ID_FULL = "hs_relatorio_legislacao.hs_relatorio_id"; + public static final int HS_RELATORIO_ID_INDEX = 0; + public static final String TO_HS_RELATORIO_ID = "to_hs_relatorio_id"; + public static final int TO_HS_RELATORIO_ID_INDEX = 1; + public static final String HS_LEGISLACAO_ID = "hs_legislacao_id"; + public static final String HS_LEGISLACAO_ID_FULL = "hs_relatorio_legislacao.hs_legislacao_id"; + public static final int HS_LEGISLACAO_ID_INDEX = 2; + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio_legislacao.id"; + public static final int ID_INDEX = 3; + public static final String CATEGORIA = "categoria"; + public static final String CATEGORIA_FULL = "hs_relatorio_legislacao.categoria"; + public static final int CATEGORIA_INDEX = 4; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "hs_relatorio_legislacao.descricao"; + public static final int DESCRICAO_INDEX = 5; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "hs_relatorio_legislacao.ordem"; + public static final int ORDEM_INDEX = 6; + + public static final String FIELD_NAMES[] = new String[]{ + HS_RELATORIO_ID, TO_HS_RELATORIO_ID, HS_LEGISLACAO_ID, CATEGORIA, DESCRICAO, + ORDEM, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + HS_RELATORIO_ID, TABLENAME + "." + TO_HS_RELATORIO_ID, TABLENAME + "." + HS_LEGISLACAO_ID, TABLENAME + "." + CATEGORIA, TABLENAME + "." + DESCRICAO, + TABLENAME + "." + ORDEM, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + HS_RELATORIO_ID, HS_LEGISLACAO_ID, ID, CATEGORIA, DESCRICAO, ORDEM, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + HS_RELATORIO_ID, HS_LEGISLACAO_ID, ID, CATEGORIA, DESCRICAO, ORDEM, }; + + private Integer hs_relatorio_id; + private siprp.data.outer.HsRelatorioData to_hs_relatorio_id; + private Integer hs_legislacao_id; + private Integer id; + private String categoria; + private String descricao; + private Integer ordem; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsRelatorioLegislacao() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false }; + } + + public Integer getHs_relatorio_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( HS_RELATORIO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.hs_relatorio_id; + } + + public void setHs_relatorio_id( Integer hs_relatorio_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( HS_RELATORIO_ID, hs_relatorio_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.hs_relatorio_id = hs_relatorio_id; + LAZY_LOADED_OBJECTS.put( HS_RELATORIO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsRelatorioData toHs_relatorio_id() + { + try + { + prepare( TO_HS_RELATORIO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_hs_relatorio_id; + } + + public void setToHs_relatorio_id( siprp.data.outer.HsRelatorioData to_hs_relatorio_id ) + { + try + { + preProcess( TO_HS_RELATORIO_ID, to_hs_relatorio_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_hs_relatorio_id = to_hs_relatorio_id; + } + + public Integer getHs_legislacao_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( HS_LEGISLACAO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.hs_legislacao_id; + } + + public void setHs_legislacao_id( Integer hs_legislacao_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( HS_LEGISLACAO_ID, hs_legislacao_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.hs_legislacao_id = hs_legislacao_id; + LAZY_LOADED_OBJECTS.put( HS_LEGISLACAO_ID, Boolean.TRUE ); + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public String getCategoria() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CATEGORIA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.categoria; + } + + public void setCategoria( String categoria ) + { + try + { + setLockedForRefresh( true ); + preProcess( CATEGORIA, categoria ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.categoria = categoria; + LAZY_LOADED_OBJECTS.put( CATEGORIA, Boolean.TRUE ); + } + + public String getDescricao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRICAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.descricao; + } + + public void setDescricao( String descricao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRICAO, descricao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.descricao = descricao; + LAZY_LOADED_OBJECTS.put( DESCRICAO, Boolean.TRUE ); + } + + public Integer getOrdem() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ORDEM ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.ordem; + } + + public void setOrdem( Integer ordem ) + { + try + { + setLockedForRefresh( true ); + preProcess( ORDEM, ordem ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.ordem = ordem; + LAZY_LOADED_OBJECTS.put( ORDEM, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioLegislacao.HS_RELATORIO_ID_INDEX: + value = getHs_relatorio_id(); + break; + case HsRelatorioLegislacao.TO_HS_RELATORIO_ID_INDEX: + value = toHs_relatorio_id(); + break; + case HsRelatorioLegislacao.HS_LEGISLACAO_ID_INDEX: + value = getHs_legislacao_id(); + break; + case HsRelatorioLegislacao.ID_INDEX: + value = getId(); + break; + case HsRelatorioLegislacao.CATEGORIA_INDEX: + value = getCategoria(); + break; + case HsRelatorioLegislacao.DESCRICAO_INDEX: + value = getDescricao(); + break; + case HsRelatorioLegislacao.ORDEM_INDEX: + value = getOrdem(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioLegislacao.HS_RELATORIO_ID_INDEX: + value = this.hs_relatorio_id; + break; + case HsRelatorioLegislacao.TO_HS_RELATORIO_ID_INDEX: + value = this.to_hs_relatorio_id; + break; + case HsRelatorioLegislacao.HS_LEGISLACAO_ID_INDEX: + value = this.hs_legislacao_id; + break; + case HsRelatorioLegislacao.ID_INDEX: + value = this.id; + break; + case HsRelatorioLegislacao.CATEGORIA_INDEX: + value = this.categoria; + break; + case HsRelatorioLegislacao.DESCRICAO_INDEX: + value = this.descricao; + break; + case HsRelatorioLegislacao.ORDEM_INDEX: + value = this.ordem; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioLegislacao.HS_RELATORIO_ID_INDEX: + setHs_relatorio_id( ( Integer ) value ); + break; + case HsRelatorioLegislacao.TO_HS_RELATORIO_ID_INDEX: + setToHs_relatorio_id( ( siprp.data.outer.HsRelatorioData ) value ); + break; + case HsRelatorioLegislacao.HS_LEGISLACAO_ID_INDEX: + setHs_legislacao_id( ( Integer ) value ); + break; + case HsRelatorioLegislacao.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsRelatorioLegislacao.CATEGORIA_INDEX: + setCategoria( ( String ) value ); + break; + case HsRelatorioLegislacao.DESCRICAO_INDEX: + setDescricao( ( String ) value ); + break; + case HsRelatorioLegislacao.ORDEM_INDEX: + setOrdem( ( Integer ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioLegislacao.HS_RELATORIO_ID_INDEX: + this.hs_relatorio_id = ( Integer ) value; + break; + case HsRelatorioLegislacao.TO_HS_RELATORIO_ID_INDEX: + this.to_hs_relatorio_id = ( siprp.data.outer.HsRelatorioData ) value; + break; + case HsRelatorioLegislacao.HS_LEGISLACAO_ID_INDEX: + this.hs_legislacao_id = ( Integer ) value; + break; + case HsRelatorioLegislacao.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsRelatorioLegislacao.CATEGORIA_INDEX: + this.categoria = ( String ) value; + break; + case HsRelatorioLegislacao.DESCRICAO_INDEX: + this.descricao = ( String ) value; + break; + case HsRelatorioLegislacao.ORDEM_INDEX: + this.ordem = ( Integer ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsRelatorioLegislacao.HS_RELATORIO_ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioLegislacao.TO_HS_RELATORIO_ID_INDEX: + theClass = siprp.data.outer.HsRelatorioData.class; + break; + case HsRelatorioLegislacao.HS_LEGISLACAO_ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioLegislacao.ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioLegislacao.CATEGORIA_INDEX: + theClass = String.class; + break; + case HsRelatorioLegislacao.DESCRICAO_INDEX: + theClass = String.class; + break; + case HsRelatorioLegislacao.ORDEM_INDEX: + theClass = Integer.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsRelatorioLegislacao._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsRelatorioLegislacao.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioMedida.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioMedida.java new file mode 100644 index 00000000..aa8c9c6f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioMedida.java @@ -0,0 +1,546 @@ +/* +* HsRelatorioMedida.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsRelatorioMedida extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( HsRelatorioMedida.ID, HsRelatorioMedida.ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioMedida.ID_FULL, HsRelatorioMedida.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsRelatorioMedida.CLASS_IDENTIFIER, HsRelatorioMedida.RISCO_ID, HsRelatorioMedida.TO_RISCO_ID ); + FIELD_INDEXES.put( HsRelatorioMedida.RISCO_ID, HsRelatorioMedida.RISCO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioMedida.RISCO_ID_FULL, HsRelatorioMedida.RISCO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioMedida.TO_RISCO_ID, HsRelatorioMedida.TO_RISCO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioMedida.DESCRIPTION, HsRelatorioMedida.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsRelatorioMedida.DESCRIPTION_FULL, HsRelatorioMedida.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsRelatorioMedida.REQUESITOS_LEGAIS, HsRelatorioMedida.REQUESITOS_LEGAIS_INDEX ); + FIELD_INDEXES.put( HsRelatorioMedida.REQUESITOS_LEGAIS_FULL, HsRelatorioMedida.REQUESITOS_LEGAIS_INDEX ); + FIELD_INDEXES.put( HsRelatorioMedida.DELETED_DATE, HsRelatorioMedida.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsRelatorioMedida.DELETED_DATE_FULL, HsRelatorioMedida.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsRelatorioMedida.HS_MEDIDA_ID, HsRelatorioMedida.HS_MEDIDA_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioMedida.HS_MEDIDA_ID_FULL, HsRelatorioMedida.HS_MEDIDA_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyrisco_idTohs_relatorio_risco = + new com.evolute.entity.ForeignKey( HsRelatorioMedida.class, HsRelatorioMedida.RISCO_ID, siprp.data.outer.HsRelatorioRiscoData.class, siprp.data.outer.HsRelatorioRiscoData.ID ); + + public static final String TABLENAME = "hs_relatorio_medida"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_relatorio_medida"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio_medida.id"; + public static final int ID_INDEX = 0; + public static final String RISCO_ID = "risco_id"; + public static final String RISCO_ID_FULL = "hs_relatorio_medida.risco_id"; + public static final int RISCO_ID_INDEX = 1; + public static final String TO_RISCO_ID = "to_risco_id"; + public static final int TO_RISCO_ID_INDEX = 2; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_relatorio_medida.description"; + public static final int DESCRIPTION_INDEX = 3; + public static final String REQUESITOS_LEGAIS = "requesitos_legais"; + public static final String REQUESITOS_LEGAIS_FULL = "hs_relatorio_medida.requesitos_legais"; + public static final int REQUESITOS_LEGAIS_INDEX = 4; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_relatorio_medida.deleted_date"; + public static final int DELETED_DATE_INDEX = 5; + public static final String HS_MEDIDA_ID = "hs_medida_id"; + public static final String HS_MEDIDA_ID_FULL = "hs_relatorio_medida.hs_medida_id"; + public static final int HS_MEDIDA_ID_INDEX = 6; + + public static final String FIELD_NAMES[] = new String[]{ + RISCO_ID, TO_RISCO_ID, DESCRIPTION, REQUESITOS_LEGAIS, DELETED_DATE, + HS_MEDIDA_ID, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + RISCO_ID, TABLENAME + "." + TO_RISCO_ID, TABLENAME + "." + DESCRIPTION, TABLENAME + "." + REQUESITOS_LEGAIS, TABLENAME + "." + DELETED_DATE, + TABLENAME + "." + HS_MEDIDA_ID, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, RISCO_ID, DESCRIPTION, REQUESITOS_LEGAIS, DELETED_DATE, HS_MEDIDA_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, RISCO_ID, DESCRIPTION, REQUESITOS_LEGAIS, DELETED_DATE, HS_MEDIDA_ID, }; + + private Integer id; + private Integer risco_id; + private siprp.data.outer.HsRelatorioRiscoData to_risco_id; + private String description; + private String requesitos_legais; + private java.sql.Timestamp deleted_date; + private Integer hs_medida_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsRelatorioMedida() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromHsRelatorioPostoMedida_medida_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRelatorioPostoMedidaData.class , getPrimaryKey().getMap().get("id"), "medida_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public Integer getRisco_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( RISCO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.risco_id; + } + + public void setRisco_id( Integer risco_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( RISCO_ID, risco_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.risco_id = risco_id; + LAZY_LOADED_OBJECTS.put( RISCO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsRelatorioRiscoData toRisco_id() + { + try + { + prepare( TO_RISCO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_risco_id; + } + + public void setToRisco_id( siprp.data.outer.HsRelatorioRiscoData to_risco_id ) + { + try + { + preProcess( TO_RISCO_ID, to_risco_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_risco_id = to_risco_id; + } + + public String getDescription() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRIPTION ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.description; + } + + public void setDescription( String description ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRIPTION, description ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.description = description; + LAZY_LOADED_OBJECTS.put( DESCRIPTION, Boolean.TRUE ); + } + + public String getRequesitos_legais() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( REQUESITOS_LEGAIS ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.requesitos_legais; + } + + public void setRequesitos_legais( String requesitos_legais ) + { + try + { + setLockedForRefresh( true ); + preProcess( REQUESITOS_LEGAIS, requesitos_legais ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.requesitos_legais = requesitos_legais; + LAZY_LOADED_OBJECTS.put( REQUESITOS_LEGAIS, Boolean.TRUE ); + } + + public java.sql.Timestamp getDeleted_date() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DELETED_DATE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.deleted_date; + } + + public void setDeleted_date( java.sql.Timestamp deleted_date ) + { + try + { + setLockedForRefresh( true ); + preProcess( DELETED_DATE, deleted_date ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.deleted_date = deleted_date; + LAZY_LOADED_OBJECTS.put( DELETED_DATE, Boolean.TRUE ); + } + + public Integer getHs_medida_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( HS_MEDIDA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.hs_medida_id; + } + + public void setHs_medida_id( Integer hs_medida_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( HS_MEDIDA_ID, hs_medida_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.hs_medida_id = hs_medida_id; + LAZY_LOADED_OBJECTS.put( HS_MEDIDA_ID, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioMedida.ID_INDEX: + value = getId(); + break; + case HsRelatorioMedida.RISCO_ID_INDEX: + value = getRisco_id(); + break; + case HsRelatorioMedida.TO_RISCO_ID_INDEX: + value = toRisco_id(); + break; + case HsRelatorioMedida.DESCRIPTION_INDEX: + value = getDescription(); + break; + case HsRelatorioMedida.REQUESITOS_LEGAIS_INDEX: + value = getRequesitos_legais(); + break; + case HsRelatorioMedida.DELETED_DATE_INDEX: + value = getDeleted_date(); + break; + case HsRelatorioMedida.HS_MEDIDA_ID_INDEX: + value = getHs_medida_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioMedida.ID_INDEX: + value = this.id; + break; + case HsRelatorioMedida.RISCO_ID_INDEX: + value = this.risco_id; + break; + case HsRelatorioMedida.TO_RISCO_ID_INDEX: + value = this.to_risco_id; + break; + case HsRelatorioMedida.DESCRIPTION_INDEX: + value = this.description; + break; + case HsRelatorioMedida.REQUESITOS_LEGAIS_INDEX: + value = this.requesitos_legais; + break; + case HsRelatorioMedida.DELETED_DATE_INDEX: + value = this.deleted_date; + break; + case HsRelatorioMedida.HS_MEDIDA_ID_INDEX: + value = this.hs_medida_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioMedida.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsRelatorioMedida.RISCO_ID_INDEX: + setRisco_id( ( Integer ) value ); + break; + case HsRelatorioMedida.TO_RISCO_ID_INDEX: + setToRisco_id( ( siprp.data.outer.HsRelatorioRiscoData ) value ); + break; + case HsRelatorioMedida.DESCRIPTION_INDEX: + setDescription( ( String ) value ); + break; + case HsRelatorioMedida.REQUESITOS_LEGAIS_INDEX: + setRequesitos_legais( ( String ) value ); + break; + case HsRelatorioMedida.DELETED_DATE_INDEX: + setDeleted_date( ( java.sql.Timestamp ) value ); + break; + case HsRelatorioMedida.HS_MEDIDA_ID_INDEX: + setHs_medida_id( ( Integer ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioMedida.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsRelatorioMedida.RISCO_ID_INDEX: + this.risco_id = ( Integer ) value; + break; + case HsRelatorioMedida.TO_RISCO_ID_INDEX: + this.to_risco_id = ( siprp.data.outer.HsRelatorioRiscoData ) value; + break; + case HsRelatorioMedida.DESCRIPTION_INDEX: + this.description = ( String ) value; + break; + case HsRelatorioMedida.REQUESITOS_LEGAIS_INDEX: + this.requesitos_legais = ( String ) value; + break; + case HsRelatorioMedida.DELETED_DATE_INDEX: + this.deleted_date = ( java.sql.Timestamp ) value; + break; + case HsRelatorioMedida.HS_MEDIDA_ID_INDEX: + this.hs_medida_id = ( Integer ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsRelatorioMedida.ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioMedida.RISCO_ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioMedida.TO_RISCO_ID_INDEX: + theClass = siprp.data.outer.HsRelatorioRiscoData.class; + break; + case HsRelatorioMedida.DESCRIPTION_INDEX: + theClass = String.class; + break; + case HsRelatorioMedida.REQUESITOS_LEGAIS_INDEX: + theClass = String.class; + break; + case HsRelatorioMedida.DELETED_DATE_INDEX: + theClass = java.sql.Timestamp.class; + break; + case HsRelatorioMedida.HS_MEDIDA_ID_INDEX: + theClass = Integer.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsRelatorioMedida._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsRelatorioMedida.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioNormalizacao.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioNormalizacao.java new file mode 100644 index 00000000..6652dd69 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioNormalizacao.java @@ -0,0 +1,532 @@ +/* +* HsRelatorioNormalizacao.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsRelatorioNormalizacao extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + com.evolute.entity.evo.EvoDataObject.register( HsRelatorioNormalizacao.CLASS_IDENTIFIER, HsRelatorioNormalizacao.HS_RELATORIO_ID, HsRelatorioNormalizacao.TO_HS_RELATORIO_ID ); + FIELD_INDEXES.put( HsRelatorioNormalizacao.HS_RELATORIO_ID, HsRelatorioNormalizacao.HS_RELATORIO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioNormalizacao.HS_RELATORIO_ID_FULL, HsRelatorioNormalizacao.HS_RELATORIO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioNormalizacao.TO_HS_RELATORIO_ID, HsRelatorioNormalizacao.TO_HS_RELATORIO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioNormalizacao.HS_NORMALIZACAO_ID, HsRelatorioNormalizacao.HS_NORMALIZACAO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioNormalizacao.HS_NORMALIZACAO_ID_FULL, HsRelatorioNormalizacao.HS_NORMALIZACAO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioNormalizacao.ID, HsRelatorioNormalizacao.ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioNormalizacao.ID_FULL, HsRelatorioNormalizacao.ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioNormalizacao.CODIGO, HsRelatorioNormalizacao.CODIGO_INDEX ); + FIELD_INDEXES.put( HsRelatorioNormalizacao.CODIGO_FULL, HsRelatorioNormalizacao.CODIGO_INDEX ); + FIELD_INDEXES.put( HsRelatorioNormalizacao.DESCRICAO, HsRelatorioNormalizacao.DESCRICAO_INDEX ); + FIELD_INDEXES.put( HsRelatorioNormalizacao.DESCRICAO_FULL, HsRelatorioNormalizacao.DESCRICAO_INDEX ); + FIELD_INDEXES.put( HsRelatorioNormalizacao.PORTUGUESA, HsRelatorioNormalizacao.PORTUGUESA_INDEX ); + FIELD_INDEXES.put( HsRelatorioNormalizacao.PORTUGUESA_FULL, HsRelatorioNormalizacao.PORTUGUESA_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyhs_relatorio_idTohs_relatorio = + new com.evolute.entity.ForeignKey( HsRelatorioNormalizacao.class, HsRelatorioNormalizacao.HS_RELATORIO_ID, siprp.data.outer.HsRelatorioData.class, siprp.data.outer.HsRelatorioData.ID ); + + public static final String TABLENAME = "hs_relatorio_normalizacao"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_relatorio_normalizacao"; + + public static final int _INVALID__INDEX = -1; + public static final String HS_RELATORIO_ID = "hs_relatorio_id"; + public static final String HS_RELATORIO_ID_FULL = "hs_relatorio_normalizacao.hs_relatorio_id"; + public static final int HS_RELATORIO_ID_INDEX = 0; + public static final String TO_HS_RELATORIO_ID = "to_hs_relatorio_id"; + public static final int TO_HS_RELATORIO_ID_INDEX = 1; + public static final String HS_NORMALIZACAO_ID = "hs_normalizacao_id"; + public static final String HS_NORMALIZACAO_ID_FULL = "hs_relatorio_normalizacao.hs_normalizacao_id"; + public static final int HS_NORMALIZACAO_ID_INDEX = 2; + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio_normalizacao.id"; + public static final int ID_INDEX = 3; + public static final String CODIGO = "codigo"; + public static final String CODIGO_FULL = "hs_relatorio_normalizacao.codigo"; + public static final int CODIGO_INDEX = 4; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "hs_relatorio_normalizacao.descricao"; + public static final int DESCRICAO_INDEX = 5; + public static final String PORTUGUESA = "portuguesa"; + public static final String PORTUGUESA_FULL = "hs_relatorio_normalizacao.portuguesa"; + public static final int PORTUGUESA_INDEX = 6; + + public static final String FIELD_NAMES[] = new String[]{ + HS_RELATORIO_ID, TO_HS_RELATORIO_ID, HS_NORMALIZACAO_ID, CODIGO, DESCRICAO, + PORTUGUESA, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + HS_RELATORIO_ID, TABLENAME + "." + TO_HS_RELATORIO_ID, TABLENAME + "." + HS_NORMALIZACAO_ID, TABLENAME + "." + CODIGO, TABLENAME + "." + DESCRICAO, + TABLENAME + "." + PORTUGUESA, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + HS_RELATORIO_ID, HS_NORMALIZACAO_ID, ID, CODIGO, DESCRICAO, PORTUGUESA, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + HS_RELATORIO_ID, HS_NORMALIZACAO_ID, ID, CODIGO, DESCRICAO, PORTUGUESA, }; + + private Integer hs_relatorio_id; + private siprp.data.outer.HsRelatorioData to_hs_relatorio_id; + private Integer hs_normalizacao_id; + private Integer id; + private String codigo; + private String descricao; + private Boolean portuguesa; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsRelatorioNormalizacao() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false }; + } + + public Integer getHs_relatorio_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( HS_RELATORIO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.hs_relatorio_id; + } + + public void setHs_relatorio_id( Integer hs_relatorio_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( HS_RELATORIO_ID, hs_relatorio_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.hs_relatorio_id = hs_relatorio_id; + LAZY_LOADED_OBJECTS.put( HS_RELATORIO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsRelatorioData toHs_relatorio_id() + { + try + { + prepare( TO_HS_RELATORIO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_hs_relatorio_id; + } + + public void setToHs_relatorio_id( siprp.data.outer.HsRelatorioData to_hs_relatorio_id ) + { + try + { + preProcess( TO_HS_RELATORIO_ID, to_hs_relatorio_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_hs_relatorio_id = to_hs_relatorio_id; + } + + public Integer getHs_normalizacao_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( HS_NORMALIZACAO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.hs_normalizacao_id; + } + + public void setHs_normalizacao_id( Integer hs_normalizacao_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( HS_NORMALIZACAO_ID, hs_normalizacao_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.hs_normalizacao_id = hs_normalizacao_id; + LAZY_LOADED_OBJECTS.put( HS_NORMALIZACAO_ID, Boolean.TRUE ); + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public String getCodigo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CODIGO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.codigo; + } + + public void setCodigo( String codigo ) + { + try + { + setLockedForRefresh( true ); + preProcess( CODIGO, codigo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.codigo = codigo; + LAZY_LOADED_OBJECTS.put( CODIGO, Boolean.TRUE ); + } + + public String getDescricao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRICAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.descricao; + } + + public void setDescricao( String descricao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRICAO, descricao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.descricao = descricao; + LAZY_LOADED_OBJECTS.put( DESCRICAO, Boolean.TRUE ); + } + + public Boolean getPortuguesa() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PORTUGUESA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.portuguesa; + } + + public void setPortuguesa( Boolean portuguesa ) + { + try + { + setLockedForRefresh( true ); + preProcess( PORTUGUESA, portuguesa ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.portuguesa = portuguesa; + LAZY_LOADED_OBJECTS.put( PORTUGUESA, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioNormalizacao.HS_RELATORIO_ID_INDEX: + value = getHs_relatorio_id(); + break; + case HsRelatorioNormalizacao.TO_HS_RELATORIO_ID_INDEX: + value = toHs_relatorio_id(); + break; + case HsRelatorioNormalizacao.HS_NORMALIZACAO_ID_INDEX: + value = getHs_normalizacao_id(); + break; + case HsRelatorioNormalizacao.ID_INDEX: + value = getId(); + break; + case HsRelatorioNormalizacao.CODIGO_INDEX: + value = getCodigo(); + break; + case HsRelatorioNormalizacao.DESCRICAO_INDEX: + value = getDescricao(); + break; + case HsRelatorioNormalizacao.PORTUGUESA_INDEX: + value = getPortuguesa(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioNormalizacao.HS_RELATORIO_ID_INDEX: + value = this.hs_relatorio_id; + break; + case HsRelatorioNormalizacao.TO_HS_RELATORIO_ID_INDEX: + value = this.to_hs_relatorio_id; + break; + case HsRelatorioNormalizacao.HS_NORMALIZACAO_ID_INDEX: + value = this.hs_normalizacao_id; + break; + case HsRelatorioNormalizacao.ID_INDEX: + value = this.id; + break; + case HsRelatorioNormalizacao.CODIGO_INDEX: + value = this.codigo; + break; + case HsRelatorioNormalizacao.DESCRICAO_INDEX: + value = this.descricao; + break; + case HsRelatorioNormalizacao.PORTUGUESA_INDEX: + value = this.portuguesa; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioNormalizacao.HS_RELATORIO_ID_INDEX: + setHs_relatorio_id( ( Integer ) value ); + break; + case HsRelatorioNormalizacao.TO_HS_RELATORIO_ID_INDEX: + setToHs_relatorio_id( ( siprp.data.outer.HsRelatorioData ) value ); + break; + case HsRelatorioNormalizacao.HS_NORMALIZACAO_ID_INDEX: + setHs_normalizacao_id( ( Integer ) value ); + break; + case HsRelatorioNormalizacao.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsRelatorioNormalizacao.CODIGO_INDEX: + setCodigo( ( String ) value ); + break; + case HsRelatorioNormalizacao.DESCRICAO_INDEX: + setDescricao( ( String ) value ); + break; + case HsRelatorioNormalizacao.PORTUGUESA_INDEX: + setPortuguesa( ( Boolean ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioNormalizacao.HS_RELATORIO_ID_INDEX: + this.hs_relatorio_id = ( Integer ) value; + break; + case HsRelatorioNormalizacao.TO_HS_RELATORIO_ID_INDEX: + this.to_hs_relatorio_id = ( siprp.data.outer.HsRelatorioData ) value; + break; + case HsRelatorioNormalizacao.HS_NORMALIZACAO_ID_INDEX: + this.hs_normalizacao_id = ( Integer ) value; + break; + case HsRelatorioNormalizacao.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsRelatorioNormalizacao.CODIGO_INDEX: + this.codigo = ( String ) value; + break; + case HsRelatorioNormalizacao.DESCRICAO_INDEX: + this.descricao = ( String ) value; + break; + case HsRelatorioNormalizacao.PORTUGUESA_INDEX: + this.portuguesa = ( Boolean ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsRelatorioNormalizacao.HS_RELATORIO_ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioNormalizacao.TO_HS_RELATORIO_ID_INDEX: + theClass = siprp.data.outer.HsRelatorioData.class; + break; + case HsRelatorioNormalizacao.HS_NORMALIZACAO_ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioNormalizacao.ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioNormalizacao.CODIGO_INDEX: + theClass = String.class; + break; + case HsRelatorioNormalizacao.DESCRICAO_INDEX: + theClass = String.class; + break; + case HsRelatorioNormalizacao.PORTUGUESA_INDEX: + theClass = Boolean.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsRelatorioNormalizacao._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsRelatorioNormalizacao.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioPosto.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioPosto.java new file mode 100644 index 00000000..96941ad9 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioPosto.java @@ -0,0 +1,558 @@ +/* +* HsRelatorioPosto.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsRelatorioPosto extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( HsRelatorioPosto.ID, HsRelatorioPosto.ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPosto.ID_FULL, HsRelatorioPosto.ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPosto.DESCRIPTION, HsRelatorioPosto.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsRelatorioPosto.DESCRIPTION_FULL, HsRelatorioPosto.DESCRIPTION_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsRelatorioPosto.CLASS_IDENTIFIER, HsRelatorioPosto.AREA_ID, HsRelatorioPosto.TO_AREA_ID ); + FIELD_INDEXES.put( HsRelatorioPosto.AREA_ID, HsRelatorioPosto.AREA_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPosto.AREA_ID_FULL, HsRelatorioPosto.AREA_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPosto.TO_AREA_ID, HsRelatorioPosto.TO_AREA_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPosto.DELETED_DATE, HsRelatorioPosto.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsRelatorioPosto.DELETED_DATE_FULL, HsRelatorioPosto.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsRelatorioPosto.IS_PRINCIPAL, HsRelatorioPosto.IS_PRINCIPAL_INDEX ); + FIELD_INDEXES.put( HsRelatorioPosto.IS_PRINCIPAL_FULL, HsRelatorioPosto.IS_PRINCIPAL_INDEX ); + FIELD_INDEXES.put( HsRelatorioPosto.HS_POSTO_ID, HsRelatorioPosto.HS_POSTO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPosto.HS_POSTO_ID_FULL, HsRelatorioPosto.HS_POSTO_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyarea_idTohs_relatorio_area = + new com.evolute.entity.ForeignKey( HsRelatorioPosto.class, HsRelatorioPosto.AREA_ID, siprp.data.outer.HsRelatorioAreaData.class, siprp.data.outer.HsRelatorioAreaData.ID ); + + public static final String TABLENAME = "hs_relatorio_posto"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_relatorio_posto"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio_posto.id"; + public static final int ID_INDEX = 0; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_relatorio_posto.description"; + public static final int DESCRIPTION_INDEX = 1; + public static final String AREA_ID = "area_id"; + public static final String AREA_ID_FULL = "hs_relatorio_posto.area_id"; + public static final int AREA_ID_INDEX = 2; + public static final String TO_AREA_ID = "to_area_id"; + public static final int TO_AREA_ID_INDEX = 3; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_relatorio_posto.deleted_date"; + public static final int DELETED_DATE_INDEX = 4; + public static final String IS_PRINCIPAL = "is_principal"; + public static final String IS_PRINCIPAL_FULL = "hs_relatorio_posto.is_principal"; + public static final int IS_PRINCIPAL_INDEX = 5; + public static final String HS_POSTO_ID = "hs_posto_id"; + public static final String HS_POSTO_ID_FULL = "hs_relatorio_posto.hs_posto_id"; + public static final int HS_POSTO_ID_INDEX = 6; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRIPTION, AREA_ID, TO_AREA_ID, DELETED_DATE, IS_PRINCIPAL, HS_POSTO_ID, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DESCRIPTION, TABLENAME + "." + AREA_ID, TABLENAME + "." + TO_AREA_ID, TABLENAME + "." + DELETED_DATE, TABLENAME + "." + IS_PRINCIPAL, TABLENAME + "." + HS_POSTO_ID, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DESCRIPTION, AREA_ID, DELETED_DATE, IS_PRINCIPAL, HS_POSTO_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DESCRIPTION, AREA_ID, DELETED_DATE, IS_PRINCIPAL, HS_POSTO_ID, }; + + private Integer id; + private String description; + private Integer area_id; + private siprp.data.outer.HsRelatorioAreaData to_area_id; + private java.sql.Timestamp deleted_date; + private Boolean is_principal; + private Integer hs_posto_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsRelatorioPosto() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromHsRelatorioPostoMedida_posto_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRelatorioPostoMedidaData.class , getPrimaryKey().getMap().get("id"), "posto_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsRelatorioPostoRisco_posto_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRelatorioPostoRiscoData.class , getPrimaryKey().getMap().get("id"), "posto_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getDescription() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRIPTION ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.description; + } + + public void setDescription( String description ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRIPTION, description ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.description = description; + LAZY_LOADED_OBJECTS.put( DESCRIPTION, Boolean.TRUE ); + } + + public Integer getArea_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( AREA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.area_id; + } + + public void setArea_id( Integer area_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( AREA_ID, area_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.area_id = area_id; + LAZY_LOADED_OBJECTS.put( AREA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsRelatorioAreaData toArea_id() + { + try + { + prepare( TO_AREA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_area_id; + } + + public void setToArea_id( siprp.data.outer.HsRelatorioAreaData to_area_id ) + { + try + { + preProcess( TO_AREA_ID, to_area_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_area_id = to_area_id; + } + + public java.sql.Timestamp getDeleted_date() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DELETED_DATE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.deleted_date; + } + + public void setDeleted_date( java.sql.Timestamp deleted_date ) + { + try + { + setLockedForRefresh( true ); + preProcess( DELETED_DATE, deleted_date ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.deleted_date = deleted_date; + LAZY_LOADED_OBJECTS.put( DELETED_DATE, Boolean.TRUE ); + } + + public Boolean getIs_principal() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( IS_PRINCIPAL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.is_principal; + } + + public void setIs_principal( Boolean is_principal ) + { + try + { + setLockedForRefresh( true ); + preProcess( IS_PRINCIPAL, is_principal ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.is_principal = is_principal; + LAZY_LOADED_OBJECTS.put( IS_PRINCIPAL, Boolean.TRUE ); + } + + public Integer getHs_posto_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( HS_POSTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.hs_posto_id; + } + + public void setHs_posto_id( Integer hs_posto_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( HS_POSTO_ID, hs_posto_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.hs_posto_id = hs_posto_id; + LAZY_LOADED_OBJECTS.put( HS_POSTO_ID, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioPosto.ID_INDEX: + value = getId(); + break; + case HsRelatorioPosto.DESCRIPTION_INDEX: + value = getDescription(); + break; + case HsRelatorioPosto.AREA_ID_INDEX: + value = getArea_id(); + break; + case HsRelatorioPosto.TO_AREA_ID_INDEX: + value = toArea_id(); + break; + case HsRelatorioPosto.DELETED_DATE_INDEX: + value = getDeleted_date(); + break; + case HsRelatorioPosto.IS_PRINCIPAL_INDEX: + value = getIs_principal(); + break; + case HsRelatorioPosto.HS_POSTO_ID_INDEX: + value = getHs_posto_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioPosto.ID_INDEX: + value = this.id; + break; + case HsRelatorioPosto.DESCRIPTION_INDEX: + value = this.description; + break; + case HsRelatorioPosto.AREA_ID_INDEX: + value = this.area_id; + break; + case HsRelatorioPosto.TO_AREA_ID_INDEX: + value = this.to_area_id; + break; + case HsRelatorioPosto.DELETED_DATE_INDEX: + value = this.deleted_date; + break; + case HsRelatorioPosto.IS_PRINCIPAL_INDEX: + value = this.is_principal; + break; + case HsRelatorioPosto.HS_POSTO_ID_INDEX: + value = this.hs_posto_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioPosto.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsRelatorioPosto.DESCRIPTION_INDEX: + setDescription( ( String ) value ); + break; + case HsRelatorioPosto.AREA_ID_INDEX: + setArea_id( ( Integer ) value ); + break; + case HsRelatorioPosto.TO_AREA_ID_INDEX: + setToArea_id( ( siprp.data.outer.HsRelatorioAreaData ) value ); + break; + case HsRelatorioPosto.DELETED_DATE_INDEX: + setDeleted_date( ( java.sql.Timestamp ) value ); + break; + case HsRelatorioPosto.IS_PRINCIPAL_INDEX: + setIs_principal( ( Boolean ) value ); + break; + case HsRelatorioPosto.HS_POSTO_ID_INDEX: + setHs_posto_id( ( Integer ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioPosto.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsRelatorioPosto.DESCRIPTION_INDEX: + this.description = ( String ) value; + break; + case HsRelatorioPosto.AREA_ID_INDEX: + this.area_id = ( Integer ) value; + break; + case HsRelatorioPosto.TO_AREA_ID_INDEX: + this.to_area_id = ( siprp.data.outer.HsRelatorioAreaData ) value; + break; + case HsRelatorioPosto.DELETED_DATE_INDEX: + this.deleted_date = ( java.sql.Timestamp ) value; + break; + case HsRelatorioPosto.IS_PRINCIPAL_INDEX: + this.is_principal = ( Boolean ) value; + break; + case HsRelatorioPosto.HS_POSTO_ID_INDEX: + this.hs_posto_id = ( Integer ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsRelatorioPosto.ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioPosto.DESCRIPTION_INDEX: + theClass = String.class; + break; + case HsRelatorioPosto.AREA_ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioPosto.TO_AREA_ID_INDEX: + theClass = siprp.data.outer.HsRelatorioAreaData.class; + break; + case HsRelatorioPosto.DELETED_DATE_INDEX: + theClass = java.sql.Timestamp.class; + break; + case HsRelatorioPosto.IS_PRINCIPAL_INDEX: + theClass = Boolean.class; + break; + case HsRelatorioPosto.HS_POSTO_ID_INDEX: + theClass = Integer.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsRelatorioPosto._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsRelatorioPosto.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioPostoMedida.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioPostoMedida.java new file mode 100644 index 00000000..9c14ea24 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioPostoMedida.java @@ -0,0 +1,429 @@ +/* +* HsRelatorioPostoMedida.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsRelatorioPostoMedida extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + com.evolute.entity.evo.EvoDataObject.register( HsRelatorioPostoMedida.CLASS_IDENTIFIER, HsRelatorioPostoMedida.POSTO_ID, HsRelatorioPostoMedida.TO_POSTO_ID ); + FIELD_INDEXES.put( HsRelatorioPostoMedida.POSTO_ID, HsRelatorioPostoMedida.POSTO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoMedida.POSTO_ID_FULL, HsRelatorioPostoMedida.POSTO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoMedida.TO_POSTO_ID, HsRelatorioPostoMedida.TO_POSTO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsRelatorioPostoMedida.CLASS_IDENTIFIER, HsRelatorioPostoMedida.MEDIDA_ID, HsRelatorioPostoMedida.TO_MEDIDA_ID ); + FIELD_INDEXES.put( HsRelatorioPostoMedida.MEDIDA_ID, HsRelatorioPostoMedida.MEDIDA_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoMedida.MEDIDA_ID_FULL, HsRelatorioPostoMedida.MEDIDA_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoMedida.TO_MEDIDA_ID, HsRelatorioPostoMedida.TO_MEDIDA_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoMedida.IS_PLANO_ACTUACAO, HsRelatorioPostoMedida.IS_PLANO_ACTUACAO_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoMedida.IS_PLANO_ACTUACAO_FULL, HsRelatorioPostoMedida.IS_PLANO_ACTUACAO_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyposto_idTohs_relatorio_posto = + new com.evolute.entity.ForeignKey( HsRelatorioPostoMedida.class, HsRelatorioPostoMedida.POSTO_ID, siprp.data.outer.HsRelatorioPostoData.class, siprp.data.outer.HsRelatorioPostoData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeymedida_idTohs_relatorio_medida = + new com.evolute.entity.ForeignKey( HsRelatorioPostoMedida.class, HsRelatorioPostoMedida.MEDIDA_ID, siprp.data.outer.HsRelatorioMedidaData.class, siprp.data.outer.HsRelatorioMedidaData.ID ); + + public static final String TABLENAME = "hs_relatorio_posto_medida"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_relatorio_posto_medida"; + + public static final int _INVALID__INDEX = -1; + public static final String POSTO_ID = "posto_id"; + public static final String POSTO_ID_FULL = "hs_relatorio_posto_medida.posto_id"; + public static final int POSTO_ID_INDEX = 0; + public static final String TO_POSTO_ID = "to_posto_id"; + public static final int TO_POSTO_ID_INDEX = 1; + public static final String MEDIDA_ID = "medida_id"; + public static final String MEDIDA_ID_FULL = "hs_relatorio_posto_medida.medida_id"; + public static final int MEDIDA_ID_INDEX = 2; + public static final String TO_MEDIDA_ID = "to_medida_id"; + public static final int TO_MEDIDA_ID_INDEX = 3; + public static final String IS_PLANO_ACTUACAO = "is_plano_actuacao"; + public static final String IS_PLANO_ACTUACAO_FULL = "hs_relatorio_posto_medida.is_plano_actuacao"; + public static final int IS_PLANO_ACTUACAO_INDEX = 4; + + public static final String FIELD_NAMES[] = new String[]{ + IS_PLANO_ACTUACAO, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + IS_PLANO_ACTUACAO, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + POSTO_ID, MEDIDA_ID, IS_PLANO_ACTUACAO, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + POSTO_ID, MEDIDA_ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + POSTO_ID, MEDIDA_ID, IS_PLANO_ACTUACAO, }; + + private Integer posto_id; + private siprp.data.outer.HsRelatorioPostoData to_posto_id; + private Integer medida_id; + private siprp.data.outer.HsRelatorioMedidaData to_medida_id; + private Boolean is_plano_actuacao; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsRelatorioPostoMedida() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false, false }; + } + + public Integer getPosto_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( POSTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.posto_id; + } + + public void setPosto_id( Integer posto_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( POSTO_ID, posto_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.posto_id = posto_id; + LAZY_LOADED_OBJECTS.put( POSTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsRelatorioPostoData toPosto_id() + { + try + { + prepare( TO_POSTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_posto_id; + } + + public void setToPosto_id( siprp.data.outer.HsRelatorioPostoData to_posto_id ) + { + try + { + preProcess( TO_POSTO_ID, to_posto_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_posto_id = to_posto_id; + } + + public Integer getMedida_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MEDIDA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.medida_id; + } + + public void setMedida_id( Integer medida_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( MEDIDA_ID, medida_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.medida_id = medida_id; + LAZY_LOADED_OBJECTS.put( MEDIDA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsRelatorioMedidaData toMedida_id() + { + try + { + prepare( TO_MEDIDA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_medida_id; + } + + public void setToMedida_id( siprp.data.outer.HsRelatorioMedidaData to_medida_id ) + { + try + { + preProcess( TO_MEDIDA_ID, to_medida_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_medida_id = to_medida_id; + } + + public Boolean getIs_plano_actuacao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( IS_PLANO_ACTUACAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.is_plano_actuacao; + } + + public void setIs_plano_actuacao( Boolean is_plano_actuacao ) + { + try + { + setLockedForRefresh( true ); + preProcess( IS_PLANO_ACTUACAO, is_plano_actuacao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.is_plano_actuacao = is_plano_actuacao; + LAZY_LOADED_OBJECTS.put( IS_PLANO_ACTUACAO, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioPostoMedida.POSTO_ID_INDEX: + value = getPosto_id(); + break; + case HsRelatorioPostoMedida.TO_POSTO_ID_INDEX: + value = toPosto_id(); + break; + case HsRelatorioPostoMedida.MEDIDA_ID_INDEX: + value = getMedida_id(); + break; + case HsRelatorioPostoMedida.TO_MEDIDA_ID_INDEX: + value = toMedida_id(); + break; + case HsRelatorioPostoMedida.IS_PLANO_ACTUACAO_INDEX: + value = getIs_plano_actuacao(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioPostoMedida.POSTO_ID_INDEX: + value = this.posto_id; + break; + case HsRelatorioPostoMedida.TO_POSTO_ID_INDEX: + value = this.to_posto_id; + break; + case HsRelatorioPostoMedida.MEDIDA_ID_INDEX: + value = this.medida_id; + break; + case HsRelatorioPostoMedida.TO_MEDIDA_ID_INDEX: + value = this.to_medida_id; + break; + case HsRelatorioPostoMedida.IS_PLANO_ACTUACAO_INDEX: + value = this.is_plano_actuacao; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioPostoMedida.POSTO_ID_INDEX: + setPosto_id( ( Integer ) value ); + break; + case HsRelatorioPostoMedida.TO_POSTO_ID_INDEX: + setToPosto_id( ( siprp.data.outer.HsRelatorioPostoData ) value ); + break; + case HsRelatorioPostoMedida.MEDIDA_ID_INDEX: + setMedida_id( ( Integer ) value ); + break; + case HsRelatorioPostoMedida.TO_MEDIDA_ID_INDEX: + setToMedida_id( ( siprp.data.outer.HsRelatorioMedidaData ) value ); + break; + case HsRelatorioPostoMedida.IS_PLANO_ACTUACAO_INDEX: + setIs_plano_actuacao( ( Boolean ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioPostoMedida.POSTO_ID_INDEX: + this.posto_id = ( Integer ) value; + break; + case HsRelatorioPostoMedida.TO_POSTO_ID_INDEX: + this.to_posto_id = ( siprp.data.outer.HsRelatorioPostoData ) value; + break; + case HsRelatorioPostoMedida.MEDIDA_ID_INDEX: + this.medida_id = ( Integer ) value; + break; + case HsRelatorioPostoMedida.TO_MEDIDA_ID_INDEX: + this.to_medida_id = ( siprp.data.outer.HsRelatorioMedidaData ) value; + break; + case HsRelatorioPostoMedida.IS_PLANO_ACTUACAO_INDEX: + this.is_plano_actuacao = ( Boolean ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + throw new RuntimeException( "getPrimaryKeyName on HsRelatorioPostoMedida is invalid" ); + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsRelatorioPostoMedida.POSTO_ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioPostoMedida.TO_POSTO_ID_INDEX: + theClass = siprp.data.outer.HsRelatorioPostoData.class; + break; + case HsRelatorioPostoMedida.MEDIDA_ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioPostoMedida.TO_MEDIDA_ID_INDEX: + theClass = siprp.data.outer.HsRelatorioMedidaData.class; + break; + case HsRelatorioPostoMedida.IS_PLANO_ACTUACAO_INDEX: + theClass = Boolean.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsRelatorioPostoMedida._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsRelatorioPostoMedida.PK_FIELD_NAMES ); + primaryKey.set( 0, getPosto_id() ); + primaryKey.set( 1, getMedida_id() ); + } + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioPostoRisco.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioPostoRisco.java new file mode 100644 index 00000000..46010c9c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioPostoRisco.java @@ -0,0 +1,630 @@ +/* +* HsRelatorioPostoRisco.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsRelatorioPostoRisco extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + com.evolute.entity.evo.EvoDataObject.register( HsRelatorioPostoRisco.CLASS_IDENTIFIER, HsRelatorioPostoRisco.POSTO_ID, HsRelatorioPostoRisco.TO_POSTO_ID ); + FIELD_INDEXES.put( HsRelatorioPostoRisco.POSTO_ID, HsRelatorioPostoRisco.POSTO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoRisco.POSTO_ID_FULL, HsRelatorioPostoRisco.POSTO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoRisco.TO_POSTO_ID, HsRelatorioPostoRisco.TO_POSTO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsRelatorioPostoRisco.CLASS_IDENTIFIER, HsRelatorioPostoRisco.RISCO_ID, HsRelatorioPostoRisco.TO_RISCO_ID ); + FIELD_INDEXES.put( HsRelatorioPostoRisco.RISCO_ID, HsRelatorioPostoRisco.RISCO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoRisco.RISCO_ID_FULL, HsRelatorioPostoRisco.RISCO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoRisco.TO_RISCO_ID, HsRelatorioPostoRisco.TO_RISCO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoRisco.PROBABILIDADE, HsRelatorioPostoRisco.PROBABILIDADE_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoRisco.PROBABILIDADE_FULL, HsRelatorioPostoRisco.PROBABILIDADE_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoRisco.SEVERIDADE, HsRelatorioPostoRisco.SEVERIDADE_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoRisco.SEVERIDADE_FULL, HsRelatorioPostoRisco.SEVERIDADE_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsRelatorioPostoRisco.CLASS_IDENTIFIER, HsRelatorioPostoRisco.VALOR_QUALITATIVO_ID, HsRelatorioPostoRisco.TO_VALOR_QUALITATIVO_ID ); + FIELD_INDEXES.put( HsRelatorioPostoRisco.VALOR_QUALITATIVO_ID, HsRelatorioPostoRisco.VALOR_QUALITATIVO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoRisco.VALOR_QUALITATIVO_ID_FULL, HsRelatorioPostoRisco.VALOR_QUALITATIVO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoRisco.TO_VALOR_QUALITATIVO_ID, HsRelatorioPostoRisco.TO_VALOR_QUALITATIVO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoRisco.ORDEM, HsRelatorioPostoRisco.ORDEM_INDEX ); + FIELD_INDEXES.put( HsRelatorioPostoRisco.ORDEM_FULL, HsRelatorioPostoRisco.ORDEM_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyposto_idTohs_relatorio_posto = + new com.evolute.entity.ForeignKey( HsRelatorioPostoRisco.class, HsRelatorioPostoRisco.POSTO_ID, siprp.data.outer.HsRelatorioPostoData.class, siprp.data.outer.HsRelatorioPostoData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyrisco_idTohs_relatorio_risco = + new com.evolute.entity.ForeignKey( HsRelatorioPostoRisco.class, HsRelatorioPostoRisco.RISCO_ID, siprp.data.outer.HsRelatorioRiscoData.class, siprp.data.outer.HsRelatorioRiscoData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyvalor_qualitativo_idTohs_relatorio_risco_valor_qualitativo = + new com.evolute.entity.ForeignKey( HsRelatorioPostoRisco.class, HsRelatorioPostoRisco.VALOR_QUALITATIVO_ID, siprp.data.outer.HsRelatorioRiscoValorQualitativoData.class, siprp.data.outer.HsRelatorioRiscoValorQualitativoData.ID ); + + public static final String TABLENAME = "hs_relatorio_posto_risco"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_relatorio_posto_risco"; + + public static final int _INVALID__INDEX = -1; + public static final String POSTO_ID = "posto_id"; + public static final String POSTO_ID_FULL = "hs_relatorio_posto_risco.posto_id"; + public static final int POSTO_ID_INDEX = 0; + public static final String TO_POSTO_ID = "to_posto_id"; + public static final int TO_POSTO_ID_INDEX = 1; + public static final String RISCO_ID = "risco_id"; + public static final String RISCO_ID_FULL = "hs_relatorio_posto_risco.risco_id"; + public static final int RISCO_ID_INDEX = 2; + public static final String TO_RISCO_ID = "to_risco_id"; + public static final int TO_RISCO_ID_INDEX = 3; + public static final String PROBABILIDADE = "probabilidade"; + public static final String PROBABILIDADE_FULL = "hs_relatorio_posto_risco.probabilidade"; + public static final int PROBABILIDADE_INDEX = 4; + public static final String SEVERIDADE = "severidade"; + public static final String SEVERIDADE_FULL = "hs_relatorio_posto_risco.severidade"; + public static final int SEVERIDADE_INDEX = 5; + public static final String VALOR_QUALITATIVO_ID = "valor_qualitativo_id"; + public static final String VALOR_QUALITATIVO_ID_FULL = "hs_relatorio_posto_risco.valor_qualitativo_id"; + public static final int VALOR_QUALITATIVO_ID_INDEX = 6; + public static final String TO_VALOR_QUALITATIVO_ID = "to_valor_qualitativo_id"; + public static final int TO_VALOR_QUALITATIVO_ID_INDEX = 7; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "hs_relatorio_posto_risco.ordem"; + public static final int ORDEM_INDEX = 8; + + public static final String FIELD_NAMES[] = new String[]{ + PROBABILIDADE, SEVERIDADE, VALOR_QUALITATIVO_ID, TO_VALOR_QUALITATIVO_ID, + ORDEM, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + PROBABILIDADE, TABLENAME + "." + SEVERIDADE, TABLENAME + "." + VALOR_QUALITATIVO_ID, TABLENAME + "." + TO_VALOR_QUALITATIVO_ID, + TABLENAME + "." + ORDEM, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + POSTO_ID, RISCO_ID, PROBABILIDADE, SEVERIDADE, VALOR_QUALITATIVO_ID, ORDEM, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + POSTO_ID, RISCO_ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + POSTO_ID, RISCO_ID, PROBABILIDADE, SEVERIDADE, VALOR_QUALITATIVO_ID, ORDEM, }; + + private Integer posto_id; + private siprp.data.outer.HsRelatorioPostoData to_posto_id; + private Integer risco_id; + private siprp.data.outer.HsRelatorioRiscoData to_risco_id; + private Integer probabilidade; + private Integer severidade; + private Integer valor_qualitativo_id; + private siprp.data.outer.HsRelatorioRiscoValorQualitativoData to_valor_qualitativo_id; + private Integer ordem; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsRelatorioPostoRisco() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false, false, false, false, false, false }; + } + + public Integer getPosto_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( POSTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.posto_id; + } + + public void setPosto_id( Integer posto_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( POSTO_ID, posto_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.posto_id = posto_id; + LAZY_LOADED_OBJECTS.put( POSTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsRelatorioPostoData toPosto_id() + { + try + { + prepare( TO_POSTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_posto_id; + } + + public void setToPosto_id( siprp.data.outer.HsRelatorioPostoData to_posto_id ) + { + try + { + preProcess( TO_POSTO_ID, to_posto_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_posto_id = to_posto_id; + } + + public Integer getRisco_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( RISCO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.risco_id; + } + + public void setRisco_id( Integer risco_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( RISCO_ID, risco_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.risco_id = risco_id; + LAZY_LOADED_OBJECTS.put( RISCO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsRelatorioRiscoData toRisco_id() + { + try + { + prepare( TO_RISCO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_risco_id; + } + + public void setToRisco_id( siprp.data.outer.HsRelatorioRiscoData to_risco_id ) + { + try + { + preProcess( TO_RISCO_ID, to_risco_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_risco_id = to_risco_id; + } + + public Integer getProbabilidade() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PROBABILIDADE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.probabilidade; + } + + public void setProbabilidade( Integer probabilidade ) + { + try + { + setLockedForRefresh( true ); + preProcess( PROBABILIDADE, probabilidade ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.probabilidade = probabilidade; + LAZY_LOADED_OBJECTS.put( PROBABILIDADE, Boolean.TRUE ); + } + + public Integer getSeveridade() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( SEVERIDADE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.severidade; + } + + public void setSeveridade( Integer severidade ) + { + try + { + setLockedForRefresh( true ); + preProcess( SEVERIDADE, severidade ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.severidade = severidade; + LAZY_LOADED_OBJECTS.put( SEVERIDADE, Boolean.TRUE ); + } + + public Integer getValor_qualitativo_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( VALOR_QUALITATIVO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.valor_qualitativo_id; + } + + public void setValor_qualitativo_id( Integer valor_qualitativo_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( VALOR_QUALITATIVO_ID, valor_qualitativo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.valor_qualitativo_id = valor_qualitativo_id; + LAZY_LOADED_OBJECTS.put( VALOR_QUALITATIVO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsRelatorioRiscoValorQualitativoData toValor_qualitativo_id() + { + try + { + prepare( TO_VALOR_QUALITATIVO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_valor_qualitativo_id; + } + + public void setToValor_qualitativo_id( siprp.data.outer.HsRelatorioRiscoValorQualitativoData to_valor_qualitativo_id ) + { + try + { + preProcess( TO_VALOR_QUALITATIVO_ID, to_valor_qualitativo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_valor_qualitativo_id = to_valor_qualitativo_id; + } + + public Integer getOrdem() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ORDEM ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.ordem; + } + + public void setOrdem( Integer ordem ) + { + try + { + setLockedForRefresh( true ); + preProcess( ORDEM, ordem ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.ordem = ordem; + LAZY_LOADED_OBJECTS.put( ORDEM, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioPostoRisco.POSTO_ID_INDEX: + value = getPosto_id(); + break; + case HsRelatorioPostoRisco.TO_POSTO_ID_INDEX: + value = toPosto_id(); + break; + case HsRelatorioPostoRisco.RISCO_ID_INDEX: + value = getRisco_id(); + break; + case HsRelatorioPostoRisco.TO_RISCO_ID_INDEX: + value = toRisco_id(); + break; + case HsRelatorioPostoRisco.PROBABILIDADE_INDEX: + value = getProbabilidade(); + break; + case HsRelatorioPostoRisco.SEVERIDADE_INDEX: + value = getSeveridade(); + break; + case HsRelatorioPostoRisco.VALOR_QUALITATIVO_ID_INDEX: + value = getValor_qualitativo_id(); + break; + case HsRelatorioPostoRisco.TO_VALOR_QUALITATIVO_ID_INDEX: + value = toValor_qualitativo_id(); + break; + case HsRelatorioPostoRisco.ORDEM_INDEX: + value = getOrdem(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioPostoRisco.POSTO_ID_INDEX: + value = this.posto_id; + break; + case HsRelatorioPostoRisco.TO_POSTO_ID_INDEX: + value = this.to_posto_id; + break; + case HsRelatorioPostoRisco.RISCO_ID_INDEX: + value = this.risco_id; + break; + case HsRelatorioPostoRisco.TO_RISCO_ID_INDEX: + value = this.to_risco_id; + break; + case HsRelatorioPostoRisco.PROBABILIDADE_INDEX: + value = this.probabilidade; + break; + case HsRelatorioPostoRisco.SEVERIDADE_INDEX: + value = this.severidade; + break; + case HsRelatorioPostoRisco.VALOR_QUALITATIVO_ID_INDEX: + value = this.valor_qualitativo_id; + break; + case HsRelatorioPostoRisco.TO_VALOR_QUALITATIVO_ID_INDEX: + value = this.to_valor_qualitativo_id; + break; + case HsRelatorioPostoRisco.ORDEM_INDEX: + value = this.ordem; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioPostoRisco.POSTO_ID_INDEX: + setPosto_id( ( Integer ) value ); + break; + case HsRelatorioPostoRisco.TO_POSTO_ID_INDEX: + setToPosto_id( ( siprp.data.outer.HsRelatorioPostoData ) value ); + break; + case HsRelatorioPostoRisco.RISCO_ID_INDEX: + setRisco_id( ( Integer ) value ); + break; + case HsRelatorioPostoRisco.TO_RISCO_ID_INDEX: + setToRisco_id( ( siprp.data.outer.HsRelatorioRiscoData ) value ); + break; + case HsRelatorioPostoRisco.PROBABILIDADE_INDEX: + setProbabilidade( ( Integer ) value ); + break; + case HsRelatorioPostoRisco.SEVERIDADE_INDEX: + setSeveridade( ( Integer ) value ); + break; + case HsRelatorioPostoRisco.VALOR_QUALITATIVO_ID_INDEX: + setValor_qualitativo_id( ( Integer ) value ); + break; + case HsRelatorioPostoRisco.TO_VALOR_QUALITATIVO_ID_INDEX: + setToValor_qualitativo_id( ( siprp.data.outer.HsRelatorioRiscoValorQualitativoData ) value ); + break; + case HsRelatorioPostoRisco.ORDEM_INDEX: + setOrdem( ( Integer ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioPostoRisco.POSTO_ID_INDEX: + this.posto_id = ( Integer ) value; + break; + case HsRelatorioPostoRisco.TO_POSTO_ID_INDEX: + this.to_posto_id = ( siprp.data.outer.HsRelatorioPostoData ) value; + break; + case HsRelatorioPostoRisco.RISCO_ID_INDEX: + this.risco_id = ( Integer ) value; + break; + case HsRelatorioPostoRisco.TO_RISCO_ID_INDEX: + this.to_risco_id = ( siprp.data.outer.HsRelatorioRiscoData ) value; + break; + case HsRelatorioPostoRisco.PROBABILIDADE_INDEX: + this.probabilidade = ( Integer ) value; + break; + case HsRelatorioPostoRisco.SEVERIDADE_INDEX: + this.severidade = ( Integer ) value; + break; + case HsRelatorioPostoRisco.VALOR_QUALITATIVO_ID_INDEX: + this.valor_qualitativo_id = ( Integer ) value; + break; + case HsRelatorioPostoRisco.TO_VALOR_QUALITATIVO_ID_INDEX: + this.to_valor_qualitativo_id = ( siprp.data.outer.HsRelatorioRiscoValorQualitativoData ) value; + break; + case HsRelatorioPostoRisco.ORDEM_INDEX: + this.ordem = ( Integer ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + throw new RuntimeException( "getPrimaryKeyName on HsRelatorioPostoRisco is invalid" ); + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsRelatorioPostoRisco.POSTO_ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioPostoRisco.TO_POSTO_ID_INDEX: + theClass = siprp.data.outer.HsRelatorioPostoData.class; + break; + case HsRelatorioPostoRisco.RISCO_ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioPostoRisco.TO_RISCO_ID_INDEX: + theClass = siprp.data.outer.HsRelatorioRiscoData.class; + break; + case HsRelatorioPostoRisco.PROBABILIDADE_INDEX: + theClass = Integer.class; + break; + case HsRelatorioPostoRisco.SEVERIDADE_INDEX: + theClass = Integer.class; + break; + case HsRelatorioPostoRisco.VALOR_QUALITATIVO_ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioPostoRisco.TO_VALOR_QUALITATIVO_ID_INDEX: + theClass = siprp.data.outer.HsRelatorioRiscoValorQualitativoData.class; + break; + case HsRelatorioPostoRisco.ORDEM_INDEX: + theClass = Integer.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsRelatorioPostoRisco._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsRelatorioPostoRisco.PK_FIELD_NAMES ); + primaryKey.set( 0, getPosto_id() ); + primaryKey.set( 1, getRisco_id() ); + } + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioRisco.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioRisco.java new file mode 100644 index 00000000..30be0be7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioRisco.java @@ -0,0 +1,508 @@ +/* +* HsRelatorioRisco.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsRelatorioRisco extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( HsRelatorioRisco.ID, HsRelatorioRisco.ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioRisco.ID_FULL, HsRelatorioRisco.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsRelatorioRisco.CLASS_IDENTIFIER, HsRelatorioRisco.RELATORIO_ID, HsRelatorioRisco.TO_RELATORIO_ID ); + FIELD_INDEXES.put( HsRelatorioRisco.RELATORIO_ID, HsRelatorioRisco.RELATORIO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioRisco.RELATORIO_ID_FULL, HsRelatorioRisco.RELATORIO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioRisco.TO_RELATORIO_ID, HsRelatorioRisco.TO_RELATORIO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioRisco.DESCRIPTION, HsRelatorioRisco.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsRelatorioRisco.DESCRIPTION_FULL, HsRelatorioRisco.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsRelatorioRisco.DELETED_DATE, HsRelatorioRisco.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsRelatorioRisco.DELETED_DATE_FULL, HsRelatorioRisco.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsRelatorioRisco.HS_RISCO_ID, HsRelatorioRisco.HS_RISCO_ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioRisco.HS_RISCO_ID_FULL, HsRelatorioRisco.HS_RISCO_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyrelatorio_idTohs_relatorio = + new com.evolute.entity.ForeignKey( HsRelatorioRisco.class, HsRelatorioRisco.RELATORIO_ID, siprp.data.outer.HsRelatorioData.class, siprp.data.outer.HsRelatorioData.ID ); + + public static final String TABLENAME = "hs_relatorio_risco"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_relatorio_risco"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio_risco.id"; + public static final int ID_INDEX = 0; + public static final String RELATORIO_ID = "relatorio_id"; + public static final String RELATORIO_ID_FULL = "hs_relatorio_risco.relatorio_id"; + public static final int RELATORIO_ID_INDEX = 1; + public static final String TO_RELATORIO_ID = "to_relatorio_id"; + public static final int TO_RELATORIO_ID_INDEX = 2; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_relatorio_risco.description"; + public static final int DESCRIPTION_INDEX = 3; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_relatorio_risco.deleted_date"; + public static final int DELETED_DATE_INDEX = 4; + public static final String HS_RISCO_ID = "hs_risco_id"; + public static final String HS_RISCO_ID_FULL = "hs_relatorio_risco.hs_risco_id"; + public static final int HS_RISCO_ID_INDEX = 5; + + public static final String FIELD_NAMES[] = new String[]{ + RELATORIO_ID, TO_RELATORIO_ID, DESCRIPTION, DELETED_DATE, HS_RISCO_ID, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + RELATORIO_ID, TABLENAME + "." + TO_RELATORIO_ID, TABLENAME + "." + DESCRIPTION, TABLENAME + "." + DELETED_DATE, TABLENAME + "." + HS_RISCO_ID, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, RELATORIO_ID, DESCRIPTION, DELETED_DATE, HS_RISCO_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, RELATORIO_ID, DESCRIPTION, DELETED_DATE, HS_RISCO_ID, }; + + private Integer id; + private Integer relatorio_id; + private siprp.data.outer.HsRelatorioData to_relatorio_id; + private String description; + private java.sql.Timestamp deleted_date; + private Integer hs_risco_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsRelatorioRisco() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromHsRelatorioMedida_risco_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRelatorioMedidaData.class , getPrimaryKey().getMap().get("id"), "risco_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsRelatorioPostoRisco_risco_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRelatorioPostoRiscoData.class , getPrimaryKey().getMap().get("id"), "risco_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public Integer getRelatorio_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( RELATORIO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.relatorio_id; + } + + public void setRelatorio_id( Integer relatorio_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( RELATORIO_ID, relatorio_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.relatorio_id = relatorio_id; + LAZY_LOADED_OBJECTS.put( RELATORIO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsRelatorioData toRelatorio_id() + { + try + { + prepare( TO_RELATORIO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_relatorio_id; + } + + public void setToRelatorio_id( siprp.data.outer.HsRelatorioData to_relatorio_id ) + { + try + { + preProcess( TO_RELATORIO_ID, to_relatorio_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_relatorio_id = to_relatorio_id; + } + + public String getDescription() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRIPTION ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.description; + } + + public void setDescription( String description ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRIPTION, description ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.description = description; + LAZY_LOADED_OBJECTS.put( DESCRIPTION, Boolean.TRUE ); + } + + public java.sql.Timestamp getDeleted_date() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DELETED_DATE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.deleted_date; + } + + public void setDeleted_date( java.sql.Timestamp deleted_date ) + { + try + { + setLockedForRefresh( true ); + preProcess( DELETED_DATE, deleted_date ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.deleted_date = deleted_date; + LAZY_LOADED_OBJECTS.put( DELETED_DATE, Boolean.TRUE ); + } + + public Integer getHs_risco_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( HS_RISCO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.hs_risco_id; + } + + public void setHs_risco_id( Integer hs_risco_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( HS_RISCO_ID, hs_risco_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.hs_risco_id = hs_risco_id; + LAZY_LOADED_OBJECTS.put( HS_RISCO_ID, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioRisco.ID_INDEX: + value = getId(); + break; + case HsRelatorioRisco.RELATORIO_ID_INDEX: + value = getRelatorio_id(); + break; + case HsRelatorioRisco.TO_RELATORIO_ID_INDEX: + value = toRelatorio_id(); + break; + case HsRelatorioRisco.DESCRIPTION_INDEX: + value = getDescription(); + break; + case HsRelatorioRisco.DELETED_DATE_INDEX: + value = getDeleted_date(); + break; + case HsRelatorioRisco.HS_RISCO_ID_INDEX: + value = getHs_risco_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioRisco.ID_INDEX: + value = this.id; + break; + case HsRelatorioRisco.RELATORIO_ID_INDEX: + value = this.relatorio_id; + break; + case HsRelatorioRisco.TO_RELATORIO_ID_INDEX: + value = this.to_relatorio_id; + break; + case HsRelatorioRisco.DESCRIPTION_INDEX: + value = this.description; + break; + case HsRelatorioRisco.DELETED_DATE_INDEX: + value = this.deleted_date; + break; + case HsRelatorioRisco.HS_RISCO_ID_INDEX: + value = this.hs_risco_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioRisco.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsRelatorioRisco.RELATORIO_ID_INDEX: + setRelatorio_id( ( Integer ) value ); + break; + case HsRelatorioRisco.TO_RELATORIO_ID_INDEX: + setToRelatorio_id( ( siprp.data.outer.HsRelatorioData ) value ); + break; + case HsRelatorioRisco.DESCRIPTION_INDEX: + setDescription( ( String ) value ); + break; + case HsRelatorioRisco.DELETED_DATE_INDEX: + setDeleted_date( ( java.sql.Timestamp ) value ); + break; + case HsRelatorioRisco.HS_RISCO_ID_INDEX: + setHs_risco_id( ( Integer ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioRisco.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsRelatorioRisco.RELATORIO_ID_INDEX: + this.relatorio_id = ( Integer ) value; + break; + case HsRelatorioRisco.TO_RELATORIO_ID_INDEX: + this.to_relatorio_id = ( siprp.data.outer.HsRelatorioData ) value; + break; + case HsRelatorioRisco.DESCRIPTION_INDEX: + this.description = ( String ) value; + break; + case HsRelatorioRisco.DELETED_DATE_INDEX: + this.deleted_date = ( java.sql.Timestamp ) value; + break; + case HsRelatorioRisco.HS_RISCO_ID_INDEX: + this.hs_risco_id = ( Integer ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsRelatorioRisco.ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioRisco.RELATORIO_ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioRisco.TO_RELATORIO_ID_INDEX: + theClass = siprp.data.outer.HsRelatorioData.class; + break; + case HsRelatorioRisco.DESCRIPTION_INDEX: + theClass = String.class; + break; + case HsRelatorioRisco.DELETED_DATE_INDEX: + theClass = java.sql.Timestamp.class; + break; + case HsRelatorioRisco.HS_RISCO_ID_INDEX: + theClass = Integer.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsRelatorioRisco._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsRelatorioRisco.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioRiscoValorQualitativo.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioRiscoValorQualitativo.java new file mode 100644 index 00000000..b9a84390 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRelatorioRiscoValorQualitativo.java @@ -0,0 +1,308 @@ +/* +* HsRelatorioRiscoValorQualitativo.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsRelatorioRiscoValorQualitativo extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( HsRelatorioRiscoValorQualitativo.ID, HsRelatorioRiscoValorQualitativo.ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioRiscoValorQualitativo.ID_FULL, HsRelatorioRiscoValorQualitativo.ID_INDEX ); + FIELD_INDEXES.put( HsRelatorioRiscoValorQualitativo.DESCRIPTION, HsRelatorioRiscoValorQualitativo.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsRelatorioRiscoValorQualitativo.DESCRIPTION_FULL, HsRelatorioRiscoValorQualitativo.DESCRIPTION_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "hs_relatorio_risco_valor_qualitativo"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_relatorio_risco_valor_qualitativo"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "hs_relatorio_risco_valor_qualitativo.id"; + public static final int ID_INDEX = 0; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_relatorio_risco_valor_qualitativo.description"; + public static final int DESCRIPTION_INDEX = 1; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRIPTION, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DESCRIPTION, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DESCRIPTION, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DESCRIPTION, }; + + private Integer id; + private String description; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsRelatorioRiscoValorQualitativo() + { + super(); + dirtyProperties = new boolean[]{ false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromHsPostoRisco_valor_qualitativo() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsPostoRiscoData.class , getPrimaryKey().getMap().get("id"), "valor_qualitativo" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsRelatorioPostoRisco_valor_qualitativo_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRelatorioPostoRiscoData.class , getPrimaryKey().getMap().get("id"), "valor_qualitativo_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getDescription() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRIPTION ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.description; + } + + public void setDescription( String description ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRIPTION, description ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.description = description; + LAZY_LOADED_OBJECTS.put( DESCRIPTION, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioRiscoValorQualitativo.ID_INDEX: + value = getId(); + break; + case HsRelatorioRiscoValorQualitativo.DESCRIPTION_INDEX: + value = getDescription(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioRiscoValorQualitativo.ID_INDEX: + value = this.id; + break; + case HsRelatorioRiscoValorQualitativo.DESCRIPTION_INDEX: + value = this.description; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioRiscoValorQualitativo.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsRelatorioRiscoValorQualitativo.DESCRIPTION_INDEX: + setDescription( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRelatorioRiscoValorQualitativo.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsRelatorioRiscoValorQualitativo.DESCRIPTION_INDEX: + this.description = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsRelatorioRiscoValorQualitativo.ID_INDEX: + theClass = Integer.class; + break; + case HsRelatorioRiscoValorQualitativo.DESCRIPTION_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsRelatorioRiscoValorQualitativo._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsRelatorioRiscoValorQualitativo.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRisco.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRisco.java new file mode 100644 index 00000000..50263b40 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRisco.java @@ -0,0 +1,472 @@ +/* +* HsRisco.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsRisco extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( HsRisco.ID, HsRisco.ID_INDEX ); + FIELD_INDEXES.put( HsRisco.ID_FULL, HsRisco.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsRisco.CLASS_IDENTIFIER, HsRisco.TEMA_ID, HsRisco.TO_TEMA_ID ); + FIELD_INDEXES.put( HsRisco.TEMA_ID, HsRisco.TEMA_ID_INDEX ); + FIELD_INDEXES.put( HsRisco.TEMA_ID_FULL, HsRisco.TEMA_ID_INDEX ); + FIELD_INDEXES.put( HsRisco.TO_TEMA_ID, HsRisco.TO_TEMA_ID_INDEX ); + FIELD_INDEXES.put( HsRisco.DESCRIPTION, HsRisco.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsRisco.DESCRIPTION_FULL, HsRisco.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsRisco.DELETED_DATE, HsRisco.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsRisco.DELETED_DATE_FULL, HsRisco.DELETED_DATE_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeytema_idTohs_risco_tema = + new com.evolute.entity.ForeignKey( HsRisco.class, HsRisco.TEMA_ID, siprp.data.outer.HsRiscoTemaData.class, siprp.data.outer.HsRiscoTemaData.ID ); + + public static final String TABLENAME = "hs_risco"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_risco"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "hs_risco.id"; + public static final int ID_INDEX = 0; + public static final String TEMA_ID = "tema_id"; + public static final String TEMA_ID_FULL = "hs_risco.tema_id"; + public static final int TEMA_ID_INDEX = 1; + public static final String TO_TEMA_ID = "to_tema_id"; + public static final int TO_TEMA_ID_INDEX = 2; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_risco.description"; + public static final int DESCRIPTION_INDEX = 3; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_risco.deleted_date"; + public static final int DELETED_DATE_INDEX = 4; + + public static final String FIELD_NAMES[] = new String[]{ + TEMA_ID, TO_TEMA_ID, DESCRIPTION, DELETED_DATE, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + TEMA_ID, TABLENAME + "." + TO_TEMA_ID, TABLENAME + "." + DESCRIPTION, TABLENAME + "." + DELETED_DATE, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, TEMA_ID, DESCRIPTION, DELETED_DATE, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, TEMA_ID, DESCRIPTION, DELETED_DATE, }; + + private Integer id; + private Integer tema_id; + private siprp.data.outer.HsRiscoTemaData to_tema_id; + private String description; + private java.sql.Timestamp deleted_date; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsRisco() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromHsPostoRisco_risco_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsPostoRiscoData.class , getPrimaryKey().getMap().get("id"), "risco_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsRiscoEmpresa_risco_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRiscoEmpresaData.class , getPrimaryKey().getMap().get("id"), "risco_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromHsRiscoMedida_risco_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRiscoMedidaData.class , getPrimaryKey().getMap().get("id"), "risco_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public Integer getTema_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TEMA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.tema_id; + } + + public void setTema_id( Integer tema_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TEMA_ID, tema_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.tema_id = tema_id; + LAZY_LOADED_OBJECTS.put( TEMA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsRiscoTemaData toTema_id() + { + try + { + prepare( TO_TEMA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_tema_id; + } + + public void setToTema_id( siprp.data.outer.HsRiscoTemaData to_tema_id ) + { + try + { + preProcess( TO_TEMA_ID, to_tema_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_tema_id = to_tema_id; + } + + public String getDescription() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRIPTION ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.description; + } + + public void setDescription( String description ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRIPTION, description ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.description = description; + LAZY_LOADED_OBJECTS.put( DESCRIPTION, Boolean.TRUE ); + } + + public java.sql.Timestamp getDeleted_date() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DELETED_DATE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.deleted_date; + } + + public void setDeleted_date( java.sql.Timestamp deleted_date ) + { + try + { + setLockedForRefresh( true ); + preProcess( DELETED_DATE, deleted_date ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.deleted_date = deleted_date; + LAZY_LOADED_OBJECTS.put( DELETED_DATE, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRisco.ID_INDEX: + value = getId(); + break; + case HsRisco.TEMA_ID_INDEX: + value = getTema_id(); + break; + case HsRisco.TO_TEMA_ID_INDEX: + value = toTema_id(); + break; + case HsRisco.DESCRIPTION_INDEX: + value = getDescription(); + break; + case HsRisco.DELETED_DATE_INDEX: + value = getDeleted_date(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRisco.ID_INDEX: + value = this.id; + break; + case HsRisco.TEMA_ID_INDEX: + value = this.tema_id; + break; + case HsRisco.TO_TEMA_ID_INDEX: + value = this.to_tema_id; + break; + case HsRisco.DESCRIPTION_INDEX: + value = this.description; + break; + case HsRisco.DELETED_DATE_INDEX: + value = this.deleted_date; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRisco.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsRisco.TEMA_ID_INDEX: + setTema_id( ( Integer ) value ); + break; + case HsRisco.TO_TEMA_ID_INDEX: + setToTema_id( ( siprp.data.outer.HsRiscoTemaData ) value ); + break; + case HsRisco.DESCRIPTION_INDEX: + setDescription( ( String ) value ); + break; + case HsRisco.DELETED_DATE_INDEX: + setDeleted_date( ( java.sql.Timestamp ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRisco.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsRisco.TEMA_ID_INDEX: + this.tema_id = ( Integer ) value; + break; + case HsRisco.TO_TEMA_ID_INDEX: + this.to_tema_id = ( siprp.data.outer.HsRiscoTemaData ) value; + break; + case HsRisco.DESCRIPTION_INDEX: + this.description = ( String ) value; + break; + case HsRisco.DELETED_DATE_INDEX: + this.deleted_date = ( java.sql.Timestamp ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsRisco.ID_INDEX: + theClass = Integer.class; + break; + case HsRisco.TEMA_ID_INDEX: + theClass = Integer.class; + break; + case HsRisco.TO_TEMA_ID_INDEX: + theClass = siprp.data.outer.HsRiscoTemaData.class; + break; + case HsRisco.DESCRIPTION_INDEX: + theClass = String.class; + break; + case HsRisco.DELETED_DATE_INDEX: + theClass = java.sql.Timestamp.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsRisco._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsRisco.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRiscoEmpresa.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRiscoEmpresa.java new file mode 100644 index 00000000..09653865 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRiscoEmpresa.java @@ -0,0 +1,379 @@ +/* +* HsRiscoEmpresa.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsRiscoEmpresa extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + com.evolute.entity.evo.EvoDataObject.register( HsRiscoEmpresa.CLASS_IDENTIFIER, HsRiscoEmpresa.RISCO_ID, HsRiscoEmpresa.TO_RISCO_ID ); + FIELD_INDEXES.put( HsRiscoEmpresa.RISCO_ID, HsRiscoEmpresa.RISCO_ID_INDEX ); + FIELD_INDEXES.put( HsRiscoEmpresa.RISCO_ID_FULL, HsRiscoEmpresa.RISCO_ID_INDEX ); + FIELD_INDEXES.put( HsRiscoEmpresa.TO_RISCO_ID, HsRiscoEmpresa.TO_RISCO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsRiscoEmpresa.CLASS_IDENTIFIER, HsRiscoEmpresa.EMPRESA_ID, HsRiscoEmpresa.TO_EMPRESA_ID ); + FIELD_INDEXES.put( HsRiscoEmpresa.EMPRESA_ID, HsRiscoEmpresa.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( HsRiscoEmpresa.EMPRESA_ID_FULL, HsRiscoEmpresa.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( HsRiscoEmpresa.TO_EMPRESA_ID, HsRiscoEmpresa.TO_EMPRESA_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyrisco_idTohs_risco = + new com.evolute.entity.ForeignKey( HsRiscoEmpresa.class, HsRiscoEmpresa.RISCO_ID, siprp.data.outer.HsRiscoData.class, siprp.data.outer.HsRiscoData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyempresa_idToempresas = + new com.evolute.entity.ForeignKey( HsRiscoEmpresa.class, HsRiscoEmpresa.EMPRESA_ID, siprp.data.outer.EmpresasData.class, siprp.data.outer.EmpresasData.ID ); + + public static final String TABLENAME = "hs_risco_empresa"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_risco_empresa"; + + public static final int _INVALID__INDEX = -1; + public static final String RISCO_ID = "risco_id"; + public static final String RISCO_ID_FULL = "hs_risco_empresa.risco_id"; + public static final int RISCO_ID_INDEX = 0; + public static final String TO_RISCO_ID = "to_risco_id"; + public static final int TO_RISCO_ID_INDEX = 1; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "hs_risco_empresa.empresa_id"; + public static final int EMPRESA_ID_INDEX = 2; + public static final String TO_EMPRESA_ID = "to_empresa_id"; + public static final int TO_EMPRESA_ID_INDEX = 3; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + RISCO_ID, EMPRESA_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + RISCO_ID, EMPRESA_ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + RISCO_ID, EMPRESA_ID, }; + + private Integer risco_id; + private siprp.data.outer.HsRiscoData to_risco_id; + private Integer empresa_id; + private siprp.data.outer.EmpresasData to_empresa_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsRiscoEmpresa() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false }; + } + + public Integer getRisco_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( RISCO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.risco_id; + } + + public void setRisco_id( Integer risco_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( RISCO_ID, risco_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.risco_id = risco_id; + LAZY_LOADED_OBJECTS.put( RISCO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsRiscoData toRisco_id() + { + try + { + prepare( TO_RISCO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_risco_id; + } + + public void setToRisco_id( siprp.data.outer.HsRiscoData to_risco_id ) + { + try + { + preProcess( TO_RISCO_ID, to_risco_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_risco_id = to_risco_id; + } + + public Integer getEmpresa_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMPRESA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.empresa_id; + } + + public void setEmpresa_id( Integer empresa_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMPRESA_ID, empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.empresa_id = empresa_id; + LAZY_LOADED_OBJECTS.put( EMPRESA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EmpresasData toEmpresa_id() + { + try + { + prepare( TO_EMPRESA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_empresa_id; + } + + public void setToEmpresa_id( siprp.data.outer.EmpresasData to_empresa_id ) + { + try + { + preProcess( TO_EMPRESA_ID, to_empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_empresa_id = to_empresa_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRiscoEmpresa.RISCO_ID_INDEX: + value = getRisco_id(); + break; + case HsRiscoEmpresa.TO_RISCO_ID_INDEX: + value = toRisco_id(); + break; + case HsRiscoEmpresa.EMPRESA_ID_INDEX: + value = getEmpresa_id(); + break; + case HsRiscoEmpresa.TO_EMPRESA_ID_INDEX: + value = toEmpresa_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRiscoEmpresa.RISCO_ID_INDEX: + value = this.risco_id; + break; + case HsRiscoEmpresa.TO_RISCO_ID_INDEX: + value = this.to_risco_id; + break; + case HsRiscoEmpresa.EMPRESA_ID_INDEX: + value = this.empresa_id; + break; + case HsRiscoEmpresa.TO_EMPRESA_ID_INDEX: + value = this.to_empresa_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRiscoEmpresa.RISCO_ID_INDEX: + setRisco_id( ( Integer ) value ); + break; + case HsRiscoEmpresa.TO_RISCO_ID_INDEX: + setToRisco_id( ( siprp.data.outer.HsRiscoData ) value ); + break; + case HsRiscoEmpresa.EMPRESA_ID_INDEX: + setEmpresa_id( ( Integer ) value ); + break; + case HsRiscoEmpresa.TO_EMPRESA_ID_INDEX: + setToEmpresa_id( ( siprp.data.outer.EmpresasData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRiscoEmpresa.RISCO_ID_INDEX: + this.risco_id = ( Integer ) value; + break; + case HsRiscoEmpresa.TO_RISCO_ID_INDEX: + this.to_risco_id = ( siprp.data.outer.HsRiscoData ) value; + break; + case HsRiscoEmpresa.EMPRESA_ID_INDEX: + this.empresa_id = ( Integer ) value; + break; + case HsRiscoEmpresa.TO_EMPRESA_ID_INDEX: + this.to_empresa_id = ( siprp.data.outer.EmpresasData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + throw new RuntimeException( "getPrimaryKeyName on HsRiscoEmpresa is invalid" ); + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsRiscoEmpresa.RISCO_ID_INDEX: + theClass = Integer.class; + break; + case HsRiscoEmpresa.TO_RISCO_ID_INDEX: + theClass = siprp.data.outer.HsRiscoData.class; + break; + case HsRiscoEmpresa.EMPRESA_ID_INDEX: + theClass = Integer.class; + break; + case HsRiscoEmpresa.TO_EMPRESA_ID_INDEX: + theClass = siprp.data.outer.EmpresasData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsRiscoEmpresa._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsRiscoEmpresa.PK_FIELD_NAMES ); + primaryKey.set( 0, getRisco_id() ); + primaryKey.set( 1, getEmpresa_id() ); + } + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRiscoMedida.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRiscoMedida.java new file mode 100644 index 00000000..71d6e5a3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRiscoMedida.java @@ -0,0 +1,379 @@ +/* +* HsRiscoMedida.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsRiscoMedida extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + com.evolute.entity.evo.EvoDataObject.register( HsRiscoMedida.CLASS_IDENTIFIER, HsRiscoMedida.RISCO_ID, HsRiscoMedida.TO_RISCO_ID ); + FIELD_INDEXES.put( HsRiscoMedida.RISCO_ID, HsRiscoMedida.RISCO_ID_INDEX ); + FIELD_INDEXES.put( HsRiscoMedida.RISCO_ID_FULL, HsRiscoMedida.RISCO_ID_INDEX ); + FIELD_INDEXES.put( HsRiscoMedida.TO_RISCO_ID, HsRiscoMedida.TO_RISCO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( HsRiscoMedida.CLASS_IDENTIFIER, HsRiscoMedida.MEDIDA_ID, HsRiscoMedida.TO_MEDIDA_ID ); + FIELD_INDEXES.put( HsRiscoMedida.MEDIDA_ID, HsRiscoMedida.MEDIDA_ID_INDEX ); + FIELD_INDEXES.put( HsRiscoMedida.MEDIDA_ID_FULL, HsRiscoMedida.MEDIDA_ID_INDEX ); + FIELD_INDEXES.put( HsRiscoMedida.TO_MEDIDA_ID, HsRiscoMedida.TO_MEDIDA_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyrisco_idTohs_risco = + new com.evolute.entity.ForeignKey( HsRiscoMedida.class, HsRiscoMedida.RISCO_ID, siprp.data.outer.HsRiscoData.class, siprp.data.outer.HsRiscoData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeymedida_idTohs_medida = + new com.evolute.entity.ForeignKey( HsRiscoMedida.class, HsRiscoMedida.MEDIDA_ID, siprp.data.outer.HsMedidaData.class, siprp.data.outer.HsMedidaData.ID ); + + public static final String TABLENAME = "hs_risco_medida"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_risco_medida"; + + public static final int _INVALID__INDEX = -1; + public static final String RISCO_ID = "risco_id"; + public static final String RISCO_ID_FULL = "hs_risco_medida.risco_id"; + public static final int RISCO_ID_INDEX = 0; + public static final String TO_RISCO_ID = "to_risco_id"; + public static final int TO_RISCO_ID_INDEX = 1; + public static final String MEDIDA_ID = "medida_id"; + public static final String MEDIDA_ID_FULL = "hs_risco_medida.medida_id"; + public static final int MEDIDA_ID_INDEX = 2; + public static final String TO_MEDIDA_ID = "to_medida_id"; + public static final int TO_MEDIDA_ID_INDEX = 3; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + RISCO_ID, MEDIDA_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + RISCO_ID, MEDIDA_ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + RISCO_ID, MEDIDA_ID, }; + + private Integer risco_id; + private siprp.data.outer.HsRiscoData to_risco_id; + private Integer medida_id; + private siprp.data.outer.HsMedidaData to_medida_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsRiscoMedida() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false }; + } + + public Integer getRisco_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( RISCO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.risco_id; + } + + public void setRisco_id( Integer risco_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( RISCO_ID, risco_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.risco_id = risco_id; + LAZY_LOADED_OBJECTS.put( RISCO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsRiscoData toRisco_id() + { + try + { + prepare( TO_RISCO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_risco_id; + } + + public void setToRisco_id( siprp.data.outer.HsRiscoData to_risco_id ) + { + try + { + preProcess( TO_RISCO_ID, to_risco_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_risco_id = to_risco_id; + } + + public Integer getMedida_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MEDIDA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.medida_id; + } + + public void setMedida_id( Integer medida_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( MEDIDA_ID, medida_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.medida_id = medida_id; + LAZY_LOADED_OBJECTS.put( MEDIDA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.HsMedidaData toMedida_id() + { + try + { + prepare( TO_MEDIDA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_medida_id; + } + + public void setToMedida_id( siprp.data.outer.HsMedidaData to_medida_id ) + { + try + { + preProcess( TO_MEDIDA_ID, to_medida_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_medida_id = to_medida_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRiscoMedida.RISCO_ID_INDEX: + value = getRisco_id(); + break; + case HsRiscoMedida.TO_RISCO_ID_INDEX: + value = toRisco_id(); + break; + case HsRiscoMedida.MEDIDA_ID_INDEX: + value = getMedida_id(); + break; + case HsRiscoMedida.TO_MEDIDA_ID_INDEX: + value = toMedida_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRiscoMedida.RISCO_ID_INDEX: + value = this.risco_id; + break; + case HsRiscoMedida.TO_RISCO_ID_INDEX: + value = this.to_risco_id; + break; + case HsRiscoMedida.MEDIDA_ID_INDEX: + value = this.medida_id; + break; + case HsRiscoMedida.TO_MEDIDA_ID_INDEX: + value = this.to_medida_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRiscoMedida.RISCO_ID_INDEX: + setRisco_id( ( Integer ) value ); + break; + case HsRiscoMedida.TO_RISCO_ID_INDEX: + setToRisco_id( ( siprp.data.outer.HsRiscoData ) value ); + break; + case HsRiscoMedida.MEDIDA_ID_INDEX: + setMedida_id( ( Integer ) value ); + break; + case HsRiscoMedida.TO_MEDIDA_ID_INDEX: + setToMedida_id( ( siprp.data.outer.HsMedidaData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRiscoMedida.RISCO_ID_INDEX: + this.risco_id = ( Integer ) value; + break; + case HsRiscoMedida.TO_RISCO_ID_INDEX: + this.to_risco_id = ( siprp.data.outer.HsRiscoData ) value; + break; + case HsRiscoMedida.MEDIDA_ID_INDEX: + this.medida_id = ( Integer ) value; + break; + case HsRiscoMedida.TO_MEDIDA_ID_INDEX: + this.to_medida_id = ( siprp.data.outer.HsMedidaData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + throw new RuntimeException( "getPrimaryKeyName on HsRiscoMedida is invalid" ); + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsRiscoMedida.RISCO_ID_INDEX: + theClass = Integer.class; + break; + case HsRiscoMedida.TO_RISCO_ID_INDEX: + theClass = siprp.data.outer.HsRiscoData.class; + break; + case HsRiscoMedida.MEDIDA_ID_INDEX: + theClass = Integer.class; + break; + case HsRiscoMedida.TO_MEDIDA_ID_INDEX: + theClass = siprp.data.outer.HsMedidaData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsRiscoMedida._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsRiscoMedida.PK_FIELD_NAMES ); + primaryKey.set( 0, getRisco_id() ); + primaryKey.set( 1, getMedida_id() ); + } + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRiscoTema.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRiscoTema.java new file mode 100644 index 00000000..8ac6d184 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/HsRiscoTema.java @@ -0,0 +1,344 @@ +/* +* HsRiscoTema.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class HsRiscoTema extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( HsRiscoTema.ID, HsRiscoTema.ID_INDEX ); + FIELD_INDEXES.put( HsRiscoTema.ID_FULL, HsRiscoTema.ID_INDEX ); + FIELD_INDEXES.put( HsRiscoTema.DESCRIPTION, HsRiscoTema.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsRiscoTema.DESCRIPTION_FULL, HsRiscoTema.DESCRIPTION_INDEX ); + FIELD_INDEXES.put( HsRiscoTema.DELETED_DATE, HsRiscoTema.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( HsRiscoTema.DELETED_DATE_FULL, HsRiscoTema.DELETED_DATE_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "hs_risco_tema"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.hs_risco_tema"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "hs_risco_tema.id"; + public static final int ID_INDEX = 0; + public static final String DESCRIPTION = "description"; + public static final String DESCRIPTION_FULL = "hs_risco_tema.description"; + public static final int DESCRIPTION_INDEX = 1; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "hs_risco_tema.deleted_date"; + public static final int DELETED_DATE_INDEX = 2; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRIPTION, DELETED_DATE, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DESCRIPTION, TABLENAME + "." + DELETED_DATE, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DESCRIPTION, DELETED_DATE, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DESCRIPTION, DELETED_DATE, }; + + private Integer id; + private String description; + private java.sql.Timestamp deleted_date; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public HsRiscoTema() + { + super(); + dirtyProperties = new boolean[]{ false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromHsRisco_tema_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRiscoData.class , getPrimaryKey().getMap().get("id"), "tema_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getDescription() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRIPTION ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.description; + } + + public void setDescription( String description ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRIPTION, description ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.description = description; + LAZY_LOADED_OBJECTS.put( DESCRIPTION, Boolean.TRUE ); + } + + public java.sql.Timestamp getDeleted_date() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DELETED_DATE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.deleted_date; + } + + public void setDeleted_date( java.sql.Timestamp deleted_date ) + { + try + { + setLockedForRefresh( true ); + preProcess( DELETED_DATE, deleted_date ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.deleted_date = deleted_date; + LAZY_LOADED_OBJECTS.put( DELETED_DATE, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRiscoTema.ID_INDEX: + value = getId(); + break; + case HsRiscoTema.DESCRIPTION_INDEX: + value = getDescription(); + break; + case HsRiscoTema.DELETED_DATE_INDEX: + value = getDeleted_date(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRiscoTema.ID_INDEX: + value = this.id; + break; + case HsRiscoTema.DESCRIPTION_INDEX: + value = this.description; + break; + case HsRiscoTema.DELETED_DATE_INDEX: + value = this.deleted_date; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRiscoTema.ID_INDEX: + setId( ( Integer ) value ); + break; + case HsRiscoTema.DESCRIPTION_INDEX: + setDescription( ( String ) value ); + break; + case HsRiscoTema.DELETED_DATE_INDEX: + setDeleted_date( ( java.sql.Timestamp ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case HsRiscoTema.ID_INDEX: + this.id = ( Integer ) value; + break; + case HsRiscoTema.DESCRIPTION_INDEX: + this.description = ( String ) value; + break; + case HsRiscoTema.DELETED_DATE_INDEX: + this.deleted_date = ( java.sql.Timestamp ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case HsRiscoTema.ID_INDEX: + theClass = Integer.class; + break; + case HsRiscoTema.DESCRIPTION_INDEX: + theClass = String.class; + break; + case HsRiscoTema.DELETED_DATE_INDEX: + theClass = java.sql.Timestamp.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : HsRiscoTema._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsRiscoTema.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Ids.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Ids.java new file mode 100644 index 00000000..35cc59e5 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Ids.java @@ -0,0 +1,229 @@ +/* +* Ids.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class Ids extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( Ids.ID, Ids.ID_INDEX ); + FIELD_INDEXES.put( Ids.ID_FULL, Ids.ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "ids"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.ids"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "ids.id"; + public static final int ID_INDEX = 0; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, }; + + private Integer id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public Ids() + { + super(); + dirtyProperties = new boolean[]{ false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Ids.ID_INDEX: + value = getId(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Ids.ID_INDEX: + value = this.id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Ids.ID_INDEX: + setId( ( Integer ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Ids.ID_INDEX: + this.id = ( Integer ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case Ids.ID_INDEX: + theClass = Integer.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : Ids._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, Ids.PK_FIELD_NAMES ); + primaryKey.set( 0, getId() ); + } + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Image.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Image.java new file mode 100644 index 00000000..fea7c208 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Image.java @@ -0,0 +1,365 @@ +/* +* Image.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class Image extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( Image.ID, Image.ID_INDEX ); + FIELD_INDEXES.put( Image.ID_FULL, Image.ID_INDEX ); + FIELD_INDEXES.put( Image.NAME, Image.NAME_INDEX ); + FIELD_INDEXES.put( Image.NAME_FULL, Image.NAME_INDEX ); + FIELD_INDEXES.put( Image.IMAGE_DATA, Image.IMAGE_DATA_INDEX ); + FIELD_INDEXES.put( Image.IMAGE_DATA_FULL, Image.IMAGE_DATA_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "image"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.image"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "image.id"; + public static final int ID_INDEX = 0; + public static final String NAME = "name"; + public static final String NAME_FULL = "image.name"; + public static final int NAME_INDEX = 1; + public static final String IMAGE_DATA = "image_data"; + public static final String IMAGE_DATA_FULL = "image.image_data"; + public static final int IMAGE_DATA_INDEX = 2; + + public static final String FIELD_NAMES[] = new String[]{ + NAME, IMAGE_DATA, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + NAME, TABLENAME + "." + IMAGE_DATA, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, NAME, IMAGE_DATA, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, NAME, }; + + private Integer id; + private String name; + private byte[] image_data; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public Image() + { + super(); + dirtyProperties = new boolean[]{ false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromEmpresas_empresa_logo_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.EmpresasData.class , getPrimaryKey().getMap().get("id"), "empresa_logo_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromMarcacoesTecnicosHst_assinatura() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.MarcacoesTecnicosHstData.class , getPrimaryKey().getMap().get("id"), "assinatura" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getName() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NAME ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.name; + } + + public void setName( String name ) + { + try + { + setLockedForRefresh( true ); + preProcess( NAME, name ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.name = name; + LAZY_LOADED_OBJECTS.put( NAME, Boolean.TRUE ); + } + + public byte[] getImage_data() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( IMAGE_DATA ); + Boolean isLazyLoaded = isPropertyLoaded( IMAGE_DATA ); + if ( ! isLazyLoaded ) + { + this.image_data = ( byte[] ) getProvider().loadFieldFromDatabase( IMAGE_DATA, this ); + LAZY_LOADED_OBJECTS.put( IMAGE_DATA, Boolean.TRUE ); + } + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.image_data; + } + + public void setImage_data( byte[] image_data ) + { + try + { + setLockedForRefresh( true ); + preProcess( IMAGE_DATA, image_data ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.image_data = image_data; + LAZY_LOADED_OBJECTS.put( IMAGE_DATA, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Image.ID_INDEX: + value = getId(); + break; + case Image.NAME_INDEX: + value = getName(); + break; + case Image.IMAGE_DATA_INDEX: + value = getImage_data(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Image.ID_INDEX: + value = this.id; + break; + case Image.NAME_INDEX: + value = this.name; + break; + case Image.IMAGE_DATA_INDEX: + value = this.image_data; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Image.ID_INDEX: + setId( ( Integer ) value ); + break; + case Image.NAME_INDEX: + setName( ( String ) value ); + break; + case Image.IMAGE_DATA_INDEX: + setImage_data( ( byte[] ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Image.ID_INDEX: + this.id = ( Integer ) value; + break; + case Image.NAME_INDEX: + this.name = ( String ) value; + break; + case Image.IMAGE_DATA_INDEX: + this.image_data = ( byte[] ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case Image.ID_INDEX: + theClass = Integer.class; + break; + case Image.NAME_INDEX: + theClass = String.class; + break; + case Image.IMAGE_DATA_INDEX: + theClass = byte[].class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : Image._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, Image.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + LAZY_LOADED_OBJECTS.put( IMAGE_DATA, Boolean.FALSE ); + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Lembretes.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Lembretes.java new file mode 100644 index 00000000..41a8b7fb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Lembretes.java @@ -0,0 +1,1445 @@ +/* +* Lembretes.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class Lembretes extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( Lembretes.ID, Lembretes.ID_INDEX ); + FIELD_INDEXES.put( Lembretes.ID_FULL, Lembretes.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Lembretes.CLASS_IDENTIFIER, Lembretes.TIPO_ID, Lembretes.TO_TIPO_ID ); + FIELD_INDEXES.put( Lembretes.TIPO_ID, Lembretes.TIPO_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.TIPO_ID_FULL, Lembretes.TIPO_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.TO_TIPO_ID, Lembretes.TO_TIPO_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.DATA, Lembretes.DATA_INDEX ); + FIELD_INDEXES.put( Lembretes.DATA_FULL, Lembretes.DATA_INDEX ); + FIELD_INDEXES.put( Lembretes.DESCRICAO, Lembretes.DESCRICAO_INDEX ); + FIELD_INDEXES.put( Lembretes.DESCRICAO_FULL, Lembretes.DESCRICAO_INDEX ); + FIELD_INDEXES.put( Lembretes.TEXTO, Lembretes.TEXTO_INDEX ); + FIELD_INDEXES.put( Lembretes.TEXTO_FULL, Lembretes.TEXTO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Lembretes.CLASS_IDENTIFIER, Lembretes.EMPRESA_ID, Lembretes.TO_EMPRESA_ID ); + FIELD_INDEXES.put( Lembretes.EMPRESA_ID, Lembretes.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.EMPRESA_ID_FULL, Lembretes.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.TO_EMPRESA_ID, Lembretes.TO_EMPRESA_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Lembretes.CLASS_IDENTIFIER, Lembretes.ESTABELECIMENTO_ID, Lembretes.TO_ESTABELECIMENTO_ID ); + FIELD_INDEXES.put( Lembretes.ESTABELECIMENTO_ID, Lembretes.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.ESTABELECIMENTO_ID_FULL, Lembretes.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.TO_ESTABELECIMENTO_ID, Lembretes.TO_ESTABELECIMENTO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Lembretes.CLASS_IDENTIFIER, Lembretes.TRABALHADOR_ID, Lembretes.TO_TRABALHADOR_ID ); + FIELD_INDEXES.put( Lembretes.TRABALHADOR_ID, Lembretes.TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.TRABALHADOR_ID_FULL, Lembretes.TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.TO_TRABALHADOR_ID, Lembretes.TO_TRABALHADOR_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Lembretes.CLASS_IDENTIFIER, Lembretes.MARCACAO_ESTABELECIMENTO_ID, Lembretes.TO_MARCACAO_ESTABELECIMENTO_ID ); + FIELD_INDEXES.put( Lembretes.MARCACAO_ESTABELECIMENTO_ID, Lembretes.MARCACAO_ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.MARCACAO_ESTABELECIMENTO_ID_FULL, Lembretes.MARCACAO_ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.TO_MARCACAO_ESTABELECIMENTO_ID, Lembretes.TO_MARCACAO_ESTABELECIMENTO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Lembretes.CLASS_IDENTIFIER, Lembretes.MARCACAO_TRABALHADOR_ID, Lembretes.TO_MARCACAO_TRABALHADOR_ID ); + FIELD_INDEXES.put( Lembretes.MARCACAO_TRABALHADOR_ID, Lembretes.MARCACAO_TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.MARCACAO_TRABALHADOR_ID_FULL, Lembretes.MARCACAO_TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.TO_MARCACAO_TRABALHADOR_ID, Lembretes.TO_MARCACAO_TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.ENVIAR_EMAIL, Lembretes.ENVIAR_EMAIL_INDEX ); + FIELD_INDEXES.put( Lembretes.ENVIAR_EMAIL_FULL, Lembretes.ENVIAR_EMAIL_INDEX ); + FIELD_INDEXES.put( Lembretes.PERIODICIDADE_DIAS, Lembretes.PERIODICIDADE_DIAS_INDEX ); + FIELD_INDEXES.put( Lembretes.PERIODICIDADE_DIAS_FULL, Lembretes.PERIODICIDADE_DIAS_INDEX ); + FIELD_INDEXES.put( Lembretes.PERIODICIDADE_MESES, Lembretes.PERIODICIDADE_MESES_INDEX ); + FIELD_INDEXES.put( Lembretes.PERIODICIDADE_MESES_FULL, Lembretes.PERIODICIDADE_MESES_INDEX ); + FIELD_INDEXES.put( Lembretes.ULTIMO_ENVIO, Lembretes.ULTIMO_ENVIO_INDEX ); + FIELD_INDEXES.put( Lembretes.ULTIMO_ENVIO_FULL, Lembretes.ULTIMO_ENVIO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Lembretes.CLASS_IDENTIFIER, Lembretes.TRABALHADORES_CONSULTAS_DATAS_ID, Lembretes.TO_TRABALHADORES_CONSULTAS_DATAS_ID ); + FIELD_INDEXES.put( Lembretes.TRABALHADORES_CONSULTAS_DATAS_ID, Lembretes.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.TRABALHADORES_CONSULTAS_DATAS_ID_FULL, Lembretes.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.TO_TRABALHADORES_CONSULTAS_DATAS_ID, Lembretes.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Lembretes.CLASS_IDENTIFIER, Lembretes.TRABALHADORES_ECDS_DATAS_ID, Lembretes.TO_TRABALHADORES_ECDS_DATAS_ID ); + FIELD_INDEXES.put( Lembretes.TRABALHADORES_ECDS_DATAS_ID, Lembretes.TRABALHADORES_ECDS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.TRABALHADORES_ECDS_DATAS_ID_FULL, Lembretes.TRABALHADORES_ECDS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.TO_TRABALHADORES_ECDS_DATAS_ID, Lembretes.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( Lembretes.DELETED_DATE, Lembretes.DELETED_DATE_INDEX ); + FIELD_INDEXES.put( Lembretes.DELETED_DATE_FULL, Lembretes.DELETED_DATE_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeytipo_idTolembretes_tipos = + new com.evolute.entity.ForeignKey( Lembretes.class, Lembretes.TIPO_ID, siprp.data.outer.LembretesTiposData.class, siprp.data.outer.LembretesTiposData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyempresa_idToempresas = + new com.evolute.entity.ForeignKey( Lembretes.class, Lembretes.EMPRESA_ID, siprp.data.outer.EmpresasData.class, siprp.data.outer.EmpresasData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyestabelecimento_idToestabelecimentos = + new com.evolute.entity.ForeignKey( Lembretes.class, Lembretes.ESTABELECIMENTO_ID, siprp.data.outer.EstabelecimentosData.class, siprp.data.outer.EstabelecimentosData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeytrabalhador_idTotrabalhadores = + new com.evolute.entity.ForeignKey( Lembretes.class, Lembretes.TRABALHADOR_ID, siprp.data.outer.TrabalhadoresData.class, siprp.data.outer.TrabalhadoresData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeymarcacao_estabelecimento_idTomarcacoes_estabelecimento = + new com.evolute.entity.ForeignKey( Lembretes.class, Lembretes.MARCACAO_ESTABELECIMENTO_ID, siprp.data.outer.MarcacoesEstabelecimentoData.class, siprp.data.outer.MarcacoesEstabelecimentoData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeymarcacao_trabalhador_idTomarcacoes_trabalhador = + new com.evolute.entity.ForeignKey( Lembretes.class, Lembretes.MARCACAO_TRABALHADOR_ID, siprp.data.outer.MarcacoesTrabalhadorData.class, siprp.data.outer.MarcacoesTrabalhadorData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeytrabalhadores_consultas_datas_idTotrabalhadores_consultas_datas = + new com.evolute.entity.ForeignKey( Lembretes.class, Lembretes.TRABALHADORES_CONSULTAS_DATAS_ID, siprp.data.outer.TrabalhadoresConsultasDatasData.class, siprp.data.outer.TrabalhadoresConsultasDatasData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeytrabalhadores_ecds_datas_idTotrabalhadores_ecds_datas = + new com.evolute.entity.ForeignKey( Lembretes.class, Lembretes.TRABALHADORES_ECDS_DATAS_ID, siprp.data.outer.TrabalhadoresEcdsDatasData.class, siprp.data.outer.TrabalhadoresEcdsDatasData.ID ); + + public static final String TABLENAME = "lembretes"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.lembretes"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "lembretes.id"; + public static final int ID_INDEX = 0; + public static final String TIPO_ID = "tipo_id"; + public static final String TIPO_ID_FULL = "lembretes.tipo_id"; + public static final int TIPO_ID_INDEX = 1; + public static final String TO_TIPO_ID = "to_tipo_id"; + public static final int TO_TIPO_ID_INDEX = 2; + public static final String DATA = "data"; + public static final String DATA_FULL = "lembretes.data"; + public static final int DATA_INDEX = 3; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "lembretes.descricao"; + public static final int DESCRICAO_INDEX = 4; + public static final String TEXTO = "texto"; + public static final String TEXTO_FULL = "lembretes.texto"; + public static final int TEXTO_INDEX = 5; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "lembretes.empresa_id"; + public static final int EMPRESA_ID_INDEX = 6; + public static final String TO_EMPRESA_ID = "to_empresa_id"; + public static final int TO_EMPRESA_ID_INDEX = 7; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "lembretes.estabelecimento_id"; + public static final int ESTABELECIMENTO_ID_INDEX = 8; + public static final String TO_ESTABELECIMENTO_ID = "to_estabelecimento_id"; + public static final int TO_ESTABELECIMENTO_ID_INDEX = 9; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String TRABALHADOR_ID_FULL = "lembretes.trabalhador_id"; + public static final int TRABALHADOR_ID_INDEX = 10; + public static final String TO_TRABALHADOR_ID = "to_trabalhador_id"; + public static final int TO_TRABALHADOR_ID_INDEX = 11; + public static final String MARCACAO_ESTABELECIMENTO_ID = "marcacao_estabelecimento_id"; + public static final String MARCACAO_ESTABELECIMENTO_ID_FULL = "lembretes.marcacao_estabelecimento_id"; + public static final int MARCACAO_ESTABELECIMENTO_ID_INDEX = 12; + public static final String TO_MARCACAO_ESTABELECIMENTO_ID = "to_marcacao_estabelecimento_id"; + public static final int TO_MARCACAO_ESTABELECIMENTO_ID_INDEX = 13; + public static final String MARCACAO_TRABALHADOR_ID = "marcacao_trabalhador_id"; + public static final String MARCACAO_TRABALHADOR_ID_FULL = "lembretes.marcacao_trabalhador_id"; + public static final int MARCACAO_TRABALHADOR_ID_INDEX = 14; + public static final String TO_MARCACAO_TRABALHADOR_ID = "to_marcacao_trabalhador_id"; + public static final int TO_MARCACAO_TRABALHADOR_ID_INDEX = 15; + public static final String ENVIAR_EMAIL = "enviar_email"; + public static final String ENVIAR_EMAIL_FULL = "lembretes.enviar_email"; + public static final int ENVIAR_EMAIL_INDEX = 16; + public static final String PERIODICIDADE_DIAS = "periodicidade_dias"; + public static final String PERIODICIDADE_DIAS_FULL = "lembretes.periodicidade_dias"; + public static final int PERIODICIDADE_DIAS_INDEX = 17; + public static final String PERIODICIDADE_MESES = "periodicidade_meses"; + public static final String PERIODICIDADE_MESES_FULL = "lembretes.periodicidade_meses"; + public static final int PERIODICIDADE_MESES_INDEX = 18; + public static final String ULTIMO_ENVIO = "ultimo_envio"; + public static final String ULTIMO_ENVIO_FULL = "lembretes.ultimo_envio"; + public static final int ULTIMO_ENVIO_INDEX = 19; + public static final String TRABALHADORES_CONSULTAS_DATAS_ID = "trabalhadores_consultas_datas_id"; + public static final String TRABALHADORES_CONSULTAS_DATAS_ID_FULL = "lembretes.trabalhadores_consultas_datas_id"; + public static final int TRABALHADORES_CONSULTAS_DATAS_ID_INDEX = 20; + public static final String TO_TRABALHADORES_CONSULTAS_DATAS_ID = "to_trabalhadores_consultas_datas_id"; + public static final int TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX = 21; + public static final String TRABALHADORES_ECDS_DATAS_ID = "trabalhadores_ecds_datas_id"; + public static final String TRABALHADORES_ECDS_DATAS_ID_FULL = "lembretes.trabalhadores_ecds_datas_id"; + public static final int TRABALHADORES_ECDS_DATAS_ID_INDEX = 22; + public static final String TO_TRABALHADORES_ECDS_DATAS_ID = "to_trabalhadores_ecds_datas_id"; + public static final int TO_TRABALHADORES_ECDS_DATAS_ID_INDEX = 23; + public static final String DELETED_DATE = "deleted_date"; + public static final String DELETED_DATE_FULL = "lembretes.deleted_date"; + public static final int DELETED_DATE_INDEX = 24; + + public static final String FIELD_NAMES[] = new String[]{ + TIPO_ID, TO_TIPO_ID, DATA, DESCRICAO, TEXTO, EMPRESA_ID, TO_EMPRESA_ID, + ESTABELECIMENTO_ID, TO_ESTABELECIMENTO_ID, TRABALHADOR_ID, TO_TRABALHADOR_ID, + MARCACAO_ESTABELECIMENTO_ID, TO_MARCACAO_ESTABELECIMENTO_ID, + MARCACAO_TRABALHADOR_ID, TO_MARCACAO_TRABALHADOR_ID, ENVIAR_EMAIL, + PERIODICIDADE_DIAS, PERIODICIDADE_MESES, ULTIMO_ENVIO, + TRABALHADORES_CONSULTAS_DATAS_ID, TO_TRABALHADORES_CONSULTAS_DATAS_ID, + TRABALHADORES_ECDS_DATAS_ID, TO_TRABALHADORES_ECDS_DATAS_ID, DELETED_DATE, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + TIPO_ID, TABLENAME + "." + TO_TIPO_ID, TABLENAME + "." + DATA, TABLENAME + "." + DESCRICAO, TABLENAME + "." + TEXTO, TABLENAME + "." + EMPRESA_ID, TABLENAME + "." + TO_EMPRESA_ID, + TABLENAME + "." + ESTABELECIMENTO_ID, TABLENAME + "." + TO_ESTABELECIMENTO_ID, TABLENAME + "." + TRABALHADOR_ID, TABLENAME + "." + TO_TRABALHADOR_ID, + TABLENAME + "." + MARCACAO_ESTABELECIMENTO_ID, TABLENAME + "." + TO_MARCACAO_ESTABELECIMENTO_ID, + TABLENAME + "." + MARCACAO_TRABALHADOR_ID, TABLENAME + "." + TO_MARCACAO_TRABALHADOR_ID, TABLENAME + "." + ENVIAR_EMAIL, + TABLENAME + "." + PERIODICIDADE_DIAS, TABLENAME + "." + PERIODICIDADE_MESES, TABLENAME + "." + ULTIMO_ENVIO, + TABLENAME + "." + TRABALHADORES_CONSULTAS_DATAS_ID, TABLENAME + "." + TO_TRABALHADORES_CONSULTAS_DATAS_ID, + TABLENAME + "." + TRABALHADORES_ECDS_DATAS_ID, TABLENAME + "." + TO_TRABALHADORES_ECDS_DATAS_ID, TABLENAME + "." + DELETED_DATE, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, TIPO_ID, DATA, DESCRICAO, TEXTO, EMPRESA_ID, ESTABELECIMENTO_ID, TRABALHADOR_ID, + MARCACAO_ESTABELECIMENTO_ID, MARCACAO_TRABALHADOR_ID, ENVIAR_EMAIL, + PERIODICIDADE_DIAS, PERIODICIDADE_MESES, ULTIMO_ENVIO, + TRABALHADORES_CONSULTAS_DATAS_ID, TRABALHADORES_ECDS_DATAS_ID, + DELETED_DATE, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, TIPO_ID, DATA, DESCRICAO, TEXTO, EMPRESA_ID, ESTABELECIMENTO_ID, TRABALHADOR_ID, + MARCACAO_ESTABELECIMENTO_ID, MARCACAO_TRABALHADOR_ID, ENVIAR_EMAIL, + PERIODICIDADE_DIAS, PERIODICIDADE_MESES, ULTIMO_ENVIO, + TRABALHADORES_CONSULTAS_DATAS_ID, TRABALHADORES_ECDS_DATAS_ID, + DELETED_DATE, }; + + private Integer id; + private Integer tipo_id; + private siprp.data.outer.LembretesTiposData to_tipo_id; + private java.util.Date data; + private String descricao; + private String texto; + private Integer empresa_id; + private siprp.data.outer.EmpresasData to_empresa_id; + private Integer estabelecimento_id; + private siprp.data.outer.EstabelecimentosData to_estabelecimento_id; + private Integer trabalhador_id; + private siprp.data.outer.TrabalhadoresData to_trabalhador_id; + private Integer marcacao_estabelecimento_id; + private siprp.data.outer.MarcacoesEstabelecimentoData to_marcacao_estabelecimento_id; + private Integer marcacao_trabalhador_id; + private siprp.data.outer.MarcacoesTrabalhadorData to_marcacao_trabalhador_id; + private String enviar_email; + private Integer periodicidade_dias; + private Integer periodicidade_meses; + private java.util.Date ultimo_envio; + private Integer trabalhadores_consultas_datas_id; + private siprp.data.outer.TrabalhadoresConsultasDatasData to_trabalhadores_consultas_datas_id; + private Integer trabalhadores_ecds_datas_id; + private siprp.data.outer.TrabalhadoresEcdsDatasData to_trabalhadores_ecds_datas_id; + private java.sql.Timestamp deleted_date; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public Lembretes() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false, false, false, false + , false, false, false, false, false, false, false, false, + false, false, false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public Integer getTipo_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TIPO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.tipo_id; + } + + public void setTipo_id( Integer tipo_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TIPO_ID, tipo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.tipo_id = tipo_id; + LAZY_LOADED_OBJECTS.put( TIPO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.LembretesTiposData toTipo_id() + { + try + { + prepare( TO_TIPO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_tipo_id; + } + + public void setToTipo_id( siprp.data.outer.LembretesTiposData to_tipo_id ) + { + try + { + preProcess( TO_TIPO_ID, to_tipo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_tipo_id = to_tipo_id; + } + + public java.util.Date getData() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data; + } + + public void setData( java.util.Date data ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA, data ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data = data; + LAZY_LOADED_OBJECTS.put( DATA, Boolean.TRUE ); + } + + public String getDescricao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRICAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.descricao; + } + + public void setDescricao( String descricao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRICAO, descricao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.descricao = descricao; + LAZY_LOADED_OBJECTS.put( DESCRICAO, Boolean.TRUE ); + } + + public String getTexto() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TEXTO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.texto; + } + + public void setTexto( String texto ) + { + try + { + setLockedForRefresh( true ); + preProcess( TEXTO, texto ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.texto = texto; + LAZY_LOADED_OBJECTS.put( TEXTO, Boolean.TRUE ); + } + + public Integer getEmpresa_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMPRESA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.empresa_id; + } + + public void setEmpresa_id( Integer empresa_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMPRESA_ID, empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.empresa_id = empresa_id; + LAZY_LOADED_OBJECTS.put( EMPRESA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EmpresasData toEmpresa_id() + { + try + { + prepare( TO_EMPRESA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_empresa_id; + } + + public void setToEmpresa_id( siprp.data.outer.EmpresasData to_empresa_id ) + { + try + { + preProcess( TO_EMPRESA_ID, to_empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_empresa_id = to_empresa_id; + } + + public Integer getEstabelecimento_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTABELECIMENTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estabelecimento_id; + } + + public void setEstabelecimento_id( Integer estabelecimento_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTABELECIMENTO_ID, estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estabelecimento_id = estabelecimento_id; + LAZY_LOADED_OBJECTS.put( ESTABELECIMENTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EstabelecimentosData toEstabelecimento_id() + { + try + { + prepare( TO_ESTABELECIMENTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_estabelecimento_id; + } + + public void setToEstabelecimento_id( siprp.data.outer.EstabelecimentosData to_estabelecimento_id ) + { + try + { + preProcess( TO_ESTABELECIMENTO_ID, to_estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_estabelecimento_id = to_estabelecimento_id; + } + + public Integer getTrabalhador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TRABALHADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.trabalhador_id; + } + + public void setTrabalhador_id( Integer trabalhador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TRABALHADOR_ID, trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.trabalhador_id = trabalhador_id; + LAZY_LOADED_OBJECTS.put( TRABALHADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresData toTrabalhador_id() + { + try + { + prepare( TO_TRABALHADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_trabalhador_id; + } + + public void setToTrabalhador_id( siprp.data.outer.TrabalhadoresData to_trabalhador_id ) + { + try + { + preProcess( TO_TRABALHADOR_ID, to_trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_trabalhador_id = to_trabalhador_id; + } + + public Integer getMarcacao_estabelecimento_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MARCACAO_ESTABELECIMENTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.marcacao_estabelecimento_id; + } + + public void setMarcacao_estabelecimento_id( Integer marcacao_estabelecimento_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( MARCACAO_ESTABELECIMENTO_ID, marcacao_estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.marcacao_estabelecimento_id = marcacao_estabelecimento_id; + LAZY_LOADED_OBJECTS.put( MARCACAO_ESTABELECIMENTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.MarcacoesEstabelecimentoData toMarcacao_estabelecimento_id() + { + try + { + prepare( TO_MARCACAO_ESTABELECIMENTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_marcacao_estabelecimento_id; + } + + public void setToMarcacao_estabelecimento_id( siprp.data.outer.MarcacoesEstabelecimentoData to_marcacao_estabelecimento_id ) + { + try + { + preProcess( TO_MARCACAO_ESTABELECIMENTO_ID, to_marcacao_estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_marcacao_estabelecimento_id = to_marcacao_estabelecimento_id; + } + + public Integer getMarcacao_trabalhador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MARCACAO_TRABALHADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.marcacao_trabalhador_id; + } + + public void setMarcacao_trabalhador_id( Integer marcacao_trabalhador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( MARCACAO_TRABALHADOR_ID, marcacao_trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.marcacao_trabalhador_id = marcacao_trabalhador_id; + LAZY_LOADED_OBJECTS.put( MARCACAO_TRABALHADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.MarcacoesTrabalhadorData toMarcacao_trabalhador_id() + { + try + { + prepare( TO_MARCACAO_TRABALHADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_marcacao_trabalhador_id; + } + + public void setToMarcacao_trabalhador_id( siprp.data.outer.MarcacoesTrabalhadorData to_marcacao_trabalhador_id ) + { + try + { + preProcess( TO_MARCACAO_TRABALHADOR_ID, to_marcacao_trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_marcacao_trabalhador_id = to_marcacao_trabalhador_id; + } + + public String getEnviar_email() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ENVIAR_EMAIL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.enviar_email; + } + + public void setEnviar_email( String enviar_email ) + { + try + { + setLockedForRefresh( true ); + preProcess( ENVIAR_EMAIL, enviar_email ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.enviar_email = enviar_email; + LAZY_LOADED_OBJECTS.put( ENVIAR_EMAIL, Boolean.TRUE ); + } + + public Integer getPeriodicidade_dias() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PERIODICIDADE_DIAS ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.periodicidade_dias; + } + + public void setPeriodicidade_dias( Integer periodicidade_dias ) + { + try + { + setLockedForRefresh( true ); + preProcess( PERIODICIDADE_DIAS, periodicidade_dias ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.periodicidade_dias = periodicidade_dias; + LAZY_LOADED_OBJECTS.put( PERIODICIDADE_DIAS, Boolean.TRUE ); + } + + public Integer getPeriodicidade_meses() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PERIODICIDADE_MESES ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.periodicidade_meses; + } + + public void setPeriodicidade_meses( Integer periodicidade_meses ) + { + try + { + setLockedForRefresh( true ); + preProcess( PERIODICIDADE_MESES, periodicidade_meses ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.periodicidade_meses = periodicidade_meses; + LAZY_LOADED_OBJECTS.put( PERIODICIDADE_MESES, Boolean.TRUE ); + } + + public java.util.Date getUltimo_envio() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ULTIMO_ENVIO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.ultimo_envio; + } + + public void setUltimo_envio( java.util.Date ultimo_envio ) + { + try + { + setLockedForRefresh( true ); + preProcess( ULTIMO_ENVIO, ultimo_envio ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.ultimo_envio = ultimo_envio; + LAZY_LOADED_OBJECTS.put( ULTIMO_ENVIO, Boolean.TRUE ); + } + + public Integer getTrabalhadores_consultas_datas_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TRABALHADORES_CONSULTAS_DATAS_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.trabalhadores_consultas_datas_id; + } + + public void setTrabalhadores_consultas_datas_id( Integer trabalhadores_consultas_datas_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TRABALHADORES_CONSULTAS_DATAS_ID, trabalhadores_consultas_datas_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.trabalhadores_consultas_datas_id = trabalhadores_consultas_datas_id; + LAZY_LOADED_OBJECTS.put( TRABALHADORES_CONSULTAS_DATAS_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresConsultasDatasData toTrabalhadores_consultas_datas_id() + { + try + { + prepare( TO_TRABALHADORES_CONSULTAS_DATAS_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_trabalhadores_consultas_datas_id; + } + + public void setToTrabalhadores_consultas_datas_id( siprp.data.outer.TrabalhadoresConsultasDatasData to_trabalhadores_consultas_datas_id ) + { + try + { + preProcess( TO_TRABALHADORES_CONSULTAS_DATAS_ID, to_trabalhadores_consultas_datas_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_trabalhadores_consultas_datas_id = to_trabalhadores_consultas_datas_id; + } + + public Integer getTrabalhadores_ecds_datas_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TRABALHADORES_ECDS_DATAS_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.trabalhadores_ecds_datas_id; + } + + public void setTrabalhadores_ecds_datas_id( Integer trabalhadores_ecds_datas_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TRABALHADORES_ECDS_DATAS_ID, trabalhadores_ecds_datas_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.trabalhadores_ecds_datas_id = trabalhadores_ecds_datas_id; + LAZY_LOADED_OBJECTS.put( TRABALHADORES_ECDS_DATAS_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresEcdsDatasData toTrabalhadores_ecds_datas_id() + { + try + { + prepare( TO_TRABALHADORES_ECDS_DATAS_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_trabalhadores_ecds_datas_id; + } + + public void setToTrabalhadores_ecds_datas_id( siprp.data.outer.TrabalhadoresEcdsDatasData to_trabalhadores_ecds_datas_id ) + { + try + { + preProcess( TO_TRABALHADORES_ECDS_DATAS_ID, to_trabalhadores_ecds_datas_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_trabalhadores_ecds_datas_id = to_trabalhadores_ecds_datas_id; + } + + public java.sql.Timestamp getDeleted_date() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DELETED_DATE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.deleted_date; + } + + public void setDeleted_date( java.sql.Timestamp deleted_date ) + { + try + { + setLockedForRefresh( true ); + preProcess( DELETED_DATE, deleted_date ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.deleted_date = deleted_date; + LAZY_LOADED_OBJECTS.put( DELETED_DATE, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Lembretes.ID_INDEX: + value = getId(); + break; + case Lembretes.TIPO_ID_INDEX: + value = getTipo_id(); + break; + case Lembretes.TO_TIPO_ID_INDEX: + value = toTipo_id(); + break; + case Lembretes.DATA_INDEX: + value = getData(); + break; + case Lembretes.DESCRICAO_INDEX: + value = getDescricao(); + break; + case Lembretes.TEXTO_INDEX: + value = getTexto(); + break; + case Lembretes.EMPRESA_ID_INDEX: + value = getEmpresa_id(); + break; + case Lembretes.TO_EMPRESA_ID_INDEX: + value = toEmpresa_id(); + break; + case Lembretes.ESTABELECIMENTO_ID_INDEX: + value = getEstabelecimento_id(); + break; + case Lembretes.TO_ESTABELECIMENTO_ID_INDEX: + value = toEstabelecimento_id(); + break; + case Lembretes.TRABALHADOR_ID_INDEX: + value = getTrabalhador_id(); + break; + case Lembretes.TO_TRABALHADOR_ID_INDEX: + value = toTrabalhador_id(); + break; + case Lembretes.MARCACAO_ESTABELECIMENTO_ID_INDEX: + value = getMarcacao_estabelecimento_id(); + break; + case Lembretes.TO_MARCACAO_ESTABELECIMENTO_ID_INDEX: + value = toMarcacao_estabelecimento_id(); + break; + case Lembretes.MARCACAO_TRABALHADOR_ID_INDEX: + value = getMarcacao_trabalhador_id(); + break; + case Lembretes.TO_MARCACAO_TRABALHADOR_ID_INDEX: + value = toMarcacao_trabalhador_id(); + break; + case Lembretes.ENVIAR_EMAIL_INDEX: + value = getEnviar_email(); + break; + case Lembretes.PERIODICIDADE_DIAS_INDEX: + value = getPeriodicidade_dias(); + break; + case Lembretes.PERIODICIDADE_MESES_INDEX: + value = getPeriodicidade_meses(); + break; + case Lembretes.ULTIMO_ENVIO_INDEX: + value = getUltimo_envio(); + break; + case Lembretes.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + value = getTrabalhadores_consultas_datas_id(); + break; + case Lembretes.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + value = toTrabalhadores_consultas_datas_id(); + break; + case Lembretes.TRABALHADORES_ECDS_DATAS_ID_INDEX: + value = getTrabalhadores_ecds_datas_id(); + break; + case Lembretes.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + value = toTrabalhadores_ecds_datas_id(); + break; + case Lembretes.DELETED_DATE_INDEX: + value = getDeleted_date(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Lembretes.ID_INDEX: + value = this.id; + break; + case Lembretes.TIPO_ID_INDEX: + value = this.tipo_id; + break; + case Lembretes.TO_TIPO_ID_INDEX: + value = this.to_tipo_id; + break; + case Lembretes.DATA_INDEX: + value = this.data; + break; + case Lembretes.DESCRICAO_INDEX: + value = this.descricao; + break; + case Lembretes.TEXTO_INDEX: + value = this.texto; + break; + case Lembretes.EMPRESA_ID_INDEX: + value = this.empresa_id; + break; + case Lembretes.TO_EMPRESA_ID_INDEX: + value = this.to_empresa_id; + break; + case Lembretes.ESTABELECIMENTO_ID_INDEX: + value = this.estabelecimento_id; + break; + case Lembretes.TO_ESTABELECIMENTO_ID_INDEX: + value = this.to_estabelecimento_id; + break; + case Lembretes.TRABALHADOR_ID_INDEX: + value = this.trabalhador_id; + break; + case Lembretes.TO_TRABALHADOR_ID_INDEX: + value = this.to_trabalhador_id; + break; + case Lembretes.MARCACAO_ESTABELECIMENTO_ID_INDEX: + value = this.marcacao_estabelecimento_id; + break; + case Lembretes.TO_MARCACAO_ESTABELECIMENTO_ID_INDEX: + value = this.to_marcacao_estabelecimento_id; + break; + case Lembretes.MARCACAO_TRABALHADOR_ID_INDEX: + value = this.marcacao_trabalhador_id; + break; + case Lembretes.TO_MARCACAO_TRABALHADOR_ID_INDEX: + value = this.to_marcacao_trabalhador_id; + break; + case Lembretes.ENVIAR_EMAIL_INDEX: + value = this.enviar_email; + break; + case Lembretes.PERIODICIDADE_DIAS_INDEX: + value = this.periodicidade_dias; + break; + case Lembretes.PERIODICIDADE_MESES_INDEX: + value = this.periodicidade_meses; + break; + case Lembretes.ULTIMO_ENVIO_INDEX: + value = this.ultimo_envio; + break; + case Lembretes.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + value = this.trabalhadores_consultas_datas_id; + break; + case Lembretes.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + value = this.to_trabalhadores_consultas_datas_id; + break; + case Lembretes.TRABALHADORES_ECDS_DATAS_ID_INDEX: + value = this.trabalhadores_ecds_datas_id; + break; + case Lembretes.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + value = this.to_trabalhadores_ecds_datas_id; + break; + case Lembretes.DELETED_DATE_INDEX: + value = this.deleted_date; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Lembretes.ID_INDEX: + setId( ( Integer ) value ); + break; + case Lembretes.TIPO_ID_INDEX: + setTipo_id( ( Integer ) value ); + break; + case Lembretes.TO_TIPO_ID_INDEX: + setToTipo_id( ( siprp.data.outer.LembretesTiposData ) value ); + break; + case Lembretes.DATA_INDEX: + setData( ( java.util.Date ) value ); + break; + case Lembretes.DESCRICAO_INDEX: + setDescricao( ( String ) value ); + break; + case Lembretes.TEXTO_INDEX: + setTexto( ( String ) value ); + break; + case Lembretes.EMPRESA_ID_INDEX: + setEmpresa_id( ( Integer ) value ); + break; + case Lembretes.TO_EMPRESA_ID_INDEX: + setToEmpresa_id( ( siprp.data.outer.EmpresasData ) value ); + break; + case Lembretes.ESTABELECIMENTO_ID_INDEX: + setEstabelecimento_id( ( Integer ) value ); + break; + case Lembretes.TO_ESTABELECIMENTO_ID_INDEX: + setToEstabelecimento_id( ( siprp.data.outer.EstabelecimentosData ) value ); + break; + case Lembretes.TRABALHADOR_ID_INDEX: + setTrabalhador_id( ( Integer ) value ); + break; + case Lembretes.TO_TRABALHADOR_ID_INDEX: + setToTrabalhador_id( ( siprp.data.outer.TrabalhadoresData ) value ); + break; + case Lembretes.MARCACAO_ESTABELECIMENTO_ID_INDEX: + setMarcacao_estabelecimento_id( ( Integer ) value ); + break; + case Lembretes.TO_MARCACAO_ESTABELECIMENTO_ID_INDEX: + setToMarcacao_estabelecimento_id( ( siprp.data.outer.MarcacoesEstabelecimentoData ) value ); + break; + case Lembretes.MARCACAO_TRABALHADOR_ID_INDEX: + setMarcacao_trabalhador_id( ( Integer ) value ); + break; + case Lembretes.TO_MARCACAO_TRABALHADOR_ID_INDEX: + setToMarcacao_trabalhador_id( ( siprp.data.outer.MarcacoesTrabalhadorData ) value ); + break; + case Lembretes.ENVIAR_EMAIL_INDEX: + setEnviar_email( ( String ) value ); + break; + case Lembretes.PERIODICIDADE_DIAS_INDEX: + setPeriodicidade_dias( ( Integer ) value ); + break; + case Lembretes.PERIODICIDADE_MESES_INDEX: + setPeriodicidade_meses( ( Integer ) value ); + break; + case Lembretes.ULTIMO_ENVIO_INDEX: + setUltimo_envio( ( java.util.Date ) value ); + break; + case Lembretes.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + setTrabalhadores_consultas_datas_id( ( Integer ) value ); + break; + case Lembretes.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + setToTrabalhadores_consultas_datas_id( ( siprp.data.outer.TrabalhadoresConsultasDatasData ) value ); + break; + case Lembretes.TRABALHADORES_ECDS_DATAS_ID_INDEX: + setTrabalhadores_ecds_datas_id( ( Integer ) value ); + break; + case Lembretes.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + setToTrabalhadores_ecds_datas_id( ( siprp.data.outer.TrabalhadoresEcdsDatasData ) value ); + break; + case Lembretes.DELETED_DATE_INDEX: + setDeleted_date( ( java.sql.Timestamp ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Lembretes.ID_INDEX: + this.id = ( Integer ) value; + break; + case Lembretes.TIPO_ID_INDEX: + this.tipo_id = ( Integer ) value; + break; + case Lembretes.TO_TIPO_ID_INDEX: + this.to_tipo_id = ( siprp.data.outer.LembretesTiposData ) value; + break; + case Lembretes.DATA_INDEX: + this.data = ( java.util.Date ) value; + break; + case Lembretes.DESCRICAO_INDEX: + this.descricao = ( String ) value; + break; + case Lembretes.TEXTO_INDEX: + this.texto = ( String ) value; + break; + case Lembretes.EMPRESA_ID_INDEX: + this.empresa_id = ( Integer ) value; + break; + case Lembretes.TO_EMPRESA_ID_INDEX: + this.to_empresa_id = ( siprp.data.outer.EmpresasData ) value; + break; + case Lembretes.ESTABELECIMENTO_ID_INDEX: + this.estabelecimento_id = ( Integer ) value; + break; + case Lembretes.TO_ESTABELECIMENTO_ID_INDEX: + this.to_estabelecimento_id = ( siprp.data.outer.EstabelecimentosData ) value; + break; + case Lembretes.TRABALHADOR_ID_INDEX: + this.trabalhador_id = ( Integer ) value; + break; + case Lembretes.TO_TRABALHADOR_ID_INDEX: + this.to_trabalhador_id = ( siprp.data.outer.TrabalhadoresData ) value; + break; + case Lembretes.MARCACAO_ESTABELECIMENTO_ID_INDEX: + this.marcacao_estabelecimento_id = ( Integer ) value; + break; + case Lembretes.TO_MARCACAO_ESTABELECIMENTO_ID_INDEX: + this.to_marcacao_estabelecimento_id = ( siprp.data.outer.MarcacoesEstabelecimentoData ) value; + break; + case Lembretes.MARCACAO_TRABALHADOR_ID_INDEX: + this.marcacao_trabalhador_id = ( Integer ) value; + break; + case Lembretes.TO_MARCACAO_TRABALHADOR_ID_INDEX: + this.to_marcacao_trabalhador_id = ( siprp.data.outer.MarcacoesTrabalhadorData ) value; + break; + case Lembretes.ENVIAR_EMAIL_INDEX: + this.enviar_email = ( String ) value; + break; + case Lembretes.PERIODICIDADE_DIAS_INDEX: + this.periodicidade_dias = ( Integer ) value; + break; + case Lembretes.PERIODICIDADE_MESES_INDEX: + this.periodicidade_meses = ( Integer ) value; + break; + case Lembretes.ULTIMO_ENVIO_INDEX: + this.ultimo_envio = ( java.util.Date ) value; + break; + case Lembretes.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + this.trabalhadores_consultas_datas_id = ( Integer ) value; + break; + case Lembretes.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + this.to_trabalhadores_consultas_datas_id = ( siprp.data.outer.TrabalhadoresConsultasDatasData ) value; + break; + case Lembretes.TRABALHADORES_ECDS_DATAS_ID_INDEX: + this.trabalhadores_ecds_datas_id = ( Integer ) value; + break; + case Lembretes.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + this.to_trabalhadores_ecds_datas_id = ( siprp.data.outer.TrabalhadoresEcdsDatasData ) value; + break; + case Lembretes.DELETED_DATE_INDEX: + this.deleted_date = ( java.sql.Timestamp ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case Lembretes.ID_INDEX: + theClass = Integer.class; + break; + case Lembretes.TIPO_ID_INDEX: + theClass = Integer.class; + break; + case Lembretes.TO_TIPO_ID_INDEX: + theClass = siprp.data.outer.LembretesTiposData.class; + break; + case Lembretes.DATA_INDEX: + theClass = java.util.Date.class; + break; + case Lembretes.DESCRICAO_INDEX: + theClass = String.class; + break; + case Lembretes.TEXTO_INDEX: + theClass = String.class; + break; + case Lembretes.EMPRESA_ID_INDEX: + theClass = Integer.class; + break; + case Lembretes.TO_EMPRESA_ID_INDEX: + theClass = siprp.data.outer.EmpresasData.class; + break; + case Lembretes.ESTABELECIMENTO_ID_INDEX: + theClass = Integer.class; + break; + case Lembretes.TO_ESTABELECIMENTO_ID_INDEX: + theClass = siprp.data.outer.EstabelecimentosData.class; + break; + case Lembretes.TRABALHADOR_ID_INDEX: + theClass = Integer.class; + break; + case Lembretes.TO_TRABALHADOR_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresData.class; + break; + case Lembretes.MARCACAO_ESTABELECIMENTO_ID_INDEX: + theClass = Integer.class; + break; + case Lembretes.TO_MARCACAO_ESTABELECIMENTO_ID_INDEX: + theClass = siprp.data.outer.MarcacoesEstabelecimentoData.class; + break; + case Lembretes.MARCACAO_TRABALHADOR_ID_INDEX: + theClass = Integer.class; + break; + case Lembretes.TO_MARCACAO_TRABALHADOR_ID_INDEX: + theClass = siprp.data.outer.MarcacoesTrabalhadorData.class; + break; + case Lembretes.ENVIAR_EMAIL_INDEX: + theClass = String.class; + break; + case Lembretes.PERIODICIDADE_DIAS_INDEX: + theClass = Integer.class; + break; + case Lembretes.PERIODICIDADE_MESES_INDEX: + theClass = Integer.class; + break; + case Lembretes.ULTIMO_ENVIO_INDEX: + theClass = java.util.Date.class; + break; + case Lembretes.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + theClass = Integer.class; + break; + case Lembretes.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresConsultasDatasData.class; + break; + case Lembretes.TRABALHADORES_ECDS_DATAS_ID_INDEX: + theClass = Integer.class; + break; + case Lembretes.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresEcdsDatasData.class; + break; + case Lembretes.DELETED_DATE_INDEX: + theClass = java.sql.Timestamp.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : Lembretes._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, Lembretes.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/LembretesTipos.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/LembretesTipos.java new file mode 100644 index 00000000..e71e1247 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/LembretesTipos.java @@ -0,0 +1,445 @@ +/* +* LembretesTipos.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class LembretesTipos extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( LembretesTipos.ID, LembretesTipos.ID_INDEX ); + FIELD_INDEXES.put( LembretesTipos.ID_FULL, LembretesTipos.ID_INDEX ); + FIELD_INDEXES.put( LembretesTipos.CODIGO, LembretesTipos.CODIGO_INDEX ); + FIELD_INDEXES.put( LembretesTipos.CODIGO_FULL, LembretesTipos.CODIGO_INDEX ); + FIELD_INDEXES.put( LembretesTipos.DESCRICAO, LembretesTipos.DESCRICAO_INDEX ); + FIELD_INDEXES.put( LembretesTipos.DESCRICAO_FULL, LembretesTipos.DESCRICAO_INDEX ); + FIELD_INDEXES.put( LembretesTipos.ORDEM, LembretesTipos.ORDEM_INDEX ); + FIELD_INDEXES.put( LembretesTipos.ORDEM_FULL, LembretesTipos.ORDEM_INDEX ); + FIELD_INDEXES.put( LembretesTipos.ACTIVO, LembretesTipos.ACTIVO_INDEX ); + FIELD_INDEXES.put( LembretesTipos.ACTIVO_FULL, LembretesTipos.ACTIVO_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "lembretes_tipos"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.lembretes_tipos"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "lembretes_tipos.id"; + public static final int ID_INDEX = 0; + public static final String CODIGO = "codigo"; + public static final String CODIGO_FULL = "lembretes_tipos.codigo"; + public static final int CODIGO_INDEX = 1; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "lembretes_tipos.descricao"; + public static final int DESCRICAO_INDEX = 2; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "lembretes_tipos.ordem"; + public static final int ORDEM_INDEX = 3; + public static final String ACTIVO = "activo"; + public static final String ACTIVO_FULL = "lembretes_tipos.activo"; + public static final int ACTIVO_INDEX = 4; + + public static final String FIELD_NAMES[] = new String[]{ + CODIGO, DESCRICAO, ORDEM, ACTIVO, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + CODIGO, TABLENAME + "." + DESCRICAO, TABLENAME + "." + ORDEM, TABLENAME + "." + ACTIVO, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, CODIGO, DESCRICAO, ORDEM, ACTIVO, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, CODIGO, DESCRICAO, ORDEM, ACTIVO, }; + + private Integer id; + private String codigo; + private String descricao; + private Integer ordem; + private String activo; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public LembretesTipos() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromLembretes_tipo_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.LembretesData.class , getPrimaryKey().getMap().get("id"), "tipo_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getCodigo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CODIGO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.codigo; + } + + public void setCodigo( String codigo ) + { + try + { + setLockedForRefresh( true ); + preProcess( CODIGO, codigo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.codigo = codigo; + LAZY_LOADED_OBJECTS.put( CODIGO, Boolean.TRUE ); + } + + public String getDescricao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRICAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.descricao; + } + + public void setDescricao( String descricao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRICAO, descricao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.descricao = descricao; + LAZY_LOADED_OBJECTS.put( DESCRICAO, Boolean.TRUE ); + } + + public Integer getOrdem() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ORDEM ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.ordem; + } + + public void setOrdem( Integer ordem ) + { + try + { + setLockedForRefresh( true ); + preProcess( ORDEM, ordem ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.ordem = ordem; + LAZY_LOADED_OBJECTS.put( ORDEM, Boolean.TRUE ); + } + + public String getActivo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ACTIVO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.activo; + } + + public void setActivo( String activo ) + { + try + { + setLockedForRefresh( true ); + preProcess( ACTIVO, activo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.activo = activo; + LAZY_LOADED_OBJECTS.put( ACTIVO, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case LembretesTipos.ID_INDEX: + value = getId(); + break; + case LembretesTipos.CODIGO_INDEX: + value = getCodigo(); + break; + case LembretesTipos.DESCRICAO_INDEX: + value = getDescricao(); + break; + case LembretesTipos.ORDEM_INDEX: + value = getOrdem(); + break; + case LembretesTipos.ACTIVO_INDEX: + value = getActivo(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case LembretesTipos.ID_INDEX: + value = this.id; + break; + case LembretesTipos.CODIGO_INDEX: + value = this.codigo; + break; + case LembretesTipos.DESCRICAO_INDEX: + value = this.descricao; + break; + case LembretesTipos.ORDEM_INDEX: + value = this.ordem; + break; + case LembretesTipos.ACTIVO_INDEX: + value = this.activo; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case LembretesTipos.ID_INDEX: + setId( ( Integer ) value ); + break; + case LembretesTipos.CODIGO_INDEX: + setCodigo( ( String ) value ); + break; + case LembretesTipos.DESCRICAO_INDEX: + setDescricao( ( String ) value ); + break; + case LembretesTipos.ORDEM_INDEX: + setOrdem( ( Integer ) value ); + break; + case LembretesTipos.ACTIVO_INDEX: + setActivo( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case LembretesTipos.ID_INDEX: + this.id = ( Integer ) value; + break; + case LembretesTipos.CODIGO_INDEX: + this.codigo = ( String ) value; + break; + case LembretesTipos.DESCRICAO_INDEX: + this.descricao = ( String ) value; + break; + case LembretesTipos.ORDEM_INDEX: + this.ordem = ( Integer ) value; + break; + case LembretesTipos.ACTIVO_INDEX: + this.activo = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case LembretesTipos.ID_INDEX: + theClass = Integer.class; + break; + case LembretesTipos.CODIGO_INDEX: + theClass = String.class; + break; + case LembretesTipos.DESCRICAO_INDEX: + theClass = String.class; + break; + case LembretesTipos.ORDEM_INDEX: + theClass = Integer.class; + break; + case LembretesTipos.ACTIVO_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : LembretesTipos._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, LembretesTipos.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesEmpresa.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesEmpresa.java new file mode 100644 index 00000000..308e482e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesEmpresa.java @@ -0,0 +1,480 @@ +/* +* MarcacoesEmpresa.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class MarcacoesEmpresa extends siprp.data.Marcacao +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( MarcacoesEmpresa.ID, MarcacoesEmpresa.ID_INDEX ); + FIELD_INDEXES.put( MarcacoesEmpresa.ID_FULL, MarcacoesEmpresa.ID_INDEX ); + FIELD_INDEXES.put( MarcacoesEmpresa.DATA, MarcacoesEmpresa.DATA_INDEX ); + FIELD_INDEXES.put( MarcacoesEmpresa.DATA_FULL, MarcacoesEmpresa.DATA_INDEX ); + FIELD_INDEXES.put( MarcacoesEmpresa.TEXTO, MarcacoesEmpresa.TEXTO_INDEX ); + FIELD_INDEXES.put( MarcacoesEmpresa.TEXTO_FULL, MarcacoesEmpresa.TEXTO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( MarcacoesEmpresa.CLASS_IDENTIFIER, MarcacoesEmpresa.EMPRESA_ID, MarcacoesEmpresa.TO_EMPRESA_ID ); + FIELD_INDEXES.put( MarcacoesEmpresa.EMPRESA_ID, MarcacoesEmpresa.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesEmpresa.EMPRESA_ID_FULL, MarcacoesEmpresa.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesEmpresa.TO_EMPRESA_ID, MarcacoesEmpresa.TO_EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesEmpresa.REALIZADA, MarcacoesEmpresa.REALIZADA_INDEX ); + FIELD_INDEXES.put( MarcacoesEmpresa.REALIZADA_FULL, MarcacoesEmpresa.REALIZADA_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyempresa_idToempresas = + new com.evolute.entity.ForeignKey( MarcacoesEmpresa.class, MarcacoesEmpresa.EMPRESA_ID, siprp.data.outer.EmpresasData.class, siprp.data.outer.EmpresasData.ID ); + + public static final String TABLENAME = "marcacoes_empresa"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.marcacoes_empresa"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "marcacoes_empresa.id"; + public static final int ID_INDEX = 0; + public static final String DATA = "data"; + public static final String DATA_FULL = "marcacoes_empresa.data"; + public static final int DATA_INDEX = 1; + public static final String TEXTO = "texto"; + public static final String TEXTO_FULL = "marcacoes_empresa.texto"; + public static final int TEXTO_INDEX = 2; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "marcacoes_empresa.empresa_id"; + public static final int EMPRESA_ID_INDEX = 3; + public static final String TO_EMPRESA_ID = "to_empresa_id"; + public static final int TO_EMPRESA_ID_INDEX = 4; + public static final String REALIZADA = "realizada"; + public static final String REALIZADA_FULL = "marcacoes_empresa.realizada"; + public static final int REALIZADA_INDEX = 5; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, TEXTO, EMPRESA_ID, TO_EMPRESA_ID, REALIZADA, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DATA, TABLENAME + "." + TEXTO, TABLENAME + "." + EMPRESA_ID, TABLENAME + "." + TO_EMPRESA_ID, TABLENAME + "." + REALIZADA, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DATA, TEXTO, EMPRESA_ID, REALIZADA, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DATA, TEXTO, EMPRESA_ID, REALIZADA, }; + + private Integer id; + private java.util.Date data; + private String texto; + private Integer empresa_id; + private siprp.data.outer.EmpresasData to_empresa_id; + private String realizada; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public MarcacoesEmpresa() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.Date getData() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data; + } + + public void setData( java.util.Date data ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA, data ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data = data; + LAZY_LOADED_OBJECTS.put( DATA, Boolean.TRUE ); + } + + public String getTexto() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TEXTO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.texto; + } + + public void setTexto( String texto ) + { + try + { + setLockedForRefresh( true ); + preProcess( TEXTO, texto ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.texto = texto; + LAZY_LOADED_OBJECTS.put( TEXTO, Boolean.TRUE ); + } + + public Integer getEmpresa_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMPRESA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.empresa_id; + } + + public void setEmpresa_id( Integer empresa_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMPRESA_ID, empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.empresa_id = empresa_id; + LAZY_LOADED_OBJECTS.put( EMPRESA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EmpresasData toEmpresa_id() + { + try + { + prepare( TO_EMPRESA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_empresa_id; + } + + public void setToEmpresa_id( siprp.data.outer.EmpresasData to_empresa_id ) + { + try + { + preProcess( TO_EMPRESA_ID, to_empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_empresa_id = to_empresa_id; + } + + public String getRealizada() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( REALIZADA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.realizada; + } + + public void setRealizada( String realizada ) + { + try + { + setLockedForRefresh( true ); + preProcess( REALIZADA, realizada ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.realizada = realizada; + LAZY_LOADED_OBJECTS.put( REALIZADA, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesEmpresa.ID_INDEX: + value = getId(); + break; + case MarcacoesEmpresa.DATA_INDEX: + value = getData(); + break; + case MarcacoesEmpresa.TEXTO_INDEX: + value = getTexto(); + break; + case MarcacoesEmpresa.EMPRESA_ID_INDEX: + value = getEmpresa_id(); + break; + case MarcacoesEmpresa.TO_EMPRESA_ID_INDEX: + value = toEmpresa_id(); + break; + case MarcacoesEmpresa.REALIZADA_INDEX: + value = getRealizada(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesEmpresa.ID_INDEX: + value = this.id; + break; + case MarcacoesEmpresa.DATA_INDEX: + value = this.data; + break; + case MarcacoesEmpresa.TEXTO_INDEX: + value = this.texto; + break; + case MarcacoesEmpresa.EMPRESA_ID_INDEX: + value = this.empresa_id; + break; + case MarcacoesEmpresa.TO_EMPRESA_ID_INDEX: + value = this.to_empresa_id; + break; + case MarcacoesEmpresa.REALIZADA_INDEX: + value = this.realizada; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesEmpresa.ID_INDEX: + setId( ( Integer ) value ); + break; + case MarcacoesEmpresa.DATA_INDEX: + setData( ( java.util.Date ) value ); + break; + case MarcacoesEmpresa.TEXTO_INDEX: + setTexto( ( String ) value ); + break; + case MarcacoesEmpresa.EMPRESA_ID_INDEX: + setEmpresa_id( ( Integer ) value ); + break; + case MarcacoesEmpresa.TO_EMPRESA_ID_INDEX: + setToEmpresa_id( ( siprp.data.outer.EmpresasData ) value ); + break; + case MarcacoesEmpresa.REALIZADA_INDEX: + setRealizada( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesEmpresa.ID_INDEX: + this.id = ( Integer ) value; + break; + case MarcacoesEmpresa.DATA_INDEX: + this.data = ( java.util.Date ) value; + break; + case MarcacoesEmpresa.TEXTO_INDEX: + this.texto = ( String ) value; + break; + case MarcacoesEmpresa.EMPRESA_ID_INDEX: + this.empresa_id = ( Integer ) value; + break; + case MarcacoesEmpresa.TO_EMPRESA_ID_INDEX: + this.to_empresa_id = ( siprp.data.outer.EmpresasData ) value; + break; + case MarcacoesEmpresa.REALIZADA_INDEX: + this.realizada = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case MarcacoesEmpresa.ID_INDEX: + theClass = Integer.class; + break; + case MarcacoesEmpresa.DATA_INDEX: + theClass = java.util.Date.class; + break; + case MarcacoesEmpresa.TEXTO_INDEX: + theClass = String.class; + break; + case MarcacoesEmpresa.EMPRESA_ID_INDEX: + theClass = Integer.class; + break; + case MarcacoesEmpresa.TO_EMPRESA_ID_INDEX: + theClass = siprp.data.outer.EmpresasData.class; + break; + case MarcacoesEmpresa.REALIZADA_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : MarcacoesEmpresa._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, MarcacoesEmpresa.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesEstabelecimento.java new file mode 100644 index 00000000..9202f05b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesEstabelecimento.java @@ -0,0 +1,863 @@ +/* +* MarcacoesEstabelecimento.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class MarcacoesEstabelecimento extends siprp.data.Marcacao +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( MarcacoesEstabelecimento.ID, MarcacoesEstabelecimento.ID_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.ID_FULL, MarcacoesEstabelecimento.ID_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.DATA, MarcacoesEstabelecimento.DATA_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.DATA_FULL, MarcacoesEstabelecimento.DATA_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.REALIZADA, MarcacoesEstabelecimento.REALIZADA_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.REALIZADA_FULL, MarcacoesEstabelecimento.REALIZADA_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.DATA_EMAIL, MarcacoesEstabelecimento.DATA_EMAIL_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.DATA_EMAIL_FULL, MarcacoesEstabelecimento.DATA_EMAIL_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.DATA_RELATORIO, MarcacoesEstabelecimento.DATA_RELATORIO_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.DATA_RELATORIO_FULL, MarcacoesEstabelecimento.DATA_RELATORIO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( MarcacoesEstabelecimento.CLASS_IDENTIFIER, MarcacoesEstabelecimento.ESTABELECIMENTO_ID, MarcacoesEstabelecimento.TO_ESTABELECIMENTO_ID ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.ESTABELECIMENTO_ID, MarcacoesEstabelecimento.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.ESTABELECIMENTO_ID_FULL, MarcacoesEstabelecimento.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.TO_ESTABELECIMENTO_ID, MarcacoesEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.ESTADO, MarcacoesEstabelecimento.ESTADO_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.ESTADO_FULL, MarcacoesEstabelecimento.ESTADO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( MarcacoesEstabelecimento.CLASS_IDENTIFIER, MarcacoesEstabelecimento.TECNICO_HST, MarcacoesEstabelecimento.TO_TECNICO_HST ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.TECNICO_HST, MarcacoesEstabelecimento.TECNICO_HST_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.TECNICO_HST_FULL, MarcacoesEstabelecimento.TECNICO_HST_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.TO_TECNICO_HST, MarcacoesEstabelecimento.TO_TECNICO_HST_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.OBSERVACOES, MarcacoesEstabelecimento.OBSERVACOES_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.OBSERVACOES_FULL, MarcacoesEstabelecimento.OBSERVACOES_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( MarcacoesEstabelecimento.CLASS_IDENTIFIER, MarcacoesEstabelecimento.TECNICO_SUPERIOR_HST, MarcacoesEstabelecimento.TO_TECNICO_SUPERIOR_HST ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.TECNICO_SUPERIOR_HST, MarcacoesEstabelecimento.TECNICO_SUPERIOR_HST_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.TECNICO_SUPERIOR_HST_FULL, MarcacoesEstabelecimento.TECNICO_SUPERIOR_HST_INDEX ); + FIELD_INDEXES.put( MarcacoesEstabelecimento.TO_TECNICO_SUPERIOR_HST, MarcacoesEstabelecimento.TO_TECNICO_SUPERIOR_HST_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyestabelecimento_idToestabelecimentos = + new com.evolute.entity.ForeignKey( MarcacoesEstabelecimento.class, MarcacoesEstabelecimento.ESTABELECIMENTO_ID, siprp.data.outer.EstabelecimentosData.class, siprp.data.outer.EstabelecimentosData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeytecnico_hstTomarcacoes_tecnicos_hst = + new com.evolute.entity.ForeignKey( MarcacoesEstabelecimento.class, MarcacoesEstabelecimento.TECNICO_HST, siprp.data.outer.MarcacoesTecnicosHstData.class, siprp.data.outer.MarcacoesTecnicosHstData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeytecnico_superior_hstTomarcacoes_tecnicos_hst = + new com.evolute.entity.ForeignKey( MarcacoesEstabelecimento.class, MarcacoesEstabelecimento.TECNICO_SUPERIOR_HST, siprp.data.outer.MarcacoesTecnicosHstData.class, siprp.data.outer.MarcacoesTecnicosHstData.ID ); + + public static final String TABLENAME = "marcacoes_estabelecimento"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.marcacoes_estabelecimento"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "marcacoes_estabelecimento.id"; + public static final int ID_INDEX = 0; + public static final String DATA = "data"; + public static final String DATA_FULL = "marcacoes_estabelecimento.data"; + public static final int DATA_INDEX = 1; + public static final String REALIZADA = "realizada"; + public static final String REALIZADA_FULL = "marcacoes_estabelecimento.realizada"; + public static final int REALIZADA_INDEX = 2; + public static final String DATA_EMAIL = "data_email"; + public static final String DATA_EMAIL_FULL = "marcacoes_estabelecimento.data_email"; + public static final int DATA_EMAIL_INDEX = 3; + public static final String DATA_RELATORIO = "data_relatorio"; + public static final String DATA_RELATORIO_FULL = "marcacoes_estabelecimento.data_relatorio"; + public static final int DATA_RELATORIO_INDEX = 4; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "marcacoes_estabelecimento.estabelecimento_id"; + public static final int ESTABELECIMENTO_ID_INDEX = 5; + public static final String TO_ESTABELECIMENTO_ID = "to_estabelecimento_id"; + public static final int TO_ESTABELECIMENTO_ID_INDEX = 6; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "marcacoes_estabelecimento.estado"; + public static final int ESTADO_INDEX = 7; + public static final String TECNICO_HST = "tecnico_hst"; + public static final String TECNICO_HST_FULL = "marcacoes_estabelecimento.tecnico_hst"; + public static final int TECNICO_HST_INDEX = 8; + public static final String TO_TECNICO_HST = "to_tecnico_hst"; + public static final int TO_TECNICO_HST_INDEX = 9; + public static final String OBSERVACOES = "observacoes"; + public static final String OBSERVACOES_FULL = "marcacoes_estabelecimento.observacoes"; + public static final int OBSERVACOES_INDEX = 10; + public static final String TECNICO_SUPERIOR_HST = "tecnico_superior_hst"; + public static final String TECNICO_SUPERIOR_HST_FULL = "marcacoes_estabelecimento.tecnico_superior_hst"; + public static final int TECNICO_SUPERIOR_HST_INDEX = 11; + public static final String TO_TECNICO_SUPERIOR_HST = "to_tecnico_superior_hst"; + public static final int TO_TECNICO_SUPERIOR_HST_INDEX = 12; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, REALIZADA, DATA_EMAIL, DATA_RELATORIO, ESTABELECIMENTO_ID, + TO_ESTABELECIMENTO_ID, ESTADO, TECNICO_HST, TO_TECNICO_HST, OBSERVACOES, + TECNICO_SUPERIOR_HST, TO_TECNICO_SUPERIOR_HST, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DATA, TABLENAME + "." + REALIZADA, TABLENAME + "." + DATA_EMAIL, TABLENAME + "." + DATA_RELATORIO, TABLENAME + "." + ESTABELECIMENTO_ID, + TABLENAME + "." + TO_ESTABELECIMENTO_ID, TABLENAME + "." + ESTADO, TABLENAME + "." + TECNICO_HST, TABLENAME + "." + TO_TECNICO_HST, TABLENAME + "." + OBSERVACOES, + TABLENAME + "." + TECNICO_SUPERIOR_HST, TABLENAME + "." + TO_TECNICO_SUPERIOR_HST, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DATA, REALIZADA, DATA_EMAIL, DATA_RELATORIO, ESTABELECIMENTO_ID, ESTADO, + TECNICO_HST, OBSERVACOES, TECNICO_SUPERIOR_HST, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DATA, REALIZADA, DATA_EMAIL, DATA_RELATORIO, ESTABELECIMENTO_ID, ESTADO, + TECNICO_HST, OBSERVACOES, TECNICO_SUPERIOR_HST, }; + + private Integer id; + private java.util.Date data; + private String realizada; + private java.util.Date data_email; + private java.util.Date data_relatorio; + private Integer estabelecimento_id; + private siprp.data.outer.EstabelecimentosData to_estabelecimento_id; + private Integer estado; + private Integer tecnico_hst; + private siprp.data.outer.MarcacoesTecnicosHstData to_tecnico_hst; + private String observacoes; + private Integer tecnico_superior_hst; + private siprp.data.outer.MarcacoesTecnicosHstData to_tecnico_superior_hst; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public MarcacoesEstabelecimento() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false, false, false, false, + false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromHsRelatorio_marcacao_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.HsRelatorioData.class , getPrimaryKey().getMap().get("id"), "marcacao_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromLembretes_marcacao_estabelecimento_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.LembretesData.class , getPrimaryKey().getMap().get("id"), "marcacao_estabelecimento_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.Date getData() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data; + } + + public void setData( java.util.Date data ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA, data ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data = data; + LAZY_LOADED_OBJECTS.put( DATA, Boolean.TRUE ); + } + + public String getRealizada() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( REALIZADA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.realizada; + } + + public void setRealizada( String realizada ) + { + try + { + setLockedForRefresh( true ); + preProcess( REALIZADA, realizada ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.realizada = realizada; + LAZY_LOADED_OBJECTS.put( REALIZADA, Boolean.TRUE ); + } + + public java.util.Date getData_email() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_EMAIL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_email; + } + + public void setData_email( java.util.Date data_email ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_EMAIL, data_email ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_email = data_email; + LAZY_LOADED_OBJECTS.put( DATA_EMAIL, Boolean.TRUE ); + } + + public java.util.Date getData_relatorio() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_RELATORIO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_relatorio; + } + + public void setData_relatorio( java.util.Date data_relatorio ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_RELATORIO, data_relatorio ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_relatorio = data_relatorio; + LAZY_LOADED_OBJECTS.put( DATA_RELATORIO, Boolean.TRUE ); + } + + public Integer getEstabelecimento_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTABELECIMENTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estabelecimento_id; + } + + public void setEstabelecimento_id( Integer estabelecimento_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTABELECIMENTO_ID, estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estabelecimento_id = estabelecimento_id; + LAZY_LOADED_OBJECTS.put( ESTABELECIMENTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EstabelecimentosData toEstabelecimento_id() + { + try + { + prepare( TO_ESTABELECIMENTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_estabelecimento_id; + } + + public void setToEstabelecimento_id( siprp.data.outer.EstabelecimentosData to_estabelecimento_id ) + { + try + { + preProcess( TO_ESTABELECIMENTO_ID, to_estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_estabelecimento_id = to_estabelecimento_id; + } + + public Integer getEstado() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTADO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estado; + } + + public void setEstado( Integer estado ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTADO, estado ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estado = estado; + LAZY_LOADED_OBJECTS.put( ESTADO, Boolean.TRUE ); + } + + public Integer getTecnico_hst() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TECNICO_HST ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.tecnico_hst; + } + + public void setTecnico_hst( Integer tecnico_hst ) + { + try + { + setLockedForRefresh( true ); + preProcess( TECNICO_HST, tecnico_hst ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.tecnico_hst = tecnico_hst; + LAZY_LOADED_OBJECTS.put( TECNICO_HST, Boolean.TRUE ); + } + + public siprp.data.outer.MarcacoesTecnicosHstData toTecnico_hst() + { + try + { + prepare( TO_TECNICO_HST ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_tecnico_hst; + } + + public void setToTecnico_hst( siprp.data.outer.MarcacoesTecnicosHstData to_tecnico_hst ) + { + try + { + preProcess( TO_TECNICO_HST, to_tecnico_hst ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_tecnico_hst = to_tecnico_hst; + } + + public String getObservacoes() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( OBSERVACOES ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.observacoes; + } + + public void setObservacoes( String observacoes ) + { + try + { + setLockedForRefresh( true ); + preProcess( OBSERVACOES, observacoes ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.observacoes = observacoes; + LAZY_LOADED_OBJECTS.put( OBSERVACOES, Boolean.TRUE ); + } + + public Integer getTecnico_superior_hst() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TECNICO_SUPERIOR_HST ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.tecnico_superior_hst; + } + + public void setTecnico_superior_hst( Integer tecnico_superior_hst ) + { + try + { + setLockedForRefresh( true ); + preProcess( TECNICO_SUPERIOR_HST, tecnico_superior_hst ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.tecnico_superior_hst = tecnico_superior_hst; + LAZY_LOADED_OBJECTS.put( TECNICO_SUPERIOR_HST, Boolean.TRUE ); + } + + public siprp.data.outer.MarcacoesTecnicosHstData toTecnico_superior_hst() + { + try + { + prepare( TO_TECNICO_SUPERIOR_HST ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_tecnico_superior_hst; + } + + public void setToTecnico_superior_hst( siprp.data.outer.MarcacoesTecnicosHstData to_tecnico_superior_hst ) + { + try + { + preProcess( TO_TECNICO_SUPERIOR_HST, to_tecnico_superior_hst ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_tecnico_superior_hst = to_tecnico_superior_hst; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesEstabelecimento.ID_INDEX: + value = getId(); + break; + case MarcacoesEstabelecimento.DATA_INDEX: + value = getData(); + break; + case MarcacoesEstabelecimento.REALIZADA_INDEX: + value = getRealizada(); + break; + case MarcacoesEstabelecimento.DATA_EMAIL_INDEX: + value = getData_email(); + break; + case MarcacoesEstabelecimento.DATA_RELATORIO_INDEX: + value = getData_relatorio(); + break; + case MarcacoesEstabelecimento.ESTABELECIMENTO_ID_INDEX: + value = getEstabelecimento_id(); + break; + case MarcacoesEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + value = toEstabelecimento_id(); + break; + case MarcacoesEstabelecimento.ESTADO_INDEX: + value = getEstado(); + break; + case MarcacoesEstabelecimento.TECNICO_HST_INDEX: + value = getTecnico_hst(); + break; + case MarcacoesEstabelecimento.TO_TECNICO_HST_INDEX: + value = toTecnico_hst(); + break; + case MarcacoesEstabelecimento.OBSERVACOES_INDEX: + value = getObservacoes(); + break; + case MarcacoesEstabelecimento.TECNICO_SUPERIOR_HST_INDEX: + value = getTecnico_superior_hst(); + break; + case MarcacoesEstabelecimento.TO_TECNICO_SUPERIOR_HST_INDEX: + value = toTecnico_superior_hst(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesEstabelecimento.ID_INDEX: + value = this.id; + break; + case MarcacoesEstabelecimento.DATA_INDEX: + value = this.data; + break; + case MarcacoesEstabelecimento.REALIZADA_INDEX: + value = this.realizada; + break; + case MarcacoesEstabelecimento.DATA_EMAIL_INDEX: + value = this.data_email; + break; + case MarcacoesEstabelecimento.DATA_RELATORIO_INDEX: + value = this.data_relatorio; + break; + case MarcacoesEstabelecimento.ESTABELECIMENTO_ID_INDEX: + value = this.estabelecimento_id; + break; + case MarcacoesEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + value = this.to_estabelecimento_id; + break; + case MarcacoesEstabelecimento.ESTADO_INDEX: + value = this.estado; + break; + case MarcacoesEstabelecimento.TECNICO_HST_INDEX: + value = this.tecnico_hst; + break; + case MarcacoesEstabelecimento.TO_TECNICO_HST_INDEX: + value = this.to_tecnico_hst; + break; + case MarcacoesEstabelecimento.OBSERVACOES_INDEX: + value = this.observacoes; + break; + case MarcacoesEstabelecimento.TECNICO_SUPERIOR_HST_INDEX: + value = this.tecnico_superior_hst; + break; + case MarcacoesEstabelecimento.TO_TECNICO_SUPERIOR_HST_INDEX: + value = this.to_tecnico_superior_hst; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesEstabelecimento.ID_INDEX: + setId( ( Integer ) value ); + break; + case MarcacoesEstabelecimento.DATA_INDEX: + setData( ( java.util.Date ) value ); + break; + case MarcacoesEstabelecimento.REALIZADA_INDEX: + setRealizada( ( String ) value ); + break; + case MarcacoesEstabelecimento.DATA_EMAIL_INDEX: + setData_email( ( java.util.Date ) value ); + break; + case MarcacoesEstabelecimento.DATA_RELATORIO_INDEX: + setData_relatorio( ( java.util.Date ) value ); + break; + case MarcacoesEstabelecimento.ESTABELECIMENTO_ID_INDEX: + setEstabelecimento_id( ( Integer ) value ); + break; + case MarcacoesEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + setToEstabelecimento_id( ( siprp.data.outer.EstabelecimentosData ) value ); + break; + case MarcacoesEstabelecimento.ESTADO_INDEX: + setEstado( ( Integer ) value ); + break; + case MarcacoesEstabelecimento.TECNICO_HST_INDEX: + setTecnico_hst( ( Integer ) value ); + break; + case MarcacoesEstabelecimento.TO_TECNICO_HST_INDEX: + setToTecnico_hst( ( siprp.data.outer.MarcacoesTecnicosHstData ) value ); + break; + case MarcacoesEstabelecimento.OBSERVACOES_INDEX: + setObservacoes( ( String ) value ); + break; + case MarcacoesEstabelecimento.TECNICO_SUPERIOR_HST_INDEX: + setTecnico_superior_hst( ( Integer ) value ); + break; + case MarcacoesEstabelecimento.TO_TECNICO_SUPERIOR_HST_INDEX: + setToTecnico_superior_hst( ( siprp.data.outer.MarcacoesTecnicosHstData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesEstabelecimento.ID_INDEX: + this.id = ( Integer ) value; + break; + case MarcacoesEstabelecimento.DATA_INDEX: + this.data = ( java.util.Date ) value; + break; + case MarcacoesEstabelecimento.REALIZADA_INDEX: + this.realizada = ( String ) value; + break; + case MarcacoesEstabelecimento.DATA_EMAIL_INDEX: + this.data_email = ( java.util.Date ) value; + break; + case MarcacoesEstabelecimento.DATA_RELATORIO_INDEX: + this.data_relatorio = ( java.util.Date ) value; + break; + case MarcacoesEstabelecimento.ESTABELECIMENTO_ID_INDEX: + this.estabelecimento_id = ( Integer ) value; + break; + case MarcacoesEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + this.to_estabelecimento_id = ( siprp.data.outer.EstabelecimentosData ) value; + break; + case MarcacoesEstabelecimento.ESTADO_INDEX: + this.estado = ( Integer ) value; + break; + case MarcacoesEstabelecimento.TECNICO_HST_INDEX: + this.tecnico_hst = ( Integer ) value; + break; + case MarcacoesEstabelecimento.TO_TECNICO_HST_INDEX: + this.to_tecnico_hst = ( siprp.data.outer.MarcacoesTecnicosHstData ) value; + break; + case MarcacoesEstabelecimento.OBSERVACOES_INDEX: + this.observacoes = ( String ) value; + break; + case MarcacoesEstabelecimento.TECNICO_SUPERIOR_HST_INDEX: + this.tecnico_superior_hst = ( Integer ) value; + break; + case MarcacoesEstabelecimento.TO_TECNICO_SUPERIOR_HST_INDEX: + this.to_tecnico_superior_hst = ( siprp.data.outer.MarcacoesTecnicosHstData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case MarcacoesEstabelecimento.ID_INDEX: + theClass = Integer.class; + break; + case MarcacoesEstabelecimento.DATA_INDEX: + theClass = java.util.Date.class; + break; + case MarcacoesEstabelecimento.REALIZADA_INDEX: + theClass = String.class; + break; + case MarcacoesEstabelecimento.DATA_EMAIL_INDEX: + theClass = java.util.Date.class; + break; + case MarcacoesEstabelecimento.DATA_RELATORIO_INDEX: + theClass = java.util.Date.class; + break; + case MarcacoesEstabelecimento.ESTABELECIMENTO_ID_INDEX: + theClass = Integer.class; + break; + case MarcacoesEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX: + theClass = siprp.data.outer.EstabelecimentosData.class; + break; + case MarcacoesEstabelecimento.ESTADO_INDEX: + theClass = Integer.class; + break; + case MarcacoesEstabelecimento.TECNICO_HST_INDEX: + theClass = Integer.class; + break; + case MarcacoesEstabelecimento.TO_TECNICO_HST_INDEX: + theClass = siprp.data.outer.MarcacoesTecnicosHstData.class; + break; + case MarcacoesEstabelecimento.OBSERVACOES_INDEX: + theClass = String.class; + break; + case MarcacoesEstabelecimento.TECNICO_SUPERIOR_HST_INDEX: + theClass = Integer.class; + break; + case MarcacoesEstabelecimento.TO_TECNICO_SUPERIOR_HST_INDEX: + theClass = siprp.data.outer.MarcacoesTecnicosHstData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : MarcacoesEstabelecimento._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, MarcacoesEstabelecimento.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesGruposRealizados.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesGruposRealizados.java new file mode 100644 index 00000000..f36ee814 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesGruposRealizados.java @@ -0,0 +1,534 @@ +/* +* MarcacoesGruposRealizados.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class MarcacoesGruposRealizados extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( MarcacoesGruposRealizados.ID, MarcacoesGruposRealizados.ID_INDEX ); + FIELD_INDEXES.put( MarcacoesGruposRealizados.ID_FULL, MarcacoesGruposRealizados.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( MarcacoesGruposRealizados.CLASS_IDENTIFIER, MarcacoesGruposRealizados.MARCACAO_TRABALHADOR_ID, MarcacoesGruposRealizados.TO_MARCACAO_TRABALHADOR_ID ); + FIELD_INDEXES.put( MarcacoesGruposRealizados.MARCACAO_TRABALHADOR_ID, MarcacoesGruposRealizados.MARCACAO_TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesGruposRealizados.MARCACAO_TRABALHADOR_ID_FULL, MarcacoesGruposRealizados.MARCACAO_TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesGruposRealizados.TO_MARCACAO_TRABALHADOR_ID, MarcacoesGruposRealizados.TO_MARCACAO_TRABALHADOR_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( MarcacoesGruposRealizados.CLASS_IDENTIFIER, MarcacoesGruposRealizados.GRUPO_PROTOCOLO_ID, MarcacoesGruposRealizados.TO_GRUPO_PROTOCOLO_ID ); + FIELD_INDEXES.put( MarcacoesGruposRealizados.GRUPO_PROTOCOLO_ID, MarcacoesGruposRealizados.GRUPO_PROTOCOLO_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesGruposRealizados.GRUPO_PROTOCOLO_ID_FULL, MarcacoesGruposRealizados.GRUPO_PROTOCOLO_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesGruposRealizados.TO_GRUPO_PROTOCOLO_ID, MarcacoesGruposRealizados.TO_GRUPO_PROTOCOLO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( MarcacoesGruposRealizados.CLASS_IDENTIFIER, MarcacoesGruposRealizados.MARCACOES_TRABALHADOR_ESTADO_ID, MarcacoesGruposRealizados.TO_MARCACOES_TRABALHADOR_ESTADO_ID ); + FIELD_INDEXES.put( MarcacoesGruposRealizados.MARCACOES_TRABALHADOR_ESTADO_ID, MarcacoesGruposRealizados.MARCACOES_TRABALHADOR_ESTADO_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesGruposRealizados.MARCACOES_TRABALHADOR_ESTADO_ID_FULL, MarcacoesGruposRealizados.MARCACOES_TRABALHADOR_ESTADO_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesGruposRealizados.TO_MARCACOES_TRABALHADOR_ESTADO_ID, MarcacoesGruposRealizados.TO_MARCACOES_TRABALHADOR_ESTADO_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeymarcacao_trabalhador_idTomarcacoes_trabalhador = + new com.evolute.entity.ForeignKey( MarcacoesGruposRealizados.class, MarcacoesGruposRealizados.MARCACAO_TRABALHADOR_ID, siprp.data.outer.MarcacoesTrabalhadorData.class, siprp.data.outer.MarcacoesTrabalhadorData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeygrupo_protocolo_idToprt_grupos_protocolo = + new com.evolute.entity.ForeignKey( MarcacoesGruposRealizados.class, MarcacoesGruposRealizados.GRUPO_PROTOCOLO_ID, siprp.data.outer.PrtGruposProtocoloData.class, siprp.data.outer.PrtGruposProtocoloData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeymarcacoes_trabalhador_estado_idTomarcacoes_trabalhador_estados = + new com.evolute.entity.ForeignKey( MarcacoesGruposRealizados.class, MarcacoesGruposRealizados.MARCACOES_TRABALHADOR_ESTADO_ID, siprp.data.outer.MarcacoesTrabalhadorEstadosData.class, siprp.data.outer.MarcacoesTrabalhadorEstadosData.ID ); + + public static final String TABLENAME = "marcacoes_grupos_realizados"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.marcacoes_grupos_realizados"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "marcacoes_grupos_realizados.id"; + public static final int ID_INDEX = 0; + public static final String MARCACAO_TRABALHADOR_ID = "marcacao_trabalhador_id"; + public static final String MARCACAO_TRABALHADOR_ID_FULL = "marcacoes_grupos_realizados.marcacao_trabalhador_id"; + public static final int MARCACAO_TRABALHADOR_ID_INDEX = 1; + public static final String TO_MARCACAO_TRABALHADOR_ID = "to_marcacao_trabalhador_id"; + public static final int TO_MARCACAO_TRABALHADOR_ID_INDEX = 2; + public static final String GRUPO_PROTOCOLO_ID = "grupo_protocolo_id"; + public static final String GRUPO_PROTOCOLO_ID_FULL = "marcacoes_grupos_realizados.grupo_protocolo_id"; + public static final int GRUPO_PROTOCOLO_ID_INDEX = 3; + public static final String TO_GRUPO_PROTOCOLO_ID = "to_grupo_protocolo_id"; + public static final int TO_GRUPO_PROTOCOLO_ID_INDEX = 4; + public static final String MARCACOES_TRABALHADOR_ESTADO_ID = "marcacoes_trabalhador_estado_id"; + public static final String MARCACOES_TRABALHADOR_ESTADO_ID_FULL = "marcacoes_grupos_realizados.marcacoes_trabalhador_estado_id"; + public static final int MARCACOES_TRABALHADOR_ESTADO_ID_INDEX = 5; + public static final String TO_MARCACOES_TRABALHADOR_ESTADO_ID = "to_marcacoes_trabalhador_estado_id"; + public static final int TO_MARCACOES_TRABALHADOR_ESTADO_ID_INDEX = 6; + + public static final String FIELD_NAMES[] = new String[]{ + MARCACAO_TRABALHADOR_ID, TO_MARCACAO_TRABALHADOR_ID, GRUPO_PROTOCOLO_ID, + TO_GRUPO_PROTOCOLO_ID, MARCACOES_TRABALHADOR_ESTADO_ID, + TO_MARCACOES_TRABALHADOR_ESTADO_ID, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + MARCACAO_TRABALHADOR_ID, TABLENAME + "." + TO_MARCACAO_TRABALHADOR_ID, TABLENAME + "." + GRUPO_PROTOCOLO_ID, + TABLENAME + "." + TO_GRUPO_PROTOCOLO_ID, TABLENAME + "." + MARCACOES_TRABALHADOR_ESTADO_ID, + TABLENAME + "." + TO_MARCACOES_TRABALHADOR_ESTADO_ID, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, MARCACAO_TRABALHADOR_ID, GRUPO_PROTOCOLO_ID, + MARCACOES_TRABALHADOR_ESTADO_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, MARCACAO_TRABALHADOR_ID, GRUPO_PROTOCOLO_ID, + MARCACOES_TRABALHADOR_ESTADO_ID, }; + + private Integer id; + private Integer marcacao_trabalhador_id; + private siprp.data.outer.MarcacoesTrabalhadorData to_marcacao_trabalhador_id; + private Integer grupo_protocolo_id; + private siprp.data.outer.PrtGruposProtocoloData to_grupo_protocolo_id; + private Integer marcacoes_trabalhador_estado_id; + private siprp.data.outer.MarcacoesTrabalhadorEstadosData to_marcacoes_trabalhador_estado_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public MarcacoesGruposRealizados() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public Integer getMarcacao_trabalhador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MARCACAO_TRABALHADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.marcacao_trabalhador_id; + } + + public void setMarcacao_trabalhador_id( Integer marcacao_trabalhador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( MARCACAO_TRABALHADOR_ID, marcacao_trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.marcacao_trabalhador_id = marcacao_trabalhador_id; + LAZY_LOADED_OBJECTS.put( MARCACAO_TRABALHADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.MarcacoesTrabalhadorData toMarcacao_trabalhador_id() + { + try + { + prepare( TO_MARCACAO_TRABALHADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_marcacao_trabalhador_id; + } + + public void setToMarcacao_trabalhador_id( siprp.data.outer.MarcacoesTrabalhadorData to_marcacao_trabalhador_id ) + { + try + { + preProcess( TO_MARCACAO_TRABALHADOR_ID, to_marcacao_trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_marcacao_trabalhador_id = to_marcacao_trabalhador_id; + } + + public Integer getGrupo_protocolo_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( GRUPO_PROTOCOLO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.grupo_protocolo_id; + } + + public void setGrupo_protocolo_id( Integer grupo_protocolo_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( GRUPO_PROTOCOLO_ID, grupo_protocolo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.grupo_protocolo_id = grupo_protocolo_id; + LAZY_LOADED_OBJECTS.put( GRUPO_PROTOCOLO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrtGruposProtocoloData toGrupo_protocolo_id() + { + try + { + prepare( TO_GRUPO_PROTOCOLO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_grupo_protocolo_id; + } + + public void setToGrupo_protocolo_id( siprp.data.outer.PrtGruposProtocoloData to_grupo_protocolo_id ) + { + try + { + preProcess( TO_GRUPO_PROTOCOLO_ID, to_grupo_protocolo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_grupo_protocolo_id = to_grupo_protocolo_id; + } + + public Integer getMarcacoes_trabalhador_estado_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MARCACOES_TRABALHADOR_ESTADO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.marcacoes_trabalhador_estado_id; + } + + public void setMarcacoes_trabalhador_estado_id( Integer marcacoes_trabalhador_estado_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( MARCACOES_TRABALHADOR_ESTADO_ID, marcacoes_trabalhador_estado_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.marcacoes_trabalhador_estado_id = marcacoes_trabalhador_estado_id; + LAZY_LOADED_OBJECTS.put( MARCACOES_TRABALHADOR_ESTADO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.MarcacoesTrabalhadorEstadosData toMarcacoes_trabalhador_estado_id() + { + try + { + prepare( TO_MARCACOES_TRABALHADOR_ESTADO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_marcacoes_trabalhador_estado_id; + } + + public void setToMarcacoes_trabalhador_estado_id( siprp.data.outer.MarcacoesTrabalhadorEstadosData to_marcacoes_trabalhador_estado_id ) + { + try + { + preProcess( TO_MARCACOES_TRABALHADOR_ESTADO_ID, to_marcacoes_trabalhador_estado_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_marcacoes_trabalhador_estado_id = to_marcacoes_trabalhador_estado_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesGruposRealizados.ID_INDEX: + value = getId(); + break; + case MarcacoesGruposRealizados.MARCACAO_TRABALHADOR_ID_INDEX: + value = getMarcacao_trabalhador_id(); + break; + case MarcacoesGruposRealizados.TO_MARCACAO_TRABALHADOR_ID_INDEX: + value = toMarcacao_trabalhador_id(); + break; + case MarcacoesGruposRealizados.GRUPO_PROTOCOLO_ID_INDEX: + value = getGrupo_protocolo_id(); + break; + case MarcacoesGruposRealizados.TO_GRUPO_PROTOCOLO_ID_INDEX: + value = toGrupo_protocolo_id(); + break; + case MarcacoesGruposRealizados.MARCACOES_TRABALHADOR_ESTADO_ID_INDEX: + value = getMarcacoes_trabalhador_estado_id(); + break; + case MarcacoesGruposRealizados.TO_MARCACOES_TRABALHADOR_ESTADO_ID_INDEX: + value = toMarcacoes_trabalhador_estado_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesGruposRealizados.ID_INDEX: + value = this.id; + break; + case MarcacoesGruposRealizados.MARCACAO_TRABALHADOR_ID_INDEX: + value = this.marcacao_trabalhador_id; + break; + case MarcacoesGruposRealizados.TO_MARCACAO_TRABALHADOR_ID_INDEX: + value = this.to_marcacao_trabalhador_id; + break; + case MarcacoesGruposRealizados.GRUPO_PROTOCOLO_ID_INDEX: + value = this.grupo_protocolo_id; + break; + case MarcacoesGruposRealizados.TO_GRUPO_PROTOCOLO_ID_INDEX: + value = this.to_grupo_protocolo_id; + break; + case MarcacoesGruposRealizados.MARCACOES_TRABALHADOR_ESTADO_ID_INDEX: + value = this.marcacoes_trabalhador_estado_id; + break; + case MarcacoesGruposRealizados.TO_MARCACOES_TRABALHADOR_ESTADO_ID_INDEX: + value = this.to_marcacoes_trabalhador_estado_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesGruposRealizados.ID_INDEX: + setId( ( Integer ) value ); + break; + case MarcacoesGruposRealizados.MARCACAO_TRABALHADOR_ID_INDEX: + setMarcacao_trabalhador_id( ( Integer ) value ); + break; + case MarcacoesGruposRealizados.TO_MARCACAO_TRABALHADOR_ID_INDEX: + setToMarcacao_trabalhador_id( ( siprp.data.outer.MarcacoesTrabalhadorData ) value ); + break; + case MarcacoesGruposRealizados.GRUPO_PROTOCOLO_ID_INDEX: + setGrupo_protocolo_id( ( Integer ) value ); + break; + case MarcacoesGruposRealizados.TO_GRUPO_PROTOCOLO_ID_INDEX: + setToGrupo_protocolo_id( ( siprp.data.outer.PrtGruposProtocoloData ) value ); + break; + case MarcacoesGruposRealizados.MARCACOES_TRABALHADOR_ESTADO_ID_INDEX: + setMarcacoes_trabalhador_estado_id( ( Integer ) value ); + break; + case MarcacoesGruposRealizados.TO_MARCACOES_TRABALHADOR_ESTADO_ID_INDEX: + setToMarcacoes_trabalhador_estado_id( ( siprp.data.outer.MarcacoesTrabalhadorEstadosData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesGruposRealizados.ID_INDEX: + this.id = ( Integer ) value; + break; + case MarcacoesGruposRealizados.MARCACAO_TRABALHADOR_ID_INDEX: + this.marcacao_trabalhador_id = ( Integer ) value; + break; + case MarcacoesGruposRealizados.TO_MARCACAO_TRABALHADOR_ID_INDEX: + this.to_marcacao_trabalhador_id = ( siprp.data.outer.MarcacoesTrabalhadorData ) value; + break; + case MarcacoesGruposRealizados.GRUPO_PROTOCOLO_ID_INDEX: + this.grupo_protocolo_id = ( Integer ) value; + break; + case MarcacoesGruposRealizados.TO_GRUPO_PROTOCOLO_ID_INDEX: + this.to_grupo_protocolo_id = ( siprp.data.outer.PrtGruposProtocoloData ) value; + break; + case MarcacoesGruposRealizados.MARCACOES_TRABALHADOR_ESTADO_ID_INDEX: + this.marcacoes_trabalhador_estado_id = ( Integer ) value; + break; + case MarcacoesGruposRealizados.TO_MARCACOES_TRABALHADOR_ESTADO_ID_INDEX: + this.to_marcacoes_trabalhador_estado_id = ( siprp.data.outer.MarcacoesTrabalhadorEstadosData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case MarcacoesGruposRealizados.ID_INDEX: + theClass = Integer.class; + break; + case MarcacoesGruposRealizados.MARCACAO_TRABALHADOR_ID_INDEX: + theClass = Integer.class; + break; + case MarcacoesGruposRealizados.TO_MARCACAO_TRABALHADOR_ID_INDEX: + theClass = siprp.data.outer.MarcacoesTrabalhadorData.class; + break; + case MarcacoesGruposRealizados.GRUPO_PROTOCOLO_ID_INDEX: + theClass = Integer.class; + break; + case MarcacoesGruposRealizados.TO_GRUPO_PROTOCOLO_ID_INDEX: + theClass = siprp.data.outer.PrtGruposProtocoloData.class; + break; + case MarcacoesGruposRealizados.MARCACOES_TRABALHADOR_ESTADO_ID_INDEX: + theClass = Integer.class; + break; + case MarcacoesGruposRealizados.TO_MARCACOES_TRABALHADOR_ESTADO_ID_INDEX: + theClass = siprp.data.outer.MarcacoesTrabalhadorEstadosData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : MarcacoesGruposRealizados._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, MarcacoesGruposRealizados.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesTecnicosHst.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesTecnicosHst.java new file mode 100644 index 00000000..d44d7238 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesTecnicosHst.java @@ -0,0 +1,762 @@ +/* +* MarcacoesTecnicosHst.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class MarcacoesTecnicosHst extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( MarcacoesTecnicosHst.ID, MarcacoesTecnicosHst.ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.ID_FULL, MarcacoesTecnicosHst.ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.NOME, MarcacoesTecnicosHst.NOME_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.NOME_FULL, MarcacoesTecnicosHst.NOME_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.NOME_PLAIN, MarcacoesTecnicosHst.NOME_PLAIN_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.NOME_PLAIN_FULL, MarcacoesTecnicosHst.NOME_PLAIN_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.INICIAIS, MarcacoesTecnicosHst.INICIAIS_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.INICIAIS_FULL, MarcacoesTecnicosHst.INICIAIS_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.IDENTIFICADOR, MarcacoesTecnicosHst.IDENTIFICADOR_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.IDENTIFICADOR_FULL, MarcacoesTecnicosHst.IDENTIFICADOR_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.INACTIVO, MarcacoesTecnicosHst.INACTIVO_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.INACTIVO_FULL, MarcacoesTecnicosHst.INACTIVO_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.CAP, MarcacoesTecnicosHst.CAP_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.CAP_FULL, MarcacoesTecnicosHst.CAP_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.FORMACAO, MarcacoesTecnicosHst.FORMACAO_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.FORMACAO_FULL, MarcacoesTecnicosHst.FORMACAO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( MarcacoesTecnicosHst.CLASS_IDENTIFIER, MarcacoesTecnicosHst.ASSINATURA, MarcacoesTecnicosHst.TO_ASSINATURA ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.ASSINATURA, MarcacoesTecnicosHst.ASSINATURA_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.ASSINATURA_FULL, MarcacoesTecnicosHst.ASSINATURA_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.TO_ASSINATURA, MarcacoesTecnicosHst.TO_ASSINATURA_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.IS_SUPERIOR, MarcacoesTecnicosHst.IS_SUPERIOR_INDEX ); + FIELD_INDEXES.put( MarcacoesTecnicosHst.IS_SUPERIOR_FULL, MarcacoesTecnicosHst.IS_SUPERIOR_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyassinaturaToimage = + new com.evolute.entity.ForeignKey( MarcacoesTecnicosHst.class, MarcacoesTecnicosHst.ASSINATURA, siprp.data.outer.ImageData.class, siprp.data.outer.ImageData.ID ); + + public static final String TABLENAME = "marcacoes_tecnicos_hst"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.marcacoes_tecnicos_hst"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "marcacoes_tecnicos_hst.id"; + public static final int ID_INDEX = 0; + public static final String NOME = "nome"; + public static final String NOME_FULL = "marcacoes_tecnicos_hst.nome"; + public static final int NOME_INDEX = 1; + public static final String NOME_PLAIN = "nome_plain"; + public static final String NOME_PLAIN_FULL = "marcacoes_tecnicos_hst.nome_plain"; + public static final int NOME_PLAIN_INDEX = 2; + public static final String INICIAIS = "iniciais"; + public static final String INICIAIS_FULL = "marcacoes_tecnicos_hst.iniciais"; + public static final int INICIAIS_INDEX = 3; + public static final String IDENTIFICADOR = "identificador"; + public static final String IDENTIFICADOR_FULL = "marcacoes_tecnicos_hst.identificador"; + public static final int IDENTIFICADOR_INDEX = 4; + public static final String INACTIVO = "inactivo"; + public static final String INACTIVO_FULL = "marcacoes_tecnicos_hst.inactivo"; + public static final int INACTIVO_INDEX = 5; + public static final String CAP = "cap"; + public static final String CAP_FULL = "marcacoes_tecnicos_hst.cap"; + public static final int CAP_INDEX = 6; + public static final String FORMACAO = "formacao"; + public static final String FORMACAO_FULL = "marcacoes_tecnicos_hst.formacao"; + public static final int FORMACAO_INDEX = 7; + public static final String ASSINATURA = "assinatura"; + public static final String ASSINATURA_FULL = "marcacoes_tecnicos_hst.assinatura"; + public static final int ASSINATURA_INDEX = 8; + public static final String TO_ASSINATURA = "to_assinatura"; + public static final int TO_ASSINATURA_INDEX = 9; + public static final String IS_SUPERIOR = "is_superior"; + public static final String IS_SUPERIOR_FULL = "marcacoes_tecnicos_hst.is_superior"; + public static final int IS_SUPERIOR_INDEX = 10; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, NOME_PLAIN, INICIAIS, IDENTIFICADOR, INACTIVO, CAP, FORMACAO, ASSINATURA, + TO_ASSINATURA, IS_SUPERIOR, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + NOME, TABLENAME + "." + NOME_PLAIN, TABLENAME + "." + INICIAIS, TABLENAME + "." + IDENTIFICADOR, TABLENAME + "." + INACTIVO, TABLENAME + "." + CAP, TABLENAME + "." + FORMACAO, TABLENAME + "." + ASSINATURA, + TABLENAME + "." + TO_ASSINATURA, TABLENAME + "." + IS_SUPERIOR, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, NOME, NOME_PLAIN, INICIAIS, IDENTIFICADOR, INACTIVO, CAP, FORMACAO, ASSINATURA, + IS_SUPERIOR, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, NOME, NOME_PLAIN, INICIAIS, IDENTIFICADOR, INACTIVO, CAP, FORMACAO, ASSINATURA, + IS_SUPERIOR, }; + + private Integer id; + private String nome; + private String nome_plain; + private String iniciais; + private Integer identificador; + private String inactivo; + private String cap; + private String formacao; + private Integer assinatura; + private siprp.data.outer.ImageData to_assinatura; + private String is_superior; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public MarcacoesTecnicosHst() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromMarcacoesEstabelecimento_tecnico_hst() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.MarcacoesEstabelecimentoData.class , getPrimaryKey().getMap().get("id"), "tecnico_hst" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromMarcacoesEstabelecimento_tecnico_superior_hst() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.MarcacoesEstabelecimentoData.class , getPrimaryKey().getMap().get("id"), "tecnico_superior_hst" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getNome() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NOME ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.nome; + } + + public void setNome( String nome ) + { + try + { + setLockedForRefresh( true ); + preProcess( NOME, nome ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.nome = nome; + LAZY_LOADED_OBJECTS.put( NOME, Boolean.TRUE ); + } + + public String getNome_plain() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NOME_PLAIN ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.nome_plain; + } + + public void setNome_plain( String nome_plain ) + { + try + { + setLockedForRefresh( true ); + preProcess( NOME_PLAIN, nome_plain ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.nome_plain = nome_plain; + LAZY_LOADED_OBJECTS.put( NOME_PLAIN, Boolean.TRUE ); + } + + public String getIniciais() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( INICIAIS ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.iniciais; + } + + public void setIniciais( String iniciais ) + { + try + { + setLockedForRefresh( true ); + preProcess( INICIAIS, iniciais ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.iniciais = iniciais; + LAZY_LOADED_OBJECTS.put( INICIAIS, Boolean.TRUE ); + } + + public Integer getIdentificador() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( IDENTIFICADOR ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.identificador; + } + + public void setIdentificador( Integer identificador ) + { + try + { + setLockedForRefresh( true ); + preProcess( IDENTIFICADOR, identificador ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.identificador = identificador; + LAZY_LOADED_OBJECTS.put( IDENTIFICADOR, Boolean.TRUE ); + } + + public String getInactivo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( INACTIVO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.inactivo; + } + + public void setInactivo( String inactivo ) + { + try + { + setLockedForRefresh( true ); + preProcess( INACTIVO, inactivo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.inactivo = inactivo; + LAZY_LOADED_OBJECTS.put( INACTIVO, Boolean.TRUE ); + } + + public String getCap() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CAP ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.cap; + } + + public void setCap( String cap ) + { + try + { + setLockedForRefresh( true ); + preProcess( CAP, cap ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.cap = cap; + LAZY_LOADED_OBJECTS.put( CAP, Boolean.TRUE ); + } + + public String getFormacao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( FORMACAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.formacao; + } + + public void setFormacao( String formacao ) + { + try + { + setLockedForRefresh( true ); + preProcess( FORMACAO, formacao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.formacao = formacao; + LAZY_LOADED_OBJECTS.put( FORMACAO, Boolean.TRUE ); + } + + public Integer getAssinatura() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ASSINATURA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.assinatura; + } + + public void setAssinatura( Integer assinatura ) + { + try + { + setLockedForRefresh( true ); + preProcess( ASSINATURA, assinatura ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.assinatura = assinatura; + LAZY_LOADED_OBJECTS.put( ASSINATURA, Boolean.TRUE ); + } + + public siprp.data.outer.ImageData toAssinatura() + { + try + { + prepare( TO_ASSINATURA ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_assinatura; + } + + public void setToAssinatura( siprp.data.outer.ImageData to_assinatura ) + { + try + { + preProcess( TO_ASSINATURA, to_assinatura ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_assinatura = to_assinatura; + } + + public String getIs_superior() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( IS_SUPERIOR ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.is_superior; + } + + public void setIs_superior( String is_superior ) + { + try + { + setLockedForRefresh( true ); + preProcess( IS_SUPERIOR, is_superior ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.is_superior = is_superior; + LAZY_LOADED_OBJECTS.put( IS_SUPERIOR, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesTecnicosHst.ID_INDEX: + value = getId(); + break; + case MarcacoesTecnicosHst.NOME_INDEX: + value = getNome(); + break; + case MarcacoesTecnicosHst.NOME_PLAIN_INDEX: + value = getNome_plain(); + break; + case MarcacoesTecnicosHst.INICIAIS_INDEX: + value = getIniciais(); + break; + case MarcacoesTecnicosHst.IDENTIFICADOR_INDEX: + value = getIdentificador(); + break; + case MarcacoesTecnicosHst.INACTIVO_INDEX: + value = getInactivo(); + break; + case MarcacoesTecnicosHst.CAP_INDEX: + value = getCap(); + break; + case MarcacoesTecnicosHst.FORMACAO_INDEX: + value = getFormacao(); + break; + case MarcacoesTecnicosHst.ASSINATURA_INDEX: + value = getAssinatura(); + break; + case MarcacoesTecnicosHst.TO_ASSINATURA_INDEX: + value = toAssinatura(); + break; + case MarcacoesTecnicosHst.IS_SUPERIOR_INDEX: + value = getIs_superior(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesTecnicosHst.ID_INDEX: + value = this.id; + break; + case MarcacoesTecnicosHst.NOME_INDEX: + value = this.nome; + break; + case MarcacoesTecnicosHst.NOME_PLAIN_INDEX: + value = this.nome_plain; + break; + case MarcacoesTecnicosHst.INICIAIS_INDEX: + value = this.iniciais; + break; + case MarcacoesTecnicosHst.IDENTIFICADOR_INDEX: + value = this.identificador; + break; + case MarcacoesTecnicosHst.INACTIVO_INDEX: + value = this.inactivo; + break; + case MarcacoesTecnicosHst.CAP_INDEX: + value = this.cap; + break; + case MarcacoesTecnicosHst.FORMACAO_INDEX: + value = this.formacao; + break; + case MarcacoesTecnicosHst.ASSINATURA_INDEX: + value = this.assinatura; + break; + case MarcacoesTecnicosHst.TO_ASSINATURA_INDEX: + value = this.to_assinatura; + break; + case MarcacoesTecnicosHst.IS_SUPERIOR_INDEX: + value = this.is_superior; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesTecnicosHst.ID_INDEX: + setId( ( Integer ) value ); + break; + case MarcacoesTecnicosHst.NOME_INDEX: + setNome( ( String ) value ); + break; + case MarcacoesTecnicosHst.NOME_PLAIN_INDEX: + setNome_plain( ( String ) value ); + break; + case MarcacoesTecnicosHst.INICIAIS_INDEX: + setIniciais( ( String ) value ); + break; + case MarcacoesTecnicosHst.IDENTIFICADOR_INDEX: + setIdentificador( ( Integer ) value ); + break; + case MarcacoesTecnicosHst.INACTIVO_INDEX: + setInactivo( ( String ) value ); + break; + case MarcacoesTecnicosHst.CAP_INDEX: + setCap( ( String ) value ); + break; + case MarcacoesTecnicosHst.FORMACAO_INDEX: + setFormacao( ( String ) value ); + break; + case MarcacoesTecnicosHst.ASSINATURA_INDEX: + setAssinatura( ( Integer ) value ); + break; + case MarcacoesTecnicosHst.TO_ASSINATURA_INDEX: + setToAssinatura( ( siprp.data.outer.ImageData ) value ); + break; + case MarcacoesTecnicosHst.IS_SUPERIOR_INDEX: + setIs_superior( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesTecnicosHst.ID_INDEX: + this.id = ( Integer ) value; + break; + case MarcacoesTecnicosHst.NOME_INDEX: + this.nome = ( String ) value; + break; + case MarcacoesTecnicosHst.NOME_PLAIN_INDEX: + this.nome_plain = ( String ) value; + break; + case MarcacoesTecnicosHst.INICIAIS_INDEX: + this.iniciais = ( String ) value; + break; + case MarcacoesTecnicosHst.IDENTIFICADOR_INDEX: + this.identificador = ( Integer ) value; + break; + case MarcacoesTecnicosHst.INACTIVO_INDEX: + this.inactivo = ( String ) value; + break; + case MarcacoesTecnicosHst.CAP_INDEX: + this.cap = ( String ) value; + break; + case MarcacoesTecnicosHst.FORMACAO_INDEX: + this.formacao = ( String ) value; + break; + case MarcacoesTecnicosHst.ASSINATURA_INDEX: + this.assinatura = ( Integer ) value; + break; + case MarcacoesTecnicosHst.TO_ASSINATURA_INDEX: + this.to_assinatura = ( siprp.data.outer.ImageData ) value; + break; + case MarcacoesTecnicosHst.IS_SUPERIOR_INDEX: + this.is_superior = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case MarcacoesTecnicosHst.ID_INDEX: + theClass = Integer.class; + break; + case MarcacoesTecnicosHst.NOME_INDEX: + theClass = String.class; + break; + case MarcacoesTecnicosHst.NOME_PLAIN_INDEX: + theClass = String.class; + break; + case MarcacoesTecnicosHst.INICIAIS_INDEX: + theClass = String.class; + break; + case MarcacoesTecnicosHst.IDENTIFICADOR_INDEX: + theClass = Integer.class; + break; + case MarcacoesTecnicosHst.INACTIVO_INDEX: + theClass = String.class; + break; + case MarcacoesTecnicosHst.CAP_INDEX: + theClass = String.class; + break; + case MarcacoesTecnicosHst.FORMACAO_INDEX: + theClass = String.class; + break; + case MarcacoesTecnicosHst.ASSINATURA_INDEX: + theClass = Integer.class; + break; + case MarcacoesTecnicosHst.TO_ASSINATURA_INDEX: + theClass = siprp.data.outer.ImageData.class; + break; + case MarcacoesTecnicosHst.IS_SUPERIOR_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : MarcacoesTecnicosHst._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, MarcacoesTecnicosHst.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesTrabalhador.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesTrabalhador.java new file mode 100644 index 00000000..7306a5d3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesTrabalhador.java @@ -0,0 +1,978 @@ +/* +* MarcacoesTrabalhador.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class MarcacoesTrabalhador extends siprp.data.Marcacao +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( MarcacoesTrabalhador.ID, MarcacoesTrabalhador.ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.ID_FULL, MarcacoesTrabalhador.ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.DATA, MarcacoesTrabalhador.DATA_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.DATA_FULL, MarcacoesTrabalhador.DATA_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.REALIZADA, MarcacoesTrabalhador.REALIZADA_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.REALIZADA_FULL, MarcacoesTrabalhador.REALIZADA_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.DATA_EMAIL, MarcacoesTrabalhador.DATA_EMAIL_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.DATA_EMAIL_FULL, MarcacoesTrabalhador.DATA_EMAIL_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.DATA_RELATORIO, MarcacoesTrabalhador.DATA_RELATORIO_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.DATA_RELATORIO_FULL, MarcacoesTrabalhador.DATA_RELATORIO_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.TIPO, MarcacoesTrabalhador.TIPO_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.TIPO_FULL, MarcacoesTrabalhador.TIPO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( MarcacoesTrabalhador.CLASS_IDENTIFIER, MarcacoesTrabalhador.TRABALHADOR_ID, MarcacoesTrabalhador.TO_TRABALHADOR_ID ); + FIELD_INDEXES.put( MarcacoesTrabalhador.TRABALHADOR_ID, MarcacoesTrabalhador.TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.TRABALHADOR_ID_FULL, MarcacoesTrabalhador.TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.TO_TRABALHADOR_ID, MarcacoesTrabalhador.TO_TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.MOTIVO, MarcacoesTrabalhador.MOTIVO_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.MOTIVO_FULL, MarcacoesTrabalhador.MOTIVO_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.ESTADO, MarcacoesTrabalhador.ESTADO_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.ESTADO_FULL, MarcacoesTrabalhador.ESTADO_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.OBSERVACOES, MarcacoesTrabalhador.OBSERVACOES_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.OBSERVACOES_FULL, MarcacoesTrabalhador.OBSERVACOES_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( MarcacoesTrabalhador.CLASS_IDENTIFIER, MarcacoesTrabalhador.PRESTADOR_ID, MarcacoesTrabalhador.TO_PRESTADOR_ID ); + FIELD_INDEXES.put( MarcacoesTrabalhador.PRESTADOR_ID, MarcacoesTrabalhador.PRESTADOR_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.PRESTADOR_ID_FULL, MarcacoesTrabalhador.PRESTADOR_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.TO_PRESTADOR_ID, MarcacoesTrabalhador.TO_PRESTADOR_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.MEDICO_ID, MarcacoesTrabalhador.MEDICO_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.MEDICO_ID_FULL, MarcacoesTrabalhador.MEDICO_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.INSERTED_STAMP, MarcacoesTrabalhador.INSERTED_STAMP_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhador.INSERTED_STAMP_FULL, MarcacoesTrabalhador.INSERTED_STAMP_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeytrabalhador_idTotrabalhadores = + new com.evolute.entity.ForeignKey( MarcacoesTrabalhador.class, MarcacoesTrabalhador.TRABALHADOR_ID, siprp.data.outer.TrabalhadoresData.class, siprp.data.outer.TrabalhadoresData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyprestador_idToprestadores = + new com.evolute.entity.ForeignKey( MarcacoesTrabalhador.class, MarcacoesTrabalhador.PRESTADOR_ID, siprp.data.outer.PrestadoresData.class, siprp.data.outer.PrestadoresData.ID ); + + public static final String TABLENAME = "marcacoes_trabalhador"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.marcacoes_trabalhador"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "marcacoes_trabalhador.id"; + public static final int ID_INDEX = 0; + public static final String DATA = "data"; + public static final String DATA_FULL = "marcacoes_trabalhador.data"; + public static final int DATA_INDEX = 1; + public static final String REALIZADA = "realizada"; + public static final String REALIZADA_FULL = "marcacoes_trabalhador.realizada"; + public static final int REALIZADA_INDEX = 2; + public static final String DATA_EMAIL = "data_email"; + public static final String DATA_EMAIL_FULL = "marcacoes_trabalhador.data_email"; + public static final int DATA_EMAIL_INDEX = 3; + public static final String DATA_RELATORIO = "data_relatorio"; + public static final String DATA_RELATORIO_FULL = "marcacoes_trabalhador.data_relatorio"; + public static final int DATA_RELATORIO_INDEX = 4; + public static final String TIPO = "tipo"; + public static final String TIPO_FULL = "marcacoes_trabalhador.tipo"; + public static final int TIPO_INDEX = 5; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String TRABALHADOR_ID_FULL = "marcacoes_trabalhador.trabalhador_id"; + public static final int TRABALHADOR_ID_INDEX = 6; + public static final String TO_TRABALHADOR_ID = "to_trabalhador_id"; + public static final int TO_TRABALHADOR_ID_INDEX = 7; + public static final String MOTIVO = "motivo"; + public static final String MOTIVO_FULL = "marcacoes_trabalhador.motivo"; + public static final int MOTIVO_INDEX = 8; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "marcacoes_trabalhador.estado"; + public static final int ESTADO_INDEX = 9; + public static final String OBSERVACOES = "observacoes"; + public static final String OBSERVACOES_FULL = "marcacoes_trabalhador.observacoes"; + public static final int OBSERVACOES_INDEX = 10; + public static final String PRESTADOR_ID = "prestador_id"; + public static final String PRESTADOR_ID_FULL = "marcacoes_trabalhador.prestador_id"; + public static final int PRESTADOR_ID_INDEX = 11; + public static final String TO_PRESTADOR_ID = "to_prestador_id"; + public static final int TO_PRESTADOR_ID_INDEX = 12; + public static final String MEDICO_ID = "medico_id"; + public static final String MEDICO_ID_FULL = "marcacoes_trabalhador.medico_id"; + public static final int MEDICO_ID_INDEX = 13; + public static final String INSERTED_STAMP = "inserted_stamp"; + public static final String INSERTED_STAMP_FULL = "marcacoes_trabalhador.inserted_stamp"; + public static final int INSERTED_STAMP_INDEX = 14; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, REALIZADA, DATA_EMAIL, DATA_RELATORIO, TIPO, TRABALHADOR_ID, + TO_TRABALHADOR_ID, MOTIVO, ESTADO, OBSERVACOES, PRESTADOR_ID, TO_PRESTADOR_ID, + MEDICO_ID, INSERTED_STAMP, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DATA, TABLENAME + "." + REALIZADA, TABLENAME + "." + DATA_EMAIL, TABLENAME + "." + DATA_RELATORIO, TABLENAME + "." + TIPO, TABLENAME + "." + TRABALHADOR_ID, + TABLENAME + "." + TO_TRABALHADOR_ID, TABLENAME + "." + MOTIVO, TABLENAME + "." + ESTADO, TABLENAME + "." + OBSERVACOES, TABLENAME + "." + PRESTADOR_ID, TABLENAME + "." + TO_PRESTADOR_ID, + TABLENAME + "." + MEDICO_ID, TABLENAME + "." + INSERTED_STAMP, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DATA, REALIZADA, DATA_EMAIL, DATA_RELATORIO, TIPO, TRABALHADOR_ID, MOTIVO, ESTADO, + OBSERVACOES, PRESTADOR_ID, MEDICO_ID, INSERTED_STAMP, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DATA, REALIZADA, DATA_EMAIL, DATA_RELATORIO, TIPO, TRABALHADOR_ID, MOTIVO, ESTADO, + OBSERVACOES, PRESTADOR_ID, MEDICO_ID, INSERTED_STAMP, }; + + private Integer id; + private java.util.Date data; + private String realizada; + private java.util.Date data_email; + private java.util.Date data_relatorio; + private Integer tipo; + private Integer trabalhador_id; + private siprp.data.outer.TrabalhadoresData to_trabalhador_id; + private Integer motivo; + private Integer estado; + private String observacoes; + private Integer prestador_id; + private siprp.data.outer.PrestadoresData to_prestador_id; + private Integer medico_id; + private java.sql.Timestamp inserted_stamp; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public MarcacoesTrabalhador() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromLembretes_marcacao_trabalhador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.LembretesData.class , getPrimaryKey().getMap().get("id"), "marcacao_trabalhador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromMarcacoesGruposRealizados_marcacao_trabalhador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.MarcacoesGruposRealizadosData.class , getPrimaryKey().getMap().get("id"), "marcacao_trabalhador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromMarcacoesTrabalhadorEstados_marcacao_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.MarcacoesTrabalhadorEstadosData.class , getPrimaryKey().getMap().get("id"), "marcacao_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.Date getData() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data; + } + + public void setData( java.util.Date data ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA, data ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data = data; + LAZY_LOADED_OBJECTS.put( DATA, Boolean.TRUE ); + } + + public String getRealizada() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( REALIZADA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.realizada; + } + + public void setRealizada( String realizada ) + { + try + { + setLockedForRefresh( true ); + preProcess( REALIZADA, realizada ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.realizada = realizada; + LAZY_LOADED_OBJECTS.put( REALIZADA, Boolean.TRUE ); + } + + public java.util.Date getData_email() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_EMAIL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_email; + } + + public void setData_email( java.util.Date data_email ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_EMAIL, data_email ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_email = data_email; + LAZY_LOADED_OBJECTS.put( DATA_EMAIL, Boolean.TRUE ); + } + + public java.util.Date getData_relatorio() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_RELATORIO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_relatorio; + } + + public void setData_relatorio( java.util.Date data_relatorio ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_RELATORIO, data_relatorio ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_relatorio = data_relatorio; + LAZY_LOADED_OBJECTS.put( DATA_RELATORIO, Boolean.TRUE ); + } + + public Integer getTipo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TIPO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.tipo; + } + + public void setTipo( Integer tipo ) + { + try + { + setLockedForRefresh( true ); + preProcess( TIPO, tipo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.tipo = tipo; + LAZY_LOADED_OBJECTS.put( TIPO, Boolean.TRUE ); + } + + public Integer getTrabalhador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TRABALHADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.trabalhador_id; + } + + public void setTrabalhador_id( Integer trabalhador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TRABALHADOR_ID, trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.trabalhador_id = trabalhador_id; + LAZY_LOADED_OBJECTS.put( TRABALHADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresData toTrabalhador_id() + { + try + { + prepare( TO_TRABALHADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_trabalhador_id; + } + + public void setToTrabalhador_id( siprp.data.outer.TrabalhadoresData to_trabalhador_id ) + { + try + { + preProcess( TO_TRABALHADOR_ID, to_trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_trabalhador_id = to_trabalhador_id; + } + + public Integer getMotivo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MOTIVO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.motivo; + } + + public void setMotivo( Integer motivo ) + { + try + { + setLockedForRefresh( true ); + preProcess( MOTIVO, motivo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.motivo = motivo; + LAZY_LOADED_OBJECTS.put( MOTIVO, Boolean.TRUE ); + } + + public Integer getEstado() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTADO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estado; + } + + public void setEstado( Integer estado ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTADO, estado ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estado = estado; + LAZY_LOADED_OBJECTS.put( ESTADO, Boolean.TRUE ); + } + + public String getObservacoes() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( OBSERVACOES ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.observacoes; + } + + public void setObservacoes( String observacoes ) + { + try + { + setLockedForRefresh( true ); + preProcess( OBSERVACOES, observacoes ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.observacoes = observacoes; + LAZY_LOADED_OBJECTS.put( OBSERVACOES, Boolean.TRUE ); + } + + public Integer getPrestador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PRESTADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.prestador_id; + } + + public void setPrestador_id( Integer prestador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( PRESTADOR_ID, prestador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.prestador_id = prestador_id; + LAZY_LOADED_OBJECTS.put( PRESTADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrestadoresData toPrestador_id() + { + try + { + prepare( TO_PRESTADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_prestador_id; + } + + public void setToPrestador_id( siprp.data.outer.PrestadoresData to_prestador_id ) + { + try + { + preProcess( TO_PRESTADOR_ID, to_prestador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_prestador_id = to_prestador_id; + } + + public Integer getMedico_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MEDICO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.medico_id; + } + + public void setMedico_id( Integer medico_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( MEDICO_ID, medico_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.medico_id = medico_id; + LAZY_LOADED_OBJECTS.put( MEDICO_ID, Boolean.TRUE ); + } + + public java.sql.Timestamp getInserted_stamp() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( INSERTED_STAMP ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.inserted_stamp; + } + + public void setInserted_stamp( java.sql.Timestamp inserted_stamp ) + { + try + { + setLockedForRefresh( true ); + preProcess( INSERTED_STAMP, inserted_stamp ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.inserted_stamp = inserted_stamp; + LAZY_LOADED_OBJECTS.put( INSERTED_STAMP, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesTrabalhador.ID_INDEX: + value = getId(); + break; + case MarcacoesTrabalhador.DATA_INDEX: + value = getData(); + break; + case MarcacoesTrabalhador.REALIZADA_INDEX: + value = getRealizada(); + break; + case MarcacoesTrabalhador.DATA_EMAIL_INDEX: + value = getData_email(); + break; + case MarcacoesTrabalhador.DATA_RELATORIO_INDEX: + value = getData_relatorio(); + break; + case MarcacoesTrabalhador.TIPO_INDEX: + value = getTipo(); + break; + case MarcacoesTrabalhador.TRABALHADOR_ID_INDEX: + value = getTrabalhador_id(); + break; + case MarcacoesTrabalhador.TO_TRABALHADOR_ID_INDEX: + value = toTrabalhador_id(); + break; + case MarcacoesTrabalhador.MOTIVO_INDEX: + value = getMotivo(); + break; + case MarcacoesTrabalhador.ESTADO_INDEX: + value = getEstado(); + break; + case MarcacoesTrabalhador.OBSERVACOES_INDEX: + value = getObservacoes(); + break; + case MarcacoesTrabalhador.PRESTADOR_ID_INDEX: + value = getPrestador_id(); + break; + case MarcacoesTrabalhador.TO_PRESTADOR_ID_INDEX: + value = toPrestador_id(); + break; + case MarcacoesTrabalhador.MEDICO_ID_INDEX: + value = getMedico_id(); + break; + case MarcacoesTrabalhador.INSERTED_STAMP_INDEX: + value = getInserted_stamp(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesTrabalhador.ID_INDEX: + value = this.id; + break; + case MarcacoesTrabalhador.DATA_INDEX: + value = this.data; + break; + case MarcacoesTrabalhador.REALIZADA_INDEX: + value = this.realizada; + break; + case MarcacoesTrabalhador.DATA_EMAIL_INDEX: + value = this.data_email; + break; + case MarcacoesTrabalhador.DATA_RELATORIO_INDEX: + value = this.data_relatorio; + break; + case MarcacoesTrabalhador.TIPO_INDEX: + value = this.tipo; + break; + case MarcacoesTrabalhador.TRABALHADOR_ID_INDEX: + value = this.trabalhador_id; + break; + case MarcacoesTrabalhador.TO_TRABALHADOR_ID_INDEX: + value = this.to_trabalhador_id; + break; + case MarcacoesTrabalhador.MOTIVO_INDEX: + value = this.motivo; + break; + case MarcacoesTrabalhador.ESTADO_INDEX: + value = this.estado; + break; + case MarcacoesTrabalhador.OBSERVACOES_INDEX: + value = this.observacoes; + break; + case MarcacoesTrabalhador.PRESTADOR_ID_INDEX: + value = this.prestador_id; + break; + case MarcacoesTrabalhador.TO_PRESTADOR_ID_INDEX: + value = this.to_prestador_id; + break; + case MarcacoesTrabalhador.MEDICO_ID_INDEX: + value = this.medico_id; + break; + case MarcacoesTrabalhador.INSERTED_STAMP_INDEX: + value = this.inserted_stamp; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesTrabalhador.ID_INDEX: + setId( ( Integer ) value ); + break; + case MarcacoesTrabalhador.DATA_INDEX: + setData( ( java.util.Date ) value ); + break; + case MarcacoesTrabalhador.REALIZADA_INDEX: + setRealizada( ( String ) value ); + break; + case MarcacoesTrabalhador.DATA_EMAIL_INDEX: + setData_email( ( java.util.Date ) value ); + break; + case MarcacoesTrabalhador.DATA_RELATORIO_INDEX: + setData_relatorio( ( java.util.Date ) value ); + break; + case MarcacoesTrabalhador.TIPO_INDEX: + setTipo( ( Integer ) value ); + break; + case MarcacoesTrabalhador.TRABALHADOR_ID_INDEX: + setTrabalhador_id( ( Integer ) value ); + break; + case MarcacoesTrabalhador.TO_TRABALHADOR_ID_INDEX: + setToTrabalhador_id( ( siprp.data.outer.TrabalhadoresData ) value ); + break; + case MarcacoesTrabalhador.MOTIVO_INDEX: + setMotivo( ( Integer ) value ); + break; + case MarcacoesTrabalhador.ESTADO_INDEX: + setEstado( ( Integer ) value ); + break; + case MarcacoesTrabalhador.OBSERVACOES_INDEX: + setObservacoes( ( String ) value ); + break; + case MarcacoesTrabalhador.PRESTADOR_ID_INDEX: + setPrestador_id( ( Integer ) value ); + break; + case MarcacoesTrabalhador.TO_PRESTADOR_ID_INDEX: + setToPrestador_id( ( siprp.data.outer.PrestadoresData ) value ); + break; + case MarcacoesTrabalhador.MEDICO_ID_INDEX: + setMedico_id( ( Integer ) value ); + break; + case MarcacoesTrabalhador.INSERTED_STAMP_INDEX: + setInserted_stamp( ( java.sql.Timestamp ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesTrabalhador.ID_INDEX: + this.id = ( Integer ) value; + break; + case MarcacoesTrabalhador.DATA_INDEX: + this.data = ( java.util.Date ) value; + break; + case MarcacoesTrabalhador.REALIZADA_INDEX: + this.realizada = ( String ) value; + break; + case MarcacoesTrabalhador.DATA_EMAIL_INDEX: + this.data_email = ( java.util.Date ) value; + break; + case MarcacoesTrabalhador.DATA_RELATORIO_INDEX: + this.data_relatorio = ( java.util.Date ) value; + break; + case MarcacoesTrabalhador.TIPO_INDEX: + this.tipo = ( Integer ) value; + break; + case MarcacoesTrabalhador.TRABALHADOR_ID_INDEX: + this.trabalhador_id = ( Integer ) value; + break; + case MarcacoesTrabalhador.TO_TRABALHADOR_ID_INDEX: + this.to_trabalhador_id = ( siprp.data.outer.TrabalhadoresData ) value; + break; + case MarcacoesTrabalhador.MOTIVO_INDEX: + this.motivo = ( Integer ) value; + break; + case MarcacoesTrabalhador.ESTADO_INDEX: + this.estado = ( Integer ) value; + break; + case MarcacoesTrabalhador.OBSERVACOES_INDEX: + this.observacoes = ( String ) value; + break; + case MarcacoesTrabalhador.PRESTADOR_ID_INDEX: + this.prestador_id = ( Integer ) value; + break; + case MarcacoesTrabalhador.TO_PRESTADOR_ID_INDEX: + this.to_prestador_id = ( siprp.data.outer.PrestadoresData ) value; + break; + case MarcacoesTrabalhador.MEDICO_ID_INDEX: + this.medico_id = ( Integer ) value; + break; + case MarcacoesTrabalhador.INSERTED_STAMP_INDEX: + this.inserted_stamp = ( java.sql.Timestamp ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case MarcacoesTrabalhador.ID_INDEX: + theClass = Integer.class; + break; + case MarcacoesTrabalhador.DATA_INDEX: + theClass = java.util.Date.class; + break; + case MarcacoesTrabalhador.REALIZADA_INDEX: + theClass = String.class; + break; + case MarcacoesTrabalhador.DATA_EMAIL_INDEX: + theClass = java.util.Date.class; + break; + case MarcacoesTrabalhador.DATA_RELATORIO_INDEX: + theClass = java.util.Date.class; + break; + case MarcacoesTrabalhador.TIPO_INDEX: + theClass = Integer.class; + break; + case MarcacoesTrabalhador.TRABALHADOR_ID_INDEX: + theClass = Integer.class; + break; + case MarcacoesTrabalhador.TO_TRABALHADOR_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresData.class; + break; + case MarcacoesTrabalhador.MOTIVO_INDEX: + theClass = Integer.class; + break; + case MarcacoesTrabalhador.ESTADO_INDEX: + theClass = Integer.class; + break; + case MarcacoesTrabalhador.OBSERVACOES_INDEX: + theClass = String.class; + break; + case MarcacoesTrabalhador.PRESTADOR_ID_INDEX: + theClass = Integer.class; + break; + case MarcacoesTrabalhador.TO_PRESTADOR_ID_INDEX: + theClass = siprp.data.outer.PrestadoresData.class; + break; + case MarcacoesTrabalhador.MEDICO_ID_INDEX: + theClass = Integer.class; + break; + case MarcacoesTrabalhador.INSERTED_STAMP_INDEX: + theClass = java.sql.Timestamp.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : MarcacoesTrabalhador._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, MarcacoesTrabalhador.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesTrabalhadorEstados.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesTrabalhadorEstados.java new file mode 100644 index 00000000..47de2e93 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/MarcacoesTrabalhadorEstados.java @@ -0,0 +1,543 @@ +/* +* MarcacoesTrabalhadorEstados.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class MarcacoesTrabalhadorEstados extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( MarcacoesTrabalhadorEstados.ID, MarcacoesTrabalhadorEstados.ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhadorEstados.ID_FULL, MarcacoesTrabalhadorEstados.ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhadorEstados.DATA, MarcacoesTrabalhadorEstados.DATA_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhadorEstados.DATA_FULL, MarcacoesTrabalhadorEstados.DATA_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhadorEstados.ESTADO, MarcacoesTrabalhadorEstados.ESTADO_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhadorEstados.ESTADO_FULL, MarcacoesTrabalhadorEstados.ESTADO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( MarcacoesTrabalhadorEstados.CLASS_IDENTIFIER, MarcacoesTrabalhadorEstados.MARCACAO_ID, MarcacoesTrabalhadorEstados.TO_MARCACAO_ID ); + FIELD_INDEXES.put( MarcacoesTrabalhadorEstados.MARCACAO_ID, MarcacoesTrabalhadorEstados.MARCACAO_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhadorEstados.MARCACAO_ID_FULL, MarcacoesTrabalhadorEstados.MARCACAO_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhadorEstados.TO_MARCACAO_ID, MarcacoesTrabalhadorEstados.TO_MARCACAO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( MarcacoesTrabalhadorEstados.CLASS_IDENTIFIER, MarcacoesTrabalhadorEstados.PRESTADOR_ID, MarcacoesTrabalhadorEstados.TO_PRESTADOR_ID ); + FIELD_INDEXES.put( MarcacoesTrabalhadorEstados.PRESTADOR_ID, MarcacoesTrabalhadorEstados.PRESTADOR_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhadorEstados.PRESTADOR_ID_FULL, MarcacoesTrabalhadorEstados.PRESTADOR_ID_INDEX ); + FIELD_INDEXES.put( MarcacoesTrabalhadorEstados.TO_PRESTADOR_ID, MarcacoesTrabalhadorEstados.TO_PRESTADOR_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeymarcacao_idTomarcacoes_trabalhador = + new com.evolute.entity.ForeignKey( MarcacoesTrabalhadorEstados.class, MarcacoesTrabalhadorEstados.MARCACAO_ID, siprp.data.outer.MarcacoesTrabalhadorData.class, siprp.data.outer.MarcacoesTrabalhadorData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyprestador_idToprestadores = + new com.evolute.entity.ForeignKey( MarcacoesTrabalhadorEstados.class, MarcacoesTrabalhadorEstados.PRESTADOR_ID, siprp.data.outer.PrestadoresData.class, siprp.data.outer.PrestadoresData.ID ); + + public static final String TABLENAME = "marcacoes_trabalhador_estados"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.marcacoes_trabalhador_estados"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "marcacoes_trabalhador_estados.id"; + public static final int ID_INDEX = 0; + public static final String DATA = "data"; + public static final String DATA_FULL = "marcacoes_trabalhador_estados.data"; + public static final int DATA_INDEX = 1; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "marcacoes_trabalhador_estados.estado"; + public static final int ESTADO_INDEX = 2; + public static final String MARCACAO_ID = "marcacao_id"; + public static final String MARCACAO_ID_FULL = "marcacoes_trabalhador_estados.marcacao_id"; + public static final int MARCACAO_ID_INDEX = 3; + public static final String TO_MARCACAO_ID = "to_marcacao_id"; + public static final int TO_MARCACAO_ID_INDEX = 4; + public static final String PRESTADOR_ID = "prestador_id"; + public static final String PRESTADOR_ID_FULL = "marcacoes_trabalhador_estados.prestador_id"; + public static final int PRESTADOR_ID_INDEX = 5; + public static final String TO_PRESTADOR_ID = "to_prestador_id"; + public static final int TO_PRESTADOR_ID_INDEX = 6; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, ESTADO, MARCACAO_ID, TO_MARCACAO_ID, PRESTADOR_ID, TO_PRESTADOR_ID, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DATA, TABLENAME + "." + ESTADO, TABLENAME + "." + MARCACAO_ID, TABLENAME + "." + TO_MARCACAO_ID, TABLENAME + "." + PRESTADOR_ID, TABLENAME + "." + TO_PRESTADOR_ID, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DATA, ESTADO, MARCACAO_ID, PRESTADOR_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DATA, ESTADO, MARCACAO_ID, PRESTADOR_ID, }; + + private Integer id; + private java.util.Date data; + private Integer estado; + private Integer marcacao_id; + private siprp.data.outer.MarcacoesTrabalhadorData to_marcacao_id; + private Integer prestador_id; + private siprp.data.outer.PrestadoresData to_prestador_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public MarcacoesTrabalhadorEstados() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromMarcacoesGruposRealizados_marcacoes_trabalhador_estado_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.MarcacoesGruposRealizadosData.class , getPrimaryKey().getMap().get("id"), "marcacoes_trabalhador_estado_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.Date getData() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data; + } + + public void setData( java.util.Date data ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA, data ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data = data; + LAZY_LOADED_OBJECTS.put( DATA, Boolean.TRUE ); + } + + public Integer getEstado() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTADO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estado; + } + + public void setEstado( Integer estado ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTADO, estado ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estado = estado; + LAZY_LOADED_OBJECTS.put( ESTADO, Boolean.TRUE ); + } + + public Integer getMarcacao_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MARCACAO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.marcacao_id; + } + + public void setMarcacao_id( Integer marcacao_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( MARCACAO_ID, marcacao_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.marcacao_id = marcacao_id; + LAZY_LOADED_OBJECTS.put( MARCACAO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.MarcacoesTrabalhadorData toMarcacao_id() + { + try + { + prepare( TO_MARCACAO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_marcacao_id; + } + + public void setToMarcacao_id( siprp.data.outer.MarcacoesTrabalhadorData to_marcacao_id ) + { + try + { + preProcess( TO_MARCACAO_ID, to_marcacao_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_marcacao_id = to_marcacao_id; + } + + public Integer getPrestador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PRESTADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.prestador_id; + } + + public void setPrestador_id( Integer prestador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( PRESTADOR_ID, prestador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.prestador_id = prestador_id; + LAZY_LOADED_OBJECTS.put( PRESTADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrestadoresData toPrestador_id() + { + try + { + prepare( TO_PRESTADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_prestador_id; + } + + public void setToPrestador_id( siprp.data.outer.PrestadoresData to_prestador_id ) + { + try + { + preProcess( TO_PRESTADOR_ID, to_prestador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_prestador_id = to_prestador_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesTrabalhadorEstados.ID_INDEX: + value = getId(); + break; + case MarcacoesTrabalhadorEstados.DATA_INDEX: + value = getData(); + break; + case MarcacoesTrabalhadorEstados.ESTADO_INDEX: + value = getEstado(); + break; + case MarcacoesTrabalhadorEstados.MARCACAO_ID_INDEX: + value = getMarcacao_id(); + break; + case MarcacoesTrabalhadorEstados.TO_MARCACAO_ID_INDEX: + value = toMarcacao_id(); + break; + case MarcacoesTrabalhadorEstados.PRESTADOR_ID_INDEX: + value = getPrestador_id(); + break; + case MarcacoesTrabalhadorEstados.TO_PRESTADOR_ID_INDEX: + value = toPrestador_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesTrabalhadorEstados.ID_INDEX: + value = this.id; + break; + case MarcacoesTrabalhadorEstados.DATA_INDEX: + value = this.data; + break; + case MarcacoesTrabalhadorEstados.ESTADO_INDEX: + value = this.estado; + break; + case MarcacoesTrabalhadorEstados.MARCACAO_ID_INDEX: + value = this.marcacao_id; + break; + case MarcacoesTrabalhadorEstados.TO_MARCACAO_ID_INDEX: + value = this.to_marcacao_id; + break; + case MarcacoesTrabalhadorEstados.PRESTADOR_ID_INDEX: + value = this.prestador_id; + break; + case MarcacoesTrabalhadorEstados.TO_PRESTADOR_ID_INDEX: + value = this.to_prestador_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesTrabalhadorEstados.ID_INDEX: + setId( ( Integer ) value ); + break; + case MarcacoesTrabalhadorEstados.DATA_INDEX: + setData( ( java.util.Date ) value ); + break; + case MarcacoesTrabalhadorEstados.ESTADO_INDEX: + setEstado( ( Integer ) value ); + break; + case MarcacoesTrabalhadorEstados.MARCACAO_ID_INDEX: + setMarcacao_id( ( Integer ) value ); + break; + case MarcacoesTrabalhadorEstados.TO_MARCACAO_ID_INDEX: + setToMarcacao_id( ( siprp.data.outer.MarcacoesTrabalhadorData ) value ); + break; + case MarcacoesTrabalhadorEstados.PRESTADOR_ID_INDEX: + setPrestador_id( ( Integer ) value ); + break; + case MarcacoesTrabalhadorEstados.TO_PRESTADOR_ID_INDEX: + setToPrestador_id( ( siprp.data.outer.PrestadoresData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case MarcacoesTrabalhadorEstados.ID_INDEX: + this.id = ( Integer ) value; + break; + case MarcacoesTrabalhadorEstados.DATA_INDEX: + this.data = ( java.util.Date ) value; + break; + case MarcacoesTrabalhadorEstados.ESTADO_INDEX: + this.estado = ( Integer ) value; + break; + case MarcacoesTrabalhadorEstados.MARCACAO_ID_INDEX: + this.marcacao_id = ( Integer ) value; + break; + case MarcacoesTrabalhadorEstados.TO_MARCACAO_ID_INDEX: + this.to_marcacao_id = ( siprp.data.outer.MarcacoesTrabalhadorData ) value; + break; + case MarcacoesTrabalhadorEstados.PRESTADOR_ID_INDEX: + this.prestador_id = ( Integer ) value; + break; + case MarcacoesTrabalhadorEstados.TO_PRESTADOR_ID_INDEX: + this.to_prestador_id = ( siprp.data.outer.PrestadoresData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case MarcacoesTrabalhadorEstados.ID_INDEX: + theClass = Integer.class; + break; + case MarcacoesTrabalhadorEstados.DATA_INDEX: + theClass = java.util.Date.class; + break; + case MarcacoesTrabalhadorEstados.ESTADO_INDEX: + theClass = Integer.class; + break; + case MarcacoesTrabalhadorEstados.MARCACAO_ID_INDEX: + theClass = Integer.class; + break; + case MarcacoesTrabalhadorEstados.TO_MARCACAO_ID_INDEX: + theClass = siprp.data.outer.MarcacoesTrabalhadorData.class; + break; + case MarcacoesTrabalhadorEstados.PRESTADOR_ID_INDEX: + theClass = Integer.class; + break; + case MarcacoesTrabalhadorEstados.TO_PRESTADOR_ID_INDEX: + theClass = siprp.data.outer.PrestadoresData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : MarcacoesTrabalhadorEstados._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, MarcacoesTrabalhadorEstados.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Medicos.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Medicos.java new file mode 100644 index 00000000..7c71b950 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Medicos.java @@ -0,0 +1,409 @@ +/* +* Medicos.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class Medicos extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( Medicos.ID, Medicos.ID_INDEX ); + FIELD_INDEXES.put( Medicos.ID_FULL, Medicos.ID_INDEX ); + FIELD_INDEXES.put( Medicos.NOME, Medicos.NOME_INDEX ); + FIELD_INDEXES.put( Medicos.NOME_FULL, Medicos.NOME_INDEX ); + FIELD_INDEXES.put( Medicos.NUMERO_CEDULA, Medicos.NUMERO_CEDULA_INDEX ); + FIELD_INDEXES.put( Medicos.NUMERO_CEDULA_FULL, Medicos.NUMERO_CEDULA_INDEX ); + FIELD_INDEXES.put( Medicos.INACTIVO, Medicos.INACTIVO_INDEX ); + FIELD_INDEXES.put( Medicos.INACTIVO_FULL, Medicos.INACTIVO_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "medicos"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.medicos"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "medicos.id"; + public static final int ID_INDEX = 0; + public static final String NOME = "nome"; + public static final String NOME_FULL = "medicos.nome"; + public static final int NOME_INDEX = 1; + public static final String NUMERO_CEDULA = "numero_cedula"; + public static final String NUMERO_CEDULA_FULL = "medicos.numero_cedula"; + public static final int NUMERO_CEDULA_INDEX = 2; + public static final String INACTIVO = "inactivo"; + public static final String INACTIVO_FULL = "medicos.inactivo"; + public static final int INACTIVO_INDEX = 3; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, NUMERO_CEDULA, INACTIVO, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + NOME, TABLENAME + "." + NUMERO_CEDULA, TABLENAME + "." + INACTIVO, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, NOME, NUMERO_CEDULA, INACTIVO, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, NOME, NUMERO_CEDULA, INACTIVO, }; + + private Integer id; + private String nome; + private String numero_cedula; + private String inactivo; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public Medicos() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromEstabelecimentos_medico_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.EstabelecimentosData.class , getPrimaryKey().getMap().get("id"), "medico_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromExames_medico_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.ExamesData.class , getPrimaryKey().getMap().get("id"), "medico_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getNome() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NOME ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.nome; + } + + public void setNome( String nome ) + { + try + { + setLockedForRefresh( true ); + preProcess( NOME, nome ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.nome = nome; + LAZY_LOADED_OBJECTS.put( NOME, Boolean.TRUE ); + } + + public String getNumero_cedula() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NUMERO_CEDULA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.numero_cedula; + } + + public void setNumero_cedula( String numero_cedula ) + { + try + { + setLockedForRefresh( true ); + preProcess( NUMERO_CEDULA, numero_cedula ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.numero_cedula = numero_cedula; + LAZY_LOADED_OBJECTS.put( NUMERO_CEDULA, Boolean.TRUE ); + } + + public String getInactivo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( INACTIVO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.inactivo; + } + + public void setInactivo( String inactivo ) + { + try + { + setLockedForRefresh( true ); + preProcess( INACTIVO, inactivo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.inactivo = inactivo; + LAZY_LOADED_OBJECTS.put( INACTIVO, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Medicos.ID_INDEX: + value = getId(); + break; + case Medicos.NOME_INDEX: + value = getNome(); + break; + case Medicos.NUMERO_CEDULA_INDEX: + value = getNumero_cedula(); + break; + case Medicos.INACTIVO_INDEX: + value = getInactivo(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Medicos.ID_INDEX: + value = this.id; + break; + case Medicos.NOME_INDEX: + value = this.nome; + break; + case Medicos.NUMERO_CEDULA_INDEX: + value = this.numero_cedula; + break; + case Medicos.INACTIVO_INDEX: + value = this.inactivo; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Medicos.ID_INDEX: + setId( ( Integer ) value ); + break; + case Medicos.NOME_INDEX: + setNome( ( String ) value ); + break; + case Medicos.NUMERO_CEDULA_INDEX: + setNumero_cedula( ( String ) value ); + break; + case Medicos.INACTIVO_INDEX: + setInactivo( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Medicos.ID_INDEX: + this.id = ( Integer ) value; + break; + case Medicos.NOME_INDEX: + this.nome = ( String ) value; + break; + case Medicos.NUMERO_CEDULA_INDEX: + this.numero_cedula = ( String ) value; + break; + case Medicos.INACTIVO_INDEX: + this.inactivo = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case Medicos.ID_INDEX: + theClass = Integer.class; + break; + case Medicos.NOME_INDEX: + theClass = String.class; + break; + case Medicos.NUMERO_CEDULA_INDEX: + theClass = String.class; + break; + case Medicos.INACTIVO_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : Medicos._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, Medicos.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Prestadores.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Prestadores.java new file mode 100644 index 00000000..e8c0154f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Prestadores.java @@ -0,0 +1,1053 @@ +/* +* Prestadores.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class Prestadores extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( Prestadores.ID, Prestadores.ID_INDEX ); + FIELD_INDEXES.put( Prestadores.ID_FULL, Prestadores.ID_INDEX ); + FIELD_INDEXES.put( Prestadores.NOME, Prestadores.NOME_INDEX ); + FIELD_INDEXES.put( Prestadores.NOME_FULL, Prestadores.NOME_INDEX ); + FIELD_INDEXES.put( Prestadores.NOME_PLAIN, Prestadores.NOME_PLAIN_INDEX ); + FIELD_INDEXES.put( Prestadores.NOME_PLAIN_FULL, Prestadores.NOME_PLAIN_INDEX ); + FIELD_INDEXES.put( Prestadores.MORADA, Prestadores.MORADA_INDEX ); + FIELD_INDEXES.put( Prestadores.MORADA_FULL, Prestadores.MORADA_INDEX ); + FIELD_INDEXES.put( Prestadores.CODIGO_POSTAL, Prestadores.CODIGO_POSTAL_INDEX ); + FIELD_INDEXES.put( Prestadores.CODIGO_POSTAL_FULL, Prestadores.CODIGO_POSTAL_INDEX ); + FIELD_INDEXES.put( Prestadores.LOCALIDADE, Prestadores.LOCALIDADE_INDEX ); + FIELD_INDEXES.put( Prestadores.LOCALIDADE_FULL, Prestadores.LOCALIDADE_INDEX ); + FIELD_INDEXES.put( Prestadores.LOCALIDADE_CP, Prestadores.LOCALIDADE_CP_INDEX ); + FIELD_INDEXES.put( Prestadores.LOCALIDADE_CP_FULL, Prestadores.LOCALIDADE_CP_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Prestadores.CLASS_IDENTIFIER, Prestadores.CONTACTO_ID, Prestadores.TO_CONTACTO_ID ); + FIELD_INDEXES.put( Prestadores.CONTACTO_ID, Prestadores.CONTACTO_ID_INDEX ); + FIELD_INDEXES.put( Prestadores.CONTACTO_ID_FULL, Prestadores.CONTACTO_ID_INDEX ); + FIELD_INDEXES.put( Prestadores.TO_CONTACTO_ID, Prestadores.TO_CONTACTO_ID_INDEX ); + FIELD_INDEXES.put( Prestadores.ACTIVO, Prestadores.ACTIVO_INDEX ); + FIELD_INDEXES.put( Prestadores.ACTIVO_FULL, Prestadores.ACTIVO_INDEX ); + FIELD_INDEXES.put( Prestadores.FAZ_CONSULTAS, Prestadores.FAZ_CONSULTAS_INDEX ); + FIELD_INDEXES.put( Prestadores.FAZ_CONSULTAS_FULL, Prestadores.FAZ_CONSULTAS_INDEX ); + FIELD_INDEXES.put( Prestadores.FAZ_ECDS, Prestadores.FAZ_ECDS_INDEX ); + FIELD_INDEXES.put( Prestadores.FAZ_ECDS_FULL, Prestadores.FAZ_ECDS_INDEX ); + FIELD_INDEXES.put( Prestadores.CONTRIBUINTE, Prestadores.CONTRIBUINTE_INDEX ); + FIELD_INDEXES.put( Prestadores.CONTRIBUINTE_FULL, Prestadores.CONTRIBUINTE_INDEX ); + FIELD_INDEXES.put( Prestadores.OBSERVACOES, Prestadores.OBSERVACOES_INDEX ); + FIELD_INDEXES.put( Prestadores.OBSERVACOES_FULL, Prestadores.OBSERVACOES_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeycontacto_idTocontactos = + new com.evolute.entity.ForeignKey( Prestadores.class, Prestadores.CONTACTO_ID, siprp.data.outer.ContactosData.class, siprp.data.outer.ContactosData.ID ); + + public static final String TABLENAME = "prestadores"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.prestadores"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "prestadores.id"; + public static final int ID_INDEX = 0; + public static final String NOME = "nome"; + public static final String NOME_FULL = "prestadores.nome"; + public static final int NOME_INDEX = 1; + public static final String NOME_PLAIN = "nome_plain"; + public static final String NOME_PLAIN_FULL = "prestadores.nome_plain"; + public static final int NOME_PLAIN_INDEX = 2; + public static final String MORADA = "morada"; + public static final String MORADA_FULL = "prestadores.morada"; + public static final int MORADA_INDEX = 3; + public static final String CODIGO_POSTAL = "codigo_postal"; + public static final String CODIGO_POSTAL_FULL = "prestadores.codigo_postal"; + public static final int CODIGO_POSTAL_INDEX = 4; + public static final String LOCALIDADE = "localidade"; + public static final String LOCALIDADE_FULL = "prestadores.localidade"; + public static final int LOCALIDADE_INDEX = 5; + public static final String LOCALIDADE_CP = "localidade_cp"; + public static final String LOCALIDADE_CP_FULL = "prestadores.localidade_cp"; + public static final int LOCALIDADE_CP_INDEX = 6; + public static final String CONTACTO_ID = "contacto_id"; + public static final String CONTACTO_ID_FULL = "prestadores.contacto_id"; + public static final int CONTACTO_ID_INDEX = 7; + public static final String TO_CONTACTO_ID = "to_contacto_id"; + public static final int TO_CONTACTO_ID_INDEX = 8; + public static final String ACTIVO = "activo"; + public static final String ACTIVO_FULL = "prestadores.activo"; + public static final int ACTIVO_INDEX = 9; + public static final String FAZ_CONSULTAS = "faz_consultas"; + public static final String FAZ_CONSULTAS_FULL = "prestadores.faz_consultas"; + public static final int FAZ_CONSULTAS_INDEX = 10; + public static final String FAZ_ECDS = "faz_ecds"; + public static final String FAZ_ECDS_FULL = "prestadores.faz_ecds"; + public static final int FAZ_ECDS_INDEX = 11; + public static final String CONTRIBUINTE = "contribuinte"; + public static final String CONTRIBUINTE_FULL = "prestadores.contribuinte"; + public static final int CONTRIBUINTE_INDEX = 12; + public static final String OBSERVACOES = "observacoes"; + public static final String OBSERVACOES_FULL = "prestadores.observacoes"; + public static final int OBSERVACOES_INDEX = 13; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, NOME_PLAIN, MORADA, CODIGO_POSTAL, LOCALIDADE, LOCALIDADE_CP, CONTACTO_ID, + TO_CONTACTO_ID, ACTIVO, FAZ_CONSULTAS, FAZ_ECDS, CONTRIBUINTE, OBSERVACOES, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + NOME, TABLENAME + "." + NOME_PLAIN, TABLENAME + "." + MORADA, TABLENAME + "." + CODIGO_POSTAL, TABLENAME + "." + LOCALIDADE, TABLENAME + "." + LOCALIDADE_CP, TABLENAME + "." + CONTACTO_ID, + TABLENAME + "." + TO_CONTACTO_ID, TABLENAME + "." + ACTIVO, TABLENAME + "." + FAZ_CONSULTAS, TABLENAME + "." + FAZ_ECDS, TABLENAME + "." + CONTRIBUINTE, TABLENAME + "." + OBSERVACOES, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, NOME, NOME_PLAIN, MORADA, CODIGO_POSTAL, LOCALIDADE, LOCALIDADE_CP, CONTACTO_ID, + ACTIVO, FAZ_CONSULTAS, FAZ_ECDS, CONTRIBUINTE, OBSERVACOES, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, NOME, NOME_PLAIN, MORADA, CODIGO_POSTAL, LOCALIDADE, LOCALIDADE_CP, CONTACTO_ID, + ACTIVO, FAZ_CONSULTAS, FAZ_ECDS, CONTRIBUINTE, OBSERVACOES, }; + + private Integer id; + private String nome; + private String nome_plain; + private String morada; + private String codigo_postal; + private String localidade; + private String localidade_cp; + private Integer contacto_id; + private siprp.data.outer.ContactosData to_contacto_id; + private String activo; + private String faz_consultas; + private String faz_ecds; + private String contribuinte; + private String observacoes; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public Prestadores() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false, false, false, false, + false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromEstabelecimentos_prestador_consulta_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.EstabelecimentosData.class , getPrimaryKey().getMap().get("id"), "prestador_consulta_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromEstabelecimentos_prestador_ecds_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.EstabelecimentosData.class , getPrimaryKey().getMap().get("id"), "prestador_ecds_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromMarcacoesTrabalhador_prestador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.MarcacoesTrabalhadorData.class , getPrimaryKey().getMap().get("id"), "prestador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromMarcacoesTrabalhadorEstados_prestador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.MarcacoesTrabalhadorEstadosData.class , getPrimaryKey().getMap().get("id"), "prestador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromPrestadoresGruposProtocolo_prestador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.PrestadoresGruposProtocoloData.class , getPrimaryKey().getMap().get("id"), "prestador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromPrtGruposProtocolo_analisador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.PrtGruposProtocoloData.class , getPrimaryKey().getMap().get("id"), "analisador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresConsultas_prestador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresConsultasData.class , getPrimaryKey().getMap().get("id"), "prestador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresConsultasDatas_prestador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresConsultasDatasData.class , getPrimaryKey().getMap().get("id"), "prestador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresEcd_analisador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresEcdData.class , getPrimaryKey().getMap().get("id"), "analisador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresEcdsAnalise_prestador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresEcdsAnaliseData.class , getPrimaryKey().getMap().get("id"), "prestador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresEcdsDatas_prestador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresEcdsDatasData.class , getPrimaryKey().getMap().get("id"), "prestador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresEcdsDatas_analisador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresEcdsDatasData.class , getPrimaryKey().getMap().get("id"), "analisador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getNome() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NOME ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.nome; + } + + public void setNome( String nome ) + { + try + { + setLockedForRefresh( true ); + preProcess( NOME, nome ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.nome = nome; + LAZY_LOADED_OBJECTS.put( NOME, Boolean.TRUE ); + } + + public String getNome_plain() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NOME_PLAIN ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.nome_plain; + } + + public void setNome_plain( String nome_plain ) + { + try + { + setLockedForRefresh( true ); + preProcess( NOME_PLAIN, nome_plain ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.nome_plain = nome_plain; + LAZY_LOADED_OBJECTS.put( NOME_PLAIN, Boolean.TRUE ); + } + + public String getMorada() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MORADA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.morada; + } + + public void setMorada( String morada ) + { + try + { + setLockedForRefresh( true ); + preProcess( MORADA, morada ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.morada = morada; + LAZY_LOADED_OBJECTS.put( MORADA, Boolean.TRUE ); + } + + public String getCodigo_postal() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CODIGO_POSTAL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.codigo_postal; + } + + public void setCodigo_postal( String codigo_postal ) + { + try + { + setLockedForRefresh( true ); + preProcess( CODIGO_POSTAL, codigo_postal ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.codigo_postal = codigo_postal; + LAZY_LOADED_OBJECTS.put( CODIGO_POSTAL, Boolean.TRUE ); + } + + public String getLocalidade() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( LOCALIDADE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.localidade; + } + + public void setLocalidade( String localidade ) + { + try + { + setLockedForRefresh( true ); + preProcess( LOCALIDADE, localidade ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.localidade = localidade; + LAZY_LOADED_OBJECTS.put( LOCALIDADE, Boolean.TRUE ); + } + + public String getLocalidade_cp() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( LOCALIDADE_CP ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.localidade_cp; + } + + public void setLocalidade_cp( String localidade_cp ) + { + try + { + setLockedForRefresh( true ); + preProcess( LOCALIDADE_CP, localidade_cp ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.localidade_cp = localidade_cp; + LAZY_LOADED_OBJECTS.put( LOCALIDADE_CP, Boolean.TRUE ); + } + + public Integer getContacto_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CONTACTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.contacto_id; + } + + public void setContacto_id( Integer contacto_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( CONTACTO_ID, contacto_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.contacto_id = contacto_id; + LAZY_LOADED_OBJECTS.put( CONTACTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.ContactosData toContacto_id() + { + try + { + prepare( TO_CONTACTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_contacto_id; + } + + public void setToContacto_id( siprp.data.outer.ContactosData to_contacto_id ) + { + try + { + preProcess( TO_CONTACTO_ID, to_contacto_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_contacto_id = to_contacto_id; + } + + public String getActivo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ACTIVO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.activo; + } + + public void setActivo( String activo ) + { + try + { + setLockedForRefresh( true ); + preProcess( ACTIVO, activo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.activo = activo; + LAZY_LOADED_OBJECTS.put( ACTIVO, Boolean.TRUE ); + } + + public String getFaz_consultas() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( FAZ_CONSULTAS ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.faz_consultas; + } + + public void setFaz_consultas( String faz_consultas ) + { + try + { + setLockedForRefresh( true ); + preProcess( FAZ_CONSULTAS, faz_consultas ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.faz_consultas = faz_consultas; + LAZY_LOADED_OBJECTS.put( FAZ_CONSULTAS, Boolean.TRUE ); + } + + public String getFaz_ecds() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( FAZ_ECDS ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.faz_ecds; + } + + public void setFaz_ecds( String faz_ecds ) + { + try + { + setLockedForRefresh( true ); + preProcess( FAZ_ECDS, faz_ecds ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.faz_ecds = faz_ecds; + LAZY_LOADED_OBJECTS.put( FAZ_ECDS, Boolean.TRUE ); + } + + public String getContribuinte() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CONTRIBUINTE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.contribuinte; + } + + public void setContribuinte( String contribuinte ) + { + try + { + setLockedForRefresh( true ); + preProcess( CONTRIBUINTE, contribuinte ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.contribuinte = contribuinte; + LAZY_LOADED_OBJECTS.put( CONTRIBUINTE, Boolean.TRUE ); + } + + public String getObservacoes() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( OBSERVACOES ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.observacoes; + } + + public void setObservacoes( String observacoes ) + { + try + { + setLockedForRefresh( true ); + preProcess( OBSERVACOES, observacoes ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.observacoes = observacoes; + LAZY_LOADED_OBJECTS.put( OBSERVACOES, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Prestadores.ID_INDEX: + value = getId(); + break; + case Prestadores.NOME_INDEX: + value = getNome(); + break; + case Prestadores.NOME_PLAIN_INDEX: + value = getNome_plain(); + break; + case Prestadores.MORADA_INDEX: + value = getMorada(); + break; + case Prestadores.CODIGO_POSTAL_INDEX: + value = getCodigo_postal(); + break; + case Prestadores.LOCALIDADE_INDEX: + value = getLocalidade(); + break; + case Prestadores.LOCALIDADE_CP_INDEX: + value = getLocalidade_cp(); + break; + case Prestadores.CONTACTO_ID_INDEX: + value = getContacto_id(); + break; + case Prestadores.TO_CONTACTO_ID_INDEX: + value = toContacto_id(); + break; + case Prestadores.ACTIVO_INDEX: + value = getActivo(); + break; + case Prestadores.FAZ_CONSULTAS_INDEX: + value = getFaz_consultas(); + break; + case Prestadores.FAZ_ECDS_INDEX: + value = getFaz_ecds(); + break; + case Prestadores.CONTRIBUINTE_INDEX: + value = getContribuinte(); + break; + case Prestadores.OBSERVACOES_INDEX: + value = getObservacoes(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Prestadores.ID_INDEX: + value = this.id; + break; + case Prestadores.NOME_INDEX: + value = this.nome; + break; + case Prestadores.NOME_PLAIN_INDEX: + value = this.nome_plain; + break; + case Prestadores.MORADA_INDEX: + value = this.morada; + break; + case Prestadores.CODIGO_POSTAL_INDEX: + value = this.codigo_postal; + break; + case Prestadores.LOCALIDADE_INDEX: + value = this.localidade; + break; + case Prestadores.LOCALIDADE_CP_INDEX: + value = this.localidade_cp; + break; + case Prestadores.CONTACTO_ID_INDEX: + value = this.contacto_id; + break; + case Prestadores.TO_CONTACTO_ID_INDEX: + value = this.to_contacto_id; + break; + case Prestadores.ACTIVO_INDEX: + value = this.activo; + break; + case Prestadores.FAZ_CONSULTAS_INDEX: + value = this.faz_consultas; + break; + case Prestadores.FAZ_ECDS_INDEX: + value = this.faz_ecds; + break; + case Prestadores.CONTRIBUINTE_INDEX: + value = this.contribuinte; + break; + case Prestadores.OBSERVACOES_INDEX: + value = this.observacoes; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Prestadores.ID_INDEX: + setId( ( Integer ) value ); + break; + case Prestadores.NOME_INDEX: + setNome( ( String ) value ); + break; + case Prestadores.NOME_PLAIN_INDEX: + setNome_plain( ( String ) value ); + break; + case Prestadores.MORADA_INDEX: + setMorada( ( String ) value ); + break; + case Prestadores.CODIGO_POSTAL_INDEX: + setCodigo_postal( ( String ) value ); + break; + case Prestadores.LOCALIDADE_INDEX: + setLocalidade( ( String ) value ); + break; + case Prestadores.LOCALIDADE_CP_INDEX: + setLocalidade_cp( ( String ) value ); + break; + case Prestadores.CONTACTO_ID_INDEX: + setContacto_id( ( Integer ) value ); + break; + case Prestadores.TO_CONTACTO_ID_INDEX: + setToContacto_id( ( siprp.data.outer.ContactosData ) value ); + break; + case Prestadores.ACTIVO_INDEX: + setActivo( ( String ) value ); + break; + case Prestadores.FAZ_CONSULTAS_INDEX: + setFaz_consultas( ( String ) value ); + break; + case Prestadores.FAZ_ECDS_INDEX: + setFaz_ecds( ( String ) value ); + break; + case Prestadores.CONTRIBUINTE_INDEX: + setContribuinte( ( String ) value ); + break; + case Prestadores.OBSERVACOES_INDEX: + setObservacoes( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Prestadores.ID_INDEX: + this.id = ( Integer ) value; + break; + case Prestadores.NOME_INDEX: + this.nome = ( String ) value; + break; + case Prestadores.NOME_PLAIN_INDEX: + this.nome_plain = ( String ) value; + break; + case Prestadores.MORADA_INDEX: + this.morada = ( String ) value; + break; + case Prestadores.CODIGO_POSTAL_INDEX: + this.codigo_postal = ( String ) value; + break; + case Prestadores.LOCALIDADE_INDEX: + this.localidade = ( String ) value; + break; + case Prestadores.LOCALIDADE_CP_INDEX: + this.localidade_cp = ( String ) value; + break; + case Prestadores.CONTACTO_ID_INDEX: + this.contacto_id = ( Integer ) value; + break; + case Prestadores.TO_CONTACTO_ID_INDEX: + this.to_contacto_id = ( siprp.data.outer.ContactosData ) value; + break; + case Prestadores.ACTIVO_INDEX: + this.activo = ( String ) value; + break; + case Prestadores.FAZ_CONSULTAS_INDEX: + this.faz_consultas = ( String ) value; + break; + case Prestadores.FAZ_ECDS_INDEX: + this.faz_ecds = ( String ) value; + break; + case Prestadores.CONTRIBUINTE_INDEX: + this.contribuinte = ( String ) value; + break; + case Prestadores.OBSERVACOES_INDEX: + this.observacoes = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case Prestadores.ID_INDEX: + theClass = Integer.class; + break; + case Prestadores.NOME_INDEX: + theClass = String.class; + break; + case Prestadores.NOME_PLAIN_INDEX: + theClass = String.class; + break; + case Prestadores.MORADA_INDEX: + theClass = String.class; + break; + case Prestadores.CODIGO_POSTAL_INDEX: + theClass = String.class; + break; + case Prestadores.LOCALIDADE_INDEX: + theClass = String.class; + break; + case Prestadores.LOCALIDADE_CP_INDEX: + theClass = String.class; + break; + case Prestadores.CONTACTO_ID_INDEX: + theClass = Integer.class; + break; + case Prestadores.TO_CONTACTO_ID_INDEX: + theClass = siprp.data.outer.ContactosData.class; + break; + case Prestadores.ACTIVO_INDEX: + theClass = String.class; + break; + case Prestadores.FAZ_CONSULTAS_INDEX: + theClass = String.class; + break; + case Prestadores.FAZ_ECDS_INDEX: + theClass = String.class; + break; + case Prestadores.CONTRIBUINTE_INDEX: + theClass = String.class; + break; + case Prestadores.OBSERVACOES_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : Prestadores._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, Prestadores.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/PrestadoresGruposProtocolo.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/PrestadoresGruposProtocolo.java new file mode 100644 index 00000000..a03ca807 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/PrestadoresGruposProtocolo.java @@ -0,0 +1,429 @@ +/* +* PrestadoresGruposProtocolo.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class PrestadoresGruposProtocolo extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( PrestadoresGruposProtocolo.ID, PrestadoresGruposProtocolo.ID_INDEX ); + FIELD_INDEXES.put( PrestadoresGruposProtocolo.ID_FULL, PrestadoresGruposProtocolo.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( PrestadoresGruposProtocolo.CLASS_IDENTIFIER, PrestadoresGruposProtocolo.PRESTADOR_ID, PrestadoresGruposProtocolo.TO_PRESTADOR_ID ); + FIELD_INDEXES.put( PrestadoresGruposProtocolo.PRESTADOR_ID, PrestadoresGruposProtocolo.PRESTADOR_ID_INDEX ); + FIELD_INDEXES.put( PrestadoresGruposProtocolo.PRESTADOR_ID_FULL, PrestadoresGruposProtocolo.PRESTADOR_ID_INDEX ); + FIELD_INDEXES.put( PrestadoresGruposProtocolo.TO_PRESTADOR_ID, PrestadoresGruposProtocolo.TO_PRESTADOR_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( PrestadoresGruposProtocolo.CLASS_IDENTIFIER, PrestadoresGruposProtocolo.GRUPO_PROTOCOLO_ID, PrestadoresGruposProtocolo.TO_GRUPO_PROTOCOLO_ID ); + FIELD_INDEXES.put( PrestadoresGruposProtocolo.GRUPO_PROTOCOLO_ID, PrestadoresGruposProtocolo.GRUPO_PROTOCOLO_ID_INDEX ); + FIELD_INDEXES.put( PrestadoresGruposProtocolo.GRUPO_PROTOCOLO_ID_FULL, PrestadoresGruposProtocolo.GRUPO_PROTOCOLO_ID_INDEX ); + FIELD_INDEXES.put( PrestadoresGruposProtocolo.TO_GRUPO_PROTOCOLO_ID, PrestadoresGruposProtocolo.TO_GRUPO_PROTOCOLO_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyprestador_idToprestadores = + new com.evolute.entity.ForeignKey( PrestadoresGruposProtocolo.class, PrestadoresGruposProtocolo.PRESTADOR_ID, siprp.data.outer.PrestadoresData.class, siprp.data.outer.PrestadoresData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeygrupo_protocolo_idToprt_grupos_protocolo = + new com.evolute.entity.ForeignKey( PrestadoresGruposProtocolo.class, PrestadoresGruposProtocolo.GRUPO_PROTOCOLO_ID, siprp.data.outer.PrtGruposProtocoloData.class, siprp.data.outer.PrtGruposProtocoloData.ID ); + + public static final String TABLENAME = "prestadores_grupos_protocolo"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.prestadores_grupos_protocolo"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "prestadores_grupos_protocolo.id"; + public static final int ID_INDEX = 0; + public static final String PRESTADOR_ID = "prestador_id"; + public static final String PRESTADOR_ID_FULL = "prestadores_grupos_protocolo.prestador_id"; + public static final int PRESTADOR_ID_INDEX = 1; + public static final String TO_PRESTADOR_ID = "to_prestador_id"; + public static final int TO_PRESTADOR_ID_INDEX = 2; + public static final String GRUPO_PROTOCOLO_ID = "grupo_protocolo_id"; + public static final String GRUPO_PROTOCOLO_ID_FULL = "prestadores_grupos_protocolo.grupo_protocolo_id"; + public static final int GRUPO_PROTOCOLO_ID_INDEX = 3; + public static final String TO_GRUPO_PROTOCOLO_ID = "to_grupo_protocolo_id"; + public static final int TO_GRUPO_PROTOCOLO_ID_INDEX = 4; + + public static final String FIELD_NAMES[] = new String[]{ + PRESTADOR_ID, TO_PRESTADOR_ID, GRUPO_PROTOCOLO_ID, TO_GRUPO_PROTOCOLO_ID, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + PRESTADOR_ID, TABLENAME + "." + TO_PRESTADOR_ID, TABLENAME + "." + GRUPO_PROTOCOLO_ID, TABLENAME + "." + TO_GRUPO_PROTOCOLO_ID, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, PRESTADOR_ID, GRUPO_PROTOCOLO_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, PRESTADOR_ID, GRUPO_PROTOCOLO_ID, }; + + private Integer id; + private Integer prestador_id; + private siprp.data.outer.PrestadoresData to_prestador_id; + private Integer grupo_protocolo_id; + private siprp.data.outer.PrtGruposProtocoloData to_grupo_protocolo_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public PrestadoresGruposProtocolo() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public Integer getPrestador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PRESTADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.prestador_id; + } + + public void setPrestador_id( Integer prestador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( PRESTADOR_ID, prestador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.prestador_id = prestador_id; + LAZY_LOADED_OBJECTS.put( PRESTADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrestadoresData toPrestador_id() + { + try + { + prepare( TO_PRESTADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_prestador_id; + } + + public void setToPrestador_id( siprp.data.outer.PrestadoresData to_prestador_id ) + { + try + { + preProcess( TO_PRESTADOR_ID, to_prestador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_prestador_id = to_prestador_id; + } + + public Integer getGrupo_protocolo_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( GRUPO_PROTOCOLO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.grupo_protocolo_id; + } + + public void setGrupo_protocolo_id( Integer grupo_protocolo_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( GRUPO_PROTOCOLO_ID, grupo_protocolo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.grupo_protocolo_id = grupo_protocolo_id; + LAZY_LOADED_OBJECTS.put( GRUPO_PROTOCOLO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrtGruposProtocoloData toGrupo_protocolo_id() + { + try + { + prepare( TO_GRUPO_PROTOCOLO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_grupo_protocolo_id; + } + + public void setToGrupo_protocolo_id( siprp.data.outer.PrtGruposProtocoloData to_grupo_protocolo_id ) + { + try + { + preProcess( TO_GRUPO_PROTOCOLO_ID, to_grupo_protocolo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_grupo_protocolo_id = to_grupo_protocolo_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case PrestadoresGruposProtocolo.ID_INDEX: + value = getId(); + break; + case PrestadoresGruposProtocolo.PRESTADOR_ID_INDEX: + value = getPrestador_id(); + break; + case PrestadoresGruposProtocolo.TO_PRESTADOR_ID_INDEX: + value = toPrestador_id(); + break; + case PrestadoresGruposProtocolo.GRUPO_PROTOCOLO_ID_INDEX: + value = getGrupo_protocolo_id(); + break; + case PrestadoresGruposProtocolo.TO_GRUPO_PROTOCOLO_ID_INDEX: + value = toGrupo_protocolo_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case PrestadoresGruposProtocolo.ID_INDEX: + value = this.id; + break; + case PrestadoresGruposProtocolo.PRESTADOR_ID_INDEX: + value = this.prestador_id; + break; + case PrestadoresGruposProtocolo.TO_PRESTADOR_ID_INDEX: + value = this.to_prestador_id; + break; + case PrestadoresGruposProtocolo.GRUPO_PROTOCOLO_ID_INDEX: + value = this.grupo_protocolo_id; + break; + case PrestadoresGruposProtocolo.TO_GRUPO_PROTOCOLO_ID_INDEX: + value = this.to_grupo_protocolo_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case PrestadoresGruposProtocolo.ID_INDEX: + setId( ( Integer ) value ); + break; + case PrestadoresGruposProtocolo.PRESTADOR_ID_INDEX: + setPrestador_id( ( Integer ) value ); + break; + case PrestadoresGruposProtocolo.TO_PRESTADOR_ID_INDEX: + setToPrestador_id( ( siprp.data.outer.PrestadoresData ) value ); + break; + case PrestadoresGruposProtocolo.GRUPO_PROTOCOLO_ID_INDEX: + setGrupo_protocolo_id( ( Integer ) value ); + break; + case PrestadoresGruposProtocolo.TO_GRUPO_PROTOCOLO_ID_INDEX: + setToGrupo_protocolo_id( ( siprp.data.outer.PrtGruposProtocoloData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case PrestadoresGruposProtocolo.ID_INDEX: + this.id = ( Integer ) value; + break; + case PrestadoresGruposProtocolo.PRESTADOR_ID_INDEX: + this.prestador_id = ( Integer ) value; + break; + case PrestadoresGruposProtocolo.TO_PRESTADOR_ID_INDEX: + this.to_prestador_id = ( siprp.data.outer.PrestadoresData ) value; + break; + case PrestadoresGruposProtocolo.GRUPO_PROTOCOLO_ID_INDEX: + this.grupo_protocolo_id = ( Integer ) value; + break; + case PrestadoresGruposProtocolo.TO_GRUPO_PROTOCOLO_ID_INDEX: + this.to_grupo_protocolo_id = ( siprp.data.outer.PrtGruposProtocoloData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case PrestadoresGruposProtocolo.ID_INDEX: + theClass = Integer.class; + break; + case PrestadoresGruposProtocolo.PRESTADOR_ID_INDEX: + theClass = Integer.class; + break; + case PrestadoresGruposProtocolo.TO_PRESTADOR_ID_INDEX: + theClass = siprp.data.outer.PrestadoresData.class; + break; + case PrestadoresGruposProtocolo.GRUPO_PROTOCOLO_ID_INDEX: + theClass = Integer.class; + break; + case PrestadoresGruposProtocolo.TO_GRUPO_PROTOCOLO_ID_INDEX: + theClass = siprp.data.outer.PrtGruposProtocoloData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : PrestadoresGruposProtocolo._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, PrestadoresGruposProtocolo.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/PrtElementosProtocolo.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/PrtElementosProtocolo.java new file mode 100644 index 00000000..486942e2 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/PrtElementosProtocolo.java @@ -0,0 +1,481 @@ +/* +* PrtElementosProtocolo.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class PrtElementosProtocolo extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( PrtElementosProtocolo.ID, PrtElementosProtocolo.ID_INDEX ); + FIELD_INDEXES.put( PrtElementosProtocolo.ID_FULL, PrtElementosProtocolo.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( PrtElementosProtocolo.CLASS_IDENTIFIER, PrtElementosProtocolo.TIPO_ELEMENTO_PROTOCOLO_ID, PrtElementosProtocolo.TO_TIPO_ELEMENTO_PROTOCOLO_ID ); + FIELD_INDEXES.put( PrtElementosProtocolo.TIPO_ELEMENTO_PROTOCOLO_ID, PrtElementosProtocolo.TIPO_ELEMENTO_PROTOCOLO_ID_INDEX ); + FIELD_INDEXES.put( PrtElementosProtocolo.TIPO_ELEMENTO_PROTOCOLO_ID_FULL, PrtElementosProtocolo.TIPO_ELEMENTO_PROTOCOLO_ID_INDEX ); + FIELD_INDEXES.put( PrtElementosProtocolo.TO_TIPO_ELEMENTO_PROTOCOLO_ID, PrtElementosProtocolo.TO_TIPO_ELEMENTO_PROTOCOLO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( PrtElementosProtocolo.CLASS_IDENTIFIER, PrtElementosProtocolo.EMPRESA_ID, PrtElementosProtocolo.TO_EMPRESA_ID ); + FIELD_INDEXES.put( PrtElementosProtocolo.EMPRESA_ID, PrtElementosProtocolo.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( PrtElementosProtocolo.EMPRESA_ID_FULL, PrtElementosProtocolo.EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( PrtElementosProtocolo.TO_EMPRESA_ID, PrtElementosProtocolo.TO_EMPRESA_ID_INDEX ); + FIELD_INDEXES.put( PrtElementosProtocolo.NUMERO_PERFIL, PrtElementosProtocolo.NUMERO_PERFIL_INDEX ); + FIELD_INDEXES.put( PrtElementosProtocolo.NUMERO_PERFIL_FULL, PrtElementosProtocolo.NUMERO_PERFIL_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeytipo_elemento_protocolo_idToprt_tipos_elementos_protocolo = + new com.evolute.entity.ForeignKey( PrtElementosProtocolo.class, PrtElementosProtocolo.TIPO_ELEMENTO_PROTOCOLO_ID, siprp.data.outer.PrtTiposElementosProtocoloData.class, siprp.data.outer.PrtTiposElementosProtocoloData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyempresa_idToempresas = + new com.evolute.entity.ForeignKey( PrtElementosProtocolo.class, PrtElementosProtocolo.EMPRESA_ID, siprp.data.outer.EmpresasData.class, siprp.data.outer.EmpresasData.ID ); + + public static final String TABLENAME = "prt_elementos_protocolo"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.prt_elementos_protocolo"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "prt_elementos_protocolo.id"; + public static final int ID_INDEX = 0; + public static final String TIPO_ELEMENTO_PROTOCOLO_ID = "tipo_elemento_protocolo_id"; + public static final String TIPO_ELEMENTO_PROTOCOLO_ID_FULL = "prt_elementos_protocolo.tipo_elemento_protocolo_id"; + public static final int TIPO_ELEMENTO_PROTOCOLO_ID_INDEX = 1; + public static final String TO_TIPO_ELEMENTO_PROTOCOLO_ID = "to_tipo_elemento_protocolo_id"; + public static final int TO_TIPO_ELEMENTO_PROTOCOLO_ID_INDEX = 2; + public static final String EMPRESA_ID = "empresa_id"; + public static final String EMPRESA_ID_FULL = "prt_elementos_protocolo.empresa_id"; + public static final int EMPRESA_ID_INDEX = 3; + public static final String TO_EMPRESA_ID = "to_empresa_id"; + public static final int TO_EMPRESA_ID_INDEX = 4; + public static final String NUMERO_PERFIL = "numero_perfil"; + public static final String NUMERO_PERFIL_FULL = "prt_elementos_protocolo.numero_perfil"; + public static final int NUMERO_PERFIL_INDEX = 5; + + public static final String FIELD_NAMES[] = new String[]{ + TIPO_ELEMENTO_PROTOCOLO_ID, TO_TIPO_ELEMENTO_PROTOCOLO_ID, EMPRESA_ID, + TO_EMPRESA_ID, NUMERO_PERFIL, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + TIPO_ELEMENTO_PROTOCOLO_ID, TABLENAME + "." + TO_TIPO_ELEMENTO_PROTOCOLO_ID, TABLENAME + "." + EMPRESA_ID, + TABLENAME + "." + TO_EMPRESA_ID, TABLENAME + "." + NUMERO_PERFIL, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, TIPO_ELEMENTO_PROTOCOLO_ID, EMPRESA_ID, NUMERO_PERFIL, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, TIPO_ELEMENTO_PROTOCOLO_ID, EMPRESA_ID, NUMERO_PERFIL, }; + + private Integer id; + private Integer tipo_elemento_protocolo_id; + private siprp.data.outer.PrtTiposElementosProtocoloData to_tipo_elemento_protocolo_id; + private Integer empresa_id; + private siprp.data.outer.EmpresasData to_empresa_id; + private Integer numero_perfil; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public PrtElementosProtocolo() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public Integer getTipo_elemento_protocolo_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TIPO_ELEMENTO_PROTOCOLO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.tipo_elemento_protocolo_id; + } + + public void setTipo_elemento_protocolo_id( Integer tipo_elemento_protocolo_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TIPO_ELEMENTO_PROTOCOLO_ID, tipo_elemento_protocolo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.tipo_elemento_protocolo_id = tipo_elemento_protocolo_id; + LAZY_LOADED_OBJECTS.put( TIPO_ELEMENTO_PROTOCOLO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrtTiposElementosProtocoloData toTipo_elemento_protocolo_id() + { + try + { + prepare( TO_TIPO_ELEMENTO_PROTOCOLO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_tipo_elemento_protocolo_id; + } + + public void setToTipo_elemento_protocolo_id( siprp.data.outer.PrtTiposElementosProtocoloData to_tipo_elemento_protocolo_id ) + { + try + { + preProcess( TO_TIPO_ELEMENTO_PROTOCOLO_ID, to_tipo_elemento_protocolo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_tipo_elemento_protocolo_id = to_tipo_elemento_protocolo_id; + } + + public Integer getEmpresa_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EMPRESA_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.empresa_id; + } + + public void setEmpresa_id( Integer empresa_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EMPRESA_ID, empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.empresa_id = empresa_id; + LAZY_LOADED_OBJECTS.put( EMPRESA_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EmpresasData toEmpresa_id() + { + try + { + prepare( TO_EMPRESA_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_empresa_id; + } + + public void setToEmpresa_id( siprp.data.outer.EmpresasData to_empresa_id ) + { + try + { + preProcess( TO_EMPRESA_ID, to_empresa_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_empresa_id = to_empresa_id; + } + + public Integer getNumero_perfil() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NUMERO_PERFIL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.numero_perfil; + } + + public void setNumero_perfil( Integer numero_perfil ) + { + try + { + setLockedForRefresh( true ); + preProcess( NUMERO_PERFIL, numero_perfil ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.numero_perfil = numero_perfil; + LAZY_LOADED_OBJECTS.put( NUMERO_PERFIL, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case PrtElementosProtocolo.ID_INDEX: + value = getId(); + break; + case PrtElementosProtocolo.TIPO_ELEMENTO_PROTOCOLO_ID_INDEX: + value = getTipo_elemento_protocolo_id(); + break; + case PrtElementosProtocolo.TO_TIPO_ELEMENTO_PROTOCOLO_ID_INDEX: + value = toTipo_elemento_protocolo_id(); + break; + case PrtElementosProtocolo.EMPRESA_ID_INDEX: + value = getEmpresa_id(); + break; + case PrtElementosProtocolo.TO_EMPRESA_ID_INDEX: + value = toEmpresa_id(); + break; + case PrtElementosProtocolo.NUMERO_PERFIL_INDEX: + value = getNumero_perfil(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case PrtElementosProtocolo.ID_INDEX: + value = this.id; + break; + case PrtElementosProtocolo.TIPO_ELEMENTO_PROTOCOLO_ID_INDEX: + value = this.tipo_elemento_protocolo_id; + break; + case PrtElementosProtocolo.TO_TIPO_ELEMENTO_PROTOCOLO_ID_INDEX: + value = this.to_tipo_elemento_protocolo_id; + break; + case PrtElementosProtocolo.EMPRESA_ID_INDEX: + value = this.empresa_id; + break; + case PrtElementosProtocolo.TO_EMPRESA_ID_INDEX: + value = this.to_empresa_id; + break; + case PrtElementosProtocolo.NUMERO_PERFIL_INDEX: + value = this.numero_perfil; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case PrtElementosProtocolo.ID_INDEX: + setId( ( Integer ) value ); + break; + case PrtElementosProtocolo.TIPO_ELEMENTO_PROTOCOLO_ID_INDEX: + setTipo_elemento_protocolo_id( ( Integer ) value ); + break; + case PrtElementosProtocolo.TO_TIPO_ELEMENTO_PROTOCOLO_ID_INDEX: + setToTipo_elemento_protocolo_id( ( siprp.data.outer.PrtTiposElementosProtocoloData ) value ); + break; + case PrtElementosProtocolo.EMPRESA_ID_INDEX: + setEmpresa_id( ( Integer ) value ); + break; + case PrtElementosProtocolo.TO_EMPRESA_ID_INDEX: + setToEmpresa_id( ( siprp.data.outer.EmpresasData ) value ); + break; + case PrtElementosProtocolo.NUMERO_PERFIL_INDEX: + setNumero_perfil( ( Integer ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case PrtElementosProtocolo.ID_INDEX: + this.id = ( Integer ) value; + break; + case PrtElementosProtocolo.TIPO_ELEMENTO_PROTOCOLO_ID_INDEX: + this.tipo_elemento_protocolo_id = ( Integer ) value; + break; + case PrtElementosProtocolo.TO_TIPO_ELEMENTO_PROTOCOLO_ID_INDEX: + this.to_tipo_elemento_protocolo_id = ( siprp.data.outer.PrtTiposElementosProtocoloData ) value; + break; + case PrtElementosProtocolo.EMPRESA_ID_INDEX: + this.empresa_id = ( Integer ) value; + break; + case PrtElementosProtocolo.TO_EMPRESA_ID_INDEX: + this.to_empresa_id = ( siprp.data.outer.EmpresasData ) value; + break; + case PrtElementosProtocolo.NUMERO_PERFIL_INDEX: + this.numero_perfil = ( Integer ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case PrtElementosProtocolo.ID_INDEX: + theClass = Integer.class; + break; + case PrtElementosProtocolo.TIPO_ELEMENTO_PROTOCOLO_ID_INDEX: + theClass = Integer.class; + break; + case PrtElementosProtocolo.TO_TIPO_ELEMENTO_PROTOCOLO_ID_INDEX: + theClass = siprp.data.outer.PrtTiposElementosProtocoloData.class; + break; + case PrtElementosProtocolo.EMPRESA_ID_INDEX: + theClass = Integer.class; + break; + case PrtElementosProtocolo.TO_EMPRESA_ID_INDEX: + theClass = siprp.data.outer.EmpresasData.class; + break; + case PrtElementosProtocolo.NUMERO_PERFIL_INDEX: + theClass = Integer.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : PrtElementosProtocolo._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, PrtElementosProtocolo.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/PrtGruposProtocolo.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/PrtGruposProtocolo.java new file mode 100644 index 00000000..5598a576 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/PrtGruposProtocolo.java @@ -0,0 +1,586 @@ +/* +* PrtGruposProtocolo.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class PrtGruposProtocolo extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( PrtGruposProtocolo.ID, PrtGruposProtocolo.ID_INDEX ); + FIELD_INDEXES.put( PrtGruposProtocolo.ID_FULL, PrtGruposProtocolo.ID_INDEX ); + FIELD_INDEXES.put( PrtGruposProtocolo.DESCRICAO, PrtGruposProtocolo.DESCRICAO_INDEX ); + FIELD_INDEXES.put( PrtGruposProtocolo.DESCRICAO_FULL, PrtGruposProtocolo.DESCRICAO_INDEX ); + FIELD_INDEXES.put( PrtGruposProtocolo.DESCRICAO_PLAIN, PrtGruposProtocolo.DESCRICAO_PLAIN_INDEX ); + FIELD_INDEXES.put( PrtGruposProtocolo.DESCRICAO_PLAIN_FULL, PrtGruposProtocolo.DESCRICAO_PLAIN_INDEX ); + FIELD_INDEXES.put( PrtGruposProtocolo.GRUPO_REAL, PrtGruposProtocolo.GRUPO_REAL_INDEX ); + FIELD_INDEXES.put( PrtGruposProtocolo.GRUPO_REAL_FULL, PrtGruposProtocolo.GRUPO_REAL_INDEX ); + FIELD_INDEXES.put( PrtGruposProtocolo.ORDEM, PrtGruposProtocolo.ORDEM_INDEX ); + FIELD_INDEXES.put( PrtGruposProtocolo.ORDEM_FULL, PrtGruposProtocolo.ORDEM_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( PrtGruposProtocolo.CLASS_IDENTIFIER, PrtGruposProtocolo.ANALISADOR_ID, PrtGruposProtocolo.TO_ANALISADOR_ID ); + FIELD_INDEXES.put( PrtGruposProtocolo.ANALISADOR_ID, PrtGruposProtocolo.ANALISADOR_ID_INDEX ); + FIELD_INDEXES.put( PrtGruposProtocolo.ANALISADOR_ID_FULL, PrtGruposProtocolo.ANALISADOR_ID_INDEX ); + FIELD_INDEXES.put( PrtGruposProtocolo.TO_ANALISADOR_ID, PrtGruposProtocolo.TO_ANALISADOR_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyanalisador_idToprestadores = + new com.evolute.entity.ForeignKey( PrtGruposProtocolo.class, PrtGruposProtocolo.ANALISADOR_ID, siprp.data.outer.PrestadoresData.class, siprp.data.outer.PrestadoresData.ID ); + + public static final String TABLENAME = "prt_grupos_protocolo"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.prt_grupos_protocolo"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "prt_grupos_protocolo.id"; + public static final int ID_INDEX = 0; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "prt_grupos_protocolo.descricao"; + public static final int DESCRICAO_INDEX = 1; + public static final String DESCRICAO_PLAIN = "descricao_plain"; + public static final String DESCRICAO_PLAIN_FULL = "prt_grupos_protocolo.descricao_plain"; + public static final int DESCRICAO_PLAIN_INDEX = 2; + public static final String GRUPO_REAL = "grupo_real"; + public static final String GRUPO_REAL_FULL = "prt_grupos_protocolo.grupo_real"; + public static final int GRUPO_REAL_INDEX = 3; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "prt_grupos_protocolo.ordem"; + public static final int ORDEM_INDEX = 4; + public static final String ANALISADOR_ID = "analisador_id"; + public static final String ANALISADOR_ID_FULL = "prt_grupos_protocolo.analisador_id"; + public static final int ANALISADOR_ID_INDEX = 5; + public static final String TO_ANALISADOR_ID = "to_analisador_id"; + public static final int TO_ANALISADOR_ID_INDEX = 6; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRICAO, DESCRICAO_PLAIN, GRUPO_REAL, ORDEM, ANALISADOR_ID, TO_ANALISADOR_ID, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DESCRICAO, TABLENAME + "." + DESCRICAO_PLAIN, TABLENAME + "." + GRUPO_REAL, TABLENAME + "." + ORDEM, TABLENAME + "." + ANALISADOR_ID, TABLENAME + "." + TO_ANALISADOR_ID, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DESCRICAO, DESCRICAO_PLAIN, GRUPO_REAL, ORDEM, ANALISADOR_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DESCRICAO, DESCRICAO_PLAIN, GRUPO_REAL, ORDEM, ANALISADOR_ID, }; + + private Integer id; + private String descricao; + private String descricao_plain; + private String grupo_real; + private Integer ordem; + private Integer analisador_id; + private siprp.data.outer.PrestadoresData to_analisador_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public PrtGruposProtocolo() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromMarcacoesGruposRealizados_grupo_protocolo_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.MarcacoesGruposRealizadosData.class , getPrimaryKey().getMap().get("id"), "grupo_protocolo_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromPrestadoresGruposProtocolo_grupo_protocolo_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.PrestadoresGruposProtocoloData.class , getPrimaryKey().getMap().get("id"), "grupo_protocolo_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromPrtTiposElementosProtocolo_grupo_protocolo_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.PrtTiposElementosProtocoloData.class , getPrimaryKey().getMap().get("id"), "grupo_protocolo_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresEcdsAnalise_grupo_ecds_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresEcdsAnaliseData.class , getPrimaryKey().getMap().get("id"), "grupo_ecds_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getDescricao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRICAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.descricao; + } + + public void setDescricao( String descricao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRICAO, descricao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.descricao = descricao; + LAZY_LOADED_OBJECTS.put( DESCRICAO, Boolean.TRUE ); + } + + public String getDescricao_plain() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRICAO_PLAIN ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.descricao_plain; + } + + public void setDescricao_plain( String descricao_plain ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRICAO_PLAIN, descricao_plain ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.descricao_plain = descricao_plain; + LAZY_LOADED_OBJECTS.put( DESCRICAO_PLAIN, Boolean.TRUE ); + } + + public String getGrupo_real() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( GRUPO_REAL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.grupo_real; + } + + public void setGrupo_real( String grupo_real ) + { + try + { + setLockedForRefresh( true ); + preProcess( GRUPO_REAL, grupo_real ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.grupo_real = grupo_real; + LAZY_LOADED_OBJECTS.put( GRUPO_REAL, Boolean.TRUE ); + } + + public Integer getOrdem() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ORDEM ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.ordem; + } + + public void setOrdem( Integer ordem ) + { + try + { + setLockedForRefresh( true ); + preProcess( ORDEM, ordem ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.ordem = ordem; + LAZY_LOADED_OBJECTS.put( ORDEM, Boolean.TRUE ); + } + + public Integer getAnalisador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ANALISADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.analisador_id; + } + + public void setAnalisador_id( Integer analisador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ANALISADOR_ID, analisador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.analisador_id = analisador_id; + LAZY_LOADED_OBJECTS.put( ANALISADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrestadoresData toAnalisador_id() + { + try + { + prepare( TO_ANALISADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_analisador_id; + } + + public void setToAnalisador_id( siprp.data.outer.PrestadoresData to_analisador_id ) + { + try + { + preProcess( TO_ANALISADOR_ID, to_analisador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_analisador_id = to_analisador_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case PrtGruposProtocolo.ID_INDEX: + value = getId(); + break; + case PrtGruposProtocolo.DESCRICAO_INDEX: + value = getDescricao(); + break; + case PrtGruposProtocolo.DESCRICAO_PLAIN_INDEX: + value = getDescricao_plain(); + break; + case PrtGruposProtocolo.GRUPO_REAL_INDEX: + value = getGrupo_real(); + break; + case PrtGruposProtocolo.ORDEM_INDEX: + value = getOrdem(); + break; + case PrtGruposProtocolo.ANALISADOR_ID_INDEX: + value = getAnalisador_id(); + break; + case PrtGruposProtocolo.TO_ANALISADOR_ID_INDEX: + value = toAnalisador_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case PrtGruposProtocolo.ID_INDEX: + value = this.id; + break; + case PrtGruposProtocolo.DESCRICAO_INDEX: + value = this.descricao; + break; + case PrtGruposProtocolo.DESCRICAO_PLAIN_INDEX: + value = this.descricao_plain; + break; + case PrtGruposProtocolo.GRUPO_REAL_INDEX: + value = this.grupo_real; + break; + case PrtGruposProtocolo.ORDEM_INDEX: + value = this.ordem; + break; + case PrtGruposProtocolo.ANALISADOR_ID_INDEX: + value = this.analisador_id; + break; + case PrtGruposProtocolo.TO_ANALISADOR_ID_INDEX: + value = this.to_analisador_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case PrtGruposProtocolo.ID_INDEX: + setId( ( Integer ) value ); + break; + case PrtGruposProtocolo.DESCRICAO_INDEX: + setDescricao( ( String ) value ); + break; + case PrtGruposProtocolo.DESCRICAO_PLAIN_INDEX: + setDescricao_plain( ( String ) value ); + break; + case PrtGruposProtocolo.GRUPO_REAL_INDEX: + setGrupo_real( ( String ) value ); + break; + case PrtGruposProtocolo.ORDEM_INDEX: + setOrdem( ( Integer ) value ); + break; + case PrtGruposProtocolo.ANALISADOR_ID_INDEX: + setAnalisador_id( ( Integer ) value ); + break; + case PrtGruposProtocolo.TO_ANALISADOR_ID_INDEX: + setToAnalisador_id( ( siprp.data.outer.PrestadoresData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case PrtGruposProtocolo.ID_INDEX: + this.id = ( Integer ) value; + break; + case PrtGruposProtocolo.DESCRICAO_INDEX: + this.descricao = ( String ) value; + break; + case PrtGruposProtocolo.DESCRICAO_PLAIN_INDEX: + this.descricao_plain = ( String ) value; + break; + case PrtGruposProtocolo.GRUPO_REAL_INDEX: + this.grupo_real = ( String ) value; + break; + case PrtGruposProtocolo.ORDEM_INDEX: + this.ordem = ( Integer ) value; + break; + case PrtGruposProtocolo.ANALISADOR_ID_INDEX: + this.analisador_id = ( Integer ) value; + break; + case PrtGruposProtocolo.TO_ANALISADOR_ID_INDEX: + this.to_analisador_id = ( siprp.data.outer.PrestadoresData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case PrtGruposProtocolo.ID_INDEX: + theClass = Integer.class; + break; + case PrtGruposProtocolo.DESCRICAO_INDEX: + theClass = String.class; + break; + case PrtGruposProtocolo.DESCRICAO_PLAIN_INDEX: + theClass = String.class; + break; + case PrtGruposProtocolo.GRUPO_REAL_INDEX: + theClass = String.class; + break; + case PrtGruposProtocolo.ORDEM_INDEX: + theClass = Integer.class; + break; + case PrtGruposProtocolo.ANALISADOR_ID_INDEX: + theClass = Integer.class; + break; + case PrtGruposProtocolo.TO_ANALISADOR_ID_INDEX: + theClass = siprp.data.outer.PrestadoresData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : PrtGruposProtocolo._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, PrtGruposProtocolo.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/PrtTiposElementosProtocolo.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/PrtTiposElementosProtocolo.java new file mode 100644 index 00000000..7e5bd098 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/PrtTiposElementosProtocolo.java @@ -0,0 +1,508 @@ +/* +* PrtTiposElementosProtocolo.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class PrtTiposElementosProtocolo extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( PrtTiposElementosProtocolo.ID, PrtTiposElementosProtocolo.ID_INDEX ); + FIELD_INDEXES.put( PrtTiposElementosProtocolo.ID_FULL, PrtTiposElementosProtocolo.ID_INDEX ); + FIELD_INDEXES.put( PrtTiposElementosProtocolo.DESCRICAO_PLAIN, PrtTiposElementosProtocolo.DESCRICAO_PLAIN_INDEX ); + FIELD_INDEXES.put( PrtTiposElementosProtocolo.DESCRICAO_PLAIN_FULL, PrtTiposElementosProtocolo.DESCRICAO_PLAIN_INDEX ); + FIELD_INDEXES.put( PrtTiposElementosProtocolo.DESCRICAO, PrtTiposElementosProtocolo.DESCRICAO_INDEX ); + FIELD_INDEXES.put( PrtTiposElementosProtocolo.DESCRICAO_FULL, PrtTiposElementosProtocolo.DESCRICAO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( PrtTiposElementosProtocolo.CLASS_IDENTIFIER, PrtTiposElementosProtocolo.GRUPO_PROTOCOLO_ID, PrtTiposElementosProtocolo.TO_GRUPO_PROTOCOLO_ID ); + FIELD_INDEXES.put( PrtTiposElementosProtocolo.GRUPO_PROTOCOLO_ID, PrtTiposElementosProtocolo.GRUPO_PROTOCOLO_ID_INDEX ); + FIELD_INDEXES.put( PrtTiposElementosProtocolo.GRUPO_PROTOCOLO_ID_FULL, PrtTiposElementosProtocolo.GRUPO_PROTOCOLO_ID_INDEX ); + FIELD_INDEXES.put( PrtTiposElementosProtocolo.TO_GRUPO_PROTOCOLO_ID, PrtTiposElementosProtocolo.TO_GRUPO_PROTOCOLO_ID_INDEX ); + FIELD_INDEXES.put( PrtTiposElementosProtocolo.ORDEM, PrtTiposElementosProtocolo.ORDEM_INDEX ); + FIELD_INDEXES.put( PrtTiposElementosProtocolo.ORDEM_FULL, PrtTiposElementosProtocolo.ORDEM_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeygrupo_protocolo_idToprt_grupos_protocolo = + new com.evolute.entity.ForeignKey( PrtTiposElementosProtocolo.class, PrtTiposElementosProtocolo.GRUPO_PROTOCOLO_ID, siprp.data.outer.PrtGruposProtocoloData.class, siprp.data.outer.PrtGruposProtocoloData.ID ); + + public static final String TABLENAME = "prt_tipos_elementos_protocolo"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.prt_tipos_elementos_protocolo"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "prt_tipos_elementos_protocolo.id"; + public static final int ID_INDEX = 0; + public static final String DESCRICAO_PLAIN = "descricao_plain"; + public static final String DESCRICAO_PLAIN_FULL = "prt_tipos_elementos_protocolo.descricao_plain"; + public static final int DESCRICAO_PLAIN_INDEX = 1; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "prt_tipos_elementos_protocolo.descricao"; + public static final int DESCRICAO_INDEX = 2; + public static final String GRUPO_PROTOCOLO_ID = "grupo_protocolo_id"; + public static final String GRUPO_PROTOCOLO_ID_FULL = "prt_tipos_elementos_protocolo.grupo_protocolo_id"; + public static final int GRUPO_PROTOCOLO_ID_INDEX = 3; + public static final String TO_GRUPO_PROTOCOLO_ID = "to_grupo_protocolo_id"; + public static final int TO_GRUPO_PROTOCOLO_ID_INDEX = 4; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "prt_tipos_elementos_protocolo.ordem"; + public static final int ORDEM_INDEX = 5; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRICAO_PLAIN, DESCRICAO, GRUPO_PROTOCOLO_ID, TO_GRUPO_PROTOCOLO_ID, ORDEM, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DESCRICAO_PLAIN, TABLENAME + "." + DESCRICAO, TABLENAME + "." + GRUPO_PROTOCOLO_ID, TABLENAME + "." + TO_GRUPO_PROTOCOLO_ID, TABLENAME + "." + ORDEM, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DESCRICAO_PLAIN, DESCRICAO, GRUPO_PROTOCOLO_ID, ORDEM, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DESCRICAO_PLAIN, DESCRICAO, GRUPO_PROTOCOLO_ID, ORDEM, }; + + private Integer id; + private String descricao_plain; + private String descricao; + private Integer grupo_protocolo_id; + private siprp.data.outer.PrtGruposProtocoloData to_grupo_protocolo_id; + private Integer ordem; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public PrtTiposElementosProtocolo() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromPrtElementosProtocolo_tipo_elemento_protocolo_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.PrtElementosProtocoloData.class , getPrimaryKey().getMap().get("id"), "tipo_elemento_protocolo_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresEcd_ecd_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresEcdData.class , getPrimaryKey().getMap().get("id"), "ecd_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getDescricao_plain() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRICAO_PLAIN ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.descricao_plain; + } + + public void setDescricao_plain( String descricao_plain ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRICAO_PLAIN, descricao_plain ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.descricao_plain = descricao_plain; + LAZY_LOADED_OBJECTS.put( DESCRICAO_PLAIN, Boolean.TRUE ); + } + + public String getDescricao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRICAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.descricao; + } + + public void setDescricao( String descricao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRICAO, descricao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.descricao = descricao; + LAZY_LOADED_OBJECTS.put( DESCRICAO, Boolean.TRUE ); + } + + public Integer getGrupo_protocolo_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( GRUPO_PROTOCOLO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.grupo_protocolo_id; + } + + public void setGrupo_protocolo_id( Integer grupo_protocolo_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( GRUPO_PROTOCOLO_ID, grupo_protocolo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.grupo_protocolo_id = grupo_protocolo_id; + LAZY_LOADED_OBJECTS.put( GRUPO_PROTOCOLO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrtGruposProtocoloData toGrupo_protocolo_id() + { + try + { + prepare( TO_GRUPO_PROTOCOLO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_grupo_protocolo_id; + } + + public void setToGrupo_protocolo_id( siprp.data.outer.PrtGruposProtocoloData to_grupo_protocolo_id ) + { + try + { + preProcess( TO_GRUPO_PROTOCOLO_ID, to_grupo_protocolo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_grupo_protocolo_id = to_grupo_protocolo_id; + } + + public Integer getOrdem() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ORDEM ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.ordem; + } + + public void setOrdem( Integer ordem ) + { + try + { + setLockedForRefresh( true ); + preProcess( ORDEM, ordem ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.ordem = ordem; + LAZY_LOADED_OBJECTS.put( ORDEM, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case PrtTiposElementosProtocolo.ID_INDEX: + value = getId(); + break; + case PrtTiposElementosProtocolo.DESCRICAO_PLAIN_INDEX: + value = getDescricao_plain(); + break; + case PrtTiposElementosProtocolo.DESCRICAO_INDEX: + value = getDescricao(); + break; + case PrtTiposElementosProtocolo.GRUPO_PROTOCOLO_ID_INDEX: + value = getGrupo_protocolo_id(); + break; + case PrtTiposElementosProtocolo.TO_GRUPO_PROTOCOLO_ID_INDEX: + value = toGrupo_protocolo_id(); + break; + case PrtTiposElementosProtocolo.ORDEM_INDEX: + value = getOrdem(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case PrtTiposElementosProtocolo.ID_INDEX: + value = this.id; + break; + case PrtTiposElementosProtocolo.DESCRICAO_PLAIN_INDEX: + value = this.descricao_plain; + break; + case PrtTiposElementosProtocolo.DESCRICAO_INDEX: + value = this.descricao; + break; + case PrtTiposElementosProtocolo.GRUPO_PROTOCOLO_ID_INDEX: + value = this.grupo_protocolo_id; + break; + case PrtTiposElementosProtocolo.TO_GRUPO_PROTOCOLO_ID_INDEX: + value = this.to_grupo_protocolo_id; + break; + case PrtTiposElementosProtocolo.ORDEM_INDEX: + value = this.ordem; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case PrtTiposElementosProtocolo.ID_INDEX: + setId( ( Integer ) value ); + break; + case PrtTiposElementosProtocolo.DESCRICAO_PLAIN_INDEX: + setDescricao_plain( ( String ) value ); + break; + case PrtTiposElementosProtocolo.DESCRICAO_INDEX: + setDescricao( ( String ) value ); + break; + case PrtTiposElementosProtocolo.GRUPO_PROTOCOLO_ID_INDEX: + setGrupo_protocolo_id( ( Integer ) value ); + break; + case PrtTiposElementosProtocolo.TO_GRUPO_PROTOCOLO_ID_INDEX: + setToGrupo_protocolo_id( ( siprp.data.outer.PrtGruposProtocoloData ) value ); + break; + case PrtTiposElementosProtocolo.ORDEM_INDEX: + setOrdem( ( Integer ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case PrtTiposElementosProtocolo.ID_INDEX: + this.id = ( Integer ) value; + break; + case PrtTiposElementosProtocolo.DESCRICAO_PLAIN_INDEX: + this.descricao_plain = ( String ) value; + break; + case PrtTiposElementosProtocolo.DESCRICAO_INDEX: + this.descricao = ( String ) value; + break; + case PrtTiposElementosProtocolo.GRUPO_PROTOCOLO_ID_INDEX: + this.grupo_protocolo_id = ( Integer ) value; + break; + case PrtTiposElementosProtocolo.TO_GRUPO_PROTOCOLO_ID_INDEX: + this.to_grupo_protocolo_id = ( siprp.data.outer.PrtGruposProtocoloData ) value; + break; + case PrtTiposElementosProtocolo.ORDEM_INDEX: + this.ordem = ( Integer ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case PrtTiposElementosProtocolo.ID_INDEX: + theClass = Integer.class; + break; + case PrtTiposElementosProtocolo.DESCRICAO_PLAIN_INDEX: + theClass = String.class; + break; + case PrtTiposElementosProtocolo.DESCRICAO_INDEX: + theClass = String.class; + break; + case PrtTiposElementosProtocolo.GRUPO_PROTOCOLO_ID_INDEX: + theClass = Integer.class; + break; + case PrtTiposElementosProtocolo.TO_GRUPO_PROTOCOLO_ID_INDEX: + theClass = siprp.data.outer.PrtGruposProtocoloData.class; + break; + case PrtTiposElementosProtocolo.ORDEM_INDEX: + theClass = Integer.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : PrtTiposElementosProtocolo._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, PrtTiposElementosProtocolo.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TiposExamesComp.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TiposExamesComp.java new file mode 100644 index 00000000..47d8c185 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TiposExamesComp.java @@ -0,0 +1,344 @@ +/* +* TiposExamesComp.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class TiposExamesComp extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( TiposExamesComp.ID, TiposExamesComp.ID_INDEX ); + FIELD_INDEXES.put( TiposExamesComp.ID_FULL, TiposExamesComp.ID_INDEX ); + FIELD_INDEXES.put( TiposExamesComp.ORDEM, TiposExamesComp.ORDEM_INDEX ); + FIELD_INDEXES.put( TiposExamesComp.ORDEM_FULL, TiposExamesComp.ORDEM_INDEX ); + FIELD_INDEXES.put( TiposExamesComp.DESCRICAO, TiposExamesComp.DESCRICAO_INDEX ); + FIELD_INDEXES.put( TiposExamesComp.DESCRICAO_FULL, TiposExamesComp.DESCRICAO_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "tipos_exames_comp"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.tipos_exames_comp"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "tipos_exames_comp.id"; + public static final int ID_INDEX = 0; + public static final String ORDEM = "ordem"; + public static final String ORDEM_FULL = "tipos_exames_comp.ordem"; + public static final int ORDEM_INDEX = 1; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_FULL = "tipos_exames_comp.descricao"; + public static final int DESCRICAO_INDEX = 2; + + public static final String FIELD_NAMES[] = new String[]{ + ORDEM, DESCRICAO, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + ORDEM, TABLENAME + "." + DESCRICAO, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, ORDEM, DESCRICAO, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, ORDEM, DESCRICAO, }; + + private Integer id; + private Integer ordem; + private String descricao; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public TiposExamesComp() + { + super(); + dirtyProperties = new boolean[]{ false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromExamesPerfis_tipo() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.ExamesPerfisData.class , getPrimaryKey().getMap().get("id"), "tipo" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public Integer getOrdem() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ORDEM ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.ordem; + } + + public void setOrdem( Integer ordem ) + { + try + { + setLockedForRefresh( true ); + preProcess( ORDEM, ordem ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.ordem = ordem; + LAZY_LOADED_OBJECTS.put( ORDEM, Boolean.TRUE ); + } + + public String getDescricao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESCRICAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.descricao; + } + + public void setDescricao( String descricao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESCRICAO, descricao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.descricao = descricao; + LAZY_LOADED_OBJECTS.put( DESCRICAO, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TiposExamesComp.ID_INDEX: + value = getId(); + break; + case TiposExamesComp.ORDEM_INDEX: + value = getOrdem(); + break; + case TiposExamesComp.DESCRICAO_INDEX: + value = getDescricao(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TiposExamesComp.ID_INDEX: + value = this.id; + break; + case TiposExamesComp.ORDEM_INDEX: + value = this.ordem; + break; + case TiposExamesComp.DESCRICAO_INDEX: + value = this.descricao; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TiposExamesComp.ID_INDEX: + setId( ( Integer ) value ); + break; + case TiposExamesComp.ORDEM_INDEX: + setOrdem( ( Integer ) value ); + break; + case TiposExamesComp.DESCRICAO_INDEX: + setDescricao( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TiposExamesComp.ID_INDEX: + this.id = ( Integer ) value; + break; + case TiposExamesComp.ORDEM_INDEX: + this.ordem = ( Integer ) value; + break; + case TiposExamesComp.DESCRICAO_INDEX: + this.descricao = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case TiposExamesComp.ID_INDEX: + theClass = Integer.class; + break; + case TiposExamesComp.ORDEM_INDEX: + theClass = Integer.class; + break; + case TiposExamesComp.DESCRICAO_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : TiposExamesComp._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, TiposExamesComp.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Trabalhadores.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Trabalhadores.java new file mode 100644 index 00000000..0eeb82ff --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Trabalhadores.java @@ -0,0 +1,1442 @@ +/* +* Trabalhadores.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class Trabalhadores extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( Trabalhadores.ID, Trabalhadores.ID_INDEX ); + FIELD_INDEXES.put( Trabalhadores.ID_FULL, Trabalhadores.ID_INDEX ); + FIELD_INDEXES.put( Trabalhadores.NOME, Trabalhadores.NOME_INDEX ); + FIELD_INDEXES.put( Trabalhadores.NOME_FULL, Trabalhadores.NOME_INDEX ); + FIELD_INDEXES.put( Trabalhadores.SEXO, Trabalhadores.SEXO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.SEXO_FULL, Trabalhadores.SEXO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.DATA_NASCIMENTO, Trabalhadores.DATA_NASCIMENTO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.DATA_NASCIMENTO_FULL, Trabalhadores.DATA_NASCIMENTO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.NACIONALIDADE, Trabalhadores.NACIONALIDADE_INDEX ); + FIELD_INDEXES.put( Trabalhadores.NACIONALIDADE_FULL, Trabalhadores.NACIONALIDADE_INDEX ); + FIELD_INDEXES.put( Trabalhadores.NUMERO_MECANOGRAFICO, Trabalhadores.NUMERO_MECANOGRAFICO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.NUMERO_MECANOGRAFICO_FULL, Trabalhadores.NUMERO_MECANOGRAFICO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.DATA_ADMISSAO, Trabalhadores.DATA_ADMISSAO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.DATA_ADMISSAO_FULL, Trabalhadores.DATA_ADMISSAO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.CATEGORIA, Trabalhadores.CATEGORIA_INDEX ); + FIELD_INDEXES.put( Trabalhadores.CATEGORIA_FULL, Trabalhadores.CATEGORIA_INDEX ); + FIELD_INDEXES.put( Trabalhadores.LOCAL_TRABALHO, Trabalhadores.LOCAL_TRABALHO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.LOCAL_TRABALHO_FULL, Trabalhadores.LOCAL_TRABALHO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.FUNCAO_PROPOSTA, Trabalhadores.FUNCAO_PROPOSTA_INDEX ); + FIELD_INDEXES.put( Trabalhadores.FUNCAO_PROPOSTA_FULL, Trabalhadores.FUNCAO_PROPOSTA_INDEX ); + FIELD_INDEXES.put( Trabalhadores.DATA_ADMISSAO_FUNCAO, Trabalhadores.DATA_ADMISSAO_FUNCAO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.DATA_ADMISSAO_FUNCAO_FULL, Trabalhadores.DATA_ADMISSAO_FUNCAO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.OBSERVACOES, Trabalhadores.OBSERVACOES_INDEX ); + FIELD_INDEXES.put( Trabalhadores.OBSERVACOES_FULL, Trabalhadores.OBSERVACOES_INDEX ); + FIELD_INDEXES.put( Trabalhadores.INACTIVO, Trabalhadores.INACTIVO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.INACTIVO_FULL, Trabalhadores.INACTIVO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( Trabalhadores.CLASS_IDENTIFIER, Trabalhadores.ESTABELECIMENTO_ID, Trabalhadores.TO_ESTABELECIMENTO_ID ); + FIELD_INDEXES.put( Trabalhadores.ESTABELECIMENTO_ID, Trabalhadores.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( Trabalhadores.ESTABELECIMENTO_ID_FULL, Trabalhadores.ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( Trabalhadores.TO_ESTABELECIMENTO_ID, Trabalhadores.TO_ESTABELECIMENTO_ID_INDEX ); + FIELD_INDEXES.put( Trabalhadores.DATA_DEMISSAO, Trabalhadores.DATA_DEMISSAO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.DATA_DEMISSAO_FULL, Trabalhadores.DATA_DEMISSAO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.OBSERVACOES_GESTAO, Trabalhadores.OBSERVACOES_GESTAO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.OBSERVACOES_GESTAO_FULL, Trabalhadores.OBSERVACOES_GESTAO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.PERFIL, Trabalhadores.PERFIL_INDEX ); + FIELD_INDEXES.put( Trabalhadores.PERFIL_FULL, Trabalhadores.PERFIL_INDEX ); + FIELD_INDEXES.put( Trabalhadores.ACTUALIZACAO, Trabalhadores.ACTUALIZACAO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.ACTUALIZACAO_FULL, Trabalhadores.ACTUALIZACAO_INDEX ); + FIELD_INDEXES.put( Trabalhadores.NOME_PLAIN, Trabalhadores.NOME_PLAIN_INDEX ); + FIELD_INDEXES.put( Trabalhadores.NOME_PLAIN_FULL, Trabalhadores.NOME_PLAIN_INDEX ); + FIELD_INDEXES.put( Trabalhadores.BI, Trabalhadores.BI_INDEX ); + FIELD_INDEXES.put( Trabalhadores.BI_FULL, Trabalhadores.BI_INDEX ); + FIELD_INDEXES.put( Trabalhadores.NIF, Trabalhadores.NIF_INDEX ); + FIELD_INDEXES.put( Trabalhadores.NIF_FULL, Trabalhadores.NIF_INDEX ); + FIELD_INDEXES.put( Trabalhadores.NUMERO_UTENTE, Trabalhadores.NUMERO_UTENTE_INDEX ); + FIELD_INDEXES.put( Trabalhadores.NUMERO_UTENTE_FULL, Trabalhadores.NUMERO_UTENTE_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyestabelecimento_idToestabelecimentos = + new com.evolute.entity.ForeignKey( Trabalhadores.class, Trabalhadores.ESTABELECIMENTO_ID, siprp.data.outer.EstabelecimentosData.class, siprp.data.outer.EstabelecimentosData.ID ); + + public static final String TABLENAME = "trabalhadores"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.trabalhadores"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores.id"; + public static final int ID_INDEX = 0; + public static final String NOME = "nome"; + public static final String NOME_FULL = "trabalhadores.nome"; + public static final int NOME_INDEX = 1; + public static final String SEXO = "sexo"; + public static final String SEXO_FULL = "trabalhadores.sexo"; + public static final int SEXO_INDEX = 2; + public static final String DATA_NASCIMENTO = "data_nascimento"; + public static final String DATA_NASCIMENTO_FULL = "trabalhadores.data_nascimento"; + public static final int DATA_NASCIMENTO_INDEX = 3; + public static final String NACIONALIDADE = "nacionalidade"; + public static final String NACIONALIDADE_FULL = "trabalhadores.nacionalidade"; + public static final int NACIONALIDADE_INDEX = 4; + public static final String NUMERO_MECANOGRAFICO = "numero_mecanografico"; + public static final String NUMERO_MECANOGRAFICO_FULL = "trabalhadores.numero_mecanografico"; + public static final int NUMERO_MECANOGRAFICO_INDEX = 5; + public static final String DATA_ADMISSAO = "data_admissao"; + public static final String DATA_ADMISSAO_FULL = "trabalhadores.data_admissao"; + public static final int DATA_ADMISSAO_INDEX = 6; + public static final String CATEGORIA = "categoria"; + public static final String CATEGORIA_FULL = "trabalhadores.categoria"; + public static final int CATEGORIA_INDEX = 7; + public static final String LOCAL_TRABALHO = "local_trabalho"; + public static final String LOCAL_TRABALHO_FULL = "trabalhadores.local_trabalho"; + public static final int LOCAL_TRABALHO_INDEX = 8; + public static final String FUNCAO_PROPOSTA = "funcao_proposta"; + public static final String FUNCAO_PROPOSTA_FULL = "trabalhadores.funcao_proposta"; + public static final int FUNCAO_PROPOSTA_INDEX = 9; + public static final String DATA_ADMISSAO_FUNCAO = "data_admissao_funcao"; + public static final String DATA_ADMISSAO_FUNCAO_FULL = "trabalhadores.data_admissao_funcao"; + public static final int DATA_ADMISSAO_FUNCAO_INDEX = 10; + public static final String OBSERVACOES = "observacoes"; + public static final String OBSERVACOES_FULL = "trabalhadores.observacoes"; + public static final int OBSERVACOES_INDEX = 11; + public static final String INACTIVO = "inactivo"; + public static final String INACTIVO_FULL = "trabalhadores.inactivo"; + public static final int INACTIVO_INDEX = 12; + public static final String ESTABELECIMENTO_ID = "estabelecimento_id"; + public static final String ESTABELECIMENTO_ID_FULL = "trabalhadores.estabelecimento_id"; + public static final int ESTABELECIMENTO_ID_INDEX = 13; + public static final String TO_ESTABELECIMENTO_ID = "to_estabelecimento_id"; + public static final int TO_ESTABELECIMENTO_ID_INDEX = 14; + public static final String DATA_DEMISSAO = "data_demissao"; + public static final String DATA_DEMISSAO_FULL = "trabalhadores.data_demissao"; + public static final int DATA_DEMISSAO_INDEX = 15; + public static final String OBSERVACOES_GESTAO = "observacoes_gestao"; + public static final String OBSERVACOES_GESTAO_FULL = "trabalhadores.observacoes_gestao"; + public static final int OBSERVACOES_GESTAO_INDEX = 16; + public static final String PERFIL = "perfil"; + public static final String PERFIL_FULL = "trabalhadores.perfil"; + public static final int PERFIL_INDEX = 17; + public static final String ACTUALIZACAO = "actualizacao"; + public static final String ACTUALIZACAO_FULL = "trabalhadores.actualizacao"; + public static final int ACTUALIZACAO_INDEX = 18; + public static final String NOME_PLAIN = "nome_plain"; + public static final String NOME_PLAIN_FULL = "trabalhadores.nome_plain"; + public static final int NOME_PLAIN_INDEX = 19; + public static final String BI = "bi"; + public static final String BI_FULL = "trabalhadores.bi"; + public static final int BI_INDEX = 20; + public static final String NIF = "nif"; + public static final String NIF_FULL = "trabalhadores.nif"; + public static final int NIF_INDEX = 21; + public static final String NUMERO_UTENTE = "numero_utente"; + public static final String NUMERO_UTENTE_FULL = "trabalhadores.numero_utente"; + public static final int NUMERO_UTENTE_INDEX = 22; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, SEXO, DATA_NASCIMENTO, NACIONALIDADE, NUMERO_MECANOGRAFICO, DATA_ADMISSAO, + CATEGORIA, LOCAL_TRABALHO, FUNCAO_PROPOSTA, DATA_ADMISSAO_FUNCAO, OBSERVACOES, + INACTIVO, ESTABELECIMENTO_ID, TO_ESTABELECIMENTO_ID, DATA_DEMISSAO, + OBSERVACOES_GESTAO, PERFIL, ACTUALIZACAO, NOME_PLAIN, BI, NIF, NUMERO_UTENTE, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + NOME, TABLENAME + "." + SEXO, TABLENAME + "." + DATA_NASCIMENTO, TABLENAME + "." + NACIONALIDADE, TABLENAME + "." + NUMERO_MECANOGRAFICO, TABLENAME + "." + DATA_ADMISSAO, + TABLENAME + "." + CATEGORIA, TABLENAME + "." + LOCAL_TRABALHO, TABLENAME + "." + FUNCAO_PROPOSTA, TABLENAME + "." + DATA_ADMISSAO_FUNCAO, TABLENAME + "." + OBSERVACOES, + TABLENAME + "." + INACTIVO, TABLENAME + "." + ESTABELECIMENTO_ID, TABLENAME + "." + TO_ESTABELECIMENTO_ID, TABLENAME + "." + DATA_DEMISSAO, + TABLENAME + "." + OBSERVACOES_GESTAO, TABLENAME + "." + PERFIL, TABLENAME + "." + ACTUALIZACAO, TABLENAME + "." + NOME_PLAIN, TABLENAME + "." + BI, TABLENAME + "." + NIF, TABLENAME + "." + NUMERO_UTENTE, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, NOME, SEXO, DATA_NASCIMENTO, NACIONALIDADE, NUMERO_MECANOGRAFICO, + DATA_ADMISSAO, CATEGORIA, LOCAL_TRABALHO, FUNCAO_PROPOSTA, + DATA_ADMISSAO_FUNCAO, OBSERVACOES, INACTIVO, ESTABELECIMENTO_ID, DATA_DEMISSAO, + OBSERVACOES_GESTAO, PERFIL, ACTUALIZACAO, NOME_PLAIN, BI, NIF, NUMERO_UTENTE, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, NOME, SEXO, DATA_NASCIMENTO, NACIONALIDADE, NUMERO_MECANOGRAFICO, + DATA_ADMISSAO, CATEGORIA, LOCAL_TRABALHO, FUNCAO_PROPOSTA, + DATA_ADMISSAO_FUNCAO, OBSERVACOES, INACTIVO, ESTABELECIMENTO_ID, DATA_DEMISSAO, + OBSERVACOES_GESTAO, PERFIL, ACTUALIZACAO, NOME_PLAIN, BI, NIF, NUMERO_UTENTE, }; + + private Integer id; + private String nome; + private String sexo; + private java.util.Date data_nascimento; + private String nacionalidade; + private String numero_mecanografico; + private java.util.Date data_admissao; + private String categoria; + private String local_trabalho; + private String funcao_proposta; + private java.util.Date data_admissao_funcao; + private String observacoes; + private String inactivo; + private Integer estabelecimento_id; + private siprp.data.outer.EstabelecimentosData to_estabelecimento_id; + private java.util.Date data_demissao; + private String observacoes_gestao; + private Integer perfil; + private java.sql.Timestamp actualizacao; + private String nome_plain; + private String bi; + private String nif; + private String numero_utente; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public Trabalhadores() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromAvisos_trabalhador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.AvisosData.class , getPrimaryKey().getMap().get("id"), "trabalhador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromExames_trabalhador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.ExamesData.class , getPrimaryKey().getMap().get("id"), "trabalhador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromLembretes_trabalhador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.LembretesData.class , getPrimaryKey().getMap().get("id"), "trabalhador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromMarcacoesTrabalhador_trabalhador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.MarcacoesTrabalhadorData.class , getPrimaryKey().getMap().get("id"), "trabalhador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresConsultas_trabalhador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresConsultasData.class , getPrimaryKey().getMap().get("id"), "trabalhador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresEcds_trabalhador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresEcdsData.class , getPrimaryKey().getMap().get("id"), "trabalhador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresProcesso_trabalhador_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresProcessoData.class , getPrimaryKey().getMap().get("id"), "trabalhador_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public String getNome() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NOME ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.nome; + } + + public void setNome( String nome ) + { + try + { + setLockedForRefresh( true ); + preProcess( NOME, nome ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.nome = nome; + LAZY_LOADED_OBJECTS.put( NOME, Boolean.TRUE ); + } + + public String getSexo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( SEXO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.sexo; + } + + public void setSexo( String sexo ) + { + try + { + setLockedForRefresh( true ); + preProcess( SEXO, sexo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.sexo = sexo; + LAZY_LOADED_OBJECTS.put( SEXO, Boolean.TRUE ); + } + + public java.util.Date getData_nascimento() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_NASCIMENTO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_nascimento; + } + + public void setData_nascimento( java.util.Date data_nascimento ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_NASCIMENTO, data_nascimento ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_nascimento = data_nascimento; + LAZY_LOADED_OBJECTS.put( DATA_NASCIMENTO, Boolean.TRUE ); + } + + public String getNacionalidade() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NACIONALIDADE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.nacionalidade; + } + + public void setNacionalidade( String nacionalidade ) + { + try + { + setLockedForRefresh( true ); + preProcess( NACIONALIDADE, nacionalidade ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.nacionalidade = nacionalidade; + LAZY_LOADED_OBJECTS.put( NACIONALIDADE, Boolean.TRUE ); + } + + public String getNumero_mecanografico() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NUMERO_MECANOGRAFICO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.numero_mecanografico; + } + + public void setNumero_mecanografico( String numero_mecanografico ) + { + try + { + setLockedForRefresh( true ); + preProcess( NUMERO_MECANOGRAFICO, numero_mecanografico ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.numero_mecanografico = numero_mecanografico; + LAZY_LOADED_OBJECTS.put( NUMERO_MECANOGRAFICO, Boolean.TRUE ); + } + + public java.util.Date getData_admissao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_ADMISSAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_admissao; + } + + public void setData_admissao( java.util.Date data_admissao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_ADMISSAO, data_admissao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_admissao = data_admissao; + LAZY_LOADED_OBJECTS.put( DATA_ADMISSAO, Boolean.TRUE ); + } + + public String getCategoria() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( CATEGORIA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.categoria; + } + + public void setCategoria( String categoria ) + { + try + { + setLockedForRefresh( true ); + preProcess( CATEGORIA, categoria ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.categoria = categoria; + LAZY_LOADED_OBJECTS.put( CATEGORIA, Boolean.TRUE ); + } + + public String getLocal_trabalho() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( LOCAL_TRABALHO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.local_trabalho; + } + + public void setLocal_trabalho( String local_trabalho ) + { + try + { + setLockedForRefresh( true ); + preProcess( LOCAL_TRABALHO, local_trabalho ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.local_trabalho = local_trabalho; + LAZY_LOADED_OBJECTS.put( LOCAL_TRABALHO, Boolean.TRUE ); + } + + public String getFuncao_proposta() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( FUNCAO_PROPOSTA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.funcao_proposta; + } + + public void setFuncao_proposta( String funcao_proposta ) + { + try + { + setLockedForRefresh( true ); + preProcess( FUNCAO_PROPOSTA, funcao_proposta ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.funcao_proposta = funcao_proposta; + LAZY_LOADED_OBJECTS.put( FUNCAO_PROPOSTA, Boolean.TRUE ); + } + + public java.util.Date getData_admissao_funcao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_ADMISSAO_FUNCAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_admissao_funcao; + } + + public void setData_admissao_funcao( java.util.Date data_admissao_funcao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_ADMISSAO_FUNCAO, data_admissao_funcao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_admissao_funcao = data_admissao_funcao; + LAZY_LOADED_OBJECTS.put( DATA_ADMISSAO_FUNCAO, Boolean.TRUE ); + } + + public String getObservacoes() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( OBSERVACOES ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.observacoes; + } + + public void setObservacoes( String observacoes ) + { + try + { + setLockedForRefresh( true ); + preProcess( OBSERVACOES, observacoes ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.observacoes = observacoes; + LAZY_LOADED_OBJECTS.put( OBSERVACOES, Boolean.TRUE ); + } + + public String getInactivo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( INACTIVO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.inactivo; + } + + public void setInactivo( String inactivo ) + { + try + { + setLockedForRefresh( true ); + preProcess( INACTIVO, inactivo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.inactivo = inactivo; + LAZY_LOADED_OBJECTS.put( INACTIVO, Boolean.TRUE ); + } + + public Integer getEstabelecimento_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTABELECIMENTO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estabelecimento_id; + } + + public void setEstabelecimento_id( Integer estabelecimento_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTABELECIMENTO_ID, estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estabelecimento_id = estabelecimento_id; + LAZY_LOADED_OBJECTS.put( ESTABELECIMENTO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EstabelecimentosData toEstabelecimento_id() + { + try + { + prepare( TO_ESTABELECIMENTO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_estabelecimento_id; + } + + public void setToEstabelecimento_id( siprp.data.outer.EstabelecimentosData to_estabelecimento_id ) + { + try + { + preProcess( TO_ESTABELECIMENTO_ID, to_estabelecimento_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_estabelecimento_id = to_estabelecimento_id; + } + + public java.util.Date getData_demissao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_DEMISSAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_demissao; + } + + public void setData_demissao( java.util.Date data_demissao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_DEMISSAO, data_demissao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_demissao = data_demissao; + LAZY_LOADED_OBJECTS.put( DATA_DEMISSAO, Boolean.TRUE ); + } + + public String getObservacoes_gestao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( OBSERVACOES_GESTAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.observacoes_gestao; + } + + public void setObservacoes_gestao( String observacoes_gestao ) + { + try + { + setLockedForRefresh( true ); + preProcess( OBSERVACOES_GESTAO, observacoes_gestao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.observacoes_gestao = observacoes_gestao; + LAZY_LOADED_OBJECTS.put( OBSERVACOES_GESTAO, Boolean.TRUE ); + } + + public Integer getPerfil() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PERFIL ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.perfil; + } + + public void setPerfil( Integer perfil ) + { + try + { + setLockedForRefresh( true ); + preProcess( PERFIL, perfil ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.perfil = perfil; + LAZY_LOADED_OBJECTS.put( PERFIL, Boolean.TRUE ); + } + + public java.sql.Timestamp getActualizacao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ACTUALIZACAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.actualizacao; + } + + public void setActualizacao( java.sql.Timestamp actualizacao ) + { + try + { + setLockedForRefresh( true ); + preProcess( ACTUALIZACAO, actualizacao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.actualizacao = actualizacao; + LAZY_LOADED_OBJECTS.put( ACTUALIZACAO, Boolean.TRUE ); + } + + public String getNome_plain() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NOME_PLAIN ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.nome_plain; + } + + public void setNome_plain( String nome_plain ) + { + try + { + setLockedForRefresh( true ); + preProcess( NOME_PLAIN, nome_plain ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.nome_plain = nome_plain; + LAZY_LOADED_OBJECTS.put( NOME_PLAIN, Boolean.TRUE ); + } + + public String getBi() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( BI ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.bi; + } + + public void setBi( String bi ) + { + try + { + setLockedForRefresh( true ); + preProcess( BI, bi ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.bi = bi; + LAZY_LOADED_OBJECTS.put( BI, Boolean.TRUE ); + } + + public String getNif() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NIF ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.nif; + } + + public void setNif( String nif ) + { + try + { + setLockedForRefresh( true ); + preProcess( NIF, nif ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.nif = nif; + LAZY_LOADED_OBJECTS.put( NIF, Boolean.TRUE ); + } + + public String getNumero_utente() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( NUMERO_UTENTE ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.numero_utente; + } + + public void setNumero_utente( String numero_utente ) + { + try + { + setLockedForRefresh( true ); + preProcess( NUMERO_UTENTE, numero_utente ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.numero_utente = numero_utente; + LAZY_LOADED_OBJECTS.put( NUMERO_UTENTE, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Trabalhadores.ID_INDEX: + value = getId(); + break; + case Trabalhadores.NOME_INDEX: + value = getNome(); + break; + case Trabalhadores.SEXO_INDEX: + value = getSexo(); + break; + case Trabalhadores.DATA_NASCIMENTO_INDEX: + value = getData_nascimento(); + break; + case Trabalhadores.NACIONALIDADE_INDEX: + value = getNacionalidade(); + break; + case Trabalhadores.NUMERO_MECANOGRAFICO_INDEX: + value = getNumero_mecanografico(); + break; + case Trabalhadores.DATA_ADMISSAO_INDEX: + value = getData_admissao(); + break; + case Trabalhadores.CATEGORIA_INDEX: + value = getCategoria(); + break; + case Trabalhadores.LOCAL_TRABALHO_INDEX: + value = getLocal_trabalho(); + break; + case Trabalhadores.FUNCAO_PROPOSTA_INDEX: + value = getFuncao_proposta(); + break; + case Trabalhadores.DATA_ADMISSAO_FUNCAO_INDEX: + value = getData_admissao_funcao(); + break; + case Trabalhadores.OBSERVACOES_INDEX: + value = getObservacoes(); + break; + case Trabalhadores.INACTIVO_INDEX: + value = getInactivo(); + break; + case Trabalhadores.ESTABELECIMENTO_ID_INDEX: + value = getEstabelecimento_id(); + break; + case Trabalhadores.TO_ESTABELECIMENTO_ID_INDEX: + value = toEstabelecimento_id(); + break; + case Trabalhadores.DATA_DEMISSAO_INDEX: + value = getData_demissao(); + break; + case Trabalhadores.OBSERVACOES_GESTAO_INDEX: + value = getObservacoes_gestao(); + break; + case Trabalhadores.PERFIL_INDEX: + value = getPerfil(); + break; + case Trabalhadores.ACTUALIZACAO_INDEX: + value = getActualizacao(); + break; + case Trabalhadores.NOME_PLAIN_INDEX: + value = getNome_plain(); + break; + case Trabalhadores.BI_INDEX: + value = getBi(); + break; + case Trabalhadores.NIF_INDEX: + value = getNif(); + break; + case Trabalhadores.NUMERO_UTENTE_INDEX: + value = getNumero_utente(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Trabalhadores.ID_INDEX: + value = this.id; + break; + case Trabalhadores.NOME_INDEX: + value = this.nome; + break; + case Trabalhadores.SEXO_INDEX: + value = this.sexo; + break; + case Trabalhadores.DATA_NASCIMENTO_INDEX: + value = this.data_nascimento; + break; + case Trabalhadores.NACIONALIDADE_INDEX: + value = this.nacionalidade; + break; + case Trabalhadores.NUMERO_MECANOGRAFICO_INDEX: + value = this.numero_mecanografico; + break; + case Trabalhadores.DATA_ADMISSAO_INDEX: + value = this.data_admissao; + break; + case Trabalhadores.CATEGORIA_INDEX: + value = this.categoria; + break; + case Trabalhadores.LOCAL_TRABALHO_INDEX: + value = this.local_trabalho; + break; + case Trabalhadores.FUNCAO_PROPOSTA_INDEX: + value = this.funcao_proposta; + break; + case Trabalhadores.DATA_ADMISSAO_FUNCAO_INDEX: + value = this.data_admissao_funcao; + break; + case Trabalhadores.OBSERVACOES_INDEX: + value = this.observacoes; + break; + case Trabalhadores.INACTIVO_INDEX: + value = this.inactivo; + break; + case Trabalhadores.ESTABELECIMENTO_ID_INDEX: + value = this.estabelecimento_id; + break; + case Trabalhadores.TO_ESTABELECIMENTO_ID_INDEX: + value = this.to_estabelecimento_id; + break; + case Trabalhadores.DATA_DEMISSAO_INDEX: + value = this.data_demissao; + break; + case Trabalhadores.OBSERVACOES_GESTAO_INDEX: + value = this.observacoes_gestao; + break; + case Trabalhadores.PERFIL_INDEX: + value = this.perfil; + break; + case Trabalhadores.ACTUALIZACAO_INDEX: + value = this.actualizacao; + break; + case Trabalhadores.NOME_PLAIN_INDEX: + value = this.nome_plain; + break; + case Trabalhadores.BI_INDEX: + value = this.bi; + break; + case Trabalhadores.NIF_INDEX: + value = this.nif; + break; + case Trabalhadores.NUMERO_UTENTE_INDEX: + value = this.numero_utente; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Trabalhadores.ID_INDEX: + setId( ( Integer ) value ); + break; + case Trabalhadores.NOME_INDEX: + setNome( ( String ) value ); + break; + case Trabalhadores.SEXO_INDEX: + setSexo( ( String ) value ); + break; + case Trabalhadores.DATA_NASCIMENTO_INDEX: + setData_nascimento( ( java.util.Date ) value ); + break; + case Trabalhadores.NACIONALIDADE_INDEX: + setNacionalidade( ( String ) value ); + break; + case Trabalhadores.NUMERO_MECANOGRAFICO_INDEX: + setNumero_mecanografico( ( String ) value ); + break; + case Trabalhadores.DATA_ADMISSAO_INDEX: + setData_admissao( ( java.util.Date ) value ); + break; + case Trabalhadores.CATEGORIA_INDEX: + setCategoria( ( String ) value ); + break; + case Trabalhadores.LOCAL_TRABALHO_INDEX: + setLocal_trabalho( ( String ) value ); + break; + case Trabalhadores.FUNCAO_PROPOSTA_INDEX: + setFuncao_proposta( ( String ) value ); + break; + case Trabalhadores.DATA_ADMISSAO_FUNCAO_INDEX: + setData_admissao_funcao( ( java.util.Date ) value ); + break; + case Trabalhadores.OBSERVACOES_INDEX: + setObservacoes( ( String ) value ); + break; + case Trabalhadores.INACTIVO_INDEX: + setInactivo( ( String ) value ); + break; + case Trabalhadores.ESTABELECIMENTO_ID_INDEX: + setEstabelecimento_id( ( Integer ) value ); + break; + case Trabalhadores.TO_ESTABELECIMENTO_ID_INDEX: + setToEstabelecimento_id( ( siprp.data.outer.EstabelecimentosData ) value ); + break; + case Trabalhadores.DATA_DEMISSAO_INDEX: + setData_demissao( ( java.util.Date ) value ); + break; + case Trabalhadores.OBSERVACOES_GESTAO_INDEX: + setObservacoes_gestao( ( String ) value ); + break; + case Trabalhadores.PERFIL_INDEX: + setPerfil( ( Integer ) value ); + break; + case Trabalhadores.ACTUALIZACAO_INDEX: + setActualizacao( ( java.sql.Timestamp ) value ); + break; + case Trabalhadores.NOME_PLAIN_INDEX: + setNome_plain( ( String ) value ); + break; + case Trabalhadores.BI_INDEX: + setBi( ( String ) value ); + break; + case Trabalhadores.NIF_INDEX: + setNif( ( String ) value ); + break; + case Trabalhadores.NUMERO_UTENTE_INDEX: + setNumero_utente( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case Trabalhadores.ID_INDEX: + this.id = ( Integer ) value; + break; + case Trabalhadores.NOME_INDEX: + this.nome = ( String ) value; + break; + case Trabalhadores.SEXO_INDEX: + this.sexo = ( String ) value; + break; + case Trabalhadores.DATA_NASCIMENTO_INDEX: + this.data_nascimento = ( java.util.Date ) value; + break; + case Trabalhadores.NACIONALIDADE_INDEX: + this.nacionalidade = ( String ) value; + break; + case Trabalhadores.NUMERO_MECANOGRAFICO_INDEX: + this.numero_mecanografico = ( String ) value; + break; + case Trabalhadores.DATA_ADMISSAO_INDEX: + this.data_admissao = ( java.util.Date ) value; + break; + case Trabalhadores.CATEGORIA_INDEX: + this.categoria = ( String ) value; + break; + case Trabalhadores.LOCAL_TRABALHO_INDEX: + this.local_trabalho = ( String ) value; + break; + case Trabalhadores.FUNCAO_PROPOSTA_INDEX: + this.funcao_proposta = ( String ) value; + break; + case Trabalhadores.DATA_ADMISSAO_FUNCAO_INDEX: + this.data_admissao_funcao = ( java.util.Date ) value; + break; + case Trabalhadores.OBSERVACOES_INDEX: + this.observacoes = ( String ) value; + break; + case Trabalhadores.INACTIVO_INDEX: + this.inactivo = ( String ) value; + break; + case Trabalhadores.ESTABELECIMENTO_ID_INDEX: + this.estabelecimento_id = ( Integer ) value; + break; + case Trabalhadores.TO_ESTABELECIMENTO_ID_INDEX: + this.to_estabelecimento_id = ( siprp.data.outer.EstabelecimentosData ) value; + break; + case Trabalhadores.DATA_DEMISSAO_INDEX: + this.data_demissao = ( java.util.Date ) value; + break; + case Trabalhadores.OBSERVACOES_GESTAO_INDEX: + this.observacoes_gestao = ( String ) value; + break; + case Trabalhadores.PERFIL_INDEX: + this.perfil = ( Integer ) value; + break; + case Trabalhadores.ACTUALIZACAO_INDEX: + this.actualizacao = ( java.sql.Timestamp ) value; + break; + case Trabalhadores.NOME_PLAIN_INDEX: + this.nome_plain = ( String ) value; + break; + case Trabalhadores.BI_INDEX: + this.bi = ( String ) value; + break; + case Trabalhadores.NIF_INDEX: + this.nif = ( String ) value; + break; + case Trabalhadores.NUMERO_UTENTE_INDEX: + this.numero_utente = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case Trabalhadores.ID_INDEX: + theClass = Integer.class; + break; + case Trabalhadores.NOME_INDEX: + theClass = String.class; + break; + case Trabalhadores.SEXO_INDEX: + theClass = String.class; + break; + case Trabalhadores.DATA_NASCIMENTO_INDEX: + theClass = java.util.Date.class; + break; + case Trabalhadores.NACIONALIDADE_INDEX: + theClass = String.class; + break; + case Trabalhadores.NUMERO_MECANOGRAFICO_INDEX: + theClass = String.class; + break; + case Trabalhadores.DATA_ADMISSAO_INDEX: + theClass = java.util.Date.class; + break; + case Trabalhadores.CATEGORIA_INDEX: + theClass = String.class; + break; + case Trabalhadores.LOCAL_TRABALHO_INDEX: + theClass = String.class; + break; + case Trabalhadores.FUNCAO_PROPOSTA_INDEX: + theClass = String.class; + break; + case Trabalhadores.DATA_ADMISSAO_FUNCAO_INDEX: + theClass = java.util.Date.class; + break; + case Trabalhadores.OBSERVACOES_INDEX: + theClass = String.class; + break; + case Trabalhadores.INACTIVO_INDEX: + theClass = String.class; + break; + case Trabalhadores.ESTABELECIMENTO_ID_INDEX: + theClass = Integer.class; + break; + case Trabalhadores.TO_ESTABELECIMENTO_ID_INDEX: + theClass = siprp.data.outer.EstabelecimentosData.class; + break; + case Trabalhadores.DATA_DEMISSAO_INDEX: + theClass = java.util.Date.class; + break; + case Trabalhadores.OBSERVACOES_GESTAO_INDEX: + theClass = String.class; + break; + case Trabalhadores.PERFIL_INDEX: + theClass = Integer.class; + break; + case Trabalhadores.ACTUALIZACAO_INDEX: + theClass = java.sql.Timestamp.class; + break; + case Trabalhadores.NOME_PLAIN_INDEX: + theClass = String.class; + break; + case Trabalhadores.BI_INDEX: + theClass = String.class; + break; + case Trabalhadores.NIF_INDEX: + theClass = String.class; + break; + case Trabalhadores.NUMERO_UTENTE_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : Trabalhadores._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, Trabalhadores.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresConsultas.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresConsultas.java new file mode 100644 index 00000000..a9956552 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresConsultas.java @@ -0,0 +1,644 @@ +/* +* TrabalhadoresConsultas.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class TrabalhadoresConsultas extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( TrabalhadoresConsultas.ID, TrabalhadoresConsultas.ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultas.ID_FULL, TrabalhadoresConsultas.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresConsultas.CLASS_IDENTIFIER, TrabalhadoresConsultas.TRABALHADOR_ID, TrabalhadoresConsultas.TO_TRABALHADOR_ID ); + FIELD_INDEXES.put( TrabalhadoresConsultas.TRABALHADOR_ID, TrabalhadoresConsultas.TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultas.TRABALHADOR_ID_FULL, TrabalhadoresConsultas.TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultas.TO_TRABALHADOR_ID, TrabalhadoresConsultas.TO_TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultas.DATA, TrabalhadoresConsultas.DATA_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultas.DATA_FULL, TrabalhadoresConsultas.DATA_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultas.ESTADO, TrabalhadoresConsultas.ESTADO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultas.ESTADO_FULL, TrabalhadoresConsultas.ESTADO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresConsultas.CLASS_IDENTIFIER, TrabalhadoresConsultas.PRESTADOR_ID, TrabalhadoresConsultas.TO_PRESTADOR_ID ); + FIELD_INDEXES.put( TrabalhadoresConsultas.PRESTADOR_ID, TrabalhadoresConsultas.PRESTADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultas.PRESTADOR_ID_FULL, TrabalhadoresConsultas.PRESTADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultas.TO_PRESTADOR_ID, TrabalhadoresConsultas.TO_PRESTADOR_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresConsultas.CLASS_IDENTIFIER, TrabalhadoresConsultas.PROCESSO_ID, TrabalhadoresConsultas.TO_PROCESSO_ID ); + FIELD_INDEXES.put( TrabalhadoresConsultas.PROCESSO_ID, TrabalhadoresConsultas.PROCESSO_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultas.PROCESSO_ID_FULL, TrabalhadoresConsultas.PROCESSO_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultas.TO_PROCESSO_ID, TrabalhadoresConsultas.TO_PROCESSO_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeytrabalhador_idTotrabalhadores = + new com.evolute.entity.ForeignKey( TrabalhadoresConsultas.class, TrabalhadoresConsultas.TRABALHADOR_ID, siprp.data.outer.TrabalhadoresData.class, siprp.data.outer.TrabalhadoresData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyprestador_idToprestadores = + new com.evolute.entity.ForeignKey( TrabalhadoresConsultas.class, TrabalhadoresConsultas.PRESTADOR_ID, siprp.data.outer.PrestadoresData.class, siprp.data.outer.PrestadoresData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyprocesso_idTotrabalhadores_processo = + new com.evolute.entity.ForeignKey( TrabalhadoresConsultas.class, TrabalhadoresConsultas.PROCESSO_ID, siprp.data.outer.TrabalhadoresProcessoData.class, siprp.data.outer.TrabalhadoresProcessoData.ID ); + + public static final String TABLENAME = "trabalhadores_consultas"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.trabalhadores_consultas"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_consultas.id"; + public static final int ID_INDEX = 0; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String TRABALHADOR_ID_FULL = "trabalhadores_consultas.trabalhador_id"; + public static final int TRABALHADOR_ID_INDEX = 1; + public static final String TO_TRABALHADOR_ID = "to_trabalhador_id"; + public static final int TO_TRABALHADOR_ID_INDEX = 2; + public static final String DATA = "data"; + public static final String DATA_FULL = "trabalhadores_consultas.data"; + public static final int DATA_INDEX = 3; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "trabalhadores_consultas.estado"; + public static final int ESTADO_INDEX = 4; + public static final String PRESTADOR_ID = "prestador_id"; + public static final String PRESTADOR_ID_FULL = "trabalhadores_consultas.prestador_id"; + public static final int PRESTADOR_ID_INDEX = 5; + public static final String TO_PRESTADOR_ID = "to_prestador_id"; + public static final int TO_PRESTADOR_ID_INDEX = 6; + public static final String PROCESSO_ID = "processo_id"; + public static final String PROCESSO_ID_FULL = "trabalhadores_consultas.processo_id"; + public static final int PROCESSO_ID_INDEX = 7; + public static final String TO_PROCESSO_ID = "to_processo_id"; + public static final int TO_PROCESSO_ID_INDEX = 8; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADOR_ID, TO_TRABALHADOR_ID, DATA, ESTADO, PRESTADOR_ID, TO_PRESTADOR_ID, + PROCESSO_ID, TO_PROCESSO_ID, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + TRABALHADOR_ID, TABLENAME + "." + TO_TRABALHADOR_ID, TABLENAME + "." + DATA, TABLENAME + "." + ESTADO, TABLENAME + "." + PRESTADOR_ID, TABLENAME + "." + TO_PRESTADOR_ID, + TABLENAME + "." + PROCESSO_ID, TABLENAME + "." + TO_PROCESSO_ID, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, TRABALHADOR_ID, DATA, ESTADO, PRESTADOR_ID, PROCESSO_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, TRABALHADOR_ID, DATA, ESTADO, PRESTADOR_ID, PROCESSO_ID, }; + + private Integer id; + private Integer trabalhador_id; + private siprp.data.outer.TrabalhadoresData to_trabalhador_id; + private java.util.Date data; + private Integer estado; + private Integer prestador_id; + private siprp.data.outer.PrestadoresData to_prestador_id; + private Integer processo_id; + private siprp.data.outer.TrabalhadoresProcessoData to_processo_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public TrabalhadoresConsultas() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromTrabalhadoresConsultasDatas_trabalhadores_consultas_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresConsultasDatasData.class , getPrimaryKey().getMap().get("id"), "trabalhadores_consultas_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public Integer getTrabalhador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TRABALHADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.trabalhador_id; + } + + public void setTrabalhador_id( Integer trabalhador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TRABALHADOR_ID, trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.trabalhador_id = trabalhador_id; + LAZY_LOADED_OBJECTS.put( TRABALHADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresData toTrabalhador_id() + { + try + { + prepare( TO_TRABALHADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_trabalhador_id; + } + + public void setToTrabalhador_id( siprp.data.outer.TrabalhadoresData to_trabalhador_id ) + { + try + { + preProcess( TO_TRABALHADOR_ID, to_trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_trabalhador_id = to_trabalhador_id; + } + + public java.util.Date getData() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data; + } + + public void setData( java.util.Date data ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA, data ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data = data; + LAZY_LOADED_OBJECTS.put( DATA, Boolean.TRUE ); + } + + public Integer getEstado() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTADO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estado; + } + + public void setEstado( Integer estado ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTADO, estado ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estado = estado; + LAZY_LOADED_OBJECTS.put( ESTADO, Boolean.TRUE ); + } + + public Integer getPrestador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PRESTADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.prestador_id; + } + + public void setPrestador_id( Integer prestador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( PRESTADOR_ID, prestador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.prestador_id = prestador_id; + LAZY_LOADED_OBJECTS.put( PRESTADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrestadoresData toPrestador_id() + { + try + { + prepare( TO_PRESTADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_prestador_id; + } + + public void setToPrestador_id( siprp.data.outer.PrestadoresData to_prestador_id ) + { + try + { + preProcess( TO_PRESTADOR_ID, to_prestador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_prestador_id = to_prestador_id; + } + + public Integer getProcesso_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PROCESSO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.processo_id; + } + + public void setProcesso_id( Integer processo_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( PROCESSO_ID, processo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.processo_id = processo_id; + LAZY_LOADED_OBJECTS.put( PROCESSO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresProcessoData toProcesso_id() + { + try + { + prepare( TO_PROCESSO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_processo_id; + } + + public void setToProcesso_id( siprp.data.outer.TrabalhadoresProcessoData to_processo_id ) + { + try + { + preProcess( TO_PROCESSO_ID, to_processo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_processo_id = to_processo_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresConsultas.ID_INDEX: + value = getId(); + break; + case TrabalhadoresConsultas.TRABALHADOR_ID_INDEX: + value = getTrabalhador_id(); + break; + case TrabalhadoresConsultas.TO_TRABALHADOR_ID_INDEX: + value = toTrabalhador_id(); + break; + case TrabalhadoresConsultas.DATA_INDEX: + value = getData(); + break; + case TrabalhadoresConsultas.ESTADO_INDEX: + value = getEstado(); + break; + case TrabalhadoresConsultas.PRESTADOR_ID_INDEX: + value = getPrestador_id(); + break; + case TrabalhadoresConsultas.TO_PRESTADOR_ID_INDEX: + value = toPrestador_id(); + break; + case TrabalhadoresConsultas.PROCESSO_ID_INDEX: + value = getProcesso_id(); + break; + case TrabalhadoresConsultas.TO_PROCESSO_ID_INDEX: + value = toProcesso_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresConsultas.ID_INDEX: + value = this.id; + break; + case TrabalhadoresConsultas.TRABALHADOR_ID_INDEX: + value = this.trabalhador_id; + break; + case TrabalhadoresConsultas.TO_TRABALHADOR_ID_INDEX: + value = this.to_trabalhador_id; + break; + case TrabalhadoresConsultas.DATA_INDEX: + value = this.data; + break; + case TrabalhadoresConsultas.ESTADO_INDEX: + value = this.estado; + break; + case TrabalhadoresConsultas.PRESTADOR_ID_INDEX: + value = this.prestador_id; + break; + case TrabalhadoresConsultas.TO_PRESTADOR_ID_INDEX: + value = this.to_prestador_id; + break; + case TrabalhadoresConsultas.PROCESSO_ID_INDEX: + value = this.processo_id; + break; + case TrabalhadoresConsultas.TO_PROCESSO_ID_INDEX: + value = this.to_processo_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresConsultas.ID_INDEX: + setId( ( Integer ) value ); + break; + case TrabalhadoresConsultas.TRABALHADOR_ID_INDEX: + setTrabalhador_id( ( Integer ) value ); + break; + case TrabalhadoresConsultas.TO_TRABALHADOR_ID_INDEX: + setToTrabalhador_id( ( siprp.data.outer.TrabalhadoresData ) value ); + break; + case TrabalhadoresConsultas.DATA_INDEX: + setData( ( java.util.Date ) value ); + break; + case TrabalhadoresConsultas.ESTADO_INDEX: + setEstado( ( Integer ) value ); + break; + case TrabalhadoresConsultas.PRESTADOR_ID_INDEX: + setPrestador_id( ( Integer ) value ); + break; + case TrabalhadoresConsultas.TO_PRESTADOR_ID_INDEX: + setToPrestador_id( ( siprp.data.outer.PrestadoresData ) value ); + break; + case TrabalhadoresConsultas.PROCESSO_ID_INDEX: + setProcesso_id( ( Integer ) value ); + break; + case TrabalhadoresConsultas.TO_PROCESSO_ID_INDEX: + setToProcesso_id( ( siprp.data.outer.TrabalhadoresProcessoData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresConsultas.ID_INDEX: + this.id = ( Integer ) value; + break; + case TrabalhadoresConsultas.TRABALHADOR_ID_INDEX: + this.trabalhador_id = ( Integer ) value; + break; + case TrabalhadoresConsultas.TO_TRABALHADOR_ID_INDEX: + this.to_trabalhador_id = ( siprp.data.outer.TrabalhadoresData ) value; + break; + case TrabalhadoresConsultas.DATA_INDEX: + this.data = ( java.util.Date ) value; + break; + case TrabalhadoresConsultas.ESTADO_INDEX: + this.estado = ( Integer ) value; + break; + case TrabalhadoresConsultas.PRESTADOR_ID_INDEX: + this.prestador_id = ( Integer ) value; + break; + case TrabalhadoresConsultas.TO_PRESTADOR_ID_INDEX: + this.to_prestador_id = ( siprp.data.outer.PrestadoresData ) value; + break; + case TrabalhadoresConsultas.PROCESSO_ID_INDEX: + this.processo_id = ( Integer ) value; + break; + case TrabalhadoresConsultas.TO_PROCESSO_ID_INDEX: + this.to_processo_id = ( siprp.data.outer.TrabalhadoresProcessoData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case TrabalhadoresConsultas.ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresConsultas.TRABALHADOR_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresConsultas.TO_TRABALHADOR_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresData.class; + break; + case TrabalhadoresConsultas.DATA_INDEX: + theClass = java.util.Date.class; + break; + case TrabalhadoresConsultas.ESTADO_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresConsultas.PRESTADOR_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresConsultas.TO_PRESTADOR_ID_INDEX: + theClass = siprp.data.outer.PrestadoresData.class; + break; + case TrabalhadoresConsultas.PROCESSO_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresConsultas.TO_PROCESSO_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresProcessoData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : TrabalhadoresConsultas._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, TrabalhadoresConsultas.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresConsultasDatas.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresConsultasDatas.java new file mode 100644 index 00000000..7868cd2f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresConsultasDatas.java @@ -0,0 +1,573 @@ +/* +* TrabalhadoresConsultasDatas.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class TrabalhadoresConsultasDatas extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( TrabalhadoresConsultasDatas.ID, TrabalhadoresConsultasDatas.ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatas.ID_FULL, TrabalhadoresConsultasDatas.ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatas.DATA, TrabalhadoresConsultasDatas.DATA_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatas.DATA_FULL, TrabalhadoresConsultasDatas.DATA_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresConsultasDatas.CLASS_IDENTIFIER, TrabalhadoresConsultasDatas.TRABALHADORES_CONSULTAS_ID, TrabalhadoresConsultasDatas.TO_TRABALHADORES_CONSULTAS_ID ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatas.TRABALHADORES_CONSULTAS_ID, TrabalhadoresConsultasDatas.TRABALHADORES_CONSULTAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatas.TRABALHADORES_CONSULTAS_ID_FULL, TrabalhadoresConsultasDatas.TRABALHADORES_CONSULTAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatas.TO_TRABALHADORES_CONSULTAS_ID, TrabalhadoresConsultasDatas.TO_TRABALHADORES_CONSULTAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatas.ESTADO, TrabalhadoresConsultasDatas.ESTADO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatas.ESTADO_FULL, TrabalhadoresConsultasDatas.ESTADO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresConsultasDatas.CLASS_IDENTIFIER, TrabalhadoresConsultasDatas.PRESTADOR_ID, TrabalhadoresConsultasDatas.TO_PRESTADOR_ID ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatas.PRESTADOR_ID, TrabalhadoresConsultasDatas.PRESTADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatas.PRESTADOR_ID_FULL, TrabalhadoresConsultasDatas.PRESTADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatas.TO_PRESTADOR_ID, TrabalhadoresConsultasDatas.TO_PRESTADOR_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeytrabalhadores_consultas_idTotrabalhadores_consultas = + new com.evolute.entity.ForeignKey( TrabalhadoresConsultasDatas.class, TrabalhadoresConsultasDatas.TRABALHADORES_CONSULTAS_ID, siprp.data.outer.TrabalhadoresConsultasData.class, siprp.data.outer.TrabalhadoresConsultasData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyprestador_idToprestadores = + new com.evolute.entity.ForeignKey( TrabalhadoresConsultasDatas.class, TrabalhadoresConsultasDatas.PRESTADOR_ID, siprp.data.outer.PrestadoresData.class, siprp.data.outer.PrestadoresData.ID ); + + public static final String TABLENAME = "trabalhadores_consultas_datas"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.trabalhadores_consultas_datas"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_consultas_datas.id"; + public static final int ID_INDEX = 0; + public static final String DATA = "data"; + public static final String DATA_FULL = "trabalhadores_consultas_datas.data"; + public static final int DATA_INDEX = 1; + public static final String TRABALHADORES_CONSULTAS_ID = "trabalhadores_consultas_id"; + public static final String TRABALHADORES_CONSULTAS_ID_FULL = "trabalhadores_consultas_datas.trabalhadores_consultas_id"; + public static final int TRABALHADORES_CONSULTAS_ID_INDEX = 2; + public static final String TO_TRABALHADORES_CONSULTAS_ID = "to_trabalhadores_consultas_id"; + public static final int TO_TRABALHADORES_CONSULTAS_ID_INDEX = 3; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "trabalhadores_consultas_datas.estado"; + public static final int ESTADO_INDEX = 4; + public static final String PRESTADOR_ID = "prestador_id"; + public static final String PRESTADOR_ID_FULL = "trabalhadores_consultas_datas.prestador_id"; + public static final int PRESTADOR_ID_INDEX = 5; + public static final String TO_PRESTADOR_ID = "to_prestador_id"; + public static final int TO_PRESTADOR_ID_INDEX = 6; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, TRABALHADORES_CONSULTAS_ID, TO_TRABALHADORES_CONSULTAS_ID, ESTADO, + PRESTADOR_ID, TO_PRESTADOR_ID, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DATA, TABLENAME + "." + TRABALHADORES_CONSULTAS_ID, TABLENAME + "." + TO_TRABALHADORES_CONSULTAS_ID, TABLENAME + "." + ESTADO, + TABLENAME + "." + PRESTADOR_ID, TABLENAME + "." + TO_PRESTADOR_ID, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DATA, TRABALHADORES_CONSULTAS_ID, ESTADO, PRESTADOR_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DATA, TRABALHADORES_CONSULTAS_ID, ESTADO, PRESTADOR_ID, }; + + private Integer id; + private java.util.Date data; + private Integer trabalhadores_consultas_id; + private siprp.data.outer.TrabalhadoresConsultasData to_trabalhadores_consultas_id; + private Integer estado; + private Integer prestador_id; + private siprp.data.outer.PrestadoresData to_prestador_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public TrabalhadoresConsultasDatas() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromLembretes_trabalhadores_consultas_datas_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.LembretesData.class , getPrimaryKey().getMap().get("id"), "trabalhadores_consultas_datas_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresConsultasDatasEmails_trabalhadores_consultas_datas_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresConsultasDatasEmailsData.class , getPrimaryKey().getMap().get("id"), "trabalhadores_consultas_datas_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresConsultasDatasObservacoes_trabalhadores_consultas_datas_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresConsultasDatasObservacoesData.class , getPrimaryKey().getMap().get("id"), "trabalhadores_consultas_datas_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.Date getData() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data; + } + + public void setData( java.util.Date data ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA, data ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data = data; + LAZY_LOADED_OBJECTS.put( DATA, Boolean.TRUE ); + } + + public Integer getTrabalhadores_consultas_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TRABALHADORES_CONSULTAS_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.trabalhadores_consultas_id; + } + + public void setTrabalhadores_consultas_id( Integer trabalhadores_consultas_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TRABALHADORES_CONSULTAS_ID, trabalhadores_consultas_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.trabalhadores_consultas_id = trabalhadores_consultas_id; + LAZY_LOADED_OBJECTS.put( TRABALHADORES_CONSULTAS_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresConsultasData toTrabalhadores_consultas_id() + { + try + { + prepare( TO_TRABALHADORES_CONSULTAS_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_trabalhadores_consultas_id; + } + + public void setToTrabalhadores_consultas_id( siprp.data.outer.TrabalhadoresConsultasData to_trabalhadores_consultas_id ) + { + try + { + preProcess( TO_TRABALHADORES_CONSULTAS_ID, to_trabalhadores_consultas_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_trabalhadores_consultas_id = to_trabalhadores_consultas_id; + } + + public Integer getEstado() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTADO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estado; + } + + public void setEstado( Integer estado ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTADO, estado ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estado = estado; + LAZY_LOADED_OBJECTS.put( ESTADO, Boolean.TRUE ); + } + + public Integer getPrestador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PRESTADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.prestador_id; + } + + public void setPrestador_id( Integer prestador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( PRESTADOR_ID, prestador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.prestador_id = prestador_id; + LAZY_LOADED_OBJECTS.put( PRESTADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrestadoresData toPrestador_id() + { + try + { + prepare( TO_PRESTADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_prestador_id; + } + + public void setToPrestador_id( siprp.data.outer.PrestadoresData to_prestador_id ) + { + try + { + preProcess( TO_PRESTADOR_ID, to_prestador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_prestador_id = to_prestador_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresConsultasDatas.ID_INDEX: + value = getId(); + break; + case TrabalhadoresConsultasDatas.DATA_INDEX: + value = getData(); + break; + case TrabalhadoresConsultasDatas.TRABALHADORES_CONSULTAS_ID_INDEX: + value = getTrabalhadores_consultas_id(); + break; + case TrabalhadoresConsultasDatas.TO_TRABALHADORES_CONSULTAS_ID_INDEX: + value = toTrabalhadores_consultas_id(); + break; + case TrabalhadoresConsultasDatas.ESTADO_INDEX: + value = getEstado(); + break; + case TrabalhadoresConsultasDatas.PRESTADOR_ID_INDEX: + value = getPrestador_id(); + break; + case TrabalhadoresConsultasDatas.TO_PRESTADOR_ID_INDEX: + value = toPrestador_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresConsultasDatas.ID_INDEX: + value = this.id; + break; + case TrabalhadoresConsultasDatas.DATA_INDEX: + value = this.data; + break; + case TrabalhadoresConsultasDatas.TRABALHADORES_CONSULTAS_ID_INDEX: + value = this.trabalhadores_consultas_id; + break; + case TrabalhadoresConsultasDatas.TO_TRABALHADORES_CONSULTAS_ID_INDEX: + value = this.to_trabalhadores_consultas_id; + break; + case TrabalhadoresConsultasDatas.ESTADO_INDEX: + value = this.estado; + break; + case TrabalhadoresConsultasDatas.PRESTADOR_ID_INDEX: + value = this.prestador_id; + break; + case TrabalhadoresConsultasDatas.TO_PRESTADOR_ID_INDEX: + value = this.to_prestador_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresConsultasDatas.ID_INDEX: + setId( ( Integer ) value ); + break; + case TrabalhadoresConsultasDatas.DATA_INDEX: + setData( ( java.util.Date ) value ); + break; + case TrabalhadoresConsultasDatas.TRABALHADORES_CONSULTAS_ID_INDEX: + setTrabalhadores_consultas_id( ( Integer ) value ); + break; + case TrabalhadoresConsultasDatas.TO_TRABALHADORES_CONSULTAS_ID_INDEX: + setToTrabalhadores_consultas_id( ( siprp.data.outer.TrabalhadoresConsultasData ) value ); + break; + case TrabalhadoresConsultasDatas.ESTADO_INDEX: + setEstado( ( Integer ) value ); + break; + case TrabalhadoresConsultasDatas.PRESTADOR_ID_INDEX: + setPrestador_id( ( Integer ) value ); + break; + case TrabalhadoresConsultasDatas.TO_PRESTADOR_ID_INDEX: + setToPrestador_id( ( siprp.data.outer.PrestadoresData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresConsultasDatas.ID_INDEX: + this.id = ( Integer ) value; + break; + case TrabalhadoresConsultasDatas.DATA_INDEX: + this.data = ( java.util.Date ) value; + break; + case TrabalhadoresConsultasDatas.TRABALHADORES_CONSULTAS_ID_INDEX: + this.trabalhadores_consultas_id = ( Integer ) value; + break; + case TrabalhadoresConsultasDatas.TO_TRABALHADORES_CONSULTAS_ID_INDEX: + this.to_trabalhadores_consultas_id = ( siprp.data.outer.TrabalhadoresConsultasData ) value; + break; + case TrabalhadoresConsultasDatas.ESTADO_INDEX: + this.estado = ( Integer ) value; + break; + case TrabalhadoresConsultasDatas.PRESTADOR_ID_INDEX: + this.prestador_id = ( Integer ) value; + break; + case TrabalhadoresConsultasDatas.TO_PRESTADOR_ID_INDEX: + this.to_prestador_id = ( siprp.data.outer.PrestadoresData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case TrabalhadoresConsultasDatas.ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresConsultasDatas.DATA_INDEX: + theClass = java.util.Date.class; + break; + case TrabalhadoresConsultasDatas.TRABALHADORES_CONSULTAS_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresConsultasDatas.TO_TRABALHADORES_CONSULTAS_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresConsultasData.class; + break; + case TrabalhadoresConsultasDatas.ESTADO_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresConsultasDatas.PRESTADOR_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresConsultasDatas.TO_PRESTADOR_ID_INDEX: + theClass = siprp.data.outer.PrestadoresData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : TrabalhadoresConsultasDatas._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, TrabalhadoresConsultasDatas.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresConsultasDatasEmails.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresConsultasDatasEmails.java new file mode 100644 index 00000000..ee45a470 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresConsultasDatasEmails.java @@ -0,0 +1,532 @@ +/* +* TrabalhadoresConsultasDatasEmails.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class TrabalhadoresConsultasDatasEmails extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( TrabalhadoresConsultasDatasEmails.ID, TrabalhadoresConsultasDatasEmails.ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasEmails.ID_FULL, TrabalhadoresConsultasDatasEmails.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresConsultasDatasEmails.CLASS_IDENTIFIER, TrabalhadoresConsultasDatasEmails.TRABALHADORES_CONSULTAS_DATAS_ID, TrabalhadoresConsultasDatasEmails.TO_TRABALHADORES_CONSULTAS_DATAS_ID ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasEmails.TRABALHADORES_CONSULTAS_DATAS_ID, TrabalhadoresConsultasDatasEmails.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasEmails.TRABALHADORES_CONSULTAS_DATAS_ID_FULL, TrabalhadoresConsultasDatasEmails.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasEmails.TO_TRABALHADORES_CONSULTAS_DATAS_ID, TrabalhadoresConsultasDatasEmails.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasEmails.DESTINATION, TrabalhadoresConsultasDatasEmails.DESTINATION_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasEmails.DESTINATION_FULL, TrabalhadoresConsultasDatasEmails.DESTINATION_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasEmails.DATA, TrabalhadoresConsultasDatasEmails.DATA_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasEmails.DATA_FULL, TrabalhadoresConsultasDatasEmails.DATA_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasEmails.SUBJECT, TrabalhadoresConsultasDatasEmails.SUBJECT_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasEmails.SUBJECT_FULL, TrabalhadoresConsultasDatasEmails.SUBJECT_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasEmails.BODY, TrabalhadoresConsultasDatasEmails.BODY_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasEmails.BODY_FULL, TrabalhadoresConsultasDatasEmails.BODY_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeytrabalhadores_consultas_datas_idTotrabalhadores_consultas_datas = + new com.evolute.entity.ForeignKey( TrabalhadoresConsultasDatasEmails.class, TrabalhadoresConsultasDatasEmails.TRABALHADORES_CONSULTAS_DATAS_ID, siprp.data.outer.TrabalhadoresConsultasDatasData.class, siprp.data.outer.TrabalhadoresConsultasDatasData.ID ); + + public static final String TABLENAME = "trabalhadores_consultas_datas_emails"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.trabalhadores_consultas_datas_emails"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_consultas_datas_emails.id"; + public static final int ID_INDEX = 0; + public static final String TRABALHADORES_CONSULTAS_DATAS_ID = "trabalhadores_consultas_datas_id"; + public static final String TRABALHADORES_CONSULTAS_DATAS_ID_FULL = "trabalhadores_consultas_datas_emails.trabalhadores_consultas_datas_id"; + public static final int TRABALHADORES_CONSULTAS_DATAS_ID_INDEX = 1; + public static final String TO_TRABALHADORES_CONSULTAS_DATAS_ID = "to_trabalhadores_consultas_datas_id"; + public static final int TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX = 2; + public static final String DESTINATION = "destination"; + public static final String DESTINATION_FULL = "trabalhadores_consultas_datas_emails.destination"; + public static final int DESTINATION_INDEX = 3; + public static final String DATA = "data"; + public static final String DATA_FULL = "trabalhadores_consultas_datas_emails.data"; + public static final int DATA_INDEX = 4; + public static final String SUBJECT = "subject"; + public static final String SUBJECT_FULL = "trabalhadores_consultas_datas_emails.subject"; + public static final int SUBJECT_INDEX = 5; + public static final String BODY = "body"; + public static final String BODY_FULL = "trabalhadores_consultas_datas_emails.body"; + public static final int BODY_INDEX = 6; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADORES_CONSULTAS_DATAS_ID, TO_TRABALHADORES_CONSULTAS_DATAS_ID, + DESTINATION, DATA, SUBJECT, BODY, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + TRABALHADORES_CONSULTAS_DATAS_ID, TABLENAME + "." + TO_TRABALHADORES_CONSULTAS_DATAS_ID, + TABLENAME + "." + DESTINATION, TABLENAME + "." + DATA, TABLENAME + "." + SUBJECT, TABLENAME + "." + BODY, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, TRABALHADORES_CONSULTAS_DATAS_ID, DESTINATION, DATA, SUBJECT, BODY, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, TRABALHADORES_CONSULTAS_DATAS_ID, DESTINATION, DATA, SUBJECT, BODY, }; + + private Integer id; + private Integer trabalhadores_consultas_datas_id; + private siprp.data.outer.TrabalhadoresConsultasDatasData to_trabalhadores_consultas_datas_id; + private String destination; + private java.util.Date data; + private String subject; + private String body; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public TrabalhadoresConsultasDatasEmails() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public Integer getTrabalhadores_consultas_datas_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TRABALHADORES_CONSULTAS_DATAS_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.trabalhadores_consultas_datas_id; + } + + public void setTrabalhadores_consultas_datas_id( Integer trabalhadores_consultas_datas_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TRABALHADORES_CONSULTAS_DATAS_ID, trabalhadores_consultas_datas_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.trabalhadores_consultas_datas_id = trabalhadores_consultas_datas_id; + LAZY_LOADED_OBJECTS.put( TRABALHADORES_CONSULTAS_DATAS_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresConsultasDatasData toTrabalhadores_consultas_datas_id() + { + try + { + prepare( TO_TRABALHADORES_CONSULTAS_DATAS_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_trabalhadores_consultas_datas_id; + } + + public void setToTrabalhadores_consultas_datas_id( siprp.data.outer.TrabalhadoresConsultasDatasData to_trabalhadores_consultas_datas_id ) + { + try + { + preProcess( TO_TRABALHADORES_CONSULTAS_DATAS_ID, to_trabalhadores_consultas_datas_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_trabalhadores_consultas_datas_id = to_trabalhadores_consultas_datas_id; + } + + public String getDestination() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESTINATION ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.destination; + } + + public void setDestination( String destination ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESTINATION, destination ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.destination = destination; + LAZY_LOADED_OBJECTS.put( DESTINATION, Boolean.TRUE ); + } + + public java.util.Date getData() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data; + } + + public void setData( java.util.Date data ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA, data ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data = data; + LAZY_LOADED_OBJECTS.put( DATA, Boolean.TRUE ); + } + + public String getSubject() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( SUBJECT ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.subject; + } + + public void setSubject( String subject ) + { + try + { + setLockedForRefresh( true ); + preProcess( SUBJECT, subject ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.subject = subject; + LAZY_LOADED_OBJECTS.put( SUBJECT, Boolean.TRUE ); + } + + public String getBody() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( BODY ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.body; + } + + public void setBody( String body ) + { + try + { + setLockedForRefresh( true ); + preProcess( BODY, body ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.body = body; + LAZY_LOADED_OBJECTS.put( BODY, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresConsultasDatasEmails.ID_INDEX: + value = getId(); + break; + case TrabalhadoresConsultasDatasEmails.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + value = getTrabalhadores_consultas_datas_id(); + break; + case TrabalhadoresConsultasDatasEmails.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + value = toTrabalhadores_consultas_datas_id(); + break; + case TrabalhadoresConsultasDatasEmails.DESTINATION_INDEX: + value = getDestination(); + break; + case TrabalhadoresConsultasDatasEmails.DATA_INDEX: + value = getData(); + break; + case TrabalhadoresConsultasDatasEmails.SUBJECT_INDEX: + value = getSubject(); + break; + case TrabalhadoresConsultasDatasEmails.BODY_INDEX: + value = getBody(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresConsultasDatasEmails.ID_INDEX: + value = this.id; + break; + case TrabalhadoresConsultasDatasEmails.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + value = this.trabalhadores_consultas_datas_id; + break; + case TrabalhadoresConsultasDatasEmails.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + value = this.to_trabalhadores_consultas_datas_id; + break; + case TrabalhadoresConsultasDatasEmails.DESTINATION_INDEX: + value = this.destination; + break; + case TrabalhadoresConsultasDatasEmails.DATA_INDEX: + value = this.data; + break; + case TrabalhadoresConsultasDatasEmails.SUBJECT_INDEX: + value = this.subject; + break; + case TrabalhadoresConsultasDatasEmails.BODY_INDEX: + value = this.body; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresConsultasDatasEmails.ID_INDEX: + setId( ( Integer ) value ); + break; + case TrabalhadoresConsultasDatasEmails.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + setTrabalhadores_consultas_datas_id( ( Integer ) value ); + break; + case TrabalhadoresConsultasDatasEmails.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + setToTrabalhadores_consultas_datas_id( ( siprp.data.outer.TrabalhadoresConsultasDatasData ) value ); + break; + case TrabalhadoresConsultasDatasEmails.DESTINATION_INDEX: + setDestination( ( String ) value ); + break; + case TrabalhadoresConsultasDatasEmails.DATA_INDEX: + setData( ( java.util.Date ) value ); + break; + case TrabalhadoresConsultasDatasEmails.SUBJECT_INDEX: + setSubject( ( String ) value ); + break; + case TrabalhadoresConsultasDatasEmails.BODY_INDEX: + setBody( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresConsultasDatasEmails.ID_INDEX: + this.id = ( Integer ) value; + break; + case TrabalhadoresConsultasDatasEmails.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + this.trabalhadores_consultas_datas_id = ( Integer ) value; + break; + case TrabalhadoresConsultasDatasEmails.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + this.to_trabalhadores_consultas_datas_id = ( siprp.data.outer.TrabalhadoresConsultasDatasData ) value; + break; + case TrabalhadoresConsultasDatasEmails.DESTINATION_INDEX: + this.destination = ( String ) value; + break; + case TrabalhadoresConsultasDatasEmails.DATA_INDEX: + this.data = ( java.util.Date ) value; + break; + case TrabalhadoresConsultasDatasEmails.SUBJECT_INDEX: + this.subject = ( String ) value; + break; + case TrabalhadoresConsultasDatasEmails.BODY_INDEX: + this.body = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case TrabalhadoresConsultasDatasEmails.ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresConsultasDatasEmails.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresConsultasDatasEmails.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresConsultasDatasData.class; + break; + case TrabalhadoresConsultasDatasEmails.DESTINATION_INDEX: + theClass = String.class; + break; + case TrabalhadoresConsultasDatasEmails.DATA_INDEX: + theClass = java.util.Date.class; + break; + case TrabalhadoresConsultasDatasEmails.SUBJECT_INDEX: + theClass = String.class; + break; + case TrabalhadoresConsultasDatasEmails.BODY_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : TrabalhadoresConsultasDatasEmails._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, TrabalhadoresConsultasDatasEmails.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresConsultasDatasObservacoes.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresConsultasDatasObservacoes.java new file mode 100644 index 00000000..45b7cd69 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresConsultasDatasObservacoes.java @@ -0,0 +1,382 @@ +/* +* TrabalhadoresConsultasDatasObservacoes.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class TrabalhadoresConsultasDatasObservacoes extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( TrabalhadoresConsultasDatasObservacoes.ID, TrabalhadoresConsultasDatasObservacoes.ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasObservacoes.ID_FULL, TrabalhadoresConsultasDatasObservacoes.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresConsultasDatasObservacoes.CLASS_IDENTIFIER, TrabalhadoresConsultasDatasObservacoes.TRABALHADORES_CONSULTAS_DATAS_ID, TrabalhadoresConsultasDatasObservacoes.TO_TRABALHADORES_CONSULTAS_DATAS_ID ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasObservacoes.TRABALHADORES_CONSULTAS_DATAS_ID, TrabalhadoresConsultasDatasObservacoes.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasObservacoes.TRABALHADORES_CONSULTAS_DATAS_ID_FULL, TrabalhadoresConsultasDatasObservacoes.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasObservacoes.TO_TRABALHADORES_CONSULTAS_DATAS_ID, TrabalhadoresConsultasDatasObservacoes.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasObservacoes.OBSERVACAO, TrabalhadoresConsultasDatasObservacoes.OBSERVACAO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresConsultasDatasObservacoes.OBSERVACAO_FULL, TrabalhadoresConsultasDatasObservacoes.OBSERVACAO_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeytrabalhadores_consultas_datas_idTotrabalhadores_consultas_datas = + new com.evolute.entity.ForeignKey( TrabalhadoresConsultasDatasObservacoes.class, TrabalhadoresConsultasDatasObservacoes.TRABALHADORES_CONSULTAS_DATAS_ID, siprp.data.outer.TrabalhadoresConsultasDatasData.class, siprp.data.outer.TrabalhadoresConsultasDatasData.ID ); + + public static final String TABLENAME = "trabalhadores_consultas_datas_observacoes"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.trabalhadores_consultas_datas_observacoes"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_consultas_datas_observacoes.id"; + public static final int ID_INDEX = 0; + public static final String TRABALHADORES_CONSULTAS_DATAS_ID = "trabalhadores_consultas_datas_id"; + public static final String TRABALHADORES_CONSULTAS_DATAS_ID_FULL = "trabalhadores_consultas_datas_observacoes.trabalhadores_consultas_datas_id"; + public static final int TRABALHADORES_CONSULTAS_DATAS_ID_INDEX = 1; + public static final String TO_TRABALHADORES_CONSULTAS_DATAS_ID = "to_trabalhadores_consultas_datas_id"; + public static final int TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX = 2; + public static final String OBSERVACAO = "observacao"; + public static final String OBSERVACAO_FULL = "trabalhadores_consultas_datas_observacoes.observacao"; + public static final int OBSERVACAO_INDEX = 3; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADORES_CONSULTAS_DATAS_ID, TO_TRABALHADORES_CONSULTAS_DATAS_ID, + OBSERVACAO, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + TRABALHADORES_CONSULTAS_DATAS_ID, TABLENAME + "." + TO_TRABALHADORES_CONSULTAS_DATAS_ID, + TABLENAME + "." + OBSERVACAO, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, TRABALHADORES_CONSULTAS_DATAS_ID, OBSERVACAO, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, TRABALHADORES_CONSULTAS_DATAS_ID, OBSERVACAO, }; + + private Integer id; + private Integer trabalhadores_consultas_datas_id; + private siprp.data.outer.TrabalhadoresConsultasDatasData to_trabalhadores_consultas_datas_id; + private String observacao; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public TrabalhadoresConsultasDatasObservacoes() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public Integer getTrabalhadores_consultas_datas_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TRABALHADORES_CONSULTAS_DATAS_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.trabalhadores_consultas_datas_id; + } + + public void setTrabalhadores_consultas_datas_id( Integer trabalhadores_consultas_datas_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TRABALHADORES_CONSULTAS_DATAS_ID, trabalhadores_consultas_datas_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.trabalhadores_consultas_datas_id = trabalhadores_consultas_datas_id; + LAZY_LOADED_OBJECTS.put( TRABALHADORES_CONSULTAS_DATAS_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresConsultasDatasData toTrabalhadores_consultas_datas_id() + { + try + { + prepare( TO_TRABALHADORES_CONSULTAS_DATAS_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_trabalhadores_consultas_datas_id; + } + + public void setToTrabalhadores_consultas_datas_id( siprp.data.outer.TrabalhadoresConsultasDatasData to_trabalhadores_consultas_datas_id ) + { + try + { + preProcess( TO_TRABALHADORES_CONSULTAS_DATAS_ID, to_trabalhadores_consultas_datas_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_trabalhadores_consultas_datas_id = to_trabalhadores_consultas_datas_id; + } + + public String getObservacao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( OBSERVACAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.observacao; + } + + public void setObservacao( String observacao ) + { + try + { + setLockedForRefresh( true ); + preProcess( OBSERVACAO, observacao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.observacao = observacao; + LAZY_LOADED_OBJECTS.put( OBSERVACAO, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresConsultasDatasObservacoes.ID_INDEX: + value = getId(); + break; + case TrabalhadoresConsultasDatasObservacoes.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + value = getTrabalhadores_consultas_datas_id(); + break; + case TrabalhadoresConsultasDatasObservacoes.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + value = toTrabalhadores_consultas_datas_id(); + break; + case TrabalhadoresConsultasDatasObservacoes.OBSERVACAO_INDEX: + value = getObservacao(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresConsultasDatasObservacoes.ID_INDEX: + value = this.id; + break; + case TrabalhadoresConsultasDatasObservacoes.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + value = this.trabalhadores_consultas_datas_id; + break; + case TrabalhadoresConsultasDatasObservacoes.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + value = this.to_trabalhadores_consultas_datas_id; + break; + case TrabalhadoresConsultasDatasObservacoes.OBSERVACAO_INDEX: + value = this.observacao; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresConsultasDatasObservacoes.ID_INDEX: + setId( ( Integer ) value ); + break; + case TrabalhadoresConsultasDatasObservacoes.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + setTrabalhadores_consultas_datas_id( ( Integer ) value ); + break; + case TrabalhadoresConsultasDatasObservacoes.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + setToTrabalhadores_consultas_datas_id( ( siprp.data.outer.TrabalhadoresConsultasDatasData ) value ); + break; + case TrabalhadoresConsultasDatasObservacoes.OBSERVACAO_INDEX: + setObservacao( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresConsultasDatasObservacoes.ID_INDEX: + this.id = ( Integer ) value; + break; + case TrabalhadoresConsultasDatasObservacoes.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + this.trabalhadores_consultas_datas_id = ( Integer ) value; + break; + case TrabalhadoresConsultasDatasObservacoes.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + this.to_trabalhadores_consultas_datas_id = ( siprp.data.outer.TrabalhadoresConsultasDatasData ) value; + break; + case TrabalhadoresConsultasDatasObservacoes.OBSERVACAO_INDEX: + this.observacao = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case TrabalhadoresConsultasDatasObservacoes.ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresConsultasDatasObservacoes.TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresConsultasDatasObservacoes.TO_TRABALHADORES_CONSULTAS_DATAS_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresConsultasDatasData.class; + break; + case TrabalhadoresConsultasDatasObservacoes.OBSERVACAO_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : TrabalhadoresConsultasDatasObservacoes._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, TrabalhadoresConsultasDatasObservacoes.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcd.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcd.java new file mode 100644 index 00000000..6db07e8e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcd.java @@ -0,0 +1,834 @@ +/* +* TrabalhadoresEcd.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class TrabalhadoresEcd extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( TrabalhadoresEcd.ID, TrabalhadoresEcd.ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcd.ID_FULL, TrabalhadoresEcd.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresEcd.CLASS_IDENTIFIER, TrabalhadoresEcd.ECD_ID, TrabalhadoresEcd.TO_ECD_ID ); + FIELD_INDEXES.put( TrabalhadoresEcd.ECD_ID, TrabalhadoresEcd.ECD_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcd.ECD_ID_FULL, TrabalhadoresEcd.ECD_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcd.TO_ECD_ID, TrabalhadoresEcd.TO_ECD_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresEcd.CLASS_IDENTIFIER, TrabalhadoresEcd.ECD_OFICIAL_ID, TrabalhadoresEcd.TO_ECD_OFICIAL_ID ); + FIELD_INDEXES.put( TrabalhadoresEcd.ECD_OFICIAL_ID, TrabalhadoresEcd.ECD_OFICIAL_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcd.ECD_OFICIAL_ID_FULL, TrabalhadoresEcd.ECD_OFICIAL_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcd.TO_ECD_OFICIAL_ID, TrabalhadoresEcd.TO_ECD_OFICIAL_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcd.ESTADO, TrabalhadoresEcd.ESTADO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcd.ESTADO_FULL, TrabalhadoresEcd.ESTADO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresEcd.CLASS_IDENTIFIER, TrabalhadoresEcd.TRABALHADORES_ECDS_DATAS_ID, TrabalhadoresEcd.TO_TRABALHADORES_ECDS_DATAS_ID ); + FIELD_INDEXES.put( TrabalhadoresEcd.TRABALHADORES_ECDS_DATAS_ID, TrabalhadoresEcd.TRABALHADORES_ECDS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcd.TRABALHADORES_ECDS_DATAS_ID_FULL, TrabalhadoresEcd.TRABALHADORES_ECDS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcd.TO_TRABALHADORES_ECDS_DATAS_ID, TrabalhadoresEcd.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcd.ENVIADO, TrabalhadoresEcd.ENVIADO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcd.ENVIADO_FULL, TrabalhadoresEcd.ENVIADO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresEcd.CLASS_IDENTIFIER, TrabalhadoresEcd.ANALISADOR_ID, TrabalhadoresEcd.TO_ANALISADOR_ID ); + FIELD_INDEXES.put( TrabalhadoresEcd.ANALISADOR_ID, TrabalhadoresEcd.ANALISADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcd.ANALISADOR_ID_FULL, TrabalhadoresEcd.ANALISADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcd.TO_ANALISADOR_ID, TrabalhadoresEcd.TO_ANALISADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcd.DATA_ENVIO, TrabalhadoresEcd.DATA_ENVIO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcd.DATA_ENVIO_FULL, TrabalhadoresEcd.DATA_ENVIO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcd.DATA_RECEPCAO, TrabalhadoresEcd.DATA_RECEPCAO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcd.DATA_RECEPCAO_FULL, TrabalhadoresEcd.DATA_RECEPCAO_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyecd_idToprt_tipos_elementos_protocolo = + new com.evolute.entity.ForeignKey( TrabalhadoresEcd.class, TrabalhadoresEcd.ECD_ID, siprp.data.outer.PrtTiposElementosProtocoloData.class, siprp.data.outer.PrtTiposElementosProtocoloData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyecd_oficial_idToecd_oficial = + new com.evolute.entity.ForeignKey( TrabalhadoresEcd.class, TrabalhadoresEcd.ECD_OFICIAL_ID, siprp.data.outer.EcdOficialData.class, siprp.data.outer.EcdOficialData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeytrabalhadores_ecds_datas_idTotrabalhadores_ecds_datas = + new com.evolute.entity.ForeignKey( TrabalhadoresEcd.class, TrabalhadoresEcd.TRABALHADORES_ECDS_DATAS_ID, siprp.data.outer.TrabalhadoresEcdsDatasData.class, siprp.data.outer.TrabalhadoresEcdsDatasData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyanalisador_idToprestadores = + new com.evolute.entity.ForeignKey( TrabalhadoresEcd.class, TrabalhadoresEcd.ANALISADOR_ID, siprp.data.outer.PrestadoresData.class, siprp.data.outer.PrestadoresData.ID ); + + public static final String TABLENAME = "trabalhadores_ecd"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.trabalhadores_ecd"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_ecd.id"; + public static final int ID_INDEX = 0; + public static final String ECD_ID = "ecd_id"; + public static final String ECD_ID_FULL = "trabalhadores_ecd.ecd_id"; + public static final int ECD_ID_INDEX = 1; + public static final String TO_ECD_ID = "to_ecd_id"; + public static final int TO_ECD_ID_INDEX = 2; + public static final String ECD_OFICIAL_ID = "ecd_oficial_id"; + public static final String ECD_OFICIAL_ID_FULL = "trabalhadores_ecd.ecd_oficial_id"; + public static final int ECD_OFICIAL_ID_INDEX = 3; + public static final String TO_ECD_OFICIAL_ID = "to_ecd_oficial_id"; + public static final int TO_ECD_OFICIAL_ID_INDEX = 4; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "trabalhadores_ecd.estado"; + public static final int ESTADO_INDEX = 5; + public static final String TRABALHADORES_ECDS_DATAS_ID = "trabalhadores_ecds_datas_id"; + public static final String TRABALHADORES_ECDS_DATAS_ID_FULL = "trabalhadores_ecd.trabalhadores_ecds_datas_id"; + public static final int TRABALHADORES_ECDS_DATAS_ID_INDEX = 6; + public static final String TO_TRABALHADORES_ECDS_DATAS_ID = "to_trabalhadores_ecds_datas_id"; + public static final int TO_TRABALHADORES_ECDS_DATAS_ID_INDEX = 7; + public static final String ENVIADO = "enviado"; + public static final String ENVIADO_FULL = "trabalhadores_ecd.enviado"; + public static final int ENVIADO_INDEX = 8; + public static final String ANALISADOR_ID = "analisador_id"; + public static final String ANALISADOR_ID_FULL = "trabalhadores_ecd.analisador_id"; + public static final int ANALISADOR_ID_INDEX = 9; + public static final String TO_ANALISADOR_ID = "to_analisador_id"; + public static final int TO_ANALISADOR_ID_INDEX = 10; + public static final String DATA_ENVIO = "data_envio"; + public static final String DATA_ENVIO_FULL = "trabalhadores_ecd.data_envio"; + public static final int DATA_ENVIO_INDEX = 11; + public static final String DATA_RECEPCAO = "data_recepcao"; + public static final String DATA_RECEPCAO_FULL = "trabalhadores_ecd.data_recepcao"; + public static final int DATA_RECEPCAO_INDEX = 12; + + public static final String FIELD_NAMES[] = new String[]{ + ECD_ID, TO_ECD_ID, ECD_OFICIAL_ID, TO_ECD_OFICIAL_ID, ESTADO, + TRABALHADORES_ECDS_DATAS_ID, TO_TRABALHADORES_ECDS_DATAS_ID, ENVIADO, + ANALISADOR_ID, TO_ANALISADOR_ID, DATA_ENVIO, DATA_RECEPCAO, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + ECD_ID, TABLENAME + "." + TO_ECD_ID, TABLENAME + "." + ECD_OFICIAL_ID, TABLENAME + "." + TO_ECD_OFICIAL_ID, TABLENAME + "." + ESTADO, + TABLENAME + "." + TRABALHADORES_ECDS_DATAS_ID, TABLENAME + "." + TO_TRABALHADORES_ECDS_DATAS_ID, TABLENAME + "." + ENVIADO, + TABLENAME + "." + ANALISADOR_ID, TABLENAME + "." + TO_ANALISADOR_ID, TABLENAME + "." + DATA_ENVIO, TABLENAME + "." + DATA_RECEPCAO, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, ECD_ID, ECD_OFICIAL_ID, ESTADO, TRABALHADORES_ECDS_DATAS_ID, ENVIADO, + ANALISADOR_ID, DATA_ENVIO, DATA_RECEPCAO, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, ECD_ID, ECD_OFICIAL_ID, ESTADO, TRABALHADORES_ECDS_DATAS_ID, ENVIADO, + ANALISADOR_ID, DATA_ENVIO, DATA_RECEPCAO, }; + + private Integer id; + private Integer ecd_id; + private siprp.data.outer.PrtTiposElementosProtocoloData to_ecd_id; + private Integer ecd_oficial_id; + private siprp.data.outer.EcdOficialData to_ecd_oficial_id; + private Integer estado; + private Integer trabalhadores_ecds_datas_id; + private siprp.data.outer.TrabalhadoresEcdsDatasData to_trabalhadores_ecds_datas_id; + private String enviado; + private Integer analisador_id; + private siprp.data.outer.PrestadoresData to_analisador_id; + private java.util.Date data_envio; + private java.util.Date data_recepcao; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public TrabalhadoresEcd() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false, false, false, false, + false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public Integer getEcd_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ECD_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.ecd_id; + } + + public void setEcd_id( Integer ecd_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ECD_ID, ecd_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.ecd_id = ecd_id; + LAZY_LOADED_OBJECTS.put( ECD_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrtTiposElementosProtocoloData toEcd_id() + { + try + { + prepare( TO_ECD_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_ecd_id; + } + + public void setToEcd_id( siprp.data.outer.PrtTiposElementosProtocoloData to_ecd_id ) + { + try + { + preProcess( TO_ECD_ID, to_ecd_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_ecd_id = to_ecd_id; + } + + public Integer getEcd_oficial_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ECD_OFICIAL_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.ecd_oficial_id; + } + + public void setEcd_oficial_id( Integer ecd_oficial_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ECD_OFICIAL_ID, ecd_oficial_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.ecd_oficial_id = ecd_oficial_id; + LAZY_LOADED_OBJECTS.put( ECD_OFICIAL_ID, Boolean.TRUE ); + } + + public siprp.data.outer.EcdOficialData toEcd_oficial_id() + { + try + { + prepare( TO_ECD_OFICIAL_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_ecd_oficial_id; + } + + public void setToEcd_oficial_id( siprp.data.outer.EcdOficialData to_ecd_oficial_id ) + { + try + { + preProcess( TO_ECD_OFICIAL_ID, to_ecd_oficial_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_ecd_oficial_id = to_ecd_oficial_id; + } + + public Integer getEstado() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTADO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estado; + } + + public void setEstado( Integer estado ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTADO, estado ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estado = estado; + LAZY_LOADED_OBJECTS.put( ESTADO, Boolean.TRUE ); + } + + public Integer getTrabalhadores_ecds_datas_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TRABALHADORES_ECDS_DATAS_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.trabalhadores_ecds_datas_id; + } + + public void setTrabalhadores_ecds_datas_id( Integer trabalhadores_ecds_datas_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TRABALHADORES_ECDS_DATAS_ID, trabalhadores_ecds_datas_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.trabalhadores_ecds_datas_id = trabalhadores_ecds_datas_id; + LAZY_LOADED_OBJECTS.put( TRABALHADORES_ECDS_DATAS_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresEcdsDatasData toTrabalhadores_ecds_datas_id() + { + try + { + prepare( TO_TRABALHADORES_ECDS_DATAS_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_trabalhadores_ecds_datas_id; + } + + public void setToTrabalhadores_ecds_datas_id( siprp.data.outer.TrabalhadoresEcdsDatasData to_trabalhadores_ecds_datas_id ) + { + try + { + preProcess( TO_TRABALHADORES_ECDS_DATAS_ID, to_trabalhadores_ecds_datas_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_trabalhadores_ecds_datas_id = to_trabalhadores_ecds_datas_id; + } + + public String getEnviado() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ENVIADO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.enviado; + } + + public void setEnviado( String enviado ) + { + try + { + setLockedForRefresh( true ); + preProcess( ENVIADO, enviado ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.enviado = enviado; + LAZY_LOADED_OBJECTS.put( ENVIADO, Boolean.TRUE ); + } + + public Integer getAnalisador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ANALISADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.analisador_id; + } + + public void setAnalisador_id( Integer analisador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ANALISADOR_ID, analisador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.analisador_id = analisador_id; + LAZY_LOADED_OBJECTS.put( ANALISADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrestadoresData toAnalisador_id() + { + try + { + prepare( TO_ANALISADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_analisador_id; + } + + public void setToAnalisador_id( siprp.data.outer.PrestadoresData to_analisador_id ) + { + try + { + preProcess( TO_ANALISADOR_ID, to_analisador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_analisador_id = to_analisador_id; + } + + public java.util.Date getData_envio() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_ENVIO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_envio; + } + + public void setData_envio( java.util.Date data_envio ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_ENVIO, data_envio ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_envio = data_envio; + LAZY_LOADED_OBJECTS.put( DATA_ENVIO, Boolean.TRUE ); + } + + public java.util.Date getData_recepcao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_RECEPCAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_recepcao; + } + + public void setData_recepcao( java.util.Date data_recepcao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_RECEPCAO, data_recepcao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_recepcao = data_recepcao; + LAZY_LOADED_OBJECTS.put( DATA_RECEPCAO, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcd.ID_INDEX: + value = getId(); + break; + case TrabalhadoresEcd.ECD_ID_INDEX: + value = getEcd_id(); + break; + case TrabalhadoresEcd.TO_ECD_ID_INDEX: + value = toEcd_id(); + break; + case TrabalhadoresEcd.ECD_OFICIAL_ID_INDEX: + value = getEcd_oficial_id(); + break; + case TrabalhadoresEcd.TO_ECD_OFICIAL_ID_INDEX: + value = toEcd_oficial_id(); + break; + case TrabalhadoresEcd.ESTADO_INDEX: + value = getEstado(); + break; + case TrabalhadoresEcd.TRABALHADORES_ECDS_DATAS_ID_INDEX: + value = getTrabalhadores_ecds_datas_id(); + break; + case TrabalhadoresEcd.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + value = toTrabalhadores_ecds_datas_id(); + break; + case TrabalhadoresEcd.ENVIADO_INDEX: + value = getEnviado(); + break; + case TrabalhadoresEcd.ANALISADOR_ID_INDEX: + value = getAnalisador_id(); + break; + case TrabalhadoresEcd.TO_ANALISADOR_ID_INDEX: + value = toAnalisador_id(); + break; + case TrabalhadoresEcd.DATA_ENVIO_INDEX: + value = getData_envio(); + break; + case TrabalhadoresEcd.DATA_RECEPCAO_INDEX: + value = getData_recepcao(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcd.ID_INDEX: + value = this.id; + break; + case TrabalhadoresEcd.ECD_ID_INDEX: + value = this.ecd_id; + break; + case TrabalhadoresEcd.TO_ECD_ID_INDEX: + value = this.to_ecd_id; + break; + case TrabalhadoresEcd.ECD_OFICIAL_ID_INDEX: + value = this.ecd_oficial_id; + break; + case TrabalhadoresEcd.TO_ECD_OFICIAL_ID_INDEX: + value = this.to_ecd_oficial_id; + break; + case TrabalhadoresEcd.ESTADO_INDEX: + value = this.estado; + break; + case TrabalhadoresEcd.TRABALHADORES_ECDS_DATAS_ID_INDEX: + value = this.trabalhadores_ecds_datas_id; + break; + case TrabalhadoresEcd.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + value = this.to_trabalhadores_ecds_datas_id; + break; + case TrabalhadoresEcd.ENVIADO_INDEX: + value = this.enviado; + break; + case TrabalhadoresEcd.ANALISADOR_ID_INDEX: + value = this.analisador_id; + break; + case TrabalhadoresEcd.TO_ANALISADOR_ID_INDEX: + value = this.to_analisador_id; + break; + case TrabalhadoresEcd.DATA_ENVIO_INDEX: + value = this.data_envio; + break; + case TrabalhadoresEcd.DATA_RECEPCAO_INDEX: + value = this.data_recepcao; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcd.ID_INDEX: + setId( ( Integer ) value ); + break; + case TrabalhadoresEcd.ECD_ID_INDEX: + setEcd_id( ( Integer ) value ); + break; + case TrabalhadoresEcd.TO_ECD_ID_INDEX: + setToEcd_id( ( siprp.data.outer.PrtTiposElementosProtocoloData ) value ); + break; + case TrabalhadoresEcd.ECD_OFICIAL_ID_INDEX: + setEcd_oficial_id( ( Integer ) value ); + break; + case TrabalhadoresEcd.TO_ECD_OFICIAL_ID_INDEX: + setToEcd_oficial_id( ( siprp.data.outer.EcdOficialData ) value ); + break; + case TrabalhadoresEcd.ESTADO_INDEX: + setEstado( ( Integer ) value ); + break; + case TrabalhadoresEcd.TRABALHADORES_ECDS_DATAS_ID_INDEX: + setTrabalhadores_ecds_datas_id( ( Integer ) value ); + break; + case TrabalhadoresEcd.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + setToTrabalhadores_ecds_datas_id( ( siprp.data.outer.TrabalhadoresEcdsDatasData ) value ); + break; + case TrabalhadoresEcd.ENVIADO_INDEX: + setEnviado( ( String ) value ); + break; + case TrabalhadoresEcd.ANALISADOR_ID_INDEX: + setAnalisador_id( ( Integer ) value ); + break; + case TrabalhadoresEcd.TO_ANALISADOR_ID_INDEX: + setToAnalisador_id( ( siprp.data.outer.PrestadoresData ) value ); + break; + case TrabalhadoresEcd.DATA_ENVIO_INDEX: + setData_envio( ( java.util.Date ) value ); + break; + case TrabalhadoresEcd.DATA_RECEPCAO_INDEX: + setData_recepcao( ( java.util.Date ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcd.ID_INDEX: + this.id = ( Integer ) value; + break; + case TrabalhadoresEcd.ECD_ID_INDEX: + this.ecd_id = ( Integer ) value; + break; + case TrabalhadoresEcd.TO_ECD_ID_INDEX: + this.to_ecd_id = ( siprp.data.outer.PrtTiposElementosProtocoloData ) value; + break; + case TrabalhadoresEcd.ECD_OFICIAL_ID_INDEX: + this.ecd_oficial_id = ( Integer ) value; + break; + case TrabalhadoresEcd.TO_ECD_OFICIAL_ID_INDEX: + this.to_ecd_oficial_id = ( siprp.data.outer.EcdOficialData ) value; + break; + case TrabalhadoresEcd.ESTADO_INDEX: + this.estado = ( Integer ) value; + break; + case TrabalhadoresEcd.TRABALHADORES_ECDS_DATAS_ID_INDEX: + this.trabalhadores_ecds_datas_id = ( Integer ) value; + break; + case TrabalhadoresEcd.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + this.to_trabalhadores_ecds_datas_id = ( siprp.data.outer.TrabalhadoresEcdsDatasData ) value; + break; + case TrabalhadoresEcd.ENVIADO_INDEX: + this.enviado = ( String ) value; + break; + case TrabalhadoresEcd.ANALISADOR_ID_INDEX: + this.analisador_id = ( Integer ) value; + break; + case TrabalhadoresEcd.TO_ANALISADOR_ID_INDEX: + this.to_analisador_id = ( siprp.data.outer.PrestadoresData ) value; + break; + case TrabalhadoresEcd.DATA_ENVIO_INDEX: + this.data_envio = ( java.util.Date ) value; + break; + case TrabalhadoresEcd.DATA_RECEPCAO_INDEX: + this.data_recepcao = ( java.util.Date ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case TrabalhadoresEcd.ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcd.ECD_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcd.TO_ECD_ID_INDEX: + theClass = siprp.data.outer.PrtTiposElementosProtocoloData.class; + break; + case TrabalhadoresEcd.ECD_OFICIAL_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcd.TO_ECD_OFICIAL_ID_INDEX: + theClass = siprp.data.outer.EcdOficialData.class; + break; + case TrabalhadoresEcd.ESTADO_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcd.TRABALHADORES_ECDS_DATAS_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcd.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresEcdsDatasData.class; + break; + case TrabalhadoresEcd.ENVIADO_INDEX: + theClass = String.class; + break; + case TrabalhadoresEcd.ANALISADOR_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcd.TO_ANALISADOR_ID_INDEX: + theClass = siprp.data.outer.PrestadoresData.class; + break; + case TrabalhadoresEcd.DATA_ENVIO_INDEX: + theClass = java.util.Date.class; + break; + case TrabalhadoresEcd.DATA_RECEPCAO_INDEX: + theClass = java.util.Date.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : TrabalhadoresEcd._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, TrabalhadoresEcd.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcds.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcds.java new file mode 100644 index 00000000..7af3d9d0 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcds.java @@ -0,0 +1,543 @@ +/* +* TrabalhadoresEcds.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class TrabalhadoresEcds extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( TrabalhadoresEcds.ID, TrabalhadoresEcds.ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcds.ID_FULL, TrabalhadoresEcds.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresEcds.CLASS_IDENTIFIER, TrabalhadoresEcds.TRABALHADOR_ID, TrabalhadoresEcds.TO_TRABALHADOR_ID ); + FIELD_INDEXES.put( TrabalhadoresEcds.TRABALHADOR_ID, TrabalhadoresEcds.TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcds.TRABALHADOR_ID_FULL, TrabalhadoresEcds.TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcds.TO_TRABALHADOR_ID, TrabalhadoresEcds.TO_TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcds.ESTADO, TrabalhadoresEcds.ESTADO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcds.ESTADO_FULL, TrabalhadoresEcds.ESTADO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcds.DATA, TrabalhadoresEcds.DATA_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcds.DATA_FULL, TrabalhadoresEcds.DATA_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresEcds.CLASS_IDENTIFIER, TrabalhadoresEcds.PROCESSO_ID, TrabalhadoresEcds.TO_PROCESSO_ID ); + FIELD_INDEXES.put( TrabalhadoresEcds.PROCESSO_ID, TrabalhadoresEcds.PROCESSO_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcds.PROCESSO_ID_FULL, TrabalhadoresEcds.PROCESSO_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcds.TO_PROCESSO_ID, TrabalhadoresEcds.TO_PROCESSO_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeytrabalhador_idTotrabalhadores = + new com.evolute.entity.ForeignKey( TrabalhadoresEcds.class, TrabalhadoresEcds.TRABALHADOR_ID, siprp.data.outer.TrabalhadoresData.class, siprp.data.outer.TrabalhadoresData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyprocesso_idTotrabalhadores_processo = + new com.evolute.entity.ForeignKey( TrabalhadoresEcds.class, TrabalhadoresEcds.PROCESSO_ID, siprp.data.outer.TrabalhadoresProcessoData.class, siprp.data.outer.TrabalhadoresProcessoData.ID ); + + public static final String TABLENAME = "trabalhadores_ecds"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.trabalhadores_ecds"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_ecds.id"; + public static final int ID_INDEX = 0; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String TRABALHADOR_ID_FULL = "trabalhadores_ecds.trabalhador_id"; + public static final int TRABALHADOR_ID_INDEX = 1; + public static final String TO_TRABALHADOR_ID = "to_trabalhador_id"; + public static final int TO_TRABALHADOR_ID_INDEX = 2; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "trabalhadores_ecds.estado"; + public static final int ESTADO_INDEX = 3; + public static final String DATA = "data"; + public static final String DATA_FULL = "trabalhadores_ecds.data"; + public static final int DATA_INDEX = 4; + public static final String PROCESSO_ID = "processo_id"; + public static final String PROCESSO_ID_FULL = "trabalhadores_ecds.processo_id"; + public static final int PROCESSO_ID_INDEX = 5; + public static final String TO_PROCESSO_ID = "to_processo_id"; + public static final int TO_PROCESSO_ID_INDEX = 6; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADOR_ID, TO_TRABALHADOR_ID, ESTADO, DATA, PROCESSO_ID, TO_PROCESSO_ID, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + TRABALHADOR_ID, TABLENAME + "." + TO_TRABALHADOR_ID, TABLENAME + "." + ESTADO, TABLENAME + "." + DATA, TABLENAME + "." + PROCESSO_ID, TABLENAME + "." + TO_PROCESSO_ID, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, TRABALHADOR_ID, ESTADO, DATA, PROCESSO_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, TRABALHADOR_ID, ESTADO, DATA, PROCESSO_ID, }; + + private Integer id; + private Integer trabalhador_id; + private siprp.data.outer.TrabalhadoresData to_trabalhador_id; + private Integer estado; + private java.util.Date data; + private Integer processo_id; + private siprp.data.outer.TrabalhadoresProcessoData to_processo_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public TrabalhadoresEcds() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromTrabalhadoresEcdsDatas_trabalhadores_ecds_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresEcdsDatasData.class , getPrimaryKey().getMap().get("id"), "trabalhadores_ecds_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public Integer getTrabalhador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TRABALHADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.trabalhador_id; + } + + public void setTrabalhador_id( Integer trabalhador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TRABALHADOR_ID, trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.trabalhador_id = trabalhador_id; + LAZY_LOADED_OBJECTS.put( TRABALHADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresData toTrabalhador_id() + { + try + { + prepare( TO_TRABALHADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_trabalhador_id; + } + + public void setToTrabalhador_id( siprp.data.outer.TrabalhadoresData to_trabalhador_id ) + { + try + { + preProcess( TO_TRABALHADOR_ID, to_trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_trabalhador_id = to_trabalhador_id; + } + + public Integer getEstado() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTADO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estado; + } + + public void setEstado( Integer estado ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTADO, estado ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estado = estado; + LAZY_LOADED_OBJECTS.put( ESTADO, Boolean.TRUE ); + } + + public java.util.Date getData() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data; + } + + public void setData( java.util.Date data ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA, data ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data = data; + LAZY_LOADED_OBJECTS.put( DATA, Boolean.TRUE ); + } + + public Integer getProcesso_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PROCESSO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.processo_id; + } + + public void setProcesso_id( Integer processo_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( PROCESSO_ID, processo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.processo_id = processo_id; + LAZY_LOADED_OBJECTS.put( PROCESSO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresProcessoData toProcesso_id() + { + try + { + prepare( TO_PROCESSO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_processo_id; + } + + public void setToProcesso_id( siprp.data.outer.TrabalhadoresProcessoData to_processo_id ) + { + try + { + preProcess( TO_PROCESSO_ID, to_processo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_processo_id = to_processo_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcds.ID_INDEX: + value = getId(); + break; + case TrabalhadoresEcds.TRABALHADOR_ID_INDEX: + value = getTrabalhador_id(); + break; + case TrabalhadoresEcds.TO_TRABALHADOR_ID_INDEX: + value = toTrabalhador_id(); + break; + case TrabalhadoresEcds.ESTADO_INDEX: + value = getEstado(); + break; + case TrabalhadoresEcds.DATA_INDEX: + value = getData(); + break; + case TrabalhadoresEcds.PROCESSO_ID_INDEX: + value = getProcesso_id(); + break; + case TrabalhadoresEcds.TO_PROCESSO_ID_INDEX: + value = toProcesso_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcds.ID_INDEX: + value = this.id; + break; + case TrabalhadoresEcds.TRABALHADOR_ID_INDEX: + value = this.trabalhador_id; + break; + case TrabalhadoresEcds.TO_TRABALHADOR_ID_INDEX: + value = this.to_trabalhador_id; + break; + case TrabalhadoresEcds.ESTADO_INDEX: + value = this.estado; + break; + case TrabalhadoresEcds.DATA_INDEX: + value = this.data; + break; + case TrabalhadoresEcds.PROCESSO_ID_INDEX: + value = this.processo_id; + break; + case TrabalhadoresEcds.TO_PROCESSO_ID_INDEX: + value = this.to_processo_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcds.ID_INDEX: + setId( ( Integer ) value ); + break; + case TrabalhadoresEcds.TRABALHADOR_ID_INDEX: + setTrabalhador_id( ( Integer ) value ); + break; + case TrabalhadoresEcds.TO_TRABALHADOR_ID_INDEX: + setToTrabalhador_id( ( siprp.data.outer.TrabalhadoresData ) value ); + break; + case TrabalhadoresEcds.ESTADO_INDEX: + setEstado( ( Integer ) value ); + break; + case TrabalhadoresEcds.DATA_INDEX: + setData( ( java.util.Date ) value ); + break; + case TrabalhadoresEcds.PROCESSO_ID_INDEX: + setProcesso_id( ( Integer ) value ); + break; + case TrabalhadoresEcds.TO_PROCESSO_ID_INDEX: + setToProcesso_id( ( siprp.data.outer.TrabalhadoresProcessoData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcds.ID_INDEX: + this.id = ( Integer ) value; + break; + case TrabalhadoresEcds.TRABALHADOR_ID_INDEX: + this.trabalhador_id = ( Integer ) value; + break; + case TrabalhadoresEcds.TO_TRABALHADOR_ID_INDEX: + this.to_trabalhador_id = ( siprp.data.outer.TrabalhadoresData ) value; + break; + case TrabalhadoresEcds.ESTADO_INDEX: + this.estado = ( Integer ) value; + break; + case TrabalhadoresEcds.DATA_INDEX: + this.data = ( java.util.Date ) value; + break; + case TrabalhadoresEcds.PROCESSO_ID_INDEX: + this.processo_id = ( Integer ) value; + break; + case TrabalhadoresEcds.TO_PROCESSO_ID_INDEX: + this.to_processo_id = ( siprp.data.outer.TrabalhadoresProcessoData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case TrabalhadoresEcds.ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcds.TRABALHADOR_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcds.TO_TRABALHADOR_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresData.class; + break; + case TrabalhadoresEcds.ESTADO_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcds.DATA_INDEX: + theClass = java.util.Date.class; + break; + case TrabalhadoresEcds.PROCESSO_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcds.TO_PROCESSO_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresProcessoData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : TrabalhadoresEcds._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, TrabalhadoresEcds.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcdsAnalise.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcdsAnalise.java new file mode 100644 index 00000000..5be98a76 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcdsAnalise.java @@ -0,0 +1,479 @@ +/* +* TrabalhadoresEcdsAnalise.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class TrabalhadoresEcdsAnalise extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( TrabalhadoresEcdsAnalise.ID, TrabalhadoresEcdsAnalise.ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsAnalise.ID_FULL, TrabalhadoresEcdsAnalise.ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsAnalise.DATA, TrabalhadoresEcdsAnalise.DATA_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsAnalise.DATA_FULL, TrabalhadoresEcdsAnalise.DATA_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresEcdsAnalise.CLASS_IDENTIFIER, TrabalhadoresEcdsAnalise.PRESTADOR_ID, TrabalhadoresEcdsAnalise.TO_PRESTADOR_ID ); + FIELD_INDEXES.put( TrabalhadoresEcdsAnalise.PRESTADOR_ID, TrabalhadoresEcdsAnalise.PRESTADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsAnalise.PRESTADOR_ID_FULL, TrabalhadoresEcdsAnalise.PRESTADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsAnalise.TO_PRESTADOR_ID, TrabalhadoresEcdsAnalise.TO_PRESTADOR_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresEcdsAnalise.CLASS_IDENTIFIER, TrabalhadoresEcdsAnalise.GRUPO_ECDS_ID, TrabalhadoresEcdsAnalise.TO_GRUPO_ECDS_ID ); + FIELD_INDEXES.put( TrabalhadoresEcdsAnalise.GRUPO_ECDS_ID, TrabalhadoresEcdsAnalise.GRUPO_ECDS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsAnalise.GRUPO_ECDS_ID_FULL, TrabalhadoresEcdsAnalise.GRUPO_ECDS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsAnalise.TO_GRUPO_ECDS_ID, TrabalhadoresEcdsAnalise.TO_GRUPO_ECDS_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyprestador_idToprestadores = + new com.evolute.entity.ForeignKey( TrabalhadoresEcdsAnalise.class, TrabalhadoresEcdsAnalise.PRESTADOR_ID, siprp.data.outer.PrestadoresData.class, siprp.data.outer.PrestadoresData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeygrupo_ecds_idToprt_grupos_protocolo = + new com.evolute.entity.ForeignKey( TrabalhadoresEcdsAnalise.class, TrabalhadoresEcdsAnalise.GRUPO_ECDS_ID, siprp.data.outer.PrtGruposProtocoloData.class, siprp.data.outer.PrtGruposProtocoloData.ID ); + + public static final String TABLENAME = "trabalhadores_ecds_analise"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.trabalhadores_ecds_analise"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_ecds_analise.id"; + public static final int ID_INDEX = 0; + public static final String DATA = "data"; + public static final String DATA_FULL = "trabalhadores_ecds_analise.data"; + public static final int DATA_INDEX = 1; + public static final String PRESTADOR_ID = "prestador_id"; + public static final String PRESTADOR_ID_FULL = "trabalhadores_ecds_analise.prestador_id"; + public static final int PRESTADOR_ID_INDEX = 2; + public static final String TO_PRESTADOR_ID = "to_prestador_id"; + public static final int TO_PRESTADOR_ID_INDEX = 3; + public static final String GRUPO_ECDS_ID = "grupo_ecds_id"; + public static final String GRUPO_ECDS_ID_FULL = "trabalhadores_ecds_analise.grupo_ecds_id"; + public static final int GRUPO_ECDS_ID_INDEX = 4; + public static final String TO_GRUPO_ECDS_ID = "to_grupo_ecds_id"; + public static final int TO_GRUPO_ECDS_ID_INDEX = 5; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, PRESTADOR_ID, TO_PRESTADOR_ID, GRUPO_ECDS_ID, TO_GRUPO_ECDS_ID, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + DATA, TABLENAME + "." + PRESTADOR_ID, TABLENAME + "." + TO_PRESTADOR_ID, TABLENAME + "." + GRUPO_ECDS_ID, TABLENAME + "." + TO_GRUPO_ECDS_ID, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, DATA, PRESTADOR_ID, GRUPO_ECDS_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, DATA, PRESTADOR_ID, GRUPO_ECDS_ID, }; + + private Integer id; + private java.util.Date data; + private Integer prestador_id; + private siprp.data.outer.PrestadoresData to_prestador_id; + private Integer grupo_ecds_id; + private siprp.data.outer.PrtGruposProtocoloData to_grupo_ecds_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public TrabalhadoresEcdsAnalise() + { + super(); + dirtyProperties = new boolean[]{ false, false, false + , false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.Date getData() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data; + } + + public void setData( java.util.Date data ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA, data ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data = data; + LAZY_LOADED_OBJECTS.put( DATA, Boolean.TRUE ); + } + + public Integer getPrestador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PRESTADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.prestador_id; + } + + public void setPrestador_id( Integer prestador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( PRESTADOR_ID, prestador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.prestador_id = prestador_id; + LAZY_LOADED_OBJECTS.put( PRESTADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrestadoresData toPrestador_id() + { + try + { + prepare( TO_PRESTADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_prestador_id; + } + + public void setToPrestador_id( siprp.data.outer.PrestadoresData to_prestador_id ) + { + try + { + preProcess( TO_PRESTADOR_ID, to_prestador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_prestador_id = to_prestador_id; + } + + public Integer getGrupo_ecds_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( GRUPO_ECDS_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.grupo_ecds_id; + } + + public void setGrupo_ecds_id( Integer grupo_ecds_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( GRUPO_ECDS_ID, grupo_ecds_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.grupo_ecds_id = grupo_ecds_id; + LAZY_LOADED_OBJECTS.put( GRUPO_ECDS_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrtGruposProtocoloData toGrupo_ecds_id() + { + try + { + prepare( TO_GRUPO_ECDS_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_grupo_ecds_id; + } + + public void setToGrupo_ecds_id( siprp.data.outer.PrtGruposProtocoloData to_grupo_ecds_id ) + { + try + { + preProcess( TO_GRUPO_ECDS_ID, to_grupo_ecds_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_grupo_ecds_id = to_grupo_ecds_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcdsAnalise.ID_INDEX: + value = getId(); + break; + case TrabalhadoresEcdsAnalise.DATA_INDEX: + value = getData(); + break; + case TrabalhadoresEcdsAnalise.PRESTADOR_ID_INDEX: + value = getPrestador_id(); + break; + case TrabalhadoresEcdsAnalise.TO_PRESTADOR_ID_INDEX: + value = toPrestador_id(); + break; + case TrabalhadoresEcdsAnalise.GRUPO_ECDS_ID_INDEX: + value = getGrupo_ecds_id(); + break; + case TrabalhadoresEcdsAnalise.TO_GRUPO_ECDS_ID_INDEX: + value = toGrupo_ecds_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcdsAnalise.ID_INDEX: + value = this.id; + break; + case TrabalhadoresEcdsAnalise.DATA_INDEX: + value = this.data; + break; + case TrabalhadoresEcdsAnalise.PRESTADOR_ID_INDEX: + value = this.prestador_id; + break; + case TrabalhadoresEcdsAnalise.TO_PRESTADOR_ID_INDEX: + value = this.to_prestador_id; + break; + case TrabalhadoresEcdsAnalise.GRUPO_ECDS_ID_INDEX: + value = this.grupo_ecds_id; + break; + case TrabalhadoresEcdsAnalise.TO_GRUPO_ECDS_ID_INDEX: + value = this.to_grupo_ecds_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcdsAnalise.ID_INDEX: + setId( ( Integer ) value ); + break; + case TrabalhadoresEcdsAnalise.DATA_INDEX: + setData( ( java.util.Date ) value ); + break; + case TrabalhadoresEcdsAnalise.PRESTADOR_ID_INDEX: + setPrestador_id( ( Integer ) value ); + break; + case TrabalhadoresEcdsAnalise.TO_PRESTADOR_ID_INDEX: + setToPrestador_id( ( siprp.data.outer.PrestadoresData ) value ); + break; + case TrabalhadoresEcdsAnalise.GRUPO_ECDS_ID_INDEX: + setGrupo_ecds_id( ( Integer ) value ); + break; + case TrabalhadoresEcdsAnalise.TO_GRUPO_ECDS_ID_INDEX: + setToGrupo_ecds_id( ( siprp.data.outer.PrtGruposProtocoloData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcdsAnalise.ID_INDEX: + this.id = ( Integer ) value; + break; + case TrabalhadoresEcdsAnalise.DATA_INDEX: + this.data = ( java.util.Date ) value; + break; + case TrabalhadoresEcdsAnalise.PRESTADOR_ID_INDEX: + this.prestador_id = ( Integer ) value; + break; + case TrabalhadoresEcdsAnalise.TO_PRESTADOR_ID_INDEX: + this.to_prestador_id = ( siprp.data.outer.PrestadoresData ) value; + break; + case TrabalhadoresEcdsAnalise.GRUPO_ECDS_ID_INDEX: + this.grupo_ecds_id = ( Integer ) value; + break; + case TrabalhadoresEcdsAnalise.TO_GRUPO_ECDS_ID_INDEX: + this.to_grupo_ecds_id = ( siprp.data.outer.PrtGruposProtocoloData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case TrabalhadoresEcdsAnalise.ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcdsAnalise.DATA_INDEX: + theClass = java.util.Date.class; + break; + case TrabalhadoresEcdsAnalise.PRESTADOR_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcdsAnalise.TO_PRESTADOR_ID_INDEX: + theClass = siprp.data.outer.PrestadoresData.class; + break; + case TrabalhadoresEcdsAnalise.GRUPO_ECDS_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcdsAnalise.TO_GRUPO_ECDS_ID_INDEX: + theClass = siprp.data.outer.PrtGruposProtocoloData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : TrabalhadoresEcdsAnalise._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, TrabalhadoresEcdsAnalise.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcdsDatas.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcdsDatas.java new file mode 100644 index 00000000..6d2e725b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcdsDatas.java @@ -0,0 +1,788 @@ +/* +* TrabalhadoresEcdsDatas.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class TrabalhadoresEcdsDatas extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.ID, TrabalhadoresEcdsDatas.ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.ID_FULL, TrabalhadoresEcdsDatas.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresEcdsDatas.CLASS_IDENTIFIER, TrabalhadoresEcdsDatas.TRABALHADORES_ECDS_ID, TrabalhadoresEcdsDatas.TO_TRABALHADORES_ECDS_ID ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.TRABALHADORES_ECDS_ID, TrabalhadoresEcdsDatas.TRABALHADORES_ECDS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.TRABALHADORES_ECDS_ID_FULL, TrabalhadoresEcdsDatas.TRABALHADORES_ECDS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.TO_TRABALHADORES_ECDS_ID, TrabalhadoresEcdsDatas.TO_TRABALHADORES_ECDS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.DATA, TrabalhadoresEcdsDatas.DATA_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.DATA_FULL, TrabalhadoresEcdsDatas.DATA_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.ESTADO, TrabalhadoresEcdsDatas.ESTADO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.ESTADO_FULL, TrabalhadoresEcdsDatas.ESTADO_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresEcdsDatas.CLASS_IDENTIFIER, TrabalhadoresEcdsDatas.PRESTADOR_ID, TrabalhadoresEcdsDatas.TO_PRESTADOR_ID ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.PRESTADOR_ID, TrabalhadoresEcdsDatas.PRESTADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.PRESTADOR_ID_FULL, TrabalhadoresEcdsDatas.PRESTADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.TO_PRESTADOR_ID, TrabalhadoresEcdsDatas.TO_PRESTADOR_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresEcdsDatas.CLASS_IDENTIFIER, TrabalhadoresEcdsDatas.ANALISADOR_ID, TrabalhadoresEcdsDatas.TO_ANALISADOR_ID ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.ANALISADOR_ID, TrabalhadoresEcdsDatas.ANALISADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.ANALISADOR_ID_FULL, TrabalhadoresEcdsDatas.ANALISADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.TO_ANALISADOR_ID, TrabalhadoresEcdsDatas.TO_ANALISADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.DATA_ENVIO, TrabalhadoresEcdsDatas.DATA_ENVIO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.DATA_ENVIO_FULL, TrabalhadoresEcdsDatas.DATA_ENVIO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.DATA_RECEPCAO, TrabalhadoresEcdsDatas.DATA_RECEPCAO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatas.DATA_RECEPCAO_FULL, TrabalhadoresEcdsDatas.DATA_RECEPCAO_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeytrabalhadores_ecds_idTotrabalhadores_ecds = + new com.evolute.entity.ForeignKey( TrabalhadoresEcdsDatas.class, TrabalhadoresEcdsDatas.TRABALHADORES_ECDS_ID, siprp.data.outer.TrabalhadoresEcdsData.class, siprp.data.outer.TrabalhadoresEcdsData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyprestador_idToprestadores = + new com.evolute.entity.ForeignKey( TrabalhadoresEcdsDatas.class, TrabalhadoresEcdsDatas.PRESTADOR_ID, siprp.data.outer.PrestadoresData.class, siprp.data.outer.PrestadoresData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyanalisador_idToprestadores = + new com.evolute.entity.ForeignKey( TrabalhadoresEcdsDatas.class, TrabalhadoresEcdsDatas.ANALISADOR_ID, siprp.data.outer.PrestadoresData.class, siprp.data.outer.PrestadoresData.ID ); + + public static final String TABLENAME = "trabalhadores_ecds_datas"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.trabalhadores_ecds_datas"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_ecds_datas.id"; + public static final int ID_INDEX = 0; + public static final String TRABALHADORES_ECDS_ID = "trabalhadores_ecds_id"; + public static final String TRABALHADORES_ECDS_ID_FULL = "trabalhadores_ecds_datas.trabalhadores_ecds_id"; + public static final int TRABALHADORES_ECDS_ID_INDEX = 1; + public static final String TO_TRABALHADORES_ECDS_ID = "to_trabalhadores_ecds_id"; + public static final int TO_TRABALHADORES_ECDS_ID_INDEX = 2; + public static final String DATA = "data"; + public static final String DATA_FULL = "trabalhadores_ecds_datas.data"; + public static final int DATA_INDEX = 3; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "trabalhadores_ecds_datas.estado"; + public static final int ESTADO_INDEX = 4; + public static final String PRESTADOR_ID = "prestador_id"; + public static final String PRESTADOR_ID_FULL = "trabalhadores_ecds_datas.prestador_id"; + public static final int PRESTADOR_ID_INDEX = 5; + public static final String TO_PRESTADOR_ID = "to_prestador_id"; + public static final int TO_PRESTADOR_ID_INDEX = 6; + public static final String ANALISADOR_ID = "analisador_id"; + public static final String ANALISADOR_ID_FULL = "trabalhadores_ecds_datas.analisador_id"; + public static final int ANALISADOR_ID_INDEX = 7; + public static final String TO_ANALISADOR_ID = "to_analisador_id"; + public static final int TO_ANALISADOR_ID_INDEX = 8; + public static final String DATA_ENVIO = "data_envio"; + public static final String DATA_ENVIO_FULL = "trabalhadores_ecds_datas.data_envio"; + public static final int DATA_ENVIO_INDEX = 9; + public static final String DATA_RECEPCAO = "data_recepcao"; + public static final String DATA_RECEPCAO_FULL = "trabalhadores_ecds_datas.data_recepcao"; + public static final int DATA_RECEPCAO_INDEX = 10; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADORES_ECDS_ID, TO_TRABALHADORES_ECDS_ID, DATA, ESTADO, PRESTADOR_ID, + TO_PRESTADOR_ID, ANALISADOR_ID, TO_ANALISADOR_ID, DATA_ENVIO, DATA_RECEPCAO, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + TRABALHADORES_ECDS_ID, TABLENAME + "." + TO_TRABALHADORES_ECDS_ID, TABLENAME + "." + DATA, TABLENAME + "." + ESTADO, TABLENAME + "." + PRESTADOR_ID, + TABLENAME + "." + TO_PRESTADOR_ID, TABLENAME + "." + ANALISADOR_ID, TABLENAME + "." + TO_ANALISADOR_ID, TABLENAME + "." + DATA_ENVIO, TABLENAME + "." + DATA_RECEPCAO, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, TRABALHADORES_ECDS_ID, DATA, ESTADO, PRESTADOR_ID, ANALISADOR_ID, DATA_ENVIO, + DATA_RECEPCAO, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, TRABALHADORES_ECDS_ID, DATA, ESTADO, PRESTADOR_ID, ANALISADOR_ID, DATA_ENVIO, + DATA_RECEPCAO, }; + + private Integer id; + private Integer trabalhadores_ecds_id; + private siprp.data.outer.TrabalhadoresEcdsData to_trabalhadores_ecds_id; + private java.util.Date data; + private Integer estado; + private Integer prestador_id; + private siprp.data.outer.PrestadoresData to_prestador_id; + private Integer analisador_id; + private siprp.data.outer.PrestadoresData to_analisador_id; + private java.util.Date data_envio; + private java.util.Date data_recepcao; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public TrabalhadoresEcdsDatas() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromLembretes_trabalhadores_ecds_datas_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.LembretesData.class , getPrimaryKey().getMap().get("id"), "trabalhadores_ecds_datas_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresEcd_trabalhadores_ecds_datas_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresEcdData.class , getPrimaryKey().getMap().get("id"), "trabalhadores_ecds_datas_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresEcdsDatasEmails_trabalhadores_ecds_datas_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresEcdsDatasEmailsData.class , getPrimaryKey().getMap().get("id"), "trabalhadores_ecds_datas_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresEcdsDatasObservacoes_trabalhadores_ecds_datas_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresEcdsDatasObservacoesData.class , getPrimaryKey().getMap().get("id"), "trabalhadores_ecds_datas_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public Integer getTrabalhadores_ecds_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TRABALHADORES_ECDS_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.trabalhadores_ecds_id; + } + + public void setTrabalhadores_ecds_id( Integer trabalhadores_ecds_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TRABALHADORES_ECDS_ID, trabalhadores_ecds_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.trabalhadores_ecds_id = trabalhadores_ecds_id; + LAZY_LOADED_OBJECTS.put( TRABALHADORES_ECDS_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresEcdsData toTrabalhadores_ecds_id() + { + try + { + prepare( TO_TRABALHADORES_ECDS_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_trabalhadores_ecds_id; + } + + public void setToTrabalhadores_ecds_id( siprp.data.outer.TrabalhadoresEcdsData to_trabalhadores_ecds_id ) + { + try + { + preProcess( TO_TRABALHADORES_ECDS_ID, to_trabalhadores_ecds_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_trabalhadores_ecds_id = to_trabalhadores_ecds_id; + } + + public java.util.Date getData() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data; + } + + public void setData( java.util.Date data ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA, data ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data = data; + LAZY_LOADED_OBJECTS.put( DATA, Boolean.TRUE ); + } + + public Integer getEstado() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTADO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estado; + } + + public void setEstado( Integer estado ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTADO, estado ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estado = estado; + LAZY_LOADED_OBJECTS.put( ESTADO, Boolean.TRUE ); + } + + public Integer getPrestador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PRESTADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.prestador_id; + } + + public void setPrestador_id( Integer prestador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( PRESTADOR_ID, prestador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.prestador_id = prestador_id; + LAZY_LOADED_OBJECTS.put( PRESTADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrestadoresData toPrestador_id() + { + try + { + prepare( TO_PRESTADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_prestador_id; + } + + public void setToPrestador_id( siprp.data.outer.PrestadoresData to_prestador_id ) + { + try + { + preProcess( TO_PRESTADOR_ID, to_prestador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_prestador_id = to_prestador_id; + } + + public Integer getAnalisador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ANALISADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.analisador_id; + } + + public void setAnalisador_id( Integer analisador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ANALISADOR_ID, analisador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.analisador_id = analisador_id; + LAZY_LOADED_OBJECTS.put( ANALISADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.PrestadoresData toAnalisador_id() + { + try + { + prepare( TO_ANALISADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_analisador_id; + } + + public void setToAnalisador_id( siprp.data.outer.PrestadoresData to_analisador_id ) + { + try + { + preProcess( TO_ANALISADOR_ID, to_analisador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_analisador_id = to_analisador_id; + } + + public java.util.Date getData_envio() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_ENVIO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_envio; + } + + public void setData_envio( java.util.Date data_envio ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_ENVIO, data_envio ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_envio = data_envio; + LAZY_LOADED_OBJECTS.put( DATA_ENVIO, Boolean.TRUE ); + } + + public java.util.Date getData_recepcao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_RECEPCAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_recepcao; + } + + public void setData_recepcao( java.util.Date data_recepcao ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_RECEPCAO, data_recepcao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_recepcao = data_recepcao; + LAZY_LOADED_OBJECTS.put( DATA_RECEPCAO, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcdsDatas.ID_INDEX: + value = getId(); + break; + case TrabalhadoresEcdsDatas.TRABALHADORES_ECDS_ID_INDEX: + value = getTrabalhadores_ecds_id(); + break; + case TrabalhadoresEcdsDatas.TO_TRABALHADORES_ECDS_ID_INDEX: + value = toTrabalhadores_ecds_id(); + break; + case TrabalhadoresEcdsDatas.DATA_INDEX: + value = getData(); + break; + case TrabalhadoresEcdsDatas.ESTADO_INDEX: + value = getEstado(); + break; + case TrabalhadoresEcdsDatas.PRESTADOR_ID_INDEX: + value = getPrestador_id(); + break; + case TrabalhadoresEcdsDatas.TO_PRESTADOR_ID_INDEX: + value = toPrestador_id(); + break; + case TrabalhadoresEcdsDatas.ANALISADOR_ID_INDEX: + value = getAnalisador_id(); + break; + case TrabalhadoresEcdsDatas.TO_ANALISADOR_ID_INDEX: + value = toAnalisador_id(); + break; + case TrabalhadoresEcdsDatas.DATA_ENVIO_INDEX: + value = getData_envio(); + break; + case TrabalhadoresEcdsDatas.DATA_RECEPCAO_INDEX: + value = getData_recepcao(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcdsDatas.ID_INDEX: + value = this.id; + break; + case TrabalhadoresEcdsDatas.TRABALHADORES_ECDS_ID_INDEX: + value = this.trabalhadores_ecds_id; + break; + case TrabalhadoresEcdsDatas.TO_TRABALHADORES_ECDS_ID_INDEX: + value = this.to_trabalhadores_ecds_id; + break; + case TrabalhadoresEcdsDatas.DATA_INDEX: + value = this.data; + break; + case TrabalhadoresEcdsDatas.ESTADO_INDEX: + value = this.estado; + break; + case TrabalhadoresEcdsDatas.PRESTADOR_ID_INDEX: + value = this.prestador_id; + break; + case TrabalhadoresEcdsDatas.TO_PRESTADOR_ID_INDEX: + value = this.to_prestador_id; + break; + case TrabalhadoresEcdsDatas.ANALISADOR_ID_INDEX: + value = this.analisador_id; + break; + case TrabalhadoresEcdsDatas.TO_ANALISADOR_ID_INDEX: + value = this.to_analisador_id; + break; + case TrabalhadoresEcdsDatas.DATA_ENVIO_INDEX: + value = this.data_envio; + break; + case TrabalhadoresEcdsDatas.DATA_RECEPCAO_INDEX: + value = this.data_recepcao; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcdsDatas.ID_INDEX: + setId( ( Integer ) value ); + break; + case TrabalhadoresEcdsDatas.TRABALHADORES_ECDS_ID_INDEX: + setTrabalhadores_ecds_id( ( Integer ) value ); + break; + case TrabalhadoresEcdsDatas.TO_TRABALHADORES_ECDS_ID_INDEX: + setToTrabalhadores_ecds_id( ( siprp.data.outer.TrabalhadoresEcdsData ) value ); + break; + case TrabalhadoresEcdsDatas.DATA_INDEX: + setData( ( java.util.Date ) value ); + break; + case TrabalhadoresEcdsDatas.ESTADO_INDEX: + setEstado( ( Integer ) value ); + break; + case TrabalhadoresEcdsDatas.PRESTADOR_ID_INDEX: + setPrestador_id( ( Integer ) value ); + break; + case TrabalhadoresEcdsDatas.TO_PRESTADOR_ID_INDEX: + setToPrestador_id( ( siprp.data.outer.PrestadoresData ) value ); + break; + case TrabalhadoresEcdsDatas.ANALISADOR_ID_INDEX: + setAnalisador_id( ( Integer ) value ); + break; + case TrabalhadoresEcdsDatas.TO_ANALISADOR_ID_INDEX: + setToAnalisador_id( ( siprp.data.outer.PrestadoresData ) value ); + break; + case TrabalhadoresEcdsDatas.DATA_ENVIO_INDEX: + setData_envio( ( java.util.Date ) value ); + break; + case TrabalhadoresEcdsDatas.DATA_RECEPCAO_INDEX: + setData_recepcao( ( java.util.Date ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcdsDatas.ID_INDEX: + this.id = ( Integer ) value; + break; + case TrabalhadoresEcdsDatas.TRABALHADORES_ECDS_ID_INDEX: + this.trabalhadores_ecds_id = ( Integer ) value; + break; + case TrabalhadoresEcdsDatas.TO_TRABALHADORES_ECDS_ID_INDEX: + this.to_trabalhadores_ecds_id = ( siprp.data.outer.TrabalhadoresEcdsData ) value; + break; + case TrabalhadoresEcdsDatas.DATA_INDEX: + this.data = ( java.util.Date ) value; + break; + case TrabalhadoresEcdsDatas.ESTADO_INDEX: + this.estado = ( Integer ) value; + break; + case TrabalhadoresEcdsDatas.PRESTADOR_ID_INDEX: + this.prestador_id = ( Integer ) value; + break; + case TrabalhadoresEcdsDatas.TO_PRESTADOR_ID_INDEX: + this.to_prestador_id = ( siprp.data.outer.PrestadoresData ) value; + break; + case TrabalhadoresEcdsDatas.ANALISADOR_ID_INDEX: + this.analisador_id = ( Integer ) value; + break; + case TrabalhadoresEcdsDatas.TO_ANALISADOR_ID_INDEX: + this.to_analisador_id = ( siprp.data.outer.PrestadoresData ) value; + break; + case TrabalhadoresEcdsDatas.DATA_ENVIO_INDEX: + this.data_envio = ( java.util.Date ) value; + break; + case TrabalhadoresEcdsDatas.DATA_RECEPCAO_INDEX: + this.data_recepcao = ( java.util.Date ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case TrabalhadoresEcdsDatas.ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcdsDatas.TRABALHADORES_ECDS_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcdsDatas.TO_TRABALHADORES_ECDS_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresEcdsData.class; + break; + case TrabalhadoresEcdsDatas.DATA_INDEX: + theClass = java.util.Date.class; + break; + case TrabalhadoresEcdsDatas.ESTADO_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcdsDatas.PRESTADOR_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcdsDatas.TO_PRESTADOR_ID_INDEX: + theClass = siprp.data.outer.PrestadoresData.class; + break; + case TrabalhadoresEcdsDatas.ANALISADOR_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcdsDatas.TO_ANALISADOR_ID_INDEX: + theClass = siprp.data.outer.PrestadoresData.class; + break; + case TrabalhadoresEcdsDatas.DATA_ENVIO_INDEX: + theClass = java.util.Date.class; + break; + case TrabalhadoresEcdsDatas.DATA_RECEPCAO_INDEX: + theClass = java.util.Date.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : TrabalhadoresEcdsDatas._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, TrabalhadoresEcdsDatas.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcdsDatasEmails.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcdsDatasEmails.java new file mode 100644 index 00000000..175af8d5 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcdsDatasEmails.java @@ -0,0 +1,532 @@ +/* +* TrabalhadoresEcdsDatasEmails.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class TrabalhadoresEcdsDatasEmails extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( TrabalhadoresEcdsDatasEmails.ID, TrabalhadoresEcdsDatasEmails.ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasEmails.ID_FULL, TrabalhadoresEcdsDatasEmails.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresEcdsDatasEmails.CLASS_IDENTIFIER, TrabalhadoresEcdsDatasEmails.TRABALHADORES_ECDS_DATAS_ID, TrabalhadoresEcdsDatasEmails.TO_TRABALHADORES_ECDS_DATAS_ID ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasEmails.TRABALHADORES_ECDS_DATAS_ID, TrabalhadoresEcdsDatasEmails.TRABALHADORES_ECDS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasEmails.TRABALHADORES_ECDS_DATAS_ID_FULL, TrabalhadoresEcdsDatasEmails.TRABALHADORES_ECDS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasEmails.TO_TRABALHADORES_ECDS_DATAS_ID, TrabalhadoresEcdsDatasEmails.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasEmails.DESTINATION, TrabalhadoresEcdsDatasEmails.DESTINATION_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasEmails.DESTINATION_FULL, TrabalhadoresEcdsDatasEmails.DESTINATION_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasEmails.DATA, TrabalhadoresEcdsDatasEmails.DATA_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasEmails.DATA_FULL, TrabalhadoresEcdsDatasEmails.DATA_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasEmails.SUBJECT, TrabalhadoresEcdsDatasEmails.SUBJECT_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasEmails.SUBJECT_FULL, TrabalhadoresEcdsDatasEmails.SUBJECT_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasEmails.BODY, TrabalhadoresEcdsDatasEmails.BODY_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasEmails.BODY_FULL, TrabalhadoresEcdsDatasEmails.BODY_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeytrabalhadores_ecds_datas_idTotrabalhadores_ecds_datas = + new com.evolute.entity.ForeignKey( TrabalhadoresEcdsDatasEmails.class, TrabalhadoresEcdsDatasEmails.TRABALHADORES_ECDS_DATAS_ID, siprp.data.outer.TrabalhadoresEcdsDatasData.class, siprp.data.outer.TrabalhadoresEcdsDatasData.ID ); + + public static final String TABLENAME = "trabalhadores_ecds_datas_emails"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.trabalhadores_ecds_datas_emails"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_ecds_datas_emails.id"; + public static final int ID_INDEX = 0; + public static final String TRABALHADORES_ECDS_DATAS_ID = "trabalhadores_ecds_datas_id"; + public static final String TRABALHADORES_ECDS_DATAS_ID_FULL = "trabalhadores_ecds_datas_emails.trabalhadores_ecds_datas_id"; + public static final int TRABALHADORES_ECDS_DATAS_ID_INDEX = 1; + public static final String TO_TRABALHADORES_ECDS_DATAS_ID = "to_trabalhadores_ecds_datas_id"; + public static final int TO_TRABALHADORES_ECDS_DATAS_ID_INDEX = 2; + public static final String DESTINATION = "destination"; + public static final String DESTINATION_FULL = "trabalhadores_ecds_datas_emails.destination"; + public static final int DESTINATION_INDEX = 3; + public static final String DATA = "data"; + public static final String DATA_FULL = "trabalhadores_ecds_datas_emails.data"; + public static final int DATA_INDEX = 4; + public static final String SUBJECT = "subject"; + public static final String SUBJECT_FULL = "trabalhadores_ecds_datas_emails.subject"; + public static final int SUBJECT_INDEX = 5; + public static final String BODY = "body"; + public static final String BODY_FULL = "trabalhadores_ecds_datas_emails.body"; + public static final int BODY_INDEX = 6; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADORES_ECDS_DATAS_ID, TO_TRABALHADORES_ECDS_DATAS_ID, DESTINATION, + DATA, SUBJECT, BODY, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + TRABALHADORES_ECDS_DATAS_ID, TABLENAME + "." + TO_TRABALHADORES_ECDS_DATAS_ID, TABLENAME + "." + DESTINATION, + TABLENAME + "." + DATA, TABLENAME + "." + SUBJECT, TABLENAME + "." + BODY, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, TRABALHADORES_ECDS_DATAS_ID, DESTINATION, DATA, SUBJECT, BODY, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, TRABALHADORES_ECDS_DATAS_ID, DESTINATION, DATA, SUBJECT, BODY, }; + + private Integer id; + private Integer trabalhadores_ecds_datas_id; + private siprp.data.outer.TrabalhadoresEcdsDatasData to_trabalhadores_ecds_datas_id; + private String destination; + private java.util.Date data; + private String subject; + private String body; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public TrabalhadoresEcdsDatasEmails() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public Integer getTrabalhadores_ecds_datas_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TRABALHADORES_ECDS_DATAS_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.trabalhadores_ecds_datas_id; + } + + public void setTrabalhadores_ecds_datas_id( Integer trabalhadores_ecds_datas_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TRABALHADORES_ECDS_DATAS_ID, trabalhadores_ecds_datas_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.trabalhadores_ecds_datas_id = trabalhadores_ecds_datas_id; + LAZY_LOADED_OBJECTS.put( TRABALHADORES_ECDS_DATAS_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresEcdsDatasData toTrabalhadores_ecds_datas_id() + { + try + { + prepare( TO_TRABALHADORES_ECDS_DATAS_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_trabalhadores_ecds_datas_id; + } + + public void setToTrabalhadores_ecds_datas_id( siprp.data.outer.TrabalhadoresEcdsDatasData to_trabalhadores_ecds_datas_id ) + { + try + { + preProcess( TO_TRABALHADORES_ECDS_DATAS_ID, to_trabalhadores_ecds_datas_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_trabalhadores_ecds_datas_id = to_trabalhadores_ecds_datas_id; + } + + public String getDestination() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DESTINATION ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.destination; + } + + public void setDestination( String destination ) + { + try + { + setLockedForRefresh( true ); + preProcess( DESTINATION, destination ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.destination = destination; + LAZY_LOADED_OBJECTS.put( DESTINATION, Boolean.TRUE ); + } + + public java.util.Date getData() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data; + } + + public void setData( java.util.Date data ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA, data ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data = data; + LAZY_LOADED_OBJECTS.put( DATA, Boolean.TRUE ); + } + + public String getSubject() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( SUBJECT ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.subject; + } + + public void setSubject( String subject ) + { + try + { + setLockedForRefresh( true ); + preProcess( SUBJECT, subject ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.subject = subject; + LAZY_LOADED_OBJECTS.put( SUBJECT, Boolean.TRUE ); + } + + public String getBody() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( BODY ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.body; + } + + public void setBody( String body ) + { + try + { + setLockedForRefresh( true ); + preProcess( BODY, body ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.body = body; + LAZY_LOADED_OBJECTS.put( BODY, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcdsDatasEmails.ID_INDEX: + value = getId(); + break; + case TrabalhadoresEcdsDatasEmails.TRABALHADORES_ECDS_DATAS_ID_INDEX: + value = getTrabalhadores_ecds_datas_id(); + break; + case TrabalhadoresEcdsDatasEmails.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + value = toTrabalhadores_ecds_datas_id(); + break; + case TrabalhadoresEcdsDatasEmails.DESTINATION_INDEX: + value = getDestination(); + break; + case TrabalhadoresEcdsDatasEmails.DATA_INDEX: + value = getData(); + break; + case TrabalhadoresEcdsDatasEmails.SUBJECT_INDEX: + value = getSubject(); + break; + case TrabalhadoresEcdsDatasEmails.BODY_INDEX: + value = getBody(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcdsDatasEmails.ID_INDEX: + value = this.id; + break; + case TrabalhadoresEcdsDatasEmails.TRABALHADORES_ECDS_DATAS_ID_INDEX: + value = this.trabalhadores_ecds_datas_id; + break; + case TrabalhadoresEcdsDatasEmails.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + value = this.to_trabalhadores_ecds_datas_id; + break; + case TrabalhadoresEcdsDatasEmails.DESTINATION_INDEX: + value = this.destination; + break; + case TrabalhadoresEcdsDatasEmails.DATA_INDEX: + value = this.data; + break; + case TrabalhadoresEcdsDatasEmails.SUBJECT_INDEX: + value = this.subject; + break; + case TrabalhadoresEcdsDatasEmails.BODY_INDEX: + value = this.body; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcdsDatasEmails.ID_INDEX: + setId( ( Integer ) value ); + break; + case TrabalhadoresEcdsDatasEmails.TRABALHADORES_ECDS_DATAS_ID_INDEX: + setTrabalhadores_ecds_datas_id( ( Integer ) value ); + break; + case TrabalhadoresEcdsDatasEmails.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + setToTrabalhadores_ecds_datas_id( ( siprp.data.outer.TrabalhadoresEcdsDatasData ) value ); + break; + case TrabalhadoresEcdsDatasEmails.DESTINATION_INDEX: + setDestination( ( String ) value ); + break; + case TrabalhadoresEcdsDatasEmails.DATA_INDEX: + setData( ( java.util.Date ) value ); + break; + case TrabalhadoresEcdsDatasEmails.SUBJECT_INDEX: + setSubject( ( String ) value ); + break; + case TrabalhadoresEcdsDatasEmails.BODY_INDEX: + setBody( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcdsDatasEmails.ID_INDEX: + this.id = ( Integer ) value; + break; + case TrabalhadoresEcdsDatasEmails.TRABALHADORES_ECDS_DATAS_ID_INDEX: + this.trabalhadores_ecds_datas_id = ( Integer ) value; + break; + case TrabalhadoresEcdsDatasEmails.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + this.to_trabalhadores_ecds_datas_id = ( siprp.data.outer.TrabalhadoresEcdsDatasData ) value; + break; + case TrabalhadoresEcdsDatasEmails.DESTINATION_INDEX: + this.destination = ( String ) value; + break; + case TrabalhadoresEcdsDatasEmails.DATA_INDEX: + this.data = ( java.util.Date ) value; + break; + case TrabalhadoresEcdsDatasEmails.SUBJECT_INDEX: + this.subject = ( String ) value; + break; + case TrabalhadoresEcdsDatasEmails.BODY_INDEX: + this.body = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case TrabalhadoresEcdsDatasEmails.ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcdsDatasEmails.TRABALHADORES_ECDS_DATAS_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcdsDatasEmails.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresEcdsDatasData.class; + break; + case TrabalhadoresEcdsDatasEmails.DESTINATION_INDEX: + theClass = String.class; + break; + case TrabalhadoresEcdsDatasEmails.DATA_INDEX: + theClass = java.util.Date.class; + break; + case TrabalhadoresEcdsDatasEmails.SUBJECT_INDEX: + theClass = String.class; + break; + case TrabalhadoresEcdsDatasEmails.BODY_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : TrabalhadoresEcdsDatasEmails._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, TrabalhadoresEcdsDatasEmails.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcdsDatasObservacoes.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcdsDatasObservacoes.java new file mode 100644 index 00000000..588ea073 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresEcdsDatasObservacoes.java @@ -0,0 +1,380 @@ +/* +* TrabalhadoresEcdsDatasObservacoes.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class TrabalhadoresEcdsDatasObservacoes extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( TrabalhadoresEcdsDatasObservacoes.ID, TrabalhadoresEcdsDatasObservacoes.ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasObservacoes.ID_FULL, TrabalhadoresEcdsDatasObservacoes.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresEcdsDatasObservacoes.CLASS_IDENTIFIER, TrabalhadoresEcdsDatasObservacoes.TRABALHADORES_ECDS_DATAS_ID, TrabalhadoresEcdsDatasObservacoes.TO_TRABALHADORES_ECDS_DATAS_ID ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasObservacoes.TRABALHADORES_ECDS_DATAS_ID, TrabalhadoresEcdsDatasObservacoes.TRABALHADORES_ECDS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasObservacoes.TRABALHADORES_ECDS_DATAS_ID_FULL, TrabalhadoresEcdsDatasObservacoes.TRABALHADORES_ECDS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasObservacoes.TO_TRABALHADORES_ECDS_DATAS_ID, TrabalhadoresEcdsDatasObservacoes.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasObservacoes.OBSERVACAO, TrabalhadoresEcdsDatasObservacoes.OBSERVACAO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresEcdsDatasObservacoes.OBSERVACAO_FULL, TrabalhadoresEcdsDatasObservacoes.OBSERVACAO_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeytrabalhadores_ecds_datas_idTotrabalhadores_ecds_datas = + new com.evolute.entity.ForeignKey( TrabalhadoresEcdsDatasObservacoes.class, TrabalhadoresEcdsDatasObservacoes.TRABALHADORES_ECDS_DATAS_ID, siprp.data.outer.TrabalhadoresEcdsDatasData.class, siprp.data.outer.TrabalhadoresEcdsDatasData.ID ); + + public static final String TABLENAME = "trabalhadores_ecds_datas_observacoes"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.trabalhadores_ecds_datas_observacoes"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_ecds_datas_observacoes.id"; + public static final int ID_INDEX = 0; + public static final String TRABALHADORES_ECDS_DATAS_ID = "trabalhadores_ecds_datas_id"; + public static final String TRABALHADORES_ECDS_DATAS_ID_FULL = "trabalhadores_ecds_datas_observacoes.trabalhadores_ecds_datas_id"; + public static final int TRABALHADORES_ECDS_DATAS_ID_INDEX = 1; + public static final String TO_TRABALHADORES_ECDS_DATAS_ID = "to_trabalhadores_ecds_datas_id"; + public static final int TO_TRABALHADORES_ECDS_DATAS_ID_INDEX = 2; + public static final String OBSERVACAO = "observacao"; + public static final String OBSERVACAO_FULL = "trabalhadores_ecds_datas_observacoes.observacao"; + public static final int OBSERVACAO_INDEX = 3; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADORES_ECDS_DATAS_ID, TO_TRABALHADORES_ECDS_DATAS_ID, OBSERVACAO, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + TRABALHADORES_ECDS_DATAS_ID, TABLENAME + "." + TO_TRABALHADORES_ECDS_DATAS_ID, TABLENAME + "." + OBSERVACAO, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, TRABALHADORES_ECDS_DATAS_ID, OBSERVACAO, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, TRABALHADORES_ECDS_DATAS_ID, OBSERVACAO, }; + + private Integer id; + private Integer trabalhadores_ecds_datas_id; + private siprp.data.outer.TrabalhadoresEcdsDatasData to_trabalhadores_ecds_datas_id; + private String observacao; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public TrabalhadoresEcdsDatasObservacoes() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public Integer getTrabalhadores_ecds_datas_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TRABALHADORES_ECDS_DATAS_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.trabalhadores_ecds_datas_id; + } + + public void setTrabalhadores_ecds_datas_id( Integer trabalhadores_ecds_datas_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TRABALHADORES_ECDS_DATAS_ID, trabalhadores_ecds_datas_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.trabalhadores_ecds_datas_id = trabalhadores_ecds_datas_id; + LAZY_LOADED_OBJECTS.put( TRABALHADORES_ECDS_DATAS_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresEcdsDatasData toTrabalhadores_ecds_datas_id() + { + try + { + prepare( TO_TRABALHADORES_ECDS_DATAS_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_trabalhadores_ecds_datas_id; + } + + public void setToTrabalhadores_ecds_datas_id( siprp.data.outer.TrabalhadoresEcdsDatasData to_trabalhadores_ecds_datas_id ) + { + try + { + preProcess( TO_TRABALHADORES_ECDS_DATAS_ID, to_trabalhadores_ecds_datas_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_trabalhadores_ecds_datas_id = to_trabalhadores_ecds_datas_id; + } + + public String getObservacao() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( OBSERVACAO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.observacao; + } + + public void setObservacao( String observacao ) + { + try + { + setLockedForRefresh( true ); + preProcess( OBSERVACAO, observacao ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.observacao = observacao; + LAZY_LOADED_OBJECTS.put( OBSERVACAO, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcdsDatasObservacoes.ID_INDEX: + value = getId(); + break; + case TrabalhadoresEcdsDatasObservacoes.TRABALHADORES_ECDS_DATAS_ID_INDEX: + value = getTrabalhadores_ecds_datas_id(); + break; + case TrabalhadoresEcdsDatasObservacoes.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + value = toTrabalhadores_ecds_datas_id(); + break; + case TrabalhadoresEcdsDatasObservacoes.OBSERVACAO_INDEX: + value = getObservacao(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcdsDatasObservacoes.ID_INDEX: + value = this.id; + break; + case TrabalhadoresEcdsDatasObservacoes.TRABALHADORES_ECDS_DATAS_ID_INDEX: + value = this.trabalhadores_ecds_datas_id; + break; + case TrabalhadoresEcdsDatasObservacoes.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + value = this.to_trabalhadores_ecds_datas_id; + break; + case TrabalhadoresEcdsDatasObservacoes.OBSERVACAO_INDEX: + value = this.observacao; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcdsDatasObservacoes.ID_INDEX: + setId( ( Integer ) value ); + break; + case TrabalhadoresEcdsDatasObservacoes.TRABALHADORES_ECDS_DATAS_ID_INDEX: + setTrabalhadores_ecds_datas_id( ( Integer ) value ); + break; + case TrabalhadoresEcdsDatasObservacoes.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + setToTrabalhadores_ecds_datas_id( ( siprp.data.outer.TrabalhadoresEcdsDatasData ) value ); + break; + case TrabalhadoresEcdsDatasObservacoes.OBSERVACAO_INDEX: + setObservacao( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresEcdsDatasObservacoes.ID_INDEX: + this.id = ( Integer ) value; + break; + case TrabalhadoresEcdsDatasObservacoes.TRABALHADORES_ECDS_DATAS_ID_INDEX: + this.trabalhadores_ecds_datas_id = ( Integer ) value; + break; + case TrabalhadoresEcdsDatasObservacoes.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + this.to_trabalhadores_ecds_datas_id = ( siprp.data.outer.TrabalhadoresEcdsDatasData ) value; + break; + case TrabalhadoresEcdsDatasObservacoes.OBSERVACAO_INDEX: + this.observacao = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case TrabalhadoresEcdsDatasObservacoes.ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcdsDatasObservacoes.TRABALHADORES_ECDS_DATAS_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresEcdsDatasObservacoes.TO_TRABALHADORES_ECDS_DATAS_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresEcdsDatasData.class; + break; + case TrabalhadoresEcdsDatasObservacoes.OBSERVACAO_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : TrabalhadoresEcdsDatasObservacoes._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, TrabalhadoresEcdsDatasObservacoes.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresFichasAptidao.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresFichasAptidao.java new file mode 100644 index 00000000..a41a4266 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresFichasAptidao.java @@ -0,0 +1,429 @@ +/* +* TrabalhadoresFichasAptidao.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class TrabalhadoresFichasAptidao extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( TrabalhadoresFichasAptidao.ID, TrabalhadoresFichasAptidao.ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresFichasAptidao.ID_FULL, TrabalhadoresFichasAptidao.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresFichasAptidao.CLASS_IDENTIFIER, TrabalhadoresFichasAptidao.PROCESSO_ID, TrabalhadoresFichasAptidao.TO_PROCESSO_ID ); + FIELD_INDEXES.put( TrabalhadoresFichasAptidao.PROCESSO_ID, TrabalhadoresFichasAptidao.PROCESSO_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresFichasAptidao.PROCESSO_ID_FULL, TrabalhadoresFichasAptidao.PROCESSO_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresFichasAptidao.TO_PROCESSO_ID, TrabalhadoresFichasAptidao.TO_PROCESSO_ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresFichasAptidao.CLASS_IDENTIFIER, TrabalhadoresFichasAptidao.EXAME_ID, TrabalhadoresFichasAptidao.TO_EXAME_ID ); + FIELD_INDEXES.put( TrabalhadoresFichasAptidao.EXAME_ID, TrabalhadoresFichasAptidao.EXAME_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresFichasAptidao.EXAME_ID_FULL, TrabalhadoresFichasAptidao.EXAME_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresFichasAptidao.TO_EXAME_ID, TrabalhadoresFichasAptidao.TO_EXAME_ID_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeyprocesso_idTotrabalhadores_processo = + new com.evolute.entity.ForeignKey( TrabalhadoresFichasAptidao.class, TrabalhadoresFichasAptidao.PROCESSO_ID, siprp.data.outer.TrabalhadoresProcessoData.class, siprp.data.outer.TrabalhadoresProcessoData.ID ); + + public static final com.evolute.entity.ForeignKey ForeignKeyexame_idToexames = + new com.evolute.entity.ForeignKey( TrabalhadoresFichasAptidao.class, TrabalhadoresFichasAptidao.EXAME_ID, siprp.data.outer.ExamesData.class, siprp.data.outer.ExamesData.ID ); + + public static final String TABLENAME = "trabalhadores_fichas_aptidao"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.trabalhadores_fichas_aptidao"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_fichas_aptidao.id"; + public static final int ID_INDEX = 0; + public static final String PROCESSO_ID = "processo_id"; + public static final String PROCESSO_ID_FULL = "trabalhadores_fichas_aptidao.processo_id"; + public static final int PROCESSO_ID_INDEX = 1; + public static final String TO_PROCESSO_ID = "to_processo_id"; + public static final int TO_PROCESSO_ID_INDEX = 2; + public static final String EXAME_ID = "exame_id"; + public static final String EXAME_ID_FULL = "trabalhadores_fichas_aptidao.exame_id"; + public static final int EXAME_ID_INDEX = 3; + public static final String TO_EXAME_ID = "to_exame_id"; + public static final int TO_EXAME_ID_INDEX = 4; + + public static final String FIELD_NAMES[] = new String[]{ + PROCESSO_ID, TO_PROCESSO_ID, EXAME_ID, TO_EXAME_ID, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + PROCESSO_ID, TABLENAME + "." + TO_PROCESSO_ID, TABLENAME + "." + EXAME_ID, TABLENAME + "." + TO_EXAME_ID, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, PROCESSO_ID, EXAME_ID, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, PROCESSO_ID, EXAME_ID, }; + + private Integer id; + private Integer processo_id; + private siprp.data.outer.TrabalhadoresProcessoData to_processo_id; + private Integer exame_id; + private siprp.data.outer.ExamesData to_exame_id; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public TrabalhadoresFichasAptidao() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public Integer getProcesso_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( PROCESSO_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.processo_id; + } + + public void setProcesso_id( Integer processo_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( PROCESSO_ID, processo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.processo_id = processo_id; + LAZY_LOADED_OBJECTS.put( PROCESSO_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresProcessoData toProcesso_id() + { + try + { + prepare( TO_PROCESSO_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_processo_id; + } + + public void setToProcesso_id( siprp.data.outer.TrabalhadoresProcessoData to_processo_id ) + { + try + { + preProcess( TO_PROCESSO_ID, to_processo_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_processo_id = to_processo_id; + } + + public Integer getExame_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( EXAME_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.exame_id; + } + + public void setExame_id( Integer exame_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( EXAME_ID, exame_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.exame_id = exame_id; + LAZY_LOADED_OBJECTS.put( EXAME_ID, Boolean.TRUE ); + } + + public siprp.data.outer.ExamesData toExame_id() + { + try + { + prepare( TO_EXAME_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_exame_id; + } + + public void setToExame_id( siprp.data.outer.ExamesData to_exame_id ) + { + try + { + preProcess( TO_EXAME_ID, to_exame_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_exame_id = to_exame_id; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresFichasAptidao.ID_INDEX: + value = getId(); + break; + case TrabalhadoresFichasAptidao.PROCESSO_ID_INDEX: + value = getProcesso_id(); + break; + case TrabalhadoresFichasAptidao.TO_PROCESSO_ID_INDEX: + value = toProcesso_id(); + break; + case TrabalhadoresFichasAptidao.EXAME_ID_INDEX: + value = getExame_id(); + break; + case TrabalhadoresFichasAptidao.TO_EXAME_ID_INDEX: + value = toExame_id(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresFichasAptidao.ID_INDEX: + value = this.id; + break; + case TrabalhadoresFichasAptidao.PROCESSO_ID_INDEX: + value = this.processo_id; + break; + case TrabalhadoresFichasAptidao.TO_PROCESSO_ID_INDEX: + value = this.to_processo_id; + break; + case TrabalhadoresFichasAptidao.EXAME_ID_INDEX: + value = this.exame_id; + break; + case TrabalhadoresFichasAptidao.TO_EXAME_ID_INDEX: + value = this.to_exame_id; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresFichasAptidao.ID_INDEX: + setId( ( Integer ) value ); + break; + case TrabalhadoresFichasAptidao.PROCESSO_ID_INDEX: + setProcesso_id( ( Integer ) value ); + break; + case TrabalhadoresFichasAptidao.TO_PROCESSO_ID_INDEX: + setToProcesso_id( ( siprp.data.outer.TrabalhadoresProcessoData ) value ); + break; + case TrabalhadoresFichasAptidao.EXAME_ID_INDEX: + setExame_id( ( Integer ) value ); + break; + case TrabalhadoresFichasAptidao.TO_EXAME_ID_INDEX: + setToExame_id( ( siprp.data.outer.ExamesData ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresFichasAptidao.ID_INDEX: + this.id = ( Integer ) value; + break; + case TrabalhadoresFichasAptidao.PROCESSO_ID_INDEX: + this.processo_id = ( Integer ) value; + break; + case TrabalhadoresFichasAptidao.TO_PROCESSO_ID_INDEX: + this.to_processo_id = ( siprp.data.outer.TrabalhadoresProcessoData ) value; + break; + case TrabalhadoresFichasAptidao.EXAME_ID_INDEX: + this.exame_id = ( Integer ) value; + break; + case TrabalhadoresFichasAptidao.TO_EXAME_ID_INDEX: + this.to_exame_id = ( siprp.data.outer.ExamesData ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case TrabalhadoresFichasAptidao.ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresFichasAptidao.PROCESSO_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresFichasAptidao.TO_PROCESSO_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresProcessoData.class; + break; + case TrabalhadoresFichasAptidao.EXAME_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresFichasAptidao.TO_EXAME_ID_INDEX: + theClass = siprp.data.outer.ExamesData.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : TrabalhadoresFichasAptidao._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, TrabalhadoresFichasAptidao.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresProcesso.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresProcesso.java new file mode 100644 index 00000000..a1443ed4 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/TrabalhadoresProcesso.java @@ -0,0 +1,674 @@ +/* +* TrabalhadoresProcesso.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class TrabalhadoresProcesso extends siprp.data.BaseObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + FIELD_INDEXES.put( TrabalhadoresProcesso.ID, TrabalhadoresProcesso.ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresProcesso.ID_FULL, TrabalhadoresProcesso.ID_INDEX ); + com.evolute.entity.evo.EvoDataObject.register( TrabalhadoresProcesso.CLASS_IDENTIFIER, TrabalhadoresProcesso.TRABALHADOR_ID, TrabalhadoresProcesso.TO_TRABALHADOR_ID ); + FIELD_INDEXES.put( TrabalhadoresProcesso.TRABALHADOR_ID, TrabalhadoresProcesso.TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresProcesso.TRABALHADOR_ID_FULL, TrabalhadoresProcesso.TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresProcesso.TO_TRABALHADOR_ID, TrabalhadoresProcesso.TO_TRABALHADOR_ID_INDEX ); + FIELD_INDEXES.put( TrabalhadoresProcesso.ESTADO, TrabalhadoresProcesso.ESTADO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresProcesso.ESTADO_FULL, TrabalhadoresProcesso.ESTADO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresProcesso.DATA_INICIO, TrabalhadoresProcesso.DATA_INICIO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresProcesso.DATA_INICIO_FULL, TrabalhadoresProcesso.DATA_INICIO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresProcesso.DATA_FIM, TrabalhadoresProcesso.DATA_FIM_INDEX ); + FIELD_INDEXES.put( TrabalhadoresProcesso.DATA_FIM_FULL, TrabalhadoresProcesso.DATA_FIM_INDEX ); + FIELD_INDEXES.put( TrabalhadoresProcesso.MOTIVO, TrabalhadoresProcesso.MOTIVO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresProcesso.MOTIVO_FULL, TrabalhadoresProcesso.MOTIVO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresProcesso.SUB_MOTIVO, TrabalhadoresProcesso.SUB_MOTIVO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresProcesso.SUB_MOTIVO_FULL, TrabalhadoresProcesso.SUB_MOTIVO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresProcesso.ACTIVO, TrabalhadoresProcesso.ACTIVO_INDEX ); + FIELD_INDEXES.put( TrabalhadoresProcesso.ACTIVO_FULL, TrabalhadoresProcesso.ACTIVO_INDEX ); + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final com.evolute.entity.ForeignKey ForeignKeytrabalhador_idTotrabalhadores = + new com.evolute.entity.ForeignKey( TrabalhadoresProcesso.class, TrabalhadoresProcesso.TRABALHADOR_ID, siprp.data.outer.TrabalhadoresData.class, siprp.data.outer.TrabalhadoresData.ID ); + + public static final String TABLENAME = "trabalhadores_processo"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.trabalhadores_processo"; + + public static final int _INVALID__INDEX = -1; + public static final String ID = "id"; + public static final String ID_FULL = "trabalhadores_processo.id"; + public static final int ID_INDEX = 0; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String TRABALHADOR_ID_FULL = "trabalhadores_processo.trabalhador_id"; + public static final int TRABALHADOR_ID_INDEX = 1; + public static final String TO_TRABALHADOR_ID = "to_trabalhador_id"; + public static final int TO_TRABALHADOR_ID_INDEX = 2; + public static final String ESTADO = "estado"; + public static final String ESTADO_FULL = "trabalhadores_processo.estado"; + public static final int ESTADO_INDEX = 3; + public static final String DATA_INICIO = "data_inicio"; + public static final String DATA_INICIO_FULL = "trabalhadores_processo.data_inicio"; + public static final int DATA_INICIO_INDEX = 4; + public static final String DATA_FIM = "data_fim"; + public static final String DATA_FIM_FULL = "trabalhadores_processo.data_fim"; + public static final int DATA_FIM_INDEX = 5; + public static final String MOTIVO = "motivo"; + public static final String MOTIVO_FULL = "trabalhadores_processo.motivo"; + public static final int MOTIVO_INDEX = 6; + public static final String SUB_MOTIVO = "sub_motivo"; + public static final String SUB_MOTIVO_FULL = "trabalhadores_processo.sub_motivo"; + public static final int SUB_MOTIVO_INDEX = 7; + public static final String ACTIVO = "activo"; + public static final String ACTIVO_FULL = "trabalhadores_processo.activo"; + public static final int ACTIVO_INDEX = 8; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADOR_ID, TO_TRABALHADOR_ID, ESTADO, DATA_INICIO, DATA_FIM, MOTIVO, + SUB_MOTIVO, ACTIVO, }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + TABLENAME + "." + TRABALHADOR_ID, TABLENAME + "." + TO_TRABALHADOR_ID, TABLENAME + "." + ESTADO, TABLENAME + "." + DATA_INICIO, TABLENAME + "." + DATA_FIM, TABLENAME + "." + MOTIVO, + TABLENAME + "." + SUB_MOTIVO, TABLENAME + "." + ACTIVO, }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + ID, TRABALHADOR_ID, ESTADO, DATA_INICIO, DATA_FIM, MOTIVO, SUB_MOTIVO, ACTIVO, }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + ID, }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + ID, TRABALHADOR_ID, ESTADO, DATA_INICIO, DATA_FIM, MOTIVO, SUB_MOTIVO, ACTIVO, }; + + private Integer id; + private Integer trabalhador_id; + private siprp.data.outer.TrabalhadoresData to_trabalhador_id; + private String estado; + private java.util.Date data_inicio; + private java.util.Date data_fim; + private Integer motivo; + private Integer sub_motivo; + private String activo; + + protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey; + + public TrabalhadoresProcesso() + { + super(); + dirtyProperties = new boolean[]{ false, false, false, + false, false, false, false, false, false }; + } + + public Integer getId() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.id; + } + + public void setId( Integer id ) + { + try + { + setLockedForRefresh( true ); + preProcess( ID, id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.id = id; + LAZY_LOADED_OBJECTS.put( ID, Boolean.TRUE ); + } + + public java.util.ListfromTrabalhadoresConsultas_processo_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresConsultasData.class , getPrimaryKey().getMap().get("id"), "processo_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresEcds_processo_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresEcdsData.class , getPrimaryKey().getMap().get("id"), "processo_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public java.util.ListfromTrabalhadoresFichasAptidao_processo_id() + { + java.util.List result = null; + try + { + result = fromReference( siprp.data.outer.TrabalhadoresFichasAptidaoData.class , getPrimaryKey().getMap().get("id"), "processo_id" ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return result; + } + + public Integer getTrabalhador_id() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( TRABALHADOR_ID ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.trabalhador_id; + } + + public void setTrabalhador_id( Integer trabalhador_id ) + { + try + { + setLockedForRefresh( true ); + preProcess( TRABALHADOR_ID, trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.trabalhador_id = trabalhador_id; + LAZY_LOADED_OBJECTS.put( TRABALHADOR_ID, Boolean.TRUE ); + } + + public siprp.data.outer.TrabalhadoresData toTrabalhador_id() + { + try + { + prepare( TO_TRABALHADOR_ID ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + return this.to_trabalhador_id; + } + + public void setToTrabalhador_id( siprp.data.outer.TrabalhadoresData to_trabalhador_id ) + { + try + { + preProcess( TO_TRABALHADOR_ID, to_trabalhador_id ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.to_trabalhador_id = to_trabalhador_id; + } + + public String getEstado() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ESTADO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.estado; + } + + public void setEstado( String estado ) + { + try + { + setLockedForRefresh( true ); + preProcess( ESTADO, estado ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.estado = estado; + LAZY_LOADED_OBJECTS.put( ESTADO, Boolean.TRUE ); + } + + public java.util.Date getData_inicio() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_INICIO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_inicio; + } + + public void setData_inicio( java.util.Date data_inicio ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_INICIO, data_inicio ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_inicio = data_inicio; + LAZY_LOADED_OBJECTS.put( DATA_INICIO, Boolean.TRUE ); + } + + public java.util.Date getData_fim() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( DATA_FIM ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.data_fim; + } + + public void setData_fim( java.util.Date data_fim ) + { + try + { + setLockedForRefresh( true ); + preProcess( DATA_FIM, data_fim ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.data_fim = data_fim; + LAZY_LOADED_OBJECTS.put( DATA_FIM, Boolean.TRUE ); + } + + public Integer getMotivo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( MOTIVO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.motivo; + } + + public void setMotivo( Integer motivo ) + { + try + { + setLockedForRefresh( true ); + preProcess( MOTIVO, motivo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.motivo = motivo; + LAZY_LOADED_OBJECTS.put( MOTIVO, Boolean.TRUE ); + } + + public Integer getSub_motivo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( SUB_MOTIVO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.sub_motivo; + } + + public void setSub_motivo( Integer sub_motivo ) + { + try + { + setLockedForRefresh( true ); + preProcess( SUB_MOTIVO, sub_motivo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.sub_motivo = sub_motivo; + LAZY_LOADED_OBJECTS.put( SUB_MOTIVO, Boolean.TRUE ); + } + + public String getActivo() + { + try + { + setLastAccess( System.currentTimeMillis() ); + prepare( ACTIVO ); + } + catch( java.lang.Exception ex ) + { + throw new RuntimeException( ex ); + } + return this.activo; + } + + public void setActivo( String activo ) + { + try + { + setLockedForRefresh( true ); + preProcess( ACTIVO, activo ); + } + catch( com.evolute.entity.evo.EvoDataException edex ) + { + throw new RuntimeException( edex ); + } + this.activo = activo; + LAZY_LOADED_OBJECTS.put( ACTIVO, Boolean.TRUE ); + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresProcesso.ID_INDEX: + value = getId(); + break; + case TrabalhadoresProcesso.TRABALHADOR_ID_INDEX: + value = getTrabalhador_id(); + break; + case TrabalhadoresProcesso.TO_TRABALHADOR_ID_INDEX: + value = toTrabalhador_id(); + break; + case TrabalhadoresProcesso.ESTADO_INDEX: + value = getEstado(); + break; + case TrabalhadoresProcesso.DATA_INICIO_INDEX: + value = getData_inicio(); + break; + case TrabalhadoresProcesso.DATA_FIM_INDEX: + value = getData_fim(); + break; + case TrabalhadoresProcesso.MOTIVO_INDEX: + value = getMotivo(); + break; + case TrabalhadoresProcesso.SUB_MOTIVO_INDEX: + value = getSub_motivo(); + break; + case TrabalhadoresProcesso.ACTIVO_INDEX: + value = getActivo(); + break; + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresProcesso.ID_INDEX: + value = this.id; + break; + case TrabalhadoresProcesso.TRABALHADOR_ID_INDEX: + value = this.trabalhador_id; + break; + case TrabalhadoresProcesso.TO_TRABALHADOR_ID_INDEX: + value = this.to_trabalhador_id; + break; + case TrabalhadoresProcesso.ESTADO_INDEX: + value = this.estado; + break; + case TrabalhadoresProcesso.DATA_INICIO_INDEX: + value = this.data_inicio; + break; + case TrabalhadoresProcesso.DATA_FIM_INDEX: + value = this.data_fim; + break; + case TrabalhadoresProcesso.MOTIVO_INDEX: + value = this.motivo; + break; + case TrabalhadoresProcesso.SUB_MOTIVO_INDEX: + value = this.sub_motivo; + break; + case TrabalhadoresProcesso.ACTIVO_INDEX: + value = this.activo; + break; + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresProcesso.ID_INDEX: + setId( ( Integer ) value ); + break; + case TrabalhadoresProcesso.TRABALHADOR_ID_INDEX: + setTrabalhador_id( ( Integer ) value ); + break; + case TrabalhadoresProcesso.TO_TRABALHADOR_ID_INDEX: + setToTrabalhador_id( ( siprp.data.outer.TrabalhadoresData ) value ); + break; + case TrabalhadoresProcesso.ESTADO_INDEX: + setEstado( ( String ) value ); + break; + case TrabalhadoresProcesso.DATA_INICIO_INDEX: + setData_inicio( ( java.util.Date ) value ); + break; + case TrabalhadoresProcesso.DATA_FIM_INDEX: + setData_fim( ( java.util.Date ) value ); + break; + case TrabalhadoresProcesso.MOTIVO_INDEX: + setMotivo( ( Integer ) value ); + break; + case TrabalhadoresProcesso.SUB_MOTIVO_INDEX: + setSub_motivo( ( Integer ) value ); + break; + case TrabalhadoresProcesso.ACTIVO_INDEX: + setActivo( ( String ) value ); + break; + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + case TrabalhadoresProcesso.ID_INDEX: + this.id = ( Integer ) value; + break; + case TrabalhadoresProcesso.TRABALHADOR_ID_INDEX: + this.trabalhador_id = ( Integer ) value; + break; + case TrabalhadoresProcesso.TO_TRABALHADOR_ID_INDEX: + this.to_trabalhador_id = ( siprp.data.outer.TrabalhadoresData ) value; + break; + case TrabalhadoresProcesso.ESTADO_INDEX: + this.estado = ( String ) value; + break; + case TrabalhadoresProcesso.DATA_INICIO_INDEX: + this.data_inicio = ( java.util.Date ) value; + break; + case TrabalhadoresProcesso.DATA_FIM_INDEX: + this.data_fim = ( java.util.Date ) value; + break; + case TrabalhadoresProcesso.MOTIVO_INDEX: + this.motivo = ( Integer ) value; + break; + case TrabalhadoresProcesso.SUB_MOTIVO_INDEX: + this.sub_motivo = ( Integer ) value; + break; + case TrabalhadoresProcesso.ACTIVO_INDEX: + this.activo = ( String ) value; + break; + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + return PK_FIELD_NAMES[ 0 ]; + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + case TrabalhadoresProcesso.ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresProcesso.TRABALHADOR_ID_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresProcesso.TO_TRABALHADOR_ID_INDEX: + theClass = siprp.data.outer.TrabalhadoresData.class; + break; + case TrabalhadoresProcesso.ESTADO_INDEX: + theClass = String.class; + break; + case TrabalhadoresProcesso.DATA_INICIO_INDEX: + theClass = java.util.Date.class; + break; + case TrabalhadoresProcesso.DATA_FIM_INDEX: + theClass = java.util.Date.class; + break; + case TrabalhadoresProcesso.MOTIVO_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresProcesso.SUB_MOTIVO_INDEX: + theClass = Integer.class; + break; + case TrabalhadoresProcesso.ACTIVO_INDEX: + theClass = String.class; + break; + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : TrabalhadoresProcesso._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, TrabalhadoresProcesso.PK_FIELD_NAMES ); + primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) ); + } + setId( ( Integer ) array.get( row, col + 0 ) ); + } + + @Override + public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Versao.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Versao.java new file mode 100644 index 00000000..9cd7e2bb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Versao.java @@ -0,0 +1,178 @@ +/* +* Versao.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class Versao extends com.evolute.entity.evo.EvoDataObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "versao"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.versao"; + + public static final int _INVALID__INDEX = -1; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + }; + + + protected com.evolute.entity.utils.ObjectPrimaryKey primaryKey; + + public Versao() + { + super(); + dirtyProperties = new boolean[]{ }; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + throw new RuntimeException( "getPrimaryKeyName on Versao is invalid" ); + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : Versao._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.ObjectPrimaryKey( TABLENAME, Versao.PK_FIELD_NAMES ); + } + } + + @Override + public com.evolute.entity.utils.ObjectPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Version.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Version.java new file mode 100644 index 00000000..4ef076c6 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/Version.java @@ -0,0 +1,178 @@ +/* +* Version.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Use but DON'T TOUCH +* -> (can't touch this) +*/ +package siprp.data.inner; + + +public class Version extends com.evolute.entity.evo.EvoDataObject +{ + private static final java.util.HashMap FIELD_INDEXES = new java.util.HashMap(); + + static + { + } + + private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >(); + + + public static final String TABLENAME = "version"; + + + public static final String CLASS_IDENTIFIER = "siprp.data.inner.version"; + + public static final int _INVALID__INDEX = -1; + + public static final String FIELD_NAMES[] = new String[]{ + }; + + public static final String FIELD_NAMES_FULL[] = new String[]{ + }; + + protected static final String DB_FIELD_NAMES[] = new String[]{ + }; + + + protected static final String PK_FIELD_NAMES[] = new String[]{ + }; + + + public static final String DEFAULT_LOAD_SET[] = new String[] { + }; + + + protected com.evolute.entity.utils.ObjectPrimaryKey primaryKey; + + public Version() + { + super(); + dirtyProperties = new boolean[]{ }; + } + + public Object get( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + } + return value; + } + + public Object rawGet( String fieldName ) + { + Object value = null; + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + } + return value; + } + + public void set( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + } + } + + public void rawSet( String fieldName, Object value ) + { + Integer index = getFieldIndex( fieldName ); + switch( index ) + { + } + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + public String []getFieldNamesFull() + { + return FIELD_NAMES_FULL; + } + + public String []getDBFieldNames() + { + return DB_FIELD_NAMES; + } + + public String []getPrimaryKeyNames() + { + return PK_FIELD_NAMES; + } + + public String []getDefaultLoadSet() + { + return DEFAULT_LOAD_SET; + } + + public String getPrimaryKeyName() + { + throw new RuntimeException( "getPrimaryKeyName on Version is invalid" ); + } + + public Class getFieldClass( String fieldName ) + { + Integer index = getFieldIndex( fieldName ); + Class theClass = null; + switch( index ) + { + } + return theClass; + } + + public Integer getFieldIndex( String fieldName ) + { + Integer index = FIELD_INDEXES.get( fieldName ); + return index != null ? index : Version._INVALID__INDEX; + } + + public String getTableName() + { + return TABLENAME; + } + + public String getClassIdentifier() + { + return CLASS_IDENTIFIER; + } + + @Override + protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col ) + { + if( primaryKey == null ) + { + primaryKey = new com.evolute.entity.utils.ObjectPrimaryKey( TABLENAME, Version.PK_FIELD_NAMES ); + } + } + + @Override + public com.evolute.entity.utils.ObjectPrimaryKey getPrimaryKey() + { + return primaryKey; + } + + public void initLazyLoadFields() + { + } + + public boolean isPropertyLoaded( String fieldName ) + { + if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null ) + { + return true; + } + else + { + return LAZY_LOADED_OBJECTS.get( fieldName ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/package.xml b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/package.xml new file mode 100644 index 00000000..47e95bce --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/inner/package.xml @@ -0,0 +1,2471 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ActualizacaoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ActualizacaoData.java new file mode 100644 index 00000000..258a4639 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ActualizacaoData.java @@ -0,0 +1,18 @@ +/* +* ActualizacaoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class ActualizacaoData extends siprp.data.inner.Actualizacao +{ + + public ActualizacaoData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/AvisosData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/AvisosData.java new file mode 100644 index 00000000..5d261a82 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/AvisosData.java @@ -0,0 +1,21 @@ +/* +* AvisosData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import siprp.data.AvisoConstants; + + +public final class AvisosData extends siprp.data.inner.Avisos implements AvisoConstants +{ + + public AvisosData() + { + super(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ContactosData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ContactosData.java new file mode 100644 index 00000000..33b943af --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ContactosData.java @@ -0,0 +1,18 @@ +/* +* ContactosData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class ContactosData extends siprp.data.inner.Contactos +{ + + public ContactosData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EcdOficialData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EcdOficialData.java new file mode 100644 index 00000000..f7534705 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EcdOficialData.java @@ -0,0 +1,18 @@ +/* +* EcdOficialData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class EcdOficialData extends siprp.data.inner.EcdOficial +{ + + public EcdOficialData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EmailPlanoDeActuacaoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EmailPlanoDeActuacaoData.java new file mode 100644 index 00000000..843c171c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EmailPlanoDeActuacaoData.java @@ -0,0 +1,25 @@ +/* +* EmailPlanoDeActuacaoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class EmailPlanoDeActuacaoData extends siprp.data.inner.EmailPlanoDeActuacao +{ + + public EmailPlanoDeActuacaoData() + { + super(); + } + + @Override + public String toString() + { + return getDescription() == null ? "" : getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EmpresaPrecoPeriodicidadeTipoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EmpresaPrecoPeriodicidadeTipoData.java new file mode 100644 index 00000000..934e9991 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EmpresaPrecoPeriodicidadeTipoData.java @@ -0,0 +1,18 @@ +/* +* EmpresaPrecoPeriodicidadeTipoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class EmpresaPrecoPeriodicidadeTipoData extends siprp.data.inner.EmpresaPrecoPeriodicidadeTipo +{ + + public EmpresaPrecoPeriodicidadeTipoData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EmpresaPrecoServicoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EmpresaPrecoServicoData.java new file mode 100644 index 00000000..62f90054 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EmpresaPrecoServicoData.java @@ -0,0 +1,18 @@ +/* +* EmpresaPrecoServicoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class EmpresaPrecoServicoData extends siprp.data.inner.EmpresaPrecoServico +{ + + public EmpresaPrecoServicoData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EmpresaPrecoServicoTipoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EmpresaPrecoServicoTipoData.java new file mode 100644 index 00000000..3b3f9a8c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EmpresaPrecoServicoTipoData.java @@ -0,0 +1,18 @@ +/* +* EmpresaPrecoServicoTipoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class EmpresaPrecoServicoTipoData extends siprp.data.inner.EmpresaPrecoServicoTipo +{ + + public EmpresaPrecoServicoTipoData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EmpresasData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EmpresasData.java new file mode 100644 index 00000000..23631923 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EmpresasData.java @@ -0,0 +1,41 @@ +/* +* EmpresasData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import java.sql.Timestamp; + +import com.evolute.entity.evo.EvoDataException; + + +public final class EmpresasData extends siprp.data.inner.Empresas +{ + + public EmpresasData() + { + super(); + } + + @Override + public void save() throws EvoDataException + { + if( getInactivo() == null ) + { + setInactivo( "n" ); + } + setActualizacao( new Timestamp(System.currentTimeMillis() ) ); + super.save(); + } + + @Override + public void delete() throws EvoDataException + { + setInactivo( "y" ); + save(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ErrorsData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ErrorsData.java new file mode 100644 index 00000000..15cee4b8 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ErrorsData.java @@ -0,0 +1,18 @@ +/* +* ErrorsData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class ErrorsData extends siprp.data.inner.Errors +{ + + public ErrorsData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EstabelecimentosData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EstabelecimentosData.java new file mode 100644 index 00000000..c1e6a620 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EstabelecimentosData.java @@ -0,0 +1,63 @@ +/* +* EstabelecimentosData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import java.sql.Timestamp; +import java.util.Collections; +import java.util.List; + +import siprp.database.cayenne.objects.MarcacoesEstabelecimento; +import siprp.database.cayenne.objects.Trabalhadores; + +import com.evolute.entity.evo.EvoDataException; + + +public final class EstabelecimentosData extends siprp.data.inner.Estabelecimentos +{ + + public EstabelecimentosData() + { + super(); + } + + @Override + public void save() throws EvoDataException + { + if( getInactivo() == null ) + { + setInactivo( "n" ); + } + setActualizacao( new Timestamp(System.currentTimeMillis() ) ); + super.save(); + } + + @Override + public void delete() throws EvoDataException + { + setInactivo( "y" ); + save(); + } + + @Override + public String toString() + { + return getNome(); + } + + @Override + public List fromMarcacoesEstabelecimento_estabelecimento_id() + { + List result = super.fromMarcacoesEstabelecimento_estabelecimento_id(); + if( result != null ) + { + Collections.sort( result ); + } + return result; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EtiquetasData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EtiquetasData.java new file mode 100644 index 00000000..e2d67a12 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/EtiquetasData.java @@ -0,0 +1,18 @@ +/* +* EtiquetasData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class EtiquetasData extends siprp.data.inner.Etiquetas +{ + + public EtiquetasData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ExamesData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ExamesData.java new file mode 100644 index 00000000..4f9e6107 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ExamesData.java @@ -0,0 +1,38 @@ +/* +* ExamesData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import com.evolute.entity.evo.EvoDataException; + + +public final class ExamesData extends siprp.data.inner.Exames +{ + + public ExamesData() + { + super(); + } + + @Override + public void save() throws EvoDataException + { + if( getInactivo() == null ) + { + setInactivo( "n" ); + } + super.save(); + } + + @Override + public void delete() throws EvoDataException + { + setInactivo( "y" ); + save(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ExamesPerfisData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ExamesPerfisData.java new file mode 100644 index 00000000..c4ea2108 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ExamesPerfisData.java @@ -0,0 +1,18 @@ +/* +* ExamesPerfisData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class ExamesPerfisData extends siprp.data.inner.ExamesPerfis +{ + + public ExamesPerfisData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ExamesPortariaData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ExamesPortariaData.java new file mode 100644 index 00000000..e1542bbb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ExamesPortariaData.java @@ -0,0 +1,18 @@ +/* +* ExamesPortariaData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class ExamesPortariaData extends siprp.data.inner.ExamesPortaria +{ + + public ExamesPortariaData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HistoricoEstabelecimentoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HistoricoEstabelecimentoData.java new file mode 100644 index 00000000..a78bf904 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HistoricoEstabelecimentoData.java @@ -0,0 +1,18 @@ +/* +* HistoricoEstabelecimentoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HistoricoEstabelecimentoData extends siprp.data.inner.HistoricoEstabelecimento +{ + + public HistoricoEstabelecimentoData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsAreaData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsAreaData.java new file mode 100644 index 00000000..0e345661 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsAreaData.java @@ -0,0 +1,46 @@ +/* +* HsAreaData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import com.evolute.entity.evo.EvoDataException; + +public final class HsAreaData extends siprp.data.inner.HsArea +{ + + public HsAreaData() + { + super(); + } + + @Override + public void save() throws EvoDataException + { + EmpresasData empresa = toEmpresa_id(); + if( empresa != null ) + { + Integer maxOrder = 0; + for( HsAreaData area : empresa.fromHsArea_empresa_id() ) + { + Integer currentOrder = area.getOrdem(); + if( currentOrder != null ) + { + maxOrder = Math.max( currentOrder, maxOrder ); + } + } + this.setOrdem( maxOrder + 1 ); + } + super.save(); + } + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsEmailData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsEmailData.java new file mode 100644 index 00000000..a3932d0e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsEmailData.java @@ -0,0 +1,25 @@ +/* +* HsEmailData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsEmailData extends siprp.data.inner.HsEmail +{ + + public HsEmailData() + { + super(); + } + + @Override + public String toString() + { + return getEmail(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsEmailEmpresaData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsEmailEmpresaData.java new file mode 100644 index 00000000..7908a6f6 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsEmailEmpresaData.java @@ -0,0 +1,25 @@ +/* +* HsEmailEmpresaData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsEmailEmpresaData extends siprp.data.inner.HsEmailEmpresa +{ + + public HsEmailEmpresaData() + { + super(); + } + + @Override + public String toString() + { + return toEmail_id().toString(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsEmailEstabelecimentoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsEmailEstabelecimentoData.java new file mode 100644 index 00000000..1efc5e45 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsEmailEstabelecimentoData.java @@ -0,0 +1,25 @@ +/* +* HsEmailEstabelecimentoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsEmailEstabelecimentoData extends siprp.data.inner.HsEmailEstabelecimento +{ + + public HsEmailEstabelecimentoData() + { + super(); + } + + @Override + public String toString() + { + return toEmail_id().toString(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsEquipamentoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsEquipamentoData.java new file mode 100644 index 00000000..e1cfcc75 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsEquipamentoData.java @@ -0,0 +1,27 @@ +/* +* HsEquipamentoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsEquipamentoData extends siprp.data.inner.HsEquipamento +{ + + public HsEquipamentoData() + { + super(); + } + + @Override + public String toString() + { + String marca = getMarca() == null ? "" : getMarca(); + String modelo = getModelo() == null ? "" : getModelo(); + return getTipo() + ": " + marca + "-" + modelo; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsLegislacaoCategoriaData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsLegislacaoCategoriaData.java new file mode 100644 index 00000000..95ad1177 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsLegislacaoCategoriaData.java @@ -0,0 +1,25 @@ +/* +* HsLegislacaoCategoriaData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsLegislacaoCategoriaData extends siprp.data.inner.HsLegislacaoCategoria +{ + + public HsLegislacaoCategoriaData() + { + super(); + } + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsLegislacaoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsLegislacaoData.java new file mode 100644 index 00000000..2c3c3368 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsLegislacaoData.java @@ -0,0 +1,25 @@ +/* +* HsLegislacaoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsLegislacaoData extends siprp.data.inner.HsLegislacao +{ + + public HsLegislacaoData() + { + super(); + } + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsLegislacaoEmpresaData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsLegislacaoEmpresaData.java new file mode 100644 index 00000000..bf12db4f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsLegislacaoEmpresaData.java @@ -0,0 +1,18 @@ +/* +* HsLegislacaoEmpresaData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsLegislacaoEmpresaData extends siprp.data.inner.HsLegislacaoEmpresa +{ + + public HsLegislacaoEmpresaData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsLegislacaoEstabelecimentoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsLegislacaoEstabelecimentoData.java new file mode 100644 index 00000000..3978d235 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsLegislacaoEstabelecimentoData.java @@ -0,0 +1,41 @@ +/* +* HsLegislacaoEstabelecimentoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import com.evolute.entity.evo.EvoDataException; + + +public final class HsLegislacaoEstabelecimentoData extends siprp.data.inner.HsLegislacaoEstabelecimento +{ + + public HsLegislacaoEstabelecimentoData() + { + super(); + } + + @Override + public void save() throws EvoDataException + { + EstabelecimentosData estabelecimento = toEstabelecimento_id(); + if( estabelecimento != null ) + { + Integer maxOrder = 0; + for( HsLegislacaoEstabelecimentoData rel : estabelecimento.fromHsLegislacaoEstabelecimento_estabelecimento_id() ) + { + Integer currentOrder = rel.getOrdem(); + if( currentOrder != null ) + { + maxOrder = Math.max( currentOrder, maxOrder ); + } + } + this.setOrdem( maxOrder + 1 ); + } + super.save(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsMedidaData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsMedidaData.java new file mode 100644 index 00000000..4774b0df --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsMedidaData.java @@ -0,0 +1,25 @@ +/* +* HsMedidaData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsMedidaData extends siprp.data.inner.HsMedida +{ + + public HsMedidaData() + { + super(); + } + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsNormalizacaoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsNormalizacaoData.java new file mode 100644 index 00000000..5d8cec5a --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsNormalizacaoData.java @@ -0,0 +1,29 @@ +/* +* HsNormalizacaoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsNormalizacaoData extends siprp.data.inner.HsNormalizacao +{ + + private static final int TO_STRING_LENGTH = 58; + + public HsNormalizacaoData() + { + super(); + } + + @Override + public String toString() + { + String codigo = getCodigo(); + String descricao = getDescricao() == null ? "" : getDescricao().replaceAll( "\n", " " ); + return (codigo == null ? "" : codigo ) + ": " + ( descricao.substring( 0, Math.min( TO_STRING_LENGTH, descricao.length() ) ) + ( TO_STRING_LENGTH < descricao.length() ? "..." : "" ) ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsNormalizacaoEmpresaData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsNormalizacaoEmpresaData.java new file mode 100644 index 00000000..0dddeb90 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsNormalizacaoEmpresaData.java @@ -0,0 +1,18 @@ +/* +* HsNormalizacaoEmpresaData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsNormalizacaoEmpresaData extends siprp.data.inner.HsNormalizacaoEmpresa +{ + + public HsNormalizacaoEmpresaData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsNormalizacaoEstabelecimentoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsNormalizacaoEstabelecimentoData.java new file mode 100644 index 00000000..2d476f91 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsNormalizacaoEstabelecimentoData.java @@ -0,0 +1,18 @@ +/* +* HsNormalizacaoEstabelecimentoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsNormalizacaoEstabelecimentoData extends siprp.data.inner.HsNormalizacaoEstabelecimento +{ + + public HsNormalizacaoEstabelecimentoData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsPostoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsPostoData.java new file mode 100644 index 00000000..113f638e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsPostoData.java @@ -0,0 +1,25 @@ +/* +* HsPostoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsPostoData extends siprp.data.inner.HsPosto +{ + + public HsPostoData() + { + super(); + } + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsPostoEstabelecimentoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsPostoEstabelecimentoData.java new file mode 100644 index 00000000..f3c74518 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsPostoEstabelecimentoData.java @@ -0,0 +1,18 @@ +/* +* HsPostoEstabelecimentoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsPostoEstabelecimentoData extends siprp.data.inner.HsPostoEstabelecimento +{ + + public HsPostoEstabelecimentoData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsPostoMedidaData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsPostoMedidaData.java new file mode 100644 index 00000000..33a09ddb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsPostoMedidaData.java @@ -0,0 +1,18 @@ +/* +* HsPostoMedidaData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsPostoMedidaData extends siprp.data.inner.HsPostoMedida +{ + + public HsPostoMedidaData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsPostoRiscoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsPostoRiscoData.java new file mode 100644 index 00000000..c82d8919 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsPostoRiscoData.java @@ -0,0 +1,46 @@ +/* +* HsPostoRiscoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import com.evolute.entity.evo.EvoDataException; + +public final class HsPostoRiscoData extends siprp.data.inner.HsPostoRisco +{ + + public HsPostoRiscoData() + { + super(); + } + + @Override + public String toString() + { + return super.toRisco_id().getDescription(); + } + + @Override + public void save() throws EvoDataException + { + HsPostoData posto = toPosto_id(); + if( posto != null ) + { + Integer maxOrder = 0; + for( HsPostoRiscoData rel : posto.fromHsPostoRisco_posto_id() ) + { + Integer currentOrder = rel.getOrdem(); + if( currentOrder != null ) + { + maxOrder = Math.max( currentOrder, maxOrder ); + } + } + this.setOrdem( maxOrder + 1 ); + } + super.save(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioAreaData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioAreaData.java new file mode 100644 index 00000000..73c1d5cb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioAreaData.java @@ -0,0 +1,25 @@ +/* +* HsRelatorioAreaData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsRelatorioAreaData extends siprp.data.inner.HsRelatorioArea +{ + + public HsRelatorioAreaData() + { + super(); + } + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioData.java new file mode 100644 index 00000000..a69081ee --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioData.java @@ -0,0 +1,18 @@ +/* +* HsRelatorioData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsRelatorioData extends siprp.data.inner.HsRelatorio +{ + + public HsRelatorioData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioEquipamentoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioEquipamentoData.java new file mode 100644 index 00000000..ac66982f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioEquipamentoData.java @@ -0,0 +1,27 @@ +/* +* HsRelatorioEquipamentoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsRelatorioEquipamentoData extends siprp.data.inner.HsRelatorioEquipamento +{ + + public HsRelatorioEquipamentoData() + { + super(); + } + + @Override + public String toString() + { + String marca = getMarca() == null ? "" : getMarca(); + String modelo = getModelo() == null ? "" : getModelo(); + return getTipo() + ": " + marca + "-" + modelo; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioLegislacaoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioLegislacaoData.java new file mode 100644 index 00000000..fdd7096f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioLegislacaoData.java @@ -0,0 +1,25 @@ +/* +* HsRelatorioLegislacaoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsRelatorioLegislacaoData extends siprp.data.inner.HsRelatorioLegislacao +{ + + public HsRelatorioLegislacaoData() + { + super(); + } + + @Override + public String toString() + { + return getDescricao(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioMedidaData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioMedidaData.java new file mode 100644 index 00000000..dd7c0342 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioMedidaData.java @@ -0,0 +1,25 @@ +/* +* HsRelatorioMedidaData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsRelatorioMedidaData extends siprp.data.inner.HsRelatorioMedida +{ + + public HsRelatorioMedidaData() + { + super(); + } + + @Override + public String toString() + { + return getRequesitos_legais(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioNormalizacaoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioNormalizacaoData.java new file mode 100644 index 00000000..70b82b9f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioNormalizacaoData.java @@ -0,0 +1,29 @@ +/* +* HsRelatorioNormalizacaoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsRelatorioNormalizacaoData extends siprp.data.inner.HsRelatorioNormalizacao +{ + + private static final int TO_STRING_LENGTH = 58; + + public HsRelatorioNormalizacaoData() + { + super(); + } + + @Override + public String toString() + { + String codigo = getCodigo(); + String descricao = getDescricao() == null ? "" : getDescricao().replaceAll( "\n", " " ); + return (codigo == null ? "" : codigo ) + ": " + ( descricao.substring( 0, Math.min( TO_STRING_LENGTH, descricao.length() ) ) + ( TO_STRING_LENGTH < descricao.length() ? "..." : "" ) ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioPostoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioPostoData.java new file mode 100644 index 00000000..77d5ef57 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioPostoData.java @@ -0,0 +1,25 @@ +/* +* HsRelatorioPostoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsRelatorioPostoData extends siprp.data.inner.HsRelatorioPosto +{ + + public HsRelatorioPostoData() + { + super(); + } + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioPostoMedidaData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioPostoMedidaData.java new file mode 100644 index 00000000..23bd4f5c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioPostoMedidaData.java @@ -0,0 +1,25 @@ +/* +* HsRelatorioPostoMedidaData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsRelatorioPostoMedidaData extends siprp.data.inner.HsRelatorioPostoMedida +{ + + public HsRelatorioPostoMedidaData() + { + super(); + } + + @Override + public String toString() + { + return toMedida_id().toString(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioPostoRiscoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioPostoRiscoData.java new file mode 100644 index 00000000..f244ec3a --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioPostoRiscoData.java @@ -0,0 +1,25 @@ +/* +* HsRelatorioPostoRiscoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsRelatorioPostoRiscoData extends siprp.data.inner.HsRelatorioPostoRisco +{ + + public HsRelatorioPostoRiscoData() + { + super(); + } + + @Override + public String toString() + { + return toRisco_id().getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioRiscoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioRiscoData.java new file mode 100644 index 00000000..862fedc7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioRiscoData.java @@ -0,0 +1,25 @@ +/* +* HsRelatorioRiscoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsRelatorioRiscoData extends siprp.data.inner.HsRelatorioRisco +{ + + public HsRelatorioRiscoData() + { + super(); + } + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioRiscoValorQualitativoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioRiscoValorQualitativoData.java new file mode 100644 index 00000000..055a1d31 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRelatorioRiscoValorQualitativoData.java @@ -0,0 +1,25 @@ +/* +* HsRelatorioRiscoValorQualitativoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsRelatorioRiscoValorQualitativoData extends siprp.data.inner.HsRelatorioRiscoValorQualitativo +{ + + public HsRelatorioRiscoValorQualitativoData() + { + super(); + } + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRiscoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRiscoData.java new file mode 100644 index 00000000..9c5d0a4b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRiscoData.java @@ -0,0 +1,25 @@ +/* +* HsRiscoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsRiscoData extends siprp.data.inner.HsRisco +{ + + public HsRiscoData() + { + super(); + } + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRiscoEmpresaData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRiscoEmpresaData.java new file mode 100644 index 00000000..49e24e56 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRiscoEmpresaData.java @@ -0,0 +1,25 @@ +/* +* HsRiscoEmpresaData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsRiscoEmpresaData extends siprp.data.inner.HsRiscoEmpresa +{ + + public HsRiscoEmpresaData() + { + super(); + } + + @Override + public String toString() + { + return super.toRisco_id().getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRiscoMedidaData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRiscoMedidaData.java new file mode 100644 index 00000000..1e37e942 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRiscoMedidaData.java @@ -0,0 +1,26 @@ +/* +* HsRiscoMedidaData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsRiscoMedidaData extends siprp.data.inner.HsRiscoMedida +{ + + public HsRiscoMedidaData() + { + super(); + } + + @Override + public String toString() + { + String d = toMedida_id() == null ? null : toMedida_id().getRequesitos_legais(); + return d == null ? " " : d.substring( 0, Math.min( 80, d.length() ) ) + "..."; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRiscoTemaData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRiscoTemaData.java new file mode 100644 index 00000000..179c1239 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/HsRiscoTemaData.java @@ -0,0 +1,25 @@ +/* +* HsRiscoTemaData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class HsRiscoTemaData extends siprp.data.inner.HsRiscoTema +{ + + public HsRiscoTemaData() + { + super(); + } + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/IdsData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/IdsData.java new file mode 100644 index 00000000..e1f9bd5f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/IdsData.java @@ -0,0 +1,18 @@ +/* +* IdsData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class IdsData extends siprp.data.inner.Ids +{ + + public IdsData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ImageData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ImageData.java new file mode 100644 index 00000000..827d71c2 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/ImageData.java @@ -0,0 +1,25 @@ +/* +* ImageData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class ImageData extends siprp.data.inner.Image +{ + + public ImageData() + { + super(); + } + + @Override + public String toString() + { + return getName() == null ? "" : getName(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/LembretesData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/LembretesData.java new file mode 100644 index 00000000..5b8cc9d1 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/LembretesData.java @@ -0,0 +1,18 @@ +/* +* LembretesData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class LembretesData extends siprp.data.inner.Lembretes +{ + + public LembretesData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/LembretesTiposData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/LembretesTiposData.java new file mode 100644 index 00000000..f8a030cf --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/LembretesTiposData.java @@ -0,0 +1,18 @@ +/* +* LembretesTiposData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class LembretesTiposData extends siprp.data.inner.LembretesTipos +{ + + public LembretesTiposData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesEmpresaData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesEmpresaData.java new file mode 100644 index 00000000..a7bc0550 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesEmpresaData.java @@ -0,0 +1,18 @@ +/* +* MarcacoesEmpresaData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class MarcacoesEmpresaData extends siprp.data.inner.MarcacoesEmpresa +{ + + public MarcacoesEmpresaData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesEstabelecimentoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesEstabelecimentoData.java new file mode 100644 index 00000000..bd22e1db --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesEstabelecimentoData.java @@ -0,0 +1,39 @@ +/* +* MarcacoesEstabelecimentoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import com.evolute.entity.evo.EvoDataObject; + +public final class MarcacoesEstabelecimentoData extends siprp.data.inner.MarcacoesEstabelecimento +{ + + public MarcacoesEstabelecimentoData() + { + super(); + } + + @Override + public String toString() + { + return DATE_FORMAT.format( getData() ); + } + + @Override + public int compareTo( EvoDataObject marcacao ) + { + if( marcacao instanceof MarcacoesEstabelecimentoData ) + { + return this.getData().compareTo( ( ( MarcacoesEstabelecimentoData) marcacao ).getData() ); + } + else + { + return super.compareTo( marcacao ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesGruposRealizadosData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesGruposRealizadosData.java new file mode 100644 index 00000000..81d764be --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesGruposRealizadosData.java @@ -0,0 +1,18 @@ +/* +* MarcacoesGruposRealizadosData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class MarcacoesGruposRealizadosData extends siprp.data.inner.MarcacoesGruposRealizados +{ + + public MarcacoesGruposRealizadosData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesTecnicosHstData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesTecnicosHstData.java new file mode 100644 index 00000000..de1f7baf --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesTecnicosHstData.java @@ -0,0 +1,24 @@ +/* +* MarcacoesTecnicosHstData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class MarcacoesTecnicosHstData extends siprp.data.inner.MarcacoesTecnicosHst +{ + + public MarcacoesTecnicosHstData() + { + super(); + } + + @Override + public String toString() + { + return getNome(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesTrabalhadorData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesTrabalhadorData.java new file mode 100644 index 00000000..1c486b49 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesTrabalhadorData.java @@ -0,0 +1,20 @@ +/* +* MarcacoesTrabalhadorData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import siprp.data.MarcacaoTrabalhadorConstants; + + +public final class MarcacoesTrabalhadorData extends siprp.data.inner.MarcacoesTrabalhador implements MarcacaoTrabalhadorConstants +{ + + public MarcacoesTrabalhadorData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesTrabalhadorEstadosData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesTrabalhadorEstadosData.java new file mode 100644 index 00000000..a03d4f87 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MarcacoesTrabalhadorEstadosData.java @@ -0,0 +1,18 @@ +/* +* MarcacoesTrabalhadorEstadosData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class MarcacoesTrabalhadorEstadosData extends siprp.data.inner.MarcacoesTrabalhadorEstados +{ + + public MarcacoesTrabalhadorEstadosData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MedicosData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MedicosData.java new file mode 100644 index 00000000..87552789 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/MedicosData.java @@ -0,0 +1,38 @@ +/* +* MedicosData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import com.evolute.entity.evo.EvoDataException; + + +public final class MedicosData extends siprp.data.inner.Medicos +{ + + public MedicosData() + { + super(); + } + + @Override + public void save() throws EvoDataException + { + if( getInactivo() == null ) + { + setInactivo( "n" ); + } + super.save(); + } + + @Override + public void delete() throws EvoDataException + { + setInactivo( "y" ); + save(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/PrestadoresData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/PrestadoresData.java new file mode 100644 index 00000000..692ec98d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/PrestadoresData.java @@ -0,0 +1,44 @@ +/* +* PrestadoresData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import java.util.List; + +import siprp.database.cayenne.objects.Prestadores; +import siprp.database.cayenne.providers.MedicinaDAO; + + +public final class PrestadoresData extends siprp.data.inner.Prestadores +{ + + public static final Prestadores prestadorNulo = new Prestadores(); + + static + { + prestadorNulo.setNome( "SIPRP" ); + } + + public PrestadoresData() + { + super(); + } + + public static List getAllPrestadores() + { + List result = new MedicinaDAO().getAllPrestadores(); + result.add( 0, prestadorNulo); + return result; + } + + @Override + public String toString() + { + return getNome(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/PrestadoresGruposProtocoloData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/PrestadoresGruposProtocoloData.java new file mode 100644 index 00000000..be21e6b7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/PrestadoresGruposProtocoloData.java @@ -0,0 +1,18 @@ +/* +* PrestadoresGruposProtocoloData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class PrestadoresGruposProtocoloData extends siprp.data.inner.PrestadoresGruposProtocolo +{ + + public PrestadoresGruposProtocoloData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/PrtElementosProtocoloData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/PrtElementosProtocoloData.java new file mode 100644 index 00000000..81857f74 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/PrtElementosProtocoloData.java @@ -0,0 +1,18 @@ +/* +* PrtElementosProtocoloData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class PrtElementosProtocoloData extends siprp.data.inner.PrtElementosProtocolo +{ + + public PrtElementosProtocoloData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/PrtGruposProtocoloData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/PrtGruposProtocoloData.java new file mode 100644 index 00000000..42cb4e8f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/PrtGruposProtocoloData.java @@ -0,0 +1,25 @@ +/* +* PrtGruposProtocoloData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class PrtGruposProtocoloData extends siprp.data.inner.PrtGruposProtocolo +{ + + public PrtGruposProtocoloData() + { + super(); + } + + @Override + public String toString() + { + return getDescricao() == null ? "" : getDescricao(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/PrtTiposElementosProtocoloData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/PrtTiposElementosProtocoloData.java new file mode 100644 index 00000000..7f0bd0b2 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/PrtTiposElementosProtocoloData.java @@ -0,0 +1,25 @@ +/* +* PrtTiposElementosProtocoloData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class PrtTiposElementosProtocoloData extends siprp.data.inner.PrtTiposElementosProtocolo +{ + + public PrtTiposElementosProtocoloData() + { + super(); + } + + @Override + public String toString() + { + return getDescricao(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TiposExamesCompData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TiposExamesCompData.java new file mode 100644 index 00000000..acfca78b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TiposExamesCompData.java @@ -0,0 +1,18 @@ +/* +* TiposExamesCompData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class TiposExamesCompData extends siprp.data.inner.TiposExamesComp +{ + + public TiposExamesCompData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresConsultasData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresConsultasData.java new file mode 100644 index 00000000..ee50d3e9 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresConsultasData.java @@ -0,0 +1,37 @@ +/* +* TrabalhadoresConsultasData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import siprp.MedicinaConstants; + + +public final class TrabalhadoresConsultasData extends siprp.data.inner.TrabalhadoresConsultas implements MedicinaConstants +{ + + public TrabalhadoresConsultasData() + { + super(); + } + + public String getEstadoString() + { + return isNew() ? isNewMessage : ((getEstado() == null || ESTADOS_CONSULTA_STR.length <= getEstado()) ? "" : ESTADOS_CONSULTA_STR[getEstado().intValue()]); + } + + public String getDataString() + { + return getData() == null ? "(sem data definida)" : DATE_FORMAT.format( getData() ); + } + + @Override + public String toString() + { + return "Consulta de " + getDataString() + ": " + getEstadoString(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresConsultasDatasData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresConsultasDatasData.java new file mode 100644 index 00000000..367fb8b4 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresConsultasDatasData.java @@ -0,0 +1,59 @@ +/* +* TrabalhadoresConsultasDatasData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import java.util.Date; + +import siprp.MedicinaConstants; + + +public final class TrabalhadoresConsultasDatasData extends siprp.data.inner.TrabalhadoresConsultasDatas implements MedicinaConstants +{ + + public TrabalhadoresConsultasDatasData() + { + super(); + } + + public String getDataString() + { + return getData() == null ? "" : DATE_FORMAT.format( getData() ); + } + + public String getEstadoString() + { + return getEstado() == null || getEstado() >= ESTADOS_CONSULTA_STR.length ? "" : ESTADOS_CONSULTA_STR[ getEstado() ]; + } + + @Override + public String toString() + { + return getDataString() + ": " + getEstadoString(); + } + + @Override + public void setData( Date date ) + { + if( date != null && this.toTrabalhadores_consultas_id() != null && this.getEstado() != null && new Integer(ESTADO_POR_REALIZAR).equals(this.getEstado())) + { + toTrabalhadores_consultas_id().setData( date ); + } + super.setData( date ); + } + + @Override + public void setEstado( Integer estado ) + { + if( estado != null && toTrabalhadores_consultas_id() != null && (new Integer(ESTADO_POR_REALIZAR).equals( this.getEstado() ) || new Integer(ESTADO_POR_REALIZAR).equals( estado ))) + { + toTrabalhadores_consultas_id().setEstado( !(estado.equals( ESTADO_POR_REALIZAR ) || estado.equals( ESTADO_REALIZADO )) ? ESTADO_POR_MARCAR : estado ); + } + super.setEstado( estado ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresConsultasDatasEmailsData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresConsultasDatasEmailsData.java new file mode 100644 index 00000000..2257dafb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresConsultasDatasEmailsData.java @@ -0,0 +1,30 @@ +/* +* TrabalhadoresConsultasDatasEmailsData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class TrabalhadoresConsultasDatasEmailsData extends siprp.data.inner.TrabalhadoresConsultasDatasEmails +{ + + public TrabalhadoresConsultasDatasEmailsData() + { + super(); + } + + public String getDataString() + { + return getData() == null ? "" : DATE_FORMAT.format( getData() ); + } + + @Override + public String toString() + { + return getSubject(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresConsultasDatasObservacoesData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresConsultasDatasObservacoesData.java new file mode 100644 index 00000000..fb9d6b76 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresConsultasDatasObservacoesData.java @@ -0,0 +1,25 @@ +/* +* TrabalhadoresConsultasDatasObservacoesData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class TrabalhadoresConsultasDatasObservacoesData extends siprp.data.inner.TrabalhadoresConsultasDatasObservacoes +{ + + public TrabalhadoresConsultasDatasObservacoesData() + { + super(); + } + + @Override + public String toString() + { + return getObservacao(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresData.java new file mode 100644 index 00000000..f72ad4df --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresData.java @@ -0,0 +1,65 @@ +/* +* TrabalhadoresData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import siprp.database.cayenne.objects.TrabalhadoresProcesso; + +import com.evolute.entity.evo.EvoDataException; + + +public final class TrabalhadoresData extends siprp.data.inner.Trabalhadores +{ + + public TrabalhadoresData() + { + super(); + } + + public String getDataNascimentoString() + { + return getData_nascimento() == null ? "" : DATE_FORMAT.format( getData_nascimento() ); + } + + @Override + public void save() throws EvoDataException + { + if( getInactivo() == null ) + { + setInactivo( "n" ); + } + setActualizacao( new Timestamp(System.currentTimeMillis() ) ); + super.save(); + } + + @Override + public void delete() throws EvoDataException + { + setInactivo( "y" ); + save(); + } + + public HashMap getSexos() + { + HashMap result = new HashMap(); + result.put("f", "Feminino"); + result.put( "m", "Masculino" ); + return result; + } + + @Override + public String toString() + { + return getNome(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdData.java new file mode 100644 index 00000000..d56a60df --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdData.java @@ -0,0 +1,36 @@ +/* +* TrabalhadoresEcdData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class TrabalhadoresEcdData extends siprp.data.inner.TrabalhadoresEcd +{ + + public TrabalhadoresEcdData() + { + super(); + } + + @Override + public String toString() + { + PrtTiposElementosProtocoloData exame = toEcd_id(); + String exameNome = exame == null ? null : exame.getDescricao(); + EcdOficialData exameOficial = toEcd_oficial_id(); + String exameOficialNome = exameOficial == null ? null : exameOficial.getDescricao(); + String result = ""; + if(exameNome == null && exameOficialNome != null) + { + result = exameOficialNome + " [oficial]"; + }else if( exameNome != null ) + { + result = exameNome; + } + return result; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdsAnaliseData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdsAnaliseData.java new file mode 100644 index 00000000..72a1955c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdsAnaliseData.java @@ -0,0 +1,18 @@ +/* +* TrabalhadoresEcdsAnaliseData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class TrabalhadoresEcdsAnaliseData extends siprp.data.inner.TrabalhadoresEcdsAnalise +{ + + public TrabalhadoresEcdsAnaliseData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdsData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdsData.java new file mode 100644 index 00000000..930d74b1 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdsData.java @@ -0,0 +1,182 @@ +/* +* TrabalhadoresEcdsData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import siprp.MedicinaConstants; + +import com.evolute.adt.OrderedMap; + + +public final class TrabalhadoresEcdsData extends siprp.data.inner.TrabalhadoresEcds implements MedicinaConstants +{ + + public TrabalhadoresEcdsData() + { + super(); + } + public String getDataString() + { + return getData() == null ? "(sem data definida)" : DATE_FORMAT.format( getData() ); + } + + public String getEstadoString() + { + return isNew() ? isNewMessage : (getEstado() == null || getEstado() >= ESTADOS_EXAME_STR.length ? "" : ESTADOS_EXAME_STR[getEstado()]); + } + + public HashMap getEstados() + { + HashMap result = new HashMap(); + for( int i = 0; i < ESTADOS_EXAME_STR.length; ++i ) + { + if( ESTADOS_EXAME_STR[i] != null ) + { + result.put( new Integer( i ), ESTADOS_EXAME_STR[i] ); + } + } + return result; + } + + @Override + public String toString() + { + return getDataString() + ": " + getEstadoString(); + } + + public OrderedMap getGruposExamesForPerfil() + { + OrderedMap grupos = new OrderedMap(); + + TrabalhadoresData trabalhador = this.toTrabalhador_id(); + Integer perfil = trabalhador.getPerfil(); + if( perfil != null ) + { + EmpresasData empresa = trabalhador.toEstabelecimento_id().toEmpresa_id(); + List ecdsPerfil = empresa.fromPrtElementosProtocolo_empresa_id(); + for( PrtElementosProtocoloData ecdPerfil : ecdsPerfil ) + { + if( perfil.equals( ecdPerfil.getNumero_perfil() ) ) + { + PrtTiposElementosProtocoloData ecd = ecdPerfil.toTipo_elemento_protocolo_id(); + if( ecd != null ) + { + PrtGruposProtocoloData grupoEcd = ecd.toGrupo_protocolo_id(); + if( grupoEcd != null ) + { + String descricao = grupoEcd.getDescricao(); + if( descricao != null && !grupos.containsKey( grupoEcd ) ) + { + grupos.putLast( grupoEcd, descricao ); + Integer estado = getEstadoForGrupoEcd( grupoEcd ); + grupos.putLast( grupoEcd, estado != null ? MedicinaConstants.ESTADOS_EXAME_STR[estado] : " " ); + } + } + } + } + } + } + List estados = new ArrayList(); + List marcacoes = fromTrabalhadoresEcdsDatas_trabalhadores_ecds_id(); + if( marcacoes != null ) + { + for( TrabalhadoresEcdsDatasData marcacao : marcacoes ) + { + Integer estado = marcacao.getEstado(); + if( !estados.contains( estado ) ) + { + estados.add( estado ); + } + } + } + if( estados.size() == 1 ) + { +// if( estadosSoFar.contains( new Integer( ESTADO_ANULADO ) ) || estadosSoFar.contains( new Integer( ESTADO_REALIZADO ) ) ) +// { + setEstado( estados.get( 0 ) ); +// } +// else if( estadosSoFar.contains( new Integer( ESTADO_POR_REALIZAR ) ) ) +// { +// setEstado( ESTADO_POR_REALIZAR ); +// } +// else +// { +// setEstado( ESTADO_POR_MARCAR ); +// } + } + else if( estados.size() == 2 ) + { + if( estados.contains( new Integer( ESTADO_ANULADO ) ) && estados.contains( new Integer( ESTADO_REALIZADO ) ) ) + { + setEstado( ESTADO_REALIZADO ); + } + else if( estados.contains( new Integer( ESTADO_POR_MARCAR ) ) ) + { + setEstado( ESTADO_POR_MARCAR ); + } + else if( estados.contains( new Integer( ESTADO_ANULADO ) ) || estados.contains( new Integer( ESTADO_REALIZADO ) ) ) + { + setEstado( ESTADO_PARCIALMENTE_REALIZADO ); + } + else + { + setEstado( ESTADO_POR_REALIZAR ); + } + } + else + { + if( estados.contains( new Integer( ESTADO_POR_MARCAR ) ) ) + { + setEstado( ESTADO_POR_MARCAR ); + } + else if( estados.contains( new Integer( ESTADO_ANULADO ) ) && estados.contains( new Integer( ESTADO_REALIZADO ) ) ) + { + setEstado( ESTADO_PARCIALMENTE_REALIZADO ); + } + else + { + setEstado( ESTADO_POR_REALIZAR ); + } + } + grupos.order(); + return grupos; + } + + private Integer getEstadoForGrupoEcd( PrtGruposProtocoloData grupoEcd ) + { + Integer estado = null; + List marcacoes = fromTrabalhadoresEcdsDatas_trabalhadores_ecds_id(); + if( marcacoes != null ) + { + for( TrabalhadoresEcdsDatasData marcacao : marcacoes ) + { + List ecds = marcacao.fromTrabalhadoresEcd_trabalhadores_ecds_datas_id(); + for( TrabalhadoresEcdData ecd : ecds ) + { + if( ecd.toEcd_id().toGrupo_protocolo_id().equals( grupoEcd ) ) + { + if( new Integer( ESTADO_REALIZADO ).equals( ecd.getEstado() ) || new Integer( ESTADO_ANULADO ).equals( ecd.getEstado() ) ) + { + return ecd.getEstado(); + } + else if( new Integer( ESTADO_POR_REALIZAR ).equals( ecd.getEstado() ) ) + { + estado = ecd.getEstado(); + break; + } + } + } + } + } + return estado == null ? ESTADO_POR_MARCAR : estado; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdsDatasData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdsDatasData.java new file mode 100644 index 00000000..1ec391d7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdsDatasData.java @@ -0,0 +1,215 @@ +/* +* TrabalhadoresEcdsDatasData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import siprp.MedicinaConstants; + +import com.evolute.adt.OrderedMap; + + +public final class TrabalhadoresEcdsDatasData extends siprp.data.inner.TrabalhadoresEcdsDatas implements MedicinaConstants +{ + + public TrabalhadoresEcdsDatasData() + { + super(); + } + + public String getDataString() + { + return getData() == null ? "" : DATE_FORMAT.format( getData() ); + } + + public String getEstadoString() + { + return getEstado() == null || getEstado() >= ESTADOS_EXAME_STR.length ? "" : ESTADOS_EXAME_STR[getEstado()]; + } + + public HashMap getEstados() + { + HashMap result = new HashMap(); + for( int i = 0; i < ESTADOS_EXAME_STR.length; ++i ) + { + if( ESTADOS_EXAME_STR[i] != null ) + { + result.put( new Integer( i ), ESTADOS_EXAME_STR[i] ); + } + } + return result; + } + + @Override + public void setData( Date date ) + { + if( date != null && this.toTrabalhadores_ecds_id() != null && this.getEstado() != null && new Integer( ESTADO_POR_REALIZAR ).equals( this.getEstado() ) ) + { + this.toTrabalhadores_ecds_id().setData( date ); + } + super.setData( date ); + } + + @Override + public String toString() + { + return getDataString() + ": " + getEstadoString(); + } + + public OrderedMap getStatesForeGruposExames() + { + OrderedMap grupos = new OrderedMap(); + List exames = this.fromTrabalhadoresEcd_trabalhadores_ecds_datas_id(); + if( exames != null ) + { + for( TrabalhadoresEcdData exame : exames ) + { + String estadoString = MedicinaConstants.ESTADOS_EXAME_STR[exame.getEstado()]; + PrtGruposProtocoloData grupo = exame.toEcd_id().toGrupo_protocolo_id(); + if( !grupos.containsKey( grupo ) ) + { + grupos.putLast( grupo, grupo.getDescricao() ); + grupos.putLast( grupo, estadoString ); + } + } + } + grupos.order(); + return grupos; + } + + private List getAllEcdForGrupoForThisMarcacao( PrtGruposProtocoloData grupo ) + { + List result = new ArrayList(); + for( TrabalhadoresEcdData ecd : (List) fromTrabalhadoresEcd_trabalhadores_ecds_datas_id() ) + { + if( grupo.equals( ecd.toEcd_id().toGrupo_protocolo_id() ) ) + { + result.add( ecd.toEcd_id() ); + } + } + return result; + } + + private List getAllEcdForGrupoAndCurrentPerfil( PrtGruposProtocoloData grupo ) + { + TrabalhadoresData trabalhador = toTrabalhadores_ecds_id().toTrabalhador_id(); + List result = new ArrayList(); + Integer perfil = trabalhador.getPerfil(); + if( perfil != null ) + { + EmpresasData empresa = trabalhador.toEstabelecimento_id().toEmpresa_id(); + List ecdsPerfil = empresa.fromPrtElementosProtocolo_empresa_id(); + for( PrtElementosProtocoloData ecdPerfil : ecdsPerfil ) + { + if( perfil.equals( ecdPerfil.getNumero_perfil() ) ) + { + PrtTiposElementosProtocoloData ecd = ecdPerfil.toTipo_elemento_protocolo_id(); + if( ecd != null ) + { + if( ecd.toGrupo_protocolo_id().equals( grupo ) && !result.contains( ecd ) ) + { + result.add( ecd ); + } + } + } + } + } + return result; + } + + public void marcarGrupoExames( PrtGruposProtocoloData grupo ) + { + for( PrtTiposElementosProtocoloData ecd : getAllEcdForGrupoAndCurrentPerfil( grupo ) ) + { + TrabalhadoresEcdData trabEcd = new TrabalhadoresEcdData(); + trabEcd.setEstado( MedicinaConstants.ESTADO_POR_REALIZAR ); + trabEcd.setToEcd_id( ecd ); + trabEcd.setToTrabalhadores_ecds_datas_id( this ); + } + toTrabalhadores_ecds_id().getGruposExamesForPerfil(); + } + + public void setStateForGrupoProtocolo( PrtGruposProtocoloData grupo, Integer estado ) + { + List group = getAllEcdForGrupoForThisMarcacao( grupo ); + for(TrabalhadoresEcdData ecd : fromTrabalhadoresEcd_trabalhadores_ecds_datas_id()) + { + if( group.contains( ecd.toEcd_id() ) ) + { + ecd.setEstado( estado ); + } + } + } + + public void setStateForGrupoProtocolo( PrtGruposProtocoloData grupo, String estado ) + { + for( int i = 0; i < ESTADOS_EXAME_STR.length; ++i ) + { + String currentEstado = ESTADOS_EXAME_STR[i]; + if( currentEstado != null && new Integer( i ).equals( estado ) ) + { + setStateForGrupoProtocolo( grupo, i ); + break; + } + } + } + + public void anular() + { + setEstadoForAllEcd( MedicinaConstants.ESTADO_ANULADO ); + } + + public void realizar() + { + setEstadoForAllEcd( MedicinaConstants.ESTADO_REALIZADO ); + } + + public void porRealizar() + { + setEstadoForAllEcd( MedicinaConstants.ESTADO_POR_REALIZAR ); + } + + public void desmarcarSIPRP() + { + setEstadoForAllEcd( MedicinaConstants.ESTADO_DESMARCADO_EMPRESA ); + } + + public void desmarcarTrabalhador() + { + setEstadoForAllEcd( MedicinaConstants.ESTADO_DESMARCADO_TRABALHADOR ); + } + + public void faltou() + { + setEstadoForAllEcd( MedicinaConstants.ESTADO_FALTOU ); + } + + public void setEstadoForAllEcd( Integer estado ) + { + List allEcd = fromTrabalhadoresEcd_trabalhadores_ecds_datas_id(); + if(allEcd != null) + { + for(TrabalhadoresEcdData ecd : allEcd ) + { + ecd.setEstado( estado ); + } + } + super.setEstado( estado ); + toTrabalhadores_ecds_id().getGruposExamesForPerfil(); + } + + @Override + public void setEstado( Integer estado ){ + super.setEstado( estado ); + toTrabalhadores_ecds_id().getGruposExamesForPerfil(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdsDatasEmailsData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdsDatasEmailsData.java new file mode 100644 index 00000000..37e38e6f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdsDatasEmailsData.java @@ -0,0 +1,24 @@ +/* +* TrabalhadoresEcdsDatasEmailsData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class TrabalhadoresEcdsDatasEmailsData extends siprp.data.inner.TrabalhadoresEcdsDatasEmails +{ + + public TrabalhadoresEcdsDatasEmailsData() + { + super(); + } + + @Override + public String toString() + { + return getSubject(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdsDatasObservacoesData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdsDatasObservacoesData.java new file mode 100644 index 00000000..d0903657 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresEcdsDatasObservacoesData.java @@ -0,0 +1,25 @@ +/* +* TrabalhadoresEcdsDatasObservacoesData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class TrabalhadoresEcdsDatasObservacoesData extends siprp.data.inner.TrabalhadoresEcdsDatasObservacoes +{ + + public TrabalhadoresEcdsDatasObservacoesData() + { + super(); + } + + @Override + public String toString() + { + return getObservacao(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresFichasAptidaoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresFichasAptidaoData.java new file mode 100644 index 00000000..6c930031 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresFichasAptidaoData.java @@ -0,0 +1,66 @@ +/* +* TrabalhadoresFichasAptidaoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import java.util.Date; + + +public final class TrabalhadoresFichasAptidaoData extends siprp.data.inner.TrabalhadoresFichasAptidao +{ + + public TrabalhadoresFichasAptidaoData() + { + super(); + } + + @Override + public String toString() + { + String result = ""; + ExamesData exame = toExame_id(); + if( exame != null ) + { + Date data = exame.getProximo_exame(); + if( data != null ) + { + result = DATE_FORMAT.format( data ); + } + } + return result + ": " + getEstadoString(); + } + + private String getEstadoString() + { + String result = ""; + ExamesData exame = toExame_id(); + if( exame != null ) + { + Integer resultadoCodigo = exame.getResultado(); + if( resultadoCodigo != null ) + { + switch( resultadoCodigo.intValue() ) + { + case 1: + result += "Apto"; + break; + case 2: + result += "Apto (cond)"; + break; + case 3: + result += "Inapto (temp)"; + break; + case 4: + result += "Inapto (def)"; + break; + } + } + } + return result; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresProcessoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresProcessoData.java new file mode 100644 index 00000000..e7791216 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/TrabalhadoresProcessoData.java @@ -0,0 +1,77 @@ +/* +* TrabalhadoresProcessoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + +import java.util.HashMap; + +import siprp.MedicinaConstants; +import siprp.ProcessoConstants; + + +public final class TrabalhadoresProcessoData extends siprp.data.inner.TrabalhadoresProcesso implements ProcessoConstants +{ + + public TrabalhadoresProcessoData() + { + super(); + } + +private static final HashMap MOTIVOS_BY_ID = new HashMap(); + + static + { + MOTIVOS_BY_ID.put( MedicinaConstants.MOTIVO_ADMISSAO_INTEGER, MedicinaConstants.MOTIVO_ADMISSAO_STR ); + MOTIVOS_BY_ID.put( MedicinaConstants.MOTIVO_PERIODICO_INTEGER, MedicinaConstants.MOTIVO_PERIODICO_STR ); + MOTIVOS_BY_ID.put( MedicinaConstants.MOTIVO_OCASIONAL_INTEGER, MedicinaConstants.MOTIVO_OCASIONAL_STR ); + MOTIVOS_BY_ID.put( MedicinaConstants.MOTIVO_PERIODICO_INICIAL_INTEGER, MedicinaConstants.MOTIVO_PERIODICO_INICIAL_STR ); + } + + private String getDescricaoEstadoProcessoByCodigo() + { + return ESTADO_PROCESSO_BY_CODE.get( getEstado() ); + } + + private String getMotivoString() + { + return getMotivo() == null ? "" : MOTIVOS_BY_ID.get( getMotivo() ); + } + + @Override + public String toString() + { + return getMotivoString() + " : " + getDescricaoEstadoProcessoByCodigo(); + } + + public HashMap getEstados() + { + HashMap result = new HashMap(); + result.put( PROCESSO_ABERTO_CODE, PROCESSO_ABERTO_DESCRIPTION ); + result.put( PROCESSO_CANCELADO_CODE, PROCESSO_CANCELADO_DESCRIPTION ); + result.put( PROCESSO_FECHADO_CODE, PROCESSO_FECHADO_DESCRIPTION ); + return result; + } + + public HashMap getMotivos() + { + HashMap result = new HashMap(); + result.put( MedicinaConstants.MOTIVO_ADMISSAO_INTEGER, MedicinaConstants.MOTIVO_ADMISSAO_STR); + result.put( MedicinaConstants.MOTIVO_OCASIONAL_INTEGER, MedicinaConstants.MOTIVO_OCASIONAL_STR); + result.put( MedicinaConstants.MOTIVO_PERIODICO_INICIAL_INTEGER, MedicinaConstants.MOTIVO_PERIODICO_INICIAL_STR); + result.put( MedicinaConstants.MOTIVO_PERIODICO_INTEGER, MedicinaConstants.MOTIVO_PERIODICO_STR); + return result; + } + + public boolean isEmpty() + { + boolean noConsultas = fromTrabalhadoresConsultas_processo_id().isEmpty(); + boolean noExames= fromTrabalhadoresEcds_processo_id().isEmpty(); + boolean noFicha = fromTrabalhadoresFichasAptidao_processo_id().isEmpty(); + return noConsultas && noExames && noFicha; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/VersaoData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/VersaoData.java new file mode 100644 index 00000000..671f4446 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/VersaoData.java @@ -0,0 +1,18 @@ +/* +* VersaoData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class VersaoData extends siprp.data.inner.Versao +{ + + public VersaoData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/VersionData.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/VersionData.java new file mode 100644 index 00000000..1d700170 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/outer/VersionData.java @@ -0,0 +1,18 @@ +/* +* VersionData.java +* +* Generated by com.evutils.codegen.EntityObjectGenerator +* +* Edit at will +*/ +package siprp.data.outer; + + +public final class VersionData extends siprp.data.inner.Version +{ + + public VersionData() + { + super(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/data/provider/MedicinaProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/data/provider/MedicinaProvider.java new file mode 100644 index 00000000..b0ce8c31 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/data/provider/MedicinaProvider.java @@ -0,0 +1,6 @@ +package siprp.data.provider; + + +public class MedicinaProvider +{ +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Avisos.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Avisos.java new file mode 100755 index 00000000..a63e2c0a --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Avisos.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._Avisos; + +public class Avisos extends _Avisos { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/BaseObject.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/BaseObject.java new file mode 100644 index 00000000..57b28d71 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/BaseObject.java @@ -0,0 +1,205 @@ +package siprp.database.cayenne.objects; + +import java.lang.reflect.Method; +import java.text.DateFormat; +import java.util.Date; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import org.apache.cayenne.CayenneDataObject; +import org.apache.cayenne.ObjectId; +import org.apache.cayenne.PersistenceState; + +import siprp.database.cayenne.providers.MainDAO; + +import com.evolute.utils.strings.StringPlainer; +import com.evolute.utils.strings.UnicodeChecker; + +public class BaseObject extends CayenneDataObject implements Comparable +{ + + static { + UnicodeChecker.setUseDoubleSlash( true ); + } + + private static final long serialVersionUID = 1L; + + protected static MainDAO dao = new MainDAO(); + + public static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); + + protected static final String isNewMessage = " "; + + public boolean isTransient() + { + return getPersistenceState() == PersistenceState.TRANSIENT; + } + + public boolean isNew() + { + return getPersistenceState() == PersistenceState.NEW; + } + + public boolean isCommited() + { + return getPersistenceState() == PersistenceState.COMMITTED; + } + + public boolean isModified() + { + return getPersistenceState() == PersistenceState.MODIFIED; + } + + public void commit() + { + dao.commit(); + } + + public void rollback() + { + dao.rollback(); + } + + public void save() throws Exception + { + if( isTransient() ) + { + dao.getContext().registerNewObject( this ); + } + commit(); + } + + private boolean hasDeletedDate() + { + boolean result = false; + try { + result = getClass().getField("DELETED_DATE_PROPERTY") != null; + } catch (SecurityException e) { + } catch (NoSuchFieldException e) { + } + return result; + } + + public void delete() throws Exception + { + if( hasDeletedDate() ) + { + writeProperty( "deletedDate", new Date() ); + } + else + { + dao.getContext().deleteObject( this ); + } + commit(); + } + + protected String parseToUnicode( String string ) + { + String result = string == null ? null : UnicodeChecker.parseToUnicode( string ); + return result == null ? null : result.replaceAll( "\\\\\\\\", "\\\\" ); + } + + protected String parseFromUnicode( String string ) + { + return string == null ? null : UnicodeChecker.parseFromUnicode( string ); + } + + @Override + public int compareTo( BaseObject object ) + { + int result = 0; + if( dao.hasOrder( this ) && dao.hasOrder( object ) ) + { + Object o1 = this.readProperty( "ordem" ); + o1 = o1 != null ? o1 : this.readProperty( "order" ); + if( o1 != null && (o1 instanceof Integer) ) + { + Object o2 = object.readProperty( "ordem" ); + o2 = o2 != null ? o2 : object.readProperty( "order" ); + if( o2 != null && (o2 instanceof Integer) ) + { + result = ((Integer)o1).compareTo( (Integer)o2 ); + } + } + } + if( result == 0 ) + { + result = StringPlainer.convertString( this.toString() ).compareTo( object == null ? null : StringPlainer.convertString( object.toString() ) ); + } + return result; + } + + private boolean isRelational( OBJ_CLASS object ) + { + boolean result = false; + ObjectId id = object.getObjectId(); + if( id != null && !id.isTemporary() ) + { + Map ids = id.getIdSnapshot(); + if( ids != null && ids.size() == 2 ) + { + result = true; + } + } + return result; + } + + private boolean isRelDeleted( OBJ_CLASS object ) + { + boolean result = false; + if( object != null ) + { + for( Method method : object.getClass().getMethods() ) + { + if( method.getName().startsWith("getTo") ) + { + try + { + Object returned = method.invoke(object); + if( returned != null && (returned instanceof BaseObject ) ) + { + result |= null != ((BaseObject)returned).readProperty("deletedDate"); + } + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + } + return result; + } + + @Override + public Object readProperty(String propertyName) { + return (propertyName != null && propertyName.endsWith("Array") ) ? getReferringObjects(propertyName) : super.readProperty(propertyName); + } + + @SuppressWarnings("unchecked") + private List getReferringObjects( String arrayProperty ) + { + List result = (List) super.readProperty(arrayProperty); + List toDelete = new LinkedList(); + Boolean isRel = null; + for( OBJ_CLASS o : result ) + { + if( isRel == null ) + { + isRel = isRelational( o ); + } + if( null != o.readProperty( "deletedDate" ) || isRel && isRelDeleted(o) ) + { + toDelete.add(o); + } + } + for( OBJ_CLASS o : toDelete ) + { + result.remove(o); + } + return result; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Contactos.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Contactos.java new file mode 100755 index 00000000..f6b9d07e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Contactos.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._Contactos; + +public class Contactos extends _Contactos { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/EcdOficial.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/EcdOficial.java new file mode 100755 index 00000000..2f0165a2 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/EcdOficial.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._EcdOficial; + +public class EcdOficial extends _EcdOficial { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/EmailPlanoDeActuacao.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/EmailPlanoDeActuacao.java new file mode 100644 index 00000000..18d134dd --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/EmailPlanoDeActuacao.java @@ -0,0 +1,12 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._EmailPlanoDeActuacao; + +public class EmailPlanoDeActuacao extends _EmailPlanoDeActuacao { + + @Override + public String toString() + { + return getDescription() == null ? "" : getDescription(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Empresas.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Empresas.java new file mode 100755 index 00000000..6ef38306 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Empresas.java @@ -0,0 +1,48 @@ +package siprp.database.cayenne.objects; + +import java.util.Collections; +import java.util.List; + +import siprp.database.cayenne.objects.auto._Empresas; + +public class Empresas extends _Empresas { + private static final long serialVersionUID = 1L; + + @Override + public String getDesignacaoSocial() + { + return parseFromUnicode( super.getDesignacaoSocial() ); + } + + @Override + public void setDesignacaoSocial( String nome ) + { + super.setDesignacaoSocial( parseToUnicode( nome ) ); + } + + @Override + public String toString() + { + return getDesignacaoSocial(); + } + + @Override + public List getEstabelecimentosArray() + { + List result = super.getEstabelecimentosArray(); + for(int i = 0; i < result.size(); ++i) + { + Estabelecimentos current = result.get(i); + if( current == null || "y".equals(current.getInactivo())) + { + result.remove( i ); + --i; + } + } + Collections.sort(result); + return result; + } +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Errors.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Errors.java new file mode 100755 index 00000000..33328746 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Errors.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._Errors; + +public class Errors extends _Errors { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Estabelecimentos.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Estabelecimentos.java new file mode 100755 index 00000000..985ce620 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Estabelecimentos.java @@ -0,0 +1,83 @@ +package siprp.database.cayenne.objects; + +import java.util.Collections; +import java.util.List; + +import siprp.database.cayenne.objects.auto._Estabelecimentos; + +public class Estabelecimentos extends _Estabelecimentos +{ + + private static final long serialVersionUID = 1L; + + private String name = null; + + private String convertedName = null; + + @Override + public String getNome() + { + String currentName = super.getNome(); + if( name == null || !name.equals( currentName ) ) + { + name = currentName; + convertedName = null; + } + return convertName(); + } + + @Override + public void setNome( String nome ) + { + super.setNome( parseToUnicode( name ) ); + getNome(); + } + + private String convertName() + { + if( name == null ) + { + convertedName = null; + } + else + { + convertedName = parseFromUnicode( name ); + } + return convertedName; + } + + @Override + public String toString() + { + return getNome(); + } + + @Override + public List getTrabalhadoresArray() + { + List result = super.getTrabalhadoresArray(); + for(int i = 0; i < result.size(); ++i) + { + Trabalhadores current = result.get(i); + if( current == null || "y".equals(current.getInactivo())) + { + result.remove( i ); + --i; + } + } + Collections.sort( result ); + return result; + } + + @Override + public List getMarcacoesEstabelecimentoArray() + { + List result = super.getMarcacoesEstabelecimentoArray(); + if( result != null ) + { + Collections.sort( result ); + } + return result; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Etiquetas.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Etiquetas.java new file mode 100755 index 00000000..9a4d5db4 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Etiquetas.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._Etiquetas; + +public class Etiquetas extends _Etiquetas { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Exames.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Exames.java new file mode 100755 index 00000000..01088501 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Exames.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._Exames; + +public class Exames extends _Exames { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/ExamesPerfis.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/ExamesPerfis.java new file mode 100755 index 00000000..07fb3d45 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/ExamesPerfis.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._ExamesPerfis; + +public class ExamesPerfis extends _ExamesPerfis { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/ExamesPortaria.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/ExamesPortaria.java new file mode 100755 index 00000000..092955df --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/ExamesPortaria.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._ExamesPortaria; + +public class ExamesPortaria extends _ExamesPortaria { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HistoricoEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HistoricoEstabelecimento.java new file mode 100755 index 00000000..56268fe4 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HistoricoEstabelecimento.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HistoricoEstabelecimento; + +public class HistoricoEstabelecimento extends _HistoricoEstabelecimento { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsArea.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsArea.java new file mode 100644 index 00000000..8a4972ef --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsArea.java @@ -0,0 +1,46 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsArea; + +public class HsArea extends _HsArea { + + private static final long serialVersionUID = 1L; + + @Override + public String getDescription() + { + return parseFromUnicode( super.getDescription() ); + } + + @Override + public void setDescription( String nome ) + { + super.setDescription( parseToUnicode( nome ) ); + } + + @Override + public void save() throws Exception + { + Empresas empresa = getToEmpresas(); + if( empresa != null ) + { + Integer maxOrder = 0; + for( HsArea area : empresa.getHsAreaArray() ) + { + Integer currentOrder = area.getOrder(); + if( currentOrder != null ) + { + maxOrder = Math.max( currentOrder, maxOrder ); + } + } + this.setOrder( maxOrder + 1 ); + } + super.save(); + } + + @Override + public String toString() + { + return getDescription(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsEmail.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsEmail.java new file mode 100644 index 00000000..0621c049 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsEmail.java @@ -0,0 +1,26 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsEmail; + +public class HsEmail extends _HsEmail { + + private static final long serialVersionUID = 1L; + + @Override + public String getEmail() + { + return parseFromUnicode( super.getEmail() ); + } + + @Override + public void setEmail( String nome ) + { + super.setEmail( parseToUnicode( nome ) ); + } + + @Override + public String toString() + { + return getEmail(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsEmailEmpresa.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsEmailEmpresa.java new file mode 100644 index 00000000..dfb9395f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsEmailEmpresa.java @@ -0,0 +1,15 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsEmailEmpresa; + +public class HsEmailEmpresa extends _HsEmailEmpresa { + + private static final long serialVersionUID = 1L; + + @Override + public String toString() + { + return getToHsEmail().toString(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsEmailEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsEmailEstabelecimento.java new file mode 100644 index 00000000..5a84acb4 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsEmailEstabelecimento.java @@ -0,0 +1,15 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsEmailEstabelecimento; + +public class HsEmailEstabelecimento extends _HsEmailEstabelecimento { + + private static final long serialVersionUID = 1L; + + @Override + public String toString() + { + return getToHsEmail().toString(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsEquipamento.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsEquipamento.java new file mode 100644 index 00000000..4c597f8c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsEquipamento.java @@ -0,0 +1,54 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsEquipamento; + +public class HsEquipamento extends _HsEquipamento { + + private static final long serialVersionUID = 1L; + + @Override + public String getTipo() + { + return parseFromUnicode( super.getTipo() ); + } + + @Override + public void setTipo( String nome ) + { + super.setTipo( parseToUnicode( nome ) ); + } + + @Override + public String getMarca() + { + return parseFromUnicode( super.getMarca() ); + } + + @Override + public void setMarca( String marca ) + { + super.setMarca( parseToUnicode( marca ) ); + } + + @Override + public String getModelo() + { + return parseFromUnicode( super.getModelo() ); + } + + @Override + public void setModelo( String modelo ) + { + super.setModelo( parseToUnicode( modelo ) ); + } + + @Override + public String toString() + { + String marca = getMarca() == null ? "" : getMarca(); + String modelo = getModelo() == null ? "" : getModelo(); + return getTipo() + ": " + marca + "-" + modelo; + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsLegislacao.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsLegislacao.java new file mode 100644 index 00000000..75bfae4f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsLegislacao.java @@ -0,0 +1,27 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsLegislacao; + +public class HsLegislacao extends _HsLegislacao { + + private static final long serialVersionUID = 1L; + + @Override + public String getDescription() + { + return parseFromUnicode( super.getDescription() ); + } + + @Override + public void setDescription( String nome ) + { + super.setDescription( parseToUnicode( nome ) ); + } + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsLegislacaoCategoria.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsLegislacaoCategoria.java new file mode 100644 index 00000000..dcfbc2b3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsLegislacaoCategoria.java @@ -0,0 +1,26 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsLegislacaoCategoria; + +public class HsLegislacaoCategoria extends _HsLegislacaoCategoria { + + private static final long serialVersionUID = 1L; + + @Override + public String getDescription() + { + return parseFromUnicode( super.getDescription() ); + } + + @Override + public void setDescription( String nome ) + { + super.setDescription( parseToUnicode( nome ) ); + } + + @Override + public String toString() + { + return getDescription(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsLegislacaoEmpresa.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsLegislacaoEmpresa.java new file mode 100644 index 00000000..1e150cc6 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsLegislacaoEmpresa.java @@ -0,0 +1,7 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsLegislacaoEmpresa; + +public class HsLegislacaoEmpresa extends _HsLegislacaoEmpresa { + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsLegislacaoEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsLegislacaoEstabelecimento.java new file mode 100644 index 00000000..2c7b6f33 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsLegislacaoEstabelecimento.java @@ -0,0 +1,29 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsLegislacaoEstabelecimento; + +public class HsLegislacaoEstabelecimento extends _HsLegislacaoEstabelecimento { + + private static final long serialVersionUID = 1L; + + @Override + public void save() throws Exception + { + Estabelecimentos estabelecimento = getToHsEstabelecimento(); + if( estabelecimento != null ) + { + Integer maxOrder = 0; + for( HsLegislacaoEstabelecimento rel : estabelecimento.getHsLegislacaoEstabelecimentoArray() ) + { + Integer currentOrder = rel.getOrdem(); + if( currentOrder != null ) + { + maxOrder = Math.max( currentOrder, maxOrder ); + } + } + this.setOrdem( maxOrder + 1 ); + } + super.save(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsMedida.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsMedida.java new file mode 100644 index 00000000..cc748b22 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsMedida.java @@ -0,0 +1,39 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsMedida; + +public class HsMedida extends _HsMedida { + + private static final long serialVersionUID = 1L; + + @Override + public String getDescription() + { + return parseFromUnicode( super.getDescription() ); + } + + @Override + public void setDescription( String nome ) + { + super.setDescription( parseToUnicode( nome ) ); + } + + @Override + public String getRequesitosLegais() + { + return parseFromUnicode( super.getRequesitosLegais() ); + } + + @Override + public void setRequesitosLegais( String nome ) + { + super.setRequesitosLegais( parseToUnicode( nome ) ); + } + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsNormalizacao.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsNormalizacao.java new file mode 100644 index 00000000..73a1af1c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsNormalizacao.java @@ -0,0 +1,43 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsNormalizacao; + +public class HsNormalizacao extends _HsNormalizacao { + + private static final long serialVersionUID = 1L; + + private static final int TO_STRING_LENGTH = 58; + + @Override + public String getCodigo() + { + return parseFromUnicode( super.getCodigo() ); + } + + @Override + public void setCodigo( String codigo ) + { + super.setCodigo( parseToUnicode( codigo ) ); + } + + @Override + public String getDescricao() + { + return parseFromUnicode( super.getDescricao() ); + } + + @Override + public void setDescricao( String nome ) + { + super.setDescricao( parseToUnicode( nome ) ); + } + + @Override + public String toString() + { + String codigo = getCodigo(); + String descricao = getDescricao() == null ? "" : getDescricao().replaceAll( "\n", " " ); + return (codigo == null ? "" : codigo ) + ": " + ( descricao.substring( 0, Math.min( TO_STRING_LENGTH, descricao.length() ) ) + ( TO_STRING_LENGTH < descricao.length() ? "..." : "" ) ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsNormalizacaoEmpresa.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsNormalizacaoEmpresa.java new file mode 100644 index 00000000..ad8e7131 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsNormalizacaoEmpresa.java @@ -0,0 +1,7 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsNormalizacaoEmpresa; + +public class HsNormalizacaoEmpresa extends _HsNormalizacaoEmpresa { + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsNormalizacaoEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsNormalizacaoEstabelecimento.java new file mode 100644 index 00000000..68e72ee2 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsNormalizacaoEstabelecimento.java @@ -0,0 +1,7 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsNormalizacaoEstabelecimento; + +public class HsNormalizacaoEstabelecimento extends _HsNormalizacaoEstabelecimento { + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsPosto.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsPosto.java new file mode 100644 index 00000000..d1006bcb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsPosto.java @@ -0,0 +1,28 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsPosto; + +public class HsPosto extends _HsPosto { + + private static final long serialVersionUID = 1L; + + @Override + public String getDescription() + { + return parseFromUnicode( super.getDescription() ); + } + + + @Override + public void setDescription( String nome ) + { + super.setDescription( parseToUnicode( nome ) ); + } + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsPostoEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsPostoEstabelecimento.java new file mode 100644 index 00000000..8fc60d53 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsPostoEstabelecimento.java @@ -0,0 +1,7 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsPostoEstabelecimento; + +public class HsPostoEstabelecimento extends _HsPostoEstabelecimento { + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsPostoMedida.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsPostoMedida.java new file mode 100644 index 00000000..c94186a3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsPostoMedida.java @@ -0,0 +1,9 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsPostoMedida; + +public class HsPostoMedida extends _HsPostoMedida { + + private static final long serialVersionUID = 1L; + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsPostoRisco.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsPostoRisco.java new file mode 100644 index 00000000..477f0c70 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsPostoRisco.java @@ -0,0 +1,34 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsPostoRisco; + +public class HsPostoRisco extends _HsPostoRisco { + + private static final long serialVersionUID = 1L; + + @Override + public String toString() + { + return super.getToHsRisco().getDescription(); + } + @Override + public void save() throws Exception + { + HsPosto posto = getToHsPosto(); + if( posto != null ) + { + Integer maxOrder = 0; + for( HsPostoRisco rel : posto.getHsPostoRiscoArray() ) + { + Integer currentOrder = rel.getOrder(); + if( currentOrder != null ) + { + maxOrder = Math.max( currentOrder, maxOrder ); + } + } + this.setOrder( maxOrder + 1 ); + } + super.save(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorio.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorio.java new file mode 100644 index 00000000..f0d11df2 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorio.java @@ -0,0 +1,83 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsRelatorio; + +public class HsRelatorio extends _HsRelatorio { + + private static final long serialVersionUID = 1L; + + @Override + public String getFuncionarios() + { + return parseFromUnicode( super.getFuncionarios() ); + } + @Override + public String getAcompanhante1() + { + return parseFromUnicode( super.getAcompanhante1() ); + } + @Override + public String getAcompanhante2() + { + return parseFromUnicode( super.getAcompanhante2() ); + } + @Override + public String getAcompanhante3() + { + return parseFromUnicode( super.getAcompanhante3() ); + } + @Override + public String getFuncaoAcompanhante1() + { + return parseFromUnicode( super.getFuncaoAcompanhante1() ); + } + @Override + public String getFuncaoAcompanhante2() + { + return parseFromUnicode( super.getFuncaoAcompanhante2() ); + } + @Override + public String getFuncaoAcompanhante3() + { + return parseFromUnicode( super.getFuncaoAcompanhante3() ); + } + + + @Override + public void setFuncionarios( String text ) + { + super.setFuncionarios( parseToUnicode( text ) ); + } + @Override + public void setAcompanhante1( String nome ) + { + super.setAcompanhante1( parseToUnicode( nome ) ); + } + @Override + public void setAcompanhante2( String nome ) + { + super.setAcompanhante2( parseToUnicode( nome ) ); + } + @Override + public void setAcompanhante3( String nome ) + { + super.setAcompanhante3( parseToUnicode( nome ) ); + } + @Override + public void setFuncaoAcompanhante1( String nome ) + { + super.setFuncaoAcompanhante1( parseToUnicode( nome ) ); + } + @Override + public void setFuncaoAcompanhante2( String nome ) + { + super.setFuncaoAcompanhante2( parseToUnicode( nome ) ); + } + @Override + public void setFuncaoAcompanhante3( String nome ) + { + super.setFuncaoAcompanhante3( parseToUnicode( nome ) ); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioArea.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioArea.java new file mode 100644 index 00000000..4c1680f0 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioArea.java @@ -0,0 +1,28 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsRelatorioArea; + +public class HsRelatorioArea extends _HsRelatorioArea { + + private static final long serialVersionUID = 1L; + + @Override + public String getDescription() + { + return parseFromUnicode( super.getDescription() ); + } + + + @Override + public void setDescription( String nome ) + { + super.setDescription( parseToUnicode( nome ) ); + } + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioEquipamento.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioEquipamento.java new file mode 100644 index 00000000..e220a91d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioEquipamento.java @@ -0,0 +1,52 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsRelatorioEquipamento; + +public class HsRelatorioEquipamento extends _HsRelatorioEquipamento { + + private static final long serialVersionUID = 1L; + + @Override + public String getTipo() + { + return parseFromUnicode( super.getTipo() ); + } + + @Override + public void setTipo( String nome ) + { + super.setTipo( parseToUnicode( nome ) ); + } + + @Override + public String getMarca() + { + return parseFromUnicode( super.getMarca() ); + } + + @Override + public void setMarca( String marca ) + { + super.setMarca( parseToUnicode( marca ) ); + } + + @Override + public String getModelo() + { + return parseFromUnicode( super.getModelo() ); + } + + @Override + public void setModelo( String modelo ) + { + super.setModelo( parseToUnicode( modelo ) ); + } + + @Override + public String toString() + { + String marca = getMarca() == null ? "" : getMarca(); + String modelo = getModelo() == null ? "" : getModelo(); + return getTipo() + ": " + marca + "-" + modelo; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioLegislacao.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioLegislacao.java new file mode 100644 index 00000000..93fd4ee4 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioLegislacao.java @@ -0,0 +1,27 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsRelatorioLegislacao; + +public class HsRelatorioLegislacao extends _HsRelatorioLegislacao { + + private static final long serialVersionUID = 1L; + + @Override + public String getDescricao() + { + return parseFromUnicode( super.getDescricao() ); + } + + @Override + public void setDescricao( String descricao ) + { + super.setDescricao( parseToUnicode( descricao ) ); + } + + @Override + public String toString() + { + return getDescricao(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioMedida.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioMedida.java new file mode 100644 index 00000000..0f88b502 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioMedida.java @@ -0,0 +1,40 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsRelatorioMedida; + +public class HsRelatorioMedida extends _HsRelatorioMedida { + + private static final long serialVersionUID = 1L; + + @Override + public String getDescription() + { + return parseFromUnicode( super.getDescription() ); + } + + + @Override + public void setDescription( String nome ) + { + super.setDescription( parseToUnicode( nome ) ); + } + + @Override + public String getRequesitosLegais() + { + return parseFromUnicode( super.getRequesitosLegais()); + } + + + @Override + public void setRequesitosLegais( String nome ) + { + super.setRequesitosLegais( parseToUnicode( nome ) ); + } + + @Override + public String toString() + { + return getRequesitosLegais(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioNormalizacao.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioNormalizacao.java new file mode 100644 index 00000000..74fcda18 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioNormalizacao.java @@ -0,0 +1,43 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsRelatorioNormalizacao; + +public class HsRelatorioNormalizacao extends _HsRelatorioNormalizacao { + + private static final long serialVersionUID = 1L; + + private static final int TO_STRING_LENGTH = 58; + + @Override + public String getCodigo() + { + return parseFromUnicode( super.getCodigo() ); + } + + @Override + public void setCodigo( String codigo ) + { + super.setCodigo( parseToUnicode( codigo ) ); + } + + @Override + public String getDescricao() + { + return parseFromUnicode( super.getDescricao() ); + } + + @Override + public void setDescricao( String nome ) + { + super.setDescricao( parseToUnicode( nome ) ); + } + + @Override + public String toString() + { + String codigo = getCodigo(); + String descricao = getDescricao() == null ? "" : getDescricao().replaceAll( "\n", " " ); + return (codigo == null ? "" : codigo ) + ": " + ( descricao.substring( 0, Math.min( TO_STRING_LENGTH, descricao.length() ) ) + ( TO_STRING_LENGTH < descricao.length() ? "..." : "" ) ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioPosto.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioPosto.java new file mode 100644 index 00000000..f62b7544 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioPosto.java @@ -0,0 +1,27 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsRelatorioPosto; + +public class HsRelatorioPosto extends _HsRelatorioPosto { + + private static final long serialVersionUID = 1L; + + @Override + public String getDescription() + { + return parseFromUnicode( super.getDescription() ); + } + + + @Override + public void setDescription( String nome ) + { + super.setDescription( parseToUnicode( nome ) ); + } + + @Override + public String toString() + { + return getDescription(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioPostoMedida.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioPostoMedida.java new file mode 100644 index 00000000..f0f2cb61 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioPostoMedida.java @@ -0,0 +1,15 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsRelatorioPostoMedida; + +public class HsRelatorioPostoMedida extends _HsRelatorioPostoMedida { + + private static final long serialVersionUID = 1L; + + @Override + public String toString() + { + return getToHsRelatorioMedida().toString(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioPostoRisco.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioPostoRisco.java new file mode 100644 index 00000000..a4c4d268 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioPostoRisco.java @@ -0,0 +1,15 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsRelatorioPostoRisco; + +public class HsRelatorioPostoRisco extends _HsRelatorioPostoRisco { + + private static final long serialVersionUID = 1L; + + @Override + public String toString() + { + return getToHsRelatorioRisco().getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioRisco.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioRisco.java new file mode 100644 index 00000000..d84572be --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioRisco.java @@ -0,0 +1,27 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsRelatorioRisco; + +public class HsRelatorioRisco extends _HsRelatorioRisco { + + private static final long serialVersionUID = 1L; + + @Override + public String getDescription() + { + return parseFromUnicode( super.getDescription() ); + } + + + @Override + public void setDescription( String nome ) + { + super.setDescription( parseToUnicode( nome ) ); + } + + @Override + public String toString() + { + return getDescription(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioRiscoValorQualitativo.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioRiscoValorQualitativo.java new file mode 100644 index 00000000..f74419b8 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRelatorioRiscoValorQualitativo.java @@ -0,0 +1,15 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsRelatorioRiscoValorQualitativo; + +public class HsRelatorioRiscoValorQualitativo extends _HsRelatorioRiscoValorQualitativo { + + private static final long serialVersionUID = 1L; + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRisco.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRisco.java new file mode 100644 index 00000000..f8579dcd --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRisco.java @@ -0,0 +1,27 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsRisco; + +public class HsRisco extends _HsRisco { + + private static final long serialVersionUID = 1L; + + @Override + public String getDescription() + { + return parseFromUnicode( super.getDescription() ); + } + + @Override + public void setDescription( String nome ) + { + super.setDescription( parseToUnicode( nome ) ); + } + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRiscoEmpresa.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRiscoEmpresa.java new file mode 100644 index 00000000..7d25801e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRiscoEmpresa.java @@ -0,0 +1,15 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsRiscoEmpresa; + +public class HsRiscoEmpresa extends _HsRiscoEmpresa { + + private static final long serialVersionUID = 1L; + + @Override + public String toString() + { + return super.getToHsRisco().getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRiscoMedida.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRiscoMedida.java new file mode 100644 index 00000000..92ea799c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRiscoMedida.java @@ -0,0 +1,14 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsRiscoMedida; + +public class HsRiscoMedida extends _HsRiscoMedida { + private static final long serialVersionUID = 1L; + + @Override + public String toString() + { + String d = getToHsMedida() == null ? null : getToHsMedida().getRequesitosLegais(); + return d == null ? " " : d.substring( 0, Math.min( 80, d.length() ) ) + "..."; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRiscoTema.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRiscoTema.java new file mode 100644 index 00000000..3260a655 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/HsRiscoTema.java @@ -0,0 +1,15 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._HsRiscoTema; + +public class HsRiscoTema extends _HsRiscoTema { + + private static final long serialVersionUID = 1L; + + @Override + public String toString() + { + return getDescription(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Image.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Image.java new file mode 100644 index 00000000..3eb2c175 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Image.java @@ -0,0 +1,12 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._Image; + +public class Image extends _Image { + + @Override + public String toString() + { + return getName() == null ? "" : getName(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Lembretes.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Lembretes.java new file mode 100755 index 00000000..1d500299 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Lembretes.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._Lembretes; + +public class Lembretes extends _Lembretes { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/LembretesTipos.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/LembretesTipos.java new file mode 100755 index 00000000..15ce2a2d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/LembretesTipos.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._LembretesTipos; + +public class LembretesTipos extends _LembretesTipos { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesEmpresa.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesEmpresa.java new file mode 100755 index 00000000..7c400e8c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesEmpresa.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._MarcacoesEmpresa; + +public class MarcacoesEmpresa extends _MarcacoesEmpresa { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesEstabelecimento.java new file mode 100755 index 00000000..5f4d6981 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesEstabelecimento.java @@ -0,0 +1,32 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._MarcacoesEstabelecimento; + +public class MarcacoesEstabelecimento extends _MarcacoesEstabelecimento +{ + + private static final long serialVersionUID = 1L; + + @Override + public String toString() + { + return DATE_FORMAT.format( getData() ); + } + + @Override + public int compareTo( BaseObject marcacao ) + { + if( marcacao instanceof MarcacoesEstabelecimento ) + { + return this.getData().compareTo( ( ( MarcacoesEstabelecimento) marcacao ).getData() ); + } + else + { + return super.compareTo( marcacao ); + } + } + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesGruposRealizados.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesGruposRealizados.java new file mode 100755 index 00000000..bd88f5d9 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesGruposRealizados.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._MarcacoesGruposRealizados; + +public class MarcacoesGruposRealizados extends _MarcacoesGruposRealizados { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesTecnicosHst.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesTecnicosHst.java new file mode 100755 index 00000000..e6b31e26 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesTecnicosHst.java @@ -0,0 +1,30 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._MarcacoesTecnicosHst; + +public class MarcacoesTecnicosHst extends _MarcacoesTecnicosHst { + + private static final long serialVersionUID = 1L; + + @Override + public String getNome() + { + return parseFromUnicode( super.getNome() ); + } + + @Override + public void setNome( String nome ) + { + super.setNome( parseToUnicode( nome ) ); + } + + @Override + public String toString() + { + return getNome(); + } + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesTrabalhador.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesTrabalhador.java new file mode 100755 index 00000000..0a7c94d1 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesTrabalhador.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._MarcacoesTrabalhador; + +public class MarcacoesTrabalhador extends _MarcacoesTrabalhador { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesTrabalhadorEstados.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesTrabalhadorEstados.java new file mode 100755 index 00000000..5fcf9f41 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/MarcacoesTrabalhadorEstados.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._MarcacoesTrabalhadorEstados; + +public class MarcacoesTrabalhadorEstados extends _MarcacoesTrabalhadorEstados { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Medicos.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Medicos.java new file mode 100755 index 00000000..b25299eb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Medicos.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._Medicos; + +public class Medicos extends _Medicos { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Prestadores.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Prestadores.java new file mode 100755 index 00000000..991e85fe --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Prestadores.java @@ -0,0 +1,74 @@ +package siprp.database.cayenne.objects; + +import java.util.List; + +import siprp.database.cayenne.objects.auto._Prestadores; +import siprp.database.cayenne.providers.MedicinaDAO; + +public class Prestadores extends _Prestadores { + + private static final long serialVersionUID = 1L; + + private String name = null; + + private String convertedName = null; + + public static final Prestadores prestadorNulo = new Prestadores(); + + static { + prestadorNulo.setNome( "SIPRP" ); + } + + @Override + public String getNome() + { + String currentName = super.getNome(); + if( name == null || !name.equals( currentName )) + { + name = currentName; + convertedName = null; + } + return convertName(); + } + + @Override + public void setNome( String nome ) + { + super.setNome( parseToUnicode( nome ) ); + getNome(); + } + + private String convertName() + { + if( name == null ) + { + convertedName = null; + } + else + { + convertedName = parseFromUnicode( name ); + } + return convertedName; + } + +// public static Prestadores getDefaultPrestador() +// { +// return medicinaProvider.getDefaultPrestador(); +// } + + public static List getAllPrestadores() + { + List result = new MedicinaDAO().getAllPrestadores(); + result.add( 0, prestadorNulo); + return result; + } + + @Override + public String toString() + { + return getNome(); + } +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/PrestadoresGruposProtocolo.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/PrestadoresGruposProtocolo.java new file mode 100755 index 00000000..8fd102d3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/PrestadoresGruposProtocolo.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._PrestadoresGruposProtocolo; + +public class PrestadoresGruposProtocolo extends _PrestadoresGruposProtocolo { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/PrtElementosProtocolo.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/PrtElementosProtocolo.java new file mode 100755 index 00000000..9fab9f60 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/PrtElementosProtocolo.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._PrtElementosProtocolo; + +public class PrtElementosProtocolo extends _PrtElementosProtocolo { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/PrtGruposProtocolo.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/PrtGruposProtocolo.java new file mode 100755 index 00000000..04645e4e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/PrtGruposProtocolo.java @@ -0,0 +1,53 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._PrtGruposProtocolo; + +public class PrtGruposProtocolo extends _PrtGruposProtocolo { + + private static final long serialVersionUID = 1L; + + private String name = null; + + private String convertedName = null; + + @Override + public String getDescricao() + { + String currentName = super.getDescricao(); + if( name == null || !name.equals( currentName )) + { + name = currentName; + convertedName = null; + } + return convertName(); + } + + @Override + public void setDescricao( String nome ) + { + super.setDescricao( parseToUnicode( name ) ); + getDescricao(); + } + + private String convertName() + { + if( name == null ) + { + convertedName = null; + } + else + { + convertedName = parseFromUnicode( name ); + } + return convertedName; + } + + @Override + public String toString() + { + return getDescricao() == null ? "" : getDescricao(); + } +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/PrtTiposElementosProtocolo.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/PrtTiposElementosProtocolo.java new file mode 100755 index 00000000..9a4a0050 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/PrtTiposElementosProtocolo.java @@ -0,0 +1,17 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._PrtTiposElementosProtocolo; + +public class PrtTiposElementosProtocolo extends _PrtTiposElementosProtocolo { + + private static final long serialVersionUID = 1L; + + @Override + public String toString() + { + return getDescricao(); + } +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/SIPRPMap.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/SIPRPMap.java new file mode 100644 index 00000000..02e79964 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/SIPRPMap.java @@ -0,0 +1,18 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._SIPRPMap; + +public class SIPRPMap extends _SIPRPMap { + + private static SIPRPMap instance; + + private SIPRPMap() {} + + public static SIPRPMap getInstance() { + if(instance == null) { + instance = new SIPRPMap(); + } + + return instance; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TiposExamesComp.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TiposExamesComp.java new file mode 100755 index 00000000..7ba39e0e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TiposExamesComp.java @@ -0,0 +1,10 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._TiposExamesComp; + +public class TiposExamesComp extends _TiposExamesComp { + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Trabalhadores.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Trabalhadores.java new file mode 100755 index 00000000..14af6ee2 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/Trabalhadores.java @@ -0,0 +1,83 @@ +package siprp.database.cayenne.objects; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import siprp.database.cayenne.objects.auto._Trabalhadores; + +public class Trabalhadores extends _Trabalhadores +{ + private static final long serialVersionUID = 1L; + + private String name = null; + + private String convertedName = null; + + public String getDataNascimentoString() + { + return getDataNascimento() == null ? "" : DATE_FORMAT.format( getDataNascimento() ); + } + + @Override + public List getTrabalhadoresProcessoArray() + { + List allProcessos = super.getTrabalhadoresProcessoArray(); + List result = new ArrayList(); + for( TrabalhadoresProcesso current : allProcessos ) + { + if("y".equals( current.getActivo() )) + { + result.add( current ); + } + } + return result; + } + + @Override + public String getNome() + { + String currentName = super.getNome(); + if( name == null || !name.equals( currentName )) + { + name = currentName; + convertedName = null; + } + return convertName(); + } + + @Override + public void setNome( String nome ) + { + super.setNome( parseToUnicode( name ) ); + getNome(); + } + + private String convertName() + { + if( name == null ) + { + convertedName = null; + } + else + { + convertedName = parseFromUnicode( name ); + } + return convertedName; + } + + public HashMap getSexos() + { + HashMap result = new HashMap(); + result.put("f", "Feminino"); + result.put( "m", "Masculino" ); + return result; + } + + @Override + public String toString() + { + return getNome(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresConsultas.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresConsultas.java new file mode 100755 index 00000000..c75cd1e3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresConsultas.java @@ -0,0 +1,27 @@ +package siprp.database.cayenne.objects; + +import siprp.MedicinaConstants; +import siprp.database.cayenne.objects.auto._TrabalhadoresConsultas; + +public class TrabalhadoresConsultas extends _TrabalhadoresConsultas implements MedicinaConstants +{ + + private static final long serialVersionUID = 1L; + + public String getEstadoString() + { + return isNew() ? isNewMessage : ((getEstado() == null || ESTADOS_CONSULTA_STR.length <= getEstado()) ? "" : ESTADOS_CONSULTA_STR[getEstado().intValue()]); + } + + public String getDataString() + { + return getData() == null ? "(sem data definida)" : DATE_FORMAT.format( getData() ); + } + + @Override + public String toString() + { + return "Consulta de " + getDataString() + ": " + getEstadoString(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresConsultasDatas.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresConsultasDatas.java new file mode 100755 index 00000000..b07c78c5 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresConsultasDatas.java @@ -0,0 +1,48 @@ +package siprp.database.cayenne.objects; + +import java.util.Date; + +import siprp.MedicinaConstants; +import siprp.database.cayenne.objects.auto._TrabalhadoresConsultasDatas; + +public class TrabalhadoresConsultasDatas extends _TrabalhadoresConsultasDatas implements MedicinaConstants +{ + + private static final long serialVersionUID = 1L; + + public String getDataString() + { + return getData() == null ? "" : DATE_FORMAT.format( getData() ); + } + + public String getEstadoString() + { + return getEstado() == null || getEstado() >= ESTADOS_CONSULTA_STR.length ? "" : ESTADOS_CONSULTA_STR[ getEstado() ]; + } + + @Override + public String toString() + { + return getDataString() + ": " + getEstadoString(); + } + + @Override + public void setData( Date date ) + { + if( date != null && this.getToTrabalhadoresConsultas() != null && this.getEstado() != null && new Integer(ESTADO_POR_REALIZAR).equals(this.getEstado())) + { + this.getToTrabalhadoresConsultas().setData( date ); + } + super.setData( date ); + } + + @Override + public void setEstado( Integer estado ) + { + if( estado != null && this.getToTrabalhadoresConsultas() != null && (new Integer(ESTADO_POR_REALIZAR).equals( this.getEstado() ) || new Integer(ESTADO_POR_REALIZAR).equals( estado ))) + { + this.getToTrabalhadoresConsultas().setEstado( !(estado.equals( ESTADO_POR_REALIZAR ) || estado.equals( ESTADO_REALIZADO )) ? ESTADO_POR_MARCAR : estado ); + } + super.setEstado( estado ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresConsultasDatasEmails.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresConsultasDatasEmails.java new file mode 100755 index 00000000..554690d6 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresConsultasDatasEmails.java @@ -0,0 +1,21 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._TrabalhadoresConsultasDatasEmails; + +public class TrabalhadoresConsultasDatasEmails extends _TrabalhadoresConsultasDatasEmails { + private static final long serialVersionUID = 1L; + + public String getDataString() + { + return getData() == null ? "" : DATE_FORMAT.format( getData() ); + } + + @Override + public String toString() + { + return getSubject(); + } +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresConsultasDatasObservacoes.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresConsultasDatasObservacoes.java new file mode 100755 index 00000000..a3383eb7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresConsultasDatasObservacoes.java @@ -0,0 +1,54 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._TrabalhadoresConsultasDatasObservacoes; + +public class TrabalhadoresConsultasDatasObservacoes extends _TrabalhadoresConsultasDatasObservacoes { + private static final long serialVersionUID = 1L; + + private String name = null; + + private String convertedName = null; + + @Override + public String toString() + { + return getObservacao(); + } + + @Override + public String getObservacao() + { + String currentName = super.getObservacao(); + if( name == null || !name.equals( currentName )) + { + name = currentName; + convertedName = null; + } + return convertName(); + } + + @Override + public void setObservacao( String nome ) + { + super.setObservacao( nome != null ? parseToUnicode( nome ) : null ); + getObservacao(); + } + + private String convertName() + { + if( name == null ) + { + convertedName = null; + } + else + { + convertedName = parseFromUnicode( name ); + } + return convertedName; + } + + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcd.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcd.java new file mode 100755 index 00000000..85bccd59 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcd.java @@ -0,0 +1,28 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._TrabalhadoresEcd; + +public class TrabalhadoresEcd extends _TrabalhadoresEcd { + private static final long serialVersionUID = 1L; + + @Override + public String toString() + { + PrtTiposElementosProtocolo exame = getToPrtTiposElementosProtocolo(); + String exameNome = exame == null ? null : exame.getDescricao(); + EcdOficial exameOficial = getToEcdOficial(); + String exameOficialNome = exameOficial == null ? null : exameOficial.getDescricao(); + String result = ""; + if(exameNome == null && exameOficialNome != null) + { + result = exameOficialNome + " [oficial]"; + }else if( exameNome != null ) + { + result = exameNome; + } + return result; + } +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcds.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcds.java new file mode 100755 index 00000000..164af20e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcds.java @@ -0,0 +1,172 @@ +package siprp.database.cayenne.objects; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import siprp.MedicinaConstants; +import siprp.database.cayenne.objects.auto._TrabalhadoresEcds; + +import com.evolute.adt.OrderedMap; + +public class TrabalhadoresEcds extends _TrabalhadoresEcds implements MedicinaConstants +{ + private static final long serialVersionUID = 1L; + + public String getDataString() + { + return getData() == null ? "(sem data definida)" : DATE_FORMAT.format( getData() ); + } + + public String getEstadoString() + { + return isNew() ? isNewMessage : (getEstado() == null || getEstado() >= ESTADOS_EXAME_STR.length ? "" : ESTADOS_EXAME_STR[getEstado()]); + } + + public HashMap getEstados() + { + HashMap result = new HashMap(); + for( int i = 0; i < ESTADOS_EXAME_STR.length; ++i ) + { + if( ESTADOS_EXAME_STR[i] != null ) + { + result.put( new Integer( i ), ESTADOS_EXAME_STR[i] ); + } + } + return result; + } + + @Override + public String toString() + { + return getDataString() + ": " + getEstadoString(); + } + + public OrderedMap getGruposExamesForPerfil() + { + OrderedMap grupos = new OrderedMap(); + + Trabalhadores trabalhador = this.getToTrabalhadores(); + Integer perfil = trabalhador.getPerfil(); + if( perfil != null ) + { + Empresas empresa = trabalhador.getToEstabelecimentos().getToEmpresas(); + List ecdsPerfil = (List) empresa.getPrtElementosProtocoloArray(); + for( PrtElementosProtocolo ecdPerfil : ecdsPerfil ) + { + if( perfil.equals( ecdPerfil.getNumeroPerfil() ) ) + { + PrtTiposElementosProtocolo ecd = ecdPerfil.getToPrtTiposElementosProtocolo(); + if( ecd != null ) + { + PrtGruposProtocolo grupoEcd = ecd.getToPrtGruposProtocolo(); + if( grupoEcd != null ) + { + String descricao = grupoEcd.getDescricao(); + if( descricao != null && !grupos.containsKey( grupoEcd ) ) + { + grupos.putLast( grupoEcd, descricao ); + Integer estado = getEstadoForGrupoEcd( grupoEcd ); + grupos.putLast( grupoEcd, estado != null ? MedicinaConstants.ESTADOS_EXAME_STR[estado] : " " ); + } + } + } + } + } + } + List estados = new ArrayList(); + List marcacoes = getTrabalhadoresEcdsDatasArray(); + if( marcacoes != null ) + { + for( TrabalhadoresEcdsDatas marcacao : marcacoes ) + { + Integer estado = marcacao.getEstado(); + if( !estados.contains( estado ) ) + { + estados.add( estado ); + } + } + } + if( estados.size() == 1 ) + { +// if( estadosSoFar.contains( new Integer( ESTADO_ANULADO ) ) || estadosSoFar.contains( new Integer( ESTADO_REALIZADO ) ) ) +// { + setEstado( estados.get( 0 ) ); +// } +// else if( estadosSoFar.contains( new Integer( ESTADO_POR_REALIZAR ) ) ) +// { +// setEstado( ESTADO_POR_REALIZAR ); +// } +// else +// { +// setEstado( ESTADO_POR_MARCAR ); +// } + } + else if( estados.size() == 2 ) + { + if( estados.contains( new Integer( ESTADO_ANULADO ) ) && estados.contains( new Integer( ESTADO_REALIZADO ) ) ) + { + setEstado( ESTADO_REALIZADO ); + } + else if( estados.contains( new Integer( ESTADO_POR_MARCAR ) ) ) + { + setEstado( ESTADO_POR_MARCAR ); + } + else if( estados.contains( new Integer( ESTADO_ANULADO ) ) || estados.contains( new Integer( ESTADO_REALIZADO ) ) ) + { + setEstado( ESTADO_PARCIALMENTE_REALIZADO ); + } + else + { + setEstado( ESTADO_POR_REALIZAR ); + } + } + else + { + if( estados.contains( new Integer( ESTADO_POR_MARCAR ) ) ) + { + setEstado( ESTADO_POR_MARCAR ); + } + else if( estados.contains( new Integer( ESTADO_ANULADO ) ) && estados.contains( new Integer( ESTADO_REALIZADO ) ) ) + { + setEstado( ESTADO_PARCIALMENTE_REALIZADO ); + } + else + { + setEstado( ESTADO_POR_REALIZAR ); + } + } + grupos.order(); + return grupos; + } + + private Integer getEstadoForGrupoEcd( PrtGruposProtocolo grupoEcd ) + { + Integer estado = null; + List marcacoes = getTrabalhadoresEcdsDatasArray(); + if( marcacoes != null ) + { + for( TrabalhadoresEcdsDatas marcacao : marcacoes ) + { + List ecds = marcacao.getTrabalhadoresEcdArray(); + for( TrabalhadoresEcd ecd : ecds ) + { + if( ecd.getToPrtTiposElementosProtocolo().getToPrtGruposProtocolo().equals( grupoEcd ) ) + { + if( new Integer( ESTADO_REALIZADO ).equals( ecd.getEstado() ) || new Integer( ESTADO_ANULADO ).equals( ecd.getEstado() ) ) + { + return ecd.getEstado(); + } + else if( new Integer( ESTADO_POR_REALIZAR ).equals( ecd.getEstado() ) ) + { + estado = ecd.getEstado(); + break; + } + } + } + } + } + return estado == null ? ESTADO_POR_MARCAR : estado; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcdsAnalise.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcdsAnalise.java new file mode 100644 index 00000000..1d7d4e95 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcdsAnalise.java @@ -0,0 +1,7 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._TrabalhadoresEcdsAnalise; + +public class TrabalhadoresEcdsAnalise extends _TrabalhadoresEcdsAnalise { + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcdsDatas.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcdsDatas.java new file mode 100755 index 00000000..2091117d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcdsDatas.java @@ -0,0 +1,205 @@ +package siprp.database.cayenne.objects; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import siprp.MedicinaConstants; +import siprp.database.cayenne.objects.auto._TrabalhadoresEcdsDatas; + +import com.evolute.adt.OrderedMap; + +public class TrabalhadoresEcdsDatas extends _TrabalhadoresEcdsDatas implements MedicinaConstants +{ + private static final long serialVersionUID = 1L; + + public String getDataString() + { + return getData() == null ? "" : DATE_FORMAT.format( getData() ); + } + + public String getEstadoString() + { + return getEstado() == null || getEstado() >= ESTADOS_EXAME_STR.length ? "" : ESTADOS_EXAME_STR[getEstado()]; + } + + public HashMap getEstados() + { + HashMap result = new HashMap(); + for( int i = 0; i < ESTADOS_EXAME_STR.length; ++i ) + { + if( ESTADOS_EXAME_STR[i] != null ) + { + result.put( new Integer( i ), ESTADOS_EXAME_STR[i] ); + } + } + return result; + } + + @Override + public void setData( Date date ) + { + if( date != null && this.getToTrabalhadoresEcds() != null && this.getEstado() != null && new Integer( ESTADO_POR_REALIZAR ).equals( this.getEstado() ) ) + { + this.getToTrabalhadoresEcds().setData( date ); + } + super.setData( date ); + } + + @Override + public String toString() + { + return getDataString() + ": " + getEstadoString(); + } + + public OrderedMap getStatesForeGruposExames() + { + OrderedMap grupos = new OrderedMap(); + List exames = this.getTrabalhadoresEcdArray(); + if( exames != null ) + { + for( TrabalhadoresEcd exame : exames ) + { + String estadoString = MedicinaConstants.ESTADOS_EXAME_STR[exame.getEstado()]; + PrtGruposProtocolo grupo = exame.getToPrtTiposElementosProtocolo().getToPrtGruposProtocolo(); + if( !grupos.containsKey( grupo ) ) + { + grupos.putLast( grupo, grupo.getDescricao() ); + grupos.putLast( grupo, estadoString ); + } + } + } + grupos.order(); + return grupos; + } + + private List getAllEcdForGrupoForThisMarcacao( PrtGruposProtocolo grupo ) + { + List result = new ArrayList(); + for( TrabalhadoresEcd ecd : (List) getTrabalhadoresEcdArray() ) + { + if( grupo.equals( ecd.getToPrtTiposElementosProtocolo().getToPrtGruposProtocolo() ) ) + { + result.add( ecd.getToPrtTiposElementosProtocolo() ); + } + } + return result; + } + + private List getAllEcdForGrupoAndCurrentPerfil( PrtGruposProtocolo grupo ) + { + Trabalhadores trabalhador = getToTrabalhadoresEcds().getToTrabalhadores(); + List result = new ArrayList(); + Integer perfil = trabalhador.getPerfil(); + if( perfil != null ) + { + Empresas empresa = trabalhador.getToEstabelecimentos().getToEmpresas(); + List ecdsPerfil = (List) empresa.getPrtElementosProtocoloArray(); + for( PrtElementosProtocolo ecdPerfil : ecdsPerfil ) + { + if( perfil.equals( ecdPerfil.getNumeroPerfil() ) ) + { + PrtTiposElementosProtocolo ecd = ecdPerfil.getToPrtTiposElementosProtocolo(); + if( ecd != null ) + { + if( ecd.getToPrtGruposProtocolo().equals( grupo ) && !result.contains( ecd ) ) + { + result.add( ecd ); + } + } + } + } + } + return result; + } + + public void marcarGrupoExames( PrtGruposProtocolo grupo ) + { + for( PrtTiposElementosProtocolo ecd : getAllEcdForGrupoAndCurrentPerfil( grupo ) ) + { + TrabalhadoresEcd trabEcd = new TrabalhadoresEcd(); + trabEcd.setEstado( MedicinaConstants.ESTADO_POR_REALIZAR ); + trabEcd.setToPrtTiposElementosProtocolo( ecd ); + trabEcd.setToTrabalhadoresEcdsDatas( this ); + addToTrabalhadoresEcdArray( trabEcd ); + } + getToTrabalhadoresEcds().getGruposExamesForPerfil(); + } + + public void setStateForGrupoProtocolo( PrtGruposProtocolo grupo, Integer estado ) + { + List group = getAllEcdForGrupoForThisMarcacao( grupo ); + for(TrabalhadoresEcd ecd : (List) getTrabalhadoresEcdArray()) + { + if(group.contains( ecd.getToPrtTiposElementosProtocolo())) + { + ecd.setEstado( estado ); + } + } + } + + public void setStateForGrupoProtocolo( PrtGruposProtocolo grupo, String estado ) + { + for( int i = 0; i < ESTADOS_EXAME_STR.length; ++i ) + { + String currentEstado = ESTADOS_EXAME_STR[i]; + if( currentEstado != null && new Integer( i ).equals( estado ) ) + { + setStateForGrupoProtocolo( grupo, i ); + break; + } + } + } + + public void anular() + { + setEstadoForAllEcd( MedicinaConstants.ESTADO_ANULADO ); + } + + public void realizar() + { + setEstadoForAllEcd( MedicinaConstants.ESTADO_REALIZADO ); + } + + public void porRealizar() + { + setEstadoForAllEcd( MedicinaConstants.ESTADO_POR_REALIZAR ); + } + + public void desmarcarSIPRP() + { + setEstadoForAllEcd( MedicinaConstants.ESTADO_DESMARCADO_EMPRESA ); + } + + public void desmarcarTrabalhador() + { + setEstadoForAllEcd( MedicinaConstants.ESTADO_DESMARCADO_TRABALHADOR ); + } + + public void faltou() + { + setEstadoForAllEcd( MedicinaConstants.ESTADO_FALTOU ); + } + + public void setEstadoForAllEcd( Integer estado ) + { + List allEcd = (List) getTrabalhadoresEcdArray(); + if(allEcd != null) + { + for(TrabalhadoresEcd ecd : allEcd ) + { + ecd.setEstado( estado ); + } + } + super.setEstado( estado ); + getToTrabalhadoresEcds().getGruposExamesForPerfil(); + } + + @Override + public void setEstado( Integer estado ){ + super.setEstado( estado ); + getToTrabalhadoresEcds().getGruposExamesForPerfil(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcdsDatasEmails.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcdsDatasEmails.java new file mode 100755 index 00000000..dd434669 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcdsDatasEmails.java @@ -0,0 +1,22 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._TrabalhadoresEcdsDatasEmails; + +public class TrabalhadoresEcdsDatasEmails extends _TrabalhadoresEcdsDatasEmails { + private static final long serialVersionUID = 1L; + + public String getDataString() + { + return getData() == null ? "" : DATE_FORMAT.format( getData() ); + } + + @Override + public String toString() + { + return getSubject(); + } + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcdsDatasObservacoes.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcdsDatasObservacoes.java new file mode 100755 index 00000000..aa91c677 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcdsDatasObservacoes.java @@ -0,0 +1,54 @@ +package siprp.database.cayenne.objects; + +import siprp.database.cayenne.objects.auto._TrabalhadoresEcdsDatasObservacoes; + +public class TrabalhadoresEcdsDatasObservacoes extends _TrabalhadoresEcdsDatasObservacoes { + + private static final long serialVersionUID = 1L; + + private String name = null; + + private String convertedName = null; + + @Override + public String toString() + { + return getObservacao(); + } + + @Override + public String getObservacao() + { + String currentName = super.getObservacao(); + if( name == null || !name.equals( currentName )) + { + name = currentName; + convertedName = null; + } + return convertName(); + } + + @Override + public void setObservacao( String nome ) + { + super.setObservacao( nome != null ? parseToUnicode( nome ) : null ); + getObservacao(); + } + + private String convertName() + { + if( name == null ) + { + convertedName = null; + } + else + { + convertedName = parseFromUnicode( name ); + } + return convertedName; + } + +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresFichasAptidao.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresFichasAptidao.java new file mode 100755 index 00000000..65748e05 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresFichasAptidao.java @@ -0,0 +1,56 @@ +package siprp.database.cayenne.objects; + +import java.util.Date; + +import siprp.database.cayenne.objects.auto._TrabalhadoresFichasAptidao; + +public class TrabalhadoresFichasAptidao extends _TrabalhadoresFichasAptidao { + private static final long serialVersionUID = 1L; + + @Override + public String toString() + { + String result = ""; + Exames exame = getToExames(); + if( exame != null ) + { + Date data = exame.getProximoExame(); + if( data != null ) + { + result = DATE_FORMAT.format( data ); + } + } + return result + ": " + getEstadoString(); + } + + private String getEstadoString() + { + String result = ""; + Exames exame = getToExames(); + if( exame != null ) + { + Integer resultadoCodigo = exame.getResultado(); + if( resultadoCodigo != null ) + { + switch( resultadoCodigo.intValue() ) + { + case 1: + result += "Apto"; + break; + case 2: + result += "Apto (cond)"; + break; + case 3: + result += "Inapto (temp)"; + break; + case 4: + result += "Inapto (def)"; + break; + } + } + } + return result; + } + +} + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresProcesso.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresProcesso.java new file mode 100755 index 00000000..b251b799 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresProcesso.java @@ -0,0 +1,74 @@ +package siprp.database.cayenne.objects; + +import java.util.HashMap; + +import siprp.MedicinaConstants; +import siprp.ProcessoConstants; +import siprp.database.cayenne.objects.auto._TrabalhadoresProcesso; + +public class TrabalhadoresProcesso extends _TrabalhadoresProcesso implements ProcessoConstants { + + private static final long serialVersionUID = 1L; + + + private static final HashMap MOTIVOS_BY_ID = new HashMap(); + + static + { + MOTIVOS_BY_ID.put( MedicinaConstants.MOTIVO_ADMISSAO_INTEGER, MedicinaConstants.MOTIVO_ADMISSAO_STR ); + MOTIVOS_BY_ID.put( MedicinaConstants.MOTIVO_PERIODICO_INTEGER, MedicinaConstants.MOTIVO_PERIODICO_STR ); + MOTIVOS_BY_ID.put( MedicinaConstants.MOTIVO_OCASIONAL_INTEGER, MedicinaConstants.MOTIVO_OCASIONAL_STR ); + MOTIVOS_BY_ID.put( MedicinaConstants.MOTIVO_PERIODICO_INICIAL_INTEGER, MedicinaConstants.MOTIVO_PERIODICO_INICIAL_STR ); + } + + private String getDescricaoEstadoProcessoByCodigo() + { + return ESTADO_PROCESSO_BY_CODE.get( getEstado() ); + } + + private String getMotivoString() + { + return getMotivo() == null ? "" : MOTIVOS_BY_ID.get( getMotivo() ); + } + + private String getDataInicioString() + { + return getDataInicio() == null ? "" : DATE_FORMAT.format( getDataInicio() ); + } + + @Override + public String toString() + { + return getMotivoString() + " : " + getDescricaoEstadoProcessoByCodigo(); + } + + public HashMap getEstados() + { + HashMap result = new HashMap(); + result.put( PROCESSO_ABERTO_CODE, PROCESSO_ABERTO_DESCRIPTION ); + result.put( PROCESSO_CANCELADO_CODE, PROCESSO_CANCELADO_DESCRIPTION ); + result.put( PROCESSO_FECHADO_CODE, PROCESSO_FECHADO_DESCRIPTION ); + return result; + } + + public HashMap getMotivos() + { + HashMap result = new HashMap(); + result.put( MedicinaConstants.MOTIVO_ADMISSAO_INTEGER, MedicinaConstants.MOTIVO_ADMISSAO_STR); + result.put( MedicinaConstants.MOTIVO_OCASIONAL_INTEGER, MedicinaConstants.MOTIVO_OCASIONAL_STR); + result.put( MedicinaConstants.MOTIVO_PERIODICO_INICIAL_INTEGER, MedicinaConstants.MOTIVO_PERIODICO_INICIAL_STR); + result.put( MedicinaConstants.MOTIVO_PERIODICO_INTEGER, MedicinaConstants.MOTIVO_PERIODICO_STR); + return result; + } + + public boolean isEmpty() + { + boolean noConsultas = (getTrabalhadoresConsultasArray() == null || getTrabalhadoresConsultasArray().size() == 0); + boolean noExames= ( getTrabalhadoresEcdsArray() == null || getTrabalhadoresEcdsArray().size() == 0); + boolean noFicha = ( getTrabalhadoresFichasAptidaoArray() == null || getTrabalhadoresFichasAptidaoArray().size() == 0); + return noConsultas && noExames && noFicha; + } +} + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Avisos.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Avisos.java new file mode 100644 index 00000000..fc8fd557 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Avisos.java @@ -0,0 +1,96 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.Estabelecimentos; + +/** + * Class _Avisos was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Avisos extends BaseObject { + + public static final String DATA_AVISO_PROPERTY = "dataAviso"; + public static final String DATA_EVENTO_PROPERTY = "dataEvento"; + public static final String DESCRICAO_PROPERTY = "descricao"; + public static final String EVENTO_ID_PROPERTY = "eventoId"; + public static final String ID_PROPERTY = "id"; + public static final String TIPO_PROPERTY = "tipo"; + public static final String TRABALHADOR_ID_PROPERTY = "trabalhadorId"; + public static final String TO_EMPRESAS_PROPERTY = "toEmpresas"; + public static final String TO_ESTABELECIMENTOS_PROPERTY = "toEstabelecimentos"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDataAviso(Date dataAviso) { + writeProperty("dataAviso", dataAviso); + } + public Date getDataAviso() { + return (Date)readProperty("dataAviso"); + } + + public void setDataEvento(Date dataEvento) { + writeProperty("dataEvento", dataEvento); + } + public Date getDataEvento() { + return (Date)readProperty("dataEvento"); + } + + public void setDescricao(String descricao) { + writeProperty("descricao", descricao); + } + public String getDescricao() { + return (String)readProperty("descricao"); + } + + public void setEventoId(Integer eventoId) { + writeProperty("eventoId", eventoId); + } + public Integer getEventoId() { + return (Integer)readProperty("eventoId"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setTipo(Integer tipo) { + writeProperty("tipo", tipo); + } + public Integer getTipo() { + return (Integer)readProperty("tipo"); + } + + public void setTrabalhadorId(Integer trabalhadorId) { + writeProperty("trabalhadorId", trabalhadorId); + } + public Integer getTrabalhadorId() { + return (Integer)readProperty("trabalhadorId"); + } + + public void setToEmpresas(Empresas toEmpresas) { + setToOneTarget("toEmpresas", toEmpresas, true); + } + + public Empresas getToEmpresas() { + return (Empresas)readProperty("toEmpresas"); + } + + + public void setToEstabelecimentos(Estabelecimentos toEstabelecimentos) { + setToOneTarget("toEstabelecimentos", toEstabelecimentos, true); + } + + public Estabelecimentos getToEstabelecimentos() { + return (Estabelecimentos)readProperty("toEstabelecimentos"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Contactos.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Contactos.java new file mode 100644 index 00000000..a1e6aab7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Contactos.java @@ -0,0 +1,129 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.Prestadores; + +/** + * Class _Contactos was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Contactos extends BaseObject { + + public static final String CARGO_PROPERTY = "cargo"; + public static final String EMAIL_PROPERTY = "email"; + public static final String FAX_PROPERTY = "fax"; + public static final String ID_PROPERTY = "id"; + public static final String NOME_PROPERTY = "nome"; + public static final String TELEFONE_PROPERTY = "telefone"; + public static final String TELEMOVEL_PROPERTY = "telemovel"; + public static final String EMPRESAS_ARRAY_PROPERTY = "empresasArray"; + public static final String EMPRESAS_ARRAY1_PROPERTY = "empresasArray1"; + public static final String ESTABELECIMENTOS_ARRAY_PROPERTY = "estabelecimentosArray"; + public static final String PRESTADORES_ARRAY_PROPERTY = "prestadoresArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setCargo(String cargo) { + writeProperty("cargo", cargo); + } + public String getCargo() { + return (String)readProperty("cargo"); + } + + public void setEmail(String email) { + writeProperty("email", email); + } + public String getEmail() { + return (String)readProperty("email"); + } + + public void setFax(String fax) { + writeProperty("fax", fax); + } + public String getFax() { + return (String)readProperty("fax"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setNome(String nome) { + writeProperty("nome", nome); + } + public String getNome() { + return (String)readProperty("nome"); + } + + public void setTelefone(String telefone) { + writeProperty("telefone", telefone); + } + public String getTelefone() { + return (String)readProperty("telefone"); + } + + public void setTelemovel(String telemovel) { + writeProperty("telemovel", telemovel); + } + public String getTelemovel() { + return (String)readProperty("telemovel"); + } + + public void addToEmpresasArray(Empresas obj) { + addToManyTarget("empresasArray", obj, true); + } + public void removeFromEmpresasArray(Empresas obj) { + removeToManyTarget("empresasArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getEmpresasArray() { + return (List)readProperty("empresasArray"); + } + + + public void addToEmpresasArray1(Empresas obj) { + addToManyTarget("empresasArray1", obj, true); + } + public void removeFromEmpresasArray1(Empresas obj) { + removeToManyTarget("empresasArray1", obj, true); + } + @SuppressWarnings("unchecked") + public List getEmpresasArray1() { + return (List)readProperty("empresasArray1"); + } + + + public void addToEstabelecimentosArray(Estabelecimentos obj) { + addToManyTarget("estabelecimentosArray", obj, true); + } + public void removeFromEstabelecimentosArray(Estabelecimentos obj) { + removeToManyTarget("estabelecimentosArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getEstabelecimentosArray() { + return (List)readProperty("estabelecimentosArray"); + } + + + public void addToPrestadoresArray(Prestadores obj) { + addToManyTarget("prestadoresArray", obj, true); + } + public void removeFromPrestadoresArray(Prestadores obj) { + removeToManyTarget("prestadoresArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getPrestadoresArray() { + return (List)readProperty("prestadoresArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_EcdOficial.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_EcdOficial.java new file mode 100644 index 00000000..46696475 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_EcdOficial.java @@ -0,0 +1,72 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.TrabalhadoresEcd; + +/** + * Class _EcdOficial was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _EcdOficial extends BaseObject { + + public static final String ACTIVO_PROPERTY = "activo"; + public static final String DESCRICAO_PROPERTY = "descricao"; + public static final String DESCRICAO_PLAIN_PROPERTY = "descricaoPlain"; + public static final String ID_PROPERTY = "id"; + public static final String ORDEM_PROPERTY = "ordem"; + public static final String TRABALHADORES_ECD_ARRAY_PROPERTY = "trabalhadoresEcdArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setActivo(String activo) { + writeProperty("activo", activo); + } + public String getActivo() { + return (String)readProperty("activo"); + } + + public void setDescricao(String descricao) { + writeProperty("descricao", descricao); + } + public String getDescricao() { + return (String)readProperty("descricao"); + } + + public void setDescricaoPlain(String descricaoPlain) { + writeProperty("descricaoPlain", descricaoPlain); + } + public String getDescricaoPlain() { + return (String)readProperty("descricaoPlain"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setOrdem(Integer ordem) { + writeProperty("ordem", ordem); + } + public Integer getOrdem() { + return (Integer)readProperty("ordem"); + } + + public void addToTrabalhadoresEcdArray(TrabalhadoresEcd obj) { + addToManyTarget("trabalhadoresEcdArray", obj, true); + } + public void removeFromTrabalhadoresEcdArray(TrabalhadoresEcd obj) { + removeToManyTarget("trabalhadoresEcdArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresEcdArray() { + return (List)readProperty("trabalhadoresEcdArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_EmailPlanoDeActuacao.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_EmailPlanoDeActuacao.java new file mode 100644 index 00000000..e6a75aa0 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_EmailPlanoDeActuacao.java @@ -0,0 +1,35 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Estabelecimentos; + +/** + * Class _EmailPlanoDeActuacao was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _EmailPlanoDeActuacao extends BaseObject { + + public static final String DESCRIPTION_PROPERTY = "description"; + public static final String TO_ESTABELECIMENTOS_PROPERTY = "toEstabelecimentos"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDescription(String description) { + writeProperty("description", description); + } + public String getDescription() { + return (String)readProperty("description"); + } + + public void setToEstabelecimentos(Estabelecimentos toEstabelecimentos) { + setToOneTarget("toEstabelecimentos", toEstabelecimentos, true); + } + + public Estabelecimentos getToEstabelecimentos() { + return (Estabelecimentos)readProperty("toEstabelecimentos"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Empresas.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Empresas.java new file mode 100644 index 00000000..f3074752 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Empresas.java @@ -0,0 +1,527 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.Avisos; +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Contactos; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsArea; +import siprp.database.cayenne.objects.HsEmailEmpresa; +import siprp.database.cayenne.objects.HsLegislacaoEmpresa; +import siprp.database.cayenne.objects.HsNormalizacaoEmpresa; +import siprp.database.cayenne.objects.HsRiscoEmpresa; +import siprp.database.cayenne.objects.Image; +import siprp.database.cayenne.objects.Lembretes; +import siprp.database.cayenne.objects.MarcacoesEmpresa; +import siprp.database.cayenne.objects.PrtElementosProtocolo; + +/** + * Class _Empresas was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Empresas extends BaseObject { + + public static final String A_CONSULTAS_PROPERTY = "aConsultas"; + public static final String A_EXAMES_PROPERTY = "aExames"; + public static final String ACTIVIDADE_PROPERTY = "actividade"; + public static final String ACTUALIZACAO_PROPERTY = "actualizacao"; + public static final String B_CONSULTAS_PROPERTY = "bConsultas"; + public static final String B_EXAMES_PROPERTY = "bExames"; + public static final String CAE_PROPERTY = "cae"; + public static final String CODIGO1_PROPERTY = "codigo1"; + public static final String CODIGO2_PROPERTY = "codigo2"; + public static final String CODIGO3_PROPERTY = "codigo3"; + public static final String CODIGO_POSTAL_PROPERTY = "codigoPostal"; + public static final String CONCELHO_PROPERTY = "concelho"; + public static final String CONTRIBUINTE_PROPERTY = "contribuinte"; + public static final String DATA_ACEITACAO_PROPERTY = "dataAceitacao"; + public static final String DATA_CANCELAMENTO_PROPERTY = "dataCancelamento"; + public static final String DATA_ENVIO_CONTRATO_PROPERTY = "dataEnvioContrato"; + public static final String DATA_ENVIO_IDICT_PROPERTY = "dataEnvioIdict"; + public static final String DATA_PROPOSTA_PROPERTY = "dataProposta"; + public static final String DATA_RECEPCAO_CONTRATO_PROPERTY = "dataRecepcaoContrato"; + public static final String DATA_RELATORIO_ANUAL_PROPERTY = "dataRelatorioAnual"; + public static final String DESIGNACAO_SOCIAL_PROPERTY = "designacaoSocial"; + public static final String DESIGNACAO_SOCIAL_PLAIN_PROPERTY = "designacaoSocialPlain"; + public static final String DISTRITO_PROPERTY = "distrito"; + public static final String DURACAO_PROPERTY = "duracao"; + public static final String ID_PROPERTY = "id"; + public static final String IMPRIMIR_TABELA_ALARGADA_PROPERTY = "imprimirTabelaAlargada"; + public static final String INACTIVO_PROPERTY = "inactivo"; + public static final String INICIO_CONTRATO_PROPERTY = "inicioContrato"; + public static final String LOCALIDADE_PROPERTY = "localidade"; + public static final String MORADA_PROPERTY = "morada"; + public static final String NUMERO_TRABALHADORES_PROPERTY = "numeroTrabalhadores"; + public static final String PERFIL1_PROPERTY = "perfil1"; + public static final String PERFIL2_PROPERTY = "perfil2"; + public static final String PERIODICIDADE_PROPERTY = "periodicidade"; + public static final String PRECO_HIGIENE_PROPERTY = "precoHigiene"; + public static final String PRECO_MEDICINA_PROPERTY = "precoMedicina"; + public static final String SEGURANCA_SOCIAL_PROPERTY = "segurancaSocial"; + public static final String SERVICO_HIGIENE_DESIGNACAO_PROPERTY = "servicoHigieneDesignacao"; + public static final String SERVICO_HIGIENE_TIPO_PROPERTY = "servicoHigieneTipo"; + public static final String SERVICO_SAUDE_DESIGNACAO_PROPERTY = "servicoSaudeDesignacao"; + public static final String SERVICO_SAUDE_TIPO_PROPERTY = "servicoSaudeTipo"; + public static final String SERVICOS_PROPERTY = "servicos"; + public static final String AVISOS_ARRAY_PROPERTY = "avisosArray"; + public static final String ESTABELECIMENTOS_ARRAY_PROPERTY = "estabelecimentosArray"; + public static final String HS_AREA_ARRAY_PROPERTY = "hsAreaArray"; + public static final String HS_EMAIL_EMPRESA_PROPERTY = "hsEmailEmpresa"; + public static final String HS_LEGISLACAO_EMPRESA_ARRAY_PROPERTY = "hsLegislacaoEmpresaArray"; + public static final String HS_NORMALIZACAO_EMPRESA_ARRAY_PROPERTY = "hsNormalizacaoEmpresaArray"; + public static final String HS_RISCO_EMPRESA_ARRAY_PROPERTY = "hsRiscoEmpresaArray"; + public static final String LEMBRETES_ARRAY_PROPERTY = "lembretesArray"; + public static final String MARCACOES_EMPRESA_ARRAY_PROPERTY = "marcacoesEmpresaArray"; + public static final String PRT_ELEMENTOS_PROTOCOLO_ARRAY_PROPERTY = "prtElementosProtocoloArray"; + public static final String TO_CONTACTOS_PROPERTY = "toContactos"; + public static final String TO_CONTACTOS1_PROPERTY = "toContactos1"; + public static final String TO_LOGOTIPO_PROPERTY = "toLogotipo"; + + public static final String ID_PK_COLUMN = "id"; + + public void setAConsultas(String aConsultas) { + writeProperty("aConsultas", aConsultas); + } + public String getAConsultas() { + return (String)readProperty("aConsultas"); + } + + public void setAExames(String aExames) { + writeProperty("aExames", aExames); + } + public String getAExames() { + return (String)readProperty("aExames"); + } + + public void setActividade(String actividade) { + writeProperty("actividade", actividade); + } + public String getActividade() { + return (String)readProperty("actividade"); + } + + public void setActualizacao(Date actualizacao) { + writeProperty("actualizacao", actualizacao); + } + public Date getActualizacao() { + return (Date)readProperty("actualizacao"); + } + + public void setBConsultas(String bConsultas) { + writeProperty("bConsultas", bConsultas); + } + public String getBConsultas() { + return (String)readProperty("bConsultas"); + } + + public void setBExames(String bExames) { + writeProperty("bExames", bExames); + } + public String getBExames() { + return (String)readProperty("bExames"); + } + + public void setCae(String cae) { + writeProperty("cae", cae); + } + public String getCae() { + return (String)readProperty("cae"); + } + + public void setCodigo1(String codigo1) { + writeProperty("codigo1", codigo1); + } + public String getCodigo1() { + return (String)readProperty("codigo1"); + } + + public void setCodigo2(String codigo2) { + writeProperty("codigo2", codigo2); + } + public String getCodigo2() { + return (String)readProperty("codigo2"); + } + + public void setCodigo3(String codigo3) { + writeProperty("codigo3", codigo3); + } + public String getCodigo3() { + return (String)readProperty("codigo3"); + } + + public void setCodigoPostal(String codigoPostal) { + writeProperty("codigoPostal", codigoPostal); + } + public String getCodigoPostal() { + return (String)readProperty("codigoPostal"); + } + + public void setConcelho(String concelho) { + writeProperty("concelho", concelho); + } + public String getConcelho() { + return (String)readProperty("concelho"); + } + + public void setContribuinte(String contribuinte) { + writeProperty("contribuinte", contribuinte); + } + public String getContribuinte() { + return (String)readProperty("contribuinte"); + } + + public void setDataAceitacao(Date dataAceitacao) { + writeProperty("dataAceitacao", dataAceitacao); + } + public Date getDataAceitacao() { + return (Date)readProperty("dataAceitacao"); + } + + public void setDataCancelamento(Date dataCancelamento) { + writeProperty("dataCancelamento", dataCancelamento); + } + public Date getDataCancelamento() { + return (Date)readProperty("dataCancelamento"); + } + + public void setDataEnvioContrato(Date dataEnvioContrato) { + writeProperty("dataEnvioContrato", dataEnvioContrato); + } + public Date getDataEnvioContrato() { + return (Date)readProperty("dataEnvioContrato"); + } + + public void setDataEnvioIdict(Date dataEnvioIdict) { + writeProperty("dataEnvioIdict", dataEnvioIdict); + } + public Date getDataEnvioIdict() { + return (Date)readProperty("dataEnvioIdict"); + } + + public void setDataProposta(Date dataProposta) { + writeProperty("dataProposta", dataProposta); + } + public Date getDataProposta() { + return (Date)readProperty("dataProposta"); + } + + public void setDataRecepcaoContrato(Date dataRecepcaoContrato) { + writeProperty("dataRecepcaoContrato", dataRecepcaoContrato); + } + public Date getDataRecepcaoContrato() { + return (Date)readProperty("dataRecepcaoContrato"); + } + + public void setDataRelatorioAnual(Date dataRelatorioAnual) { + writeProperty("dataRelatorioAnual", dataRelatorioAnual); + } + public Date getDataRelatorioAnual() { + return (Date)readProperty("dataRelatorioAnual"); + } + + public void setDesignacaoSocial(String designacaoSocial) { + writeProperty("designacaoSocial", designacaoSocial); + } + public String getDesignacaoSocial() { + return (String)readProperty("designacaoSocial"); + } + + public void setDesignacaoSocialPlain(String designacaoSocialPlain) { + writeProperty("designacaoSocialPlain", designacaoSocialPlain); + } + public String getDesignacaoSocialPlain() { + return (String)readProperty("designacaoSocialPlain"); + } + + public void setDistrito(String distrito) { + writeProperty("distrito", distrito); + } + public String getDistrito() { + return (String)readProperty("distrito"); + } + + public void setDuracao(Integer duracao) { + writeProperty("duracao", duracao); + } + public Integer getDuracao() { + return (Integer)readProperty("duracao"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setImprimirTabelaAlargada(Boolean imprimirTabelaAlargada) { + writeProperty("imprimirTabelaAlargada", imprimirTabelaAlargada); + } + public Boolean getImprimirTabelaAlargada() { + return (Boolean)readProperty("imprimirTabelaAlargada"); + } + + public void setInactivo(String inactivo) { + writeProperty("inactivo", inactivo); + } + public String getInactivo() { + return (String)readProperty("inactivo"); + } + + public void setInicioContrato(Date inicioContrato) { + writeProperty("inicioContrato", inicioContrato); + } + public Date getInicioContrato() { + return (Date)readProperty("inicioContrato"); + } + + public void setLocalidade(String localidade) { + writeProperty("localidade", localidade); + } + public String getLocalidade() { + return (String)readProperty("localidade"); + } + + public void setMorada(String morada) { + writeProperty("morada", morada); + } + public String getMorada() { + return (String)readProperty("morada"); + } + + public void setNumeroTrabalhadores(Integer numeroTrabalhadores) { + writeProperty("numeroTrabalhadores", numeroTrabalhadores); + } + public Integer getNumeroTrabalhadores() { + return (Integer)readProperty("numeroTrabalhadores"); + } + + public void setPerfil1(String perfil1) { + writeProperty("perfil1", perfil1); + } + public String getPerfil1() { + return (String)readProperty("perfil1"); + } + + public void setPerfil2(String perfil2) { + writeProperty("perfil2", perfil2); + } + public String getPerfil2() { + return (String)readProperty("perfil2"); + } + + public void setPeriodicidade(String periodicidade) { + writeProperty("periodicidade", periodicidade); + } + public String getPeriodicidade() { + return (String)readProperty("periodicidade"); + } + + public void setPrecoHigiene(Double precoHigiene) { + writeProperty("precoHigiene", precoHigiene); + } + public Double getPrecoHigiene() { + return (Double)readProperty("precoHigiene"); + } + + public void setPrecoMedicina(Double precoMedicina) { + writeProperty("precoMedicina", precoMedicina); + } + public Double getPrecoMedicina() { + return (Double)readProperty("precoMedicina"); + } + + public void setSegurancaSocial(String segurancaSocial) { + writeProperty("segurancaSocial", segurancaSocial); + } + public String getSegurancaSocial() { + return (String)readProperty("segurancaSocial"); + } + + public void setServicoHigieneDesignacao(String servicoHigieneDesignacao) { + writeProperty("servicoHigieneDesignacao", servicoHigieneDesignacao); + } + public String getServicoHigieneDesignacao() { + return (String)readProperty("servicoHigieneDesignacao"); + } + + public void setServicoHigieneTipo(Integer servicoHigieneTipo) { + writeProperty("servicoHigieneTipo", servicoHigieneTipo); + } + public Integer getServicoHigieneTipo() { + return (Integer)readProperty("servicoHigieneTipo"); + } + + public void setServicoSaudeDesignacao(String servicoSaudeDesignacao) { + writeProperty("servicoSaudeDesignacao", servicoSaudeDesignacao); + } + public String getServicoSaudeDesignacao() { + return (String)readProperty("servicoSaudeDesignacao"); + } + + public void setServicoSaudeTipo(Integer servicoSaudeTipo) { + writeProperty("servicoSaudeTipo", servicoSaudeTipo); + } + public Integer getServicoSaudeTipo() { + return (Integer)readProperty("servicoSaudeTipo"); + } + + public void setServicos(Integer servicos) { + writeProperty("servicos", servicos); + } + public Integer getServicos() { + return (Integer)readProperty("servicos"); + } + + public void addToAvisosArray(Avisos obj) { + addToManyTarget("avisosArray", obj, true); + } + public void removeFromAvisosArray(Avisos obj) { + removeToManyTarget("avisosArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getAvisosArray() { + return (List)readProperty("avisosArray"); + } + + + public void addToEstabelecimentosArray(Estabelecimentos obj) { + addToManyTarget("estabelecimentosArray", obj, true); + } + public void removeFromEstabelecimentosArray(Estabelecimentos obj) { + removeToManyTarget("estabelecimentosArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getEstabelecimentosArray() { + return (List)readProperty("estabelecimentosArray"); + } + + + public void addToHsAreaArray(HsArea obj) { + addToManyTarget("hsAreaArray", obj, true); + } + public void removeFromHsAreaArray(HsArea obj) { + removeToManyTarget("hsAreaArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsAreaArray() { + return (List)readProperty("hsAreaArray"); + } + + + public void addToHsEmailEmpresa(HsEmailEmpresa obj) { + addToManyTarget("hsEmailEmpresa", obj, true); + } + public void removeFromHsEmailEmpresa(HsEmailEmpresa obj) { + removeToManyTarget("hsEmailEmpresa", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsEmailEmpresa() { + return (List)readProperty("hsEmailEmpresa"); + } + + + public void addToHsLegislacaoEmpresaArray(HsLegislacaoEmpresa obj) { + addToManyTarget("hsLegislacaoEmpresaArray", obj, true); + } + public void removeFromHsLegislacaoEmpresaArray(HsLegislacaoEmpresa obj) { + removeToManyTarget("hsLegislacaoEmpresaArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsLegislacaoEmpresaArray() { + return (List)readProperty("hsLegislacaoEmpresaArray"); + } + + + public void addToHsNormalizacaoEmpresaArray(HsNormalizacaoEmpresa obj) { + addToManyTarget("hsNormalizacaoEmpresaArray", obj, true); + } + public void removeFromHsNormalizacaoEmpresaArray(HsNormalizacaoEmpresa obj) { + removeToManyTarget("hsNormalizacaoEmpresaArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsNormalizacaoEmpresaArray() { + return (List)readProperty("hsNormalizacaoEmpresaArray"); + } + + + public void addToHsRiscoEmpresaArray(HsRiscoEmpresa obj) { + addToManyTarget("hsRiscoEmpresaArray", obj, true); + } + public void removeFromHsRiscoEmpresaArray(HsRiscoEmpresa obj) { + removeToManyTarget("hsRiscoEmpresaArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRiscoEmpresaArray() { + return (List)readProperty("hsRiscoEmpresaArray"); + } + + + public void addToLembretesArray(Lembretes obj) { + addToManyTarget("lembretesArray", obj, true); + } + public void removeFromLembretesArray(Lembretes obj) { + removeToManyTarget("lembretesArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getLembretesArray() { + return (List)readProperty("lembretesArray"); + } + + + public void addToMarcacoesEmpresaArray(MarcacoesEmpresa obj) { + addToManyTarget("marcacoesEmpresaArray", obj, true); + } + public void removeFromMarcacoesEmpresaArray(MarcacoesEmpresa obj) { + removeToManyTarget("marcacoesEmpresaArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getMarcacoesEmpresaArray() { + return (List)readProperty("marcacoesEmpresaArray"); + } + + + public void addToPrtElementosProtocoloArray(PrtElementosProtocolo obj) { + addToManyTarget("prtElementosProtocoloArray", obj, true); + } + public void removeFromPrtElementosProtocoloArray(PrtElementosProtocolo obj) { + removeToManyTarget("prtElementosProtocoloArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getPrtElementosProtocoloArray() { + return (List)readProperty("prtElementosProtocoloArray"); + } + + + public void setToContactos(Contactos toContactos) { + setToOneTarget("toContactos", toContactos, true); + } + + public Contactos getToContactos() { + return (Contactos)readProperty("toContactos"); + } + + + public void setToContactos1(Contactos toContactos1) { + setToOneTarget("toContactos1", toContactos1, true); + } + + public Contactos getToContactos1() { + return (Contactos)readProperty("toContactos1"); + } + + + public void setToLogotipo(Image toLogotipo) { + setToOneTarget("toLogotipo", toLogotipo, true); + } + + public Image getToLogotipo() { + return (Image)readProperty("toLogotipo"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Errors.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Errors.java new file mode 100644 index 00000000..dd3b32f0 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Errors.java @@ -0,0 +1,58 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; + +import siprp.database.cayenne.objects.BaseObject; + +/** + * Class _Errors was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Errors extends BaseObject { + + public static final String DATE_PROPERTY = "date"; + public static final String DESCRIPTION_PROPERTY = "description"; + public static final String ENVIRONMENT_PROPERTY = "environment"; + public static final String ID_PROPERTY = "id"; + public static final String TYPE_PROPERTY = "type"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDate(Date date) { + writeProperty("date", date); + } + public Date getDate() { + return (Date)readProperty("date"); + } + + public void setDescription(String description) { + writeProperty("description", description); + } + public String getDescription() { + return (String)readProperty("description"); + } + + public void setEnvironment(String environment) { + writeProperty("environment", environment); + } + public String getEnvironment() { + return (String)readProperty("environment"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setType(String type) { + writeProperty("type", type); + } + public String getType() { + return (String)readProperty("type"); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Estabelecimentos.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Estabelecimentos.java new file mode 100644 index 00000000..7eb0e07f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Estabelecimentos.java @@ -0,0 +1,293 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.Avisos; +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Contactos; +import siprp.database.cayenne.objects.EmailPlanoDeActuacao; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.HistoricoEstabelecimento; +import siprp.database.cayenne.objects.HsEmailEstabelecimento; +import siprp.database.cayenne.objects.HsLegislacaoEstabelecimento; +import siprp.database.cayenne.objects.HsNormalizacaoEstabelecimento; +import siprp.database.cayenne.objects.HsPostoEstabelecimento; +import siprp.database.cayenne.objects.Lembretes; +import siprp.database.cayenne.objects.MarcacoesEstabelecimento; +import siprp.database.cayenne.objects.Medicos; +import siprp.database.cayenne.objects.Prestadores; +import siprp.database.cayenne.objects.Trabalhadores; + +/** + * Class _Estabelecimentos was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Estabelecimentos extends BaseObject { + + public static final String ACTUALIZACAO_PROPERTY = "actualizacao"; + public static final String CODIGO_POSTAL_PROPERTY = "codigoPostal"; + public static final String CONTACTO_BACKUP_PROPERTY = "contactoBackup"; + public static final String HISTORICO_PROPERTY = "historico"; + public static final String ID_PROPERTY = "id"; + public static final String INACTIVO_PROPERTY = "inactivo"; + public static final String LOCALIDADE_PROPERTY = "localidade"; + public static final String MORADA_PROPERTY = "morada"; + public static final String NOME_PROPERTY = "nome"; + public static final String NOME_PLAIN_PROPERTY = "nomePlain"; + public static final String AVISOS_ARRAY_PROPERTY = "avisosArray"; + public static final String EMAIL_PLANO_DE_ACTUACAO_ARRAY_PROPERTY = "emailPlanoDeActuacaoArray"; + public static final String HISTORICO_ESTABELECIMENTO_ARRAY_PROPERTY = "historicoEstabelecimentoArray"; + public static final String HS_EMAIL_ESTABELECIMENTO_PROPERTY = "hsEmailEstabelecimento"; + public static final String HS_LEGISLACAO_ESTABELECIMENTO_ARRAY_PROPERTY = "hsLegislacaoEstabelecimentoArray"; + public static final String HS_NORMALIZACAO_ESTABELECIMENTO_ARRAY_PROPERTY = "hsNormalizacaoEstabelecimentoArray"; + public static final String HS_POSTO_ESTABELECIMENTO_ARRAY_PROPERTY = "hsPostoEstabelecimentoArray"; + public static final String LEMBRETES_ARRAY_PROPERTY = "lembretesArray"; + public static final String MARCACOES_ESTABELECIMENTO_ARRAY_PROPERTY = "marcacoesEstabelecimentoArray"; + public static final String TO_CONTACTOS_PROPERTY = "toContactos"; + public static final String TO_EMPRESAS_PROPERTY = "toEmpresas"; + public static final String TO_MEDICOS_PROPERTY = "toMedicos"; + public static final String TO_PRESTADORES_PROPERTY = "toPrestadores"; + public static final String TO_PRESTADORES1_PROPERTY = "toPrestadores1"; + public static final String TRABALHADORES_ARRAY_PROPERTY = "trabalhadoresArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setActualizacao(Date actualizacao) { + writeProperty("actualizacao", actualizacao); + } + public Date getActualizacao() { + return (Date)readProperty("actualizacao"); + } + + public void setCodigoPostal(String codigoPostal) { + writeProperty("codigoPostal", codigoPostal); + } + public String getCodigoPostal() { + return (String)readProperty("codigoPostal"); + } + + public void setContactoBackup(String contactoBackup) { + writeProperty("contactoBackup", contactoBackup); + } + public String getContactoBackup() { + return (String)readProperty("contactoBackup"); + } + + public void setHistorico(String historico) { + writeProperty("historico", historico); + } + public String getHistorico() { + return (String)readProperty("historico"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setInactivo(String inactivo) { + writeProperty("inactivo", inactivo); + } + public String getInactivo() { + return (String)readProperty("inactivo"); + } + + public void setLocalidade(String localidade) { + writeProperty("localidade", localidade); + } + public String getLocalidade() { + return (String)readProperty("localidade"); + } + + public void setMorada(String morada) { + writeProperty("morada", morada); + } + public String getMorada() { + return (String)readProperty("morada"); + } + + public void setNome(String nome) { + writeProperty("nome", nome); + } + public String getNome() { + return (String)readProperty("nome"); + } + + public void setNomePlain(String nomePlain) { + writeProperty("nomePlain", nomePlain); + } + public String getNomePlain() { + return (String)readProperty("nomePlain"); + } + + public void addToAvisosArray(Avisos obj) { + addToManyTarget("avisosArray", obj, true); + } + public void removeFromAvisosArray(Avisos obj) { + removeToManyTarget("avisosArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getAvisosArray() { + return (List)readProperty("avisosArray"); + } + + + public void addToEmailPlanoDeActuacaoArray(EmailPlanoDeActuacao obj) { + addToManyTarget("emailPlanoDeActuacaoArray", obj, true); + } + public void removeFromEmailPlanoDeActuacaoArray(EmailPlanoDeActuacao obj) { + removeToManyTarget("emailPlanoDeActuacaoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getEmailPlanoDeActuacaoArray() { + return (List)readProperty("emailPlanoDeActuacaoArray"); + } + + + public void addToHistoricoEstabelecimentoArray(HistoricoEstabelecimento obj) { + addToManyTarget("historicoEstabelecimentoArray", obj, true); + } + public void removeFromHistoricoEstabelecimentoArray(HistoricoEstabelecimento obj) { + removeToManyTarget("historicoEstabelecimentoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHistoricoEstabelecimentoArray() { + return (List)readProperty("historicoEstabelecimentoArray"); + } + + + public void addToHsEmailEstabelecimento(HsEmailEstabelecimento obj) { + addToManyTarget("hsEmailEstabelecimento", obj, true); + } + public void removeFromHsEmailEstabelecimento(HsEmailEstabelecimento obj) { + removeToManyTarget("hsEmailEstabelecimento", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsEmailEstabelecimento() { + return (List)readProperty("hsEmailEstabelecimento"); + } + + + public void addToHsLegislacaoEstabelecimentoArray(HsLegislacaoEstabelecimento obj) { + addToManyTarget("hsLegislacaoEstabelecimentoArray", obj, true); + } + public void removeFromHsLegislacaoEstabelecimentoArray(HsLegislacaoEstabelecimento obj) { + removeToManyTarget("hsLegislacaoEstabelecimentoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsLegislacaoEstabelecimentoArray() { + return (List)readProperty("hsLegislacaoEstabelecimentoArray"); + } + + + public void addToHsNormalizacaoEstabelecimentoArray(HsNormalizacaoEstabelecimento obj) { + addToManyTarget("hsNormalizacaoEstabelecimentoArray", obj, true); + } + public void removeFromHsNormalizacaoEstabelecimentoArray(HsNormalizacaoEstabelecimento obj) { + removeToManyTarget("hsNormalizacaoEstabelecimentoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsNormalizacaoEstabelecimentoArray() { + return (List)readProperty("hsNormalizacaoEstabelecimentoArray"); + } + + + public void addToHsPostoEstabelecimentoArray(HsPostoEstabelecimento obj) { + addToManyTarget("hsPostoEstabelecimentoArray", obj, true); + } + public void removeFromHsPostoEstabelecimentoArray(HsPostoEstabelecimento obj) { + removeToManyTarget("hsPostoEstabelecimentoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsPostoEstabelecimentoArray() { + return (List)readProperty("hsPostoEstabelecimentoArray"); + } + + + public void addToLembretesArray(Lembretes obj) { + addToManyTarget("lembretesArray", obj, true); + } + public void removeFromLembretesArray(Lembretes obj) { + removeToManyTarget("lembretesArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getLembretesArray() { + return (List)readProperty("lembretesArray"); + } + + + public void addToMarcacoesEstabelecimentoArray(MarcacoesEstabelecimento obj) { + addToManyTarget("marcacoesEstabelecimentoArray", obj, true); + } + public void removeFromMarcacoesEstabelecimentoArray(MarcacoesEstabelecimento obj) { + removeToManyTarget("marcacoesEstabelecimentoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getMarcacoesEstabelecimentoArray() { + return (List)readProperty("marcacoesEstabelecimentoArray"); + } + + + public void setToContactos(Contactos toContactos) { + setToOneTarget("toContactos", toContactos, true); + } + + public Contactos getToContactos() { + return (Contactos)readProperty("toContactos"); + } + + + public void setToEmpresas(Empresas toEmpresas) { + setToOneTarget("toEmpresas", toEmpresas, true); + } + + public Empresas getToEmpresas() { + return (Empresas)readProperty("toEmpresas"); + } + + + public void setToMedicos(Medicos toMedicos) { + setToOneTarget("toMedicos", toMedicos, true); + } + + public Medicos getToMedicos() { + return (Medicos)readProperty("toMedicos"); + } + + + public void setToPrestadores(Prestadores toPrestadores) { + setToOneTarget("toPrestadores", toPrestadores, true); + } + + public Prestadores getToPrestadores() { + return (Prestadores)readProperty("toPrestadores"); + } + + + public void setToPrestadores1(Prestadores toPrestadores1) { + setToOneTarget("toPrestadores1", toPrestadores1, true); + } + + public Prestadores getToPrestadores1() { + return (Prestadores)readProperty("toPrestadores1"); + } + + + public void addToTrabalhadoresArray(Trabalhadores obj) { + addToManyTarget("trabalhadoresArray", obj, true); + } + public void removeFromTrabalhadoresArray(Trabalhadores obj) { + removeToManyTarget("trabalhadoresArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresArray() { + return (List)readProperty("trabalhadoresArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Etiquetas.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Etiquetas.java new file mode 100644 index 00000000..d9ddfa1a --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Etiquetas.java @@ -0,0 +1,128 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; + +/** + * Class _Etiquetas was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Etiquetas extends BaseObject { + + public static final String ALTURA_PROPERTY = "altura"; + public static final String ALTURA_FOLHA_PROPERTY = "alturaFolha"; + public static final String COLUNAS_PROPERTY = "colunas"; + public static final String CONTINUA_PROPERTY = "continua"; + public static final String DESCRICAO_PROPERTY = "descricao"; + public static final String DESCRICAO_PLAIN_PROPERTY = "descricaoPlain"; + public static final String ID_PROPERTY = "id"; + public static final String LARGURA_PROPERTY = "largura"; + public static final String LARGURA_FOLHA_PROPERTY = "larguraFolha"; + public static final String LINHAS_PROPERTY = "linhas"; + public static final String MARGEM_CIMA_PROPERTY = "margemCima"; + public static final String MARGEM_ESQUERDA_PROPERTY = "margemEsquerda"; + public static final String MARGEM_HORIZONTAL_FOLHA_PROPERTY = "margemHorizontalFolha"; + public static final String MARGEM_VERTICAL_FOLHA_PROPERTY = "margemVerticalFolha"; + + public static final String ID_PK_COLUMN = "id"; + + public void setAltura(Float altura) { + writeProperty("altura", altura); + } + public Float getAltura() { + return (Float)readProperty("altura"); + } + + public void setAlturaFolha(Float alturaFolha) { + writeProperty("alturaFolha", alturaFolha); + } + public Float getAlturaFolha() { + return (Float)readProperty("alturaFolha"); + } + + public void setColunas(Integer colunas) { + writeProperty("colunas", colunas); + } + public Integer getColunas() { + return (Integer)readProperty("colunas"); + } + + public void setContinua(String continua) { + writeProperty("continua", continua); + } + public String getContinua() { + return (String)readProperty("continua"); + } + + public void setDescricao(String descricao) { + writeProperty("descricao", descricao); + } + public String getDescricao() { + return (String)readProperty("descricao"); + } + + public void setDescricaoPlain(String descricaoPlain) { + writeProperty("descricaoPlain", descricaoPlain); + } + public String getDescricaoPlain() { + return (String)readProperty("descricaoPlain"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setLargura(Float largura) { + writeProperty("largura", largura); + } + public Float getLargura() { + return (Float)readProperty("largura"); + } + + public void setLarguraFolha(Float larguraFolha) { + writeProperty("larguraFolha", larguraFolha); + } + public Float getLarguraFolha() { + return (Float)readProperty("larguraFolha"); + } + + public void setLinhas(Integer linhas) { + writeProperty("linhas", linhas); + } + public Integer getLinhas() { + return (Integer)readProperty("linhas"); + } + + public void setMargemCima(Float margemCima) { + writeProperty("margemCima", margemCima); + } + public Float getMargemCima() { + return (Float)readProperty("margemCima"); + } + + public void setMargemEsquerda(Float margemEsquerda) { + writeProperty("margemEsquerda", margemEsquerda); + } + public Float getMargemEsquerda() { + return (Float)readProperty("margemEsquerda"); + } + + public void setMargemHorizontalFolha(Float margemHorizontalFolha) { + writeProperty("margemHorizontalFolha", margemHorizontalFolha); + } + public Float getMargemHorizontalFolha() { + return (Float)readProperty("margemHorizontalFolha"); + } + + public void setMargemVerticalFolha(Float margemVerticalFolha) { + writeProperty("margemVerticalFolha", margemVerticalFolha); + } + public Float getMargemVerticalFolha() { + return (Float)readProperty("margemVerticalFolha"); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Exames.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Exames.java new file mode 100644 index 00000000..fa6daaef --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Exames.java @@ -0,0 +1,172 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Medicos; +import siprp.database.cayenne.objects.TrabalhadoresFichasAptidao; + +/** + * Class _Exames was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Exames extends BaseObject { + + public static final String DATA_PROPERTY = "data"; + public static final String FO_PROPERTY = "fo"; + public static final String ID_PROPERTY = "id"; + public static final String INACTIVO_PROPERTY = "inactivo"; + public static final String OCASIONAL_PROPERTY = "ocasional"; + public static final String OUTRA_FUNCAO1_PROPERTY = "outraFuncao1"; + public static final String OUTRA_FUNCAO2_PROPERTY = "outraFuncao2"; + public static final String OUTRA_FUNCAO3_PROPERTY = "outraFuncao3"; + public static final String OUTRA_FUNCAO4_PROPERTY = "outraFuncao4"; + public static final String OUTRAS_RECOMENDACOES_PROPERTY = "outrasRecomendacoes"; + public static final String OUTRO_TIPO_PROPERTY = "outroTipo"; + public static final String PDF_PROPERTY = "pdf"; + public static final String PROXIMO_EXAME_PROPERTY = "proximoExame"; + public static final String RESULTADO_PROPERTY = "resultado"; + public static final String TIPO_PROPERTY = "tipo"; + public static final String TRABALHADOR_ID_PROPERTY = "trabalhadorId"; + public static final String TO_MEDICOS_PROPERTY = "toMedicos"; + public static final String TRABALHADORES_FICHAS_APTIDAO_ARRAY_PROPERTY = "trabalhadoresFichasAptidaoArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setData(Date data) { + writeProperty("data", data); + } + public Date getData() { + return (Date)readProperty("data"); + } + + public void setFo(byte[] fo) { + writeProperty("fo", fo); + } + public byte[] getFo() { + return (byte[])readProperty("fo"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setInactivo(String inactivo) { + writeProperty("inactivo", inactivo); + } + public String getInactivo() { + return (String)readProperty("inactivo"); + } + + public void setOcasional(Integer ocasional) { + writeProperty("ocasional", ocasional); + } + public Integer getOcasional() { + return (Integer)readProperty("ocasional"); + } + + public void setOutraFuncao1(String outraFuncao1) { + writeProperty("outraFuncao1", outraFuncao1); + } + public String getOutraFuncao1() { + return (String)readProperty("outraFuncao1"); + } + + public void setOutraFuncao2(String outraFuncao2) { + writeProperty("outraFuncao2", outraFuncao2); + } + public String getOutraFuncao2() { + return (String)readProperty("outraFuncao2"); + } + + public void setOutraFuncao3(String outraFuncao3) { + writeProperty("outraFuncao3", outraFuncao3); + } + public String getOutraFuncao3() { + return (String)readProperty("outraFuncao3"); + } + + public void setOutraFuncao4(String outraFuncao4) { + writeProperty("outraFuncao4", outraFuncao4); + } + public String getOutraFuncao4() { + return (String)readProperty("outraFuncao4"); + } + + public void setOutrasRecomendacoes(String outrasRecomendacoes) { + writeProperty("outrasRecomendacoes", outrasRecomendacoes); + } + public String getOutrasRecomendacoes() { + return (String)readProperty("outrasRecomendacoes"); + } + + public void setOutroTipo(String outroTipo) { + writeProperty("outroTipo", outroTipo); + } + public String getOutroTipo() { + return (String)readProperty("outroTipo"); + } + + public void setPdf(byte[] pdf) { + writeProperty("pdf", pdf); + } + public byte[] getPdf() { + return (byte[])readProperty("pdf"); + } + + public void setProximoExame(Date proximoExame) { + writeProperty("proximoExame", proximoExame); + } + public Date getProximoExame() { + return (Date)readProperty("proximoExame"); + } + + public void setResultado(Integer resultado) { + writeProperty("resultado", resultado); + } + public Integer getResultado() { + return (Integer)readProperty("resultado"); + } + + public void setTipo(Integer tipo) { + writeProperty("tipo", tipo); + } + public Integer getTipo() { + return (Integer)readProperty("tipo"); + } + + public void setTrabalhadorId(Integer trabalhadorId) { + writeProperty("trabalhadorId", trabalhadorId); + } + public Integer getTrabalhadorId() { + return (Integer)readProperty("trabalhadorId"); + } + + public void setToMedicos(Medicos toMedicos) { + setToOneTarget("toMedicos", toMedicos, true); + } + + public Medicos getToMedicos() { + return (Medicos)readProperty("toMedicos"); + } + + + public void addToTrabalhadoresFichasAptidaoArray(TrabalhadoresFichasAptidao obj) { + addToManyTarget("trabalhadoresFichasAptidaoArray", obj, true); + } + public void removeFromTrabalhadoresFichasAptidaoArray(TrabalhadoresFichasAptidao obj) { + removeToManyTarget("trabalhadoresFichasAptidaoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresFichasAptidaoArray() { + return (List)readProperty("trabalhadoresFichasAptidaoArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_ExamesPerfis.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_ExamesPerfis.java new file mode 100644 index 00000000..23e5d4ba --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_ExamesPerfis.java @@ -0,0 +1,51 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.TiposExamesComp; + +/** + * Class _ExamesPerfis was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _ExamesPerfis extends BaseObject { + + public static final String ID_PROPERTY = "id"; + public static final String MULTIPLICADOR_PROPERTY = "multiplicador"; + public static final String PERFIL_PROPERTY = "perfil"; + public static final String TO_TIPOS_EXAMES_COMP_PROPERTY = "toTiposExamesComp"; + + public static final String ID_PK_COLUMN = "id"; + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setMultiplicador(Integer multiplicador) { + writeProperty("multiplicador", multiplicador); + } + public Integer getMultiplicador() { + return (Integer)readProperty("multiplicador"); + } + + public void setPerfil(Integer perfil) { + writeProperty("perfil", perfil); + } + public Integer getPerfil() { + return (Integer)readProperty("perfil"); + } + + public void setToTiposExamesComp(TiposExamesComp toTiposExamesComp) { + setToOneTarget("toTiposExamesComp", toTiposExamesComp, true); + } + + public TiposExamesComp getToTiposExamesComp() { + return (TiposExamesComp)readProperty("toTiposExamesComp"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_ExamesPortaria.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_ExamesPortaria.java new file mode 100644 index 00000000..b3d05da1 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_ExamesPortaria.java @@ -0,0 +1,42 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; + +import siprp.database.cayenne.objects.BaseObject; + +/** + * Class _ExamesPortaria was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _ExamesPortaria extends BaseObject { + + public static final String DATA_ENTRADA_PROPERTY = "dataEntrada"; + public static final String ID_PROPERTY = "id"; + public static final String PORTARIA_PROPERTY = "portaria"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDataEntrada(Date dataEntrada) { + writeProperty("dataEntrada", dataEntrada); + } + public Date getDataEntrada() { + return (Date)readProperty("dataEntrada"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setPortaria(String portaria) { + writeProperty("portaria", portaria); + } + public String getPortaria() { + return (String)readProperty("portaria"); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HistoricoEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HistoricoEstabelecimento.java new file mode 100644 index 00000000..c0a83806 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HistoricoEstabelecimento.java @@ -0,0 +1,53 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Estabelecimentos; + +/** + * Class _HistoricoEstabelecimento was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HistoricoEstabelecimento extends BaseObject { + + public static final String DATA_PROPERTY = "data"; + public static final String ID_PROPERTY = "id"; + public static final String TEXTO_PROPERTY = "texto"; + public static final String TO_ESTABELECIMENTOS_PROPERTY = "toEstabelecimentos"; + + public static final String ID_PK_COLUMN = "id"; + + public void setData(Date data) { + writeProperty("data", data); + } + public Date getData() { + return (Date)readProperty("data"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setTexto(String texto) { + writeProperty("texto", texto); + } + public String getTexto() { + return (String)readProperty("texto"); + } + + public void setToEstabelecimentos(Estabelecimentos toEstabelecimentos) { + setToOneTarget("toEstabelecimentos", toEstabelecimentos, true); + } + + public Estabelecimentos getToEstabelecimentos() { + return (Estabelecimentos)readProperty("toEstabelecimentos"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsArea.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsArea.java new file mode 100644 index 00000000..190231bb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsArea.java @@ -0,0 +1,84 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.HsPosto; + +/** + * Class _HsArea was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsArea extends BaseObject { + + public static final String DELETED_DATE_PROPERTY = "deletedDate"; + public static final String DESCRIPTION_PROPERTY = "description"; + public static final String EMPRESA_ID_PROPERTY = "empresaId"; + public static final String ID_PROPERTY = "id"; + public static final String ORDER_PROPERTY = "order"; + public static final String HS_POSTO_ARRAY_PROPERTY = "hsPostoArray"; + public static final String TO_EMPRESAS_PROPERTY = "toEmpresas"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDeletedDate(Date deletedDate) { + writeProperty("deletedDate", deletedDate); + } + public Date getDeletedDate() { + return (Date)readProperty("deletedDate"); + } + + public void setDescription(String description) { + writeProperty("description", description); + } + public String getDescription() { + return (String)readProperty("description"); + } + + public void setEmpresaId(Integer empresaId) { + writeProperty("empresaId", empresaId); + } + public Integer getEmpresaId() { + return (Integer)readProperty("empresaId"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setOrder(Integer order) { + writeProperty("order", order); + } + public Integer getOrder() { + return (Integer)readProperty("order"); + } + + public void addToHsPostoArray(HsPosto obj) { + addToManyTarget("hsPostoArray", obj, true); + } + public void removeFromHsPostoArray(HsPosto obj) { + removeToManyTarget("hsPostoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsPostoArray() { + return (List)readProperty("hsPostoArray"); + } + + + public void setToEmpresas(Empresas toEmpresas) { + setToOneTarget("toEmpresas", toEmpresas, true); + } + + public Empresas getToEmpresas() { + return (Empresas)readProperty("toEmpresas"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsEmail.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsEmail.java new file mode 100644 index 00000000..58b132dc --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsEmail.java @@ -0,0 +1,54 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsEmailEmpresa; +import siprp.database.cayenne.objects.HsEmailEstabelecimento; + +/** + * Class _HsEmail was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsEmail extends BaseObject { + + public static final String EMAIL_PROPERTY = "email"; + public static final String HS_EMAIL_EMPRESA_ARRAY_PROPERTY = "hsEmailEmpresaArray"; + public static final String HS_EMAIL_ESTABELECIMENTO_ARRAY_PROPERTY = "hsEmailEstabelecimentoArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setEmail(String email) { + writeProperty("email", email); + } + public String getEmail() { + return (String)readProperty("email"); + } + + public void addToHsEmailEmpresaArray(HsEmailEmpresa obj) { + addToManyTarget("hsEmailEmpresaArray", obj, true); + } + public void removeFromHsEmailEmpresaArray(HsEmailEmpresa obj) { + removeToManyTarget("hsEmailEmpresaArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsEmailEmpresaArray() { + return (List)readProperty("hsEmailEmpresaArray"); + } + + + public void addToHsEmailEstabelecimentoArray(HsEmailEstabelecimento obj) { + addToManyTarget("hsEmailEstabelecimentoArray", obj, true); + } + public void removeFromHsEmailEstabelecimentoArray(HsEmailEstabelecimento obj) { + removeToManyTarget("hsEmailEstabelecimentoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsEmailEstabelecimentoArray() { + return (List)readProperty("hsEmailEstabelecimentoArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsEmailEmpresa.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsEmailEmpresa.java new file mode 100644 index 00000000..c45d96e0 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsEmailEmpresa.java @@ -0,0 +1,39 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.HsEmail; + +/** + * Class _HsEmailEmpresa was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsEmailEmpresa extends BaseObject { + + public static final String TO_EMPRESA_PROPERTY = "toEmpresa"; + public static final String TO_HS_EMAIL_PROPERTY = "toHsEmail"; + + public static final String EMAIL_ID_PK_COLUMN = "email_id"; + public static final String EMPRESA_ID_PK_COLUMN = "empresa_id"; + + public void setToEmpresa(Empresas toEmpresa) { + setToOneTarget("toEmpresa", toEmpresa, true); + } + + public Empresas getToEmpresa() { + return (Empresas)readProperty("toEmpresa"); + } + + + public void setToHsEmail(HsEmail toHsEmail) { + setToOneTarget("toHsEmail", toHsEmail, true); + } + + public HsEmail getToHsEmail() { + return (HsEmail)readProperty("toHsEmail"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsEmailEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsEmailEstabelecimento.java new file mode 100644 index 00000000..bb6fd529 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsEmailEstabelecimento.java @@ -0,0 +1,39 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsEmail; + +/** + * Class _HsEmailEstabelecimento was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsEmailEstabelecimento extends BaseObject { + + public static final String TO_ESTABELECIMENTO_PROPERTY = "toEstabelecimento"; + public static final String TO_HS_EMAIL_PROPERTY = "toHsEmail"; + + public static final String EMAIL_ID_PK_COLUMN = "email_id"; + public static final String ESTABELECIMENTO_ID_PK_COLUMN = "estabelecimento_id"; + + public void setToEstabelecimento(Estabelecimentos toEstabelecimento) { + setToOneTarget("toEstabelecimento", toEstabelecimento, true); + } + + public Estabelecimentos getToEstabelecimento() { + return (Estabelecimentos)readProperty("toEstabelecimento"); + } + + + public void setToHsEmail(HsEmail toHsEmail) { + setToOneTarget("toHsEmail", toHsEmail, true); + } + + public HsEmail getToHsEmail() { + return (HsEmail)readProperty("toHsEmail"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsEquipamento.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsEquipamento.java new file mode 100644 index 00000000..4f8c55b4 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsEquipamento.java @@ -0,0 +1,58 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; + +import siprp.database.cayenne.objects.BaseObject; + +/** + * Class _HsEquipamento was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsEquipamento extends BaseObject { + + public static final String DELETED_DATE_PROPERTY = "deletedDate"; + public static final String ID_PROPERTY = "id"; + public static final String MARCA_PROPERTY = "marca"; + public static final String MODELO_PROPERTY = "modelo"; + public static final String TIPO_PROPERTY = "tipo"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDeletedDate(Date deletedDate) { + writeProperty("deletedDate", deletedDate); + } + public Date getDeletedDate() { + return (Date)readProperty("deletedDate"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setMarca(String marca) { + writeProperty("marca", marca); + } + public String getMarca() { + return (String)readProperty("marca"); + } + + public void setModelo(String modelo) { + writeProperty("modelo", modelo); + } + public String getModelo() { + return (String)readProperty("modelo"); + } + + public void setTipo(String tipo) { + writeProperty("tipo", tipo); + } + public String getTipo() { + return (String)readProperty("tipo"); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsLegislacao.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsLegislacao.java new file mode 100644 index 00000000..951326c7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsLegislacao.java @@ -0,0 +1,82 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsLegislacaoCategoria; +import siprp.database.cayenne.objects.HsLegislacaoEmpresa; +import siprp.database.cayenne.objects.HsLegislacaoEstabelecimento; + +/** + * Class _HsLegislacao was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsLegislacao extends BaseObject { + + public static final String DELETED_DATE_PROPERTY = "deletedDate"; + public static final String DESCRIPTION_PROPERTY = "description"; + public static final String ID_PROPERTY = "id"; + public static final String HS_LEGISLACAO_EMPRESA_ARRAY_PROPERTY = "hsLegislacaoEmpresaArray"; + public static final String HS_LEGISLACAO_ESTABELECIMENTO_ARRAY_PROPERTY = "hsLegislacaoEstabelecimentoArray"; + public static final String TO_HS_LEGISLACAO_CATEGORIA_PROPERTY = "toHsLegislacaoCategoria"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDeletedDate(Date deletedDate) { + writeProperty("deletedDate", deletedDate); + } + public Date getDeletedDate() { + return (Date)readProperty("deletedDate"); + } + + public void setDescription(String description) { + writeProperty("description", description); + } + public String getDescription() { + return (String)readProperty("description"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void addToHsLegislacaoEmpresaArray(HsLegislacaoEmpresa obj) { + addToManyTarget("hsLegislacaoEmpresaArray", obj, true); + } + public void removeFromHsLegislacaoEmpresaArray(HsLegislacaoEmpresa obj) { + removeToManyTarget("hsLegislacaoEmpresaArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsLegislacaoEmpresaArray() { + return (List)readProperty("hsLegislacaoEmpresaArray"); + } + + + public void addToHsLegislacaoEstabelecimentoArray(HsLegislacaoEstabelecimento obj) { + addToManyTarget("hsLegislacaoEstabelecimentoArray", obj, true); + } + public void removeFromHsLegislacaoEstabelecimentoArray(HsLegislacaoEstabelecimento obj) { + removeToManyTarget("hsLegislacaoEstabelecimentoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsLegislacaoEstabelecimentoArray() { + return (List)readProperty("hsLegislacaoEstabelecimentoArray"); + } + + + public void setToHsLegislacaoCategoria(HsLegislacaoCategoria toHsLegislacaoCategoria) { + setToOneTarget("toHsLegislacaoCategoria", toHsLegislacaoCategoria, true); + } + + public HsLegislacaoCategoria getToHsLegislacaoCategoria() { + return (HsLegislacaoCategoria)readProperty("toHsLegislacaoCategoria"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsLegislacaoCategoria.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsLegislacaoCategoria.java new file mode 100644 index 00000000..e3414c75 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsLegislacaoCategoria.java @@ -0,0 +1,49 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsLegislacao; + +/** + * Class _HsLegislacaoCategoria was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsLegislacaoCategoria extends BaseObject { + + public static final String DELETED_DATE_PROPERTY = "deletedDate"; + public static final String DESCRIPTION_PROPERTY = "description"; + public static final String HS_LEGISLACAO_ARRAY_PROPERTY = "hsLegislacaoArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDeletedDate(Date deletedDate) { + writeProperty("deletedDate", deletedDate); + } + public Date getDeletedDate() { + return (Date)readProperty("deletedDate"); + } + + public void setDescription(String description) { + writeProperty("description", description); + } + public String getDescription() { + return (String)readProperty("description"); + } + + public void addToHsLegislacaoArray(HsLegislacao obj) { + addToManyTarget("hsLegislacaoArray", obj, true); + } + public void removeFromHsLegislacaoArray(HsLegislacao obj) { + removeToManyTarget("hsLegislacaoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsLegislacaoArray() { + return (List)readProperty("hsLegislacaoArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsLegislacaoEmpresa.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsLegislacaoEmpresa.java new file mode 100644 index 00000000..3953a419 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsLegislacaoEmpresa.java @@ -0,0 +1,39 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.HsLegislacao; + +/** + * Class _HsLegislacaoEmpresa was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsLegislacaoEmpresa extends BaseObject { + + public static final String TO_HS_EMPRESA_PROPERTY = "toHsEmpresa"; + public static final String TO_HS_LEGISLACAO_PROPERTY = "toHsLegislacao"; + + public static final String EMPRESA_ID_PK_COLUMN = "empresa_id"; + public static final String LEGISLACAO_ID_PK_COLUMN = "legislacao_id"; + + public void setToHsEmpresa(Empresas toHsEmpresa) { + setToOneTarget("toHsEmpresa", toHsEmpresa, true); + } + + public Empresas getToHsEmpresa() { + return (Empresas)readProperty("toHsEmpresa"); + } + + + public void setToHsLegislacao(HsLegislacao toHsLegislacao) { + setToOneTarget("toHsLegislacao", toHsLegislacao, true); + } + + public HsLegislacao getToHsLegislacao() { + return (HsLegislacao)readProperty("toHsLegislacao"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsLegislacaoEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsLegislacaoEstabelecimento.java new file mode 100644 index 00000000..7966230f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsLegislacaoEstabelecimento.java @@ -0,0 +1,47 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsLegislacao; + +/** + * Class _HsLegislacaoEstabelecimento was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsLegislacaoEstabelecimento extends BaseObject { + + public static final String ORDEM_PROPERTY = "ordem"; + public static final String TO_HS_ESTABELECIMENTO_PROPERTY = "toHsEstabelecimento"; + public static final String TO_HS_LEGISLACAO_PROPERTY = "toHsLegislacao"; + + public static final String ESTABELECIMENTO_ID_PK_COLUMN = "estabelecimento_id"; + public static final String LEGISLACAO_ID_PK_COLUMN = "legislacao_id"; + + public void setOrdem(Integer ordem) { + writeProperty("ordem", ordem); + } + public Integer getOrdem() { + return (Integer)readProperty("ordem"); + } + + public void setToHsEstabelecimento(Estabelecimentos toHsEstabelecimento) { + setToOneTarget("toHsEstabelecimento", toHsEstabelecimento, true); + } + + public Estabelecimentos getToHsEstabelecimento() { + return (Estabelecimentos)readProperty("toHsEstabelecimento"); + } + + + public void setToHsLegislacao(HsLegislacao toHsLegislacao) { + setToOneTarget("toHsLegislacao", toHsLegislacao, true); + } + + public HsLegislacao getToHsLegislacao() { + return (HsLegislacao)readProperty("toHsLegislacao"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsMedida.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsMedida.java new file mode 100644 index 00000000..1d0fc984 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsMedida.java @@ -0,0 +1,71 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsPostoMedida; +import siprp.database.cayenne.objects.HsRiscoMedida; + +/** + * Class _HsMedida was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsMedida extends BaseObject { + + public static final String DELETED_DATE_PROPERTY = "deletedDate"; + public static final String DESCRIPTION_PROPERTY = "description"; + public static final String REQUESITOS_LEGAIS_PROPERTY = "requesitosLegais"; + public static final String HS_POSTO_MEDIDA_ARRAY_PROPERTY = "hsPostoMedidaArray"; + public static final String HS_RISCO_MEDIDA_ARRAY_PROPERTY = "hsRiscoMedidaArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDeletedDate(Date deletedDate) { + writeProperty("deletedDate", deletedDate); + } + public Date getDeletedDate() { + return (Date)readProperty("deletedDate"); + } + + public void setDescription(String description) { + writeProperty("description", description); + } + public String getDescription() { + return (String)readProperty("description"); + } + + public void setRequesitosLegais(String requesitosLegais) { + writeProperty("requesitosLegais", requesitosLegais); + } + public String getRequesitosLegais() { + return (String)readProperty("requesitosLegais"); + } + + public void addToHsPostoMedidaArray(HsPostoMedida obj) { + addToManyTarget("hsPostoMedidaArray", obj, true); + } + public void removeFromHsPostoMedidaArray(HsPostoMedida obj) { + removeToManyTarget("hsPostoMedidaArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsPostoMedidaArray() { + return (List)readProperty("hsPostoMedidaArray"); + } + + + public void addToHsRiscoMedidaArray(HsRiscoMedida obj) { + addToManyTarget("hsRiscoMedidaArray", obj, true); + } + public void removeFromHsRiscoMedidaArray(HsRiscoMedida obj) { + removeToManyTarget("hsRiscoMedidaArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRiscoMedidaArray() { + return (List)readProperty("hsRiscoMedidaArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsNormalizacao.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsNormalizacao.java new file mode 100644 index 00000000..7f58892e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsNormalizacao.java @@ -0,0 +1,87 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsNormalizacaoEmpresa; +import siprp.database.cayenne.objects.HsNormalizacaoEstabelecimento; + +/** + * Class _HsNormalizacao was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsNormalizacao extends BaseObject { + + public static final String CODIGO_PROPERTY = "codigo"; + public static final String DELETED_DATE_PROPERTY = "deletedDate"; + public static final String DESCRICAO_PROPERTY = "descricao"; + public static final String ID_PROPERTY = "id"; + public static final String PORTUGUESA_PROPERTY = "portuguesa"; + public static final String HS_NORMALIZACAO_EMPRESA_ARRAY_PROPERTY = "hsNormalizacaoEmpresaArray"; + public static final String HS_NORMALIZACAO_ESTABELECIMENTO_ARRAY_PROPERTY = "hsNormalizacaoEstabelecimentoArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setCodigo(String codigo) { + writeProperty("codigo", codigo); + } + public String getCodigo() { + return (String)readProperty("codigo"); + } + + public void setDeletedDate(Date deletedDate) { + writeProperty("deletedDate", deletedDate); + } + public Date getDeletedDate() { + return (Date)readProperty("deletedDate"); + } + + public void setDescricao(String descricao) { + writeProperty("descricao", descricao); + } + public String getDescricao() { + return (String)readProperty("descricao"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setPortuguesa(Boolean portuguesa) { + writeProperty("portuguesa", portuguesa); + } + public Boolean getPortuguesa() { + return (Boolean)readProperty("portuguesa"); + } + + public void addToHsNormalizacaoEmpresaArray(HsNormalizacaoEmpresa obj) { + addToManyTarget("hsNormalizacaoEmpresaArray", obj, true); + } + public void removeFromHsNormalizacaoEmpresaArray(HsNormalizacaoEmpresa obj) { + removeToManyTarget("hsNormalizacaoEmpresaArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsNormalizacaoEmpresaArray() { + return (List)readProperty("hsNormalizacaoEmpresaArray"); + } + + + public void addToHsNormalizacaoEstabelecimentoArray(HsNormalizacaoEstabelecimento obj) { + addToManyTarget("hsNormalizacaoEstabelecimentoArray", obj, true); + } + public void removeFromHsNormalizacaoEstabelecimentoArray(HsNormalizacaoEstabelecimento obj) { + removeToManyTarget("hsNormalizacaoEstabelecimentoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsNormalizacaoEstabelecimentoArray() { + return (List)readProperty("hsNormalizacaoEstabelecimentoArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsNormalizacaoEmpresa.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsNormalizacaoEmpresa.java new file mode 100644 index 00000000..cd517508 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsNormalizacaoEmpresa.java @@ -0,0 +1,39 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.HsNormalizacao; + +/** + * Class _HsNormalizacaoEmpresa was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsNormalizacaoEmpresa extends BaseObject { + + public static final String TO_EMPRESA_PROPERTY = "toEmpresa"; + public static final String TO_HS_NORMALIZACAO_PROPERTY = "toHsNormalizacao"; + + public static final String EMPRESA_ID_PK_COLUMN = "empresa_id"; + public static final String NORMALIZACAO_ID_PK_COLUMN = "normalizacao_id"; + + public void setToEmpresa(Empresas toEmpresa) { + setToOneTarget("toEmpresa", toEmpresa, true); + } + + public Empresas getToEmpresa() { + return (Empresas)readProperty("toEmpresa"); + } + + + public void setToHsNormalizacao(HsNormalizacao toHsNormalizacao) { + setToOneTarget("toHsNormalizacao", toHsNormalizacao, true); + } + + public HsNormalizacao getToHsNormalizacao() { + return (HsNormalizacao)readProperty("toHsNormalizacao"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsNormalizacaoEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsNormalizacaoEstabelecimento.java new file mode 100644 index 00000000..39647746 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsNormalizacaoEstabelecimento.java @@ -0,0 +1,39 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsNormalizacao; + +/** + * Class _HsNormalizacaoEstabelecimento was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsNormalizacaoEstabelecimento extends BaseObject { + + public static final String TO_ESTABELECIMENTO_PROPERTY = "toEstabelecimento"; + public static final String TO_HS_NORMALIZACAO_PROPERTY = "toHsNormalizacao"; + + public static final String ESTABELECIMENTO_ID_PK_COLUMN = "estabelecimento_id"; + public static final String NORMALIZACAO_ID_PK_COLUMN = "normalizacao_id"; + + public void setToEstabelecimento(Estabelecimentos toEstabelecimento) { + setToOneTarget("toEstabelecimento", toEstabelecimento, true); + } + + public Estabelecimentos getToEstabelecimento() { + return (Estabelecimentos)readProperty("toEstabelecimento"); + } + + + public void setToHsNormalizacao(HsNormalizacao toHsNormalizacao) { + setToOneTarget("toHsNormalizacao", toHsNormalizacao, true); + } + + public HsNormalizacao getToHsNormalizacao() { + return (HsNormalizacao)readProperty("toHsNormalizacao"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsPosto.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsPosto.java new file mode 100644 index 00000000..caf2d7ad --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsPosto.java @@ -0,0 +1,104 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsArea; +import siprp.database.cayenne.objects.HsPostoEstabelecimento; +import siprp.database.cayenne.objects.HsPostoMedida; +import siprp.database.cayenne.objects.HsPostoRisco; + +/** + * Class _HsPosto was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsPosto extends BaseObject { + + public static final String DELETED_DATE_PROPERTY = "deletedDate"; + public static final String DESCRIPTION_PROPERTY = "description"; + public static final String ID_PROPERTY = "id"; + public static final String IS_PRINCIPAL_PROPERTY = "isPrincipal"; + public static final String HS_POSTO_ESTABELECIMENTO_ARRAY_PROPERTY = "hsPostoEstabelecimentoArray"; + public static final String HS_POSTO_MEDIDA_ARRAY_PROPERTY = "hsPostoMedidaArray"; + public static final String HS_POSTO_RISCO_ARRAY_PROPERTY = "hsPostoRiscoArray"; + public static final String TO_HS_AREA_PROPERTY = "toHsArea"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDeletedDate(Date deletedDate) { + writeProperty("deletedDate", deletedDate); + } + public Date getDeletedDate() { + return (Date)readProperty("deletedDate"); + } + + public void setDescription(String description) { + writeProperty("description", description); + } + public String getDescription() { + return (String)readProperty("description"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setIsPrincipal(Boolean isPrincipal) { + writeProperty("isPrincipal", isPrincipal); + } + public Boolean getIsPrincipal() { + return (Boolean)readProperty("isPrincipal"); + } + + public void addToHsPostoEstabelecimentoArray(HsPostoEstabelecimento obj) { + addToManyTarget("hsPostoEstabelecimentoArray", obj, true); + } + public void removeFromHsPostoEstabelecimentoArray(HsPostoEstabelecimento obj) { + removeToManyTarget("hsPostoEstabelecimentoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsPostoEstabelecimentoArray() { + return (List)readProperty("hsPostoEstabelecimentoArray"); + } + + + public void addToHsPostoMedidaArray(HsPostoMedida obj) { + addToManyTarget("hsPostoMedidaArray", obj, true); + } + public void removeFromHsPostoMedidaArray(HsPostoMedida obj) { + removeToManyTarget("hsPostoMedidaArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsPostoMedidaArray() { + return (List)readProperty("hsPostoMedidaArray"); + } + + + public void addToHsPostoRiscoArray(HsPostoRisco obj) { + addToManyTarget("hsPostoRiscoArray", obj, true); + } + public void removeFromHsPostoRiscoArray(HsPostoRisco obj) { + removeToManyTarget("hsPostoRiscoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsPostoRiscoArray() { + return (List)readProperty("hsPostoRiscoArray"); + } + + + public void setToHsArea(HsArea toHsArea) { + setToOneTarget("toHsArea", toHsArea, true); + } + + public HsArea getToHsArea() { + return (HsArea)readProperty("toHsArea"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsPostoEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsPostoEstabelecimento.java new file mode 100644 index 00000000..95949606 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsPostoEstabelecimento.java @@ -0,0 +1,39 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsPosto; + +/** + * Class _HsPostoEstabelecimento was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsPostoEstabelecimento extends BaseObject { + + public static final String TO_ESTABELECIMENTOS_PROPERTY = "toEstabelecimentos"; + public static final String TO_HS_POSTO_PROPERTY = "toHsPosto"; + + public static final String ESTABELECIMENTO_ID_PK_COLUMN = "estabelecimento_id"; + public static final String POSTO_ID_PK_COLUMN = "posto_id"; + + public void setToEstabelecimentos(Estabelecimentos toEstabelecimentos) { + setToOneTarget("toEstabelecimentos", toEstabelecimentos, true); + } + + public Estabelecimentos getToEstabelecimentos() { + return (Estabelecimentos)readProperty("toEstabelecimentos"); + } + + + public void setToHsPosto(HsPosto toHsPosto) { + setToOneTarget("toHsPosto", toHsPosto, true); + } + + public HsPosto getToHsPosto() { + return (HsPosto)readProperty("toHsPosto"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsPostoMedida.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsPostoMedida.java new file mode 100644 index 00000000..17e74eb7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsPostoMedida.java @@ -0,0 +1,39 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsMedida; +import siprp.database.cayenne.objects.HsPosto; + +/** + * Class _HsPostoMedida was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsPostoMedida extends BaseObject { + + public static final String TO_HS_MEDIDA_PROPERTY = "toHsMedida"; + public static final String TO_HS_POSTO_PROPERTY = "toHsPosto"; + + public static final String MEDIDA_ID_PK_COLUMN = "medida_id"; + public static final String POSTO_ID_PK_COLUMN = "posto_id"; + + public void setToHsMedida(HsMedida toHsMedida) { + setToOneTarget("toHsMedida", toHsMedida, true); + } + + public HsMedida getToHsMedida() { + return (HsMedida)readProperty("toHsMedida"); + } + + + public void setToHsPosto(HsPosto toHsPosto) { + setToOneTarget("toHsPosto", toHsPosto, true); + } + + public HsPosto getToHsPosto() { + return (HsPosto)readProperty("toHsPosto"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsPostoRisco.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsPostoRisco.java new file mode 100644 index 00000000..31ccbc49 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsPostoRisco.java @@ -0,0 +1,100 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsPosto; +import siprp.database.cayenne.objects.HsRelatorioRiscoValorQualitativo; +import siprp.database.cayenne.objects.HsRisco; + +/** + * Class _HsPostoRisco was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsPostoRisco extends BaseObject { + + public static final String IS_PLANO_ACTUACAO_PROPERTY = "isPlanoActuacao"; + public static final String ORDER_PROPERTY = "order"; + public static final String PROBABILIDADE_PROPERTY = "probabilidade"; + public static final String SEVERIDADE_PROPERTY = "severidade"; + public static final String VALOR_QUALITATIVO_PROPERTY = "valorQualitativo"; + public static final String TO_HS_POSTO_PROPERTY = "toHsPosto"; + public static final String TO_HS_RELATORIO_RISCO_VALOR_QUALITATIVO_PROPERTY = "toHsRelatorioRiscoValorQualitativo"; + public static final String TO_HS_RELATORIO_RISCO_VALOR_QUALITATIVO1_PROPERTY = "toHsRelatorioRiscoValorQualitativo1"; + public static final String TO_HS_RISCO_PROPERTY = "toHsRisco"; + + public static final String POSTO_ID_PK_COLUMN = "posto_id"; + public static final String RISCO_ID_PK_COLUMN = "risco_id"; + + public void setIsPlanoActuacao(String isPlanoActuacao) { + writeProperty("isPlanoActuacao", isPlanoActuacao); + } + public String getIsPlanoActuacao() { + return (String)readProperty("isPlanoActuacao"); + } + + public void setOrder(Integer order) { + writeProperty("order", order); + } + public Integer getOrder() { + return (Integer)readProperty("order"); + } + + public void setProbabilidade(Integer probabilidade) { + writeProperty("probabilidade", probabilidade); + } + public Integer getProbabilidade() { + return (Integer)readProperty("probabilidade"); + } + + public void setSeveridade(Integer severidade) { + writeProperty("severidade", severidade); + } + public Integer getSeveridade() { + return (Integer)readProperty("severidade"); + } + + public void setValorQualitativo(Integer valorQualitativo) { + writeProperty("valorQualitativo", valorQualitativo); + } + public Integer getValorQualitativo() { + return (Integer)readProperty("valorQualitativo"); + } + + public void setToHsPosto(HsPosto toHsPosto) { + setToOneTarget("toHsPosto", toHsPosto, true); + } + + public HsPosto getToHsPosto() { + return (HsPosto)readProperty("toHsPosto"); + } + + + public void setToHsRelatorioRiscoValorQualitativo(HsRelatorioRiscoValorQualitativo toHsRelatorioRiscoValorQualitativo) { + setToOneTarget("toHsRelatorioRiscoValorQualitativo", toHsRelatorioRiscoValorQualitativo, true); + } + + public HsRelatorioRiscoValorQualitativo getToHsRelatorioRiscoValorQualitativo() { + return (HsRelatorioRiscoValorQualitativo)readProperty("toHsRelatorioRiscoValorQualitativo"); + } + + + public void setToHsRelatorioRiscoValorQualitativo1(HsRelatorioRiscoValorQualitativo toHsRelatorioRiscoValorQualitativo1) { + setToOneTarget("toHsRelatorioRiscoValorQualitativo1", toHsRelatorioRiscoValorQualitativo1, true); + } + + public HsRelatorioRiscoValorQualitativo getToHsRelatorioRiscoValorQualitativo1() { + return (HsRelatorioRiscoValorQualitativo)readProperty("toHsRelatorioRiscoValorQualitativo1"); + } + + + public void setToHsRisco(HsRisco toHsRisco) { + setToOneTarget("toHsRisco", toHsRisco, true); + } + + public HsRisco getToHsRisco() { + return (HsRisco)readProperty("toHsRisco"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorio.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorio.java new file mode 100644 index 00000000..a1a7ebeb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorio.java @@ -0,0 +1,196 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsRelatorioArea; +import siprp.database.cayenne.objects.HsRelatorioEquipamento; +import siprp.database.cayenne.objects.HsRelatorioLegislacao; +import siprp.database.cayenne.objects.HsRelatorioNormalizacao; +import siprp.database.cayenne.objects.HsRelatorioRisco; +import siprp.database.cayenne.objects.MarcacoesEstabelecimento; + +/** + * Class _HsRelatorio was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsRelatorio extends BaseObject { + + public static final String ACOMPANHANTE1_PROPERTY = "acompanhante1"; + public static final String ACOMPANHANTE2_PROPERTY = "acompanhante2"; + public static final String ACOMPANHANTE3_PROPERTY = "acompanhante3"; + public static final String AVALIACAO_INICIAL_PROPERTY = "avaliacaoInicial"; + public static final String DATA_PROPERTY = "data"; + public static final String DELETED_DATE_PROPERTY = "deletedDate"; + public static final String FUNCAO_ACOMPANHANTE1_PROPERTY = "funcaoAcompanhante1"; + public static final String FUNCAO_ACOMPANHANTE2_PROPERTY = "funcaoAcompanhante2"; + public static final String FUNCAO_ACOMPANHANTE3_PROPERTY = "funcaoAcompanhante3"; + public static final String FUNCIONARIOS_PROPERTY = "funcionarios"; + public static final String ID_PROPERTY = "id"; + public static final String IS_SUBMETIDO_PROPERTY = "isSubmetido"; + public static final String HS_RELATORIO_AREA_PROPERTY = "hsRelatorioArea"; + public static final String HS_RELATORIO_EQUIPAMENTO_ARRAY_PROPERTY = "hsRelatorioEquipamentoArray"; + public static final String HS_RELATORIO_LEGISLACAO_ARRAY_PROPERTY = "hsRelatorioLegislacaoArray"; + public static final String HS_RELATORIO_NORMALIZACAO_ARRAY_PROPERTY = "hsRelatorioNormalizacaoArray"; + public static final String HS_RELATORIO_RISCO_ARRAY_PROPERTY = "hsRelatorioRiscoArray"; + public static final String TO_HS_MARCACOES_ESTABELECIMENTO_PROPERTY = "toHsMarcacoesEstabelecimento"; + + public static final String ID_PK_COLUMN = "id"; + + public void setAcompanhante1(String acompanhante1) { + writeProperty("acompanhante1", acompanhante1); + } + public String getAcompanhante1() { + return (String)readProperty("acompanhante1"); + } + + public void setAcompanhante2(String acompanhante2) { + writeProperty("acompanhante2", acompanhante2); + } + public String getAcompanhante2() { + return (String)readProperty("acompanhante2"); + } + + public void setAcompanhante3(String acompanhante3) { + writeProperty("acompanhante3", acompanhante3); + } + public String getAcompanhante3() { + return (String)readProperty("acompanhante3"); + } + + public void setAvaliacaoInicial(Boolean avaliacaoInicial) { + writeProperty("avaliacaoInicial", avaliacaoInicial); + } + public Boolean getAvaliacaoInicial() { + return (Boolean)readProperty("avaliacaoInicial"); + } + + public void setData(Date data) { + writeProperty("data", data); + } + public Date getData() { + return (Date)readProperty("data"); + } + + public void setDeletedDate(Date deletedDate) { + writeProperty("deletedDate", deletedDate); + } + public Date getDeletedDate() { + return (Date)readProperty("deletedDate"); + } + + public void setFuncaoAcompanhante1(String funcaoAcompanhante1) { + writeProperty("funcaoAcompanhante1", funcaoAcompanhante1); + } + public String getFuncaoAcompanhante1() { + return (String)readProperty("funcaoAcompanhante1"); + } + + public void setFuncaoAcompanhante2(String funcaoAcompanhante2) { + writeProperty("funcaoAcompanhante2", funcaoAcompanhante2); + } + public String getFuncaoAcompanhante2() { + return (String)readProperty("funcaoAcompanhante2"); + } + + public void setFuncaoAcompanhante3(String funcaoAcompanhante3) { + writeProperty("funcaoAcompanhante3", funcaoAcompanhante3); + } + public String getFuncaoAcompanhante3() { + return (String)readProperty("funcaoAcompanhante3"); + } + + public void setFuncionarios(String funcionarios) { + writeProperty("funcionarios", funcionarios); + } + public String getFuncionarios() { + return (String)readProperty("funcionarios"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setIsSubmetido(Date isSubmetido) { + writeProperty("isSubmetido", isSubmetido); + } + public Date getIsSubmetido() { + return (Date)readProperty("isSubmetido"); + } + + public void addToHsRelatorioArea(HsRelatorioArea obj) { + addToManyTarget("hsRelatorioArea", obj, true); + } + public void removeFromHsRelatorioArea(HsRelatorioArea obj) { + removeToManyTarget("hsRelatorioArea", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRelatorioArea() { + return (List)readProperty("hsRelatorioArea"); + } + + + public void addToHsRelatorioEquipamentoArray(HsRelatorioEquipamento obj) { + addToManyTarget("hsRelatorioEquipamentoArray", obj, true); + } + public void removeFromHsRelatorioEquipamentoArray(HsRelatorioEquipamento obj) { + removeToManyTarget("hsRelatorioEquipamentoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRelatorioEquipamentoArray() { + return (List)readProperty("hsRelatorioEquipamentoArray"); + } + + + public void addToHsRelatorioLegislacaoArray(HsRelatorioLegislacao obj) { + addToManyTarget("hsRelatorioLegislacaoArray", obj, true); + } + public void removeFromHsRelatorioLegislacaoArray(HsRelatorioLegislacao obj) { + removeToManyTarget("hsRelatorioLegislacaoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRelatorioLegislacaoArray() { + return (List)readProperty("hsRelatorioLegislacaoArray"); + } + + + public void addToHsRelatorioNormalizacaoArray(HsRelatorioNormalizacao obj) { + addToManyTarget("hsRelatorioNormalizacaoArray", obj, true); + } + public void removeFromHsRelatorioNormalizacaoArray(HsRelatorioNormalizacao obj) { + removeToManyTarget("hsRelatorioNormalizacaoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRelatorioNormalizacaoArray() { + return (List)readProperty("hsRelatorioNormalizacaoArray"); + } + + + public void addToHsRelatorioRiscoArray(HsRelatorioRisco obj) { + addToManyTarget("hsRelatorioRiscoArray", obj, true); + } + public void removeFromHsRelatorioRiscoArray(HsRelatorioRisco obj) { + removeToManyTarget("hsRelatorioRiscoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRelatorioRiscoArray() { + return (List)readProperty("hsRelatorioRiscoArray"); + } + + + public void setToHsMarcacoesEstabelecimento(MarcacoesEstabelecimento toHsMarcacoesEstabelecimento) { + setToOneTarget("toHsMarcacoesEstabelecimento", toHsMarcacoesEstabelecimento, true); + } + + public MarcacoesEstabelecimento getToHsMarcacoesEstabelecimento() { + return (MarcacoesEstabelecimento)readProperty("toHsMarcacoesEstabelecimento"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioArea.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioArea.java new file mode 100644 index 00000000..1ca5d455 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioArea.java @@ -0,0 +1,76 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsRelatorio; +import siprp.database.cayenne.objects.HsRelatorioPosto; + +/** + * Class _HsRelatorioArea was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsRelatorioArea extends BaseObject { + + public static final String DELETED_DATE_PROPERTY = "deletedDate"; + public static final String DESCRIPTION_PROPERTY = "description"; + public static final String HS_AREA_ID_PROPERTY = "hsAreaId"; + public static final String ORDER_PROPERTY = "order"; + public static final String HS_RELATORIO_POSTO_ARRAY_PROPERTY = "hsRelatorioPostoArray"; + public static final String TO_HS_RELATORIO_PROPERTY = "toHsRelatorio"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDeletedDate(Date deletedDate) { + writeProperty("deletedDate", deletedDate); + } + public Date getDeletedDate() { + return (Date)readProperty("deletedDate"); + } + + public void setDescription(String description) { + writeProperty("description", description); + } + public String getDescription() { + return (String)readProperty("description"); + } + + public void setHsAreaId(Integer hsAreaId) { + writeProperty("hsAreaId", hsAreaId); + } + public Integer getHsAreaId() { + return (Integer)readProperty("hsAreaId"); + } + + public void setOrder(Integer order) { + writeProperty("order", order); + } + public Integer getOrder() { + return (Integer)readProperty("order"); + } + + public void addToHsRelatorioPostoArray(HsRelatorioPosto obj) { + addToManyTarget("hsRelatorioPostoArray", obj, true); + } + public void removeFromHsRelatorioPostoArray(HsRelatorioPosto obj) { + removeToManyTarget("hsRelatorioPostoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRelatorioPostoArray() { + return (List)readProperty("hsRelatorioPostoArray"); + } + + + public void setToHsRelatorio(HsRelatorio toHsRelatorio) { + setToOneTarget("toHsRelatorio", toHsRelatorio, true); + } + + public HsRelatorio getToHsRelatorio() { + return (HsRelatorio)readProperty("toHsRelatorio"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioEquipamento.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioEquipamento.java new file mode 100644 index 00000000..e3212a18 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioEquipamento.java @@ -0,0 +1,75 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsRelatorio; + +/** + * Class _HsRelatorioEquipamento was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsRelatorioEquipamento extends BaseObject { + + public static final String HS_EQUIPAMENTO_PROPERTY = "hsEquipamento"; + public static final String HS_EQUIPAMENTO_ID_PROPERTY = "hsEquipamentoId"; + public static final String HS_RELATORIO_ID_PROPERTY = "hsRelatorioId"; + public static final String MARCA_PROPERTY = "marca"; + public static final String MODELO_PROPERTY = "modelo"; + public static final String TIPO_PROPERTY = "tipo"; + public static final String TO_HS_RELATORIO_PROPERTY = "toHsRelatorio"; + + public static final String ID_PK_COLUMN = "id"; + + public void setHsEquipamento(Integer hsEquipamento) { + writeProperty("hsEquipamento", hsEquipamento); + } + public Integer getHsEquipamento() { + return (Integer)readProperty("hsEquipamento"); + } + + public void setHsEquipamentoId(Integer hsEquipamentoId) { + writeProperty("hsEquipamentoId", hsEquipamentoId); + } + public Integer getHsEquipamentoId() { + return (Integer)readProperty("hsEquipamentoId"); + } + + public void setHsRelatorioId(Integer hsRelatorioId) { + writeProperty("hsRelatorioId", hsRelatorioId); + } + public Integer getHsRelatorioId() { + return (Integer)readProperty("hsRelatorioId"); + } + + public void setMarca(String marca) { + writeProperty("marca", marca); + } + public String getMarca() { + return (String)readProperty("marca"); + } + + public void setModelo(String modelo) { + writeProperty("modelo", modelo); + } + public String getModelo() { + return (String)readProperty("modelo"); + } + + public void setTipo(String tipo) { + writeProperty("tipo", tipo); + } + public String getTipo() { + return (String)readProperty("tipo"); + } + + public void setToHsRelatorio(HsRelatorio toHsRelatorio) { + setToOneTarget("toHsRelatorio", toHsRelatorio, true); + } + + public HsRelatorio getToHsRelatorio() { + return (HsRelatorio)readProperty("toHsRelatorio"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioLegislacao.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioLegislacao.java new file mode 100644 index 00000000..0c60288e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioLegislacao.java @@ -0,0 +1,59 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsRelatorio; + +/** + * Class _HsRelatorioLegislacao was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsRelatorioLegislacao extends BaseObject { + + public static final String CATEGORIA_PROPERTY = "categoria"; + public static final String DESCRICAO_PROPERTY = "descricao"; + public static final String HS_LEGISLACAO_ID_PROPERTY = "hsLegislacaoId"; + public static final String ORDEM_PROPERTY = "ordem"; + public static final String TO_HS_RELATORIO_PROPERTY = "toHsRelatorio"; + + public static final String ID_PK_COLUMN = "id"; + + public void setCategoria(String categoria) { + writeProperty("categoria", categoria); + } + public String getCategoria() { + return (String)readProperty("categoria"); + } + + public void setDescricao(String descricao) { + writeProperty("descricao", descricao); + } + public String getDescricao() { + return (String)readProperty("descricao"); + } + + public void setHsLegislacaoId(Integer hsLegislacaoId) { + writeProperty("hsLegislacaoId", hsLegislacaoId); + } + public Integer getHsLegislacaoId() { + return (Integer)readProperty("hsLegislacaoId"); + } + + public void setOrdem(Integer ordem) { + writeProperty("ordem", ordem); + } + public Integer getOrdem() { + return (Integer)readProperty("ordem"); + } + + public void setToHsRelatorio(HsRelatorio toHsRelatorio) { + setToOneTarget("toHsRelatorio", toHsRelatorio, true); + } + + public HsRelatorio getToHsRelatorio() { + return (HsRelatorio)readProperty("toHsRelatorio"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioMedida.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioMedida.java new file mode 100644 index 00000000..08d7e06e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioMedida.java @@ -0,0 +1,76 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsRelatorioPostoMedida; +import siprp.database.cayenne.objects.HsRelatorioRisco; + +/** + * Class _HsRelatorioMedida was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsRelatorioMedida extends BaseObject { + + public static final String DELETED_DATE_PROPERTY = "deletedDate"; + public static final String DESCRIPTION_PROPERTY = "description"; + public static final String HS_MEDIDA_ID_PROPERTY = "hsMedidaId"; + public static final String REQUESITOS_LEGAIS_PROPERTY = "requesitosLegais"; + public static final String HS_RELATORIO_POSTO_MEDIDA_ARRAY_PROPERTY = "hsRelatorioPostoMedidaArray"; + public static final String TO_HS_RELATORIO_RISCO_PROPERTY = "toHsRelatorioRisco"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDeletedDate(Date deletedDate) { + writeProperty("deletedDate", deletedDate); + } + public Date getDeletedDate() { + return (Date)readProperty("deletedDate"); + } + + public void setDescription(String description) { + writeProperty("description", description); + } + public String getDescription() { + return (String)readProperty("description"); + } + + public void setHsMedidaId(Integer hsMedidaId) { + writeProperty("hsMedidaId", hsMedidaId); + } + public Integer getHsMedidaId() { + return (Integer)readProperty("hsMedidaId"); + } + + public void setRequesitosLegais(String requesitosLegais) { + writeProperty("requesitosLegais", requesitosLegais); + } + public String getRequesitosLegais() { + return (String)readProperty("requesitosLegais"); + } + + public void addToHsRelatorioPostoMedidaArray(HsRelatorioPostoMedida obj) { + addToManyTarget("hsRelatorioPostoMedidaArray", obj, true); + } + public void removeFromHsRelatorioPostoMedidaArray(HsRelatorioPostoMedida obj) { + removeToManyTarget("hsRelatorioPostoMedidaArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRelatorioPostoMedidaArray() { + return (List)readProperty("hsRelatorioPostoMedidaArray"); + } + + + public void setToHsRelatorioRisco(HsRelatorioRisco toHsRelatorioRisco) { + setToOneTarget("toHsRelatorioRisco", toHsRelatorioRisco, true); + } + + public HsRelatorioRisco getToHsRelatorioRisco() { + return (HsRelatorioRisco)readProperty("toHsRelatorioRisco"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioNormalizacao.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioNormalizacao.java new file mode 100644 index 00000000..df20ae14 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioNormalizacao.java @@ -0,0 +1,59 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsRelatorio; + +/** + * Class _HsRelatorioNormalizacao was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsRelatorioNormalizacao extends BaseObject { + + public static final String CODIGO_PROPERTY = "codigo"; + public static final String DESCRICAO_PROPERTY = "descricao"; + public static final String HS_NORMALIZACAO_ID_PROPERTY = "hsNormalizacaoId"; + public static final String PORTUGUESA_PROPERTY = "portuguesa"; + public static final String TO_HS_RELATORIO_PROPERTY = "toHsRelatorio"; + + public static final String ID_PK_COLUMN = "id"; + + public void setCodigo(String codigo) { + writeProperty("codigo", codigo); + } + public String getCodigo() { + return (String)readProperty("codigo"); + } + + public void setDescricao(String descricao) { + writeProperty("descricao", descricao); + } + public String getDescricao() { + return (String)readProperty("descricao"); + } + + public void setHsNormalizacaoId(Integer hsNormalizacaoId) { + writeProperty("hsNormalizacaoId", hsNormalizacaoId); + } + public Integer getHsNormalizacaoId() { + return (Integer)readProperty("hsNormalizacaoId"); + } + + public void setPortuguesa(Boolean portuguesa) { + writeProperty("portuguesa", portuguesa); + } + public Boolean getPortuguesa() { + return (Boolean)readProperty("portuguesa"); + } + + public void setToHsRelatorio(HsRelatorio toHsRelatorio) { + setToOneTarget("toHsRelatorio", toHsRelatorio, true); + } + + public HsRelatorio getToHsRelatorio() { + return (HsRelatorio)readProperty("toHsRelatorio"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioPosto.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioPosto.java new file mode 100644 index 00000000..96dab9bd --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioPosto.java @@ -0,0 +1,90 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsRelatorioArea; +import siprp.database.cayenne.objects.HsRelatorioPostoMedida; +import siprp.database.cayenne.objects.HsRelatorioPostoRisco; + +/** + * Class _HsRelatorioPosto was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsRelatorioPosto extends BaseObject { + + public static final String DELETED_DATE_PROPERTY = "deletedDate"; + public static final String DESCRIPTION_PROPERTY = "description"; + public static final String HS_POSTO_ID_PROPERTY = "hsPostoId"; + public static final String IS_PRINCIPAL_PROPERTY = "isPrincipal"; + public static final String HS_RELATORIO_POSTO_MEDIDA_ARRAY_PROPERTY = "hsRelatorioPostoMedidaArray"; + public static final String HS_RELATORIO_POSTO_RISCO_ARRAY_PROPERTY = "hsRelatorioPostoRiscoArray"; + public static final String TO_HS_RELATORIO_AREA_PROPERTY = "toHsRelatorioArea"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDeletedDate(Date deletedDate) { + writeProperty("deletedDate", deletedDate); + } + public Date getDeletedDate() { + return (Date)readProperty("deletedDate"); + } + + public void setDescription(String description) { + writeProperty("description", description); + } + public String getDescription() { + return (String)readProperty("description"); + } + + public void setHsPostoId(Integer hsPostoId) { + writeProperty("hsPostoId", hsPostoId); + } + public Integer getHsPostoId() { + return (Integer)readProperty("hsPostoId"); + } + + public void setIsPrincipal(Boolean isPrincipal) { + writeProperty("isPrincipal", isPrincipal); + } + public Boolean getIsPrincipal() { + return (Boolean)readProperty("isPrincipal"); + } + + public void addToHsRelatorioPostoMedidaArray(HsRelatorioPostoMedida obj) { + addToManyTarget("hsRelatorioPostoMedidaArray", obj, true); + } + public void removeFromHsRelatorioPostoMedidaArray(HsRelatorioPostoMedida obj) { + removeToManyTarget("hsRelatorioPostoMedidaArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRelatorioPostoMedidaArray() { + return (List)readProperty("hsRelatorioPostoMedidaArray"); + } + + + public void addToHsRelatorioPostoRiscoArray(HsRelatorioPostoRisco obj) { + addToManyTarget("hsRelatorioPostoRiscoArray", obj, true); + } + public void removeFromHsRelatorioPostoRiscoArray(HsRelatorioPostoRisco obj) { + removeToManyTarget("hsRelatorioPostoRiscoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRelatorioPostoRiscoArray() { + return (List)readProperty("hsRelatorioPostoRiscoArray"); + } + + + public void setToHsRelatorioArea(HsRelatorioArea toHsRelatorioArea) { + setToOneTarget("toHsRelatorioArea", toHsRelatorioArea, true); + } + + public HsRelatorioArea getToHsRelatorioArea() { + return (HsRelatorioArea)readProperty("toHsRelatorioArea"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioPostoMedida.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioPostoMedida.java new file mode 100644 index 00000000..85201632 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioPostoMedida.java @@ -0,0 +1,47 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsRelatorioMedida; +import siprp.database.cayenne.objects.HsRelatorioPosto; + +/** + * Class _HsRelatorioPostoMedida was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsRelatorioPostoMedida extends BaseObject { + + public static final String IS_PLANO_ACTUACAO_PROPERTY = "isPlanoActuacao"; + public static final String TO_HS_RELATORIO_MEDIDA_PROPERTY = "toHsRelatorioMedida"; + public static final String TO_HS_RELATORIO_POSTO_PROPERTY = "toHsRelatorioPosto"; + + public static final String MEDIDA_ID_PK_COLUMN = "medida_id"; + public static final String POSTO_ID_PK_COLUMN = "posto_id"; + + public void setIsPlanoActuacao(Boolean isPlanoActuacao) { + writeProperty("isPlanoActuacao", isPlanoActuacao); + } + public Boolean getIsPlanoActuacao() { + return (Boolean)readProperty("isPlanoActuacao"); + } + + public void setToHsRelatorioMedida(HsRelatorioMedida toHsRelatorioMedida) { + setToOneTarget("toHsRelatorioMedida", toHsRelatorioMedida, true); + } + + public HsRelatorioMedida getToHsRelatorioMedida() { + return (HsRelatorioMedida)readProperty("toHsRelatorioMedida"); + } + + + public void setToHsRelatorioPosto(HsRelatorioPosto toHsRelatorioPosto) { + setToOneTarget("toHsRelatorioPosto", toHsRelatorioPosto, true); + } + + public HsRelatorioPosto getToHsRelatorioPosto() { + return (HsRelatorioPosto)readProperty("toHsRelatorioPosto"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioPostoRisco.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioPostoRisco.java new file mode 100644 index 00000000..5122ec01 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioPostoRisco.java @@ -0,0 +1,74 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsRelatorioPosto; +import siprp.database.cayenne.objects.HsRelatorioRisco; +import siprp.database.cayenne.objects.HsRelatorioRiscoValorQualitativo; + +/** + * Class _HsRelatorioPostoRisco was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsRelatorioPostoRisco extends BaseObject { + + public static final String ORDER_PROPERTY = "order"; + public static final String PROBABILIDADE_PROPERTY = "probabilidade"; + public static final String SEVERIDADE_PROPERTY = "severidade"; + public static final String TO_HS_RELATORIO_POSTO_PROPERTY = "toHsRelatorioPosto"; + public static final String TO_HS_RELATORIO_RISCO_PROPERTY = "toHsRelatorioRisco"; + public static final String TO_HS_RELATORIO_RISCO_VALOR_QUALITATIVO_PROPERTY = "toHsRelatorioRiscoValorQualitativo"; + + public static final String POSTO_ID_PK_COLUMN = "posto_id"; + public static final String RISCO_ID_PK_COLUMN = "risco_id"; + + public void setOrder(Integer order) { + writeProperty("order", order); + } + public Integer getOrder() { + return (Integer)readProperty("order"); + } + + public void setProbabilidade(Integer probabilidade) { + writeProperty("probabilidade", probabilidade); + } + public Integer getProbabilidade() { + return (Integer)readProperty("probabilidade"); + } + + public void setSeveridade(Integer severidade) { + writeProperty("severidade", severidade); + } + public Integer getSeveridade() { + return (Integer)readProperty("severidade"); + } + + public void setToHsRelatorioPosto(HsRelatorioPosto toHsRelatorioPosto) { + setToOneTarget("toHsRelatorioPosto", toHsRelatorioPosto, true); + } + + public HsRelatorioPosto getToHsRelatorioPosto() { + return (HsRelatorioPosto)readProperty("toHsRelatorioPosto"); + } + + + public void setToHsRelatorioRisco(HsRelatorioRisco toHsRelatorioRisco) { + setToOneTarget("toHsRelatorioRisco", toHsRelatorioRisco, true); + } + + public HsRelatorioRisco getToHsRelatorioRisco() { + return (HsRelatorioRisco)readProperty("toHsRelatorioRisco"); + } + + + public void setToHsRelatorioRiscoValorQualitativo(HsRelatorioRiscoValorQualitativo toHsRelatorioRiscoValorQualitativo) { + setToOneTarget("toHsRelatorioRiscoValorQualitativo", toHsRelatorioRiscoValorQualitativo, true); + } + + public HsRelatorioRiscoValorQualitativo getToHsRelatorioRiscoValorQualitativo() { + return (HsRelatorioRiscoValorQualitativo)readProperty("toHsRelatorioRiscoValorQualitativo"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioRisco.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioRisco.java new file mode 100644 index 00000000..dc0f318e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioRisco.java @@ -0,0 +1,82 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsRelatorio; +import siprp.database.cayenne.objects.HsRelatorioMedida; +import siprp.database.cayenne.objects.HsRelatorioPostoRisco; + +/** + * Class _HsRelatorioRisco was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsRelatorioRisco extends BaseObject { + + public static final String DELETED_DATE_PROPERTY = "deletedDate"; + public static final String DESCRIPTION_PROPERTY = "description"; + public static final String HS_RISCO_ID_PROPERTY = "hsRiscoId"; + public static final String HS_RELATORIO_MEDIDA_ARRAY_PROPERTY = "hsRelatorioMedidaArray"; + public static final String HS_RELATORIO_POSTO_RISCO_ARRAY_PROPERTY = "hsRelatorioPostoRiscoArray"; + public static final String TO_HS_RELATORIO_PROPERTY = "toHsRelatorio"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDeletedDate(Date deletedDate) { + writeProperty("deletedDate", deletedDate); + } + public Date getDeletedDate() { + return (Date)readProperty("deletedDate"); + } + + public void setDescription(String description) { + writeProperty("description", description); + } + public String getDescription() { + return (String)readProperty("description"); + } + + public void setHsRiscoId(Integer hsRiscoId) { + writeProperty("hsRiscoId", hsRiscoId); + } + public Integer getHsRiscoId() { + return (Integer)readProperty("hsRiscoId"); + } + + public void addToHsRelatorioMedidaArray(HsRelatorioMedida obj) { + addToManyTarget("hsRelatorioMedidaArray", obj, true); + } + public void removeFromHsRelatorioMedidaArray(HsRelatorioMedida obj) { + removeToManyTarget("hsRelatorioMedidaArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRelatorioMedidaArray() { + return (List)readProperty("hsRelatorioMedidaArray"); + } + + + public void addToHsRelatorioPostoRiscoArray(HsRelatorioPostoRisco obj) { + addToManyTarget("hsRelatorioPostoRiscoArray", obj, true); + } + public void removeFromHsRelatorioPostoRiscoArray(HsRelatorioPostoRisco obj) { + removeToManyTarget("hsRelatorioPostoRiscoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRelatorioPostoRiscoArray() { + return (List)readProperty("hsRelatorioPostoRiscoArray"); + } + + + public void setToHsRelatorio(HsRelatorio toHsRelatorio) { + setToOneTarget("toHsRelatorio", toHsRelatorio, true); + } + + public HsRelatorio getToHsRelatorio() { + return (HsRelatorio)readProperty("toHsRelatorio"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioRiscoValorQualitativo.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioRiscoValorQualitativo.java new file mode 100644 index 00000000..0113013f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRelatorioRiscoValorQualitativo.java @@ -0,0 +1,54 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsPostoRisco; +import siprp.database.cayenne.objects.HsRelatorioPostoRisco; + +/** + * Class _HsRelatorioRiscoValorQualitativo was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsRelatorioRiscoValorQualitativo extends BaseObject { + + public static final String DESCRIPTION_PROPERTY = "description"; + public static final String HS_POSTO_RISCO_ARRAY_PROPERTY = "hsPostoRiscoArray"; + public static final String HS_RELATORIO_POSTO_RISCO_ARRAY_PROPERTY = "hsRelatorioPostoRiscoArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDescription(String description) { + writeProperty("description", description); + } + public String getDescription() { + return (String)readProperty("description"); + } + + public void addToHsPostoRiscoArray(HsPostoRisco obj) { + addToManyTarget("hsPostoRiscoArray", obj, true); + } + public void removeFromHsPostoRiscoArray(HsPostoRisco obj) { + removeToManyTarget("hsPostoRiscoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsPostoRiscoArray() { + return (List)readProperty("hsPostoRiscoArray"); + } + + + public void addToHsRelatorioPostoRiscoArray(HsRelatorioPostoRisco obj) { + addToManyTarget("hsRelatorioPostoRiscoArray", obj, true); + } + public void removeFromHsRelatorioPostoRiscoArray(HsRelatorioPostoRisco obj) { + removeToManyTarget("hsRelatorioPostoRiscoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRelatorioPostoRiscoArray() { + return (List)readProperty("hsRelatorioPostoRiscoArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRisco.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRisco.java new file mode 100644 index 00000000..1d6cab04 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRisco.java @@ -0,0 +1,88 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsPostoRisco; +import siprp.database.cayenne.objects.HsRiscoEmpresa; +import siprp.database.cayenne.objects.HsRiscoMedida; +import siprp.database.cayenne.objects.HsRiscoTema; + +/** + * Class _HsRisco was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsRisco extends BaseObject { + + public static final String DELETED_DATE_PROPERTY = "deletedDate"; + public static final String DESCRIPTION_PROPERTY = "description"; + public static final String HS_POSTO_RISCO_ARRAY_PROPERTY = "hsPostoRiscoArray"; + public static final String HS_RISCO_EMPRESA_ARRAY_PROPERTY = "hsRiscoEmpresaArray"; + public static final String HS_RISCO_MEDIDA_ARRAY_PROPERTY = "hsRiscoMedidaArray"; + public static final String TO_HS_RISCO_TEMA_PROPERTY = "toHsRiscoTema"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDeletedDate(Date deletedDate) { + writeProperty("deletedDate", deletedDate); + } + public Date getDeletedDate() { + return (Date)readProperty("deletedDate"); + } + + public void setDescription(String description) { + writeProperty("description", description); + } + public String getDescription() { + return (String)readProperty("description"); + } + + public void addToHsPostoRiscoArray(HsPostoRisco obj) { + addToManyTarget("hsPostoRiscoArray", obj, true); + } + public void removeFromHsPostoRiscoArray(HsPostoRisco obj) { + removeToManyTarget("hsPostoRiscoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsPostoRiscoArray() { + return (List)readProperty("hsPostoRiscoArray"); + } + + + public void addToHsRiscoEmpresaArray(HsRiscoEmpresa obj) { + addToManyTarget("hsRiscoEmpresaArray", obj, true); + } + public void removeFromHsRiscoEmpresaArray(HsRiscoEmpresa obj) { + removeToManyTarget("hsRiscoEmpresaArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRiscoEmpresaArray() { + return (List)readProperty("hsRiscoEmpresaArray"); + } + + + public void addToHsRiscoMedidaArray(HsRiscoMedida obj) { + addToManyTarget("hsRiscoMedidaArray", obj, true); + } + public void removeFromHsRiscoMedidaArray(HsRiscoMedida obj) { + removeToManyTarget("hsRiscoMedidaArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRiscoMedidaArray() { + return (List)readProperty("hsRiscoMedidaArray"); + } + + + public void setToHsRiscoTema(HsRiscoTema toHsRiscoTema) { + setToOneTarget("toHsRiscoTema", toHsRiscoTema, true); + } + + public HsRiscoTema getToHsRiscoTema() { + return (HsRiscoTema)readProperty("toHsRiscoTema"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRiscoEmpresa.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRiscoEmpresa.java new file mode 100644 index 00000000..f62cd7c8 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRiscoEmpresa.java @@ -0,0 +1,39 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.HsRisco; + +/** + * Class _HsRiscoEmpresa was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsRiscoEmpresa extends BaseObject { + + public static final String TO_EMPRESA_PROPERTY = "toEmpresa"; + public static final String TO_HS_RISCO_PROPERTY = "toHsRisco"; + + public static final String EMPRESA_ID_PK_COLUMN = "empresa_id"; + public static final String RISCO_ID_PK_COLUMN = "risco_id"; + + public void setToEmpresa(Empresas toEmpresa) { + setToOneTarget("toEmpresa", toEmpresa, true); + } + + public Empresas getToEmpresa() { + return (Empresas)readProperty("toEmpresa"); + } + + + public void setToHsRisco(HsRisco toHsRisco) { + setToOneTarget("toHsRisco", toHsRisco, true); + } + + public HsRisco getToHsRisco() { + return (HsRisco)readProperty("toHsRisco"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRiscoMedida.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRiscoMedida.java new file mode 100644 index 00000000..8e6d5aff --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRiscoMedida.java @@ -0,0 +1,39 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsMedida; +import siprp.database.cayenne.objects.HsRisco; + +/** + * Class _HsRiscoMedida was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsRiscoMedida extends BaseObject { + + public static final String TO_HS_MEDIDA_PROPERTY = "toHsMedida"; + public static final String TO_HS_RISCO_PROPERTY = "toHsRisco"; + + public static final String MEDIDA_ID_PK_COLUMN = "medida_id"; + public static final String RISCO_ID_PK_COLUMN = "risco_id"; + + public void setToHsMedida(HsMedida toHsMedida) { + setToOneTarget("toHsMedida", toHsMedida, true); + } + + public HsMedida getToHsMedida() { + return (HsMedida)readProperty("toHsMedida"); + } + + + public void setToHsRisco(HsRisco toHsRisco) { + setToOneTarget("toHsRisco", toHsRisco, true); + } + + public HsRisco getToHsRisco() { + return (HsRisco)readProperty("toHsRisco"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRiscoTema.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRiscoTema.java new file mode 100644 index 00000000..437d72d8 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_HsRiscoTema.java @@ -0,0 +1,49 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.HsRisco; + +/** + * Class _HsRiscoTema was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _HsRiscoTema extends BaseObject { + + public static final String DELETED_DATE_PROPERTY = "deletedDate"; + public static final String DESCRIPTION_PROPERTY = "description"; + public static final String HS_RISCO_ARRAY_PROPERTY = "hsRiscoArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDeletedDate(Date deletedDate) { + writeProperty("deletedDate", deletedDate); + } + public Date getDeletedDate() { + return (Date)readProperty("deletedDate"); + } + + public void setDescription(String description) { + writeProperty("description", description); + } + public String getDescription() { + return (String)readProperty("description"); + } + + public void addToHsRiscoArray(HsRisco obj) { + addToManyTarget("hsRiscoArray", obj, true); + } + public void removeFromHsRiscoArray(HsRisco obj) { + removeToManyTarget("hsRiscoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRiscoArray() { + return (List)readProperty("hsRiscoArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Image.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Image.java new file mode 100644 index 00000000..bf4420ac --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Image.java @@ -0,0 +1,48 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Empresas; + +/** + * Class _Image was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Image extends BaseObject { + + public static final String IMAGE_DATA_PROPERTY = "imageData"; + public static final String NAME_PROPERTY = "name"; + public static final String EMPRESAS_ARRAY_PROPERTY = "empresasArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setImageData(byte[] imageData) { + writeProperty("imageData", imageData); + } + public byte[] getImageData() { + return (byte[])readProperty("imageData"); + } + + public void setName(String name) { + writeProperty("name", name); + } + public String getName() { + return (String)readProperty("name"); + } + + public void addToEmpresasArray(Empresas obj) { + addToManyTarget("empresasArray", obj, true); + } + public void removeFromEmpresasArray(Empresas obj) { + removeToManyTarget("empresasArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getEmpresasArray() { + return (List)readProperty("empresasArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Lembretes.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Lembretes.java new file mode 100644 index 00000000..d43da540 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Lembretes.java @@ -0,0 +1,148 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.LembretesTipos; +import siprp.database.cayenne.objects.MarcacoesEstabelecimento; +import siprp.database.cayenne.objects.MarcacoesTrabalhador; +import siprp.database.cayenne.objects.Trabalhadores; + +/** + * Class _Lembretes was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Lembretes extends BaseObject { + + public static final String DATA_PROPERTY = "data"; + public static final String DESCRICAO_PROPERTY = "descricao"; + public static final String ENVIAR_EMAIL_PROPERTY = "enviarEmail"; + public static final String ID_PROPERTY = "id"; + public static final String PERIODICIDADE_DIAS_PROPERTY = "periodicidadeDias"; + public static final String PERIODICIDADE_MESES_PROPERTY = "periodicidadeMeses"; + public static final String TEXTO_PROPERTY = "texto"; + public static final String ULTIMO_ENVIO_PROPERTY = "ultimoEnvio"; + public static final String TO_EMPRESAS_PROPERTY = "toEmpresas"; + public static final String TO_ESTABELECIMENTOS_PROPERTY = "toEstabelecimentos"; + public static final String TO_LEMBRETES_TIPOS_PROPERTY = "toLembretesTipos"; + public static final String TO_MARCACOES_ESTABELECIMENTO_PROPERTY = "toMarcacoesEstabelecimento"; + public static final String TO_MARCACOES_TRABALHADOR_PROPERTY = "toMarcacoesTrabalhador"; + public static final String TO_TRABALHADORES_PROPERTY = "toTrabalhadores"; + + public static final String ID_PK_COLUMN = "id"; + + public void setData(Date data) { + writeProperty("data", data); + } + public Date getData() { + return (Date)readProperty("data"); + } + + public void setDescricao(String descricao) { + writeProperty("descricao", descricao); + } + public String getDescricao() { + return (String)readProperty("descricao"); + } + + public void setEnviarEmail(String enviarEmail) { + writeProperty("enviarEmail", enviarEmail); + } + public String getEnviarEmail() { + return (String)readProperty("enviarEmail"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setPeriodicidadeDias(Integer periodicidadeDias) { + writeProperty("periodicidadeDias", periodicidadeDias); + } + public Integer getPeriodicidadeDias() { + return (Integer)readProperty("periodicidadeDias"); + } + + public void setPeriodicidadeMeses(Integer periodicidadeMeses) { + writeProperty("periodicidadeMeses", periodicidadeMeses); + } + public Integer getPeriodicidadeMeses() { + return (Integer)readProperty("periodicidadeMeses"); + } + + public void setTexto(String texto) { + writeProperty("texto", texto); + } + public String getTexto() { + return (String)readProperty("texto"); + } + + public void setUltimoEnvio(Date ultimoEnvio) { + writeProperty("ultimoEnvio", ultimoEnvio); + } + public Date getUltimoEnvio() { + return (Date)readProperty("ultimoEnvio"); + } + + public void setToEmpresas(Empresas toEmpresas) { + setToOneTarget("toEmpresas", toEmpresas, true); + } + + public Empresas getToEmpresas() { + return (Empresas)readProperty("toEmpresas"); + } + + + public void setToEstabelecimentos(Estabelecimentos toEstabelecimentos) { + setToOneTarget("toEstabelecimentos", toEstabelecimentos, true); + } + + public Estabelecimentos getToEstabelecimentos() { + return (Estabelecimentos)readProperty("toEstabelecimentos"); + } + + + public void setToLembretesTipos(LembretesTipos toLembretesTipos) { + setToOneTarget("toLembretesTipos", toLembretesTipos, true); + } + + public LembretesTipos getToLembretesTipos() { + return (LembretesTipos)readProperty("toLembretesTipos"); + } + + + public void setToMarcacoesEstabelecimento(MarcacoesEstabelecimento toMarcacoesEstabelecimento) { + setToOneTarget("toMarcacoesEstabelecimento", toMarcacoesEstabelecimento, true); + } + + public MarcacoesEstabelecimento getToMarcacoesEstabelecimento() { + return (MarcacoesEstabelecimento)readProperty("toMarcacoesEstabelecimento"); + } + + + public void setToMarcacoesTrabalhador(MarcacoesTrabalhador toMarcacoesTrabalhador) { + setToOneTarget("toMarcacoesTrabalhador", toMarcacoesTrabalhador, true); + } + + public MarcacoesTrabalhador getToMarcacoesTrabalhador() { + return (MarcacoesTrabalhador)readProperty("toMarcacoesTrabalhador"); + } + + + public void setToTrabalhadores(Trabalhadores toTrabalhadores) { + setToOneTarget("toTrabalhadores", toTrabalhadores, true); + } + + public Trabalhadores getToTrabalhadores() { + return (Trabalhadores)readProperty("toTrabalhadores"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_LembretesTipos.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_LembretesTipos.java new file mode 100644 index 00000000..6b5fa77b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_LembretesTipos.java @@ -0,0 +1,72 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Lembretes; + +/** + * Class _LembretesTipos was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _LembretesTipos extends BaseObject { + + public static final String ACTIVO_PROPERTY = "activo"; + public static final String CODIGO_PROPERTY = "codigo"; + public static final String DESCRICAO_PROPERTY = "descricao"; + public static final String ID_PROPERTY = "id"; + public static final String ORDEM_PROPERTY = "ordem"; + public static final String LEMBRETES_ARRAY_PROPERTY = "lembretesArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setActivo(String activo) { + writeProperty("activo", activo); + } + public String getActivo() { + return (String)readProperty("activo"); + } + + public void setCodigo(String codigo) { + writeProperty("codigo", codigo); + } + public String getCodigo() { + return (String)readProperty("codigo"); + } + + public void setDescricao(String descricao) { + writeProperty("descricao", descricao); + } + public String getDescricao() { + return (String)readProperty("descricao"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setOrdem(Integer ordem) { + writeProperty("ordem", ordem); + } + public Integer getOrdem() { + return (Integer)readProperty("ordem"); + } + + public void addToLembretesArray(Lembretes obj) { + addToManyTarget("lembretesArray", obj, true); + } + public void removeFromLembretesArray(Lembretes obj) { + removeToManyTarget("lembretesArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getLembretesArray() { + return (List)readProperty("lembretesArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesEmpresa.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesEmpresa.java new file mode 100644 index 00000000..320a0132 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesEmpresa.java @@ -0,0 +1,61 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Empresas; + +/** + * Class _MarcacoesEmpresa was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _MarcacoesEmpresa extends BaseObject { + + public static final String DATA_PROPERTY = "data"; + public static final String ID_PROPERTY = "id"; + public static final String REALIZADA_PROPERTY = "realizada"; + public static final String TEXTO_PROPERTY = "texto"; + public static final String TO_EMPRESAS_PROPERTY = "toEmpresas"; + + public static final String ID_PK_COLUMN = "id"; + + public void setData(Date data) { + writeProperty("data", data); + } + public Date getData() { + return (Date)readProperty("data"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setRealizada(String realizada) { + writeProperty("realizada", realizada); + } + public String getRealizada() { + return (String)readProperty("realizada"); + } + + public void setTexto(String texto) { + writeProperty("texto", texto); + } + public String getTexto() { + return (String)readProperty("texto"); + } + + public void setToEmpresas(Empresas toEmpresas) { + setToOneTarget("toEmpresas", toEmpresas, true); + } + + public Empresas getToEmpresas() { + return (Empresas)readProperty("toEmpresas"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesEstabelecimento.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesEstabelecimento.java new file mode 100644 index 00000000..3d6d76bc --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesEstabelecimento.java @@ -0,0 +1,143 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsRelatorio; +import siprp.database.cayenne.objects.Lembretes; +import siprp.database.cayenne.objects.MarcacoesTecnicosHst; + +/** + * Class _MarcacoesEstabelecimento was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _MarcacoesEstabelecimento extends BaseObject { + + public static final String DATA_PROPERTY = "data"; + public static final String DATA_EMAIL_PROPERTY = "dataEmail"; + public static final String DATA_RELATORIO_PROPERTY = "dataRelatorio"; + public static final String ESTABELECIMENTO_ID_PROPERTY = "estabelecimentoID"; + public static final String ESTADO_PROPERTY = "estado"; + public static final String ID_PROPERTY = "id"; + public static final String OBSERVACOES_PROPERTY = "observacoes"; + public static final String REALIZADA_PROPERTY = "realizada"; + public static final String HS_RELATORIO_ARRAY_PROPERTY = "hsRelatorioArray"; + public static final String LEMBRETES_ARRAY_PROPERTY = "lembretesArray"; + public static final String TO_ESTABELECIMENTOS_PROPERTY = "toEstabelecimentos"; + public static final String TO_MARCACOES_TECNICOS_HST_PROPERTY = "toMarcacoesTecnicosHst"; + public static final String TO_MARCACOES_TECNICOS_SUPERIORES_HST_PROPERTY = "toMarcacoesTecnicosSuperioresHst"; + + public static final String ID_PK_COLUMN = "id"; + + public void setData(Date data) { + writeProperty("data", data); + } + public Date getData() { + return (Date)readProperty("data"); + } + + public void setDataEmail(Date dataEmail) { + writeProperty("dataEmail", dataEmail); + } + public Date getDataEmail() { + return (Date)readProperty("dataEmail"); + } + + public void setDataRelatorio(Date dataRelatorio) { + writeProperty("dataRelatorio", dataRelatorio); + } + public Date getDataRelatorio() { + return (Date)readProperty("dataRelatorio"); + } + + public void setEstabelecimentoID(Integer estabelecimentoID) { + writeProperty("estabelecimentoID", estabelecimentoID); + } + public Integer getEstabelecimentoID() { + return (Integer)readProperty("estabelecimentoID"); + } + + public void setEstado(Integer estado) { + writeProperty("estado", estado); + } + public Integer getEstado() { + return (Integer)readProperty("estado"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setObservacoes(String observacoes) { + writeProperty("observacoes", observacoes); + } + public String getObservacoes() { + return (String)readProperty("observacoes"); + } + + public void setRealizada(String realizada) { + writeProperty("realizada", realizada); + } + public String getRealizada() { + return (String)readProperty("realizada"); + } + + public void addToHsRelatorioArray(HsRelatorio obj) { + addToManyTarget("hsRelatorioArray", obj, true); + } + public void removeFromHsRelatorioArray(HsRelatorio obj) { + removeToManyTarget("hsRelatorioArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getHsRelatorioArray() { + return (List)readProperty("hsRelatorioArray"); + } + + + public void addToLembretesArray(Lembretes obj) { + addToManyTarget("lembretesArray", obj, true); + } + public void removeFromLembretesArray(Lembretes obj) { + removeToManyTarget("lembretesArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getLembretesArray() { + return (List)readProperty("lembretesArray"); + } + + + public void setToEstabelecimentos(Estabelecimentos toEstabelecimentos) { + setToOneTarget("toEstabelecimentos", toEstabelecimentos, true); + } + + public Estabelecimentos getToEstabelecimentos() { + return (Estabelecimentos)readProperty("toEstabelecimentos"); + } + + + public void setToMarcacoesTecnicosHst(MarcacoesTecnicosHst toMarcacoesTecnicosHst) { + setToOneTarget("toMarcacoesTecnicosHst", toMarcacoesTecnicosHst, true); + } + + public MarcacoesTecnicosHst getToMarcacoesTecnicosHst() { + return (MarcacoesTecnicosHst)readProperty("toMarcacoesTecnicosHst"); + } + + + public void setToMarcacoesTecnicosSuperioresHst(MarcacoesTecnicosHst toMarcacoesTecnicosSuperioresHst) { + setToOneTarget("toMarcacoesTecnicosSuperioresHst", toMarcacoesTecnicosSuperioresHst, true); + } + + public MarcacoesTecnicosHst getToMarcacoesTecnicosSuperioresHst() { + return (MarcacoesTecnicosHst)readProperty("toMarcacoesTecnicosSuperioresHst"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesGruposRealizados.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesGruposRealizados.java new file mode 100644 index 00000000..3a481856 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesGruposRealizados.java @@ -0,0 +1,49 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.MarcacoesTrabalhador; +import siprp.database.cayenne.objects.MarcacoesTrabalhadorEstados; +import siprp.database.cayenne.objects.PrtGruposProtocolo; + +/** + * Class _MarcacoesGruposRealizados was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _MarcacoesGruposRealizados extends BaseObject { + + public static final String TO_MARCACOES_TRABALHADOR_PROPERTY = "toMarcacoesTrabalhador"; + public static final String TO_MARCACOES_TRABALHADOR_ESTADOS_PROPERTY = "toMarcacoesTrabalhadorEstados"; + public static final String TO_PRT_GRUPOS_PROTOCOLO_PROPERTY = "toPrtGruposProtocolo"; + + public static final String ID_PK_COLUMN = "id"; + + public void setToMarcacoesTrabalhador(MarcacoesTrabalhador toMarcacoesTrabalhador) { + setToOneTarget("toMarcacoesTrabalhador", toMarcacoesTrabalhador, true); + } + + public MarcacoesTrabalhador getToMarcacoesTrabalhador() { + return (MarcacoesTrabalhador)readProperty("toMarcacoesTrabalhador"); + } + + + public void setToMarcacoesTrabalhadorEstados(MarcacoesTrabalhadorEstados toMarcacoesTrabalhadorEstados) { + setToOneTarget("toMarcacoesTrabalhadorEstados", toMarcacoesTrabalhadorEstados, true); + } + + public MarcacoesTrabalhadorEstados getToMarcacoesTrabalhadorEstados() { + return (MarcacoesTrabalhadorEstados)readProperty("toMarcacoesTrabalhadorEstados"); + } + + + public void setToPrtGruposProtocolo(PrtGruposProtocolo toPrtGruposProtocolo) { + setToOneTarget("toPrtGruposProtocolo", toPrtGruposProtocolo, true); + } + + public PrtGruposProtocolo getToPrtGruposProtocolo() { + return (PrtGruposProtocolo)readProperty("toPrtGruposProtocolo"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesTecnicosHst.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesTecnicosHst.java new file mode 100644 index 00000000..0c6bd29f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesTecnicosHst.java @@ -0,0 +1,104 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.MarcacoesEstabelecimento; + +/** + * Class _MarcacoesTecnicosHst was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _MarcacoesTecnicosHst extends BaseObject { + + public static final String ASSINATURA_PROPERTY = "assinatura"; + public static final String CAP_PROPERTY = "cap"; + public static final String FORMACAO_PROPERTY = "formacao"; + public static final String ID_PROPERTY = "id"; + public static final String IDENTIFICADOR_PROPERTY = "identificador"; + public static final String INACTIVO_PROPERTY = "inactivo"; + public static final String INICIAIS_PROPERTY = "iniciais"; + public static final String NOME_PROPERTY = "nome"; + public static final String NOME_PLAIN_PROPERTY = "nomePlain"; + public static final String MARCACOES_ESTABELECIMENTO_ARRAY_PROPERTY = "marcacoesEstabelecimentoArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setAssinatura(Integer assinatura) { + writeProperty("assinatura", assinatura); + } + public Integer getAssinatura() { + return (Integer)readProperty("assinatura"); + } + + public void setCap(String cap) { + writeProperty("cap", cap); + } + public String getCap() { + return (String)readProperty("cap"); + } + + public void setFormacao(String formacao) { + writeProperty("formacao", formacao); + } + public String getFormacao() { + return (String)readProperty("formacao"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setIdentificador(Integer identificador) { + writeProperty("identificador", identificador); + } + public Integer getIdentificador() { + return (Integer)readProperty("identificador"); + } + + public void setInactivo(String inactivo) { + writeProperty("inactivo", inactivo); + } + public String getInactivo() { + return (String)readProperty("inactivo"); + } + + public void setIniciais(String iniciais) { + writeProperty("iniciais", iniciais); + } + public String getIniciais() { + return (String)readProperty("iniciais"); + } + + public void setNome(String nome) { + writeProperty("nome", nome); + } + public String getNome() { + return (String)readProperty("nome"); + } + + public void setNomePlain(String nomePlain) { + writeProperty("nomePlain", nomePlain); + } + public String getNomePlain() { + return (String)readProperty("nomePlain"); + } + + public void addToMarcacoesEstabelecimentoArray(MarcacoesEstabelecimento obj) { + addToManyTarget("marcacoesEstabelecimentoArray", obj, true); + } + public void removeFromMarcacoesEstabelecimentoArray(MarcacoesEstabelecimento obj) { + removeToManyTarget("marcacoesEstabelecimentoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getMarcacoesEstabelecimentoArray() { + return (List)readProperty("marcacoesEstabelecimentoArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesTrabalhador.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesTrabalhador.java new file mode 100644 index 00000000..50fed840 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesTrabalhador.java @@ -0,0 +1,152 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Lembretes; +import siprp.database.cayenne.objects.MarcacoesGruposRealizados; +import siprp.database.cayenne.objects.MarcacoesTrabalhadorEstados; +import siprp.database.cayenne.objects.Prestadores; + +/** + * Class _MarcacoesTrabalhador was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _MarcacoesTrabalhador extends BaseObject { + + public static final String DATA_PROPERTY = "data"; + public static final String DATA_EMAIL_PROPERTY = "dataEmail"; + public static final String DATA_RELATORIO_PROPERTY = "dataRelatorio"; + public static final String ESTADO_PROPERTY = "estado"; + public static final String ID_PROPERTY = "id"; + public static final String MOTIVO_PROPERTY = "motivo"; + public static final String OBSERVACOES_PROPERTY = "observacoes"; + public static final String REALIZADA_PROPERTY = "realizada"; + public static final String TIPO_PROPERTY = "tipo"; + public static final String TRABALHADOR_ID_PROPERTY = "trabalhadorId"; + public static final String LEMBRETES_ARRAY_PROPERTY = "lembretesArray"; + public static final String MARCACOES_GRUPOS_REALIZADOS_ARRAY_PROPERTY = "marcacoesGruposRealizadosArray"; + public static final String MARCACOES_TRABALHADOR_ESTADOS_ARRAY_PROPERTY = "marcacoesTrabalhadorEstadosArray"; + public static final String TO_PRESTADORES_PROPERTY = "toPrestadores"; + + public static final String ID_PK_COLUMN = "id"; + + public void setData(Date data) { + writeProperty("data", data); + } + public Date getData() { + return (Date)readProperty("data"); + } + + public void setDataEmail(Date dataEmail) { + writeProperty("dataEmail", dataEmail); + } + public Date getDataEmail() { + return (Date)readProperty("dataEmail"); + } + + public void setDataRelatorio(Date dataRelatorio) { + writeProperty("dataRelatorio", dataRelatorio); + } + public Date getDataRelatorio() { + return (Date)readProperty("dataRelatorio"); + } + + public void setEstado(Integer estado) { + writeProperty("estado", estado); + } + public Integer getEstado() { + return (Integer)readProperty("estado"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setMotivo(Integer motivo) { + writeProperty("motivo", motivo); + } + public Integer getMotivo() { + return (Integer)readProperty("motivo"); + } + + public void setObservacoes(String observacoes) { + writeProperty("observacoes", observacoes); + } + public String getObservacoes() { + return (String)readProperty("observacoes"); + } + + public void setRealizada(String realizada) { + writeProperty("realizada", realizada); + } + public String getRealizada() { + return (String)readProperty("realizada"); + } + + public void setTipo(Integer tipo) { + writeProperty("tipo", tipo); + } + public Integer getTipo() { + return (Integer)readProperty("tipo"); + } + + public void setTrabalhadorId(Integer trabalhadorId) { + writeProperty("trabalhadorId", trabalhadorId); + } + public Integer getTrabalhadorId() { + return (Integer)readProperty("trabalhadorId"); + } + + public void addToLembretesArray(Lembretes obj) { + addToManyTarget("lembretesArray", obj, true); + } + public void removeFromLembretesArray(Lembretes obj) { + removeToManyTarget("lembretesArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getLembretesArray() { + return (List)readProperty("lembretesArray"); + } + + + public void addToMarcacoesGruposRealizadosArray(MarcacoesGruposRealizados obj) { + addToManyTarget("marcacoesGruposRealizadosArray", obj, true); + } + public void removeFromMarcacoesGruposRealizadosArray(MarcacoesGruposRealizados obj) { + removeToManyTarget("marcacoesGruposRealizadosArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getMarcacoesGruposRealizadosArray() { + return (List)readProperty("marcacoesGruposRealizadosArray"); + } + + + public void addToMarcacoesTrabalhadorEstadosArray(MarcacoesTrabalhadorEstados obj) { + addToManyTarget("marcacoesTrabalhadorEstadosArray", obj, true); + } + public void removeFromMarcacoesTrabalhadorEstadosArray(MarcacoesTrabalhadorEstados obj) { + removeToManyTarget("marcacoesTrabalhadorEstadosArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getMarcacoesTrabalhadorEstadosArray() { + return (List)readProperty("marcacoesTrabalhadorEstadosArray"); + } + + + public void setToPrestadores(Prestadores toPrestadores) { + setToOneTarget("toPrestadores", toPrestadores, true); + } + + public Prestadores getToPrestadores() { + return (Prestadores)readProperty("toPrestadores"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesTrabalhadorEstados.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesTrabalhadorEstados.java new file mode 100644 index 00000000..0951ada6 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_MarcacoesTrabalhadorEstados.java @@ -0,0 +1,79 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.MarcacoesGruposRealizados; +import siprp.database.cayenne.objects.MarcacoesTrabalhador; +import siprp.database.cayenne.objects.Prestadores; + +/** + * Class _MarcacoesTrabalhadorEstados was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _MarcacoesTrabalhadorEstados extends BaseObject { + + public static final String DATA_PROPERTY = "data"; + public static final String ESTADO_PROPERTY = "estado"; + public static final String ID_PROPERTY = "id"; + public static final String MARCACOES_GRUPOS_REALIZADOS_ARRAY_PROPERTY = "marcacoesGruposRealizadosArray"; + public static final String TO_MARCACOES_TRABALHADOR_PROPERTY = "toMarcacoesTrabalhador"; + public static final String TO_PRESTADORES_PROPERTY = "toPrestadores"; + + public static final String ID_PK_COLUMN = "id"; + + public void setData(Date data) { + writeProperty("data", data); + } + public Date getData() { + return (Date)readProperty("data"); + } + + public void setEstado(Integer estado) { + writeProperty("estado", estado); + } + public Integer getEstado() { + return (Integer)readProperty("estado"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void addToMarcacoesGruposRealizadosArray(MarcacoesGruposRealizados obj) { + addToManyTarget("marcacoesGruposRealizadosArray", obj, true); + } + public void removeFromMarcacoesGruposRealizadosArray(MarcacoesGruposRealizados obj) { + removeToManyTarget("marcacoesGruposRealizadosArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getMarcacoesGruposRealizadosArray() { + return (List)readProperty("marcacoesGruposRealizadosArray"); + } + + + public void setToMarcacoesTrabalhador(MarcacoesTrabalhador toMarcacoesTrabalhador) { + setToOneTarget("toMarcacoesTrabalhador", toMarcacoesTrabalhador, true); + } + + public MarcacoesTrabalhador getToMarcacoesTrabalhador() { + return (MarcacoesTrabalhador)readProperty("toMarcacoesTrabalhador"); + } + + + public void setToPrestadores(Prestadores toPrestadores) { + setToOneTarget("toPrestadores", toPrestadores, true); + } + + public Prestadores getToPrestadores() { + return (Prestadores)readProperty("toPrestadores"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Medicos.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Medicos.java new file mode 100644 index 00000000..71024a24 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Medicos.java @@ -0,0 +1,78 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.Exames; + +/** + * Class _Medicos was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Medicos extends BaseObject { + + public static final String ID_PROPERTY = "id"; + public static final String INACTIVO_PROPERTY = "inactivo"; + public static final String NOME_PROPERTY = "nome"; + public static final String NUMERO_CEDULA_PROPERTY = "numeroCedula"; + public static final String ESTABELECIMENTOS_ARRAY_PROPERTY = "estabelecimentosArray"; + public static final String EXAMES_ARRAY_PROPERTY = "examesArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setInactivo(String inactivo) { + writeProperty("inactivo", inactivo); + } + public String getInactivo() { + return (String)readProperty("inactivo"); + } + + public void setNome(String nome) { + writeProperty("nome", nome); + } + public String getNome() { + return (String)readProperty("nome"); + } + + public void setNumeroCedula(String numeroCedula) { + writeProperty("numeroCedula", numeroCedula); + } + public String getNumeroCedula() { + return (String)readProperty("numeroCedula"); + } + + public void addToEstabelecimentosArray(Estabelecimentos obj) { + addToManyTarget("estabelecimentosArray", obj, true); + } + public void removeFromEstabelecimentosArray(Estabelecimentos obj) { + removeToManyTarget("estabelecimentosArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getEstabelecimentosArray() { + return (List)readProperty("estabelecimentosArray"); + } + + + public void addToExamesArray(Exames obj) { + addToManyTarget("examesArray", obj, true); + } + public void removeFromExamesArray(Exames obj) { + removeToManyTarget("examesArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getExamesArray() { + return (List)readProperty("examesArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Prestadores.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Prestadores.java new file mode 100644 index 00000000..d6def74c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Prestadores.java @@ -0,0 +1,264 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Contactos; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.MarcacoesTrabalhador; +import siprp.database.cayenne.objects.MarcacoesTrabalhadorEstados; +import siprp.database.cayenne.objects.PrestadoresGruposProtocolo; +import siprp.database.cayenne.objects.PrtGruposProtocolo; +import siprp.database.cayenne.objects.TrabalhadoresConsultas; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatas; +import siprp.database.cayenne.objects.TrabalhadoresEcd; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatas; + +/** + * Class _Prestadores was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Prestadores extends BaseObject { + + public static final String ACTIVO_PROPERTY = "activo"; + public static final String CODIGO_POSTAL_PROPERTY = "codigoPostal"; + public static final String CONTRIBUINTE_PROPERTY = "contribuinte"; + public static final String FAZ_CONSULTAS_PROPERTY = "fazConsultas"; + public static final String FAZ_ECDS_PROPERTY = "fazEcds"; + public static final String ID_PROPERTY = "id"; + public static final String LOCALIDADE_PROPERTY = "localidade"; + public static final String LOCALIDADE_CP_PROPERTY = "localidadeCp"; + public static final String MORADA_PROPERTY = "morada"; + public static final String NOME_PROPERTY = "nome"; + public static final String NOME_PLAIN_PROPERTY = "nomePlain"; + public static final String OBSERVACOES_PROPERTY = "observacoes"; + public static final String ESTABELECIMENTOS_ARRAY_PROPERTY = "estabelecimentosArray"; + public static final String ESTABELECIMENTOS_ARRAY1_PROPERTY = "estabelecimentosArray1"; + public static final String MARCACOES_TRABALHADOR_ARRAY_PROPERTY = "marcacoesTrabalhadorArray"; + public static final String MARCACOES_TRABALHADOR_ESTADOS_ARRAY_PROPERTY = "marcacoesTrabalhadorEstadosArray"; + public static final String PRESTADORES_GRUPOS_PROTOCOLO_ARRAY_PROPERTY = "prestadoresGruposProtocoloArray"; + public static final String PRT_GRUPOS_PROTOCOLO_ARRAY_PROPERTY = "prtGruposProtocoloArray"; + public static final String TO_CONTACTOS_PROPERTY = "toContactos"; + public static final String TRABALHADORES_CONSULTAS_ARRAY_PROPERTY = "trabalhadoresConsultasArray"; + public static final String TRABALHADORES_CONSULTAS_DATAS_ARRAY_PROPERTY = "trabalhadoresConsultasDatasArray"; + public static final String TRABALHADORES_ECD_ARRAY_PROPERTY = "trabalhadoresEcdArray"; + public static final String TRABALHADORES_ECDS_DATAS_ARRAY_PROPERTY = "trabalhadoresEcdsDatasArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setActivo(String activo) { + writeProperty("activo", activo); + } + public String getActivo() { + return (String)readProperty("activo"); + } + + public void setCodigoPostal(String codigoPostal) { + writeProperty("codigoPostal", codigoPostal); + } + public String getCodigoPostal() { + return (String)readProperty("codigoPostal"); + } + + public void setContribuinte(String contribuinte) { + writeProperty("contribuinte", contribuinte); + } + public String getContribuinte() { + return (String)readProperty("contribuinte"); + } + + public void setFazConsultas(String fazConsultas) { + writeProperty("fazConsultas", fazConsultas); + } + public String getFazConsultas() { + return (String)readProperty("fazConsultas"); + } + + public void setFazEcds(String fazEcds) { + writeProperty("fazEcds", fazEcds); + } + public String getFazEcds() { + return (String)readProperty("fazEcds"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setLocalidade(String localidade) { + writeProperty("localidade", localidade); + } + public String getLocalidade() { + return (String)readProperty("localidade"); + } + + public void setLocalidadeCp(String localidadeCp) { + writeProperty("localidadeCp", localidadeCp); + } + public String getLocalidadeCp() { + return (String)readProperty("localidadeCp"); + } + + public void setMorada(String morada) { + writeProperty("morada", morada); + } + public String getMorada() { + return (String)readProperty("morada"); + } + + public void setNome(String nome) { + writeProperty("nome", nome); + } + public String getNome() { + return (String)readProperty("nome"); + } + + public void setNomePlain(String nomePlain) { + writeProperty("nomePlain", nomePlain); + } + public String getNomePlain() { + return (String)readProperty("nomePlain"); + } + + public void setObservacoes(String observacoes) { + writeProperty("observacoes", observacoes); + } + public String getObservacoes() { + return (String)readProperty("observacoes"); + } + + public void addToEstabelecimentosArray(Estabelecimentos obj) { + addToManyTarget("estabelecimentosArray", obj, true); + } + public void removeFromEstabelecimentosArray(Estabelecimentos obj) { + removeToManyTarget("estabelecimentosArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getEstabelecimentosArray() { + return (List)readProperty("estabelecimentosArray"); + } + + + public void addToEstabelecimentosArray1(Estabelecimentos obj) { + addToManyTarget("estabelecimentosArray1", obj, true); + } + public void removeFromEstabelecimentosArray1(Estabelecimentos obj) { + removeToManyTarget("estabelecimentosArray1", obj, true); + } + @SuppressWarnings("unchecked") + public List getEstabelecimentosArray1() { + return (List)readProperty("estabelecimentosArray1"); + } + + + public void addToMarcacoesTrabalhadorArray(MarcacoesTrabalhador obj) { + addToManyTarget("marcacoesTrabalhadorArray", obj, true); + } + public void removeFromMarcacoesTrabalhadorArray(MarcacoesTrabalhador obj) { + removeToManyTarget("marcacoesTrabalhadorArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getMarcacoesTrabalhadorArray() { + return (List)readProperty("marcacoesTrabalhadorArray"); + } + + + public void addToMarcacoesTrabalhadorEstadosArray(MarcacoesTrabalhadorEstados obj) { + addToManyTarget("marcacoesTrabalhadorEstadosArray", obj, true); + } + public void removeFromMarcacoesTrabalhadorEstadosArray(MarcacoesTrabalhadorEstados obj) { + removeToManyTarget("marcacoesTrabalhadorEstadosArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getMarcacoesTrabalhadorEstadosArray() { + return (List)readProperty("marcacoesTrabalhadorEstadosArray"); + } + + + public void addToPrestadoresGruposProtocoloArray(PrestadoresGruposProtocolo obj) { + addToManyTarget("prestadoresGruposProtocoloArray", obj, true); + } + public void removeFromPrestadoresGruposProtocoloArray(PrestadoresGruposProtocolo obj) { + removeToManyTarget("prestadoresGruposProtocoloArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getPrestadoresGruposProtocoloArray() { + return (List)readProperty("prestadoresGruposProtocoloArray"); + } + + + public void addToPrtGruposProtocoloArray(PrtGruposProtocolo obj) { + addToManyTarget("prtGruposProtocoloArray", obj, true); + } + public void removeFromPrtGruposProtocoloArray(PrtGruposProtocolo obj) { + removeToManyTarget("prtGruposProtocoloArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getPrtGruposProtocoloArray() { + return (List)readProperty("prtGruposProtocoloArray"); + } + + + public void setToContactos(Contactos toContactos) { + setToOneTarget("toContactos", toContactos, true); + } + + public Contactos getToContactos() { + return (Contactos)readProperty("toContactos"); + } + + + public void addToTrabalhadoresConsultasArray(TrabalhadoresConsultas obj) { + addToManyTarget("trabalhadoresConsultasArray", obj, true); + } + public void removeFromTrabalhadoresConsultasArray(TrabalhadoresConsultas obj) { + removeToManyTarget("trabalhadoresConsultasArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresConsultasArray() { + return (List)readProperty("trabalhadoresConsultasArray"); + } + + + public void addToTrabalhadoresConsultasDatasArray(TrabalhadoresConsultasDatas obj) { + addToManyTarget("trabalhadoresConsultasDatasArray", obj, true); + } + public void removeFromTrabalhadoresConsultasDatasArray(TrabalhadoresConsultasDatas obj) { + removeToManyTarget("trabalhadoresConsultasDatasArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresConsultasDatasArray() { + return (List)readProperty("trabalhadoresConsultasDatasArray"); + } + + + public void addToTrabalhadoresEcdArray(TrabalhadoresEcd obj) { + addToManyTarget("trabalhadoresEcdArray", obj, true); + } + public void removeFromTrabalhadoresEcdArray(TrabalhadoresEcd obj) { + removeToManyTarget("trabalhadoresEcdArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresEcdArray() { + return (List)readProperty("trabalhadoresEcdArray"); + } + + + public void addToTrabalhadoresEcdsDatasArray(TrabalhadoresEcdsDatas obj) { + addToManyTarget("trabalhadoresEcdsDatasArray", obj, true); + } + public void removeFromTrabalhadoresEcdsDatasArray(TrabalhadoresEcdsDatas obj) { + removeToManyTarget("trabalhadoresEcdsDatasArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresEcdsDatasArray() { + return (List)readProperty("trabalhadoresEcdsDatasArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_PrestadoresGruposProtocolo.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_PrestadoresGruposProtocolo.java new file mode 100644 index 00000000..93f46800 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_PrestadoresGruposProtocolo.java @@ -0,0 +1,38 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Prestadores; +import siprp.database.cayenne.objects.PrtGruposProtocolo; + +/** + * Class _PrestadoresGruposProtocolo was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _PrestadoresGruposProtocolo extends BaseObject { + + public static final String TO_PRESTADORES_PROPERTY = "toPrestadores"; + public static final String TO_PRT_GRUPOS_PROTOCOLO_PROPERTY = "toPrtGruposProtocolo"; + + public static final String ID_PK_COLUMN = "id"; + + public void setToPrestadores(Prestadores toPrestadores) { + setToOneTarget("toPrestadores", toPrestadores, true); + } + + public Prestadores getToPrestadores() { + return (Prestadores)readProperty("toPrestadores"); + } + + + public void setToPrtGruposProtocolo(PrtGruposProtocolo toPrtGruposProtocolo) { + setToOneTarget("toPrtGruposProtocolo", toPrtGruposProtocolo, true); + } + + public PrtGruposProtocolo getToPrtGruposProtocolo() { + return (PrtGruposProtocolo)readProperty("toPrtGruposProtocolo"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_PrtElementosProtocolo.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_PrtElementosProtocolo.java new file mode 100644 index 00000000..4b73400b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_PrtElementosProtocolo.java @@ -0,0 +1,54 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.PrtTiposElementosProtocolo; + +/** + * Class _PrtElementosProtocolo was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _PrtElementosProtocolo extends BaseObject { + + public static final String ID_PROPERTY = "id"; + public static final String NUMERO_PERFIL_PROPERTY = "numeroPerfil"; + public static final String TO_EMPRESAS_PROPERTY = "toEmpresas"; + public static final String TO_PRT_TIPOS_ELEMENTOS_PROTOCOLO_PROPERTY = "toPrtTiposElementosProtocolo"; + + public static final String ID_PK_COLUMN = "id"; + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setNumeroPerfil(Integer numeroPerfil) { + writeProperty("numeroPerfil", numeroPerfil); + } + public Integer getNumeroPerfil() { + return (Integer)readProperty("numeroPerfil"); + } + + public void setToEmpresas(Empresas toEmpresas) { + setToOneTarget("toEmpresas", toEmpresas, true); + } + + public Empresas getToEmpresas() { + return (Empresas)readProperty("toEmpresas"); + } + + + public void setToPrtTiposElementosProtocolo(PrtTiposElementosProtocolo toPrtTiposElementosProtocolo) { + setToOneTarget("toPrtTiposElementosProtocolo", toPrtTiposElementosProtocolo, true); + } + + public PrtTiposElementosProtocolo getToPrtTiposElementosProtocolo() { + return (PrtTiposElementosProtocolo)readProperty("toPrtTiposElementosProtocolo"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_PrtGruposProtocolo.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_PrtGruposProtocolo.java new file mode 100644 index 00000000..cc070aaf --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_PrtGruposProtocolo.java @@ -0,0 +1,111 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.MarcacoesGruposRealizados; +import siprp.database.cayenne.objects.Prestadores; +import siprp.database.cayenne.objects.PrestadoresGruposProtocolo; +import siprp.database.cayenne.objects.PrtTiposElementosProtocolo; + +/** + * Class _PrtGruposProtocolo was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _PrtGruposProtocolo extends BaseObject { + + public static final String DESCRICAO_PROPERTY = "descricao"; + public static final String DESCRICAO_PLAIN_PROPERTY = "descricaoPlain"; + public static final String GRUPO_REAL_PROPERTY = "grupoReal"; + public static final String ID_PROPERTY = "id"; + public static final String ORDEM_PROPERTY = "ordem"; + public static final String MARCACOES_GRUPOS_REALIZADOS_ARRAY_PROPERTY = "marcacoesGruposRealizadosArray"; + public static final String PRESTADORES_GRUPOS_PROTOCOLO_ARRAY_PROPERTY = "prestadoresGruposProtocoloArray"; + public static final String PRT_TIPOS_ELEMENTOS_PROTOCOLO_ARRAY_PROPERTY = "prtTiposElementosProtocoloArray"; + public static final String TO_ANALISADOR_PROPERTY = "toAnalisador"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDescricao(String descricao) { + writeProperty("descricao", descricao); + } + public String getDescricao() { + return (String)readProperty("descricao"); + } + + public void setDescricaoPlain(String descricaoPlain) { + writeProperty("descricaoPlain", descricaoPlain); + } + public String getDescricaoPlain() { + return (String)readProperty("descricaoPlain"); + } + + public void setGrupoReal(String grupoReal) { + writeProperty("grupoReal", grupoReal); + } + public String getGrupoReal() { + return (String)readProperty("grupoReal"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setOrdem(Integer ordem) { + writeProperty("ordem", ordem); + } + public Integer getOrdem() { + return (Integer)readProperty("ordem"); + } + + public void addToMarcacoesGruposRealizadosArray(MarcacoesGruposRealizados obj) { + addToManyTarget("marcacoesGruposRealizadosArray", obj, true); + } + public void removeFromMarcacoesGruposRealizadosArray(MarcacoesGruposRealizados obj) { + removeToManyTarget("marcacoesGruposRealizadosArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getMarcacoesGruposRealizadosArray() { + return (List)readProperty("marcacoesGruposRealizadosArray"); + } + + + public void addToPrestadoresGruposProtocoloArray(PrestadoresGruposProtocolo obj) { + addToManyTarget("prestadoresGruposProtocoloArray", obj, true); + } + public void removeFromPrestadoresGruposProtocoloArray(PrestadoresGruposProtocolo obj) { + removeToManyTarget("prestadoresGruposProtocoloArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getPrestadoresGruposProtocoloArray() { + return (List)readProperty("prestadoresGruposProtocoloArray"); + } + + + public void addToPrtTiposElementosProtocoloArray(PrtTiposElementosProtocolo obj) { + addToManyTarget("prtTiposElementosProtocoloArray", obj, true); + } + public void removeFromPrtTiposElementosProtocoloArray(PrtTiposElementosProtocolo obj) { + removeToManyTarget("prtTiposElementosProtocoloArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getPrtTiposElementosProtocoloArray() { + return (List)readProperty("prtTiposElementosProtocoloArray"); + } + + + public void setToAnalisador(Prestadores toAnalisador) { + setToOneTarget("toAnalisador", toAnalisador, true); + } + + public Prestadores getToAnalisador() { + return (Prestadores)readProperty("toAnalisador"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_PrtTiposElementosProtocolo.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_PrtTiposElementosProtocolo.java new file mode 100644 index 00000000..bc5b8795 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_PrtTiposElementosProtocolo.java @@ -0,0 +1,89 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.PrtElementosProtocolo; +import siprp.database.cayenne.objects.PrtGruposProtocolo; +import siprp.database.cayenne.objects.TrabalhadoresEcd; + +/** + * Class _PrtTiposElementosProtocolo was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _PrtTiposElementosProtocolo extends BaseObject { + + public static final String DESCRICAO_PROPERTY = "descricao"; + public static final String DESCRICAO_PLAIN_PROPERTY = "descricaoPlain"; + public static final String ID_PROPERTY = "id"; + public static final String ORDEM_PROPERTY = "ordem"; + public static final String PRT_ELEMENTOS_PROTOCOLO_ARRAY_PROPERTY = "prtElementosProtocoloArray"; + public static final String TO_PRT_GRUPOS_PROTOCOLO_PROPERTY = "toPrtGruposProtocolo"; + public static final String TRABALHADORES_ECD_ARRAY_PROPERTY = "trabalhadoresEcdArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDescricao(String descricao) { + writeProperty("descricao", descricao); + } + public String getDescricao() { + return (String)readProperty("descricao"); + } + + public void setDescricaoPlain(String descricaoPlain) { + writeProperty("descricaoPlain", descricaoPlain); + } + public String getDescricaoPlain() { + return (String)readProperty("descricaoPlain"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setOrdem(Integer ordem) { + writeProperty("ordem", ordem); + } + public Integer getOrdem() { + return (Integer)readProperty("ordem"); + } + + public void addToPrtElementosProtocoloArray(PrtElementosProtocolo obj) { + addToManyTarget("prtElementosProtocoloArray", obj, true); + } + public void removeFromPrtElementosProtocoloArray(PrtElementosProtocolo obj) { + removeToManyTarget("prtElementosProtocoloArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getPrtElementosProtocoloArray() { + return (List)readProperty("prtElementosProtocoloArray"); + } + + + public void setToPrtGruposProtocolo(PrtGruposProtocolo toPrtGruposProtocolo) { + setToOneTarget("toPrtGruposProtocolo", toPrtGruposProtocolo, true); + } + + public PrtGruposProtocolo getToPrtGruposProtocolo() { + return (PrtGruposProtocolo)readProperty("toPrtGruposProtocolo"); + } + + + public void addToTrabalhadoresEcdArray(TrabalhadoresEcd obj) { + addToManyTarget("trabalhadoresEcdArray", obj, true); + } + public void removeFromTrabalhadoresEcdArray(TrabalhadoresEcd obj) { + removeToManyTarget("trabalhadoresEcdArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresEcdArray() { + return (List)readProperty("trabalhadoresEcdArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_SIPRPMap.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_SIPRPMap.java new file mode 100644 index 00000000..97b98c02 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_SIPRPMap.java @@ -0,0 +1,12 @@ +package siprp.database.cayenne.objects.auto; + + + +/** + * This class was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public class _SIPRPMap { +} \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TiposExamesComp.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TiposExamesComp.java new file mode 100644 index 00000000..8baf2602 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TiposExamesComp.java @@ -0,0 +1,56 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.ExamesPerfis; + +/** + * Class _TiposExamesComp was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _TiposExamesComp extends BaseObject { + + public static final String DESCRICAO_PROPERTY = "descricao"; + public static final String ID_PROPERTY = "id"; + public static final String ORDEM_PROPERTY = "ordem"; + public static final String EXAMES_PERFIS_ARRAY_PROPERTY = "examesPerfisArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDescricao(String descricao) { + writeProperty("descricao", descricao); + } + public String getDescricao() { + return (String)readProperty("descricao"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setOrdem(Integer ordem) { + writeProperty("ordem", ordem); + } + public Integer getOrdem() { + return (Integer)readProperty("ordem"); + } + + public void addToExamesPerfisArray(ExamesPerfis obj) { + addToManyTarget("examesPerfisArray", obj, true); + } + public void removeFromExamesPerfisArray(ExamesPerfis obj) { + removeToManyTarget("examesPerfisArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getExamesPerfisArray() { + return (List)readProperty("examesPerfisArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Trabalhadores.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Trabalhadores.java new file mode 100644 index 00000000..7c7ed8dd --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_Trabalhadores.java @@ -0,0 +1,238 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.Lembretes; +import siprp.database.cayenne.objects.TrabalhadoresConsultas; +import siprp.database.cayenne.objects.TrabalhadoresEcds; +import siprp.database.cayenne.objects.TrabalhadoresProcesso; + +/** + * Class _Trabalhadores was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Trabalhadores extends BaseObject { + + public static final String ACTUALIZACAO_PROPERTY = "actualizacao"; + public static final String BI_PROPERTY = "bi"; + public static final String CATEGORIA_PROPERTY = "categoria"; + public static final String DATA_ADMISSAO_PROPERTY = "dataAdmissao"; + public static final String DATA_ADMISSAO_FUNCAO_PROPERTY = "dataAdmissaoFuncao"; + public static final String DATA_DEMISSAO_PROPERTY = "dataDemissao"; + public static final String DATA_NASCIMENTO_PROPERTY = "dataNascimento"; + public static final String FUNCAO_PROPOSTA_PROPERTY = "funcaoProposta"; + public static final String ID_PROPERTY = "id"; + public static final String INACTIVO_PROPERTY = "inactivo"; + public static final String LOCAL_TRABALHO_PROPERTY = "localTrabalho"; + public static final String NACIONALIDADE_PROPERTY = "nacionalidade"; + public static final String NOME_PROPERTY = "nome"; + public static final String NOME_PLAIN_PROPERTY = "nomePlain"; + public static final String NUMERO_MECANOGRAFICO_PROPERTY = "numeroMecanografico"; + public static final String OBSERVACOES_PROPERTY = "observacoes"; + public static final String OBSERVACOES_GESTAO_PROPERTY = "observacoesGestao"; + public static final String PERFIL_PROPERTY = "perfil"; + public static final String SEXO_PROPERTY = "sexo"; + public static final String LEMBRETES_ARRAY_PROPERTY = "lembretesArray"; + public static final String TO_ESTABELECIMENTOS_PROPERTY = "toEstabelecimentos"; + public static final String TRABALHADORES_CONSULTAS_ARRAY_PROPERTY = "trabalhadoresConsultasArray"; + public static final String TRABALHADORES_ECDS_ARRAY_PROPERTY = "trabalhadoresEcdsArray"; + public static final String TRABALHADORES_PROCESSO_ARRAY_PROPERTY = "trabalhadoresProcessoArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setActualizacao(Date actualizacao) { + writeProperty("actualizacao", actualizacao); + } + public Date getActualizacao() { + return (Date)readProperty("actualizacao"); + } + + public void setBi(String bi) { + writeProperty("bi", bi); + } + public String getBi() { + return (String)readProperty("bi"); + } + + public void setCategoria(String categoria) { + writeProperty("categoria", categoria); + } + public String getCategoria() { + return (String)readProperty("categoria"); + } + + public void setDataAdmissao(Date dataAdmissao) { + writeProperty("dataAdmissao", dataAdmissao); + } + public Date getDataAdmissao() { + return (Date)readProperty("dataAdmissao"); + } + + public void setDataAdmissaoFuncao(Date dataAdmissaoFuncao) { + writeProperty("dataAdmissaoFuncao", dataAdmissaoFuncao); + } + public Date getDataAdmissaoFuncao() { + return (Date)readProperty("dataAdmissaoFuncao"); + } + + public void setDataDemissao(Date dataDemissao) { + writeProperty("dataDemissao", dataDemissao); + } + public Date getDataDemissao() { + return (Date)readProperty("dataDemissao"); + } + + public void setDataNascimento(Date dataNascimento) { + writeProperty("dataNascimento", dataNascimento); + } + public Date getDataNascimento() { + return (Date)readProperty("dataNascimento"); + } + + public void setFuncaoProposta(String funcaoProposta) { + writeProperty("funcaoProposta", funcaoProposta); + } + public String getFuncaoProposta() { + return (String)readProperty("funcaoProposta"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setInactivo(String inactivo) { + writeProperty("inactivo", inactivo); + } + public String getInactivo() { + return (String)readProperty("inactivo"); + } + + public void setLocalTrabalho(String localTrabalho) { + writeProperty("localTrabalho", localTrabalho); + } + public String getLocalTrabalho() { + return (String)readProperty("localTrabalho"); + } + + public void setNacionalidade(String nacionalidade) { + writeProperty("nacionalidade", nacionalidade); + } + public String getNacionalidade() { + return (String)readProperty("nacionalidade"); + } + + public void setNome(String nome) { + writeProperty("nome", nome); + } + public String getNome() { + return (String)readProperty("nome"); + } + + public void setNomePlain(String nomePlain) { + writeProperty("nomePlain", nomePlain); + } + public String getNomePlain() { + return (String)readProperty("nomePlain"); + } + + public void setNumeroMecanografico(String numeroMecanografico) { + writeProperty("numeroMecanografico", numeroMecanografico); + } + public String getNumeroMecanografico() { + return (String)readProperty("numeroMecanografico"); + } + + public void setObservacoes(String observacoes) { + writeProperty("observacoes", observacoes); + } + public String getObservacoes() { + return (String)readProperty("observacoes"); + } + + public void setObservacoesGestao(String observacoesGestao) { + writeProperty("observacoesGestao", observacoesGestao); + } + public String getObservacoesGestao() { + return (String)readProperty("observacoesGestao"); + } + + public void setPerfil(Integer perfil) { + writeProperty("perfil", perfil); + } + public Integer getPerfil() { + return (Integer)readProperty("perfil"); + } + + public void setSexo(String sexo) { + writeProperty("sexo", sexo); + } + public String getSexo() { + return (String)readProperty("sexo"); + } + + public void addToLembretesArray(Lembretes obj) { + addToManyTarget("lembretesArray", obj, true); + } + public void removeFromLembretesArray(Lembretes obj) { + removeToManyTarget("lembretesArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getLembretesArray() { + return (List)readProperty("lembretesArray"); + } + + + public void setToEstabelecimentos(Estabelecimentos toEstabelecimentos) { + setToOneTarget("toEstabelecimentos", toEstabelecimentos, true); + } + + public Estabelecimentos getToEstabelecimentos() { + return (Estabelecimentos)readProperty("toEstabelecimentos"); + } + + + public void addToTrabalhadoresConsultasArray(TrabalhadoresConsultas obj) { + addToManyTarget("trabalhadoresConsultasArray", obj, true); + } + public void removeFromTrabalhadoresConsultasArray(TrabalhadoresConsultas obj) { + removeToManyTarget("trabalhadoresConsultasArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresConsultasArray() { + return (List)readProperty("trabalhadoresConsultasArray"); + } + + + public void addToTrabalhadoresEcdsArray(TrabalhadoresEcds obj) { + addToManyTarget("trabalhadoresEcdsArray", obj, true); + } + public void removeFromTrabalhadoresEcdsArray(TrabalhadoresEcds obj) { + removeToManyTarget("trabalhadoresEcdsArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresEcdsArray() { + return (List)readProperty("trabalhadoresEcdsArray"); + } + + + public void addToTrabalhadoresProcessoArray(TrabalhadoresProcesso obj) { + addToManyTarget("trabalhadoresProcessoArray", obj, true); + } + public void removeFromTrabalhadoresProcessoArray(TrabalhadoresProcesso obj) { + removeToManyTarget("trabalhadoresProcessoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresProcessoArray() { + return (List)readProperty("trabalhadoresProcessoArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresConsultas.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresConsultas.java new file mode 100644 index 00000000..7b920445 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresConsultas.java @@ -0,0 +1,90 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Prestadores; +import siprp.database.cayenne.objects.Trabalhadores; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatas; +import siprp.database.cayenne.objects.TrabalhadoresProcesso; + +/** + * Class _TrabalhadoresConsultas was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _TrabalhadoresConsultas extends BaseObject { + + public static final String DATA_PROPERTY = "data"; + public static final String ESTADO_PROPERTY = "estado"; + public static final String ID_PROPERTY = "id"; + public static final String TO_PRESTADORES_PROPERTY = "toPrestadores"; + public static final String TO_TRABALHADORES_PROPERTY = "toTrabalhadores"; + public static final String TO_TRABALHADORES_PROCESSO_PROPERTY = "toTrabalhadoresProcesso"; + public static final String TRABALHADORES_CONSULTAS_DATAS_ARRAY_PROPERTY = "trabalhadoresConsultasDatasArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setData(Date data) { + writeProperty("data", data); + } + public Date getData() { + return (Date)readProperty("data"); + } + + public void setEstado(Integer estado) { + writeProperty("estado", estado); + } + public Integer getEstado() { + return (Integer)readProperty("estado"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setToPrestadores(Prestadores toPrestadores) { + setToOneTarget("toPrestadores", toPrestadores, true); + } + + public Prestadores getToPrestadores() { + return (Prestadores)readProperty("toPrestadores"); + } + + + public void setToTrabalhadores(Trabalhadores toTrabalhadores) { + setToOneTarget("toTrabalhadores", toTrabalhadores, true); + } + + public Trabalhadores getToTrabalhadores() { + return (Trabalhadores)readProperty("toTrabalhadores"); + } + + + public void setToTrabalhadoresProcesso(TrabalhadoresProcesso toTrabalhadoresProcesso) { + setToOneTarget("toTrabalhadoresProcesso", toTrabalhadoresProcesso, true); + } + + public TrabalhadoresProcesso getToTrabalhadoresProcesso() { + return (TrabalhadoresProcesso)readProperty("toTrabalhadoresProcesso"); + } + + + public void addToTrabalhadoresConsultasDatasArray(TrabalhadoresConsultasDatas obj) { + addToManyTarget("trabalhadoresConsultasDatasArray", obj, true); + } + public void removeFromTrabalhadoresConsultasDatasArray(TrabalhadoresConsultasDatas obj) { + removeToManyTarget("trabalhadoresConsultasDatasArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresConsultasDatasArray() { + return (List)readProperty("trabalhadoresConsultasDatasArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresConsultasDatas.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresConsultasDatas.java new file mode 100644 index 00000000..8426ef6e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresConsultasDatas.java @@ -0,0 +1,93 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Prestadores; +import siprp.database.cayenne.objects.TrabalhadoresConsultas; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatasEmails; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatasObservacoes; + +/** + * Class _TrabalhadoresConsultasDatas was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _TrabalhadoresConsultasDatas extends BaseObject { + + public static final String DATA_PROPERTY = "data"; + public static final String ESTADO_PROPERTY = "estado"; + public static final String ID_PROPERTY = "id"; + public static final String TO_PRESTADORES_PROPERTY = "toPrestadores"; + public static final String TO_TRABALHADORES_CONSULTAS_PROPERTY = "toTrabalhadoresConsultas"; + public static final String TRABALHADORES_CONSULTAS_DATAS_EMAILS_ARRAY_PROPERTY = "trabalhadoresConsultasDatasEmailsArray"; + public static final String TRABALHADORES_CONSULTAS_DATAS_OBSERVACOES_ARRAY_PROPERTY = "trabalhadoresConsultasDatasObservacoesArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setData(Date data) { + writeProperty("data", data); + } + public Date getData() { + return (Date)readProperty("data"); + } + + public void setEstado(Integer estado) { + writeProperty("estado", estado); + } + public Integer getEstado() { + return (Integer)readProperty("estado"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setToPrestadores(Prestadores toPrestadores) { + setToOneTarget("toPrestadores", toPrestadores, true); + } + + public Prestadores getToPrestadores() { + return (Prestadores)readProperty("toPrestadores"); + } + + + public void setToTrabalhadoresConsultas(TrabalhadoresConsultas toTrabalhadoresConsultas) { + setToOneTarget("toTrabalhadoresConsultas", toTrabalhadoresConsultas, true); + } + + public TrabalhadoresConsultas getToTrabalhadoresConsultas() { + return (TrabalhadoresConsultas)readProperty("toTrabalhadoresConsultas"); + } + + + public void addToTrabalhadoresConsultasDatasEmailsArray(TrabalhadoresConsultasDatasEmails obj) { + addToManyTarget("trabalhadoresConsultasDatasEmailsArray", obj, true); + } + public void removeFromTrabalhadoresConsultasDatasEmailsArray(TrabalhadoresConsultasDatasEmails obj) { + removeToManyTarget("trabalhadoresConsultasDatasEmailsArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresConsultasDatasEmailsArray() { + return (List)readProperty("trabalhadoresConsultasDatasEmailsArray"); + } + + + public void addToTrabalhadoresConsultasDatasObservacoesArray(TrabalhadoresConsultasDatasObservacoes obj) { + addToManyTarget("trabalhadoresConsultasDatasObservacoesArray", obj, true); + } + public void removeFromTrabalhadoresConsultasDatasObservacoesArray(TrabalhadoresConsultasDatasObservacoes obj) { + removeToManyTarget("trabalhadoresConsultasDatasObservacoesArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresConsultasDatasObservacoesArray() { + return (List)readProperty("trabalhadoresConsultasDatasObservacoesArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresConsultasDatasEmails.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresConsultasDatasEmails.java new file mode 100644 index 00000000..1e88c58c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresConsultasDatasEmails.java @@ -0,0 +1,69 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatas; + +/** + * Class _TrabalhadoresConsultasDatasEmails was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _TrabalhadoresConsultasDatasEmails extends BaseObject { + + public static final String BODY_PROPERTY = "body"; + public static final String DATA_PROPERTY = "data"; + public static final String DESTINATION_PROPERTY = "destination"; + public static final String ID_PROPERTY = "id"; + public static final String SUBJECT_PROPERTY = "subject"; + public static final String TO_TRABALHADORES_CONSULTAS_DATAS_PROPERTY = "toTrabalhadoresConsultasDatas"; + + public static final String ID_PK_COLUMN = "id"; + + public void setBody(String body) { + writeProperty("body", body); + } + public String getBody() { + return (String)readProperty("body"); + } + + public void setData(Date data) { + writeProperty("data", data); + } + public Date getData() { + return (Date)readProperty("data"); + } + + public void setDestination(String destination) { + writeProperty("destination", destination); + } + public String getDestination() { + return (String)readProperty("destination"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setSubject(String subject) { + writeProperty("subject", subject); + } + public String getSubject() { + return (String)readProperty("subject"); + } + + public void setToTrabalhadoresConsultasDatas(TrabalhadoresConsultasDatas toTrabalhadoresConsultasDatas) { + setToOneTarget("toTrabalhadoresConsultasDatas", toTrabalhadoresConsultasDatas, true); + } + + public TrabalhadoresConsultasDatas getToTrabalhadoresConsultasDatas() { + return (TrabalhadoresConsultasDatas)readProperty("toTrabalhadoresConsultasDatas"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresConsultasDatasObservacoes.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresConsultasDatasObservacoes.java new file mode 100644 index 00000000..7b3dc20e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresConsultasDatasObservacoes.java @@ -0,0 +1,43 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatas; + +/** + * Class _TrabalhadoresConsultasDatasObservacoes was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _TrabalhadoresConsultasDatasObservacoes extends BaseObject { + + public static final String ID_PROPERTY = "id"; + public static final String OBSERVACAO_PROPERTY = "observacao"; + public static final String TO_TRABALHADORES_CONSULTAS_DATAS_PROPERTY = "toTrabalhadoresConsultasDatas"; + + public static final String ID_PK_COLUMN = "id"; + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setObservacao(String observacao) { + writeProperty("observacao", observacao); + } + public String getObservacao() { + return (String)readProperty("observacao"); + } + + public void setToTrabalhadoresConsultasDatas(TrabalhadoresConsultasDatas toTrabalhadoresConsultasDatas) { + setToOneTarget("toTrabalhadoresConsultasDatas", toTrabalhadoresConsultasDatas, true); + } + + public TrabalhadoresConsultasDatas getToTrabalhadoresConsultasDatas() { + return (TrabalhadoresConsultasDatas)readProperty("toTrabalhadoresConsultasDatas"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcd.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcd.java new file mode 100644 index 00000000..f82cce3e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcd.java @@ -0,0 +1,94 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.EcdOficial; +import siprp.database.cayenne.objects.Prestadores; +import siprp.database.cayenne.objects.PrtTiposElementosProtocolo; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatas; + +/** + * Class _TrabalhadoresEcd was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _TrabalhadoresEcd extends BaseObject { + + public static final String DATA_ENVIO_PROPERTY = "dataEnvio"; + public static final String DATA_RECEPCAO_PROPERTY = "dataRecepcao"; + public static final String ENVIADO_PROPERTY = "enviado"; + public static final String ESTADO_PROPERTY = "estado"; + public static final String TO_ANALISADOR_PROPERTY = "toAnalisador"; + public static final String TO_ECD_OFICIAL_PROPERTY = "toEcdOficial"; + public static final String TO_PRT_TIPOS_ELEMENTOS_PROTOCOLO_PROPERTY = "toPrtTiposElementosProtocolo"; + public static final String TO_TRABALHADORES_ECDS_DATAS_PROPERTY = "toTrabalhadoresEcdsDatas"; + + public static final String ID_PK_COLUMN = "id"; + + public void setDataEnvio(Date dataEnvio) { + writeProperty("dataEnvio", dataEnvio); + } + public Date getDataEnvio() { + return (Date)readProperty("dataEnvio"); + } + + public void setDataRecepcao(Date dataRecepcao) { + writeProperty("dataRecepcao", dataRecepcao); + } + public Date getDataRecepcao() { + return (Date)readProperty("dataRecepcao"); + } + + public void setEnviado(Character enviado) { + writeProperty("enviado", enviado); + } + public Character getEnviado() { + return (Character)readProperty("enviado"); + } + + public void setEstado(Integer estado) { + writeProperty("estado", estado); + } + public Integer getEstado() { + return (Integer)readProperty("estado"); + } + + public void setToAnalisador(Prestadores toAnalisador) { + setToOneTarget("toAnalisador", toAnalisador, true); + } + + public Prestadores getToAnalisador() { + return (Prestadores)readProperty("toAnalisador"); + } + + + public void setToEcdOficial(EcdOficial toEcdOficial) { + setToOneTarget("toEcdOficial", toEcdOficial, true); + } + + public EcdOficial getToEcdOficial() { + return (EcdOficial)readProperty("toEcdOficial"); + } + + + public void setToPrtTiposElementosProtocolo(PrtTiposElementosProtocolo toPrtTiposElementosProtocolo) { + setToOneTarget("toPrtTiposElementosProtocolo", toPrtTiposElementosProtocolo, true); + } + + public PrtTiposElementosProtocolo getToPrtTiposElementosProtocolo() { + return (PrtTiposElementosProtocolo)readProperty("toPrtTiposElementosProtocolo"); + } + + + public void setToTrabalhadoresEcdsDatas(TrabalhadoresEcdsDatas toTrabalhadoresEcdsDatas) { + setToOneTarget("toTrabalhadoresEcdsDatas", toTrabalhadoresEcdsDatas, true); + } + + public TrabalhadoresEcdsDatas getToTrabalhadoresEcdsDatas() { + return (TrabalhadoresEcdsDatas)readProperty("toTrabalhadoresEcdsDatas"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcds.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcds.java new file mode 100644 index 00000000..6fdb2919 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcds.java @@ -0,0 +1,79 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Trabalhadores; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatas; +import siprp.database.cayenne.objects.TrabalhadoresProcesso; + +/** + * Class _TrabalhadoresEcds was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _TrabalhadoresEcds extends BaseObject { + + public static final String DATA_PROPERTY = "data"; + public static final String ESTADO_PROPERTY = "estado"; + public static final String ID_PROPERTY = "id"; + public static final String TO_TRABALHADORES_PROPERTY = "toTrabalhadores"; + public static final String TO_TRABALHADORES_PROCESSO_PROPERTY = "toTrabalhadoresProcesso"; + public static final String TRABALHADORES_ECDS_DATAS_ARRAY_PROPERTY = "trabalhadoresEcdsDatasArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setData(Date data) { + writeProperty("data", data); + } + public Date getData() { + return (Date)readProperty("data"); + } + + public void setEstado(Integer estado) { + writeProperty("estado", estado); + } + public Integer getEstado() { + return (Integer)readProperty("estado"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setToTrabalhadores(Trabalhadores toTrabalhadores) { + setToOneTarget("toTrabalhadores", toTrabalhadores, true); + } + + public Trabalhadores getToTrabalhadores() { + return (Trabalhadores)readProperty("toTrabalhadores"); + } + + + public void setToTrabalhadoresProcesso(TrabalhadoresProcesso toTrabalhadoresProcesso) { + setToOneTarget("toTrabalhadoresProcesso", toTrabalhadoresProcesso, true); + } + + public TrabalhadoresProcesso getToTrabalhadoresProcesso() { + return (TrabalhadoresProcesso)readProperty("toTrabalhadoresProcesso"); + } + + + public void addToTrabalhadoresEcdsDatasArray(TrabalhadoresEcdsDatas obj) { + addToManyTarget("trabalhadoresEcdsDatasArray", obj, true); + } + public void removeFromTrabalhadoresEcdsDatasArray(TrabalhadoresEcdsDatas obj) { + removeToManyTarget("trabalhadoresEcdsDatasArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresEcdsDatasArray() { + return (List)readProperty("trabalhadoresEcdsDatasArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcdsAnalise.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcdsAnalise.java new file mode 100644 index 00000000..2ce50fce --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcdsAnalise.java @@ -0,0 +1,48 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Prestadores; +import siprp.database.cayenne.objects.PrtGruposProtocolo; + +/** + * Class _TrabalhadoresEcdsAnalise was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _TrabalhadoresEcdsAnalise extends BaseObject { + + public static final String DATA_PROPERTY = "data"; + public static final String TO_PRESTADORES_PROPERTY = "toPrestadores"; + public static final String TO_PRT_GRUPOS_PROTOCOLO_PROPERTY = "toPrtGruposProtocolo"; + + public static final String ID_PK_COLUMN = "id"; + + public void setData(Date data) { + writeProperty("data", data); + } + public Date getData() { + return (Date)readProperty("data"); + } + + public void setToPrestadores(Prestadores toPrestadores) { + setToOneTarget("toPrestadores", toPrestadores, true); + } + + public Prestadores getToPrestadores() { + return (Prestadores)readProperty("toPrestadores"); + } + + + public void setToPrtGruposProtocolo(PrtGruposProtocolo toPrtGruposProtocolo) { + setToOneTarget("toPrtGruposProtocolo", toPrtGruposProtocolo, true); + } + + public PrtGruposProtocolo getToPrtGruposProtocolo() { + return (PrtGruposProtocolo)readProperty("toPrtGruposProtocolo"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcdsDatas.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcdsDatas.java new file mode 100644 index 00000000..5a43ed98 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcdsDatas.java @@ -0,0 +1,133 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Prestadores; +import siprp.database.cayenne.objects.TrabalhadoresEcd; +import siprp.database.cayenne.objects.TrabalhadoresEcds; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatasEmails; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatasObservacoes; + +/** + * Class _TrabalhadoresEcdsDatas was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _TrabalhadoresEcdsDatas extends BaseObject { + + public static final String DATA_PROPERTY = "data"; + public static final String DATA_ENVIO_PROPERTY = "dataEnvio"; + public static final String DATA_RECEPCAO_PROPERTY = "dataRecepcao"; + public static final String ESTADO_PROPERTY = "estado"; + public static final String ID_PROPERTY = "id"; + public static final String TO_ANALISADOR_PROPERTY = "toAnalisador"; + public static final String TO_PRESTADORES_PROPERTY = "toPrestadores"; + public static final String TO_TRABALHADORES_ECDS_PROPERTY = "toTrabalhadoresEcds"; + public static final String TRABALHADORES_ECD_ARRAY_PROPERTY = "trabalhadoresEcdArray"; + public static final String TRABALHADORES_ECDS_DATAS_EMAILS_ARRAY_PROPERTY = "trabalhadoresEcdsDatasEmailsArray"; + public static final String TRABALHADORES_ECDS_DATAS_OBSERVACOES_ARRAY_PROPERTY = "trabalhadoresEcdsDatasObservacoesArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setData(Date data) { + writeProperty("data", data); + } + public Date getData() { + return (Date)readProperty("data"); + } + + public void setDataEnvio(Date dataEnvio) { + writeProperty("dataEnvio", dataEnvio); + } + public Date getDataEnvio() { + return (Date)readProperty("dataEnvio"); + } + + public void setDataRecepcao(Date dataRecepcao) { + writeProperty("dataRecepcao", dataRecepcao); + } + public Date getDataRecepcao() { + return (Date)readProperty("dataRecepcao"); + } + + public void setEstado(Integer estado) { + writeProperty("estado", estado); + } + public Integer getEstado() { + return (Integer)readProperty("estado"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setToAnalisador(Prestadores toAnalisador) { + setToOneTarget("toAnalisador", toAnalisador, true); + } + + public Prestadores getToAnalisador() { + return (Prestadores)readProperty("toAnalisador"); + } + + + public void setToPrestadores(Prestadores toPrestadores) { + setToOneTarget("toPrestadores", toPrestadores, true); + } + + public Prestadores getToPrestadores() { + return (Prestadores)readProperty("toPrestadores"); + } + + + public void setToTrabalhadoresEcds(TrabalhadoresEcds toTrabalhadoresEcds) { + setToOneTarget("toTrabalhadoresEcds", toTrabalhadoresEcds, true); + } + + public TrabalhadoresEcds getToTrabalhadoresEcds() { + return (TrabalhadoresEcds)readProperty("toTrabalhadoresEcds"); + } + + + public void addToTrabalhadoresEcdArray(TrabalhadoresEcd obj) { + addToManyTarget("trabalhadoresEcdArray", obj, true); + } + public void removeFromTrabalhadoresEcdArray(TrabalhadoresEcd obj) { + removeToManyTarget("trabalhadoresEcdArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresEcdArray() { + return (List)readProperty("trabalhadoresEcdArray"); + } + + + public void addToTrabalhadoresEcdsDatasEmailsArray(TrabalhadoresEcdsDatasEmails obj) { + addToManyTarget("trabalhadoresEcdsDatasEmailsArray", obj, true); + } + public void removeFromTrabalhadoresEcdsDatasEmailsArray(TrabalhadoresEcdsDatasEmails obj) { + removeToManyTarget("trabalhadoresEcdsDatasEmailsArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresEcdsDatasEmailsArray() { + return (List)readProperty("trabalhadoresEcdsDatasEmailsArray"); + } + + + public void addToTrabalhadoresEcdsDatasObservacoesArray(TrabalhadoresEcdsDatasObservacoes obj) { + addToManyTarget("trabalhadoresEcdsDatasObservacoesArray", obj, true); + } + public void removeFromTrabalhadoresEcdsDatasObservacoesArray(TrabalhadoresEcdsDatasObservacoes obj) { + removeToManyTarget("trabalhadoresEcdsDatasObservacoesArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresEcdsDatasObservacoesArray() { + return (List)readProperty("trabalhadoresEcdsDatasObservacoesArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcdsDatasEmails.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcdsDatasEmails.java new file mode 100644 index 00000000..20be3583 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcdsDatasEmails.java @@ -0,0 +1,69 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatas; + +/** + * Class _TrabalhadoresEcdsDatasEmails was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _TrabalhadoresEcdsDatasEmails extends BaseObject { + + public static final String BODY_PROPERTY = "body"; + public static final String DATA_PROPERTY = "data"; + public static final String DESTINATION_PROPERTY = "destination"; + public static final String ID_PROPERTY = "id"; + public static final String SUBJECT_PROPERTY = "subject"; + public static final String TO_TRABALHADORES_ECDS_DATAS_PROPERTY = "toTrabalhadoresEcdsDatas"; + + public static final String ID_PK_COLUMN = "id"; + + public void setBody(String body) { + writeProperty("body", body); + } + public String getBody() { + return (String)readProperty("body"); + } + + public void setData(Date data) { + writeProperty("data", data); + } + public Date getData() { + return (Date)readProperty("data"); + } + + public void setDestination(String destination) { + writeProperty("destination", destination); + } + public String getDestination() { + return (String)readProperty("destination"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setSubject(String subject) { + writeProperty("subject", subject); + } + public String getSubject() { + return (String)readProperty("subject"); + } + + public void setToTrabalhadoresEcdsDatas(TrabalhadoresEcdsDatas toTrabalhadoresEcdsDatas) { + setToOneTarget("toTrabalhadoresEcdsDatas", toTrabalhadoresEcdsDatas, true); + } + + public TrabalhadoresEcdsDatas getToTrabalhadoresEcdsDatas() { + return (TrabalhadoresEcdsDatas)readProperty("toTrabalhadoresEcdsDatas"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcdsDatasObservacoes.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcdsDatasObservacoes.java new file mode 100644 index 00000000..e8d42291 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcdsDatasObservacoes.java @@ -0,0 +1,43 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatas; + +/** + * Class _TrabalhadoresEcdsDatasObservacoes was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _TrabalhadoresEcdsDatasObservacoes extends BaseObject { + + public static final String ID_PROPERTY = "id"; + public static final String OBSERVACAO_PROPERTY = "observacao"; + public static final String TO_TRABALHADORES_ECDS_DATAS_PROPERTY = "toTrabalhadoresEcdsDatas"; + + public static final String ID_PK_COLUMN = "id"; + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setObservacao(String observacao) { + writeProperty("observacao", observacao); + } + public String getObservacao() { + return (String)readProperty("observacao"); + } + + public void setToTrabalhadoresEcdsDatas(TrabalhadoresEcdsDatas toTrabalhadoresEcdsDatas) { + setToOneTarget("toTrabalhadoresEcdsDatas", toTrabalhadoresEcdsDatas, true); + } + + public TrabalhadoresEcdsDatas getToTrabalhadoresEcdsDatas() { + return (TrabalhadoresEcdsDatas)readProperty("toTrabalhadoresEcdsDatas"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresFichasAptidao.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresFichasAptidao.java new file mode 100644 index 00000000..e5b4f60c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresFichasAptidao.java @@ -0,0 +1,46 @@ +package siprp.database.cayenne.objects.auto; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Exames; +import siprp.database.cayenne.objects.TrabalhadoresProcesso; + +/** + * Class _TrabalhadoresFichasAptidao was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _TrabalhadoresFichasAptidao extends BaseObject { + + public static final String ID_PROPERTY = "id"; + public static final String TO_EXAMES_PROPERTY = "toExames"; + public static final String TO_TRABALHADORES_PROCESSO_PROPERTY = "toTrabalhadoresProcesso"; + + public static final String ID_PK_COLUMN = "id"; + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setToExames(Exames toExames) { + setToOneTarget("toExames", toExames, true); + } + + public Exames getToExames() { + return (Exames)readProperty("toExames"); + } + + + public void setToTrabalhadoresProcesso(TrabalhadoresProcesso toTrabalhadoresProcesso) { + setToOneTarget("toTrabalhadoresProcesso", toTrabalhadoresProcesso, true); + } + + public TrabalhadoresProcesso getToTrabalhadoresProcesso() { + return (TrabalhadoresProcesso)readProperty("toTrabalhadoresProcesso"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresProcesso.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresProcesso.java new file mode 100644 index 00000000..5a8ecd16 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresProcesso.java @@ -0,0 +1,128 @@ +package siprp.database.cayenne.objects.auto; + +import java.util.Date; +import java.util.List; + +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Trabalhadores; +import siprp.database.cayenne.objects.TrabalhadoresConsultas; +import siprp.database.cayenne.objects.TrabalhadoresEcds; +import siprp.database.cayenne.objects.TrabalhadoresFichasAptidao; + +/** + * Class _TrabalhadoresProcesso was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _TrabalhadoresProcesso extends BaseObject { + + public static final String ACTIVO_PROPERTY = "activo"; + public static final String DATA_FIM_PROPERTY = "dataFim"; + public static final String DATA_INICIO_PROPERTY = "dataInicio"; + public static final String ESTADO_PROPERTY = "estado"; + public static final String ID_PROPERTY = "id"; + public static final String MOTIVO_PROPERTY = "motivo"; + public static final String SUB_MOTIVO_PROPERTY = "subMotivo"; + public static final String TO_TRABALHADORES_PROPERTY = "toTrabalhadores"; + public static final String TRABALHADORES_CONSULTAS_ARRAY_PROPERTY = "trabalhadoresConsultasArray"; + public static final String TRABALHADORES_ECDS_ARRAY_PROPERTY = "trabalhadoresEcdsArray"; + public static final String TRABALHADORES_FICHAS_APTIDAO_ARRAY_PROPERTY = "trabalhadoresFichasAptidaoArray"; + + public static final String ID_PK_COLUMN = "id"; + + public void setActivo(String activo) { + writeProperty("activo", activo); + } + public String getActivo() { + return (String)readProperty("activo"); + } + + public void setDataFim(Date dataFim) { + writeProperty("dataFim", dataFim); + } + public Date getDataFim() { + return (Date)readProperty("dataFim"); + } + + public void setDataInicio(Date dataInicio) { + writeProperty("dataInicio", dataInicio); + } + public Date getDataInicio() { + return (Date)readProperty("dataInicio"); + } + + public void setEstado(String estado) { + writeProperty("estado", estado); + } + public String getEstado() { + return (String)readProperty("estado"); + } + + public void setId(Integer id) { + writeProperty("id", id); + } + public Integer getId() { + return (Integer)readProperty("id"); + } + + public void setMotivo(Integer motivo) { + writeProperty("motivo", motivo); + } + public Integer getMotivo() { + return (Integer)readProperty("motivo"); + } + + public void setSubMotivo(Integer subMotivo) { + writeProperty("subMotivo", subMotivo); + } + public Integer getSubMotivo() { + return (Integer)readProperty("subMotivo"); + } + + public void setToTrabalhadores(Trabalhadores toTrabalhadores) { + setToOneTarget("toTrabalhadores", toTrabalhadores, true); + } + + public Trabalhadores getToTrabalhadores() { + return (Trabalhadores)readProperty("toTrabalhadores"); + } + + + public void addToTrabalhadoresConsultasArray(TrabalhadoresConsultas obj) { + addToManyTarget("trabalhadoresConsultasArray", obj, true); + } + public void removeFromTrabalhadoresConsultasArray(TrabalhadoresConsultas obj) { + removeToManyTarget("trabalhadoresConsultasArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresConsultasArray() { + return (List)readProperty("trabalhadoresConsultasArray"); + } + + + public void addToTrabalhadoresEcdsArray(TrabalhadoresEcds obj) { + addToManyTarget("trabalhadoresEcdsArray", obj, true); + } + public void removeFromTrabalhadoresEcdsArray(TrabalhadoresEcds obj) { + removeToManyTarget("trabalhadoresEcdsArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresEcdsArray() { + return (List)readProperty("trabalhadoresEcdsArray"); + } + + + public void addToTrabalhadoresFichasAptidaoArray(TrabalhadoresFichasAptidao obj) { + addToManyTarget("trabalhadoresFichasAptidaoArray", obj, true); + } + public void removeFromTrabalhadoresFichasAptidaoArray(TrabalhadoresFichasAptidao obj) { + removeToManyTarget("trabalhadoresFichasAptidaoArray", obj, true); + } + @SuppressWarnings("unchecked") + public List getTrabalhadoresFichasAptidaoArray() { + return (List)readProperty("trabalhadoresFichasAptidaoArray"); + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/providers/MainDAO.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/providers/MainDAO.java new file mode 100755 index 00000000..2cddb6be --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/providers/MainDAO.java @@ -0,0 +1,47 @@ +package siprp.database.cayenne.providers; + +import org.apache.cayenne.access.DataContext; + +import siprp.database.cayenne.objects.BaseObject; + +public class MainDAO +{ + protected static DataContext context = null; + + public MainDAO() + { + if( context == null ) + { + context = DataContext.createDataContext(); + } + } + + public void commit() + { + context.commitChanges(); + } + + public void rollback() + { + context.rollbackChanges(); + context.unregisterObjects( context.uncommittedObjects() ); + } + + public DataContext getContext() + { + return context; + } + + public boolean hasOrder( BaseObject baseObject ) + { + if( baseObject == null || baseObject.getObjEntity() == null ) + { + return false; + } + else + { + return baseObject == null ? false : ( null != baseObject.getObjEntity().getAttribute( "ordem" ) || null != baseObject.getObjEntity().getAttribute( "order" )); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/providers/MedicinaDAO.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/providers/MedicinaDAO.java new file mode 100644 index 00000000..ada654a7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/providers/MedicinaDAO.java @@ -0,0 +1,116 @@ +package siprp.database.cayenne.providers; + +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.cayenne.DataObjectUtils; +import org.apache.cayenne.exp.ExpressionFactory; +import org.apache.cayenne.query.SelectQuery; + +import siprp.MedicinaConstants; +import siprp.ProcessoConstants; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.Exames; +import siprp.database.cayenne.objects.LembretesTipos; +import siprp.database.cayenne.objects.Prestadores; +import siprp.database.cayenne.objects.PrtGruposProtocolo; +import siprp.database.cayenne.objects.Trabalhadores; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatas; +import siprp.database.cayenne.objects.TrabalhadoresEcd; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatas; +import siprp.database.cayenne.objects.TrabalhadoresProcesso; + +public class MedicinaDAO extends MainDAO implements MedicinaConstants +{ + + private Prestadores defaultPrestador = Prestadores.prestadorNulo; + + public Trabalhadores getTrabalhadorByID( Integer id ) + { + return (Trabalhadores) DataObjectUtils.objectForPK( context, Trabalhadores.class, id ); + } + + public TrabalhadoresConsultasDatas getConsultaMarcacaoByID( Integer id ) + { + return (TrabalhadoresConsultasDatas) DataObjectUtils.objectForPK( context, TrabalhadoresConsultasDatas.class, id ); + } + + public TrabalhadoresEcdsDatas getExameMarcacaoByID( Integer id ) + { + return (TrabalhadoresEcdsDatas) DataObjectUtils.objectForPK( context, TrabalhadoresEcdsDatas.class, id ); + } + + + public Exames getExameForExameID( Integer currentFichaExameID ) + { + return (Exames) DataObjectUtils.objectForPK( context, Exames.class, currentFichaExameID ); + } + + public LembretesTipos getTipoLembretesCustomizavel( ) + { + return (LembretesTipos) DataObjectUtils.objectForPK( context, LembretesTipos.class, 1 ); + } + + public List getAllEmpresas() + { + SelectQuery query = new SelectQuery( Empresas.class ); + query.andQualifier( ExpressionFactory.noMatchExp( Empresas.INACTIVO_PROPERTY, "y" ) ); + query.addOrdering( Empresas.DESIGNACAO_SOCIAL_PLAIN_PROPERTY, true ); + List allEmpresas = context.performQuery( query ); + return allEmpresas; + } + + public List getAllPrestadores() + { + SelectQuery query = new SelectQuery( Prestadores.class ); + query.andQualifier( ExpressionFactory.matchExp( Prestadores.ACTIVO_PROPERTY, "y" ) ); + query.addOrdering( Prestadores.NOME_PROPERTY, true ); + List allPrestadores = context.performQuery( query ); + return allPrestadores; + } + + public List getAllPrtGruposProtocolo() + { + SelectQuery query = new SelectQuery( PrtGruposProtocolo.class ); + query.addOrdering( PrtGruposProtocolo.DESCRICAO_PLAIN_PROPERTY, true ); + List allPrtGruposProtocolo= context.performQuery( query ); + return allPrtGruposProtocolo; + } + + public void fecharProcesso( TrabalhadoresProcesso currentProcesso ) + { + currentProcesso.setEstado( ProcessoConstants.PROCESSO_FECHADO_CODE ); + context.commitChanges(); + } + + public Prestadores getDefaultPrestador() + { + return defaultPrestador; + } + + public Collection getPendingExamesForAnalisador( Prestadores currentAnalisador ) + { + Map resultMap = new HashMap(); + SelectQuery query = new SelectQuery( TrabalhadoresEcd.class, ExpressionFactory.matchExp(TrabalhadoresEcd.DATA_RECEPCAO_PROPERTY, null )); + List all = context.performQuery( query ); + for( TrabalhadoresEcd ecd : all ) + { + TrabalhadoresEcdsDatas data = ecd.getToTrabalhadoresEcdsDatas(); + if(new Integer(MedicinaConstants.ESTADO_REALIZADO).equals( data.getEstado())) + { + + if(currentAnalisador.equals( ecd.getToAnalisador() )) + { + resultMap.put( ecd ,ecd ); + }else if( Prestadores.prestadorNulo.equals( currentAnalisador ) && ecd.getToAnalisador() == null ) + { + resultMap.put( ecd, ecd ); + } + } + } + return resultMap.values(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/providers/PlanoActuacaoDAO.java b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/providers/PlanoActuacaoDAO.java new file mode 100644 index 00000000..94f5d7d7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/database/cayenne/providers/PlanoActuacaoDAO.java @@ -0,0 +1,195 @@ +package siprp.database.cayenne.providers; + +import java.util.Date; +import java.util.LinkedList; +import java.util.List; + +import org.apache.cayenne.DataObjectUtils; +import org.apache.cayenne.exp.ExpressionFactory; +import org.apache.cayenne.query.SelectQuery; + +import siprp.database.cayenne.objects.EmailPlanoDeActuacao; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsEmailEstabelecimento; +import siprp.database.cayenne.objects.HsEquipamento; +import siprp.database.cayenne.objects.HsLegislacao; +import siprp.database.cayenne.objects.HsLegislacaoCategoria; +import siprp.database.cayenne.objects.HsNormalizacao; +import siprp.database.cayenne.objects.HsPosto; +import siprp.database.cayenne.objects.HsPostoRisco; +import siprp.database.cayenne.objects.HsRelatorio; +import siprp.database.cayenne.objects.HsRelatorioRisco; +import siprp.database.cayenne.objects.HsRelatorioRiscoValorQualitativo; +import siprp.database.cayenne.objects.HsRisco; +import siprp.database.cayenne.objects.HsRiscoTema; +import siprp.database.cayenne.objects.MarcacoesEstabelecimento; + +public class PlanoActuacaoDAO extends MainDAO +{ + + private static final Integer ID_COMPANHIA_HIPERMERCADOS = 32; + + public Estabelecimentos getEstabelecimentoByID( Integer id ) + { + return (Estabelecimentos) DataObjectUtils.objectForPK( context, Estabelecimentos.class, id ); + } + + public void addEmailToEstabelecimento( String email, Estabelecimentos estabelecimento ) + { + EmailPlanoDeActuacao emailObject = (EmailPlanoDeActuacao) context.newObject( EmailPlanoDeActuacao.class ); + emailObject.setDescription( email ); + emailObject.setToEstabelecimentos( estabelecimento ); + context.commitChanges(); + } + + public List getAllRiscoTemas() + { + SelectQuery query = new SelectQuery( HsRiscoTema.class ); + query.andQualifier( ExpressionFactory.matchExp( HsRiscoTema.DELETED_DATE_PROPERTY, null ) ); + query.addOrdering( HsRiscoTema.DESCRIPTION_PROPERTY, true ); + return context.performQuery( query ); + } + + public HsRelatorio criarRelatorioForVisita( MarcacoesEstabelecimento visita ) + { + HsRelatorio result = null; + if( visita != null ) + { + result = (HsRelatorio) context.newObject( HsRelatorio.class ); + result.setToHsMarcacoesEstabelecimento( visita ); + result.setData( new Date() ); + context.commitChanges(); + } + return result; + } + + public HsPostoRisco createValoresFor( HsRisco risco, HsPosto posto ) + { + HsPostoRisco result = null; + if( risco != null && posto != null ) + { + result = (HsPostoRisco) context.newObject( HsPostoRisco.class ); + result.setToHsPosto( posto ); + result.setToHsRisco( risco ); + result.setIsPlanoActuacao( "n" ); + context.commitChanges(); + } + return result; + } + + public List getAllValoresQualitativos() + { + SelectQuery query = new SelectQuery( HsRelatorioRiscoValorQualitativo.class ); + return context.performQuery( query ); + } + + /** + * Get + * @param dates + * @param estabelecimentoID + * @return + */ + public List getRelatoriosNotIn( List dates, Integer estabelecimentoID ) + { + List result = new LinkedList(); + dates = dates != null ? dates : new LinkedList(); + SelectQuery query = new SelectQuery( HsRelatorio.class ); + query.andQualifier( ExpressionFactory.noMatchExp( HsRelatorio.IS_SUBMETIDO_PROPERTY, null ) ); + query.andQualifier( ExpressionFactory.matchExp( HsRelatorio.DELETED_DATE_PROPERTY, null ) ); + List all = context.performQuery( query ); + for( HsRelatorio relatorio : all ) + { + MarcacoesEstabelecimento visita = relatorio.getToHsMarcacoesEstabelecimento(); + if( visita != null ) + { + if( visita.getToEstabelecimentos() != null && visita.getToEstabelecimentos().getToEmpresas().getId().equals( ID_COMPANHIA_HIPERMERCADOS ) ) + { + if( estabelecimentoID == null || estabelecimentoID != null && estabelecimentoID.equals( visita.getEstabelecimentoID() ) ) + { + Date dateVisita = visita.getData(); + if( dateVisita != null && !dates.contains( dateVisita ) ) + { + result.add( relatorio ); + } + } + } + } + } + return result; + } + + public List getRelatoriosNotIn( List knownEstabelecimentosIDs ) + { + List result = new LinkedList(); + knownEstabelecimentosIDs = knownEstabelecimentosIDs != null ? knownEstabelecimentosIDs : new LinkedList(); + SelectQuery query = new SelectQuery( HsRelatorio.class ); + query.andQualifier( ExpressionFactory.noMatchExp( HsRelatorio.IS_SUBMETIDO_PROPERTY, null ) ); + query.andQualifier( ExpressionFactory.matchExp( HsRelatorio.DELETED_DATE_PROPERTY, null ) ); + List all = context.performQuery( query ); + for( HsRelatorio relatorio : all ) + { + MarcacoesEstabelecimento visita = relatorio.getToHsMarcacoesEstabelecimento(); + if( visita != null ) + { + if( visita.getToEstabelecimentos() != null && visita.getToEstabelecimentos().getToEmpresas().getId().equals( ID_COMPANHIA_HIPERMERCADOS ) ) + { + Integer estabelecimentoID = visita.getToEstabelecimentos().getId(); + if( !knownEstabelecimentosIDs.contains(estabelecimentoID) ) + { + result.add( relatorio ); + } + } + } + } + return result; + } + + public List getAllLegislacaoGeral() + { + SelectQuery query = new SelectQuery( HsLegislacao.class ); + query.andQualifier( ExpressionFactory.matchExp( HsLegislacao.DELETED_DATE_PROPERTY, null ) ); + query.andQualifier( ExpressionFactory.matchExp( HsLegislacao.TO_HS_LEGISLACAO_CATEGORIA_PROPERTY, null ) ); + query.addOrdering( HsLegislacao.DESCRIPTION_PROPERTY, true ); + return context.performQuery( query ); + } + + public List getAllLegislacaoCategorias() + { + SelectQuery query = new SelectQuery( HsLegislacaoCategoria.class ); + query.andQualifier( ExpressionFactory.matchExp( HsLegislacaoCategoria.DELETED_DATE_PROPERTY, null ) ); + query.addOrdering( HsLegislacao.DESCRIPTION_PROPERTY, true ); + return context.performQuery( query ); + } + + public List getNormalizacao( boolean portuguesa ) + { + SelectQuery query = new SelectQuery( HsNormalizacao.class ); + query.andQualifier( ExpressionFactory.matchExp( HsNormalizacao.DELETED_DATE_PROPERTY, null ) ); + query.andQualifier( ExpressionFactory.matchExp( HsNormalizacao.PORTUGUESA_PROPERTY, portuguesa ) ); + query.addOrdering( HsNormalizacao.CODIGO_PROPERTY, true ); + return context.performQuery( query ); + } + + public List getAllEquipamentos() + { + SelectQuery query = new SelectQuery( HsEquipamento.class ); + query.andQualifier( ExpressionFactory.matchExp( HsEquipamento.DELETED_DATE_PROPERTY, null ) ); + query.addOrdering( HsEquipamento.TIPO_PROPERTY, true ); + return context.performQuery( query ); + } + + public List getEmailsForEstabelecimento( Estabelecimentos estabelecimento ) + { + SelectQuery query = new SelectQuery( HsEmailEstabelecimento.class ); + query.andQualifier( ExpressionFactory.matchExp( HsEmailEstabelecimento.TO_ESTABELECIMENTO_PROPERTY, estabelecimento ) ); + return context.performQuery( query ); + } + + public List findHsRiscosFor( HsRelatorioRisco relatorioRisco ) + { + SelectQuery query = new SelectQuery( HsRisco.class ); + query.andQualifier( ExpressionFactory.likeIgnoreCaseExp( HsRisco.DESCRIPTION_PROPERTY, relatorioRisco.getDescription() ) ); + return context.performQuery( query ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/estatistica/EstatisticaDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/estatistica/EstatisticaDataProvider.java new file mode 100644 index 00000000..9dd4b3b8 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/estatistica/EstatisticaDataProvider.java @@ -0,0 +1,777 @@ +/* + * EstatisticaDataProvider.java + * + * Created on 16 de Dezembro de 2004, 12:50 + */ + +package siprp.estatistica; + +import java.text.DateFormat; +import java.util.Date; + +import siprp.data.Marcacao; +import siprp.data.outer.MarcacoesTrabalhadorData; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.metadb.MetaProvider; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +/** + * + * @author fpalma + */ +public class EstatisticaDataProvider extends MetaProvider +{ + private static final Object LOCK = new Object(); + private static EstatisticaDataProvider instance = null; + private final Executer executer; + + public static final DateFormat DF = DateFormat.getDateInstance( DateFormat.SHORT ); + + /** Creates a new instance of EstatisticaDataProvider */ + public EstatisticaDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + executer = dbm.getSharedExecuter( this ); + } + + public static MetaProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new EstatisticaDataProvider(); + } + } + return instance; + } + + public String[][] getMarcacoesPeriodo( Date dataInicio, Date dataFim ) + throws Exception + { + String [][]result = null; + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ MarcacoesTrabalhadorData.DATA, + "trabalhador_id", + MarcacoesTrabalhadorData.REALIZADA, + MarcacoesTrabalhadorData.TIPO }, + new Field( "data" ).isGreaterOrEqual( dataInicio ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ), + new String[]{ "data" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + result = new String[ array.columnLength() ][ 5 ]; + for( int n = 0; n < result.length; n++ ) + { + Date data = ( Date ) array.get( n, 0 ); + int trabalhadorID = ( ( Number ) array.get( n, 1 ) ).intValue(); + boolean realizada = "y".equals( array.get( n, 2 ) ); + int tipo = ( ( Number ) array.get( n, 3 ) ).intValue(); + String nomeEstabEmp[] = getNomeEstabelecimentoEmpresaForTrabalhador( trabalhadorID ); + result[ n ][ 0 ] = nomeEstabEmp[ 2 ]; + result[ n ][ 1 ] = nomeEstabEmp[ 0 ]; + result[ n ][ 2 ] = nomeEstabEmp[ 1 ]; + result[ n ][ 3 ] = DF.format( data ); + result[ n ][ 4 ] = ( tipo == Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ? "(Exame)" : "(Consulta)" ); + + } + return result; + } + + public String[] getNomeEstabelecimentoEmpresaForTrabalhador( int trabalhadorID ) + throws Exception + { + String data[] = new String[ 3 ]; + Select select = + new Select( new String[]{ "trabalhadores", "estabelecimentos", "empresas"}, + new String[]{ "trabalhadores.nome", "estabelecimentos.nome", "empresas.designacao_social" }, + new Field( "trabalhadores.id" ).isEqual( new Integer( trabalhadorID ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 1 ) + { + data[ 0 ] = ( String ) array.get( 0, 0 ); + data[ 1 ] = ( String ) array.get( 0, 1 ); + data[ 2 ] = ( String ) array.get( 0, 2 ); + } + return data; + } + + public int countExamesPeriodo( Date dataInicio, Date dataFim ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "count(*)" }, + new Field( "data" ).isGreaterOrEqual( dataInicio ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return 0; + } + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + + public int countConsultasPeriodo( Date dataInicio, Date dataFim ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "count(*)" }, + new Field( "data" ).isGreaterOrEqual( dataInicio ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return 0; + } + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + + public int countExamesPeriodoForEmpresa( Date dataInicio, Date dataFim, Integer empresaID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" }, + new String[]{ "count(*)" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return 0; + } + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + + public int countConsultasPeriodoForEmpresa( Date dataInicio, Date dataFim, Integer empresaID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" }, + new String[]{ "count(*)" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return 0; + } + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + + public String[][] getMarcacoesPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID ) + throws Exception + { + String [][]result = null; + Select select = + new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" }, + new String[]{ MarcacoesTrabalhadorData.DATA, + "trabalhador_id", + MarcacoesTrabalhadorData.REALIZADA, + MarcacoesTrabalhadorData.TIPO }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ), + new String[]{ "data" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + result = new String[ array.columnLength() ][ 5 ]; + for( int n = 0; n < result.length; n++ ) + { + Date data = ( Date ) array.get( n, 0 ); + int trabalhadorID = ( ( Number ) array.get( n, 1 ) ).intValue(); + boolean realizada = "y".equals( array.get( n, 2 ) ); + int tipo = ( ( Number ) array.get( n, 3 ) ).intValue(); + String nomeEstabEmp[] = getNomeEstabelecimentoEmpresaForTrabalhador( trabalhadorID ); + result[ n ][ 0 ] = nomeEstabEmp[ 2 ]; + result[ n ][ 1 ] = nomeEstabEmp[ 0 ]; + result[ n ][ 2 ] = nomeEstabEmp[ 1 ]; + result[ n ][ 3 ] = DF.format( data ); + result[ n ][ 4 ] = ( tipo == Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ? "(Exame)" : "(Consulta)" ); + + } + return result; + } + + public int countExamesPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" }, + new String[]{ "count(*)" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return 0; + } + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + + public int countConsultasPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" }, + new String[]{ "count(*)" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return 0; + } + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + + public String[][] getTrabalhadoresSemExamesOuConsultas( Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { +// Select subSelect = +// new Select( new String[]{ "marcacoes_trabalhador" }, +// new String[]{ "trabalhador_id" }, +// new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ).and( +// new Field( "realizada" ).isEqual( "y" ) ) ); + Select select = + new Select( new String[]{ "empresas", "estabelecimentos", + "trabalhadores LEFT OUTER JOIN marcacoes_trabalhador ON " + + "( trabalhadores.id = marcacoes_trabalhador.trabalhador_id AND marcacoes_trabalhador.tipo = " + + (exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA) + " AND marcacoes_trabalhador.realizada = 'y' )" }, + new String[]{ "empresas.designacao_social", "estabelecimentos.nome", "trabalhadores.nome", + "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( null ) ).and( + new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ).or( + new Field( "marcacoes_trabalhador.realizada" ).isDifferent( "y" ) ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ), + new String[]{ "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + String data[][] = new String[ array.columnLength() ][ 3 ]; + for( int r = 0; r < array.columnLength(); r++ ) + { + for( int c = 0; c < 3; c++ ) + { + data[ r ][ c ] = (String) array.get( r, c ); + } + } + return data; + } + + + + public int countTrabalhadoresSemExamesOuConsultas( Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "trabalhadores" }, new String[]{ "COUNT(*)" }, + new Field( "inactivo" ).isDifferent( "y" ) ); + int totalCount = 0; + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() > 0 && array.rowLength() > 0 ) + { + Number n = (Number) array.get( 0, 0 ); + if( n != null ) + { + totalCount = n.intValue(); + } + } + +// select = +// new Select( new String[]{ "marcacoes_trabalhador" }, +// new String[]{ "COUNT(*)" }, +// new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ).and( +// new Field( "realizada" ).isEqual( "y" ) ).and( +// new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) ); +// int subCount = 0; +// array = executer.executeQuery( select ); +// if( array.columnLength() > 0 && array.rowLength() > 0 ) +// { +// Number n = (Number) array.get( 0, 0 ); +// if( n != null ) +// { +// subCount = n.intValue(); +// } +// } + + return totalCount - countTrabalhadoresComExamesOuConsultasPeriodo( dataInicio, dataFim, exames ); + } + + public String[][] getTrabalhadoresSemExamesOuConsultasEstabelecimento( Integer estabelecimentoID, Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "trabalhador_id" }, + new Field( "tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ).and( + new Field( "realizada" ).isEqual( "y" ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < ids.length; n++ ) + { + ids[ n ] = ( Integer ) array.get( n, 0 ); + } + if( ids.length == 0 ) + { + ids = new Integer[]{ new Integer( -1 ) }; + } + select = + new Select( new String[]{ "estabelecimentos", + "trabalhadores" }, + new String[]{ "estabelecimentos.nome", "trabalhadores.nome" }, + new Field( "estabelecimentos.id" ).isEqual( estabelecimentoID ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.id" ).notIn( ids ) ), + new String[]{ "trabalhadores.nome" }, null ); +// Select select = +// new Select( new String[]{ "estabelecimentos", +// "trabalhadores LEFT OUTER JOIN marcacoes_trabalhador ON " +// + "( trabalhadores.id = marcacoes_trabalhador.trabalhador_id AND marcacoes_trabalhador.tipo = " +// + (exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA) + " AND marcacoes_trabalhador.realizada = 'y' )" }, +// new String[]{ "estabelecimentos.nome", "trabalhadores.nome" }, +// new Field( "estabelecimentos.id" ).isEqual( estabelecimentoID ).and( +// new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( +// new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and( +// new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( null ).or( +// new Field( "marcacoes_trabalhador.realizada" ).isDifferent( "y" ) ) ).and( +// new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( +// new Field( "data" ).isLessOrEqual( dataFim ) ).and( +// new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ), +// new String[]{ "trabalhadores.nome" }, null ); + array = executer.executeQuery( select ); + String data[][] = new String[ array.columnLength() ][ 2 ]; + for( int r = 0; r < array.columnLength(); r++ ) + { + for( int c = 0; c < 2; c++ ) + { + data[ r ][ c ] = (String) array.get( r, c ); + } + } + return data; + } + + public Object[][] getCountTrabalhadoresSemExamesOuConsultasPeriodoForAllEmpresas( Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "empresas" }, + new String[]{ "id", "designacao_social", "designacao_social_plain" }, + new Field( "inactivo" ).isDifferent( "y" ), + new String[]{ "designacao_social_plain" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + Object data[][] = new Object[ array.columnLength() ][ 3 ]; + for( int n = 0; n < data.length; n++ ) + { + data[ n ][ 0 ] = array.get( n, 1 ); + Integer empresaID = (Integer)array.get( n, 0 ); + data[ n ][ 1 ] = new Integer( countTrabalhadoresSemExamesOuConsultasEmpresa( empresaID, dataInicio, dataFim, exames ) ); + data[ n ][ 2 ] = empresaID; + } + return data; + } + + public int countTrabalhadoresSemExamesOuConsultasEmpresa( Integer empresaID, Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "trabalhadores", "estabelecimentos" }, new String[]{ "COUNT(*)" }, + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and( + new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and( + new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) ); + int totalCount = 0; + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() > 0 && array.rowLength() > 0 ) + { + Number n = (Number) array.get( 0, 0 ); + if( n != null ) + { + totalCount = n.intValue(); + } + } + +// select = +// new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" }, +// new String[]{ "COUNT(*)" }, +// new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( +// new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( +// new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and( +// new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ).and( +// new Field( "realizada" ).isEqual( "y" ) ).and( +// new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) ); +// int subCount = 0; +// array = executer.executeQuery( select ); +// if( array.columnLength() > 0 && array.rowLength() > 0 ) +// { +// Number n = (Number) array.get( 0, 0 ); +// if( n != null ) +// { +// subCount = n.intValue(); +// } +// } + return totalCount - countTrabalhadoresComExamesOuConsultasPeriodoForEmpresa( dataInicio, dataFim, empresaID, exames ); + } + + public int countTrabalhadoresSemExamesOuConsultasEstabelecimento( Integer estabelecimentoID, Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "trabalhadores" }, new String[]{ "COUNT(*)" }, + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) ); + int totalCount = 0; + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() > 0 && array.rowLength() > 0 ) + { + Number n = (Number) array.get( 0, 0 ); + if( n != null ) + { + totalCount = n.intValue(); + } + } + +// select = +// new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" }, +// new String[]{ "COUNT(*)" }, +// new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( +// new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( +// new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ).and( +// new Field( "realizada" ).isEqual( "y" ) ).and( +// new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) ); +// int subCount = 0; +// array = executer.executeQuery( select ); +// if( array.columnLength() > 0 && array.rowLength() > 0 ) +// { +// Number n = (Number) array.get( 0, 0 ); +// if( n != null ) +// { +// subCount = n.intValue(); +// } +// } + return totalCount - countTrabalhadoresComExamesOuConsultasPeriodoForEstabelecimento( dataInicio, dataFim, estabelecimentoID, exames ); + } + + public String[][]getTrabalhadoresComExamesOuConsultasPeriodo( Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "empresas", "estabelecimentos", + "trabalhadores", "marcacoes_trabalhador" }, + new String[]{ "empresas.designacao_social", "estabelecimentos.nome", "trabalhadores.nome", + "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and( + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ).and( + new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "marcacoes_trabalhador.realizada" ).isEqual( "y" ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ), + new String[]{ "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + String data[][] = new String[ array.columnLength() ][ 3 ]; + for( int r = 0; r < array.columnLength(); r++ ) + { + for( int c = 0; c < 3; c++ ) + { + data[ r ][ c ] = (String) array.get( r, c ); + } + } + return data; + } + + public int countTrabalhadoresComExamesOuConsultasPeriodo( Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" }, + new String[]{ "COUNT(*)" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "realizada" ).isEqual( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ) ); + int count = 0; + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() > 0 && array.rowLength() > 0 ) + { + Number n = (Number) array.get( 0, 0 ); + if( n != null ) + { + count = n.intValue(); + } + } + return count; + } + + public String[][]getTrabalhadoresComExamesOuConsultasPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "estabelecimentos", + "trabalhadores", "marcacoes_trabalhador" }, + new String[]{ "estabelecimentos.nome", "trabalhadores.nome" }, + new Field( "estabelecimentos.id" ).isEqual( estabelecimentoID ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and( + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ).and( + new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "marcacoes_trabalhador.realizada" ).isEqual( "y" ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ), + new String[]{ "estabelecimentos.nome", "trabalhadores.nome" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + String data[][] = new String[ array.columnLength() ][ 2 ]; + for( int r = 0; r < array.columnLength(); r++ ) + { + for( int c = 0; c < 2; c++ ) + { + data[ r ][ c ] = (String) array.get( r, c ); + } + } + return data; + } + + public Object[][] getCountTrabalhadoresComExamesOuConsultasPeriodoForAllEmpresas( Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "empresas" }, + new String[]{ "id", "designacao_social", "designacao_social_plain" }, + new Field( "inactivo" ).isDifferent( "y" ), + new String[]{ "designacao_social_plain" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + Object data[][] = new Object[ array.columnLength() ][ 3 ]; + for( int n = 0; n < data.length; n++ ) + { + data[ n ][ 0 ] = array.get( n, 1 ); + Integer empresaID = (Integer)array.get( n, 0 ); + data[ n ][ 1 ] = new Integer( countTrabalhadoresComExamesOuConsultasPeriodoForEmpresa( dataInicio, dataFim, empresaID, exames ) ); + data[ n ][ 2 ] = empresaID; + } + return data; + } + + public int countTrabalhadoresComExamesOuConsultasPeriodoForEmpresa( Date dataInicio, Date dataFim, Integer empresaID, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" }, + new String[]{ "COUNT(*)" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and( + new Field( "tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "realizada" ).isEqual( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and( + new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ) ); + int count = 0; + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() > 0 && array.rowLength() > 0 ) + { + Number n = (Number) array.get( 0, 0 ); + if( n != null ) + { + count = n.intValue(); + } + } + return count; + } + + public int countTrabalhadoresComExamesOuConsultasPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" }, + new String[]{ "COUNT(*)" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( "tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "realizada" ).isEqual( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ) ); + int count = 0; + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() > 0 && array.rowLength() > 0 ) + { + Number n = (Number) array.get( 0, 0 ); + if( n != null ) + { + count = n.intValue(); + } + } + return count; + } + + public String [][]getDadosTrabalhadoresPeriodo( Date dataInicio, Date dataFim ) + throws Exception + { + Select select = + new Select( new String[]{ "empresas", "estabelecimentos", "trabalhadores" }, + new String[]{ "empresas.designacao_social", "estabelecimentos.nome", "trabalhadores.nome", "trabalhadores.id", + "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and( + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ).and( + new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ), + new String[]{ "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, null ); + + Virtual2DArray array = executer.executeQuery( select ); + String data[][] = new String[ array.columnLength() ][ 7 ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + data[ n ][ 0 ] = ( String ) array.get( n, 0 ); + data[ n ][ 1 ] = ( String ) array.get( n, 1 ); + data[ n ][ 2 ] = ( String ) array.get( n, 2 ); + Integer id = new Integer( ( (Number) array.get( n, 3 ) ).intValue() ); + Select exameSelect = + new Select( new String[]{ "trabalhadores", "marcacoes_trabalhador" }, + new String[]{ "data", "realizada" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.id" ).isEqual( id ) ).and( + new Field( "marcacoes_trabalhador.data" ).isLessOrEqual( dataFim ) ).and( + new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ), + new String[]{ "data desc" }, null ); + Virtual2DArray exameArray = executer.executeQuery( exameSelect ); + if( exameArray.columnLength() > 0 ) + { + Date dataExame = ( Date ) exameArray.get( 0, 0 ); + String estado = ( String ) exameArray.get( 0, 1 ); + data[ n ][ 3 ] = DF.format( dataExame ); + data[ n ][ 4 ] = "y".equals( estado ) ? "Realizado" : "Faltou"; + } + else + { + data[ n ][ 3 ] = "--"; + data[ n ][ 4 ] = "--"; + } + + Select consultaSelect = + new Select( new String[]{ "trabalhadores", "marcacoes_trabalhador" }, + new String[]{ "data", "realizada" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.id" ).isEqual( id ) ).and( + new Field( "marcacoes_trabalhador.data" ).isLessOrEqual( dataFim ) ).and( + new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ), + new String[]{ "data desc" }, null ); + Virtual2DArray consultaArray = executer.executeQuery( consultaSelect ); + if( consultaArray.columnLength() > 0 ) + { + Date dataConsulta = ( Date ) consultaArray.get( 0, 0 ); + String estado = ( String ) consultaArray.get( 0, 1 ); + data[ n ][ 5 ] = DF.format( dataConsulta ); + data[ n ][ 6 ] = "y".equals( estado ) ? "Realizada" : "Faltou"; + } + else + { + data[ n ][ 5 ] = "--"; + data[ n ][ 6 ] = "--"; + } + } + return data; + } + + public String[][]getDadosHigieneSeguranca() + throws Exception + { + Select select = + new Select( new String[]{ "empresas", "estabelecimentos" }, + new String[]{ "empresas.designacao_social", "estabelecimentos.nome", "estabelecimentos.id", + "empresas.designacao_social_plain", "estabelecimentos.nome_plain" }, + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ).and( + new Field( "empresas.inactivo" ).isDifferent( "y" ) ).and( + new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ), + new String[]{ "empresas.designacao_social_plain", "estabelecimentos.nome_plain" }, null ); + + Virtual2DArray array = executer.executeQuery( select ); + String data[][] = new String[ array.columnLength() ][ 6 ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + data[ n ][ 0 ] = ( String ) array.get( n, 0 ); + data[ n ][ 1 ] = ( String ) array.get( n, 1 ); + Integer id = new Integer( ( (Number) array.get( n, 2 ) ).intValue() ); + Select ultimaSelect = + new Select( new String[]{ "marcacoes_estabelecimento" }, + new String[]{ "data", "realizada", "data_relatorio" }, + new Field( "marcacoes_estabelecimento.estabelecimento_id" ).isEqual( id ).and( + new Field( "marcacoes_estabelecimento.data" ).isLessOrEqual( new Date() ) ), + new String[]{ "data desc" }, null ); + Virtual2DArray ultimaArray = executer.executeQuery( ultimaSelect ); + if( ultimaArray.columnLength() > 0 ) + { + Date dataAud = ( Date ) ultimaArray.get( 0, 0 ); + String estado = ( String ) ultimaArray.get( 0, 1 ); + Date dataRel = ( Date ) ultimaArray.get( 0, 2 ); + data[ n ][ 2 ] = DF.format( dataAud ); + data[ n ][ 3 ] = "y".equals( estado ) ? "Realizada" : "Não Realizada"; + data[ n ][ 4 ] = dataRel != null ? DF.format( dataRel ) : "--"; + } + else + { + data[ n ][ 2 ] = "--"; + data[ n ][ 3 ] = "--"; + data[ n ][ 4 ] = "--"; + } + + Select proximaSelect = + new Select( new String[]{ "marcacoes_estabelecimento" }, + new String[]{ "data" }, + new Field( "marcacoes_estabelecimento.estabelecimento_id" ).isEqual( id ).and( + new Field( "marcacoes_estabelecimento.data" ).isGreaterOrEqual( new Date() ) ), + new String[]{ "data desc" }, null ); + Virtual2DArray proximaArray = executer.executeQuery( proximaSelect ); + if( proximaArray.columnLength() > 0 ) + { + Date dataProx = ( Date ) proximaArray.get( 0, 0 ); + data[ n ][ 5 ] = DF.format( dataProx ); + } + else + { + data[ n ][ 5 ] = "--"; + } + } + return data; + } + + + +} + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/estatistica/EstatisticaWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/estatistica/EstatisticaWindow.java new file mode 100644 index 00000000..165c4d41 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/estatistica/EstatisticaWindow.java @@ -0,0 +1,1349 @@ +/* + * EstatisticaWindow.java + * + * Created on 16 de Dezembro de 2004, 13:50 + */ + +package siprp.estatistica; + +import java.awt.Dimension; +import java.awt.FileDialog; +import java.awt.FlowLayout; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.Insets; +import java.awt.event.ActionListener; +import java.awt.event.ItemListener; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.text.DateFormat; +import java.util.Arrays; +import java.util.Date; +import java.util.Vector; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionListener; + +import siprp.data.outer.EmpresasData; +import siprp.data.outer.EstabelecimentosData; +import siprp.pesquisas.PesquisasProvider; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.documents.YearDocument; +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.VectorTableModel; +import com.evolute.utils.tracker.TrackableWindow; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import com.evolute.utils.ui.text.CopyPasteHandler; +/** + * + * @author fpalma + */ +public class EstatisticaWindow extends JFrame + implements TrackableWindow, ListSelectionListener, ActionListener, ItemListener +{ + public static final DateFormat DF = DateFormat.getDateInstance( DateFormat.SHORT ); + + public static final int NONE = 0; + public static final int LISTAGEM_GERAL_MARCACOES_PERIODO = 1; + public static final int LISTAGEM_MARCACOES_PERIODO_EMPRESA_ESTABELECIMENTO = 2; + public static final int LISTAGEM_GLOBAL_TRABALHADORES_SEM_EXAMES = 3; + public static final int LISTAGEM_TRABALHADORES_SEM_EXAMES_EMPRESA_ESTABELECIMENTO = 4; + public static final int LISTAGEM_GLOBAL_TRABALHADORES_COM_EXAMES_PERIODO = 5; + public static final int LISTAGEM_TRABALHADORES_COM_EXAMES_PERIODO_EMPRESA_ESTABELECIMENTO = 6; + public static final int LISTAGEM_GLOBAL_TRABALHADORES_SEM_CONSULTA = 7; + public static final int LISTAGEM_TRABALHADORES_SEM_CONSULTA_EMPRESA_ESTABELECIMENTO = 8; + public static final int LISTAGEM_GLOBAL_TRABALHADORES_COM_CONSULTA_PERIODO = 9; + public static final int LISTAGEM_TRABALHADORES_COM_CONSULTA_PERIODO_EMPRESA_ESTABELECIMENTO = 10; + public static final int LISTAGEM_GLOBAL_TRABALHADORES_PERIODO = -1; + public static final int LISTAGEM_GLOBAL_HIGIENE_SEGURANCA = 11; + + public static final String ESTATISTICAS[] = + new String[]{ "", + "Marca\u00e7\u00f5es efectuadas e pendentes (geral)", + "Marca\u00e7\u00f5es efectuadas e pendentes (por Empresa e Estabelecimento)", + "Contagem global de trabalhadores que ainda n\u00e3o realizaram exames (por per\u00edodo)", + "Listagem de trabalhadores que ainda n\u00e3o realizaram exames (por per\u00edodo, Empresa e Estabelecimento)", + "Contagem global de trabalhadores que j\u00e1 realizaram exames (por per\u00edodo)", + "Listagem de trabalhadores que j\u00e1 realizaram exames (por per\u00edodo, Empresa e Estabelecimento)", + "Contagem global de trabalhadores que ainda n\u00e3o realizaram consultas (por per\u00edodo)", + "Listagem de trabalhadores que ainda n\u00e3o realizaram consultas (por per\u00edodo, Empresa e Estabelecimento)", + "Contagem global de trabalhadores que j\u00e1 realizaram consultas (por per\u00edodo)", + "Listagem de trabalhadores que j\u00e1 realizaram consultas (por per\u00edodo, Empresa e Estabelecimento)", + //"Listagem global de trabalhadores (por per\u00edodo)", + "Listagem global com os dados de higiene e seguran\u00e7a" }; + + + public static final int OPTION_INTERVALO = 0; + public static final int OPTION_ANO = 1; + public static final int OPTION_EMPRESA = 2; + public static final int OPTION_ESTABELECIMENTO = 0; + + public static final boolean ESTATISTICAS_OPTIONS[][] = + // intervalo, ano, empresa, estabelecimento + new boolean[][]{ { false, false, false, false }, + { true, false, false, false }, + { true, false, true, true }, + { true, false, false, false }, + { true, false, true, true }, + { true, false, false, false }, + { true, false, true, true }, + { true, false, false, false }, + { true, false, true, true }, + { true, false, false, false }, + { true, false, true, true }, +// { true, false, false, false }, + { false, false, false, false } }; + + private ProviderInterface JDO; + private EstatisticaDataProvider provider; + private PesquisasProvider pesquisasProvider; + + private JComboBox estatisticaCombo; + private JCalendarPanel dataInicioPanel; + private JCalendarPanel dataFimPanel; + private JTextField anoText; + private BaseTable empresasTable; + private VectorTableModel empresasModel; + private BaseTable estabelecimentosTable; + private VectorTableModel estabelecimentosModel; + private JButton pesquisarButton; + private JButton excelButton; + private JEditorPane resultadoText; + + /** Creates a new instance of EstatisticaWindow */ + public EstatisticaWindow() + throws Exception + { + provider = (EstatisticaDataProvider)EstatisticaDataProvider.getProvider(); + pesquisasProvider = (PesquisasProvider)PesquisasProvider.getProvider(); + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + } + + private void setupComponents() + { + setSize( 1000, 700 ); + setTitle( "Listagens" ); + + JLabel estatisticaLabel = new JLabel( "Listagem" ); + estatisticaCombo = new JComboBox(); + for( int n = 0; n < ESTATISTICAS.length; n++ ) + { + estatisticaCombo.addItem( ESTATISTICAS[ n ] ); + } + estatisticaCombo.setSelectedIndex( 0 ); + estatisticaCombo.addItemListener( this ); + estatisticaCombo.setPreferredSize( new Dimension( 700, 20 ) ); + JLabel intervalo1Label = new JLabel( "De" ); + JLabel intervalo2Label = new JLabel( "a" ); + dataInicioPanel = new JCalendarPanel( null ); + dataInicioPanel.setPreferredSize( new Dimension( 200, 20 ) ); + dataFimPanel = new JCalendarPanel( null ); + dataFimPanel.setPreferredSize( new Dimension( 200, 20 ) ); + + JLabel anoLabel = new JLabel( "Ano" ); + anoText = new JTextField(); + anoText.setDocument( new YearDocument() ); + anoText.setPreferredSize( new Dimension( 50, 20 ) ); + new CopyPasteHandler( anoText ); + + empresasModel = new VectorTableModel( new String[]{ "Designa\u00e7\u00e3o Social" } ); + empresasTable = new BaseTable( empresasModel ); + empresasTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + empresasTable.setNonResizableNorReordable(); + empresasTable.getSelectionModel().addListSelectionListener( this ); + JScrollPane empresasScroll = new JScrollPane(); + empresasScroll.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Empresa" ) ); + empresasScroll.setViewportView( empresasTable ); + empresasScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + empresasScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + empresasScroll.getVerticalScrollBar().setBlockIncrement(20); + + estabelecimentosModel = new VectorTableModel( new String[]{ "Nome" } ); + estabelecimentosTable = new BaseTable( estabelecimentosModel ); + estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + estabelecimentosTable.setNonResizableNorReordable(); + estabelecimentosTable.getSelectionModel().addListSelectionListener( this ); + JScrollPane estabelecimentosScroll = new JScrollPane(); + estabelecimentosScroll.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Estabelecimento" ) ); + estabelecimentosScroll.setViewportView( estabelecimentosTable ); + estabelecimentosScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + estabelecimentosScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + + pesquisarButton = new JButton( "Pesquisar" ); + pesquisarButton.addActionListener( this ); + excelButton = new JButton( "Exportar" ); + excelButton.addActionListener( this ); + + resultadoText = new JEditorPane( "text/html", "" ); + resultadoText.setEditable( false ); +// resultadoText.setLineWrap( true ); +// resultadoText.setWrapStyleWord( true ); + new CopyPasteHandler( resultadoText ); + JScrollPane resultadoScroll = new JScrollPane(); + resultadoScroll.setViewportView( resultadoText ); + resultadoScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS ); + resultadoScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + + JPanel pad; + + GridBagLayout gridbag = new GridBagLayout(); + getContentPane().setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 5, 5, 5, 5 ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + + JPanel escolhaEstatisticaPanel = new JPanel(); + escolhaEstatisticaPanel.setLayout( new FlowLayout( FlowLayout.LEFT ) ); + escolhaEstatisticaPanel.add( estatisticaLabel ); + escolhaEstatisticaPanel.add( estatisticaCombo ); + gridbag.setConstraints( escolhaEstatisticaPanel, constraints ); + getContentPane().add( escolhaEstatisticaPanel ); + + JPanel periodoPanel = new JPanel(); + periodoPanel.setLayout( new FlowLayout( FlowLayout.LEFT ) ); + periodoPanel.add( intervalo1Label ); + periodoPanel.add( dataInicioPanel ); + periodoPanel.add( intervalo2Label ); + periodoPanel.add( dataFimPanel ); + gridbag.setConstraints( periodoPanel, constraints ); + getContentPane().add( periodoPanel ); + + JPanel anoPanel = new JPanel(); + anoPanel.setLayout( new FlowLayout( FlowLayout.LEFT ) ); + anoPanel.add( anoLabel ); + anoPanel.add( anoText ); + gridbag.setConstraints( anoPanel, constraints ); + getContentPane().add( anoPanel ); + + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 0.2; + constraints.gridheight = 2; + constraints.weightx = 0.3; + constraints.gridwidth = 3; + gridbag.setConstraints( empresasScroll, constraints ); + getContentPane().add( empresasScroll ); + + gridbag.setConstraints( estabelecimentosScroll, constraints ); + getContentPane().add( estabelecimentosScroll ); + + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 0.4; + constraints.gridwidth = GridBagConstraints.REMAINDER; + pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + getContentPane().add( pad ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 0; + constraints.gridwidth = 1; + JPanel buttonPanel = new JPanel(); + buttonPanel.setLayout( new GridLayout( 1, 1 ) ); + buttonPanel.add( pesquisarButton ); + buttonPanel.add( excelButton ); + gridbag.setConstraints( buttonPanel, constraints ); + getContentPane().add( buttonPanel ); + + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 0.4; + constraints.gridwidth = GridBagConstraints.REMAINDER; + pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + getContentPane().add( pad ); + + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 0.8; + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( resultadoScroll, constraints ); + getContentPane().add( resultadoScroll ); + + processarEscolha(); + } + + public void actionPerformed(java.awt.event.ActionEvent e) + { + Object source = e.getSource(); + if( source.equals( pesquisarButton ) ) + { + int index = estatisticaCombo.getSelectedIndex(); + switch( index ) + { + case LISTAGEM_GERAL_MARCACOES_PERIODO: + listagemGeralMarcacoesPeriodo(); + break; + + case LISTAGEM_MARCACOES_PERIODO_EMPRESA_ESTABELECIMENTO: + listagemMarcacoesPeriodoEmpresaEstabelecimento(); + break; + + case LISTAGEM_GLOBAL_TRABALHADORES_SEM_EXAMES: + listagemGeralTrabalhadoresSemExamesOuConsultas( true ); + break; + + case LISTAGEM_TRABALHADORES_SEM_EXAMES_EMPRESA_ESTABELECIMENTO: + listagemTrabalhadoresSemExamesOuConsultasEmpresaEstabelecimento( true ); + break; + + case LISTAGEM_GLOBAL_TRABALHADORES_COM_EXAMES_PERIODO: + listagemGeralTrabalhadoresComExamesOuConsultasPeriodo( true ); + break; + + case LISTAGEM_TRABALHADORES_COM_EXAMES_PERIODO_EMPRESA_ESTABELECIMENTO: + listagemGeralTrabalhadoresComExamesOuConsultasPeriodoEmpresaEstabelecimento( true ); + break; + + case LISTAGEM_GLOBAL_TRABALHADORES_SEM_CONSULTA: + listagemGeralTrabalhadoresSemExamesOuConsultas( false ); + break; + + case LISTAGEM_TRABALHADORES_SEM_CONSULTA_EMPRESA_ESTABELECIMENTO: + listagemTrabalhadoresSemExamesOuConsultasEmpresaEstabelecimento( false ); + break; + + case LISTAGEM_GLOBAL_TRABALHADORES_COM_CONSULTA_PERIODO: + listagemGeralTrabalhadoresComExamesOuConsultasPeriodo( false ); + break; + + case LISTAGEM_TRABALHADORES_COM_CONSULTA_PERIODO_EMPRESA_ESTABELECIMENTO: + listagemGeralTrabalhadoresComExamesOuConsultasPeriodoEmpresaEstabelecimento( false ); + break; + + case LISTAGEM_GLOBAL_TRABALHADORES_PERIODO: + listagemGeralTrabalhadoresPeriodo(); + break; + + case LISTAGEM_GLOBAL_HIGIENE_SEGURANCA: + listagemGlobalHigieneSeguranca(); + break; + } + } + else if( source.equals( excelButton ) ) + { + exportar(); + } + } + + private boolean close() + { + setVisible( false ); + dispose(); + return true; + } + + public boolean closeIfPossible() + { + return close(); + } + + public void open() + { + empresasTable.clearSelection(); + estatisticaCombo.setSelectedIndex( 0 ); + try + { + IDObject empresas[] = pesquisasProvider.getAllEmpresas(); + empresasModel.setValues( new Vector( Arrays.asList( empresas ) ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); + } + setVisible( true ); + } + + public void refresh() + { + setVisible( true ); + } + + public void valueChanged(javax.swing.event.ListSelectionEvent e) + { + Object source = e.getSource(); + if( source.equals( empresasTable.getSelectionModel() ) ) + { + estabelecimentosTable.clearSelection(); + int selected = empresasTable.getSelectedRow(); + if( selected == -1 ) + { + return; + } + IDObject empresa = (IDObject) empresasModel.getRowAt( selected ); + estabelecimentosModel.clearAll(); + IDObject estabelecimentos[]; + try + { + estabelecimentos = pesquisasProvider.getAllEstabelecimentosForEmpresa( empresa.getID() ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os estabelecimentos", true ); + return; + } + Vector v = new Vector( Arrays.asList( estabelecimentos ) ); + v.add( new MappableObject( new Integer( -1 ), "TODOS" ) ); + estabelecimentosModel.setValues( v ); + } + } + + public void itemStateChanged(java.awt.event.ItemEvent itemEvent) + { + processarEscolha(); + } + + protected void processarEscolha() + { + int index = estatisticaCombo.getSelectedIndex(); + boolean optionLine[] = ESTATISTICAS_OPTIONS[ index ]; + dataInicioPanel.setEnabled( optionLine[ OPTION_INTERVALO ] ); + dataFimPanel.setEnabled( optionLine[ OPTION_INTERVALO ] ); + anoText.setEnabled( optionLine[ OPTION_ANO ] ); + empresasTable.setEnabled( optionLine[ OPTION_EMPRESA ] ); + estabelecimentosTable.setEnabled( optionLine[ OPTION_ESTABELECIMENTO ] ); + pesquisarButton.setEnabled( index != NONE ); + } + + protected void listagemGeralMarcacoesPeriodo() + { + try + { + Date inicio = dataInicioPanel.getDate(); + Date fim = dataFimPanel.getDate(); + if( inicio == null || fim == null ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher o intervalo de datas.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + if( inicio.after( fim ) ) + { + JOptionPane.showMessageDialog( this, "A data de in\u00edcio tem de ser inferior \u00e0 de fim..", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + StringBuffer buffer = new StringBuffer(); + int exames = provider.countExamesPeriodo( inicio, fim ); + int consultas = provider.countConsultasPeriodo( inicio, fim ); + int total = exames + consultas; + buffer.append( "

" ); + buffer.append( "" + ESTATISTICAS[ LISTAGEM_GERAL_MARCACOES_PERIODO ] + "" ); + buffer.append( "

" ); + buffer.append( "
" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "PER\u00cdODO:" ); + buffer.append( "" ); + buffer.append( "" + DF.format( dataInicioPanel.getDate() ) + " a " + + DF.format( dataFimPanel.getDate() ) + "" ); + buffer.append( "
" ); + buffer.append( "EXAMES:" ); + buffer.append( "" ); + buffer.append( "" + exames + "" ); + buffer.append( "
" ); + buffer.append( "CONSULTAS:" ); + buffer.append( "" ); + buffer.append( "" + consultas + "" ); + buffer.append( "
" ); + buffer.append( "TOTAL:" ); + buffer.append( "" ); + buffer.append( "" + ( exames + consultas ) + "" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + String data[][] = provider.getMarcacoesPeriodo( inicio, fim ); + for( int l = 0; l < data.length; l++ ) + { + buffer.append( "" ); + for( int c = 0; c < data[ l ].length; c++ ) + { + buffer.append( "" ); + buffer.append( "" ); + } + buffer.append( "" ); + } + buffer.append( "
" ); + buffer.append( "EMPRESA" ); + buffer.append( "" ); + buffer.append( "NOME" ); + buffer.append( "" ); + buffer.append( "ESTABELECIMENTO" ); + buffer.append( "" ); + buffer.append( "DATA" ); + buffer.append( "" ); + buffer.append( " " ); + buffer.append( "
" ); + buffer.append( "" + data[ l ][ c ] + "" ); + buffer.append( "
" ); + resultadoText.setText( buffer.toString() ); + } + catch( Exception ex ) + { + resultadoText.setText( "ERRO a carregar dados!" ); + ex.printStackTrace(); + } + } + + protected void listagemMarcacoesPeriodoEmpresaEstabelecimento() + { + try + { + Date inicio = dataInicioPanel.getDate(); + Date fim = dataFimPanel.getDate(); + int sEmpresa = empresasTable.getSelectedRow(); + int sEstabelecimento = estabelecimentosTable.getSelectedRow(); + if( inicio == null || fim == null || sEmpresa == -1 ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher Empresa e intervalo de datas.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + if( inicio.after( fim ) ) + { + JOptionPane.showMessageDialog( this, "A data de in\u00edcio tem de ser inferior \u00e0 de fim..", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + StringBuffer buffer = new StringBuffer(); + Integer idEmpresa = ( (IDObject)empresasModel.getRowAt( sEmpresa ) ).getID(); + EmpresasData empresa = (EmpresasData)JDO.load( EmpresasData.class, idEmpresa ); + String designacao = (String)empresa.get( EmpresasData.DESIGNACAO_SOCIAL ); + IDObject estabelecimentos[]; + if( sEstabelecimento == -1 || ( ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento ) ).getID().equals( new Integer( -1 ) ) ) + { + estabelecimentos = pesquisasProvider.getAllEstabelecimentosForEmpresa( idEmpresa ); + } + else + { + estabelecimentos = new IDObject[ 1 ]; + estabelecimentos[ 0 ] = ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento ); + } + int examesEmpresa = provider.countExamesPeriodoForEmpresa( inicio, fim, idEmpresa ); + int consultasEmpresa = provider.countConsultasPeriodoForEmpresa( inicio, fim, idEmpresa ); + buffer.append( "

" ); + buffer.append( "" + ESTATISTICAS[ LISTAGEM_MARCACOES_PERIODO_EMPRESA_ESTABELECIMENTO ] + "" ); + buffer.append( "

" ); + buffer.append( "
" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "EMPRESA:" ); + buffer.append( "" ); + buffer.append( "" + designacao + "" ); + buffer.append( "
" ); + buffer.append( "PER\u00cdODO:" ); + buffer.append( "" ); + buffer.append( "" + DF.format( dataInicioPanel.getDate() ) + " a " + + DF.format( dataFimPanel.getDate() ) + "" ); + buffer.append( "
" ); + buffer.append( "EXAMES:" ); + buffer.append( "" ); + buffer.append( "" + examesEmpresa + "" ); + buffer.append( "
" ); + buffer.append( "CONSULTAS:" ); + buffer.append( "" ); + buffer.append( "" + consultasEmpresa + "" ); + buffer.append( "
" ); + buffer.append( "TOTAL:" ); + buffer.append( "" ); + buffer.append( "" + ( examesEmpresa + consultasEmpresa ) + "" ); + buffer.append( "
" ); + for( int e = 0; e < estabelecimentos.length; e++ ) + { + EstabelecimentosData estabelecimento = (EstabelecimentosData)JDO.load( EstabelecimentosData.class, estabelecimentos[ e ].getID() ); + String nome = (String)estabelecimento.get( EstabelecimentosData.NOME ); + int exames = provider.countExamesPeriodoForEstabelecimento( inicio, fim, estabelecimentos[ e ].getID() ); + int consultas = provider.countConsultasPeriodoForEstabelecimento( inicio, fim, estabelecimentos[ e ].getID() ); + int total = exames + consultas; + buffer.append( "



" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "ESTABELECIMENTO:" ); + buffer.append( "" ); + buffer.append( "" + nome + "" ); + buffer.append( "
" ); + buffer.append( "EXAMES:" ); + buffer.append( "" ); + buffer.append( "" + exames + "" ); + buffer.append( "
" ); + buffer.append( "CONSULTAS:" ); + buffer.append( "" ); + buffer.append( "" + consultas + "" ); + buffer.append( "
" ); + buffer.append( "TOTAL:" ); + buffer.append( "" ); + buffer.append( "" + ( exames + consultas ) + "" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + String data[][] = provider.getMarcacoesPeriodoForEstabelecimento( inicio, fim, estabelecimentos[ e ].getID() ); + for( int l = 0; l < data.length; l++ ) + { + buffer.append( "" ); + for( int c = 1; c < data[ l ].length; c++ ) + { + buffer.append( "" ); + buffer.append( "" ); + } + buffer.append( "" ); + } + buffer.append( "
" ); + buffer.append( "NOME" ); + buffer.append( "" ); + buffer.append( "ESTABELECIMENTO" ); + buffer.append( "" ); + buffer.append( "DATA" ); + buffer.append( "" ); + buffer.append( " " ); + buffer.append( "
" ); + buffer.append( "" + data[ l ][ c ] + "" ); + buffer.append( "
" ); + } + resultadoText.setText( buffer.toString() ); + } + catch( Exception ex ) + { + resultadoText.setText( "ERRO a carregar dados!" ); + ex.printStackTrace(); + } + } + + protected void listagemGeralTrabalhadoresSemExamesOuConsultas( boolean exames ) + { + try + { + Date inicio = dataInicioPanel.getDate(); + Date fim = dataFimPanel.getDate(); + if( inicio == null || fim == null ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher o intervalo de datas.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + if( inicio.after( fim ) ) + { + JOptionPane.showMessageDialog( this, "A data de in\u00edcio tem de ser inferior \u00e0 de fim..", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + int count = provider.countTrabalhadoresSemExamesOuConsultas( inicio, fim, exames ); + //String data[][] = provider.getTrabalhadoresComExamesOuConsultasPeriodo( inicio, fim, exames ); + Object data[][] = provider.getCountTrabalhadoresSemExamesOuConsultasPeriodoForAllEmpresas( inicio, fim, exames ); + StringBuffer buffer = new StringBuffer(); + buffer.append( "

" ); + buffer.append( "" + ESTATISTICAS[ exames ? LISTAGEM_GLOBAL_TRABALHADORES_SEM_EXAMES : LISTAGEM_GLOBAL_TRABALHADORES_SEM_CONSULTA ] + "" ); + buffer.append( "

" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "PER\u00cdODO:" ); + buffer.append( "" ); + buffer.append( "" + DF.format( dataInicioPanel.getDate() ) + " a " + + DF.format( dataFimPanel.getDate() ) + "" ); + buffer.append( "
" ); + buffer.append( "TOTAL:" ); + buffer.append( "" ); + buffer.append( "" + count + "" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + for( int l = 0; l < data.length; l++ ) + { + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + } + buffer.append( "
" ); + buffer.append( "EMPRESA" ); + buffer.append( "" ); + buffer.append( "N\u00ba" ); + buffer.append( "
" ); + buffer.append( "" + data[ l ][ 0 ] + "" ); + buffer.append( "" ); + buffer.append( "" + data[ l ][ 1 ] + "" ); + buffer.append( "
" ); + resultadoText.setText( buffer.toString() ); + } + catch( Exception ex ) + { + resultadoText.setText( "ERRO a carregar dados!" ); + ex.printStackTrace(); + } + } + + protected void listagemTrabalhadoresSemExamesOuConsultasEmpresaEstabelecimento( boolean exames ) + { + try + { + Date inicio = dataInicioPanel.getDate(); + Date fim = dataFimPanel.getDate(); + if( inicio == null || fim == null ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher o intervalo de datas.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + if( inicio.after( fim ) ) + { + JOptionPane.showMessageDialog( this, "A data de in\u00edcio tem de ser inferior \u00e0 de fim..", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + int sEmpresa = empresasTable.getSelectedRow(); + int sEstabelecimento = estabelecimentosTable.getSelectedRow(); + if( sEmpresa == -1 ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher Empresa.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + StringBuffer buffer = new StringBuffer(); + Integer idEmpresa = ( (IDObject)empresasModel.getRowAt( sEmpresa ) ).getID(); + EmpresasData empresa = (EmpresasData)JDO.load( EmpresasData.class, idEmpresa ); + String designacao = (String)empresa.get( EmpresasData.DESIGNACAO_SOCIAL ); + IDObject estabelecimentos[]; + if( sEstabelecimento == -1 || ( ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento ) ).getID().equals( new Integer( -1 ) ) ) + { + estabelecimentos = pesquisasProvider.getAllEstabelecimentosForEmpresa( idEmpresa ); + } + else + { + estabelecimentos = new IDObject[ 1 ]; + estabelecimentos[ 0 ] = ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento ); + } + int countEmpresa = provider.countTrabalhadoresSemExamesOuConsultasEmpresa( idEmpresa, inicio, fim, exames ); + buffer.append( "

" ); + buffer.append( "" + ESTATISTICAS[ exames ? LISTAGEM_TRABALHADORES_SEM_EXAMES_EMPRESA_ESTABELECIMENTO : LISTAGEM_TRABALHADORES_SEM_CONSULTA_EMPRESA_ESTABELECIMENTO ] + "" ); + buffer.append( "

" ); + buffer.append( "
" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "EMPRESA:" ); + buffer.append( "" ); + buffer.append( "" + designacao + "" ); + buffer.append( "
" ); + buffer.append( "Nº DE TRABALHADORES:" ); + buffer.append( "" ); + buffer.append( "" + countEmpresa + "" ); + buffer.append( "
" ); + for( int e = 0; e < estabelecimentos.length; e++ ) + { + EstabelecimentosData estabelecimento = (EstabelecimentosData)JDO.load( EstabelecimentosData.class, estabelecimentos[ e ].getID() ); + String nome = (String)estabelecimento.get( EstabelecimentosData.NOME ); + int countEstabelecimento = provider.countTrabalhadoresSemExamesOuConsultasEstabelecimento( estabelecimentos[ e ].getID(), inicio, fim, exames ); + buffer.append( "



" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "ESTABELECIMENTO:" ); + buffer.append( "" ); + buffer.append( "" + nome + "" ); + buffer.append( "
" ); + buffer.append( "Nº DE TRABALHADORES:" ); + buffer.append( "" ); + buffer.append( "" + countEstabelecimento + "" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + String data[][] = provider.getTrabalhadoresSemExamesOuConsultasEstabelecimento( estabelecimentos[ e ].getID(), inicio, fim, exames ); + for( int l = 0; l < data.length; l++ ) + { + buffer.append( "" ); + for( int c = 0; c < data[ l ].length; c++ ) + { + buffer.append( "" ); + buffer.append( "" ); + } + buffer.append( "" ); + } + buffer.append( "
" ); + buffer.append( "ESTABELECIMENTO" ); + buffer.append( "" ); + buffer.append( "NOME" ); + buffer.append( "
" ); + buffer.append( "" + data[ l ][ c ] + "" ); + buffer.append( "
" ); + } + resultadoText.setText( buffer.toString() ); + } + catch( Exception ex ) + { + resultadoText.setText( "ERRO a carregar dados!" ); + ex.printStackTrace(); + } + } + + protected void listagemGeralTrabalhadoresComExamesOuConsultasPeriodo( boolean exames ) + { + try + { + Date inicio = dataInicioPanel.getDate(); + Date fim = dataFimPanel.getDate(); + if( inicio == null || fim == null ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher o intervalo de datas.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + if( inicio.after( fim ) ) + { + JOptionPane.showMessageDialog( this, "A data de in\u00edcio tem de ser inferior \u00e0 de fim..", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + int count = provider.countTrabalhadoresComExamesOuConsultasPeriodo( inicio, fim, exames ); + //String data[][] = provider.getTrabalhadoresComExamesOuConsultasPeriodo( inicio, fim, exames ); + Object data[][] = provider.getCountTrabalhadoresComExamesOuConsultasPeriodoForAllEmpresas( inicio, fim, exames ); + StringBuffer buffer = new StringBuffer(); + buffer.append( "

" ); + buffer.append( "" + ESTATISTICAS[ exames ? LISTAGEM_GLOBAL_TRABALHADORES_COM_EXAMES_PERIODO : LISTAGEM_GLOBAL_TRABALHADORES_COM_CONSULTA_PERIODO ] + "" ); + buffer.append( "

" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "PER\u00cdODO:" ); + buffer.append( "" ); + buffer.append( "" + DF.format( dataInicioPanel.getDate() ) + " a " + + DF.format( dataFimPanel.getDate() ) + "" ); + buffer.append( "
" ); + buffer.append( "TOTAL:" ); + buffer.append( "" ); + buffer.append( "" + count + "" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + for( int l = 0; l < data.length; l++ ) + { + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + } + buffer.append( "
" ); + buffer.append( "EMPRESA" ); + buffer.append( "" ); + buffer.append( "N\u00ba" ); + buffer.append( "
" ); + buffer.append( "" + data[ l ][ 0 ] + "" ); + buffer.append( "" ); + buffer.append( "" + data[ l ][ 1 ] + "" ); + buffer.append( "
" ); + resultadoText.setText( buffer.toString() ); + } + catch( Exception ex ) + { + resultadoText.setText( "ERRO a carregar dados!" ); + ex.printStackTrace(); + } + } + + protected void listagemGeralTrabalhadoresComExamesOuConsultasPeriodoEmpresaEstabelecimento( boolean exames ) + { + try + { + Date inicio = dataInicioPanel.getDate(); + Date fim = dataFimPanel.getDate(); + int sEmpresa = empresasTable.getSelectedRow(); + int sEstabelecimento = estabelecimentosTable.getSelectedRow(); + if( inicio == null || fim == null || sEmpresa == -1 ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher Empresa e intervalo de datas.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + if( inicio.after( fim ) ) + { + JOptionPane.showMessageDialog( this, "A data de in\u00edcio tem de ser inferior \u00e0 de fim..", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + StringBuffer buffer = new StringBuffer(); + Integer idEmpresa = ( (IDObject)empresasModel.getRowAt( sEmpresa ) ).getID(); + EmpresasData empresa = (EmpresasData)JDO.load( EmpresasData.class, idEmpresa ); + String designacao = (String)empresa.get( EmpresasData.DESIGNACAO_SOCIAL ); + IDObject estabelecimentos[]; + if( sEstabelecimento == -1 || ( ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento ) ).getID().equals( new Integer( -1 ) ) ) + { + estabelecimentos = pesquisasProvider.getAllEstabelecimentosForEmpresa( idEmpresa ); + } + else + { + estabelecimentos = new IDObject[ 1 ]; + estabelecimentos[ 0 ] = ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento ); + } + int countEmpresa = provider.countTrabalhadoresComExamesOuConsultasPeriodoForEmpresa( inicio, fim, idEmpresa, exames ); + buffer.append( "

" ); + buffer.append( "" + ESTATISTICAS[ exames ? LISTAGEM_TRABALHADORES_COM_EXAMES_PERIODO_EMPRESA_ESTABELECIMENTO : LISTAGEM_TRABALHADORES_COM_CONSULTA_PERIODO_EMPRESA_ESTABELECIMENTO ] + "" ); + buffer.append( "

" ); + buffer.append( "
" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "
" ); + buffer.append( "EMPRESA:" ); + buffer.append( "" ); + buffer.append( "" + designacao + "" ); + buffer.append( "
" ); + buffer.append( "PER\u00cdODO:" ); + buffer.append( "" ); + buffer.append( "" + DF.format( dataInicioPanel.getDate() ) + " a " + + DF.format( dataFimPanel.getDate() ) + "" ); + buffer.append( "
" ); + buffer.append( "Nº:" ); + buffer.append( "" ); + buffer.append( "" + countEmpresa + "" ); + buffer.append( "
" ); + for( int e = 0; e < estabelecimentos.length; e++ ) + { + EstabelecimentosData estabelecimento = (EstabelecimentosData)JDO.load( EstabelecimentosData.class, estabelecimentos[ e ].getID() ); + String nome = (String)estabelecimento.get( EstabelecimentosData.NOME ); + int countEstabelecimento = provider.countTrabalhadoresComExamesOuConsultasPeriodoForEstabelecimento( inicio, fim, estabelecimentos[ e ].getID(), exames ); + buffer.append( "



" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "ESTABELECIMENTO:" ); + buffer.append( "" ); + buffer.append( "" + nome + "" ); + buffer.append( "
" ); + buffer.append( "Nº:" ); + buffer.append( "" ); + buffer.append( "" + countEstabelecimento + "" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + String data[][] = provider.getTrabalhadoresComExamesOuConsultasPeriodoForEstabelecimento( inicio, fim, estabelecimentos[ e ].getID(), exames ); + for( int l = 0; l < data.length; l++ ) + { + buffer.append( "" ); + for( int c = 0; c < data[ l ].length; c++ ) + { + buffer.append( "" ); + buffer.append( "" ); + } + buffer.append( "" ); + } + buffer.append( "
" ); + buffer.append( "ESTABELECIMENTO" ); + buffer.append( "" ); + buffer.append( "NOME" ); + buffer.append( "
" ); + buffer.append( "" + data[ l ][ c ] + "" ); + buffer.append( "
" ); + } + resultadoText.setText( buffer.toString() ); + } + catch( Exception ex ) + { + resultadoText.setText( "ERRO a carregar dados!" ); + ex.printStackTrace(); + } + } + + protected void listagemGeralTrabalhadoresPeriodo() + { + try + { + Date inicio = dataInicioPanel.getDate(); + Date fim = dataFimPanel.getDate(); + if( inicio == null || fim == null ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher o intervalo de datas.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + if( inicio.after( fim ) ) + { + JOptionPane.showMessageDialog( this, "A data de in\u00edcio tem de ser inferior \u00e0 de fim..", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + StringBuffer buffer = new StringBuffer(); + buffer.append( "

" ); + buffer.append( "" + ESTATISTICAS[ LISTAGEM_GLOBAL_TRABALHADORES_PERIODO ] + "" ); + buffer.append( "

" ); + buffer.append( "
" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "PER\u00cdODO:" ); + buffer.append( "" ); + buffer.append( "" + DF.format( dataInicioPanel.getDate() ) + " a " + + DF.format( dataFimPanel.getDate() ) + "" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + String data[][] = provider.getDadosTrabalhadoresPeriodo( inicio, fim ); + for( int l = 0; l < data.length; l++ ) + { + buffer.append( "" ); + for( int c = 0; c < data[ l ].length; c++ ) + { + buffer.append( "" ); + buffer.append( "" ); + } + buffer.append( "" ); + } + buffer.append( "
" ); + buffer.append( "EMPRESA" ); + buffer.append( "" ); + buffer.append( "ESTABELECIMENTO" ); + buffer.append( "" ); + buffer.append( "NOME" ); + buffer.append( "" ); + buffer.append( "ÚLTIMO EXAME" ); + buffer.append( "" ); + buffer.append( "ESTADO" ); + buffer.append( "" ); + buffer.append( "ÚLTIMA CONSULTA" ); + buffer.append( "" ); + buffer.append( "ESTADO" ); + buffer.append( "
" ); + buffer.append( "" + data[ l ][ c ] + "" ); + buffer.append( "
" ); + resultadoText.setText( buffer.toString() ); + } + catch( Exception ex ) + { + resultadoText.setText( "ERRO a carregar dados!" ); + ex.printStackTrace(); + } + } + + protected void listagemGlobalHigieneSeguranca() + { + try + { + StringBuffer buffer = new StringBuffer(); + buffer.append( "

" ); + buffer.append( "" + ESTATISTICAS[ LISTAGEM_GLOBAL_HIGIENE_SEGURANCA ] + "" ); + buffer.append( "

" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + String data[][] = provider.getDadosHigieneSeguranca(); + for( int l = 0; l < data.length; l++ ) + { + buffer.append( "" ); + for( int c = 0; c < data[ l ].length; c++ ) + { + buffer.append( "" ); + buffer.append( "" ); + } + buffer.append( "" ); + } + buffer.append( "
" ); + buffer.append( "EMPRESA" ); + buffer.append( "" ); + buffer.append( "ESTABELECIMENTO" ); + buffer.append( "" ); + buffer.append( "ÚLTIMA AUDITORIA" ); + buffer.append( "" ); + buffer.append( "ESTADO" ); + buffer.append( "" ); + buffer.append( "RELATÓRIO" ); + buffer.append( "" ); + buffer.append( "PRÓXIMA AUDITORIA" ); + buffer.append( "
" ); + buffer.append( "" + data[ l ][ c ] + "" ); + buffer.append( "
" ); + resultadoText.setText( buffer.toString() ); + } + catch( Exception ex ) + { + resultadoText.setText( "ERRO a carregar dados!" ); + ex.printStackTrace(); + } + } + + public void exportar() + { + FileDialog dialog = new FileDialog( this, "Ficheiro de destino", FileDialog.SAVE ); + dialog.setDirectory( System.getProperty( "user.home" ) ); + dialog.setVisible( true ); + String fileName; + String dirName; + fileName = dialog.getFile(); + dirName = dialog.getDirectory(); + if( fileName != null ) + { + int index = fileName.indexOf( '.' ); + if( index == -1 ) + { + fileName += ".html"; + } + if( index == fileName.length() - 1 ) + { + fileName += "html"; + } + String fullName = dirName + fileName; + String text = resultadoText.getText(); + String title = "S.I.P.R.P. - Sociedade Ibérica de Prevenção de Riscos Profissionais"; + String style = ""; + text = text.replace( "", "\n\t\t" + title + "\n" + style ); + text = text.replace( "", "
" ); + text = text.replace( "", "
" ); +// System.out.println( text ); + try + { + FileWriter writer = new FileWriter( new File( fullName ) ); + writer.write( text ); + writer.close(); + } + catch( IOException ex ) + { + DialogException.showException( ex ); + return; + } + } + } +} \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/estatisticas/EstatisticasWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/estatisticas/EstatisticasWindow.java new file mode 100644 index 00000000..cc54322d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/estatisticas/EstatisticasWindow.java @@ -0,0 +1,37 @@ +/* + * EstatisticasWindow.java + * + * Created on 11 de Maio de 2004, 17:57 + */ + +package siprp.estatisticas; + +import javax.swing.JComboBox; +import javax.swing.JPanel; + +import com.evolute.utils.ui.window.CustomJFrame; + +/** + * + * @author fpalma + */ +public class EstatisticasWindow + extends CustomJFrame +{ + private JPanel filtrosPanel; + private JPanel agrupamentosPanel; + private JPanel buttonPanel; + + private JComboBox filtroEmpresa; + + /** Creates a new instance of EstatisticasWindow */ + public EstatisticasWindow() + { + setupComponents(); + } + + private void setupComponents() + { + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/EmpresaPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/EmpresaPanel.java new file mode 100644 index 00000000..41ea20fe --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/EmpresaPanel.java @@ -0,0 +1,505 @@ +/* + * EmpresaPanel.java + * + * Created on 29 de Marco de 2004, 11:53 + */ + +package siprp.ficha; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Map; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import siprp.FichaDataProvider; +import siprp.SingletonConstants; +import siprp.data.outer.EmpresasData; +import siprp.data.outer.EstabelecimentosData; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.dataui.ComponentController; +import com.evolute.utils.dataui.ComponentsHashtable; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.panel.RadioButtonFixedPanel; +import com.evolute.utils.ui.panel.RadioButtonPanel; +import com.evolute.utils.ui.text.CopyPasteHandler; + +/** + * + * @author fpalma + */ +public class EmpresaPanel extends JPanel + implements ControllableComponent +{ + private ProviderInterface JDO; + private JTextField designacaoSocialText; + private JTextField estabelecimentoText; + private JTextField localidadeText; + private RadioButtonFixedPanel servicoSaudeTipoPanel; + private JTextField designacaoServicoSaudeText; + private JButton defaultServicoSaudeButton; + private RadioButtonFixedPanel servicoHigieneTipoPanel; + private JTextField designacaoText; + private JButton defaultServicoHigieneButton; + + private FichaDataProvider provider; + private ComponentsHashtable empresaComponents; + private ComponentsHashtable estabelecimentoComponents; + + private EstabelecimentosData estabelecimento; + private EmpresasData empresa; + + + /** Creates a new instance of EmpresaPanel */ + public EmpresaPanel() + throws Exception + { + provider = (FichaDataProvider)FichaDataProvider.getProvider(); + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + { + setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Empresa/Entidade" ) ); + + JLabel designacaoSocialLabel = new JLabel( "Designa\u00e7\u00e3o Social" ); + designacaoSocialText = new JTextField(); +// JPanel servicoSaudePanel = new JPanel(); + JLabel estabelecimentoLabel = new JLabel( "Estabelecimento" ); + estabelecimentoText = new JTextField(); + JLabel localidadeLabel = new JLabel( "Localidade" ); + localidadeText = new JTextField(); + JLabel servicoSaudeLabel = new JLabel( "Servi\u00e7o de Sa\u00fade: Tipo" ); + servicoSaudeTipoPanel = + new RadioButtonFixedPanel( new IDObject[]{ new MappableObject( new Integer(1), "Interno" ), + new MappableObject( new Integer(2), "Interempresas" ), + new MappableObject( new Integer(3), "Externo" ), + new MappableObject( new Integer(4), "Servi\u00e7o Nacional de Sa\u00fade" ) }, + 1, 4, RadioButtonPanel.ORIENTATION_HORIZONTAL, false ); + JLabel designacaoServicoSaudeLabel = new JLabel( "Designa\u00e7\u00e3o" ); + designacaoServicoSaudeText = new JTextField(); + defaultServicoSaudeButton = new JButton("-"); + defaultServicoSaudeButton.addActionListener( new ActionListener(){ + public void actionPerformed( ActionEvent e ) + { + designacaoServicoSaudeText.setText( (String) Singleton.getInstance( SingletonConstants.COMPANY_NAME ) ); + } + } ); + + JLabel servicoHigieneLabel = new JLabel( "Servi\u00e7o de Higiene e Seguran\u00e7a: Tipo" ); + servicoHigieneTipoPanel = + new RadioButtonFixedPanel( new IDObject[]{ new MappableObject( new Integer(1), "Interno" ), + new MappableObject( new Integer(2), "Interempresas" ), + new MappableObject( new Integer(3), "Externo" ), + new MappableObject( new Integer(4), "Outro" ) }, + 1, 4, RadioButtonPanel.ORIENTATION_HORIZONTAL, false ); + JLabel designacaoLabel = new JLabel( "Designa\u00e7\u00e3o" ); + designacaoText = new JTextField(); + defaultServicoHigieneButton = new JButton("-"); + defaultServicoHigieneButton.addActionListener( new ActionListener(){ + public void actionPerformed( ActionEvent e ) + { + designacaoText.setText( (String) Singleton.getInstance( SingletonConstants.COMPANY_NAME ) ); + } + } ); + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 0, 1, 0, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridwidth = 1; + constraints.weightx = 0; + constraints.gridheight = 1; + constraints.weighty = 0; + + gridbag.setConstraints( designacaoSocialLabel, constraints ); + add( designacaoSocialLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( designacaoSocialText, constraints ); + add( designacaoSocialText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( estabelecimentoLabel, constraints ); + add( estabelecimentoLabel ); + + constraints.weightx = 0.6; + constraints.gridwidth = 3; + gridbag.setConstraints( estabelecimentoText, constraints ); + add( estabelecimentoText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( localidadeLabel, constraints ); + add( localidadeLabel ); + + constraints.weightx = 0.4; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( localidadeText, constraints ); + add( localidadeText ); + + constraints.weightx = 0; + constraints.gridwidth = 2; + gridbag.setConstraints( servicoSaudeLabel, constraints ); + add( servicoSaudeLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( servicoSaudeTipoPanel, constraints ); + add( servicoSaudeTipoPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( designacaoServicoSaudeLabel, constraints ); + add( designacaoServicoSaudeLabel ); + + JPanel designacaoServicoSaudePanel = new JPanel(); + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( designacaoServicoSaudePanel, constraints ); + add( designacaoServicoSaudePanel ); + + constraints.weightx = 0; + constraints.gridwidth = 3; + gridbag.setConstraints( servicoHigieneLabel, constraints ); + add( servicoHigieneLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( servicoHigieneTipoPanel, constraints ); + add( servicoHigieneTipoPanel ); + + constraints.gridwidth = 1; + constraints.weightx = 0; + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + gridbag.setConstraints( designacaoLabel, constraints ); + add( designacaoLabel ); + + JPanel designacaoServicoHigienePanel = new JPanel(); + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( designacaoServicoHigienePanel, constraints ); + add( designacaoServicoHigienePanel ); + + gridbag = new GridBagLayout(); + designacaoServicoSaudePanel.setLayout( gridbag ); + constraints.insets = new Insets( 0, 0, 0, 0 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridwidth = 1; + constraints.weightx = 1; + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + + gridbag.setConstraints( designacaoServicoSaudeText, constraints ); + designacaoServicoSaudePanel.add( designacaoServicoSaudeText ); + + constraints.weightx = 0; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( defaultServicoSaudeButton, constraints ); + designacaoServicoSaudePanel.add( defaultServicoSaudeButton ); + + + gridbag = new GridBagLayout(); + designacaoServicoHigienePanel.setLayout( gridbag ); + constraints.insets = new Insets( 0, 0, 0, 0 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridwidth = 1; + constraints.weightx = 1; + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + + gridbag.setConstraints( designacaoText, constraints ); + designacaoServicoHigienePanel.add( designacaoText ); + + constraints.weightx = 0; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( defaultServicoHigieneButton, constraints ); + designacaoServicoHigienePanel.add( defaultServicoHigieneButton ); + + new CopyPasteHandler( designacaoSocialText ); + new CopyPasteHandler( estabelecimentoText ); + new CopyPasteHandler( localidadeText ); + new CopyPasteHandler( designacaoServicoSaudeText ); + new CopyPasteHandler( designacaoText ); + } + + private void setupComponentsHashtable() + { + empresaComponents = new ComponentsHashtable(); + empresaComponents.putComponent( EmpresasData.DESIGNACAO_SOCIAL, designacaoSocialText ); + empresaComponents.putComponent( EmpresasData.SERVICO_SAUDE_TIPO, servicoSaudeTipoPanel ); + empresaComponents.putComponent( EmpresasData.SERVICO_SAUDE_DESIGNACAO, designacaoServicoSaudeText ); + empresaComponents.putComponent( EmpresasData.SERVICO_HIGIENE_TIPO, servicoHigieneTipoPanel ); + empresaComponents.putComponent( EmpresasData.SERVICO_HIGIENE_DESIGNACAO, designacaoText ); + + empresaComponents.putDummy( EmpresasData.MORADA ); + empresaComponents.putDummy( EmpresasData.CODIGO_POSTAL ); + empresaComponents.putDummy( EmpresasData.LOCALIDADE ); + empresaComponents.putDummy( EmpresasData.DISTRITO ); + empresaComponents.putDummy( EmpresasData.CONCELHO ); + empresaComponents.putDummy( EmpresasData.DATA_PROPOSTA ); + empresaComponents.putDummy( EmpresasData.DATA_ACEITACAO ); + empresaComponents.putDummy( EmpresasData.PERFIL_1 ); + empresaComponents.putDummy( EmpresasData.PERFIL_2 ); + empresaComponents.putDummy( EmpresasData.DATA_ENVIO_CONTRATO ); + empresaComponents.putDummy( EmpresasData.DATA_RECEPCAO_CONTRATO ); + empresaComponents.putDummy( EmpresasData.DATA_ENVIO_IDICT ); + empresaComponents.putDummy( EmpresasData.DATA_RELATORIO_ANUAL ); + empresaComponents.putDummy( EmpresasData.CODIGO_1 ); + empresaComponents.putDummy( EmpresasData.CODIGO_2 ); + empresaComponents.putDummy( EmpresasData.CODIGO_3 ); + empresaComponents.putDummy( EmpresasData.CAE ); + empresaComponents.putDummy( EmpresasData.ACTIVIDADE ); + empresaComponents.putDummy( EmpresasData.CONTRIBUINTE ); + empresaComponents.putDummy( EmpresasData.SEGURANCA_SOCIAL ); + empresaComponents.putDummy( EmpresasData.CONTACTO_1 ); + empresaComponents.putDummy( EmpresasData.CONTACTO_2 ); + empresaComponents.putDummy( EmpresasData.SERVICOS ); +// empresaComponents.putDummy( EmpresasData.PRECO_HIGIENE ); +// empresaComponents.putDummy( EmpresasData.PRECO_MEDICINA ); + empresaComponents.putDummy( EmpresasData.PERIODICIDADE ); + empresaComponents.putDummy( EmpresasData.DESIGNACAO_SOCIAL_PLAIN ); + empresaComponents.putDummy( EmpresasData.DATA_CANCELAMENTO ); + empresaComponents.putDummy( EmpresasData.A_CONSULTAS ); + empresaComponents.putDummy( EmpresasData.A_EXAMES ); + empresaComponents.putDummy( EmpresasData.B_CONSULTAS ); + empresaComponents.putDummy( EmpresasData.B_EXAMES ); + empresaComponents.putDummy( EmpresasData.INICIO_CONTRATO ); + empresaComponents.putDummy( EmpresasData.DURACAO ); + + estabelecimentoComponents = new ComponentsHashtable(); + estabelecimentoComponents.putComponent( EstabelecimentosData.NOME, estabelecimentoText ); + estabelecimentoComponents.putComponent( EstabelecimentosData.LOCALIDADE, localidadeText ); + estabelecimentoComponents.putDummy( EstabelecimentosData.MORADA ); + estabelecimentoComponents.putDummy( EstabelecimentosData.CODIGO_POSTAL ); + estabelecimentoComponents.putDummy( EstabelecimentosData.CONTACTO_ID ); + estabelecimentoComponents.putDummy( EstabelecimentosData.HISTORICO ); + estabelecimentoComponents.putDummy( EstabelecimentosData.EMPRESA_ID ); + estabelecimentoComponents.putDummy( EstabelecimentosData.NOME_PLAIN ); + +// components.putComponent( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.DESIGNACAO_SOCIAL, designacaoSocialText ); +// components.put( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.SERVICO_SAUDE_TIPO, servicoSaudeTipoPanel ); +// components.putComponent( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.SERVICO_SAUDE_DESIGNACAO, designacaoServicoSaudeText ); +// components.put( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.SERVICO_HIGIENE_TIPO, servicoHigieneTipoPanel ); +// components.putComponent( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.SERVICO_HIGIENE_DESIGNACAO, designacaoText ); +// +// components.putComponent( FichaDataProvider.T_ESTABELECIMENTOS + "." + FichaDataProvider.NOME, estabelecimentoText ); +// components.putComponent( FichaDataProvider.T_ESTABELECIMENTOS + "." + FichaDataProvider.LOCALIDADE, localidadeText ); +// +// components.putDummy( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.INACTIVO ); +// components.putDummy( FichaDataProvider.T_ESTABELECIMENTOS + "." + FichaDataProvider.EMPRESA_ID ); +// components.putDummy( FichaDataProvider.T_ESTABELECIMENTOS + "." + FichaDataProvider.INACTIVO ); + } + + public void fill(Object value) + { + clear(); + empresa = null; + estabelecimento = null; + if( value != null ) + { + Integer empresaID = (Integer)((Object[])value)[0]; + Integer estabelecimentoID = (Integer)((Object[])value)[1]; + if( empresaID != null ) + { + try + { + empresa = (EmpresasData)JDO.load( EmpresasData.class, empresaID ); + String names[] = (String[])empresaComponents.keySet().toArray( new String[0] ); + ComponentController.fill( names, empresa.getHashData(), empresaComponents ); + + if( estabelecimentoID != null ) + { + estabelecimento = (EstabelecimentosData)JDO.load( EstabelecimentosData.class, estabelecimentoID ); + names = (String[])estabelecimentoComponents.keySet().toArray( new String[0] ); //estabelecimento.getFieldNames(); + ComponentController.fill( names, estabelecimento.getHashData(), estabelecimentoComponents ); + } + +// DBField fields[] = provider.EMPRESAS.getInsertFields(); +// String empresaFields[] = new String[ fields.length ]; +// Hashtable data = new Hashtable(); +// for( int i = 0; i < empresaFields.length; ++i ) +// { +// empresaFields[ i ] = fields[ i ].FULL_NAME; +// Object fieldValue = empresa.getProperty( empresaFields[ i ] ); +// if( fieldValue != null ) +// { +// data.put( empresaFields[ i ], fieldValue ); +// } +// } +// ComponentController.fill( empresaFields, data, components ); +// if( estabelecimentoID != null ) +// { +// estabelecimento = provider.load( provider.ESTABELECIMENTOS, new DBKey( estabelecimentoID ) ); +// fields = provider.ESTABELECIMENTOS.getInsertFields(); +// String estabelecimentoFields[] = new String[ fields.length ]; +// for( int i = 0; i < estabelecimentoFields.length; ++i ) +// { +// estabelecimentoFields[ i ] = fields[ i ].FULL_NAME; +// Object fieldValue = estabelecimento.getProperty( estabelecimentoFields[ i ] ); +// if( fieldValue != null ) +// { +// data.put( estabelecimentoFields[ i ], fieldValue ); +// } +// } +// ComponentController.fill( estabelecimentoFields, data, components ); +// } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os dados da Empresa", true ); + } + } + } + else + { + estabelecimentoText.setText( "Sede" ); + } + } + + public Object save() + { + StringBuffer msg = new StringBuffer(); + boolean hasMsg = false; + try + { + if( estabelecimento == null ) + { +// estabelecimento = provider.createObject( provider.ESTABELECIMENTOS ); + estabelecimento = new EstabelecimentosData(); + } + if( empresa == null ) + { +// empresa = provider.createObject( provider.EMPRESAS ); + empresa = new EmpresasData(); + } +// DBField fields[] = provider.EMPRESAS.getInsertFields(); +// String empresaFields[] = new String[ fields.length ]; +// for( int i = 0; i < empresaFields.length; ++i ) +// { +// empresaFields[ i ] = fields[ i ].FULL_NAME; +// } +// Hashtable hash = new Hashtable(); +// ComponentController.save( empresaFields, hash, components ); +// Enumeration enum = hash.keys(); +// while( enum.hasMoreElements() ) +// { +// String name = ( String )enum.nextElement(); +// empresa.setProperty( name, hash.get( name ) ); +// } +// fields = provider.ESTABELECIMENTOS.getInsertFields(); +// String estabelecimentoFields[] = new String[ fields.length ]; +// for( int i = 0; i < estabelecimentoFields.length; ++i ) +// { +// estabelecimentoFields[ i ] = fields[ i ].FULL_NAME; +// } +// hash = new Hashtable(); +// ComponentController.save( estabelecimentoFields, hash, components ); +// enum = hash.keys(); +// while( enum.hasMoreElements() ) +// { +// String name = ( String )enum.nextElement(); +// estabelecimento.setProperty( name, hash.get( name ) ); +// } + + String names[] = (String[])empresaComponents.keySet().toArray( new String[0] ); +// String names[] = new String[]{ EmpresasData.DESIGNACAO_SOCIAL, EmpresasData.SERVICO_SAUDE_TIPO, +// EmpresasData.SERVICO_SAUDE_DESIGNACAO, EmpresasData.SERVICO_HIGIENE_TIPO, +// EmpresasData.SERVICO_HIGIENE_DESIGNACAO }; + Map hash = empresa.getHashData(); + ComponentController.save( names, hash, empresaComponents ); + empresa.setHashData( hash ); + +// names = estabelecimento.getFieldNames(); + names = (String[])estabelecimentoComponents.keySet().toArray( new String[0] ); + hash = estabelecimento.getHashData(); + ComponentController.save( names, hash, estabelecimentoComponents ); + estabelecimento.setHashData( hash ); + estabelecimento.setToEmpresa_id( empresa ); + +// estabelecimento.setProperty( provider.R_ESTABELECIMENTO_EMPRESA, empresa ); + +// if( ((String)empresa.getProperty( provider.DESIGNACAO_SOCIAL )).trim().length() == 0 ) + if( ((String)empresa.get( EmpresasData.DESIGNACAO_SOCIAL )).trim().length() == 0 ) + { + msg.append( "A empresa tem de ter uma design\u00e7\u00e3o social\n" ); + hasMsg = true; + } + else + { + empresa.set( EmpresasData.DESIGNACAO_SOCIAL_PLAIN, + com.evolute.utils.strings.StringPlainer.convertString( ( String ) + empresa.get( EmpresasData.DESIGNACAO_SOCIAL ) ) ); + } +// if( empresa.getProperty( provider.SERVICO_SAUDE_TIPO ) == null ) + if( empresa.get( EmpresasData.SERVICO_SAUDE_TIPO ) == null ) + { + msg.append( "A empresa tem de ter um tipo de seri\00e7o de sa\u00fade\n" ); + hasMsg = true; + } +// if( empresa.getProperty( provider.SERVICO_HIGIENE_TIPO ) == null ) + if( empresa.get( EmpresasData.SERVICO_HIGIENE_TIPO ) == null ) + { + msg.append( "A empresa tem de ter um tipo de seri\00e7o de higiene\n" ); + hasMsg = true; + } +// if( ((String)estabelecimento.getProperty( provider.NOME )).trim().length() == 0 ) + if( ((String)estabelecimento.get( EstabelecimentosData.NOME )).trim().length() == 0 ) + { + msg.append( "O estabelecimento tem de ter nome\n" ); + hasMsg = true; + } + + } + catch( Exception ex ) + { + ex.printStackTrace(); + return null; + } + if( hasMsg ) + { + throw new ValuesException( msg.toString() ); + } + return estabelecimento; + + } + + public void clear() + { + String names[] = (String[])empresaComponents.keySet().toArray( new String[0] ); + ComponentController.clear( names, empresaComponents ); + names = (String[])estabelecimentoComponents.keySet().toArray( new String[0] ); + ComponentController.clear( names, estabelecimentoComponents ); + estabelecimentoText.setText( "Sede" ); + empresa = null; + estabelecimento = null; + } + + public void setEnabled( boolean enable ) + { + String names[] = (String[])empresaComponents.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, empresaComponents ); + names = (String[])estabelecimentoComponents.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, estabelecimentoComponents ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ExamePDF.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ExamePDF.java new file mode 100644 index 00000000..61f934fb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ExamePDF.java @@ -0,0 +1,524 @@ +package siprp.ficha; + +import java.awt.Color; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.HashMap; + +import siprp.SingletonConstants; + +import com.evolute.utils.Singleton; +import com.lowagie.text.Cell; +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.Element; +import com.lowagie.text.Font; +import com.lowagie.text.FontFactory; +import com.lowagie.text.PageSize; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Phrase; +import com.lowagie.text.Table; +import com.lowagie.text.pdf.BaseFont; +import com.lowagie.text.pdf.PdfWriter; + +public class ExamePDF implements FichaAptidaoConstants +{ + private final Font FONT_BOLD = FontFactory.getFont( "Arial", 8, Font.BOLD ); + private final Font FONT_NORMAL = FontFactory.getFont( "Arial", 8, Font.NORMAL ); + private final Font FONT_ZAPFDINGBATS = new Font( Font.ZAPFDINGBATS , 12, Font.NORMAL, new Color( 0, 0, 0 ) ); + + private BaseFont BASE_WINGDINGS; + private Font FONT_WINGDINGS; + +// static +// { +// try +// { +// //BASE_WINGDINGS = BaseFont.createFont("C:\\WINNT\\Fonts\\WINGDING.TTF", BaseFont.CP1252, BaseFont.NOT_EMBEDDED); +// BASE_WINGDINGS = BaseFont.createFont("WingDings", BaseFont.CP1252, BaseFont.EMBEDDED); +// InputStream stream = BaseFont.getResourceStream( "WING", ClassLoader loader) +// BASE_WINGDINGS = BaseFont.createFont("WingDings", BaseFont.CP1252, BaseFont.EMBEDDED, +// true, byte[] ttfAfm, null ); +// FONT_WINGDINGS = new Font(BASE_WINGDINGS, 12); +// } +// catch( Exception ex ) +// { +// FONT_WINGDINGS = FONT_NORMAL; +// System.out.println( "NO FONT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ); +// } +// } + + public ExamePDF() + { + FontFactory.registerDirectories(); + String possibleNames[] = new String[]{ "Wingdings", "WingDings", "wingdings", "WINGDINGS" }; + + for( int n = 0; n < 4; n++ ) + { + FONT_WINGDINGS = FontFactory.getFont( possibleNames[ n ] ); + if( FONT_WINGDINGS.getFamilyname().toLowerCase().equals( "wingdings" ) ) + { + break; + } + } + + } + + public static void main( String[] args ) + { + try + { + HashMap ht = new HashMap(); + // designacao_social + // estabelecimentos.nome + // estabelecimentos.localidade + // servico_saude_tipo_interno + // servico_saude_tipo_interempresas + // servico_saude_tipo_externo + // servico_saude_tipo_sns + // servico_saude_designacao + // servico_higiene_tipo_interno + // servico_higiene_tipo_interempresas + // servico_higiene_tipo_externo + // servico_higiene_outro + // servico_higiene_designacao + // trabalhadores.nome + // sexo + // data_nascimento + // nacionalidade + // numero_mecanografico + // data_admissao + // categoria + // local_trabalho + // funcao_proposta + // data_admissao_funcao + // observacoes + // exames.data + // tipo_admissao + // tipo_periodico + // tipo_ocasional + // tipo_apos_doenca + // tipo_apos_acidente + // tipo_pedido_trabalhador + // tipo_pedido_empresa + // tipo_mudanca_funcao + // tipo_trabalho + // tipo_outro + // resultado_apto + // resultado_apto_condicionalmente + // resultado_inapto_temp + // resultado_inapto_def + // outra_funcao_1 + // outra_funcao_2 + // outra_funcao_3 + // outra_funcao_4 + // proximo_exame + // outras_recomendacoes + // medicos.nome + // numero_cedula + + ht.put( TRABALHADORES_NOME, "Trabalhador do com\u00e9rcio" ); + ht.put( SERVICO_SAUDE_DESIGNACAO, "Designacao servico saude" ); + ht.put( SERVICO_SAUDE_TIPO_EXTERNO, "" + Boolean.TRUE ); + ht.put( TIPO_PERIODICO, "" + Boolean.TRUE ); + ht.put( RESULTADO_INAPTO_TEMP, "" + Boolean.TRUE ); + FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + "\\report.pdf" ); + fos.write( new ExamePDF().createPDF( ht ) ); + fos.close(); + System.out.println( "File saved." ); + Process proc = Runtime.getRuntime().exec( "cmd.exe /c \"" + System.getProperty( "user.home" ) + "\\report.pdf\"" ); + proc.waitFor(); + new File( System.getProperty( "user.home" ) + "\\report.pdf" ).delete(); + System.out.println( "Done." ); + } + catch( Exception e ) + { + e.printStackTrace(); + } + } + + public void print( byte []pdf, String nome ) + throws Exception + { +// new PDFFilePrinter( pdf, false ); + +// if( true ) +// { +// return; +// } + + long time = System.currentTimeMillis(); +// FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + "report_ficha" + time + ".pdf" ); + FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf" ); + fos.write( pdf ); + fos.close(); + System.out.println( "File saved ( " + nome + "_" + time + " )." ); + Process proc; + if( System.getProperty( "os.name" ).startsWith( "Windows" ) ) + { +//System.out.println( "cmd.exe /c \"" + System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + "report_ficha.pdf\"" ); + proc = Runtime.getRuntime().exec( "cmd.exe /c \"" + System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf\"" ); + +// proc = Runtime.getRuntime().exec( new String[]{ System.getProperty( "user.home" ) + "\\open.bat", System.getProperty( "user.home" ) + "\\" + nome + "_" + time + ".pdf" }); + + + proc.waitFor(); + if( !new File( System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf" ).delete() ) + { + System.err.println( "File: report_ficha" + time + ".pdf - NOT DELETED" ); + } + } + else + { +//System.out.println( "/usr/bin/open \"" + System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + "report_ficha.pdf\"" ); + try{ + proc = Runtime.getRuntime().exec( new String[]{"/usr/bin/open", "" + System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf" } ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } +// proc = Runtime.getRuntime().exec( "/usr/bin/open \"/Users/Shared/teste.pdf.pdf\"" ); + } + } + + public void printSilent( byte []pdf, String nome, String printerName ) throws InterruptedException, IOException + // throws Exception + { + long time = System.currentTimeMillis(); +// FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + "report_ficha" + time + ".pdf" ); + + if( System.getProperty( "os.name" ).startsWith( "Windows" ) ) + { + Process proc; + +// FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + "\\print_fichas_temp\\" + nome + "_" + time + ".pdf" ); + FileOutputStream fos = new FileOutputStream( "c:\\temp\\" + nome + "_" + time + ".pdf" ); + fos.write( pdf ); + fos.close(); + + System.out.println( "File saved ( " + nome + "_" + time + " )." ); +//System.out.println("cmd /c \"c:\\temp\\acrord32.lnk /t \"c:" + System.getProperty( "file.separator" ) + "temp" + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf\" \"" + printerName + "\"\""); +// proc = Runtime.getRuntime().exec( new String[]{ System.getProperty( "user.home" ) + "\\print.bat", +// System.getProperty( "user.home" ) + "\\print_fichas_temp\\" + nome + "_" + time + ".pdf", +// printerName }); + proc = Runtime.getRuntime().exec( new String[]{ System.getProperty( "user.home" ) + "\\print.bat", + "c:\\temp\\" + nome + "_" + time + ".pdf", + printerName }); + proc.waitFor(); +// if( !new File( "c:\\temp\\" + nome + "_" + time + ".pdf" ).delete() ) +// { +// System.err.println( "File: " + nome + "_" + ".pdf - NOT DELETED" ); +// } + } + + } + + public void cleanSilentPrint() + throws Exception + { + Process proc; + proc = Runtime.getRuntime().exec( "cmd /c \"del c:\\temp\\*.pdf\"" ); + proc.waitFor(); + } + + public byte[] createPDF( HashMap values ) + { + Document document = new Document(); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + document.setPageSize( PageSize.A4 ); + try { + PdfWriter pdfw = PdfWriter.getInstance( document, bos ); +// try { + + + document.addTitle( "Ficha de Aptid\u00e3o" ); + String acronym = (String) Singleton.getInstance( SingletonConstants.COMPANY_ACRONYM ); + document.addAuthor( acronym != null ? acronym: "n/a" ); + document.addCreator( "Evolute" ); + + document.open(); + + Paragraph conteudo = new Paragraph(); + + conteudo.add( new Chunk( "\n\nFICHA DE APTID\u00c3O\n", + FontFactory.getFont( "Arial", 10, Font.BOLD ) ) ); + conteudo.add( new Chunk( "(Portaria n.\u00ba 299/2007, de 16 de Mar\u00e7o)", +// conteudo.add( new Chunk( "(Portaria n\u00ba1031/2002, de 10 de Agosto)", + FontFactory.getFont( "Arial", 7, Font.BOLD ) ) ); + + conteudo.setAlignment( Element.ALIGN_CENTER ); + + document.add( conteudo ); + + Table table = new Table( 1 ); + table.setBorderWidth( 1 ); + table.setPadding( 5 ); + table.setOffset( 0 ); + table.setWidth( 100 ); + + table.addCell( new Phrase( "Empresa/Entidade", FONT_BOLD ) ); + + StringBuilder texto = new StringBuilder(); + Phrase ph = new Phrase( 12f ); + + Cell cell = new Cell(); + texto.append( "DESIGNA\u00c7\u00c3O SOCIAL: " + values.get( DESIGNACAO_SOCIAL ) + "\n" ); + texto.append( "ESTABELECIMENTO: " + values.get( ESTABELECIMENTOS_NOME ) + + " LOCALIDADE: " + values.get( ESTABELECIMENTOS_LOCALIDADE ) + "\n" ); + texto.append( "SERVI\u00c7O DE SA\u00DaDE: Tipo " ); + ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); + + texto = new StringBuilder( "Interno" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_SAUDE_TIPO_INTERNO ) ) ); + + texto = new StringBuilder( "Interempresas" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_SAUDE_TIPO_INTEREMPRESAS ), true ) ); + + texto = new StringBuilder( "Externo" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_SAUDE_TIPO_EXTERNO ), true ) ); + + texto = new StringBuilder( "Servi\u00e7o Nacional de Sa\u00fade\n" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_SAUDE_TIPO_SNS ), true ) ); + + texto = new StringBuilder(); + + texto.append( "DESIGNA\u00c7\u00c3O: " + values.get( SERVICO_SAUDE_DESIGNACAO ) + "\n" ); + texto.append( "SERVI\u00c7O DE HIGIENE E SEGURAN\u00c7A: Tipo " ); + ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); + + texto = new StringBuilder( "Interno" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_HIGIENE_TIPO_INTERNO ) ) ); + + texto = new StringBuilder( "Interempresas" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_HIGIENE_TIPO_INTEREMPRESAS ), true ) ); + + texto = new StringBuilder( "Externo" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_HIGIENE_TIPO_EXTERNO ), true ) ); + + texto = new StringBuilder( "Outro\n" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_HIGIENE_TIPO_OUTRO ), true ) ); + + texto = new StringBuilder(); + + texto.append( "DESIGNA\u00c7\u00c3O: " + values.get( SERVICO_HIGIENE_DESIGNACAO ) + "" ); + + ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); + + cell.addElement( ph ); + table.addCell( cell ); + document.add( table ); + + table = new Table( 1 ); + table.setBorderWidth( 1 ); + table.setPadding( 5 ); + table.setOffset( 0 ); + table.setWidth( 100 ); + + table.addCell( new Phrase( "Trabalhador", + FONT_BOLD ) ); + + texto = new StringBuilder(); + + texto.append( "NOME: " + values.get( TRABALHADORES_NOME ) + "\n" ); + texto.append( "SEXO: " + values.get( SEXO ) + " DATA DE NASCIMENTO: " + + values.get( DATA_NASCIMENTO ) + " NACIONALIDADE: " + + values.get( NACIONALIDADE ) + "\n" ); + texto.append( "N\u00daMERO MECANOGR\u00c1FICO/OUTRO: " + values.get( NUMERO_MECANOGRAFICO ) + + " DATA DE ADMISS\u00c3O: " + values.get( DATA_ADMISSAO ) + "\n" ); + texto.append( "CATEGORIA PROFISSIONAL: " + values.get( CATEGORIA ) + + " LOCAL DE TRABALHO: " + values.get( LOCAL_TRABALHO ) + "\n" ); + texto.append( "FUN\u00c7\u00c3O PROPOSTA: " + values.get( FUNCAO_PROPOSTA ) + + " DATA DE ADMISS\u00c3O NA FUN\u00c7\u00c3O: " + + values.get( DATA_ADMISSAO_FUNCAO ) + "" ); + + table.addCell( new Phrase( 12f, texto.toString(), FONT_NORMAL ) ); + document.add( table ); + + table = new Table( 1 ); + table.setBorderWidth( 1 ); + table.setOffset( 0 ); + table.setPadding( 5 ); + table.setWidth( 100 ); + + table.addCell( new Phrase( "Observa\u00e7\u00f5es", + FONT_BOLD ) ); + + texto = new StringBuilder(); + texto.append( values.get( OBSERVACOES ) ); + + table.addCell( new Phrase( 12f, texto.toString(), FONT_NORMAL ) ); + document.add( table ); + + table = new Table( 2 ); + table.setBorderWidth( 1 ); + table.setOffset( 0 ); + table.setPadding( 5 ); + table.setWidth( 100 ); + + cell = new Cell( new Phrase( "Exame M\u00e9dico", + FONT_BOLD ) ); + + cell.setColspan( 2 ); + table.addCell( cell ); + + texto = new StringBuilder(); + ph = new Phrase( 12f ); + texto.append( "DATA DO EXAME: " + values.get( EXAMES_DATA ) + "\n" ); + texto.append( "TIPO\n" ); + ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); + + ph.add( doCheckedPhrase( "ADMISS\u00c3O\n", values.get( TIPO_ADMISSAO ) ) ); + + ph.add( doCheckedPhrase( "PERI\u00d3DICO\n", values.get( TIPO_PERIODICO ) ) ); + + ph.add( doCheckedPhrase( "OCASIONAL\n", values.get( TIPO_OCASIONAL ) ) ); + + ph.add( doCheckedPhrase( "AP\u00d3S DOEN\u00c7A\n", values.get( TIPO_APOS_DOENCA ), true ) ); + + ph.add( doCheckedPhrase( "AP\u00d3S ACIDENTE\n", values.get( TIPO_APOS_ACIDENTE ), true ) ); + + ph.add( doCheckedPhrase( "A PEDIDO DO TRABALHADOR\n", values.get( TIPO_PEDIDO_TRABALHADOR ), true ) ); + + ph.add( doCheckedPhrase( "A PEDIDO DO SERVI\u00c7O\n", values.get( TIPO_PEDIDO_EMPRESA ), true ) ); + + ph.add( doCheckedPhrase( "POR MUDAN\u00c7A DE FUN\u00c7\u00c3O\n", values.get( TIPO_MUDANCA_FUNCAO ), true ) ); + + ph.add( doCheckedPhrase( "POR ALTERA\u00c7\u00c3O DAS CONDI\u00c7\u00d5ES DE TRABALHO\n", values.get( TIPO_TRABALHO ), true ) ); + + ph.add( doCheckedPhrase( "OUTRO\n", values.get( TIPO_OUTRO ), true ) ); + + texto = new StringBuilder(); + texto.append( " ESPECIFIQUE: " + values.get( TIPO_OUTRO_TEXTO ) ); + + ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); + + table.addCell( ph ); + + ph = new Phrase( 12f ); + ph.add( new Chunk( "RESULTADO\n", FONT_NORMAL ) ); + ph.add( doCheckedPhrase( "APTO\n", values.get( RESULTADO_APTO ) ) ); + + ph.add( doCheckedPhrase( "APTO CONDICIONALMENTE\n\n", values.get( RESULTADO_APTO_CONDICIONALMENTE ) ) ); + + ph.add( doCheckedPhrase( "INAPTO TEMPORARIAMENTE\n", values.get( RESULTADO_INAPTO_TEMP ) ) ); + + ph.add( doCheckedPhrase( "INAPTO DEFINITIVAMENTE\n\n", values.get( RESULTADO_INAPTO_DEF ) ) ); + + texto = new StringBuilder(); + texto.append( "OUTRAS FUN\u00c7\u00d5ES QUE PODE DESEMPENHAR\n" ); + texto.append( " 1 " + values.get( OUTRA_FUNCAO_1 ) + "\n" ); + texto.append( " 2 " + values.get( OUTRA_FUNCAO_2 ) + "\n" ); + texto.append( " 3 " + values.get( OUTRA_FUNCAO_3 ) + "\n" ); + texto.append( " 4 " + values.get( OUTRA_FUNCAO_4 ) + "\n" ); + ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); + table.addCell( ph ); + + document.add( table ); + + table = new Table( 1 ); + table.setBorderWidth( 1 ); + table.setOffset( 0 ); + table.setPadding( 5 ); + table.setWidth( 100 ); + + table.addCell( new Phrase( "Outras Recomenda\u00e7\u00f5es", + FONT_BOLD ) ); + + texto = new StringBuilder(); + if( ( (Boolean) Singleton.getInstance( SingletonConstants.FICHA_MARCA_EXAMES ) ).booleanValue() ) + { + System.out.println( "ficha marca exames" ); + texto.append( "PR\u00d3XIMO EXAME: " + values.get( PROXIMO_EXAME ) + "\n" ); + } + texto.append( "" + values.get( OUTRAS_RECOMENDACOES ) + "" ); + + table.addCell( new Phrase( 12f, texto.toString(), FONT_NORMAL ) ); + document.add( table ); + + + table = new Table( 1 ); + table.setBorderWidth( 1 ); + table.setOffset( 0 ); + table.setPadding( 5 ); + table.setWidth( 100 ); + + texto = new StringBuilder(); + + texto.append( "M\u00c9DICO DO TRABALHO: " + + values.get( MEDICOS_NOME ) + " C.P. " + values.get( NUMERO_CEDULA ) + "\n" ); + texto.append( "ASSINATURA _____________________________________________________________________________________\n\n" ); + texto.append( "TOMEI CONHECIMENTO ___________________________________________________________ DATA:____/____/________\n" ); + texto.append( " O RESPONS\u00c1VEL DOS RECURSOS HUMANOS" ); + + table.addCell( new Phrase( 18f, texto.toString(), FONT_NORMAL ) ); + document.add( table ); + +// } +// catch( Exception e ) { +// e.printStackTrace(); +// return null; +// } + + document.close(); +// PdfWriter pdfw = PdfWriter.getInstance( document, bos ); +// PdfContentByte pdfcb = new PdfContentByte( pdfw ); +// +// PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); +// // Step 2: Obtain a print job. +// PrinterJob pj = PrinterJob.getPrinterJob(); +// Graphics2D graphics = pdfcb.createPrinterGraphics( 100.0F, 100.0F, pj ); +// // Step 3: Find print services. +// PrintService []services = PrinterJob.lookupPrintServices(); +// PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService(); +// if(services.length > 0) +// { +// System.out.println("selected printer: " + services[0]); +// try +// { +// PrintService service = defaultService; +//// PrintService service = ServiceUI.printDialog(null, 200, 200, +//// services, defaultService, DocFlavor.SERVICE_FORMATTED.PAGEABLE, aset); +// pj.setPrintService(service); +// // Step 2: Pass the settings to a page dialog and print dialog. +//// pj.pageDialog(aset); +//// if (pj.printDialog(aset)) +//// { +// // Step 4: Update the settings made by the user in the dialogs. +// // Step 5: Pass the final settings into the print request. +// pj.print(aset); +//// } +// } +// catch (PrinterException pe ) { +// System.err.println(pe); +// } +// } + + } + catch( Exception e ) { + e.printStackTrace(); + return null; + } + return bos.toByteArray(); + } + + private Phrase doCheckedPhrase( String text, String phrase, boolean indent ) + { + boolean checked = CHECKED.equals( phrase ); + Phrase p = new Phrase( 12f ); + //p.add( new Chunk( ( indent ? " " : "" ) + ( char )( checked? 110: 111) + " ", FONT_ZAPFDINGBATS ) ); + //System.out.println( "FAMILY: " + FONT_WINGDINGS.getFamilyname() ); + p.add( new Chunk( ( indent ? " " : "" ) + ( char )( checked? 0xfe: 0xa8), FONT_WINGDINGS ) ); +// p.add( new Chunk( ( indent ? " " : "" ) + ( char )( checked? 'X': '_'), FONT_WINGDINGS ) ); + p.add( new Chunk( text, FONT_NORMAL ) ); + return p; + } + + private Phrase doCheckedPhrase( String text, String phrase ) + { + return doCheckedPhrase( text, phrase, false ); + } +} \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ExamePanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ExamePanel.java new file mode 100644 index 00000000..9ada0a17 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ExamePanel.java @@ -0,0 +1,573 @@ +/* + * ExamePanel.java + * + * Created on 29 de Marco de 2004, 11:57 + */ + +package siprp.ficha; + +import java.awt.BorderLayout; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.Insets; +import java.util.Calendar; +import java.util.Date; +import java.util.Hashtable; +import java.util.Vector; + +import javax.swing.BorderFactory; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.ListSelectionListener; + +import siprp.FichaDataProvider; +import siprp.MedicinaConstants; +import siprp.SingletonConstants; +import siprp.data.Marcacao; +import siprp.data.outer.ExamesData; +import siprp.data.outer.MarcacoesTrabalhadorData; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.dataui.ComponentController; +import com.evolute.utils.dataui.ComponentsHashtable; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.documents.MaximumLengthDocument; +import com.evolute.utils.ui.button.BetterButtonGroup; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import com.evolute.utils.ui.panel.RadioButtonFixedPanel; +import com.evolute.utils.ui.text.CopyPasteHandler; +/** + * + * @author fpalma + */ +public class ExamePanel extends JPanel + implements ChangeListener, ControllableComponent, ListSelectionListener +{ + + private ProviderInterface JDO; + + private JCalendarPanel dataExamePanel; + private BetterButtonGroup tipoGroup; + private JRadioButton admissaoRadio; + private JRadioButton periodicoRadio; + private JRadioButton ocasionalRadio; +// private JRadioButton outroRadio; + private RadioButtonFixedPanel ocasionalPanel; + private JTextField especificarText; + private RadioButtonFixedPanel tipoProximoPanel; + private JCalendarPanel proximoExamePanel; + private RadioButtonFixedPanel resultadoPanel; + private JTextField outrasFuncoesTexts[]; + private JTextArea recomendacoesText; + + private FichaDataProvider provider; + private ComponentsHashtable components; + + private Integer trabalhadorID; + private MarcacoesTrabalhadorData marcacao; + + /** Creates a new instance of ExamePanel */ + public ExamePanel() + throws Exception + { + provider = (FichaDataProvider)FichaDataProvider.getProvider(); + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + { + setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Exame M\u00e9dico" ) ); + + JPanel leftPanel = new JPanel(); + JPanel rightPanel = new JPanel(); + JPanel dataExameOuterPanel = new JPanel(); + JLabel dataExameLabel = new JLabel( "Data do Exame" ); + dataExamePanel = new JCalendarPanel( null ); + JPanel tipoPanel = new JPanel(); + tipoPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Tipo" ) ); + tipoGroup = new BetterButtonGroup( false ); + admissaoRadio = new JRadioButton( "Admiss\u00e3o" ); + tipoGroup.add( admissaoRadio ); + periodicoRadio = new JRadioButton( "Peri\u00f3dico" ); + tipoGroup.add( periodicoRadio ); + ocasionalRadio = new JRadioButton( "Ocasional" ); + tipoGroup.add( ocasionalRadio ); + ocasionalRadio.addChangeListener( this ); +// outroRadio = new JRadioButton( "Outro" ); +// tipoGroup.add( outroRadio ); +// outroRadio.addChangeListener( this ); + ocasionalPanel = new RadioButtonFixedPanel( + new IDObject[]{ new MappableObject( new Integer( 1 ), "Ap\u00f3s doen\u00e7a" ), + new MappableObject( new Integer( 2 ), "Ap\u00f3s acidente" ), + new MappableObject( new Integer( 3 ), "A pedido do trabalhador" ), + new MappableObject( new Integer( 4 ), "A pedido do servi\u00e7o" ), + new MappableObject( new Integer( 5 ), "Por mudan\u00e7a de fun\u00e7\u00e3o" ), + new MappableObject( new Integer( 6 ), "Por altera\u00e7\u00e3o das condi\u00e7\u00f5es de trabalho" ), + new MappableObject( new Integer( 10 ), "Outro" ) }, + false ); + ocasionalPanel.addListSelectionListener( this ); + ocasionalPanel.setEnabled( false ); + especificarText = new JTextField(); + especificarText.setEnabled( false ); + JPanel proximoExameOuterPanel = new JPanel(); + proximoExameOuterPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Pr\u00f3ximo Exame" ) ); + proximoExamePanel = new JCalendarPanel( null ); + tipoProximoPanel = new RadioButtonFixedPanel( + new IDObject[]{ new MappableObject( new Integer( 2 ), "Peri\u00f3dico" ), + new MappableObject( new Integer( 3 ), "Ocasional" ) }, + RadioButtonFixedPanel.ORIENTATION_HORIZONTAL, 1, 2, false ); +// JLabel proximoExameLabel = new JLabel( "Pr\u00f3ximo Exame" ); + + JPanel resultadoOuterPanel = new JPanel(); + resultadoOuterPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Resultado" ) ); + resultadoPanel = new RadioButtonFixedPanel( + new IDObject[]{ new MappableObject( new Integer( 1 ), "Apto" ), + new MappableObject( new Integer( 2 ), "Apto condicionalmente" ), + new MappableObject( new Integer( 3 ), "Inapto temporariamente" ), + new MappableObject( new Integer( 4 ), "Inapto definitivamente" ) }, + false ); + JLabel outrasFuncoesLabel = new JLabel( "Outras fun\u00e7\u00f5es que pode desempenhar", JLabel.CENTER ); + JPanel outrasFuncoesPanel = new JPanel(); + JLabel outrasFuncoesLabels[] = new JLabel[ 4 ]; + outrasFuncoesTexts = new JTextField[ 4 ]; + for( int n = 0; n < 4; n++ ) + { + outrasFuncoesLabels[ n ] = new JLabel( "" + ( n + 1 ) ); + outrasFuncoesTexts[ n ] = new JTextField(); + } + JScrollPane recomendacoesScp = new JScrollPane(); + recomendacoesScp.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + recomendacoesScp.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + recomendacoesText = new JTextArea(); + recomendacoesText.setLineWrap( true ); + recomendacoesText.setWrapStyleWord( true ); + recomendacoesText.setDocument( new MaximumLengthDocument( 300 ) ); + recomendacoesScp.setViewportView( recomendacoesText ); + recomendacoesScp.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Outras recomenda\u00e7\u00f5es" ) ); + + setLayout( new GridLayout( 1, 2 ) ); + add( leftPanel ); + add( rightPanel ); + + leftPanel.setLayout( new BorderLayout() ); + + dataExameOuterPanel.setLayout( new BorderLayout() ); + dataExameOuterPanel.add( dataExameLabel, BorderLayout.WEST ); + dataExameOuterPanel.add( dataExamePanel, BorderLayout.CENTER ); + leftPanel.add( dataExameOuterPanel, BorderLayout.NORTH ); + leftPanel.add( tipoPanel, BorderLayout.CENTER ); + proximoExameOuterPanel.setLayout( new BorderLayout() ); +// proximoExameOuterPanel.add( proximoExameLabel, BorderLayout.WEST ); + proximoExameOuterPanel.add( proximoExamePanel, BorderLayout.CENTER ); + proximoExameOuterPanel.add( tipoProximoPanel, BorderLayout.SOUTH ); + if( ( ( Boolean ) Singleton.getInstance( SingletonConstants.FICHA_MARCA_EXAMES ) ).booleanValue() ) + { + leftPanel.add( proximoExameOuterPanel, BorderLayout.SOUTH ); + } + + GridBagLayout gridbag = new GridBagLayout(); + tipoPanel.setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 0, 1, 0, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + + gridbag.setConstraints( admissaoRadio, constraints ); + tipoPanel.add( admissaoRadio ); + + gridbag.setConstraints( periodicoRadio, constraints ); + tipoPanel.add( periodicoRadio ); + + gridbag.setConstraints( ocasionalRadio, constraints ); + tipoPanel.add( ocasionalRadio ); + + constraints.weightx = 0.1; + constraints.gridwidth = 1; + JPanel pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + tipoPanel.add( pad ); + + constraints.weightx = 0.9; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( ocasionalPanel, constraints ); + tipoPanel.add( ocasionalPanel ); + +// constraints.weightx = 0; +// constraints.gridwidth = 1; +// gridbag.setConstraints( outroRadio, constraints ); +// tipoPanel.add( outroRadio ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( especificarText, constraints ); + tipoPanel.add( especificarText ); + + + gridbag = new GridBagLayout(); + rightPanel.setLayout( gridbag ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + constraints.weighty = 0; + + gridbag.setConstraints( resultadoOuterPanel, constraints ); + rightPanel.add( resultadoOuterPanel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + //constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.weighty = 1; +// JPanel recomendacoesOuterPanel = new JPanel(); +// recomendacoesOuterPanel.setLayout( new GridLayout( 1, 1 ) ); +// recomendacoesOuterPanel.add( recomendacoesScp ); + gridbag.setConstraints( recomendacoesScp, constraints ); + rightPanel.add( recomendacoesScp ); + + gridbag = new GridBagLayout(); + resultadoOuterPanel.setLayout( gridbag ); + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + constraints.weighty = 0; + + gridbag.setConstraints( resultadoPanel, constraints ); + resultadoOuterPanel.add( resultadoPanel ); + + gridbag.setConstraints( outrasFuncoesLabel, constraints ); + resultadoOuterPanel.add( outrasFuncoesLabel ); + + gridbag.setConstraints( outrasFuncoesPanel, constraints ); + resultadoOuterPanel.add( outrasFuncoesPanel ); + + for( int n = 0; n < outrasFuncoesTexts.length; n++ ) + { + constraints.weightx = 0.1; + constraints.gridwidth = 1; + pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + resultadoOuterPanel.add( pad ); + + constraints.weightx = 0; + gridbag.setConstraints( outrasFuncoesLabels[ n ], constraints ); + resultadoOuterPanel.add( outrasFuncoesLabels[ n ] ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( outrasFuncoesTexts[ n ], constraints ); + resultadoOuterPanel.add( outrasFuncoesTexts[ n ] ); + new CopyPasteHandler( outrasFuncoesTexts[ n ] ); + } + + new CopyPasteHandler( especificarText ); + new CopyPasteHandler( recomendacoesText ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putDummy( ExamesData.TIPO ); + components.putComponent( ExamesData.DATA, dataExamePanel ); + components.putComponent( ExamesData.OCASIONAL, ocasionalPanel ); + components.putComponent( ExamesData.OUTRO_TIPO, especificarText ); + components.putComponent( ExamesData.PROXIMO_EXAME, proximoExamePanel ); + components.putComponent( ExamesData.RESULTADO, resultadoPanel ); + components.putComponent( ExamesData.OUTRA_FUNCAO_1, outrasFuncoesTexts[ 0 ] ); + components.putComponent( ExamesData.OUTRA_FUNCAO_2, outrasFuncoesTexts[ 1 ] ); + components.putComponent( ExamesData.OUTRA_FUNCAO_3, outrasFuncoesTexts[ 2 ] ); + components.putComponent( ExamesData.OUTRA_FUNCAO_4, outrasFuncoesTexts[ 3 ] ); + components.putComponent( ExamesData.OUTRAS_RECOMENDACOES, recomendacoesText ); + components.putDummy( ExamesData.INACTIVO ); + components.putDummy( ExamesData.TRABALHADOR_ID ); + components.putDummy( ExamesData.MEDICO_ID ); + components.putDummy( ExamesData.PDF ); + components.putDummy( ExamesData.FO ); + } + + public void stateChanged( ChangeEvent e ) + { + if( e.getSource().equals( ocasionalRadio ) ) + { + ocasionalPanel.setEnabled( ocasionalRadio.isSelected() && ocasionalRadio.isEnabled() ) ; + } +// else if( e.getSource().equals( outroRadio ) ) +// { +// especificarText.setEnabled( outroRadio.isSelected() && outroRadio.isEnabled() ); +// } + } + + + public void fill( Object value ) + { + clear(); + trabalhadorID = ( Integer ) value; + if( trabalhadorID == null ) + { + return; + } + try + { + Integer marcacaoID = provider.getMarcacaoIDByTrabalhador( trabalhadorID ); + + if( marcacaoID != null ) + { + marcacao = ( MarcacoesTrabalhadorData ) JDO.load( MarcacoesTrabalhadorData.class, marcacaoID ); + proximoExamePanel.setDate( (Date) marcacao.get( Marcacao.DATA ) ); + } + Object dadosMarcacao[] = provider.getDadosUltimaMarcacao( trabalhadorID ); + if( dadosMarcacao != null ) + { + dataExamePanel.setDate( ( Date ) dadosMarcacao[ 0 ] ); + Integer tipo = ( Integer ) dadosMarcacao[ 1 ]; + int tipoValue = tipo != null ? tipo.intValue() : 0; + tipoGroup.setIntSelected( tipoValue > 0 ? tipoValue - 1 : 0 ); + } + + } + catch( Exception ex ) + { + ex.printStackTrace(); + return; + } + +// Integer trabID = (Integer) value; +// if( trabID == null ) +// { +// return; +// } +// try +// { +// Integer id = provider.getLastExameIDForTrabalhador( trabID ); +// if( id == null ) +// { +// return; +// } +// MetaObject exame = provider.load( provider.EXAMES, new DBKey( id ) ); +// byte pdf[] = (byte []) exame.getProperty( provider.PDF ); +// if( pdf != null ) +// { +// FileOutputStream fos = new FileOutputStream( "C:\\teste.pdf" ); +// fos.write( pdf ); +// fos.close(); +// } +// } +// catch( Exception ex ) +// { +// ex.printStackTrace(); +// return; +// } + } + + public Object save() + { + StringBuffer msg = new StringBuffer(); + boolean hasMsg = false; + boolean hasData = false; + ExamesData exame; + Date dataExame = dataExamePanel.getDate(); + if( dataExame == null ) + { + dataExame = new Date(); + } + Calendar cal = Calendar.getInstance(); + cal.add( Calendar.DAY_OF_MONTH, 1 ); + if( !cal.getTime().after( dataExame ) ) + { + throw new ValuesException( "N\u00E3o \u00E9 poss\u00EDvel gravar exames com datas futuras." ); + } + try + { + String recomendacoes = recomendacoesText.getText(); + String linhas[] = recomendacoes.split( "\\n" ); + Vector linhasV = new Vector(); + for( int n = 0; n < linhas.length; n++ ) + { + if( linhas[ n ].trim().length() > 0 ) + { + linhasV.add( linhas[ n ] ); + } + } + if( linhasV.size() > 0 ) + { + linhas = ( String[] ) linhasV.toArray( new String[0] ); + boolean compress = false; + if( linhas.length == 2 ) + { + linhas[ 0 ] += " "; + } + recomendacoes = ""; + for( int n = 0; n < linhas.length; n++ ) + { + recomendacoes += linhas[ n ]; + } + } + recomendacoesText.setText( recomendacoes.trim() ); + +// exame = provider.createObject( FichaDataProvider.EXAMES ); + exame = new ExamesData(); +// DBField fields[] = FichaDataProvider.EXAMES.getInsertFields(); +// String exameFields[] = new String[ fields.length ]; +// for( int i = 0; i < exameFields.length; ++i ) +// { +// exameFields[ i ] = fields[ i ].FULL_NAME; +// } +// Hashtable hash = new Hashtable(); +// ComponentController.save( exameFields, hash, components ); +// hash.put( FichaDataProvider.T_EXAMES + "." + FichaDataProvider.INACTIVO, "n" ); +// Enumeration enum = hash.keys(); +// while( enum.hasMoreElements() ) +// { +// String name = ( String )enum.nextElement(); +// exame.setProperty( name, hash.get( name ) ); +// } + String names[] = exame.getFieldNames(); + Hashtable hash = new Hashtable(); + ComponentController.save( names, hash, components ); + exame.setHashData( hash ); + + int tipo = 0; + if( admissaoRadio.isSelected() ) + { + tipo = 1; + } + else if( periodicoRadio.isSelected() ) + { + tipo = 2; + } + else if( ocasionalRadio.isSelected() ) + { + tipo = 3; + } +// else if( outroRadio.isSelected() ) +// { +// tipo = 4; +// } +// exame.setProperty( FichaDataProvider.TIPO, new Integer( tipo ) ); + exame.set( ExamesData.TIPO, new Integer( tipo ) ); + if( tipo != 3 ) + { +// exame.setProperty( FichaDataProvider.EXAMES.getFieldByName( FichaDataProvider.OCASIONAL ).FULL_NAME, null ); + exame.set( ExamesData.OCASIONAL, null ); +// exame.setProperty( FichaDataProvider.EXAMES.getFieldByName( FichaDataProvider.OUTRO_TIPO ).FULL_NAME, "" ); + exame.set( ExamesData.OUTRO_TIPO, "" ); + } + else + { + Integer ocasionalID = ( Integer )ocasionalPanel.save(); + if( ocasionalID == null || ocasionalID.intValue() != 10 ) + { +// exame.setProperty( FichaDataProvider.EXAMES.getFieldByName( FichaDataProvider.OUTRO_TIPO ).FULL_NAME, "" ); + exame.set( ExamesData.OUTRO_TIPO, "" ); + } + } + } + catch( Exception ex ) + { + ex.printStackTrace(); + return null; + } + if( hasMsg ) + { + throw new ValuesException( msg.toString() ); + } + return exame; + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + tipoGroup.setIntSelected( 0 ); + dataExamePanel.setDate( new Date() ); + tipoProximoPanel.setSelected( new Integer( 2 ) ); + marcacao = null; + } + + public void setEnabled( boolean enable ) + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + admissaoRadio.setEnabled( enable ); + periodicoRadio.setEnabled( enable ); + ocasionalRadio.setEnabled( enable ); +// outroRadio.setEnabled( enable ); + ocasionalPanel.setEnabled( ocasionalRadio.isSelected() && ocasionalRadio.isEnabled() ) ; +// especificarText.setEnabled( outroRadio.isSelected() && outroRadio.isEnabled() ); + setEspecificarState(); + } + + public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent) + { + setEspecificarState(); + } + + public void setEspecificarState() + { + Integer id = ( Integer )ocasionalPanel.save(); + if( id != null && id.intValue() == 10 ) + { + especificarText.setEnabled( ocasionalRadio.isSelected() && ocasionalRadio.isEnabled() ); + } + else + { + especificarText.setEnabled( false ); + } + } + + public Integer getMotivoProximoExame() + { + return tipoProximoPanel.getSelected(); + } + + public void setup( Date fichaDate, Integer motivoProcesso ) + { + if( fichaDate != null ) + { + dataExamePanel.setDate( fichaDate ); + Calendar proximo = Calendar.getInstance(); + proximo.setTime( fichaDate ); + proximo.add( Calendar.YEAR, 2 ); + proximoExamePanel.setDate( proximo.getTime() ); + } + if( motivoProcesso != null ) + { + switch( motivoProcesso.intValue() ) + { + case MedicinaConstants.MOTIVO_ADMISSAO: + admissaoRadio.setSelected( true ); + break; + case MedicinaConstants.MOTIVO_PERIODICO: + periodicoRadio.setSelected( true ); + break; + case MedicinaConstants.MOTIVO_PERIODICO_INICIAL: + periodicoRadio.setSelected( true ); + break; + case MedicinaConstants.MOTIVO_OCASIONAL: + ocasionalRadio.setSelected( true ); + break; + } + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaAptidaoConstants.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaAptidaoConstants.java new file mode 100644 index 00000000..a9cfaef7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaAptidaoConstants.java @@ -0,0 +1,78 @@ +/* + * FichaAptidaoConstants.java + * + * Created on May 14, 2007, 5:12 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.ficha; + +/** + * + * @author lflores + */ +public interface FichaAptidaoConstants +{ + /* unicode + private final String SQUARE = "☐"; + private final String CHECKED = "☑";*/ +/* windows arial circle (full circle) */ + public static final String SQUARE = "○"; + public static final String CHECKED = "●"; + + public static final String PORTARIA = "portaria"; + public static final String DESIGNACAO_SOCIAL = "designacao_social"; + public static final String ESTABELECIMENTOS_NOME = "estabelecimentos.nome"; + public static final String ESTABELECIMENTOS_LOCALIDADE = "estabelecimentos.localidade"; + public static final String SERVICO_SAUDE_TIPO_INTERNO = "servico_saude_tipo_interno"; + public static final String SERVICO_SAUDE_TIPO_INTEREMPRESAS = "servico_saude_tipo_interempresas"; + public static final String SERVICO_SAUDE_TIPO_EXTERNO = "servico_saude_tipo_externo"; + public static final String SERVICO_SAUDE_TIPO_SNS = "servico_saude_tipo_sns"; + public static final String SERVICO_SAUDE_DESIGNACAO = "servico_saude_designacao"; + public static final String SERVICO_HIGIENE_TIPO_INTERNO = "servico_higiene_tipo_interno"; + public static final String SERVICO_HIGIENE_TIPO_INTEREMPRESAS = "servico_higiene_tipo_interempresas"; + public static final String SERVICO_HIGIENE_TIPO_EXTERNO = "servico_higiene_tipo_externo"; + public static final String SERVICO_HIGIENE_TIPO_OUTRO = "servico_higiene_tipo_outro"; + public static final String SERVICO_HIGIENE_DESIGNACAO = "servico_higiene_designacao"; + public static final String TRABALHADORES_NOME = "trabalhadores.nome"; + public static final String SEXO = "sexo"; + public static final String DATA_NASCIMENTO = "data_nascimento"; + public static final String NACIONALIDADE = "nacionalidade"; + public static final String NUMERO_MECANOGRAFICO = "numero_mecanografico"; + public static final String DATA_ADMISSAO = "data_admissao"; + public static final String CATEGORIA = "categoria"; + public static final String LOCAL_TRABALHO = "local_trabalho"; + public static final String FUNCAO_PROPOSTA = "funcao_proposta"; + public static final String DATA_ADMISSAO_FUNCAO = "data_admissao_funcao"; + public static final String OBSERVACOES = "observacoes"; + public static final String EXAMES_DATA = "exames.data"; + public static final String TIPO_ADMISSAO = "tipo_admissao"; + public static final String TIPO_PERIODICO = "tipo_periodico"; + public static final String TIPO_OCASIONAL = "tipo_ocasional"; + public static final String TIPO_APOS_DOENCA = "tipo_apos_doenca"; + public static final String TIPO_APOS_ACIDENTE = "tipo_apos_acidente"; + public static final String TIPO_PEDIDO_TRABALHADOR = "tipo_pedido_trabalhador"; + public static final String TIPO_PEDIDO_EMPRESA = "tipo_pedido_empresa"; + public static final String TIPO_MUDANCA_FUNCAO = "tipo_mudanca_funcao"; + public static final String TIPO_TRABALHO = "tipo_trabalho"; + public static final String TIPO_OUTRO = "tipo_outro"; + public static final String TIPO_OUTRO_TEXTO = "tipo_outro_texto"; + public static final String RESULTADO_APTO = "resultado_apto"; + public static final String RESULTADO_APTO_CONDICIONALMENTE = "resultado_apto_condicionalmente"; + public static final String RESULTADO_INAPTO_TEMP = "resultado_inapto_temp"; + public static final String RESULTADO_INAPTO_DEF = "resultado_inapto_def"; + public static final String OUTRA_FUNCAO_1 = "outra_funcao_1"; + public static final String OUTRA_FUNCAO_2 = "outra_funcao_2"; + public static final String OUTRA_FUNCAO_3 = "outra_funcao_3"; + public static final String OUTRA_FUNCAO_4 = "outra_funcao_4"; + public static final String OUTRAS_RECOMENDACOES = "outras_recomendacoes"; + public static final String PROXIMO_EXAME = "proximo_exame"; + public static final String MEDICOS_NOME = "medicos.nome"; + public static final String NUMERO_CEDULA = "numero_cedula"; + + public static final int CODIGO_TIPO_ADMISSAO = 1; + public static final int CODIGO_TIPO_PERIODICO = 2; + public static final int CODIGO_TIPO_OCASIONAL = 3; +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaAptidaoCreator.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaAptidaoCreator.java new file mode 100644 index 00000000..347a29be --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaAptidaoCreator.java @@ -0,0 +1,114 @@ +/* + * FichaAptidaoCreator.java + * + * Created on May 14, 2007, 4:50 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.ficha; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; + +import siprp.util.fop.FOPCreator; +import siprp.util.fop.FOPPrinter; +import siprp.util.fop.PDFCreator; + +/** + * + * @author lflores + */ +public class FichaAptidaoCreator implements FichaAptidaoConstants +{ + private final FOPCreator fopCreator; + private final PDFCreator pdfCreator; + private final FOPPrinter fopPrinter; + + private static FichaAptidaoCreator creator = null; + + /** Creates a new instance of FichaAptidaoCreator */ + private FichaAptidaoCreator() + { + fopCreator = FOPCreator.getFOPCreator(); + pdfCreator = PDFCreator.getPDFCreator(); + fopPrinter = FOPPrinter.getFOPPrinter(); + } + + public static FichaAptidaoCreator getCreator() + { + if( creator == null ) + { + creator = new FichaAptidaoCreator(); + } + return creator; + } + + public void print( byte fo[] ) + throws Exception + { + ByteArrayInputStream in = new ByteArrayInputStream( fo ); + fopPrinter.printFO( in, true, true, null ); +// System.out.println( "DONE" ); + } + + public void printSilent( byte fo[], String printerName ) + throws Exception + { + ByteArrayInputStream in = new ByteArrayInputStream( fo ); + fopPrinter.printFO( in, true, false, null ); + } + +// public byte[] createFO( HashMap values ) +// throws Exception +// { +// StringBuilder buff = new StringBuilder( "\n\n" ); +// +// values.put( PORTARIA, "Portaria n. 299/2007, de 16 de Março" ); +// +//// ☐ square +//// ☑ checked square +// +// for( String key: values.keySet() ) +// { +// buff.append( "\t<" + key + ">" ); +// String val = values.get( key ); +// buff.append( UnicodeChecker.parseToUnicode( "&#x", ";", val, true ) ); +// buff.append( "\n" ); +// } +// buff.append( "" ); +// String xml = buff.toString(); +// +// System.out.println( "XML: " + xml ); +// +// ByteArrayOutputStream out = new ByteArrayOutputStream(); +// InputStream xmlIn = new ByteArrayInputStream( xml.getBytes() ); +// +// InputStream xslStream = getClass().getClassLoader().getResourceAsStream( "siprp/ficha/ficha_aptidao.xsl" ); +// fopCreator.createFOfromXML( xmlIn, xslStream, out ); +// // System.out.println( "FO created" ); +// +// return out.toByteArray(); +// } + + public byte[] createFO( byte []xml ) + throws Exception + { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + InputStream xmlIn = new ByteArrayInputStream( xml ); + + InputStream xslStream = getClass().getClassLoader().getResourceAsStream( "siprp/ficha/ficha_aptidao.xsl" ); + fopCreator.createFOfromXML( xmlIn, xslStream, out ); + // System.out.println( "FO created" ); + + return out.toByteArray(); + } + + public byte[] createPDF( byte[] fo ) + throws Exception + { + return pdfCreator.createPdfFromFo( fo ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaAptidaoEditorManager.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaAptidaoEditorManager.java new file mode 100644 index 00000000..ba56bd15 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaAptidaoEditorManager.java @@ -0,0 +1,207 @@ +/* + * FichaAptidaoEditorManager.java + * + * Created on 30 de Marco de 2004, 19:23 + */ + +package siprp.ficha; + +import com.evolute.utils.editormanager.Editor; +import com.evolute.utils.editormanager.EditorManager; +import com.evolute.utils.editormanager.EditorManagerFactory; +import com.evolute.utils.editormanager.EditorManagerInterface; + +/** + * + * @author fpalma + */ +public class FichaAptidaoEditorManager extends EditorManager +{ + private static final EditorManagerFactory FACTORY = new FichaAptidaoEditorManagerFactory(); + + public static EditorManagerFactory getEditorManagerFactory() + { + return FACTORY; + } + + /** Creates a new instance of FichaAptidaoEditorManager */ + public FichaAptidaoEditorManager( Editor ed, int i ) + { + super( ed, i ); + } + + /** Creates a new instance of FichaAptidaoEditorManager */ + public FichaAptidaoEditorManager( Editor ed, int i, EditorManagerInterface subMan ) + { + super( ed, i, subMan ); + throw new RuntimeException( "FichaAptidaoEditorManager cannot have subManagers" ); + } + + /** Creates a new instance of FichaAptidaoEditorManager */ + public FichaAptidaoEditorManager( Editor ed, int i, EditorManagerInterface subMan[] ) + { + super( ed, i, subMan ); + throw new RuntimeException( "FichaAptidaoEditorManager cannot have subManagers" ); + } + + public boolean isEditing() + { + if( state != STATE_UNSELECT ) + { + return true; + } + return false; + } + + public void enable() + { +// System.out.println( "EditorManager: enable " + this ); + editor.enableComponents( index, false ); + // new, edit, cancel, save, delete, select + editor.actions( index, true, false, false, false, false, true ); + enabled = true; + } + + public void disable() + { +// System.out.println( "EditorManager: disable " + this ); + editor.clear( index ); + editor.enableComponents( index, false ); + // new, edit, cancel, save, delete, select + editor.actions( index, false, false, false, false, false, false ); + enabled = false; + state = STATE_UNSELECT; + } + + public void unlock(boolean direction) + { + editor.enableComponents( index, false ); + if( enabled ) + { + if( state == STATE_UNSELECT ) + { + // new, edit, cancel, save, delete, select + editor.actions( index, true, false, false, false, false, true ); + } + else + { + // new, edit, cancel, save, delete, select + editor.actions( index, true, true, false, false, true, true ); + } + } + } + + public void select() + { +// System.out.println( "EditorManager: select " + this ); + // new, edit, cancel, save, delete, select + editor.actions( index, true, true, true, true, true, true ); + state = STATE_EDIT; + } + + public void unselect() + { +// System.out.println( "EditorManager: select " + this ); + // new, edit, cancel, save, delete, select + editor.actions( index, true, false, false, false, false, true ); + state = STATE_UNSELECT; + } + + public void newItem() + { +// System.out.println( "EditorManager: new " + this ); + editor.enableComponents( index, true ); + // new, edit, cancel, save, delete, select + editor.actions( index, false, false, true, true, true, false ); + state = STATE_NEW; + } + + public void cancelItem() + { +// System.out.println( "EditorManager: cancel " + this ); + if( state == STATE_NEW ) + { + editor.clear( index ); + editor.enableComponents( index, false ); + // new, edit, cancel, save, delete, select + editor.actions( index, true, false, false, false, false, true ); + state = STATE_UNSELECT; + } + else if( state == STATE_EDIT ) + { + editor.reload( index ); + editor.enableComponents( index, true ); + // new, edit, cancel, save, delete, select + editor.actions( index, true, true, true, true, true, true ); + state = STATE_EDIT; + } + } + + public void saveItem() + { +// System.out.println( "EditorManager: save " + this ); + if( ! editor.save( index ) ) + { + return; + } + editor.enableComponents( index, false ); + // new, edit, cancel, save, delete, select + editor.actions( index, true, true, false, false, true, true ); + state = STATE_EDIT; + } + + public void deleteItem() + { +// System.out.println( "EditorManager: delete " + this ); + if( editor.delete( index ) ) + { + editor.clear( index ); + editor.enableComponents( index, false ); + // new, edit, cancel, save, delete, select + editor.actions( index, true, false, false, false, false, true ); + state = STATE_UNSELECT; + } + } + + public void refresh() + { +// System.out.println( "EditorManager: refresh " + this ); + if( !enabled ) + { + disable(); + return; + } + switch( state ) + { + case STATE_NEW: + editItem(); + state = STATE_NEW; + break; + case STATE_EDIT: + editItem(); + break; + case STATE_SELECT: + throw new RuntimeException( "FichaAptidaoEditorManager cannot be in STATE_SELECT" ); + case STATE_UNSELECT: + enable(); + break; + } + } + + public void editItem() + { + state = STATE_EDIT; + editor.actions( index, false, false, true, true, true, false ); + } + + public void lock(boolean direction) + { + throw new RuntimeException( "lock cannot be called on FichaAptidaoEditorManager" ); + } + + public void registerMain(EditorManagerInterface mainMan) + { + throw new RuntimeException( "registerMain cannot be called on FichaAptidaoEditorManager" ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaAptidaoEditorManagerFactory.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaAptidaoEditorManagerFactory.java new file mode 100644 index 00000000..f6ec1512 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaAptidaoEditorManagerFactory.java @@ -0,0 +1,40 @@ +/* + * FichaAptidaoEditorManagerFactory.java + * + * Created on 30 de Marco de 2004, 20:48 + */ + +package siprp.ficha; + +import com.evolute.utils.editormanager.Editor; +import com.evolute.utils.editormanager.EditorManagerFactory; +import com.evolute.utils.editormanager.EditorManagerInterface; +/** + * + * @author fpalma + */ +public class FichaAptidaoEditorManagerFactory + implements EditorManagerFactory +{ + + /** Creates a new instance of FichaAptidaoEditorManagerFactory */ + public FichaAptidaoEditorManagerFactory() + { + } + + public EditorManagerInterface createEditorManager(Editor ed, int i) + { + return new FichaAptidaoEditorManager( ed, i ); + } + + public EditorManagerInterface createEditorManager(Editor ed, int i, EditorManagerInterface[] subMan) + { + return new FichaAptidaoEditorManager( ed, i, subMan ); + } + + public EditorManagerInterface createEditorManager(Editor ed, int i, EditorManagerInterface subMan) + { + return new FichaAptidaoEditorManager( ed, i, subMan ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaMainPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaMainPanel.java new file mode 100644 index 00000000..6dcddc12 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaMainPanel.java @@ -0,0 +1,120 @@ +package siprp.ficha; + +import java.awt.BorderLayout; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.Window; + +import javax.swing.JPanel; +import javax.swing.JTabbedPane; + +import com.evolute.utils.dataui.ControllableComponent; + +class FichaMainPanel extends JPanel + implements ControllableComponent +{ + protected Window owner; + + private UpperPanel upperPanel; + private EmpresaPanel empresaPanel; + private TrabalhadorPanel trabalhadorPanel; + private ObservacoesPanel observacoesPanel; + private ExamePanel examePanel; + + + public FichaMainPanel( Window owner ) + { + this.owner = owner; + } + + + private void setupComponents() + throws Exception + { + upperPanel = new UpperPanel(); + JTabbedPane tabbedPane = new JTabbedPane(); + setLayout( new BorderLayout( ) ); + add( upperPanel, BorderLayout.NORTH ); + add( tabbedPane, BorderLayout.CENTER ); + + + JPanel empresaTrabalhadorPanel = new JPanel(); + JPanel exameRecomendacoesPanel = new JPanel(); + + tabbedPane.add( empresaTrabalhadorPanel, "Empresa/Trabalhador" ); + tabbedPane.add( exameRecomendacoesPanel, "Exame" ); + + GridBagLayout gridbag = new GridBagLayout(); + empresaTrabalhadorPanel.setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 0, 1, 0, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + constraints.weighty = 0; + + empresaPanel = new EmpresaPanel(); + empresaPanel.setEnabled( false ); + gridbag.setConstraints( empresaPanel, constraints ); + empresaTrabalhadorPanel.add( empresaPanel ); + + constraints.weighty = 0; + trabalhadorPanel = new TrabalhadorPanel(); + gridbag.setConstraints( trabalhadorPanel, constraints ); + empresaTrabalhadorPanel.add( trabalhadorPanel ); + + constraints.weighty = 1; + observacoesPanel = new ObservacoesPanel(); + gridbag.setConstraints( observacoesPanel, constraints ); + empresaTrabalhadorPanel.add( observacoesPanel ); + + + gridbag = new GridBagLayout(); + exameRecomendacoesPanel.setLayout( gridbag ); + constraints = new GridBagConstraints(); + constraints.insets = new Insets( 0, 1, 0, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + constraints.weighty = 0; + + constraints.weighty = 1; + examePanel = new ExamePanel(); + gridbag.setConstraints( examePanel, constraints ); + exameRecomendacoesPanel.add( examePanel ); + + + } + + @Override + public void clear() + { + // TODO Auto-generated method stub + + } + + @Override + public void setEnabled( boolean enable ) + { + // TODO Auto-generated method stub + + } + + @Override + public void fill( Object value ) + { + // TODO Auto-generated method stub + + } + + @Override + public Object save() + { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaWindow.java new file mode 100644 index 00000000..01c08084 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/FichaWindow.java @@ -0,0 +1,1284 @@ +/* + * FichaWindow.java + * + * Created on 29 de Marco de 2004, 11:50 + */ + +package siprp.ficha; + +import java.awt.FileDialog; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FilenameFilter; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Vector; + +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.JPanel; + +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.output.XMLOutputter; + +import siprp.FichaDataProvider; +import siprp.data.outer.EmpresasData; +import siprp.data.outer.EstabelecimentosData; +import siprp.data.outer.ExamesData; +import siprp.data.outer.MedicosData; +import siprp.data.outer.TrabalhadoresData; +import siprp.importer.Importer; +import siprp.lembretes.LembretesDataProvider; +import siprp.medicina.MarcacoesMedicinaHandler; +import siprp.printer.Printer; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.strings.StringPlainer; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.dialog.ListAction; +import com.evolute.utils.ui.dialog.ListActionDialog; +import com.evolute.utils.ui.search.SearchDialog; +import com.evolute.utils.ui.window.ActionHandler; +import com.evolute.utils.ui.window.ProgressDialog; +import com.evolute.utils.ui.window.TabbedWindow; + +/** + * + * @author fpalma + */ +public class FichaWindow extends TabbedWindow + implements ListAction, FichaAptidaoConstants +{ + private ProviderInterface JDO; + + private UpperPanel upperPanel; + private EmpresaPanel empresaPanel; + private TrabalhadorPanel trabalhadorPanel; + private ObservacoesPanel observacoesPanel; + private ExamePanel examePanel; + + private LembretesDataProvider lembretesProvider; + private FichaDataProvider fdpProvider; + private MarcacoesMedicinaHandler marcacoesHandler; + private Integer empresaID; + private Integer estabelecimentoID; + private Integer trabalhadorID; + + private final ExamePDF ePDF = new ExamePDF(); + + private static int permissions[][] = + new int[][]{ { NEW_INDEX, CANCEL_INDEX, SAVE_INDEX } }; + + private static FichaWindow window = null; + + private Integer imposedTrabalhadorID = null; + private SaveExameListener exameListener = null; + + private boolean useFO = false; + + /** Creates a new instance of FichaWindow */ + private FichaWindow() + throws Exception + { + super( new UpperPanel(), new String[]{ "Empresa/Trabalhador", "Exame" }, + createPermissions( permissions ) ); + setEditorManagerFactory( FichaAptidaoEditorManager.getEditorManagerFactory() ); + upperPanel = (UpperPanel) getUpperPanel(); + upperPanel.owner = this; + fdpProvider = ( FichaDataProvider ) FichaDataProvider.getProvider(); + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + marcacoesHandler = new MarcacoesMedicinaHandler(); + lembretesProvider = LembretesDataProvider.getProvider(); + setupComponents(); + } + + public static FichaWindow getWindow() + throws Exception + { + if( window == null ) + { + window = new FichaWindow(); + } + return window; + } + + private void setupComponents() + throws Exception + { + setSize( 700, 640 ); + setResizable( false ); + setTitle( "Ficha de Aptid\u00e3o" ); + + JPanel empresaTrabalhadorPanel = getTab( 0 ); + JPanel exameRecomendacoesPanel = getTab( 1 ); + + GridBagLayout gridbag = new GridBagLayout(); + empresaTrabalhadorPanel.setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 0, 1, 0, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + constraints.weighty = 0; + + empresaPanel = new EmpresaPanel(); + empresaPanel.setEnabled( false ); + gridbag.setConstraints( empresaPanel, constraints ); + empresaTrabalhadorPanel.add( empresaPanel ); + + constraints.weighty = 0; + trabalhadorPanel = new TrabalhadorPanel(); + gridbag.setConstraints( trabalhadorPanel, constraints ); + empresaTrabalhadorPanel.add( trabalhadorPanel ); + + constraints.weighty = 1; + observacoesPanel = new ObservacoesPanel(); + gridbag.setConstraints( observacoesPanel, constraints ); + empresaTrabalhadorPanel.add( observacoesPanel ); + + + gridbag = new GridBagLayout(); + exameRecomendacoesPanel.setLayout( gridbag ); + constraints = new GridBagConstraints(); + constraints.insets = new Insets( 0, 1, 0, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + constraints.weighty = 0; + + constraints.weighty = 1; + examePanel = new ExamePanel(); + gridbag.setConstraints( examePanel, constraints ); + exameRecomendacoesPanel.add( examePanel ); + + registerAction( new ActionHandler(){ + public void execute() + { + print(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return saveAction || editAction; + } + }, "Imprimir", + "Imprimir Ficha", "print", + 0, true ); + + registerAction( new ActionHandler(){ + public void execute() + { + printOld(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return saveAction || editAction; + } + }, "Imprimir Fichas Anteriores", + "Imprimir Fichas Anteriores", null, + 0, false ); + +// registerAction( new ActionHandler(){ +// public void execute() +// { +// printOldFO(); +// } +// +// public boolean activate( boolean newAction, boolean editAction, +// boolean cancelAction, boolean saveAction, +// boolean deleteAction, boolean selectAction ) +// { +// return saveAction || editAction; +// } +// }, "Imprimir Fichas Anteriores (novo)", +// "Imprimir Fichas Anteriores (novo)", null, +// 0, false ); + + registerAction( new ActionHandler(){ + public void execute() + { + deleteOld(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return saveAction || editAction; + } + }, "Apagar Fichas Anteriores", + "Apagar Fichas Anteriores", null, + 0, false ); + + registerAction( new ActionHandler(){ + public void execute() + { + printToFile(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return saveAction || editAction; + } + }, "Exportar", "Exportar para PDF", null, 0, true ); + +// registerAction( new ActionHandler(){ +// public void execute() +// { +// excel(); +// } +// +// public boolean activate( boolean newAction, boolean editAction, +// boolean cancelAction, boolean saveAction, +// boolean deleteAction, boolean selectAction ) +// { +// return saveAction; +// } +// }, "Importar", +// "Importar de Excel", "excel", +// 0, true ); + } + + public boolean save( int index ) + { + new ProgressDialog( this, "A gravar...", + new Runnable(){ + public void run() + { + + } + }); + StringBuilder msg = new StringBuilder(); + MedicosData medico; + try + { + medico = (MedicosData)upperPanel.save(); + } + catch( ValuesException vex ) + { + msg.append( vex.getMessage() ); + medico = null; + } + EstabelecimentosData estabelecimento; + try + { + estabelecimento = (EstabelecimentosData)empresaPanel.save(); + } + catch( ValuesException vex ) + { + msg.append( vex.getMessage() ); + estabelecimento = null; + } + TrabalhadoresData trabalhador; + try + { + trabalhador = (TrabalhadoresData)trabalhadorPanel.save(); + } + catch( ValuesException vex ) + { + msg.append( vex.getMessage() ); + trabalhador = null; + } + ExamesData exame; + try + { + exame = (ExamesData)examePanel.save(); + } + catch( ValuesException vex ) + { + msg.append( vex.getMessage() ); + exame = null; + } + if( estabelecimento == null || trabalhador == null || exame == null || medico == null ) + { + JOptionPane.showMessageDialog( this, msg.toString(), "Erro...", JOptionPane.ERROR_MESSAGE ); + return false; + } + String observacoes = ( String ) observacoesPanel.save(); + + + estabelecimento.set( EstabelecimentosData.NOME_PLAIN, + com.evolute.utils.strings.StringPlainer.convertString( ( String ) + estabelecimento.get( EstabelecimentosData.NOME ) ) ); + +// trabalhador.setProperty( FichaDataProvider.R_TRABALHADOR_ESTABELECIMENTO, estabelecimento ); +// trabalhador.setProperty( FichaDataProvider.OBSERVACOES, observacoesPanel.save() ); + trabalhador.set( TrabalhadoresData.TO_ESTABELECIMENTO_ID, estabelecimento ); + trabalhador.set( TrabalhadoresData.OBSERVACOES, observacoes ); + trabalhador.set( TrabalhadoresData.NOME_PLAIN, + com.evolute.utils.strings.StringPlainer.convertString( ( String ) + trabalhador.get( TrabalhadoresData.NOME ) ) ); + + +// exame.setProperty( FichaDataProvider.R_EXAME_MEDICO, medico ); +// exame.setProperty( FichaDataProvider.R_EXAME_TRABALHADOR, trabalhador ); + exame.set( ExamesData.TO_MEDICO_ID, medico ); + exame.set( ExamesData.TO_TRABALHADOR_ID, trabalhador ); + + byte fo[] = null; + try + { + fo = createFO( exame ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a criar nova vers\u00e3o de ficha", true ); + } + + try + { + // lflores - disable FO for now + + +// System.out.println( "FO sz: " + fo.length ); + exame.set( ExamesData.FO, fo ); + exame.set( ExamesData.PDF, createPDF( exame ) ); + +// empresa.save(); +// estabelecimento.save(); + + exame.save(); + trabalhador.save(); + try + { + if( medico != null ) + { + fdpProvider.setMedicoForEstabelecimento( ( Integer ) estabelecimento.get( EstabelecimentosData.ID ), + ( Integer ) medico.get( MedicosData.ID ) ); + } + } + catch( Exception mex ) + { + } +// fdpProvider.savePDF( exame ); + +// DBKey key = trabalhador.getPrimaryKeyValue(); +// DBField fields[] = FichaDataProvider.TRABALHADORES.getPrimaryKey(); +// trabalhadorID = new Integer( ((Number)key.getFieldValue( fields[ 0 ] )).intValue() ); + trabalhadorID = ( Integer ) trabalhador.get( TrabalhadoresData.ID ); + try + { + //Marcacao.saveMarcacaoConsultaForTrabalhadorID( trabalhadorID, (Date)exame.get( ExamesData.PROXIMO_EXAME ) ); + marcacoesHandler.ajustarMarcacoes( + trabalhadorID, (Integer)exame.get( ExamesData.TIPO ), + (Date)exame.get( ExamesData.DATA ), + examePanel.getMotivoProximoExame(), (Date)exame.get( ExamesData.PROXIMO_EXAME ) ); + } + catch( Exception iex ) + { + iex.printStackTrace(); + } + Integer motivoProximoExame = (Integer) exame.get( ExamesData.TIPO ); + if ( motivoProximoExame != null && motivoProximoExame.equals( new Integer( FichaAptidaoConstants.CODIGO_TIPO_OCASIONAL ) ) ) + { + Date proximoExameDate = (Date) exame.get( ExamesData.PROXIMO_EXAME ); + if( proximoExameDate != null && proximoExameDate.getTime() > 0 ) + { + Calendar whenCal = Calendar.getInstance(); + whenCal.setTime( proximoExameDate ); + whenCal.add( Calendar.MONTH, -2 ); + Date now = new Date(); + Date when = whenCal.getTime(); + lembretesProvider.criarLembreteFicha( exame, now.after( when ) ? now : when ); + System.out.println(new Date() + ": A criar lembrete"); + } + } +// createPDF( exame ); +// print(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a guardar", true ); + return false; + } + if( exameListener != null ) + { + exameListener.exameSaved( trabalhadorID, ( Integer )exame.get( ExamesData.ID ) ); + exameListener = null; + } + return true; + } + + public boolean newItem( int index ) + { + exameListener = null; + if( imposedTrabalhadorID == null ) + { + fdpProvider.setSearch( FichaDataProvider.SEARCH_EMPRESAS ); + SearchDialog search; + Integer oldID = empresaID; + + search = new SearchDialog( fdpProvider, null, false, null, true ); + empresaID = ( Integer )search.getSelected(); + + if( empresaID == null ) + { + if( search.getIsNew() ) + { + estabelecimentoID = null; + trabalhadorID = null; + clear( 0 ); + return true; + } + else + { + return false; + } + } + + fdpProvider.setSearch( FichaDataProvider.SEARCH_ESTABELECIMENTOS ); + fdpProvider.setSearchID( FichaDataProvider.SEARCH_EMPRESAS, empresaID.intValue() ); + + search = new SearchDialog( fdpProvider, null, false, null, true ); + estabelecimentoID = ( Integer )search.getSelected(); + + if( estabelecimentoID == null ) + { + if( search.getIsNew() ) + { + trabalhadorID = null; + reload(0); + return true; + } + else + { + return false; + } + } + + fdpProvider.setSearch( FichaDataProvider.SEARCH_TRABALHADORES ); + fdpProvider.setSearchID( FichaDataProvider.SEARCH_ESTABELECIMENTOS, estabelecimentoID.intValue() ); + search = new SearchDialog( fdpProvider, null, false, null, true ); + trabalhadorID = ( Integer )search.getSelected(); + if( trabalhadorID == null && search.getIsNew() ) + { + reload(0); + return true; + } + } + else + { + trabalhadorID = imposedTrabalhadorID; + imposedTrabalhadorID = null; + try + { + estabelecimentoID = fdpProvider.getEstabelecimentoIDForTrabalhador( trabalhadorID ); + empresaID = fdpProvider.getEmpresaIDForEstabelecimento( estabelecimentoID ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados.", true ); + return false; + } + } + if( trabalhadorID == null ) + { + return false; + } + reload(0); + return true; + } + + public boolean delete( int index ) + { + return true; + } + + public void deleteOld() + { + if( trabalhadorID == null ) + { + return; + } + Vector linhas; + try + { + IDObject fichas[] = fdpProvider.getAllFichasForTrabalhador( trabalhadorID ); + linhas = new Vector( Arrays.asList( fichas ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a criar lista de Fichas anteriores", true ); + return; + } + ListActionDialog dialog = + new ListActionDialog( this, "Apagar Fichas Anteriores", new String[]{ "Data" }, linhas, + new ListAction(){ + public String getListActionName() + { + return "Apagar"; + } + + public boolean executeListAction( int line, Object value ) + { + if( value == null ) + { + return true; + } + try + { + delete( ( ( IDObject )value ).getID() ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a Apagar Ficha", true ); + return false; + } + return true; + } + } ); + dialog.setSize( 250, 200 ); + dialog.setVisible( true ); + } + + public void reload( int index ) + { + Integer upperData[] = new Integer[]{ empresaID, estabelecimentoID, trabalhadorID }; + upperPanel.fill( upperData ); + Object empresaData[] = new Object[]{ empresaID, estabelecimentoID }; + empresaPanel.fill( empresaData ); + trabalhadorPanel.fill( trabalhadorID ); + observacoesPanel.fill( trabalhadorID ); + examePanel.fill( trabalhadorID ); + } + + public void enableComponents( int index, boolean enable ) + { + upperPanel.setEnabled( enable ); + empresaPanel.setEnabled( enable ); + trabalhadorPanel.setEnabled( enable ); + observacoesPanel.setEnabled( enable ); + examePanel.setEnabled( enable ); + } + + public void clear( int index ) + { + upperPanel.clear(); + empresaPanel.clear(); + trabalhadorPanel.clear(); + observacoesPanel.clear(); + examePanel.clear(); + } + + public void print() + { + try + { + if( trabalhadorID == null ) + { + System.out.println( "no trab" ); + return; + } + + Integer id = fdpProvider.getLastExameIDForTrabalhador( trabalhadorID ); + if( id == null ) + { + System.out.println( "no id" ); + return; + } + print( id, false ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "N\u00e3o foi poss\u00edvel imprimir", true ); + } + } + + private void print( Integer exameID, boolean toFile ) + throws Exception + { +// MetaObject exame = fdpProvider.load( fdpProvider.EXAMES, new DBKey( exameID ) ); + ExamesData exame = (ExamesData) JDO.load( ExamesData.class, exameID ); + if( exame == null ) + { + throw new Exception( "N\u00e3o existe exame" ); + } + + byte fo[] = (byte []) exame.get( ExamesData.FO ); + byte pdf[] = (byte []) exame.get( ExamesData.PDF ); + + if( toFile ) + { + TrabalhadoresData trabalhadorExame = exame.toTrabalhador_id(); + String fileName = StringPlainer.convertString( ( String ) trabalhadorExame.get( TrabalhadoresData.NOME ) ); + SimpleDateFormat sdf = new SimpleDateFormat("_dd-MM-yyyy"); + Date date = new Date(); + fileName = fileName + sdf.format( date ); + fileName = fileName.replace( ' ', '_' ); + JFileChooser dialog = new JFileChooser(); + dialog.setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY ); + int result = dialog.showSaveDialog( this ); + if( result == JFileChooser.APPROVE_OPTION ) + { + File selectedFile = dialog.getSelectedFile(); + if( selectedFile != null ) + { + String absolutePath = selectedFile.getAbsolutePath(); + if( absolutePath != null ) + { + if(absolutePath.charAt( absolutePath.length() - 1) != File.separatorChar ) + { + absolutePath = absolutePath + File.separatorChar; + } + fileName = absolutePath + fileName + ".pdf"; + } + +// if( fo != null ) +// { +// Printer.printFoToFile( fo, fileName, true ); +// } +// else +// { + Printer.printPDFToFile( pdf, fileName, true ); +// } + JOptionPane.showMessageDialog( this, "Ficha exportada para: " + fileName ); + } + } + } + else + { +// if( fo != null ) +// { +// FichaAptidaoCreator.getCreator().print( fo ); +// } +// else +// { + TrabalhadoresData trabalhadorExame = exame.toTrabalhador_id(); + String nomeFicheiro = StringPlainer.convertString( ( String ) trabalhadorExame.get( TrabalhadoresData.NOME ) ); + nomeFicheiro = nomeFicheiro.replaceAll( " ", "_" ); + ePDF.print( pdf, nomeFicheiro ); +// } + } + } + + private void printToFile() + { + try + { + if( trabalhadorID != null ) + { + Integer id = fdpProvider.getLastExameIDForTrabalhador( trabalhadorID ); + if( id != null ) + { + print(id, true); + } + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "N\u00e3o foi poss\u00edvel exportar", true ); + } + } + +// private void printFO( Integer exameID ) +// throws Exception +//{ +//// MetaObject exame = fdpProvider.load( fdpProvider.EXAMES, new DBKey( exameID ) ); +// ExamesData exame = (ExamesData) JDO.load( ExamesData.class, exameID ); +// if( exame == null ) +// { +// throw new Exception( "N\u00e3o existe exame" ); +// } +// +// // lflores - ignore FO (for now) +// byte fo[] = (byte []) exame.get( ExamesData.FO ); +// +// if( fo != null ) +// { +// byte pdf[] = FichaAptidaoCreator.getCreator().createPDF( fo ); +// new PDFFilePrinter( pdf, true ); +// } +//} + + public byte[] createFO( ExamesData exame ) + throws Exception + { + byte xml[] = createXmlFromExame( exame ); +// HashMap ht = createMapFromExame(exame); +// ExamePDF ePDF = new ExamePDF(); +// return ePDF.createPDF( ht ); + + return FichaAptidaoCreator.getCreator().createFO( xml ); + } + + public byte[] createPDF( ExamesData exame ) + throws Exception + { + // byte fo[] = exame.get( ExamesData.FO, fo ); + HashMap ht = createMapFromExame( exame ); + return ePDF.createPDF( ht ); +// return FichaAptidaoCreator.getCreator().createPDF( fo ); + } + + private HashMap createMapFromExame(final ExamesData exame) + { + MedicosData medico = exame.toMedico_id(); + TrabalhadoresData trabalhador = exame.toTrabalhador_id(); + EstabelecimentosData estabelecimento = trabalhador.toEstabelecimento_id(); + EmpresasData empresa = estabelecimento.toEmpresa_id(); +// empresa.load( empresa.getPrimaryKeyValue() ); + HashMap ht = new HashMap(); + ht.put( DESIGNACAO_SOCIAL, ( String )empresa.get( EmpresasData.DESIGNACAO_SOCIAL ) ); + ht.put( ESTABELECIMENTOS_NOME, ( String )estabelecimento.get( EstabelecimentosData.NOME ) ); + String aux = (String)estabelecimento.get( EstabelecimentosData.LOCALIDADE ); + ht.put( ESTABELECIMENTOS_LOCALIDADE, aux != null ? aux : "" ); + Integer tipo = (Integer)empresa.get( EmpresasData.SERVICO_SAUDE_TIPO ); + ht.put( SERVICO_SAUDE_TIPO_INTERNO, SQUARE ); + ht.put( SERVICO_SAUDE_TIPO_INTEREMPRESAS, SQUARE ); + ht.put( SERVICO_SAUDE_TIPO_EXTERNO, SQUARE ); + ht.put( SERVICO_SAUDE_TIPO_SNS, SQUARE ); + switch( tipo.intValue() ) + { + case 1: + ht.put( SERVICO_SAUDE_TIPO_INTERNO, CHECKED ); + break; + case 2: + ht.put( SERVICO_SAUDE_TIPO_INTEREMPRESAS, CHECKED ); + break; + case 3: + ht.put( SERVICO_SAUDE_TIPO_EXTERNO, CHECKED ); + break; + case 4: + ht.put( SERVICO_SAUDE_TIPO_SNS, CHECKED ); + break; + } + ht.put( SERVICO_SAUDE_DESIGNACAO, ( String )empresa.get( EmpresasData.SERVICO_SAUDE_DESIGNACAO ) ); + tipo = (Integer)empresa.get( EmpresasData.SERVICO_HIGIENE_TIPO ); + ht.put( SERVICO_HIGIENE_TIPO_INTERNO, SQUARE ); + ht.put( SERVICO_HIGIENE_TIPO_INTEREMPRESAS, SQUARE ); + ht.put( SERVICO_HIGIENE_TIPO_EXTERNO, SQUARE ); + ht.put( SERVICO_HIGIENE_TIPO_OUTRO, SQUARE ); + switch( tipo.intValue() ) + { + case 1: + ht.put( SERVICO_HIGIENE_TIPO_INTERNO, CHECKED ); + break; + case 2: + ht.put( SERVICO_HIGIENE_TIPO_INTEREMPRESAS, CHECKED ); + break; + case 3: + ht.put( SERVICO_HIGIENE_TIPO_EXTERNO, CHECKED ); + break; + case 4: + ht.put( SERVICO_HIGIENE_TIPO_OUTRO, CHECKED ); + break; + } + ht.put( SERVICO_HIGIENE_DESIGNACAO, ( String )empresa.get( EmpresasData.SERVICO_HIGIENE_DESIGNACAO ) ); + ht.put( TRABALHADORES_NOME, ( String )trabalhador.get( TrabalhadoresData.NOME ) ); + aux = (String)trabalhador.get( TrabalhadoresData.SEXO ); + switch( aux.charAt( 0 ) ) + { + case 'm': + ht.put( SEXO, "Masculino" ); + break; + case 'f': + ht.put( SEXO, "Feminino" ); + break; + } + DateFormat df = DateFormat.getDateInstance( DateFormat.SHORT ); + Date data = ( Date )trabalhador.get( TrabalhadoresData.DATA_NASCIMENTO ); + ht.put( DATA_NASCIMENTO, data != null ? df.format( data ) : "" ); + aux = (String)trabalhador.get( TrabalhadoresData.NACIONALIDADE ); + ht.put( NACIONALIDADE, aux != null ? aux : "" ); + aux = (String)trabalhador.get( TrabalhadoresData.NUMERO_MECANOGRAFICO ); + ht.put( NUMERO_MECANOGRAFICO, aux != null ? aux : "" ); + data = ( Date )trabalhador.get( TrabalhadoresData.DATA_ADMISSAO ); + ht.put( DATA_ADMISSAO, data != null ? df.format( data ) : "" ); + aux = (String)trabalhador.get( TrabalhadoresData.CATEGORIA ); + ht.put( CATEGORIA, aux != null ? aux : "" ); + aux = (String)trabalhador.get( TrabalhadoresData.LOCAL_TRABALHO ); + ht.put( LOCAL_TRABALHO, aux != null ? aux : "" ); + aux = (String)trabalhador.get( TrabalhadoresData.FUNCAO_PROPOSTA ); + ht.put( FUNCAO_PROPOSTA, aux != null ? aux : "" ); + data = ( Date )trabalhador.get( TrabalhadoresData.DATA_ADMISSAO_FUNCAO ); + ht.put( DATA_ADMISSAO_FUNCAO, data != null ? df.format( data ) : "" ); + aux = (String)trabalhador.get( TrabalhadoresData.OBSERVACOES ); + ht.put( OBSERVACOES, aux != null ? aux : "" ); + data = ( Date )exame.get( ExamesData.DATA ); + ht.put( EXAMES_DATA, data != null ? df.format( data ) : "" ); + tipo = (Integer)exame.get( ExamesData.TIPO ); + ht.put( TIPO_ADMISSAO, SQUARE ); + ht.put( TIPO_PERIODICO, SQUARE ); + ht.put( TIPO_OCASIONAL, SQUARE ); + + ht.put( TIPO_APOS_DOENCA, SQUARE ); + ht.put( TIPO_APOS_ACIDENTE, SQUARE ); + ht.put( TIPO_PEDIDO_TRABALHADOR, SQUARE ); + ht.put( TIPO_PEDIDO_EMPRESA, SQUARE ); + ht.put( TIPO_MUDANCA_FUNCAO, SQUARE ); + ht.put( TIPO_TRABALHO, SQUARE ); + ht.put( TIPO_OUTRO, SQUARE ); + + switch( tipo.intValue() ) + { + case 1: + ht.put( TIPO_ADMISSAO, CHECKED ); + break; + case 2: + ht.put( TIPO_PERIODICO, CHECKED ); + break; + case 3: + ht.put( TIPO_OCASIONAL, CHECKED ); + tipo = (Integer)exame.get( ExamesData.OCASIONAL ); + + switch( tipo.intValue() ) + { + case 1: + ht.put( TIPO_APOS_DOENCA, CHECKED ); + break; + case 2: + ht.put( TIPO_APOS_ACIDENTE, CHECKED ); + break; + case 3: + ht.put( TIPO_PEDIDO_TRABALHADOR, CHECKED ); + break; + case 4: + ht.put( TIPO_PEDIDO_EMPRESA, CHECKED ); + break; + case 5: + ht.put( TIPO_MUDANCA_FUNCAO, CHECKED ); + break; + case 6: + ht.put( TIPO_TRABALHO, CHECKED ); + break; + case 10: + ht.put( TIPO_OUTRO, CHECKED ); + break; + } + break; +// case 4: +// aux = (String)exame.get( ExamesData.OUTRO_TIPO ); +// ht.put( "tipo_outro", aux != null ? aux : "" ); +// break; + } + aux = (String)exame.get( ExamesData.OUTRO_TIPO ); + ht.put( TIPO_OUTRO_TEXTO, aux != null ? aux : "" ); + tipo = (Integer)exame.get( ExamesData.RESULTADO ); + ht.put( RESULTADO_APTO, SQUARE ); + ht.put( RESULTADO_APTO_CONDICIONALMENTE, SQUARE ); + ht.put( RESULTADO_INAPTO_TEMP, SQUARE ); + ht.put( RESULTADO_INAPTO_DEF, SQUARE ); + switch( tipo.intValue() ) + { + case 1: + ht.put( RESULTADO_APTO, CHECKED ); + break; + case 2: + ht.put( RESULTADO_APTO_CONDICIONALMENTE, CHECKED ); + break; + case 3: + ht.put( RESULTADO_INAPTO_TEMP, CHECKED ); + break; + case 4: + ht.put( RESULTADO_INAPTO_DEF, CHECKED ); + break; + } + aux = (String)exame.get( ExamesData.OUTRA_FUNCAO_1 ); + ht.put( OUTRA_FUNCAO_1, aux != null ? aux : "" ); + aux = (String)exame.get( ExamesData.OUTRA_FUNCAO_2 ); + ht.put( OUTRA_FUNCAO_2, aux != null ? aux : "" ); + aux = (String)exame.get( ExamesData.OUTRA_FUNCAO_3 ); + ht.put( OUTRA_FUNCAO_3, aux != null ? aux : "" ); + aux = (String)exame.get( ExamesData.OUTRA_FUNCAO_4 ); + ht.put( OUTRA_FUNCAO_4, aux != null ? aux : "" ); + aux = (String)exame.get( ExamesData.OUTRAS_RECOMENDACOES ); + ht.put( OUTRAS_RECOMENDACOES, aux != null ? aux : "" ); + data = ( Date )exame.get( ExamesData.PROXIMO_EXAME ); + ht.put( PROXIMO_EXAME, data != null ? df.format( data ) : "n/d" ); + aux = (String)medico.get( MedicosData.NOME ); + ht.put( MEDICOS_NOME, aux != null ? aux : "" ); + aux = (String)medico.get( MedicosData.NUMERO_CEDULA ); + ht.put( NUMERO_CEDULA, aux != null ? aux : "" ); + return ht; + } + + private byte[] createXmlFromExame(final ExamesData exame) + throws Exception + { + MedicosData medico = exame.toMedico_id(); + TrabalhadoresData trabalhador = exame.toTrabalhador_id(); + EstabelecimentosData estabelecimento = trabalhador.toEstabelecimento_id(); + EmpresasData empresa = estabelecimento.toEmpresa_id(); + + Element rootElement = new Element( "FichaAptidao" ); + Element portariaElement = new Element( "portaria" ); + portariaElement.setText( "Portaria n. 299/2007, de 16 de Mar\u00e7o" ); + rootElement.addContent( portariaElement ); + + Element empresaElement = new Element( "empresa" ); + Element designacaoSocialEmpresaElement = new Element( "designacao-social" ); + designacaoSocialEmpresaElement.setText( ( String )empresa.get( EmpresasData.DESIGNACAO_SOCIAL ) ); + empresaElement.addContent( designacaoSocialEmpresaElement ); + rootElement.addContent( empresaElement ); + + Integer tipoServicoSaude = (Integer)empresa.get( EmpresasData.SERVICO_SAUDE_TIPO ); + Integer tipoServicoHigieneSeguranca = (Integer)empresa.get( EmpresasData.SERVICO_HIGIENE_TIPO ); + Element estabelecimentoElement = new Element( "estabelecimento" ); + Element nomeEstabelecimentoElement = new Element( "nome" ); + nomeEstabelecimentoElement.setText( ( String )estabelecimento.get( EstabelecimentosData.NOME ) ); + estabelecimentoElement.addContent( nomeEstabelecimentoElement ); + Element localidadeEstabelecimentoElement = new Element( "localidade" ); + localidadeEstabelecimentoElement.setText( ( String )estabelecimento.get( EstabelecimentosData.LOCALIDADE ) ); + estabelecimentoElement.addContent( localidadeEstabelecimentoElement ); + Element servicoSaudeEstabelecimentoElement = new Element( "servico-saude" ); + Element tipoServicoSaudeEstabelecimentoElement = new Element( "tipo" ); + Element internoTipoServicoSaudeEstabelecimentoElement = new Element( "interno" ); + internoTipoServicoSaudeEstabelecimentoElement.setText( tipoServicoSaude.intValue() == 1 ? "y" : "n" ); + tipoServicoSaudeEstabelecimentoElement.addContent( internoTipoServicoSaudeEstabelecimentoElement ); + Element interempresasTipoServicoSaudeEstabelecimentoElement = new Element( "interempresas" ); + interempresasTipoServicoSaudeEstabelecimentoElement.setText( tipoServicoSaude.intValue() == 2 ? "y" : "n" ); + tipoServicoSaudeEstabelecimentoElement.addContent( interempresasTipoServicoSaudeEstabelecimentoElement ); + Element externoTipoServicoSaudeEstabelecimentoElement = new Element( "externo" ); + externoTipoServicoSaudeEstabelecimentoElement.setText( tipoServicoSaude.intValue() == 3 ? "y" : "n" ); + tipoServicoSaudeEstabelecimentoElement.addContent( externoTipoServicoSaudeEstabelecimentoElement ); + Element snsTipoServicoSaudeEstabelecimentoElement = new Element( "sns" ); + snsTipoServicoSaudeEstabelecimentoElement.setText( tipoServicoSaude.intValue() == 4 ? "y" : "n" ); + tipoServicoSaudeEstabelecimentoElement.addContent( snsTipoServicoSaudeEstabelecimentoElement ); + servicoSaudeEstabelecimentoElement.addContent( tipoServicoSaudeEstabelecimentoElement ); + Element designacaoServicoSaudeEstabelecimentoElement = new Element( "designacao" ); + designacaoServicoSaudeEstabelecimentoElement.setText( ( String )empresa.get( EmpresasData.SERVICO_SAUDE_DESIGNACAO ) ); + servicoSaudeEstabelecimentoElement.addContent( designacaoServicoSaudeEstabelecimentoElement ); + estabelecimentoElement.addContent( servicoSaudeEstabelecimentoElement ); + Element servicoHigieneSegurancaEstabelecimentoElement = new Element( "servico-higiene-seguranca" ); + Element tipoServicoHigieneSegurancaEstabelecimentoElement = new Element( "tipo" ); + Element internoTipoServicoHigieneSegurancaEstabelecimentoElement = new Element( "interno" ); + internoTipoServicoHigieneSegurancaEstabelecimentoElement.setText( tipoServicoHigieneSeguranca.intValue() == 1 ? "y" : "n" ); + tipoServicoHigieneSegurancaEstabelecimentoElement.addContent( internoTipoServicoHigieneSegurancaEstabelecimentoElement ); + Element interempresasTipoServicoHigieneSegurancaEstabelecimentoElement = new Element( "interempresas" ); + interempresasTipoServicoHigieneSegurancaEstabelecimentoElement.setText( tipoServicoHigieneSeguranca.intValue() == 2 ? "y" : "n" ); + tipoServicoHigieneSegurancaEstabelecimentoElement.addContent( interempresasTipoServicoHigieneSegurancaEstabelecimentoElement ); + Element externoTipoServicoHigieneSegurancaEstabelecimentoElement = new Element( "externo" ); + externoTipoServicoHigieneSegurancaEstabelecimentoElement.setText( tipoServicoHigieneSeguranca.intValue() == 3 ? "y" : "n" ); + tipoServicoHigieneSegurancaEstabelecimentoElement.addContent( externoTipoServicoHigieneSegurancaEstabelecimentoElement ); + Element outroTipoServicoHigieneSegurancaEstabelecimentoElement = new Element( "outro" ); + outroTipoServicoHigieneSegurancaEstabelecimentoElement.setText( tipoServicoHigieneSeguranca.intValue() == 4 ? "y" : "n" ); + tipoServicoHigieneSegurancaEstabelecimentoElement.addContent( outroTipoServicoHigieneSegurancaEstabelecimentoElement ); + servicoHigieneSegurancaEstabelecimentoElement.addContent( tipoServicoHigieneSegurancaEstabelecimentoElement ); + Element designacaoServicoHigieneSegurancaEstabelecimentoElement = new Element( "designacao" ); + designacaoServicoHigieneSegurancaEstabelecimentoElement.setText( ( String )empresa.get( EmpresasData.SERVICO_HIGIENE_DESIGNACAO ) ); + servicoHigieneSegurancaEstabelecimentoElement.addContent( designacaoServicoHigieneSegurancaEstabelecimentoElement ); + estabelecimentoElement.addContent( servicoHigieneSegurancaEstabelecimentoElement ); + rootElement.addContent( estabelecimentoElement ); + + char sexo = ( (String)trabalhador.get( TrabalhadoresData.SEXO ) ).charAt( 0 ); + DateFormat df = DateFormat.getDateInstance( DateFormat.SHORT ); + Date dataNascimento = ( Date )trabalhador.get( TrabalhadoresData.DATA_NASCIMENTO ); + Date dataAdmissao = ( Date )trabalhador.get( TrabalhadoresData.DATA_ADMISSAO ); + Date dataAdmissaoFuncao = ( Date )trabalhador.get( TrabalhadoresData.DATA_ADMISSAO_FUNCAO ); + Element trabalhadorElement = new Element( "trabalhador" ); + Element nomeTrabalhadorElement = new Element( "nome" ); + nomeTrabalhadorElement.setText( ( String )trabalhador.get( TrabalhadoresData.NOME ) ); + Element sexoTrabalhadorElement = new Element( "sexo" ); + sexoTrabalhadorElement.setText( sexo == 'm' ? "Masculino" : "Feminino" ); + trabalhadorElement.addContent( sexoTrabalhadorElement ); + Element dataNascimentoTrabalhadorElement = new Element( "data-nascimento" ); + dataNascimentoTrabalhadorElement.setText( dataNascimento != null ? df.format( dataNascimento ) : "" ); + trabalhadorElement.addContent( dataNascimentoTrabalhadorElement ); + Element nacionalidadeTrabalhadorElement = new Element( "nacionalidade" ); + nacionalidadeTrabalhadorElement.setText( (String)trabalhador.get( TrabalhadoresData.NACIONALIDADE ) ); + trabalhadorElement.addContent( nacionalidadeTrabalhadorElement ); + trabalhadorElement.addContent( nomeTrabalhadorElement ); + Element numeroMecanograficoTrabalhadorElement = new Element( "numero-mecanografico" ); + numeroMecanograficoTrabalhadorElement.setText( (String)trabalhador.get( TrabalhadoresData.NUMERO_MECANOGRAFICO ) ); + trabalhadorElement.addContent( numeroMecanograficoTrabalhadorElement ); + Element dataAdmissaoTrabalhadorElement = new Element( "data-admissao" ); + dataAdmissaoTrabalhadorElement.setText( dataAdmissao != null ? df.format( dataAdmissao ) : "" ); + trabalhadorElement.addContent( dataAdmissaoTrabalhadorElement ); + Element categoriaProfissionalTrabalhadorElement = new Element( "categoria-profissional" ); + categoriaProfissionalTrabalhadorElement.setText( (String)trabalhador.get( TrabalhadoresData.CATEGORIA ) ); + trabalhadorElement.addContent( categoriaProfissionalTrabalhadorElement ); + Element localTrabalhoTrabalhadorElement = new Element( "local-trabalho" ); + localTrabalhoTrabalhadorElement.setText( (String)trabalhador.get( TrabalhadoresData.LOCAL_TRABALHO ) ); + trabalhadorElement.addContent( localTrabalhoTrabalhadorElement ); + Element funcaoPropostaTrabalhadorElement = new Element( "funcao-proposta" ); + funcaoPropostaTrabalhadorElement.setText( (String)trabalhador.get( TrabalhadoresData.FUNCAO_PROPOSTA ) ); + Element dataAdmissaoFuncaoTrabalhadorElement = new Element( "data-admissao-funcao" ); + dataAdmissaoFuncaoTrabalhadorElement.setText( dataAdmissaoFuncao != null ? df.format( dataAdmissaoFuncao ) : "" ); + trabalhadorElement.addContent( dataAdmissaoFuncaoTrabalhadorElement ); + trabalhadorElement.addContent( funcaoPropostaTrabalhadorElement ); + rootElement.addContent( trabalhadorElement ); + + Element observacoesElement = new Element( "observacoes" ); + observacoesElement.setText( (String)trabalhador.get( TrabalhadoresData.OBSERVACOES ) ); + rootElement.addContent( observacoesElement ); + + Date dataExameMedico = ( Date )exame.get( ExamesData.DATA ); + Integer tipoExameMedico = (Integer)exame.get( ExamesData.TIPO ); + Integer tipoOcasionalExameMedico = (Integer)exame.get( ExamesData.OCASIONAL ); + Integer resultadoExameMedico = (Integer)exame.get( ExamesData.RESULTADO ); + Element exameMedicoElement = new Element( "exame-medico" ); + Element dataExameMedicoElement = new Element( "data" ); + dataExameMedicoElement.setText( dataExameMedico != null ? df.format( dataExameMedico ) : "" ); + exameMedicoElement.addContent( dataExameMedicoElement ); + Element tipoExameMedicoElement = new Element( "tipo" ); + Element admissaoTipoExameMedicoElement = new Element( "admissao" ); + admissaoTipoExameMedicoElement.setText( tipoExameMedico.intValue() == 1 ? "y" : "n" ); + tipoExameMedicoElement.addContent( admissaoTipoExameMedicoElement ); + Element periodicoTipoExameMedicoElement = new Element( "periodico" ); + periodicoTipoExameMedicoElement.setText( tipoExameMedico.intValue() == 2 ? "y" : "n" ); + tipoExameMedicoElement.addContent( periodicoTipoExameMedicoElement ); + Element ocasionalTipoExameMedicoElement = new Element( "ocasional" ); + ocasionalTipoExameMedicoElement.setText( tipoExameMedico.intValue() == 3 ? "y" : "n" ); + tipoExameMedicoElement.addContent( ocasionalTipoExameMedicoElement ); + Element ocasionalDoencaTipoExameMedicoElement = new Element( "ocasional-doenca" ); + ocasionalDoencaTipoExameMedicoElement.setText( + ( tipoExameMedico.intValue() == 3 && tipoOcasionalExameMedico != null && tipoOcasionalExameMedico.intValue() == 1 ) ? "y" : "n" ); + tipoExameMedicoElement.addContent( ocasionalDoencaTipoExameMedicoElement ); + Element ocasionalAcidenteTipoExameMedicoElement = new Element( "ocasional-acidente" ); + ocasionalAcidenteTipoExameMedicoElement.setText( + ( tipoExameMedico.intValue() == 3 && tipoOcasionalExameMedico != null && tipoOcasionalExameMedico.intValue() == 2 ) ? "y" : "n" ); + tipoExameMedicoElement.addContent( ocasionalAcidenteTipoExameMedicoElement ); + Element ocasionalPedidoTrabalhadorTipoExameMedicoElement = new Element( "ocasional-pedido-trabalhador" ); + ocasionalPedidoTrabalhadorTipoExameMedicoElement.setText( + ( tipoExameMedico.intValue() == 3 && tipoOcasionalExameMedico != null && tipoOcasionalExameMedico.intValue() == 3 ) ? "y" : "n" ); + tipoExameMedicoElement.addContent( ocasionalPedidoTrabalhadorTipoExameMedicoElement ); + Element ocasionalPedidoServicoTipoExameMedicoElement = new Element( "ocasional-pedido-servico" ); + ocasionalPedidoServicoTipoExameMedicoElement.setText( + ( tipoExameMedico.intValue() == 3 && tipoOcasionalExameMedico != null && tipoOcasionalExameMedico.intValue() == 4 ) ? "y" : "n" ); + tipoExameMedicoElement.addContent( ocasionalPedidoServicoTipoExameMedicoElement ); + Element ocasionalMudancaoFuncaoTipoExameMedicoElement = new Element( "ocasional-mudanca-funcao" ); + ocasionalMudancaoFuncaoTipoExameMedicoElement.setText( + ( tipoExameMedico.intValue() == 3 && tipoOcasionalExameMedico != null && tipoOcasionalExameMedico.intValue() == 5 ) ? "y" : "n" ); + tipoExameMedicoElement.addContent( ocasionalMudancaoFuncaoTipoExameMedicoElement ); + Element ocasionalAlteracaoCondicoesTrabalhoTipoExameMedicoElement = new Element( "ocasional-alteracao-condicoes-trabalho" ); + ocasionalAlteracaoCondicoesTrabalhoTipoExameMedicoElement.setText( + ( tipoExameMedico.intValue() == 3 && tipoOcasionalExameMedico != null && tipoOcasionalExameMedico.intValue() == 6 ) ? "y" : "n" ); + tipoExameMedicoElement.addContent( ocasionalAlteracaoCondicoesTrabalhoTipoExameMedicoElement ); + Element ocasionalOutroTipoExameMedicoElement = new Element( "ocasional-outro" ); + ocasionalOutroTipoExameMedicoElement.setText( + ( tipoExameMedico.intValue() == 3 && tipoOcasionalExameMedico != null && tipoOcasionalExameMedico.intValue() == 10 ) ? "y" : "n" ); + tipoExameMedicoElement.addContent( ocasionalOutroTipoExameMedicoElement ); + Element ocasionalOutroDescricaoTipoExameMedicoElement = new Element( "ocasional-outro-descricao" ); + ocasionalOutroDescricaoTipoExameMedicoElement.setText( (String)exame.get( ExamesData.OUTRO_TIPO ) ); + tipoExameMedicoElement.addContent( ocasionalOutroDescricaoTipoExameMedicoElement ); + exameMedicoElement.addContent( tipoExameMedicoElement ); + Element resultadoExameMedicoElement = new Element( "resultado" ); + Element aptoResultadoExameMedicoElement = new Element( "apto" ); + aptoResultadoExameMedicoElement.setText( resultadoExameMedico.intValue() == 1 ? "y" : "n" ); + resultadoExameMedicoElement.addContent( aptoResultadoExameMedicoElement ); + Element aptoCondicionalmenteResultadoExameMedicoElement = new Element( "apto-condicionalmente" ); + aptoCondicionalmenteResultadoExameMedicoElement.setText( resultadoExameMedico.intValue() == 2 ? "y" : "n" ); + resultadoExameMedicoElement.addContent( aptoCondicionalmenteResultadoExameMedicoElement ); + Element inaptoTemporariamenteResultadoExameMedicoElement = new Element( "inapto-temporariamente" ); + inaptoTemporariamenteResultadoExameMedicoElement.setText( resultadoExameMedico.intValue() == 3 ? "y" : "n" ); + resultadoExameMedicoElement.addContent( inaptoTemporariamenteResultadoExameMedicoElement ); + Element inaptoDefinitivamenteResultadoExameMedicoElement = new Element( "inapto-definitivamente" ); + inaptoDefinitivamenteResultadoExameMedicoElement.setText( resultadoExameMedico.intValue() == 4 ? "y" : "n" ); + resultadoExameMedicoElement.addContent( inaptoDefinitivamenteResultadoExameMedicoElement ); + Element outrasFuncoes1ResultadoExameMedicoElement = new Element( "outras-funcoes-1" ); + outrasFuncoes1ResultadoExameMedicoElement.setText( (String)exame.get( ExamesData.OUTRA_FUNCAO_1 ) ); + resultadoExameMedicoElement.addContent( outrasFuncoes1ResultadoExameMedicoElement ); + Element outrasFuncoes2ResultadoExameMedicoElement = new Element( "outras-funcoes-2" ); + outrasFuncoes2ResultadoExameMedicoElement.setText( (String)exame.get( ExamesData.OUTRA_FUNCAO_2 ) ); + resultadoExameMedicoElement.addContent( outrasFuncoes2ResultadoExameMedicoElement ); + Element outrasFuncoes3ResultadoExameMedicoElement = new Element( "outras-funcoes-3" ); + outrasFuncoes3ResultadoExameMedicoElement.setText( (String)exame.get( ExamesData.OUTRA_FUNCAO_3 ) ); + resultadoExameMedicoElement.addContent( outrasFuncoes3ResultadoExameMedicoElement ); + Element outrasFuncoes4ResultadoExameMedicoElement = new Element( "outras-funcoes-4" ); + outrasFuncoes4ResultadoExameMedicoElement.setText( (String)exame.get( ExamesData.OUTRA_FUNCAO_4 ) ); + resultadoExameMedicoElement.addContent( outrasFuncoes4ResultadoExameMedicoElement ); + exameMedicoElement.addContent( resultadoExameMedicoElement ); + rootElement.addContent( exameMedicoElement ); + + Date dataProximoExame = ( Date )exame.get( ExamesData.PROXIMO_EXAME ); + Element proximoExameElement = new Element( "proximo-element" ); + proximoExameElement.setText( dataProximoExame != null ? df.format( dataProximoExame ) : "" ); + rootElement.addContent( proximoExameElement ); + + Element outrasRecomendacoesElement = new Element( "outras-recomendacoes" ); + outrasRecomendacoesElement.setText( (String)exame.get( ExamesData.OUTRAS_RECOMENDACOES ) ); + rootElement.addContent( outrasRecomendacoesElement ); + + Element medicoElement = new Element( "medico" ); + Element nomeMedicoElement = new Element( "nome" ); + nomeMedicoElement.setText( (String)medico.get( MedicosData.NOME ) ); + medicoElement.addContent( nomeMedicoElement ); + Element cedulaMedicoElement = new Element( "cedula" ); + cedulaMedicoElement.setText( (String)medico.get( MedicosData.NUMERO_CEDULA ) ); + medicoElement.addContent( cedulaMedicoElement ); + rootElement.addContent( medicoElement ); + + Document doc = new Document( rootElement ); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + new XMLOutputter().output( doc, baos ); + return baos.toByteArray(); + } + + private void excel() + { + FileDialog fd = new FileDialog( this, "Escolha um ficheiro Excel:", FileDialog.LOAD ); + fd.setDirectory( System.getProperty( "user.home" ) ); + fd.setFilenameFilter( new FilenameFilter() { + public boolean accept( File dir, String name ) + { + return (name!=null) && (name.indexOf( ".xls" ) != -1); + } + } ); + fd.setVisible( true ); + //String filename = "c:\\test.xls"; + String filename = fd.getFile(); + if( filename != null ) + { + filename = fd.getDirectory() + File.separator + filename; + try + { + Importer importer = new Importer( this, filename, false, Importer.TYPE_ADMISSAO ); + Hashtable hash = importer.getData(); + if( hash != null ) + { + trabalhadorPanel.setData( hash ); + } + } + catch( Exception ex ) + { + ex.printStackTrace(); + JOptionPane.showMessageDialog( this, "Erro a importar", "Erro...", JOptionPane.ERROR_MESSAGE ); + } + } + + } + + private void printOld() + { + if( trabalhadorID != null ) + { + Vector linhas; + try + { + IDObject fichas[] = fdpProvider.getAllFichasForTrabalhador( trabalhadorID ); + linhas = new Vector( Arrays.asList( fichas ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a criar lista de Fichas anteriores", true ); + return; + } + ListActionDialog dialog = new ListActionDialog( this, "Imprimir Fichas Anteriores", new String[]{ "Data" }, + linhas, this ); + dialog.setSize( 250, 200 ); + useFO = false; + dialog.setVisible( true ); + } + } + +// private void printOldFO() +// { +// if( trabalhadorID != null ) +// { +// Vector linhas; +// try +// { +// IDObject fichas[] = fdpProvider.getAllFichasForTrabalhador( trabalhadorID ); +// linhas = new Vector( Arrays.asList( fichas ) ); +// } +// catch( Exception ex ) +// { +// DialogException.showExceptionMessage( ex, "Erro a criar lista de Fichas anteriores", true ); +// return; +// } +// ListActionDialog dialog = new ListActionDialog( this, "Imprimir Fichas Anteriores", new String[]{ "Data" }, +// linhas, this ); +// dialog.setSize( 250, 200 ); +// useFO = true; +// dialog.setVisible( true ); +// } +// } + + public boolean executeListAction( int line, Object value ) + { + if( value != null ) + { + try + { +// if( useFO ) +// { +// ExamesData exame = (ExamesData) JDO.load( ExamesData.class, ( ( IDObject )value ).getID() ); +// if( exame == null ) +// { +// throw new Exception( "N\u00e3o existe exame" ); +// } +// byte fo[] = (byte[]) exame.get( ExamesData.FO ); +// Printer.printFO( fo ); +// } +// else +// { + print( ( ( IDObject )value ).getID(), false ); +// } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a imprimir Ficha", true ); + return false; + } + } + return true; + } + + public String getListActionName() + { + return "Imprimir"; + } + + private void delete( Integer exameID ) + throws Exception + { +// MetaObject exame = fdpProvider.load( fdpProvider.EXAMES, new DBKey( exameID ) ); + ExamesData exame = (ExamesData) JDO.load( ExamesData.class, exameID ); + if( exame == null ) + { + throw new Exception( "N\u00e3o existe exame" ); + } + if( JOptionPane.showConfirmDialog( this, + "Tem a certeza que quer apagar o exame de " + exame.get( ExamesData.DATA ) + "?", + "...", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null ) == 0 ) + { +// exame.set( ExamesData.INACTIVO, "y" ); +// exame.save(); + exame.delete(); + } + } + + + public void editTrabalhador( Integer trabalhadorID, SaveExameListener listener ) + { + System.out.println( "edit trabalhador: " + trabalhadorID ); + if( isVisible() ) + { + toFront(); + } + else + { + setVisible( true ); + } + imposedTrabalhadorID = trabalhadorID; + executeAction( NEW_INDEX ); + exameListener = listener; + } + + public void editTrabalhador( Integer trabalhadorID, Date ultimaConsulta, Integer motivoProcesso, SaveExameListener listener ) + { + editTrabalhador(trabalhadorID,listener); + examePanel.setup( ultimaConsulta, motivoProcesso ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/MedicoColumnizedObject.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/MedicoColumnizedObject.java new file mode 100644 index 00000000..f8d64bbd --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/MedicoColumnizedObject.java @@ -0,0 +1,46 @@ +/* + * MedicoColumnizedObject.java + * + * Created on 12 de Abril de 2004, 11:53 + */ + +package siprp.ficha; + +import com.evolute.utils.tables.ColumnizedObject; + +/** + * + * @author fpalma + */ +public class MedicoColumnizedObject implements ColumnizedObject +{ + private Integer id; + private String nome; + private String numero; + + /** Creates a new instance of MedicoColumnizedObject */ + public MedicoColumnizedObject( Integer id, String nome, String numero ) + { + this.id = id; + this.nome = nome; + this.numero = numero; + } + + public Object getValue( int col ) + { + switch( col ) + { + case 0: + return nome; + + case 1: + return numero; + } + return null; + } + + public Integer getID() + { + return id; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/MedicoEditor.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/MedicoEditor.java new file mode 100644 index 00000000..326a492b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/MedicoEditor.java @@ -0,0 +1,281 @@ +/* + * MedicoEditor.java + * + * Created on 10 de Abril de 2004, 20:50 + */ + +package siprp.ficha; + +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionListener; + +import siprp.FichaDataProvider; +import siprp.data.outer.MedicosData; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.VectorTableModel; +import com.evolute.utils.ui.CustomJDialog; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.text.CopyPasteHandler; + +/** + * + * @author Administrator + */ +public class MedicoEditor extends CustomJDialog + implements ActionListener, ListSelectionListener +{ + + private ProviderInterface JDO; + private FichaDataProvider provider; + private BaseTable table; + private VectorTableModel model; + private JButton okButton; + private JButton cancelarButton; + private JButton novoButton; + private JTextField nomeText; + private JTextField numeroText; + private Integer id; + private boolean isNew = false; + + /** Creates a new instance of MedicoEditor */ + public MedicoEditor( JFrame owner ) + throws Exception + { + super( owner, true ); + provider = (FichaDataProvider)FichaDataProvider.getProvider(); + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + setSize( 600, 300 ); + setResizable( false ); + setTitle( "Criar/Editar M\u00e9dico" ); + centerSuper(); + + model = new VectorTableModel( new String[]{ "Nome", "NC" } ); + table = new BaseTable( model ); + table.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + JScrollPane scp = new JScrollPane(); + scp.setMinimumSize( new Dimension( 300, 200 ) ); + scp.setMaximumSize( new Dimension( 300, 200 ) ); + scp.setPreferredSize( new Dimension( 300, 200 ) ); + scp.setSize( new Dimension( 300, 200 ) ); + scp.setViewportView( table ); + scp.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + scp.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + table.fixColumnWidth( 0, 200 ); + table.setNonResizableNorReordable(); + table.getSelectionModel().addListSelectionListener( this ); + Object obj[][] = provider.getAllMedicos(); + Vector medicos = new Vector(); + for( int n = 0; n < obj.length; n++ ) + { + medicos.add( new MedicoColumnizedObject( (Integer)obj[n][0], + (String)obj[n][1], + (String)obj[n][2] ) ); + } + model.setValues( medicos ); + + okButton = new JButton( "OK" ); + cancelarButton = new JButton( "Cancelar" ); + novoButton = new JButton( "Novo" ); + okButton.addActionListener( this ); + cancelarButton.addActionListener( this ); + novoButton.addActionListener( this ); + + nomeText = new JTextField(); + nomeText.setEnabled( false ); + numeroText = new JTextField(); + numeroText.setEnabled( false ); + + GridBagLayout gridbag = new GridBagLayout(); + getContentPane().setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 1; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + + JPanel upperPanel = new JPanel(); + upperPanel.setLayout( new GridLayout( 1, 2 ) ); + upperPanel.add( scp ); + JPanel textPanel = new JPanel(); + upperPanel.add( textPanel ); + gridbag.setConstraints( upperPanel, constraints ); + getContentPane().add( upperPanel ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.weightx = 0.3; + constraints.gridwidth = 1; + constraints.gridheight = GridBagConstraints.REMAINDER;; + + gridbag.setConstraints( novoButton, constraints ); + getContentPane().add( novoButton ); + + gridbag.setConstraints( okButton, constraints ); + getContentPane().add( okButton ); + + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( cancelarButton, constraints ); + getContentPane().add( cancelarButton ); + + gridbag = new GridBagLayout(); + textPanel.setLayout( gridbag ); + constraints.weighty = 0; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + + JLabel nomeLabel = new JLabel( "Nome" ); + gridbag.setConstraints( nomeLabel, constraints ); + textPanel.add( nomeLabel ); + + gridbag.setConstraints( nomeText, constraints ); + textPanel.add( nomeText ); + + JLabel numeroLabel = new JLabel( "N\u00famero" ); + gridbag.setConstraints( numeroLabel, constraints ); + textPanel.add( numeroLabel ); + + gridbag.setConstraints( numeroText, constraints ); + textPanel.add( numeroText ); + + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER;; + JPanel pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + textPanel.add( pad ); + + new CopyPasteHandler( nomeText ); + new CopyPasteHandler( numeroText ); + } + + public void actionPerformed( ActionEvent e ) + { + if( e.getSource().equals( okButton ) ) + { + if( save() ) + { + close(); + } + } + else if( e.getSource().equals( cancelarButton ) ) + { + close(); + } + if( e.getSource().equals( novoButton ) ) + { + table.getSelectionModel().removeListSelectionListener( this ); + nomeText.setText( "" ); + numeroText.setText( "" ); + nomeText.setEnabled( true ); + numeroText.setEnabled( true ); + id = null; + isNew = true; + } + } + + public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent) + { + int selected = table.getSelectedRow(); + if( selected == -1 ) + { + return; + } + MedicoColumnizedObject row = (MedicoColumnizedObject)model.getRowAt( selected ); + id = row.getID(); + String nome = (String) row.getValue( 0 ); + String numero = (String) row.getValue( 1 ); + nomeText.setText( nome ); + numeroText.setText( numero ); + nomeText.setEnabled( true ); + numeroText.setEnabled( true ); + } + + private void close() + { + setVisible( false ); + dispose(); + } + + public boolean getIsNew() + { + return isNew; + } + + public Integer getID() + { + return id; + } + + private boolean save() + { + String nome = nomeText.getText().trim(); + String numero = numeroText.getText().trim(); + if( nome.length() == 0 ) + { + JOptionPane.showMessageDialog( this, "O Nome n\u00e3o pode ser vazio.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + return false; + } + try + { + MedicosData medico; + if( id != null ) + { + medico = ( MedicosData ) JDO.load( MedicosData.class, id ); +// medico = provider.load( provider.MEDICOS, new DBKey( id ) ); + } + else + { + medico = new MedicosData(); +// medico = provider.createObject( provider.MEDICOS ); + } +// medico.setProperty( provider.NOME, nome ); +// medico.setProperty( provider.NUMERO_CEDULA, numero ); + medico.set( MedicosData.NOME, nome ); + medico.set( MedicosData.NUMERO_CEDULA, numero ); + medico.save(); + if( id == null ) + { +// DBKey key = medico.getPrimaryKeyValue(); +// DBField fields[] = provider.MEDICOS.getPrimaryKey(); +// id = new Integer( ((Number)key.getFieldValue( fields[ 0 ] )).intValue() ); + id = (Integer)medico.get( MedicosData.ID ); + } + } + catch( Exception ex ) + { +// JOptionPane.showMessageDialog( this, "Erro a gravar...", "Erro...", +// JOptionPane.ERROR_MESSAGE ); + DialogException.showExceptionMessage( ex, "Erro a gravar...", false ); + return false; + } + return true; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ObservacoesPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ObservacoesPanel.java new file mode 100644 index 00000000..f0af82de --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ObservacoesPanel.java @@ -0,0 +1,103 @@ +/* + * ObservacoesPanel.java + * + * Created on 29 de Marco de 2004, 11:56 + */ + +package siprp.ficha; + +import java.awt.GridLayout; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import siprp.FichaDataProvider; +import siprp.data.outer.TrabalhadoresData; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.documents.MaximumLengthDocument; +import com.evolute.utils.ui.text.CopyPasteHandler; +/** + * + * @author fpalma + */ +public class ObservacoesPanel extends JPanel + implements ControllableComponent +{ + private ProviderInterface JDO; + + private JTextField observacoesText; + + private FichaDataProvider provider; + + /** Creates a new instance of ObservacoesPanel */ + public ObservacoesPanel() + throws Exception + { + provider = (FichaDataProvider)FichaDataProvider.getProvider(); + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + } + + private void setupComponents() + { + setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Observa\u00e7\u00f5es" ) ); + +// JScrollPane scp = new JScrollPane(); +// scp.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); +// scp.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + observacoesText = new JTextField(); + observacoesText.setDocument( new MaximumLengthDocument( 150 ) ); +// observacoesText.setLineWrap( true ); +// observacoesText.setWrapStyleWord( true ); +// scp.setViewportView( observacoesText ); + + setLayout( new GridLayout( 1, 1, 0, 0 ) ); + add( observacoesText ); + + new CopyPasteHandler( observacoesText ); + } + + public void fill(Object value) + { + clear(); + Integer trabalhadorID = (Integer)value; + if( trabalhadorID != null ) + { + + try + { + TrabalhadoresData trabalhador = (TrabalhadoresData)JDO.load( TrabalhadoresData.class, trabalhadorID ); + String observacoes = (String) trabalhador.get( TrabalhadoresData.OBSERVACOES ); + if( observacoes != null ) + { + observacoesText.setText( observacoes ); + } + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + } + + public Object save() + { + return observacoesText.getText(); + } + + public void clear() + { + observacoesText.setText( "" ); + } + + public void setEnabled( boolean enable ) + { + observacoesText.setEnabled( enable ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/PDFFilePrinter.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/PDFFilePrinter.java new file mode 100644 index 00000000..a3e0b5ea --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/PDFFilePrinter.java @@ -0,0 +1,57 @@ +package siprp.ficha; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.print.PageFormat; +import java.nio.ByteBuffer; + +import com.evolute.utils.print.A4ContinuoPage; +import com.evolute.utils.print.AbstractPrintHandler; +import com.sun.pdfview.PDFFile; +import com.sun.pdfview.PDFPage; +import com.sun.pdfview.PDFRenderer; + +public class PDFFilePrinter extends AbstractPrintHandler +{ + protected byte pdf[]; + protected PDFFile pdffile; + + public PDFFilePrinter(byte pdf[], boolean printDialog ) + throws Exception + { + super( new A4ContinuoPage(), printDialog ); + + this.pdf = pdf; + ByteBuffer buffer = ByteBuffer.allocate( pdf.length ); + buffer.put( pdf ); +// + +// File file = new File("/home/fpalma/Desktop/icons_op.pdf"); +// +// // set up the PDF reading +// RandomAccessFile raf = new RandomAccessFile(file, "r"); +// FileChannel channel = raf.getChannel(); +// ByteBuffer buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size()); + pdffile = new PDFFile(buffer); + setNumberOfPages( pdffile.getNumPages() ); + print(); + } + + protected void paintGraphics( Graphics g, PageFormat pf, int index ) + { + try + { + PDFPage page = pdffile.getPage( index ); + PDFRenderer renderer = new PDFRenderer(page, ( Graphics2D ) g, + new Rectangle(0, 0,(int) page.getWidth(), (int) page.getHeight()), null, Color.RED); + page.waitForFinish(); + renderer.run(); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/RecomendacoesPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/RecomendacoesPanel.java new file mode 100644 index 00000000..2e387342 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/RecomendacoesPanel.java @@ -0,0 +1,64 @@ +/* + * RecomendacoesPanel.java + * + * Created on 29 de Marco de 2004, 11:58 + */ + +package siprp.ficha; + +import java.awt.BorderLayout; +import java.awt.GridLayout; + +import javax.swing.BorderFactory; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +import com.evolute.utils.documents.MaximumLengthDocument; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import com.evolute.utils.ui.text.CopyPasteHandler; + +/** + * + * @author fpalma + */ +public class RecomendacoesPanel extends JPanel +{ + private JTextArea recomendacoesText; + private JCalendarPanel proximoExamePanel; + /** Creates a new instance of RecomendacoesPanel */ + public RecomendacoesPanel() + { + setupComponents(); + } + + private void setupComponents() + { + setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Outras Recomenda\u00e7\u00f5es" ) ); + + JScrollPane scp = new JScrollPane(); + scp.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + scp.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + recomendacoesText = new JTextArea(); + recomendacoesText.setLineWrap( true ); + recomendacoesText.setWrapStyleWord( true ); + recomendacoesText.setDocument( new MaximumLengthDocument( 150 ) ); + scp.setViewportView( recomendacoesText ); + JPanel rightPanel = new JPanel(); + JLabel proximoExameLabel = new JLabel( "Pr\u00f3ximo Exame" ); + proximoExamePanel = new JCalendarPanel( null ); + + setLayout( new GridLayout( 1, 2, 0, 0 ) ); + add( scp ); + add( rightPanel ); + + rightPanel.setLayout( new BorderLayout() ); + rightPanel.add( proximoExameLabel, BorderLayout.WEST ); + rightPanel.add( proximoExamePanel, BorderLayout.CENTER ); + + new CopyPasteHandler( recomendacoesText ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/SaveExameListener.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/SaveExameListener.java new file mode 100644 index 00000000..ccb16da8 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/SaveExameListener.java @@ -0,0 +1,19 @@ +/* + * SaveExameListener.java + * + * Created on May 17, 2007, 12:33 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.ficha; + +/** + * + * @author lflores + */ +public interface SaveExameListener +{ + public void exameSaved( Integer trabalhadorID, Integer exameID ); +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/TrabalhadorPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/TrabalhadorPanel.java new file mode 100644 index 00000000..d0f111f3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/TrabalhadorPanel.java @@ -0,0 +1,488 @@ +/* + * TrabalhadorPanel.java + * + * Created on 29 de Marco de 2004, 11:55 + */ + +package siprp.ficha; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.util.Hashtable; +import java.util.Map; + +import javax.swing.BorderFactory; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import siprp.FichaDataProvider; +import siprp.data.outer.TrabalhadoresData; +import siprp.importer.Importer; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.dataui.ComponentController; +import com.evolute.utils.dataui.ComponentsHashtable; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.date.DateUtils; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import com.evolute.utils.ui.panel.RadioButtonFixedPanel; +import com.evolute.utils.ui.panel.RadioButtonPanel; +import com.evolute.utils.ui.text.CopyPasteHandler; +/** + * + * @author fpalma + */ +public class TrabalhadorPanel extends JPanel + implements ControllableComponent +{ + private ProviderInterface JDO; + private JTextField nomeText; + private RadioButtonFixedPanel sexoPanel; + private JCalendarPanel dataNascimentoPanel; + private JTextField nacionalidadeText; + private JTextField numeroMecanograficoText; + private JCalendarPanel dataAdmissaoPanel; + private JTextField categoriaText; + private JTextField localText; + private JTextField funcaoText; + private JCalendarPanel dataAdmissaoFuncaoPanel; + + private ComponentsHashtable components; + private FichaDataProvider provider; + private TrabalhadoresData trabalhador; + + /** Creates a new instance of TrabalhadorPanel */ + + public TrabalhadorPanel() + throws Exception + { + provider = (FichaDataProvider)FichaDataProvider.getProvider(); + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + setupComponentsHashtable(); + } + + + private void setupComponents() + { + setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Trabalhador" ) ); + JLabel nomeLabel = new JLabel( "Nome" ); + nomeText = new JTextField(); + JLabel sexoLabel = new JLabel( "Sexo" ); + sexoPanel = + new RadioButtonFixedPanel( + new IDObject[]{ new MappableObject( new Integer( 1 ), "M" ), + new MappableObject( new Integer( 2 ), "F" ) }, + 1, 2, RadioButtonPanel.ORIENTATION_HORIZONTAL, false ); + JLabel dataNascimentoLabel = new JLabel( "Data de Nascimento" ); + dataNascimentoPanel = new JCalendarPanel( null ); + JLabel nacionalidadeLabel = new JLabel( "Nacionalidade" ); + nacionalidadeText = new JTextField(); + JLabel numeroMecanograficoLabel = new JLabel( "N\u00famero Mecanogr\u00e1fico/outro" ); + numeroMecanograficoText = new JTextField(); + JLabel dataAdmissaoLabel = new JLabel( "Data de Admiss\u00e3o" ); + dataAdmissaoPanel = new JCalendarPanel( null ); + JLabel categoriaLabel = new JLabel( "Categoria Profissional" ); + categoriaText = new JTextField(); + JLabel localLabel = new JLabel( "Local de Trabalho" ); + localText = new JTextField(); + JLabel funcaoLabel = new JLabel( "Fun\u00e7\u00e3o proposta" ); + funcaoText = new JTextField(); + JLabel dataAdmissaoFuncaoLabel = new JLabel( "Data de Admiss\u00e3o na Fun\u00e7\u00e3o" ); + dataAdmissaoFuncaoPanel = new JCalendarPanel( null ); + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 0, 1, 0, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.gridwidth = 1; + constraints.weightx = 0; + + gridbag.setConstraints( nomeLabel, constraints ); + add( nomeLabel ); + + constraints.weightx = 1; + constraints.gridwidth = 3; + gridbag.setConstraints( nomeText, constraints ); + add( nomeText ); + + constraints.gridwidth = 1; + constraints.weightx = 0; + gridbag.setConstraints( sexoLabel, constraints ); + add( sexoLabel ); + + constraints.weightx = 0; + //constraints.gridwidth = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( sexoPanel, constraints ); + add( sexoPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 2; + gridbag.setConstraints( nacionalidadeLabel, constraints ); + add( nacionalidadeLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = 1; + gridbag.setConstraints( nacionalidadeText, constraints ); + add( nacionalidadeText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( dataNascimentoLabel, constraints ); + add( dataNascimentoLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( dataNascimentoPanel, constraints ); + add( dataNascimentoPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 2; + gridbag.setConstraints( numeroMecanograficoLabel, constraints ); + add( numeroMecanograficoLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = 1; + gridbag.setConstraints( numeroMecanograficoText, constraints ); + add( numeroMecanograficoText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( dataAdmissaoLabel, constraints ); + add( dataAdmissaoLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( dataAdmissaoPanel, constraints ); + add( dataAdmissaoPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 2; + gridbag.setConstraints( categoriaLabel, constraints ); + add( categoriaLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = 1; + gridbag.setConstraints( categoriaText, constraints ); + add( categoriaText ); + + constraints.weightx = 0; + gridbag.setConstraints( localLabel, constraints ); + add( localLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( localText, constraints ); + add( localText ); + + constraints.weightx = 0; + constraints.gridwidth = 2; + gridbag.setConstraints( funcaoLabel, constraints ); + add( funcaoLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = 1; + gridbag.setConstraints( funcaoText, constraints ); + add( funcaoText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( dataAdmissaoFuncaoLabel, constraints ); + add( dataAdmissaoFuncaoLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( dataAdmissaoFuncaoPanel, constraints ); + add( dataAdmissaoFuncaoPanel ); + + new CopyPasteHandler( nomeText ); + new CopyPasteHandler( nacionalidadeText ); + new CopyPasteHandler( numeroMecanograficoText ); + new CopyPasteHandler( categoriaText ); + new CopyPasteHandler( localText ); + new CopyPasteHandler( funcaoText ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( TrabalhadoresData.NOME, nomeText ); + components.putComponent( TrabalhadoresData.SEXO, new ControllableComponent() + { + public void fill( Object value ) + { + if( value != null && value.equals( "f" ) ) + { + sexoPanel.fill( new Integer(2) ); + } + else + { + sexoPanel.fill( new Integer(1) ); + } + } + + public Object save() + { + Integer id = (Integer)sexoPanel.save(); + if( id != null && id.intValue() == 1 ) + { + return "m"; + } + return "f"; + } + + public void clear() + { + sexoPanel.clear(); + } + + public void setEnabled( boolean enable ) + { + sexoPanel.setEnabled( enable ); + } + } ); + components.putComponent( TrabalhadoresData.DATA_NASCIMENTO, dataNascimentoPanel ); + components.putComponent( TrabalhadoresData.NACIONALIDADE, nacionalidadeText ); + components.putComponent( TrabalhadoresData.NUMERO_MECANOGRAFICO, numeroMecanograficoText ); + components.putComponent( TrabalhadoresData.DATA_ADMISSAO, dataAdmissaoPanel ); + components.putComponent( TrabalhadoresData.CATEGORIA, categoriaText ); + components.putComponent( TrabalhadoresData.LOCAL_TRABALHO, localText ); + components.putComponent( TrabalhadoresData.FUNCAO_PROPOSTA, funcaoText ); + components.putComponent( TrabalhadoresData.DATA_ADMISSAO_FUNCAO, dataAdmissaoFuncaoPanel ); + components.putDummy( TrabalhadoresData.DATA_DEMISSAO ); + components.putDummy( TrabalhadoresData.OBSERVACOES ); + components.putDummy( TrabalhadoresData.OBSERVACOES_GESTAO ); + components.putDummy( TrabalhadoresData.PERFIL ); + components.putDummy( TrabalhadoresData.TO_ESTABELECIMENTO_ID ); + components.putDummy( TrabalhadoresData.NOME_PLAIN ); + components.putDummy( TrabalhadoresData.BI ); + +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.NOME, nomeText ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.DATA_NASCIMENTO, dataNascimentoPanel ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.NACIONALIDADE, nacionalidadeText ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.NUMERO_MECANOGRAFICO, numeroMecanograficoText ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.DATA_ADMISSAO, dataAdmissaoPanel ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.CATEGORIA, categoriaText ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.LOCAL_TRABALHO, localText ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.FUNCAO_PROPOSTA, funcaoText ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.DATA_ADMISSAO_FUNCAO, dataAdmissaoFuncaoPanel ); +// components.putDummy( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.ESTABELECIMENTO_ID ); +// components.putDummy( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.OBSERVACOES ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.SEXO, +// new ControllableComponent() +// { +// public void fill( Object value ) +// { +// if( value != null && value.equals( "f" ) ) +// { +// sexoPanel.fill( new Integer(2) ); +// } +// else +// { +// sexoPanel.fill( new Integer(1) ); +// } +// } +// +// public Object save() +// { +// Integer id = (Integer)sexoPanel.save(); +// if( id != null && id.intValue() == 1 ) +// { +// return "m"; +// } +// return "f"; +// } +// +// public void clear() +// { +// sexoPanel.clear(); +// } +// +// public void setEnabled( boolean enable ) +// { +// sexoPanel.setEnabled( enable ); +// } +// } ); + } + + public void fill(Object value) + { + clear(); + trabalhador = null; + if( value != null ) + { + Integer trabalhadorID = (Integer)value; + if( trabalhadorID != null ) + { + try + { + trabalhador = ( TrabalhadoresData ) JDO.load( TrabalhadoresData.class, trabalhadorID ); + String names[] = trabalhador.getFieldNames(); + ComponentController.fill( names, trabalhador.getHashData(), components ); +// trabalhador = provider.load( FichaDataProvider.TRABALHADORES, new DBKey( trabalhadorID ) ); +// DBField fields[] = FichaDataProvider.TRABALHADORES.getInsertFields(); +// String trabalhadorFields[] = new String[ fields.length ]; +// Hashtable data = new Hashtable(); +// for( int i = 0; i < trabalhadorFields.length; ++i ) +// { +// trabalhadorFields[ i ] = fields[ i ].FULL_NAME; +// Object fieldValue = trabalhador.getProperty( trabalhadorFields[ i ] ); +// if( fieldValue != null ) +// { +// data.put( trabalhadorFields[ i ], fieldValue ); +// } +// } +// ComponentController.fill( trabalhadorFields, data, components ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os dados do trabalhador", true ); + } + } + } + + } + + public Object save() + { + StringBuffer msg = new StringBuffer(); + boolean hasMsg = false; + try + { + if( trabalhador == null ) + { +// trabalhador = provider.createObject( FichaDataProvider.TRABALHADORES ); + trabalhador = new TrabalhadoresData(); + trabalhador.set( TrabalhadoresData.PERFIL, new Integer( 1 ) ); + } +// DBField fields[] = FichaDataProvider.TRABALHADORES.getInsertFields(); +// String trabalhadorFields[] = new String[ fields.length ]; +// for( int i = 0; i < trabalhadorFields.length; ++i ) +// { +// trabalhadorFields[ i ] = fields[ i ].FULL_NAME; +// } +// Hashtable hash = new Hashtable(); +// ComponentController.save( trabalhadorFields, hash, components ); +// Enumeration enum = hash.keys(); +// while( enum.hasMoreElements() ) +// { +// String name = ( String )enum.nextElement(); +// trabalhador.setProperty( name, hash.get( name ) ); +// } + String names[] = trabalhador.getFieldNames(); + Map hash = trabalhador.getHashData(); + ComponentController.save( names, hash, components ); + trabalhador.setHashData( hash ); +// if( ((String)trabalhador.getProperty( FichaDataProvider.NOME )).trim().length() == 0 ) + if( ((String)trabalhador.get( TrabalhadoresData.NOME )).trim().length() == 0 ) + { + msg.append( "O trabalhador tem de ter nome\n" ); + hasMsg = true; + } +// if( trabalhador.getProperty( FichaDataProvider.SEXO ) == null ) + if( trabalhador.get( TrabalhadoresData.SEXO ) == null ) + { + msg.append( "O trabalhador tem de ter um sexo definido\n" ); + hasMsg = true; + } + } + catch( Exception ex ) + { + ex.printStackTrace(); + return null; + } + if( hasMsg ) + { + throw new ValuesException( msg.toString() ); + } + return trabalhador; + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + trabalhador = null; + } + + public void setEnabled( boolean enable ) + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + } + + public void setData( Hashtable data ) + { + String nome = (String)data.get( Importer.NOME ); + if( nome != null && nome.trim().length() > 0 ) + { + nomeText.setText( nome ); + } + String sexo = (String)data.get( Importer.SEXO ); + if( sexo != null && sexo.trim().length() > 0 ) + { + Integer sexoInt; + if( sexo.trim().toLowerCase().charAt(0) == 'f' ) + { + sexoInt = new Integer( 2 ); + } + else + { + sexoInt = new Integer( 1 ); + } + sexoPanel.fill( sexoInt ); + } + String nacionalidade = (String)data.get( Importer.NACIONALIDADE ); + if( nacionalidade != null && nacionalidade.trim().length() > 0 ) + { + nacionalidadeText.setText( nacionalidade ); + } + String dataNascimento = (String)data.get( Importer.DATA_NASCIMENTO ); + if( dataNascimento != null ) + { + dataNascimentoPanel.setDate( DateUtils.guessDate( dataNascimento ) ); + } + String numeroMecanografico = (String)data.get( Importer.NUMERO_MECANOGRAFICO ); + if( numeroMecanografico != null && numeroMecanografico.trim().length() > 0 ) + { + numeroMecanograficoText.setText( numeroMecanografico ); + } + String dataAdmissao = (String)data.get( Importer.DATA_ADMISSAO ); + if( dataAdmissao != null ) + { + dataAdmissaoPanel.setDate( DateUtils.guessDate( dataAdmissao ) ); + } + String categoria = (String)data.get( Importer.CATEGORIA ); + if( categoria != null && categoria.trim().length() > 0 ) + { + categoriaText.setText( categoria ); + } + String localTrabalho = (String)data.get( Importer.LOCAL_TRABALHO ); + if( localTrabalho != null && localTrabalho.trim().length() > 0 ) + { + localText.setText( localTrabalho ); + } + String funcao = (String)data.get( Importer.FUNCAO ); + if( funcao != null && funcao.trim().length() > 0 ) + { + funcaoText.setText( funcao ); + } + String dataAdmissaoFuncao = (String)data.get( Importer.DATA_ADMISSAO_FUNCAO ); + if( dataAdmissaoFuncao != null ) + { + dataAdmissaoFuncaoPanel.setDate( DateUtils.guessDate( dataAdmissaoFuncao ) ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/UpperPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/UpperPanel.java new file mode 100644 index 00000000..63878174 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/UpperPanel.java @@ -0,0 +1,305 @@ +/* + * UpperPanel.java + * + * Created on 29 de Marco de 2004, 17:44 + */ + +package siprp.ficha; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.event.ItemListener; +import java.util.Hashtable; + +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import siprp.FichaDataProvider; +import siprp.data.outer.EmpresasData; +import siprp.data.outer.EstabelecimentosData; +import siprp.data.outer.MedicosData; +import siprp.data.outer.TrabalhadoresData; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.text.CopyPasteHandler; + +/** + * + * @author fpalma + */ +public class UpperPanel extends JPanel + implements ControllableComponent, ItemListener +{ + protected ProviderInterface JDO; + + protected JFrame owner; + private JTextField empresaText; + private JTextField nomeText; + private JComboBox medicosCombo; + private JTextField cpText; + + private FichaDataProvider provider; + private Hashtable medicosHash; + + /** Creates a new instance of UpperPanel */ + public UpperPanel() + throws Exception + { + provider = (FichaDataProvider)FichaDataProvider.getProvider(); + medicosHash = new Hashtable(); + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + JLabel empresaLabel = new JLabel( "Empresa/Entidade" ); + empresaText = new JTextField(); + empresaText.setEditable( false ); + JLabel nomeLabel = new JLabel( "Nome" ); + nomeText = new JTextField(); + nomeText.setEditable( false ); + JLabel medicoLabel = new JLabel( "M\u00e9dico" ); + medicosCombo = new JComboBox(); + JLabel cpLabel = new JLabel( "c.p." ); + cpText = new JTextField(); + cpText.setEditable( false ); + fillCombo(); + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 0, 1, 0, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridheight = 1; + constraints.weighty = 0; + + constraints.gridwidth = 1; + constraints.weightx = 0; + gridbag.setConstraints( empresaLabel, constraints ); + add( empresaLabel ); + + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1; + gridbag.setConstraints( empresaText, constraints ); + add( empresaText ); + + constraints.gridwidth = 1; + constraints.weightx = 0; + gridbag.setConstraints( nomeLabel, constraints ); + add( nomeLabel ); + + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1; + gridbag.setConstraints( nomeText, constraints ); + add( nomeText ); + + constraints.gridwidth = 1; + constraints.weightx = 0; + gridbag.setConstraints( medicoLabel, constraints ); + add( medicoLabel ); + + constraints.gridwidth = 1; + constraints.weightx = 0.8; + gridbag.setConstraints( medicosCombo, constraints ); + add( medicosCombo ); + + constraints.gridwidth = 1; + constraints.weightx = 0; + gridbag.setConstraints( cpLabel, constraints ); + add( cpLabel ); + + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 0.2; + gridbag.setConstraints( cpText, constraints ); + add( cpText ); + + new CopyPasteHandler( empresaText ); + new CopyPasteHandler( nomeText ); + new CopyPasteHandler( cpText ); + } + + public void fill(Object value) + { + Integer values[] = (Integer[])value; + Integer empresaID = values[0]; + Integer estabelecimentoID = values[1]; + Integer trabalhadorID = values[2]; + clear(); + try + { + TrabalhadoresData trabalhador; + EstabelecimentosData estabelecimento; + EmpresasData empresa; + if( trabalhadorID != null ) + { + trabalhador = ( TrabalhadoresData ) JDO.load( TrabalhadoresData.class, trabalhadorID ); + String nome = (String) trabalhador.get( TrabalhadoresData.NOME ); + nomeText.setText( nome ); + } + String nomeEstabelecimento = ""; + if( estabelecimentoID != null ) + { + estabelecimento = ( EstabelecimentosData ) JDO.load( EstabelecimentosData.class, estabelecimentoID ); + nomeEstabelecimento = (String) estabelecimento.get( EstabelecimentosData.NOME ); + try + { + Integer medicoID = provider.getMedicoForEstabelecimento( estabelecimentoID ); + if( medicoID != null && medicoID.intValue() > -1 ) + { + for( int n = 0; n < medicosCombo.getItemCount(); n++ ) + { + IDObject medico = ( IDObject ) medicosCombo.getItemAt( n ); + if( medico.getID().equals( medicoID ) ) + { + medicosCombo.setSelectedIndex( n ); + break; + } + } + } + } + catch( Exception ex ) + { + } + } + if( empresaID != null ) + { + empresa = ( EmpresasData ) JDO.load( EmpresasData.class, empresaID ); + String nomeEmpresa = (String) empresa.get( EmpresasData.DESIGNACAO_SOCIAL ); + empresaText.setText( nomeEmpresa + ( nomeEstabelecimento.length() > 0?" / " + nomeEstabelecimento:"" ) ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os dados do cabe\u00e7alho...", true ); + } + } + + public Object save() + { + Integer id = ( (IDObject) medicosCombo.getSelectedItem() ).getID(); + if( id != null ) + { + try + { + MedicosData medico = ( MedicosData )JDO.load( MedicosData.class, id ); + return medico; + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + else + { + throw new ValuesException( "A ficha tem de ter um m\u00e9dico associado" ); + } + return null; + } + + public void fillCombo() + throws Exception + { + medicosCombo.removeItemListener( this ); + medicosCombo.removeAllItems(); + medicosHash.clear(); + Object medicos[][] = provider.getAllMedicos(); + for( int n = 0; n < medicos.length; n++ ) + { + Object medico[] = new Object[ 4 ]; + medico[ 0 ] = new Integer( ( (Number)medicos[n][0] ).intValue() ); + medico[ 1 ] = medicos[ n ][ 1 ]; + medico[ 2 ] = medicos[ n ][ 2 ]; + medico[ 3 ] = new Integer( n ); + medicosHash.put( medicos[ n ][ 0 ], medico ); + medicosCombo.addItem( new MappableObject( (Integer) medico[ 0 ], medico[ 1 ] ) ); + } + + if( medicos.length > 0 ) + { + medicosCombo.setSelectedIndex( 0 ); + cpText.setText( medicos[ 0 ][ 2 ] != null?(String)medicos[ 0 ][ 2 ]:"" ); + } + else + { + medicosCombo.addItem( new MappableObject( null, "" ) ); + medicosCombo.setSelectedIndex( 0 ); + cpText.setText( "" ); + } + medicosCombo.addItem( new MappableObject( new Integer( -1 ), "Novo/Editar" ) ); + medicosCombo.addItemListener( this ); + } + + public void itemStateChanged(java.awt.event.ItemEvent itemEvent) + { + int index = medicosCombo.getSelectedIndex(); + if( index == medicosCombo.getItemCount() - 1 ) + { + try + { + MedicoEditor me = new MedicoEditor( owner ); + me.setVisible( true ); +// boolean isNew = me.getIsNew(); + Integer id = me.getID(); + if( id == null ) + { + medicosCombo.setSelectedIndex( 0 ); + } + else + { + fillCombo(); + if( id != null ) + { + Object[] medico = (Object[])medicosHash.get( id ); + medicosCombo.setSelectedIndex( ((Integer)medico[ 3 ] ).intValue() ); + } + } + + } + catch( Exception ex ) + { + JOptionPane.showMessageDialog( null, "Erro a abrir a janela de edi\u00e7\u00e3o...", "Erro...", + JOptionPane.ERROR_MESSAGE ); + ex.printStackTrace(); + medicosCombo.setSelectedIndex( 0 ); + return; + } + } + else + { + IDObject selected = (IDObject)medicosCombo.getItemAt( index ); + Integer id = selected.getID(); + if( id == null ) + { + cpText.setText( "" ); + } + else + { + Object[] medico = (Object[])medicosHash.get( id ); + cpText.setText( medico[ 2 ] != null?(String)medico[ 2 ]:"" ); + } + } + } + + public void clear() + { + empresaText.setText( "" ); + nomeText.setText( "" ); + medicosCombo.setSelectedIndex( 0 ); + } + + public void setEnabled( boolean enable ) + { + medicosCombo.setEnabled( enable ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ValuesException.java b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ValuesException.java new file mode 100644 index 00000000..e5a14882 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ValuesException.java @@ -0,0 +1,22 @@ +/* + * ValuesException.java + * + * Created on 5 de Abril de 2004, 20:22 + */ + +package siprp.ficha; + +/** + * + * @author fpalma + */ +public class ValuesException extends RuntimeException +{ + + /** Creates a new instance of ValuesException */ + public ValuesException( String msg ) + { + super( msg ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ficha_aptidao.xsl b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ficha_aptidao.xsl new file mode 100644 index 00000000..55536878 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ficha_aptidao.xsl @@ -0,0 +1,487 @@ + + + + + + + + + + + + + FICHA DE APTIDÃO + + ( + + ) + + + + + + + + Empresa/Entidade + + + + + + DESIGNAÇÃO SOCIAL: + + + + + + + + ESTABELECIMENTO: + + + + + + LOCALIDADE: + + + + + + + + + + + + + + + + + + + + SERVIÇO DE + SAÚDE: Tipo + + + + â +      + + + ✓ + + + + Interno + + + + â +      + + + ✓ + + + + Interempresas + + + + â +      + + + ✓ + + + + Externo + + + + â +      + + + ✓ + + + + Serviço + Nacional de + Saúde + + + + + + DESIGNAÇÃO: + + + + + + + + + + + + + + + + SERVIÇO DE + HIGIENE E + SEGURANÇA: + Tipo + + + â + + ✓ + + + + Interno + + + â + + ✓ + + + + Interempresas + + + â + + ✓ + + + + Externo + + + â + + ✓ + + + + Outro + + + + + + DESIGNAÇÃO: + + + + + + + + + + + + + + + + + Trabalhador + + + + + + NOME: + + + + + + + + SEXO: + + + + + + DATA DE NASCIMENTO: + + + + + + NACIONALIDADE: + + + + + + + + NÚMERO + MECANOGRÃFICO/OUTRO: + + + + CATEGORIA PROFISSIONAL: + + + + FUNÇÃO PROPOSTA: + + + + + + DATA DE ADMISSÃO: + + + + LOCAL DE TRABALHO: + + + + DATA DE ADMISSÃO NA + FUNÇÃO: + + + + + + + + + + + + + Observações + + + + + + + + + + + + + + + + + + Exame Médico + + + + + + DATA DO EXAME: + + + TIPO + + â + ADMISSÃO + + + ✓ + + + â + PERIÓDICO + + + ✓ + + + â + OCASIONAL + + + ✓ + + + â + APÓS DOENÇA + + + ✓ + + + â + APÓS ACIDENTE + + + ✓ + + + â + A PEDIDO DO TRABALHADOR + + + ✓ + + + â + A PEDIDO DO SERVIÇO + + + ✓ + + + â + POR MUDANCA DE FUNÇÃO + + + ✓ + + + â + POR ALTERAÇÃO DAS + CONDIÇÕES DE TRABALHO + + + ✓ + + + â + OUTRO + + + ✓ + + + ESPECIFIQUE: + + + + + RESULTADO + + â + APTO + + + ✓ + + + â + APTO CONDICIONALMENTE + + + ✓ + + + â + INAPTO TEMPORARIAMENTE + + + ✓ + + + â + INAPTO DEFINITIVAMENTE + + + ✓ + + + OUTRAS FUNÇÕES QUE + PODE DESEMPENHAR + + 1 + + + + 2 + + + + 3 + + + + 4 + + +   + + + + + + + + + + + Outras Recomendações + + + + + + PRÓXIMO EXAME: + + + + + + + + + + + + + + + + + MÉDICO DO TRABALHO: + + + + + + C.P. + + + + + + + ASSINATURA + _____________________________________________________________________________________________ + TOMEI CONHECIMENTO + ___________________________________________________________________ + DATA: ___/___/______ + O RESPONSÃVEL DOS RECURSOS + HUMANOS + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ficha_aptidao_teste.xml b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ficha_aptidao_teste.xml new file mode 100644 index 00000000..0935d901 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/ficha_aptidao_teste.xml @@ -0,0 +1,88 @@ + + + 111-21/12/2001 + + + Evolute - Consultoria Informatica + + + + + Sede + + + Lisboa + + + + y + n + n + n + + + SIPRP + + + + + n + n + n + y + + + SIPRP + + + + + Frederico Palma + Masculino + 30-12-1977 + Portuguesa + 32434234 + 01-10-2006 + Deus + Sede + Senhor do Universo + 01-01-10000AF + + + nada a observar + + + 03-12-2007 + + y + y + y + y + y + y + y + y + y + y + sdlfjk + + + y + y + y + y + outra-func-1 + outra-func-2 + outra-func-3 + outra-func-4 + + + 10-01-2010 + + Olho por Olho, Dente por Dente + + + Joao Antonio Pedro + 4234234 + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/out.txt b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/out.txt new file mode 100644 index 00000000..f853af5a --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/out.txt @@ -0,0 +1,6 @@ +C:\Documents and Settings\Frederico\workspace\SIPRP\SIPRPSoft\src\siprp\ficha\ficha_aptidao_teste.xml +/home/fpalma/projectos2/SIPRP/SIPRPSoft/src/siprp/ficha/ficha_aptidao_teste.xml + +☐ +✓ + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/svg/char_square_pure.svg b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/svg/char_square_pure.svg new file mode 100644 index 00000000..6c17f710 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/svg/char_square_pure.svg @@ -0,0 +1,24 @@ + + + + + + ☠+ + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/ficha/svg/char_tick_pure.svg b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/svg/char_tick_pure.svg new file mode 100644 index 00000000..e5e1b808 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/ficha/svg/char_tick_pure.svg @@ -0,0 +1,24 @@ + + + + + + ☑ + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/HigieneDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/HigieneDataProvider.java new file mode 100644 index 00000000..0ae206d0 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/HigieneDataProvider.java @@ -0,0 +1,270 @@ +/* + * HigieneDataProvider.java + * + * Created on February 1, 2006, 10:49 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene; + +import java.awt.Color; +import java.util.Calendar; +import java.util.Date; +import java.util.Hashtable; +import java.util.Vector; + +import siprp.SingletonConstants; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.metadb.MetaProvider; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +import com.evolute.utils.tables.ColumnizedMappable; + +/** + * + * @author fpalma + */ +public class HigieneDataProvider extends MetaProvider +{ + public static final int ESTADO_POR_REALIZAR = 0; + public static final int ESTADO_REALIZADO = 2; + public static final int ESTADO_DESMARCADO_TRABALHADOR = 3; + public static final int ESTADO_DESMARCADO_EMPRESA = 4; + public static final int ESTADO_FALTOU = 5; + + public static final String ESTADOS_STR[] = + new String[]{ "Por realizar", "", "Realizada", + "Desmarcada empresa", + "Desmarcada " + Singleton.getInstance( SingletonConstants.COMPANY_ACRONYM ), + "Faltou" }; + + public static final Color CORES_TECNICOS[] = + new Color[]{ Color.white, Color.red.darker(), Color.blue, + Color.green.darker(), Color.yellow.darker(), + Color.gray, Color.pink.darker() }; + + private static final Object LOCK = new Object(); + private static HigieneDataProvider instance = null; + private final Executer executer; + + /** Creates a new instance of HigieneDataProvider */ + public HigieneDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + executer = dbm.getSharedExecuter( this ); + } + + public static MetaProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new HigieneDataProvider(); + } + } + return instance; + } + + public Object[][] getTecnicosHST( boolean superiores ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_tecnicos_hst" }, + new String[]{ "id", "nome", "iniciais", "identificador", "nome_plain" }, + new Field( "inactivo" ).isDifferent( "y" ).and(new Field( "is_superior" ).isEqual( superiores ? "y" : "n" )), + new String[]{ "nome_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + return array.getObjects(); + } + + public Object[][] getAllTecnicosHST( ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_tecnicos_hst" }, + new String[]{ "id", "nome", "iniciais", "identificador", "is_superior", "nome_plain" }, + new Field( "inactivo" ).isDifferent( "y" ), + new String[]{ "nome_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + return array.getObjects(); + } + + public ColumnizedMappable[] getAllEmpresas() + throws Exception + { + Select select = + new Select( new String[]{ "empresas" }, + new String[]{ "id", "designacao_social", "designacao_social_plain" }, + new Field( "inactivo" ).isDifferent( "y" ), + new String[]{ "designacao_social_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + ColumnizedMappable empresas[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < empresas.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String designacao = ( String ) array.get( n, 1 ); + empresas[ n ] = new ColumnizedMappable( id, designacao ); + } + return empresas; + } + + public ColumnizedMappable[] getAllEstabelecimentosForEmpresa( Integer empresaID ) + throws Exception + { + Select select = + new Select( new String[]{ "estabelecimentos" }, + new String[]{ "id", "nome", "nome_plain" }, + new Field( "empresa_id" ).isEqual( empresaID ).and( + new Field( "inactivo" ).isDifferent( "y" ) ), + new String[]{ "nome_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + ColumnizedMappable estabelecimentos[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < estabelecimentos.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + estabelecimentos[ n ] = new ColumnizedMappable( id, nome ); + } + return estabelecimentos; + } + + public String getEmpresa( Integer empresaID ) + throws Exception + { + String nomes[] = new String[ 2 ]; + Select select = new Select( new String[]{ "empresas" }, + new String[]{ "designacao_social" }, + new Field( "id" ).isEqual( empresaID ) ); + Virtual2DArray array = executer.executeQuery( select ); + return ( String ) array.get( 0, 0 ); + } + + public Object[][] getVisitasEstabelecimento( Integer estabelecimentoID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_estabelecimento" }, + new String[]{ "id", "data", "estado" }, + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ), + new String[]{ "data desc" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + Object data[][] = array.getObjects(); + for( int n = 0; n < data.length; n++ ) + { + int estado = ( ( Integer ) data[ n ][ 2 ] ).intValue(); + data[ n ][ 2 ] = ESTADOS_STR[ estado ]; + } + return data; + } + + public Vector[][] getMapaAnual( Integer ano ) + throws Exception + { + String deleted = "__DELETED__"; + Select select = + new Select( new String[]{ "marcacoes_tecnicos_hst" }, + new String[]{ "id", "nome", "iniciais", "identificador", "nome_plain" }, + new Field( "inactivo" ).isDifferent( "y" ).and(new Field( "is_superior" ).isDifferent( "y" )), + new String[]{ "nome_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + Object tecnicosArr[][] = array.getObjects(); + Hashtable tecnicos = new Hashtable(); + for( int n = 0; n < tecnicosArr.length; n++ ) + { + tecnicos.put( tecnicosArr[ n ][ 0 ], tecnicosArr[ n ] ); + } + Hashtable empresas = new Hashtable(); + Hashtable estabelecimentos = new Hashtable(); + Hashtable empresasEstabelecimentos = new Hashtable(); + Vector data[][] = new Vector[ 31 ][ 12 ]; + select = new Select( new String[]{ "marcacoes_estabelecimento" }, + new String[]{ "data", "estabelecimento_id", "tecnico_hst" }, + new Field( "data" ).between( new Object[]{ ano + "-01-01", ano + "-12-31" } ).and( + new Field( "estado" ).in( new Integer[]{ new Integer( 0 ), new Integer( 2 ) } ) ) ); + array = executer.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Date dataVisita = ( Date ) array.get( n, 0 ); + Integer estabelecimentoID = ( Integer ) array.get( n, 1 ); + Integer tecnicoID = ( Integer ) array.get( n, 2 ); + Integer empresaID = null; + if( !estabelecimentos.containsKey( estabelecimentoID ) ) + { + Select estabelecimentoSelect = + new Select( new String[]{ "estabelecimentos" }, + new String[]{ "nome", "empresa_id", "inactivo" }, + new Field( "id" ).isEqual( estabelecimentoID ) ); + Virtual2DArray estabelecimentoArray = executer.executeQuery( estabelecimentoSelect ); + if( "y".equals( estabelecimentoArray.get( 0, 2 ) ) ) + { + estabelecimentos.put( estabelecimentoID, deleted ); + } + else + { + estabelecimentos.put( estabelecimentoID, estabelecimentoArray.get( 0, 0 ) ); + } + empresaID = ( Integer ) estabelecimentoArray.get( 0, 1 ); + empresasEstabelecimentos.put( estabelecimentoID, empresaID ); + if( !empresas.containsKey( empresaID ) ) + { + Select empresaSelect = + new Select( new String[]{ "empresas" }, + new String[]{ "designacao_social", "inactivo" }, + new Field( "id" ).isEqual( empresaID ) ); + Virtual2DArray empresaArray = executer.executeQuery( empresaSelect ); + if( "y".equals( empresaArray.get( 0, 1 ) ) ) + { + empresas.put( empresaID, deleted ); + } + else + { + empresas.put( empresaID, empresaArray.get( 0, 0 ) ); + } + } + } + String nomeEstabelecimento = ( String ) estabelecimentos.get( estabelecimentoID ); + empresaID = ( Integer ) empresasEstabelecimentos.get( estabelecimentoID ); + String nomeEmpresa = ( String ) empresas.get( empresaID ); + String nomeTecnico = " "; + Integer indiceCor = null; + Color cor = null; + if( tecnicoID != null ) + { + Object tecnico[] = ( Object[] ) tecnicos.get( tecnicoID ); + nomeTecnico = ( String ) tecnico[ 1 ]; + indiceCor = ( Integer ) tecnico[ 3 ]; + cor = CORES_TECNICOS[ indiceCor.intValue() ]; + } + Calendar cal = Calendar.getInstance(); + cal.setTime( dataVisita ); + int dia = cal.get( Calendar.DAY_OF_MONTH ) - 1; + int mes = cal.get( Calendar.MONTH ); + if( data[ dia ][ mes ] == null ) + { + data[ dia ][ mes ] = new Vector(); + data[ dia ][ mes ].add( new Object[]{ new Integer( dia + 1 ) } ); + } + if( nomeEmpresa != deleted && nomeEstabelecimento != deleted ) + { + data[ dia ][ mes ].add( new Object[]{ nomeEmpresa, nomeEstabelecimento, nomeTecnico, cor } ); + } + } + + return data; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/alter2.sql b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/alter2.sql new file mode 100644 index 00000000..6166400d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/alter2.sql @@ -0,0 +1,18 @@ + +CREATE TABLE marcacoes_tecnicos_hst +( + id int4 NOT NULL, + nome varchar(255) NOT NULL, + nome_plain varchar(255) NOT NULL, + iniciais varchar(10) NOT NULL, + identificador int4, + inactivo char(1) DEFAULT 'n' NOT NULL, + CONSTRAINT marcacoes_tecnicos_hst_pkey PRIMARY KEY (id) +) +WITHOUT OIDS; +ALTER TABLE marcacoes_tecnicos_hst OWNER TO postgres; + +ALTER TABLE marcacoes_estabelecimento ADD estado INT; +ALTER TABLE marcacoes_estabelecimento ADD tecnico_hst INT REFERENCES marcacoes_tecnicos_hst(id); +ALTER TABLE marcacoes_estabelecimento ADD observacoes VARCHAR( 2048 ); +UPDATE marcacoes_estabelecimento SET estado = 2 WHERE realizada = 'y'; \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/AdicionarPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/AdicionarPanel.java new file mode 100644 index 00000000..d82dce3e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/AdicionarPanel.java @@ -0,0 +1,133 @@ +package siprp.higiene.gestao; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +import leaf.ui.LeafButton; +import leaf.ui.LeafIconButton; +import leaf.ui.LeafTree; + +public abstract class AdicionarPanel extends JPanel +{ + + private static final long serialVersionUID = 1L; + + private static final String ICON_NAME_SAVE = "siprp/higiene/gestao/add.png"; + + private static final String ICON_NAME_REVERT = "siprp/higiene/gestao/delete.png"; + + protected final LeafButton buttonAdicionar = LeafIconButton.createButton( ICON_NAME_SAVE ); + + protected final LeafButton buttonRemover = LeafIconButton.createButton( ICON_NAME_REVERT ); + + public static final String SELECTION_CHANGED = "SELECTION_CHANGED"; + + protected final DefaultMutableTreeNode root = new DefaultMutableTreeNode(); + + protected final DefaultTreeModel model = new DefaultTreeModel( root ); + + protected final LeafTree tree = new LeafTree( model ); + + protected final JScrollPane scroll = new JScrollPane( tree ); + + public AdicionarPanel() + { + startupComponents(); + setupLayout(); + placeComponents(); + startupListeners(); + } + + private void startupComponents() + { + buttonAdicionar.setEnabled( false ); + buttonRemover.setEnabled( false ); + tree.setRootVisible( false ); + tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); + } + + private void setupLayout() + { + TableLayout layout = new TableLayout( new double[] { + TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM, TableLayout.FILL + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + setLayout( layout ); + } + + private void placeComponents() + { + JPanel panel = new JPanel(); + TableLayout layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + panel.setLayout( layout ); + panel.add( buttonAdicionar, new TableLayoutConstraints( 0, 0 ) ); + panel.add( buttonRemover, new TableLayoutConstraints( 1, 0 ) ); + + add( panel, new TableLayoutConstraints( 0, 0 ) ); + add( scroll, new TableLayoutConstraints( 0, 1 ) ); + } + + private void startupListeners() + { + buttonAdicionar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + add(); + } + } ); + buttonRemover.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + rem(); + } + } ); + tree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() + { + @Override + public void valueChanged( TreeSelectionEvent e ) + { + TreePath path = tree.getSelectionPath(); + if( path != null ) + { + Object selection = path.getLastPathComponent(); + firePropertyChange( SELECTION_CHANGED, null, selection ); + } + setEnabled(); + } + } ); + } + + protected abstract void rem(); + + protected abstract void add(); + + protected abstract void setEnabled(); + + public abstract void refresh(); + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/EmpresaPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/EmpresaPanel.java new file mode 100644 index 00000000..d3bd1465 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/EmpresaPanel.java @@ -0,0 +1,129 @@ +package siprp.higiene.gestao; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.List; + +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTabbedPane; + +import leaf.ui.LeafDialog; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.providers.MedicinaDAO; + +public class EmpresaPanel extends JPanel +{ + + private static final long serialVersionUID = 1L; + + private final JComboBox comboEmpresa = new JComboBox(); + + private final JCheckBox checkImpressao = new JCheckBox("Imprimir tabela alargada"); + + private final GerirEmpresaPanel panelEmpresa = new GerirEmpresaPanel(); + + private final GerirEstabelecimentosPanel panelEstabelecimentos = new GerirEstabelecimentosPanel(); + + private final JTabbedPane tabs = new JTabbedPane(); + + private Empresas empresa = null; + + public EmpresaPanel() + { + startupListeners(); + startupComponents(); + setupLayout(); + placeComponents(); + + } + + private void startupComponents() + { + List empresas = new MedicinaDAO().getAllEmpresas(); + if( empresas != null ) + { + for( Empresas empresa : empresas ) + { + comboEmpresa.addItem( empresa ); + } + } + tabs.addTab( "Empresa", panelEmpresa ); + tabs.addTab( "Estabelecimentos", panelEstabelecimentos ); + } + + private void setupLayout() + { + double[] cols = new double[]{ + TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM + }; + double[] rows = new double[]{ + TableLayout.MINIMUM, TableLayout.FILL, + }; + TableLayout layout = new TableLayout(cols,rows); + layout.setHGap( 10 ); + layout.setVGap( 10 ); + this.setLayout( layout ); + } + + private void placeComponents() + { + this.add( new JLabel( "Empresa" ), new TableLayoutConstraints( 0, 0 ) ); + this.add( comboEmpresa, new TableLayoutConstraints( 1, 0 ) ); + this.add( checkImpressao, new TableLayoutConstraints( 2, 0 ) ); + this.add( tabs, new TableLayoutConstraints( 0, 1, 2, 1 ) ); + } + + private void setEmpresa( Empresas empresa ) + { + this.empresa = empresa; + checkImpressao.setSelected( false ); + if( empresa != null ) + { + checkImpressao.setSelected( empresa.getImprimirTabelaAlargada() == null ? false : empresa.getImprimirTabelaAlargada() ); + } + } + + private void startupListeners() + { + checkImpressao.addItemListener( new ItemListener() + { + @Override + public void itemStateChanged( ItemEvent e ) + { + try + { + empresa.setImprimirTabelaAlargada( checkImpressao.isSelected() ); + empresa.save(); + } + catch( Exception ex ) + { + LeafDialog.error( ex ); + } + } + } ); + comboEmpresa.addItemListener( new ItemListener() + { + @Override + public void itemStateChanged( ItemEvent e ) + { + Object item = e.getItem(); + if( item != null && ItemEvent.SELECTED == e.getStateChange() ) + { + if( item instanceof Empresas ) + { + panelEmpresa.setEmpresa( (Empresas) item ); + panelEstabelecimentos.setEmpresa( (Empresas) item ); + EmpresaPanel.this.setEmpresa( (Empresas) item ); + } + } + } + }); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/GerirEmpresaPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/GerirEmpresaPanel.java new file mode 100644 index 00000000..43e7a8e2 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/GerirEmpresaPanel.java @@ -0,0 +1,81 @@ +package siprp.higiene.gestao; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import static com.evolute.utils.strings.UnicodeLatin1Map.otilde; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Dimension; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; + +import siprp.database.cayenne.objects.Empresas; +import siprp.higiene.gestao.email.AdicionarEmailsPanel; +import siprp.higiene.gestao.legislacao.AdicionarLegislacaoPanel; +import siprp.higiene.gestao.normalizacao.AdicionarNormalizacaoPanel; +import siprp.higiene.gestao.postos.GerirAreasPanel; +import siprp.higiene.gestao.riscos.AdicionarRiscosPanel; + +public class GerirEmpresaPanel extends JPanel +{ + + private static final long serialVersionUID = 1L; + + private final GerirAreasPanel panelAreas = new GerirAreasPanel(); + private final AdicionarRiscosPanel panelRiscos = new AdicionarRiscosPanel(); + private final AdicionarEmailsPanel panelEmails = new AdicionarEmailsPanel(); + private final AdicionarLegislacaoPanel panelLegislacao = new AdicionarLegislacaoPanel(); + private final AdicionarNormalizacaoPanel panelNormalizacao = new AdicionarNormalizacaoPanel(); + + public GerirEmpresaPanel() + { + startupComponents(); + setupLayout(); + placeComponents(); + startupListeners(); + } + + private void startupComponents() + { + panelAreas.setBorder( BorderFactory.createTitledBorder( "Postos de trabalho" ) ); + panelRiscos.setBorder( BorderFactory.createTitledBorder( "Riscos" ) ); + panelEmails.setBorder( BorderFactory.createTitledBorder( "Emails" ) ); + panelLegislacao.setBorder( BorderFactory.createTitledBorder( "Legisla" + ccedil + atilde + "o" ) ); + panelNormalizacao.setBorder( BorderFactory.createTitledBorder( "Normaliza" + ccedil + otilde + "es" ) ); + panelEmails.setPreferredSize( new Dimension(0,150) ); + } + + private void setupLayout() + { + double [] cols = new double[]{ TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, }; + double [] rows = new double[]{ TableLayout.FILL, TableLayout.FILL }; + TableLayout layout = new TableLayout( cols, rows ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + this.setLayout( layout ); + } + + private void placeComponents() + { + this.add( panelAreas, new TableLayoutConstraints( 0, 0, 0, 1 ) ); + this.add( panelRiscos, new TableLayoutConstraints( 1, 0, 1, 1 ) ); + this.add( panelLegislacao, new TableLayoutConstraints( 2, 0 ) ); + this.add( panelNormalizacao, new TableLayoutConstraints( 2, 1 ) ); + } + + private void startupListeners() + { + + } + + public void setEmpresa( Empresas empresa ) + { + panelAreas.setEmpresa( empresa ); + panelLegislacao.setEmpresa( empresa ); + panelRiscos.setEmpresa( empresa ); + panelNormalizacao.setEmpresa( empresa ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/GerirEstabelecimentosPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/GerirEstabelecimentosPanel.java new file mode 100644 index 00000000..6889a1b1 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/GerirEstabelecimentosPanel.java @@ -0,0 +1,136 @@ +package siprp.higiene.gestao; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + +import javax.swing.BorderFactory; +import javax.swing.JComboBox; +import javax.swing.JPanel; + +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsPosto; +import siprp.higiene.gestao.email.AdicionarEmailsPanel; +import siprp.higiene.gestao.legislacao.AdicionarLegislacaoPanel; +import siprp.higiene.gestao.normalizacao.AdicionarNormalizacaoPanel; +import siprp.higiene.gestao.postos.AdicionarAreasPanel; +import siprp.higiene.gestao.riscos.AdicionarRiscosPanel; + +public class GerirEstabelecimentosPanel extends JPanel +{ + + private static final long serialVersionUID = 1L; + + private final JComboBox comboEstabelecimentos = new JComboBox(); + private final JPanel panelAreasRiscos = new JPanel(); + private final AdicionarAreasPanel panelAreas = new AdicionarAreasPanel(); + private final AdicionarRiscosPanel panelRiscos = new AdicionarRiscosPanel(); + private final AdicionarEmailsPanel panelEmails = new AdicionarEmailsPanel(); + private final AdicionarLegislacaoPanel panelLegislacao = new AdicionarLegislacaoPanel(); + private final AdicionarNormalizacaoPanel panelNormalizacao = new AdicionarNormalizacaoPanel(); + + public GerirEstabelecimentosPanel() + { + startupComponents(); + setupLayout(); + placeComponents(); + startupListeners(); + } + + private void startupComponents() + { + panelAreasRiscos.setBorder( BorderFactory.createTitledBorder( "Riscos por posto de trabalho" ) ); + panelRiscos.setBorder( BorderFactory.createTitledBorder( "Riscos" ) ); + panelEmails.setBorder( BorderFactory.createTitledBorder( "Emails" ) ); + panelLegislacao.setBorder( BorderFactory.createTitledBorder( "Legisla" + ccedil + atilde + "o" ) ); + panelEmails.setPreferredSize( new Dimension(0,150) ); + } + + private void setupLayout() + { + double [] cols = new double[]{ TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, }; + double [] rows = new double[]{ TableLayout.MINIMUM, TableLayout.FILL,TableLayout.FILL, TableLayout.PREFERRED }; + TableLayout layout = new TableLayout( cols, rows ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + this.setLayout( layout ); + + panelAreasRiscos.setLayout( new GridLayout( 1, 2 ) ); + } + + private void placeComponents() + { + panelAreasRiscos.add( panelAreas ); + panelAreasRiscos.add( panelRiscos ); + + this.add( comboEstabelecimentos, new TableLayoutConstraints( 0, 0, 2, 0 ) ); + this.add( panelAreasRiscos, new TableLayoutConstraints( 0, 1, 1, 3 ) ); + this.add( panelLegislacao, new TableLayoutConstraints( 2, 1 ) ); + this.add( panelNormalizacao, new TableLayoutConstraints( 2, 2 ) ); + this.add( panelEmails, new TableLayoutConstraints( 2, 3 ) ); + } + + private void startupListeners() + { + comboEstabelecimentos.addItemListener( new ItemListener() + { + @Override + public void itemStateChanged( ItemEvent e ) + { + if( e.getItem() != null && ItemEvent.SELECTED == e.getStateChange() ) + { + if( e.getItem() instanceof Estabelecimentos ) + { + Estabelecimentos estabelecimento = (Estabelecimentos) e.getItem(); + panelAreas.setEstabelecimento( estabelecimento ); + panelEmails.setEstabelecimento( estabelecimento ); + panelLegislacao.setEstabelecimento( estabelecimento ); + panelNormalizacao.setEstabelecimento( estabelecimento ); + } + } + } + } ); + panelAreas.addPropertyChangeListener( AdicionarAreasPanel.SELECTION_CHANGED, new PropertyChangeListener() + { + @Override + public void propertyChange( PropertyChangeEvent evt ) + { + Object obj = evt.getNewValue(); + if( obj != null && (obj instanceof HsPosto) ) + { + panelRiscos.setPosto( (HsPosto) obj ); + } + else + { + panelRiscos.setPosto( null ); + } + } + } ); + } + + public void setEmpresa( Empresas empresa ) + { + comboEstabelecimentos.removeAllItems(); + if( empresa != null ) + { + for( Estabelecimentos estabelecimento : empresa.getEstabelecimentosArray() ) + { + comboEstabelecimentos.addItem( estabelecimento ); + } + if( comboEstabelecimentos.getItemCount() > 0 ) + { + comboEstabelecimentos.setSelectedIndex( 0 ); + } + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/GestaoRelatorioWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/GestaoRelatorioWindow.java new file mode 100644 index 00000000..ab48d55f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/GestaoRelatorioWindow.java @@ -0,0 +1,83 @@ +package siprp.higiene.gestao; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import static com.evolute.utils.strings.UnicodeLatin1Map.oacute; + +import java.awt.Dimension; + +import javax.swing.JFrame; +import javax.swing.JTabbedPane; +import javax.swing.SwingUtilities; + +import com.evolute.utils.tracker.TrackableWindow; + +public class GestaoRelatorioWindow extends JFrame implements TrackableWindow +{ + + public static final String TITLE = "Gest" + atilde + "o de Relat" + oacute + "rio de Higiene e Seguran" + ccedil + "a"; + + private static final Dimension SIZE = new Dimension( 1024, 700 ); + + private static final long serialVersionUID = 1L; + + private final JTabbedPane tabs = new JTabbedPane(); + + private final GlobalPanel panelGlobal = new GlobalPanel(); + + private final EmpresaPanel panelEmpresa = new EmpresaPanel(); + + public static void main( String[] args ) + { + GestaoRelatorioWindow window = new GestaoRelatorioWindow(); + window.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); + window.open(); + } + + public GestaoRelatorioWindow() + { + this.setTitle( TITLE ); + this.setSize( SIZE ); + this.setLocationRelativeTo( null ); + placeComponents(); + } + + private void placeComponents() + { + tabs.addTab( "Global", panelGlobal ); + tabs.addTab( "Por Empresa", panelEmpresa ); + this.setContentPane( tabs ); + } + + @Override + public void open() + { + setVisible( true ); + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable() + { + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + @Override + public boolean closeIfPossible() + { + close(); + return true; + } + + @Override + public void refresh() + { + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/GlobalPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/GlobalPanel.java new file mode 100644 index 00000000..cc77c4d8 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/GlobalPanel.java @@ -0,0 +1,54 @@ +package siprp.higiene.gestao; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; + +import javax.swing.JTabbedPane; + +import siprp.higiene.gestao.equipamentos.GerirEquipamentosPanel; +import siprp.higiene.gestao.legislacao.GerirLegislacaoPanel; +import siprp.higiene.gestao.normalizacao.GerirNormalizacaoPanel; +import siprp.higiene.gestao.riscos.GerirRiscosPanel; + +public class GlobalPanel extends JTabbedPane +{ + + private static final long serialVersionUID = 1L; + + private final GerirRiscosPanel panelRiscos = new GerirRiscosPanel(); + + private final GerirLegislacaoPanel panelLegislacao = new GerirLegislacaoPanel(); + + private final GerirNormalizacaoPanel panelNormalizacao= new GerirNormalizacaoPanel(); + + private final GerirEquipamentosPanel panelEquipamentos = new GerirEquipamentosPanel(); + + public GlobalPanel() + { + startupComponents(); + setupLayout(); + placeComponents(); + startupListeners(); + } + + private void startupComponents() + { + addTab( "Riscos", panelRiscos ); + addTab( "Legisla" + ccedil + atilde + "o", panelLegislacao ); + addTab( "Normaliza" + ccedil + atilde + "o", panelNormalizacao ); + addTab( "Equipamentos", panelEquipamentos ); + } + + private void setupLayout() + { + } + + private void placeComponents() + { + } + + private void startupListeners() + { + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/add.png b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/add.png new file mode 100644 index 00000000..ff55ed0c Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/add.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/delete.png b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/delete.png new file mode 100644 index 00000000..d7cc9c68 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/delete.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/email/AdicionarEmailsPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/email/AdicionarEmailsPanel.java new file mode 100644 index 00000000..a69e0b49 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/email/AdicionarEmailsPanel.java @@ -0,0 +1,109 @@ +package siprp.higiene.gestao.email; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; + +import javax.swing.JOptionPane; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreePath; + +import leaf.ui.LeafDialog; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsEmail; +import siprp.database.cayenne.objects.HsEmailEstabelecimento; +import siprp.higiene.gestao.AdicionarPanel; +import siprp.logic.HigieneSegurancaLogic; + +import com.evolute.utils.ui.trees.TreeTools; + +public class AdicionarEmailsPanel extends AdicionarPanel +{ + + private static final long serialVersionUID = 1L; + + private Estabelecimentos estabelecimento = null; + + public void setEstabelecimento( Estabelecimentos estabelecimento ) + { + this.estabelecimento = estabelecimento; + refresh(); + setEnabled(); + } + + @Override + protected void add() + { + try + { + if( estabelecimento != null ) + { + String emailString = JOptionPane.showInputDialog( this, "Email", "Adicionar novo Email", JOptionPane.QUESTION_MESSAGE ); + if( emailString != null ) + { + HsEmail email = new HsEmail(); + email.setEmail( emailString ); + email.save(); + HsEmailEstabelecimento rel = new HsEmailEstabelecimento(); + rel.setToHsEmail( email ); + rel.setToEstabelecimento( estabelecimento ); + rel.save(); + refresh(); + } + } + } + catch (Exception e) + { + LeafDialog.error( e ); + } + } + + private boolean confirmDelete() + { + return JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog( + null, "Tem a certeza que deseja remover o email seleccionado?", + "Confirmar remo" + ccedil + atilde + "o", + JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null ); + } + + @Override + protected void rem() + { + try + { + TreePath path = tree.getSelectionPath(); + if( path != null ) + { + DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); + if( node != null && confirmDelete() ) + { + Object obj = node.getUserObject(); + if( obj instanceof HsEmailEstabelecimento ) + { + ((HsEmailEstabelecimento) obj).delete(); + refresh(); + } + } + } + } + catch (Exception e) + { + LeafDialog.error( e ); + } + } + + @Override + public void refresh() + { + root.removeAllChildren(); + TreeTools.merge( root, HigieneSegurancaLogic.getEmailsForEstabelecimento( estabelecimento ) ); + TreeTools.refreshTree( tree, root, false ); + } + + @Override + protected void setEnabled() + { + buttonAdicionar.setEnabled( estabelecimento != null ); + buttonRemover.setEnabled( tree.getSelectionCount() > 0 ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/equipamentos/AdicionarEquipamentosPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/equipamentos/AdicionarEquipamentosPanel.java new file mode 100644 index 00000000..94702387 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/equipamentos/AdicionarEquipamentosPanel.java @@ -0,0 +1,232 @@ +package siprp.higiene.gestao.equipamentos; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +import leaf.ui.LeafButton; +import leaf.ui.LeafDialog; +import leaf.ui.LeafIconButton; +import leaf.ui.LeafTree; +import leaf.ui.TreeInserterDialog; +import siprp.database.cayenne.objects.HsEquipamento; +import siprp.database.cayenne.objects.HsRelatorio; +import siprp.database.cayenne.objects.HsRelatorioEquipamento; +import siprp.logic.HigieneSegurancaLogic; +import siprp.logic.node.EquipamentoNode; + +import com.evolute.utils.ui.trees.TreeTools; + +public class AdicionarEquipamentosPanel extends JPanel +{ + + private static final long serialVersionUID = 1L; + + public static final String SELECTION_CHANGED = "SELECTION_CHANGED"; + + private static final String ICON_NAME_SAVE = "siprp/higiene/gestao/add.png"; + + private static final String ICON_NAME_REVERT = "siprp/higiene/gestao/delete.png"; + + private final LeafButton buttonAdicionar = LeafIconButton.createButton( ICON_NAME_SAVE ); + + private final LeafButton buttonRemover = LeafIconButton.createButton( ICON_NAME_REVERT ); + + private final DefaultMutableTreeNode root = new DefaultMutableTreeNode(); + + private final DefaultTreeModel model = new DefaultTreeModel( root ); + + public final LeafTree tree = new LeafTree( model ); + + private final JScrollPane scroll = new JScrollPane( tree ); + + private HsRelatorio relatorio = null; + + public AdicionarEquipamentosPanel() + { + startupComponents(); + setupLayout(); + placeComponents(); + startupListeners(); + } + + private void startupComponents() + { + buttonAdicionar.setEnabled( false ); + buttonRemover.setEnabled( false ); + buttonAdicionar.setToolTipText( "Adicionar" ); + buttonRemover.setToolTipText( "Remover" ); + tree.setRootVisible( false ); + tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); + } + + private void setupLayout() + { + TableLayout layout = new TableLayout( new double[] { + TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM, TableLayout.FILL + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + setLayout( layout ); + } + + private void placeComponents() + { + JPanel panel = new JPanel(); + TableLayout layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + panel.setLayout( layout ); + panel.add( buttonAdicionar, new TableLayoutConstraints( 0, 0 ) ); + panel.add( buttonRemover, new TableLayoutConstraints( 1, 0 ) ); + + add( panel, new TableLayoutConstraints( 0, 0 ) ); + add( scroll, new TableLayoutConstraints( 0, 1 ) ); + } + + private void startupListeners() + { + tree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() + { + @Override + public void valueChanged( TreeSelectionEvent e ) + { + setEnabled(); + TreePath path = tree.getSelectionPath(); + DefaultMutableTreeNode node = path == null ? null : (DefaultMutableTreeNode)path.getLastPathComponent(); + Object obj = node == null ? null : node.getUserObject(); + HsRelatorioEquipamento rel = obj == null ? null : ((obj instanceof HsRelatorioEquipamento) ? (HsRelatorioEquipamento) obj : null); + firePropertyChange( SELECTION_CHANGED, null, rel == null ? null : rel.getToHsRelatorio() ); + } + } ); + buttonAdicionar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + add(); + } + } ); + buttonRemover.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + rem(); + } + } ); + } + + private void add() + { + if( relatorio != null ) + { + + DefaultMutableTreeNode allEquipamentos = HigieneSegurancaLogic.getEquipamentosTree(); + TreeInserterDialog dialog = new TreeInserterDialog("Adicionar equipamento",allEquipamentos); + DefaultMutableTreeNode result = dialog.getResult(); + if( result != null ) + { + for( int i = 0; i < result.getChildCount(); ++i ) + { + DefaultMutableTreeNode node = (DefaultMutableTreeNode) result.getChildAt( i ); + Object obj = node.getUserObject(); + if( obj instanceof HsEquipamento ) + { + try + { + HsEquipamento equipamento = (HsEquipamento) obj; + HsRelatorioEquipamento relEqui = new HsRelatorioEquipamento(); + relEqui.setHsEquipamento( equipamento.getId() ); + relEqui.setToHsRelatorio( relatorio ); + relEqui.setMarca( equipamento.getMarca() ); + relEqui.setModelo( equipamento.getModelo() ); + relEqui.setTipo( equipamento.getTipo() ); + relEqui.save(); + } + catch (Exception e) + { + LeafDialog.error( e ); + } + } + } + } + refresh(); + } + } + + private void rem() + { + try + { + TreePath path = tree.getSelectionPath(); + DefaultMutableTreeNode node = path == null ? null : (DefaultMutableTreeNode)path.getLastPathComponent(); + Object obj = node.getUserObject(); + HsRelatorioEquipamento rel = obj == null ? null : ((obj instanceof HsRelatorioEquipamento) ? (HsRelatorioEquipamento) obj : null); + if( rel != null && confirmDelete() ) + { + rel.delete(); + refresh(); + } + } + catch (Exception e) + { + LeafDialog.error( e ); + } + } + + private boolean confirmDelete() + { + return JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog( + null, "Tem a certeza que deseja remover o equipamento seleccionado?", + "Confirmar remo" + ccedil + atilde + "o", + JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null ); + } + + private void setEnabled() + { + buttonAdicionar.setEnabled( relatorio != null && relatorio.getIsSubmetido() == null ); + buttonRemover.setEnabled( tree.getSelectionCount() > 0 ); + } + + public void refresh() + { + root.removeAllChildren(); + if( relatorio != null ) + { + for( HsRelatorioEquipamento rel : relatorio.getHsRelatorioEquipamentoArray() ) + { + root.add( new EquipamentoNode( rel ) ); + } + } + setEnabled(); + TreeTools.refreshTree( tree, root, false ); + } + + public void setRelatorio( HsRelatorio relatorio ) + { + this.relatorio = relatorio; + refresh(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/equipamentos/GerirEquipamentosPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/equipamentos/GerirEquipamentosPanel.java new file mode 100644 index 00000000..d705d51d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/equipamentos/GerirEquipamentosPanel.java @@ -0,0 +1,332 @@ +package siprp.higiene.gestao.equipamentos; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Date; + +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.event.CaretEvent; +import javax.swing.event.CaretListener; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +import leaf.ui.LeafButton; +import leaf.ui.LeafDialog; +import leaf.ui.LeafIconButton; +import leaf.ui.LeafTree; +import leaf.ui.LeafUIConstants; +import siprp.database.cayenne.objects.HsEquipamento; +import siprp.logic.HigieneSegurancaLogic; + +import com.evolute.utils.ui.trees.TreeTools; + +public class GerirEquipamentosPanel extends JPanel implements CaretListener, LeafUIConstants +{ + + private static final long serialVersionUID = 1L; + + private LeafIconButton buttonSaveRequesito = LeafIconButton.createButton( ICON_NAME_SAVE ); + + private LeafIconButton buttonRevertRequesito = LeafIconButton.createButton( ICON_NAME_REVERT ); + + private final JPanel panelButtons = new JPanel(); + + private final JPanel panelTree = new JPanel(); + + private final JPanel panelData = new JPanel(); + + private final JTextField textTipo = new JTextField(20); + + private final JTextField textMarca = new JTextField(20); + + private final JTextField textModelo = new JTextField(20); + + private final LeafButton buttonCriar = LeafIconButton.createDefaultNewButton(); + + private final LeafButton buttonRemover = LeafIconButton.createDefaultRemoveButton(); + + private final DefaultMutableTreeNode root = new DefaultMutableTreeNode(); + + private final DefaultTreeModel model = new DefaultTreeModel( root ); + + private final LeafTree tree = new LeafTree( model ); + + private final JScrollPane scroll = new JScrollPane( tree ); + + public GerirEquipamentosPanel() + { + startupComponents(); + startupLayout(); + placeComponents(); + setupListeners(); + refresh(); + } + + private void setupListeners() + { + buttonCriar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + criar(); + } + } ); + buttonRemover.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + remover(); + } + } ); + buttonSaveRequesito.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + save(); + } + } ); + buttonRevertRequesito.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + revert(); + } + } ); + tree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() + { + @Override + public void valueChanged( TreeSelectionEvent e ) + { + TreePath path = e.getNewLeadSelectionPath(); + if( path != null ) + { + DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); + Object obj = node.getUserObject(); + if( obj instanceof HsEquipamento ) + { + textTipo.setText( ((HsEquipamento)obj).getTipo() ); + textMarca.setText( ((HsEquipamento)obj).getMarca() ); + textModelo.setText( ((HsEquipamento)obj).getModelo()); + } + } + else + { + textTipo.setText( "" ); + textMarca.setText( "" ); + textModelo.setText( "" ); + } + setEnabled(); + } + } ); + textTipo.addCaretListener( this ); + textMarca.addCaretListener( this ); + textModelo.addCaretListener( this ); + } + + private void criar() + { + try + { + String tipo = JOptionPane.showInputDialog( this, "Tipo", "Criar novo equipamento", JOptionPane.QUESTION_MESSAGE ); + if( tipo != null ) + { + HsEquipamento equipamento = new HsEquipamento(); + equipamento.setTipo( tipo ); + equipamento.save(); + refresh(); + } + } + catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void remover() + { + try + { + HsEquipamento equipamento = getSelected(); + if( equipamento != null && confirmDelete() ) + { + equipamento.setDeletedDate( new Date() ); + equipamento.save(); + refresh(); + } + } + catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private boolean confirmDelete() + { + return JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog( + null, "Tem a certeza que deseja remover o equipamento seleccionado?", + "Confirmar remo" + ccedil + atilde + "o", + JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null ); + } + + private void save() + { + try + { + HsEquipamento equipamento = getSelected(); + if( equipamento != null ) + { + equipamento.setTipo( textTipo.getText() ); + equipamento.setMarca( textMarca.getText() ); + equipamento.setModelo( textModelo.getText() ); + equipamento.save(); + refresh(); + } + } + catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void revert() + { + HsEquipamento equipamento = getSelected(); + if( equipamento != null ) + { + textTipo.setText( equipamento.getTipo() ); + textMarca.setText( equipamento.getMarca() ); + textModelo.setText( equipamento.getModelo() ); + } + } + + private HsEquipamento getSelected() + { + Object object = getSelectedObject(); + return object == null ? null : ((object instanceof HsEquipamento) ? (HsEquipamento) object : null); + } + + private Object getSelectedObject() + { + DefaultMutableTreeNode node = getSelectedNode(); + return node == null ? null : node.getUserObject(); + } + + private DefaultMutableTreeNode getSelectedNode() + { + TreePath path = tree.getSelectionPath(); + return path == null ? null : (DefaultMutableTreeNode) path.getLastPathComponent(); + } + + private void startupComponents() + { + panelTree.setPreferredSize( new Dimension( 400, 400 ) ); + tree.setRootVisible( false ); + tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); + } + + private void setEnabled() + { + HsEquipamento equipamento = getSelected(); + buttonRemover.setEnabled( equipamento != null ); + textTipo.setEnabled( equipamento != null ); + textMarca.setEnabled( equipamento != null ); + textModelo.setEnabled( equipamento != null ); + buttonSaveRequesito.setEnabled( false ); + buttonRevertRequesito.setEnabled( false ); + if( equipamento != null ) + { + boolean changed = !textTipo.getText().equals( equipamento.getTipo() ); + changed |= !textMarca.getText().equals( equipamento.getMarca() == null ? "" : equipamento.getMarca() ); + changed |= !textModelo.getText().equals( equipamento.getModelo() == null ? "" : equipamento.getModelo() ); + buttonSaveRequesito.setEnabled( changed ); + buttonRevertRequesito.setEnabled( changed ); + } + } + + private void startupLayout() + { + TableLayout layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM, TableLayout.FILL + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + setLayout( layout ); + + layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.MINIMUM + }, new double[] { + TableLayout.MINIMUM + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + panelButtons.setLayout( layout ); + + layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.FILL,TableLayout.MINIMUM,TableLayout.MINIMUM + }, new double[] { + TableLayout.MINIMUM,TableLayout.MINIMUM,TableLayout.MINIMUM, TableLayout.MINIMUM + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + panelData.setLayout( layout ); + + panelTree.setLayout( new GridLayout( 1,1 ) ); + } + + private void placeComponents() + { + panelButtons.add( buttonCriar, new TableLayoutConstraints( 0, 0 ) ); + panelButtons.add( buttonRemover, new TableLayoutConstraints( 1, 0 ) ); + + panelTree.add( scroll, new TableLayoutConstraints( 0, 0 ) ); + + panelData.add( buttonSaveRequesito, new TableLayoutConstraints( 2, 0 ) ); + panelData.add( buttonRevertRequesito, new TableLayoutConstraints( 3, 0 ) ); + panelData.add( new JLabel("Tipo"), new TableLayoutConstraints( 0, 1 ) ); + panelData.add( textTipo, new TableLayoutConstraints( 1, 1, 3, 1 ) ); + panelData.add( new JLabel("Marca"), new TableLayoutConstraints( 0, 2 ) ); + panelData.add( textMarca, new TableLayoutConstraints( 1, 2, 3, 2 ) ); + panelData.add( new JLabel("Modelo"), new TableLayoutConstraints( 0, 3 ) ); + panelData.add( textModelo, new TableLayoutConstraints( 1, 3, 3, 3 ) ); + + add( panelButtons, new TableLayoutConstraints( 0, 0 ) ); + add( panelTree, new TableLayoutConstraints( 0, 1, 1, 1 ) ); + add( panelData, new TableLayoutConstraints( 2, 1 ) ); + } + + private void refresh() + { + root.removeAllChildren(); + TreeTools.merge( root, HigieneSegurancaLogic.getEquipamentosTree() ); + TreeTools.refreshTree( tree, root, false ); + setEnabled(); + } + + @Override + public void caretUpdate( CaretEvent e ) + { + setEnabled(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/importacao/Importador.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/importacao/Importador.java new file mode 100644 index 00000000..26e8a180 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/importacao/Importador.java @@ -0,0 +1,218 @@ +package siprp.higiene.gestao.importacao; + +import java.io.InputStream; +import java.util.List; +import java.util.Vector; + +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.input.SAXBuilder; + +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.db.JDBCManager; +import com.evolute.utils.db.keyretrievers.JDBCAutoKeyRetriever; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; +import com.evolute.utils.strings.UnicodeChecker; + +public class Importador +{ + private Executer EXECUTER; + + public static void main( String args[] ) + throws Exception + { + Insert.setDefaultKeyRetriever( JDBCAutoKeyRetriever.DEFAULT ); + UnicodeChecker.setUseDoubleSlash( true ); + String url = "jdbc:postgresql://localhost:5436/siprp_local"; + String user = "postgres"; + String pwd = "Typein"; + DBManager dbm = new JDBCManager( url, user, pwd, 10, 8, 8, null ); + + Importador importador = new Importador( dbm.getSharedExecuter(Importador.class) ); +// importador.converter(); + importador.importar(); + } + + public Importador( Executer executer ) + throws Exception + { +// DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); +// EXECUTER = dbm.getSharedExecuter(); + EXECUTER = executer; + } + + // NAO APAGAR +// public void converter() +// throws Exception +// { +// InputStream xsl = getClass().getClassLoader().getResourceAsStream( "siprp/higiene/gestao/importacao/importacao_ods_to_xml.xsl" ); +// InputStream xmlContent = getClass().getClassLoader().getResourceAsStream( "siprp/higiene/gestao/importacao/content.xml" ); +// ByteArrayOutputStream baos = new ByteArrayOutputStream(); +// XSLTransformer.getXSLTransformer().transform( xmlContent, xsl, baos ); +// FileOutputStream fos = new FileOutputStream( "/home/fpalma/projectos2/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/importacao/data.xml" ); +// fos.write( baos.toByteArray() ); +// fos.close(); +// } + + public void importar() + throws Exception + { + SAXBuilder builder = new SAXBuilder(); + InputStream fileFoIs = getClass().getClassLoader().getResourceAsStream( "siprp/higiene/gestao/importacao/data.xml" ); + Document fileDocument = builder.build( fileFoIs ); + Element root = fileDocument.getRootElement(); + List entradas = root.getChildren( "entrada" ); + for( Element entrada : entradas ) + { + Element temaElement = entrada.getChild( "tema" ); + String tema = getTexto( temaElement ); + Element riscoElement = entrada.getChild( "risco" ); + String risco = getTexto( riscoElement ); + Element requisitoElement = entrada.getChild( "requisito" ); + String requisito = getTexto( requisitoElement ); + Element medidaElement = entrada.getChild( "medida" ); + String medida = getTexto( medidaElement ); + if( tema.length() == 0 || risco.length() == 0 ) + { + continue; + } + Integer idTema = inserirTema( tema ); + Integer idRisco = inserirRisco( idTema, risco ); + inserirMedida( idRisco, medida, requisito ); + } + } + + protected String getTexto( Element elemento ) + { + List linhas = elemento != null ? elemento.getChildren( "linha" ) : new Vector(); + String texto = limparEspacos( linhas.size() > 0 ? linhas.get( 0 ).getText() : "" ); + for( int l = 1; l < linhas.size(); l++ ) + { + String linha = limparEspacos( linhas.get( 0 ).getText() ); + texto += "\n" + linha; + } + return texto.trim(); + } + + protected String limparEspacos( String texto ) + { + texto = texto.replaceAll( "\n", " " ); + texto = texto.replaceAll( "\t", "" ); + while( texto.indexOf( " " ) != -1 ) + { + texto = texto.replaceAll( " ", " " ); + } + return texto; + } + + protected Integer inserirTema( String tema ) + throws Exception + { + Select select = + new Select2( + new String[]{ "hs_risco_tema" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id" }, + new Field( "description" ).isEqual( tema ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Integer id = ( array.columnLength() > 0 && array.get( 0, 0 ) != null ) ? ( Integer ) array.get( 0, 0 ) : null; + if( id == null ) + { + Insert insert = + new Insert( "hs_risco_tema", + new Assignment[]{ + new Assignment( "description", tema ) + } ); + EXECUTER.executeQuery( insert ); + id = inserirTema( tema ); + } + + return id; + } + + protected Integer inserirRisco( Integer temaId, String risco ) + throws Exception + { + Select select = + new Select2( + new String[]{ "hs_risco" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id" }, + new Field( "description" ).isEqual( risco ).and( + new Field( "tema_id" ).isEqual( temaId ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + + Integer id = ( array.columnLength() > 0 && array.get( 0, 0 ) != null ) ? ( Integer ) array.get( 0, 0 ) : null; + if( id == null ) + { + Insert insert = + new Insert( "hs_risco", + new Assignment[]{ + new Assignment( "description", risco ), + new Assignment( "tema_id", temaId ) + } ); + EXECUTER.executeQuery( insert ); + id = inserirRisco( temaId, risco ); + } + + return id; + } + + protected Integer inserirMedida( Integer riscoId, String medida, String requisito ) + throws Exception + { + Select select = + new Select2( + new String[]{ "hs_medida", "hs_risco_medida" }, + new Integer[]{ Select2.JOIN_LEFT_OUTER }, + new Expression[]{ + new Field( "hs_medida.id" ).isEqual( new Field( "hs_risco_medida.medida_id" ) ).and( + new Field( "hs_risco_medida.risco_id" ).isEqual( riscoId ) ) + }, + new String[]{ "hs_medida.id" }, + new Field( "hs_medida.description" ).isEqual( medida ).and( + new Field( "hs_medida.requesitos_legais" ).isEqual( requisito ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Integer id = array.columnLength() > 0 ? ( Integer ) array.get( 0, 0 ) : null; + if( id == null ) + { + Insert insert = + new Insert( "hs_medida", + new Assignment[]{ + new Assignment( new Field( "description" ), medida ), + new Assignment( new Field( "requesitos_legais" ), requisito ), + } ); + EXECUTER.executeQuery( insert ); + id = inserirMedida( null, medida, requisito ); + insert = + new Insert( "hs_risco_medida", + new Assignment[]{ + new Assignment( new Field( "medida_id" ), id ), + new Assignment( new Field( "risco_id" ), riscoId ), + } ); + EXECUTER.executeQuery( insert ); + } + return id; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/importacao/data.xml b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/importacao/data.xml new file mode 100644 index 00000000..b7b64cc6 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/importacao/data.xml @@ -0,0 +1,12951 @@ + + Geral + + Atmosfera de trabalho + + + A atmosfera de trabalho bem como a das + instalações comuns devem garantir a saúde e + o bem-estar dos trabalhadores ( + + Decreto Lei nº 243/86 – Art. 10º - 1 + + + ) + + + + + A atmosfera de trabalho bem como a das + instalações comuns devem garantir a saúde e + o bem-estar dos trabalhadores + + + Geral + + Atmosfera de trabalho + + + Os diversos locais de trabalho bem como as + instalações comuns devem conter meios que + permitam a renovação natural e permanente do + ar sem provocar correntes incómodas ou + prejudiciais aos trabalhadores ( + + Decreto Lei nº 243/86 – Art. 10º - 2 + + + ) + + + + + Os diversos locais de trabalho bem como as + instalações comuns devem conter meios que + permitam a renovação natural e permanente do + ar sem provocar correntes incómodas ou + prejudiciais aos trabalhadores + + + Geral + + Atmosfera de trabalho + + + Os meios destinados à renovação natural ou + forçada da atmosfera de trabalho e das + instalações comuns devem assegurar a + admissão de um caudal médio de ar fresco e + puro deve tender a 30 m3 por hora e por + trabalhador ( + + Decreto Lei nº 243/86 – Art. 10º - + + + 6 + + + ) + + + + + Os meios destinados à renovação natural ou + forçada da atmosfera de trabalho e das + instalações comuns devem assegurar a + admissão de um caudal médio de ar fresco e + puro deve tender a 30 m3 por hora e por + trabalhador + + + Geral + + + Risco de queda a diferente nível (devido à + existência de escadas muito íngremes) + + + + As vias de circulação (incluindo escadarias + e escadas fixas) devem permitir a circulação + fácil e segura de pessoas ( + + Portaria nº 987/93 – Art. 13º - 1 + + + ) + + + + + As vias de circulação (incluindo escadarias + e escadas fixas) devem permitir a circulação + fácil e segura de pessoas + + + Geral + + + Risco de queda ao mesmo nível (devido à + existência de cabos eléctricos/telefónicos) + + + + As vias de circulação devem estar + desimpedidas de cabos eléctricos e + telefónicos. + + + + As vias de circulação devem estar + desimpedidas de cabos eléctricos e + telefónicos + + + Geral + + Geral + + + Pavimentos, paredes e tectos dos locais de + trabalho em mau estado + + + + Os pavimentos, paredes e tectos devem ser + construídos de forma a permitirem a limpeza, + o restauro e a pintura das suas superfícies + ( + + Portaria nº 987/93 - Art. 10º - 1º + + + ) + + + + + Os pavimentos, paredes e tectos devem ser + construídos de forma a permitirem a limpeza, + o restauro e a pintura das suas superfícies + + + Geral + + + Existência de piso escorregadio (Risco de + queda ao mesmo nível) + + + + Os pavimentos dos locais de trabalho devem + ser fixos, estáveis, antiderrapantes, sem + inclinações perigosas saliências e cavidades + ( + + Portaria nº987/93 – Art. 10º - 1 + + + ). + + + + + Os pavimentos dos locais de trabalho devem + ser fixos, estáveis, antiderrapantes, sem + inclinações perigosas saliências e cavidades + + + Geral + + Inexistência de água potável + + + Colocar à disposição dos trabalhadores, em + locais facilmente acessíveis, água potável + em quantidade suficiente e, se possível, + corrente ( + + Decreto Lei nº 243/86 Art.45º + + + ) + + + + + Colocar à disposição dos trabalhadores, em + locais facilmente acessíveis, água potável + em quantidade suficiente e, se possível, + corrente + + + Geral + + + Espaço unitário de trabalho insuficiente + + + + A área útil por trabalhador, excluindo a + ocupada pelo posto de trabalho fixo, não + deve ser inferior a 2 m + + 2 + + + e o espaço entre postos de trabalho não + deve ser inferior a 80 cm + + + ( + + + Decreto Lei nº 243/86 – Art. 4º - 2 a + + + ) + + + + + A área útil por trabalhador, excluindo a + ocupada pelo posto de trabalho fixo, não + deve ser inferior a 2 m + + 2 + + + e o espaço entre postos de trabalho não + deve ser inferior a 80 cm + + + + Geral + + + Espaço unitário de trabalho insuficiente + + + + O pé direito dos locais de trabalho não deve + ser inferior a 3 m, admitindo-se, nos + edifícios adaptados, uma tolerância até 2,70 + m ( + + Decreto Lei nº 243/86 – Art. 4º - 2 c + + + ) + + + + + O pé direito dos locais de trabalho não deve + ser inferior a 3 m, admitindo-se, nos + edifícios adaptados, uma tolerância até 2,70 + m + + + Geral + + + Espaço unitário de trabalho insuficiente + + + + Os locais destinados exclusivamente a + armazém, e desde que neles não haja + permanência de trabalhadores, podem ter + tolerância limite de 2,2 m de pé direito ( + + Decreto Lei nº 243/86 – Art. 4º - 2 d + + + ). + + + + + Os locais destinados exclusivamente a + armazém, e desde que neles não haja + permanência de trabalhadores, podem ter + tolerância limite de 2,2 m de pé direito + + + Geral + + Limpeza diária e periódica + + + Devem ser limpos diariamente os pavimentos, + os planos de trabalho e seus utensílios, + utensílios ou equipamentos de uso diário, + instalações higieno-sanitárias ( + + Decreto Lei nº + + + 243/86 – Art. 7º - 1 + + + ); + + + + + Devem ser limpos diariamente os pavimentos, + os planos de trabalho e seus utensílios, + utensílios ou equipamentos de uso diário, + instalações higieno-sanitárias + + + Geral + + Limpeza diária e periódica + + + Devem ser limpos periodicamente paredes e + tectos, fontes de luz natural e artificial, + utensílios ou equipamentos de uso não diário + ( + + Decreto Lei nº 243/86 – Art. 7º- 2 + + + ) + + + + + Devem ser limpos periodicamente paredes e + tectos, fontes de luz natural e artificial, + utensílios ou equipamentos de uso não diário + + + Geral + + Limpeza diária e periódica + + + Devem ser limpas periodicamente e + desinfectadas as instalações + higieno-sanitárias ( + + Decreto Lei nº 243/86 – Art. 7º - 2 + + + ) + + + + + Devem ser limpas periodicamente e + desinfectadas as instalações + higieno-sanitárias + + + Geral + + Limpeza diária e periódica + + + As operações de limpeza e desinfecção devem + ser feitas por forma a que não levantem + poeiras, fora das horas de trabalho (ou + durante as horas de trabalho, quando + exigências particulares a tal obriguem e + possam ser feitas sem inconvenientes grave + para o trabalhador) e com produtos não + tóxicos ou irritantes ( + + Decreto Lei nº 243/86 – Art. 8 + + + ) + + + + + As operações de limpeza e desinfecção devem + ser feitas por forma a que não levantem + poeiras, fora das horas de trabalho (ou + durante as horas de trabalho, quando + exigências particulares a tal obriguem e + possam ser feitas sem inconvenientes grave + para o trabalhador) e com produtos não + tóxicos ou irritantes + + + Geral + + Desperdícios + + + Os desperdícios ou restos incómodos devem + ser colocados em recipientes resistentes e + higienizáveis com tampa, que serão removidos + diariamente do local de trabalho ( + + Decreto + + + Lei nº 243/86 – Art. 9 -1 + + + ) + + + + + Os desperdícios ou restos incómodos devem + ser colocados em recipientes resistentes e + higienizáveis com tampa, que serão removidos + diariamente do local de trabalho + + + Geral + + Desperdícios + + + Quando os desperdícios ou restos forem muito + incómodos ou susceptíveis de libertarem + substâncias tóxicas, perigosas ou + infectantes, devem ser previamente + neutralizados e colocados em recipientes + resistentes cuja tampa feche hermeticamente. + A sua remoção do local de trabalho deve ser + diária ou no final de cada turno de trabalho + (…) ( + + Decreto + + + Lei nº 243/86 – Art. 9 -2 + + + ) + + + + + Quando os desperdícios ou restos forem muito + incómodos ou susceptíveis de libertarem + substâncias tóxicas, perigosas ou + infectantes, devem ser previamente + neutralizados e colocados em recipientes + resistentes cuja tampa feche hermeticamente. + A sua remoção do local de trabalho deve ser + diária ou no final de cada turno de trabalho + (…) + + + Geral + + Desperdícios + + + Cada posto de trabalho deve ter recipiente + ou dispositivo próprio ( + + Decreto Lei nº 243/86 + + + – Art. 9 -3 + + + ) + + + + + Cada posto de trabalho deve ter recipiente + ou dispositivo próprio + + + Segurança + + + Primeiros socorros, combate a incêndios e + evacuação de trabalhadores + + + + A empresa ou estabelecimento (…) deve ter + uma estrutura interna que assegure as + actividades de primeiros socorros, combate a + incêndios e de evacuação de trabalhadores em + situações de perigo grave e iminente, + designando os trabalhadores responsáveis por + essas actividades ( + + Lei nº 35/2004 – Art. 220º + + + ) + + + + + A empresa ou estabelecimento (…) deve ter + uma estrutura interna que assegure as + actividades de primeiros socorros, combate a + incêndios e de evacuação de trabalhadores em + situações de perigo grave e iminente, + designando os trabalhadores responsáveis por + essas actividades + + + Segurança + + Risco de incêndio + + + O material de detecção e combate a incêndios + deve encontrar-se num local permanentemente + acessível + + (Decreto Lei n.º243/86 – Art.36º-1) + + + + + O material de detecção e combate a incêndios + deve encontrar-se num local permanentemente + acessível + + + Segurança + + Risco de incêndio + + + Todos os locais de trabalho devem + encontrar-se providos de equipamento + adequado para a extinção de incêndios, em + perfeito estado de funcionamento, situado em + local acessível e convenientemente + assinalado ( + + Decreto Lei n.º243/86 – Art.36º-1) + + + + + Todos os locais de trabalho devem + encontrar-se providos de equipamento + adequado para a extinção de incêndios, em + perfeito estado de funcionamento, situado em + local acessível e convenientemente + assinalado + + + Segurança + + Risco de incêndio + + + O estado de funcionamento dos equipamentos + de extinção de incêndios deve ser verificado + em intervalos regulares ( + + Decreto Lei 243/86 – Art. 36º - 2) + + + + + O estado de funcionamento dos equipamentos + de extinção de incêndios deve ser verificado + em intervalos regulares + + + Segurança + + Risco de incêndio + + + Formar os colaboradores na utilização dos + equipamentos de combate a incêndios ( + + Decreto Lei n.º 243/86 – Art.36º-3 + + + ) + + + + + Formar os colaboradores na utilização dos + equipamentos de combate a incêndios + + + Segurança + + Risco de incêndio + + + Os edifícios devem dispor no seu interior de + meios próprios de intervenção que permitam a + actuação imediata sobre focos de incêndio + pelos seus ocupantes e que facilitem aos + bombeiros o lançamento rápido das operações + de socorro. (Portaria 1352/2008 – Título VI + Capítulo V Art. 162, 1) + + + + Os edifícios devem dispor no seu interior de + meios próprios de intervenção que permitam a + actuação imediata sobre focos de incêndio + pelos seus ocupantes e que facilitem aos + bombeiros o lançamento rápido das operações + de socorro. + + + Segurança + + Risco de incêndio + + + Os meios de extinção a aplicar no interior + dos edifícios podem ser: + + + a) Extintores portáteis e móveis, redes de + incêndio armadas; + + + b) Redes secas ou húmidas para a segunda + intervenção; + + c) Outros meios. + + (Portaria 1352/2008 – Título VI Capítulo V + Art. 162, 2 a) e b)) + + + + Os meios de extinção a aplicar no interior + dos edifícios podem ser extintores portáteis + e móveis, redes de incêndio armadas; redes + secas ou húmidas para a segunda intervenção + ou outros meios + + + Segurança + + Risco de incêndio + + + Todos os locais devem ser equipados com + extintores devidamente dimensionados e + adequadamente distribuídos, em edifícios de + forma que a distância a percorrer de + qualquer saída de um local de risco para os + caminhos de evacuação até ao extintor mais + próximo não exceda 15 m. (Portaria 1352/2008 + – Título VI Capítulo V Art. 163, 1) + + + + Todos os locais devem ser equipados com + extintores devidamente dimensionados e + adequadamente distribuídos + + de forma que a distância a percorrer de + qualquer saída de um local de risco para os + caminhos de evacuação até ao extintor mais + próximo não exceda 15 m. + + + Segurança + + Risco de incêndio + + + Na ausência de outro critério de + dimensionamento devidamente justificado, os + extintores devem ser calculados à razão de: + + + a) 18 L de agente extintor por 500 m2 ou + fracção de área de pavimento do piso; + + + b) Um por cada 200 m2 de pavimento do piso + ou fracção, com um mínimo de dois por piso. + + + (Portaria 1352/2008 – Título VI Capítulo V + Art. 163, 1) + + + + Na ausência de outro critério de + dimensionamento os extintores devem ser + calculados à razão de + + 18 L de agente extintor por 500 m2 ou um por + cada 200 m2 de pavimento com um mínimo de + dois por piso. + + + Segurança + + Risco de incêndio + + + Os extintores devem ser convenientemente + distribuídos, sinalizados e instalados em + locais bem visíveis, colocados em suporte + próprio de modo a que o seu manípulo fique a + uma altura não superior a 1,2 m do pavimento + e localizados preferencialmente: + + + a) Nas comunicações horizontais ou, em + alternativa, no interior das câmaras + corta-fogo, quando existam; + + + b) No interior dos grandes espaços e junto + às suas saídas. + + + (Portaria 1352/2008 – Título VI Capítulo V + Art. 163, 2 a) e b)) + + + + Os extintores devem ser convenientemente + distribuídos, sinalizados e instalados em + locais bem visíveis, colocados em suporte + próprio de modo a que o seu manípulo fique a + uma altura não superior a 1,2 m do pavimento + e localizados preferencialmente nas + comunicações horizontais ou, em alternativa, + no interior das câmaras corta-fogo, quando + existam ou no interior dos grandes espaços e + junto às suas saídas. + + + Segurança + + Risco de incêndio + + + As cozinhas e os laboratórios devem ser + dotados de mantas ignífugas em complemento + dos extintores. (Portaria 1352/2008 – Título + VI Capítulo V Art. 163, 5) + + + + As cozinhas e os laboratórios devem ser + dotados de mantas ignífugas em complemento + dos extintores. + + + Segurança + + Risco de incêndio + + + Nas centrais térmicas com potência útil + superior a 70 kW devem ser instalados, + enquanto meios adicionais de primeira + intervenção: + + + a) Nos casos de combustível sólido ou + líquido: + + + i) Um recipiente com 100 l de areia e uma + pá; + + + ii) Extintores de eficácia mínima 34 B, dois + por queimador, com um máximo de quatro; + + + b) Nos casos de combustível gasoso, extintor + de pó químico ABC, de eficácia mínima 5 A/34 + B. + + + (Portaria 1352/2008 – Título VI Capítulo V + Art. 163, 6 a) e b)) + + + + Nas centrais térmicas (com potência útil + superior a 70 kW e nos casos de combustível + sólido ou líquido), devem ser instalados + meios adicionais de primeira intervenção: um + recipiente com 100 l de areia e uma pá e + extintores de eficácia mínima 34 B, dois por + queimador, com um máximo de quatro e (nos + casos de combustível gasoso), um extintor de + pó químico ABC, de eficácia mínima 5 A/34 B + + + Segurança + + Risco de incêndio + + + Devem ser servidos por redes de incêndio + armadas, com bocas-de-incêndio do tipo + carretel, devidamente distribuídas e + sinalizadas: + + + a) As utilizações-tipo II a VIII, VI e XII, + da 2.ª categoria de risco ou superior, com + excepção das disposições específicas para as + utilizações-tipo VII e VIII constantes do + título VIII; + + + b) Estacionamentos (1.ª categoria de risco), + com espaços cobertos de área superior a 500 + m2; + + + d) Os locais que possam receber mais de 200 + pessoas. + + + (Portaria 1352/2008 – Título VI Capítulo V + Art. 164º) + + + + Devem ser servidos por redes de incêndio + armadas, com bocas-de-incêndio do tipo + carretel, devidamente distribuídas e + sinalizadas: + + + a) As utilizações-tipo II a VIII, VI e XII, + da 2.ª categoria de risco ou superior, com + excepção das disposições específicas para as + utilizações-tipo VII e VIII constantes do + título VIII; + + + b) Estacionamentos (1.ª categoria de risco), + com espaços cobertos de área superior a 500 + m2; + + + d) Os locais que possam receber mais de 200 + pessoas. + + + Segurança + + Risco de incêndio + + + As bocas-de-incêndio devem ser dispostas nos + seguintes termos: + + + a) O comprimento das mangueiras atinja, por + uma agulheta, uma distância não superior a 5 + m de todos os pontos do espaço a proteger; + + + b) A distância entre as bocas não seja + superior ao dobro do comprimento das + mangueiras utilizadas; + + + c) Exista uma boca-de-incêndio nos caminhos + horizontais de evacuação junto à saída para + os caminhos verticais, a uma distância + inferior a 3 m do respectivo vão de + transição; + + + d) Exista uma boca-de-incêndio junto à saída + de locais que possam receber mais de 200 + pessoas. + + + (Portaria 1352/2008 – Título VI Capítulo V + Art. 164º) + + + + As bocas-de-incêndio devem garantir : + + + a) comprimento das mangueiras que atinja, + por uma agulheta, uma distância não superior + a 5 m de todos os pontos do espaço a + proteger; + + + b) distância entre as bocas não seja + superior ao dobro do comprimento das + mangueiras utilizadas; + + + c) Exista uma boca-de-incêndio nos caminhos + horizontais de evacuação junto à saída para + os caminhos verticais, a uma distância + inferior a 3 m do respectivo vão de + transição; + + + d) Exista uma boca-de-incêndio junto à saída + de locais que possam receber mais de 200 + pessoas. + + + Segurança + + Risco de incêndio + + + Os carretéis de incêndio devem assegurar + que: + + + a) O seu manípulo de manobra se situa a uma + altura do pavimento não superior a 1,50 m; + + + b) Os carretéis de tambor fixo são + exclusivamente para instalação à face da + parede e possuem guia de roletes + omnidirecional; + + + c) Os carretéis encastrados, com ou sem + armário, são do tipo de rodar ou de pivotar; + + + d) Os armários são sempre do tipo homologado + em conjunto com o carretel e a respectiva + porta, instalada à face da parede ou + saliente desta, de modo a que possa rodar + 170º na sua abertura. + + + (Portaria 1352/2008 – Título VI Capítulo V + Art. 165º, 1 a) a d)) + + + + Os carretéis de incêndio devem assegurar + que: o seu manípulo de manobra se situa a + uma altura do pavimento não superior a 1,50 + m e que os armários são sempre do tipo + homologado em conjunto com o carretel e a + respectiva porta. + + + Segurança + + Risco de incêndio + + + + A eixo com os carretéis, instalados ou não + em armário, deve existir um espaço + desimpedido e livre de quaisquer elementos + que possam comprometer o seu acesso ou a sua + manobra, com um raio mínimo, medido em + planta, de 1 m e altura de 2 m. (Portaria + 1352/2008 – Título VI Capítulo V Art. 165º, + 2) + + + + A eixo com os carretéis + + deve existir um espaço desimpedido e livre + de quaisquer elementos que possam + comprometer o seu acesso ou a sua manobra, + com um raio mínimo, medido em planta, de 1 m + e altura de 2 m. + + + Segurança + + + Risco de incêndio - Formação em Segurança + contra Incêndio + + + + Devem possuir formação no domínio da + segurança contra incêndio: + + + a) Os funcionários e colaboradores das + entidades exploradoras; + + + b) Todos as pessoas que exerçam actividades + profissionais por períodos superiores a 30 + dias por ano nos espaços; + + + c) Todos os elementos com atribuições + previstas nas actividades de autoprotecção. + + + (Portaria 1352/2008 – Título VII Art. 206º, + 1 a), b) e c)) + + + + Devem possuir formação no domínio da + segurança contra incêndio: os funcionários e + colaboradores das entidades exploradoras; + todos as pessoas que exerçam actividades + profissionais por períodos superiores a 30 + dias por ano nos espaços e todos os + elementos com atribuições previstas nas + actividades de autoprotecção. + + + Segurança + + + Risco de incêndio - Formação em Segurança + contra Incêndio + + + + As acções de formação, a definir em programa + estabelecido por cada RS, poderão consistir + em: + + + a) Sensibilização para a segurança contra + incêndio, constantes de sessões informativas + que devem cobrir o universo dos + destinatários com o objectivo de: + + + i) Familiarização com os espaços e + identificação dos respectivos riscos de + incêndio; + + + ii) Cumprimento dos procedimentos genéricos + de prevenção contra incêndios ou, caso + exista, do plano de prevenção; + + + iii) Cumprimento dos procedimentos de + alarme; + + + iv) Cumprimento dos procedimentos gerais de + actuação em caso de emergência; + + + v) Instrução de técnicas básicas de + utilização dos meios de primeira + intervenção, nomeadamente os extintores + portáteis; + + + b) Formação específica destinada aos + elementos que, na sua actividade + profissional normal, lidam com situações de + maior risco de incêndio, nomeadamente os que + a exercem em locais como + Indústria/Oficinas/Armazéns; + + + c) Formação específica para os elementos que + possuem atribuições especiais de actuação em + caso de emergência, nomeadamente para: + + i) A emissão do alerta; + ii) A evacuação; + + iii) A utilização dos comandos de meios de + actuação em caso de incêndio e de segunda + intervenção; + + + iv) A recepção e o encaminhamento dos + bombeiros; + + + v) A direcção das operações de emergência; + + + vi) Outras actividades previstas no plano de + emergência interno, quando exista. + + + (Portaria 1352/2008 – Título VII Art. 206º, + 2) + + + + As acções de Formação em segurança contra + incêndio deverão consistir numa + sensibilização para a segurança contra + incêndio e cubrir o universo dos + destinatários. O objectivo da formação de + sensibilização deverá ser a familiarização + com os espaços e identificação dos + respectivos riscos de incêndio; o + cumprimento dos procedimentos genéricos de + prevenção contra incêndios ou do plano de + prevenção; o cumprimento dos procedimentos + de alarme e do procedimentos gerais de + actuação em caso de emergência; as intrução + de técnicas básicas de utilização dos meios + de primeira intervenção, nomeadamente os + extintores portáteis. + + + Deverá verificar-se Formação específica + destinada aos elementos que, na sua + actividade profissional normal, lidam com + situações de maior risco de incêndio, + nomeadamente os que a exercem em locais como + Indústria/Oficinas/Armazéns; + + + Também os colaboradores que possuem + atribuições especiais de actuação em caso de + emergência (emissão do alerta; evacuação; + ,utilização dos comandos de meios de + actuação em caso de incêndio e de segunda + intervenção; recepção e o encaminhamento dos + bombeiros e direcção das operações de + emergência deverão ter Formação específica + em Segurança contra Incêndio. + + + Segurança + + + Risco de incêndio - Formação em Segurança + contra Incêndio + + + + As acções de sensibilização devem ser + programadas de modo a que os seus + destinatários as tenham frequentado no prazo + máximo de 60 dias após a sua entrada em + serviço nos espaços da utilização-tipo. + (Portaria 1352/2008 – Título VII Art. 206º, + 3 d)) + + + + As acções de sensibilização devem ser + programadas de modo a que os seus + destinatários as tenham frequentado no prazo + máximo de 60 dias após a sua entrada em + serviço nos espaços da utilização-tipo. + + + Segurança + + + Risco de incêndio - Formação em Segurança + contra Incêndio + + + + Nas utilizações-tipo que possuam plano de + emergência interno devem ser realizados + exercícios com os objectivos de teste do + referido plano e de treino dos ocupantes, + com vista à criação de rotinas de + comportamento e de actuação, bem como ao + aperfeiçoamento dos procedimentos em causa. + (Portaria 1352/2008 – Título VII Art. 207º, + 1) + + + + Realizar exercícios (simualção de situações + de emergência) com vista à criação de + rotinas de comportamento e de actuação, bem + como ao aperfeiçoamento dos procedimentos de + emergência e de evacuação. + + + Segurança + + + Risco de incêndio - Formação em Segurança + contra Incêndio + + + Na realização dos simulacros: + + c) Os exercícios devem ser devidamente + planeados, executados e avaliados, com a + colaboração eventual do corpo de bombeiros + em cuja área de actuação própria se situe a + utilização-tipo e de coordenadores ou de + delegados da protecção civil; + + + d) A execução dos simulacros deve ser + acompanhada por observadores que colaborarão + na avaliação dos mesmos; + + + e) Deve ser sempre dada informação prévia + aos ocupantes da realização de exercícios, + podendo não ser rigorosamente estabelecida a + data e ou hora programadas. + + + (Portaria 1352/2008 – Título VII Art. 207º, + 2 c), d) e e)) + + + + Os exercícios de simualção devem: ser + devidamente planeados, executados e + avaliados, com a colaboração eventual do + corpo de bombeiros; ser acompanhada por + observadores que colaborarão na avaliação + dos mesmos. Deve ser sempre dada informação + prévia aos ocupantes da realização de + exercícios, podendo não ser rigorosamente + estabelecida a data e ou hora programadas. + + + Segurança + + + Risco de incêndio - Formação em Segurança + contra Incêndio + + + + + Quando as características dos ocupantes + inviabilizem a realização de exercícios de + evacuação, devem ser realizados exercícios + de quadros que os substituam e reforçadas as + medidas de segurança, designadamente nos + domínios da vigilância do fogo e das + instruções de segurança. (Portaria 1352/2008 + – Título VII Art. 207º, 3) + + + + Quando as características dos ocupantes + inviabilizem a realização de exercícios de + evacuação, devem ser realizados exercícios + de quadros que os substituam e reforçadas as + medidas de segurança, designadamente nos + domínios da vigilância do fogo e das + instruções de segurança. + + + Segurança + + + Risco de incêndio - Controlo de Poluição + + + + O teor de monóxido de carbono (CO) existente + no ar não deve exceder 50 ppm em valores + médios durante oito horas, nem 200 ppm em + valores instantâneos. (Portaria 1352/2008 – + Título VI Capítulo VIII Art. 180º, 1) + + + + O teor de monóxido de carbono (CO) existente + no ar não deve exceder 50 ppm em valores + médios durante oito horas, nem 200 ppm em + valores instantâneos. + + + Segurança + + + Risco de incêndio - Controlo de Poluição + + + + Quando atingida a concentração de 200 ppm, + as pessoas devem ser avisadas através de um + + alarme óptico e acústico que indique + «Atmosfera Saturada - CO» junto às entradas + do espaço em questão, por cima das portas de + acesso. (Portaria 1352/2008 – Título VI + Capítulo VIII Art. 180º, 2) + + + + Quando atingida a concentração de 200 ppm, + as pessoas devem ser avisadas através de um + + alarme óptico e acústico que indique + «Atmosfera Saturada - CO» junto às entradas + do espaço em questão, por cima das portas de + acesso. + + + Segurança + + + Risco de incêndio - Controlo de Poluição + + + + O sistema de controlo da poluição deve + dispor de: + + + a) Sistema automático de detecção de + monóxido de carbono, cujos detectores devem + ser instalados a uma altura de 1,5 m do + pavimento e distribuídos uniformemente de + modo a cobrir áreas inferiores a 400 m² por + cada detector; + + + c) Instalação de ventilação, por meios + passivos ou activos. + + + (Portaria 1352/2008 – Título VI Capítulo + VIII Art. 180º, 2 a) e c)) + + + + O sistema de controlo da poluição deve + dispor de sistema automático de detecção de + monóxido de carbono (cujos detectores devem + ser instalados a uma altura de 1,5 m do + pavimento e distribuídos uniformemente de + modo a cobrir áreas inferiores a 400 m² por + cada detector) e Instalação de ventilação. + + + Segurança + + + Risco de incêndio - Controlo de Poluição + + + + Nos locais onde se preveja a emissão de + gases poluentes distintos do monóxido de + carbono, cabe à entidade responsável pelo + projecto ou pela exploração do local alertar + para o facto e propor a fixação de limites + de teor máximo admissíveis. (Portaria + 1352/2008 – Título VI Capítulo VIII Art. + 180º,3) + + + + Nos locais onde se preveja a emissão de + gases poluentes distintos do monóxido de + carbono, cabe à entidade responsável pelo + projecto ou pela exploração do local alertar + para o facto e propor a fixação de limites + de teor máximo admissíveis. + + + Segurança + + + Risco de incêndio - Controlo de Poluição + + + + É obrigatória a existência de sistemas de + controlo de poluição: + + + a) Nos espaços cobertos fechados afectos a + Estacionamentos; + + + b) Nos espaços afectos à utilização-tipo + Industrial/Oficina/Armazém: + + + (Portaria 1352/2008 – Título VI Capítulo + VIII Art. 181º) + + + + É obrigatória a existência de sistemas de + controlo de poluição nos espaços cobertos + fechados afectos a Estacionamentos e nos + espaços afectos à utilização-tipo + Industrial/Oficina/Armazém: + + + Segurança + + + Risco de incêndio - Controlo de Poluição + + + + É admissível nos espaços afectos a + Estacionamentos, em pisos acima do nível de + referência ou no piso imediatamente abaixo + desse nível, que a ventilação para controlo + da poluição se faça por meios passivos. + (Portaria 1352/2008 – Título VI Capítulo + VIII Art. 182º, 1) + + + + É admissível nos espaços afectos a + Estacionamentos, em pisos acima do nível de + referência ou no piso imediatamente abaixo + desse nível, que a ventilação para controlo + da poluição se faça por meios passivos. + + + Segurança + + + Risco de incêndio - Controlo de Poluição + + + + As instalações de ventilação mecânica devem + ser accionadas automaticamente por activação + da central de controlo de monóxido de + carbono e manualmente por comando, bem + protegido e sinalizado, situado no posto de + segurança. (Portaria 1352/2008 – Título VI + Capítulo VIII Art. 183º, 2) + + + + As instalações de ventilação mecânica devem + ser accionadas automaticamente por activação + da central de controlo de monóxido de + carbono e manualmente por comando, bem + protegido e sinalizado, situado no posto de + segurança. + + + Segurança + + + Risco de incêndio - Controlo de Fumo + + + + Os edifícios devem ser dotados de meios que + promovam a libertação para o exterior do + fumo e dos gases tóxicos ou corrosivos, + reduzindo a contaminação e a temperatura dos + espaços e mantendo condições de + visibilidade, nomeadamente nas vias de + evacuação. (Portaria 1352/2008 – Título VI + Capítulo IV Art. 133º) + + + + Os edifícios devem ser dotados de meios que + promovam a libertação para o exterior do + fumo e dos gases tóxicos ou corrosivos, + reduzindo a contaminação e a temperatura dos + espaços e mantendo condições de + visibilidade, nomeadamente nas vias de + evacuação. + + + Segurança + + + Risco de incêndio - Controlo de Fumo + + + + Devem ser dotados de instalações de controlo + de fumo: + + + a) As vias verticais de evacuação + enclausuradas; + + b) As câmaras corta-fogo; + + c) As vias horizontais de evacuação; + + + d) Os pisos situados no subsolo, desde que + sejam acessíveis a público ou que tenham + área superior a 200 m2, independentemente da + sua ocupação; + + + e) Os locais de risco B com efectivo + superior a 500 pessoas; + + + f) Os locais de risco com risco agravado de + incêndio pelos materiais ou actividades; + + + g) As cozinhas na situação ligadas a salas + de refeições; + + + h) Os átrios e corredores adjacentes a + pátios interiores cobertos; + + + i) Os espaços cobertos de Estacionamentos; + + + j) Os espaços afectos à utilização-tipo + industrial; + + + l) Os espaços cénicos isoláveis. + + + (Portaria 1352/2008 – Título VI Capítulo IV + Art. 135º, 1 a) a l)) + + + + Devem ser dotados de instalações de controlo + de fumo: + + + + - As vias verticais de evacuação + enclausuradas; + + + + - As câmaras corta-fogo; + + + + - + + As vias horizontais de evacuação; + + + + - + + Os pisos situados no subsolo, desde que + sejam acessíveis a público ou que tenham + área superior a 200 m2, independentemente da + sua ocupação; + + + + - + + Os locais de risco B com efectivo superior a + 500 pessoas; + + + + - + + Os locais de risco com risco agravado de + incêndio pelos materiais ou actividades; + + + + - + + As cozinhas na situação ligadas a salas de + refeições; + + + + - + + Os átrios e corredores adjacentes a pátios + interiores cobertos; + + + + - + + Os espaços cobertos de Estacionamentos; + + + + - + + Os espaços afectos à utilização-tipo + industrial; + + + + - + + Os espaços cénicos isoláveis. + + + Segurança + + + Risco de incêndio - Controlo de Fumo + + + + As instalações de controlo de fumo devem ser + dotadas de sistemas de comando manual, + duplicados por comandos automáticos quando + exigido, de forma a assegurar: + + + a) A abertura apenas dos obturadores das + bocas, de insuflação ou de extracção, ou dos + exutores do local ou da via sinistrada; + + + b) A paragem das instalações de ventilação + ou de tratamento de ar, quando existam, a + menos que essas instalações participem no + controlo de fumo; + + + c) O arranque dos ventiladores de controlo + de fumo, quando existam. + + + (Portaria 1352/2008 – Título VI Capítulo IV + Art. 140º, 1 a), b) e c)) + + + + As instalações de controlo de fumo devem ser + dotadas de sistemas de comando manual, + duplicados por comandos automáticos quando + exigido, de forma a assegurar a abertura + apenas dos obturadores das bocas, de + insuflação ou de extracção, ou dos exutores + do local ou da via sinistrada; a paragem das + instalações de ventilação ou de tratamento + de ar, quando existam, a menos que essas + instalações participem no controlo de fumo e + o arranque dos ventiladores de controlo de + fumo, quando existam. + + + Segurança + + + Risco de incêndio - Controlo de Fumo + + + + Nos sistemas de comando manual, os + dispositivos de abertura devem ser + accionáveis por comandos devidamente + sinalizados, dispostos na proximidade dos + acessos aos locais, duplicados no posto de + segurança, quando este exista. (Portaria + 1352/2008 – Título VI Capítulo IV Art. 140º, + 2) + + + + Nos sistemas de comando manual, os + dispositivos de abertura devem ser + accionáveis por comandos devidamente + sinalizados, dispostos na proximidade dos + acessos aos locais, duplicados no posto de + segurança, quando este exista. + + + Segurança + + + Risco de incêndio - Controlo de Fumo + + + + Nos locais ou vias de evacuação para os + quais se exigem instalações de alarme + compreendendo detectores automáticos de + incêndio, as instalações de controlo de fumo + devem ser dotadas de comando automático. + (Portaria 1352/2008 – Título VI Capítulo IV + Art. 140º, 4) + + + + Nos locais ou vias de evacuação para os + quais se exigem instalações de alarme + compreendendo detectores automáticos de + incêndio, as instalações de controlo de fumo + devem ser dotadas de comando automático. + + + Segurança + + + Risco de incêndio - Controlo de Fumo + + + + A posição dos aparelhos de comando dos + ventiladores deve ser sinalizada no posto de + segurança, quando exista. (Portaria + 1352/2008 – Título VI Capítulo IV Art. 144º, + 6) + + + + A posição dos aparelhos de comando dos + ventiladores deve ser sinalizada no posto de + segurança, quando exista. + + + Segurança + + + Risco de incêndio + + - ExsitÊncia de Líquidos e Gases + Combustíveis + + + + É interdita a utilização ou o depósito de + líquidos ou gases combustíveis, em qualquer + quantidade, em vias de evacuação, + horizontais e verticais. (Portaria 1352/2008 + – Título V Capítulo VIII Art. 106º, 4 a)) + + + + É interdita a utilização ou o depósito de + líquidos ou gases combustíveis, em qualquer + quantidade, em vias de evacuação, + horizontais e verticais. + + + Segurança + + + Risco de incêndio + + - ExsitÊncia de Líquidos e Gases + Combustíveis + + + + Devem ser dotados de ventilação natural + permanente por meio de aberturas inferiores + e superiores criteriosamente distribuídas + todos os espaços que contenham gases ou + líquidos combustíveis. (Portaria 1352/2008 – + Título V Capítulo VIII Art. 106º, 7) + + + + Todos os espaços que contenham gases ou + líquidos combustíveis + + devem ser dotados de ventilação natural + permanente por meio de aberturas inferiores + e superiores. + + + Segurança + + + Risco de incêndio + + - ExsitÊncia de Líquidos e Gases + Combustíveis + + + + As válvulas (de corte de alimentação) adevem + ser devidamente sinalizadas, estar + permanentemente acessíveis e estar + localizadas no exterior dos compartimentos. + (Portaria 1352/2008 – Título V Capítulo VIII + Art. 107º, 5) + + + + As válvulas (de corte de alimentação) adevem + ser devidamente sinalizadas, estar + permanentemente acessíveis e estar + localizadas no exterior dos compartimentos. + + + Segurança + + + Risco de incêndio - Instalações de Confecção + e Conservação + + de Alimentos + + + + As instalações técnicas dos edifícios e dos + recintos devem ser concebidas, instaladas e + mantidas, nos termos legais, de modo que não + constituam causa de incêndio nem contribuam + para a sua propagação. (Portaria 1352/2008 – + Título V Capítulo I Art. 69º 1) + + + + As instalações técnicas dos edifícios devem + ser concebidas, instaladas e mantidas de + modo que não constituam causa de incêndio + nem contribuam para a sua propagação. + + + Segurança + + + Risco de incêndio - Instalações de Confecção + e Conservação + + de Alimentos + + + + As cozinhas ou outros locais de confecção ou + reaquecimento de alimentos, fixos ou móveis, + com potência instalada não superior a 20 kW, + são permitidos desde que: Funcionem a gás ou + a electricidade e distem 2 m, no mínimo, dos + espaços acessíveis aao público; O bloco de + confecção possua paredes ou painéis de + protecção construídos com materiais da + Classe A1; As canalizações de gás sejam + fixas, protegidas contra acções mecânicas, + visíveis em todo o percurso e instaladas de + forma a não serem atingidas por chamas ou + por produtos de combustão, sendo, contudo, + permitidos tubos flexíveis de comprimento + até 1,5 m para ligação de garrafas de gás a + um único aparelho e Sejam equipados com + dispositivos de corte e comando, + permanentemente acessíveis e sinalizados, + que assegurem, por accionamento manual, a + interrupção da alimentação de + + combustível e de fornecimento de energia aos + aparelhos. (Portaria 1352/2008 – Título V + Capítulo III Art. 88º, 6 a), b), c), e d)) + + + + + são permitias cozinhas ou outros locais de + confecção ou reaquecimento de alimentos, + fixos ou móveis (com potência + + não superior a 20 kW) desde que: funcionem a + gás ou a electricidade e distem 2 m, no + mínimo, dos espaços acessíveis aao público; + o bloco de confecção possua paredes ou + painéis de protecção construídos com + materiais da Classe A1; as canalizações de + gás sejam fixas, protegidas contra acções + mecânicas, visíveis em todo o percurso e + instaladas de forma a não serem atingidas + por chamas ou por produtos de combustão, + sendo, contudo, permitidos tubos flexíveis + de comprimento até 1,5 m para ligação de + garrafas de gás a um único aparelho e sejam + equipados com dispositivos de corte e + comando, permanentemente acessíveis e + sinalizados, que assegurem, por accionamento + manual, a interrupção da alimentação de + + combustível e de fornecimento de energia aos + aparelhos. + + + Segurança + + + Risco de incêndio - Instalações de Confecção + e Conservação + + de Alimentos + + + + As cozinhas com potência útil total + instalada superior a 20 kW devem ser + equipadas com dispositivos devidamente + sinalizados, instalados junto ao respectivo + acesso principal, que assegurem, por + accionamento manual: a interrupção da + alimentação de combustível e de fornecimento + de energia aos aparelhos e o comando do + sistema de controlo de fumo. (Portaria + 1352/2008 – Título V Capítulo III Art. 90º, + 7 a) e b)) + + + + As cozinhas com potência útil total + instalada superior a 20 kW devem ser + equipadas com dispositivos devidamente + sinalizados, instalados junto ao respectivo + acesso principal, que assegurem, por + accionamento manual: a interrupção da + alimentação de combustível e de fornecimento + de energia aos aparelhos e o comando do + sistema de controlo de fumo. (Portaria + 1352/2008 – Título V Capítulo III Art. 90º, + 7 a) e b)) + + + Segurança + + + Risco de incêndio - + + Parques de Estacionamento + + + + Nos parques de estacionamento cobertos não é + permitida a existência de Garagens; Postos + de abastecimento de combustíveis e/ou + Oficinas de reparação. (Portaria 1352/2008 – + Título VIII Art. 214º, 1) + + + + Nos parques de estacionamento cobertos não é + permitida a existência de Garagens; Postos + de abastecimento de combustíveis e/ou + Oficinas de reparação. + + + Segurança + + + Risco de incêndio - + + Parques de Estacionamento + + + + Constituem excepção as oficinas destinadas + exclusivamente a Lavagens auto e/ou mudanças + de óleo ou reparação e mudança de pneus, + desde que os produtos destinados à sua + actividade, quando armazenados no interior + do parque, o sejam em compartimentos com + volume inferior a 50 m3, considerados locais + de risco C para todos os efeitos + estabelecidos no presente regulamento. + (Portaria 1352/2008 – Título VIII Art. 214º, + 2) + + + + Constituem excepção as oficinas destinadas + exclusivamente a Lavagens auto e/ou mudanças + de óleo ou reparação e mudança de pneus, + desde que os produtos destinados à sua + actividade, quando armazenados no interior + do parque, o sejam em compartimentos com + volume inferior a 50 m3, considerados locais + de risco C para todos os efeitos + estabelecidos no presente regulamento. + + + Segurança + + + Risco de incêndio - + + Parques de Estacionamento + + + + Nos parques de estacionamento cobertos, a + distância máxima a percorrer até se atingir + a saída mais próxima, para o exterior ou + para uma via de evacuação protegida, medida + segundo os eixos dos caminhos de evacuação, + deve ser de 25 m nos pontos em impasse e de + 40 m nos pontos com acesso a saídas + distintas. (Portaria 1352/2008 – Título VIII + Capítulo II Art. 218º, 1) + + + + Nos parques de estacionamento cobertos, a + distância máxima a percorrer até à saída + mais próxima, para o exterior ou + + via de evacuação protegida, deve ser de 25 m + nos pontos em impasse e de 40 m nos pontos + com acesso a saídas distintas. + + + Segurança + + + Risco de incêndio - + + Parques de Estacionamento + + + + Nos parques de estacionamento os espaços + demarcados para arrumo de carrinhos de + transporte, quando existam, devem ser + sinalizados e protegidos contra choques de + veículos e não podem prejudicar a evacuação. + (Portaria 1352/2008 – Título VIII Capítulo + II Art. 218º, 2) + + + + Nos parques de estacionamento os espaços + demarcados para arrumo de carrinhos de + transporte, quando existam, devem ser + sinalizados e protegidos contra choques de + veículos e não podem prejudicar a evacuação. + + + Segurança + + + Risco de incêndio - + + Parques de Estacionamento + + + + + Nos locais onde se exerçam actividades que + interessam à segurança, nomeadamente os + locais de serviço de exploração, deve + prever-se a instalação de aparelhos de + iluminação de potência adequada àquelas + actividades e às dimensões do local, com um + mínimo de dois aparelhos, de maneira a + garantir a iluminação ambiente. (Portaria + 1352/2008 – Título VIII Capítulo II Art. + 222º, 1) + + + + Nos locais onde se exerçam actividades que + interessam à segurança, nomeadamente os + locais de serviço de exploração, deve + prever-se a instalação de aparelhos de + iluminação de potência adequada àquelas + actividades e às dimensões do local, com um + mínimo de dois aparelhos, de maneira a + garantir a iluminação ambiente. + + + Segurança + + + Risco de incêndio - + + Parques de Estacionamento + + + + A ligação e corte das instalações de + iluminação de segurança devem poder ser + feitos manualmente, por comando localizado + no posto de segurança. (Portaria 1352/2008 – + Título VIII Capítulo II Art. 224º, 1). + + + + A ligação e corte das instalações de + iluminação de segurança devem poder ser + feitos manualmente, por comando localizado + no posto de segurança. + + + Segurança + + + Risco de incêndio - + + Parques de Estacionamento + + + + Nos casos em que os caminhos horizontais de + evacuação estejam exclusivamente assinalados + através de passadeiras pintadas nos + pavimentos, os dispositivos de iluminação + devem ser distribuídos de modo a garantir o + nível médio de iluminância de 10 lux, medido + num plano situado a 1 m do pavimento, e, se + necessário, ser devidamente protegidos + contra acções dinâmicas. (Portaria 1352/2008 + – Título VIII Capítulo II Art. 224º, 2) + + + + Nos casos em que os caminhos horizontais de + evacuação estejam exclusivamente assinalados + através de passadeiras pintadas nos + pavimentos, os dispositivos de iluminação + devem ser distribuídos de modo a garantir o + nível médio de iluminância de 10 lux, medido + num plano situado a 1 m do pavimento, e, se + necessário, ser devidamente protegidos + contra acções dinâmicas. + + + Segurança + + + Risco de incêndio - + + Parques de Estacionamento + + + + Nos parques automáticos os meios de primeira + intervenção devem ser constituídos por + extintores móveis de CO2 ou pó ABC, + localizados, em cada piso, junto ao acesso a + cada uma das escadas existentes. (Portaria + 1352/2008 – Título VIII Capítulo II Art. + 226º, 1) + + + + Nos parques automáticos os meios de primeira + intervenção devem ser constituídos por + extintores móveis de CO2 ou pó ABC, + localizados, em cada piso, junto ao acesso a + cada uma das escadas existentes. + + + Segurança + + + Risco de incêndio - + + Parques de Estacionamento + + + + Nos parques de estacionamento exteriores os + meios de primeira intervenção devem ser + constituídos, no mínimo, por um extintor + portátil e um móvel de CO2 ou pó ABC, + localizados no posto de controlo do parque. + (Portaria 1352/2008 – Título VIII Capítulo + II Art. 226º, 2) + + + + Nos parques de estacionamento exteriores os + meios de primeira intervenção devem ser + constituídos, no mínimo, por um extintor + portátil e um móvel de CO2 ou pó ABC, + localizados no posto de controlo do parque. + + + Segurança + + + Risco de incêndio - + + Parques de Estacionamento + + + + Em todos os pisos dos parques automáticos + deve existir protecção através de sistemas + fixos de extinção automática de incêndios + por água, nas condições expressas neste + regulamento. (Portaria 1352/2008 – Título + VIII Capítulo II Art. 226º, 4) + + + + Em todos os pisos dos parques automáticos + deve existir protecção através de sistemas + fixos de extinção automática de incêndios + por água, nas condições expressas neste + regulamento. + + + Segurança + + + Risco de incêndio - + + Parques de Estacionamento + + + + Nos parques automáticos, a equipa de + segurança deve ser constituída, no mínimo, + por dois elementos. (Portaria 1352/2008 – + Título VIII Capítulo IV Art. 226º, 6) + + + + Nos parques automáticos, a equipa de + segurança deve ser constituída, no mínimo, + por dois elementos. + + + Segurança + + + Risco de incêndio - + + Salas de Espetáculo + + + + Os locais de projecção são considerados + locais de risco agravado de incêndio. + (Portaria 1352/2008 – Título IV Capítulo IV + Art. 238º, 1 e 2) + + + + Os locais de projecção são considerados + locais de risco agravado de incêndio. + + + Segurança + + + Risco de incêndio - + + Salas de Espetáculo + + + + Nas salas de espectáculo deve ser garantido + que os meios de socorro tenham acesso, a + partir do exterior, a todos os pisos da + caixa de palco de espaços cénicos isoláveis, + sem utilizar os caminhos de evacuação + acessíveis ao público. (Portaria 1352/2008 – + Título IV Capítulo IV Art. 239º, 1) + + + + Nas salas de espectáculo deve ser garantido + que os meios de socorro tenham acesso, a + partir do exterior, a todos os pisos da + caixa de palco de espaços cénicos isoláveis, + sem utilizar os caminhos de evacuação + acessíveis ao público. + + + Segurança + + + Risco de incêndio - + + Salas de Espetáculo + + + + Ao nível do piso do palco, devem ainda + existir duas saídas, tão afastadas quanto + possível, com acesso a caminhos de evacuação + que não incluam qualquer percurso na sala. + (Portaria 1352/2008 – Título IV Capítulo IV + Art. 241º, 8) + + + + Ao nível do piso do palco, devem ainda + existir duas saídas, tão afastadas quanto + possível, com acesso a caminhos de evacuação + que não incluam qualquer percurso na sala. + + + Segurança + + + Risco de incêndio - + + Salas de Espetáculo + + + + Nos espaços afectos à utilização de Espaços + de Espectáculo, que possuam espaços cénicos + isoláveis, o posto de segurança deve: + + + a) Estar localizado de forma a ter + visibilidade sobre a totalidade do palco e + dispor de acesso franco ao exterior, directo + ou através de via de evacuação protegida; + + + b) Constituir um local de risco agravado + devido a ter equipamentos e controlos + fundamentais; + + + c) Integrar as centrais de alarme ou quadros + repetidores, bem como dispositivos de + comando manual das instalações de segurança + exigíveis para todos os espaços; + + + d) Dispor de meio de transmissão, rápido e + fiável, do alerta aos meios de socorro e de + intervenção; + + e) Ser de utilização exclusiva + + (Portaria 1352/2008 – Título IV Capítulo IV + Art. 254º) + + + + Nos espaços afectos à utilização de Espaços + de Espectáculo, que possuam espaços cénicos + isoláveis, o posto de segurança deve: + + + a) Estar localizado de forma a ter + visibilidade sobre a totalidade do palco e + dispor de acesso franco ao exterior, directo + ou através de via de evacuação protegida; + + + b) Constituir um local de risco agravado + devido a ter equipamentos e controlos + fundamentais; + + + c) Integrar as centrais de alarme ou quadros + repetidores, bem como dispositivos de + comando manual das instalações de segurança + exigíveis para todos os espaços; + + + d) Dispor de meio de transmissão, rápido e + fiável, do alerta aos meios de socorro e de + intervenção; + + e) Ser de utilização exclusiva + + Segurança + + + Risco de incêndio - + + Salas de Espetáculo + + + + Nos espaços das 3.ª e 4.ª categorias de + risco, durante os períodos de abertura ao + público, deve permanecer o delegado de + segurança, a quem compete a coordenação da + equipa de segurança. (Portaria 1352/2008 – + Título IV Capítulo IV Art. 255º) + + + + Nos espaços das 3.ª e 4.ª categorias de + risco, durante os períodos de abertura ao + público, deve permanecer o delegado de + segurança, a quem compete a coordenação da + equipa de segurança. + + + Segurança + + + Risco de incêndio - + + Standes de Exposição + + + + Os equipamentos técnicos e os standes de + exposição devem ser dispostos por forma a + que: + + + a) Não reduzam as alturas e as larguras + mínimas nem o número dos caminhos de + evacuação; + + + b) Não sejam facilmente derrubáveis nem + ameacem os elementos estruturais do recinto; + + + c) Não constituam obstáculo à visualização + dos dispositivos de sinalização e de + iluminação de emergência, nem ao acesso dos + comandos das instalações de segurança e dos + meios de combate a incêndios; + + + d) No caso de serem utilizados equipamentos + ou painéis suspensos sobre as zonas ocupadas + pelo público, estes sejam suportados por + dois sistemas de concepção diferente, com + vista a impedir a sua queda; + + + e) No caso de se verificar movimento dos + elementos referidos na alínea anterior, tal + não comprometa a segurança de evacuação da + sala nem o acesso aos meios de intervenção + existentes. + + + (Portaria 1352/2008 – Título IV Capítulo IV + Art. 249º) + + + + Os equipamentos técnicos e os standes de + exposição devem ser dispostos por forma a + que não reduzam as alturas e as larguras + mínimas nem o número dos caminhos de + evacuação; não sejam facilmente derrubáveis + nem ameacem os elementos estruturais do + recinto; não constituam obstáculo à + visualização dos dispositivos de sinalização + e de iluminação de emergência, nem ao acesso + dos comandos das instalações de segurança e + dos meios de combate a incêndios. + + + No caso de serem utilizados equipamentos ou + painéis suspensos sobre as zonas ocupadas + pelo público, estes devem ser suportados por + dois sistemas de concepção diferente, com + vista a impedir a sua queda. No caso de se + verificar movimento dos elementos referidos + na alínea anterior, tal não comprometa a + segurança de evacuação da sala nem o acesso + aos meios de intervenção existentes. + + + Segurança + + + Risco de incêndio - + + Espaços Comerciais + + + + Quando existir mais do que uma central de + sinalização e comando das instalações de + alarme, afectas a espaços explorados por + entidades independentes, designadamente + lojas âncora, devem ser repetidas no posto + de segurança da utilização-tipo todas as + informações dessas centrais, de modo a que + nele seja possível garantir a supervisão de + cada um dos referidos espaços. (Portaria + 1352/2008 – Título IV Capítulo VI Art. 270º, + 1) + + + + Quando existir mais do que uma central de + sinalização e comando das instalações de + alarme, afectas a espaços explorados por + entidades independentes, designadamente + lojas âncora, devem ser repetidas no posto + de segurança da utilização-tipo todas as + informações dessas centrais, de modo a que + nele seja possível garantir a supervisão de + cada um dos referidos espaços. + + + Segurança + + + Risco de incêndio - + + Indústria/Oficina/Armazém + + + + Nas oficinas ou zonas oficinais destinadas a + pintura ou aplicação de vernizes, não é + permitido o armazenamento de tintas ou + vernizes em quantidade superior à necessária + para um dia de laboração. (Portaria + 1352/2008 – Título IV Capítulo X Art. 303º, + 2) + + + + Nas oficinas ou zonas oficinais destinadas a + pintura ou aplicação de vernizes, não é + permitido o armazenamento de tintas ou + vernizes em quantidade superior à necessária + para um dia de laboração. + + + Segurança + + + Risco de incêndio - + + Indústria/Oficina/Armazém + + + + O armazenamento de tintas ou vernizes em + quantidade superior à referida no número + anterior deve ser efectuado num + compartimento corta-fogo. (Portaria + 1352/2008 – Título IV Capítulo X Art. 303º, + 3) + + + + O armazenamento de tintas ou vernizes em + quantidade superior à necessária para um dia + de laboração deve ser efectuado num + compartimento corta-fogo. + + + Segurança + + + Risco de incêndio - + + Indústria/Oficina/Armazém + + + + + A distância máxima a percorrer entre + qualquer ponto de um local afecto à + utilização-tipo Indústria/Oficina/Armazéns + (1ª categoria de risco) e a saída mais + próxima para o exterior não deve exceder 25 + m (em impasse) e 80 m (sem impasse). + (Portaria 1352/2008 – Título IV Capítulo X + Art. 304º, 1). (Portaria 1352/2008 – Título + IV Capítulo X Art. 304º, 1) + + + + + A distância máxima a percorrer entre + qualquer ponto de um local afecto à + utilização-tipo Indústria/Oficina/Armazéns + (1ª categoria de risco) e a saída mais + próxima para o exterior não deve exceder 25 + m (em impasse) e 80 m (sem impasse). + + + Segurança + + + Risco de incêndio - + + Indústria/Oficina/Armazém + + + + A distância máxima a percorrer entre + qualquer ponto de um local afecto à + utilização-tipo Indústria/Oficina/Armazéns + (2ª categoria de risco) e a saída mais + próxima para o exterior não deve exceder 25 + m (em impasse) e 60 m (sem impasse). + (Portaria 1352/2008 – Título IV Capítulo X + Art. 304º, 1). (Portaria 1352/2008 – Título + IV Capítulo X Art. 304º, 1) + + + + A distância máxima a percorrer entre + qualquer ponto de um local afecto à + utilização-tipo Indústria/Oficina/Armazéns + (2ª categoria de risco) e a saída mais + próxima para o exterior não deve exceder 25 + m (em impasse) e 60 m (sem impasse). + + + Segurança + + + Risco de incêndio - + + Indústria/Oficina/Armazém + + + + A distância máxima a percorrer entre + qualquer ponto de um local afecto à + utilização-tipo Indústria/Oficina/Armazéns + (3ª e 4ª categoria de risco) e a saída mais + próxima para o exterior não deve exceder 15 + m (em impasse) e 40 m (sem impasse). + (Portaria 1352/2008 – Título IV Capítulo X + Art. 304º, 1) + + + + A distância máxima a percorrer entre + qualquer ponto de um local afecto à + utilização-tipo Indústria/Oficina/Armazéns + (3ª e 4ª categoria de risco) e a saída mais + próxima para o exterior não deve exceder 15 + m (em impasse) e 40 m (sem impasse). + + + Segurança + + + Risco de incêndio - + + Indústria/Oficina/Armazém + + + + Todos os espaços destinados a armazenamento + de produtos explosivos ou outros + susceptíveis de formar misturas explosivas + com o ar, diluentes, vernizes, soluções + celulósicas e líquidos inflamáveis, + derivados ou não do petróleo, e as zonas + destinadas ao manuseamento ou trasfega + destes produtos, como as de pinturas ou + aplicação de vernizes referidas no artigo + 303.º, devem: + + + a) Ser dotados de sistemas de protecção + contra electricidade estática; + + + b) Garantir, no mínimo, a qualidade + antideflagrante de todo o equipamento + eléctrico e a qualidade anti-explosivo EX + para o equipamento e ferramentas de trabalho + e materiais de revestimento, nomeadamente do + pavimento; + + + c) Possuir ventilação adequada, a qual, nas + zonas de utilização dos produtos, deve ser + sempre por meios activos, dimensionada de + forma a evitar que os vapores libertos + possam criar uma atmosfera susceptível de + ocasionar um sinistro; + + + d) Quando for permitido o recurso a + ventilação natural, observar nas respectivas + aberturas de ventilação de entrada e saída + de ar os valores mínimos de: + + + i) 0,5 m2 por cada 150 m2 de área em espaços + de fabricação e reparação; + + + ii) 0,5 m2 por cada 100 m2 de área em + espaços de armazenamento + + + (Portaria 1352/2008 – Título IV Capítulo X + Art. 305º, 1) + + + + Todos os espaços destinados a armazenamento + de produtos explosivos (ou + + susceptíveis de formar misturas explosivas + com o ar) e as zonas destinadas ao + manuseamento ou trasfega destes produtos, + assim como as de pinturas ou aplicação de + vernizes, devem ser dotados de sistemas de + protecção contra electricidade estática. + Estes locais devem garantir a qualidade + antideflagrante de todo o equipamento + eléctrico e a qualidade anti-explosivo EX + para o equipamento e ferramentas de trabalho + e materiais de revestimento, nomeadamente do + pavimento e possuir ventilação adequada, a + qual, nas zonas de utilização dos produtos, + deve ser sempre por meios activos, + dimensionada de forma a evitar que os + vapores libertos possam criar uma atmosfera + susceptível de ocasionar um sinistro. + + Quando for permitido o recurso a ventilação + natural devem observar-se + + aberturas de ventilação de entrada e saída + de + + valores mínimos de ar. + + + Segurança + + + Risco de incêndio - + + Indústria/Oficina/Armazém + + + + Nos compartimentos (corta-fogo) onde sejam + armazenados combustíveis líquidos, a dotação + de extintores deve obedecer ao seguinte + critério: + + + a) Eficácia mínima de 113 B/C para um volume + de líquido inferior a 50 l; + + + b) Eficácia mínima de 144 B/C para um volume + de líquido entre 50 l e 100 l; + + + c) Eficácia mínima de 233 B/C para um volume + de líquido entre 100 l e 200 l; + + + d) Eficácia mínima de 233 B/C para um volume + de líquido entre 200 e 750 l, acrescido de + um extintor móvel com 50 kg de pó BC, ABC, + ou de outro agente extintor com eficácia + equivalente; + + + e) Um extintor móvel com 50 kg de pó BC, ABC + ou de outro agente extintor e por cada 1 000 + l de líquido adicionais. + + + (Portaria 1352/2008 – Título IV Capítulo X + Art. 307º, 1) + + + + Nos compartimentos (corta-fogo) onde sejam + armazenados combustíveis líquidos, a dotação + de extintores deve obedecer a critérios + espcíficos definidos de acordo com o volume + líquido armazenado. + + + Segurança + + + Risco de incêndio - + + Indústria/Oficina/Armazém + + + + As zonas destinadas a pintura ou aplicação + de vernizes, colas ou solventes orgânicos + (Pi < 55 ºC), em espaços com área + superior a 30 m2, devem ter protecção + adicional através de uma instalação fixa de + extinção automática de incêndios por água. + (Portaria 1352/2008 – Título IV Capítulo X + Art. 308º, 1) + + + + As zonas destinadas a pintura ou aplicação + de vernizes, colas ou solventes orgânicos + (Pi < 55 ºC), em espaços com área + superior a 30 m2, devem ter protecção + adicional através de uma instalação fixa de + extinção automática de incêndios por água. + + + Segurança + + + Risco de incêndio - + + Indústria/Oficina/Armazém + + + + Os locais de armazenamento de quantidades + superiores a 750 l ou manuseadas quantidades + superiores a 50 l de produtos combustíveis, + devem ter protecção adicional através de uma + instalação fixa de extinção automática de + incêndios por agente extintor apropriado + diferente da água, em protecção total ou + local. (Portaria 1352/2008 – Título IV + Capítulo X Art. 308º, 2) + + + + Os locais de armazenamento de quantidades + superiores a 750 l ou manuseadas quantidades + superiores a 50 l de produtos combustíveis, + devem ter protecção adicional através de uma + instalação fixa de extinção automática de + incêndios por agente extintor apropriado + diferente da água, em protecção total ou + local. + + + Segurança + + + Risco de incêndio - + + Indústria/Oficina/Armazém + + + + Nos espaços afectos à utilização-tipo XII + onde sejam armazenados produtos que, por + contacto com a água utilizada no combate a + incêndios ou por ela arrastados, possam + causar danos à saúde ou ao ambiente, deve + ser instalado um sistema de drenagem + adequado aos riscos em questão, respeitando + as condições do capítulo X do título VI. + + + + Nos espaços afectos à utilização-tipo + Oficina/Armazém onde sejam armazenados + produtos que, por contacto com a água + utilizada no combate a incêndios ou por ela + arrastados, possam causar danos à saúde ou + ao ambiente, deve ser instalado um sistema + de drenagem adequado aos riscos em questão, + respeitando as condições do capítulo X do + título VI. + + + Segurança + + Aparelhos a gás + + + Os aparelhos e equipamentos devem satisfazer + as normas técnicas, especificações + respeitantes aos sistemas de comprovação da + conformidade, à marca CE de conformidade, às + inscrições complementares e documentação + relativa à concepção ( + + Decreto Lei n.º130/92 – Art. 2º) + + + ; + + + + + Os aparelhos e equipamentos devem satisfazer + as normas técnicas, especificações + respeitantes aos sistemas de comprovação da + conformidade, à marca CE de conformidade, às + inscrições complementares e documentação + relativa à concepção + + + Segurança + + Aparelhos a gás + + + Um aparelho deve estar correctamente + instalado, ser sujeito a manutenção regular + (em conformidade com as instruções do + fabricante), utilizado com a variação normal + da qualidade do gás e da pressão da + alimentação e em conformidade com o fim a + que se destina ( + + Decreto Lei n.º130/92 – Art. 3º) + + + + + Um aparelho deve estar correctamente + instalado, ser sujeito a manutenção regular + (em conformidade com as instruções do + fabricante), utilizado com a variação normal + da qualidade do gás e da pressão da + alimentação e em conformidade com o fim a + que se destina + + + Segurança + + + Inexistência de sinalização de segurança e + saúde + + + + Os sinais devem ser instalados em local bem + iluminado, a altura e em posição + apropriadas, tendo em conta os impedimentos + à sua visibilidade desde a distância julgada + conveniente ( + + Portaria n.º1456-A/95 – Art. 6º-1 + + + ) + + + + + Os sinais devem ser instalados em local bem + iluminado, a altura e em posição + apropriadas, tendo em conta os impedimentos + à sua visibilidade desde a distância julgada + conveniente + + + Segurança + + + Inexistência de sinalização de segurança e + saúde + + + + Sinalizar os botões de alarme com sinal + fotoluminescente ( + + Portaria n.º1456-A/95 + + + ) + + + + + Sinalizar os botões de alarme com sinal + fotoluminescente + + + Segurança + + + Inexistência de sinalização de segurança e + saúde + + + + Sinalizar os extintores com pictograma de + forma rectangular/quadrada, fotoluminescente + e com pictograma branco sobre fundo + vermelho, a cerca de 2,2 m de altura do + solo, de modo a que seja visível em toda a + área envolvente ( + + Portaria nº 1456-A/95 + + + ) + + + + + Sinalizar os extintores com pictograma de + forma rectangular/quadrada, fotoluminescente + e com pictograma branco sobre fundo + vermelho, a cerca de 2,2 m de altura do + solo, de modo a que seja visível em toda a + área envolvente + + + Segurança + + + Inexistência de sinalização de segurança e + saúde + + + + Os extintores de combate a incêndios devem + ser de cor vermelha, devendo o restante + equipamento ser identificado pela cor + vermelha dos locais onde se encontra ou dos + acessos a estes mesmos locais ( + + Portaria n.º1456-A/95 – Art. 8º - 1) + + + + + Os extintores de combate a incêndios devem + ser de cor vermelha, devendo o restante + equipamento ser identificado pela cor + vermelha dos locais onde se encontra ou dos + acessos a estes mesmos locais + + + Segurança + + + Inexistência de sinalização de segurança e + saúde + + + + Colocar sinalização de salvamento ou de + emergência (Indicação da saída) + fotoluminescente, a uma altura de 2,0/2,5 + metros sobre as portas e 1,7/2,0 metros nas + vias de evacuação ( + + Portaria n.º987/93 – Art.4º-5 + + + ) + + + + + Colocar sinalização de salvamento ou de + emergência (Indicação da saída) + fotoluminescente, a uma altura de 2,0/2,5 + metros sobre as portas e 1,7/2,0 metros nas + vias de evacuação + + + Segurança + + + Inexistência de sinalização de segurança e + saúde + + + + Sinalizar o material de primeiros socorros ( + + Portaria nº 1456-A/95 + + + ) + + + + + Sinalizar o material de primeiros socorros + + + Segurança + + + Inexistência de sinalização de segurança e + saúde + + + + Sinalizar o quadro eléctrico com placa + fotoluminescente ( + + Portaria n.º1456-A/95) + + + + + Sinalizar o quadro eléctrico com placa + fotoluminescente + + + Segurança + + + Inexistência de sinalização de segurança e + saúde + + + + Os equipamentos de trabalho devem estar + sinalizados com avisos ou outra sinalização + indispensável para garantir a segurança dos + trabalhadores ( + + Decreto Lei nº 50/2005 – Art. + + + 22º + + + ) + + + + + Os equipamentos de trabalho devem estar + sinalizados com avisos ou outra sinalização + indispensável para garantir a segurança dos + trabalhadores + + + Segurança + + + Inexistência de sinalização de segurança e + saúde + + + + A sinalização dos riscos de choque contra + obstáculos, bem como de queda de objectos ou + de pessoas no interior das zonas da empresa + ou do estabelecimento a que o trabalhador + tenha acesso no âmbito do seu trabalho, é + feita com cores amarela e negra alternadas + (ou com cores vermelha e branca alternadas) + ( + + Portaria nº 1456-A/95 – Art.9º - 1) + + + + + A sinalização dos riscos de choque contra + obstáculos, bem como de queda de objectos ou + de pessoas no interior das zonas da empresa + ou do estabelecimento a que o trabalhador + tenha acesso no âmbito do seu trabalho, é + feita com cores amarela e negra alternadas + (ou com cores vermelha e branca alternadas) + + + Segurança + + + Inexistência de sinalização de segurança e + saúde + + + + A sinalização de obstáculos e locais + perigosos deve ter em conta as dimensões do + obstáculo ou do local perigoso e assinalar e + ser constituída por bandas de duas cores + alternadas com superfícies sensivelmente + iguais, sob a forma de faixas com uma + inclinação de cerca de 45º ( + + Portaria nº 1456-A/95 – Art.9º - 2) + + + + + A sinalização de obstáculos e locais + perigosos deve ter em conta as dimensões do + obstáculo ou do local perigoso e assinalar e + ser constituída por bandas de duas cores + alternadas com superfícies sensivelmente + iguais, sob a forma de faixas com uma + inclinação de cerca de 45º + + + Segurança + + + Inexistência de sinalização de segurança e + saúde + + + + A obrigação da utilização de um equipamento + de protecção individual deve colocar-se + sobre a porta de acesso a um local de + trabalho ou na proximidade de uma máquina ( + + Portaria nº 1456-A/95) + + + + + A obrigação da utilização de um equipamento + de protecção individual deve colocar-se + sobre a porta de acesso a um local de + trabalho ou na proximidade de uma máquina + + + Segurança + + + Inexistência de sinalização de segurança e + saúde + + + + Limpar e verificar regularmente os meios de + sinalização de segurança ( + + Portaria nº 1456- + + + A/95 – Art. 4º + + + ) + + + + + Limpar e verificar regularmente os meios de + sinalização de segurança + + + Segurança + + + Inexistência de sinalização de segurança e + saúde + + + + Informar, consultar e formar os + trabalhadores sobre a sinalização de + segurança e saúde ( + + Decreto Lei nº 141/95 – Art. 9º + + + ) + + + + + Informar, consultar e formar os + trabalhadores sobre a sinalização de + segurança e saúde + + + Segurança + + + Sinalização do Risco de Incêndio + + + + Na linha de visão das pessoas, não devem ser + dispostas placas, publicitárias ou não, nem + outros objectos, que, pela intensidade da + sua iluminação ou pela sua forma, cores ou + dimensões, possam ocultar os dispositivos de + sinalização ou iludir os ocupantes, + confundindo-os. (Portaria 1352/2008 – Título + VI Capítulo I Art. 108º, 3) + + + + Na linha de visão das pessoas, não devem ser + dispostas placas, publicitárias ou não, nem + outros objectos, que, pela intensidade da + sua iluminação ou pela sua forma, cores ou + dimensões, possam ocultar os dispositivos de + sinalização ou iludir os ocupantes, + confundindo-os. + + + Segurança + + + Sinalização do Risco de Incêndio + + + + As placas devem ter áreas (A) não inferiores + às determinadas em função da distância (d) a + que devem ser vistas, com um mínimo de 6 m e + um máximo de 50 m, conforme a expressão A ≥ + d² / 2000. (Portaria 1352/2008 – Título VI + Capítulo I Art. 109º) + + + + As placas devem ter áreasnão inferiores às + determinadas em função da distância a que + devem ser vistas, com um mínimo de 6 m e um + máximo de 50 m. + + + Segurança + + + Sinalização do Risco de Incêndio + + + + As placas de sinalização indicam + respectivamente proibição, perigo, + emergência e meios de intervenção, consoante + o seu formato e cor, devendo ser de material + rígido fotoluminescente. (Portaria 1352/2008 + – Título VI Capítulo I Art. 110º) + + + + As placas de sinalização devem ser de + material rígido fotoluminescente. + + + Segurança + + + Sinalização do Risco de Incêndio + + + + A distribuição das placas de sinalização + deve permitir a visibilidade a partir de + qualquer ponto onde a informação que contém + deva ser conhecida, podendo, com esse + objectivo: Ser paralela às paredes com + informação numa só face; ser perpendicular + às mesmas paredes, ou suspensa do tecto, com + informação em dupla face e fazer um ângulo + de 45º com a parede, com informação nas duas + faces exteriores. (Portaria 1352/2008 – + Título VI Capítulo I Art. 111º, 1 a), b) e + c)) + + + + A distribuição das placas de sinalização + deve permitir a visibilidade a partir de + qualquer ponto onde a informação que contém + deva ser conhecida, podendo, com esse + objectivo: ser paralela às paredes com + informação numa só face; ser perpendicular + às mesmas paredes, ou suspensa do tecto, com + informação em dupla face. + + + Segurança + + + Sinalização do Risco de Incêndio + + + + As placas que fiquem salientes relativamente + aos elementos de construção que as suportam, + devem ser fixadas a uma altura igual ou + superior a 2,1 m e não superior a 3 m. + (Portaria 1352/2008 – Título VI Capítulo I + Art. 111º, 2) + + + + As placas que fiquem salientes relativamente + aos elementos de construção que as suportam, + devem ser fixadas a uma altura igual ou + superior a 2,1 m e não superior a 3 m. + + + Segurança + + + Sinalização do Risco de Incêndio + + + + A sinalização dentro dos locais de + permanência deve ser claramente distinguível + de qualquer ponto desse local. (Portaria + 1352/2008 – Título VI Capítulo I Art. 112º, + 1) + + + + A sinalização dentro dos locais de + permanência deve ser claramente distinguível + de qualquer ponto desse local. + + + Segurança + + + Sinalização do Risco de Incêndio + + + + Toda a sinalização referente às indicações + de evacuação e localização de meios de + intervenção, alarme e alerta, quando + colocada nas vias de evacuação, deve estar + na perpendicular ao sentido das fugas + possíveis nessas vias. (Portaria 1352/2008 – + Título VI Capítulo I Art. 112º, 2) + + + + Toda a sinalização referente às indicações + de evacuação e localização de meios de + intervenção, alarme e alerta, quando + colocada nas vias de evacuação, deve estar + na perpendicular ao sentido das fugas + possíveis nessas vias. + + + Segurança + + + Sinalização do Risco de Incêndio + + + + Nos locais de mudança de direcção das vias + referidas deve ser colocada sinalização + adequada ao sentido da fuga a tomar, de + forma inequívoca. (Portaria 1352/2008 – + Título VI Capítulo I Art. 112º, 3) + + + + Nos locais de mudança de direcção das vias + referidas deve ser colocada sinalização + adequada ao sentido da fuga a tomar, de + forma inequívoca. + + + Segurança + + + Sinalização do Risco de Incêndio + + + + A distância de colocação das placas nas vias + de evacuação e nos locais de permanência + deve variar entre 6 e 30 m. (Portaria + 1352/2008 – Título VI Capítulo I Art. 112º, + 4) + + + + A distância de colocação das placas nas vias + de evacuação e nos locais de permanência + deve variar entre 6 e 30 m. + + + Segurança + + + Sinalização do Risco de Incêndio + + + + Sem prejuízo do referido no número anterior, + nos locais de permanência e nas vias + horizontais de evacuação acessíveis a + público deve ser visível uma placa + indicadora de saída ou de sentido de + evacuação, pelo menos, a partir de qualquer + ponto susceptível de ocupação. (Portaria + 1352/2008 – Título VI Capítulo I Art. 112º, + 5) + + + + Sem prejuízo do referido no número anterior, + nos locais de permanência e nas vias + horizontais de evacuação acessíveis a + público deve ser visível uma placa + indicadora de saída ou de sentido de + evacuação, pelo menos, a partir de qualquer + ponto susceptível de ocupação. + + + Segurança + + + Sinalização do Risco de Incêndio + + + + Nas vias verticais de evacuação devem ser + montadas placas, pelo menos, no patamar de + acesso, indicando o número do andar ou a + saída, se for o caso, e no patamar + intermédio, indicando o sentido da + evacuação. (Portaria 1352/2008 – Título VI + Capítulo I Art. 112º, 6) + + + + Nas vias verticais de evacuação devem ser + montadas placas, pelo menos, no patamar de + acesso, indicando o número do andar ou a + saída, se for o caso, e no patamar + intermédio, indicando o sentido da + evacuação. + + + Segurança + + + Sinalização do Risco de Incêndio + + + + As placas de sinalização devem ser colocadas + o mais próximo possível das fontes luminosas + existentes, a uma distância inferior a 2 + metros em projecção horizontal, mas não + coladas sobre os aparelhos. (Portaria + 1352/2008 – Título VI Capítulo I Art. 112º, + 7) + + + + As placas de sinalização devem ser colocadas + o mais próximo possível das fontes luminosas + existentes, a uma distância inferior a 2 + metros em projecção horizontal, mas não + coladas sobre os aparelhos. + + + Segurança + + + Sinalização do Risco de Incêndio + + + + Exceptuam-se, relativamente ao determinado + no número anterior, a sinalização colocada + directamente sobre os difusores de uma ou de + duas faces: + + + a) + + Em vias de evacuação; + + + b) Em locais da 1.ª categoria de risco, + desde que a colagem dos pictogramas sobre os + equipamentos não prejudique os níveis de + iluminação mínimos, nem as dimensões mínimas + legais das placas face às distâncias de + visibilidade. + + + (Portaria 1352/2008 – Título VI Capítulo I + Art. 112º, 8 a) e b)) + + + + Poderão existir placas de sinalização de + saída colocadas directamente sobre os blocos + difusores de uma ou de duas faces se estas + forem blocos com iluminação própria e + existirem em vias de evacuação e /ou em + locais da 1.ª categoria de risco, desde que + a colagem dos pictogramas sobre os + equipamentos não prejudique os níveis de + iluminação mínimos, nem as dimensões + mínimas. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + Assegurar que todos os colaboradores se + encontram suficientemente instruídos sobre + os planos de evacuação dos locais de + trabalho ( + + Decreto Lei n.º 243/86 – Art.37º-1 + + + ) + + + + + Assegurar que todos os colaboradores se + encontram suficientemente instruídos sobre + os planos de evacuação dos locais de + trabalho + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + As vias normais e de emergência têm de estar + permanentemente desobstruídas e em condições + de utilização, devendo o respectivo traçado + conduzir, o mais directamente possível, a + áreas ao ar livre ou a zonas de segurança ( + + Portaria nº 987/93 – 4º-1 + + + ) + + + + + As vias normais e de emergência têm de estar + permanentemente desobstruídas e em condições + de utilização, devendo o respectivo traçado + conduzir, o mais directamente possível, a + áreas ao ar livre ou a zonas de segurança + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + A instalação de cada posto de trabalho deve + permitir a evacuação rápida e em máxima + segurança dos trabalhadores ( + + Portaria nº 987/93 – 4º-3 + + + ) + + + + + A instalação de cada posto de trabalho deve + permitir a evacuação rápida e em máxima + segurança dos trabalhadores + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + Os espaços interiores dos edifícios devem + ser organizados para permitir que, em caso + de incêndio, os ocupantes possam alcançar um + local seguro no exterior pelos seus próprios + meios, de modo fácil, rápido e seguro. + (Portaria 1352/2008 – Título IV Capítulo I + Art. 50º - 1) + + + + Os espaços interiores dos edifícios devem + ser organizados para permitir que, em caso + de incêndio, os ocupantes possam alcançar um + local seguro no exterior pelos seus próprios + meios, de modo fácil, rápido e seguro. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + Os locais de permanência, os edifícios e os + recintos devem dispor de saídas, em número e + largura suficientes, convenientemente + distribuídas e devidamente sinalizadas. + (Portaria 1352/2008 – Título IV Capítulo I + Art. 50º - 2 a)) + + + + Os locais de permanência, os edifícios e os + recintos devem dispor de saídas, em número e + largura suficientes, convenientemente + distribuídas e devidamente sinalizadas. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + As distâncias a percorrer devem ser + limitadas. (Portaria 1352/2008 – Título IV + Capítulo I Art. 50º - 2, c)) + + + + As distâncias a percorrer devem ser + limitadas. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + A evacuação pode processar-se para espaços + de edifícios temporariamente seguros, + designados por «zonas de refúgio». (Portaria + 1352/2008 – Título IV Capítulo I Art. 50º - + 3) + + + + A evacuação pode processar-se para espaços + de edifícios temporariamente seguros, + designados por «zonas de refúgio». + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + Não são consideradas para o número de saídas + utilizáveis em caso de incêndio, as que + forem dotadas de portas giratórias ou de + deslizamento lateral não motorizadas + (Portaria 1352/2008 – Título IV Capítulo II + Art. 54º - 3, a)) + + + + Não são consideradas para o número de saídas + utilizáveis em caso de incêndio, as que + forem dotadas de portas giratórias ou de + deslizamento lateral não motorizadas + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + Não são consideradas para o número de saídas + utilizáveis em caso de incêndio, as que + forem portas motorizadas e obstáculos de + controlo de acesso excepto se, em caso de + falta de energia ou de falha no sistema de + comando, abrirem automaticamente por + deslizamento lateral, recolha ou rotação, + libertando o vão respectivo em toda a sua + largura, ou poderem ser abertas por pressão + manual no sentido da evacuação por rotação. + (Portaria 1352/2008 – Título IV Capítulo II + Art. 54º - 3, b)) + + + + Não são consideradas para o número de saídas + utilizáveis em caso de incêndio, as que + forem portas motorizadas e obstáculos de + controlo de acesso excepto se, em caso de + falta de energia ou de falha no sistema de + comando, abrirem automaticamente por + deslizamento lateral, recolha ou rotação, + libertando o vão respectivo em toda a sua + largura, ou poderem ser abertas por pressão + manual no sentido da evacuação por rotação. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + As saídas que servem os diferentes espaços + de um edifício devem ser distintas e estar + localizadas de modo a permitir a sua rápida + evacuação, distribuindo entre elas os seus + ocupantes, minimizando a possibilidade de + percursos em impasse. (Portaria 1352/2008 – + Título IV Capítulo II Art. 55º - 1) + + + + As saídas que servem os diferentes espaços + de um edifício devem ser distintas e estar + localizadas de modo a permitir a sua rápida + evacuação, distribuindo entre elas os seus + ocupantes, minimizando a possibilidade de + percursos em impasse. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + Os caminhos horizontais de evacuação devem + proporcionar o acesso rápido e seguro às + saídas de piso através de encaminhamentos + claramente traçados, preferencialmente + rectilíneos, com um número mínimo de + mudanças de direcção e tão curtos quanto + possível. (Portaria 1352/2008 – Título IV + Capítulo II Art. 57º - 1) + + + + Os caminhos horizontais de evacuação devem + proporcionar o acesso rápido e seguro às + saídas de piso através de encaminhamentos + claramente traçados, preferencialmente + rectilíneos, com um número mínimo de + mudanças de direcção e tão curtos quanto + possível. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + Nos locais de risco A (sem especial risco de + incêndio; até 100 trabalhadores e < 50 + pessoas/público), o mobiliário, os + equipamentos e os elementos decorativos + devem ser dispostos de forma que os + percursos até às saídas sejam clara e + perfeitamente delineados. (Portaria + 1352/2008 – Título IV Capítulo I Art. 58º - + 1) + + + + Nos locais de risco A (sem especial risco de + incêndio; até 100 trabalhadores e < 50 + pessoas/público), o mobiliário, os + equipamentos e os elementos decorativos + devem ser dispostos de forma que os + percursos até às saídas sejam clara e + perfeitamente delineados. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + Nos locais de risco B (sem risco agravado de + incêndio com efectivo superior a 100 + trabalhadores e público < 50) , o + mobiliário, os equipamentos e os elementos + decorativos devem ser dispostos de forma que + os percursos até às saídas sejam clara e + perfeitamente delineados. (Portaria + 1352/2008 – Título IV Capítulo II Art. 59º - + 1) + + + + Nos locais de risco B (sem risco agravado de + incêndio com efectivo superior a 100 + trabalhadores e público < 50) , o + mobiliário, os equipamentos e os elementos + decorativos devem ser dispostos de forma que + os percursos até às saídas sejam clara e + perfeitamente delineados. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + Nos locais de risco B (sem risco agravado de + incêndio com efectivo superior a 100 + trabalhadores e público < 50), o + mobiliário e os equipamentos dispostos nas + proximidades dos percursos de acesso às + saídas devem ser solidamente fixados ao + pavimento ou às paredes sempre que não + possuam peso ou estabilidade suficientes + para prevenir o seu arrastamento ou derrube, + pelos ocupantes, em caso de fuga + precipitada. (Portaria 1352/2008 – Título IV + Capítulo II Art. 59º - 2) + + + + Nos locais de risco B (sem risco agravado de + incêndio com efectivo superior a 100 + trabalhadores e público < 50), o + mobiliário e os equipamentos dispostos nas + proximidades dos percursos de acesso às + saídas devem ser solidamente fixados ao + pavimento ou às paredes sempre que não + possuam peso ou estabilidade suficientes + para prevenir o seu arrastamento ou derrube, + pelos ocupantes, em caso de fuga + precipitada. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + + As vias horizontais de evacuação devem + conduzir, directamente ou através de câmaras + corta-fogo, a vias verticais de evacuação ou + ao exterior do edifício. (Portaria 1352/2008 + – Título IV Capítulo III Art. 61º - 1) + + + + + As vias horizontais de evacuação devem + conduzir, directamente ou através de câmaras + corta-fogo, a vias verticais de evacuação ou + ao exterior do edifício. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + Nas vias de evacuação com mais de 0,90 m (1 + UP) é permitida a existência de elementos de + decoração, placas publicitárias ou de + equipamentos compreendidos nos espaços de + circulação, desde que sejam solidamente + fixados às paredes ou aos pavimentos. + (Portaria 1352/2008 – Título IV Capítulo III + Art. 61º - 9 a)) + + + + Nas vias de evacuação com mais de 0,90 m (1 + UP) é permitida a existência de elementos de + decoração, placas publicitárias ou de + equipamentos compreendidos nos espaços de + circulação, desde que sejam solidamente + fixados às paredes ou aos pavimentos. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + Nas vias de evacuação com mais de 0,90 m (1 + UP) é permitida a existência de elementos de + decoração, placas publicitárias ou de + equipamentos compreendidos nos espaços de + circulação, desde que não reduzam as + larguras mínimas impostas em mais de 0,1 m. + (Portaria 1352/2008 – Título IV Capítulo III + Art. 61º - 9 b)) + + + + Nas vias de evacuação com mais de 0,90 m (1 + UP) é permitida a existência de elementos de + decoração, placas publicitárias ou de + equipamentos compreendidos nos espaços de + circulação, desde que não reduzam as + larguras mínimas impostas em mais de 0,1 m. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + Nas vias de evacuação com mais de 0,90 m (1 + UP) é permitida a existência de elementos de + decoração, placas publicitárias ou de + equipamentos compreendidos nos espaços de + circulação, desde que não possuam saliências + susceptíveis de prender o vestuário ou os + objectos normalmente transportados pelos + ocupantes. (Portaria 1352/2008 – Título IV + Capítulo III Art. 61º - 9 c)) + + + + Nas vias de evacuação com mais de 0,90 m (1 + UP) é permitida a existência de elementos de + decoração, placas publicitárias ou de + equipamentos compreendidos nos espaços de + circulação, desde que não possuam saliências + susceptíveis de prender o vestuário ou os + objectos normalmente transportados pelos + ocupantes. (Portaria 1352/2008 – Título IV + Capítulo III Art. 61º - 9 c)) + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + Os desníveis existentes nas vias horizontais + de evacuação devem distar mais de 1 m de + qualquer saída e ser vencidos por rampa. + (Portaria 1352/2008 – Título IV Capítulo III + Art. 61º - 12) + + + + Os desníveis existentes nas vias horizontais + de evacuação devem distar mais de 1 m de + qualquer saída e ser vencidos por rampa. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + As portas utilizáveis por mais de 50 pessoas + devem abrir facilmente no sentido da + evacuação; dispensar o recurso a meios de + desbloqueamento e dispor de sinalização + indicativa do modo de operar. (Portaria + 1352/2008 – Título IV Capítulo III Art. 62º + - 1) + + + + As portas utilizáveis por mais de 50 pessoas + devem abrir facilmente no sentido da + evacuação; dispensar o recurso a meios de + desbloqueamento e dispor de sinalização + indicativa do modo de operar. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + Quando as portas referidas no número + anterior forem de acesso directo ao + exterior, deve permanecer livre um percurso + exterior que possibilite o afastamento do + edifício com uma largura mínima igual à da + saída e não possuir, até uma distância de 3 + m, quaisquer obstáculos susceptíveis de + causar a queda das pessoas em evacuação. + (Portaria 1352/2008 – Título IV Capítulo III + Art. 62º - 2) + + + + Quando as portas referidas no número + anterior forem de acesso directo ao + exterior, deve permanecer livre um percurso + exterior que possibilite o afastamento do + edifício com uma largura mínima igual à da + saída e não possuir, até uma distância de 3 + m, quaisquer obstáculos susceptíveis de + causar a queda das pessoas em evacuação. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + As portas incluídas nas vias utilizáveis + para evacuação de pessoas em cama devem + comportar superfícies transparentes, à + altura da visão. (Portaria 1352/2008 – + Título IV Capítulo III Art. 62º - 5) + + + + As portas incluídas nas vias utilizáveis + para evacuação de pessoas em cama devem + comportar superfícies transparentes, à + altura da visão. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + As portas do tipo vaivém de duas folhas, + quando a evacuação for possível nos dois + sentidos, devem: + + + a) Comportar as superfícies transparentes; + + + b) Possuir batentes protegidos contra o + esmagamento de mãos; + + + c) Dispor de sinalização, em ambos os lados, + que oriente para a abertura da folha que se + apresenta à direita. + + + (Portaria 1352/2008 – Título IV Capítulo III + Art. 62º - 6, a), b) e c)) + + + + As portas do tipo vaivém de duas folhas, + quando a evacuação for possível nos dois + sentidos, devem: + + + + - + + Comportar as superfícies transparentes; + + + + - + + Possuir batentes protegidos contra o + esmagamento de mãos; + + + + - + + Dispor de sinalização, em ambos os lados, + que oriente para a abertura da folha que se + apresenta à direita. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + As portas da saída de locais, + utilizações-tipo ou edifícios, utilizáveis + por mais de 200 pessoas devem ser equipadas + com sistemas de abertura dotados de barras + antipânico, devidamente sinalizadas. + (Portaria 1352/2008 – Título IV Capítulo III + Art. 62º - 7, a) e b)) + + + + As portas da saída de locais, + utilizações-tipo ou edifícios, utilizáveis + por mais de 200 pessoas devem ser equipadas + com sistemas de abertura dotados de barras + antipânico, devidamente sinalizadas. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + O acesso a vias verticais de evacuação, + utilizáveis por mais de 50 pessoas devem + possuir portas equipadas com sistemas de + abertura dotados de barras antipânico, + devidamente sinalizadas. (Portaria 1352/2008 + – Título IV Capítulo III Art. 62º - 7, a) e + b)) + + + + O acesso a vias verticais de evacuação, + utilizáveis por mais de 50 pessoas devem + possuir portas equipadas com sistemas de + abertura dotados de barras antipânico, + devidamente sinalizadas. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + As portas de locais de risco C (locais com + risco agravado de incêndio devida às + actividades /ou características dos + equipamentos/materiais), devem abrir no + sentido da saída. (Portaria 1352/2008 – + Título IV Capítulo III Art. 62º - 11) + + + + As portas de locais de risco C (locais com + risco agravado de incêndio devida às + actividades /ou características dos + equipamentos/materiais), devem abrir no + sentido da saída. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + As portas de saída para o exterior dos + edifícios devem ser dotadas de fechadura que + possibilite a sua abertura pelo exterior, + encontrando-se as respectivas chaves + disponíveis no posto de segurança ou na + portaria, visando a sua utilização pelas + equipas de segurança e bombeiros. (Portaria + 1352/2008 – Título IV Capítulo III Art. 62º + - 12) + + + + As portas de saída para o exterior dos + edifícios devem ser dotadas de fechadura que + possibilite a sua abertura pelo exterior, + encontrando-se as respectivas chaves + disponíveis no posto de segurança ou na + portaria, visando a sua utilização pelas + equipas de segurança e bombeiros. + + + Segurança + + + Organização dos meios de evacuação e + emergência + + + + + As escadas mecânicas e os tapetes rolantes + incluídos nas vias de evacuação devem: + operar, em exploração normal, no sentido da + saída e possuir, em cada um dos seus topos, + devidamente sinalizados e de accionamento + fácil e evidente, dispositivos que promovam + a sua paragem. (Portaria 1352/2008 – Título + IV Capítulo III Art. 66º - 3, a) e b)) + + + + + As escadas mecânicas e os tapetes rolantes + incluídos nas vias de evacuação devem: + operar, em exploração normal, no sentido da + saída e possuir, em cada um dos seus topos, + devidamente sinalizados e de accionamento + fácil e evidente, dispositivos que promovam + a sua paragem. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Condições Gerais de Auto + Protecção + + + + Os edifícios, os estabelecimentos e os + recintos devem, no decurso da exploração dos + respectivos espaços, ser dotados de medidas + de organização e gestão da segurança, + designadas por medidas de autoprotecção. + (Portaria 1352/2008 – Título VII Art. 193º, + 1) + + + + Os edifícios, os estabelecimentos e os + recintos devem, no decurso da exploração dos + respectivos espaços, ser dotados de medidas + de organização e gestão da segurança, + designadas por medidas de autoprotecção. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Condições Gerais de Auto + Protecção + + + + As medidas de autoprotecção devem ser + adaptadas às condições reais de exploração + de cada utilização-tipo e proporcionadas à + sua categoria de risco. (Portaria 1352/2008 + – Título VII Art. 193º, 2) + + + + As medidas de autoprotecção devem ser + adaptadas às condições reais de exploração + de cada utilização-tipo e proporcionadas à + sua categoria de risco. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Condições Gerais de Auto + Protecção + + + + A entidade responsável nos termos dos n.os 3 + e 4 do artigo 6.º (proprietário ou quem + detiver a exploração de edifício/recinto) + designa um delegado de segurança para + executar as medidas de autoprotecção. ( + + Decreto-Lei 220/2008 - CAPÃTULO III Art. + 20º - 1) + + + + + A entidade responsável nos termos dos n.os 3 + e 4 do artigo 6.º (proprietário ou quem + detiver a exploração de edifício/recinto) + designa um delegado de segurança para + executar as medidas de autoprotecção. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Condições Gerais de Auto + Protecção + + + + O delegado de segurança age em representação + da entidade responsável, ficando esta + integralmente obrigada ao cumprimento das + condições de SCIE, previstas no presente + decreto-lei e demais legislação aplicável. + (Decreto-Lei 220/2008 - CAPÃTULO III Art. + 20º - 2) + + + + O delegado de segurança age em representação + da entidade responsável, ficando esta + integralmente obrigada ao cumprimento das + condições de SCIE, previstas no presente + decreto-lei e demais legislação aplicável. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Condições Gerais de Auto + Protecção + + + + O responsável pela segurança contra incêndio + (RS) perante a entidade competente é a + pessoa individual ou colectiva: Proprietário + ou entidade exploradora de cada espaço ou + Entidade gestora de vários espaços. + (Portaria 1352/2008 – Título VII Art. 194º, + 1) + + + + O responsável pela segurança contra incêndio + (RS) perante a entidade competente é a + pessoa individual ou colectiva: Proprietário + ou entidade exploradora de cada espaço ou + Entidade gestora de vários espaços. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Condições Gerais de Auto + Protecção + + + + O RS designa um delegado de segurança para + executar as medidas de autoprotecção. + (Portaria 1352/2008 – Título VII Art. 194º, + 2) + + + + O RS designa um delegado de segurança para + executar as medidas de autoprotecção. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Condições Gerais de Auto + Protecção + + + + Os locais de cada utilização-tipo devem ter + uso e lotação compatíveis com as finalidades + para que foram concebidos. (Portaria + 1352/2008 – Título VII Art. 195º, 1) + + + + Os locais de cada utilização-tipo devem ter + uso e lotação compatíveis com as finalidades + para que foram concebidos. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Condições Gerais de Auto + Protecção + + + + Os responsáveis dos edifícios ou recintos + que sofram alterações de uso ou de lotação + que impliquem alteração da equipa de + segurança e da configuração do plano de + segurança interno, devem actualizar os + documentos. (Portaria 1352/2008 – Título VII + Art. 195º,2) + + + + Os responsáveis dos edifícios ou recintos + que sofram alterações de uso ou de lotação + que impliquem alteração da equipa de + segurança e da configuração do plano de + segurança interno, devem actualizar os + documentos. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Condições Gerais de Auto + Protecção + + + + No caso de cedência temporária a terceiros, + apenas deve ser permitido aos utilizadores + eventuais o acesso aos locais estritamente + necessários, devendo os restantes ser + vedados mediante sinalização adequada, sem + prejuízo da manutenção dos caminhos de + evacuação. (Portaria 1352/2008 – Título VII + Art. 195º,3) + + + + No caso de cedência temporária a terceiros, + apenas deve ser permitido aos utilizadores + eventuais o acesso aos locais estritamente + necessários, devendo os restantes ser + vedados mediante sinalização adequada, sem + prejuízo da manutenção dos caminhos de + evacuação. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Condições Gerais de Auto + Protecção + + + + Nas mudanças de uso, os materiais a aplicar + devem respeitar as limitações de reacção ao + fogo impostas no presente regulamento, com + as excepções previstas no número seguinte, + no que se refere a operações de modificação + de acabamentos, mobiliário fixo ou + decoração. (Portaria 1352/2008 – Título VII + Art. 195º,4) + + + + Nas mudanças de uso, os materiais a aplicar + devem respeitar as limitações de reacção ao + fogo impostas no presente regulamento, com + as excepções previstas no número seguinte, + no que se refere a operações de modificação + de acabamentos, mobiliário fixo ou + decoração. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Condições Gerais de Auto + Protecção + + + + As medidas de autoprotecção a adoptar nas + situações previstas no n.º 2 do artigo 49.º + são: + + + a) O afastamento adequado de fontes de calor + dos materiais com classe de reacção ao fogo + não especificada; + + + b) A disponibilidade de meios de primeira + intervenção suplementares apropriados; + + + c) A interdição, nos espaços envolvidos, do + uso de chama nua, de elementos + incandescentes não protegidos ou de + aparelhos ou equipamentos susceptíveis de + produzir faíscas. + + + (Portaria 1352/2008 – Título VII Art. 195º,5 + a), b) e c)) + + + + As medidas de autoprotecção a adoptar nas + situações previstas no n.º 2 do artigo 49.º + são: + + + a) O afastamento adequado de fontes de calor + dos materiais com classe de reacção ao fogo + não especificada; + + + b) A disponibilidade de meios de primeira + intervenção suplementares apropriados; + + + c) A interdição, nos espaços envolvidos, do + uso de chama nua, de elementos + incandescentes não protegidos ou de + aparelhos ou equipamentos susceptíveis de + produzir faíscas. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Condições Gerais de Auto + Protecção + + + + Os elementos de decoração temporária + referidos no número anterior devem ser + desmontados num prazo não superior a 48 + horas após as manifestações que os + justificaram. (Portaria 1352/2008 – Título + VII Art. 195º, 6) + + + + Os elementos de decoração temporária + referidos no número anterior devem ser + desmontados num prazo não superior a 48 + horas após as manifestações que os + justificaram + + + Segurança + + + Organização dos meios de evacuação e + emergência - Condições Gerais de Auto + Protecção + + + + Os trabalhos em obras de conservação, de + alteração, de manutenção ou reparação em + edifícios e recintos, que envolvam + procedimentos que possam prejudicar a + evacuação dos ocupantes devem ser realizados + fora dos períodos de funcionamento dos + espaços. (Portaria 1352/2008 – Título VII + Art. 197º, 1) + + + + Os trabalhos em obras de conservação, de + alteração, de manutenção ou reparação em + edifícios e recintos, que envolvam + procedimentos que possam prejudicar a + evacuação dos ocupantes devem ser realizados + fora dos períodos de funcionamento dos + espaços. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Condições Gerais de Auto + Protecção + + + + Os trabalhos em obras que envolvam a + utilização de substâncias, materiais, + equipamentos ou processos que apresentem + riscos de incêndio ou de explosão, + nomeadamente pela produção de chama nua, + faíscas ou elementos incandescentes em + contacto com o ar, associados à presença de + materiais facilmente inflamáveis, carecem de + autorização expressa do RS, devendo a zona + de intervenção ser convenientemente isolada + e dotada dos meios de intervenção e de + socorro suplementares apropriados ao risco + em causa. (Portaria 1352/2008 – Título VII + Art. 197º, 3) + + + + Os trabalhos em obras que envolvam a + utilização de substâncias, materiais, + equipamentos ou processos que apresentem + riscos de incêndio ou de explosão, + nomeadamente pela produção de chama nua, + faíscas ou elementos incandescentes em + contacto com o ar, associados à presença de + materiais facilmente inflamáveis, carecem de + autorização expressa do RS, devendo a zona + de intervenção ser convenientemente isolada + e dotada dos meios de intervenção e de + socorro suplementares apropriados ao risco + em causa. (Portaria 1352/2008 – Título VII + Art. 197º, 3) + + + Segurança + + + Organização dos meios de evacuação e + emergência - Condições Gerais de Auto + Protecção + + + + As medidas de autoprotecção são auditáveis a + qualquer momento, pelo que o RS deve + fornecer a documentação e facultar o acesso + a todos os espaços dos edifícios e recintos + à entidade competente. (Portaria 1352/2008 – + Título VII Art. 198º, 3) + + + + As medidas de autoprotecção são auditáveis a + qualquer momento, pelo que o RS deve + fornecer a documentação e facultar o acesso + a todos os espaços dos edifícios e recintos + à entidade competente. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Instruções de Segurança + + + + Independentemente da categoria de risco, + devem ser elaboradas e afixadas instruções + de segurança especificamente destinadas aos + ocupantes de Indústrias/Oficinas/Armazéns. + (Portaria 1352/2008 – Título VII Art. 199º, + 1) + + + + Independentemente da categoria de risco, + devem ser elaboradas e afixadas instruções + de segurança especificamente destinadas aos + ocupantes de Indústrias/Oficinas/Armazéns. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Instruções de Segurança + + + + As instruções de segurança (a existir em + Indústrias/Oficinas/Armazéns) devem: + + + a) Conter os procedimentos de prevenção e os + procedimentos em caso de emergência + aplicáveis ao espaço; + + + b) Ser afixadas em locais visíveis, + designadamente na face interior das portas + de acesso aos locais a que se referem. + + + (Portaria 1352/2008 – Título VII Art. 199º, + 2 a) e b)) + + + + As instruções de segurança (a existir em + Indústrias/Oficinas/Armazéns) devem: + + + a) Conter os procedimentos de prevenção e os + procedimentos em caso de emergência + aplicáveis ao espaço; + + + b) Ser afixadas em locais visíveis, + designadamente na face interior das portas + de acesso aos locais a que se referem. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Instruções de Segurança + + + + Quando numa dada utilização-tipo não for + exigível, nos termos do presente + regulamento, procedimentos ou plano de + emergência interno, devem ser afixadas, nos + mesmos locais, instruções de segurança + simplificadas, incluindo: + + + a) Procedimentos de alarme, a cumprir em + caso de detecção ou percepção de um + incêndio; + + b) Procedimentos de alerta; + + c) Técnicas de utilização dos meios de + primeira intervenção e de outros meios de + actuação em caso de incêndio que sirvam os + espaços. + + + (Portaria 1352/2008 – Título VII Art. 199º, + 3 a), b) e c)) + + + + Quando numa dada utilização-tipo não for + exigível, nos termos do presente + regulamento, procedimentos ou plano de + emergência interno, devem ser afixadas, nos + mesmos locais, instruções de segurança + simplificadas, incluindo: + + + a) Procedimentos de alarme, a cumprir em + caso de detecção ou percepção de um + incêndio; + + b) Procedimentos de alerta; + + c) Técnicas de utilização dos meios de + primeira intervenção e de outros meios de + actuação em caso de incêndio que sirvam os + espaços. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Instruções de Segurança + + + + Devem ainda existir instruções gerais de + segurança nas plantas de emergência. + (Portaria 1352/2008 – Título VII Art. 199º, + 4) + + + + Devem ainda existir instruções gerais de + segurança nas plantas de emergência. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Instruções de Segurança + + + + Para concretização das medidas de + autoprotecção, o RS estabelece a organização + necessária, recorrendo a funcionários, + trabalhadores e colaboradores das entidades + exploradoras dos espaços ou a terceiros. + (Portaria 1352/2008 – Título VII Art. 200º, + 1) + + + + Para concretização das medidas de + autoprotecção, o RS estabelece a organização + necessária, recorrendo a funcionários, + trabalhadores e colaboradores das entidades + exploradoras dos espaços ou a terceiros. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Instruções de Segurança + + + + Durante os períodos de funcionamento dos + Estacionamentos deve ser assegurada a + presença simultânea do número mínimo de + elementos da equipa de segurança: 1 elemento + da equipa para 1ª e 2ª categorias de risco e + 2 elementos de 3ª ou 4ª categoria de risco. + (Portaria 1352/2008 – Título VII Art. 200º, + 2) + + + + Durante os períodos de funcionamento dos + Estacionamentos deve ser assegurada a + presença simultânea do número mínimo de + elementos da equipa de segurança: 1 elemento + da equipa para 1ª e 2ª categorias de risco e + 2 elementos de 3ª ou 4ª categoria de risco. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Instruções de Segurança + + + + Durante os períodos de funcionamento dos + espaços (administrativos e comercial) deve + ser assegurada a presença simultânea do + número mínimo de elementos da equipa de + segurança: 1 elemento da equipa para 1 + categoria de risco; 3 elementos para a 2ª + categoria de risco; 5 elementos para a 3ª + categoria de risco e 8 elementos para a 4ª + categoria de risco. (Portaria 1352/2008 – + Título VII Art. 200º, 3) + + + + Durante os períodos de funcionamento dos + espaços (administrativos e comercial) deve + ser assegurada a presença simultânea do + número mínimo de elementos da equipa de + segurança: 1 elemento da equipa para 1 + categoria de risco; 3 elementos para a 2ª + categoria de risco; 5 elementos para a 3ª + categoria de risco e 8 elementos para a 4ª + categoria de risco. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Instruções de Segurança + + + + Durante os períodos de funcionamento, o + posto de segurança que as supervisiona deve + ser mantido ocupado, em permanência, no + mínimo por um agente de segurança. (Portaria + 1352/2008 – Título VII Art. 200º, 4) + + + + Durante os períodos de funcionamento, o + posto de segurança que as supervisiona deve + ser mantido ocupado, em permanência, no + mínimo por um agente de segurança. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Instruções de Segurança + + + + Nas situações em que seja exigível a + existência de um plano de emergência + interno, deve ser implementado um Serviço de + Segurança contra Incêndio (SSI), constituído + por um delegado de segurança com as funções + de chefe de equipa e pelo número de + elementos adequado à dimensão da + utilização-tipo e categoria de risco, com a + configuração mínima (4). (Portaria 1352/2008 + – Título VII Art. 200º, 5) + + + + Nas situações em que seja exigível a + existência de um plano de emergência + interno, deve ser implementado um Serviço de + Segurança contra Incêndio (SSI), constituído + por um delegado de segurança com as funções + de chefe de equipa e pelo número de + elementos adequado à dimensão da + utilização-tipo e categoria de risco, com a + configuração mínima (4). + + + Segurança + + + Organização dos meios de evacuação e + emergência - Instruções de Segurança + + + + Nos estabelecimentos que recebem público (de + 3.ª e 4.ª categorias de risco), o delegado + de segurança, que chefia a equipa, deve + desempenhar as suas funções enquanto houver + público presente, podendo os restantes + agentes de segurança ocupar-se habitualmente + com outras tarefas, desde que se encontrem + permanentemente susceptíveis de contacto com + o posto de segurança e rapidamente + mobilizáveis. (Portaria 1352/2008 – Título + VII Art. 200º, 6) + + + + Nos estabelecimentos que recebem público (de + 3.ª e 4.ª categorias de risco), o delegado + de segurança, que chefia a equipa, deve + desempenhar as suas funções enquanto houver + público presente, podendo os restantes + agentes de segurança ocupar-se habitualmente + com outras tarefas, desde que se encontrem + permanentemente susceptíveis de contacto com + o posto de segurança e rapidamente + mobilizáveis. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Instruções de Segurança + + + + O RS deve garantir a existência de registos + de segurança, destinados à inscrição de + ocorrências relevantes e à guarda de + relatórios relacionados com a segurança + contra incêndio, devendo compreender, + designadamente: + + + a) Os relatórios de vistoria e de inspecção + ou fiscalização de condições de segurança + realizadas por entidades externas; + + + b) Informação sobre as anomalias observadas + nas operações de verificação, conservação ou + manutenção das instalações técnicas, dos + sistemas e dos equipamentos de segurança, + incluindo a sua descrição, impacte, datas da + sua detecção e duração da respectiva + reparação; + + + c) A relação de todas as acções de + manutenção efectuadas em instalações + técnicas, dos sistemas e dos equipamentos de + segurança, com indicação do elemento + intervencionado, tipo e motivo de acção + efectuada, data e responsável; + + + d) A descrição sumária das modificações, + alterações e trabalhos perigosos efectuados + nos espaços da utilização-tipo, com + indicação das datas de seu início e + finalização; + + + e) Os relatórios de ocorrências, directa ou + indirectamente relacionados com a segurança + contra incêndio, tais como alarmes + intempestivos ou falsos, princípios de + incêndio ou actuação de equipas de + intervenção da utilização-tipo; + + + f) Cópia dos relatórios de intervenção dos + bombeiros, em incêndios ou outras + emergências na entidade; + + + g) Relatórios sucintos das acções de + formação e dos simulacros, previstos + respectivamente nos artigos 206.º e 207.º, + com menção dos aspectos mais relevantes. + + + (Portaria 1352/2008 – Título VII Art. 201º, + 1 a) a g)) + + + + O RS deve garantir a existência de registos + de segurança, destinados à inscrição de + ocorrências relevantes e à guarda de + relatórios relacionados com a segurança + contra incêndio, devendo compreender, + designadamente: + + + a) Os relatórios de vistoria e de inspecção + ou fiscalização de condições de segurança + realizadas por entidades externas; + + + b) Informação sobre as anomalias observadas + nas operações de verificação, conservação ou + manutenção das instalações técnicas, dos + sistemas e dos equipamentos de segurança, + incluindo a sua descrição, impacte, datas da + sua detecção e duração da respectiva + reparação; + + + c) A relação de todas as acções de + manutenção efectuadas em instalações + técnicas, dos sistemas e dos equipamentos de + segurança, com indicação do elemento + intervencionado, tipo e motivo de acção + efectuada, data e responsável; + + + d) A descrição sumária das modificações, + alterações e trabalhos perigosos efectuados + nos espaços da utilização-tipo, com + indicação das datas de seu início e + finalização; + + + e) Os relatórios de ocorrências, directa ou + indirectamente relacionados com a segurança + contra incêndio, tais como alarmes + intempestivos ou falsos, princípios de + incêndio ou actuação de equipas de + intervenção da utilização-tipo; + + + f) Cópia dos relatórios de intervenção dos + bombeiros, em incêndios ou outras + emergências na entidade; + + + g) Relatórios sucintos das acções de + formação e dos simulacros, previstos + respectivamente nos artigos 206.º e 207.º, + com menção dos aspectos mais relevantes. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Instruções de Segurança + + + + Os registos de segurança devem ser + arquivados de modo a facilitar as auditorias + nos termos do n.º 3 do artigo 198.º, pelo + período de 10 anos. (Portaria 1352/2008 – + Título VII Art. 201º, 2) + + + + Os registos de segurança devem ser + arquivados de modo a facilitar as auditorias + , pelo período de 10 anos. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Instruções de Segurança + + + + Para as utilizações-tipo devem ser definidas + e cumpridas regras de exploração e de + comportamento, que constituem o conjunto de + procedimentos de prevenção a adoptar pelos + ocupantes, destinados a garantir a + manutenção das condições de segurança. + (Portaria 1352/2008 – Título VII Art. 202º, + 1) + + + + Para as utilizações-tipo devem ser definidas + e cumpridas regras de exploração e de + comportamento, que constituem o conjunto de + procedimentos de prevenção a adoptar pelos + ocupantes, destinados a garantir a + manutenção das condições de segurança. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Instruções de Segurança + + + + Os procedimentos de exploração e utilização + dos espaços devem garantir permanentemente + a: + + + a) Acessibilidade dos meios de socorro aos + espaços; + + + b) Acessibilidade dos veículos de socorro + dos bombeiros aos meios de abastecimento de + água; + + + c) Praticabilidade dos caminhos de + evacuação; + + + d) Eficácia da estabilidade ao fogo e dos + meios de compartimentação, isolamento e + protecção; + + + e) Acessibilidade aos meios de alarme e de + intervenção em caso de emergência; + + + f) Vigilância dos espaços, em especial os de + maior risco de incêndio e os que estão + normalmente desocupados; + + + g) Conservação dos espaços em condições de + limpeza e arrumação adequadas; + + + h) Segurança na produção, manipulação e + armazenamento de matérias e substâncias + perigosas; + + + i) Segurança em todos os trabalhos de + manutenção, recuperação, beneficiação, + alteração ou remodelação de sistemas ou das + instalações, que impliquem um risco agravado + de incêndio, introduzam limitações em + sistemas de segurança instalados ou que + possam afectar a evacuação dos ocupantes. + + + (Portaria 1352/2008 – Título VII Art. 202º, + 2 a) a i)) + + + + Os procedimentos de exploração e utilização + dos espaços devem garantir permanentemente + a: + + + + - + + Acessibilidade dos meios de socorro aos + espaços; + + + + - + + Acessibilidade dos veículos de socorro dos + bombeiros aos meios de abastecimento de + água; + + + + - + + Praticabilidade dos caminhos de evacuação; + + + + - + + Eficácia da estabilidade ao fogo e dos meios + de compartimentação, isolamento e protecção; + + + + - + + Acessibilidade aos meios de alarme e de + intervenção em caso de emergência; + + + + - + + Vigilância dos espaços, em especial os de + maior risco de incêndio e os que estão + normalmente desocupados; + + + + - + + Conservação dos espaços em condições de + limpeza e arrumação adequadas; + + + + - + + Segurança na produção, manipulação e + armazenamento de matérias e substâncias + perigosas; + + + + - + + Segurança em todos os trabalhos de + manutenção, recuperação, beneficiação, + alteração ou remodelação de sistemas ou das + instalações, que impliquem um risco agravado + de incêndio, introduzam limitações em + sistemas de segurança instalados ou que + possam afectar a evacuação dos ocupantes. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Instruções de Segurança + + + + Os procedimentos de exploração e de + utilização das instalações técnicas, + equipamentos e sistemas, devem incluir as + respectivas instruções de funcionamento, os + procedimentos de segurança, a descrição dos + comandos e de eventuais alarmes, bem como + dos sintomas e indicadores de avaria que os + caracterizam. (Portaria 1352/2008 – Título + VII Art. 202º, 3) + + + + Os procedimentos de exploração e de + utilização das instalações técnicas, + equipamentos e sistemas, devem incluir as + respectivas instruções de funcionamento, os + procedimentos de segurança, a descrição dos + comandos e de eventuais alarmes, bem como + dos sintomas e indicadores de avaria que os + caracterizam. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Instruções de Segurança + + + + Os procedimentos de conservação e de + manutenção das instalações técnicas, + dispositivos, equipamentos e sistemas + existentes na utilização-tipo, devem ser + baseados em programas com estipulação de + calendários e listas de testes de + verificação periódica. (Constituem excepção + ao estabelecido no número anterior os + hidrantes exteriores, quando não se + encontrem sob a responsabilidade da entidade + exploradora da utilização-tipo). (Portaria + 1352/2008 – Título VII Art. 202º, 4 e 5) + + + + Os procedimentos de conservação e de + manutenção das instalações técnicas, + dispositivos, equipamentos e sistemas + existentes na utilização-tipo, devem ser + baseados em programas com estipulação de + calendários e listas de testes de + verificação periódica. (Constituem excepção + ao estabelecido no número anterior os + hidrantes exteriores, quando não se + encontrem sob a responsabilidade da entidade + exploradora da utilização-tipo). + + + Segurança + + + Organização dos meios de evacuação e + emergência - Plano de Prevenção + + + + O plano de prevenção, quando exigido, deve + ser constituído: + + a) Por informações relativas à: + + i) Identificação da utilização-tipo; + + + ii) Data da sua entrada em funcionamento; + + iii) Identificação do RS; + + iv) Identificação de eventuais delegados de + segurança; + + + b) Por plantas, à escala de 1:100 ou 1:200 + com a representação inequívoca, recorrendo à + simbologia constante das normas portuguesas, + dos seguintes aspectos: + + + i) Classificação de risco e efectivo + previsto para cada local; + + + ii) Vias horizontais e verticais de + evacuação, incluindo os percursos em + comunicações comuns; + + + iii) Localização de todos os dispositivos e + equipamentos ligados à segurança contra + incêndio. + + + (Portaria 1352/2008 – Título VII Art. 203º, + 1) + + + + + O plano de prevenção deve ser constituído + por informações relativas à identificação da + utilização-tipo; à data da sua entrada em + funcionamento; à identificação do RS e de + eventuais delegados de segurança. Deve ainda + ser constituído por plantas, à escala de + 1:100 ou 1:200 com a representação + inequívoca, recorrendo à simbologia + constante das normas portuguesas com: a + classificação de risco e efectivo previsto + para cada local; as vias horizontais e + verticais de evacuação, incluindo os + percursos em comunicações comuns e a + localização de todos os dispositivos e + equipamentos ligados à segurança contra + incêndio. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Plano de Prevenção + + + + O plano de prevenção e os seus anexos devem + ser actualizados sempre que as modificações + ou alterações efectuadas na utilização-tipo + o justifiquem e estão sujeitos a verificação + durante as inspecções regulares e + extraordinárias. (Portaria 1352/2008 – + Título VII Art. 203º, 2) + + + + O plano de prevenção e os seus anexos devem + ser actualizados sempre que as modificações + ou alterações efectuadas na utilização-tipo + o justifiquem e estão sujeitos a verificação + durante as inspecções regulares e + extraordinárias. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Plano de Prevenção + + + + No posto de segurança deve estar disponível + um exemplar do plano de prevenção. (Portaria + 1352/2008 – Título VII Art. 203º, 3) + + + + Deve estar disponível um exemplar do plano + de prevenção no posto de segurança + + + Segurança + + + Organização dos meios de evacuação e + emergência - Plano de Prevenção + + + + Para as utilizações-tipo devem ser definidos + e cumpridos os procedimentos e as técnicas + de actuação em caso de emergência, a adoptar + pelos ocupantes, contemplando no mínimo: + + + a) Os procedimentos de alarme, a cumprir em + caso de detecção ou percepção de um + incêndio; + + b) Os procedimentos de alerta; + + c) Os procedimentos a adoptar para garantir + a evacuação rápida e segura dos espaços em + risco; + + + d) As técnicas de utilização dos meios de + primeira intervenção e de outros meios de + actuação em caso de incêndio que sirvam os + espaços da utilização-tipo; + + + e) Os procedimentos de recepção e + encaminhamento dos bombeiros. + + + (Portaria 1352/2008 – Título VII Art. 204º, + 1) + + + + Para as utilizações-tipo devem ser definidos + e cumpridos os procedimentos e as técnicas + de actuação em caso de emergência, a adoptar + pelos ocupantes, contemplando no mínimo: + + + a) Os procedimentos de alarme, a cumprir em + caso de detecção ou percepção de um + incêndio; + + b) Os procedimentos de alerta; + + c) Os procedimentos a adoptar para garantir + a evacuação rápida e segura dos espaços em + risco; + + + d) As técnicas de utilização dos meios de + primeira intervenção e de outros meios de + actuação em caso de incêndio que sirvam os + espaços da utilização-tipo; + + + e) Os procedimentos de recepção e + encaminhamento dos bombeiros. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Plano de Prevenção + + + + + Todos os ocupantes, que não pertençam ao + público, devem ser capazes de cumprir, por + si só, os procedimentos relativamente aos + extintores portáteis. (Portaria 1352/2008 – + Título VII Art. 204º, 2) + + + + + Todos os ocupantes, que não pertençam ao + público, devem ser capazes de cumprir, por + si só, os procedimentos relativamente aos + extintores portáteis. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Plano de Emergência Interno + + + + São objectivos do plano de emergência + interno do edifício, sistematizar a + evacuação enquadrada dos ocupantes da + utilização-tipo, que se encontrem em risco, + limitar a propagação e as consequências dos + incêndios, recorrendo a meios próprios. + (Portaria 1352/2008 – Título VII Art. 205º, + 1) + + + + São objectivos do plano de emergência + interno do edifício, sistematizar a + evacuação enquadrada dos ocupantes da + utilização-tipo, que se encontrem em risco, + limitar a propagação e as consequências dos + incêndios, recorrendo a meios próprios. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Plano de Emergência Interno + + + + O plano de emergência interno deve ser + constituído: + + + a) Pela definição da organização a adoptar + em caso de emergência; + + + b) Pela indicação das entidades internas e + externas a contactar em situação de + emergência; + + c) Pelo plano de actuação; + d) Pelo plano de evacuação; + + e) Por um anexo com as instruções de + segurança a que se refere o artigo 199.º; + + + f) Por um anexo com as plantas de + emergência, podendo ser acompanhadas por + esquemas de emergência. + + + (Portaria 1352/2008 – Título VII Art. 205º, + 2 a) a f)) + + + + O plano de emergência interno deve ser + constituído: + + + + - + + Pela definição da organização a adoptar em + caso de emergência; + + + + - + + Pela indicação das entidades internas e + externas a contactar em situação de + emergência; + + + + - + + Pelo plano de actuação; + + + + - + + Pelo plano de evacuação; + + + + - + + Por um anexo com as instruções de segurança + ; + + + + - + + Por um anexo com as plantas de emergência, + podendo ser acompanhadas por esquemas de + emergência. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Plano de Emergência Interno + + + + A organização em situação de emergência deve + contemplar: + + + a) Os organogramas hierárquicos e funcionais + do SSI cobrindo as várias fases do + desenvolvimento de uma situação de + emergência; + + + b) A identificação dos delegados e agentes + de segurança componentes das várias equipas + de intervenção, respectivas missões e + responsabilidades. + + + (Portaria 1352/2008 – Título VII Art. 205º, + 3) + + + + A organização em situação de emergência deve + contemplar os organogramas hierárquicos e + funcionais do SSI cobrindo as várias fases + do desenvolvimento de uma situação de + emergência e a identificação dos delegados e + agentes de segurança componentes das várias + equipas de intervenção, respectivas missões + e responsabilidades. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Plano de Emergência Interno + + + + O plano de actuação deve contemplar a + organização das operações a desencadear por + delegados e agentes de segurança em caso de + ocorrência de uma situação perigosa e os + procedimentos a observar, abrangendo: + + + a) O conhecimento prévio dos riscos + presentes nos espaços afectos à + utilização-tipo, nomeadamente nos locais de + risco Industria/Oficina/Armazém; + + + b) Os procedimentos a adoptar em caso de + detecção ou percepção de um alarme de + incêndio; + + + c) A planificação da difusão dos alarmes + restritos e geral e a transmissão do alerta; + + + d) A coordenação das operações previstas no + plano de evacuação; + + + e) A activação dos meios de primeira + intervenção, apropriados a cada + circunstância, incluindo as técnicas de + utilização desses meios; + + + f) A execução da manobra dos dispositivos de + segurança, designadamente de corte da + alimentação de energia eléctrica e de + combustíveis, de fecho de portas resistentes + ao fogo e das instalações de controlo de + fumo; + + + g) A prestação de primeiros socorros; + + + h) A protecção de locais de risco e de + pontos nevrálgicos da utilização-tipo; + + + i) O acolhimento, informação, orientação e + apoio dos bombeiros; + + + j) A reposição das condições de segurança + após uma situação de emergência. + + + (Portaria 1352/2008 – Título VII Art. 205º, + 4 a) a j)) + + + + O plano de actuação deve contemplar a + organização das operações a desencadear por + delegados e agentes de segurança em caso de + ocorrência de uma situação perigosa e os + procedimentos a observar, abrangendo: + + + + - + + O conhecimento prévio dos riscos presentes + nos espaços afectos à utilização-tipo, + nomeadamente nos locais de risco + Industria/Oficina/Armazém; + + + + - + + Os procedimentos a adoptar em caso de + detecção ou percepção de um alarme de + incêndio; + + + + - + + A planificação da difusão dos alarmes + restritos e geral e a transmissão do alerta; + + + + - + + A coordenação das operações previstas no + plano de evacuação; + + + + - + + A activação dos meios de primeira + intervenção, apropriados a cada + circunstância, incluindo as técnicas de + utilização desses meios; + + + + - + + A execução da manobra dos dispositivos de + segurança, designadamente de corte da + alimentação de energia eléctrica e de + combustíveis, de fecho de portas resistentes + ao fogo e das instalações de controlo de + fumo; + + + + - + + A prestação de primeiros socorros; + + + + - + + A protecção de locais de risco e de pontos + nevrálgicos da utilização-tipo; + + + + - + + O acolhimento, informação, orientação e + apoio dos bombeiros; + + + + - + + A reposição das condições de segurança após + uma situação de emergência. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Plano de Emergência Interno + + + + O plano de evacuação deve contemplar as + instruções e os procedimentos, a observar + por todo o pessoal, relativos à articulação + das operações destinadas a garantir a + evacuação ordenada, total ou parcial, dos + espaços considerados em risco pelo RS e + abranger: + + + a) O encaminhamento rápido e seguro dos + ocupantes desses espaços para o exterior ou + para uma zona segura; + + + b) O auxílio a pessoas com capacidades + limitadas; + + + c) A confirmação da evacuação total dos + espaços e garantia de que ninguém a eles + regressa. + + + (Portaria 1352/2008 – Título VII Art. 205º, + 5 a), b) e c)) + + + + O plano de evacuação deve contemplar as + instruções e os procedimentos, a observar + por todo o pessoal, relativos à articulação + das operações destinadas a garantir a + evacuação ordenada, total ou parcial, dos + espaços considerados em risco pelo RS e deve + abranger: o encaminhamento rápido e seguro + dos ocupantes desses espaços para o exterior + ou para uma zona segura; o auxílio a pessoas + com capacidades limitadas e a confirmação da + evacuação total dos espaços e garantia de + que ninguém a eles regressa. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Plano de Emergência Interno + + + + As plantas de emergência, a elaborar para + cada piso da utilização-tipo, quer em + edifícios quer em recintos, devem ser + afixadas em posições estratégicas junto aos + acessos principais do piso a que se referem. + (Portaria 1352/2008 – Título VII Art. 205º, + 6) + + + + As plantas de emergência, a elaborar para + cada piso da utilização-tipo, quer em + edifícios quer em recintos, devem ser + afixadas em posições estratégicas junto aos + acessos principais do piso a que se referem. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Plano de Emergência Interno + + + + + Quando solicitado, devem ser + disponibilizadas cópias das plantas de + emergência ao corpo de bombeiros em cuja + área de actuação própria se inserem os + espaços afectos à utilização-tipo. (Portaria + 1352/2008 – Título VII Art. 205º, 7) + + + + + Quando solicitado, devem ser + disponibilizadas cópias das plantas de + emergência ao corpo de bombeiros em cuja + área de actuação própria se inserem os + espaços afectos à utilização-tipo. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Plano de Emergência Interno + + + + O plano de emergência interno e os seus + anexos devem ser actualizados sempre que as + modificações ou alterações efectuadas na + utilização-tipo o justifiquem e estão + sujeitos a verificação durante as inspecções + regulares e extraordinárias. (Portaria + 1352/2008 – Título VII Art. 205º, 8) + + + + O plano de emergência interno e os seus + anexos devem ser actualizados sempre que as + modificações ou alterações efectuadas na + utilização-tipo o justifiquem e estão + sujeitos a verificação durante as inspecções + regulares e extraordinárias. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Plano de Emergência Interno + + + + No posto de segurança deve estar disponível + um exemplar do plano de emergência interno. + (Portaria 1352/2008 – Título VII Art. 205º, + 9) + + + + Deve estar disponível um exemplar do plano + de emergência interno no posto de segurança + + + Segurança + + + Organização dos meios de evacuação e + emergência - Ascensores + + + + Junto dos acessos aos ascensores deve ser + afixado o sinal com a inscrição: «Não + utilizar o ascensor em caso de incêndio» ou + com pictograma equivalente. (Portaria + 1352/2008 – Título V Capítulo VII Art. 102º) + + + + Junto dos acessos aos ascensores deve ser + afixado o sinal com a inscrição: «Não + utilizar o ascensor em caso de incêndio» ou + com pictograma equivalente + + + Segurança + + + Organização dos meios de evacuação e + emergência - Ascensores + + + + Os ascensores devem ser equipados com + dispositivos de chamada em caso de incêndio, + accionáveis por operação de uma fechadura + localizada junto das portas de patamar do + piso de referência, mediante uso de chave + especial, e automaticamente, a partir de + sinal proveniente do quadro de sinalização e + comando do sistema de alarme de incêndio, + quando exista. (Portaria 1352/2008 – Título + V Capítulo VII Art. 103º, 1) + + + + Os ascensores devem ser equipados com + dispositivos de chamada em caso de incêndio, + accionáveis por operação de uma fechadura + localizada junto das portas de patamar do + piso de referência, mediante uso de chave + especial, e automaticamente, a partir de + sinal proveniente do quadro de sinalização e + comando do sistema de alarme de incêndio, + quando exista. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Ascensores + + + + A chave deve estar localizada junto à porta + de patamar do piso do plano de referência, + alojada em caixa protegida contra o uso + abusivo e sinalizada com a frase «Chave de + manobra de emergência do elevador», devendo + o posto de segurança, caso exista, dispor de + uma cópia dessa chave. (Portaria 1352/2008 – + Título V Capítulo VII Art. 103º, 2) + + + + A chave deve estar localizada junto à porta + de patamar do piso do plano de referência, + alojada em caixa protegida contra o uso + abusivo e sinalizada com a frase «Chave de + manobra de emergência do elevador», devendo + o posto de segurança, caso exista, dispor de + uma cópia dessa chave. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + Os edifícios devem ser equipados com + instalações que permitam detectar o incêndio + e, em caso de emergência, difundir o alarme + para os seus ocupantes, alertar os bombeiros + e accionar sistemas e equipamentos de + segurança. (Portaria 1352/2008 – Título VI + Capítulo III Art. 116º 1) + + + + Os edifícios devem ser equipados com + instalações que permitam detectar o incêndio + e, em caso de emergência, difundir o alarme + para os seus ocupantes, alertar os bombeiros + e accionar sistemas e equipamentos de + segurança. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + Estão isentos de cobertura por detectores + automáticos de incêndio os espaços que + cumulativamente estejam protegidos + totalmente por sistema fixo de extinção + automática de incêndios por água e não + possuam controlo de fumo por meios activos. + (Portaria 1352/2008 – Título VI Capítulo III + Art. 116º, 3 a) e b)) + + + + Estão isentos de cobertura por detectores + automáticos de incêndio os espaços que + cumulativamente estejam protegidos + totalmente por sistema fixo de extinção + automática de incêndios por água e não + possuam controlo de fumo por meios activos. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + As instalações de detecção, alarme e alerta + na sua versão mais completa são constituídas + por: + + + a) Dispositivos de accionamento do alarme de + operação manual («botões de alarme»); + + + b) Dispositivos de actuação automática + («detectores de incêndio»); + + + c) Centrais e quadros de sinalização e + comando; + + + d) Sinalizadores de alarme restrito; + + e) Difusores de alarme geral; + + f) Equipamentos de transmissão automática do + sinal ou mensagem de alerta; + + + g) Telefones para transmissão manual do + alerta; + + + h) Dispositivos de comando de sistemas e + equipamentos de segurança; + + + i) Fontes locais de energia de emergência. + + + (Portaria 1352/2008 – Título VI Capítulo III + Art. 117º) + + + + As instalações de detecção, alarme e alerta + na sua versão mais completa são constituídas + por: + + + + - Dispositivos de accionamento do alarme de + operação manual («botões de alarme»); + + + + - Dispositivos de actuação automática + («detectores de incêndio»); + + + + - Centrais e quadros de sinalização e + comando; + + + + - + + Sinalizadores de alarme restrito; + + + + - Difusores de alarme geral; + + + + - Equipamentos de transmissão automática do + sinal ou mensagem de alerta; + + + + - Telefones para transmissão manual do + alerta; + + + + - Dispositivos de comando de sistemas e + equipamentos de segurança; + + + + - Fontes locais de energia de emergência. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + Nos períodos de exploração as instalações + devem estar no estado de vigília, facto que + deve ser sinalizado na central, quando + exista. (Portaria 1352/2008 – Título VI + Capítulo III Art. 118º, 1) + + + + Nos períodos de exploração as instalações + devem estar no estado de vigília, facto que + deve ser sinalizado na central, quando + exista. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + A actuação de um dispositivo de accionamento + do alarme deve provocar, de imediato, o + funcionamento do alarme restrito e, + eventualmente, o accionamento dos + dispositivos de comando de sistemas e + equipamentos de segurança. (Portaria + 1352/2008 – Título VI Capítulo III Art. + 118º, 2) + + + + A actuação de um dispositivo de accionamento + do alarme deve provocar, de imediato, o + funcionamento do alarme restrito e, + eventualmente, o accionamento dos + dispositivos de comando de sistemas e + equipamentos de segurança. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + Nos edifícios que não disponham de meios + humanos para explorar uma situação de alarme + restrito, a actuação de um dispositivo de + accionamento do alarme deve provocar, de + imediato, o funcionamento do alarme geral. + (Portaria 1352/2008 – Título VI Capítulo III + Art. 118º, 3) + + + + Nos edifícios que não disponham de meios + humanos para explorar uma situação de alarme + restrito, a actuação de um dispositivo de + accionamento do alarme deve provocar, de + imediato, o funcionamento do alarme geral. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + Nos edifícios que disponham de meios humanos + para explorar uma situação de alarme + restrito, deve existir uma temporização + entre os alarmes (restrito e geral), de modo + a permitir a intervenção do pessoal afecto à + segurança, para eventual extinção da causa + que lhe deu origem, sem proceder à + evacuação. (Portaria 1352/2008 – Título VI + Capítulo III Art. 118º, 4) + + + + Nos edifícios que disponham de meios humanos + para explorar uma situação de alarme + restrito, deve existir uma temporização + entre os alarmes (restrito e geral), de modo + a permitir a intervenção do pessoal afecto à + segurança, para eventual extinção da causa + que lhe deu origem, sem proceder à + evacuação. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + A temporização referida no número anterior + deve ter duração adaptada às características + do edifício e da sua exploração, devendo + ainda ser previstos meios de proceder à sua + anulação sempre que seja considerado + oportuno. (Portaria 1352/2008 – Título VI + Capítulo III Art. 118º, 5) + + + + A temporização referida no número anterior + deve ter duração adaptada às características + do edifício e da sua exploração, devendo + ainda ser previstos meios de proceder à sua + anulação sempre que seja considerado + oportuno. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + O alarme geral deve ser claramente audível + em todos os locais do edifício, ter a + possibilidade de soar durante o tempo + necessário à evacuação dos seus ocupantes, + com um mínimo de cinco minutos, e de ser + ligado ou desligado a qualquer momento. + (Portaria 1352/2008 – Título VI Capítulo III + Art. 118º, 6) + + + + O alarme geral deve ser claramente audível + em todos os locais do edifício, ter a + possibilidade de soar durante o tempo + necessário à evacuação dos seus ocupantes, + com um mínimo de cinco minutos, e de ser + ligado ou desligado a qualquer momento. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + A transmissão do alerta, quando automática, + deve ser simultânea com a difusão do alarme + geral. (Portaria 1352/2008 – Título VI + Capítulo III Art. 118º, 8) + + + + A transmissão do alerta, quando automática, + deve ser simultânea com a difusão do alarme + geral. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + Os dispositivos de accionamento manual do + alarme devem ser instalados nos caminhos + horizontais de evacuação, sempre que + possível junto às saídas dos pisos e a + locais sujeitos a riscos especiais, a cerca + de 1,5 m do pavimento, devidamente + sinalizados, não podendo ser ocultados por + quaisquer elementos decorativos ou outros, + nem por portas, quando abertas. (Portaria + 1352/2008 – Título VI Capítulo III Art. + 119º) + + + + Os dispositivos de accionamento manual do + alarme devem ser instalados nos caminhos + horizontais de evacuação, sempre que + possível junto às saídas dos pisos e a + locais sujeitos a riscos especiais, a cerca + de 1,5 m do pavimento, devidamente + sinalizados, não podendo ser ocultados por + quaisquer elementos decorativos ou outros, + nem por portas, quando abertas. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + Os dispositivos de detecção automática devem + ser seleccionados e colocados em função das + características do espaço a proteger, do seu + conteúdo e da actividade exercida, cobrindo + convenientemente a área em causa. (Portaria + 1352/2008 – Título VI Capítulo III Art. + 120º) + + + + Os dispositivos de detecção automática devem + ser seleccionados e colocados em função das + características do espaço a proteger, do seu + conteúdo e da actividade exercida, cobrindo + convenientemente a área em causa. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + Os difusores de alarme geral devem, sempre + que possível, ser instalados fora do alcance + dos ocupantes e, no caso de se situarem a + uma altura do pavimento inferior a 2,25 m, + ser protegidos por elementos que os + resguardem de danos acidentais. (Portaria + 1352/2008 – Título VI Capítulo III Art. + 121º, 1) + + + + Os difusores de alarme geral devem, sempre + que possível, ser instalados fora do alcance + dos ocupantes e, no caso de se situarem a + uma altura do pavimento inferior a 2,25 m, + ser protegidos por elementos que os + resguardem de danos acidentais. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + O sinal emitido deve ser inconfundível com + qualquer outro e audível em todos os locais + do edifício ou recinto a que seja destinado. + (Portaria 1352/2008 – Título VI Capítulo III + Art. 121º, 2) + + + + O sinal emitido deve ser inconfundível com + qualquer outro e audível em todos os locais + do edifício ou recinto a que seja destinado. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + Nos espaços equipados com instalações de + sonorização, o sinal de alarme geral para + execução da evacuação total ou parcial do + público pode consistir numa mensagem + gravada, activada após a interrupção do + programa normal, de modo automático ou + manual, a partir do posto de segurança, + devendo constar o seu conteúdo e actuação no + plano de emergência interno. (Portaria + 1352/2008 – Título VI Capítulo III Art. + 121º, 4) + + + + Nos espaços equipados com instalações de + sonorização, o sinal de alarme geral para + execução da evacuação total ou parcial do + público pode consistir numa mensagem + gravada, activada após a interrupção do + programa normal, de modo automático ou + manual, a partir do posto de segurança, + devendo constar o seu conteúdo e actuação no + plano de emergência interno. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + Os meios de difusão do alarme em caso de + incêndio dos locais cujo efectivo seja + superior a 200 pessoas e durante a + permanência de público nesses locais, devem + ser concebidos de modo a não causarem + pânico. (Portaria 1352/2008 – Título VI + Capítulo III Art. 121º, 5) + + + + Os meios de difusão do alarme em caso de + incêndio dos locais cujo efectivo seja + superior a 200 pessoas e durante a + permanência de público nesses locais, devem + ser concebidos de modo a não causarem + pânico. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + A difusão da mensagem gravada deve ser + precedida da ligação dos aparelhos de + iluminação de emergência de ambiente ou + circulação. (Portaria 1352/2008 – Título VI + Capítulo III Art. 121º, 6) + + + + A difusão da mensagem gravada deve ser + precedida da ligação dos aparelhos de + iluminação de emergência de ambiente ou + circulação. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + As centrais de sinalização e comando das + instalações devem ser situadas em locais + reservados ao pessoal afecto à segurança do + edifício, nomeadamente no posto de + segurança, quando existir, e assegurar: + + + a) A alimentação dos dispositivos de + accionamento do alarme; + + + b) A alimentação dos difusores de alarme + geral; + + + c) A sinalização de presença de energia de + rede e de avaria da fonte de energia + autónoma; + + + d) A sinalização sonora e óptica dos alarmes + restrito e geral e do alerta; + + + e) A sinalização do estado de vigília das + instalações; + + + f)A sinalização de avaria, teste ou + desactivação de circuitos dos dispositivos + de accionamento de alarme; + + + g) O comando de accionamento e de + interrupção do alarme geral; + + + h) A temporização do sinal de alarme geral, + quando exigido; + + + i) O comando dos sistemas e equipamentos de + segurança do edifício, quando exigido; + + + j) O comando de accionamento do alerta + + + (Portaria 1352/2008 – Título VI Capítulo III + Art. 122º, 1 a) a j)) + + + + As centrais de sinalização e comando das + instalações devem ser situadas em locais + reservados ao pessoal afecto à segurança do + edifício, nomeadamente no posto de + segurança, quando existir, e assegurar: + + + + - + + A alimentação dos dispositivos de + accionamento do alarme; + + + + - A alimentação dos difusores de alarme + geral; + + + + - A sinalização de presença de energia de + rede e de avaria da fonte de energia + autónoma; + + + + - + + A sinalização sonora e óptica dos alarmes + restrito e geral e do alerta; + + + + - + + A sinalização do estado de vigília das + instalações; + + + + - + + A sinalização de avaria, teste ou + desactivação de circuitos dos dispositivos + de accionamento de alarme; + + + + - + + O comando de accionamento e de interrupção + do alarme geral; + + + + - + + A temporização do sinal de alarme geral, + quando exigido; + + + + - + + O comando dos sistemas e equipamentos de + segurança do edifício, quando exigido; + + + + - + + O comando de accionamento do alerta + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + Quando a central de sinalização e comando + não puder ficar localizada junto do posto do + vigilante responsável pela segurança, deve + equipar-se o sistema com um quadro repetidor + daquela unidade, instalado num local vigiado + em permanência. (Portaria 1352/2008 – Título + VI Capítulo III Art. 122º, 2) + + + + Quando a central de sinalização e comando + não puder ficar localizada junto do posto do + vigilante responsável pela segurança, deve + equipar-se o sistema com um quadro repetidor + daquela unidade, instalado num local vigiado + em permanência. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + Os espaços confinados, designadamente + delimitados por tectos falsos com mais de + 0,8 m de altura ou por pavimentos + sobreelevados em mais de 0,2 m, devem + possuir detecção automática de incêndios, + desde que neles passem cablagens ou sejam + instalados equipamento ou condutas + susceptíveis de causar ou propagar incêndios + ou fumo. (Portaria 1352/2008 – Título VI + Capítulo III Art. 132º, 1) + + + + Os espaços confinados, designadamente + delimitados por tectos falsos com mais de + 0,8 m de altura ou por pavimentos + sobreelevados em mais de 0,2 m, devem + possuir detecção automática de incêndios, + desde que neles passem cablagens ou sejam + instalados equipamento ou condutas + susceptíveis de causar ou propagar incêndios + ou fumo. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Detecção, Alarme e Alerta + + + + Quando os espaços referidos no número + anterior forem protegidos por detectores + pontuais, mesmo que sejam integrados em + sistemas endereçáveis, deve existir, em + local visível, sinalização óptica desses + detectores. (Portaria 1352/2008 – Título VI + Capítulo III Art. 132º, 3) + + + + Quando os espaços referidos no número + anterior forem protegidos por detectores + pontuais, mesmo que sejam integrados em + sistemas endereçáveis, deve existir, em + local visível, sinalização óptica desses + detectores. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Posto de Segurança + + + + Deve ser previsto um posto de segurança, + destinado a centralizar toda a informação de + segurança e os meios principais de recepção + e difusão de alarmes e de transmissão do + alerta, bem como a coordenar os meios + operacionais e logísticos em caso de + emergência, nos espaços afectos a + Estacionamentos (da 2.ª categoria de risco + ou superior). (Portaria 1352/2008 – Título + VI Capítulo XI Art. 190º, 1 a)) + + + + Deve ser previsto um posto de segurança, + destinado a centralizar toda a informação de + segurança e os meios principais de recepção + e difusão de alarmes e de transmissão do + alerta, bem como a coordenar os meios + operacionais e logísticos em caso de + emergência, nos espaços afectos a + Estacionamentos (da 2.ª categoria de risco + ou superior). + + + Segurança + + + Organização dos meios de evacuação e + emergência - Posto de Segurança + + + + O posto de segurança pode ser estabelecido + na recepção ou na portaria, desde que + localizado junto a um acesso principal, + sempre que possível em local com ingresso + reservado e resguardado ou protegido do + fogo. (Portaria 1352/2008 – Título VI + Capítulo XI Art. 190º, 2) + + + + O posto de segurança pode ser estabelecido + na recepção ou na portaria, desde que + localizado junto a um acesso principal, + sempre que possível em local com ingresso + reservado e resguardado ou protegido do + fogo. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Posto de Segurança + + + + No caso de existirem espaços afectos a mais + do que uma utilização-tipo, nas + circunstâncias mencionadas no n.º 1, num + mesmo edifício ou recinto, pode existir um + único posto de segurança para a globalidade + das utilizações - tipo, desde que nele seja + possível individualizar a supervisão, + comando e controlo para cada uma delas. + (Portaria 1352/2008 – Título VI Capítulo XI + Art. 190º, 3) + + + + No caso de existirem espaços afectos a mais + do que uma utilização-tipo + + num mesmo edifício ou recinto, pode existir + um único posto de segurança para a + globalidade das utilizações - tipo, desde + que nele seja possível individualizar a + supervisão, comando e controlo para cada uma + delas. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Posto de Segurança + + + + No posto de segurança deve existir um + chaveiro de segurança contendo as chaves de + reserva para abertura de todos os acessos do + espaço que serve, bem como dos seus + compartimentos e acessos a instalações + técnicas e de segurança. (Portaria 1352/2008 + – Título VI Capítulo XI Art. 190º, 5) + + + + No posto de segurança deve existir um + chaveiro de segurança contendo as chaves de + reserva para abertura de todos os acessos do + espaço que serve, bem como dos seus + compartimentos e acessos a instalações + técnicas e de segurança. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Posto de Segurança + + + + No posto de segurança deve também existir um + exemplar do plano de prevenção e do plano de + emergência interno. (Portaria 1352/2008 – + Título VI Capítulo XI Art. 190º, 6) + + + + No posto de segurança deve também existir um + exemplar do plano de prevenção e do plano de + emergência interno. + + + Segurança + + + Organização dos meios de evacuação e + emergência - Posto de Segurança + + + + Sempre que um posto de segurança sirva + diversos edifícios gerida pela mesma + entidade, devem existir meios de comunicação + oral entre o posto de segurança e as + recepções ou portarias dos restantes + edifícios, garantidos através de meios + distintos das redes telefónicas públicas. + (Portaria 1352/2008 – Título VI Capítulo XI + Art. 190º, 7) + + + + Sempre que um posto de segurança sirva + diversos edifícios gerida pela mesma + entidade, devem existir meios de comunicação + oral entre o posto de segurança e as + recepções ou portarias dos restantes + edifícios, garantidos através de meios + distintos das redes telefónicas públicas. + + + Segurança + + + Existência de instalações eléctricas de + baixa tensão + + + + A instalação eléctrica deverá ser + convenientemente conservada e mantida em + conformidade com o Regulamento de Segurança + de Instalações de Utilização de Energia + Eléctrica e Instalações Colectivas de + Edifícios e Entradas (Portaria n.º987/93 – + art.3º-1); + + + + A instalação eléctrica deverá ser + convenientemente conservada e mantida em + conformidade com o Regulamento de Segurança + de Instalações de Utilização de Energia + Eléctrica e Instalações Colectivas de + Edifícios e Entradas + + + Segurança + + + Existência de instalações eléctricas de + baixa tensão + + + + Utilizar correctamente, e segundo as + instruções transmitidas pelo empregador, + máquinas, aparelhos, instrumentos, + substâncias perigosas e outros equipamentos + e meios postos à sua disposição, + designadamente os equipamentos de protecção + colectiva e individual, bem como cumprir os + procedimentos de trabalho estabelecidos ( + + Lei n.º99/03 + + + – Art.274 – 1c + + + ) + + + + Segurança + + + Existência de instalações eléctricas de + baixa tensão + + + + Assegurar a substituição dos equipamentos + existentes quando se encontrarem degradados + ( + + Decreto Lei n.º441/91 – Art. + + + 15 + + + ºb + + + ) + + + + + A instalação eléctrica não pode comportar + risco de incêndio ou de explosão e deve + assegurar que a sua utilização não constitua + factor de risco para os trabalhadores, por + contacto directo ou indirecto + + + Segurança + + + Existência de instalações eléctricas de + baixa tensão + + + + Manter os objectos arrumados após cada + utilização ( + + Decreto Lei n.º441/91 – Art. + + + 15 + + + ºb + + + ) + + + + + Manter os objectos arrumados após cada + utilização + + + Segurança + + + Condições gerais das instalações técnicas - + Energia Eléctrica + + + + As instalações técnicas dos edifícios e dos + recintos devem ser concebidas, instaladas e + mantidas, nos termos legais, de modo que não + constituam causa de incêndio nem contribuam + para a sua propagação. (Portaria 1352/2008 – + Título V Capítulo I Art. 69º 1) + + + + As instalações técnicas dos edifícios e dos + recintos devem ser concebidas, instaladas e + mantidas, nos termos legais, de modo que não + constituam causa de incêndio nem contribuam + para a sua propagação. + + + Segurança + + + Condições gerais das instalações técnicas - + Energia Eléctrica + + + + O acesso aos locais (transformadores de + potência e grupos geradores e localizados em + locais isolados e delimitados por barreiras + físicas) deve ser reservado a pessoal + técnico especializado adstrito à sua + exploração ou manutenção e estar devidamente + sinalizado. (Portaria 1352/2008 – Título V + Capítulo IIArt. 70º 2) + + + + O acesso aos locais (transformadores de + potência e grupos geradores e localizados em + locais isolados e delimitados por barreiras + físicas) deve ser reservado a pessoal + técnico especializado adstrito à sua + exploração ou manutenção e estar devidamente + sinalizado. + + + Segurança + + + Condições gerais das instalações técnicas - + Energia Eléctrica + + + + Os compartimentos e os espaços dos edifícios + onde existam unidades de alimentação + ininterrupta de energia eléctrica (UPS) + devem possuir em todos os seus acessos + sinalização desse facto, independentemente + da potência em causa. (Portaria 1352/2008 – + Título V Capítulo II Art. 75º, 1) + + + + Os compartimentos e os espaços dos edifícios + onde existam unidades de alimentação + ininterrupta de energia eléctrica (UPS) + devem possuir em todos os seus acessos + sinalização desse facto, independentemente + da potência em causa. + + + Segurança + + + Condições gerais das instalações técnicas - + Energia Eléctrica + + + + As instalações eléctricas fixas servidas por + unidades de alimentação ininterrupta, devem + dispor, pelo menos, de uma Botoneira de + corte de emergência que corte todos os + circuitos alimentados com base nessas + unidades. (Portaria 1352/2008 – Título V + Capítulo II Art. 75º, 2) + + + + As instalações eléctricas fixas servidas por + unidades de alimentação ininterrupta, devem + dispor, pelo menos, de uma Botoneira de + corte de emergência que corte todos os + circuitos alimentados com base nessas + unidades. + + + Segurança + + + Condições gerais das instalações técnicas - + Energia Eléctrica + + + + As botoneiras, devidamente sinalizadas, + devem localizar-se os acessos aos + compartimentos, quando as instalações + referidas no n.º 2 sirvam até três + compartimentos contíguos. (Portaria + 1352/2008 – Título V Capítulo II Art. 75º, 3 + a)) + + + + As botoneiras, devidamente sinalizadas, + devem localizar-se os acessos aos + compartimentos, quando as instalações + referidas no n.º 2 sirvam até três + compartimentos contíguos. + + + Segurança + + + Condições gerais das instalações técnicas - + Energia Eléctrica + + + + Sempre que exista posto de segurança, as + botoneiras de corte também devem ser nele + localizadas. (Portaria 1352/2008 – Título V + Capítulo II Art. 75º, 4) + + + + Sempre que exista posto de segurança, as + botoneiras de corte também devem ser nele + localizadas. + + + Segurança + + + Condições gerais das instalações técnicas - + Energia Eléctrica + + + + Os quadros eléctricos devem ser instalados à + vista ou em armários próprios para o efeito + sem qualquer outra utilização, devendo ter, + em ambos os casos, acesso livre de + obstáculos de qualquer natureza e estar + devidamente sinalizados. (Portaria 1352/2008 + – Título V Capítulo II Art. 76º, 1) + + + + Os quadros eléctricos devem ser instalados à + vista ou em armários próprios para o efeito + sem qualquer outra utilização, devendo ter, + em ambos os casos, acesso livre de + obstáculos de qualquer natureza e estar + devidamente sinalizados. ( + + + Segurança + + + Condições gerais das instalações técnicas - + Energia Eléctrica + + + + No posto de segurança (todas as + utilizações-tipo + + ) + + + da 3.ª e 4.ª categorias de risco, devem + + + existir botoneiras de corte geral de + energia eléctrica da rede e de todas as + fontes + + + centrais de alimentação de emergência, + devidamente sinalizadas. (Portaria + 1352/2008 – + + + Título V Capítulo II Art. 76º, 4) + + + + + No posto de segurança (todas as + utilizações-tipo + + ) + + + da 3.ª e 4.ª categorias de risco, devem + + + existir botoneiras de corte geral de + energia eléctrica da rede e de todas as + fontes + + + centrais de alimentação de emergência, + devidamente sinalizadas. + + + + Segurança + + + Condições gerais das instalações técnicas - + Aquecimento + + + + Em torno dos aparelhos de produção de calor + devem ser reservados corredores com largura + adequada para assegurar a manobra dos órgãos + de comando e de regulação, bem como as + operações de manutenção, conservação e + limpeza. (Portaria 1352/2008 – Título V + Capítulo III Art. 81º, 2) + + + + Em torno dos aparelhos de produção de calor + devem ser reservados corredores com largura + adequada para assegurar a manobra dos órgãos + de comando e de regulação, bem como as + operações de manutenção, conservação e + limpeza. + + + Segurança + + + Condições gerais das instalações técnicas - + Aquecimento + + + + Só é permitida a instalação de aparelhos de + aquecimento autónomos em locais de risco A + (sem risco) e em locais de risco B (algum + risco e acessível ao público) com efectivo + inferior a 500 pessoas. (Portaria 1352/2008 + – Título V Capítulo III Art. 85º, 1) + + + + Só é permitida a instalação de aparelhos de + aquecimento autónomos em locais de risco A + (sem risco) e em locais de risco B (algum + risco e acessível ao público) com efectivo + inferior a 500 pessoas. + + + Segurança + + + Condições gerais das instalações técnicas - + Aquecimento + + + + Nos locais de risco C, D, E e F, e nas vias + de evacuação de qualquer local, apenas são + permitidos aparelhos autónomos + exclusivamente eléctricos que não apresentem + resistências em contacto directo com o ar, + nem possuam potência total instalada + superior a 25 kW. (Portaria 1352/2008 – + Título V Capítulo III Art. 85º, 2) + + + + Nos locais de risco C, D, E e F, e nas vias + de evacuação de qualquer local, apenas são + permitidos aparelhos autónomos + exclusivamente eléctricos que não apresentem + resistências em contacto directo com o ar, + nem possuam potência total instalada + superior a 25 kW. + + + Segurança + + + Condições gerais das instalações técnicas - + Aquecimento + + + + Os aparelhos autónomos instalados em locais + de risco B (algum risco e acessível ao + público) e nas vias de evacuação devem ser + fixados às paredes ou aos pavimentos. + (Portaria 1352/2008 – Título V Capítulo III + Art. 85º, 3) + + + + Os aparelhos autónomos instalados em locais + de risco B (algum risco e acessível ao + público) e nas vias de evacuação devem ser + fixados às paredes ou aos pavimentos. + + + Segurança + + + Condições gerais das instalações técnicas - + Aquecimento + + + + A distância mínima dos queimadores a + quaisquer elementos de construção, decoração + ou mobiliário, inflamáveis deve ser de 0,5 + m, excepto se esses elementos forem + protegidos de forma eficaz com materiais + isolantes térmicos da classe A1, caso em que + a distância pode ser reduzida para 0,25 m. + (Portaria 1352/2008 – Título V Capítulo III + Art. 86º, 6) + + + + A distância mínima dos queimadores a + quaisquer elementos de construção, decoração + ou mobiliário, inflamáveis deve ser de 0,5 + m, excepto se esses elementos forem + protegidos de forma eficaz com materiais + isolantes térmicos da classe A1, caso em que + a distância pode ser reduzida para 0,25 m. + + + Segurança + + + Condições gerais das instalações técnicas - + + Ventilação e Condicionamento de Ar + + + + As condutas de ventilação dos locais de + risco B (e/ou F) não devem servir locais de + risco C. (Portaria 1352/2008 – Título V + Capítulo III Art. 97º, 6) + + + + As condutas de ventilação dos locais de + risco B (e/ou F) não devem servir locais de + risco C. + + + Segurança + + + Risco de contacto com objectos perfurantes + e/ou cortantes + + + + Manter o local de trabalho arrumado ( + + Decreto Lei n.º441/91 – Art.15ºb + + + ) + + + + + Utilizar correctamente, e segundo as + instruções transmitidas pelo empregador, + máquinas, aparelhos, instrumentos, + substâncias perigosas e outros equipamentos + e meios postos à sua disposição, + designadamente os equipamentos de protecção + colectiva e individual, bem como cumprir os + procedimentos de trabalho estabelecidos + + + Segurança + + + Risco de contacto com objectos perfurantes + e/ou cortantes + + + + Assegurar que as vias de passagem se + encontram permanentemente desobstruídas ( + + Portaria n.º987/93 – Art.4º + + + ) + + + + + Assegurar a substituição dos equipamentos + existentes quando se encontrarem degradados + + + Segurança + + + Risco de contacto com objectos perfurantes + e/ou cortantes + + + + Colocar sistemas de iluminação de segurança + (D + + ecreto Lei nº 243/86 – Art. 15º + + + ) + + + + + Manter os objectos arrumados após cada + utilização + + + Segurança + + + Risco de choque contra objectos imóveis + + + + As características das alimentações para + serviços de segurança e alimentações de + socorro devem ser definidas separadamente + sempre que tal seja imposto pelas + autoridades responsáveis pela protecção de + incêndios, pelo dono da instalação ou sempre + que existam condições relativas à evacuação + dos locais em caso de emergência ( + + Portaria nº 949-A – 313.2 + + + ) + + + + + Manter o local de trabalho arrumado + + + Segurança + + + Risco de choque contra objectos imóveis + + + + Nos caminhos de evacuação devem ser + instalados aparelhos de iluminação de + segurança por forma a facilitar a evacuação + de pessoas e a intervenção dos bombeiros. + Esses aparelhos de iluminação devem entrar + automaticamente em serviço em caso de + interrupção da alimentação normal do + edifício ( + + Portaria nº 949-A – 801.5.12.2 + + + ) + + + + + Assegurar que as vias de passagem se + encontram permanentemente desobstruídas + + + Segurança + + + Inexistência de iluminação de emergência de + segurança + + + + O número e a localização dos aparelhos e + iluminação de segurança devem ser escolhidos + tendo em conta as comunicações horizontais + comuns e das escadas e a necessidade de + garantir a visibilidade dos indicativos de + segurança nelas existentes ( + + Portaria nº 949-A – + + + 801.5.12.3 + + + ) + + + + + Colocar sistemas de iluminação de segurança + + + Segurança + + + Inexistência de iluminação de emergência de + segurança + + + + Os aparelhos de iluminação de segurança + podem ser do tipo bloco autónomos ou serem + alimentados por uma fonte central de + segurança ( + + Portaria nº 949-A – 801.5.12.4 + + + ) + + + + + As características das alimentações para + serviços de segurança e alimentações de + socorro devem ser definidas separadamente + sempre que tal seja imposto pelas + autoridades responsáveis pela protecção de + incêndios, pelo dono da instalação ou sempre + que existam condições relativas à evacuação + dos locais em caso de emergência + + + Segurança + + + Inexistência de iluminação de emergência de + segurança + + + + As instalações de iluminação não devem + constituir um factor de risco para os + trabalhadores ( + + Portaria nº 987/93 – 3 + + + ) + + + + + Nos caminhos de evacuação devem ser + instalados aparelhos de iluminação de + segurança por forma a facilitar a evacuação + de pessoas e a intervenção dos bombeiros. + Esses aparelhos de iluminação devem entrar + automaticamente em serviço em caso de + interrupção da alimentação normal do + edifício + + + Segurança + + + Inexistência de iluminação de emergência de + segurança + + + + Quando os materiais se conservem em + embalagens, o empilhamento deve efectuar-se + de forma a oferecer estabilidade: o peso dos + materiais empilhados não deve exceder, mesmo + temporariamente, a sobrecarga prevista para + os pavimentos e não é permitido o + empilhamento de materiais contra paredes ou + divisórias que não se encontrem + dimensionadas para resistir aos esforços + laterais ( + + Decreto Lei nº 243/86 - Art. 35º + + + ) + + + + + O número e a localização dos aparelhos e + iluminação de segurança devem ser escolhidos + tendo em conta as comunicações horizontais + comuns e das escadas e a necessidade de + garantir a visibilidade dos indicativos de + segurança nelas existentes + + + Segurança + + + Inexistência de iluminação de emergência de + segurança + + + + O empilhamento dos materiais ou produtos + deve realizar-se de maneira a que não + prejudique a conveniente distribuição da luz + natural ou artificial, a circulação nas vias + de passagem e o funcionamento dos + equipamentos ou do material de luta contra + incêndios ( + + Decreto Lei nº 243/86 - Art. 35º + + + ) + + + + + Os aparelhos de iluminação de segurança + podem ser do tipo bloco autónomos ou serem + alimentados por uma fonte central de + segurança + + + Segurança + + + Inexistência de iluminação de emergência de + segurança + + + + Os espaços de edifícios, para além de + possuírem iluminação normal, devem também + ser dotados de um sistema de iluminação de + emergência de segurança e, em alguns casos, + de um sistema de iluminação de substituição. + (Portaria 1352/2008 – Título VI Capítulo II + Art. 113º, 1) + + + + Os espaços de edifícios, para além de + possuírem iluminação normal, devem também + ser dotados de um sistema de iluminação de + emergência de segurança e, em alguns casos, + de um sistema de iluminação de substituição. + + + Segurança + + + Inexistência de iluminação de emergência de + segurança + + + + A iluminação de emergência compreende a + iluminação de ambiente, destinada a iluminar + os locais de permanência habitual de + pessoas, evitando situações de pânico e a + iluminação de circulação, com o objectivo de + facilitar a visibilidade no encaminhamento + seguro das pessoas até uma zona de segurança + e, ainda, possibilitar a execução das + manobras respeitantes à segurança e à + intervenção dos meios de socorro. (Portaria + 1352/2008 – Título VI Capítulo II Art. 113º, + 2 a) e b)) + + + + A iluminação de emergência compreende a + iluminação de ambiente, destinada a iluminar + os locais de permanência habitual de + pessoas, evitando situações de pânico e a + iluminação de circulação, com o objectivo de + facilitar a visibilidade no encaminhamento + seguro das pessoas até uma zona de segurança + e, ainda, possibilitar a execução das + manobras respeitantes à segurança e à + intervenção dos meios de socorro. + + + Segurança + + + Inexistência de iluminação de emergência de + segurança + + + + Nos locais de risco B e C, e nas zonas de + vestuários ou sanitários públicos com área + superior a 10 m2 e os destinados a utentes + com mobilidade condicionada, devem ser + instalados aparelhos de iluminação de + ambiente. (Portaria 1352/2008 – Título VI + Capítulo II Art. 113º, 3) + + + + Nos locais de risco B e C, e nas zonas de + vestuários ou sanitários públicos com área + superior a 10 m2 e os destinados a utentes + com mobilidade condicionada, devem ser + instalados aparelhos de iluminação de + ambiente. + + + Segurança + + + Inexistência de iluminação de emergência de + segurança + + + + A iluminação de ambiente deve garantir + níveis de iluminância tão uniformes quanto + possível, com um valor mínimo de 1 lux, + medido no pavimento. (Portaria 1352/2008 – + Título VI Capítulo II Art. 113º, 4) + + + + A iluminação de ambiente deve garantir + níveis de iluminância tão uniformes quanto + possível, com um valor mínimo de 1 lux, + medido no pavimento. + + + Segurança + + + Inexistência de iluminação de emergência de + segurança + + + + Na iluminação de balizagem ou de circulação + os dispositivos devem garantir 5 lux. + + (Portaria 1352/2008 – Título VI Capítulo II + Art. 114º, 5) + + + + Na iluminação de balizagem ou de circulação + os dispositivos devem garantir 5 lux. + + + + Segurança + + + Inexistência de iluminação de emergência de + segurança + + + + Nas salas de espectáculo ou noutros locais + onde seja necessário o obscurecimento total + para o desenvolvimento das actividades + normais, os blocos autónomos, quando + instalados, devem ser sempre do tipo + permanente, independentemente da categoria + de risco. (Portaria 1352/2008 – Título VI + Capítulo II Art. 115º, 1) + + + + Nas salas de espectáculo ou noutros locais + onde seja necessário o obscurecimento total + para o desenvolvimento das actividades + normais, os blocos autónomos, quando + instalados, devem ser sempre do tipo + permanente, independentemente da categoria + de risco. + + + Segurança + + + Inexistência de iluminação de emergência de + segurança + + + + É obrigatória a utilização de blocos + permanentes ou de luz mantida apenas quando + sirva para iluminação de placas indicadoras + de saída ou quando lhes sirva de suporte. + (Portaria 1352/2008 – Título VI Capítulo II + Art. 115º, 2) + + + + É obrigatória a utilização de blocos + permanentes ou de luz mantida apenas quando + sirva para iluminação de placas indicadoras + de saída ou quando lhes sirva de suporte. + + + Segurança + + + Inexistência de iluminação de emergência de + segurança + + + + Nas salas de espectáculos ou noutros locais + onde seja necessário o obscurecimento total + para o desenvolvimento das actividades + normais, os blocos autónomos a que se + referem os n.os 1 e 2 do presente artigo + poderão possuir dispositivo que reduza a sua + intensidade de iluminação durante os + períodos de obscurecimento, desde que + adquiram automaticamente a intensidade de + iluminação normal: Quando for ligada a + iluminação de ambiente e circulação do + espaço que servem e Por accionamento a + partir da central do sistema de alarme. + + + (Portaria 1352/2008 – Título VI Capítulo II + Art. 115º, 3 a) e b)) + + + + Nas salas de espectáculos ou noutros locais + onde seja necessário o obscurecimento total + para o desenvolvimento das actividades + normais, os blocos autónomos a que se + referem os n.os 1 e 2 do presente artigo + poderão possuir dispositivo que reduza a sua + intensidade de iluminação durante os + períodos de obscurecimento, desde que + adquiram automaticamente a intensidade de + iluminação normal: Quando for ligada a + iluminação de ambiente e circulação do + espaço que servem e Por accionamento a + partir da central do sistema de alarme. + + + + Segurança + + Fontes de luz não protegidas + + + As vias de circulação das zonas de risco de + queda de objectos devem encontrar-se + sinalizadas de forma bem visível, sendo o + seu acesso apenas permitido a trabalhadores + devidamente protegidos ( + + Portaria nº 987/93 – Art. 13º - 8 + + + ) + + + + + As instalações de iluminação não devem + constituir um factor de risco para os + trabalhadores + + + Segurança + + + Risco de queda de objectos (existência de + empilhamento) + + + + Os elementos móveis de motor e máquinas + devem encontrar-se convenientemente + protegidos por dispositivos de segurança ( + + Decreto Lei nº 243/86 – Art. 20º + + + ) + + + + + Quando os materiais se conservem em + embalagens, o empilhamento deve efectuar-se + de forma a oferecer estabilidade: o peso dos + materiais empilhados não deve exceder, mesmo + temporariamente, a sobrecarga prevista para + os pavimentos e não é permitido o + empilhamento de materiais contra paredes ou + divisórias que não se encontrem + dimensionadas para resistir aos esforços + laterais + + + Segurança + + + Risco de queda de objectos (existência de + empilhamento) + + + + As instalações frigoríficas devem ser + convenientemente iluminadas e dispor de + espaço suficiente para a inspecção e + manutenção dos condensadores ( + + Decreto Lei nº 243/86 – + + + Art. 30º + + + ) + + + + + O empilhamento dos materiais ou produtos + deve realizar-se de maneira a que não + prejudique a conveniente distribuição da luz + natural ou artificial, a circulação nas vias + de passagem e o funcionamento dos + equipamentos ou do material de luta contra + incêndios + + + Segurança + + + Risco de queda de objectos (existência de + empilhamento) + + + + As portas das instalações frigoríficas devem + possuir fechos que permitam a sua abertura, + tanto do exterior como do interior ( + + Decreto Lei nº 243/86 – Art. 30º + + + ) + + + + + As vias de circulação das zonas de risco de + queda de objectos devem encontrar-se + sinalizadas de forma bem visível, sendo o + seu acesso apenas permitido a trabalhadores + devidamente protegidos + + + Segurança + + + Inexistência de dispositivos de segurança + + + + Quando o trabalho nas instalações + frigoríficas tiver uma certa permanência, + deverá haver câmara intermédia, com ar + condicionado, onde o pessoal possa + reaquecer-se e tomar bebidas e alimentos + quentes ( + + Decreto Lei nº 243/86 – Art. 31º - 1 + + + ) + + + + + Os elementos móveis de motor e máquinas + devem encontrar-se convenientemente + protegidos por dispositivos de segurança + + + Segurança + + Instalações frigoríficas + + + As pessoas que trabalhem no interior de + instalações frigoríficas, em permanência ou + não, devem usar equipamento de protecção + individual adequado ( + + Decreto Lei nº 243/86 – Art. + + + 31º - 1 + + + ) + + + + + As instalações frigoríficas devem ser + convenientemente iluminadas e dispor de + espaço suficiente para a inspecção e + manutenção dos condensadores + + + Segurança + + Instalações frigoríficas + + + Os termoacumuladores eléctricos devem ser + instalados de acordo com o estipulado na + norma portuguesa NP-3401 ( + + Portaria nº 1081/91 – 1º-1 + + + ) + + + + + As portas das instalações frigoríficas devem + possuir fechos que permitam a sua abertura, + tanto do exterior como do interior + + + Segurança + + Instalações frigoríficas + + + A instalação de um termoacumulador só pode + ser efectuada por pessoa ou empresa + qualificada, designada por técnico + responsável, que fornecer ao proprietário do + termoacumulador o duplicado do termo de + responsabilidade com o carimbo comprovativo + da entrega do original na entidade + fiscalizadora ( + + Portaria nº 1081/91 – 2º e + + + 7º + + + ) + + + + + Quando o trabalho nas instalações + frigoríficas tiver uma certa permanência, + deverá haver câmara intermédia, com ar + condicionado, onde o pessoal possa + reaquecer-se e tomar bebidas e alimentos + quentes + + + Segurança + + Instalações frigoríficas + + + Os locais de trabalho ao ar livre devem, na + medida do possível, ser concebidos de forma + que os trabalhadores fiquem protegidos + contra níveis sonoros e influências + atmosféricas nocivos, poluição do ambiente + e, se for caso disso, contra a queda de + materiais e objectos ( + + Portaria nº 987/93 – Art. 23º - 1 + + + ) + + + + + As pessoas que trabalhem no interior de + instalações frigoríficas, em permanência ou + não, devem usar equipamento de protecção + individual adequado + + + Segurança + + + Existência de termoacumulador eléctrico + + + + Os locais de trabalho ao ar livre devem + permitir que os trabalhadores possam, em + situação de emergência, abandoná-los e ser + rapidamente socorridos ( + + Portaria nº 987/93 – + + + Art. 23º - 2 + + + ) + + + + + Os termoacumuladores eléctricos devem ser + instalados de acordo com o estipulado na + norma portuguesa NP-3401 + + + Segurança + + + Existência de termoacumulador eléctrico + + + + O empregador deve fornecer equipamento de + protecção individual e garantir o seu + funcionamento, fornecer e manter disponível + nos locais de trabalho informação adequada + sobre cada equipamento de protecção + individual, informar os trabalhadores dos + riscos contra os quais o equipamento de + protecção individual os visa proteger e + ainda deve assegurar a formação sobre a + utilização dos equipamentos de protecção + individual ( + + Decreto Lei nº 348/93 – Art. 6º + + + ) + + + + + A instalação de um termoacumulador só pode + ser efectuada por pessoa ou empresa + qualificada, designada por técnico + responsável, que fornecer ao proprietário do + termoacumulador o duplicado do termo de + responsabilidade com o carimbo comprovativo + da entrega do original na entidade + fiscalizadora + + + Segurança + + Local de trabalho ao ar livre + + + Os trabalhadores, assim como os seus + representantes, devem dispor de informação + sobre todas as medidas a tomar relativas à + segurança e saúde na utilização dos + equipamentos de protecção individual ( + + Decreto Lei nº 348/93 – Art. 9º + + + ) + + + + + Os locais de trabalho ao ar livre devem, na + medida do possível, ser concebidos de forma + que os trabalhadores fiquem protegidos + contra níveis sonoros e influências + atmosféricas nocivos, poluição do ambiente + e, se for caso disso, contra a queda de + materiais e objectos + + + Segurança + + Local de trabalho ao ar livre + + + Os trabalhadores, assim como os seus + representantes, devem ser consultados sobre + a escolha do equipamento de protecção + individual ( + + Decreto Lei nº 348/93 – Art. 10º + + + ) + + + + + Os locais de trabalho ao ar livre devem + permitir que os trabalhadores possam, em + situação de emergência, abandoná-los e ser + rapidamente socorridos + + + Segurança + + + Inexistência de equipamento de protecção + individual adequado + + + + Os trabalhadores têm de utilizar + correctamente o equipamento de protecção + individual de acordo com as indicações + fornecidas, conservar e manter em bom estado + o equipamento que lhe foi distribuído e + ainda participar de imediato todas as + avarias ou deficiências do equipamento de + que tenha conhecimento ( + + Decreto Lei nº 348/93 – Art. + + + 8º + + + ) + + + + + O empregador deve fornecer equipamento de + protecção individual e garantir o seu + funcionamento, fornecer e manter disponível + nos locais de trabalho informação adequada + sobre cada equipamento de protecção + individual, informar os trabalhadores dos + riscos contra os quais o equipamento de + protecção individual os visa proteger e + ainda deve assegurar a formação sobre a + utilização dos equipamentos de protecção + individual + + + Segurança + + + Inexistência de equipamento de protecção + individual adequado + + + + Todo o equipamento de protecção individual + deve estar conforme com as normas aplicáveis + à sua concepção e fabrico em matéria de + segurança e saúde, ser adequado aos riscos a + prevenir e às condições existentes no local + de trabalho (sem implicar por si próprio um + aumento de risco), atender às exigências + ergonómicas e de saúde do trabalhador e + ainda ser adequado ao seu utilizado ( + + Decreto Lei nº 348/93 – Art. 5º - 1 + + + ) + + + + + Os trabalhadores, assim como os seus + representantes, devem dispor de informação + sobre todas as medidas a tomar relativas à + segurança e saúde na utilização dos + equipamentos de protecção individual + + + Segurança + + + Inexistência de equipamento de protecção + individual adequado + + + + O fabricante (ou o mandatário) do + equipamento de protecção individual tem de + emitir uma declaração de conformidade CE ( + + Portaria nº 1131/93 – Anexo IV + + + ) + + + + + Os trabalhadores, assim como os seus + representantes, devem ser consultados sobre + a escolha do equipamento de protecção + individual + + + Segurança + + + Inexistência de equipamento de protecção + individual adequado + + + + O equipamento de protecção individual é de + uso pessoal ( + + Decreto Lei nº 348/93 – Art. 5º - + + + 3 + + + ) + + + + + Os trabalhadores têm de utilizar + correctamente o equipamento de protecção + individual de acordo com as indicações + fornecidas, conservar e manter em bom estado + o equipamento que lhe foi distribuído e + ainda participar de imediato todas as + avarias ou deficiências do equipamento de + que tenha conhecimento + + + Segurança + + + Inexistência de equipamento de protecção + individual adequado + + + + O equipamento de protecção individual deve + ser usado de acordo com as instruções do + fabricante ( + + Decreto Lei nº 348/93 – Art. 5º - 6 + + + ) + + + + + Todo o equipamento de protecção individual + deve estar conforme com as normas aplicáveis + à sua concepção e fabrico em matéria de + segurança e saúde, ser adequado aos riscos a + prevenir e às condições existentes no local + de trabalho (sem implicar por si próprio um + aumento de risco), atender às exigências + ergonómicas e de saúde do trabalhador e + ainda ser adequado ao seu utilizado + + + Segurança + + + Inexistência de equipamento de protecção + individual adequado + + + + Disponibilizar armários, caixas ou bolsas + com o conteúdo mínimo destinado aos + primeiros socorros, nos vários sectores de + trabalho ( + + Decreto Lei n.º243/86 – Art.º28º-1 + + + ) + + + + + O fabricante (ou o mandatário) do + equipamento de protecção individual tem de + emitir uma declaração de conformidade CE + + + Segurança + + + Inexistência de equipamento de protecção + individual adequado + + + + O número de instalações de primeiros + socorros em cada local de trabalho é + determinado em função do número de + trabalhadores, do tipo de actividade e da + frequência dos acidentes ( + + Portaria nº 987/93 – Art. 21º - 1 + + + ) + + + + + O equipamento de protecção individual é de + uso pessoal + + + Segurança + + + Inexistência de equipamento de protecção + individual adequado + + + + O conteúdo dos armários, caixas ou bolsas, + deve ser mantido em condições de assepsia, + convenientemente conservado, etiquetado e + imediatamente substituído após a sua + utilização ( + + Decreto Lei n.º243/86 – Art.º28º-2) + + + + + O equipamento de protecção individual deve + ser usado de acordo com as instruções do + fabricante + + + Segurança + + + Inexistência de armário, caixa ou bolsa com + conteúdo mínimo destinado aos primeiros + socorros + + + + Devem existir instruções claras e simples + para os primeiros cuidados a pôr em prática + em caso de emergência junto dos armários, + caixas ou bolsas de primeiros socorros ( + + Decreto Lei n.º243/86 – Art.º28º-4) + + + + + Disponibilizar armários, caixas ou bolsas + com o conteúdo mínimo destinado aos + primeiros socorros, nos vários sectores de + trabalho + + + Segurança + + + Inexistência de armário, caixa ou bolsa com + conteúdo mínimo destinado aos primeiros + socorros + + + + O empregador tem de assegurar que os + equipamentos de trabalho são adequados ou + convenientemente adaptados ao trabalho a + efectuar; atender às condições e + características do trabalho e aos riscos + existentes na escolha dos equipamentos de + trabalho; considerar os postos de trabalho, + posição dos trabalhadores e os princípios + ergonómicos no decorrer da utilização dos + equipamentos; e assegurar a sua adequada + manutenção ( + + Decreto Lei nº 50/2005 – Art. 3º + + + ) + + + + + O número de instalações de primeiros + socorros em cada local de trabalho é + determinado em função do número de + trabalhadores, do tipo de actividade e da + frequência dos acidentes + + + Segurança + + + Inexistência de armário, caixa ou bolsa com + conteúdo mínimo destinado aos primeiros + socorros + + + + O empregador deve prestar aos trabalhadores + e seus representantes para a segurança, + higiene e saúde do trabalho a informação + adequada sobre os equipamentos de trabalho + utilizados ( + + Decreto Lei nº 50/2005 – Art. 8º + + + ) + + + + + O conteúdo dos armários, caixas ou bolsas, + deve ser mantido em condições de assepsia, + convenientemente conservado, etiquetado e + imediatamente substituído após a sua + utilização + + + Segurança + + + Inexistência de armário, caixa ou bolsa com + conteúdo mínimo destinado aos primeiros + socorros + + + + O empregador deve consultar por escrito, + previamente e em tempo útil, os + representantes dos trabalhadores ou, na sua + ausência, os trabalhadores sobre os + equipamentos de trabalho utilizados, pelo + menos duas vezes por ano ( + + Decreto Lei nº + + + 50/2005 – Art. 9º + + + ) + + + + + Devem existir instruções claras e simples + para os primeiros cuidados a pôr em prática + em caso de emergência junto dos armários, + caixas ou bolsas de primeiros socorros + + + Segurança + + + Utilização de equipamentos de trabalho + (máquinas, ferramentas ou instalações) + + + + Os sistemas de comando de um equipamento + devem ser claramente visíveis e + identificáveis ( + + Decreto Lei nº 50/2005 – Art. 11º + + + ) + + + + + O empregador tem de assegurar que os + equipamentos de trabalho são adequados ou + convenientemente adaptados ao trabalho a + efectuar; atender às condições e + características do trabalho e aos riscos + existentes na escolha dos equipamentos de + trabalho; considerar os postos de trabalho, + posição dos trabalhadores e os princípios + ergonómicos no decorrer da utilização dos + equipamentos; e assegurar a sua adequada + manutenção + + + Segurança + + + Utilização de equipamentos de trabalho + (máquinas, ferramentas ou instalações) + + + + O equipamento de trabalho deve estar provido + de um sistema de comando que permita a + paragem geral em condições de segurança, bem + como de um dispositivo de paragem de + emergência ( + + Decreto Lei nº 50/2005 – Art. 13º + + + ) + + + + + O empregador deve prestar aos trabalhadores + e seus representantes para a segurança, + higiene e saúde do trabalho a informação + adequada sobre os equipamentos de trabalho + utilizados + + + Segurança + + + Utilização de equipamentos de trabalho + (máquinas, ferramentas ou instalações) + + + + O equipamento de trabalho que provoque + riscos devido a quedas e projecções de + objectos deve dispor de dispositivos de + segurança adequados ( + + Decreto Lei nº 50/2005 – + + + Art. 15º - 1 + + + ) + + + + + O empregador deve consultar por escrito, + previamente e em tempo útil, os + representantes dos trabalhadores ou, na sua + ausência, os trabalhadores sobre os + equipamentos de trabalho utilizados, pelo + menos duas vezes por ano + + + Segurança + + + Utilização de equipamentos de trabalho + (máquinas, ferramentas ou instalações) + + + + O equipamento de trabalho que provoque + riscos devido a emanações de gases, vapores, + líquidos ou poeiras deve dispor de + dispositivos de retenção ou extracção + eficazes, instalados na proximidade da + respectiva fonte ( + + Decreto Lei nº 50/2005 – Art. 15º - 2 + + + ) + + + + + Os sistemas de comando de um equipamento + devem ser claramente visíveis e + identificáveis + + + Segurança + + + Utilização de equipamentos de trabalho + (máquinas, ferramentas ou instalações) + + + + Os elementos móveis de um equipamento de + trabalho que possam causar acidentes por + contacto mecânico devem dispor de + protectores que permitam o acesso às zonas + perigosas ou de dispositivos que interrompam + o movimento dos elementos móveis antes do + acesso a essas zonas ( + + Decreto Lei nº 50/2005 – Art. 16º-1 + + + ) + + + + + O equipamento de trabalho deve estar provido + de um sistema de comando que permita a + paragem geral em condições de segurança, bem + como de um dispositivo de paragem de + emergência + + + Segurança + + + Utilização de equipamentos de trabalho + (máquinas, ferramentas ou instalações) + + + + Cada máquina deve ser acompanhada de um + manual de instruções ( + + Decreto Lei nº + + + 320/2001 – Anexo 1 1.7.4 + + + ) + + + + + O equipamento de trabalho que provoque + riscos devido a quedas e projecções de + objectos deve dispor de dispositivos de + segurança adequados + + + Segurança + + + Utilização de equipamentos de trabalho + (máquinas, ferramentas ou instalações) + + + + O manual de instruções será elaborado, numa + das línguas comunitárias, pelo fabricante ou + pelo seu mandatário estabelecido na + Comunidade. Ao ser posta em serviço, cada + máquina deve ser acompanhada do manual + original e de uma tradução desse manual em + português ( + + Decreto Lei nº 320/2001 – Anexo 1 1.7.4 + + + ) + + + + + O equipamento de trabalho que provoque + riscos devido a emanações de gases, vapores, + líquidos ou poeiras deve dispor de + dispositivos de retenção ou extracção + eficazes, instalados na proximidade da + respectiva fonte + + + Segurança + + + Utilização de equipamentos de trabalho + (máquinas, ferramentas ou instalações) + + + + O manual incluirá (…) todas as instruções + úteis, nomeadamente em matéria de segurança + ( + + Decreto Lei nº 320/2001 – Anexo 1 1.7.4 + + + ) + + + + + Os elementos móveis de um equipamento de + trabalho que possam causar acidentes por + contacto mecânico devem dispor de + protectores que permitam o acesso às zonas + perigosas ou de dispositivos que interrompam + o movimento dos elementos móveis antes do + acesso a essas zonas + + + Segurança + + Utilização de máquinas + + + Cada máquina deve estar equipada com um + órgão de comando que permita a sua paragem + total em condições de segurança ( + + Decreto Lei nº 320/2001 – Anexo 1 2.4 + + + ) + + + + + Cada máquina deve ser acompanhada de um + manual de instruções + + + Segurança + + Utilização de máquinas + + + Cada máquina deve estar equipada com um ou + vários dispositivos de paragem de emergência + por meio do(s) qual(quais) possam ser + evitadas situações de perigo latentes ou + existentes ( + + Decreto Lei nº 320/2001 – Anexo 1 2.4 + + + ) + + + + + O manual de instruções será elaborado, numa + das línguas comunitárias, pelo fabricante ou + pelo seu mandatário estabelecido na + Comunidade. Ao ser posta em serviço, cada + máquina deve ser acompanhada do manual + original e de uma tradução desse manual em + português + + + Segurança + + Utilização de máquinas + + + Os elementos móveis de um equipamento de + trabalho que possam causar acidentes por + contacto mecânico devem dispor de + protectores que impeçam o acesso às zonas + perigosas e/ou dispositivos que interrompam + o movimento dos elementos móveis antes do + acesso a essas zonas ( + + Decreto Lei nº 50/2005 – Art. 16º-1 + + + ) + + + + + O manual incluirá (…) todas as instruções + úteis, nomeadamente em matéria de segurança + + + Segurança + + Utilização de máquinas + + + Os equipamentos de trabalho de elevação de + cargas que estejam instalados + permanentemente devem manter a solidez e + estabilidade durante a sua utilização e ser + instalados de modo a reduzir o risco de as + cargas colidirem com os trabalhadores ( + + Decreto Lei nº 50/2005 – Art. 27º + + + ) + + + + + Cada máquina deve estar equipada com um + órgão de comando que permita a sua paragem + total em condições de segurança + + + Segurança + + Utilização de máquinas + + + Se o equipamento de trabalho não se destinar + à elevação de trabalhadores, deve existir + uma sinalização de proibição adequada ( + + Decreto Lei nº 50/2005 – Art. 28º + + + ) + + + + + Cada máquina deve estar equipada com um ou + vários dispositivos de paragem de emergência + por meio do(s) qual(quais) possam ser + evitadas situações de perigo latentes ou + existentes + + + Segurança + + Utilização de máquinas + + + O empilhador que transporta o operador deve + ser adaptado ou equipado de modo a limitar + os riscos de capotamento ( + + Decreto Lei nº 50/2005 – Art. 25º + + + ) + + + + + Os elementos móveis de um equipamento de + trabalho que possam causar acidentes por + contacto mecânico devem dispor de + protectores que impeçam o acesso às zonas + perigosas e/ou dispositivos que interrompam + o movimento dos elementos móveis antes do + acesso a essas zonas + + + Segurança + + + Utilização de equipamentos de elevação de + cargas + + + + Os equipamentos de trabalho de elevação de + cargas devem ostentar a indicação, de forma + bem visível, da sua carga nominal ( + + Decreto Lei nº 50/2005 – Art. 28º + + + ) + + + + + Os equipamentos de trabalho de elevação de + cargas que estejam instalados + permanentemente devem manter a solidez e + estabilidade durante a sua utilização e ser + instalados de modo a reduzir o risco de as + cargas colidirem com os trabalhadores + + + Segurança + + + Utilização de equipamentos de elevação de + cargas + + + + A elevação de trabalhadores só é permitida + com equipamentos de trabalho e acessórios + destinados a essa finalidade ( + + Decreto Lei nº 50/2005 – Art. 33º + + + ) + + + + + Se o equipamento de trabalho não se destinar + à elevação de trabalhadores, deve existir + uma sinalização de proibição adequada + + + Segurança + + + Utilização de equipamentos de elevação de + cargas + + + + Não podem ser colocados no mercado ou em + serviço os aparelhos de elevação ou de + movimentação ou elementos de construção que + não satisfaçam os procedimentos demais + prescrições aplicáveis às respectivas + categorias ( + + Decreto-Lei nº 286/91 – Art. 4º + + + ) + + + + + O empilhador que transporta o operador deve + ser adaptado ou equipado de modo a limitar + os riscos de capotamento + + + Segurança + + + Utilização de equipamentos de elevação de + cargas + + + + As escadas devem ser colocadas de forma a + garantir a sua estabilidade durante a sua + utilização ( + + Decreto Lei nº 50/2005 – Art. 38 - 1º + + + ) + + + + + Os equipamentos de trabalho de elevação de + cargas devem ostentar a indicação, de forma + bem visível, da sua carga nominal + + + Segurança + + + Utilização de equipamentos de elevação de + cargas + + + + Os apoios das escadas portáteis devem + assentar em suporte estável e resistente, de + dimensão adequada e imóvel ( + + Decreto Lei nº 50/2005 – Art. 38º - 2 + + + ) + + + + + A elevação de trabalhadores só é permitida + com equipamentos de trabalho e acessórios + destinados a essa finalidade + + + Segurança + + + Utilização de equipamentos de elevação de + cargas + + + + As escadas móveis devem ser imobilizadas + antes da sua utilização ( + + Decreto Lei nº + + + 50/2005 – Art. 38º - 6 + + + ) + + + + + Não podem ser colocados no mercado ou em + serviço os aparelhos de elevação ou de + movimentação ou elementos de construção que + não satisfaçam os procedimentos demais + prescrições aplicáveis às respectivas + categorias + + + Segurança + + Utilização de escadas + + + As vias de circulação dos veículos devem ser + identificadas com faixas contínuas, + indissociáveis do pavimento, as quais para + assegurar o contraste bem visível com a cor + do pavimento, podem ser brancas ou amarelas + ( + + Portaria nº 1456-A/95 – Art.10º - 1) + + + + + As escadas devem ser colocadas de forma a + garantir a sua estabilidade durante a sua + utilização + + + Segurança + + Utilização de escadas + + + A localização das faixas deve considerar as + distâncias de segurança necessárias, quer + entre veículos e trabalhadores, quer entre + ambos e os objectos ou instalações que + possam encontrar-se na sua vizinhança ( + + Portaria nº 1456-A/95 – Art.10º - 2) + + + + + Os apoios das escadas portáteis devem + assentar em suporte estável e resistente, de + dimensão adequada e imóvel + + + Segurança + + Utilização de escadas + + + A sinalização dos riscos de choque contra + obstáculos, bem como de queda de objectos ou + de pessoas no interior das zonas da empresa + ou do estabelecimento a que o trabalhador + tenha acesso no âmbito do seu trabalho, é + feita com as cores amarela e negra + alternadas ( + + Portaria nº 1456-A/95 + + + ) + + + + + As escadas móveis devem ser imobilizadas + antes da sua utilização + + + Segurança + + Marcação das vias de circulação + + + O empregador deve avaliar de forma global os + riscos de explosão; a probabilidade de + ocorrência de atmosferas explosivas bem como + a sua duração; a probabilidade de presença + de fontes de ignição e a possibilidade das + mesmas se tornarema activas e causarem + risco; a probabilidade de descargas + eléctricas provenientes dos trabalhadores ou + do ambiente de trabalho; as instalações e + susbtâncias utilizadas, os processos e as + suas eventuais interacções; as áreas que + estejam ou possam estar ligadas àquelas onde + se possam formar atmosferas explosivas e a + amplitude das consequências previsíveis. ( + + Decreto-Lei 236/2003 - Art. 5ª - 1a) + + + ) + + + + + As vias de circulação dos veículos devem ser + identificadas com faixas contínuas, + indissociáveis do pavimento, as quais para + assegurar o contraste bem visível com a cor + do pavimento, podem ser brancas ou amarelas + + + Segurança + + Marcação das vias de circulação + + + O empregador deve prevenir a formação de + atmosferas explosivas através de medidas + organizativas e técnicas e + + apropriadas à natureza das operações. + + ( + + Decreto-Lei 236/2003 + + + - Art. 6ª - 1) + + + + + A localização das faixas deve considerar as + distâncias de segurança necessárias, quer + entre veículos e trabalhadores, quer entre + ambos e os objectos ou instalações que + possam encontrar-se na sua vizinhança + + + Segurança + + Existência de locais perigosos + + + Se, dada a natureza da actividade, for + impossível evitar a formação de atmosferas + explosivas, o empregador deve adoptar + medidas técnicas e organizativas que evitem + a ignição das mesmas e atenuem os efeitos + prejudiciais de uma explosão, de forma a + proteger a vida, a integridade física e a + saúde dos trabalhadores. ( + + Decreto-Lei 236/2003 - + + + Art. 6ª - 2 + + + ) + + + + + A sinalização dos riscos de choque contra + obstáculos, bem como de queda de objectos ou + de pessoas no interior das zonas da empresa + ou do estabelecimento a que o trabalhador + tenha acesso no âmbito do seu trabalho, é + feita com as cores amarela e negra + alternadas + + + Segurança - Gasolineiras + + Medidas de Segurança + + + Deverá ser assegurada a supervisão adequada + durante a presença de trabalhadores nos + locais onde se possam formar atmosferas + explosivas em concentrações susceptíveis de + constituir um risco para a sua segurança e + saúde Seja assegurada, através de meios + técnicos apropriados, a supervisão adequada + durante a presença de trabalhadores nos + locais onde se possam formar atmosferas + explosivas em concentrações susceptíveis de + constituir um risco para a sua segurança e + saúde. ( + + Decreto-Lei 236/2003 - Art. 7ª - a) + + + ) + + + + + O empregador deve avaliar de forma global os + riscos de explosão; a probabilidade de + ocorrência de atmosferas explosivas bem como + a sua duração; a probabilidade de presença + de fontes de ignição e a possibilidade das + mesmas se tornarema activas e causarem + risco; a probabilidade de descargas + eléctricas provenientes dos trabalhadores ou + do ambiente de trabalho; as instalações e + susbtâncias utilizadas, os processos e as + suas eventuais interacções; as áreas que + estejam ou possam estar ligadas àquelas onde + se possam formar atmosferas explosivas e a + amplitude das consequências previsíveis + + + Segurança - Gasolineiras + + Medidas de Segurança + + + Nas áreas onde se possam formar atmosferas + explosivas o empregador deve proceder à sua + classificação + + ( + + Decreto-Lei 236/2003 - Art. 8ª - a) + + + ) + + + + + O empregador deve prevenir a formação de + atmosferas explosivas através de medidas + organizativas e técnicas e + + apropriadas à natureza das operações + + + Segurança - Gasolineiras + + Medidas de Segurança + + + Nas áreas onde se possam formar atmosferas + explosivas o empregador deve sinalizar os + respectivos locais de acesso. + + + + + + Se, dada a natureza da actividade, for + impossível evitar a formação de atmosferas + explosivas, o empregador deve adoptar + medidas técnicas e organizativas que evitem + a ignição das mesmas e atenuem os efeitos + prejudiciais de uma explosão, de forma a + proteger a vida, a integridade física e a + saúde dos trabalhadores + + + Segurança - Gasolineiras + + Medidas de Segurança + + + Nas áreas perigosas, classificadas o + empregador deve tomar as medidas necessárias + para evitar fugas e libertações, + intencionais ou não, de gases, vapores, + névoas inflamáveis ou poeiras combustíveis + que possam dar origem a risco de explosão + sejam desviadas de forma adequada ou + removidas para local seguro ou, se tal não + for praticável, confinadas de forma segura + ou neutralizadas por outro método adequado. + + (Decreto-Lei 236/2003 - Art. 11ª - 1 a)) + + + + Deverá ser assegurada a supervisão adequada + durante a presença de trabalhadores nos + locais onde se possam formar atmosferas + explosivas em concentrações susceptíveis de + constituir um risco para a sua segurança e + saúde Seja assegurada, através de meios + técnicos apropriados, a supervisão adequada + durante a presença de trabalhadores nos + locais onde se possam formar atmosferas + explosivas em concentrações susceptíveis de + constituir um risco para a sua segurança e + saúde + + + Segurança - Gasolineiras + + Medidas de Segurança + + + Nas áreas perigosas, classificadas o + empregador deve tomar as medidas necessárias + para que os trabalhadores disponham de + vestuário de trabalho adequado, constituído + por materiais que não originem descargas + electrostáticas susceptíveis de inflamar + atmosferas explosivas. Decreto-Lei 236/2003 + - Art. 11ª - 1 b)) + + + + Nas áreas onde se possam formar atmosferas + explosivas o empregador deve proceder à sua + classificação + + + Segurança - Gasolineiras + + Medidas de Segurança + + + Nas áreas perigosas, classificadas o + empregador deve tomar as medidas necessárias + para que os trabalhadores + + sejam alertados por sinais ópticos e ou + acústicos da necessidade de abandonarem o + local de trabalho antes de se verificarem as + condições susceptíveis de originar uma + explosão. + + ( + + Decreto-Lei 236/2003 - Art. 11 -1 f) + + + ) + + + + + Nas áreas onde se possam formar atmosferas + explosivas o empregador deve sinalizar os + respectivos locais de acesso + + + Segurança - Gasolineiras + + Medidas de Segurança + + + O empregador deve proporcionar aos + trabalhadores que prestam serviço em áreas + onde se possam formar atmosferas explosivas + uma formação adequada à protecção contra + explosões. (Decreto-Lei 236/2003 - Art. 15ª + - 1) + + + + Nas áreas perigosas, classificadas o + empregador deve tomar as medidas necessárias + para evitar fugas e libertações, + intencionais ou não, de gases, vapores, + névoas inflamáveis ou poeiras combustíveis + que possam dar origem a risco de explosão + sejam desviadas de forma adequada ou + removidas para local seguro ou, se tal não + for praticável, confinadas de forma segura + ou neutralizadas por outro método adequado + + + Segurança - Gasolineiras + + Medidas de Segurança + + + O abastecimento só pode ser iniciado após a + paragem corte da ignição dos veículos + rodoviários situados na zona de segurança da + unidade de abastecimento ( + + Portaria nº + + + 131/2002 – art. 46º - 1) + + + + + Nas áreas perigosas, classificadas o + empregador deve tomar as medidas necessárias + para que os trabalhadores disponham de + vestuário de trabalho adequado, constituído + por materiais que não originem descargas + electrostáticas susceptíveis de inflamar + atmosferas explosivas + + + Segurança - Gasolineiras + + Medidas de Segurança + + + São proibidos todos os fogos nus dentro das + zonas de segurança dos postos de + abastecimento, bem como dos respectivos + acessórios eléctricos que, embora com a + ignição cortada, permaneçam sob tensão ( + + Portaria nº 131/2002 – art. 46º - 2) + + + + + Nas áreas perigosas, classificadas o + empregador deve tomar as medidas necessárias + para que os trabalhadores + + sejam alertados por sinais ópticos e ou + acústicos da necessidade de abandonarem o + local de trabalho antes de se verificarem as + condições susceptíveis de originar uma + explosão + + + Segurança - Gasolineiras + + Medidas de Segurança + + + Durante a operação de reabastecimento dos + reservatórios, a área de estacionamento onde + permanece o veículo-cisterna deve estar + sinalizado (Portaria nº 131/2002 – art. 46º + - 4) + + + + O empregador deve proporcionar aos + trabalhadores que prestam serviço em áreas + onde se possam formar atmosferas explosivas + uma formação adequada à protecção contra + explosões + + + Segurança - Gasolineiras + + Medidas de Segurança + + + Devem ser afixadas nas instalações do posto + de abastecimento (junto aos equipamentos de + abastecimento ou à entrada das zonas de + segurança), de maneira que fiquem bem + visíveis pelos funcionários que entrem na + área de abastecimento, as condições de + exploração e as medidas de segurança a + respeitar ( + + Portaria nº 131/2002 – art. 47º - 1 e + + + 2 + + + ) + + + + + O abastecimento só pode ser iniciado após a + paragem corte da ignição dos veículos + rodoviários situados na zona de segurança da + unidade de abastecimento + + + Segurança - Gasolineiras + + Medidas de Segurança + + + Devem ser afixadas nas instalações do posto + de abastecimento, de maneira que fiquem bem + visíveis pelos funcionários, as medidas a + tomar em caso de acidente ou incidente, + manual de operações e um plano de combate a + incêndios ( + + Portaria nº 131/2002 – art. 47º + + + - 3 + + + ) + + + + + São proibidos todos os fogos nus dentro das + zonas de segurança dos postos de + abastecimento, bem como dos respectivos + acessórios eléctricos que, embora com a + ignição cortada, permaneçam sob tensão + + + Segurança - Gasolineiras + + Medidas de Segurança + + + Cada ilha de abastecimento de gasolina ou de + gasóleo deverá estar equipada com pelo menos + dois extintores (6 Kg cada) de pó químico + seco do tipo ABC ( + + Portaria nº 131/2002 + + + – art. 50º -1) + + + + + Durante a operação de reabastecimento dos + reservatórios, a área de estacionamento onde + permanece o veículo-cisterna deve estar + sinalizado + + + Segurança - Gasolineiras + + Avisos + + + O posto de abastecimento deverá, ainda, + dispor de recipientes amovíveis com areia + seca em quantidade suficiente para cobrir + fugas acidentais de combustíveis líquidos, + com um mínimo de um balde por cada unidade + de abastecimento ( + + Portaria nº 131/2002 – art. 50º + + + -2 + + + ) + + + + + Devem ser afixadas nas instalações do posto + de abastecimento (junto aos equipamentos de + abastecimento ou à entrada das zonas de + segurança), de maneira que fiquem bem + visíveis pelos funcionários que entrem na + área de abastecimento, as condições de + exploração e as medidas de segurança a + respeitar + + + Segurança - Gasolineiras + + Avisos + + + Cada unidade de abastecimento de GPL deve + estar equipada com pelos menos dois + extintores (6 Kg cada) de pó químico seco do + tipo ABC ( + + Portaria nº 131/2002 – art. 50º -3) + + + + + Devem ser afixadas nas instalações do posto + de abastecimento, de maneira que fiquem bem + visíveis pelos funcionários, as medidas a + tomar em caso de acidente ou incidente, + manual de operações e um plano de combate a + incêndios + + + Segurança - Gasolineiras + + Material de combate a incêndios + + + Na proximidade imediata do local onde se + encontra a válvula de enchimento e restantes + jogos de válvulas de um reservatório de GPL + deverão existir pelo menos dois extintores + (6 Kg cada) de pó químico seco do tipo ABC ( + + Portaria nº 131/2002 – art. 50º -4 + + + ) + + + + + Cada ilha de abastecimento de gasolina ou de + gasóleo deverá estar equipada com pelo menos + dois extintores (6 Kg cada) de pó químico + seco do tipo ABC + + + Segurança - Gasolineiras + + Material de combate a incêndios + + + A instalação eléctrica deverá ser + convenientemente conservada e mantida em + conformidade com o Regulamento de Segurança + de Instalações de Utilização de Energia + Eléctrica e Instalações Colectivas de + Edifícios e Entradas ( + + Portaria n.º987/93 – art.3º-1 + + + ) + + + + + O posto de abastecimento deverá, ainda, + dispor de recipientes amovíveis com areia + seca em quantidade suficiente para cobrir + fugas acidentais de combustíveis líquidos, + com um mínimo de um balde por cada unidade + de abastecimento + + + Segurança - Gasolineiras + + Material de combate a incêndios + + + Deve existir no edifício integrado, junto ao + funcionário, um botão de emergência que + corte a energia eléctrica a partir do quadro + geral ( + + Portaria nº 131/2002 – art.43 + + + ) + + + + + Cada unidade de abastecimento de GPL deve + estar equipada com pelos menos dois + extintores (6 Kg cada) de pó químico seco do + tipo ABC + + + Segurança - Gasolineiras + + Material de combate a incêndios + + + As unidades de abastecimento de GPL devem + ser assistidas por um funcionário, + responsável pelas operações de abastecimento + ( + + Decreto Lei nº 246/92 – art. 45º + + + ) + + + + + Na proximidade imediata do local onde se + encontra a válvula de enchimento e restantes + jogos de válvulas de um reservatório de GPL + deverão existir pelo menos dois extintores + (6 Kg cada) de pó químico seco do tipo ABC + + + Segurança - Gasolineiras + + Risco de contacto eléctrico + + + As entidades empregadoras devem garantir a + prevenção médica adequada a todos os seus + trabalhadores expostos, compreendendo os + exames médicos de pré-colocação e + periódicos, bem como a avaliação de + indicadores biológicos ( + + Decreto-lei n.º274/89 – + + + art.11º-1 + + + ) + + + + + A instalação eléctrica deverá ser + convenientemente conservada e mantida em + conformidade com o Regulamento de Segurança + de Instalações de Utilização de Energia + Eléctrica e Instalações Colectivas de + Edifícios e Entradas + + + Segurança - Gasolineiras + + Risco de contacto eléctrico + + + A vigilância médica deve compreender a + determinação de chumbo no sangue (plumbémia) + e, sempre que o médico responsável o + prescreva, a determinação da protoporfirina + de zinco no sangue (PPZ), do ácido + delta-aminolevulínico na urina (ALAU) e da + desidratase do ácido delta-aminolevulínico + no sangue (ALAD) ( + + Decreto-lei n.º274/89 – + + + art.11º-3 + + + ) + + + + + Deve existir no edifício integrado, junto ao + funcionário, um botão de emergência que + corte a energia eléctrica a partir do quadro + geral + + + Segurança - Gasolineiras + + + Pessoa responsável pelo abastecimento GPL + + + + Disponibilizar cópia das fichas de dados de + segurança no local de armazenagem e de + utilização, de modo a que os trabalhadores + estejam familiarizados com as medidas de + actuação em caso de emergência ( + + Lei nº99/03 – Art.275º - 1 + + + ) + + + + + As unidades de abastecimento de GPL devem + ser assistidas por um funcionário, + responsável pelas operações de abastecimento + + + Segurança - Gasolineiras + + + Risco de exposição a agentes químicos + (chumbo e seus compostos) + + + + É proibido fumar (…) nos locais de trabalho, + sendo admitido fumar nas áreas ao ar livre, + com excepção das zonas onde se realize o + abastecimento de veículos ( + + Lei nº 37/2007 – + + + Art. 4 e 5 + + + ) + + + + + As entidades empregadoras devem garantir a + prevenção médica adequada a todos os seus + trabalhadores expostos, compreendendo os + exames médicos de pré-colocação e + periódicos, bem como a avaliação de + indicadores biológicos + + + Segurança - Gasolineiras + + + Risco de exposição a agentes químicos + (chumbo e seus compostos) + + + + Os trabalhadores devem ter calçado + anti-estático e roupa de trabalho adequada + feita de materiais que não dêem lugar a + descargas electrostáticas que possam causar + a ignição de atmosferas explosivas + + + + A vigilância médica deve compreender a + determinação de chumbo no sangue (plumbémia) + e, sempre que o médico responsável o + prescreva, a determinação da protoporfirina + de zinco no sangue (PPZ), do ácido + delta-aminolevulínico na urina (ALAU) e da + desidratase do ácido delta-aminolevulínico + no sangue (ALAD) + + + Segurança - Gasolineiras + + + Risco de exposição a substâncias químicas + perigosas, tais como gasolina e gasóleo + + + + A instalação, os equipamentos, os sistemas + de protecção e os seus correspondentes + dispositivos de ligação à terra destinados a + funcionar em zonas classificadas só se + colocarão em funcionamento se o seu manual + de instruções indicar que se podem usar com + segurança numa atmosfera explosiva e possuam + a marcação EX + + + + Disponibilizar cópia das fichas de dados de + segurança no local de armazenagem e de + utilização, de modo a que os trabalhadores + estejam familiarizados com as medidas de + actuação em caso de emergência + + + Segurança - Gasolineiras + + + Exposição involuntária ao fumo do tabaco + + + + Devem-se adoptar todas as medidas + necessárias para assegurar de que as + instalações, os equipamentos e os + correspondentes dispositivos de ligação que + se encontram à disposição dos trabalhadores + e dos clientes foram concebidos, + construídos, montados e instalados e se + mantêm e utilizam de tal forma que, se + reduzam ao máximo os riscos de explosão e, + no caso de que se produza alguma, se + controle ou se reduza ao máximo a sua + propagação + + + + É proibido fumar (…) nos locais de trabalho, + sendo admitido fumar nas áreas ao ar livre, + com excepção das zonas onde se realize o + abastecimento de veículos + + + Segurança - Gasolineiras + + Atmosferas explosivas + + + Os níveis de concentração de substâncias + nocivas existentes no ar não podem + ultrapassar os definidos em legislação + específica ( + + Portaria nº 987/93 – Art.6º - 5 + + + ) + + + + + Os trabalhadores devem ter calçado + anti-estático e roupa de trabalho adequada + feita de materiais que não dêem lugar a + descargas electrostáticas que possam causar + a ignição de atmosferas explosivas + + + Segurança - Gasolineiras + + Atmosferas explosivas + + + O empregador deve assegurar que as + exposições aos agentes químicos, físicos e + biológicos nos locais de trabalho não + constituam risco para a saúde dos + trabalhadores ( + + Lei nº 99/03 – Art.273º -2c + + + ) + + + + + A instalação, os equipamentos, os sistemas + de protecção e os seus correspondentes + dispositivos de ligação à terra destinados a + funcionar em zonas classificadas só se + colocarão em funcionamento se o seu manual + de instruções indicar que se podem usar com + segurança numa atmosfera explosiva e possuam + a marcação EX + + + Segurança - Gasolineiras + + Atmosferas explosivas + + + Os novos edifícios a construir devem ser + dotados de meios naturais, mecânicos ou + híbridos que garantam o valor mínimo de + renovação do ar por espaço, em função da sua + utilização e do tipo de fontes poluentes + nele existentes, nomeadamente as derivadas + dos materiais de construção aplicados ( + + Decreto Lei nº 79/2006 – Art.12º e 4º + + + ) + + + + + Devem-se adoptar todas as medidas + necessárias para assegurar de que as + instalações, os equipamentos e os + correspondentes dispositivos de ligação que + se encontram à disposição dos trabalhadores + e dos clientes foram concebidos, + construídos, montados e instalados e se + mantêm e utilizam de tal forma que, se + reduzam ao máximo os riscos de explosão e, + no caso de que se produza alguma, se + controle ou se reduza ao máximo a sua + propagação + + + Higiene + + Substâncias nocivas no ar + + + Em todos os edifícios de serviços durante o + seu funcionamento normal, devem ser + consideradas as concentrações máximas das + concentrações de algumas substâncias + poluentes do ar interior dos edifícios ( + + Decreto Lei nº 79/2006 – Art.12º- 2 + + + ) + + + + + Os níveis de concentração de substâncias + nocivas existentes no ar não podem + ultrapassar os definidos em legislação + específica + + + Higiene + + Substâncias nocivas no ar + + + Nos edifícios de serviços existentes dotados + de sistemas de climatização, devem ser + efectuadas auditorias à Qualidade do Ar + Interior, com periodicidade e complexidade + adequadas ao tipo e à dimensão do edifício ( + + Decreto Lei nº 79/2006 – Art.12º- 3 + + + ) + + + + + O empregador deve assegurar que as + exposições aos agentes químicos, físicos e + biológicos nos locais de trabalho não + constituam risco para a saúde dos + trabalhadores + + + Higiene + + + Existência de sistema de climatização + + + + Nas auditorias à Qualidade do ar Interior, + devem ser medidas as concentrações de todos + os poluentes, bem como quando se justifique, + efectuadas medições adicionais de outros + poluentes perigosos, químicos ou + bacteriológicos ( + + Decreto Lei nº 79/2006 – Art.12º- 4 + + + ) + + + + + Os novos edifícios a construir devem ser + dotados de meios naturais, mecânicos ou + híbridos que garantam o valor mínimo de + renovação do ar por espaço, em função da sua + utilização e do tipo de fontes poluentes + nele existentes, nomeadamente as derivadas + dos materiais de construção aplicados + + + Higiene + + + Existência de sistema de climatização + + + + Quando forem detectadas concentrações mais + elevadas do que as concentrações máximas de + referência, o proprietário ou o titular do + contrato de locação ou arrendamento do + edifício deve preparar um plano de acções + correctivas da Qualidade do Ar Interior no + prazo máximo de 30 dias a contar da data de + conclusão da auditoria, submetendo-o à + aprovação do Instituto do Ambiente e deve + ainda apresentar os resultados da nova + auditoria que comprove que a Qualidade do Ar + Interior desse edifício passou a estar de + acordo com as concentrações máximas de + referência no prazo de 30 dias após a + implementação do referido plano ( + + Decreto Lei nº 79/2006 – Art.12º- 6 + + + ) + + + + + Em todos os edifícios de serviços durante o + seu funcionamento normal, devem ser + consideradas as concentrações máximas das + concentrações de algumas substâncias + poluentes do ar interior dos edifícios + + + Higiene + + + Existência de sistema de climatização + + + + Todos os sistemas energéticos dos edifícios + devem ser mantidos e condições adequadas de + operação para garantir o respectivo + funcionamento optimizado e permitir alcançar + os objectivos pretendidos de conforto + ambiental, de Qualidade do Ar Interior e de + eficiência energética ( + + Decreto Lei nº 79/2006 – Art.19º- 1 + + + ) + + + + + Nos edifícios de serviços existentes dotados + de sistemas de climatização, devem ser + efectuadas auditorias à Qualidade do Ar + Interior, com periodicidade e complexidade + adequadas ao tipo e à dimensão do edifício + + + Higiene + + + Existência de sistema de climatização + + + + As instalações e equipamentos devem possuir + um plano de manutenção preventiva que + estabeleça claramente as tarefas de + manutenção previstas, nomeadamente o registo + das análises periódicas da Qualidade do Ar + Interior, com indicação do técnico ou + técnicos que as realizaram ( + + Decreto Lei nº 79/2006 – Art.19º- 2 + + + ) + + + + + Nas auditorias à Qualidade do ar Interior, + devem ser medidas as concentrações de todos + os poluentes, bem como quando se justifique, + efectuadas medições adicionais de outros + poluentes perigosos, químicos ou + bacteriológicos + + + Higiene + + + Existência de sistema de climatização + + + + Em edifícios com sistemas de climatização em + que haja produção de aerossóis ou com + sistemas de água quente para chuveiros onde + a temperatura de armazenamento seja inferior + a 60ºC, as auditorias da Qualidade do Ar + Interior incluem também a pesquisa da + presença de colónias de Legionella em + amostras de água recolhidas nos locais de + maior risco ( + + Decreto Lei nº 79/2006 – Art.29º- 9 + + + ) + + + + + Quando forem detectadas concentrações mais + elevadas do que as concentrações máximas de + referência, o proprietário ou o titular do + contrato de locação ou arrendamento do + edifício deve preparar um plano de acções + correctivas da Qualidade do Ar Interior no + prazo máximo de 30 dias a contar da data de + conclusão da auditoria, submetendo-o à + aprovação do Instituto do Ambiente e deve + ainda apresentar os resultados da nova + auditoria que comprove que a Qualidade do Ar + Interior desse edifício passou a estar de + acordo com as concentrações máximas de + referência no prazo de 30 dias após a + implementação do referido plano + + + Higiene + + + Existência de sistema de climatização + + + + As instalações de iluminação não devem + constituir um factor de risco para os + trabalhadores ( + + Portaria nº 987/93 – Art.8º - 3 + + + ) + + + + + Todos os sistemas energéticos dos edifícios + devem ser mantidos e condições adequadas de + operação para garantir o respectivo + funcionamento optimizado e permitir alcançar + os objectivos pretendidos de conforto + ambiental, de Qualidade do Ar Interior e de + eficiência energética + + + Higiene + + + Existência de sistema de climatização + + + + As janelas, clarabóias e paredes + envidraçadas não devem permitir uma + excessiva exposição ao sol, tendo em conta o + tipo de trabalho e a natureza do local de + trabalho ( + + Portaria nº 987/93 – Art.7º - 3 + + + ) + + + + + As instalações e equipamentos devem possuir + um plano de manutenção preventiva que + estabeleça claramente as tarefas de + manutenção previstas, nomeadamente o registo + das análises periódicas da Qualidade do Ar + Interior, com indicação do técnico ou + técnicos que as realizaram + + + Higiene + + + Existência de sistema de climatização + + + + As fontes de iluminação devem ser de + intensidade uniforme e não devem provocar + contrastes muito acentuados, encandeamento, + excessivo aquecimento, cheiros, fumos ou + gases incómodos, tóxicos ou perigosos ( + + Decreto Lei nº 243/86 – Art. 14º + + + ) + + + + + Em edifícios com sistemas de climatização em + que haja produção de aerossóis ou com + sistemas de água quente para chuveiros onde + a temperatura de armazenamento seja inferior + a 60ºC, as auditorias da Qualidade do Ar + Interior incluem também a pesquisa da + presença de colónias de Legionella em + amostras de água recolhidas nos locais de + maior risco + + + Higiene + + + Risco de exposição a condições inadequadas + de iluminação + + + + O valor medido de iluminância em condições + normais de utilização na área do posto de + trabalho onde é desenvolvida maior exigência + visual (lux) e na área imediatamente + envolvente ( lux) está de acordo com o + mínimo recomendável (lux e lux, + respectivamente) + + (ISO 8995 – The lighting indoor of work + places + + + ) + + + + + As instalações de iluminação não devem + constituir um factor de risco para os + trabalhadores + + + Higiene + + + Risco de exposição a condições inadequadas + de iluminação + + + + De forma a garantir que as tarefas são + realizadas de forma fácil e confortável, + deverão ser considerados aspectos tais como + a distribuição da iluminação, a iluminação, + o brilho, a direcção da luz, o aspecto da + cor da luz e das superfícies, a cintilação, + a luz natural existente, a respectiva + manutenção, as propriedades intrínsecas das + tarefas e a capacidade visual do trabalhador + + (ISO 8995 – The lighting indoor of work + places + + + ) + + + + + As janelas, clarabóias e paredes + envidraçadas não devem permitir uma + excessiva exposição ao sol, tendo em conta o + tipo de trabalho e a natureza do local de + trabalho + + + Higiene + + + Risco de exposição a condições inadequadas + de iluminação + + + + A temperatura e a humidade dos locais de + trabalho devem ser adequadas ao organismo + humano, levados em conta os métodos de + trabalho e os condicionalismos físicos + impostos aos trabalhadores ( + + Portaria nº 987/93 – Art.7º - 1 + + + ) + + + + + As fontes de iluminação devem ser de + intensidade uniforme e não devem provocar + contrastes muito acentuados, encandeamento, + excessivo aquecimento, cheiros, fumos ou + gases incómodos, tóxicos ou perigosos + + + Higiene + + + Risco de exposição a condições inadequadas + de iluminação + + + + Os postos de trabalho devem estar instalados + em locais com isolamento térmico compatível + com o tipo de actividade desenvolvida e o + esforço físico exigido aos trabalhadores ( + + Portaria nº 987/93 – Art.9º + + + ) + + + + + O valor medido de iluminância em condições + normais de utilização na área do posto de + trabalho onde é desenvolvida maior exigência + visual (lux) e na área imediatamente + envolvente ( lux) está de acordo com o + mínimo recomendável (lux e lux, + respectivamente) + + + Higiene + + + Risco de exposição a condições inadequadas + de iluminação + + + + O valor de temperatura (…ºC) encontra-se de + acordo com os recomendados (18 a 22ºC, + podendo atingir os 25ºC em determinadas + condições climatéricas) ( + + Decreto Lei n.º243/86 + + + – Art.11º-1a) + + + + + De forma a garantir que as tarefas são + realizadas de forma fácil e confortável, + deverão ser considerados aspectos tais como + a distribuição da iluminação, a iluminação, + o brilho, a direcção da luz, o aspecto da + cor da luz e das superfícies, a cintilação, + a luz natural existente, a respectiva + manutenção, as propriedades intrínsecas das + tarefas e a capacidade visual do trabalhador + + + Higiene + + Risco de desconforto térmico + + + A humidade relativa da atmosfera de trabalho + (55%) está de acordo com os valores + recomendados (50 a 70%) + + (Decreto-Lei n.º243/86 – Art.11º- 1b) + + + + + A temperatura e a humidade dos locais de + trabalho devem ser adequadas ao organismo + humano, levados em conta os métodos de + trabalho e os condicionalismos físicos + impostos aos trabalhadores + + + Higiene + + Risco de desconforto térmico + + + A velocidade do ar não deve ser superior a + 0,2 m/s ( + + Decreto Lei nº 79/2006 – Art.4º - 1 + + + ) + + + + + Os postos de trabalho devem estar instalados + em locais com isolamento térmico compatível + com o tipo de actividade desenvolvida e o + esforço físico exigido aos trabalhadores + + + Higiene + + Risco de desconforto térmico + + + As condições ambientes de conforto de + referência são uma temperatura do ar de 20ºC + para a estação de aquecimento e uma + temperatura do ar de 25ºC e 50% de humidade + relativa para a estação de arrefecimento ( + + Decreto-Lei nº 80/2006 – Art.14º + + + ) + + + + + O valor de temperatura (…ºC) encontra-se de + acordo com os recomendados (18 a 22ºC, + podendo atingir os 25ºC em determinadas + condições climatéricas) + + + Higiene + + Risco de desconforto térmico + + + A taxa de referência para a renovação do ar, + para garantia da qualidade do ar interior, é + de 0,6 renovações por hora, devendo as + soluções construtivas adoptadas para o + edifício ou fracção autónoma, dotados ou não + de sistemas mecânicos de ventilação, + garantir a satisfação desse valor sob + condições médias de funcionamento ( + + Decreto-Lei nº 80/2006 – + + + Art.14º + + + ) + + + + + A humidade relativa da atmosfera de trabalho + (55%) está de acordo com os valores + recomendados (50 a 70%) + + + Higiene + + Risco de desconforto térmico + + + Nas actividades susceptíveis de apresentar + riscos de exposição ao ruído, o empregador + deve avaliar e, se necessário, medir os + níveis de ruído a que os trabalhadores se + encontram expostos ( + + Decreto Lei nº 182/2006 - Art.4º 1 + + + ) + + + + + A velocidade do ar não deve ser superior a + 0,2 m/s + + + Higiene + + Risco de desconforto térmico + + + A avaliação de riscos é actualizada sempre + que haja alterações significativas, + nomeadamente a criação ou a modificação de + postos de trabalho, ou se o resultado da + vigilância da saúde demonstrar a necessidade + de nova avaliação ( + + Decreto Lei nº + + + 182/2006 - Art.5º 2 + + + ) + + + + + As condições ambientes de conforto de + referência são uma temperatura do ar de 20ºC + para a estação de aquecimento e uma + temperatura do ar de 25ºC e 50% de humidade + relativa para a estação de arrefecimento + + + Higiene + + Risco de desconforto térmico + + + Sempre que seja atingido ou excedido o valor + de acção superior (85 dB (A) e 137 dB (C)), + a periodicidade mínima da avaliação de + riscos é de um ano ( + + Decreto Lei nº 182/2006 + + + -Art.5º 2 + + + ) + + + + + A taxa de referência para a renovação do ar, + para garantia da qualidade do ar interior, é + de 0,6 renovações por hora, devendo as + soluções construtivas adoptadas para o + edifício ou fracção autónoma, dotados ou não + de sistemas mecânicos de ventilação, + garantir a satisfação desse valor sob + condições médias de funcionamento + + + Higiene + + Risco de exposição ao ruído + + + O empregador utiliza todos os meios + disponíveis para eliminar na fonte ou + reduzir ao mínimo os riscos resultantes da + exposição dos trabalhadores ao ruído, de + acordo com os princípios gerais de prevenção + legalmente estabelecidos ( + + Decreto Lei nº 182/2006 -Art. + + + 6º 1 + + + ) + + + + + Nas actividades susceptíveis de apresentar + riscos de exposição ao ruído, o empregador + deve avaliar e, se necessário, medir os + níveis de ruído a que os trabalhadores se + encontram expostos + + + Higiene + + Risco de exposição ao ruído + + + Nos locais de trabalho onde os trabalhadores + possam estar expostos a níveis de ruído + acima dos valores de acção superior (85 dB + (A) e 137 dB (C)), o empregador estabelece e + aplica um programa de medidas técnicas e + organizacionais (…) ( + + Decreto Lei nº 182/2006 + + + -Art. 6º 3 + + + ) + + + + + A avaliação de riscos é actualizada sempre + que haja alterações significativas, + nomeadamente a criação ou a modificação de + postos de trabalho, ou se o resultado da + vigilância da saúde demonstrar a necessidade + de nova avaliação + + + Higiene + + Risco de exposição ao ruído + + + Os locais de trabalho onde os trabalhadores + possam estar expostos a níveis de ruído + acima dos valores de acção superior (85 dB + (A) e 137 dB (C)) devem estar sinalizados + (…) e ser delimitado e o acesso aos mesmos + ser restrito, sempre que seja tecnicamente + possível e o risco de exposição o justifique + ( + + Decreto Lei nº 182/2006 -Art. 6º 4 + + + ) + + + + + Sempre que seja atingido ou excedido o valor + de acção superior (85 dB (A) e 137 dB (C)), + a periodicidade mínima da avaliação de + riscos é de um ano + + + Higiene + + Risco de exposição ao ruído + + + Nas situações em que os riscos resultantes + da exposição ao ruído não possam ser + evitados por outros meios, o empregador põe + à disposição dos trabalhadores equipamentos + de protecção individual no trabalho que + obedeçam à legislação aplicável e sejam + seleccionados, no que respeita à atenuação + que proporcionam (…) ( + + Decreto Lei nº + + + 182/2006 -Art. 7º 1 + + + ) + + + + + O empregador utiliza todos os meios + disponíveis para eliminar na fonte ou + reduzir ao mínimo os riscos resultantes da + exposição dos trabalhadores ao ruído, de + acordo com os princípios gerais de prevenção + legalmente estabelecidos + + + Higiene + + Risco de exposição ao ruído + + + O empregador deve colocar à disposição dos + trabalhadores protectores auditivos + individuais sempre que seja ultrapassado um + dos valores de acção inferiores (80 dB (A) e + 135 dB (C)) ( + + Decreto Lei nº 182/2006 -Art. 7º 2a + + + ) + + + + + Nos locais de trabalho onde os trabalhadores + possam estar expostos a níveis de ruído + acima dos valores de acção superior (85 dB + (A) e 137 dB (C)), o empregador estabelece e + aplica um programa de medidas técnicas e + organizacionais (…) + + + Higiene + + Risco de exposição ao ruído + + + O empregador deve assegurar a utilização + pelos trabalhadores de protectores auditivos + individuais sempre que o nível de exposição + ao ruído iguale ou ultrapasse os valores de + acção superiores (85 dB (A) e 137 dB (C)) ( + + Decreto Lei nº 182/2006 -Art. 7º 2b + + + ) + + + + + Os locais de trabalho onde os trabalhadores + possam estar expostos a níveis de ruído + acima dos valores de acção superior (85 dB + (A) e 137 dB (C)) devem estar sinalizados + (…) e ser delimitado e o acesso aos mesmos + ser restrito, sempre que seja tecnicamente + possível e o risco de exposição o justifique + + + Higiene + + Risco de exposição ao ruído + + + O empregador assegura que a exposição dos + trabalhadores ao ruído durante o trabalho + seja reduzida ao nível mais baixo possível + e, em qualquer caso, não superior aos + valores limite de exposição de 87 dB (A) e + 140 dB (C) ( + + Decreto Lei nº 182/2006 -Art. 8º 1 + + + ) + + + + + Nas situações em que os riscos resultantes + da exposição ao ruído não possam ser + evitados por outros meios, o empregador põe + à disposição dos trabalhadores equipamentos + de protecção individual no trabalho que + obedeçam à legislação aplicável e sejam + seleccionados, no que respeita à atenuação + que proporcionam (…) + + + Higiene + + Risco de exposição ao ruído + + + Nas situações em que sejam ultrapassados os + valores limite de exposição (87 dB (A) e 140 + dB (C)) o empregador toma medidas que + reduzam a exposição de modo a não exceder os + valores limite de exposição (87 dB (A) e 140 + dB (C)), identifica as causas da + ultrapassagem dos valores limite e corrige + as medidas de protecção e prevenção de modo + a evitar a ocorrência de situações idênticas + ( + + Decreto Lei nº 182/2006 -Art. 8º 2 + + + ) + + + + + O empregador deve colocar à disposição dos + trabalhadores protectores auditivos + individuais sempre que seja ultrapassado um + dos valores de acção inferiores (80 dB (A) e + 135 dB (C)) + + + Higiene + + Risco de exposição ao ruído + + + O empregador assegura aos trabalhadores + expostos a níveis de ruído iguais ou acima + dos valores de acção inferiores (80 dB (A) e + 135 dB (C)), assim como aos seus + representantes para a segurança, higiene e + saúde no trabalho informação e, se + necessário, formação adequada ( + + Decreto Lei nº 182/2006 -Art. 9º -1 + + + ) + + + + + O empregador deve assegurar a utilização + pelos trabalhadores de protectores auditivos + individuais sempre que o nível de exposição + ao ruído iguale ou ultrapasse os valores de + acção superiores (85 dB (A) e 137 dB (C)) + + + Higiene + + Risco de exposição ao ruído + + + A informação deve, tendo em conta o + resultado da avaliação, ser prestada de + forma adequada, oralmente ou por escrito, + nomeadamente através de formação individual + dos trabalhadores, e ser periodicamente + actualizada de modo a incluir qualquer + alteração verificada ( + + Decreto Lei nº 182/2006 -Art. 9º -2 + + + ) + + + + + O empregador assegura que a exposição dos + trabalhadores ao ruído durante o trabalho + seja reduzida ao nível mais baixo possível + e, em qualquer caso, não superior aos + valores limite de exposição de 87 dB (A) e + 140 dB © + + + Higiene + + Risco de exposição ao ruído + + + O empregador assegura a informação e a + consulta dos trabalhadores e dos seus + representantes para a segurança, higiene e + saúde no trabalho sobre a aplicação das + disposições sobre a avaliação dos riscos e a + identificação das medidas a tomar, as + medidas destinadas a reduzir a exposição e a + selecção de protectores auditivos ( + + Decreto + + + Lei nº 182/2006 -Art. 10º + + + ) + + + + + Nas situações em que sejam ultrapassados os + valores limite de exposição (87 dB (A) e 140 + dB (C)) o empregador toma medidas que + reduzam a exposição de modo a não exceder os + valores limite de exposição (87 dB (A) e 140 + dB (C)), identifica as causas da + ultrapassagem dos valores limite e corrige + as medidas de protecção e prevenção de modo + a evitar a ocorrência de situações idênticas + + + Higiene + + Risco de exposição ao ruído + + + O empregador assegura que a exposição dos + trabalhadores ao ruído durante o trabalho + seja reduzida ao nível mais baixo possível + e, em qualquer caso, não superior aos + valores limite de exposição de 87 dB (A) e + 140 dB (C) ( + + Decreto Lei nº 182/2006 -Art. 8º 1 + + + ) + + + + + O empregador assegura aos trabalhadores + expostos a níveis de ruído iguais ou acima + dos valores de acção inferiores (80 dB (A) e + 135 dB (C)), assim como aos seus + representantes para a segurança, higiene e + saúde no trabalho informação e, se + necessário, formação adequada + + + Higiene + + Risco de exposição ao ruído + + + O nível sonoro contínuo equivalente obtido + foi de dB (A), pelo que (e em condições + normais de funcionamento) a Exposição + pessoal diária ao ruído, a média semanal dos + valores diários da exposição pessoal ao + ruído e o nível de pressão sonora de pico + deverá ser inferior aos valores limite. + + + + A informação deve, tendo em conta o + resultado da avaliação, ser prestada de + forma adequada, oralmente ou por escrito, + nomeadamente através de formação individual + dos trabalhadores, e ser periodicamente + actualizada de modo a incluir qualquer + alteração verificada + + + Higiene + + Risco de exposição ao ruído + + + O empregador deve avaliar os riscos e + verificar a existência de agentes químicos + perigosos nos locais de trabalho ( + + Decreto Lei nº290/2001 – Art.4º - 1 + + + ) + + + + + O empregador assegura a informação e a + consulta dos trabalhadores e dos seus + representantes para a segurança, higiene e + saúde no trabalho sobre a aplicação das + disposições sobre a avaliação dos riscos e a + identificação das medidas a tomar, as + medidas destinadas a reduzir a exposição e a + selecção de protectores auditivos + + + Higiene + + Risco de exposição ao ruído + + + Se existirem agentes químicos perigosos, o + empregador deve avaliar os riscos para a + segurança e a saúde dos trabalhadores + resultantes da presença desses agentes ( + + Decreto + + + Lei nº290/2001 – Art.4º - 2 + + + ) + + + + + O empregador assegura que a exposição dos + trabalhadores ao ruído durante o trabalho + seja reduzida ao nível mais baixo possível + e, em qualquer caso, não superior aos + valores limite de exposição de 87 dB (A) e + 140 dB © + + + Higiene + + Risco de exposição ao ruído + + + O empregador deve garantir que os riscos + para a segurança e saúde dos trabalhadores + resultantes da presença de uma agente + químico perigoso sejam eliminados ou + reduzidos ao mínimo, pela sua substituição + por outro agente ou processo químico cujas + condições de utilização não apresentem + perigo ou tenham menor perigo ou, se a + substituição não for possível, através de + outra medida preventiva de eficácia + equivalente ( + + Decreto Lei + + + nº290/2001 – Art.6º - 1 + + + ) + + + + + O nível sonoro contínuo equivalente obtido + foi de dB (A), pelo que (e em condições + normais de funcionamento) a Exposição + pessoal diária ao ruído, a média semanal dos + valores diários da exposição pessoal ao + ruído e o nível de pressão sonora de pico + deverá ser inferior aos valores limite. + + + Higiene + + + Risco de exposição a substâncias químicas + + + + Nas medidas em que não é possível a + eliminação dos riscos através da + substituição do agente, o empregador deve + aplicar medidas de protecção adequadas ( + + Decreto Lei + + + nº290/2001 – Art.6º - 2 + + + ) + + + + + O empregador deve avaliar os riscos e + verificar a existência de agentes químicos + perigosos nos locais de trabalho + + + Higiene + + + Risco de exposição a substâncias químicas + + + + O empregador deve proceder à medição da + concentração dos agentes químicos que possam + apresentar riscos para a saúde dos + trabalhadores, tendo em atenção os valores + limite de exposição profissional + estabelecidos ( + + Decreto Lei nº290/2001 – Art.7º - 1 + + + ) + + + + + Se existirem agentes químicos perigosos, o + empregador deve avaliar os riscos para a + segurança e a saúde dos trabalhadores + resultantes da presença desses agentes + + + Higiene + + + Risco de exposição a substâncias químicas + + + + A medição da concentração dos agentes + químicos deve ser periodicamente repetida e + logo que se verifique qualquer alteração das + condições susceptíveis de se repercutirem na + exposição dos trabalhadores a agentes + químicos perigosos ( + + Decreto Lei nº290/2001 – + + + Art.7º - 2 + + + ) + + + + + O empregador deve garantir que os riscos + para a segurança e saúde dos trabalhadores + resultantes da presença de uma agente + químico perigoso sejam eliminados ou + reduzidos ao mínimo, pela sua substituição + por outro agente ou processo químico cujas + condições de utilização não apresentem + perigo ou tenham menor perigo ou, se a + substituição não for possível, através de + outra medida preventiva de eficácia + equivalente + + + Higiene + + + Risco de exposição a substâncias químicas + + + + O empregador deve assegurar a informação, + consulta e formação dos trabalhadores e dos + seus representantes para a segurança, + higiene e saúde no trabalho ( + + Decreto Lei + + + nº290/2001 – Art.11º e 14º + + + ) + + + + + Nas medidas em que não é possível a + eliminação dos riscos através da + substituição do agente, o empregador deve + aplicar medidas de protecção adequadas + + + Higiene + + + Risco de exposição a substâncias químicas + + + + Os agentes químicos que compõem as moedas da + União Europeia (cuproníquel, latão níquel, + níquel, latão níquel, ouro nórdico e aço + cobrado) podem ser libertados para a + atmosfera, estabelecendo ligações com as + poeiras existentes no ar e podem provocar + uma reacção alérgica ao nível epidérmico + + + + O empregador deve proceder à medição da + concentração dos agentes químicos que possam + apresentar riscos para a saúde dos + trabalhadores, tendo em atenção os valores + limite de exposição profissional + estabelecidos + + + Higiene + + + Risco de exposição a substâncias químicas + + + + O empregador deve assegurar que as + exposições aos agentes químicos, físicos e + biológicos nos locais de trabalho não + constituam risco para a saúde dos + trabalhadores ( + + Lei nº 99/03 – Art.273º -2c + + + ) + + + + + A medição da concentração dos agentes + químicos deve ser periodicamente repetida e + logo que se verifique qualquer alteração das + condições susceptíveis de se repercutirem na + exposição dos trabalhadores a agentes + químicos perigosos + + + Higiene + + + Risco de exposição a substâncias químicas + + + + Todas as embalagens (mesmo os transvazes) + devem conter um rótulo legível e indelével + (redigido em língua portuguesa) contendo as + seguintes indicações: nome da substância, + nome e morada completa e número de telefone + do responsável pela sua colocação no + mercado, símbolos de perigo e indicação dos + perigos que apresenta a utilização da + substância, frases tipo R (Riscos + específicos), frases S (Conselhos de + prudência) e número CE, quando atribuído + + (Portaria n.º732-A/96 – Art. 18º -1 + + + ) + + + + + O empregador deve assegurar a informação, + consulta e formação dos trabalhadores e dos + seus representantes para a segurança, + higiene e saúde no trabalho + + + Higiene + + + Risco de exposição directa e indirecta a + moedas + + + + Solicitar junto do fabricante, importador ou + distribuidor dos produtos as fichas de dados + de segurança dos produtos, contendo as + informações necessárias à protecção do homem + e do ambiente ( + + Portaria n.º732-A/96 – Art. 21º) + + + + + Os agentes químicos que compõem as moedas da + União Europeia (cuproníquel, latão níquel, + níquel, latão níquel, ouro nórdico e aço + cobrado) podem ser libertados para a + atmosfera, estabelecendo ligações com as + poeiras existentes no ar e podem provocar + uma reacção alérgica ao nível epidérmico + + + Higiene + + + Risco de exposição directa e indirecta a + moedas + + + + As fichas de dados de segurança devem ser + redigidas em língua portuguesa + + (Portaria + + + nº732-A/969 – Art.22º) + + + + + O empregador deve assegurar que as + exposições aos agentes químicos, físicos e + biológicos nos locais de trabalho não + constituam risco para a saúde dos + trabalhadores + + + Higiene + + + Existência de substâncias químicas perigosas + + + + Disponibilizar cópia das fichas de dados de + segurança no local de armazenagem e de + utilização, de modo a que os trabalhadores + estejam familiarizados com as medidas de + actuação em caso de emergência + + (Lei nº99/03 – Art.275º - 1) + + + + + Todas as embalagens (mesmo os transvazes) + devem conter um rótulo legível e indelével + (redigido em língua portuguesa) contendo as + seguintes indicações: nome da substância, + nome e morada completa e número de telefone + do responsável pela sua colocação no + mercado, símbolos de perigo e indicação dos + perigos que apresenta a utilização da + substância, frases tipo R (Riscos + específicos), frases S (Conselhos de + prudência) e número CE, quando atribuído + + + Higiene + + + Existência de substâncias químicas perigosas + + + + A armazenagem destes produtos deverá ser + feita em local próprio e ventilado ( + + Portaria + + + n.º732-A/96) + + + + + Solicitar junto do fabricante, importador ou + distribuidor dos produtos as fichas de dados + de segurança dos produtos, contendo as + informações necessárias à protecção do homem + e do ambiente + + + Higiene + + + Existência de substâncias químicas perigosas + + + + Garantir a existência de armários duplos, de + forma a permitir a separação das roupas de + uso pessoal e de trabalho + + (Portaria n.º987/93 – Art.18º - 4) + + + + + As fichas de dados de segurança devem ser + redigidas em língua portuguesa + + + Higiene + + + Existência de substâncias químicas perigosas + + + + A entidade patronal tem de avaliar e, se + necessário, medir os níveis de vibrações + mecânicas a que os trabalhadores se + encontram expostos ( + + Directiva 2004/44/CE – Art.4º + + + - 1 + + + ) + + + + + Disponibilizar cópia das fichas de dados de + segurança no local de armazenagem e de + utilização, de modo a que os trabalhadores + estejam familiarizados com as medidas de + actuação em caso de emergência + + + Higiene + + + Existência de substâncias químicas perigosas + + + + Tendo em conta o progresso técnico e a + disponibilidade de medidas de controlo dos + riscos na fonte, os riscos resultantes da + exposição a vibrações mecânicas devem ser + eliminados na fonte ou reduzidos ao mínimo ( + + Directiva 2004/44/CE – Art.5º - 1 + + + ) + + + + + A armazenagem destes produtos deverá ser + feita em local próprio e ventilado + + + Higiene + + + Existência de substâncias químicas perigosas + + + + A entidade patronal deve assegurar que os + trabalhadores expostos a riscos devidos a + vibrações mecânicas no local de trabalho + e/ou representantes recebam informações e + formação de acordo com o resultado da + avaliação dos riscos ( + + Directiva 2004/44/CE – + + + Art.6. + + + ) + + + + + Garantir a existência de armários duplos, de + forma a permitir a separação das roupas de + uso pessoal e de trabalho + + + Higiene + + + Risco de exposição a vibrações mecânicas + + + + Nas actividades susceptíveis de apresentar + riscos de exposição a vibrações mecânicas, o + empregador deve avaliar e, se necessário, + medir os níveis de vibrações a que os + trabalhadores se encontram expostos ( + + Decreto Lei nº 46/2006 – Art.4º-1 + + + ) + + + + + A entidade patronal tem de avaliar e, se + necessário, medir os níveis de vibrações + mecânicas a que os trabalhadores se + encontram expostos + + + Higiene + + + Risco de exposição a vibrações mecânicas + + + + O empregador deve utilizar os meios + disponíveis para eliminar na fonte ou + reduzir ao mínimo os riscos resultantes da + exposição dos trabalhadores a vibrações + mecânicas, de acordo com os princípios + gerais de prevenção legalmente estabelecidos + ( + + Decreto Lei nº + + + 46/2006 – Art.6º-1 + + + ) + + + + + Tendo em conta o progresso técnico e a + disponibilidade de medidas de controlo dos + riscos na fonte, os riscos resultantes da + exposição a vibrações mecânicas devem ser + eliminados na fonte ou reduzidos ao mínimo + + + Higiene + + + Risco de exposição a vibrações mecânicas + + + + O empregador deve avaliar de forma global os + riscos de explosão, tendo em conta as + obrigações gerais do empregador previstas no + regime aplicável em matéria de segurança, + higiene e saúde no trabalho ( + + Decreto Lei nº 236/2003 – Art. 5º + + + ) + + + + + A entidade patronal deve assegurar que os + trabalhadores expostos a riscos devidos a + vibrações mecânicas no local de trabalho + e/ou representantes recebam informações e + formação de acordo com o resultado da + avaliação dos riscos + + + Higiene + + + Risco de exposição a vibrações mecânicas + + + + O empregador deve prevenir a formação de + atmosferas explosivas através de medidas + técnicas e organizativas apropriadas à + natureza das operações, tendo em conta os + princípios de prevenção consagrados no + regime aplicável em matéria de segurança, + higiene e saúde no trabalho ( + + Decreto Lei nº 236/2003 – Art. 6º- 1 + + + ) + + + + + Nas actividades susceptíveis de apresentar + riscos de exposição a vibrações mecânicas, o + empregador deve avaliar e, se necessário, + medir os níveis de vibrações a que os + trabalhadores se encontram expostos + + + Higiene + + + Risco de exposição a vibrações mecânicas + + + + Se, dada a natureza da actividade, for + impossível evitar a formação de atmosferas + explosivas, o empregador deve adoptar + medidas técnicas e organizativas que evitem + a ignição das mesmas e atenuem os efeitos + prejudiciais de uma explosão, de forma a + proteger a vida, a integridade física e a + saúde dos trabalhadores ( + + Decreto Lei nº + + + 236/2003 – Art. 6º- 2 + + + ) + + + + + O empregador deve utilizar os meios + disponíveis para eliminar na fonte ou + reduzir ao mínimo os riscos resultantes da + exposição dos trabalhadores a vibrações + mecânicas, de acordo com os princípios + gerais de prevenção legalmente estabelecidos + + + Higiene + + Risco de exposição a uma Zona 0 + + + As medidas de prevenção e protecção contra + explosões devem ser revistas com a + periodicidade máxima de um ano, bem como + sempre que ocorram alterações significativas + que afectem a segurança das operações ( + + Decreto Lei nº 236/2003 – Art. 6º- + + + 4 + + + ) + + + + + O empregador deve avaliar de forma global os + riscos de explosão, tendo em conta as + obrigações gerais do empregador previstas no + regime aplicável em matéria de segurança, + higiene e saúde no trabalho + + + Higiene + + Risco de exposição a uma Zona 1 + + + O empregador deve adoptar as medidas + necessárias para que seja assegurada, + através de meios técnicos apropriados, a + supervisão adequada durante a presença de + trabalhadores nos locais onde se possam + formar atmosferas explosivas em + concentrações susceptíveis de constituir um + risco para a sua segurança e saúde ( + + Decreto + + + Lei nº 236/2003 – Art. 7º- b + + + ) + + + + + O empregador deve prevenir a formação de + atmosferas explosivas através de medidas + técnicas e organizativas apropriadas à + natureza das operações, tendo em conta os + princípios de prevenção consagrados no + regime aplicável em matéria de segurança, + higiene e saúde no trabalho + + + Higiene + + Risco de exposição a uma Zona 2 + + + Ao proceder à avaliação de riscos de + explosão, o empregador deve assegurar a + elaboração e a actualização de um manual de + protecção contra explosões ( + + Decreto Lei nº + + + 236/2003 – Art. 9º- 1 + + + ) + + + + + Se, dada a natureza da actividade, for + impossível evitar a formação de atmosferas + explosivas, o empregador deve adoptar + medidas técnicas e organizativas que evitem + a ignição das mesmas e atenuem os efeitos + prejudiciais de uma explosão, de forma a + proteger a vida, a integridade física e a + saúde dos trabalhadores + + + + Higiene + + Risco de exposição a uma Zona 3 + + + Nas zonas 0 e 20 deve ser utilizada a + categoria de equipamento 1 ( + + Decreto Lei nº + + + 236/2003 – Art. 12º- 2 -a) + + + + + As medidas de prevenção e protecção contra + explosões devem ser revistas com a + periodicidade máxima de um ano, bem como + sempre que ocorram alterações significativas + que afectem a segurança das operações + + + Higiene + + Risco de exposição a uma Zona 4 + + + O empregador deve proporcionar aos + trabalhadores que prestam serviço em áreas + onde se possam formar atmosferas explosivas + uma formação adequada à protecção contra + explosões ( + + Decreto Lei nº 236/2003 – Art. 15º- 1) + + + + + O empregador deve adoptar as medidas + necessárias para que seja assegurada, + através de meios técnicos apropriados, a + supervisão adequada durante a presença de + trabalhadores nos locais onde se possam + formar atmosferas explosivas em + concentrações susceptíveis de constituir um + risco para a sua segurança e saúde + + + Higiene + + Risco de exposição a uma Zona 5 + + + O empregador deve assegurar a informação e a + consulta dos trabalhadores e dos seus + representantes para a segurança, higiene e + saúde no trabalho ( + + Decreto Lei nº 236/2003 – + + + Art. 15º- 2) + + + + + Ao proceder à avaliação de riscos de + explosão, o empregador deve assegurar a + elaboração e a actualização de um manual de + protecção contra explosões + + + Higiene + + Risco de exposição a uma Zona 6 + + + Assegurar que os aparelhos e sistemas de + protecção destinados a serem utilizados em + atmosferas potencialmente explosivas + satisfazem as exigências essenciais de + segurança e de saúde estabelecidas no + Decreto-lei nº 112/96 de 5 de Agosto e as + regras que constam na Portaria nº 341/97 de + 21 de Maio + + + + Nas zonas 0 e 20 deve ser utilizada a + categoria de equipamento 1 + + + Higiene + + Risco de exposição a uma Zona 7 + + + Organizar a actividade do trabalhador para + que o trabalho diário com visor seja + periodicamente interrompido por pausas (de 5 + ou 10 minutos por cada 1h30 trabalhada) ou + mudanças de actividade que reduzam a pressão + do trabalhador com equipamento dotado de + visor ( + + Decreto Lei nº 349/93 – Art. 6º + + + ) + + + + + O empregador deve proporcionar aos + trabalhadores que prestam serviço em áreas + onde se possam formar atmosferas explosivas + uma formação adequada à protecção contra + explosões + + + Higiene + + Risco de exposição a uma Zona 8 + + + Formar os trabalhadores sobre a utilização + dos equipamentos dotados de visor ( + + Decreto + + + Lei nº 349/93 – Art. 8º + + + ) + + + + + O empregador deve assegurar a informação e a + consulta dos trabalhadores e dos seus + representantes para a segurança, higiene e + saúde no trabalho + + + Higiene + + Risco de exposição a uma Zona 9 + + + Os visores existentes nos postos de trabalho + não devem possuir reflexos, sendo por isso + aconselhável a sua colocação num plano + perpendicular à janela ( + + Portaria nº 989/93 + + + ) + + + + + Assegurar que os aparelhos e sistemas de + protecção destinados a serem utilizados em + atmosferas potencialmente explosivas + satisfazem as exigências essenciais de + segurança e de saúde estabelecidas no + Decreto-lei nº 112/96 de 5 de Agosto e as + regras que constam na Portaria nº 341/97 de + 21 de Maio + + + Ergonomia + + + Riscos inerentes à utilização de + equipamentos dotados de visor + + + + A cadeira de trabalho deve ter boa + estabilidade, ser de altura ajustável e + possuir um espaldar regulável em altura e + inclinação ( + + Portaria nº 989/93 – Art. 2-3 + + + ) + + + + + Organizar a actividade do trabalhador para + que o trabalho diário com visor seja + periodicamente interrompido por pausas (de 5 + ou 10 minutos por cada 1h30 trabalhada) ou + mudanças de actividade que reduzam a pressão + do trabalhador com equipamento dotado de + visor + + + Ergonomia + + + Riscos inerentes à utilização de + equipamentos dotados de visor + + + + A mesa ou superfície de trabalho deve ter + dimensões adequadas e permitir uma + disposição flexível do visor, do teclado, + dos documentos e do material acessório e + reflectir um mínimo de luminosidade ( + + Portaria nº 989/93 – Art. 2º-1 + + + ) + + + + + Formar os trabalhadores sobre a utilização + dos equipamentos dotados de visor + + + Ergonomia + + + Riscos inerentes à utilização de + equipamentos dotados de visor + + + + Adoptar medidas de organização do trabalho + adequadas ou utilizar os meios apropriados, + para evitar a movimentação manual de cargas + pelos trabalhadores ( + + Decreto Lei nº + + + 330/93 – 4º + + + ) + + + + + Os visores existentes nos postos de trabalho + não devem possuir reflexos, sendo por isso + aconselhável a sua colocação num plano + perpendicular à janela + + + Ergonomia + + + Riscos inerentes à utilização de + equipamentos dotados de visor + + + + Avaliar o risco inerente à movimentação + manual de cargas ( + + Decreto Lei nº 330/93 – 5º + + + ) + + + + + A cadeira de trabalho deve ter boa + estabilidade, ser de altura ajustável e + possuir um espaldar regulável em altura e + inclinação + + + Ergonomia + + + Riscos inerentes à utilização de + equipamentos dotados de visor + + + + Informar os trabalhadores dos riscos + potenciais para a saúde derivados da + incorrecta movimentação manual de cargas, do + peso máximo e outras características da + carga, do centro de gravidade da carga e o + lado mais pesado da mesma ( + + Decreto Lei nº 330/93 – + + + 8º + + + ) + + + + + A mesa ou superfície de trabalho deve ter + dimensões adequadas e permitir uma + disposição flexível do visor, do teclado, + dos documentos e do material acessório e + reflectir um mínimo de luminosidade + + + Ergonomia + + + Risco ergonómico inerente à manipulação + manual de cargas + + + + Formar adequadamente os trabalhadores sobre + a movimentação manual de cargas ( + + Decreto Lei nº 330/93 – 8º + + + ) + + + + + Adoptar medidas de organização do trabalho + adequadas ou utilizar os meios apropriados, + para evitar a movimentação manual de cargas + pelos trabalhadores + + + Ergonomia + + + Risco ergonómico inerente à manipulação + manual de cargas + + + + Criar pausas no decurso do trabalho ou se + possível, criar sistema de alternância de + tarefas ( + + Decreto Lei n.º243/86 – Art. 22º-2 + + + ) + + + + + Avaliar o risco inerente à movimentação + manual de cargas + + + Ergonomia + + + Risco ergonómico inerente à manipulação + manual de cargas + + + + Criar condições para que o ritmo de trabalho + não ocasione efeitos nocivos aos + trabalhadores ( + + Decreto Lei n.º243/86 – Art.22 º– 1 + + + ) + + + + + Informar os trabalhadores dos riscos + potenciais para a saúde derivados da + incorrecta movimentação manual de cargas, do + peso máximo e outras características da + carga, do centro de gravidade da carga e o + lado mais pesado da mesma + + + Ergonomia + + + Risco ergonómico inerente à manipulação + manual de cargas + + + + Facultar pausas no horário de trabalho + sempre que os trabalhadores estejam + submetidos a temperaturas muito altas ou + muito baixas em consequência do ambiente de + trabalho ( + + Decreto Lei n.º243/86 – Art.23º + + + ) + + + + + Formar adequadamente os trabalhadores sobre + a movimentação manual de cargas + + + Psicossociologia + + Carga de trabalho + + + Os ritmos de trabalho não devem ocasionar + efeitos nocivos nos trabalhadores, + particularmente nos domínios da fadiga + física ou nervosa ( + + Decreto Lei n.º243/86 – Art.22º + + + - 1 + + + ) + + + + + Criar pausas no decurso do trabalho ou se + possível, criar sistema de alternância de + tarefas + + + Psicossociologia + + Carga de trabalho + + + Devem prever-se pausas no decurso do + trabalho ou caso seja possível, criar-se + sistemas de rotatividade no desempenho de + tarefas ( + + Decreto Lei n.º243/86 – Art.22º - 2 + + + ) + + + + + Criar condições para que o ritmo de trabalho + não ocasione efeitos nocivos aos + trabalhadores + + + Psicossociologia + + Pausas no horário de trabalho + + + O empregador que pretenda organizar a + actividade laboral segundo um certo ritmo + deve observar o princípio geral da adaptação + do trabalho ao homem, com vista, + nomeadamente, a atenuar o trabalho monótono + e o trabalho cadenciado em função do tipo de + actividade e das exigências em matéria de + segurança e saúde, em especial no que se + refere à pausas durante o tempo de trabalho + ( + + Lei nº 99/2003 – Art. 161º + + + ) + + + + + Facultar pausas no horário de trabalho + sempre que os trabalhadores estejam + submetidos a temperaturas muito altas ou + muito baixas em consequência do ambiente de + trabalho + + + Psicossociologia + + Ritmos de trabalho + + + Garantir a existência de informação + actualizada sobre os riscos para a segurança + e saúde, medidas de protecção e de prevenção + e a forma como se aplicam; medidas e + instruções a adoptar em caso de perigo grave + e iminente; medidas de primeiros socorros, + de combate a incêndios e de evacuação dos + trabalhadores em caso de sinistro, bem como + os trabalhadores ou serviços encarregados de + as pôr em prática ( + + Lei 99/03- Art.275 + + + - 1 + + + º) + + + + + Os ritmos de trabalho não devem ocasionar + efeitos nocivos nos trabalhadores, + particularmente nos domínios da fadiga + física ou nervosa + + + Psicossociologia + + Ritmos de trabalho + + + O trabalhador deve receber uma formação + adequada no domínio da segurança, higiene e + saúde do trabalho, tendo em atenção o posto + de trabalho e o exercício de actividades de + risco elevado ( + + Lei nº 99/2003 – Art. 278º - 1 + + + ) + + + + + Devem prever-se pausas no decurso do + trabalho ou caso seja possível, criar-se + sistemas de rotatividade no desempenho de + tarefas + + + Psicossociologia + + Ritmos de trabalho + + + A formação dos trabalhadores da empresa + sobre segurança, higiene e saúde do trabalho + deve ser assegurada de modo que não possa + resultar prejuízo para os mesmos ( + + Lei nº + + + 99/2003 – Art. 278º - 2 + + + ) + + + + + O empregador que pretenda organizar a + actividade laboral segundo um certo ritmo + deve observar o princípio geral da adaptação + do trabalho ao homem, com vista, + nomeadamente, a atenuar o trabalho monótono + e o trabalho cadenciado em função do tipo de + actividade e das exigências em matéria de + segurança e saúde, em especial no que se + refere à pausas durante o tempo de trabalho + + + Informação e formação + + + Inexistência de informação no domínio da + segurança, higiene e saúde do trabalho + + + + Formar em número suficiente (tendo em conta + a dimensão da empresa e os riscos + existentes) os trabalhadores responsáveis + pela aplicação das medidas de primeiros + socorros, de combate a incêndios e de + evacuação de trabalhadores, bem como + facultar-lhes material adequado ( + + Lei nº 35/2004 - Art. 217º + + + ) + + + + + Garantir a existência de informação + actualizada sobre os riscos para a segurança + e saúde, medidas de protecção e de prevenção + e a forma como se aplicam; medidas e + instruções a adoptar em caso de perigo grave + e iminente; medidas de primeiros socorros, + de combate a incêndios e de evacuação dos + trabalhadores em caso de sinistro, bem como + os trabalhadores ou serviços encarregados de + as pôr em prática + + + Informação e formação + + + Inexistência de formação no domínio da + segurança, higiene e saúde do trabalho + + + + Por instrumento de regulamentação colectiva + de trabalho negocial, podem ser criadas + comissões de segurança, higiene e saúde no + trabalho, de composição paritária + + (Lei nº + + + 35/2004 de 29 de Julho - Art. 215º- 1) + + + + + O trabalhador deve receber uma formação + adequada no domínio da segurança, higiene e + saúde do trabalho, tendo em atenção o posto + de trabalho e o exercício de actividades de + risco elevado + + + Informação e formação + + + Inexistência de formação no domínio da + segurança, higiene e saúde do trabalho + + + + A comissão de segurança, higiene e saúde no + trabalho (…) é constituída pelos + representantes dos trabalhadores para a + segurança, higiene e saúde no trabalho (…) ( + + Lei + + + nº 35/2004 de 29 de Julho - Art. 215º- + 2) + + + + + A formação dos trabalhadores da empresa + sobre segurança, higiene e saúde do trabalho + deve ser assegurada de modo que não possa + resultar prejuízo para os mesmos + + + Informação e formação + + + Inexistência de formação no domínio da + segurança, higiene e saúde do trabalho + + + + Os representantes dos trabalhadores para a + segurança, higiene e saúde no trabalho são + eleitos pelos trabalhadores por voto directo + e secreto, segundo o princípio da + representação pelo método de Hondt + + (Lei nº 99/2003 de 27 de Agosto - Art. + 277º- 1) + + + + + Formar em número suficiente (tendo em conta + a dimensão da empresa e os riscos + existentes) os trabalhadores responsáveis + pela aplicação das medidas de primeiros + socorros, de combate a incêndios e de + evacuação de trabalhadores, bem como + facultar-lhes material adequado + + + Informação e formação + + + Comissão de segurança, higiene e saúde no + trabalho + + + + Por instrumento de regulamentação colectiva + de trabalho negocial, podem ser criadas + comissões de segurança, higiene e saúde no + trabalho, de composição paritária + + + Informação e formação + + + Comissão de segurança, higiene e saúde no + trabalho + + + + A comissão de segurança, higiene e saúde no + trabalho (…) é constituída pelos + representantes dos trabalhadores para a + segurança, higiene e saúde no trabalho (…) + + + Informação e formação + + + Comissão de segurança, higiene e saúde no + trabalho + + + + Os representantes dos trabalhadores para a + segurança, higiene e saúde no trabalho são + eleitos pelos trabalhadores por voto directo + e secreto, segundo o princípio da + representação pelo método de Hondt + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/importacao/importacao_ods_to_xml.xsl b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/importacao/importacao_ods_to_xml.xsl new file mode 100644 index 00000000..125bcd37 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/importacao/importacao_ods_to_xml.xsl @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/legislacao/AdicionarLegislacaoPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/legislacao/AdicionarLegislacaoPanel.java new file mode 100644 index 00000000..22009bc3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/legislacao/AdicionarLegislacaoPanel.java @@ -0,0 +1,207 @@ +package siprp.higiene.gestao.legislacao; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; + +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreePath; + +import leaf.ui.LeafDialog; +import leaf.ui.TreeInserterDialog; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsLegislacao; +import siprp.database.cayenne.objects.HsLegislacaoEmpresa; +import siprp.database.cayenne.objects.HsLegislacaoEstabelecimento; +import siprp.higiene.gestao.AdicionarPanel; +import siprp.logic.HigieneSegurancaLogic; + +import com.evolute.utils.ui.trees.TreeTools; + +public class AdicionarLegislacaoPanel extends AdicionarPanel +{ + +private static final long serialVersionUID = 1L; + + private Empresas empresa = null; + + private Estabelecimentos estabelecimento = null; + + public void setEmpresa( Empresas empresa ) + { + this.empresa = empresa; + this.estabelecimento = null; + refresh(); + } + + public void setEstabelecimento( Estabelecimentos estabelecimento ) + { + this.empresa = null; + this.estabelecimento = estabelecimento; + refresh(); + } + + @Override + protected void add() + { + DefaultMutableTreeNode allLegislacao = getAllLegislacao(); + removeCurrent( allLegislacao ); + TreeInserterDialog dialog = new TreeInserterDialog( "Adicionar Legisla" + ccedil + atilde + "o", allLegislacao ); + DefaultMutableTreeNode result = dialog.getResult(); + if( result != null ) + { + addResult( result ); + refresh(); + } + setEnabled(); + } + + private DefaultMutableTreeNode getAllLegislacao() + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + if( empresa != null ) + { + result = HigieneSegurancaLogic.getLegislacaoTreeForEmpresa( null ); + } + else if( estabelecimento != null ) + { + result = HigieneSegurancaLogic.getLegislacaoTreeForEmpresa( estabelecimento.getToEmpresas() ); + } + return result; + } + + private void removeCurrent( DefaultMutableTreeNode all ) + { + if( all != null && root.getChildCount() == 2 && all.getChildCount() == 2 ) + { + DefaultMutableTreeNode geralAll = (DefaultMutableTreeNode) all.getChildAt( 0 ); + DefaultMutableTreeNode especificaAll = (DefaultMutableTreeNode) all.getChildAt( 1 ); + DefaultMutableTreeNode geralCurrent = (DefaultMutableTreeNode) root.getChildAt( 0 ); + DefaultMutableTreeNode especificaCurrent = (DefaultMutableTreeNode) root.getChildAt( 1 ); + TreeTools.remove( geralAll, geralCurrent ); + TreeTools.removeAllLeafs( especificaAll, especificaCurrent ); + } + } + + private void addResult( DefaultMutableTreeNode root ) + { + try + { + if( root != null ) + { + Object userObject = root.getUserObject(); + if( userObject instanceof HsLegislacao ) + { + if( empresa != null ) + { + HsLegislacaoEmpresa rel = new HsLegislacaoEmpresa(); + rel.setToHsEmpresa( empresa ); + rel.setToHsLegislacao( ((HsLegislacao) userObject ) ); + rel.save(); + } + else if( estabelecimento != null ) + { + HsLegislacaoEstabelecimento rel = new HsLegislacaoEstabelecimento(); + rel.setToHsEstabelecimento( estabelecimento ); + rel.setToHsLegislacao( ((HsLegislacao) userObject ) ); + rel.save(); + } + } + } + for( int i = 0; i < root.getChildCount(); ++i ) + { + DefaultMutableTreeNode child = (DefaultMutableTreeNode) root.getChildAt( i ); + addResult( child ); + } + } + catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + @Override + public void refresh() + { + root.removeAllChildren(); + if( empresa != null ) + { + TreeTools.merge( root, HigieneSegurancaLogic.getLegislacaoTreeForEmpresa( empresa ) ); + } + else if( estabelecimento != null ) + { + TreeTools.merge( root, HigieneSegurancaLogic.getLegislacaoTreeForEstabelecimento( estabelecimento ) ); + } + setEnabled(); + TreeTools.refreshTree( tree, root, false ); + } + + @Override + protected void setEnabled() + { + buttonAdicionar.setEnabled( empresa != null || estabelecimento != null ); + buttonRemover.setEnabled( tree.getSelectionCount() > 0 ); + } + + @Override + protected void rem() + { + try + { + TreePath path = tree.getSelectionPath(); + if( path != null ) + { + DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); + Object obj = node.getUserObject(); + if( obj != null && (obj instanceof HsLegislacao) ) + { + if( empresa != null && LeafDialog.confirmDelete( false, false, "legisla" + ccedil + atilde + "o" ) ) + { + removeFromEmpresa( ((HsLegislacao) obj ) ); + } + else if( estabelecimento != null && LeafDialog.confirmDelete( false, false, "legisla" + ccedil + atilde + "o" ) ) + { + removeFromEstabelecimento( ((HsLegislacao) obj )); + } + refresh(); + } + } + } + catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void removeFromEmpresa( HsLegislacao legislacao ) throws Exception + { + if( legislacao != null && empresa != null ) + { + for( HsLegislacaoEmpresa rel : empresa.getHsLegislacaoEmpresaArray() ) + { + if( legislacao.equals( rel.getToHsLegislacao() ) ) + { + rel.delete(); + break; + } + } + } + } + + private void removeFromEstabelecimento( HsLegislacao legislacao ) throws Exception + { + if( legislacao != null && estabelecimento != null ) + { + for( HsLegislacaoEstabelecimento rel : estabelecimento.getHsLegislacaoEstabelecimentoArray() ) + { + if( legislacao.equals( rel.getToHsLegislacao() ) ) + { + rel.delete(); + break; + } + } + + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/legislacao/GerirLegislacaoPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/legislacao/GerirLegislacaoPanel.java new file mode 100644 index 00000000..7a7a7bf8 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/legislacao/GerirLegislacaoPanel.java @@ -0,0 +1,498 @@ +package siprp.higiene.gestao.legislacao; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import static com.evolute.utils.strings.UnicodeLatin1Map.iacute; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.GridLayout; +import java.awt.LayoutManager; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.Date; + +import javax.swing.BorderFactory; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +import leaf.ui.LeafButton; +import leaf.ui.LeafDialog; +import leaf.ui.LeafIconButton; +import leaf.ui.LeafTextAreaEditor; +import leaf.ui.LeafTree; +import leaf.ui.LeafUIConstants; +import siprp.database.cayenne.objects.HsLegislacao; +import siprp.database.cayenne.objects.HsLegislacaoCategoria; +import siprp.logic.HigieneSegurancaLogic; + +import com.evolute.adt.Validator; +import com.evolute.utils.ui.trees.TreeTools; + +public class GerirLegislacaoPanel extends JPanel implements LeafUIConstants +{ + + private static final long serialVersionUID = 1L; + + private final JPanel panelGeral = new JPanel(); + + private final JPanel panelCategorias = new JPanel(); + + private final JPanel panelButtonsGeral = new JPanel(); + + private final LeafButton buttonGeralCriar = LeafIconButton.createDefaultNewButton(); + + private final LeafButton buttonGeralRemover = LeafIconButton.createDefaultRemoveButton(); + + private final JPanel panelButtonsCategoriasCategoria = new JPanel(); + + private final LeafButton buttonCategoriaCriar = LeafIconButton.createDefaultNewButton(); + + private final LeafButton buttonCategoriaEditar = LeafIconButton.createDefaultEditButton(); + + private final LeafButton buttonCategoriaRemover = LeafIconButton.createDefaultRemoveButton(); + + private final JPanel panelButtonsCategoriasLegislacao = new JPanel(); + + private final LeafButton buttonCategoriasLegislacaoCriar = LeafIconButton.createDefaultNewButton(); + + private final LeafButton buttonCategoriasLegislacaoRemover = LeafIconButton.createDefaultRemoveButton(); + + private final DefaultMutableTreeNode rootGeral = new DefaultMutableTreeNode(); + + private final DefaultTreeModel modelGeral = new DefaultTreeModel( rootGeral ); + + private final LeafTree treeGeral = new LeafTree( modelGeral ); + + private final JScrollPane scrollGeral = new JScrollPane( treeGeral ); + + private final DefaultMutableTreeNode rootCategorias = new DefaultMutableTreeNode(); + + private final DefaultTreeModel modelCategorias = new DefaultTreeModel( rootCategorias ); + + private final LeafTree treeCategorias = new LeafTree( modelCategorias ); + + private final JScrollPane scrollCategorias = new JScrollPane( treeCategorias ); + + private HsLegislacao selectedLegislacaoGeral = null; + + private HsLegislacao selectedLegislacaoEspecifica = null; + + private HsLegislacaoCategoria selectedCategoria = null; + + private final LeafTextAreaEditor panelData = new LeafTextAreaEditor( new Validator() + { + @Override + public boolean isValid( String object ) + { + return true; + } + } ); + + public GerirLegislacaoPanel() + { + startupComponents(); + startupLayout(); + placeComponents(); + setupListeners(); + reload(); + setEnable(); + } + + private void startupComponents() + { + panelGeral.setBorder( BorderFactory.createTitledBorder( "Legisla" + ccedil + atilde + "o de aplica" + ccedil + atilde + "o geral" ) ); + + panelCategorias.setBorder( BorderFactory.createTitledBorder( "Legisla" + ccedil + atilde + "o espec" + iacute + "fica" ) ); + panelButtonsCategoriasCategoria.setBorder( BorderFactory.createTitledBorder( "Categoria" ) ); + panelButtonsCategoriasLegislacao.setBorder( BorderFactory.createTitledBorder( "Legisla" + ccedil + atilde + "o" ) ); + + treeCategorias.setRootVisible( false ); + treeGeral.setRootVisible( false ); + treeCategorias.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); + treeGeral.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); + } + + private void startupLayout() + { + LayoutManager layout = new TableLayout( new double[] { + TableLayout.FILL, TableLayout.FILL + }, new double[] { + TableLayout.FILL, TableLayout.FILL + } ); + this.setLayout( layout ); + + layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM, TableLayout.FILL + } ); + panelGeral.setLayout( layout ); + + layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM, TableLayout.FILL + } ); + panelCategorias.setLayout( layout ); + + layout = new GridLayout( 1, 2, 5, 5 ); + panelButtonsGeral.setLayout( layout ); + + layout = new GridLayout( 1, 4, 5, 5 ); + panelButtonsCategoriasCategoria.setLayout( layout ); + + layout = new GridLayout( 1, 4, 5, 5 ); + panelButtonsCategoriasLegislacao.setLayout( layout ); + } + + private void placeComponents() + { + panelButtonsGeral.add( buttonGeralCriar ); + panelButtonsGeral.add( buttonGeralRemover ); + + panelButtonsCategoriasCategoria.add( buttonCategoriaCriar ); + panelButtonsCategoriasCategoria.add( buttonCategoriaEditar ); + panelButtonsCategoriasCategoria.add( buttonCategoriaRemover ); + panelButtonsCategoriasCategoria.add( new JPanel() ); + + panelButtonsCategoriasLegislacao.add( buttonCategoriasLegislacaoCriar ); + panelButtonsCategoriasLegislacao.add( buttonCategoriasLegislacaoRemover ); + panelButtonsCategoriasLegislacao.add( new JPanel() ); + panelButtonsCategoriasLegislacao.add( new JPanel() ); + + panelGeral.add( panelButtonsGeral, new TableLayoutConstraints( 0, 0 ) ); + panelGeral.add( scrollGeral, new TableLayoutConstraints( 0, 1, 1, 1 ) ); + + panelCategorias.add( panelButtonsCategoriasCategoria, new TableLayoutConstraints( 0, 0 ) ); + panelCategorias.add( panelButtonsCategoriasLegislacao, new TableLayoutConstraints( 1, 0 ) ); + panelCategorias.add( scrollCategorias, new TableLayoutConstraints( 0, 1, 2, 1 ) ); + + this.add( panelGeral, new TableLayoutConstraints( 0, 0 ) ); + this.add( panelCategorias, new TableLayoutConstraints( 0, 1 ) ); + this.add( panelData, new TableLayoutConstraints( 1, 0, 1, 1 ) ); + } + + private void setupListeners() + { + treeCategorias.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() + { + @Override + public void valueChanged( TreeSelectionEvent e ) + { + TreePath selectionPath = e.getNewLeadSelectionPath(); + if( selectionPath != null ) + { + Object last = selectionPath.getLastPathComponent(); + if( last instanceof DefaultMutableTreeNode ) + { + Object userObject = ((DefaultMutableTreeNode) last).getUserObject(); + if( userObject instanceof HsLegislacao ) + { + selectedLegislacaoEspecifica = (HsLegislacao) userObject; + } + else if( userObject instanceof HsLegislacaoCategoria ) + { + selectedCategoria = (HsLegislacaoCategoria) userObject; + } + } + treeGeral.clearSelection(); + selectedLegislacaoGeral = null; + } + else + { + selectedLegislacaoEspecifica = null; + selectedCategoria = null; + } + refreshData(); + setEnable(); + } + } ); + treeGeral.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() + { + @Override + public void valueChanged( TreeSelectionEvent e ) + { + TreePath selectionPath = e.getNewLeadSelectionPath(); + if( selectionPath != null ) + { + Object last = selectionPath.getLastPathComponent(); + if( last instanceof DefaultMutableTreeNode ) + { + Object userObject = ((DefaultMutableTreeNode) last).getUserObject(); + if( userObject instanceof HsLegislacao ) + { + selectedLegislacaoGeral = (HsLegislacao) userObject; + } + } + treeCategorias.clearSelection(); + selectedLegislacaoEspecifica = null; + selectedCategoria = null; + } + else + { + selectedLegislacaoGeral = null; + } + refreshData(); + setEnable(); + } + } ); + panelData.addPropertyChangeListener( LeafTextAreaEditor.ACTION_SAVE, new PropertyChangeListener() + { + @Override + public void propertyChange( PropertyChangeEvent evt ) + { + try + { + String newValue = (String) evt.getNewValue(); + if( selectedLegislacaoEspecifica != null ) + { + selectedLegislacaoEspecifica.setDescription( newValue ); + selectedLegislacaoEspecifica.save(); + } + else if( selectedLegislacaoGeral != null ) + { + selectedLegislacaoGeral.setDescription( newValue ); + selectedLegislacaoGeral.save(); + } + reload(); + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + } ); + buttonCategoriaCriar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + criarCategoria(); + } + } ); + buttonCategoriaEditar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + editarCategoria(); + } + } ); + buttonCategoriaRemover.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + removerCategoria(); + } + } ); + buttonCategoriasLegislacaoCriar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + criarCategoriaLegislacao(); + } + } ); + buttonCategoriasLegislacaoRemover.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + removerCategoriaLegislacao(); + } + } ); + buttonGeralCriar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + criarGeral(); + } + } ); + buttonGeralRemover.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + removerGeral(); + } + } ); + } + + private void criarCategoria() + { + try + { + String categoriaString = JOptionPane.showInputDialog( this, "Nova categoria", "" ); + if( categoriaString != null ) + { + HsLegislacaoCategoria novaCategoria = new HsLegislacaoCategoria(); + novaCategoria.setDescription( categoriaString ); + novaCategoria.save(); + reload(); + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void editarCategoria() + { + try + { + if( selectedCategoria != null ) + { + String categoriaString = JOptionPane.showInputDialog( this, "Nova categoria", selectedCategoria.getDescription() ); + if( categoriaString != null ) + { + selectedCategoria.setDescription( categoriaString ); + selectedCategoria.save(); + reload(); + } + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void removerCategoria() + { + try + { + if( selectedCategoria != null && LeafDialog.confirmDelete( false, false, "categoria" ) ) + { + selectedCategoria.setDeletedDate( new Date() ); + selectedCategoria.save(); + reload(); + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void criarCategoriaLegislacao() + { + try + { + if( selectedCategoria != null ) + { + HsLegislacao novaLegislacao = new HsLegislacao(); + novaLegislacao.setDescription( "" ); + novaLegislacao.setToHsLegislacaoCategoria( selectedCategoria ); + novaLegislacao.save(); + reload(); + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void removerCategoriaLegislacao() + { + try + { + if( selectedLegislacaoEspecifica != null && LeafDialog.confirmDelete( false, false, "legisla" + ccedil + atilde + "o" ) ) + { + selectedLegislacaoEspecifica.setDeletedDate( new Date() ); + selectedLegislacaoEspecifica.save(); + reload(); + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void removerGeral() + { + try + { + if( selectedLegislacaoGeral != null && LeafDialog.confirmDelete( false, false, "legisla" + ccedil + atilde + "o" ) ) + { + selectedLegislacaoGeral.setDeletedDate( new Date() ); + selectedLegislacaoGeral.save(); + reload(); + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void criarGeral() + { + try + { + HsLegislacao legislacao = new HsLegislacao(); + legislacao.setDescription( "" ); + legislacao.save(); + reload(); + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void reload() + { + rootGeral.removeAllChildren(); + rootCategorias.removeAllChildren(); + TreeTools.merge( rootGeral, HigieneSegurancaLogic.getLegislacaoGeral() ); + TreeTools.merge( rootCategorias, HigieneSegurancaLogic.getLegislacaoEspecifica() ); + TreeTools.refreshTree( treeGeral, rootGeral, false ); + TreeTools.refreshTree( treeCategorias, rootCategorias, false ); + } + + private void refreshData() + { + buttonCategoriaEditar.setEnabled( false ); + buttonCategoriaRemover.setEnabled( false ); + buttonCategoriasLegislacaoCriar.setEnabled( false ); + buttonCategoriasLegislacaoRemover.setEnabled( false ); + buttonGeralRemover.setEnabled( false ); + panelData.setEnabled( false ); + if( selectedLegislacaoEspecifica != null ) + { + panelData.setValue( selectedLegislacaoEspecifica.getDescription() ); + panelData.setEnabled( true ); + } + else if( selectedLegislacaoGeral != null ) + { + panelData.setValue( selectedLegislacaoGeral.getDescription() ); + panelData.setEnabled( true ); + } + else + { + panelData.setValue( null ); + } + if( selectedCategoria != null ) + { + buttonCategoriaEditar.setEnabled( true ); + buttonCategoriaRemover.setEnabled( true ); + } + } + + private void setEnable() + { + buttonCategoriaEditar.setEnabled( selectedCategoria != null ); + buttonCategoriaRemover.setEnabled( selectedCategoria != null ); + buttonCategoriasLegislacaoCriar.setEnabled( selectedCategoria != null ); + buttonCategoriasLegislacaoRemover.setEnabled( selectedLegislacaoEspecifica != null ); + buttonGeralRemover.setEnabled( selectedLegislacaoGeral != null ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/normalizacao/AdicionarNormalizacaoPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/normalizacao/AdicionarNormalizacaoPanel.java new file mode 100644 index 00000000..11df7767 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/normalizacao/AdicionarNormalizacaoPanel.java @@ -0,0 +1,209 @@ +package siprp.higiene.gestao.normalizacao; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; + +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreePath; + +import leaf.ui.LeafDialog; +import leaf.ui.TreeInserterDialog; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsNormalizacao; +import siprp.database.cayenne.objects.HsNormalizacaoEmpresa; +import siprp.database.cayenne.objects.HsNormalizacaoEstabelecimento; +import siprp.higiene.gestao.AdicionarPanel; +import siprp.logic.HigieneSegurancaLogic; + +import com.evolute.utils.ui.trees.TreeTools; + +public class AdicionarNormalizacaoPanel extends AdicionarPanel +{ + + private static final long serialVersionUID = 1L; + + private Empresas empresa = null; + + private Estabelecimentos estabelecimento = null; + + public void setEmpresa( Empresas empresa ) + { + this.empresa = empresa; + this.estabelecimento = null; + refresh(); + setEnabled(); + } + + public void setEstabelecimento( Estabelecimentos estabelecimento ) + { + this.empresa = null; + this.estabelecimento = estabelecimento; + refresh(); + setEnabled(); + } + + @Override + protected void add() + { + DefaultMutableTreeNode allNormalizacao = getAllNormalizacao(); + removeCurrent( allNormalizacao ); + TreeInserterDialog dialog = new TreeInserterDialog( "Adicionar Normaliza" + ccedil + atilde + "o", allNormalizacao ); + DefaultMutableTreeNode result = dialog.getResult(); + if( result != null ) + { + addResult( result ); + refresh(); + } + setEnabled(); + } + + private DefaultMutableTreeNode getAllNormalizacao() + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + if( empresa != null ) + { + result = HigieneSegurancaLogic.getNormalizacaoTreeForEmpresa( null ); + } + else if( estabelecimento != null ) + { + result = HigieneSegurancaLogic.getNormalizacaoTreeForEmpresa( estabelecimento.getToEmpresas() ); + } + return result; + } + + private void removeCurrent( DefaultMutableTreeNode all ) + { + if( all != null && root.getChildCount() == 2 && all.getChildCount() == 2 ) + { + DefaultMutableTreeNode portuguesaAll = (DefaultMutableTreeNode) all.getChildAt( 0 ); + DefaultMutableTreeNode internacionalAll = (DefaultMutableTreeNode) all.getChildAt( 1 ); + DefaultMutableTreeNode portuguesaCurrent = (DefaultMutableTreeNode) root.getChildAt( 0 ); + DefaultMutableTreeNode internacionalCurrent = (DefaultMutableTreeNode) root.getChildAt( 1 ); + TreeTools.remove( portuguesaAll, portuguesaCurrent ); + TreeTools.remove( internacionalAll, internacionalCurrent ); + } + setEnabled(); + } + + private void addResult( DefaultMutableTreeNode root ) + { + try + { + if( root != null ) + { + Object userObject = root.getUserObject(); + if( userObject instanceof HsNormalizacao ) + { + if( empresa != null ) + { + HsNormalizacaoEmpresa rel = new HsNormalizacaoEmpresa(); + rel.setToEmpresa( empresa ); + rel.setToHsNormalizacao( ((HsNormalizacao) userObject ) ); + rel.save(); + } + else if( estabelecimento != null ) + { + HsNormalizacaoEstabelecimento rel = new HsNormalizacaoEstabelecimento(); + rel.setToEstabelecimento( estabelecimento ); + rel.setToHsNormalizacao( ((HsNormalizacao) userObject ) ); + rel.save(); + } + } + } + for( int i = 0; i < root.getChildCount(); ++i ) + { + DefaultMutableTreeNode child = (DefaultMutableTreeNode) root.getChildAt( i ); + addResult( child ); + } + } + catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + @Override + public void refresh() + { + root.removeAllChildren(); + if( empresa != null) + { + TreeTools.merge( root, HigieneSegurancaLogic.getNormalizacaoTreeForEmpresa( empresa ) ); + } + if( estabelecimento != null ) + { + TreeTools.merge( root, HigieneSegurancaLogic.getNormalizacaoTreeForEstabelecimento( estabelecimento ) ); + } + TreeTools.refreshTree( tree, root, false ); + } + + @Override + protected void setEnabled() + { + buttonAdicionar.setEnabled( empresa != null || estabelecimento != null ); + buttonRemover.setEnabled( tree.getSelectionCount() > 0 ); + } + + @Override + protected void rem() + { + try + { + TreePath path = tree.getSelectionPath(); + if( path != null ) + { + DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); + Object obj = node.getUserObject(); + if( obj != null && (obj instanceof HsNormalizacao) ) + { + if( empresa != null ) + { + removeFromEmpresa( ((HsNormalizacao) obj ) ); + } + else if( estabelecimento != null ) + { + removeFromEstabelecimento( ((HsNormalizacao) obj )); + } + refresh(); + } + } + } + catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void removeFromEmpresa( HsNormalizacao normalizacao ) throws Exception + { + if( normalizacao != null && empresa != null && LeafDialog.confirmDelete( false, false, "normaliza" + ccedil + atilde + "o" ) ) + { + for( HsNormalizacaoEmpresa rel : empresa.getHsNormalizacaoEmpresaArray() ) + { + if( normalizacao.equals( rel.getToHsNormalizacao() ) ) + { + rel.delete(); + break; + } + } + } + } + + private void removeFromEstabelecimento( HsNormalizacao normalizacao ) throws Exception + { + if( normalizacao != null && estabelecimento != null && LeafDialog.confirmDelete( false, false, "normaliza" + ccedil + atilde + "o" ) ) + { + for( HsNormalizacaoEstabelecimento rel : estabelecimento.getHsNormalizacaoEstabelecimentoArray() ) + { + if( normalizacao.equals( rel.getToHsNormalizacao() ) ) + { + rel.delete(); + break; + } + } + + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/normalizacao/GerirNormalizacaoPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/normalizacao/GerirNormalizacaoPanel.java new file mode 100644 index 00000000..a77eaaf7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/normalizacao/GerirNormalizacaoPanel.java @@ -0,0 +1,555 @@ +package siprp.higiene.gestao.normalizacao; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import static com.evolute.utils.strings.UnicodeLatin1Map.oacute; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.GridLayout; +import java.awt.LayoutManager; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Date; + +import javax.swing.BorderFactory; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.event.CaretEvent; +import javax.swing.event.CaretListener; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +import leaf.ui.LeafButton; +import leaf.ui.LeafDialog; +import leaf.ui.LeafIconButton; +import leaf.ui.LeafTree; +import leaf.ui.LeafUIConstants; +import siprp.SIPRPSpellChecker; +import siprp.database.cayenne.objects.HsNormalizacao; +import siprp.logic.HigieneSegurancaLogic; + +import com.evolute.utils.ui.trees.TreeTools; + +public class GerirNormalizacaoPanel extends JPanel implements LeafUIConstants, CaretListener +{ + + private static final long serialVersionUID = 1L; + + private final JPanel panelPortuguesa = new JPanel(); + + private final JPanel panelInternacional = new JPanel(); + + private final JPanel panelButtonsPortuguesa = new JPanel(); + + private final LeafButton buttonPortuguesaCriar = LeafIconButton.createDefaultNewButton(); + + private final LeafButton buttonPortuguesaEditar = LeafIconButton.createDefaultEditButton(); + + private final LeafButton buttonPortuguesaRemover = LeafIconButton.createDefaultRemoveButton(); + + private final JPanel panelButtonsInternacional = new JPanel(); + + private final LeafButton buttonInternacionalCriar = LeafIconButton.createDefaultNewButton(); + + private final LeafButton buttonInternacionalEditar = LeafIconButton.createDefaultEditButton(); + + private final LeafButton buttonInternacionalRemover = LeafIconButton.createDefaultRemoveButton(); + + private final LeafButton buttonSave = LeafIconButton.createButton( ICON_NAME_SAVE ); + + private final LeafButton buttonRevert = LeafIconButton.createButton( ICON_NAME_REVERT ); + + private final DefaultMutableTreeNode rootPortuguesa = new DefaultMutableTreeNode(); + + private final DefaultTreeModel modelPortuguesa = new DefaultTreeModel( rootPortuguesa ); + + private final LeafTree treePortuguesa = new LeafTree( modelPortuguesa ); + + private final JScrollPane scrollPortuguesa = new JScrollPane( treePortuguesa ); + + private final DefaultMutableTreeNode rootInternacional = new DefaultMutableTreeNode(); + + private final DefaultTreeModel modelInternacional = new DefaultTreeModel( rootInternacional ); + + private final LeafTree treeInternacional = new LeafTree( modelInternacional ); + + private final JScrollPane scrollInternacional = new JScrollPane( treeInternacional ); + + private HsNormalizacao selectedPortuguesa = null; + + private HsNormalizacao selectedInternacional = null; + + private final JPanel panelData = new JPanel(); + + private final JTextField textCodigo = new JTextField(10); + + private final JTextArea textAreaDescricao = new JTextArea(); + + public GerirNormalizacaoPanel() + { + startupComponents(); + startupLayout(); + placeComponents(); + setupListeners(); + reload(); + setEnable(); + } + + private void startupComponents() + { + panelPortuguesa.setBorder( BorderFactory.createTitledBorder( "Normaliza" + ccedil + atilde + "o Portuguesa" ) ); + + panelInternacional.setBorder( BorderFactory.createTitledBorder( "Normaliza" + ccedil + atilde + "o Internacional" ) ); + + treeInternacional.setRootVisible( false ); + treePortuguesa.setRootVisible( false ); + treeInternacional.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); + treePortuguesa.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); + + textCodigo.setEnabled( false ); + + buttonSave.setEnabled( false ); + buttonRevert.setEnabled( false ); + } + + private void startupLayout() + { + LayoutManager layout = new TableLayout( new double[] { + TableLayout.FILL, TableLayout.FILL + }, new double[] { + TableLayout.FILL, TableLayout.FILL + } ); + this.setLayout( layout ); + + layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM, TableLayout.FILL + } ); + panelPortuguesa.setLayout( layout ); + ((TableLayout) layout).setHGap( 5 ); + ((TableLayout) layout).setVGap( 5 ); + + layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM, TableLayout.FILL + } ); + ((TableLayout) layout).setHGap( 5 ); + ((TableLayout) layout).setVGap( 5 ); + + panelInternacional.setLayout( layout ); + + layout = new GridLayout( 1, 3, 5, 5 ); + panelButtonsPortuguesa.setLayout( layout ); + + layout = new GridLayout( 1, 3, 5, 5 ); + panelButtonsInternacional.setLayout( layout ); + + layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.MINIMUM + }, new double[] { + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL + } ); + ((TableLayout) layout).setHGap( 5 ); + ((TableLayout) layout).setVGap( 5 ); + panelData.setLayout( layout ); + } + + private void placeComponents() + { + panelButtonsPortuguesa.add( buttonPortuguesaCriar ); + panelButtonsPortuguesa.add( buttonPortuguesaEditar ); + panelButtonsPortuguesa.add( buttonPortuguesaRemover ); + + panelButtonsInternacional.add( buttonInternacionalCriar ); + panelButtonsInternacional.add( buttonInternacionalEditar ); + panelButtonsInternacional.add( buttonInternacionalRemover ); + + panelPortuguesa.add( panelButtonsPortuguesa, new TableLayoutConstraints( 0, 0 ) ); + panelPortuguesa.add( scrollPortuguesa, new TableLayoutConstraints( 0, 1, 1, 1 ) ); + + panelInternacional.add( panelButtonsInternacional, new TableLayoutConstraints( 0, 0 ) ); + panelInternacional.add( scrollInternacional, new TableLayoutConstraints( 0, 1, 1, 1 ) ); + + panelData.add( buttonSave, new TableLayoutConstraints( 3, 0 ) ); + panelData.add( buttonRevert, new TableLayoutConstraints( 4, 0 ) ); + panelData.add( new JLabel("C" + oacute + "digo"), new TableLayoutConstraints( 0, 1 ) ); + panelData.add( textCodigo, new TableLayoutConstraints( 1, 1 ) ); + panelData.add( textAreaDescricao, new TableLayoutConstraints( 0, 2, 4, 2 ) ); + + this.add( panelPortuguesa, new TableLayoutConstraints( 0, 0 ) ); + this.add( panelInternacional, new TableLayoutConstraints( 0, 1 ) ); + this.add( panelData, new TableLayoutConstraints( 1, 0, 1, 1 ) ); + } + + private void setupListeners() + { + treeInternacional.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() + { + @Override + public void valueChanged( TreeSelectionEvent e ) + { + TreePath selectionPath = e.getNewLeadSelectionPath(); + if( selectionPath != null ) + { + Object last = selectionPath.getLastPathComponent(); + if( last instanceof DefaultMutableTreeNode ) + { + Object userObject = ((DefaultMutableTreeNode) last).getUserObject(); + if( userObject instanceof HsNormalizacao ) + { + selectedInternacional = (HsNormalizacao) userObject; + } + } + treePortuguesa.clearSelection(); + selectedPortuguesa = null; + } + else + { + selectedInternacional = null; + } + refreshData(); + setEnable(); + } + } ); + treePortuguesa.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() + { + @Override + public void valueChanged( TreeSelectionEvent e ) + { + TreePath selectionPath = e.getNewLeadSelectionPath(); + if( selectionPath != null ) + { + Object last = selectionPath.getLastPathComponent(); + if( last instanceof DefaultMutableTreeNode ) + { + Object userObject = ((DefaultMutableTreeNode) last).getUserObject(); + if( userObject instanceof HsNormalizacao ) + { + selectedPortuguesa = (HsNormalizacao) userObject; + } + } + treeInternacional.clearSelection(); + selectedInternacional = null; + } + else + { + selectedPortuguesa = null; + } + refreshData(); + setEnable(); + } + } ); + textCodigo.addCaretListener( this ); + textAreaDescricao.addCaretListener( this ); + SIPRPSpellChecker.getInstance().attachSpellCheckToComponent( textAreaDescricao ); + buttonPortuguesaCriar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + criarPortuguesa(); + } + } ); + buttonPortuguesaEditar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + editarPortuguesa(); + } + } ); + buttonPortuguesaRemover.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + removerPortuguesa(); + } + } ); + buttonInternacionalCriar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + criarInternacional(); + } + } ); + buttonInternacionalEditar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + editarInternacional(); + } + } ); + buttonInternacionalRemover.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + removerInternacional(); + } + } ); + buttonSave.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + try + { + save(); + } catch( Exception e1 ) + { + LeafDialog.error( e1 ); + } + } + } ); + buttonRevert.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + if( selectedInternacional != null ) + { + textAreaDescricao.setText( selectedInternacional.getDescricao() ); + textAreaDescricao.setEnabled( true ); + textCodigo.setText( selectedInternacional.getCodigo() ); + } + else if( selectedPortuguesa != null ) + { + textAreaDescricao.setText( selectedPortuguesa.getDescricao() ); + textAreaDescricao.setEnabled( true ); + textCodigo.setText( selectedPortuguesa.getCodigo() ); + } + else + { + textAreaDescricao.setText( "" ); + textCodigo.setText( "" ); + } + } + } ); + } + + private void save() throws Exception + { + if( selectedInternacional != null ) + { + selectedInternacional.setCodigo( textCodigo.getText() ); + selectedInternacional.setDescricao( textAreaDescricao.getText() ); + selectedInternacional.save(); + } + else if( selectedPortuguesa != null ) + { + selectedPortuguesa.setCodigo( textCodigo.getText() ); + selectedPortuguesa.setDescricao( textAreaDescricao.getText() ); + selectedPortuguesa.save(); + } + reload(); + } + + private String getCodigoForNormalizacao( boolean criar, boolean portuguesa ) + { + String result = null; + if( criar ) + { + result = JOptionPane.showInputDialog( this, "C" + oacute + "digo", "Criar normaliza" + ccedil + atilde + "o" + (portuguesa ? " Portuguesa": " internacional"), JOptionPane.QUESTION_MESSAGE ); + } + else + { + result = JOptionPane.showInputDialog( this, "C" + oacute + "digo", portuguesa ? selectedPortuguesa.getCodigo() : selectedInternacional.getCodigo() ); + } + return result; + } + + private boolean isValidCodigo( String codigo ) + { + boolean result = false; + if( codigo != null ) + { + result = true; + } + return result; + } + + private void criarPortuguesa() + { + try + { + String codigo = getCodigoForNormalizacao(true,true); + if( isValidCodigo(codigo) ) + { + HsNormalizacao normalizacao = new HsNormalizacao(); + normalizacao.setDescricao( "" ); + normalizacao.setCodigo( codigo ); + normalizacao.setPortuguesa( true ); + normalizacao.save(); + reload(); + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void editarPortuguesa() + { + try + { + if( selectedPortuguesa != null ) + { + String codigo = getCodigoForNormalizacao(false, true); + if( isValidCodigo(codigo) ) + { + selectedPortuguesa.setCodigo( codigo ); + selectedPortuguesa.save(); + reload(); + } + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void removerPortuguesa() + { + try + { + if( selectedPortuguesa != null && LeafDialog.confirmDelete( false, false, "normaliza" + ccedil + atilde + "o" ) ) + { + selectedPortuguesa.setDeletedDate( new Date() ); + selectedPortuguesa.save(); + reload(); + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void criarInternacional() + { + try + { + String codigo = getCodigoForNormalizacao(true, false); + if( isValidCodigo(codigo) ) + { + HsNormalizacao normalizacao = new HsNormalizacao(); + normalizacao.setDescricao( "" ); + normalizacao.setCodigo( codigo ); + normalizacao.setPortuguesa( false ); + normalizacao.save(); + reload(); + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void editarInternacional() + { + try + { + if( selectedInternacional != null ) + { + String codigo = getCodigoForNormalizacao(false, false); + if( isValidCodigo(codigo) ) + { + selectedInternacional.setCodigo( codigo ); + selectedInternacional.save(); + reload(); + } + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void removerInternacional() + { + try + { + if( selectedInternacional != null && LeafDialog.confirmDelete( false, false, "normaliza" + ccedil + atilde + "o" ) ) + { + selectedInternacional.setDeletedDate( new Date() ); + selectedInternacional.save(); + reload(); + } + } + catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + + private void reload() + { + rootPortuguesa.removeAllChildren(); + rootInternacional.removeAllChildren(); + textCodigo.setText( "" ); + TreeTools.merge( rootPortuguesa, HigieneSegurancaLogic.getNormalizacaoTree( true ) ); + TreeTools.merge( rootInternacional, HigieneSegurancaLogic.getNormalizacaoTree( false ) ); + TreeTools.refreshTree( treePortuguesa, rootPortuguesa, false ); + TreeTools.refreshTree( treeInternacional, rootInternacional, false ); + } + + private void refreshData() + { + buttonInternacionalRemover.setEnabled( false ); + buttonPortuguesaRemover.setEnabled( false ); + buttonInternacionalEditar.setEnabled( false ); + buttonPortuguesaEditar.setEnabled( false ); + textAreaDescricao.setEnabled( false ); + buttonSave.setEnabled( false ); + buttonRevert.setEnabled( false ); + if( selectedInternacional != null ) + { + textAreaDescricao.setText( selectedInternacional.getDescricao() ); + textAreaDescricao.setEnabled( true ); + textCodigo.setText( selectedInternacional.getCodigo() ); + textCodigo.setEnabled( true ); + } + else if( selectedPortuguesa != null ) + { + textAreaDescricao.setText( selectedPortuguesa.getDescricao() ); + textAreaDescricao.setEnabled( true ); + textCodigo.setText( selectedPortuguesa.getCodigo() ); + textCodigo.setEnabled( true ); + } + else + { + textAreaDescricao.setText( "" ); + textCodigo.setText( "" ); + } + } + + private void setEnable() + { + buttonPortuguesaEditar.setEnabled( selectedPortuguesa != null ); + buttonPortuguesaRemover.setEnabled( selectedPortuguesa != null ); + buttonInternacionalEditar.setEnabled( selectedInternacional != null ); + buttonInternacionalRemover.setEnabled( selectedInternacional != null ); + } + + @Override + public void caretUpdate( CaretEvent e ) + { + buttonSave.setEnabled( true ); + buttonRevert.setEnabled( true ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/postos/AdicionarAreasPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/postos/AdicionarAreasPanel.java new file mode 100644 index 00000000..1851ae15 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/postos/AdicionarAreasPanel.java @@ -0,0 +1,240 @@ +package siprp.higiene.gestao.postos; + +import static com.evolute.utils.strings.UnicodeLatin1Map.aacute; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +import leaf.ui.LeafButton; +import leaf.ui.LeafDialog; +import leaf.ui.LeafIconButton; +import leaf.ui.LeafTree; +import leaf.ui.TreeInserterDialog; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsPosto; +import siprp.database.cayenne.objects.HsPostoEstabelecimento; +import siprp.logic.HigieneSegurancaLogic; +import siprp.logic.node.AreaNode; +import siprp.logic.node.PostoNode; + +import com.evolute.utils.ui.trees.TreeTools; + +public class AdicionarAreasPanel extends JPanel +{ + + private static final long serialVersionUID = 1L; + + public static final String SELECTION_CHANGED = "SELECTION_CHANGED"; + + private static final String ICON_NAME_SAVE = "siprp/higiene/gestao/add.png"; + + private static final String ICON_NAME_REVERT = "siprp/higiene/gestao/delete.png"; + + protected final LeafButton buttonAdicionar = LeafIconButton.createButton( ICON_NAME_SAVE ); + + protected final LeafButton buttonRemover = LeafIconButton.createButton( ICON_NAME_REVERT ); + + private final DefaultMutableTreeNode root = new DefaultMutableTreeNode(); + + private final DefaultTreeModel model = new DefaultTreeModel( root ); + + public final LeafTree tree = new LeafTree( model ); + + private final JScrollPane scroll = new JScrollPane( tree ); + + private Estabelecimentos estabelecimento = null; + + public AdicionarAreasPanel() + { + startupComponents(); + setupLayout(); + placeComponents(); + startupListeners(); + } + + private void startupComponents() + { + buttonAdicionar.setEnabled( false ); + buttonRemover.setEnabled( false ); + tree.setRootVisible( false ); + tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); + } + + private void setupLayout() + { + TableLayout layout = new TableLayout( new double[] { + TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM, TableLayout.FILL + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + setLayout( layout ); + } + + private void placeComponents() + { + JPanel panel = new JPanel(); + TableLayout layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + panel.setLayout( layout ); + panel.add( buttonAdicionar, new TableLayoutConstraints( 0, 0 ) ); + panel.add( buttonRemover, new TableLayoutConstraints( 1, 0 ) ); + + add( panel, new TableLayoutConstraints( 0, 0 ) ); + add( scroll, new TableLayoutConstraints( 0, 1 ) ); + } + + private void startupListeners() + { + tree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() + { + @Override + public void valueChanged( TreeSelectionEvent e ) + { + setEnabled(); + TreePath path = tree.getSelectionPath(); + Object object = path == null ? null : path.getLastPathComponent(); + HsPosto posto = object == null ? null : ((object instanceof PostoNode) ? (HsPosto) ((PostoNode) object).getUserObject() : null); + firePropertyChange( SELECTION_CHANGED, null, posto ); + } + } ); + buttonAdicionar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + add(); + } + } ); + buttonRemover.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + rem(); + } + } ); + } + + private void add() + { + DefaultMutableTreeNode allPostos = HigieneSegurancaLogic.getAreasTree( estabelecimento.getToEmpresas() ); + TreeTools.removeAll( allPostos, HigieneSegurancaLogic.getPostosTree( estabelecimento ) ); + TreeInserterDialog dialog = new TreeInserterDialog( "Adicionar Postos de Trabalho", allPostos ); + save( dialog.getResult() ); + refresh(); + } + + private void save( DefaultMutableTreeNode toadd ) + { + try + { + Object obj = toadd.getUserObject(); + if( obj instanceof HsPosto ) + { + HsPostoEstabelecimento rel = new HsPostoEstabelecimento(); + rel.setToEstabelecimentos( estabelecimento ); + rel.setToHsPosto( (HsPosto) obj ); + rel.save(); + } + else + { + for( int i = 0; i < toadd.getChildCount(); ++i ) + { + save( (DefaultMutableTreeNode) toadd.getChildAt( i ) ); + } + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void rem() + { + TreePath path = tree.getSelectionPath(); + if( path != null ) + { + Object object = path.getLastPathComponent(); + if( ( object instanceof PostoNode ) && LeafDialog.confirmDelete( true, false, "posto" ) ) + { + HsPosto posto = ((HsPosto) ((PostoNode) object).getUserObject()); + remPosto( posto ); + } + else if( ( object instanceof AreaNode ) && LeafDialog.confirmDelete( false, false, aacute + "rea" ) ) + { + for( int i = 0; i < ((AreaNode) object).getChildCount(); ++i ) + { + PostoNode postoNode = (PostoNode) ((AreaNode) object).getChildAt( i ); + remPosto( (HsPosto) postoNode.getUserObject() ); + } + } + } + refresh(); + } + + private void remPosto( HsPosto posto ) + { + try + { + HsPostoEstabelecimento toDelete = null; + for( HsPostoEstabelecimento rel : posto.getHsPostoEstabelecimentoArray() ) + { + if( rel.getToEstabelecimentos().equals( estabelecimento ) ) + { + toDelete = rel; + break; + } + } + if( toDelete != null ) + { + toDelete.delete(); + } + } + catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void setEnabled() + { + buttonAdicionar.setEnabled( estabelecimento != null ); + buttonRemover.setEnabled( tree.getSelectionCount() > 0 ); + } + + public void refresh() + { + root.removeAllChildren(); + if( estabelecimento != null ) + { + TreeTools.merge( root, HigieneSegurancaLogic.getAreasTree( estabelecimento ) ); + } + setEnabled(); + TreeTools.refreshTree( tree, root, false ); + } + + public void setEstabelecimento( Estabelecimentos estabelecimento ) + { + this.estabelecimento = estabelecimento; + refresh(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/postos/GerirAreasPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/postos/GerirAreasPanel.java new file mode 100644 index 00000000..0468a490 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/postos/GerirAreasPanel.java @@ -0,0 +1,454 @@ +package siprp.higiene.gestao.postos; + +import static com.evolute.utils.strings.UnicodeLatin1Map.aacute; +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import static com.evolute.utils.strings.UnicodeLatin1Map.eacute; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +import javax.swing.BorderFactory; +import javax.swing.JCheckBox; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +import leaf.ui.LeafButton; +import leaf.ui.LeafDialog; +import leaf.ui.LeafIconButton; +import leaf.ui.LeafTree; +import leaf.ui.LeafUIConstants; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.HsArea; +import siprp.database.cayenne.objects.HsPosto; +import siprp.logic.node.AreaNode; +import siprp.logic.node.PostoNode; + +import com.evolute.utils.ui.trees.TreeTools; + +public class GerirAreasPanel extends JPanel implements LeafUIConstants +{ + + private static final long serialVersionUID = 1L; + + private final JPanel panelButtons = new JPanel(); + + private final JPanel panelTree = new JPanel(); + + public final LeafButton buttonAreaCriar = LeafIconButton.createDefaultNewButton(); + + public final LeafButton buttonAreaEditar = LeafIconButton.createDefaultEditButton(); + + public final LeafButton buttonAreaRemover = LeafIconButton.createDefaultRemoveButton(); + + public final LeafButton buttonPostoCriar = LeafIconButton.createDefaultNewButton(); + + public final LeafButton buttonPostoEditar = LeafIconButton.createDefaultEditButton(); + + public final LeafButton buttonPostoRemover = LeafIconButton.createDefaultRemoveButton(); + + private final JCheckBox checkGenerico = new JCheckBox( "Gen"+eacute+"rico" ); + + private final DefaultMutableTreeNode root = new DefaultMutableTreeNode(); + + private final DefaultTreeModel model = new DefaultTreeModel( root ); + + public final LeafTree tree = new LeafTree( model ); + + private final JScrollPane scroll = new JScrollPane( tree ); + + private Empresas empresa = null; + + public GerirAreasPanel() + { + startupComponents(); + startupLayout(); + placeComponents(); + setupListeners(); + } + + private void startupComponents() + { + panelButtons.setPreferredSize( new Dimension( 150, 0 ) ); + panelTree.setPreferredSize( new Dimension( 300, 0 ) ); + tree.setRootVisible( false ); + tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); + } + + private void startupLayout() + { + TableLayout layout = new TableLayout( new double[] { + TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM, TableLayout.FILL + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + setLayout( layout ); + + layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + panelButtons.setLayout( layout ); + + layout = new TableLayout( new double[] { + TableLayout.FILL + }, new double[] { + TableLayout.FILL + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + panelTree.setLayout( layout ); + } + + private void placeComponents() + { + JPanel panel = new JPanel(); + panel.setBorder( BorderFactory.createTitledBorder( "Area" ) ); + panel.setLayout( new GridLayout( 1, 3 ) ); + panel.add( buttonAreaCriar ); + panel.add( buttonAreaEditar ); + panel.add( buttonAreaRemover ); + panelButtons.add( panel, new TableLayoutConstraints( 0, 0 ) ); + + panel = new JPanel(); + panel.setBorder( BorderFactory.createTitledBorder( "Posto" ) ); + panel.setLayout( new GridLayout( 1, 3 ) ); + panel.add( buttonPostoCriar ); + panel.add( buttonPostoEditar ); + panel.add( buttonPostoRemover ); + panelButtons.add( panel, new TableLayoutConstraints( 1, 0 ) ); + + panelButtons.add( checkGenerico, new TableLayoutConstraints(2,0)); + + panelTree.add( scroll, new TableLayoutConstraints( 0, 0 ) ); + + add( panelButtons, new TableLayoutConstraints( 0, 0 ) ); + add( panelTree, new TableLayoutConstraints( 0, 1 ) ); + } + + private void setupListeners() + { + tree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() + { + @Override + public void valueChanged( TreeSelectionEvent e ) + { + setSelected(); + } + } ); + buttonAreaCriar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + criarArea(); + } + } ); + buttonAreaEditar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + editarArea(); + } + } ); + buttonAreaRemover.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + removerArea(); + } + } ); + buttonPostoCriar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + criarPosto(); + } + } ); + buttonPostoEditar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + editarPosto(); + } + } ); + buttonPostoRemover.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + removerPosto(); + } + } ); + checkGenerico.addItemListener( new ItemListener() + { + @Override + public void itemStateChanged( ItemEvent e ) + { + HsPosto posto = getSelectedPosto(); + if( posto != null ) + { + posto.setIsPrincipal( checkGenerico.isSelected() ); + try + { + posto.save(); + } catch( Exception e1 ) + { + e1.printStackTrace(); + } + } + } + } ); + } + + private void criarArea() + { + try + { + if( empresa != null ) + { + String areaString = JOptionPane.showInputDialog( this, "Descri" + ccedil + atilde + "o", "Criar nova " + aacute + "rea", JOptionPane.QUESTION_MESSAGE ); + if( areaString != null ) + { + HsArea area = new HsArea(); + area.setToEmpresas( empresa ); + area.setDescription( areaString ); + area.save(); + refresh(); + } + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void editarArea() + { + try + { + HsArea area = getSelectedArea(); + if( area != null ) + { + String areaString = JOptionPane.showInputDialog( this, "Descri" + ccedil + atilde + "o", area.getDescription() ); + if( areaString != null ) + { + area.setDescription( areaString ); + area.save(); + refresh(); + } + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void removerArea() + { + try + { + HsArea area = getSelectedArea(); + if( area != null && LeafDialog.confirmDelete( false, false, aacute + "rea") ) + { + area.delete(); + refresh(); + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void criarPosto() + { + try + { + HsArea area = getSelectedArea(); + if( area != null ) + { + String postoString = JOptionPane.showInputDialog( this, "Descri" + ccedil + atilde + "o", "Criar novo posto de trabalho", JOptionPane.QUESTION_MESSAGE ); + if( postoString != null ) + { + HsPosto posto = new HsPosto(); + posto.setToHsArea( area ); + posto.setDescription( postoString ); + posto.save(); + refresh(); + } + refresh(); + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void editarPosto() + { + try + { + HsPosto posto = getSelectedPosto(); + if( posto != null ) + { + String postoString = JOptionPane.showInputDialog( this, "Descri" + ccedil + atilde + "o", posto.getDescription() ); + if( postoString != null ) + { + posto.setDescription( postoString ); + posto.save(); + refresh(); + } + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void removerPosto() + { + try + { + HsPosto posto = getSelectedPosto(); + if( posto != null && LeafDialog.confirmDelete( true, false, "posto" ) ) + { + posto.setDeletedDate( new Date() ); + posto.save(); + refresh(); + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private HsArea getSelectedArea() + { + HsArea result = null; + TreePath path = tree.getSelectionPath(); + if( path != null ) + { + Object leaf = path.getLastPathComponent(); + if( leaf != null ) + { + if( leaf instanceof AreaNode ) + { + result = (HsArea) ((AreaNode) leaf).getUserObject(); + } + else if( leaf instanceof PostoNode ) + { + result = (HsArea) ((HsPosto) ((PostoNode) leaf).getUserObject()).getToHsArea(); + } + } + } + return result; + } + + private HsPosto getSelectedPosto() + { + HsPosto result = null; + TreePath path = tree.getSelectionPath(); + if( path != null ) + { + Object leaf = path.getLastPathComponent(); + if( leaf != null && (leaf instanceof PostoNode) ) + { + result = (HsPosto) ((PostoNode) leaf).getUserObject(); + } + } + return result; + } + + private void setSelected() + { + TreePath path = tree.getSelectionPath(); + TreeNode node = path == null ? null : (TreeNode) path.getLastPathComponent(); + boolean areaSelected = node != null && (node instanceof AreaNode); + boolean postoSelected = node != null && (node instanceof PostoNode); + buttonPostoCriar.setEnabled( areaSelected || postoSelected ); + buttonPostoEditar.setEnabled( postoSelected ); + buttonPostoRemover.setEnabled( postoSelected ); + buttonAreaRemover.setEnabled( areaSelected ); + buttonAreaCriar.setEnabled( empresa != null ); + buttonAreaEditar.setEnabled( areaSelected ); + checkGenerico.setEnabled( postoSelected ); + boolean generico = false; + if( postoSelected && node != null) + { + HsPosto posto = (HsPosto) ((PostoNode) node).getUserObject(); + generico = posto != null && (posto.getIsPrincipal() ==null ? false : posto.getIsPrincipal() ); + } + checkGenerico.setSelected(generico); + } + + public void refresh() + { + root.removeAllChildren(); + if( empresa != null ) + { + List areas = empresa.getHsAreaArray(); + Collections.sort( areas ); + for( HsArea area : areas ) + { + addArea( area ); + } + } + setSelected(); + TreeTools.refreshTree( tree, root, false ); + } + + private void addArea( HsArea area ) + { + if( area != null ) + { + AreaNode areaNode = new AreaNode( area ); + for( HsPosto posto : area.getHsPostoArray() ) + { + addPosto( posto, areaNode ); + } + root.add( areaNode ); + } + } + + private void addPosto( HsPosto posto, AreaNode areaNode ) + { + if( posto != null && posto.getDeletedDate() == null ) + { + PostoNode postoNode = new PostoNode( posto ); + areaNode.add( postoNode ); + } + } + + public void setEmpresa( Empresas empresa ) + { + this.empresa = empresa; + refresh(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/riscos/AdicionarRiscosPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/riscos/AdicionarRiscosPanel.java new file mode 100644 index 00000000..8ceb203f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/riscos/AdicionarRiscosPanel.java @@ -0,0 +1,308 @@ +package siprp.higiene.gestao.riscos; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Collections; +import java.util.List; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +import leaf.ui.LeafButton; +import leaf.ui.LeafDialog; +import leaf.ui.LeafIconButton; +import leaf.ui.LeafTree; +import leaf.ui.TreeInserterDialog; +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.HsPosto; +import siprp.database.cayenne.objects.HsPostoRisco; +import siprp.database.cayenne.objects.HsRisco; +import siprp.database.cayenne.objects.HsRiscoEmpresa; +import siprp.logic.HigieneSegurancaLogic; +import siprp.logic.node.NodeRisco; + +import com.evolute.utils.ui.trees.TreeTools; + +public class AdicionarRiscosPanel extends JPanel +{ + + private static final long serialVersionUID = 1L; + + public static final String SELECTION_CHANGED = "RISCOS_SELECTION_CHANGED"; + + private static final String ICON_NAME_SAVE = "siprp/higiene/gestao/add.png"; + + private static final String ICON_NAME_REVERT = "siprp/higiene/gestao/delete.png"; + + protected final LeafButton buttonAdicionar = LeafIconButton.createButton( ICON_NAME_SAVE ); + + protected final LeafButton buttonRemover = LeafIconButton.createButton( ICON_NAME_REVERT ); + + private final DefaultMutableTreeNode root = new DefaultMutableTreeNode(); + + private final DefaultTreeModel model = new DefaultTreeModel( root ); + + public final LeafTree tree = new LeafTree( model ); + + private final JScrollPane scroll = new JScrollPane( tree ); + + private Empresas empresa = null; + + private HsPosto posto = null; + + public AdicionarRiscosPanel() + { + startupComponents(); + setupLayout(); + placeComponents(); + startupListeners(); + } + + private void startupComponents() + { + buttonAdicionar.setEnabled( false ); + buttonRemover.setEnabled( false ); + tree.setRootVisible( false ); + tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); + } + + private void setupLayout() + { + TableLayout layout = new TableLayout( new double[] { + TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM, TableLayout.FILL + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + setLayout( layout ); + } + + private void placeComponents() + { + JPanel panel = new JPanel(); + TableLayout layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + panel.setLayout( layout ); + panel.add( buttonAdicionar, new TableLayoutConstraints( 0, 0 ) ); + panel.add( buttonRemover, new TableLayoutConstraints( 1, 0 ) ); + + add( panel, new TableLayoutConstraints( 0, 0 ) ); + add( scroll, new TableLayoutConstraints( 0, 1 ) ); + } + + private void startupListeners() + { + buttonAdicionar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + add(); + } + } ); + buttonRemover.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + rem(); + } + } ); + tree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() + { + @Override + public void valueChanged( TreeSelectionEvent e ) + { + setEnabled(); + TreePath path = tree.getSelectionPath(); + if( path != null ) + { + Object selection = path.getLastPathComponent(); + firePropertyChange( SELECTION_CHANGED, null, selection ); + } + } + } ); + } + + private void add() + { + DefaultMutableTreeNode allRiscos = getAllRiscos(); + TreeTools.removeAll( allRiscos, getRiscosTree() ); + TreeInserterDialog dialog = new TreeInserterDialog( "Adicionar Riscos", allRiscos ); + DefaultMutableTreeNode result = dialog.getResult(); + if( result != null ) + { + addResult( result ); + refresh(); + } + setEnabled(); + } + + private DefaultMutableTreeNode getAllRiscos() + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + if( posto == null ) + { + result = HigieneSegurancaLogic.getRiscosTree(); + } + else + { + result = HigieneSegurancaLogic.getRiscosTree( posto.getToHsArea().getToEmpresas() ); + } + return result; + } + + private DefaultMutableTreeNode getRiscosTree() + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + for( int i = 0; i < root.getChildCount(); ++i ) + { + DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) root.getChildAt( i ); + BaseObject userObject = (BaseObject) childNode.getUserObject(); + HsRisco risco = null; + if( userObject instanceof HsRiscoEmpresa ) + { + risco = ((HsRiscoEmpresa) userObject).getToHsRisco(); + } + else if( userObject instanceof HsPostoRisco ) + { + risco = ((HsPostoRisco) userObject).getToHsRisco(); + } + if( risco != null ) + { + result.add( new NodeRisco( risco ) ); + } + } + return result; + } + + private void addResult( DefaultMutableTreeNode root ) + { + try + { + if( root != null ) + { + if( root instanceof NodeRisco ) + { + HsRisco risco = (HsRisco) root.getUserObject(); + if( empresa != null ) + { + HsRiscoEmpresa rel = new HsRiscoEmpresa(); + rel.setToEmpresa( empresa ); + rel.setToHsRisco( risco ); + rel.save(); + } + else if( posto != null ) + { + HsPostoRisco rel = new HsPostoRisco(); + rel.setToHsPosto( posto ); + rel.setToHsRisco( risco ); + rel.save(); + } + } + for( int i = 0; i < root.getChildCount(); ++i ) + { + DefaultMutableTreeNode child = (DefaultMutableTreeNode) root.getChildAt( i ); + addResult( child ); + } + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void rem() + { + try + { + TreePath path = tree.getSelectionPath(); + if( path != null ) + { + DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); + Object obj = node.getUserObject(); + if( obj != null && LeafDialog.confirmDelete( true, false, "risco" ) ) + { + ((BaseObject) obj).delete(); + refresh(); + } + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void setEnabled() + { + if( empresa != null ) + { + buttonAdicionar.setEnabled( true ); + } + else if( posto != null ) + { + buttonAdicionar.setEnabled( true ); + } + else + { + buttonAdicionar.setEnabled( false ); + } + buttonRemover.setEnabled( tree.getSelectionCount() > 0 ); + } + + public void refresh() + { + root.removeAllChildren(); + if( empresa != null ) + { + List riscos = empresa.getHsRiscoEmpresaArray(); + Collections.sort( riscos ); + for( HsRiscoEmpresa rel : riscos ) + { + root.add( new DefaultMutableTreeNode( rel ) ); + } + } + else if( posto != null ) + { + List riscos = posto.getHsPostoRiscoArray(); + Collections.sort( riscos ); + for( HsPostoRisco rel : riscos ) + { + root.add( new DefaultMutableTreeNode( rel ) ); + } + } + setEnabled(); + TreeTools.refreshTree( tree, root, false ); + } + + public void setEmpresa( Empresas empresa ) + { + this.empresa = empresa; + this.posto = null; + refresh(); + } + + public void setPosto( HsPosto posto ) + { + this.posto = posto; + this.empresa = null; + refresh(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/riscos/GerirMedidaPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/riscos/GerirMedidaPanel.java new file mode 100644 index 00000000..51393615 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/riscos/GerirMedidaPanel.java @@ -0,0 +1,199 @@ +package siprp.higiene.gestao.riscos; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.event.CaretEvent; +import javax.swing.event.CaretListener; + +import leaf.ui.LeafButton; +import leaf.ui.LeafDialog; +import siprp.SIPRPSpellChecker; +import siprp.database.cayenne.objects.HsMedida; + +import com.evolute.utils.images.ImageException; +import com.evolute.utils.images.ImageIconLoader; + +public class GerirMedidaPanel extends JPanel +{ + + public static final String MEDIDA_CHANGED = "MEDIDA_CHANGED"; + + private static final long serialVersionUID = 1L; + + private static final String ICON_NAME_SAVE = "leaf/ui/icons/save.png"; + + private static final String ICON_NAME_REVERT = "leaf/ui/icons/revert.png"; + + private LeafButton buttonSaveRequesito; + + private LeafButton buttonRevertRequesito; + + private final JTextArea fieldTextMedida = new JTextArea(); + + private final JScrollPane scrollMedida = new JScrollPane( fieldTextMedida ); + + private final JTextArea fieldTextRequisitosLegais = new JTextArea(); + + private final JScrollPane scrollRequesitos = new JScrollPane( fieldTextRequisitosLegais ); + + private HsMedida medida = null; + + public GerirMedidaPanel() + { + try + { + buttonSaveRequesito = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_SAVE ) ); + buttonRevertRequesito = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_REVERT ) ); + } catch( ImageException e ) + { + e.printStackTrace(); + } + startupComponents(); + startupLayout(); + placeComponents(); + setupListeners(); + } + + private void startupComponents() + { + fieldTextMedida.setWrapStyleWord( true ); + fieldTextMedida.setLineWrap( true ); + SIPRPSpellChecker.getInstance().attachSpellCheckToComponent( fieldTextMedida ); + fieldTextRequisitosLegais.setWrapStyleWord( true ); + fieldTextRequisitosLegais.setLineWrap( true ); + SIPRPSpellChecker.getInstance().attachSpellCheckToComponent( fieldTextRequisitosLegais ); + scrollMedida.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + scrollMedida.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + scrollRequesitos.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + scrollRequesitos.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + buttonSaveRequesito.setMargin( new Insets( 0, 0, 0, 0 ) ); + buttonRevertRequesito.setMargin( new Insets( 0, 0, 0, 0 ) ); + } + + private void setupListeners() + { + fieldTextRequisitosLegais.addCaretListener( new CaretListener() + { + @Override + public void caretUpdate( CaretEvent e ) + { + setEnabled(); + } + } ); + fieldTextMedida.addCaretListener( new CaretListener() + { + @Override + public void caretUpdate( CaretEvent e ) + { + setEnabled(); + } + } ); + buttonSaveRequesito.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + saveRequesito(); + } + } ); + buttonRevertRequesito.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + revertRequesito(); + } + } ); + } + + private void startupLayout() + { + TableLayout layout = new TableLayout( new double[] { + TableLayout.FILL, TableLayout.MINIMUM, TableLayout.MINIMUM + }, new double[] { + TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.FILL + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + setLayout( layout ); + } + + private void placeComponents() + { + add( new JLabel( "Requisitos legais" ), new TableLayoutConstraints( 0, 0 ) ); + add( buttonSaveRequesito, new TableLayoutConstraints( 1, 0 ) ); + add( buttonRevertRequesito, new TableLayoutConstraints( 2, 0 ) ); + add( scrollRequesitos, new TableLayoutConstraints( 0, 1, 2, 1 ) ); + add( new JLabel( "Medida" ), new TableLayoutConstraints( 0, 2 ) ); + add( scrollMedida, new TableLayoutConstraints( 0, 3, 2, 3 ) ); + } + + private void setEnabled() + { + boolean medidaChanged = false; + boolean requesitoChanged = false; + if( medida != null ) + { + medidaChanged = !fieldTextMedida.getText().equals( medida.getDescription() ); + requesitoChanged = !fieldTextRequisitosLegais.getText().equals( medida.getRequesitosLegais() ); + } + buttonSaveRequesito.setEnabled( requesitoChanged || medidaChanged ); + buttonRevertRequesito.setEnabled( requesitoChanged || medidaChanged ); + } + + private void saveRequesito() + { + try + { + if( medida != null ) + { + medida.setRequesitosLegais( fieldTextRequisitosLegais.getText() ); + medida.setDescription( fieldTextMedida.getText() ); + medida.save(); + refresh(); + } + setEnabled(); + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void revertRequesito() + { + if( medida != null ) + { + fieldTextRequisitosLegais.setText( medida.getRequesitosLegais() ); + fieldTextMedida.setText( medida.getDescription() ); + } + setEnabled(); + } + + private void refresh() + { + firePropertyChange( MEDIDA_CHANGED, null, medida ); + } + + public void setMedida( HsMedida medida ) + { + this.medida = medida; + fieldTextMedida.setText( medida == null ? null : medida.getDescription() ); + fieldTextRequisitosLegais.setText( medida == null ? null : medida.getRequesitosLegais() ); + setEnabled(); + } + + public HsMedida getMedida() + { + return this.medida; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/riscos/GerirRiscosPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/riscos/GerirRiscosPanel.java new file mode 100644 index 00000000..88f7ae4f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/riscos/GerirRiscosPanel.java @@ -0,0 +1,570 @@ +package siprp.higiene.gestao.riscos; + +import static com.evolute.utils.strings.UnicodeLatin1Map.aacute; +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.CardLayout; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + +import javax.swing.BorderFactory; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +import leaf.ui.LeafButton; +import leaf.ui.LeafDialog; +import leaf.ui.LeafIconButton; +import leaf.ui.LeafTree; +import leaf.ui.LeafUIConstants; +import siprp.database.cayenne.objects.HsMedida; +import siprp.database.cayenne.objects.HsRisco; +import siprp.database.cayenne.objects.HsRiscoMedida; +import siprp.database.cayenne.objects.HsRiscoTema; +import siprp.logic.HigieneSegurancaLogic; + +import com.evolute.utils.ui.trees.TreeTools; + +public class GerirRiscosPanel extends JPanel implements LeafUIConstants +{ + + private static final long serialVersionUID = 1L; + + private static final String PANEL_TEMA = "PANEL_TEMA"; + + private static final String PANEL_RISCO = "PANEL_RISCO"; + + private static final String PANEL_MEDIDA = "PANEL_MEDIDA"; + + private final JPanel panelButtons = new JPanel(); + + private final JPanel panelTree = new JPanel(); + + private final JPanel panelData = new JPanel(); + + private final JPanel panelDataTema = new JPanel(); + + private final JPanel panelDataRisco = new JPanel(); + + private final GerirMedidaPanel panelDataMedida = new GerirMedidaPanel(); + + private final LeafButton buttonTemaCriar = LeafIconButton.createDefaultNewButton(); + + private final LeafButton buttonTemaEditar = LeafIconButton.createDefaultEditButton(); + + private final LeafButton buttonTemaRemover = LeafIconButton.createDefaultRemoveButton(); + + private final LeafButton buttonRiscoCriar = LeafIconButton.createDefaultNewButton(); + + private final LeafButton buttonRiscoEditar = LeafIconButton.createDefaultEditButton(); + + private final LeafButton buttonRiscoRemover = LeafIconButton.createDefaultRemoveButton(); + + private final LeafButton buttonMedidaCriar = LeafIconButton.createDefaultNewButton(); + + private final LeafButton buttonMedidaRemover = LeafIconButton.createDefaultRemoveButton(); + + private final DefaultMutableTreeNode root = new DefaultMutableTreeNode(); + + private final DefaultTreeModel model = new DefaultTreeModel( root ); + + private final LeafTree tree = new LeafTree( model ); + + private final JScrollPane scroll = new JScrollPane( tree ); + + private final CardLayout cardLayout = new CardLayout(); + + public GerirRiscosPanel() + { + startupComponents(); + startupLayout(); + placeComponents(); + setupListeners(); + refresh(); + } + + private void setupListeners() + { + buttonTemaCriar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + criarTema(); + } + } ); + buttonTemaEditar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + editarTema(); + } + } ); + buttonTemaRemover.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + removerTema(); + } + } ); + buttonRiscoCriar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + criarRisco(); + } + } ); + buttonRiscoEditar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + editarRisco(); + } + } ); + buttonRiscoRemover.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + removerRisco(); + } + } ); + buttonMedidaCriar.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + criarMedida(); + } + } ); + buttonMedidaRemover.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + removerMedida(); + } + } ); + tree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() + { + @Override + public void valueChanged( TreeSelectionEvent e ) + { + setEnabled(); + selectCard(); + } + } ); + panelDataMedida.addPropertyChangeListener( GerirMedidaPanel.MEDIDA_CHANGED, new PropertyChangeListener() + { + @Override + public void propertyChange( PropertyChangeEvent evt ) + { + if( evt.getNewValue() != null ) + { + refresh(); + } + } + } ); + } + + private void criarTema() + { + try + { + String temaString = JOptionPane.showInputDialog( this, "Criar tema", "Descri" + ccedil + atilde + "o", JOptionPane.QUESTION_MESSAGE ); + if( temaString != null ) + { + HsRiscoTema tema = new HsRiscoTema(); + tema.setDescription( temaString ); + tema.save(); + refresh(); + } + } + catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void editarTema() + { + try + { + HsRiscoTema tema = getSelectedTema(); + if( tema != null ) + { + String temaString = JOptionPane.showInputDialog( this, "Editar tema", tema.getDescription() ); + if( temaString != null ) + { + tema.setDescription( temaString ); + tema.save(); + refresh(); + } + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void removerTema() + { + try + { + HsRiscoTema tema = getSelectedTema(); + if( tema != null && LeafDialog.confirmDelete( true, false, "tema" ) ) + { + tema.delete(); + refresh(); + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void criarRisco() + { + try + { + HsRiscoTema tema = getSelectedTema(); + if( tema == null ) + { + HsRisco risco = getSelectedRisco(); + if( risco != null ) + { + tema = risco.getToHsRiscoTema(); + } + else + { + HsRiscoMedida medida = getSelectedMedida(); + if( medida != null ) + { + tema = medida.getToHsRisco().getToHsRiscoTema(); + } + } + } + if( tema != null ) + { + String riscoString = JOptionPane.showInputDialog( this, "Criar risco", "Descri" + ccedil + atilde + "o", JOptionPane.QUESTION_MESSAGE ); + if( riscoString != null ) + { + HsRisco risco = new HsRisco(); + risco.setDescription( riscoString ); + risco.setToHsRiscoTema( tema ); + tema.save(); + refresh(); + } + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void editarRisco() + { + try + { + HsRisco risco = getSelectedRisco(); + if( risco != null ) + { + String riscoString = JOptionPane.showInputDialog( this, "Editar risco", risco.getDescription() ); + if( riscoString != null ) + { + risco.setDescription( riscoString ); + risco.save(); + refresh(); + } + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void removerRisco() + { + try + { + HsRisco risco = getSelectedRisco(); + if( risco != null && LeafDialog.confirmDelete( true, false, "risco" ) && removerRiscoOK( risco ) ) + { + risco.delete(); + refresh(); + } + } + catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private boolean removerRiscoOK( HsRisco risco ) + { + boolean result = true; + if( risco.getHsRiscoEmpresaArray().size() > 0 ) + { + if( JOptionPane.NO_OPTION == JOptionPane.showConfirmDialog( this, "Este risco est" + aacute + " associado a uma ou mais empresas, \n tem a certeza que o deseja remover?", "Aviso", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE ) ) + { + result = false; + } + } + return result; + } + + private void criarMedida() + { + try + { + HsRisco risco = getSelectedRisco(); + if( risco == null ) + { + HsRiscoMedida medida = getSelectedMedida(); + if( medida != null ) + { + risco = medida.getToHsRisco(); + } + } + if( risco != null ) + { + HsMedida medida = new HsMedida(); + medida.setDescription( "" ); + medida.setRequesitosLegais( "" ); + medida.save(); + HsRiscoMedida rel = new HsRiscoMedida(); + rel.setToHsRisco( risco ); + rel.setToHsMedida( medida ); + rel.save(); + refresh(); + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void removerMedida() + { + try + { + HsRiscoMedida medida = getSelectedMedida(); + if( medida != null && LeafDialog.confirmDelete( true, false, "requisisto" ) ) + { + medida.delete(); + refresh(); + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private HsRiscoTema getSelectedTema() + { + Object object = getSelectedObject(); + return object == null ? null : ((object instanceof HsRiscoTema) ? (HsRiscoTema) object : null); + } + + private HsRisco getSelectedRisco() + { + Object object = getSelectedObject(); + return object == null ? null : ((object instanceof HsRisco) ? (HsRisco) object : null); + } + + private HsRiscoMedida getSelectedMedida() + { + Object object = getSelectedObject(); + return object == null ? null : ((object instanceof HsRiscoMedida) ? (HsRiscoMedida) object : null); + } + + private Object getSelectedObject() + { + DefaultMutableTreeNode node = getSelectedNode(); + return node == null ? null : node.getUserObject(); + } + + private DefaultMutableTreeNode getSelectedNode() + { + TreePath path = tree.getSelectionPath(); + return path == null ? null : (DefaultMutableTreeNode) path.getLastPathComponent(); + } + + private void startupComponents() + { + panelButtons.setPreferredSize( new Dimension( 150, 0 ) ); + panelTree.setPreferredSize( new Dimension( 600, 0 ) ); + tree.setRootVisible( false ); + tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); + } + + private void setEnabled() + { + HsRiscoTema tema = getSelectedTema(); + HsRisco risco = getSelectedRisco(); + HsRiscoMedida medida = getSelectedMedida(); + buttonMedidaCriar.setEnabled( risco != null || medida != null ); + buttonRiscoCriar.setEnabled( tema != null || risco != null || medida != null ); + + buttonTemaEditar.setEnabled( tema != null ); + buttonRiscoEditar.setEnabled( risco != null ); + + buttonMedidaRemover.setEnabled( medida != null ); + buttonRiscoRemover.setEnabled( risco != null ); + buttonTemaRemover.setEnabled( tema != null ); + } + + private void startupLayout() + { + TableLayout layout = new TableLayout( new double[] { + TableLayout.PREFERRED, TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM, TableLayout.FILL + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + setLayout( layout ); + + layout = new TableLayout( new double[] { + TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + panelButtons.setLayout( layout ); + + layout = new TableLayout( new double[] { + TableLayout.FILL + }, new double[] { + TableLayout.FILL + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + panelTree.setLayout( layout ); + + layout = new TableLayout( new double[] { + TableLayout.FILL + }, new double[] { + TableLayout.FILL + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + panelDataTema.setLayout( layout ); + + layout = new TableLayout( new double[] { + TableLayout.FILL + }, new double[] { + TableLayout.FILL + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + panelDataRisco.setLayout( layout ); + + panelData.setLayout( cardLayout ); + } + + private void placeComponents() + { + JPanel panel = new JPanel(); + panel.setBorder( BorderFactory.createTitledBorder( "Tema" ) ); + panel.setLayout( new GridLayout( 1, 3 ) ); + panel.add( buttonTemaCriar ); + panel.add( buttonTemaEditar ); + panel.add( buttonTemaRemover ); + panelButtons.add( panel, new TableLayoutConstraints( 0, 0 ) ); + panel = new JPanel(); + panel.setBorder( BorderFactory.createTitledBorder( "Risco" ) ); + panel.setLayout( new GridLayout( 1, 3 ) ); + panel.add( buttonRiscoCriar ); + panel.add( buttonRiscoEditar ); + panel.add( buttonRiscoRemover ); + panelButtons.add( panel, new TableLayoutConstraints( 1, 0 ) ); + panel = new JPanel(); + panel.setBorder( BorderFactory.createTitledBorder( "Requisito" ) ); + panel.setLayout( new GridLayout( 1, 3 ) ); + panel.add( buttonMedidaCriar ); + panel.add( buttonMedidaRemover ); + panel.add( new JPanel() ); + panelButtons.add( panel, new TableLayoutConstraints( 2, 0 ) ); + + panelTree.add( scroll, new TableLayoutConstraints( 0, 0 ) ); + + panelData.add( panelDataTema, PANEL_TEMA ); + panelData.add( panelDataRisco, PANEL_RISCO ); + panelData.add( panelDataMedida, PANEL_MEDIDA ); + + add( panelButtons, new TableLayoutConstraints( 0, 0 ) ); + add( panelTree, new TableLayoutConstraints( 0, 1 ) ); + add( panelData, new TableLayoutConstraints( 1, 1 ) ); + } + + private void selectCard() + { + HsRiscoTema tema = getSelectedTema(); + HsRisco risco = getSelectedRisco(); + HsRiscoMedida medida = getSelectedMedida(); + if( tema != null ) + { + cardLayout.show( panelData, PANEL_TEMA ); + } + else if( risco != null ) + { + cardLayout.show( panelData, PANEL_RISCO ); + } + else if( medida != null ) + { + cardLayout.show( panelData, PANEL_MEDIDA ); + panelDataMedida.setMedida( medida.getToHsMedida() ); + } + } + + private void refresh() + { + TreePath selPath = tree.getSelectionPath(); + Object selObject = null; + if( selPath != null ) + { + Object selNode = selPath.getLastPathComponent(); + if( selNode != null && (selNode instanceof DefaultMutableTreeNode )) + { + selObject = ((DefaultMutableTreeNode)selNode).getUserObject(); + } + } + root.removeAllChildren(); + TreeTools.merge( root, HigieneSegurancaLogic.getRiscosTree() ); + TreeTools.refreshTree( tree, root, false ); + if( selObject != null ) + { + DefaultMutableTreeNode found = TreeTools.findNodeWithUserObject( selObject, root ); + if( found != null ) + { + TreePath selNew = TreeTools.getPathFor( found ); + if( selNew != null ) + { + tree.setSelectionPath( selNew ); + TreeTools.refreshTree( tree, found, false ); + } + } + } + setEnabled(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/riscos/revert.png b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/riscos/revert.png new file mode 100644 index 00000000..bd1d011a Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/riscos/revert.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/riscos/save.png b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/riscos/save.png new file mode 100644 index 00000000..d2d0d6e1 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/riscos/save.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/legislacoes/GestaoLegislacoesWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/legislacoes/GestaoLegislacoesWindow.java new file mode 100644 index 00000000..7e4178c9 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/legislacoes/GestaoLegislacoesWindow.java @@ -0,0 +1,374 @@ +package siprp.higiene.legislacoes; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import static com.evolute.utils.strings.UnicodeLatin1Map.otilde; + +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +import com.evolute.utils.tracker.TrackableWindow; + +public class GestaoLegislacoesWindow extends JFrame implements TrackableWindow +{ + + private static final long serialVersionUID = 1L; + + public static final String TITLE = "Gest" + atilde + "o de Legisla" + ccedil + otilde + "es"; +// +// private static final Dimension SIZE = new Dimension( 800, 400 ); +// +// private DefaultMutableTreeNode root = new DefaultMutableTreeNode( "Legisla" + ccedil + atilde + "o em Higiene e Seguran" + ccedil + "a no Trabalho" ); +// +// private final DefaultTreeModel model = new DefaultTreeModel( root ); +// +// private final JTree tree = new JTree( model ); +// +// private final JScrollPane scroll = new JScrollPane( tree ); +// +// private final JButton buttonCriar = new JButton("Criar"); +// +// private final JButton buttonRemover = new JButton("Remover"); +// +// private final JButton buttonGuardar = new JButton("Guardar"); +// +// private final JButton buttonCancelar = new JButton("Cancelar"); +// +// private final JTextArea text = new JTextArea(); +// +// private final JPanel panelTree = new JPanel(); +// +// private final JPanel panelText = new JPanel(); +// +// private final PlanoActuacaoDAO provider = new PlanoActuacaoDAO(); +// +// private Legislacao newLegislacao = null; +// +// public static void main( String[] args ) +// { +// GestaoLegislacoesWindow window = new GestaoLegislacoesWindow(); +// window.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); +// window.setVisible( true ); +// } + + public GestaoLegislacoesWindow() + { +// this.setTitle( TITLE ); +// this.setSize( SIZE ); +// startupComponents(); +// startupLayout(); +// startupListeners(); +// placeComponents(); +// refresh(); + } + +// private void startupComponents() +// { +// panelText.setBorder( BorderFactory.createEtchedBorder() ); +// buttonRemover.setEnabled( false ); +// buttonGuardar.setEnabled( false ); +// buttonCancelar.setEnabled( false ); +// text.setEnabled( false ); +// tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); +// tree.setRootVisible( true ); +// } +// +// private void startupLayout() +// { +// startupPanelTextLayout(); +// startupPanelTreeLayout(); +// this.getContentPane().setLayout( new GridLayout(1,0,5,5) ); +// } +// +// private void startupPanelTextLayout() +// { +// TableLayout layout = new TableLayout( +// new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL }, +// new double[]{ TableLayout.FILL, TableLayout.MINIMUM } +// ); +// layout.setHGap( 5 ); +// layout.setVGap( 5 ); +// panelText.setLayout( layout ); +// } +// +// private void startupPanelTreeLayout() +// { +// TableLayout layout = new TableLayout( +// new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL }, +// new double[]{ TableLayout.FILL, TableLayout.MINIMUM } +// ); +// layout.setHGap( 5 ); +// layout.setVGap( 5 ); +// panelTree.setLayout( layout ); +// } +// +// private void startupListeners() +// { +// buttonCriar.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// criarLegislacao( ); +// } +// } ); +// buttonRemover.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// removerLegislacao(); +// } +// } ); +// buttonGuardar.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// guardarLegislacao(); +// } +// } ); +// buttonCancelar.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// cancelarEdicao(); +// } +// } ); +// tree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() +// { +// @Override +// public void valueChanged( TreeSelectionEvent e ) +// { +// TreePath path = tree.getSelectionPath(); +// Legislacao legislacao = getSelectedLegislacao(); +// if( path != null ) +// { +// buttonRemover.setEnabled( !root.equals( path.getLastPathComponent() ) ); +// text.setEnabled( !root.equals( path.getLastPathComponent() ) ); +// text.setText( legislacao == null ? "" : legislacao.getDescription() ); +// } +// else +// { +// text.setEnabled( false ); +// buttonRemover.setEnabled( false ); +// text.setText( "" ); +// } +// } +// } ); +// text.addCaretListener( new CaretListener() +// { +// @Override +// public void caretUpdate( CaretEvent e ) +// { +// if( text.getText().length() > 0) +// { +// Legislacao legislacao = null; +// if( newLegislacao != null ) +// { +// legislacao = newLegislacao; +// } +// else +// { +// legislacao = getSelectedLegislacao(); +// } +// boolean changed = legislacao == null ? false : !legislacao.getDescription().equals( text.getText() ); +// buttonGuardar.setEnabled( changed ); +// text.setBorder( changed ? BorderFactory.createLineBorder( Color.RED, 2 ) : BorderFactory.createEtchedBorder() ); +// } +// else +// { +// buttonGuardar.setEnabled( false ); +// text.setBorder( BorderFactory.createEtchedBorder() ); +// } +// } +// } ); +// } +// +// private void placeComponents() +// { +// panelTree.add( scroll, new TableLayoutConstraints( 0, 0, 2, 0 ) ); +// panelTree.add( buttonCriar, new TableLayoutConstraints( 0, 1 ) ); +// panelTree.add( buttonRemover, new TableLayoutConstraints( 1, 1 ) ); +// +// panelText.add( text, new TableLayoutConstraints( 0, 0, 2, 0 ) ); +// panelText.add( buttonGuardar, new TableLayoutConstraints( 0, 1 ) ); +// panelText.add( buttonCancelar, new TableLayoutConstraints( 1, 1 ) ); +// +// this.getContentPane().add( panelTree ); +// this.getContentPane().add( panelText ); +// } +// +// private void criarLegislacao() +// { +// text.setText( "" ); +// Legislacao selected = getSelectedLegislacao(); +// if( selected != null ) +// { +// newLegislacao = provider.createNovaLegislacao( selected ); +// } +// else +// { +// newLegislacao = provider.createNovaLegislacao( getSelectedLegislacao() ); +// } +// prepareEditar( false ); +// textInputOnly( true ); +// } +// +// private void prepareEditar( boolean editar ) +// { +// buttonGuardar.setText( editar ? "Editar" : "Criar" ); +// buttonCancelar.setText( editar ? "Reverter" : "Cancelar" ); +// } +// +// private void textInputOnly( boolean doTextInput ) +// { +// text.setEnabled( doTextInput ); +// buttonCancelar.setEnabled( doTextInput ); +// buttonCriar.setEnabled( !doTextInput ); +// tree.setEnabled( !doTextInput ); +// text.setBorder( doTextInput ? BorderFactory.createLineBorder( Color.RED, 2 ) : BorderFactory.createEtchedBorder()); +// if( doTextInput ){ +// text.setCaretPosition( 0 ); +// text.requestFocus(); +// buttonRemover.setEnabled( false ); +// } +// } +// +// private void guardarLegislacao() +// { +// TreePath path = tree.getSelectionPath(); +// if( newLegislacao != null ) +// { +// newLegislacao.setDescription( text.getText() ); +// provider.commit(); +// newLegislacao = null; +// prepareEditar( true ); +// textInputOnly( false ); +// refresh(); +// } +// else if( path != null ) +// { +// Legislacao legislacao = getSelectedLegislacao(); +// legislacao.setDescription( text.getText() ); +// provider.commit(); +// prepareEditar( true ); +// textInputOnly( false ); +// refresh(); +// } +// } +// +// private void cancelarEdicao() +// { +// TreePath path = tree.getSelectionPath(); +// if( newLegislacao != null ) +// { +// newLegislacao = null; +// prepareEditar( true ); +// textInputOnly( false ); +// refresh(); +// tree.setSelectionPath( path ); +// } +// else if( path != null ) +// { +// prepareEditar( true ); +// textInputOnly( false ); +// refresh(); +// tree.setSelectionPath( path ); +// } +// } +// +// private Legislacao getSelectedLegislacao() +// { +// Legislacao result = null; +// TreePath path = tree.getSelectionPath(); +// if( path != null ) +// { +// Object o = ( (DefaultMutableTreeNode) path.getLastPathComponent() ).getUserObject(); +// if( o instanceof Legislacao ) +// { +// result = (Legislacao) o; +// } +// } +// return result; +// } +// +// private void removerLegislacao() +// { +// Legislacao legislacao = getSelectedLegislacao(); +// if( legislacao != null ) +// { +// provider.delete( legislacao ); +// } +// refresh(); +// } +// + @Override + public void refresh() + { +// clearTree(); +// fillTree(); + } +// +// private void clearTree() +// { +// root.removeAllChildren(); +// refreshTree(); +// } +// +// private void fillTree() +// { +// List legislacoes = provider.getAllLegislacoes( null ); +// for( Legislacao legislacao : legislacoes ) +// { +// DefaultMutableTreeNode node = new DefaultMutableTreeNode( legislacao ); +// fillWithChildren( node, legislacao ); +// root.add( node ); +// } +// refreshTree(); +// } +// +// private void fillWithChildren( DefaultMutableTreeNode node, Legislacao legislacao ) +// { +// if( legislacao != null ) +// { +// for( Legislacao child : legislacao.getChildrenArray() ) +// { +// DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(child); +// fillWithChildren( childNode, child ); +// node.add( childNode ); +// } +// } +// } +// +// private void refreshTree() +// { +// model.nodeStructureChanged( root ); +// } + + @Override + public boolean closeIfPossible() + { + close(); + return true; + } + + private void close() + { + SwingUtilities.invokeLater( new Runnable() { + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + @Override + public void open() + { + setVisible( true ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/DiaLine.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/DiaLine.java new file mode 100644 index 00000000..c38e0102 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/DiaLine.java @@ -0,0 +1,61 @@ +/* + * DiaLine.java + * + * Created on 8 de Fevereiro de 2006, 22:43 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene.mapa; + +import java.util.Vector; + +import com.evolute.utils.tables.ColumnizedObjectForUpdate; + +/** + * + * @author Frederico + */ +public class DiaLine implements ColumnizedObjectForUpdate +{ + protected Integer day; + protected Vector data[]; + + public DiaLine( int day, Vector data[] ) + { + this.day = new Integer( day ); + this.data = data; + } + + public Object getValue( int col ) + { + switch( col ) + { + case 0: + return day; + + default: + return data[ col - 1 ].toArray( new Object[ 0 ][] ); + } + } + + public int[] getUpdateableColumns() + { + return new int[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; + } + + public void setValueAt( Object value, int col ) + { +// data[ col - 1 ].clear(); + if( value != null && value instanceof Vector ) + { + data[ col - 1 ].addAll( ( Vector ) value ); + } + } + + public void clear( int col ) + { + data[ col - 1 ].clear(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/DiaPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/DiaPanel.java new file mode 100644 index 00000000..dafe4fe4 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/DiaPanel.java @@ -0,0 +1,97 @@ +package siprp.higiene.mapa; + +import java.awt.Color; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; + +import com.evolute.utils.dataui.ControllableComponent; +/** + * + * @author fpalma + */ +public class DiaPanel extends JPanel implements ControllableComponent, ActionListener +{ + + private static final long serialVersionUID = 1L; + + protected Object data[][]; + protected JButton buttons[]; + + public DiaPanel() + { + } + + public void setEnabled( boolean enable ) + { + } + + public void fill( Object value ) + { + removeAll(); + Object arr[][] = ( Object[][] ) value; + data = arr; + buttons = new JButton[ arr.length ]; + if( arr.length > 0 ) + { + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 0, 0, 0, 0 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weighty = 0; + constraints.gridheight = 1; + Integer dia = ( Integer ) arr[ 0 ][ 0 ]; + JLabel diaLabel = new JLabel( dia.toString(), JLabel.LEFT ); + gridbag.setConstraints( diaLabel, constraints ); + add( diaLabel ); + for( int n = 1; n < arr.length; n++ ) + { + String empresa = ( String ) arr[ n ][ 0 ]; + String estabelecimento = ( String ) arr[ n ][ 1 ]; + String tecnico = ( String ) arr[ n ][ 2 ]; + Color cor = ( Color ) arr[ n ][ 3 ]; + String empresaR = empresa.length() > 10 ? empresa.substring( 0, 10 ) : empresa; + String estabelecimentoR = estabelecimento.length() > 10 ? estabelecimento.substring( 0, 10 ) : estabelecimento; + buttons[ n ] = new JButton( "" + empresaR + "
" + estabelecimentoR + "
" ); + buttons[ n ].setMargin( new Insets( 2, 1, 2, 1 ) ); + buttons[ n ].setBackground( cor ); + buttons[ n ].setToolTipText( "T\u00e9cnico: " + ( tecnico != null ? tecnico : "n.d." ) + + " \nEmpresa: " + empresa + " \nEstabelecimento: " + estabelecimento ); + gridbag.setConstraints( buttons[ n ], constraints ); + add( buttons[ n ] ); + buttons[ n ].addActionListener( this ); + } + JPanel pad = new JPanel(); + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + gridbag.setConstraints( pad, constraints ); + add( pad ); + } + + } + + public Object save() + { + return data; + } + + public void clear() + { + } + + public void actionPerformed( ActionEvent e ) + { + JButton source = ( JButton ) e.getSource(); + JOptionPane.showMessageDialog( source, source.getToolTipText(), "", JOptionPane.PLAIN_MESSAGE ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/DiaRenderer.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/DiaRenderer.java new file mode 100644 index 00000000..8ba625ed --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/DiaRenderer.java @@ -0,0 +1,61 @@ +package siprp.higiene.mapa; + +import java.awt.Component; + +import javax.swing.DefaultCellEditor; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JTable; +import javax.swing.table.TableCellRenderer; +/** + * + * @author Frederico + */ +public class DiaRenderer extends DefaultCellEditor implements TableCellRenderer +{ + + private static final long serialVersionUID = 1L; + + protected JLabel diaLabel; + protected DiaPanel diaPanel; + + /** Creates a new instance of DiaRenderer */ + public DiaRenderer() + { + super( new JCheckBox() ); + diaLabel = new JLabel(); + diaPanel = new DiaPanel(); + } + + public Component getTableCellRendererComponent( JTable table, Object value, + boolean isSelected, + boolean hasFocus, + int row, int column ) + { + if( column == 0 ) + { + diaLabel.setText( "" + value ); + return diaLabel; + } + diaPanel.fill( value ); + return diaPanel; + } + + public Component getTableCellEditorComponent( JTable table, Object value, + boolean isSelected, + int row, int column ) + { + if( column == 0 ) + { + diaLabel.setText( "" + value ); + return diaLabel; + } + diaPanel.fill( value ); + return diaPanel; + } + + public Object getCellEditorValue() + { + return diaPanel.save(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/MapaHigienePanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/MapaHigienePanel.java new file mode 100644 index 00000000..76b490f1 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/MapaHigienePanel.java @@ -0,0 +1,108 @@ +package siprp.higiene.mapa; + +import java.awt.GridLayout; +import java.util.Vector; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; + +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.date.DateUtils; +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.VectorTableModel; +/** + * + * @author Frederico + */ +public class MapaHigienePanel extends JPanel implements ControllableComponent +{ + + private static final long serialVersionUID = 1L; + + protected BaseTable yearTable; + protected VectorTableModel yearModel; + protected JScrollPane yearScroll; + + /** Creates a new instance of MapaHigienePanel */ + public MapaHigienePanel() + throws Exception + { + setupComponents(); + } + + private void setupComponents() + throws Exception + { + String headers[] = new String[ 13 ]; + headers[ 0 ] = " "; + for( int n = 0; n < DateUtils.MONTHS_FULL_PT.length; n++ ) + { + headers[ n + 1 ] = DateUtils.MONTHS_FULL_PT[ n ]; + } + yearModel = new VectorTableModel( headers ); + yearTable = new BaseTable( yearModel ); + yearTable.fixColumnWidth( 0, 20 ); + yearTable.setNonResizableNorReordable(); +// yearTable.setEnabled( true ); + yearModel.setEditable( true ); + yearTable.setTableCellRenderer( new DiaRenderer() ); + yearTable.setTableCellEditor( new DiaRenderer() ); + yearScroll = new JScrollPane( yearTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + Vector values = yearModel.getValues(); + for( int n = 0; n < 31; n++ ) + { + Vector data[] = new Vector[ 12 ]; + for( int m = 0; m < 12; m++ ) + { + data[ m ] = new Vector(); + } + values.add( new DiaLine( n + 1, data ) ); + } + yearModel.setValues( values ); + + setLayout( new GridLayout( 1, 1 ) ); + add( yearScroll ); + } + + public void clear() + { + } + + public void setEnabled( boolean enable ) + { + yearTable.setEnabled( enable ); + } + + public void fill( Object value ) + { +// if( true ) return; + Vector arr[][] = ( Vector[][] )value; + int maxs[] = new int[ arr.length ]; + for( int r = 0; r < arr.length; r++ ) + { + maxs[ r ] = 1; + for( int c = 0; c < arr[ r ].length; c++ ) + { + if( arr[ r ][ c ] != null && arr[ r ][ c ].size() > maxs[ r ] ) + { + maxs[ r ] = arr[ r ][ c ].size(); + } + DiaLine line = ( DiaLine ) yearModel.getRowAt( r ); + line.clear( c + 1 ); + line.setValueAt( arr[ r ][ c ], c + 1 ); + yearModel.removeRowAt( r ); + yearModel.insertRowAt( line, r ); + } + } + for( int r = 0; r < arr.length; r++ ) + { + yearTable.setRowHeight( r, 20 + ( maxs[ r ] - 1 ) * 40 ); + } + } + + public Object save() + { + return null; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/MapaHigieneWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/MapaHigieneWindow.java new file mode 100644 index 00000000..ec8812dd --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/MapaHigieneWindow.java @@ -0,0 +1,138 @@ +package siprp.higiene.mapa; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Calendar; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import siprp.higiene.HigieneDataProvider; + +import com.evolute.utils.documents.YearDocument; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.window.EditorWindow; + +/** + * + * @author fpalma + */ +public class MapaHigieneWindow extends EditorWindow implements ActionListener +{ + + private static final long serialVersionUID = 1L; + + public final static String TITLE = "Mapa de Higiene e Seguran\u00e7a"; + + private final static int iPermissionArray[][] = + new int[][]{ { } }; + + protected MapaHigienePanel mainPanel; + protected JTextField anoText; + protected JButton actualizarButton; + + protected HigieneDataProvider provider; + + public static void main( String args[] ) + throws Exception + { + + JFrame frm = new MapaHigieneWindow(); + frm.setVisible( true ); + } + + /** Creates a new instance of MarcacoesHigieneWindow */ + public MapaHigieneWindow() + throws Exception + { + super( iPermissionArray ); + provider = ( HigieneDataProvider ) HigieneDataProvider.getProvider(); + setupComponents(); + setExtendedState(getExtendedState() | MAXIMIZED_BOTH); + } + + private void setupComponents() + throws Exception + { + setTitle( TITLE ); + JPanel upperPanel = new JPanel(); + mainPanel = new MapaHigienePanel(); + getContentPane().setLayout( new BorderLayout() ); + getContentPane().add( upperPanel, BorderLayout.NORTH ); + getContentPane().add( mainPanel, BorderLayout.CENTER ); + + upperPanel.setLayout( new FlowLayout( FlowLayout.LEFT ) ); + upperPanel.add( new TecnicosPanel() ); + JLabel anoLabel = new JLabel( "Ano" ); + anoText = new JTextField(); + anoText.setPreferredSize( new Dimension( 50, 20 ) ); + anoText.setDocument( new YearDocument() ); + anoText.addActionListener( this ); + actualizarButton = new JButton( "Actualizar" ); + actualizarButton.addActionListener( this ); + + Calendar cal = Calendar.getInstance(); + anoText.setText( "" + cal.get( Calendar.YEAR ) ); + + JPanel pesquisaPanel = new JPanel(); + upperPanel.add( pesquisaPanel ); + pesquisaPanel.setLayout( new FlowLayout( FlowLayout.CENTER ) ); + pesquisaPanel.add( anoLabel ); + pesquisaPanel.add( anoText ); + pesquisaPanel.add( actualizarButton ); + +// Vector data[][] = new Vector[ 31 ][ 12 ]; +// for( int r = 0; r < 31; r++ ) +// { +// for( int c = 0; c < 12; c++ ) +// { +// data[ r ][ c ] = new Vector(); +// } +// } +//// Vector example = new Vector(); +//// example.add( new Object[]{ "Empresa1", "Estabelecimento1", "Pai Natal", "9:30", Color.red } ); +// data[ 20 ][ 10 ].add( new Object[]{ new Integer( 21 ) } ); +// data[ 20 ][ 10 ].add( new Object[]{ "Empresa1", "Estabelecimento1", "Pai Natal", Color.red } ); +// data[ 20 ][ 10 ].add( new Object[]{ "Empresa1", "Estabelecimento1", "Pai Natal", Color.green } ); +// data[ 20 ][ 10 ].add( new Object[]{ "Empresa1", "Estabelecimento1", "Pai Natal", Color.yellow } ); +// data[ 20 ][ 10 ].add( new Object[]{ "Empresa1", "Estabelecimento1", "Pai Natal", Color.white } ); +// mainPanel.fill( data ); + } + + public void actualizar() + { + String anoStr = anoText.getText(); + if( anoStr.length() == 0 ) + { + mainPanel.clear(); + } + else + { + Integer ano = new Integer( anoStr ); + try + { + mainPanel.fill( provider.getMapaAnual( ano ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); + mainPanel.clear(); + } + } + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( actualizarButton ) || source.equals( anoText ) ) + { + actualizar(); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/TecnicosPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/TecnicosPanel.java new file mode 100644 index 00000000..602bc045 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/mapa/TecnicosPanel.java @@ -0,0 +1,70 @@ +/* + * TecnicosPanel.java + * + * Created on 12 de Fevereiro de 2006, 17:48 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene.mapa; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; + +import javax.swing.JLabel; +import javax.swing.JPanel; + +import siprp.higiene.HigieneDataProvider; + +/** + * + * @author Frederico + */ +public class TecnicosPanel extends JPanel +{ + + private static final long serialVersionUID = 1L; + + protected HigieneDataProvider provider; + + /** Creates a new instance of TecnicosPanel */ + public TecnicosPanel() + throws Exception + { + provider = ( HigieneDataProvider ) HigieneDataProvider.getProvider(); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + Object tecnicos[][] = provider.getTecnicosHST( false ); + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridheight = 1; + constraints.weighty = 0; + + for( int n = 0; n < tecnicos.length; n++ ) + { + constraints.weightx = 0; + constraints.gridwidth = 1; + JLabel corLabel = new JLabel( " " ); + corLabel.setBackground( HigieneDataProvider.CORES_TECNICOS[ ( ( Integer ) tecnicos[ n ][ 3 ] ).intValue() ] ); + corLabel.setOpaque( true ); + gridbag.setConstraints( corLabel, constraints ); + add( corLabel ); + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + JLabel nomeLabel = new JLabel( (String)tecnicos[ n ][ 1 ] ); + gridbag.setConstraints( nomeLabel, constraints ); + add( nomeLabel ); + + } + + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/CorTecnicoCellRenderer.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/CorTecnicoCellRenderer.java new file mode 100644 index 00000000..ad536467 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/CorTecnicoCellRenderer.java @@ -0,0 +1,45 @@ +/* + * CorTecnicoCellRenderer.java + * + * Created on February 1, 2006, 11:13 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene.marcacoes; + +import java.awt.Color; +import java.awt.Component; + +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.ListCellRenderer; + +import siprp.higiene.HigieneDataProvider; + +/** + * + * @author fpalma + */ +public class CorTecnicoCellRenderer extends JLabel implements ListCellRenderer +{ + + public CorTecnicoCellRenderer() + { + setOpaque(true); + } + + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) + { + setText( " " ); + Color color = HigieneDataProvider.CORES_TECNICOS[ ( ( Integer ) value ).intValue() ]; + if( cellHasFocus ) + { + color = color.darker().darker(); + } + setBackground( color ); + + return this; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacaoVisitaHSTPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacaoVisitaHSTPanel.java new file mode 100644 index 00000000..a5dfdbe8 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacaoVisitaHSTPanel.java @@ -0,0 +1,354 @@ +package siprp.higiene.marcacoes; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.util.Hashtable; +import java.util.Map; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; + +import siprp.data.outer.MarcacoesEstabelecimentoData; + +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.data.PropertyObject; +import com.evolute.utils.dataui.ComponentController; +import com.evolute.utils.dataui.ComponentsHashtable; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.dataui.DataClassAware; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.SQLExecuter; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import com.evolute.utils.ui.panel.RadioButtonFixedPanel; +import com.evolute.utils.ui.text.StateTextArea; + +public class MarcacaoVisitaHSTPanel + extends JPanel + implements ControllableComponent, DataClassAware +{ + + private static final long serialVersionUID = 1L; + private MarcacoesEstabelecimentoData marcacaoEstabelecimentosData; + private final ComponentsHashtable components = new ComponentsHashtable(); + + protected final SQLExecuter EXECUTER; + + private final JLabel dataLabel = new JLabel( "Data da visita", JLabel.RIGHT ); + private final JCalendarPanel dataPanel = new JCalendarPanel( null ); + private final JButton emailButton = new JButton( "Enviar Email" ); + private final JLabel dataFichaLabel = new JLabel( "Data do Relat\u00f3rio(externo)", JLabel.RIGHT ); + private final JCalendarPanel dataFichaPanel = new JCalendarPanel( null ); + private final JLabel tecnicoLabel = new JLabel( "T\u00e9cnico", JLabel.RIGHT ); + private final JLabel tecnicoSuperiorLabel = new JLabel( "T\u00e9cnico Superior", JLabel.RIGHT ); + private final JComboBox tecnicoList = new JComboBox(); + private final JComboBox tecnicoSuperiorList = new JComboBox(); + private RadioButtonFixedPanel estadoList; + private final JScrollPane observacoesTextScroll = new JScrollPane(); + private final StateTextArea observacoesText = new StateTextArea(); + + public MarcacaoVisitaHSTPanel() + throws Exception + { + DBManager dbm = ( DBManager )Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + if( dbm != null ) + { + EXECUTER = ( SQLExecuter )dbm.getSharedExecuter( this ); + } + else + { + EXECUTER = null; + } + setupComponents(); + setupComponentsHashtable(); + place(); + } + + public void setupComponents() + throws Exception + { +// emailButton.setMinimumSize( new Dimension( 300, 20 ) ); +// emailButton.setPreferredSize( new Dimension( 200, 20 ) ); + + tecnicoList.addItem( new MappableObject( new Integer( -1 ), "" ) ); + tecnicoList.setSelectedIndex( 0 ); + + tecnicoSuperiorList.addItem( new MappableObject( new Integer( -1 ), "" ) ); + tecnicoSuperiorList.setSelectedIndex( 0 ); + + IDObject estadoListOptions[] = new IDObject[]{ + new MappableObject( new Integer( 0 ), "Por realizar" ), + new MappableObject( new Integer( 2 ), "Realizada" ), + new MappableObject( new Integer( 3 ), "Desmarcada pela empresa" ), + new MappableObject( new Integer( 4 ), "Desmarcada pela SIPRP" ), + }; + estadoList = new RadioButtonFixedPanel( estadoListOptions, 6, 1, RadioButtonFixedPanel.ORIENTATION_VERTICAL, false, null ); + estadoList.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Estado" ) ); + + observacoesText.setLineWrap( true ); + observacoesText.setWrapStyleWord( true ); + observacoesText.setRows( 5 ); + + observacoesTextScroll.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Observa\u00e7\u00f5es" ) ); + observacoesTextScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + observacoesTextScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED ); + observacoesTextScroll.setViewportView( observacoesText ); + + } + + public void place() + { + TableLayout layout = new TableLayout( + new double[]{ TableLayout.FILL, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL }, + new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, + TableLayout.PREFERRED} + ); + layout.setHGap(5); + layout.setVGap(5); + this.setLayout( layout ); + this.add( dataLabel, new TableLayoutConstraints(1,0) ); + this.add( dataPanel, new TableLayoutConstraints(2,0) ); + this.add( emailButton, new TableLayoutConstraints(2,1) ); + this.add( dataFichaLabel, new TableLayoutConstraints(1,2) ); + this.add( dataFichaPanel, new TableLayoutConstraints(2,2) ); + this.add( tecnicoLabel, new TableLayoutConstraints(1,3) ); + this.add( tecnicoList, new TableLayoutConstraints(2,3) ); + this.add( tecnicoSuperiorLabel, new TableLayoutConstraints(1,4) ); + this.add( tecnicoSuperiorList, new TableLayoutConstraints(2,4) ); + this.add( estadoList, new TableLayoutConstraints(1,5,2,5) ); + this.add( observacoesTextScroll, new TableLayoutConstraints(1,6,2,6) ); +// +// JPanel MarcacaoVisitaHSTPanel = this; +// GridBagConstraints MarcacaoVisitaHSTPanelGBC = new GridBagConstraints(); +// MarcacaoVisitaHSTPanelGBC.insets = new Insets( 1, 1, 1, 1 ); +// GridBagLayout MarcacaoVisitaHSTPanelLayout = new GridBagLayout(); +// MarcacaoVisitaHSTPanel.setLayout( MarcacaoVisitaHSTPanelLayout ); +// MarcacaoVisitaHSTPanelGBC.gridx = 0; +// MarcacaoVisitaHSTPanelGBC.gridy = 0; +// MarcacaoVisitaHSTPanelGBC.gridwidth = 1; +// MarcacaoVisitaHSTPanelGBC.gridheight = 1; +// MarcacaoVisitaHSTPanelGBC.weightx = 0.0; +// MarcacaoVisitaHSTPanelGBC.weighty = 0.0; +// MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.HORIZONTAL; +// MarcacaoVisitaHSTPanelLayout.setConstraints( dataLabel, MarcacaoVisitaHSTPanelGBC ); +// MarcacaoVisitaHSTPanel.add( dataLabel ); +// +// MarcacaoVisitaHSTPanelGBC.gridx = 1; +// MarcacaoVisitaHSTPanelGBC.gridy = 0; +// MarcacaoVisitaHSTPanelGBC.gridwidth = 1; +// MarcacaoVisitaHSTPanelGBC.gridheight = 1; +// MarcacaoVisitaHSTPanelGBC.weightx = 0.5; +// MarcacaoVisitaHSTPanelGBC.weighty = 0.0; +// MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.HORIZONTAL; +// MarcacaoVisitaHSTPanelLayout.setConstraints( dataPanel, MarcacaoVisitaHSTPanelGBC ); +// MarcacaoVisitaHSTPanel.add( dataPanel ); +// +// MarcacaoVisitaHSTPanelGBC.gridx = 2; +// MarcacaoVisitaHSTPanelGBC.gridy = 0; +// MarcacaoVisitaHSTPanelGBC.gridwidth = 1; +// MarcacaoVisitaHSTPanelGBC.gridheight = 1; +// MarcacaoVisitaHSTPanelGBC.weightx = 0.5; +// MarcacaoVisitaHSTPanelGBC.weighty = 0.0; +// MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.NONE; +// MarcacaoVisitaHSTPanelLayout.setConstraints( emailButton, MarcacaoVisitaHSTPanelGBC ); +// MarcacaoVisitaHSTPanel.add( emailButton ); +// +// MarcacaoVisitaHSTPanelGBC.gridx = 0; +// MarcacaoVisitaHSTPanelGBC.gridy = 1; +// MarcacaoVisitaHSTPanelGBC.gridwidth = 1; +// MarcacaoVisitaHSTPanelGBC.gridheight = 1; +// MarcacaoVisitaHSTPanelGBC.weightx = 0.0; +// MarcacaoVisitaHSTPanelGBC.weighty = 0.0; +// MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.HORIZONTAL; +// MarcacaoVisitaHSTPanelLayout.setConstraints( dataFichaLabel, MarcacaoVisitaHSTPanelGBC ); +// MarcacaoVisitaHSTPanel.add( dataFichaLabel ); +// +// MarcacaoVisitaHSTPanelGBC.gridx = 1; +// MarcacaoVisitaHSTPanelGBC.gridy = 1; +// MarcacaoVisitaHSTPanelGBC.gridwidth = 1; +// MarcacaoVisitaHSTPanelGBC.gridheight = 1; +// MarcacaoVisitaHSTPanelGBC.weightx = 0.5; +// MarcacaoVisitaHSTPanelGBC.weighty = 0.0; +// MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.HORIZONTAL; +// MarcacaoVisitaHSTPanelLayout.setConstraints( dataFichaPanel, MarcacaoVisitaHSTPanelGBC ); +// MarcacaoVisitaHSTPanel.add( dataFichaPanel ); +// +// MarcacaoVisitaHSTPanelGBC.gridx = 0; +// MarcacaoVisitaHSTPanelGBC.gridy = 2; +// MarcacaoVisitaHSTPanelGBC.gridwidth = 1; +// MarcacaoVisitaHSTPanelGBC.gridheight = 1; +// MarcacaoVisitaHSTPanelGBC.weightx = 0.0; +// MarcacaoVisitaHSTPanelGBC.weighty = 0.0; +// MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.HORIZONTAL; +// MarcacaoVisitaHSTPanelLayout.setConstraints( tecnicoLabel, MarcacaoVisitaHSTPanelGBC ); +// MarcacaoVisitaHSTPanel.add( tecnicoLabel ); +// +// MarcacaoVisitaHSTPanelGBC.gridx = 1; +// MarcacaoVisitaHSTPanelGBC.gridy = 2; +// MarcacaoVisitaHSTPanelGBC.gridwidth = 1; +// MarcacaoVisitaHSTPanelGBC.gridheight = 1; +// MarcacaoVisitaHSTPanelGBC.weightx = 0.5; +// MarcacaoVisitaHSTPanelGBC.weighty = 0.0; +// MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.HORIZONTAL; +// MarcacaoVisitaHSTPanelLayout.setConstraints( tecnicoList, MarcacaoVisitaHSTPanelGBC ); +// MarcacaoVisitaHSTPanel.add( tecnicoList ); +// +// MarcacaoVisitaHSTPanelGBC.gridx = 0; +// MarcacaoVisitaHSTPanelGBC.gridy = 3; +// MarcacaoVisitaHSTPanelGBC.gridwidth = 3; +// MarcacaoVisitaHSTPanelGBC.gridheight = 1; +// MarcacaoVisitaHSTPanelGBC.weightx = 1.0; +// MarcacaoVisitaHSTPanelGBC.weighty = 0.5; +// MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.BOTH; +// MarcacaoVisitaHSTPanelLayout.setConstraints( estadoList, MarcacaoVisitaHSTPanelGBC ); +// MarcacaoVisitaHSTPanel.add( estadoList ); +// +// MarcacaoVisitaHSTPanelGBC.gridx = 0; +// MarcacaoVisitaHSTPanelGBC.gridy = 4; +// MarcacaoVisitaHSTPanelGBC.gridwidth = 3; +// MarcacaoVisitaHSTPanelGBC.gridheight = 1; +// MarcacaoVisitaHSTPanelGBC.weightx = 1.0; +// MarcacaoVisitaHSTPanelGBC.weighty = 0.5; +// +// MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.BOTH; +// MarcacaoVisitaHSTPanelLayout.setConstraints( observacoesTextScroll, MarcacaoVisitaHSTPanelGBC ); +// MarcacaoVisitaHSTPanel.add( observacoesTextScroll ); + } + + private void setupComponentsHashtable() + { + components.putComponent( MarcacoesEstabelecimentoData.DATA, dataPanel ); + components.putComponent( MarcacoesEstabelecimentoData.DATA_RELATORIO, dataFichaPanel ); + components.putComponent( MarcacoesEstabelecimentoData.TECNICO_HST, tecnicoList ); + components.putComponent( MarcacoesEstabelecimentoData.TECNICO_SUPERIOR_HST, tecnicoSuperiorList ); + components.putComponent( MarcacoesEstabelecimentoData.ESTADO, estadoList ); + components.putComponent( MarcacoesEstabelecimentoData.OBSERVACOES, observacoesText ); + } + + public void fill( Object toFill ) + { + clear(); + if( toFill == null || !( toFill instanceof PropertyObject ) ) + { + return; + } + Map data = null; + if( toFill instanceof PropertyObject ) + { + data = ( (PropertyObject) toFill ).getHashData(); + if( toFill instanceof MarcacoesEstabelecimentoData ) + { + marcacaoEstabelecimentosData = (MarcacoesEstabelecimentoData) toFill; + } + } + else if( toFill instanceof Hashtable ) + { + data = (Hashtable) toFill; + } + else + { + return; + } + if( marcacaoEstabelecimentosData == null ) + { + marcacaoEstabelecimentosData = new MarcacoesEstabelecimentoData(); + marcacaoEstabelecimentosData.setHashData( data ); + } + PropertyObject po = (PropertyObject) toFill; + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.fill( properties, po.getHashData(), components ); + } + + public Object save() + { + if( marcacaoEstabelecimentosData == null ) + { + marcacaoEstabelecimentosData = new MarcacoesEstabelecimentoData(); + } + Map data = marcacaoEstabelecimentosData.getHashData(); + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.save( properties, data, components ); + if( !( marcacaoEstabelecimentosData instanceof PropertyObject ) ) + { + return data; + } + marcacaoEstabelecimentosData.setHashData( data ); + return marcacaoEstabelecimentosData; + } + + public void clear() + { + marcacaoEstabelecimentosData = null; + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.clear( properties, components ); + } + + public void setEnabled( boolean enable ) + { + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.setEnabled( properties, enable, components ); + } + + public Class getDataClass() + { + return MarcacoesEstabelecimentoData.class; + } + + public JLabel getDataFichaLabel() + { + return dataFichaLabel; + } + + public JCalendarPanel getDataFichaPanel() + { + return dataFichaPanel; + } + + public JLabel getDataLabel() + { + return dataLabel; + } + + public JCalendarPanel getDataPanel() + { + return dataPanel; + } + + public JButton getEmailButton() + { + return emailButton; + } + + public RadioButtonFixedPanel getEstadoList() + { + return estadoList; + } + + public StateTextArea getObservacoesText() + { + return observacoesText; + } + + public JLabel getTecnicoLabel() + { + return tecnicoLabel; + } + + public JComboBox getTecnicoList() + { + return tecnicoList; + } + + public JComboBox getTecnicoSuperiorList() + { + return tecnicoSuperiorList; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacaoVisitaHSTPanel.xml b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacaoVisitaHSTPanel.xml new file mode 100644 index 00000000..04a78a45 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacaoVisitaHSTPanel.xml @@ -0,0 +1,93 @@ + + + + + + + siprp.data.* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + Estado + + 6 + + + Por realizar + Realizada + Desmarcada pela empresa + Desmarcada pela SIPRP + + + + + + Observa\u00e7\u00f5es + + + 5 + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacoesHigieneUpperPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacoesHigieneUpperPanel.java new file mode 100644 index 00000000..64c9c2d1 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacoesHigieneUpperPanel.java @@ -0,0 +1,207 @@ +/* + * MarcacoesHigieneUpperPanel.java + * + * Created on February 2, 2006, 12:40 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene.marcacoes; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.util.Arrays; +import java.util.Vector; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import siprp.higiene.HigieneDataProvider; + +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.ColumnizedMappable; +import com.evolute.utils.tables.VectorTableModel; +import com.evolute.utils.ui.DialogException; + +/** + * + * @author fpalma + */ +public class MarcacoesHigieneUpperPanel extends JPanel + implements ListSelectionListener, ControllableComponent +{ + protected BaseTable empresasTable; + protected VectorTableModel empresasModel; + protected BaseTable estabelecimentosTable; + protected VectorTableModel estabelecimentosModel; + + protected HigieneDataProvider provider; + + protected final Vector listeners; + + /** Creates a new instance of MedicinaUpperPanel */ + public MarcacoesHigieneUpperPanel() + throws Exception + { + provider = ( HigieneDataProvider ) HigieneDataProvider.getProvider(); + listeners = new Vector(); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + empresasModel = new VectorTableModel( new String[]{ "empresas" } ); + empresasTable = new BaseTable( empresasModel ); + empresasTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + empresasTable.setNonResizableNorReordable(); + JScrollPane empresasScroll = + new JScrollPane( empresasTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + empresasTable.getSelectionModel().addListSelectionListener( this ); + estabelecimentosModel = new VectorTableModel( new String[]{ "estabelecimentos" } ); + estabelecimentosTable = new BaseTable( estabelecimentosModel ); + estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + estabelecimentosTable.setNonResizableNorReordable(); + JScrollPane estabelecimentosScroll = + new JScrollPane( estabelecimentosTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + estabelecimentosTable.getSelectionModel().addListSelectionListener( this ); + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridwidth = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.weightx = 0.5; + constraints.weighty = 1; + + gridbag.setConstraints( empresasScroll, constraints ); + + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( estabelecimentosScroll, constraints ); + + add( empresasScroll ); + add( estabelecimentosScroll ); + + ColumnizedMappable empresas[] = provider.getAllEmpresas(); + Vector values = empresasModel.getValues(); + values.addAll( Arrays.asList( empresas ) ); + empresasModel.setValues( values ); + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + if( e.getValueIsAdjusting() ) + { + return; + } + if( source.equals( empresasTable.getSelectionModel() ) ) + { + carregarEstabelecimentos(); + } + else if( source.equals( estabelecimentosTable.getSelectionModel() ) ) + { + notifyListeners( e ); + } + } + + protected void carregarEstabelecimentos() + { + estabelecimentosTable.clearSelection(); + int selected = empresasTable.getSelectedRow(); + estabelecimentosModel.clearAll(); + if( selected > -1 ) + { + try + { + Integer empresaID = ( ( ColumnizedMappable ) empresasModel.getRowAt( selected ) ).getID(); + ColumnizedMappable estabelecimentos[] = provider.getAllEstabelecimentosForEmpresa( empresaID); + Vector values = estabelecimentosModel.getValues(); + values.addAll( Arrays.asList( estabelecimentos ) ); + estabelecimentosModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os estabelecimentos.", true ); + estabelecimentosModel.clearAll(); + } + } + } + + protected void notifyListeners( ListSelectionEvent e ) + { + for( int n = 0; n < listeners.size(); n++ ) + { + ListSelectionEvent event = + new ListSelectionEvent( this, e.getFirstIndex(), e.getLastIndex(), e.getValueIsAdjusting() ); + ( ( ListSelectionListener ) listeners.elementAt( n ) ).valueChanged( event ); + } + } + + public void addListSelectionListener( ListSelectionListener listener ) + { + listeners.add( listener ); + } + + public void removeSelectionListener( ListSelectionListener listener ) + { + listeners.remove( listener ); + } + + public void clear() + { +// empresasTable.clearSelection(); + } + + public void fill( Object value ) + { + if( value == null ) + { + clear(); + } + Integer ids[] = ( Integer [] ) value; + for( int n = 0; n < empresasTable.getRowCount(); n++ ) + { + if( ( ( ColumnizedMappable ) empresasModel.getRowAt( n ) ).getID().equals( ids[ 0 ] ) ) + { + empresasTable.setRowSelectionInterval( n, n ); + break; + } + } + + for( int n = 0; n < estabelecimentosTable.getRowCount(); n++ ) + { + if( ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( n ) ).getID().equals( ids[ 1 ] ) ) + { + estabelecimentosTable.setRowSelectionInterval( n, n ); + break; + } + } + } + + public Object save() + { + int empresaSelected = empresasTable.getSelectedRow(); + int estabelecimentoSelected = estabelecimentosTable.getSelectedRow(); + return new Integer[]{ + empresaSelected == -1 ? null : ( ( ColumnizedMappable ) empresasModel.getRowAt( empresaSelected ) ).getID(), + estabelecimentoSelected == -1 ? null : ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( estabelecimentoSelected ) ).getID() + }; + } + + public void setEnabled( boolean enable ) + { + empresasTable.setEnabled( enable ); + estabelecimentosTable.setEnabled( enable ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacoesHigieneWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacoesHigieneWindow.java new file mode 100644 index 00000000..50e0b313 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacoesHigieneWindow.java @@ -0,0 +1,558 @@ +/* + * MarcacoesHigieneWindow.java + * + * Created on January 31, 2006, 11:32 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene.marcacoes; + +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.text.DateFormat; +import java.util.Date; +import java.util.Hashtable; +import java.util.Locale; + +import javax.swing.JComboBox; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import shst.SHSTTrackerInterface; +import shst.higiene.marcacoes.MarcacoesHigieneInterface; +import siprp.CompanyDataLoader; +import siprp.SingletonConstants; +import siprp.clientes.AvisosPanel; +import siprp.data.AvisoConstants; +import siprp.data.Marcacao; +import siprp.data.outer.ContactosData; +import siprp.data.outer.EstabelecimentosData; +import siprp.data.outer.MarcacoesEstabelecimentoData; +import siprp.higiene.HigieneDataProvider; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Object2DArray; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.panel.TableEditorPanel; +import com.evolute.utils.ui.text.CopyPasteHandler; +import com.evolute.utils.ui.window.EditorWindow; + +/** + * + * @author fpalma + */ +public class MarcacoesHigieneWindow extends EditorWindow + implements ItemListener, ActionListener, ListSelectionListener, MarcacoesHigieneInterface +{ + + private static final long serialVersionUID = 1L; + + public final static String TITLE = "Marca\u00e7\u00f5es de Higiene e Seguran\u00e7a"; + + private final static int iPermissionArray[][] = + new int[][]{ {}, { NEW_INDEX, EDIT_INDEX, CANCEL_INDEX, SAVE_INDEX, DELETE_INDEX } }; + + private static final int INDEX_MAIN = 0; + private static final int INDEX_VISITA = 1; + + private static final DateFormat DATE_FORMAT = + DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "PT", "pt" ) ); + + protected MarcacoesHigieneUpperPanel upperPanel; + protected MarcacaoVisitaHSTPanel marcacaoPanel; + protected TableEditorPanel marcacaoEditorPanel; + + protected HigieneDataProvider provider; + protected ProviderInterface JDO; + protected SHSTTrackerInterface tracker; + + private Hashtable tecnicosHash; + + protected Integer empresaID; + protected String empresa; + protected Integer estabelecimentoID; + protected EstabelecimentosData estabelecimento; + + protected boolean editing = false; + + /** Creates a new instance of MarcacoesHigieneWindow */ + public MarcacoesHigieneWindow() + throws Exception + { + super( iPermissionArray ); + this.provider = ( HigieneDataProvider ) HigieneDataProvider.getProvider(); + this.JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + this.tecnicosHash = new Hashtable(); + this.setupComponents(); + this.setSize( 800, 700 ); + this.setLocationRelativeTo(null); + this.setExtendedState( getExtendedState() | MAXIMIZED_BOTH ); + } + + private void setupComponents() + throws Exception + { + setTitle( TITLE ); + upperPanel = new MarcacoesHigieneUpperPanel(); + JPanel panel = new JPanel(); + + GridBagLayout gridbag = new GridBagLayout(); + GridBagConstraints constraints = new GridBagConstraints(); + getContentPane().setLayout( gridbag ); + constraints.insets = new Insets( 2, 2, 2, 2 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1; + constraints.gridheight = 1; + + constraints.weighty = 1; + gridbag.setConstraints( upperPanel, constraints ); + + constraints.weighty = 0; + gridbag.setConstraints( panel, constraints ); + + getContentPane().add( upperPanel ); + getContentPane().add( panel ); + + changeGroupName( INDEX_VISITA, "Visitas" ); + setActionName( INDEX_VISITA, NEW_INDEX, "Nova" ); + setActionTooltip( INDEX_VISITA, NEW_INDEX, "Nova" ); + JPanel toolbar = getToolbarPanel( INDEX_VISITA ); + + gridbag = new GridBagLayout(); +// GridBagConstraints constraints = new GridBagConstraints(); + panel.setLayout( gridbag ); + constraints.insets = new Insets( 2, 2, 2, 2 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1.0; + constraints.weighty = 0; + + gridbag.setConstraints( toolbar, constraints ); + panel.add( toolbar ); + + constraints.gridheight = 1; + constraints.weighty = 0; + try + { + marcacaoEditorPanel = + new TableEditorPanel( new String[]{ "Data", + "Estado" }, + new int[]{0,2}, new int[]{0,0}, + 0.0, 1.0, new Dimension( 350, 100 ) ); + marcacaoPanel = new MarcacaoVisitaHSTPanel(); + new CopyPasteHandler( marcacaoPanel.getObservacoesText() ); + marcacaoEditorPanel.addComponent( marcacaoPanel, + new int[]{0,2}, new int[]{1,2}, + 1.0, 1.0 ); + marcacaoEditorPanel.addListSelectionListener( new ListSelectionListener(){ + public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent) + { + if( marcacaoEditorPanel.getID() != null ) + { + reload(INDEX_VISITA); + select(INDEX_VISITA); + } + else + { + clear( INDEX_VISITA ); + } + } + }); + }catch( Exception ex ) + { + DialogException.showException( ex ); + return; + } + gridbag.setConstraints( marcacaoEditorPanel, constraints ); + panel.add( marcacaoEditorPanel ); + marcacaoPanel.getEmailButton().addActionListener( this ); + + fillCombos(); + upperPanel.addListSelectionListener( this ); + } + + public void fillCombos() + throws Exception + { + JComboBox tecnicosList = marcacaoPanel.getTecnicoList(); + JComboBox tecnicosSuperioresList = marcacaoPanel.getTecnicoSuperiorList(); + tecnicosHash.clear(); + tecnicosList.removeItemListener( this ); + tecnicosSuperioresList.removeItemListener( this ); + fillTecnicos(tecnicosList,false); + fillTecnicos(tecnicosSuperioresList,true); + tecnicosList.addItemListener( this ); + tecnicosSuperioresList.addItemListener( this ); + } + + private void fillTecnicos( JComboBox tecnicosList, boolean superiores ) throws Exception + { + tecnicosList.removeAllItems(); + Object tecnicos[][] = provider.getTecnicosHST( superiores ); + tecnicosList.addItem( new MappableObject( new Integer( -2 ), " " ) ); + for( int n = 0; n < tecnicos.length; n++ ) + { + Object tecnico[] = new Object[ 4 ]; + tecnico[ 0 ] = new Integer( ( (Number)tecnicos[n][0] ).intValue() ); + tecnico[ 1 ] = tecnicos[ n ][ 1 ]; + tecnico[ 2 ] = tecnicos[ n ][ 2 ]; + tecnico[ 3 ] = new Integer( n ); + tecnicosHash.put( tecnicos[ n ][ 0 ], tecnico ); + tecnicosList.addItem( new MappableObject( (Integer) tecnico[ 0 ], tecnico[ 1 ] ) ); + } + tecnicosList.setSelectedIndex( 0 ); + + tecnicosList.addItem( new MappableObject( new Integer( -1 ), "Novo/Editar" ) ); + } + + public void itemStateChanged( ItemEvent itemEvent ) + { + JComboBox tecnicos = null; + if( itemEvent.getSource().equals( marcacaoPanel.getTecnicoList() ) ) + { + tecnicos = marcacaoPanel.getTecnicoList(); + } + else if( itemEvent.getSource().equals( marcacaoPanel.getTecnicoSuperiorList() ) ) + { + tecnicos = marcacaoPanel.getTecnicoSuperiorList(); + } + if( tecnicos != null && itemEvent.getStateChange() == ItemEvent.SELECTED ) + { + int index = tecnicos.getSelectedIndex(); + if( index == tecnicos.getItemCount() - 1 ) + { + try + { + TecnicoEditor te = new TecnicoEditor( this ); + te.setVisible( true ); + Integer id = te.getID(); + if( id == null ) + { + tecnicos.setSelectedIndex( 0 ); + } + else + { + fillCombos(); + if( id != null ) + { + Object[] tecnico = tecnicosHash.get( id ); + tecnicos.setSelectedIndex( ( (Integer)tecnico[ 3 ] ).intValue() + 1 ); + } + } + + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro na janela de edi\u00e7\u00e3o...", true ); + ex.printStackTrace(); + tecnicos.setSelectedIndex( 0 ); + return; + } + } + } + } + + public boolean save(int index) + { + switch( index ) + { + case INDEX_VISITA: + MarcacoesEstabelecimentoData visita = ( MarcacoesEstabelecimentoData ) marcacaoPanel.save(); + Date data = ( Date ) visita.get( MarcacoesEstabelecimentoData.DATA ); + if( data == null ) + { + JOptionPane.showMessageDialog( this, "Tem de preencher uma data para a visita.", + "Erro", JOptionPane.ERROR_MESSAGE ); + return false; + } + visita.setToEstabelecimento_id( estabelecimento ); + try + { + visita.set( MarcacoesEstabelecimentoData.REALIZADA, + ( ( Integer )visita.get( MarcacoesEstabelecimentoData.ESTADO ) ).intValue() == + HigieneDataProvider.ESTADO_REALIZADO ? "y" : "n" ); + System.out.println( "DATA " + visita.get( MarcacoesEstabelecimentoData.DATA ) ); + Integer tecnico = ( Integer ) visita.get( MarcacoesEstabelecimentoData.TECNICO_HST ); + if( tecnico != null && tecnico.intValue() < 0 ) + { + visita.set( MarcacoesEstabelecimentoData.TECNICO_HST, null ); + } + Integer tecnicoSup = ( Integer ) visita.get( MarcacoesEstabelecimentoData.TECNICO_SUPERIOR_HST ); + if( tecnicoSup != null && tecnicoSup.intValue() < 0 ) + { + visita.set( MarcacoesEstabelecimentoData.TECNICO_SUPERIOR_HST, null ); + } + visita.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + return false; + } + + break; + } + reload( INDEX_MAIN ); + editing = false; + return true; + } + + public boolean delete(int index) + { + int option = JOptionPane.showConfirmDialog( this, "Tem a certeza que quer apagar a marca\u00e7\u00e3o?", + "Apagar", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE ); + if( option == 0 ) + { + switch( index ) + { + case INDEX_VISITA: + MarcacoesEstabelecimentoData visita = ( MarcacoesEstabelecimentoData ) marcacaoPanel.save(); + try + { + visita.delete(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a apagar.", true ); + return false; + } + break; + } + reload( INDEX_MAIN ); + return true; + } + return false; + } + + public void clear(int index) + { + switch( index ) + { + case INDEX_MAIN: + empresaID = null; + empresa = null; + estabelecimentoID = null; + estabelecimento = null; + upperPanel.clear(); + marcacaoEditorPanel.clear(); + break; + + case INDEX_VISITA: + marcacaoPanel.clear(); + marcacaoPanel.getEmailButton().setText( "Enviar email" ); + break; + } + } + + public void enableComponents(int index, boolean enable) + { + switch( index ) + { + case INDEX_MAIN: + + break; + + case INDEX_VISITA: + marcacaoPanel.setEnabled( enable ); + marcacaoPanel.getEmailButton().setEnabled( enable ); + upperPanel.setEnabled( !enable ); + editing = enable; + break; + } + if( tracker != null ) + { + ( ( AvisosPanel ) tracker.getAvisosPanel() ).setEnabled( ! editing, AvisoConstants.TIPO_ESTABELECIMENTO ); + } + } + + protected void enableSelect( int index, boolean select ) + { + switch( index ) + { + case INDEX_VISITA: + marcacaoEditorPanel.setEnabled( select ); + break; + } + } + + public void reload( int index ) + { + switch( index ) + { + case INDEX_MAIN: + try + { + empresa = provider.getEmpresa( empresaID ); + estabelecimento = ( EstabelecimentosData ) JDO.load( EstabelecimentosData.class, estabelecimentoID ); +// upperPanel.getEmpresaText().setText( empresa ); +// upperPanel.getEstabelecimentoText().setText( estabelecimento ); +// upperPanel.getTrabalhadorText().setText( ( String ) trabalhador.get( TrabalhadoresData.NOME ) ); + Object visitas[][] = provider.getVisitasEstabelecimento( estabelecimentoID ); + if( visitas.length > 0 ) + { + marcacaoEditorPanel.setData( new Object2DArray( visitas ) ); + } + else + { + marcacaoEditorPanel.clear(); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os dados.", true ); + } + break; + + case INDEX_VISITA: + Integer visitaID = marcacaoEditorPanel.getID(); + if( visitaID == null ) + { + return; + } + try + { + MarcacoesEstabelecimentoData visita = + ( MarcacoesEstabelecimentoData ) JDO.load( MarcacoesEstabelecimentoData.class, visitaID ); + marcacaoPanel.fill( visita ); + Date dataEmailVisita = ( Date ) visita.get( MarcacoesEstabelecimentoData.DATA_EMAIL ); + if( dataEmailVisita != null ) + { + marcacaoPanel.getEmailButton().setText( "Enviar email (" + DATE_FORMAT.format( dataEmailVisita ) + ")" ); + } + else + { + marcacaoPanel.getEmailButton().setText( "Enviar email" ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os dados da visita.", true ); + } + break; + } + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( marcacaoPanel.getEmailButton() ) ) + { + enviarEmailVisita(); + } + } + + protected void enviarEmailVisita() + { + MarcacoesEstabelecimentoData visita = ( MarcacoesEstabelecimentoData ) marcacaoPanel.save(); + + String subject = ( String ) Singleton.getInstance( SingletonConstants.SUBJECT_VISITA ); + String texto = ( String ) Singleton.getInstance( SingletonConstants.LETTER_VISITA ); + + Date today = new Date(); + marcacaoPanel.getEmailButton().setText( "Enviar email (" + DATE_FORMAT.format( today ) + ")" ); + + try + { + enviarEmail( subject, texto, ( Date )visita.get( MarcacoesEstabelecimentoData.DATA ) ); + visita.set( Marcacao.DATA_EMAIL, today ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a enviar mail", true ); + } + } + + protected void enviarEmail( String subject, String texto, Date data ) + throws Exception + { + String sede = ( String )estabelecimento.get( EstabelecimentosData.NOME ); + String dataStr = DATE_FORMAT.format( data ); + subject = subject.replaceAll( CompanyDataLoader.NOME, sede ); + String morada = ( String )estabelecimento.get( EstabelecimentosData.MORADA ); + + texto = texto.replaceAll( CompanyDataLoader.DATA, dataStr ); + texto = texto.replaceAll( CompanyDataLoader.NOME, sede ); + texto = texto.replaceAll( CompanyDataLoader.MORADA, morada ); + + ContactosData contacto = estabelecimento.toContacto_id(); + String mail = ""; + if( contacto != null ) + { + mail = ( String )contacto.get( ContactosData.EMAIL ); + } + + if( System.getProperty( "os.name" ).startsWith( "Windows" ) ) + { + mail = mail.replaceAll( " ", "%20" ); + subject = subject.replaceAll( " ", "%20" ); + texto = texto.replaceAll( " ", "%20" ); + Process proc = Runtime.getRuntime().exec( "cmd.exe /c start mailto:\"" + mail + + "?subject=" + subject + "&body=" + + + texto + ); + } + else + { + mail = mail.replaceAll( " ", "%20" ); + subject = subject.replaceAll( " ", "%20" ); + texto = texto.replaceAll( " ", "%20" ); + + Process proc = Runtime.getRuntime().exec( new String[]{ "/usr/bin/open", "/Applications/Mail.app", "mailto:" + mail + + "?subject=" + subject + "&body=" + + texto } ); + } + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + if( source.equals( upperPanel ) ) + { + Integer ids[] = ( Integer [] ) upperPanel.save(); + empresaID = ids[ 0 ]; + estabelecimentoID = ids[ 1 ]; + if( ids[ 1 ] == null ) + { + clear( INDEX_MAIN ); + unselect( INDEX_MAIN ); + } + else + { + reload( INDEX_MAIN ); + select( INDEX_MAIN ); + } + } + } + + public void setEmpresaAndEstabelecimento( Integer empresaID, Integer estabelecimentoID ) + { + if( editing ) + { + JOptionPane.showMessageDialog( this, "Esta janela est\u00e1 em edi\u00e7\u00e3o.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + } + else + { + upperPanel.fill( new Integer[]{ empresaID, estabelecimentoID } ); + } + } + + public void setTracker( SHSTTrackerInterface tracker ) + { + this.tracker = tracker; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/TecnicoEditor.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/TecnicoEditor.java new file mode 100644 index 00000000..02b6f334 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/TecnicoEditor.java @@ -0,0 +1,323 @@ +package siprp.higiene.marcacoes; + + +import static com.evolute.utils.strings.UnicodeLatin1Map.eacute; + +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Vector; + +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import siprp.data.outer.MarcacoesTecnicosHstData; +import siprp.higiene.HigieneDataProvider; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.ColumnizedObjectArray; +import com.evolute.utils.tables.VectorTableModel; +import com.evolute.utils.ui.CustomJDialog; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.button.BetterButtonGroup; +import com.evolute.utils.ui.text.CopyPasteHandler; + +/** + * + * @author fpalma + */ +public class TecnicoEditor extends CustomJDialog + implements ActionListener, ListSelectionListener +{ + + private static final long serialVersionUID = 1L; + + private ProviderInterface JDO; + private HigieneDataProvider provider; + private BaseTable table; + private VectorTableModel model; + private JButton okButton; + private JButton cancelarButton; + private JButton novoButton; + private JTextField nomeText; + private JTextField iniciaisText; + private JCheckBox checkSuperior; + private Integer id; + private boolean isNew = false; + private BetterButtonGroup corGroup; + private JRadioButton cores[]; + + /** Creates a new instance of MedicoEditor */ + public TecnicoEditor( JFrame owner ) + throws Exception + { + super( owner, true ); + provider = (HigieneDataProvider)HigieneDataProvider.getProvider(); + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + setSize( 600, 300 ); + setResizable( false ); + setTitle( "Criar/Editar T\u00e9cnico" ); + centerSuper(); + + model = new VectorTableModel( new String[]{ "Nome", "Iniciais", "Cor", "Superior" } ); + table = new BaseTable( model ); + table.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + table.setTableCellRenderer( new TecnicoRenderer() ); + JScrollPane scp = new JScrollPane(); + scp.setMinimumSize( new Dimension( 300, 200 ) ); + scp.setMaximumSize( new Dimension( 300, 200 ) ); + scp.setPreferredSize( new Dimension( 300, 200 ) ); + scp.setSize( new Dimension( 300, 200 ) ); + scp.setViewportView( table ); + scp.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + scp.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + table.fixColumnWidth( 0, 200 ); + table.setNonResizableNorReordable(); + table.getSelectionModel().addListSelectionListener( this ); + Object obj[][] = provider.getAllTecnicosHST(); + Vector tecnicosHST = new Vector(); + for( int n = 0; n < obj.length; n++ ) + { + tecnicosHST.add( new ColumnizedObjectArray( obj[ n ], true ) ); + } + model.setValues( tecnicosHST ); + + okButton = new JButton( "OK" ); + cancelarButton = new JButton( "Cancelar" ); + novoButton = new JButton( "Novo" ); + okButton.addActionListener( this ); + cancelarButton.addActionListener( this ); + novoButton.addActionListener( this ); + + nomeText = new JTextField(); + nomeText.setEnabled( false ); + iniciaisText = new JTextField(); + iniciaisText.setEnabled( false ); + checkSuperior = new JCheckBox( "T" + eacute + "cnico Superior" ); + checkSuperior.setEnabled( false ); + JPanel corPanel = new JPanel(); + corPanel.setLayout( new BoxLayout( corPanel, BoxLayout.Y_AXIS ) ); + corGroup = new BetterButtonGroup( false ); + cores = new JRadioButton[ HigieneDataProvider.CORES_TECNICOS.length ]; + for( int n = 0; n < HigieneDataProvider.CORES_TECNICOS.length; n++ ) + { + cores[ n ] = new JRadioButton( " " ); + cores[ n ].setBackground( HigieneDataProvider.CORES_TECNICOS[ n ] ); + corPanel.add( cores[ n ] ); + corGroup.add( cores[ n ] ); + } + JScrollPane corScroll = + new JScrollPane( corPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + + GridBagLayout gridbag = new GridBagLayout(); + getContentPane().setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 1; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + + JPanel upperPanel = new JPanel(); + upperPanel.setLayout( new GridLayout( 1, 2 ) ); + upperPanel.add( scp ); + JPanel textPanel = new JPanel(); + upperPanel.add( textPanel ); + gridbag.setConstraints( upperPanel, constraints ); + getContentPane().add( upperPanel ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.weightx = 0.3; + constraints.gridwidth = 1; + constraints.gridheight = GridBagConstraints.REMAINDER;; + + gridbag.setConstraints( novoButton, constraints ); + getContentPane().add( novoButton ); + + gridbag.setConstraints( okButton, constraints ); + getContentPane().add( okButton ); + + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( cancelarButton, constraints ); + getContentPane().add( cancelarButton ); + + gridbag = new GridBagLayout(); + textPanel.setLayout( gridbag ); + constraints.weighty = 0; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + + JLabel nomeLabel = new JLabel( "Nome" ); + gridbag.setConstraints( nomeLabel, constraints ); + textPanel.add( nomeLabel ); + + gridbag.setConstraints( nomeText, constraints ); + textPanel.add( nomeText ); + + JLabel iniciaisLabel = new JLabel( "Iniciais" ); + gridbag.setConstraints( iniciaisLabel, constraints ); + textPanel.add( iniciaisLabel ); + + gridbag.setConstraints( iniciaisText, constraints ); + textPanel.add( iniciaisText ); + + gridbag.setConstraints( checkSuperior, constraints ); + textPanel.add( checkSuperior ); + + JLabel corLabel = new JLabel( "Cor" ); + gridbag.setConstraints( corLabel, constraints ); + textPanel.add( corLabel ); + + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.fill = GridBagConstraints.BOTH; + + gridbag.setConstraints( corScroll, constraints ); + textPanel.add( corScroll ); + + new CopyPasteHandler( nomeText ); + new CopyPasteHandler( iniciaisText ); + } + + @Override + public void actionPerformed( ActionEvent e ) + { + if( e.getSource().equals( okButton ) ) + { + if( save() ) + { + close(); + } + } + else if( e.getSource().equals( cancelarButton ) ) + { + id = null; + close(); + } + if( e.getSource().equals( novoButton ) ) + { + table.getSelectionModel().removeListSelectionListener( this ); + nomeText.setText( "" ); + iniciaisText.setText( "" ); + corGroup.setIntSelected( 0 ); + nomeText.setEnabled( true ); + iniciaisText.setEnabled( true ); + corGroup.setEnabled( true ); + checkSuperior.setSelected( false ); + checkSuperior.setEnabled( true ); + id = null; + isNew = true; + } + } + + @Override + public void valueChanged( ListSelectionEvent listSelectionEvent ) + { + int selected = table.getSelectedRow(); + if( selected == -1 ) + { + return; + } + ColumnizedObjectArray row = model.getRowAt( selected ); + id = row.getID(); + String nome = (String) row.getValue( 0 ); + String iniciais = (String) row.getValue( 1 ); + Integer cor = ( Integer ) row.getValue( 2 ); + String superior = ( String) row.getValue( 3 ); + nomeText.setText( nome ); + iniciaisText.setText( iniciais ); + corGroup.setIntSelected( cor.intValue() ); + nomeText.setEnabled( true ); + iniciaisText.setEnabled( true ); + corGroup.setEnabled( true ); + checkSuperior.setEnabled( true ); + checkSuperior.setSelected( superior != null && "y".equals(superior) ); + } + + private void close() + { + setVisible( false ); + dispose(); + } + + public boolean getIsNew() + { + return isNew; + } + + public Integer getID() + { + return id; + } + + private boolean save() + { + String nome = nomeText.getText().trim(); + String nomePlain = com.evolute.utils.strings.StringPlainer.convertString( nome ); + String iniciais = iniciaisText.getText().trim(); + Integer cor = new Integer( corGroup.getIntSelected() ); + if( nome.length() == 0 || iniciais.length() == 0 ) + { + JOptionPane.showMessageDialog( this, "O Nome e as iniciais n\u00e3o podem ser vazios.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + return false; + } + try + { + MarcacoesTecnicosHstData tecnico; + if( id != null ) + { + tecnico = ( MarcacoesTecnicosHstData ) JDO.load( MarcacoesTecnicosHstData.class, id ); + } + else + { + tecnico = new MarcacoesTecnicosHstData(); + } + tecnico.set( MarcacoesTecnicosHstData.IS_SUPERIOR, checkSuperior.isSelected() ? "y" : "n" ); + tecnico.set( MarcacoesTecnicosHstData.NOME, nome ); + tecnico.set( MarcacoesTecnicosHstData.NOME_PLAIN, nomePlain ); + tecnico.set( MarcacoesTecnicosHstData.INICIAIS, iniciais ); + tecnico.set( MarcacoesTecnicosHstData.IDENTIFICADOR, cor ); + tecnico.save(); + if( id == null ) + { + id = (Integer)tecnico.get( MarcacoesTecnicosHstData.ID ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar...", false ); + return false; + } + + return true; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/TecnicoRenderer.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/TecnicoRenderer.java new file mode 100644 index 00000000..5510e309 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/marcacoes/TecnicoRenderer.java @@ -0,0 +1,61 @@ +/* + * DiaRenderer.java + * + * Created on 8 de Fevereiro de 2006, 21:45 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene.marcacoes; + +import java.awt.Color; +import java.awt.Component; + +import javax.swing.JLabel; +import javax.swing.JTable; +import javax.swing.table.TableCellRenderer; + +import siprp.higiene.HigieneDataProvider; + +/** + * + * @author Frederico + */ +public class TecnicoRenderer + implements TableCellRenderer +{ + protected JLabel labels[]; + protected Color defaultColor; + + /** Creates a new instance of DiaRenderer */ + public TecnicoRenderer() + { + labels = new JLabel[ 4 ]; + for( int n = 0; n < 4; n++ ) + { + labels[ n ] = new JLabel(); + } + defaultColor = labels[ 0 ].getBackground(); + labels[ 2 ].setOpaque( true ); + } + + public Component getTableCellRendererComponent( JTable table, Object value, + boolean isSelected, + boolean hasFocus, + int row, int column ) + { + switch( column ) + { + case 2: + labels[ 2 ].setText( " " ); + labels[ 2 ].setBackground( value == null ? defaultColor : + HigieneDataProvider.CORES_TECNICOS[ ( ( Integer ) value ).intValue() ] ); + break; + default: + labels[ column ].setText( ( String ) value ); + break; + } + return labels[ column ]; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidaRelatorioPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidaRelatorioPanel.java new file mode 100644 index 00000000..f8db5968 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidaRelatorioPanel.java @@ -0,0 +1,304 @@ +package siprp.higiene.relatorio; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.event.CaretEvent; +import javax.swing.event.CaretListener; + +import leaf.ui.LeafButton; +import leaf.ui.LeafDialog; +import siprp.SIPRPSpellChecker; +import siprp.database.cayenne.objects.HsRelatorioPostoMedida; + +import com.evolute.utils.images.ImageException; +import com.evolute.utils.images.ImageIconLoader; + +public class GerirMedidaRelatorioPanel extends JPanel +{ + + public static final String MEDIDA_CHANGED = "MEDIDA_CHANGED"; + + private static final long serialVersionUID = 1L; + + private static final String ICON_NAME_SAVE = "siprp/higiene/gestao/riscos/save.png"; + + private static final String ICON_NAME_REVERT = "siprp/higiene/gestao/riscos/revert.png"; + + private LeafButton buttonSaveMedida; + + private LeafButton buttonRevertMedida; + + private LeafButton buttonSaveRequesito; + + private LeafButton buttonRevertRequesito; + + private final JCheckBox checkPlanoActuacao = new JCheckBox( "Plano de actua" + ccedil + atilde + "o" ); + + private final JTextArea fieldTextMedida = new JTextArea(); + + private final JScrollPane scrollMedida = new JScrollPane( fieldTextMedida ); + + private final JTextArea fieldTextRequisitosLegais = new JTextArea(); + + private final JScrollPane scrollRequesitos = new JScrollPane( fieldTextRequisitosLegais ); + + private HsRelatorioPostoMedida relacao = null; + + public GerirMedidaRelatorioPanel() + { + try + { + buttonSaveMedida = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_SAVE ) ); + buttonRevertMedida = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_REVERT ) ); + buttonSaveRequesito = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_SAVE ) ); + buttonRevertRequesito = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_REVERT ) ); + } catch( ImageException e ) + { + e.printStackTrace(); + } + startupComponents(); + startupLayout(); + placeComponents(); + setupListeners(); + } + + private void startupComponents() + { + fieldTextMedida.setWrapStyleWord( true ); + fieldTextMedida.setLineWrap( true ); + fieldTextRequisitosLegais.setWrapStyleWord( true ); + fieldTextRequisitosLegais.setLineWrap( true ); + SIPRPSpellChecker.getInstance().attachSpellCheckToComponent( fieldTextRequisitosLegais ); + SIPRPSpellChecker.getInstance().attachSpellCheckToComponent( fieldTextMedida ); + scrollMedida.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + scrollMedida.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + scrollRequesitos.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + scrollRequesitos.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + buttonSaveMedida.setMargin( new Insets( 0, 0, 0, 0 ) ); + buttonSaveRequesito.setMargin( new Insets( 0, 0, 0, 0 ) ); + buttonRevertMedida.setMargin( new Insets( 0, 0, 0, 0 ) ); + buttonRevertRequesito.setMargin( new Insets( 0, 0, 0, 0 ) ); + } + + private void setupListeners() + { + checkPlanoActuacao.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + savePlano(); + } + } ); + fieldTextRequisitosLegais.addCaretListener( new CaretListener() + { + @Override + public void caretUpdate( CaretEvent e ) + { + setEnabled(); + } + } ); + fieldTextMedida.addCaretListener( new CaretListener() + { + @Override + public void caretUpdate( CaretEvent e ) + { + setEnabled(); + } + } ); + buttonSaveMedida.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + saveMedida(); + } + } ); + buttonSaveRequesito.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + saveRequesito(); + } + } ); + buttonRevertMedida.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + revertMedida(); + } + } ); + buttonRevertRequesito.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + revertRequesito(); + } + } ); + } + + private void startupLayout() + { + TableLayout layout = new TableLayout( new double[] { + TableLayout.FILL, TableLayout.MINIMUM, TableLayout.MINIMUM + }, new double[] { + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.FILL + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + setLayout( layout ); + } + + private void placeComponents() + { + JPanel panel = new JPanel(); + TableLayout layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + panel.setLayout( layout ); + panel.add( checkPlanoActuacao, new TableLayoutConstraints( 0, 0 ) ); + add( panel, new TableLayoutConstraints( 0, 0, 2, 0 ) ); + add( new JLabel( "Requisitos legais" ), new TableLayoutConstraints( 0, 1 ) ); + add( buttonSaveRequesito, new TableLayoutConstraints( 1, 1 ) ); + add( buttonRevertRequesito, new TableLayoutConstraints( 2, 1 ) ); + add( scrollRequesitos, new TableLayoutConstraints( 0, 2, 2, 2 ) ); + add( new JLabel( "Medida" ), new TableLayoutConstraints( 0, 3 ) ); + add( buttonSaveMedida, new TableLayoutConstraints( 1, 3 ) ); + add( buttonRevertMedida, new TableLayoutConstraints( 2, 3 ) ); + add( scrollMedida, new TableLayoutConstraints( 0, 4, 2, 4 ) ); + } + + private void setEnabled() + { + if( isEnabled() ) + { + boolean medidaChanged = false; + boolean requesitoChanged = false; + if( relacao != null ) + { + checkPlanoActuacao.setEnabled( true ); + medidaChanged = !fieldTextMedida.getText().equals( relacao.getToHsRelatorioMedida().getDescription() ); + requesitoChanged = !fieldTextRequisitosLegais.getText().equals( relacao.getToHsRelatorioMedida().getRequesitosLegais() ); + } + fieldTextMedida.setEnabled( relacao != null ); + fieldTextRequisitosLegais.setEnabled( relacao != null ); + buttonSaveMedida.setEnabled( medidaChanged ); + buttonSaveRequesito.setEnabled( requesitoChanged ); + buttonRevertMedida.setEnabled( medidaChanged ); + buttonRevertRequesito.setEnabled( requesitoChanged ); + } + else + { + buttonSaveMedida.setEnabled( false ); + buttonSaveRequesito.setEnabled( false ); + buttonRevertMedida.setEnabled( false ); + buttonRevertRequesito.setEnabled( false ); + fieldTextRequisitosLegais.setEnabled( false ); + fieldTextMedida.setEnabled( false ); + checkPlanoActuacao.setEnabled( false ); + } + + } + + private void savePlano() + { + try + { + if( relacao != null ) + { + relacao.setIsPlanoActuacao( checkPlanoActuacao.isSelected() ); + relacao.save(); + firePropertyChange( MEDIDA_CHANGED, null, relacao ); + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void saveMedida() + { + try + { + if( relacao != null ) + { + relacao.getToHsRelatorioMedida().setDescription( fieldTextMedida.getText() ); + relacao.save(); + refresh(); + } + setEnabled(); + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void saveRequesito() + { + try + { + if( relacao != null ) + { + relacao.getToHsRelatorioMedida().setRequesitosLegais( fieldTextRequisitosLegais.getText() ); + relacao.save(); + refresh(); + } + setEnabled(); + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private void revertMedida() + { + if( relacao != null ) + { + fieldTextMedida.setText( relacao.getToHsRelatorioMedida().getDescription() ); + } + setEnabled(); + } + + private void revertRequesito() + { + if( relacao != null ) + { + fieldTextRequisitosLegais.setText( relacao.getToHsRelatorioMedida().getRequesitosLegais() ); + } + setEnabled(); + } + + private void refresh() + { + firePropertyChange( MEDIDA_CHANGED, null, relacao ); + } + + public void setMedida( HsRelatorioPostoMedida medida ) + { + this.relacao = medida; + fieldTextMedida.setText( medida == null ? null : medida.getToHsRelatorioMedida().getDescription() ); + fieldTextRequisitosLegais.setText( medida == null ? null : medida.getToHsRelatorioMedida().getRequesitosLegais() ); + checkPlanoActuacao.setSelected( medida == null ? false : (medida.getIsPlanoActuacao() == null ? false : medida.getIsPlanoActuacao()) ); + setEnabled(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidasRelatorioPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidasRelatorioPanel.java new file mode 100644 index 00000000..3c1439aa --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidasRelatorioPanel.java @@ -0,0 +1,507 @@ +package siprp.higiene.relatorio; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Color; +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.List; + +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +import leaf.ui.LeafButton; +import leaf.ui.LeafDialog; +import leaf.ui.LeafIconButton; +import leaf.ui.LeafTree; +import leaf.ui.TreeInserterDialog; +import siprp.database.cayenne.objects.HsPostoRisco; +import siprp.database.cayenne.objects.HsRelatorioMedida; +import siprp.database.cayenne.objects.HsRelatorioPosto; +import siprp.database.cayenne.objects.HsRelatorioPostoMedida; +import siprp.database.cayenne.objects.HsRelatorioPostoRisco; +import siprp.database.cayenne.objects.HsRelatorioRisco; +import siprp.database.cayenne.objects.HsRisco; +import siprp.logic.HigieneSegurancaLogic; +import siprp.logic.node.MedidaRelatorioNode; +import siprp.logic.node.NodeRisco; +import siprp.logic.node.RiscoRelatorioNode; + +import com.evolute.utils.ui.trees.TreeTools; + +public class GerirMedidasRelatorioPanel extends JPanel +{ + + private static final long serialVersionUID = 1L; + + public static final String SELECTION_CHANGED = "RISCOS_SELECTION_CHANGED"; + + public static final String VALUE_CHANGED = "VALUE_CHANGED"; + + private static final String ICON_NAME_SAVE = "siprp/higiene/gestao/add.png"; + + private static final String ICON_NAME_REVERT = "siprp/higiene/gestao/delete.png"; + + private final LeafButton buttonAdicionar = LeafIconButton.createButton( ICON_NAME_SAVE ); + + private final LeafButton buttonRemover = LeafIconButton.createButton( ICON_NAME_REVERT ); + + private final DefaultMutableTreeNode root = new DefaultMutableTreeNode(); + + private final DefaultTreeModel model = new DefaultTreeModel( root ); + + public final LeafTree tree = new LeafTree( model ); + + private final JScrollPane scroll = new JScrollPane( tree ); + + private HsRelatorioPosto posto = null; + + private HsRelatorioPostoMedida selectedMedida = null; + + public GerirMedidasRelatorioPanel() + { + startupComponents(); + setupLayout(); + placeComponents(); + startupListeners(); + } + + private void startupComponents() + { + buttonAdicionar.setEnabled( false ); + buttonRemover.setEnabled( false ); + tree.setRootVisible( false ); + tree.getSelectionModel().setSelectionMode( TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION ); + tree.setCellRenderer( new DefaultTreeCellRenderer() + { + + private static final long serialVersionUID = 1L; + + public Component getTreeCellRendererComponent( JTree pTree, Object pValue, boolean pIsSelected, boolean pIsExpanded, boolean pIsLeaf, int pRow, boolean pHasFocus ) + { + super.getTreeCellRendererComponent( pTree, pValue, pIsSelected, pIsExpanded, pIsLeaf, pRow, pHasFocus ); + boolean highlight = false; + Color highColor = null; + Color lowColor = null; + if( pValue instanceof RiscoRelatorioNode ) + { + Object userObject = ((RiscoRelatorioNode) pValue).getUserObject(); + if( userObject instanceof HsRelatorioPostoRisco ) + { + highlight = HigieneSegurancaLogic.isRelatorioRiscoPreenchido( (HsRelatorioPostoRisco) userObject ); + highColor = RelatorioHigieneSegurancaWindow.COLOR_RISCO_OK_SEL; + lowColor = RelatorioHigieneSegurancaWindow.COLOR_RISCO_OK; + } + } + else if( pValue instanceof MedidaRelatorioNode ) + { + Object userObject = ((MedidaRelatorioNode) pValue).getUserObject(); + if( userObject instanceof HsRelatorioPostoMedida ) + { + HsRelatorioPostoMedida medida = (HsRelatorioPostoMedida) userObject; + if( medida.getIsPlanoActuacao() != null ) + { + highlight = medida.getIsPlanoActuacao(); + highColor = RelatorioHigieneSegurancaWindow.COLOR_MEDIDA_OK_SEL; + lowColor = RelatorioHigieneSegurancaWindow.COLOR_MEDIDA_OK; + } + } + } + if( highlight ) + { + setOpaque( true ); + setBackground( pIsSelected ? highColor : lowColor ); + } + else + { + setOpaque( false ); + } + return (this); + } + } ); + } + + private void setupLayout() + { + TableLayout layout = new TableLayout( new double[] { + TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM, TableLayout.FILL + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + setLayout( layout ); + } + + private void placeComponents() + { + JPanel panel = new JPanel(); + TableLayout layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM + } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + panel.setLayout( layout ); + panel.add( buttonAdicionar, new TableLayoutConstraints( 0, 0 ) ); + panel.add( buttonRemover, new TableLayoutConstraints( 1, 0 ) ); + + add( panel, new TableLayoutConstraints( 0, 0 ) ); + add( scroll, new TableLayoutConstraints( 0, 1 ) ); + } + + private void startupListeners() + { + tree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() + { + @Override + public void valueChanged( TreeSelectionEvent e ) + { + Object object = null; + TreePath path = tree.getSelectionPath(); + if( path != null ) + { + Object selection = path.getLastPathComponent(); + if( selection instanceof RiscoRelatorioNode ) + { + object = selection == null ? null : ((RiscoRelatorioNode) selection).getUserObject(); + + } + else if( selection instanceof MedidaRelatorioNode ) + { + object = selection == null ? null : ((MedidaRelatorioNode) selection).getUserObject(); + selectedMedida = (HsRelatorioPostoMedida) object; + } + } + setEnabled(); + firePropertyChange( SELECTION_CHANGED, null, object ); + } + } ); + buttonAdicionar.addActionListener( new ActionListener() + { + + @Override + public void actionPerformed( ActionEvent e ) + { + add(); + + } + + } ); + buttonRemover.addActionListener( new ActionListener() + { + + @Override + public void actionPerformed( ActionEvent e ) + { + rem(); + } + + } ); + } + + private HsRelatorioPostoRisco getSelectedRisco() + { + HsRelatorioPostoRisco result = null; + TreePath path = tree.getSelectionPath(); + if( path != null ) + { + Object selection = path.getLastPathComponent(); + if( selection instanceof RiscoRelatorioNode ) + { + result = selection == null ? null : (HsRelatorioPostoRisco) ((RiscoRelatorioNode) selection).getUserObject(); + } + } + return result; + } + + private HsRelatorioPostoMedida getSelectedMedida() + { + HsRelatorioPostoMedida result = null; + TreePath path = tree.getSelectionPath(); + if( path != null ) + { + Object selection = path.getLastPathComponent(); + if( selection instanceof MedidaRelatorioNode ) + { + result = selection == null ? null : (HsRelatorioPostoMedida) ((MedidaRelatorioNode) selection).getUserObject(); + } + } + return result; + } + + private void add() + { + try + { + DefaultMutableTreeNode allRiscos = getAllRiscos(); + TreeTools.removeAll( allRiscos, getRiscosTree() ); + TreeInserterDialog dialog = new TreeInserterDialog( "Adicionar Riscos", allRiscos ); + DefaultMutableTreeNode result = dialog.getResult(); + if( result != null ) + { + addResult( result ); + refresh(); + } + setEnabled(); + } + catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + private DefaultMutableTreeNode getAllRiscos() + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + if( posto != null ) + { + result = HigieneSegurancaLogic.getRiscosTree( posto.getToHsRelatorioArea().getToHsRelatorio().getToHsMarcacoesEstabelecimento().getToEstabelecimentos().getToEmpresas() ); + } + return result; + } + + private DefaultMutableTreeNode getRiscosTree() + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + for( int i = 0; i < root.getChildCount(); ++i ) + { + DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) root.getChildAt( i ); + HsRelatorioPostoRisco relPostoRisco = null; + if( childNode instanceof RiscoRelatorioNode ) + { + relPostoRisco = (HsRelatorioPostoRisco) ((RiscoRelatorioNode) childNode).getUserObject(); + } + HsRelatorioRisco relRisco = relPostoRisco == null ? null : relPostoRisco.getToHsRelatorioRisco(); + if( relRisco != null ) + { + HsRisco risco = HigieneSegurancaLogic.findHsRiscoFor( relRisco ); + if( risco != null ) + { + result.add( new NodeRisco( risco ) ); + } + } + } + return result; + } + + private void addResult( DefaultMutableTreeNode root ) + { + if( root != null ) + { + if( root instanceof NodeRisco ) + { + HsRisco risco = (HsRisco) ((NodeRisco)root).getUserObject(); + addRisco( risco ); + } + for( int i = 0; i < root.getChildCount(); ++i ) + { + addResult( (DefaultMutableTreeNode) root.getChildAt( i ) ); + } + } + } + + private void addRisco( HsRisco risco ) + { + if( posto != null ) + { + Integer order = 0; + List toPostos = risco.getHsPostoRiscoArray(); + if( !toPostos.isEmpty() ) + { + for (HsPostoRisco hsPostoRisco : toPostos) + { + order = Math.max(order, hsPostoRisco.getOrder() == null ? 0 : hsPostoRisco.getOrder() ); + } + } + HigieneSegurancaLogic.addRiscoToRelatorioPosto( risco, order+1, posto ); + } + } + + private boolean confirm( String message ) + { + return JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog( this, message, "Confirma"+ccedil+atilde+"o", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null ); + } + + private void rem() + { + for( TreePath path : tree.getSelectionPaths() ) + { + if( !rem(path) ) + { + break; + } + } + refresh(); + setEnabled(); + } + + + private String shortenString( String string ) + { + return string == null ? null : (string.length() <= 40 ? string : (string.substring(0,40) + "...")); + } + + + private boolean rem(TreePath path) + { + boolean outcome = false; + try + { + if( path != null ) + { + Object selection = path.getLastPathComponent(); + if( selection instanceof MedidaRelatorioNode ) + { + HsRelatorioPostoMedida rel = selection == null ? null : (HsRelatorioPostoMedida) ((MedidaRelatorioNode) selection).getUserObject(); + if( confirm("Tem a certeza que deseja remover o requisito '" + shortenString( rel.getToHsRelatorioMedida().toString() ) + "'?") ) + { + rel.getToHsRelatorioMedida().setDeletedDate( new Date() ); + rel.delete(); + outcome = true; + } + } + else if( selection instanceof RiscoRelatorioNode ) + { + HsRelatorioPostoRisco rel = (HsRelatorioPostoRisco) ((RiscoRelatorioNode)selection).getUserObject(); + if( confirm("Tem a certeza que deseja remover o risco '" + shortenString( rel.getToHsRelatorioRisco().toString() ) + "'?") ) + { + for( HsRelatorioMedida medida : rel.getToHsRelatorioRisco().getHsRelatorioMedidaArray() ) + { + while( true ) + { + List list = medida.getHsRelatorioPostoMedidaArray(); + HsRelatorioPostoMedida relMedida = list.isEmpty() ? null : list.get(0); + if( relMedida != null ) + { + relMedida.delete(); + } + else + { + break; + } + } + medida.setDeletedDate( new Date() ); + } + rel.getToHsRelatorioRisco().setDeletedDate( new Date() ); + outcome = true; + } + } + } + } + catch( Exception e ) + { + LeafDialog.error( e ); + } + return outcome; + } + + private void setEnabled() + { + boolean add = false; + boolean rem = false; + if( posto != null ) + { + if( posto.getToHsRelatorioArea() != null && posto.getToHsRelatorioArea().getToHsRelatorio() != null && posto.getToHsRelatorioArea().getToHsRelatorio().getIsSubmetido() == null ) + { + add = true; + rem = true; + } + } + buttonAdicionar.setEnabled( add ); + buttonRemover.setEnabled( rem && ( getSelectedMedida() != null || getSelectedRisco() != null ) ); + } + + public void refresh() + { + root.removeAllChildren(); + if( posto != null ) + { + List list = posto.getHsRelatorioPostoRiscoArray(); + Collections.sort( list ); + for( HsRelatorioPostoRisco rel : list ) + { + RiscoRelatorioNode node = new RiscoRelatorioNode( rel ); + HsRelatorioRisco risco = rel.getToHsRelatorioRisco(); + if( risco.getDeletedDate() == null ) + { + for( HsRelatorioMedida medida : risco.getHsRelatorioMedidaArray() ) + { + for( HsRelatorioPostoMedida medidaRel : medida.getHsRelatorioPostoMedidaArray() ) + { + node.add( new MedidaRelatorioNode( medidaRel ) ); + } + } + root.add( node ); + } + } + } + setEnabled(); + TreeTools.sort( root, new Comparator() + { + @Override + public int compare( DefaultMutableTreeNode o1, DefaultMutableTreeNode o2 ) + { + Integer result = null; + if( (o1 instanceof RiscoRelatorioNode) && o2 instanceof RiscoRelatorioNode ) + { + HsRelatorioPostoRisco risco1 = (HsRelatorioPostoRisco) o1.getUserObject(); + HsRelatorioPostoRisco risco2 = (HsRelatorioPostoRisco) o2.getUserObject(); + if( risco1 != null ) + { + return risco1.compareTo( risco2 == null ? null : risco2 ); + } + } + return result == null ? o1.toString().compareTo( o2.toString() ) : result; + } + }); + TreeTools.refreshTree( tree, root, false ); + if( selectedMedida != null ) + { + selectMedida(); + } + } + + private void selectMedida( ) + { + DefaultMutableTreeNode node = TreeTools.findNodeWithUserObject( selectedMedida, root ); + if( node != null ) + { + TreePath path = TreeTools.getPathFor( node ); + if( path != null ) + { + tree.setSelectionPath( path ); + } + } + else + { + selectedMedida = null; + } + } + + public void setPosto( HsRelatorioPosto posto ) + { + this.posto = posto; + this.selectedMedida = null; + refresh(); + setEnabled(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/GerirValoresRiscoPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/GerirValoresRiscoPanel.java new file mode 100644 index 00000000..306f7190 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/GerirValoresRiscoPanel.java @@ -0,0 +1,331 @@ +package siprp.higiene.relatorio; + +import static com.evolute.utils.strings.UnicodeLatin1Map.aacute; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.ButtonGroup; +import javax.swing.JComboBox; +import javax.swing.JFormattedTextField; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.event.CaretEvent; +import javax.swing.event.CaretListener; + +import leaf.ui.LeafButton; +import leaf.ui.LeafDialog; +import leaf.ui.LeafIconButton; +import siprp.database.cayenne.objects.HsRelatorioPostoRisco; +import siprp.database.cayenne.objects.HsRelatorioRiscoValorQualitativo; +import siprp.logic.HigieneSegurancaLogic; + +import com.evolute.utils.documents.IntegerDocument; + +public class GerirValoresRiscoPanel extends JPanel implements ActionListener, CaretListener +{ + + private static final long serialVersionUID = 1L; + + private static final String ICON_NAME_SAVE = "siprp/higiene/gestao/riscos/save.png"; + + private static final String ICON_NAME_REVERT = "siprp/higiene/gestao/riscos/revert.png"; + + public static final String VALUE_CHANGED = "VALUE_CHANGED"; + + private final JRadioButton radioValorQuantitativo = new JRadioButton(); + + private final JRadioButton radioValorQualitativo = new JRadioButton(); + + private final JFormattedTextField textSeveridade = new JFormattedTextField(); + + private final JFormattedTextField textProbabilidade = new JFormattedTextField(); + + private final JComboBox comboValorQualitativo = new JComboBox(); + + private final LeafButton buttonSave = LeafIconButton.createButton( ICON_NAME_SAVE ); + + private final LeafButton buttonRevert = LeafIconButton.createButton( ICON_NAME_REVERT ); + + private final ButtonGroup bg = new ButtonGroup(); + + private HsRelatorioPostoRisco valoresRisco = null; + + public GerirValoresRiscoPanel() + { + startupListeners(); + startupComponents(); + startupLayout(); + placeComponents(); + loadValoresQualitativos(); + } + + private void startupListeners() + { + radioValorQualitativo.addActionListener( this ); + radioValorQuantitativo.addActionListener( this ); + comboValorQualitativo.addActionListener( this ); + textProbabilidade.addCaretListener( this ); + textSeveridade.addCaretListener( this ); + buttonSave.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + save(); + } + } ); + buttonRevert.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + refresh(); + } + } ); + + } + + private void startupComponents() + { + textSeveridade.setPreferredSize( new Dimension( 30, 0 ) ); + textSeveridade.setDocument( new IntegerDocument( 1, false ) ); + textProbabilidade.setPreferredSize( new Dimension( 30, 0 ) ); + textProbabilidade.setDocument( new IntegerDocument( 1, false ) ); + buttonSave.setEnabled( false ); + buttonRevert.setEnabled( false ); + bg.add( radioValorQualitativo ); + bg.add( radioValorQuantitativo ); + } + + private void startupLayout() + { + TableLayout layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM + } ); + layout.setVGap( 5 ); + layout.setHGap( 5 ); + setLayout( layout ); + } + + private void placeComponents() + { + TableLayout layout = new TableLayout( new double[] { + TableLayout.FILL, TableLayout.MINIMUM, TableLayout.MINIMUM + }, new double[] { + TableLayout.MINIMUM + } ); + layout.setVGap( 5 ); + layout.setHGap( 5 ); + JPanel panel = new JPanel(); + panel.setLayout( layout ); + panel.add( buttonSave, new TableLayoutConstraints( 1, 0 ) ); + panel.add( buttonRevert, new TableLayoutConstraints( 2, 0 ) ); + + add( panel, new TableLayoutConstraints( 1, 0, 6, 0 ) ); + add( radioValorQuantitativo, new TableLayoutConstraints( 0, 1 ) ); + add( new JLabel( "Severidade" ), new TableLayoutConstraints( 1, 1 ) ); + add( textSeveridade, new TableLayoutConstraints( 2, 1 ) ); + add( new JLabel( "Probabilidade" ), new TableLayoutConstraints( 4, 1 ) ); + add( textProbabilidade, new TableLayoutConstraints( 5, 1 ) ); + add( radioValorQualitativo, new TableLayoutConstraints( 0, 2 ) ); + add( comboValorQualitativo, new TableLayoutConstraints( 1, 2, 5, 2 ) ); + } + + private void loadValoresQualitativos() + { + comboValorQualitativo.removeAllItems(); + for( HsRelatorioRiscoValorQualitativo valor : HigieneSegurancaLogic.getAllValoresQualitativos() ) + { + comboValorQualitativo.addItem( valor ); + } + } + + void refresh() + { + if( valoresRisco != null ) + { + boolean qualitativo = valoresRisco.getToHsRelatorioRiscoValorQualitativo() != null; + radioValorQuantitativo.setSelected( !qualitativo ); + radioValorQualitativo.setSelected( qualitativo ); + String severidade = (valoresRisco.getSeveridade() == null ? null : valoresRisco.getSeveridade() + ""); + String probabilidade = (valoresRisco.getProbabilidade() == null ? null : valoresRisco.getProbabilidade() + ""); + textSeveridade.setText( severidade ); + textProbabilidade.setText( probabilidade ); + if( valoresRisco.getToHsRelatorioRiscoValorQualitativo() != null ) + { + comboValorQualitativo.setSelectedItem( valoresRisco.getToHsRelatorioRiscoValorQualitativo() ); + } + } + else + { + bg.clearSelection(); + textSeveridade.setText( null ); + textProbabilidade.setText( null ); + } + } + + private void setEnabled() + { + if( isEnabled() ) + { + textProbabilidade.setEnabled( valoresRisco != null && radioValorQuantitativo.isSelected() ); + textSeveridade.setEnabled( valoresRisco != null && radioValorQuantitativo.isSelected() ); + radioValorQualitativo.setEnabled( valoresRisco != null ); + radioValorQuantitativo.setEnabled( valoresRisco != null ); + comboValorQualitativo.setEnabled( valoresRisco != null && radioValorQualitativo.isSelected() ); + if( valoresRisco != null ) + { + boolean changes = false; + boolean wasQual = valoresRisco.getToHsRelatorioRiscoValorQualitativo() != null; + boolean isQual = radioValorQualitativo.isSelected(); + if( !isQual ) + { + changes = wasQual; + if( !changes ) + { + boolean probChanged = false; + boolean sevChanged = false; + String prob = textProbabilidade.getText(); + String sev = textSeveridade.getText(); + if( prob == null ) + { + probChanged = valoresRisco.getProbabilidade() != null; + } + else + { + probChanged = !prob.equals( valoresRisco.getProbabilidade() == null ? "" : valoresRisco.getProbabilidade() + "" ); + } + if( sev == null ) + { + sevChanged = valoresRisco.getSeveridade() != null; + } + else + { + sevChanged = !sev.equals( valoresRisco.getSeveridade() == null ? "" : valoresRisco.getSeveridade() + "" ); + } + changes = probChanged || sevChanged; + } + } + else + { + changes = !wasQual; + if( !changes ) + { + changes = !comboValorQualitativo.getSelectedItem().equals( valoresRisco.getToHsRelatorioRiscoValorQualitativo() ); + } + } + buttonSave.setEnabled( changes ); + buttonRevert.setEnabled( changes ); + } + } + else + { + buttonRevert.setEnabled( false ); + buttonSave.setEnabled( false ); + radioValorQualitativo.setEnabled( false ); + radioValorQuantitativo.setEnabled( false ); + comboValorQualitativo.setEnabled( false ); + textProbabilidade.setEnabled( false ); + textSeveridade.setEnabled( false ); + } + } + + public void setRelatorioPostoRisco( HsRelatorioPostoRisco rel ) + { + this.valoresRisco = rel; + refresh(); + setEnabled(); + } + + private void error( boolean probabilidade ) + { + JOptionPane.showMessageDialog( this, "Valor inv" + aacute + "lido para " + (probabilidade ? "'Probabilidade'" : "'Severidade'") + ".", "Erro", JOptionPane.ERROR_MESSAGE, null ); + } + + private void save() + { + try + { + if( valoresRisco != null ) + { + if( radioValorQualitativo.isSelected() ) + { + valoresRisco.setToHsRelatorioRiscoValorQualitativo( (HsRelatorioRiscoValorQualitativo) comboValorQualitativo.getSelectedItem() ); + valoresRisco.setProbabilidade( null ); + valoresRisco.setSeveridade( null ); + } + else + { + valoresRisco.setToHsRelatorioRiscoValorQualitativo( null ); + Integer probabilidade = null; + Integer severidade = null; + boolean ok = true; + if( textProbabilidade.getText() != null && !textProbabilidade.getText().trim().equals( "" ) ) + { + try + { + probabilidade = new Integer( textProbabilidade.getText() ); + } catch( NumberFormatException e1 ) + { + ok = false; + } + if( !ok || !HigieneSegurancaLogic.isProbabilidadeValida( probabilidade ) ) + { + error( true ); + } + } + if( textSeveridade.getText() != null && !textSeveridade.getText().trim().equals( "" ) ) + { + if( ok ) + { + try + { + severidade = new Integer( textSeveridade.getText() ); + } catch( NumberFormatException e2 ) + { + ok = false; + } + if( !ok || !HigieneSegurancaLogic.isSeveridadeValida( severidade ) ) + { + error( false ); + } + } + } + boolean pvalid = HigieneSegurancaLogic.isProbabilidadeValida( probabilidade ); + boolean svalid = HigieneSegurancaLogic.isSeveridadeValida( severidade ); + + valoresRisco.setProbabilidade( pvalid && svalid ? probabilidade : null ); + valoresRisco.setSeveridade( pvalid && svalid ? severidade : null ); + } + valoresRisco.save(); + firePropertyChange( VALUE_CHANGED, null, valoresRisco ); + refresh(); + setEnabled(); + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + @Override + public void caretUpdate( CaretEvent e ) + { + setEnabled(); + } + + @Override + public void actionPerformed( ActionEvent e ) + { + setEnabled(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/PanelRelatorio.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/PanelRelatorio.java new file mode 100644 index 00000000..724e7217 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/PanelRelatorio.java @@ -0,0 +1,763 @@ +package siprp.higiene.relatorio; + +import static com.evolute.utils.strings.UnicodeLatin1Map.aacute; +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import static com.evolute.utils.strings.UnicodeLatin1Map.eacute; +import static com.evolute.utils.strings.UnicodeLatin1Map.iacute; +import static com.evolute.utils.strings.UnicodeLatin1Map.oacute; +import static com.evolute.utils.strings.UnicodeLatin1Map.otilde; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.EventObject; +import java.util.List; +import java.util.Vector; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JTabbedPane; +import javax.swing.JTextField; +import javax.swing.event.CaretEvent; +import javax.swing.event.CaretListener; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import leaf.ui.LeafButton; +import leaf.ui.LeafDialog; +import leaf.ui.LeafIconButton; +import leaf.ui.LeafTextAreaEditor; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsEmailEstabelecimento; +import siprp.database.cayenne.objects.HsRelatorio; +import siprp.database.cayenne.objects.MarcacoesEstabelecimento; +import siprp.database.cayenne.objects.MarcacoesTecnicosHst; +import siprp.higiene.gestao.equipamentos.AdicionarEquipamentosPanel; +import siprp.higiene.relatorio.print.RelatorioPDFCreator; +import siprp.logic.HigieneSegurancaLogic; +import siprp.medicina.processo.mail.MailDialog; +import siprp.medicina.processo.mail.MailSender; +import siprp.planoactuacao.print.PlanoActuacaoPDFCreator; + +import com.evolute.adt.Validator; +import com.evolute.utils.ui.calendar.JCalendarPanel; + +public class PanelRelatorio extends JPanel implements CaretListener, ChangeListener, ActionListener +{ + + private static final long serialVersionUID = 1L; + + private static final int MAX_NOME_ESTABELECIMENTO_ON_FILENAME = 10; + + private static final String DEFAULT_FUNCIONARIOS_TEXT = "A empresa supracitada possui ? funcionários, sendo que ? destes exercem actividades na zona de produtos frescos."; + + private static final String ICON_NAME_SAVE = "siprp/higiene/gestao/riscos/save.png"; + public static final String ICON_NAME_REVERT = "siprp/higiene/gestao/riscos/revert.png"; + public static final String ICON_NAME_SUBMIT = "siprp/higiene/relatorio/submit.png"; + public static final String ICON_NAME_PDF = "siprp/higiene/relatorio/adobe_reader.png"; + public static final String ICON_NAME_UNDO = "siprp/higiene/relatorio/revert.png"; + + private final JCalendarPanel dataRelatorio = new JCalendarPanel( null ); + + private final JRadioButton radioInicial = new JRadioButton( "Inicial" ); + private final JRadioButton radioPeriodica = new JRadioButton( "Peri" + oacute + "dica" ); + + private final JTextField fieldTecnico = new JTextField(); + + private final JTextField fieldTecnicoSuperior = new JTextField(); + + private final JPanel panelAcompanhantes = new JPanel(); + + private final JTextField fieldNome1 = new JTextField(); + private final JTextField fieldNome2 = new JTextField(); + + private final JTextField fieldFuncao1 = new JTextField(); + private final JTextField fieldFuncao2 = new JTextField(); + + private final LeafIconButton buttonSave = LeafIconButton.createButton( ICON_NAME_SAVE ); + private final LeafIconButton buttonRevertText = LeafIconButton.createButton( ICON_NAME_REVERT ); + private final LeafIconButton buttonSubmit = LeafIconButton.createButton( "Submeter", ICON_NAME_SUBMIT ); + private final LeafIconButton buttonPdfPlano = LeafIconButton.createButton( "Plano de actua" + ccedil + atilde + "o", ICON_NAME_PDF ); + private final LeafIconButton buttonPdfRelatorio = LeafIconButton.createButton( "Relat" + oacute + "rio", ICON_NAME_PDF ); + private final LeafButton buttonRevertPlano = LeafIconButton.createButton( "Recarregar", ICON_NAME_UNDO ); + + private final JTabbedPane tabsRelatorio = new JTabbedPane(); + + private final AdicionarEquipamentosPanel panelEquipamentos = new AdicionarEquipamentosPanel(); + + private final LeafTextAreaEditor panelFuncionarios = new LeafTextAreaEditor( new Validator() + { + @Override + public boolean isValid( String text ) + { + return !DEFAULT_FUNCIONARIOS_TEXT.equals( text ); + } + }); + + private final JTabbedPane tabsPlanoActuacao = new JTabbedPane(); + + private final PlanoActuacaoPanel panelPlano = new PlanoActuacaoPanel(); + + private final RelatorioLegislacaoPanel panelLegislacao = new RelatorioLegislacaoPanel(); + + private final RelatorioNormalizacaoPanel panelNormalizacao = new RelatorioNormalizacaoPanel(); + + ButtonGroup bg = new ButtonGroup(); + + private HsRelatorio relatorio = null; + + public PanelRelatorio() + { + setupListeners(); + startupComponents(); + startupLayout(); + placeComponents(); + } + + private void startupComponents() + { + dataRelatorio.setPreferredSize( new Dimension( 150, 0 ) ); + panelEquipamentos.setPreferredSize( new Dimension( 400, 0 ) ); + bg.add( radioInicial ); + bg.add( radioPeriodica ); + panelAcompanhantes.setBorder( BorderFactory.createTitledBorder( "Pessoas que acompanharam" ) ); + tabsRelatorio.addTab( "Funcion" + aacute + "rios", panelFuncionarios ); + tabsRelatorio.addTab( "Equipamentos de medi"+ccedil+atilde+"o", panelEquipamentos ); + tabsPlanoActuacao.addTab( "Plano de actua" + ccedil + atilde + "o", panelPlano ); + tabsPlanoActuacao.addTab( "Legisla" + ccedil + atilde + "o", panelLegislacao ); + tabsPlanoActuacao.addTab( "Normaliza" + ccedil + atilde + "o", panelNormalizacao ); + buttonSave.setToolTipText( "Guardar" ); + buttonRevertText.setToolTipText( "Reverter" ); + buttonRevertPlano.setToolTipText( "Carregar dados do estabelecimento" ); + } + + private void startupLayout() + { + TableLayout layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.PREFERRED + }, new double[] { + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL + } ); + layout.setVGap( 5 ); + layout.setHGap( 5 ); + setLayout( layout ); + + layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.FILL + }, new double[] { + TableLayout.MINIMUM, TableLayout.MINIMUM + } ); + layout.setVGap( 5 ); + layout.setHGap( 5 ); + panelAcompanhantes.setLayout( layout ); + } + + private void placeComponents() + { + panelAcompanhantes.add( new JLabel( "Nome" ), new TableLayoutConstraints( 0, 0 ) ); + panelAcompanhantes.add( fieldNome1, new TableLayoutConstraints( 1, 0 ) ); + panelAcompanhantes.add( new JLabel( "Fun" + ccedil + atilde + "o" ), new TableLayoutConstraints( 2, 0 ) ); + panelAcompanhantes.add( fieldFuncao1, new TableLayoutConstraints( 3, 0 ) ); + panelAcompanhantes.add( new JLabel( "Nome" ), new TableLayoutConstraints( 0, 1 ) ); + panelAcompanhantes.add( fieldNome2, new TableLayoutConstraints( 1, 1 ) ); + panelAcompanhantes.add( new JLabel( "Fun" + ccedil + atilde + "o" ), new TableLayoutConstraints( 2, 1 ) ); + panelAcompanhantes.add( fieldFuncao2, new TableLayoutConstraints( 3, 1 ) ); + + TableLayout layout = new TableLayout( new double[] { + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL, + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, + TableLayout.MINIMUM, TableLayout.MINIMUM + }, new double[] { + TableLayout.MINIMUM + } ); + layout.setVGap( 5 ); + layout.setHGap( 5 ); + JPanel panel = new JPanel(); + panel.setLayout( layout ); + + panel.add( buttonSave, new TableLayoutConstraints( 0, 0 ) ); + panel.add( buttonRevertText, new TableLayoutConstraints( 1, 0 ) ); + panel.add( buttonPdfRelatorio, new TableLayoutConstraints( 3, 0 ) ); + panel.add( buttonPdfPlano, new TableLayoutConstraints( 4, 0 ) ); + panel.add( buttonRevertPlano, new TableLayoutConstraints( 5, 0 ) ); + panel.add( buttonSubmit, new TableLayoutConstraints( 6, 0 ) ); + + add( panel, new TableLayoutConstraints( 0, 0, 7, 0 ) ); + add( new JLabel( "Data do relat" + oacute + "rio" ), new TableLayoutConstraints( 0, 1, 2, 1 ) ); + add( dataRelatorio, new TableLayoutConstraints( 3, 1 ) ); + JLabel labelAvaliacao = new JLabel( "Avalia" + ccedil + atilde + "o" ); + labelAvaliacao.setHorizontalAlignment( JLabel.RIGHT ); + add( labelAvaliacao , new TableLayoutConstraints( 4, 1 ) ); + add( radioInicial, new TableLayoutConstraints( 5, 1 ) ); + add( radioPeriodica, new TableLayoutConstraints( 6, 1 ) ); + add( new JLabel( "T" + eacute + "cnico de H.S." ), new TableLayoutConstraints( 0, 2, 2, 2 ) ); + add( fieldTecnico, new TableLayoutConstraints( 3, 2, 6, 2 ) ); + add( new JLabel( "T" + eacute + "cnico Superior de H.S." ), new TableLayoutConstraints( 0, 3, 2, 3 ) ); + add( fieldTecnicoSuperior, new TableLayoutConstraints( 3, 3, 6, 3 ) ); + add( tabsRelatorio, new TableLayoutConstraints( 7, 1, 7, 4 ) ); + add( panelAcompanhantes, new TableLayoutConstraints( 0, 4, 6, 4 ) ); + add( tabsPlanoActuacao, new TableLayoutConstraints( 0, 5, 7, 5 ) ); + } + + private void setupListeners() + { + fieldFuncao1.addCaretListener( this ); + fieldFuncao2.addCaretListener( this ); + fieldNome1.addCaretListener( this ); + fieldNome2.addCaretListener( this ); + dataRelatorio.addChangeListener( this ); + radioInicial.addActionListener( this ); + radioPeriodica.addActionListener( this ); + buttonSave.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + save(); + } + } ); + buttonRevertText.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + revert(); + } + } ); + buttonSubmit.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + if( isValidEmail() || JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog(null, "Emails n" + atilde + "o preenchidos para este estabelecimento!\nContinuar?", "Aviso", JOptionPane.YES_NO_OPTION ) ) + { + if( isValidPlano() && confirmSubmit() ) + { + submit(); + } + } + } + } ); + buttonPdfPlano.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + pdf(true); + } + } ); + buttonPdfRelatorio.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + pdf(false); + } + } ); + buttonRevertPlano.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + revert(true); + } + } ); + panelFuncionarios.addPropertyChangeListener( LeafTextAreaEditor.ACTION_SAVE, new PropertyChangeListener() + { + @Override + public void propertyChange( PropertyChangeEvent evt ) + { + try + { + String text = (String) evt.getNewValue(); + if( text != null && relatorio != null ) + { + text = text.trim(); + if( text.length() == 0 ) + { + text = null; + } + else if( text.equals( DEFAULT_FUNCIONARIOS_TEXT ) ) + { + text = null; + } + } + relatorio.setFuncionarios( text ); + relatorio.save(); + } + catch( Exception e ) + { + LeafDialog.error( e ); + } + } + } ); + } + + protected void revert( boolean ask ) + { + if( relatorio != null ) + { + try + { + setCursor( new Cursor( Cursor.WAIT_CURSOR ) ); + int ret = ask == false ? JOptionPane.YES_OPTION : JOptionPane.showConfirmDialog( this, "Todas as altera" + ccedil + otilde + "es ao plano de actua" + ccedil + atilde + "o ser" + atilde + "o perdidas\nTem a certeza?","Carregar dados do estabelecimento",JOptionPane.YES_NO_OPTION); + if( JOptionPane.YES_OPTION == ret ) + { + HigieneSegurancaLogic.reverterRelatorio(relatorio); + if( relatorio != null ) + { + try + { + relatorio.save(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + } + setRelatorio( relatorio, false ); + } + } + finally + { + setCursor( new Cursor( Cursor.DEFAULT_CURSOR ) ); + } + } + } + + private boolean isValidEmail() + { + boolean result = false; + List emails = relatorio.getToHsMarcacoesEstabelecimento().getToEstabelecimentos().getHsEmailEstabelecimento(); + result = emails != null && emails.size() > 0; + return result; + } + + private boolean isValidPlano() + { + boolean result = false; + result = panelPlano.isValidPlano(); + if( !result ) + { + JOptionPane.showMessageDialog( null, "Todos os riscos devem ser preenchidos antes da submiss"+ atilde + "o do plano de actua" + ccedil + atilde+ "o!", "Erro", JOptionPane.ERROR_MESSAGE, null ); + } + return result; + } + + private boolean confirmSubmit() + { + return JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog( null, "Ao submeter o Plano de Actua"+ccedil+atilde+"o n"+atilde+"o ser"+aacute+" mais poss"+iacute+"vel alter"+aacute+"-lo. Deseja continuar?" ); + } + + private void submit() + { + try + { + setCursor(new Cursor(Cursor.WAIT_CURSOR)); + if( relatorio != null ) + { + if( sendMail( relatorio ) ) + { + refresh(); + relatorio.setIsSubmetido( new Date() ); + relatorio.save(); + setRelatorio( relatorio, false ); + } + else + { + JOptionPane.showMessageDialog( this, "Erro ao enviar o email, o plano n"+atilde+"o ser"+aacute+" submetido." ); + } + } + } + catch( Exception e ) + { + LeafDialog.error(e); + refresh(); + } + finally + { + setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); + } + } + + private boolean confirmDelete( File file ) + { + boolean result = false; + result = JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog( this, "Ficheiro j" + aacute + " existente, deseja substituir?", "Aviso", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null ); + return result; + } + + private void pdf(boolean plano) + { + try + { + setCursor( new Cursor(Cursor.WAIT_CURSOR) ); + byte [] pdf = null; + if( plano ) + { + PlanoActuacaoPDFCreator creator = new PlanoActuacaoPDFCreator(); + pdf = creator.createPDF( relatorio.getId(), false ); + } + else + { + RelatorioPDFCreator creator = new RelatorioPDFCreator(); + pdf = creator.createPDF( relatorio.getId() ); + } + if( !printToFile( pdf ) ) + { + throw new Exception( "ERRO: NULL " + ( plano ? "p " : "r " ) + relatorio.getId() ); + } + } + catch( Exception e ) + { + LeafDialog.error( e ); + } + finally + { + setCursor( new Cursor(Cursor.DEFAULT_CURSOR) ); + } + } + + private boolean printToFile( byte [] pdf ) throws IOException + { + + if( pdf != null ) + { + JFileChooser fileChooser = new JFileChooser( ); + if( fileChooser.showSaveDialog( this ) == JFileChooser.APPROVE_OPTION ) + { + File file = fileChooser.getSelectedFile(); + String path = file.getAbsolutePath(); + if( !path.toUpperCase().endsWith( ".PDF" ) ) + { + path += ".pdf"; + file = new File( path ); + } + if( file != null ) + { + if( file.exists() && confirmDelete( file ) ) + { + file.delete(); + } + FileOutputStream a = new FileOutputStream(file); + a.write( pdf ); + a.close(); + } + } + } + return pdf != null; + } + + private JFrame getFrame( ) + { + Component comp = this; + JFrame frame = null; + while( comp != null ) + { + if( comp.getParent() instanceof RelatorioHigieneSegurancaWindow ) + { + frame = (RelatorioHigieneSegurancaWindow) comp.getParent(); + break; + } + comp = comp.getParent(); + } + return frame; + } + + private boolean sendMail( HsRelatorio relatorio ) throws Exception + { + boolean result = false; + List rels = relatorio.getToHsMarcacoesEstabelecimento().getToEstabelecimentos().getHsEmailEstabelecimento(); + String to = ""; + String bcc = ""; + for( HsEmailEstabelecimento rel : rels ) + { + if( to.isEmpty() ) + { + to += rel.getToHsEmail().getEmail(); + } + else + { + bcc += rel.getToHsEmail().getEmail() + ", "; + } + } + if(bcc.endsWith( ", " )) + { + bcc = bcc.substring( 0, bcc.length() - 2 ); + } + if( to.length() > 0 ) + { + String nomeEstabelecimento = relatorio.getToHsMarcacoesEstabelecimento().getToEstabelecimentos().getNome(); + MarcacoesTecnicosHst tecnico = relatorio.getToHsMarcacoesEstabelecimento().getToMarcacoesTecnicosHst(); + String nomeTecnico = tecnico == null ? "" : tecnico.getNome(); + Date dataVisita = relatorio.getToHsMarcacoesEstabelecimento().getData(); + String dataVisitaString = new SimpleDateFormat("dd/MM/yyyy").format( dataVisita ); + String subject = "Relat" + oacute + "rio da Avalia" + ccedil + atilde + "o de Riscos Laborais e Plano de Actua" + ccedil + atilde + "o de " + nomeEstabelecimento + " - auditoria de " + dataVisitaString; + String body = "

Exmos. Senhores" + + "
" + + "
" + + "
" + + "Junto enviamos o relat" + oacute + "rio de avalia" + ccedil + atilde + "o de riscos laborais e " + + "respectivo plano de actua" + ccedil + atilde + "o da auditoria realizada no dia " + + dataVisitaString + + " ao vosso estabelecimento de(o) " + + nomeEstabelecimento + + ". Aconselhamos que tenham em conta as n" + atilde + "o conformidades indicadas " + + "nestes documentos e que preencham o plano de actua" + ccedil + atilde + "o por forma a " + + "auxiliar-vos na planifica" + ccedil + atilde + "o das medidas correctivas e para poderem " + + "apresent" + aacute + "-los em caso de inspec" + ccedil + atilde + "o da ACT – Autoridade para as Condi" + ccedil + otilde + "es do Trabalho." + + "
" + + "
" + + "
" + + "Caso pretendam o nosso apoio ou necessitem de qualquer esclarecimento, contactem-nos, por favor, atrav" + eacute + "s do telefone (+351) 213 504 540." + + "
" + + "
" + + "
" + + "Com os melhores cumprimentos, " + + "
" + + "
" + + "
" + + nomeTecnico + + "
" + + "SIPRP - Sociedade Ib" + eacute + "rica de Preven" + ccedil + atilde + "o de Riscos Profissionais " + + "
" + + "Atrium Saldanha - Pra" + ccedil + "a Duque de Saldanha, 1 - 9º G - 1050-094 Lisboa " + + "
" + + "Telefone: (+351) 213 504 540 " + + "
" + + "Fax: (+351) 213 504 549 " + + "
" + + "E-mail: geral@siprp.pt " + + "
" + + "URL: www.siprp.com " + + "
" + + "
" + + "
" + + "Esta " + eacute + " uma mensagem gerada automaticamente pelo nosso sistema, por favor n" + atilde + "o responda.

"; + MailDialog md = new MailDialog( getFrame(), to, bcc, subject, body, getRelatoriosTemp(relatorio), MailSender.from ); + result = md.wasSent(); + } + return result; + } + + private String getShortNameForEstabelecimento( Estabelecimentos estabelecimento ) + { + String result = null; + String nome = estabelecimento.getNomePlain(); + if( nome != null ) + { + result = nome.trim(); + if( result.length() > MAX_NOME_ESTABELECIMENTO_ON_FILENAME ) + { + String [] tokens = result.split( " " ); + if( tokens != null && tokens.length > 2 ) + { + result = ""; + for ( String token : tokens ) + { + result += token == null ? "" : token; + } + } + } + } + return result; + } + + private Vector getRelatoriosTemp(HsRelatorio relatorio) throws Exception + { + Vector result = new Vector(); + byte[] relatorioPDF = new RelatorioPDFCreator().createPDF( relatorio.getId() ); + byte[] planoPDF = new PlanoActuacaoPDFCreator().createPDF( relatorio.getId(), false ); + if( relatorioPDF != null ) + { + String data = relatorio.getToHsMarcacoesEstabelecimento().getDataRelatorio() == null ? "" : HsRelatorio.DATE_FORMAT.format( relatorio.getData() ); + String estabelecimento = getShortNameForEstabelecimento(relatorio.getToHsMarcacoesEstabelecimento().getToEstabelecimentos()); + File relat = File.createTempFile("Relatorio - " + estabelecimento + " - " + data, ".pdf"); + if( relat != null ) + { + FileOutputStream fos = new FileOutputStream(relat); + fos.write(relatorioPDF); + fos.close(); + result.add( relat ); + } + } + if( planoPDF != null ) + { + String data = relatorio.getToHsMarcacoesEstabelecimento().getDataRelatorio() == null ? "" : HsRelatorio.DATE_FORMAT.format( relatorio.getData() ); + String estabelecimento = relatorio.getToHsMarcacoesEstabelecimento().getToEstabelecimentos().getNomePlain(); + File plan = File.createTempFile("Plano de actuacao - " + estabelecimento + " - " + data, ".pdf"); + if( plan != null ) + { + FileOutputStream fos = new FileOutputStream(plan); + fos.write(planoPDF); + fos.close(); + result.add( plan ); + } + } + return result; + } + + private void save() + { + try + { + if( relatorio != null ) + { + relatorio.setData( dataRelatorio.getDate() ); + relatorio.setAvaliacaoInicial( radioInicial.isSelected() ); + } + relatorio.setAcompanhante1( fieldNome1.getText() ); + relatorio.setAcompanhante2( fieldNome2.getText() ); + + relatorio.setFuncaoAcompanhante1(fieldFuncao1.getText()); + relatorio.setFuncaoAcompanhante2(fieldFuncao2.getText()); + relatorio.save(); + refresh(); + buttonRevertText.setEnabled( false ); + buttonSave.setEnabled( false ); + } catch( Exception e ) + { + LeafDialog.error(e); + } + } + + private void revert() + { + refresh(); + buttonRevertText.setEnabled( false ); + buttonSave.setEnabled( false ); + } + + private void refresh() + { + dataRelatorio.setDate( relatorio == null ? null : relatorio.getData() ); + if( relatorio == null || relatorio.getAvaliacaoInicial() == null ) + { + bg.clearSelection(); + } + else + { + radioInicial.setSelected( relatorio.getAvaliacaoInicial() ); + radioPeriodica.setSelected( !relatorio.getAvaliacaoInicial() ); + } + String tecnicoName = null; + if(relatorio != null) + { + MarcacoesEstabelecimento marcacao = relatorio.getToHsMarcacoesEstabelecimento(); + if( marcacao != null ) + { + MarcacoesTecnicosHst tecnico = marcacao.getToMarcacoesTecnicosHst(); + if( tecnico != null ) + { + tecnicoName = tecnico.getNome(); + } + } + } + fieldTecnico.setText( tecnicoName ); + String tecnicoSuperiorName = null; + if( relatorio != null ) + { + MarcacoesEstabelecimento marcacao = relatorio.getToHsMarcacoesEstabelecimento(); + if( marcacao != null ) + { + MarcacoesTecnicosHst tecnico = marcacao.getToMarcacoesTecnicosSuperioresHst(); + if( tecnico != null ) + { + tecnicoSuperiorName = tecnico.getNome(); + } + } + } + fieldTecnicoSuperior.setText( tecnicoSuperiorName ); + fieldNome1.setText( relatorio == null ? null : relatorio.getAcompanhante1() ); + fieldNome2.setText( relatorio == null ? null : relatorio.getAcompanhante2() ); + fieldFuncao1.setText( relatorio == null ? null : relatorio.getFuncaoAcompanhante1() ); + fieldFuncao2.setText( relatorio == null ? null : relatorio.getFuncaoAcompanhante2() ); + } + + private void setEnabled() + { + boolean enabled = relatorio != null && relatorio.getIsSubmetido() == null; + dataRelatorio.setEnabled( enabled ); + radioInicial.setEnabled( enabled );; + radioPeriodica.setEnabled( enabled ); + fieldTecnico.setEnabled( false ); + fieldTecnicoSuperior.setEnabled( false ); + fieldNome1.setEnabled( enabled ); + fieldNome2.setEnabled( enabled ); + fieldFuncao1.setEnabled( enabled ); + fieldFuncao2.setEnabled( enabled ); + buttonSubmit.setEnabled( enabled ); + buttonPdfPlano.setEnabled( relatorio != null ); + buttonPdfRelatorio.setEnabled( relatorio != null ); + buttonRevertPlano.setEnabled( enabled ); + panelFuncionarios.setEnabled( enabled ); + } + + public void setRelatorio( HsRelatorio relatorio,boolean create ) + { + this.relatorio = relatorio; + buttonSave.setEnabled( false ); + buttonRevertText.setEnabled( false ); + panelEquipamentos.setRelatorio( relatorio ); + panelPlano.setRelatorio( relatorio ); + panelLegislacao.setRelatorio( relatorio ); + panelNormalizacao.setRelatorio( relatorio ); + panelFuncionarios.setValue( relatorio == null ? null : ( relatorio.getFuncionarios() == null ? DEFAULT_FUNCIONARIOS_TEXT : relatorio.getFuncionarios() ) ); + if( create ) + { + this.revert(false); + } + refresh(); + setEnabled(); + } + + private void updated( EventObject e ) + { + Object source = e.getSource(); + if( source instanceof Component ) + { + if( ( (Component) source).isEnabled() ) + { + buttonSave.setEnabled( true ); + buttonRevertText.setEnabled( true ); + } + } + } + + @Override + public void caretUpdate( CaretEvent e ) + { + updated(e); + } + + @Override + public void stateChanged( ChangeEvent e ) + { + updated(e); + } + + @Override + public void actionPerformed( ActionEvent e ) + { + updated(e); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/PlanoActuacaoPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/PlanoActuacaoPanel.java new file mode 100644 index 00000000..4dd6390b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/PlanoActuacaoPanel.java @@ -0,0 +1,317 @@ +package siprp.higiene.relatorio; + +import static com.evolute.utils.strings.UnicodeLatin1Map.aacute; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.CardLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; + +import leaf.ui.LeafButton; +import leaf.ui.LeafIconButton; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsArea; +import siprp.database.cayenne.objects.HsPosto; +import siprp.database.cayenne.objects.HsPostoEstabelecimento; +import siprp.database.cayenne.objects.HsRelatorio; +import siprp.database.cayenne.objects.HsRelatorioArea; +import siprp.database.cayenne.objects.HsRelatorioPosto; +import siprp.database.cayenne.objects.HsRelatorioPostoMedida; +import siprp.database.cayenne.objects.HsRelatorioPostoRisco; +import siprp.database.cayenne.objects.MarcacoesEstabelecimento; +import siprp.logic.HigieneSegurancaLogic; + +import com.evolute.utils.error.ErrorLogger; + +public class PlanoActuacaoPanel extends JPanel +{ + + private static final long serialVersionUID = 1L; + + private static final String RISCO_PANEL = "RISCO_PANEL"; + + private static final String MEDIDA_PANEL = "MEDIDA_PANEL"; + + private static final String EMPTY_PANEL = "EMPTY_PANEL"; + + private final VerAreasRelatorioPanel areas = new VerAreasRelatorioPanel(); + + private final GerirMedidasRelatorioPanel riscos = new GerirMedidasRelatorioPanel(); + + private final GerirValoresRiscoPanel valoresRisco = new GerirValoresRiscoPanel(); + + private final GerirMedidaRelatorioPanel valoresMedida = new GerirMedidaRelatorioPanel(); + + private final LeafButton refreshAreasButton = LeafIconButton.createButton( "Actualizar nomes de " + aacute + "reas/postos", PanelRelatorio.ICON_NAME_UNDO ); + + private final JPanel emptyPanel = new JPanel(); + + private final JPanel valoresPanel = new JPanel(); + + private final CardLayout cards = new CardLayout(); + + private HsRelatorio relatorio = null; + + public PlanoActuacaoPanel() + { + startupListeners(); + startupComponents(); + startupLayout(); + placeComponents(); + cards.show( valoresPanel, EMPTY_PANEL ); + } + + private void startupListeners() + { + areas.addPropertyChangeListener( VerAreasRelatorioPanel.SELECTION_CHANGED, new PropertyChangeListener() + { + @Override + public void propertyChange( PropertyChangeEvent evt ) + { + if( evt.getNewValue() instanceof HsRelatorioPosto ) + { + riscos.setPosto( (HsRelatorioPosto) evt.getNewValue() ); + } + else + { + riscos.setPosto( null ); + } + } + } ); + riscos.addPropertyChangeListener( GerirMedidasRelatorioPanel.SELECTION_CHANGED, new PropertyChangeListener() + { + @Override + public void propertyChange( PropertyChangeEvent evt ) + { + if( evt.getNewValue() instanceof HsRelatorioPostoRisco ) + { + cards.show( valoresPanel, RISCO_PANEL ); + valoresRisco.setRelatorioPostoRisco( (HsRelatorioPostoRisco) evt.getNewValue() ); + } + else if( evt.getNewValue() instanceof HsRelatorioPostoMedida ) + { + cards.show( valoresPanel, MEDIDA_PANEL ); + valoresMedida.setMedida( (HsRelatorioPostoMedida) evt.getNewValue() ); + } + else + { + cards.show( valoresPanel, EMPTY_PANEL ); + valoresRisco.setRelatorioPostoRisco( null ); + valoresMedida.setMedida( null ); + } + } + } ); + valoresRisco.addPropertyChangeListener( GerirValoresRiscoPanel.VALUE_CHANGED, new PropertyChangeListener() + { + @Override + public void propertyChange( PropertyChangeEvent evt ) + { + riscos.repaint(); + areas.repaint(); + } + } ); + valoresMedida.addPropertyChangeListener( GerirMedidaRelatorioPanel.MEDIDA_CHANGED, new PropertyChangeListener() + { + @Override + public void propertyChange( PropertyChangeEvent evt ) + { + riscos.refresh(); + } + } ); + refreshAreasButton.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + try + { + refreshAreas(); + } + catch ( Exception ex ) + { + ErrorLogger.logException( ex ); + } + } + } ); + } + + private void refreshAreas() throws Exception + { + if( relatorio != null ) + { + MarcacoesEstabelecimento marcacao = relatorio.getToHsMarcacoesEstabelecimento(); + if( marcacao != null ) + { + Estabelecimentos estabelecimento = marcacao.getToEstabelecimentos(); + if( estabelecimento != null ) + { + for( HsPostoEstabelecimento postoEstabelecimento : estabelecimento.getHsPostoEstabelecimentoArray() ) + { + refreshPostoEstabelecimento( postoEstabelecimento ); + } + areas.refresh(); + } + } + } + } + + private void refreshPostoEstabelecimento( HsPostoEstabelecimento postoEstabelecimento ) throws Exception + { + if( postoEstabelecimento != null ) + { + HsPosto posto = postoEstabelecimento.getToHsPosto(); + if( posto != null ) + { + HsArea area = posto.getToHsArea(); + HsRelatorioArea relatorioArea = null; + if( area != null ) + { + relatorioArea = getAreaInRelatorio( relatorio, area.getId() ); + if( relatorioArea == null ) + { + relatorioArea = new HsRelatorioArea(); + } + HigieneSegurancaLogic.updateRelatorioAreaFromHsArea( relatorio, relatorioArea, area ); + } + HsRelatorioPosto relatorioPosto = getPostoInRelatorio( relatorio, posto.getId() ); + if( relatorioPosto == null ) + { + relatorioPosto = HigieneSegurancaLogic.createRelatorioPostoFromHsPosto( relatorio , relatorioArea, posto ); + } + else + { + HigieneSegurancaLogic.updateRelatorioPostoFromHsPosto( relatorioPosto, relatorioArea, posto ); + } + } + } + } + + private HsRelatorioArea getAreaInRelatorio( HsRelatorio relatorio, Integer softRefId ) + { + HsRelatorioArea result = null; + if( relatorio != null && softRefId != null ) + { + for( HsRelatorioArea relatArea : relatorio.getHsRelatorioArea() ) + { + if( softRefId.equals( relatArea.getHsAreaId() ) ) + { + result = relatArea; + break; + } + } + } + return result; + } + + private HsRelatorioPosto getPostoInRelatorio( HsRelatorio relatorio, Integer softRefId ) + { + HsRelatorioPosto result = null; + if( relatorio != null && softRefId != null ) + { + for( HsRelatorioArea relatArea : relatorio.getHsRelatorioArea() ) + { + for( HsRelatorioPosto relatPosto : relatArea.getHsRelatorioPostoArray() ) + { + if( softRefId.equals( relatPosto.getHsPostoId() ) ) + { + result = relatPosto; + break; + } + } + } + } + return result; + } + + private void startupComponents() + { + riscos.setBorder( BorderFactory.createTitledBorder( "Riscos" ) ); + areas.setBorder( BorderFactory.createTitledBorder( "Postos de trabalho" ) ); + areas.setPreferredSize( new Dimension(250,0) ); + } + + private void startupLayout() + { + TableLayout layout = new TableLayout( + new double[]{ TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.FILL, TableLayout.FILL }, + new double[]{ TableLayout.MINIMUM, TableLayout.FILL } + ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + setLayout( layout ); + valoresPanel.setLayout(cards); + } + + private void placeComponents() + { + valoresPanel.add( valoresRisco, RISCO_PANEL ); + valoresPanel.add( valoresMedida, MEDIDA_PANEL ); + valoresPanel.add( emptyPanel, EMPTY_PANEL ); + add( refreshAreasButton, new TableLayoutConstraints( 0, 0, 1, 0 ) ); + add( areas, new TableLayoutConstraints( 0, 1, 1, 1 ) ); + add( riscos, new TableLayoutConstraints( 2, 1 ) ); + add( valoresPanel, new TableLayoutConstraints( 3, 1 ) ); + } + + private void setEnabled() + { + refreshAreasButton.setEnabled(relatorio != null && relatorio.getIsSubmetido() == null ); + } + + public void setRelatorio( HsRelatorio relatorio ) + { + this.relatorio = relatorio; + areas.setRelatorio( relatorio ); + riscos.setPosto( null ); + valoresRisco.setRelatorioPostoRisco( null ); + valoresRisco.setEnabled( relatorio != null && relatorio.getIsSubmetido() == null ); + valoresMedida.setMedida( null ); + valoresMedida.setEnabled( relatorio != null && relatorio.getIsSubmetido() == null ); + setEnabled( ); + } + + public boolean isValidPlano() + { + boolean result = true; + if( relatorio != null ) + { + for( HsRelatorioArea area : relatorio.getHsRelatorioArea() ) + { + for( HsRelatorioPosto posto : area.getHsRelatorioPostoArray() ) + { + for( HsRelatorioPostoRisco relRisco : posto.getHsRelatorioPostoRiscoArray() ) + { + boolean preenchido = relRisco.getToHsRelatorioRiscoValorQualitativo() != null; + if( !preenchido ) + { + preenchido = HigieneSegurancaLogic.isProbabilidadeValida( relRisco.getProbabilidade() ) && HigieneSegurancaLogic.isSeveridadeValida( relRisco.getSeveridade() ); + } + if( !preenchido ) + { + result = false; + break; + } + } + if( !result ) + { + break; + } + } + if( !result ) + { + break; + } + } + } + return result; + } + +} + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/RelatorioHigieneSegurancaWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/RelatorioHigieneSegurancaWindow.java new file mode 100644 index 00000000..e84bf102 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/RelatorioHigieneSegurancaWindow.java @@ -0,0 +1,242 @@ +package siprp.higiene.relatorio; + +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import static com.evolute.utils.strings.UnicodeLatin1Map.oacute; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Color; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.Date; +import java.util.List; + +import javax.swing.BorderFactory; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.SwingUtilities; + +import leaf.ui.LeafDialog; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsRelatorio; +import siprp.database.cayenne.objects.MarcacoesEstabelecimento; +import siprp.logic.HigieneSegurancaLogic; + +import com.evolute.utils.tracker.TrackableWindow; + +public class RelatorioHigieneSegurancaWindow extends JFrame implements TrackableWindow +{ + private static final long serialVersionUID = 1L; + + public static final Color COLOR_RISCO_OK = new Color(200,255,200); + + public static final Color COLOR_RISCO_OK_SEL = new Color(140,240,140); + + public static final Color COLOR_MEDIDA_OK = new Color(200,230,255); + + public static final Color COLOR_MEDIDA_OK_SEL = new Color(160,190,255); + + public static final String TITLE = "Relat" + oacute + "rios de Higiene e Seguran" + ccedil + "a no Trabalho"; + + public static final Dimension SIZE = new Dimension( 1024, 700 ); + + private final JComboBox comboEmpresas = new JComboBox(); + + private final JComboBox comboEstabelecimentos = new JComboBox(); + + private final JComboBox comboVisitas = new JComboBox(); + + private final PanelRelatorio panelRelatorio = new PanelRelatorio(); + + public RelatorioHigieneSegurancaWindow() + { + setupListeners(); + startupComponents(); + startupLayout(); + placeComponents(); + setTitle( TITLE ); + setSize( SIZE ); + setLocationRelativeTo( null ); + } + + private void startupComponents() + { + panelRelatorio.setBorder( BorderFactory.createTitledBorder( "Relat" + oacute + "rio" ) ); + for( Empresas empresa : HigieneSegurancaLogic.getAllEmpresas() ) + { + comboEmpresas.addItem( empresa ); + } + } + + private void startupLayout() + { + TableLayout layout = new TableLayout( + new double[]{ TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.FILL }, + new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL } + ); + layout.setVGap( 5 ); + layout.setHGap( 5 ); + getContentPane().setLayout( layout ); + } + + private void placeComponents() + { + Container pane = getContentPane(); + pane.add( new JLabel("Empresa"), new TableLayoutConstraints( 0, 0 ) ); + pane.add( comboEmpresas, new TableLayoutConstraints( 1, 0, 3, 0 ) ); + pane.add( new JLabel("Estabelecimento"), new TableLayoutConstraints( 0, 1 ) ); + pane.add( comboEstabelecimentos, new TableLayoutConstraints( 1, 1 ) ); + pane.add( new JLabel("Visita"), new TableLayoutConstraints( 2, 1 ) ); + pane.add( comboVisitas, new TableLayoutConstraints( 3, 1 ) ); + pane.add( panelRelatorio, new TableLayoutConstraints(0,2,3,2)); + } + + private void setupListeners() + { + comboEmpresas.addItemListener( new ItemListener() + { + @Override + public void itemStateChanged( ItemEvent e ) + { + if( e.getStateChange() == ItemEvent.SELECTED ) + { + fillEstabelecimentos( (Empresas) e.getItem() ); + } + } + } ); + comboEstabelecimentos.addItemListener( new ItemListener() + { + @Override + public void itemStateChanged( ItemEvent e ) + { + if( e.getStateChange() == ItemEvent.SELECTED ) + { + fillVisitas( (Estabelecimentos) e.getItem() ); + } + } + } ); + comboVisitas.addItemListener( new ItemListener() + { + @Override + public void itemStateChanged( ItemEvent e ) + { + if( e.getStateChange() == ItemEvent.SELECTED ) + { + fillRelatorio( (MarcacoesEstabelecimento) e.getItem() ); + } + } + } ); + + } + + private void fillEstabelecimentos( Empresas empresa ) + { + comboEstabelecimentos.removeAllItems(); + if( empresa != null ) + { + for( Estabelecimentos estabelecimento : empresa.getEstabelecimentosArray() ) + { + comboEstabelecimentos.addItem( estabelecimento ); + } + } + } + + private void fillVisitas( Estabelecimentos estabelecimento ) + { + comboVisitas.removeAllItems(); + if( estabelecimento != null ) + { + for( MarcacoesEstabelecimento visita : estabelecimento.getMarcacoesEstabelecimentoArray() ) + { + if( "y".equals( visita.getRealizada() ) ) + { + comboVisitas.addItem( visita ); + } + } + } + } + + private void fillRelatorio( MarcacoesEstabelecimento visita ) + { + try + { + setCursor( new Cursor( Cursor.WAIT_CURSOR ) ); + boolean carregarDadosEstabelecimento = false; + panelRelatorio.setRelatorio( null, carregarDadosEstabelecimento ); + if( visita != null ) + { + HsRelatorio relatorio = null; + List relatorios = visita.getHsRelatorioArray(); + Date data = null; + for( HsRelatorio current : relatorios ) + { + boolean newest = data == null ? true : (data.before( current.getData() ) ); + if( newest ) + { + data = current.getData(); + relatorio = current; + } + } + if( relatorio == null ) + { + relatorio = new HsRelatorio(); + relatorio.setData( new Date() ); + relatorio.setToHsMarcacoesEstabelecimento( visita ); + relatorio.save(); + carregarDadosEstabelecimento = true; + } + panelRelatorio.setRelatorio( relatorio, carregarDadosEstabelecimento );; + } + } catch( Exception e ) + { + LeafDialog.error(e); + } + finally + { + setCursor( new Cursor( Cursor.DEFAULT_CURSOR ) ); + } + } + + @Override + public void open() + { + setVisible( true ); + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable() + { + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + @Override + public boolean closeIfPossible() + { + close(); + return true; + } + + @Override + public void refresh() + { + + } + + public static void main( String[] args ) + { + RelatorioHigieneSegurancaWindow window = new RelatorioHigieneSegurancaWindow(); + window.setVisible( true ); + window.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/RelatorioLegislacaoPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/RelatorioLegislacaoPanel.java new file mode 100644 index 00000000..99497eaf --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/RelatorioLegislacaoPanel.java @@ -0,0 +1,111 @@ +package siprp.higiene.relatorio; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Collections; +import java.util.List; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JPanel; + +import leaf.ui.SimpleTable; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsRelatorio; +import siprp.database.cayenne.objects.HsRelatorioLegislacao; +import siprp.database.cayenne.objects.MarcacoesEstabelecimento; +import siprp.logic.HigieneSegurancaLogic; + +import com.evolute.utils.error.ErrorLogger; +import com.evolute.utils.tables.ColumnizedObjectArray; + +public class RelatorioLegislacaoPanel extends JPanel +{ + + private static final long serialVersionUID = 1L; + + private final JButton revert = new JButton("Reverter"); + + private HsRelatorio relatorio = null; + + private final SimpleTable table = new SimpleTable( "Categoria", "Legisla" + ccedil + atilde + "o" ); + + public RelatorioLegislacaoPanel() + { + startupComponents(); + setupLayout(); + placeComponents(); + } + + private void startupComponents() + { + table.getTable().fixColumnWidth(0,200); + revert.addActionListener( new ActionListener() + { + + @Override + public void actionPerformed( ActionEvent e ) + { + if( relatorio != null ) + { + MarcacoesEstabelecimento marcacao = relatorio.getToHsMarcacoesEstabelecimento(); + if( marcacao != null ) + { + Estabelecimentos estabelecimento = marcacao.getToEstabelecimentos(); + if( estabelecimento != null ) + { + try + { + HigieneSegurancaLogic.reverterLegislacao( relatorio, estabelecimento ); + } catch( Exception e1 ) + { + ErrorLogger.logException( e1 ); + } + } + } + refresh(); + } + } + } ); + } + + private void setupLayout() + { + TableLayout layout = new TableLayout( new double[]{ TableLayout.MINIMUM, TableLayout.FILL }, new double[]{ TableLayout.MINIMUM, TableLayout.FILL } ); + this.setLayout( layout ); + } + + private void placeComponents() + { + this.add( table, new TableLayoutConstraints( 0, 1,1,1 ) ); + this.add( revert, new TableLayoutConstraints( 0, 0 ) ); + } + + public void setRelatorio( HsRelatorio relatorio ) + { + this.relatorio = relatorio; + refresh(); + } + + private void refresh() + { + table.clear(); + if( relatorio != null ) + { + List legislacoes = relatorio.getHsRelatorioLegislacaoArray(); + Collections.sort( legislacoes ); + Vector rows = new Vector(); + for( HsRelatorioLegislacao legislacao : legislacoes ) + { + rows.add( new ColumnizedObjectArray( new Object[]{ legislacao, legislacao.getCategoria(), legislacao.getDescricao() }, true ) ); + } + table.setRows( rows ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/RelatorioNormalizacaoPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/RelatorioNormalizacaoPanel.java new file mode 100644 index 00000000..dedcf0e4 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/RelatorioNormalizacaoPanel.java @@ -0,0 +1,113 @@ +package siprp.higiene.relatorio; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import static com.evolute.utils.strings.UnicodeLatin1Map.oacute; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Collections; +import java.util.List; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JPanel; + +import leaf.ui.SimpleTable; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsRelatorio; +import siprp.database.cayenne.objects.HsRelatorioNormalizacao; +import siprp.database.cayenne.objects.MarcacoesEstabelecimento; +import siprp.logic.HigieneSegurancaLogic; + +import com.evolute.utils.error.ErrorLogger; +import com.evolute.utils.tables.ColumnizedObjectArray; + +public class RelatorioNormalizacaoPanel extends JPanel +{ + + private static final long serialVersionUID = 1L; + + private HsRelatorio relatorio = null; + + private final JButton revert = new JButton("Reverter"); + + private final SimpleTable table = new SimpleTable( "C" + oacute + "digo", "Normaliza" + ccedil + atilde + "o", "" ); + + public RelatorioNormalizacaoPanel() + { + startupComponents(); + setupLayout(); + placeComponents(); + } + + private void startupComponents() + { + table.getTable().fixColumnWidth(0,50); + table.getTable().fixColumnWidth(2,100); + revert.addActionListener( new ActionListener() + { + + @Override + public void actionPerformed( ActionEvent e ) + { + if( relatorio != null ) + { + MarcacoesEstabelecimento marcacao = relatorio.getToHsMarcacoesEstabelecimento(); + if( marcacao != null ) + { + Estabelecimentos estabelecimento = marcacao.getToEstabelecimentos(); + if( estabelecimento != null ) + { + try + { + HigieneSegurancaLogic.reverterNormalizacao( relatorio, estabelecimento ); + } catch( Exception e1 ) + { + ErrorLogger.logException( e1 ); + } + } + } + refresh(); + } + } + } ); + } + + private void setupLayout() + { + TableLayout layout = new TableLayout( new double[]{ TableLayout.MINIMUM, TableLayout.FILL }, new double[]{ TableLayout.MINIMUM, TableLayout.FILL } ); + this.setLayout( layout ); + } + + private void placeComponents() + { + this.add( table, new TableLayoutConstraints( 0, 1,1,1 ) ); + this.add( revert, new TableLayoutConstraints( 0, 0 ) ); + } + + public void setRelatorio( HsRelatorio relatorio ) + { + this.relatorio = relatorio; + refresh(); + } + + private void refresh() + { + table.clear(); + if( relatorio != null ) + { + List normalizacoes = relatorio.getHsRelatorioNormalizacaoArray(); + Collections.sort( normalizacoes ); + Vector rows = new Vector(); + for( HsRelatorioNormalizacao normalizacao : normalizacoes ) + { + rows.add( new ColumnizedObjectArray( new Object[]{ normalizacao, normalizacao.getCodigo(), normalizacao.getDescricao(), normalizacao.getPortuguesa() ? "Portuguesa" : "Internacional" }, true ) ); + } + table.setRows( rows ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/VerAreasRelatorioPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/VerAreasRelatorioPanel.java new file mode 100644 index 00000000..63b8f654 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/VerAreasRelatorioPanel.java @@ -0,0 +1,156 @@ +package siprp.higiene.relatorio; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Color; +import java.awt.Component; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +import leaf.ui.LeafTree; +import siprp.database.cayenne.objects.HsRelatorio; +import siprp.database.cayenne.objects.HsRelatorioPosto; +import siprp.database.cayenne.objects.HsRelatorioPostoRisco; +import siprp.logic.HigieneSegurancaLogic; +import siprp.logic.node.PostoRelatorioNode; + +import com.evolute.utils.ui.trees.TreeTools; + +public class VerAreasRelatorioPanel extends JPanel +{ + + private static final long serialVersionUID = 1L; + + public static final String SELECTION_CHANGED = "SELECTION_CHANGED"; + + private final DefaultMutableTreeNode root = new DefaultMutableTreeNode(); + + private final DefaultTreeModel model = new DefaultTreeModel( root ); + + public final LeafTree tree = new LeafTree( model ); + + private final JScrollPane scroll = new JScrollPane( tree ); + + private HsRelatorio relatorio = null; + + public VerAreasRelatorioPanel() + { + startupComponents(); + setupLayout(); + placeComponents(); + startupListeners(); + } + + private void startupComponents() + { + tree.setRootVisible( false ); + tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); + tree.setCellRenderer(new DefaultTreeCellRenderer() + { + + private static final long serialVersionUID = 1L; + + public Component getTreeCellRendererComponent(JTree pTree, Object pValue, boolean pIsSelected, boolean pIsExpanded, boolean pIsLeaf, int pRow, boolean pHasFocus) + { + super.getTreeCellRendererComponent(pTree, pValue, pIsSelected, pIsExpanded, pIsLeaf, pRow, pHasFocus); + boolean highlight= false; + Color highColor = null; + Color lowColor = null; + if( pValue instanceof PostoRelatorioNode ) + { + Object userObject = ((PostoRelatorioNode)pValue).getUserObject(); + if( userObject instanceof HsRelatorioPosto ) + { + HsRelatorioPosto posto = (HsRelatorioPosto) userObject; + boolean allOk = true; + for( HsRelatorioPostoRisco rel : posto.getHsRelatorioPostoRiscoArray() ) + { + allOk &= HigieneSegurancaLogic.isRelatorioRiscoPreenchido( rel ); + } + highColor = RelatorioHigieneSegurancaWindow.COLOR_RISCO_OK_SEL; + lowColor = RelatorioHigieneSegurancaWindow.COLOR_RISCO_OK; + highlight = allOk; + } + } + if( highlight ) + { + setOpaque( true ); + setBackground( pIsSelected ? highColor : lowColor ); + } + else + { + setOpaque( false ); + } + return(this); + } + } ); + } + + private void setupLayout() + { + TableLayout layout = new TableLayout( + new double[]{ TableLayout.FILL }, + new double[]{ TableLayout.MINIMUM, TableLayout.FILL } + ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + setLayout( layout ); + } + + private void placeComponents() + { + JPanel panel = new JPanel(); + TableLayout layout = new TableLayout( + new double[]{ TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM }, + new double[]{ TableLayout.MINIMUM } + ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + panel.setLayout( layout ); + + add( panel, new TableLayoutConstraints( 0, 0 ) ); + add( scroll, new TableLayoutConstraints( 0, 1 ) ); + } + + private void startupListeners() + { + tree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener(){ + @Override + public void valueChanged( TreeSelectionEvent e ) + { + TreePath path = tree.getSelectionPath(); + Object object = path == null ? null : path.getLastPathComponent(); + HsRelatorioPosto posto = object == null ? null : ( (object instanceof PostoRelatorioNode) ? (HsRelatorioPosto) ((PostoRelatorioNode) object).getUserObject() : null); + firePropertyChange( SELECTION_CHANGED, null, posto ); + } + } ); + } + + public void refresh() + { + root.removeAllChildren(); + if( relatorio != null ) + { + TreeTools.merge( root, HigieneSegurancaLogic.getAreasRelatorioTree( relatorio ) ); + } + TreeTools.refreshTree( tree, root, false ); + } + + + public void setRelatorio( HsRelatorio relatorio ) + { + this.relatorio = relatorio; + refresh(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/adobe_reader.png b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/adobe_reader.png new file mode 100644 index 00000000..613bda10 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/adobe_reader.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/AreaToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/AreaToPrint.java new file mode 100644 index 00000000..2a335d22 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/AreaToPrint.java @@ -0,0 +1,59 @@ +package siprp.higiene.relatorio.print; + +import java.util.Vector; + +import org.jdom.Element; + +public class AreaToPrint + implements PrintableInterface, Comparable +{ + protected String designacao; + protected Vector postos; + protected Integer ordem; + protected boolean temGenerico; + + public AreaToPrint( String designacao, Vector postos, Integer ordem, boolean temGenerico ) + { + super(); + this.designacao = designacao; + this.postos = postos; + this.ordem = ordem; + this.temGenerico = temGenerico; + } + + @Override + public Element toJdomElement() throws Exception + { + Element areaElement = new Element( "area" ); + Element designacaoElement = new Element( "designacao" ); + designacaoElement.setText( designacao ); + areaElement.addContent( designacaoElement ); + for( PostoToPrint posto : postos ) + { + areaElement.addContent( posto.toJdomElement() ); + } + return areaElement; + } + + @Override + public int compareTo(Object o) + { + if( o instanceof AreaToPrint ) + { + if( temGenerico && !( ( AreaToPrint ) o ).temGenerico ) + { + return -1; + } + else if( !temGenerico && ( ( AreaToPrint ) o ).temGenerico ) + { + return 1; + } + if( ordem != null ) + { + return ( ( ( AreaToPrint ) o ).ordem == null ) ? -1 : ordem.compareTo( ( ( AreaToPrint ) o ).ordem ); + } + } + return 0; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/DBConstants.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/DBConstants.java new file mode 100644 index 00000000..06e1a1fa --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/DBConstants.java @@ -0,0 +1,17 @@ +package siprp.higiene.relatorio.print; + +public interface DBConstants +{ + +// public static final String LOCAL_URL = "jdbc:postgresql://localhost:5436/siprp_local_3"; +//// public static final String LOCAL_URL = "jdbc:postgresql://storage/siprp_local"; +// public static final String LOCAL_USER = "postgres"; +//// public static final String LOCAL_PASSWORD = "Typein"; +// public static final String LOCAL_PASSWORD = null; + + public static final String LOCAL_URL = "jdbc:postgresql://www.evolute.pt:5436/siprp_local_3"; + public static final String LOCAL_USER = "postgres"; + public static final String LOCAL_PASSWORD = "Typein"; + + public static final String LOCAL_DBMANAGER = "LOCAL DBMANAGER"; +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/DataToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/DataToPrint.java new file mode 100644 index 00000000..b921677b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/DataToPrint.java @@ -0,0 +1,66 @@ +package siprp.higiene.relatorio.print; + +import java.util.Calendar; +import java.util.Date; + +import org.jdom.Element; + +import com.evolute.utils.date.DateUtils; + +public class DataToPrint + implements PrintableInterface +{ + protected String tag; + protected Date data; + + public DataToPrint( String tag, Date data ) + { + super(); + this.tag = tag; + this.data = data; + } + + @Override + public Element toJdomElement() throws Exception + { + Element dataElement = new Element( tag ); + Calendar cal = Calendar.getInstance(); + cal.setTime( data ); + int ano = cal.get( Calendar.YEAR ); + int mes = cal.get( Calendar.MONTH ); + int dia = cal.get( Calendar.DAY_OF_MONTH ); + Element anoElement = new Element( "ano" ); + anoElement.setText( "" + ano ); + dataElement.addContent( anoElement ); + Element mesElement = new Element( "mes" ); + mesElement.setText( "" + ( mes + 1 ) ); + dataElement.addContent( mesElement ); + Element mesExtensoElement = new Element( "mes-extenso" ); + mesExtensoElement.setText( DateUtils.MONTHS_FULL_PT[ mes ] ); + dataElement.addContent( mesExtensoElement ); + Element diaElement = new Element( "dia" ); + diaElement.setText( "" + dia ); + dataElement.addContent( diaElement ); + return dataElement; + } + + public String getTag() + { + return tag; + } + + public void setTag( String tag ) + { + this.tag = tag; + } + + public Date getData() + { + return data; + } + + public void setData( Date data ) + { + this.data = data; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/EmpresaToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/EmpresaToPrint.java new file mode 100644 index 00000000..3786ebd9 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/EmpresaToPrint.java @@ -0,0 +1,76 @@ +package siprp.higiene.relatorio.print; + +import org.jdom.Element; + +public class EmpresaToPrint + implements PrintableInterface +{ + protected String designacaoSocial; + protected String logotipo; + protected String estabelecimento; + protected String actividade; + protected String nomeAcompanhante; + protected String funcaoAcompanhante; + protected String nomeAcompanhante2; + protected String funcaoAcompanhante2; + protected String morada; + + public EmpresaToPrint( String designacaoSocial, String logotipo, + String estabelecimento, String actividade, String nomeAcompanhante, + String funcaoAcompanhante, String nomeAcompanhante2, + String funcaoAcompanhante2, String morada ) + { + super(); + this.designacaoSocial = designacaoSocial; + this.logotipo = logotipo; + this.estabelecimento = estabelecimento; + this.actividade = actividade; + this.nomeAcompanhante = nomeAcompanhante; + this.funcaoAcompanhante = funcaoAcompanhante; + this.nomeAcompanhante2 = nomeAcompanhante2; + this.funcaoAcompanhante2 = funcaoAcompanhante2; + this.morada = morada; + } + + + @Override + public Element toJdomElement() throws Exception + { + Element empresaElement = new Element( "empresa" ); + Element designacaoSocialElement = new Element( "designacao-social" ); + designacaoSocialElement.setText( designacaoSocial ); + empresaElement.addContent( designacaoSocialElement ); + Element logotipoElement = new Element( "logotipo" ); + logotipoElement.setText( logotipo ); + empresaElement.addContent( logotipoElement ); + Element estabelecimentoElement = new Element( "estabelecimento" ); + estabelecimentoElement.setText( estabelecimento ); + empresaElement.addContent( estabelecimentoElement ); + Element actividadeElement = new Element( "actividade" ); + actividadeElement.setText( actividade ); + empresaElement.addContent( actividadeElement ); + Element nomeAcompanhanteElement = new Element( "nome-acompanhante" ); + nomeAcompanhanteElement.setText( nomeAcompanhante ); + empresaElement.addContent( nomeAcompanhanteElement ); + Element funcaoAcompanhanteElement = new Element( "funcao-acompanhante" ); + funcaoAcompanhanteElement.setText( funcaoAcompanhante ); + empresaElement.addContent( funcaoAcompanhanteElement ); + if( nomeAcompanhante2 != null && nomeAcompanhante2.trim().length() > 0 ) + { + Element nomeAcompanhante2Element = new Element( "nome-acompanhante2" ); + nomeAcompanhante2Element.setText( nomeAcompanhante2 ); + empresaElement.addContent( nomeAcompanhante2Element ); + Element funcaoAcompanhante2Element = new Element( "funcao-acompanhante2" ); + funcaoAcompanhante2Element.setText( funcaoAcompanhante2 ); + empresaElement.addContent( funcaoAcompanhante2Element ); + } + if( morada != null ) + { + Element moradaElement = new Element( "morada" ); + moradaElement.setText( morada ); + empresaElement.addContent( moradaElement ); + } + return empresaElement; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/EquipamentoToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/EquipamentoToPrint.java new file mode 100644 index 00000000..bd2785b4 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/EquipamentoToPrint.java @@ -0,0 +1,27 @@ +package siprp.higiene.relatorio.print; + +import org.jdom.Element; + +public class EquipamentoToPrint + implements PrintableInterface +{ + protected String tipo; + protected String marca; + protected String modelo; + + public EquipamentoToPrint( String tipo, String marca, String modelo ) + { + super(); + this.tipo = tipo; + this.marca = marca; + this.modelo = modelo; + } + + @Override + public Element toJdomElement() throws Exception + { + Element equipamentoElement = new Element( "equipamento" ); + equipamentoElement.setText( tipo + " (" + marca + " " + modelo + ")" ); + return equipamentoElement; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/EquipamentosToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/EquipamentosToPrint.java new file mode 100644 index 00000000..7323db41 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/EquipamentosToPrint.java @@ -0,0 +1,27 @@ +package siprp.higiene.relatorio.print; + +import org.jdom.Element; + +public class EquipamentosToPrint + implements PrintableInterface +{ + protected EquipamentoToPrint equipamentos[]; + + public EquipamentosToPrint( EquipamentoToPrint[] equipamentos ) + { + super(); + this.equipamentos = equipamentos; + } + + @Override + public Element toJdomElement() + throws Exception + { + Element equipamentosElement = new Element( "equipamentos" ); + for( EquipamentoToPrint equipamento : equipamentos ) + { + equipamentosElement.addContent( equipamento.toJdomElement() ); + } + return equipamentosElement; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/LegislacaoAplicavelToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/LegislacaoAplicavelToPrint.java new file mode 100644 index 00000000..3861186d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/LegislacaoAplicavelToPrint.java @@ -0,0 +1,53 @@ +package siprp.higiene.relatorio.print; + +import java.util.Vector; + +import org.jdom.Element; + +public class LegislacaoAplicavelToPrint + implements PrintableInterface +{ + protected Vector diplomasGerais; + protected String[] nomesGruposEspecificos; + protected Vector[] diplomasEspecificos; + + public LegislacaoAplicavelToPrint( Vector diplomasGerais, + String[] nomesGruposEspecificos, Vector[] diplomasEspecificos ) + { + super(); + this.diplomasGerais = diplomasGerais; + this.nomesGruposEspecificos = nomesGruposEspecificos; + this.diplomasEspecificos = diplomasEspecificos; + } + + @Override + public Element toJdomElement() throws Exception + { + Element legislacaoAplicavelElement = new Element( "legislacao-aplicavel" ); + Element legislacaoGeralElement = new Element( "legislacao-geral" ); + for( String diploma : diplomasGerais ) + { + Element diplomaElement = new Element( "diploma" ); + diplomaElement.setText( diploma ); + legislacaoGeralElement.addContent( diplomaElement ); + } + legislacaoAplicavelElement.addContent( legislacaoGeralElement ); + + for( int e = 0; e < nomesGruposEspecificos.length; e++ ) + { + Element legislacaoEspecificaElement = new Element( "legislacao-especifica" ); + Element designacaoElement = new Element( "designacao" ); + designacaoElement.setText( nomesGruposEspecificos[ e ] ); + legislacaoEspecificaElement.addContent( designacaoElement ); + for( String diploma : diplomasEspecificos[ e ] ) + { + Element diplomaElement = new Element( "diploma" ); + diplomaElement.setText( diploma ); + legislacaoEspecificaElement.addContent( diplomaElement ); + } + legislacaoAplicavelElement.addContent( legislacaoEspecificaElement ); + } + return legislacaoAplicavelElement; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/MedidaToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/MedidaToPrint.java new file mode 100644 index 00000000..374aecd6 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/MedidaToPrint.java @@ -0,0 +1,30 @@ +package siprp.higiene.relatorio.print; + +import org.jdom.Element; + +public class MedidaToPrint + implements PrintableInterface +{ + protected String requisitosLegais; + protected String descricao; + + public MedidaToPrint( String requisitosLegais, String descricao ) + { + super(); + this.requisitosLegais = requisitosLegais; + this.descricao = descricao; + } + + @Override + public Element toJdomElement() throws Exception + { + Element medidaElement = new Element( "medida" ); + Element requisitosLegaisElement = new Element( "requisitos-legais" ); + requisitosLegaisElement.setText( requisitosLegais ); + medidaElement.addContent( requisitosLegaisElement ); + Element descricaoElement = new Element( "descricao" ); + descricaoElement.setText( descricao ); + medidaElement.addContent( descricaoElement ); + return medidaElement; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/NormalizacaoToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/NormalizacaoToPrint.java new file mode 100644 index 00000000..c3746d1d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/NormalizacaoToPrint.java @@ -0,0 +1,43 @@ +package siprp.higiene.relatorio.print; + +import java.util.Vector; + +import org.jdom.Element; + +public class NormalizacaoToPrint + implements PrintableInterface +{ + protected Vector normasPortuguesas; + protected Vector normasInternacionais; + + public NormalizacaoToPrint( Vector normasPortuguesas, Vector normasInternacionais ) + { + super(); + this.normasPortuguesas = normasPortuguesas; + this.normasInternacionais = normasInternacionais; + } + + @Override + public Element toJdomElement() throws Exception + { + Element normalizacaoElement = new Element( "normalizacao-aplicavel" ); + Element portuguesaElement = new Element( "normalizacao-portuguesa" ); + addNormas( portuguesaElement, normasPortuguesas ); + normalizacaoElement.addContent( portuguesaElement ); + Element internacionalElement = new Element( "normalizacao-internacional" ); + addNormas( internacionalElement, normasInternacionais ); + normalizacaoElement.addContent( internacionalElement ); + return normalizacaoElement; + } + + protected void addNormas( Element element, Vector normas ) + { + for( String norma : normas ) + { + Element normaElement = new Element( "norma" ); + normaElement.setText( norma ); + element.addContent( normaElement ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/PostoToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/PostoToPrint.java new file mode 100644 index 00000000..f8762d9a --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/PostoToPrint.java @@ -0,0 +1,41 @@ +package siprp.higiene.relatorio.print; + +import java.util.Vector; + +import org.jdom.Element; + + +public class PostoToPrint + implements PrintableInterface +{ + protected String designacao; + protected Vector riscos; + protected boolean generico; + + public PostoToPrint( String designacao, Vector riscos, boolean generico ) + { + this.designacao = designacao; + this.riscos = riscos; + this.generico = generico; + } + + @Override + public Element toJdomElement() + throws Exception + { + Element postoElement = new Element( "posto" ); + Element designacaoElement = new Element( "designacao" ); + designacaoElement.setText( designacao ); + postoElement.addContent( designacaoElement ); + for( RiscoToPrint risco : riscos ) + { + postoElement.addContent( risco.toJdomElement() ); + } + return postoElement; + } + + public boolean isGenerico() + { + return generico; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/PrintableInterface.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/PrintableInterface.java new file mode 100644 index 00000000..3e21c8a4 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/PrintableInterface.java @@ -0,0 +1,8 @@ +package siprp.higiene.relatorio.print; + +import org.jdom.Element; + +public interface PrintableInterface +{ + public Element toJdomElement() throws Exception; +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioDBInit.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioDBInit.java new file mode 100644 index 00000000..b06320cd --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioDBInit.java @@ -0,0 +1,29 @@ +package siprp.higiene.relatorio.print; + +import com.evolute.utils.Singleton; +import com.evolute.utils.db.keyretrievers.PostgresqlAutoKeyRetriever; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.strings.UnicodeChecker; + +public class RelatorioDBInit +{ + public static void initDB() + throws Exception + { +// if( web ) +// { +// String url = DBConstants.LOCAL_URL; +// String user = DBConstants.LOCAL_USER; +// String pwd = DBConstants.LOCAL_PASSWORD; +// DBManager localManager = new JDBCManager( url, user, pwd, 10, 8, 8, null ); +// Singleton.setInstance( DBConstants.LOCAL_DBMANAGER, localManager ); +// } +// else +// { + Singleton.setInstance( DBConstants.LOCAL_DBMANAGER, Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ) ); +// } + + Insert.setDefaultKeyRetriever( PostgresqlAutoKeyRetriever.RETRIEVER ); + UnicodeChecker.setUseDoubleSlash( true ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioPDFCreator.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioPDFCreator.java new file mode 100644 index 00000000..231a382e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioPDFCreator.java @@ -0,0 +1,55 @@ +package siprp.higiene.relatorio.print; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; + +import org.jdom.Document; +import org.jdom.output.Format; +import org.jdom.output.XMLOutputter; + +import siprp.Main; +import siprp.util.fop.PDFCreator; + +import com.evolute.utils.xml.XSLTransformer; + + +public class RelatorioPDFCreator +{ + + public byte[] createPDF( Integer relatorioId ) throws Exception + { + RelatorioToPrint relatorio = RelatorioPrintDataProvider.getProvider().getRelatorioToPrint( relatorioId ); + Document foDoc = new Document( relatorio.toJdomElement() ); + XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat()); + ByteArrayOutputStream foBaos = new ByteArrayOutputStream(); +// FileOutputStream fos = new FileOutputStream("/home/jneto/a.xml"); + outputter.output( foDoc, foBaos ); +// outputter.output( foDoc, fos ); + +// System.out.println( new String( foBaos.toByteArray() ) ); + byte fo[] = + applyTemplate( + getClass().getClassLoader().getResourceAsStream( + "siprp/higiene/relatorio/print/relatorio.xsl" ), + new ByteArrayInputStream( foBaos.toByteArray() ) ); +// System.out.println( new String( fo ) ); + + + //FIXME: FOP COPIADO + PDFCreator.setUserConfig(Main.fopConfigFile); + PDFCreator pdfCreator = PDFCreator.getPDFCreator(); + + + byte pdf[] = pdfCreator.createPdfFromFo( fo ); + return pdf; + } + + public byte[] applyTemplate( InputStream xsl, InputStream dataStream ) throws Exception + { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + XSLTransformer.getXSLTransformer().transform( dataStream, xsl, baos ); + return baos.toByteArray(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioPrintDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioPrintDataProvider.java new file mode 100644 index 00000000..f7815973 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioPrintDataProvider.java @@ -0,0 +1,607 @@ +package siprp.higiene.relatorio.print; + +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.Vector; + +import siprp.planoactuacao.db.DBConstants; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.data.Mappable; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.BlobUpdate; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; + + +public class RelatorioPrintDataProvider +{ + private static final Object LOCK = new Object(); + protected static final Object UNCONTROLLED = "Incontrolado"; + protected static final Object CONTROLLED = "Controlado"; + protected static final Object INDETERMINATE = "Indeterminado"; + private static RelatorioPrintDataProvider instance = null; + + protected final Executer EXECUTER; + + public RelatorioPrintDataProvider() + throws Exception + { + if( Singleton.getInstance( DBConstants.LOCAL_DBMANAGER ) == null ) + { + RelatorioDBInit.initDB(); + } + DBManager LOCAL_DBMANAGER = ( DBManager ) Singleton.getInstance( DBConstants.LOCAL_DBMANAGER ); + EXECUTER = LOCAL_DBMANAGER.getSharedExecuter( this ); + } + + public static RelatorioPrintDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new RelatorioPrintDataProvider(); + } + } + return instance; + } + + public boolean empresaUsaPlanoAlargadoPorPlanoId( Integer planoId ) + throws Exception + { + try + { + Select select = + new Select2( + new String[]{ "hs_relatorio", "marcacoes_estabelecimento", "estabelecimentos", "empresas" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "hs_relatorio.marcacao_id" ).isEqual( new Field( "marcacoes_estabelecimento.id" ) ), + new Field( "marcacoes_estabelecimento.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ), + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) + }, + new String[]{ "imprimir_tabela_alargada" }, + new Field( "hs_relatorio.id" ).isEqual( planoId ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + + return ( ( Boolean ) array.get( 0, 0 ) ).booleanValue(); + } + catch( Exception ex ) + { + return true; + } + } + + + public RelatorioToPrint getRelatorioToPrint( Integer id ) + throws Exception + { + Virtual2DArray array; + + Select select = + new Select2( + new String[]{ "hs_relatorio", "marcacoes_estabelecimento", "estabelecimentos", "empresas" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "hs_relatorio.marcacao_id" ).isEqual( new Field( "marcacoes_estabelecimento.id" ) ), + new Field( "marcacoes_estabelecimento.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ), + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) + }, + new String[]{ "empresas.id", "empresas.designacao_social", "empresas.actividade", + "estabelecimentos.id", "estabelecimentos.nome", + "hs_relatorio.data", "marcacoes_estabelecimento.data", + "hs_relatorio.acompanhante1", "hs_relatorio.funcao_acompanhante1", + "hs_relatorio.acompanhante2", "hs_relatorio.funcao_acompanhante2", + "hs_relatorio.funcionarios", "estabelecimentos.morada", + "hs_relatorio.avaliacao_inicial"}, + new Field( "hs_relatorio.id" ).isEqual( id ), + null, + null, + null, + null ); + array = EXECUTER.executeQuery( select ); + Integer empresaId = ( Integer ) array.get( 0, 0 ); + String nomeEmpresa = ( String ) array.get( 0, 1 ); + String actividadeEmpresa = ( String ) array.get( 0, 2 ); + Integer estabelecimentoId = ( Integer ) array.get( 0, 3 ); + String nomeEstabelecimento = ( String ) array.get( 0, 4 ); + Integer logoId = getLogotipoIdForEmpresaId( empresaId ); + Date dataRelatorio = ( Date ) array.get( 0, 5 ); + Date dataVisita = ( Date ) array.get( 0, 6 ); + Date dataProximaVisita = getDataProximaVisita( estabelecimentoId, dataVisita ); + String nomeAcompanhante = ( String ) array.get( 0, 7 ); + String funcaoAcompanhante = ( String ) array.get( 0, 8 ); + String nomeAcompanhante2 = ( String ) array.get( 0, 9 ); + String funcaoAcompanhante2 = ( String ) array.get( 0, 10 ); + String textoFuncionarios = ( String ) array.get( 0, 11 ); + String morada = ( String ) array.get( 0, 12 ); + String tipoAvaliacao = ( array.get( 0, 13 ) != null && ( ( Boolean ) array.get( 0, 13 ) ).booleanValue() ) ? "INICIAL" : "PERI\u00d3DICA"; + EmpresaToPrint empresa = new EmpresaToPrint( nomeEmpresa, + "http://www.evolute.pt:13080/SIPRPImages/image?id=" + logoId, + nomeEstabelecimento, actividadeEmpresa, + nomeAcompanhante, funcaoAcompanhante, nomeAcompanhante2, funcaoAcompanhante2, morada ); + RelatorioToPrint plano = + new RelatorioToPrint( + empresa, + dataRelatorio != null ? new DataToPrint( "data-relatorio", dataRelatorio ) : null, + dataVisita != null ? new DataToPrint( "data-hs", dataVisita ) : null, + tipoAvaliacao, + dataProximaVisita != null ? new DataToPrint( "data-proxima-hs", dataProximaVisita ) : null, + textoFuncionarios, + getTecnicoHS( id ), + getTecnicoSuperiorHS( id ), + getLegislacaoAplicavel( id ), + getNormalizacaoAplicavel( id ), + getEquipamento( id ), + getAreasToPrint( id ) ); + return plano; + } + + public Date getDataProximaVisita( Integer estabelecimentoId, Date dataVisita ) + throws Exception + { + Select select = + new Select2( + new String[]{ "marcacoes_estabelecimento" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "MIN( marcacoes_estabelecimento.data )" }, + new Field( "marcacoes_estabelecimento.estabelecimento_id" ).isEqual( estabelecimentoId ).and( + new Field( "marcacoes_estabelecimento.data" ).isGreater( dataVisita ) ).and( + new Field( "marcacoes_estabelecimento.estado" ).isEqual( 0 ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 ) + { + return null; + } + else + { + return ( Date ) array.get( 0, 0 ); + } + } + + public Integer getLogotipoIdForEmpresaId( Integer empresaId ) + throws Exception + { + Select select = + new Select2( + new String[]{ "empresas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "empresa_logo_id" }, + new Field( "id" ).isEqual( empresaId ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + return array.columnLength() > 0 ? ( Integer ) array.get( 0, 0 ) : null; + } + + public TecnicoHSToPrint getTecnicoHS( Integer relatorioId ) + throws Exception + { + Select select = + new Select2( + new String[]{ "hs_relatorio", "marcacoes_estabelecimento", "marcacoes_tecnicos_hst" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "hs_relatorio.marcacao_id" ).isEqual( new Field( "marcacoes_estabelecimento.id" ) ), + new Field( "marcacoes_estabelecimento.tecnico_hst" ).isEqual( new Field( "marcacoes_tecnicos_hst.id" ) ), + }, + new String[]{ + "marcacoes_tecnicos_hst.id", + "marcacoes_tecnicos_hst.nome", + "marcacoes_tecnicos_hst.cap", + "marcacoes_tecnicos_hst.formacao", + "marcacoes_tecnicos_hst.assinatura",}, + new Field( "hs_relatorio.id" ).isEqual( relatorioId ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 ) + { + return null; + } + else + { + Integer id = ( Integer ) array.get( 0, 0 ); + String nome = ( String ) array.get( 0, 1 ); + String cap = ( String ) array.get( 0, 2 ); + String formacao = ( String ) array.get( 0, 3 ); + Integer assinatura = ( Integer ) array.get( 0, 4 ); + return new TecnicoHSToPrint( id, nome, cap, formacao, "http://www.evolute.pt:13080/SIPRPImages/image?id=" + assinatura, false ); + } + } + + public TecnicoHSToPrint getTecnicoSuperiorHS( Integer relatorioId ) + throws Exception + { + Select select = + new Select2( + new String[]{ "hs_relatorio", "marcacoes_estabelecimento", "marcacoes_tecnicos_hst" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "hs_relatorio.marcacao_id" ).isEqual( new Field( "marcacoes_estabelecimento.id" ) ), + new Field( "marcacoes_estabelecimento.tecnico_superior_hst" ).isEqual( new Field( "marcacoes_tecnicos_hst.id" ) ), + }, + new String[]{ + "marcacoes_tecnicos_hst.id", + "marcacoes_tecnicos_hst.nome", + "marcacoes_tecnicos_hst.cap", + "marcacoes_tecnicos_hst.formacao", + "marcacoes_tecnicos_hst.assinatura",}, + new Field( "hs_relatorio.id" ).isEqual( relatorioId ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 ) + { + return null; + } + else + { + Integer id = ( Integer ) array.get( 0, 0 ); + String nome = ( String ) array.get( 0, 1 ); + String cap = ( String ) array.get( 0, 2 ); + String formacao = ( String ) array.get( 0, 3 ); + Integer assinatura = ( Integer ) array.get( 0, 4 ); + return new TecnicoHSToPrint( id, nome, cap, formacao, "http://www.evolute.pt:13080/SIPRPImages/image?id=" + assinatura, true ); + } + } + + public LegislacaoAplicavelToPrint getLegislacaoAplicavel( Integer relatorioId ) + throws Exception + { + Select select = + new Select2( + new String[]{ "hs_relatorio_legislacao" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "hs_relatorio_legislacao.categoria", "hs_relatorio_legislacao.descricao", + "COALESCE(hs_relatorio_legislacao.categoria,'A')"}, + new Field( "hs_relatorio_legislacao.hs_relatorio_id" ).isEqual( relatorioId ), + new String[]{ "COALESCE(hs_relatorio_legislacao.categoria,'A')", "ordem" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Vector diplomasGerais = new Vector(); + Vector nomes = new Vector(); + Vector> diplomas = new Vector>(); + String last = null; + for( int n = 0; n < array.columnLength(); n++ ) + { + String categoria = ( String ) array.get( n, 0 ); + String descricao = ( String ) array.get( n, 1 ); + if( categoria == null || categoria.trim().length() == 0 ) + { + diplomasGerais.add( descricao ); + } + else + { + if( !categoria.equals( last ) ) + { + nomes.add( categoria ); + diplomas.add( new Vector() ); + } + last = categoria; + diplomas.lastElement().add( descricao ); + } + } + LegislacaoAplicavelToPrint legislacao = + new LegislacaoAplicavelToPrint( diplomasGerais, nomes.toArray( new String[ nomes.size() ] ), + diplomas.toArray( new Vector[ diplomas.size() ] )); + return legislacao; + } + + public NormalizacaoToPrint getNormalizacaoAplicavel( Integer relatorioId ) + throws Exception + { + Select select = + new Select2( + new String[]{ "hs_relatorio_normalizacao" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "hs_relatorio_normalizacao.portuguesa", "hs_relatorio_normalizacao.descricao" }, + new Field( "hs_relatorio_normalizacao.hs_relatorio_id" ).isEqual( relatorioId ), + new String[]{ "hs_relatorio_normalizacao.portuguesa", "hs_relatorio_normalizacao.descricao" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Vector portuguesas = new Vector(); + Vector internacionais = new Vector(); + for( int n = 0; n < array.columnLength(); n++ ) + { + Boolean portuguesa = ( Boolean ) array.get( n, 0 ); + String descricao = ( String ) array.get( n, 1 ); + if( portuguesa ) + { + portuguesas.add( descricao ); + } + else + { + internacionais.add( descricao ); + } + } + return new NormalizacaoToPrint( portuguesas, internacionais ); + } + + public EquipamentosToPrint getEquipamento( Integer relatorioId ) + throws Exception + { + Select select = + new Select2( + new String[]{ "hs_relatorio_equipamento" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "hs_relatorio_equipamento.tipo", "hs_relatorio_equipamento.marca", + "hs_relatorio_equipamento.modelo" }, + new Field( "hs_relatorio_equipamento.hs_relatorio_id" ).isEqual( relatorioId ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + EquipamentoToPrint equipamentos[] = new EquipamentoToPrint[ array.columnLength() ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + String tipo = ( String ) array.get( n, 0 ); + String marca = ( String ) array.get( n, 1 ); + String modelo = ( String ) array.get( n, 2 ); + equipamentos[ n ] = new EquipamentoToPrint( tipo, marca, modelo ); + } + return new EquipamentosToPrint( equipamentos ); + } + + public Vector getAreasToPrint( Integer relatorioId ) + throws Exception + { + Virtual2DArray array; + Vector areas = new Vector(); + + Select select = + new Select2( + new String[]{ "hs_relatorio_area" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "description", "ordem" }, + new Field( "relatorio_id" ).isEqual( relatorioId ).and( + new Field( "deleted_date" ).isEqual( null ) ), + new String[]{ "id" }, + null, + null, + null ); + array = EXECUTER.executeQuery( select ); + + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer areaId = ( Integer ) array.get( n, 0 ); + String areaDescricao = ( String ) array.get( n, 1 ); + Integer ordem = ( Integer ) array.get( n, 2 ); + Vector postos = getPostosToPrintByAreaId( areaId ); + if( postos.size() > 0 ) + { + boolean generico = false; + for( PostoToPrint posto : postos ) + { + generico |= posto.isGenerico(); + } + areas.add( new AreaToPrint( areaDescricao, postos, ordem, generico ) ); + } + } + Collections.sort( areas ); + return areas; + } + + public Vector getPostosToPrintByAreaId( Integer areaId ) + throws Exception + { + Vector postos = new Vector(); + Virtual2DArray array; + Select select = + new Select2( + new String[]{ "hs_relatorio_posto" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "hs_relatorio_posto.id", "hs_relatorio_posto.description", "coalesce(hs_relatorio_posto.is_principal,'FALSE')" }, + new Field( "hs_relatorio_posto.area_id" ).isEqual( areaId ), + new String[]{ "coalesce(hs_relatorio_posto.is_principal,'FALSE') DESC", "hs_relatorio_posto.id" }, + null, + null, + null ); + array = EXECUTER.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String descricao = ( String ) array.get( n, 1 ); + Boolean generico = ( Boolean ) array.get( n, 2 ); + postos.add( new PostoToPrint( descricao, getRiscosToPrintByPostoId( id ), generico ) ); + } + return postos; + } + + public Vector getRiscosToPrintByPostoId( Integer postoId ) + throws Exception + { + Virtual2DArray array; + Vector riscos = new Vector(); + Select select = + new Select2( + new String[]{ "hs_relatorio_risco", "hs_relatorio_posto_risco", "hs_relatorio_risco_valor_qualitativo" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_LEFT_OUTER }, + new Expression[]{ + new Field( "hs_relatorio_risco.id" ).isEqual( new Field( "hs_relatorio_posto_risco.risco_id" ) ), + new Field( "hs_relatorio_posto_risco.valor_qualitativo_id" ).isEqual( new Field( "hs_relatorio_risco_valor_qualitativo.id" ) ) + }, + new String[]{ "hs_relatorio_risco.id", + "hs_relatorio_risco.description", + "hs_relatorio_posto_risco.probabilidade", + "hs_relatorio_posto_risco.severidade", + "hs_relatorio_risco_valor_qualitativo.description" }, + new Field( "hs_relatorio_posto_risco.posto_id" ).isEqual( postoId ).and( + new Field( "hs_relatorio_risco.deleted_date" ).isEqual( null ).and( + new Field("hs_relatorio_posto_risco.probabilidade").isDifferent(null).or( + new Field("hs_relatorio_posto_risco.severidade").isDifferent(null).or( + new Field("hs_relatorio_posto_risco.valor_qualitativo_id").isDifferent(null)))) ), + new String[]{ "hs_relatorio_posto_risco.probabilidade*hs_relatorio_posto_risco.severidade DESC" }, + null, + null, + null ); + array = EXECUTER.executeQuery( select ); + Vector riscosVector = new Vector(); + HashMap> riscosIdMap = new HashMap>(); + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String descricao = ( String ) array.get( n, 1 ); + Integer probabilidade = ( Integer ) array.get( n, 2 ); + Integer severidade = ( Integer ) array.get( n, 3 ); + String valorQualitativo = ( String ) array.get( n, 4 ); + riscos.add( + new RiscoToPrint( + descricao, + severidade, + probabilidade, + valorQualitativo, + getMedidasToPrintByRiscoId( id ) ) ); + } + + Collections.sort(riscos, new Comparator(){ + + @Override + public int compare(RiscoToPrint o1, RiscoToPrint o2) { + Integer o1Value = 1000; + Integer o2Value = 1000; + if( o1.probabilidade != null && o1.severidade != null ) + { + o1Value = -o1.probabilidade*o1.severidade; + } + else if(o1.valorQualitativo.equals(UNCONTROLLED)) + { + o1Value = 100; + } + else if(o1.valorQualitativo.equals(CONTROLLED)) + { + o1Value = 200; + } + else if(o1.valorQualitativo.equals(INDETERMINATE)) + { + o1Value = 300; + } + if( o2.probabilidade != null && o2.severidade != null ) + { + o2Value = -o2.probabilidade*o2.severidade; + } + else if(o2.valorQualitativo.equals(UNCONTROLLED)) + { + o2Value = 100; + } + else if(o2.valorQualitativo.equals(CONTROLLED)) + { + o2Value = 200; + } + else if(o2.valorQualitativo.equals(INDETERMINATE)) + { + o2Value = 300; + } + if( o1Value == -4 && o2Value == -4 ) + { + o1Value = o1.probabilidade + o1.severidade; + o2Value = o2.probabilidade + o2.severidade; + } + return o1Value.compareTo(o2Value); + } + }); + + return riscos; + } + + public Vector getMedidasToPrintByRiscoId( Integer riscoId ) + throws Exception + { + Vector medidas = new Vector(); + Select select = + new Select2( + new String[]{ "hs_relatorio_medida" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "hs_relatorio_medida.id", "hs_relatorio_medida.requesitos_legais", "hs_relatorio_medida.description" }, + new Field( "hs_relatorio_medida.risco_id" ).isEqual( riscoId ).and( + new Field( "hs_relatorio_medida.deleted_date" ).isEqual( null ) ), + new String[]{ "hs_relatorio_medida.id" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + String requisitosLegais = ( String ) array.get( n, 1 ); + String descricao = ( String ) array.get( n, 2 ); + medidas.add( new MedidaToPrint( requisitosLegais, descricao ) ); + } + return medidas; + } + + /** + * Para fazer dump dos logotipos para converter para jpeg + */ + public Mappable[] getLogotipos() + throws Exception + { + Select select = + new Select2( + new String[]{ "image" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "image_data" }, + null, + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Mappable logotipos[] = new Mappable[ array.columnLength() ]; + for( int n = 0; n < logotipos.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + byte data[] = ( byte[] ) array.get( n, 1 ); + logotipos[ n ] = + new MappableObject( id, data ); + } + return logotipos; + } + + /** + * Para fazer import dos logotipos convertidos para jpeg + */ + public void updateLogotipo( Integer id, byte[] data ) + throws Exception + { + BlobUpdate update = + new BlobUpdate( "image", "image_data", data, new Field( "id" ).isEqual( id ) ); + EXECUTER.executeQuery( update ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioToPrint.java new file mode 100644 index 00000000..0c36facb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioToPrint.java @@ -0,0 +1,96 @@ +package siprp.higiene.relatorio.print; + +import java.util.Vector; + +import org.jdom.Element; + +public class RelatorioToPrint + implements PrintableInterface +{ + protected EmpresaToPrint empresa; + protected DataToPrint dataRelatorio; + protected DataToPrint dataHs; + protected String tipoAvaliacao; + protected DataToPrint dataProximaHs; + protected String textoFuncionarios; + protected TecnicoHSToPrint tecnicoHS; + protected TecnicoHSToPrint tecnicoSuperiorHS; + protected LegislacaoAplicavelToPrint legislacaoAplicavel; + protected NormalizacaoToPrint normalizacaoAplicavel; + protected EquipamentosToPrint equipamentos; + protected Vector areas; + + public RelatorioToPrint( EmpresaToPrint empresa, + DataToPrint dataRelatorio, + DataToPrint dataHs, + String tipoAvaliacao, + DataToPrint dataProximaHs, + String textoFuncionarios, + TecnicoHSToPrint tecnicoHS, + TecnicoHSToPrint tecnicoSuperiorHS, + LegislacaoAplicavelToPrint legislacaoAplicavel, + NormalizacaoToPrint normalizacaoAplicavel, + EquipamentosToPrint equipamentos, + Vector areas ) + { + super(); + this.empresa = empresa; + this.dataRelatorio = dataRelatorio; + this.dataHs = dataHs; + this.tipoAvaliacao = tipoAvaliacao; + this.dataProximaHs = dataProximaHs; + this.textoFuncionarios = textoFuncionarios; + this.tecnicoHS = tecnicoHS; + this.tecnicoSuperiorHS = tecnicoSuperiorHS; + this.legislacaoAplicavel = legislacaoAplicavel; + this.normalizacaoAplicavel = normalizacaoAplicavel; + this.equipamentos = equipamentos; + this.areas = areas; + } + + @Override + public Element toJdomElement() throws Exception + { + Element relatorioElement = new Element( "relatorio" ); + relatorioElement.addContent( empresa.toJdomElement() ); + relatorioElement.addContent( dataRelatorio.toJdomElement() ); + relatorioElement.addContent( dataHs.toJdomElement() ); + Element tipoAvaliacaoElement = new Element( "tipo-avaliacao" ); + tipoAvaliacaoElement.setText( tipoAvaliacao ); + relatorioElement.addContent( tipoAvaliacaoElement ); + Element tipoAvaliacaoCamelElement = new Element( "tipo-avaliacao-camel" ); + tipoAvaliacaoCamelElement.setText( tipoAvaliacao.charAt(0) + tipoAvaliacao.toLowerCase().substring(1) ); + relatorioElement.addContent( tipoAvaliacaoCamelElement ); + if( dataProximaHs != null ) + { + relatorioElement.addContent( dataProximaHs.toJdomElement() ); + } + if( textoFuncionarios != null ) + { + Element textoFuncionariosElement = new Element( "texto-funcionarios" ); + textoFuncionariosElement.setText( textoFuncionarios ); + relatorioElement.addContent( textoFuncionariosElement ); + } + if( tecnicoHS != null ) + { + relatorioElement.addContent( tecnicoHS.toJdomElement() ); + } + if( tecnicoSuperiorHS != null ) + { + relatorioElement.addContent( tecnicoSuperiorHS.toJdomElement() ); + } + relatorioElement.addContent( legislacaoAplicavel.toJdomElement() ); + relatorioElement.addContent( normalizacaoAplicavel.toJdomElement() ); + relatorioElement.addContent( equipamentos.toJdomElement() ); + if( areas.size() > 0 ) + { + Element conclusoesElement = new Element( "conclusoes" ); + for( AreaToPrint area : areas ) + { + conclusoesElement.addContent( area.toJdomElement() ); + } + relatorioElement.addContent( conclusoesElement ); + } + return relatorioElement; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/RiscoToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/RiscoToPrint.java new file mode 100644 index 00000000..f558f0eb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/RiscoToPrint.java @@ -0,0 +1,59 @@ +package siprp.higiene.relatorio.print; + +import java.util.Vector; + +import org.jdom.Element; + +public class RiscoToPrint + implements PrintableInterface +{ + protected String descricao; + protected Integer severidade; + protected Integer probabilidade; + protected String valorQualitativo; + protected Vector medidas; + + public RiscoToPrint( String descricao, Integer severidade, Integer probabilidade, + String valorQualitativo, Vector medidas ) + { + super(); + this.descricao = descricao; + this.severidade = severidade; + this.probabilidade = probabilidade; + this.valorQualitativo = valorQualitativo; + this.medidas = medidas; + } + + @Override + public Element toJdomElement() throws Exception + { + Element riscoElement = new Element( "risco" ); + Element descricaoElement = new Element( "descricao" ); + descricaoElement.setText( descricao ); + riscoElement.addContent( descricaoElement ); + if( severidade != null ) + { + Element severidadeElement = new Element( "severidade" ); + severidadeElement.setText( severidade != null ? severidade.toString() : " " ); + riscoElement.addContent( severidadeElement ); + } + if( probabilidade != null ) + { + Element probabilidadeElement = new Element( "probabilidade" ); + probabilidadeElement.setText( probabilidade != null ? probabilidade.toString() : " " ); + riscoElement.addContent( probabilidadeElement ); + } + Element valorElement = new Element( "valor-numerico" ); + valorElement.setText( ( severidade != null && probabilidade != null ) ? "" + ( severidade * probabilidade ) : " " ); + riscoElement.addContent( valorElement ); + Element valorQualitativoElement = new Element( "valor-qualitativo" ); + valorQualitativoElement.setText( valorQualitativo != null ? valorQualitativo : " " ); + riscoElement.addContent( valorQualitativoElement ); + for( MedidaToPrint medida : medidas ) + { + riscoElement.addContent( medida.toJdomElement() ); + } + + return riscoElement; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/TecnicoHSToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/TecnicoHSToPrint.java new file mode 100644 index 00000000..88fe4715 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/TecnicoHSToPrint.java @@ -0,0 +1,45 @@ +package siprp.higiene.relatorio.print; + +import org.jdom.Element; + +public class TecnicoHSToPrint + implements PrintableInterface +{ + protected Integer id; + protected String nome; + protected String cap; + protected String formacao; + protected String assinatura; + protected boolean superior; + + public TecnicoHSToPrint( Integer id, String nome, String cap, + String formacao, String assinatura, boolean superior ) + { + super(); + this.id = id; + this.nome = nome; + this.cap = cap; + this.formacao = formacao; + this.assinatura = assinatura; + this.superior = superior; + } + + @Override + public Element toJdomElement() throws Exception + { + Element tecnicoHSElement = new Element( "tecnico" + ( superior ? "-superior" : "" ) + "-hs" ); + Element nomeElement = new Element( "nome" ); + nomeElement.setText( nome ); + tecnicoHSElement.addContent( nomeElement ); + Element capElement = new Element( "cap" ); + capElement.setText( cap ); + tecnicoHSElement.addContent( capElement ); + Element formacaoElement = new Element( "formacao" ); + formacaoElement.setText( formacao ); + tecnicoHSElement.addContent( formacaoElement ); + Element assinaturaElement = new Element( "assinatura" ); + assinaturaElement.setText( "" + assinatura ); + tecnicoHSElement.addContent( assinaturaElement ); + return tecnicoHSElement; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/TestPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/TestPrint.java new file mode 100644 index 00000000..6b1256a8 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/TestPrint.java @@ -0,0 +1,87 @@ +package siprp.higiene.relatorio.print; + +import java.io.ByteArrayOutputStream; +import java.io.FileOutputStream; +import java.io.InputStream; + +import siprp.util.fop.PDFCreator; + +import com.evolute.utils.xml.XSLTransformer; + +public class TestPrint +{ + public static void main( String args[] ) + throws Exception + { + new TestPrint().test(); + } + + public void test() + throws Exception + { +// FileOutputStream fos; +// +//// PlanoActuacaoDBInit.initDB(); +//// PlanoActuacaoToPrint plano = PlanoActuacaoPrintDataProvider.getProvider().getPlanoToPrint( 6 ); +// Element evoluteElement = new Element( "evolute" ); +// Document foDoc = new Document( evoluteElement ); +// Format pretty = Format.getPrettyFormat(); +// pretty.setIndent("\t"); +// XMLOutputter outputter = new XMLOutputter(pretty); +// ByteArrayOutputStream foBaos = new ByteArrayOutputStream(); +// outputter.output( foDoc, foBaos ); +//// FileOutputStream fos = new FileOutputStream( "/home/fpalma/Desktop/in.xml" ); +//// fos.write( foBaos.toByteArray() ); +//// fos.close(); +// +// byte fo[] = applyTemplate( +//// "siprp/planoactuacao/print/plano_actuacao.xsl", +//// getClass().getClassLoader().getResourceAsStream( "siprp/higiene/relatorio/relatorio.xsl" ), +// new FileInputStream( "/home/fpalma/projectos2/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/relatorio.xsl" ), +//// "siprp/planoactuacao/print/teste_input.xml" ); +// new FileInputStream( "/home/fpalma/projectos2/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/teste_input.xml" ) ); +//// new ByteArrayInputStream( foBaos.toByteArray() ) ); +//// new ByteArrayInputStream( "".getBytes() ) ); +//// System.out.println( new String( fo ) ); +// System.out.println( new String(fo) ); +// createPDFFile( fo, "/home/fpalma/Desktop/out.pdf" ); +//// createPDFFile( fo, "c:/Documents and Settings/Frederico/Ambiente de Trabalho/out.pdf" ); +// +// fos = new FileOutputStream( "/home/fpalma/Desktop/out.xml" ); +// fos.write( fo ); +// fos.close(); + + for( int n = 59; n <= 59; n++ ) + { + byte pdf[] = new RelatorioPDFCreator().createPDF( n ); + FileOutputStream fos = new FileOutputStream( "/home/fpalma/Desktop/" + n + ".pdf" ); + fos.write( pdf ); + fos.close(); + } + } + + public void createPDFFile( byte fo[], String path ) + throws Exception + { + byte pdf[] = PDFCreator.getPDFCreator().createPdfFromFo( fo ); + FileOutputStream fos = new FileOutputStream( path ); + fos.write( pdf ); + fos.close(); + } + + public byte[] applyTemplate( String template, String data ) + throws Exception + { + InputStream xsl = getClass().getClassLoader().getResourceAsStream( template ); + InputStream xml = getClass().getClassLoader().getResourceAsStream( data ); + return( applyTemplate( xsl, xml ) ); + } + + public byte[] applyTemplate( InputStream xsl, InputStream dataStream ) + throws Exception + { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + XSLTransformer.getXSLTransformer().transform( dataStream, xsl, baos ); + return baos.toByteArray(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/relatorio.xsl b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/relatorio.xsl new file mode 100644 index 00000000..03464b16 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/relatorio.xsl @@ -0,0 +1,3005 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ATRIUM SALDANHA   + + + Praça Duque de Saldanha, 1 – 9º G   + + + 1050 – 094 Lisboa   + + + Telefone (+351) 213 504 540   + + + Fax (+351) 213 504 549   + + + geral@siprp.pt   + + + www.siprp.com   + + + + + Lisboa   + + + + + de + + + + + + + + + + AVALIAÇÃO DOS RISCOS PROFISSIONAIS   + + + Relatório + + +   + + +   + + +   + + + + + + + + +   + + +   + + + + + + - + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + +   + + + + + + + + ÃNDICE + + + + + + + + + + + + 1. INTRODUÇÃO + + + + + + + 2. AVALIAÇÃO DOS RISCOS PROFISSIONAIS + + + + + + + 3. MEDIÇÃO DOS FACTORES DE RISCO + + + + + + + 4. LEGISLAÇÃO APLICÃVEL + + + + + + + 4.1 Legislação de aplicação geral + + + + + + + 4.2 Legislação específica + + + + + + + 5. NORMALIZAÇÃO APLICÃVEL + + + + + + + 6. EMPRESA CLIENTE + + + + + + + 7. TABELAS DE AVALIAÇÃO DOS RISCOS PROFISSIONAIS + + + + + + + 8. PLANO DE ACTUAÇÃO + + + + + + + 9. ACOMPANHAMENTO + + + + + + + 10. CONSIDERAÇÕES FINAIS + + + + + +   + + +   + + + + + + + + 1 - INTRODUÇÃO   + + + + + + + + + + + O empregador deve assegurar aos trabalhadores condições de segurança e saúde em todos os aspectos relacionados com o trabalho, aplicando as medidas necessárias tendo em conta os princípios gerais de prevenção. + + + + + Na aplicação das medidas de prevenção, o empregador deve mobilizar os meios necessários, nomeadamente nos domínios da prevenção técnica, da formação, informação e consulta dos trabalhadores e de serviços adequados, internos ou externos à empresa. + + + + + De acordo com a Lei nº 102/2009 de 10 de Setembro, que regulamenta o regime jurídico da promoção e prevenção da segurança e da saúde no trabalho, a prevenção dos riscos profissionais deve assentar numa correcta e permanente avaliação de riscos. + + + + + Enquanto entidade prestadora de serviços externos, a SIPRP - Sociedade Ibérica de Prevenção de Riscos Profissionais fomenta a implementação das medidas necessárias para prevenir os riscos profissionais e promover a segurança e a saúde dos trabalhadores, nomeadamente através da planificação da prevenção (integrando a todos os níveis a avaliação dos riscos e respectivas medidas de prevenção), da avaliação de riscos (com elaboração do respectivo relatório), da elaboração do plano de prevenção dos riscos profissionais e dos planos detalhados de prevenção e protecção (planos de actuação). + + + + + O presente documento reflecte a avaliação dos riscos profissionais realizada, assim como recomenda as respectivas medidas de prevenção necessárias. + + + + + Será igualmente emitido um outro documento no qual se elabora o plano de prevenção dos riscos profissionais, o qual é denominado de Plano de Actuação. + + + + + + + + + + + + + + 2 - AVALIAÇÃO DOS RISCOS PROFISSIONAIS + + + + + + + + + + + Uma avaliação dos riscos profissionais é um exame cuidadoso, realizado nos locais de trabalho, de forma a detectar os componentes aí existentes capazes de causar dano(s) ao(s) trabalhador(es) expostos. Na prática, trata-se de um processo dinâmico que reúne um duplo objectivo: + + + + + + + + + + • + + + + + Estimar a gravidade que um determinado risco no trabalho pode ter para a saúde e segurança dos trabalhadores, resultante das circunstâncias em que o perigo pode ocorrer; + + + + + + + • + + + + + Obter a informação necessária para que o empregador reúna condições para uma tomada de decisão apropriada, nomeadamente informação sobre a necessidade e o tipo de medidas preventivas a adoptar. + + + + + + + + A avaliação dos riscos profissionais constitui um processo dinâmico, uma vez que os riscos profissionais que a entidade patronal se vê obrigada a avaliar não ficam definitivamente determinados, mas vai evoluindo à medida que alterações se vão efectuando em função: + + + + + + + + + + • + + + + + do desenvolvimento progressivo das condições de trabalho; + + + + + + + + + + + • + + + + + das investigações científicas em matéria de riscos profissionais. + + + + + + + + A avaliação dos riscos profissionais deve ser eficiente e suficientemente detalhada para possibilitar uma adequada hierarquização dos riscos e consequente controlo. + + + + + Uma vez que assume uma linguagem mais objectiva, a SIPRP optou pelo método de matriz simples 4x4, que envolve a quantificação da probabilidade e da gravidade. + + + + + O método referido recorre a duas escalas de quatro níveis, para caracterizar as variáveis gravidade e probabilidade. + + + + + + + + + + + + Gravidade + + + + + + + + Probabilidade  + + + + + + + + Improvável   + + + 1   + + + + + Ocasional   + + + 2   + + + + + Provável   + + + 3   + + + + + Frequente   + + + 4   + + + + + + + Negligenciável + + + 1   + + + + + Aceitável   + + + 1   + + + + + Médio + + + 2   + + + + + Médio + + + 3   + + + + + Alto + + + 4   + + + + + + + Marginal + + + 2   + + + + + Médio + + + 2   + + + + + Médio   + + + 4   + + + + + Alto   + + + 6   + + + + + Muito alto   + + + 8   + + + + + + + Crítico + + + 3   + + + + + Médio + + + 3   + + + + + Alto   + + + 6   + + + + + Muito alto   + + + 9   + + + + + Extremamente alto + + + 12   + + + + + + + Catastrófico + + + 4   + + + + + Alto   + + + 4   + + + + + Muito alto   + + + 8   + + + + + Extremamente alto + + + 12   + + + + + Extremamente alto + + + 16   + + + + + + + Quadro – Matriz simples 4x4 + + + + + A interpretação do valor obtido pode ser realizada através da consulta do índice de risco, que traduz a prioridade de intervenção associada à avaliação feita. + + + + + + + + + + + Indice de risco + + + + + prioridade de intervenção + + + + + + + Aceitável + + + + + Actuação não prioritária + + + + + + + Médio + + + + + Intervenção a médio prazo + + + + + + + Alto + + + + + Intervenção a curto prazo + + + + + + + Muito alto + + + + + Actuação urgente + + + + + + + Extremamente alto + + + + + Actuação imediata + + + + + + + Quadro – Prioridade de intervenção de acordo com o índice de risco + + + Alguns riscos profissionais poderão ainda ser classificados como + indeterminados, dada a insuficência de informação. + + + + + + + + + + + + + + 3 - MEDIÇÃO DOS FACTORES DE RISCO + + + + + + + + + + + Uma vez que um dos princípios gerais de prevenção é assegurar que as exposições aos agentes químicos, físicos e biológicos e aos factores de risco psicossociais não constituem risco para a segurança e saúde do trabalhador nos locais de trabalho, a SIPRP, no decorrer das avaliações dos riscos profissionais, realiza medições aos seguintes parâmetros: + + + + + + + + + + • + + + + + Iluminância ou nível de iluminação; + + + + + + + • + + + + + Temperatura do ar; + + + + + + + • + + + + + Humidade relativa do ar; + + + + + + + • + + + + + Nível sonoro contínuo equivalente (ruído). + + + + + + + + Para realizar as referidas medições são utilizados os seguintes equipamentos: + + + + + + + + + + + • + + + + + + + + . + + + ; + + + + + + + + + + + Todos os equipamentos encontram-se devidamente calibrados por entidades acreditadas pelo Instituto Português de Acreditação. + + + + + + + + + + + + + + 4 - LEGISLAÇÃO APLICÃVEL + + + + + + + + + + + A avaliação dos riscos profissionais realizada pela SIPRP tem em conta as prescrições indicadas na legislação portuguesa em matéria de Segurança, Higiene e Saúde do Trabalho: + + + + + + + 4.1 Aplicação geral + + + + + + + + + + + + + • + + + + + + + + . + + + ; + + + + + + + + + + + + + 4.2 Aplicação específica + + + + + + + + + + + + + + + + + • + + + + + + + + . + + + ; + + + + + + + + + + + + + + + + + + + + + 5 - NORMALIZAÇÃO APLICÃVEL + + + + + + + + + + + Na realização da avaliação dos riscos profissionais é considerada além da legislação, também a normalização relativa à Segurança, Higiene e Saúde do Trabalho.  + + + + + + + + + + + + + + + • + + + + + + + + . + + + ; + + + + + + + + + + + + + + + + + • + + + + + + + + . + + + ; + + + + + + + + + + + + + + + + + + + + 6 - EMPRESA CLIENTE + + + + + + + + + + + A SIPRP realizou a avaliação dos riscos profissionais na empresa + , + estabelecimento de , + no dia + + de + + de + . + + + + + A actividade desenvolvida pela empresa é de . + + + + + De acordo com funções fornecidas, . + + + + + No decorrer da avaliação dos riscos profissionais, + a SIPRP obteve a colaboração e acompanhamento de + + ( + + ) + + e + ( + + ) + . + + + + + + + + + + + + + + 7 - TABELAS DE AVALIAÇÃO DOS RISCOS PROFISSIONAIS + + + + + + + + + + + A avaliação dos riscos profissionais realizada encontra-se nas tabelas que são apresentadas seguidamente. Nas mesmas são referidas igualmente as respectivas medidas de prevenção tidas como necessárias. + + + + + Os riscos comuns encontram-se agrupados por forma a facilitar a leitura do presente documento. + + + ÃNDICE DAS TABELAS DE RISCO POR ÃREA DE + ACTIVIDADE + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + +   + + +   + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8 - PLANO DE ACTUAÇÃO + + + + + + + + + + + Após a avaliação dos riscos profissionais e da indicação das respectivas medidas de prevenção tidas como necessárias, a SIPRP emite um documento no qual é elaborado o plano de prevenção dos riscos profissionais, denominado de Plano de Actuação. + + + + + + + + + + + + + + 9 - ACOMPANHAMENTO + + + + + + + + + + + A SIPRP acompanha a execução das medidas de prevenção através de assessoramento ao cliente durante o preenchimento do Plano de Actuação. +   + + + + + A execução das medidas de prevenção são verificadas através da realização da avaliação dos riscos profissionais periódica. +   + + + + + + + + + + + + + + 10 - CONSIDERAÇÕES FINAIS + + + + + + + + + + + A SIPRP agradece a disponibilidade e o apoio de todos os colaboradores da empresa e fica ao dispor para qualquer esclarecimento. + + + + + + + + + Lisboa, + + de + + de + + + +   + + +  Realizado por: + + + + + + + + + + + + + + + + + + +   + + + + + + Técnico de Higiene e Segurança +   + + + CAP nº + + + + + + + + + + + +  Verificado por: + + + + + + + + + + + + + + + + + + +   + + + + + + Técnico Superior de Higiene e Segurança +   + + + CAP nº + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AVALIAÇÃO DE RISCOS PROFISSIONAIS   + + + + + + +   + + + + EMPRESA: + + + + + + + + + + +   + + + + ESTABELECIMENTO: + + + + + + + + + + + + DATA DA AVALIAÇÃO: + + + + de + + de + + +   + + + + + + AVALIAÇÃO: + + + + +   + + + + + + PRÓXIMA AVALIAÇÃO: + + + + de + + de + + +   + + + + + + + + REALIZADA POR: + + + + + + + + + + / SIPRP – + Sociedade Ibérica de Prevenção + de Riscos Profissionais   + + + + + + + + + POSTO DE TRABALHO: + + + + + + + + + + + + + + + + + + + + GRAV.   + + + (G)   + + + + + PROB.   + + + (P)   + + + + + VALOR RISCO   + + + (G x P)   + + + + + RISCO / CONDIÇÕES ANÓMALAS /   + + + / ACÇÕES DE CONTROLO OU REDUÇÃO DO + RISCO   + + + + + + + + + +   + + + + +   + + + + +   + + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + +   + + +   + + + + + + + + - + + + + + + +   + + +   + + +   + + + + + + + + - + + + + + + +   + + +   + + +   + + + + + + + + Aceitável + + + Médio + + + Médio + + + + + Médio + + + Alto + + + + + Alto + + + Muito alto + + + Muito alto + + + Extremamente alto + + + Extremamente alto + + + + + + + + + + + +   + + + + +   + + + + + + + + + + +   + + + + + + + - + + + + + + + + . + + + ; + + + + + + + +   + + + + + + + + . + + + ; + + + + +   + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + Avaliação + + + + + + + dos Riscos Profissionais + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/relatorio_new.xsl b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/relatorio_new.xsl new file mode 100644 index 00000000..adc69ba1 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/relatorio_new.xsl @@ -0,0 +1,3671 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ATRIUM SALDANHA   + Praça Duque de Saldanha, 1 – 9º G   + 1050 – 094 Lisboa   + Telefone (+351) 213 504 540   + Fax (+351) 213 504 549   + geral@siprp.pt   + www.siprp.com   + + + Lisboa   + + + + de + + + + + + + + + AVALIAÇÃO DE RISCOS LABORAIS   + Relatório +   +   +   +   +   +   +   + + + + +   +   + + + - + +   + +   + + + + + + +   +   +   + + + + + + Avaliação Periódica de Riscos Laborais +   +   + + + 113 + +   + + + +   +   + 9. PLANO DE ACTUAÇÃO   +   + A partir dos resultados da avaliação de riscos, + é elaborado um outro documento (Plano de + Actuação), que inclui a listagem das acções que + deverão ser realizadas de modo a eliminar, + reduzir ou controlar os riscos detectados.   + + Este Plano permitirá auxiliar a + AUCHAN + - + Loja de Coimbra + na programação e acompanhamento das + referidas acções. +   + +   +   + 10. CONSIDERAÇÕES FINAIS   +   + + A equipa técnica de Segurança e Higiene do + Trabalho da SIPRP agradece a colaboração de + todos os colaboradores da + AUCHAN + - + Loja de Coimbra + durante a realização desta auditoria, + ficando à disposição para qualquer + esclarecimento. +   + +   +   +   + Lisboa, 29 de Abril de 2008   +   + + + + + +   + Sónia Campos   + Ergonomista   + Téc. Sup. Seg. Hig. do Trabalho +   + (CAP nº 0601/6505/02)   + + + + +   +   +   +   + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/relatorio_old.xsl b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/relatorio_old.xsl new file mode 100644 index 00000000..6da1dd6e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/relatorio_old.xsl @@ -0,0 +1,3833 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vbvb   + + + + +   + + + + + + + +   + + Avaliação Periódica de Riscos Laborais +   +   +   +   +   +   + + + +   +   + ÃNDICE   + + 1. INTRODUÇÃO + + + + + 2. DADOS DA EMPRESA + + + + + 3. LEGISLAÇÃO APLICÃVEL + + + + + 3.1 Legislação de aplicação geral + + + + + 3.2 Legislação específica + + + + + 4. NORMALIZAÇÃO APLICÃVEL + + + + + 4.1 Normalização portuguesa + + + + + 4.2 Normalização internacional + + + + + 5. OBRIGAÇÕES LEGAIS + + + + + 5.1 Obrigações do empregador + + + + + 5.2 Obrigações do trabalhador + + + + + 6. EQUIPAMENTOS UTILIZADOS + + + + + 7. RISCOS LABORAIS + + + + + 7.1 Classificação dos riscos profissionais + + + + + 7.2 Valoração dos riscos + + + + + 8. AVALIAÇÃO DE RISCOS LABORAIS + + + + + + + + +   +   +   + 1. INTRODUÇÃO   +   + A entidade empregadora deve tomar todas as + medidas necessárias para a defesa da segurança e + saúde dos seus trabalhadores, mediante a criação + de um sistema organizado, dotado dos meios + necessários, que deve abranger as medidas de + eliminação e de controlo dos riscos, assim como + de formação, informação e consulta a empreender. +   + + De acordo com a Lei nº 35/2004 de 29 de + Julho, que contém os princípios que visam + promover a segurança, higiene e saúde do + trabalho, o empregador deve “ + Integrar no conjunto de actividades da + empresa … a avaliação dos riscos para a + segurança e saúde dos trabalhadores, com a + adopção de convenientes medidas de + prevenção.†+   + + Tendo em vista assegurar condições adequadas de + segurança, higiene e saúde dos trabalhadores, + são realizadas auditorias de segurança, no + decorrer das quais:   + + 1 + é recolhida informação através das visitas + aos locais de trabalho, do diálogo + estabelecido com os trabalhadores ou através + de outras fontes de informação;   + + + 2 + é listado o conjunto de factores de risco + inerentes às condições normais de laboração + ou aos acontecimentos não planeados mas + previsíveis;   + + + 3 + são identificados os trabalhadores + potencialmente expostos a riscos resultantes + dos factores de risco identificados;   + + + 4 + é recolhida informação relativa à existência + de grupos específicos (jovens, grávidas, + puérperas, lactantes);   + + + 5 + são identificados os trabalhadores + envolvidos em trabalhos proibidos, + condicionados ou não recomendados;   + + + 6 + são identificadas as situações de perigo + grave ou iminente.   + + A avaliação dos riscos laborais consiste + portanto, na análise estruturada de todos os + aspectos inerentes ao trabalho, concretizada + através da identificação, estimação e valoração + dos riscos existentes (com indicação dos + trabalhadores a eles expostos) e da definição + das medidas de prevenção ou protecção adequadas. +   +   +   +   +   + 2. DADOS DA EMPRESA   +   + + No dia + 6 de Março 2008 + realizou-se a auditoria às instalações da + empresa + JUMBO – Loja integrada no C. C. + Dolce Vita + Coimbra + , situada na + R. D. João III, Coimbra + (cuja actividade desenvolvida é de comércio + a retalho em supermercados e hipermercados) + para a avaliação das condições de segurança, + higiene e saúde do trabalho existentes. +   + + A empresa supracitada possui duzentos e sessenta + e quatro (264) funcionários, sendo que setenta e + seis (76) destes exercem actividades na zona de + produtos frescos.   + Para a realização da visita, a Técnica Superior + de Segurança e Higiene do Trabalho da Sociedade + Ibérica de Prevenção de Riscos Profissionais + Unipessoal Lda., obteve a colaboração e + acompanhamento do Sr. Carlos Beijinho + (Responsável de Segurança) na prestação de + informações relativas à actividade desenvolvida + e às condições de trabalho existentes.   +   +   + 3. LEGISLAÇÃO APLICÃVEL   +   + A avaliação de riscos laborais realizada foi + baseada nas obrigações impostas pela legislação + portuguesa em vigor relativa à Segurança, + Higiene e Saúde do Trabalho.   +   + 3.1 Legislação de aplicação geral   + + - +   + Lei nº 99/2003 de 27 de Agosto regulamentada + pela Lei nº 35/2004 de 29 de Julho – Aprova o + novo Código de Trabalho;   + + + + - +   + Decreto-Lei n.º441/91 de 14 de Novembro, + + alterado pelo + Decreto-Lei n.º133/99 de 21 de Abril – + Estabelece o regime jurídico do + enquadramento da segurança, higiene e saúde + do trabalho; +   + + + + - +   + Decreto-Lei n.º26/94, de 1 de Fevereiro, + + alterado + pela Lei n.º7/95 de 29 de Março e pelo + Decreto-Lei n.º109/2000 – Regime de + Organização e funcionamento dos serviços da + segurança, higiene e saúde do trabalho; +   + + + - +   + Decreto-Lei n.º 347/93 de 1 de Outubro e + Portaria n.º987/93 de 6 de Outubro – Relativos + às prescrições mínimas de segurança nos locais + de trabalho.   + +   +   + 3.2 Legislação específica   + Acidentes de Trabalho e Doenças Profissionais   + + 1 + Lei nº100/97, de 13 de Setembro + regulamentado pelo Decreto-Lei n.º143/99 de + 30 de Abril – Aprova o novo regime jurídico + dos acidentes de trabalho e doenças + profissionais;   + + + 2 + Decreto-Lei nº 341/93 de 30 de Setembro – + Aprova a Tabela Nacional de Incapacidades de + Trabalho;   + + + 3 + Decreto Regulamentar nº 6/2001 de 5 de Maio + – Aprova a lista das doenças profissionais e + o respectivo índice codificado.   + + Grupos Específicos de Trabalhadores   + + 1 + Portaria nº 229/96 de de 26 de Junho – + Relativa à Protecção da segurança e da saúde + das trabalhadoras grávidas, puérperas e + lactantes.   + + Comércio e serviços   + + 1 + Decreto-Lei nº243/86 de 20 de Agosto – + Aprova o Regulamento Geral de Higiene e + Segurança de Trabalho nos Estabelecimentos + Comerciais, de Escritórios e Serviços;   + + Equipamentos de Protecção Individual   + + 1 + Decreto-Lei nº 348/93 de 1 de Outubro – + Relativo às prescrições mínimas de segurança + e de saúde para a utilização pelos + trabalhadores de equipamentos de protecção + individual no trabalho;   + + + 2 + Portaria nº 988/93 de 6 de Outubro – + Estabelece as prescrições mínimas de + segurança e saúde dos trabalhadores na + utilização de equipamentos de protecção + individual no trabalho.   + + Sinalização de segurança   + + 1 + Decreto-Lei n.º141/95, de 14 de Junho + regulamentado pela Portaria n.º1456-A/95, de + 11 de Dezembro – Estabelece as prescrições + mínimas para a sinalização de segurança e de + saúde no trabalho.   + + Segurança contra incêndios   + + 1 + + Decreto-Lei nº 368/99 de 18 de Setembro + – Aprova as medidas de segurança contra + riscos de incêndio aplicáveis aos + estabelecimentos comerciais com área + total igual ou superior a 300 m + 2 + . +   + + +   +   + Máquinas e equipamentos   + + 1 + Decreto-Lei nº 50/2005 de 25 de Fevereiro – + Relativo às prescrições mínimas de segurança + e de saúde para a utilização de equipamentos + de trabalho;   + + + 2 + Decreto-Lei nº 320/2001 de 12 de Dezembro – + Estabelece as regras a que deve obedecer a + colocação no mercado e a entrada em serviço + das máquinas e dos componentes de segurança + e colocados no mercado isoladamente.   + + Risco e instalações eléctricas   + + 1 + Portaria nº 37/70 de 21 de Janeiro – Aprova + as instruções para os primeiros socorros em + acidentes pessoais produzidos por correntes + eléctricas;   + + + 2 + + Portaria nº 949A/2006, de 11 de Setembro + – Relativo às Regras Técnicas das + Instalações Eléctricas + de Baixa Tensão; +   + + + Agentes biológicos   + + 1 + Decreto-lei nº 84/97 de 16 de Abril – + Estabelece prescrições mínimas de protecção + da segurança e da saúde dos trabalhadores + contra os riscos da exposição a agentes + biológicos durante o trabalho.   + + Agentes químicos   + + 1 + Decreto-lei nº 290/201 de 16 de Novembro – + Relativo à protecção da segurança e saúde + dos trabalhadores contra os riscos ligados à + exposição a agentes químicos no trabalho.   + + Desempenho energético dos edifícios   + + 1 + Decreto-Lei n.º 78/06 de 4 de Abril – + Relativo ao desempenho energético dos + edifícios;   + + + 2 + Decreto-Lei nº 79/2006 de 4 de Abril - + Aprova o regulamento dos Sistemas + Energéticos de Climatização em Edifícios.   + + Ruído   + + 1 + Decreto-lei nº 182/2006 de 6 de Setembro – + Relativo às prescrições mínimas de segurança + e saúde em matéria de exposição dos + trabalhadores aos riscos devidos ao ruído.   + +   +   + Classificação, embalagem e rotulagem   + + - +   + Portaria nº 732-A/96 de 11 de Dezembro – + Estabelecer as regras a que devem obedecer a + notificação de novas substâncias químicas e a + classificação, embalagem e rotulagem que + substâncias perigosas para o Homem e o ambiente + quando colocadas no mercado.   + + Equipamentos dotados de visor   + + - +   + Decreto-Lei n.º349/93, de 1 de Outubro – + Prescrições mínimas de segurança e de saúde + respeitantes ao trabalho com equipamentos + dotados de visor,   + + + - +   + Portaria n.º 989/93, de 6 de Outubro – + Prescrições mínimas de segurança e de saúde + respeitantes ao trabalho com equipamentos + dotados de visor (Regulamenta o Decreto-Lei + n.º349/93, de 1 de Outubro).   + + Movimentação manual de cargas   + + 1 + Decreto-Lei n.º330/93 de 25 de Outubro – + Relativa às prescrições mínimas de segurança + e de saúde na movimentação manual de cargas. +   + +   + 4. NORMALIZAÇÃO APLICÃVEL   +   + Na realização da avaliação de riscos laborais + foi considerada além da legislação, também a + normalização relativa à Segurança, Higiene e + Saúde do Trabalho.   + 4.1 Normalização portuguesa   + + 1 + Norma Portuguesa (NP) 3992:1994 - + Sinalização contra incêndio. Sinais de + segurança;   + + + 2 + NP EN 2:1993 - Classes de fogos;   + + + 3 + NP 1800:1981 - Segurança contra incêndios. + Agentes extintores. Selecção segundo as + classes de fogos;   + + + 4 +   + + + 5 + NP 3064:1988 - Segurança contra incêndio. + Utilização dos extintores de incêndio + portáteis;   + + + 6 + NP 4280:1995 - Segurança contra incêndios. + Sinalização de dispositivos de combate a + incêndio;   + + + 7 + NP 4413:2002 - Manutenção de extintores;   + + + 8 + NP EN 2:1993 - Classes de fogos;   + + + 9 + NP EN 1866: 2000 - Extintores de incêndio + móveis;   + + + 10 + NP EN 869:1998 - Mantas de incêndio;   + + + 11 + NP EN 671-1:2003 - Instalações fixas de + combate a incêndio – Sistemas armados com + mangueiras.   + +   + 4.2 Normalização internacional   + + 1 + + International Organization of + Standardization (ISO) 8995: + 2002 - Lighting of Indoor Work Places; +   + + + + 1 + ISO 9241-5:1998 - Ergonomic requirements for + Office work with visual display terminals + (VDTS) Part 5: Workstation layout and + postural requirements;   + + + 2 + Norma Belga NBN S26001: 1984 - Chair-desk + working position – Basic principles;   + + + 3 + Norma Belga NBN S26002: 1984 - Chair-desk + working position-Dimensions and design + requirements.   + +   +   + 5. OBRIGAÇÕES LEGAIS   +   + De acordo com o Capítulo IV da Lei nº99/2003 de + 27 de Agosto são estabelecidas obrigações legais + para o empregador e trabalhador.   +   +   + 5.1 Obrigações do empregador   + De acordo com o artigo 273º da Lei nº99/2003 de + 27 de Agosto o empregador tem de:   + + - +   + Identificar os riscos previsíveis, combatendo-os + na origem, anulando-os ou limitando os seus + efeitos;   + + + - +   + Avaliar os riscos para a segurança e saúde dos + trabalhadores, com a adopção de convenientes + medidas de prevenção;   + +   +   + + - +   + Assegurar que a exposição a agentes químicos, + físicos e biológicos não constituam risco para a + saúde;   + + + - +   + Considerar a componente técnica, organização do + trabalho, as relações sociais e os factores + materiais na planificação da prevenção;   + + + - +   + Ter em conta os trabalhadores e terceiros + susceptíveis de serem abrangidos pelos riscos e + realização de trabalhos;   + + + - +   + Dar prioridade à protecção colectiva em relação + às medidas de protecção individual;   + + + - +   + Organizar o trabalho, procurando eliminar + eventuais efeitos nocivos do trabalho monótono e + cadenciado;   + + + + - +   + Assegurar a vigilância adequada da saúde dos + trabalhadores em função + + + dos riscos a que se encontram expostos; +   + + + - +   + Estabelecer medidas, identificar trabalhadores + responsáveis e assegurar contactos necessários + com entidades exteriores em matéria de primeiros + socorros, combate a incêndios e evacuação dos + trabalhadores;   + + + - +   + Permitir unicamente a trabalhadores com aptidão + e formação adequadas o acesso (apenas durante o + tempo necessário) a zonas de risco grave;   + + + - +   + Adoptar medidas e dar instruções que permitam + aos trabalhadores em caso de perigo grave ou + eminente que não possa ser evitado, cessar a sua + actividade ou afastar-se imediatamente do local + de trabalho, sem que possam retomar a actividade + enquanto persistir o perigo;   + + + - +   + Substituir o que é perigoso pelo que é isento de + perigo ou menos perigoso;   + + + - +   + Dar instruções adequadas aos trabalhadores;   + + + - +   + Ter em consideração se os trabalhadores têm + conhecimentos e aptidões em matéria de SHST que + lhes permita exercer com segurança as tarefas + incumbidas.   + +   +   + 5.2 Obrigações do trabalhador   + De acordo com o artigo 274º da Lei nº99/2003 de + 27 de Agosto os trabalhadores têm de:   + + - +   + Cumprir prescrições de SHST estabelecidas e + instruções determinadas pelo empregador;   + + + - +   + Zelar pela sua segurança e saúde, bem como pela + das outras pessoas que possam ser afectadas + pelas suas acções ou omissões no trabalho;   + + + - +   + Utilizar correctamente máquinas, aparelhos, + instrumentos, substâncias perigosas e outros + equipamentos e meios postos à sua disposição + (equipamento de protecção colectiva e + individual) e cumprir os procedimentos de + trabalho estabelecidos;   + + + - +   + Cooperar na melhoria do sistema de SHST;   + + + - +   + Comunicar imediatamente (ao superior + hierárquico) as avarias e deficiências por si + detectadas que se afigurem susceptíveis de + originar perigo grave e iminente (se não for + possível estabelecer contacto, adoptar as + medidas e instruções estabelecidas), assim como + qualquer defeito verificado nos sistemas de + protecção;   + + + - +   + Adoptar as medidas e instruções estabelecidas em + caso de perigo grave e iminente, se não for + possível estabelecer contacto imediato com o + superior hierárquico ou com os trabalhadores que + desempenhem funções específicas nos domínios da + segurança, higiene e saúde do trabalho.   + +   +   + 6. EQUIPAMENTOS UTILIZADOS   + No decorrer da auditoria são realizadas medições + relativas aos níveis de iluminância, humidade + relativa, temperatura do ar, velocidade do ar e + do nível sonoro contínuo equivalente.   + Na realização das referidas medições são + utilizados os seguintes equipamentos + (devidamente calibrados):   + + - +   + Luxímetro (Chauvin Arnoux Physics Line CA 811); +   + + + - +   + Termo-higrómetro (Chauvin Arnoux Physics Line CA + 846);   + + + - +   + Sonómetro (Cesva SC – 15 c Classe 2).   + +   + 7. RISCOS LABORAIS   +   + 7.1 Classificação dos riscos profissionais   + Os riscos profissionais encontram-se + relacionados com a Segurança, a Higiene, a + Ergonomia e a Psicossociologia do Trabalho.   + + Segurança do Trabalho + : contacto directo/indirecto com a + electricidade, projecção de fragmentos ou + partículas. +   + + + Higiene do Trabalho + : +   + + + Riscos físicos + : exposição a ruído, vibrações, radiações + (ionizantes e não ionizantes), condições + inadequadas de iluminação; +   + + + Riscos químicos + : exposição a agentes químicos no estado + sólido (poeiras, fibras e fumos), líquido + (aerossóis e neblinas) e gasoso (gases e + vapores); +   + + + Riscos biológicos + : exposição a contaminantes biológicos + (vírus, bactérias, fungos e parasitas). +   + + + Ergonomia do Trabalho + : manipulação manual de cargas, adopção de + posturas incorrectas. +   + + + Psicossociologia do Trabalho + : realização de trabalho monótono e/ou + complexo, atendimento público, existência de + conflitos interpessoais. +   + +   +   + 7.2 Valoração dos riscos   + A valoração dos riscos associados as perigos + identificados tem como objectivo a definição de + prioridades da execução das medidas preventivas + (hierarquização dos riscos).   + + Para realizar a valoração de um risco + laboral é necessário atender à + probabilidade + de ocorrência (quantas vezes pode ocorrer?) + e da estimativa da + severidade + (gravidade) das consequências da sua + materialização (que dano/lesão pode + resultar?). +   + + As consequências de um risco laboral podem ser + caracterizadas em danos muito leves, em lesões + leves, lesões graves ou lesões muito graves ou + morte.   + No seguinte quadro encontram-se descritos alguns + exemplos de consequências de acordo com o grau + de severidade.   +   + + + + + + + SEVERIDADE (S)   + + + CONSEQUÊNCIAS PREVISÃVEIS   + + + + + Danos muito leves   + + + - Pequenos ferimentos   + - Dor de cabeça ou outros + transtornos leves que não causem + baixa   + - Desconforto, fadiga visual   + - Em geral, lesões ou + transtornos que não requeiram + tratamento médico ou baixa + médica   + + + + + Lesão leve   + + + - Contusões, cortes + superficiais, entorses, + distensões   + - Irritações   + - Pequenas queimaduras + superficiais   + - Em geral, lesões ou + transtornos que requerem + tratamento médico e podem + ocasionar em alguns casos baixa + de curta duração   + + + + + Lesão grave   + + + - Lacerações   + - Queimaduras extensas   + - Comoções/Abalos físicos   + - Pequenas fracturas   + - Doença crónica que conduza a + uma incapacidade menor + (diminuição da audição, + dermatoses, asma)   + - Transtornos + músculo-esqueléticos   + + + + + Lesão muito grave/mortal   + + + - Amputações, lesões múltiplas   + - Facturas maiores   + - Intoxicações   + - Cancro   + - Doenças crónicas que afectam + severamente a vida   + - Incapacidades permanentes   + - Invalidez   + - Morte   + + + + +   +   +   + Um risco laboral pode ser classificado em + improvável, possível, provável ou inevitável, de + acordo com a probabilidade de se vir a + materializar; como se pode verificar no quadro + seguinte.   +   + + + + + + + PROBABILIDADE (P)   + + + CRITÉRIOS APLICADOS   + + + + + Improvável   + + + - Extremamente raro, ainda não + acorreu   + - Não existe exposição ao perigo + em condições normais de trabalho + ou é muito esporádica   + - O dano não é previsível que + ocorra   + + + + + Possível   + + + - É raro que possa ocorrer   + - Se já ocorreu alguma vez   + - Pode-se apresentar em + determinadas circunstâncias   + - A exposição ao perigo é + ocasional   + - O dano ocorreu várias vezes   + + + + + Provável   + + + - Não será estranho que ocorra o + dano   + - Já ocorreu em algumas + situações   + - Existência de vários + incidentes ou acidentes pela + mesma causa   + - Os sistemas e medidas + aplicadas para o controlo dos + riscos não impedem que este se + manifeste em qualquer momento da + exposição   + - O dano ocorrerá em algumas + ocasiões   + - A exposição ao perigo é + frequente ou afecta bastante + pessoas   + + + + + Inevitável   + + + - É o resultado mais provável + quando existe uma exposição + continuada ou afecta a muitas + pessoas   + - Ocorrerá a médio ou a longo + prazo   + - O dano ocorrerá sempre ou + quase sempre   + + + + +   + Com base na frequência da exposição e nas + consequências de um risco, é possível construir + uma matriz de falhas, na qual podem ser + atribuídas cores e números que evidenciem os + diferentes níveis de valoração do risco, como se + pode verificar no quadro seguinte.   +   + + + + + + + +   + + +   + PROBABILIDADE DE MATERIALIZAÇÃO + DO RISCO   +   + + + + + GRAU DE SEVERIDADE POSSÃVEL   + + + IMPROVÃVEL   + 1   + + + POSSÃVEL   + 2   + + + PROVÃVEL   + 3   + + + INEVITÃVEL   + 4   + + + + + DANOS MUITO LEVES   + 1   + + + IRRELEVANTE   + 1   + + + MUITO BAIXO   + 2   + + + MUITO BAIXO   + 3   + + + BAIXO   + 4   + + + + + LESÃO LEVE   + 2   + + + MUITO BAIXO   + 2   + + + BAIXO   + 4   + + + MÉDIO   + 6   + + + ALTO   + 8   + + + + + LESÃO GRAVE   + 3   + + + MUITO BAIXO   + 3   + + + MÉDIO   + 6   + + + ALTO   + 9   + + + MUITO ALTO   + 12   + + + + + LESÃO MUITO GRAVE OU MORTAL   + 4   + + + BAIXO   + 4   + + + ALTO   + 8   + + + MUITO ALTO   + 12   + + + EXTREMAMENTE ALTO   + 16   + + + + +   +   +   +   + A determinação da valoração do risco permite + hierarquizar as intervenções, definir as acções + e estabelecer prazos de execução, como se + exemplifica no seguinte quadro:   +   + + + + + + + VALORAÇÃO DO RISCO   + + + RECOMENDAÇÕES   + + + + + Irrelevante   + + + Não é necessário estabelecer + nenhuma medida   + + + + + Muito baixo   + + + Não é necessário estabelecer + medidas adicionais às existentes +   + + + + + Baixo   + Prioridade: Baixa   + + + Controlar a situação que pode + materializar o risco   + + + + + Médio   + Prioridade: Média   + + + Verificar periodicamente a + eficácia das medidas de controlo + e melhorar a acção preventiva a + médio prazo (se as consequências + poderem ser muito graves ou + mortais, o prazo deve ser + reduzido)   + + + + + Alto   + Prioridade: Média/Alta   + + + Devem-se implementar medidas + para reduzir o risco a curto + prazo (se as consequências + poderem ser muito graves ou + mortais, o prazo deve ser + reduzido)   + + + + + Muito alto   + Prioridade: Alta   + + + Adoptar medidas provisórias + imediatas e definitivas para a + redução do risco a muito curto + prazo.   + Se o trabalho não se realiza + habitualmente, não se deve + iniciar sem que haja redução do + risco. Avaliar as medidas + adoptadas   + + + + + Extremamente alto   + Prioridade: Actuação imediata   + + + Não começar ou continuar o + trabalho até que se reduza o + risco. É necessário avaliar o + risco, uma vez corrigido.   + + + + +   + Alguns riscos laborais podem necessitar da + realização de estudos específicos, realizados de + acordo com os critérios estabelecidos na + legislação e normativa portuguesa e + internacional. Nesta situação, os riscos + laborais detectados podem ser classificados como + risco controlado, semi-controlado, incontrolado + e indeterminado, como é mostrado na tabela + seguinte.   + + + + + + + + + RISCOS DE HIGIENE, + ERGONOMICOS OU PSICOSSOCIAIS + DO TRABALHO   + + + CLASSIFICAÇÃO   + + + OBSERVAÇÕES   + + + + + Risco analisado/documentado. +   + Informação suficiente.   + + + + + + + + + Controlado   +   + + + As medidas + de controlo + existentes + são + adequadas   + + + + + Incontrolado +   + + + As medidas + de controlo + são + inexistentes, + insuficientes + ou + inadequadas. +   + + + + + + + + + Risco não + estudado/analisado.   + Informação insuficiente.   + + + Indeterminado   + + + É necessário realizar estudo + específico   + + + + +   + + Um risco analisado e documentado, é aquele que + tendo sido objecto de uma avaliação específica e + que se encontra documentado, registado e + disponível na empresa.   + + Um risco que foi analisado pode encontrar-se + controlado ou incontrolado + , sendo esta última situação referente ao + não cumprimento das medidas de controlo + aconselhadas nos + estudos realizados e à não realização de + novos estudos com a periodicidade + obrigatória. +   + + + Se não existe informação suficiente para + determinar a magnitude ou nível do risco e + poder adoptar as medidas adequadas, + classifica-se como risco + Indeterminado + . +   + +   +   +   + 8. AVALIAÇÃO DE RISCOS LABORAIS   +   +   +   + Com base na informação recolhida no decorrer da + auditoria, foram elaboradas as tabelas de riscos + laborais que a seguir se apresentam, sendo estas + elaboradas por trabalhador (ou grupo de + trabalhadores com actividades semelhantes) e + para as instalações.   + Para cada um dos riscos identificados são + aconselhadas medidas preventivas e/ou + correctivas, de acordo com a legislação e + normativa vigente, tendo em vista a sua + eliminação, redução ou controlo para níveis + aceitáveis.   + + + + +   + + + + + + + +   + + Avaliação Periódica de Riscos Laborais +   +   +   +   +   + + + +   +   +   +   +   +   +   +   +   +   +   + Genérico   + Riscos comuns às áreas Administrativa   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   + + + + + + + + + + + + AVALIAÇÃO DE RISCOS LABORAIS   + + + + +   + + EMPRESA + : Auchan +   + + + +   + + DATA DA AVALIAÇÃO + : 6 de Março de 2008 +   + + + + + AVALIAÇÃO: INICIAL + + ¨ + PERIÓDICA + þ + +   + + + + + +   + ESTABELECIMENTO: Coimbra   + + +   + + DATA DA PRÓXIMA + : 25 de Setembro de 2008 +   + + + + REALIZADA POR: Sónia Campos   + SIPRP – Sociedade Ibérica de + Prevenção de Riscos + Profissionais   + + + + + + POSTO DE TRABALHO + : + Genérico Ãrea Administrativa +   + + + + Página 1 de 11   + + + + + SEV.   + (S)   + + + PROB.   + (P)   + + + VALOR RISCO   + (S x P)   + + + RISCO / CONDIÇÕES ANÓMALAS /   + / ACÇÕES DE CONTROLO OU REDUÇÃO + DO RISCO   + + + + + 3   + + + 2   + + + 6   + MÉDIO   + + +   + + 1 + Risco ergonómico devido à + postura na utilização de + equipamentos dotados de + visor   + +   + + 1 + Formar os trabalhadores + sobre a utilização dos + equipamentos dotados de + visor (Decreto Lei nº 349/93 + – art. 8º).   + + Devido ao tempo de exposição aos + factores de risco inerentes ao + trabalho e ao tempo de + interacção com ecrãs de + visualização, devem ser + garantidas condições básicas + para que os colaboradores possam + executar as suas tarefas com o + máximo de conforto, garantindo + níveis de produtividade.   + + 1 + + Disponibilizar a + todos + os trabalhadores + cadeiras que: garantam + ajustabilidade (altura e + apoios) e disponham de + apoio para os braços + (ISO 9241:1997 – + Ergonomics requirements + for office work with + visual terminals) +   + + + + + + +   +   +   +   +   +   +   +   +   +   +   +   +   +   + + + + + + + + + + + + AVALIAÇÃO DE RISCOS LABORAIS   + + + + +   + + EMPRESA + : Auchan +   + + + +   + + DATA DA AVALIAÇÃO + : 6 de Março de 2008 +   + + + + + AVALIAÇÃO: INICIAL + + ¨ + PERIÓDICA + þ + +   + + + + + +   + ESTABELECIMENTO: Coimbra   + + +   + + DATA DA PRÓXIMA + : 25 de Setembro de 2008 +   + + + + REALIZADA POR: Sónia Campos   + SIPRP – Sociedade Ibérica de + Prevenção de Riscos + Profissionais   + + + + + + POSTO DE TRABALHO + : + Genérico Ãrea Administrativa +   + + + + Página 2 de 11   + + + + + SEV.   + (S)   + + + PROB.   + (P)   + + + VALOR RISCO   + (S x P)   + + + RISCO / CONDIÇÕES ANÓMALAS /   + / ACÇÕES DE CONTROLO OU REDUÇÃO + DO RISCO   + + + + + 3   + + + 2   + + + 6   + MÉDIO   + + +   +   + + 1 + Risco de exposição a + condições inadequadas de + iluminação   + + + 1 + As fontes de iluminação + devem ser de intensidade + uniforme e não devem + provocar contrastes muito + acentuados, encandeamento, + excessivo aquecimento, + cheiros, fumos ou gases + incómodos, tóxicos ou + perigosos (Decreto Lei nº + 243/86 – art. 14º);   + + + 2 + O valor de iluminância deve + ser no mínimo de 500 lux na + área focal de trabalho e de + 300 lux no envolvimento para + actividade de carácter (ISO + 8995 –Lighting of Indoor + Work Places);   + + + 3 + + A instalação eléctrica + (…) e deve assegurar que + a sua utilização não + constitua factor de + risco para os + trabalhadores, por + contacto directo ou + indirecto + ( + Portaria 987/93 art. 3º + - 1) +   + + + Todas as lâmpadas existentes nas + instalações deverão estar + devidamente protegidas.   + + + + + 3   + + + 2   + + + 6   + MÉDIO   + + +   + + 1 + Risco de incêndio   + +   + + 1 + + Todos os + estabelecimentos + comerciais devem dispor + de meios de primeira + intervenção apropriados, + colocados perto dos + acessos às escadas ou + saídas, nos caminhos de + evacuação e na + proximidade dos locais + de maior risco ( + Decreto-Lei 368/99 - + ponto 9 do Anexo + ); +   + + + + 2 + + Manter o material de + detecção e combate a + incêndios + permanentemente + acessível + (Decreto Lei n.º243/86 – + art.36º-1) + ; +   + + + Todos os extintores existentes + nas instalações deverão estar + posicionados a 1,20 m do chão + (manípulo)   + + + + +   +   +   + + + + + + + + + + + + + + + AVALIAÇÃO DE RISCOS LABORAIS   + + + + +   + + EMPRESA + : Auchan +   + + + +   + + DATA DA AVALIAÇÃO + : 6 de Março de 2008 +   + + + + + AVALIAÇÃO: INICIAL + + ¨ + PERIÓDICA + þ + +   + + + + + +   + ESTABELECIMENTO: Coimbra   + + +   + + DATA DA PRÓXIMA + : 25 de Setembro de 2008 +   + + + + REALIZADA POR: Sónia Campos   + SIPRP – Sociedade Ibérica de + Prevenção de Riscos + Profissionais   + + + + + + POSTO DE TRABALHO + : + Genérico Ãrea Administrativa +   + + + + Página 3 de 11   + + + + + SEV.   + (S)   + + + PROB.   + (P)   + + + VALOR RISCO   + (S x P)   + + + RISCO / CONDIÇÕES ANÓMALAS /   + / ACÇÕES DE CONTROLO OU REDUÇÃO + DO RISCO   + + + + + 4   + + + 1   + + + 4   + BAIXO   + + +   + + 1 + Risco de choque contra + objectos imóveis   + + + 1 + Manter o local de trabalho + arrumado (Decreto Lei + n.º441/91 – art.15ºb);   + + + 1 + Assegurar que as vias de + passagem se encontram + permanentemente + desobstruídas (Portaria + n.º987/93 – art.4º.)   + + + + + + 2   + + + 2   + + + 4   + BAIXO   + + + +   +   + + + 1 + Risco de desconforto térmico +   + + + 1 + O valor de temperatura deve + situar-se no intervalo de + valores recomendados (18 a + 22ºC, podendo atingir os + 25ºC em determinadas + condições climatéricas) + (Decreto Lei n.º243/86 – + art.11º-1a);   + + + 2 + O valor de humidade relativa + da atmosfera de trabalho + deve situar-se no intervalo + de valores recomendados (50 + a 70%) (Decreto-Lei + n.º243/86 – art.11º- 1b).   + + + Os valores de temperatura em + toda a área de escritórios + variaram entre + 21,1 ºC + e + 22 ºC + . Todos os valores + apresentados estão de acordo + com os valores recomendáveis + para o tipo de actividade + que aí se desenvolve. +   + + + Os valores de humidade + relativa da atmosfera de + trabalho em toda a área de + escritórios variaram entre + 27,3% + e + 29,2%. + Todos os valores + apresentados são inferiores + aos valores recomendáveis + para o tipo de actividade + que aí se desenvolve. +   + + + + + +   +   +   +   + + + + + + + + + + + + + + + AVALIAÇÃO DE RISCOS LABORAIS   + + + + +   + + EMPRESA + : Auchan +   + + + +   + + DATA DA AVALIAÇÃO + : 6 de Março de 2008 +   + + + + + AVALIAÇÃO: INICIAL + + ¨ + PERIÓDICA + þ + +   + + + + + +   + ESTABELECIMENTO: Coimbra   + + +   + + DATA DA PRÓXIMA + : 25 de Setembro de 2008 +   + + + + REALIZADA POR: Sónia Campos   + SIPRP – Sociedade Ibérica de + Prevenção de Riscos + Profissionais   + + + + + + POSTO DE TRABALHO + : + Genérico Ãrea Administrativa +   + + + + Página 4 de 11   + + + + + SEV.   + (S)   + + + PROB.   + (P)   + + + VALOR RISCO   + (S x P)   + + + RISCO / CONDIÇÕES ANÓMALAS /   + / ACÇÕES DE CONTROLO OU REDUÇÃO + DO RISCO   + + + + + 2   + + + 2   + + + 4   + BAIXO   + + +   + + 1 + Risco de exposição ao ruído +   + + + 1 + + O empregador assegura + que a exposição dos + trabalhadores ao ruído + durante o trabalho seja + reduzida ao nível mais + baixo possível e, em + qualquer caso, não + superior aos valores + limite de exposição de + 87 dB (A) e 140 dB (C) ( + Decreto Lei nº 182/2006 + -Art. 8º 1 + ); +   + + + + 1 + + O nível sonoro contínuo + equivalente médio obtido + (nas áreas + administrativas) variou + entre + 42 dB(A) e 70 dB (A), + pelo que (e em condições + normais de + funcionamento) a + Exposição pessoal diária + ao ruído, a média + semanal dos valores + diários da exposição + pessoal ao ruído e o + nível de pressão sonora + de pico deverá ser + inferior aos valores + limite. +   + + + + + + + 2   + + + 2   + + + 4   + BAIXO   + + +   + + 1 + Risco de contacto eléctrico + na utilização da instalação + e equipamentos eléctricos   + + + 1 + Toda a instalação eléctrica + deverá encontrar-se de + acordo com a Portaria nº + 949-A/2006 de 11 de Setembro + de 2006, que aprova as + regras técnicas das + instalações eléctricas de + baixa tensão.   + + Os colaboradores deverão estar + sensibilizados para a utilização + correcta da electricidade, de + forma a evitar situações de + sobrecarga das fontes de energia + (fichas triplas e extensões + sobrecaregadas)   + + + + + 2   + + + 2   + + + 4   + BAIXO   + + +   + + 1 + Risco de contacto com + objectos perfurantes e/ou + cortantes   + +   + + 1 + Assegurar a sua substituição + quando apresentarem um + elevado estado de degradação + (Decreto Lei n.º441/91 – + art.15ºb)   + + + 2 + Mantê-los arrumados após + cada utilização (Decreto Lei + n.º441/91 – art.15ºb)   + + + + + +   +   + + + + + + + + + + + + + AVALIAÇÃO DE RISCOS LABORAIS   + + + + +   + + EMPRESA + : Auchan +   + + + +   + + DATA DA AVALIAÇÃO + : 6 de Março de 2008 +   + + + + + AVALIAÇÃO: INICIAL + + ¨ + PERIÓDICA + þ + +   + + + + + +   + ESTABELECIMENTO: Coimbra   + + +   + + DATA DA PRÓXIMA + : 25 de Setembro de 2008 +   + + + + REALIZADA POR: Sónia Campos   + SIPRP – Sociedade Ibérica de + Prevenção de Riscos + Profissionais   + + + + + + POSTO DE TRABALHO + : + Genérico Ãrea Administrativa +   + + + + Página 5 de 11   + + + + + SEV.   + (S)   + + + PROB.   + (P)   + + + VALOR RISCO   + (S x P)   + + + RISCO / CONDIÇÕES ANÓMALAS /   + / ACÇÕES DE CONTROLO OU REDUÇÃO + DO RISCO   + + + + + 2   + + + 2   + + + 4   + BAIXO   + + +   + + 1 + Risco de queda ao mesmo + nível   + + + 1 + + Manter o pavimento dos + locais de trabalho + isentos de obstáculos + que possam provocar + quedas ( + Portaria n.º987/93 – + art.10º + ) +   + + + Identificar as áreas de trabalho + onde se verifica acumulação de + cablagens diversas em espaços de + circulação e rotear devidamente + (ou colocar no interior de calha + técnica) os referidos cabos para + que estes não representem risco + de queda para os trabalhadores   + + +   + + + + + -   + + + -   + + + INDETERMINADO   + + +   + + 1 + Inexistência de sinalização + adequada de segurança e + saúde   + + + 1 + + Os sinais devem ser + instalados em local bem + iluminado, a altura e em + posição apropriadas, + tendo em conta os + impedimentos à sua + visibilidade desde a + distância julgada + conveniente ( + Portaria n.º1456-A/95 – + Art. 6º-1 + ); +   + + + + 2 + Limpar e verificar + regularmente os meios de + sinalização de segurança + (Portaria nº 1456-A/95 – + Art. 4º);   + + + 3 + Informar, consultar e formar + os trabalhadores sobre a + sinalização de segurança e + saúde (Decreto Lei nº 141/95 + – Art. 9º).   + + Assegurar que a sinalização de + segurança e emergência se + encontra permanentemente + actualizada   +   + + +   + + + + +   +   +   +   +   + + + + + + + + + + + + AVALIAÇÃO DE RISCOS LABORAIS   + + + + +   + + EMPRESA + : Auchan +   + + + +   + + DATA DA AVALIAÇÃO + : 6 de Março de 2008 +   + + + + + AVALIAÇÃO: INICIAL + + ¨ + PERIÓDICA + þ + +   + + + + + +   + ESTABELECIMENTO: Coimbra   + + +   + + DATA DA PRÓXIMA + : 25 de Setembro de 2008 +   + + + + REALIZADA POR: Sónia Campos   + SIPRP – Sociedade Ibérica de + Prevenção de Riscos + Profissionais   + + + + + + POSTO DE TRABALHO + : + Genérico Ãrea Administrativa +   + + + + Página 6 de 11   + + + + + SEV.   + (S)   + + + PROB.   + (P)   + + + VALOR RISCO   + (S x P)   + + + RISCO / CONDIÇÕES ANÓMALAS /   + / ACÇÕES DE CONTROLO OU REDUÇÃO + DO RISCO   + + + + + -   + + + -   + + + INDETERMINADO   + + +   + + 1 + Existência de iluminação de + emergência de segurança   + + + 1 + A instalação de iluminação + de emergência de segurança + deverá permitir, em caso de + avaria da instalação normal, + a evacuação segura e fácil + do público para o exterior e + a execução das manobras + respeitantes à segurança e à + intervenção de socorros + (Portaria nº 740/74 – art. + 446º);   + + + 2 + A instalação de iluminação + de emergência deverá + assegurar a iluminação de + ambiente e a de circulação + (Portaria nº 740/74 – art. + 446º   + + + + + + -   + + + -   + + + INDETERMINADO   + + +   + + 1 + Organização dos meios de + evacuação e emergência   + + + 1 + Nos caminhos de evacuação + não devem ser colocados + obstáculos susceptíveis de + dificultarem a circulação e + poderem também constituir um + risco de propagação de + incêndio (Decreto Lei nº + 368/99 de 18 de Setembro + Anexo 2.1.5);   + + + 2 + + Assegurar que os + colaboradores se + encontram + suficientemente + instruídos sobre os + planos de evacuação dos + locais de trabalho + (Decreto Lei n.º 243/86 + – art.37º-1); +   + + + + 3 + As vias normais e de + emergência têm de estar + permanentemente + desobstruídas e em condições + de utilização, devendo o + respectivo traçado conduzir, + o mais rapidamente possível, + a áreas ao ar livre ou a + zonas de segurança (Portaria + nº 987/93 – 4º – 1);   + + + 4 + A instalação de cada posto + de trabalho deve permitir a + evacuação rápida e em máxima + segurança dos trabalhadores + (Portaria nº 987/93 – 4º – + 3).   + + + + + +   +   + + + + + + + + + + + + + + AVALIAÇÃO DE RISCOS LABORAIS   + + + + +   + + EMPRESA + : Auchan +   + + + +   + + DATA DA AVALIAÇÃO + : 6 de Março de 2008 +   + + + + + AVALIAÇÃO: INICIAL + + ¨ + PERIÓDICA + þ + +   + + + + + +   + ESTABELECIMENTO: Coimbra   + + +   + + DATA DA PRÓXIMA + : 25 de Setembro de 2008 +   + + + + REALIZADA POR: Sónia Campos   + SIPRP – Sociedade Ibérica de + Prevenção de Riscos + Profissionais   + + + + + + POSTO DE TRABALHO + : + Genérico Ãrea Administrativa +   + + + + Página 7 de 11   + + + + + SEV.   + (S)   + + + PROB.   + (P)   + + + VALOR RISCO   + (S x P)   + + + RISCO / CONDIÇÕES ANÓMALAS /   + / ACÇÕES DE CONTROLO OU REDUÇÃO + DO RISCO   + + + + + -   + + + -   + + + INDETERMINADO   + + +   + + 1 + Utilização de equipamentos + de trabalho (máquinas, + ferramentas ou instalações) +   + +   + + 1 + O empregador tem de + assegurar que os + equipamentos de trabalho são + adequados ou + convenientemente adaptados + ao trabalho a efectuar; + atender às condições e + características do trabalho + e aos riscos existentes na + escolha dos equipamentos de + trabalho; considerar os + postos de trabalho, posição + dos trabalhadores e os + princípios ergonómicos no + decorrer da utilização dos + equipamentos; e assegurar a + sua adequada manutenção + (Decreto Lei nº 50/2005 – + art. 3º)   + + + 2 + O empregador deve prestar a + trabalhadores e + representantes para a + segurança, higiene e saúde + do trabalho a informação + adequada sobre os + equipamentos de trabalho + utilizados (Decreto Lei nº + 50/2005 – art. 8º);   + + + 3 + O empregador deve consultar + por escrito, previamente e + em tempo útil, os + representantes dos + trabalhadores ou, na sua + ausência, os trabalhadores + sobre os equipamentos de + trabalho utilizados, pelo + menos duas vezes por ano + (Decreto Lei nº 50/2005 – + art. 9º)   + + + + + +   +   +   +   +   +   +   +   +   +   +   +   + + + + + + + + + + + + AVALIAÇÃO DE RISCOS LABORAIS   + + + + +   + + EMPRESA + : Auchan +   + + + +   + + DATA DA AVALIAÇÃO + : 6 de Março de 2008 +   + + + + + AVALIAÇÃO: INICIAL + + ¨ + PERIÓDICA + þ + +   + + + + + +   + ESTABELECIMENTO: Coimbra   + + +   + + DATA DA PRÓXIMA + : 25 de Setembro de 2008 +   + + + + REALIZADA POR: Sónia Campos   + SIPRP – Sociedade Ibérica de + Prevenção de Riscos + Profissionais   + + + + + + POSTO DE TRABALHO + : + Genérico Ãrea Administrativa +   + + + + Página 8 de 11   + + + + + SEV.   + (S)   + + + PROB.   + (P)   + + + VALOR RISCO   + (S x P)   + + + RISCO / CONDIÇÕES ANÓMALAS /   + / ACÇÕES DE CONTROLO OU REDUÇÃO + DO RISCO   + + + + + -   + + + -   + + + INDETERMINADO   + + +   + + 1 + Existência de armário, caixa + ou bolsa com conteúdo mínimo + destinado aos primeiros + socorros   + +   + + 1 + O conteúdo dos armários, + caixas ou bolsas, deve ser + mantido em condições de + assepsia, convenientemente + conservado, etiquetado e + imediatamente substituído + após a sua utilização + (Decreto Lei n.º243/86 – + art.º28º-2);   + + + 2 + Deverão existir instruções + claras e simples para os + primeiros cuidados a pôr em + prática em caso de + emergência junto dos + armários, caixas ou bolsas + de primeiros socorros + (Decreto Lei n.º243/86 – + art.º28º-4).   + + + + + +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   + + + + + + + + + + + + + AVALIAÇÃO DE RISCOS LABORAIS   + + + + +   + + EMPRESA + : Auchan +   + + + +   + + DATA DA AVALIAÇÃO + : 6 de Março de 2008 +   + + + + + AVALIAÇÃO: INICIAL + + ¨ + PERIÓDICA + þ + +   + + + + + +   + ESTABELECIMENTO: Coimbra   + + +   + + DATA DA PRÓXIMA + : 25 de Setembro de 2008 +   + + + + REALIZADA POR: Sónia Campos   + SIPRP – Sociedade Ibérica de + Prevenção de Riscos + Profissionais   + + + + + + POSTO DE TRABALHO + : + Genérico Ãrea Administrativa +   + + + + Página 9 de 11   + + + + + SEV.   + (S)   + + + PROB.   + (P)   + + + VALOR RISCO   + (S x P)   + + + RISCO / CONDIÇÕES ANÓMALAS /   + / ACÇÕES DE CONTROLO OU REDUÇÃO + DO RISCO   + + + + + -   + + + -   + + + INDETERMINADO   + + +   + + 1 + Risco de exposição a + contaminantes químicos e + biológicos   + + + 1 + O empregador deve assegurar + que as exposições aos + agentes químicos, físicos e + biológicos nos locais de + trabalho não constituam + risco para a saúde dos + trabalhadores (Lei nº 99/03 + – Art.273º -2c);   + + + 2 + Os níveis de concentração de + substâncias nocivas + existentes no ar não podem + ultrapassar os definidos em + legislação específica + (Portaria nº 987/93 – art.6º + - 5);   + + + 3 + As instalações e + equipamentos devem possuir + um plano de manutenção + preventiva que estabeleça + claramente as tarefas de + manutenção previstas, + nomeadamente o registo das + análises periódicas da + Qualidade do Ar Interior, + com indicação do técnico ou + técnicos que as realizaram + (Decreto Lei nº 79/2006 – + Art.19º- 2).   + + + 4 + Limpar e desinfectar todo o + equipamento no mínimo duas + vezes por ano e Verificar + regularmente o estado de + limpeza dos filtros e + proceder à sua limpeza + sempre que se justifique + (Direcção Geral da Saúde);   + + + 5 + + Realizar avaliações + microbiológicas + periódicas no interior + do sistema de ar + condicionado. + (Decreto-Lei 78/2006 e + Decreto-Lei 79/2006) - + próxima auditoria a + realizar até ao final de + 2009 + . +   + + + As embalagens de toner vazias + devem ser sempre armazenar em + local afastado dos locais de + trabalho   +   + + + + +   +   +   +   +   +   +   + + + + + + + + + + + + + + + AVALIAÇÃO DE RISCOS LABORAIS   + + + + +   + + EMPRESA + : Auchan +   + + + +   + + DATA DA AVALIAÇÃO + : 6 de Março de 2008 +   + + + + + AVALIAÇÃO: INICIAL + + ¨ + PERIÓDICA + þ + +   + + + + + +   + ESTABELECIMENTO: Coimbra   + + +   + + DATA DA PRÓXIMA + : 25 de Setembro de 2008 +   + + + + REALIZADA POR: Sónia Campos   + SIPRP – Sociedade Ibérica de + Prevenção de Riscos + Profissionais   + + + + + + POSTO DE TRABALHO + : + Genérico Ãrea Administrativa +   + + + + Página 10 de 11   + + + + + SEV.   + (S)   + + + PROB.   + (P)   + + + VALOR RISCO   + (S x P)   + + + RISCO / CONDIÇÕES ANÓMALAS /   + / ACÇÕES DE CONTROLO OU REDUÇÃO + DO RISCO   + + + + + -   + + + -   + + + INDETERMINADO   + + +   + + 1 + Existência de informação no + domínio da segurança, + higiene e saúde do trabalho +   + + + 1 + + Garantir a existência de + informação actualizada + sobre (Lei nº 99/2003 de + 27 de Agosto + art. 272 + º): +   + + + + 1 + Riscos para a segurança e + saúde, medidas de protecção + e de prevenção e a forma + como se aplicam;   + + + 2 + Medidas e instruções a + adoptar em caso de perigo + grave e iminente;   + + + 3 + Medidas de primeiros + socorros, de combate a + incêndios e de evacuação dos + trabalhadores em caso de + sinistro, bem como os + trabalhadores ou serviços + encarregados de as pôr em + prática.   + + + + + + -   + + + -   + + + INDETERMINADO   + + +   + + 1 + Formação no domínio da + segurança, higiene e saúde + do trabalho   + +   + + 1 + + Proporcionar formação + adequada e suficiente no + domínio da segurança, + higiene e saúde do + trabalho, tendo em conta + as respectivas funções e + o posto de trabalho ( + Lei nº 35/04 – art. 216º + ); +   + + + + 2 + + Formar em número + suficiente os + trabalhadores + responsáveis pela + aplicação das medidas de + primeiros socorros, de + combate a incêndios e de + evacuação de + trabalhadores, bem como + facultar-lhes o material + adequado ( + Lei nº 35/04 – art. 217º + ). +   + + + + + + +   +   +   +   +   +   +   + + + + + + + + + + + + AVALIAÇÃO DE RISCOS LABORAIS   + + + + +   + + EMPRESA + : Auchan +   + + + +   + + DATA DA AVALIAÇÃO + : 6 de Março de 2008 +   + + + + + AVALIAÇÃO: INICIAL + + ¨ + PERIÓDICA + þ + +   + + + + + +   + ESTABELECIMENTO: Coimbra   + + +   + + DATA DA PRÓXIMA + : 25 de Setembro de 2008 +   + + + + REALIZADA POR: Sónia Campos   + SIPRP – Sociedade Ibérica de + Prevenção de Riscos + Profissionais   + + + + + + POSTO DE TRABALHO + : + Genérico Ãrea Administrativa +   + + + + Página 11 de 11   + + + + + SEV.   + (S)   + + + PROB.   + (P)   + + + VALOR RISCO   + (S x P)   + + + RISCO / CONDIÇÕES ANÓMALAS /   + / ACÇÕES DE CONTROLO OU REDUÇÃO + DO RISCO   + + + + + -   + + + -   + + + INDETERMINADO   + + +   + + 1 + Representante dos + trabalhadores para a + segurança, higiene e saúde + no trabalho   + +   + + 1 + + Os trabalhadores ou o + sindicato que tenha + trabalhadores + representados na empresa + promovem a eleição dos + representantes dos + trabalhadores para a + segurança, higiene e + saúde do trabalho ( + Lei nº 35/04 – art. 266º + ). +   + + + + + + + -   + + + -   + + + INDETERMINADO   + + +   + + 1 + Comissão de higiene e + segurança no trabalho   + +   + + 1 + + Podem ser criadas + comissões de higiene e + segurança no trabalho de + composição paritária + (Lei + nº 35/04 – art. 215º + ). +   + + + + + + +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   + + + + + +   +   +   + + + + + + Avaliação Periódica de Riscos Laborais +   +   + + + 113 + +   + + + +   +   + 9. PLANO DE ACTUAÇÃO   +   + A partir dos resultados da avaliação de riscos, + é elaborado um outro documento (Plano de + Actuação), que inclui a listagem das acções que + deverão ser realizadas de modo a eliminar, + reduzir ou controlar os riscos detectados.   + + Este Plano permitirá auxiliar a + AUCHAN + - + Loja de Coimbra + na programação e acompanhamento das + referidas acções. +   + +   +   + 10. CONSIDERAÇÕES FINAIS   +   + + A equipa técnica de Segurança e Higiene do + Trabalho da SIPRP agradece a colaboração de + todos os colaboradores da + AUCHAN + - + Loja de Coimbra + durante a realização desta auditoria, + ficando à disposição para qualquer + esclarecimento. +   + +   +   +   + Lisboa, 29 de Abril de 2008   +   + + + + + +   + Sónia Campos   + Ergonomista   + Téc. Sup. Seg. Hig. do Trabalho +   + (CAP nº 0601/6505/02)   + + + + +   +   +   +   + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/relatorio_old_2.xsl b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/relatorio_old_2.xsl new file mode 100644 index 00000000..89c379af --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/relatorio_old_2.xsl @@ -0,0 +1,4391 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ATRIUM SALDANHA   + + + Praça Duque de Saldanha, 1 – 9º G   + + + 1050 – 094 Lisboa   + + + Telefone (+351) 213 504 540   + + + Fax (+351) 213 504 549   + + + geral@siprp.pt   + + + www.siprp.com   + + + + + Lisboa   + + + + + de + + + + + + + + + + AVALIAÇÃO DE RISCOS LABORAIS   + + + Relatório + + +   + + +   + + +   + + + + + + + + +   + + +   + + + + + + - + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + +   + + + ÃNDICE + + + + 1. INTRODUÇÃO + + + + + + + 2. DADOS DA EMPRESA + + + + + + + 3. LEGISLAÇÃO APLICÃVEL + + + + + + + 3.1 Legislação de aplicação geral + + + + + + + 3.2 Legislação específica + + + + + + + 4. NORMALIZAÇÃO APLICÃVEL + + + + + + + 4.1 Normalização portuguesa + + + + + + + 4.2 Normalização internacional + + + + + + + 5. OBRIGAÇÕES LEGAIS + + + + + + + 5.1 Obrigações do empregador + + + + + + + 5.2 Obrigações do trabalhador + + + + + + + 6. EQUIPAMENTOS UTILIZADOS + + + + + + + 7. RISCOS LABORAIS + + + + + + + 7.1 Classificação dos riscos profissionais + + + + + + + 7.2 Valoração dos riscos + + + + + + + 8. AVALIAÇÃO DE RISCOS LABORAIS + + + + + + + 9. PLANO DE ACTUAÇÃO + + + + + + + 10. CONSIDERAÇÕES FINAIS + + + + + +   + + +   + + + + 1. INTRODUÇÃO   + + +   + + + A entidade empregadora deve tomar todas as + medidas necessárias para a defesa da segurança e + saúde dos seus trabalhadores, mediante a criação + de um sistema organizado, dotado dos meios + necessários, que deve abranger as medidas de + eliminação e de controlo dos riscos, assim como + de formação, informação e consulta a empreender. +   + + + + De acordo com a Lei nº 35/2004 de 29 de + Julho, que contém os princípios que visam + promover a segurança, higiene e saúde do + trabalho, o empregador deve + + + “Integrar no conjunto de actividades da + empresa … a avaliação dos riscos para a + segurança e saúde dos trabalhadores, com a + adopção de convenientes medidas de + prevenção.†+ +   + + + Tendo em vista assegurar condições adequadas de + segurança, higiene e saúde dos trabalhadores, + são realizadas auditorias de segurança, no + decorrer das quais:   + + + + + + • + + + + + é recolhida informação através das + visitas aos locais de trabalho, do + diálogo estabelecido com os + trabalhadores ou através de outras + fontes de informação; + + + + + + + • + + + + + é listado o conjunto de factores de + risco inerentes às condições normais + de laboração ou aos acontecimentos + não planeados mas previsíveis;   + + + + + + + • + + + + + são identificados os trabalhadores + potencialmente expostos a riscos + resultantes dos factores de risco + identificados;   + + + + + + + • + + + + + é recolhida informação relativa à + existência de grupos específicos + (jovens, grávidas, puérperas, + lactantes);   + + + + + + + • + + + + + são identificados os trabalhadores + envolvidos em trabalhos proibidos, + condicionados ou não recomendados;   + + + + + + + • + + + + + são identificadas as situações de + perigo grave ou iminente.   + + + + + + A avaliação dos riscos laborais consiste + portanto, na análise estruturada de todos os + aspectos inerentes ao trabalho, concretizada + através da identificação, estimação e valoração + dos riscos existentes (com indicação dos + trabalhadores a eles expostos) e da definição + das medidas de prevenção ou protecção adequadas. +   + + +   + + + +   + + + 2. DADOS DA EMPRESA   + + +   + + + No dia + + + de + + de + + + + realizou-se a auditoria às instalações da + empresa + + + + – + + + , situada na + + + + + (cuja actividade desenvolvida é de + + ) para a avaliação das condições de + segurança, higiene e saúde do trabalho + existentes. + +   + + + + + + Para a realização da visita, a Técnica Superior + de Segurança e Higiene do Trabalho da Sociedade + Ibérica de Prevenção de Riscos Profissionais + Unipessoal Lda., obteve a colaboração e + acompanhamento de + + ( + + ) + + e + ( + + ) + + na prestação de informações relativas à + actividade desenvolvida e às condições de + trabalho existentes.   + + +   + + +   + + + 3. LEGISLAÇÃO APLICÃVEL   + + +   + + + A avaliação de riscos laborais realizada foi + baseada nas obrigações impostas pela legislação + portuguesa em vigor relativa à Segurança, + Higiene e Saúde do Trabalho.   + + +   + + + 3.1 Legislação de aplicação geral   + + + + + + + + + + + • + + + + + + + + . + + + ; + + + + + + + + +   + + + 3.2 Legislação específica   + + + + + + + + + + + + + + + • + + + + + + + + . + + + ; + + + + + + + + + +   + + + 4. NORMALIZAÇÃO APLICÃVEL   + + +   + + + Na realização da avaliação de riscos laborais + foi considerada além da legislação, também a + normalização relativa à Segurança, Higiene e + Saúde do Trabalho.   + + + 4.1 Normalização portuguesa   + + + + + + + + + + + • + + + + + + + + . + + + ; + + + + + + + + +   + + + 4.2 Normalização internacional   + + + + + + + + + + + • + + + + + + + + . + + + ; + + + + + + + + +   + + + 5. OBRIGAÇÕES LEGAIS   + + +   + + + De acordo com o Capítulo IV da Lei nº99/2003 de + 27 de Agosto são estabelecidas obrigações legais + para o empregador e trabalhador.   + + +   + + +   + + + 5.1 Obrigações do empregador   + + + De acordo com o artigo 273º da Lei nº99/2003 de + 27 de Agosto o empregador tem de:   + + + + + + - + + + + + Identificar os riscos previsíveis, + combatendo-os na origem, anulando-os + ou limitando os seus efeitos;   + + + + + + + - + + > + + + + Avaliar os riscos para a segurança e + saúde dos trabalhadores, com a + adopção de convenientes medidas de + prevenção;   + + + + + + + - + + > + + + + Assegurar que a exposição a agentes + químicos, físicos e biológicos não + constituam risco para a saúde;   + + + + + + + - + + > + + + + Considerar a componente técnica, + organização do trabalho, as relações + sociais e os factores materiais na + planificação da prevenção;   + + + + + + + - + + > + + + + Ter em conta os trabalhadores e + terceiros susceptíveis de serem + abrangidos pelos riscos e realização + de trabalhos;   + + + + + + + - + + > + + + + Dar prioridade à protecção colectiva + em relação às medidas de protecção + individual;   + + + + + + + - + + > + + + + Organizar o trabalho, procurando + eliminar eventuais efeitos nocivos + do trabalho monótono e cadenciado;   + + + + + + + - + + > + + + + Assegurar a vigilância adequada da + saúde dos trabalhadores em função + dos riscos a que se encontram + expostos; + + + + + + + - + + > + + + + Estabelecer medidas, identificar + trabalhadores responsáveis e + assegurar contactos necessários com + entidades exteriores em matéria de + primeiros socorros, combate a + incêndios e evacuação dos + trabalhadores;   + + + + + + + - + + > + + + + Permitir unicamente a trabalhadores + com aptidão e formação adequadas o + acesso (apenas durante o tempo + necessário) a zonas de risco grave; +   + + + + + + + - + + > + + + + Adoptar medidas e dar instruções que + permitam aos trabalhadores em caso + de perigo grave ou eminente que não + possa ser evitado, cessar a sua + actividade ou afastar-se + imediatamente do local de trabalho, + sem que possam retomar a actividade + enquanto persistir o perigo;   + + + + + + + - + + > + + + + Substituir o que é perigoso pelo que + é isento de perigo ou menos + perigoso;   + + + + + + + - + + > + + + + Dar instruções adequadas aos + trabalhadores;   + + + + + + + - + + > + + + + Ter em consideração se os + trabalhadores têm conhecimentos e + aptidões em matéria de SHST que lhes + permita exercer com segurança as + tarefas incumbidas.   + + + + + +   + + +   + + + 5.2 Obrigações do trabalhador   + + + + + + - + + > + + + + De acordo com o artigo 274º da Lei + nº99/2003 de 27 de Agosto os + trabalhadores têm de:   + + + + + + + - + + > + + + + Cumprir prescrições de SHST + estabelecidas e instruções + determinadas pelo empregador;   + + + + + + + - + + > + + + + Zelar pela sua segurança e saúde, + bem como pela das outras pessoas que + possam ser afectadas pelas suas + acções ou omissões no trabalho;   + + + + + + + - + + > + + + + Utilizar correctamente máquinas, + aparelhos, instrumentos, substâncias + perigosas e outros equipamentos e + meios postos à sua disposição + (equipamento de protecção colectiva + e individual) e cumprir os + procedimentos de trabalho + estabelecidos;   + + + + + + + - + + > + + + + Cooperar na melhoria do sistema de + SHST;   + + + + + + + - + + > + + + + Comunicar imediatamente (ao superior + hierárquico) as avarias e + deficiências por si detectadas que + se afigurem susceptíveis de originar + perigo grave e iminente (se não for + possível estabelecer contacto, + adoptar as medidas e instruções + estabelecidas), assim como qualquer + defeito verificado nos sistemas de + protecção;   + + + + + + + - + + > + + + + Adoptar as medidas e instruções + estabelecidas em caso de perigo + grave e iminente, se não for + possível estabelecer contacto + imediato com o superior hierárquico + ou com os trabalhadores que + desempenhem funções específicas nos + domínios da segurança, higiene e + saúde do trabalho.   + + + + + +   + + + + 6. EQUIPAMENTOS UTILIZADOS   + + +   + + + No decorrer da auditoria são realizadas medições + relativas aos níveis de iluminância, humidade + relativa, temperatura do ar, velocidade do ar e + do nível sonoro contínuo equivalente.   + + + Na realização das referidas medições são + utilizados os seguintes equipamentos + (devidamente calibrados):   + + + + + + + + + + + • + + + + + + + + . + + + ; + + + + + + + + +   + + +   + + + 7. RISCOS LABORAIS   + + +   + + +   + + + 7.1 Classificação dos riscos profissionais   + + + Os riscos profissionais encontram-se + relacionados com a Segurança, a Higiene, a + Ergonomia e a Psicossociologia do Trabalho.   + + + + Segurança do Trabalho + + + : contacto directo/indirecto com a + electricidade, projecção de fragmentos ou + partículas. + + + + + Higiene do Trabalho + + : + + + + Riscos físicos + + : exposição a ruído, vibrações, radiações + (ionizantes e não ionizantes), condições + inadequadas de iluminação; + + + + Riscos químicos + + : exposição a agentes químicos no estado sólido + (poeiras, fibras e fumos), líquido (aerossóis e + neblinas) e gasoso (gases e vapores); + + + + Riscos biológicos + + : exposição a contaminantes biológicos (vírus, + bactérias, fungos e parasitas). + + + + Ergonomia do Trabalho + + : manipulação manual de cargas, adopção de + posturas incorrectas. + + + + Psicossociologia do Trabalho + + : realização de trabalho monótono e/ou complexo, + atendimento público, existência de conflitos + interpessoais. + + +   + + + 7.2 Valoração dos riscos   + + + A valoração dos riscos associados as perigos + identificados tem como objectivo a definição de + prioridades da execução das medidas preventivas + (hierarquização dos riscos).   + + + Para realizar a valoração de um risco laboral é + necessário atender à + + probabilidade + + de ocorrência (quantas vezes pode ocorrer?) e da + estimativa da + + severidade + + (gravidade) das consequências da sua + materialização (que dano/lesão pode resultar?). + + + As consequências de um risco laboral podem ser + caracterizadas em danos muito leves, em lesões + leves, lesões graves ou lesões muito graves ou + morte.   + + + No seguinte quadro encontram-se descritos alguns + exemplos de consequências de acordo com o grau + de severidade.   + + +   + + + + + + + + + SEVERIDADE (S)   + + + + + CONSEQUÊNCIAS PREVISÃVEIS   + + + + + + + Danos muito leves   + + + + + - Pequenos ferimentos   + + + - Dor de cabeça ou outros + transtornos leves que não causem + baixa   + + + - Desconforto, fadiga visual   + + + - Em geral, lesões ou + transtornos que não requeiram + tratamento médico ou baixa + médica   + + + + + + + Lesão leve   + + + + + - Contusões, cortes + superficiais, entorses, + distensões   + + + - Irritações   + + + - Pequenas queimaduras + superficiais   + + + - Em geral, lesões ou + transtornos que requerem + tratamento médico e podem + ocasionar em alguns casos baixa + de curta duração   + + + + + + + Lesão grave   + + + + + - Lacerações   + + + - Queimaduras extensas   + + + - Comoções/Abalos físicos   + + + - Pequenas fracturas   + + + - Doença crónica que conduza a + uma incapacidade menor + (diminuição da audição, + dermatoses, asma)   + + + - Transtornos + músculo-esqueléticos   + + + + + + + Lesão muito grave/mortal   + + + + + - Amputações, lesões múltiplas   + + + - Facturas maiores   + + + - Intoxicações   + + + - Cancro   + + + - Doenças crónicas que afectam + severamente a vida   + + + - Incapacidades permanentes   + + + - Invalidez   + + + - Morte   + + + + + + +   + + +   + + + Um risco laboral pode ser classificado em + improvável, possível, provável ou inevitável, de + acordo com a probabilidade de se vir a + materializar; como se pode verificar no quadro + seguinte.   + + +   + + + + + + + + + PROBABILIDADE (P)   + + + + + CRITÉRIOS APLICADOS   + + + + + + + Improvável   + + + + + - Extremamente raro, ainda não + acorreu   + + + - Não existe exposição ao perigo + em condições normais de trabalho + ou é muito esporádica   + + + - O dano não é previsível que + ocorra   + + + + + + + Possível   + + + + + - É raro que possa ocorrer   + + + - Se já ocorreu alguma vez   + + + - Pode-se apresentar em + determinadas circunstâncias   + + + - A exposição ao perigo é + ocasional   + + + - O dano ocorreu várias vezes   + + + + + + + Provável   + + + + + - Não será estranho que ocorra o + dano   + + + - Já ocorreu em algumas + situações   + + + - Existência de vários + incidentes ou acidentes pela + mesma causa   + + + - Os sistemas e medidas + aplicadas para o controlo dos + riscos não impedem que este se + manifeste em qualquer momento da + exposição   + + + - O dano ocorrerá em algumas + ocasiões   + + + - A exposição ao perigo é + frequente ou afecta bastante + pessoas   + + + + + + + Inevitável   + + + + + - É o resultado mais provável + quando existe uma exposição + continuada ou afecta a muitas + pessoas   + + + - Ocorrerá a médio ou a longo + prazo   + + + - O dano ocorrerá sempre ou + quase sempre   + + + + + + +   + + + Com base na frequência da exposição e nas + consequências de um risco, é possível construir + uma matriz de falhas, na qual podem ser + atribuídas cores e números que evidenciem os + diferentes níveis de valoração do risco, como se + pode verificar no quadro seguinte.   + + +   + + + + + + + + + +   + + + + +   + + + PROBABILIDADE DE MATERIALIZAÇÃO + DO RISCO   + + + + + + + + GRAU DE SEVERIDADE POSSÃVEL   + + + + + IMPROVÃVEL   + + + 1   + + + + + POSSÃVEL   + + + 2   + + + + + PROVÃVEL   + + + 3   + + + + + INEVITÃVEL   + + + 4   + + + + + + + DANOS MUITO LEVES   + + + 1   + + + + + IRRELEVANTE   + + + 1   + + + + + MUITO BAIXO   + + + 2   + + + + + MUITO BAIXO   + + + 3   + + + + + BAIXO   + + + 4   + + + + + + + LESÃO LEVE   + + + 2   + + + + + MUITO BAIXO   + + + 2   + + + + + BAIXO   + + + 4   + + + + + MÉDIO   + + + 6   + + + + + ALTO   + + + 8   + + + + + + + LESÃO GRAVE   + + + 3   + + + + + MUITO BAIXO   + + + 3   + + + + + MÉDIO   + + + 6   + + + + + ALTO   + + + 9   + + + + + MUITO ALTO   + + + 12   + + + + + + + LESÃO MUITO GRAVE OU MORTAL   + + + 4   + + + + + BAIXO   + + + 4   + + + + + ALTO   + + + 8   + + + + + MUITO ALTO   + + + 12   + + + + + EXTREMAMENTE ALTO   + + + 16   + + + + + + +   + + +   + + + A determinação da valoração do risco permite + hierarquizar as intervenções, definir as acções + e estabelecer prazos de execução, como se + exemplifica no seguinte quadro:   + + +   + + + + + + + + + VALORAÇÃO DO RISCO   + + + + + RECOMENDAÇÕES   + + + + + + + Irrelevante   + + + + + Não é necessário estabelecer + nenhuma medida   + + + + + + + Muito baixo   + + + + + Não é necessário estabelecer + medidas adicionais às existentes +   + + + + + + + Baixo   + + + Prioridade: Baixa   + + + + + Controlar a situação que pode + materializar o risco   + + + + + + + Médio   + + + Prioridade: Média   + + + + + Verificar periodicamente a + eficácia das medidas de controlo + e melhorar a acção preventiva a + médio prazo (se as consequências + poderem ser muito graves ou + mortais, o prazo deve ser + reduzido)   + + + + + + + Alto   + + + Prioridade: Média/Alta   + + + + + Devem-se implementar medidas + para reduzir o risco a curto + prazo (se as consequências + poderem ser muito graves ou + mortais, o prazo deve ser + reduzido)   + + + + + + + Muito alto   + + + Prioridade: Alta   + + + + + Adoptar medidas provisórias + imediatas e definitivas para a + redução do risco a muito curto + prazo.   + + + Se o trabalho não se realiza + habitualmente, não se deve + iniciar sem que haja redução do + risco. Avaliar as medidas + adoptadas   + + + + + + + Extremamente alto   + + + Prioridade: Actuação imediata   + + + + + Não começar ou continuar o + trabalho até que se reduza o + risco. É necessário avaliar o + risco, uma vez corrigido.   + + + + + + +   + + + Alguns riscos laborais podem necessitar da + realização de estudos específicos, realizados de + acordo com os critérios estabelecidos na + legislação e normativa portuguesa e + internacional. Nesta situação, os riscos + laborais detectados podem ser classificados como + risco controlado, semi-controlado, incontrolado + e indeterminado, como é mostrado na tabela + seguinte.   + + +   + + + + + + + + + + RISCOS DE HIGIENE, ERGONOMICOS + OU PSICOSSOCIAIS DO TRABALHO   + + + + + CLASSIFICAÇÃO   + + + + + OBSERVAÇÕES   + + + + + + + Risco analisado/documentado.   + + + Informação suficiente.   + + + + + + + + + + + Controlado   + + +   + + + + + As medidas de + controlo + existentes são + adequadas   + + + + + + + Incontrolado   + + + + + As medidas de + controlo são + inexistentes, + insuficientes ou + inadequadas.   + + + + + + + + + + + Risco não estudado/analisado.   + + + Informação insuficiente.   + + + + + Indeterminado   + + + + + É necessário realizar estudo + específico   + + + + + +   + + Um risco analisado e documentado, é aquele que + tendo sido objecto de uma avaliação específica e + que se encontra documentado, registado e + disponível na empresa.   + + + + Um risco que foi analisado pode encontrar-se + + + controlado ou incontrolado + + + , sendo esta última situação referente ao + não cumprimento das medidas de controlo + aconselhadas nos + + + estudos realizados e à não realização de + novos estudos com a periodicidade + obrigatória. + +   + + + + Se não existe informação suficiente para + determinar a magnitude ou nível do risco e + poder adoptar as medidas adequadas, + classifica-se como risco + + + Indeterminado + + . +   + + +   + + + +   + + +   + + + 8. AVALIAÇÃO DE RISCOS LABORAIS   + + +   + + + Com base na informação recolhida no decorrer da + auditoria, foram elaboradas as tabelas de riscos + laborais que a seguir se apresentam, sendo estas + elaboradas por trabalhador (ou grupo de + trabalhadores com actividades semelhantes) e + para as instalações.   + + + Para cada um dos riscos identificados são + aconselhadas medidas preventivas e/ou + correctivas, de acordo com a legislação e + normativa vigente, tendo em vista a sua + eliminação, redução ou controlo para níveis + aceitáveis.   + + + ÃNDICE DAS TABELAS DE RISCO POR ÃREA DE + ACTIVIDADE + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + +   + + +   + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 9. PLANO DE ACTUAÇÃO   + + +   + + + A partir dos resultados da avaliação de riscos, + é elaborado um outro documento (Plano de + Actuação), que inclui a listagem das acções que + deverão ser realizadas de modo a eliminar, + reduzir ou controlar os riscos detectados.   + + + + Este Plano permitirá auxiliar a + + + + + - + + + + + na programação e acompanhamento das + referidas acções. + +   + + +   + + +   + + + 10. CONSIDERAÇÕES FINAIS + + +   + + + + A equipa técnica de Segurança e Higiene do + Trabalho da SIPRP agradece a colaboração de + todos os colaboradores da + + + + + - + + + + + durante a realização desta auditoria, + ficando à disposição para qualquer + esclarecimento. + +   + + +   + + +   + + +   + + + Lisboa, + + de + + de + + + +   + + + + + + + + + + + + + + + + + +   + + + + + + +   + + + Téc. Sup. Seg. Hig. do Trabalho +   + + + (CAP nº + + )   + + + + + + +   + + +   + + +   + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AVALIAÇÃO DE RISCOS LABORAIS   + + + + + + +   + + + + EMPRESA: + + + + + + + + + + +   + + + + ESTABELECIMENTO: + + + + + + + + + + + + DATA DA AVALIAÇÃO: + + + + de + + de + + +   + + + + + + AVALIAÇÃO: + + + + +   + + + + + + PRÓXIMA AVALIAÇÃO: + + + + de + + de + + +   + + + + + + + + REALIZADA POR: + + +  / SIPRP – + Sociedade Ibérica de Prevenção + de Riscos Profissionais   + + + + + + + + + POSTO DE TRABALHO: + + + + + + + + + + + + + + + + + + + + SEV.   + + + (S)   + + + + + PROB.   + + + (P)   + + + + + VALOR RISCO   + + + (S x P)   + + + + + RISCO / CONDIÇÕES ANÓMALAS /   + + + / ACÇÕES DE CONTROLO OU REDUÇÃO DO + RISCO   + + + + + + + + + +   + + + + +   + + + + +   + + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + +   + + +   + + + + + + + + - + + + + + + +   + + +   + + +   + + + + + + + + - + + + + + + +   + + +   + + +   + + + + + + + + IRRELEVANTE + + + MUITO BAIXO + + + MUITO BAIXO + + + BAIXO + + + MÉDIO + + + ALTO + + + ALTO + + + MUITO ALTO + + + EXTREMAMENTE ALTO + + + + + + + + + + + +   + + + + +   + + + + + + + + + + +   + + + + + + + - + + + + + + + + . + + + ; + + + + + + + +   + + + + + + + + . + + + ; + + + + +   + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + Avaliação + + + + + + + de Riscos Laborais + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/teste_input.xml b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/teste_input.xml new file mode 100644 index 00000000..b4a8f8c5 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/teste_input.xml @@ -0,0 +1,133 @@ + + + + + COMPANHIA PORTUGUESA DE HIPERMERCADOS + + ALVERCA + + http://www.evolute.pt/~siprp/planoactuacao/siprp_logo.jpg + rua do estabelecimento + + + 2008 + 4 + Abril + 29 + + + 2008 + 3 + Março + 1 + + + Lei nº 99/2003 de 27 de Agosto regulamentada pela Lei + nº 35/2004 de 29 de Julho – Aprova o novo Código + de Trabalho + Decreto-Lei n.º441/91 de 14 de Novembro, alterado pelo + Decreto-Lei n.º133/99 de 21 de Abril – Estabelece o + regime jurídico do enquadramento da segurança, + higiene e saúde do trabalho + Decreto-Lei n.º26/94, de 1 de Fevereiro, alterado pela + Lei n.º7/95 de 29 de Março e pelo Decreto-Lei + n.º109/2000 – Regime de Organização e + funcionamento dos serviços da segurança, higiene e + saúde do trabalho + + + + Acidentes de Trabalho e Doenças Profissionais + + + + Lei nº 99/2003 de 27 de Agosto regulamentada pela + Lei nº 35/2004 de 29 de Julho – Aprova o novo + Código de Trabalho + + + Decreto-Lei n.º441/91 de 14 de Novembro, alterado + pelo Decreto-Lei n.º133/99 de 21 de Abril – + Estabelece o regime jurídico do enquadramento da + segurança, higiene e saúde do trabalho + + + Decreto-Lei n.º26/94, de 1 de Fevereiro, alterado + pela Lei n.º7/95 de 29 de Março e pelo + Decreto-Lei n.º109/2000 – Regime de + Organização e funcionamento dos serviços + da segurança, higiene e saúde do trabalho + + + + + + Área Administrativa + + Areas comerciais + + + Areas comerciais + + + Areas comerciais + + + Areas comerciais + + + Areas comerciais + + + Areas comerciais + + + Areas comerciais + + + + Risco de exposição a condições + inadequadas de iluminação + + 6 + + + + Melhorar as condições de iluminação para valores + mínimos de 500 na área focal de trabalho e 300 + lux no seu envolvimento + + + Areas comerciais + + + + Cartazista + + + Frederico Palma + lampadas + + 2008 + 5 + Maio + 1 + + + 2009 + 5 + Maio + 1 + + OK + OK + OK + + + + Área Comercial + + + 1 + 2 + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/teste_input2.xml b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/teste_input2.xml new file mode 100644 index 00000000..d305826b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/print/teste_input2.xml @@ -0,0 +1,138 @@ + + + + + COMPANHIA PORTUGUESA DE HIPERMERCADOS + + ALVERCA + http://apdp/siprp/auchan_jumbo_lado.jpg + rua do estabelecimento + + + 2008 + 4 + Abril + 29 + + + 2008 + 3 + Março + 1 + + + + Lei nº 99/2003 de 27 de Agosto regulamentada pela Lei + nº 35/2004 de 29 de Julho – Aprova o novo Código + de Trabalho + + + Decreto-Lei n.º441/91 de 14 de Novembro, alterado pelo + Decreto-Lei n.º133/99 de 21 de Abril – Estabelece o + regime jurídico do enquadramento da segurança, + higiene e saúde do trabalho + + + Decreto-Lei n.º26/94, de 1 de Fevereiro, alterado pela + Lei n.º7/95 de 29 de Março e pelo Decreto-Lei + n.º109/2000 – Regime de Organização e + funcionamento dos serviços da segurança, higiene e + saúde do trabalho + + + + + Acidentes de Trabalho e Doenças Profissionais + + + + Lei nº 99/2003 de 27 de Agosto regulamentada pela + Lei nº 35/2004 de 29 de Julho – Aprova o novo + Código de Trabalho + + + Decreto-Lei n.º441/91 de 14 de Novembro, alterado + pelo Decreto-Lei n.º133/99 de 21 de Abril – + Estabelece o regime jurídico do enquadramento da + segurança, higiene e saúde do trabalho + + + Decreto-Lei n.º26/94, de 1 de Fevereiro, alterado + pela Lei n.º7/95 de 29 de Março e pelo + Decreto-Lei n.º109/2000 – Regime de + Organização e funcionamento dos serviços + da segurança, higiene e saúde do trabalho + + + + + + Área Administrativa + + Areas comerciais + + + Areas comerciais + + + Areas comerciais + + + Areas comerciais + + + Areas comerciais + + + Areas comerciais + + + Areas comerciais + + + + Risco de exposição a condições + inadequadas de iluminação + + 6 + + + + Melhorar as condições de iluminação para valores + mínimos de 500 na área focal de trabalho e 300 + lux no seu envolvimento + + + Areas comerciais + + + + Cartazista + + + Frederico Palma + lampadas + + 2008 + 5 + Maio + 1 + + + 2009 + 5 + Maio + 1 + + OK + OK + OK + + + + Área Comercial + + + 1 + 2 + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/revert.png b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/revert.png new file mode 100644 index 00000000..f7e5f935 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/revert.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/submit.png b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/submit.png new file mode 100644 index 00000000..7cb1f515 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/submit.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/importer/DataChooserWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/importer/DataChooserWindow.java new file mode 100644 index 00000000..00d9a541 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/importer/DataChooserWindow.java @@ -0,0 +1,199 @@ +/* + * DataChooserWindow.java + * + * Created on 29 de Abril de 2004, 16:53 + */ + +package siprp.importer; + +import java.awt.Container; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Hashtable; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; + +import com.evolute.utils.ui.CustomJDialog; +/** + * + * @author lflores + */ +public class DataChooserWindow extends CustomJDialog +{ + private final String labels[]; + private final Object items[]; + private final Object empty[]; + private final Object allItems[][]; + private final JComboBox combos[]; + private final int preselected[]; + + private boolean canceled = false; + + /** Creates a new instance of DataChooserWindow */ + public DataChooserWindow( JFrame modalFrame, String names[], Object data[][] ) + { + this( modalFrame, names, data, null ); + } + + public DataChooserWindow( JFrame modalFrame, String names[], Object data[][], int selected[] ) + { + super( modalFrame, true ); + labels = names; + items = data[ 0 ]; + empty = new String[ items.length ]; + for( int i = 0; i < empty.length; ++i ) + { + empty[ i ] = ""; + } + allItems = data; + combos = new JComboBox[ labels.length ]; + preselected = selected; + setupComponents(); + if( modalFrame == null ) + { + center(); + } + else + { + centerSuper(); + } + setVisible( true ); + } + + private void setupComponents() + { + setTitle( "Escolha os campos correspondentes:" ); + setSize(450, 120 + 25 * labels.length ); + GridBagLayout gbl = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + gbc.insets = new Insets( 2, 2, 2, 2 ); + gbc.fill = GridBagConstraints.HORIZONTAL; + Container cont = getContentPane(); + cont.setLayout( gbl ); + for( int i = 0; i < labels.length; ++i ) + { + gbc.weightx = 0; + gbc.gridwidth = 1; + JLabel label = new JLabel( labels[ i ] ); + gbl.setConstraints( label, gbc ); + cont.add( label ); +/* gbc.weightx = 1; + JPanel pad = new JPanel(); + gbl.setConstraints( pad, gbc ); + cont.add( pad ); +*/ gbc.weightx = 1; + gbc.gridwidth = GridBagConstraints.REMAINDER; + JComboBox combo = new JComboBox( items ); + int index; + if( preselected == null ) + { + index = Math.min( i, items.length - 1 ); + } + else + { + if( i < preselected.length ) + { + index = Math.min( preselected[ i ], items.length - 1 ); + if( index == -1 ) + { + index = items.length - 1; + } + } + else + { + index = items.length - 1; + } + + } + combo.setSelectedIndex( index ); + combos[ i ] = combo; + gbl.setConstraints( combo, gbc ); + cont.add( combo ); + } + gbc.insets = new Insets( 10, 2, 2, 2 ); + gbc.weightx = 1; + gbc.gridwidth = 2; + JPanel pad = new JPanel(); + gbl.setConstraints( pad, gbc ); + cont.add( pad ); + gbc.weightx = 0; + gbc.gridwidth = 1; + JButton butOK = new JButton( "OK" ); + gbl.setConstraints( butOK, gbc ); + cont.add( butOK ); + gbc.weightx = 0; + gbc.gridwidth = GridBagConstraints.REMAINDER; + JButton butCancel = new JButton( "Cancelar" ); + gbl.setConstraints( butCancel, gbc ); + cont.add( butCancel ); + butOK.addActionListener( new ActionListener() { + public void actionPerformed( ActionEvent e ) + { + setVisible( false ); + dispose(); + } + }); + butCancel.addActionListener( new ActionListener() { + public void actionPerformed( ActionEvent e ) + { + setVisible( false ); + dispose(); + canceled = true; + } + }); + } + + public Hashtable getData() + { + if( canceled ) + { + return null; + } + Hashtable hash = new Hashtable(); + for( int i = 0; i < labels.length; ++i ) + { + hash.put( labels[ i ], combos[ i ].getSelectedItem() ); + } + return hash; + } + + public Hashtable[] getMultipleData() + { + if( canceled ) + { + return null; + } + Hashtable hash[] = new Hashtable[ allItems.length ]; +//System.out.println( "Hash[] size: " + hash.length ); + for( int j = 0; j < hash.length; ++j ) + { + hash[ j ] = new Hashtable(); + } + for( int i = 0; i < labels.length; ++i ) + { + String sel = combos[ i ].getSelectedItem().toString(); + if( sel.length() > 0 ) + { + for( int j = 0; j < allItems.length; ++j ) + { + hash[ j ].put( labels[ i ], allItems[ j ][ combos[ i ].getSelectedIndex() ] ); + } + } + } + return hash; + } + +/* public static void main( String arg[] ) + { + String names[] = new String[] { "Nome:", "Morada:", "Telefone:" }; + String data[] = new String[] { "Joao Catita", "Damaiasdg sdfg sdf gsdfs hgf h", "nao tem", "so a noite", "" }; + DataChooserWindow dcw = new DataChooserWindow( null, names, data, new int[] { 3, 2 ,1 } ); + }*/ +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/importer/Importer.java b/branches/SIPRP/SIPRPSoft/src/siprp/importer/Importer.java new file mode 100644 index 00000000..cda6bedf --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/importer/Importer.java @@ -0,0 +1,369 @@ +package siprp.importer; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.Arrays; +import java.util.Hashtable; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.ListSelectionModel; + +import siprp.SingletonConstants; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Excel2DArray; +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.Virtual2DTableModel; +import com.evolute.utils.ui.CustomJDialog; + +/** + * + * @author psantos + */ +public class Importer extends CustomJDialog +{ + + private static final long serialVersionUID = 1L; + public static final int TYPE_ADMISSAO = 0; + public static final int TYPE_DEMISSAO = 1; + + public static final String DATA_PREFIX = "Data "; + + public static final String NOME = "Nome do Funcion\u00e1rio"; + public static final String SEXO = "Sexo"; + public static final String NACIONALIDADE = "Nacionalidade"; + public static final String DATA_NASCIMENTO = DATA_PREFIX + "Nascimento"; + public static final String NUMERO_MECANOGRAFICO = "N\u00famero Mecanogr\u00e1fico"; + public static final String DATA_ADMISSAO = DATA_PREFIX + "Admiss\u00e3o"; + public static final String CATEGORIA = "Categoria"; + public static final String LOCAL_TRABALHO = "Local Trabalho"; + public static final String FUNCAO = "Fun\u00e7\u00e3o"; + public static final String DATA_ADMISSAO_FUNCAO = DATA_PREFIX + "Admiss\u00e3o na Fun\u00e7\u00e3o"; + public static final String DATA_DEMISSAO = DATA_PREFIX + "Demiss\u00e3o"; + + private JPanel panel; + private BaseTable table; + private Excel2DArray e2da; + private boolean canceled = false; + private DataChooserWindow dcw; + private Object vals[][]; + private int[] DEFAULT_SELECTION = new int[]{ 0, 2, 3, 1, -1, 4, 5, 7, 6, -1 }; + private int[] DEFAULT_SELECTION_DEMISSAO = new int[]{ 0, 1 }; + + public static final String NAMES[] = new String[]{ + NOME, + SEXO, + NACIONALIDADE, + DATA_NASCIMENTO, + NUMERO_MECANOGRAFICO, + DATA_ADMISSAO, + CATEGORIA, + LOCAL_TRABALHO, + FUNCAO, + DATA_ADMISSAO_FUNCAO + }; + + public static final String NAMES_DEMISSAO[] = new String[]{ + NOME, + DATA_DEMISSAO + }; + private final boolean multipleSelection; + protected final int type; + + /** Creates a new instance of Importer */ + public Importer( JFrame modalFrame, String filename, boolean multiple, int type ) + throws Exception + { + super( modalFrame, true ); + multipleSelection = multiple; + this.type = type; + + int []selection = ( int [] ) Singleton.getInstance( SingletonConstants.EXCEL_FORMAT ); + if( selection != null ) + { + DEFAULT_SELECTION = selection; + } + int []selectionDemissao = ( int [] ) Singleton.getInstance( SingletonConstants.EXCEL_FORMAT_DEMISSAO ); + if( selectionDemissao != null ) + { + DEFAULT_SELECTION_DEMISSAO = selectionDemissao; + } + setupComponents( filename ); + if( modalFrame == null ) + { + center(); + } + else + { + centerSuper(); + } + setVisible( true ); + } + + private void setupComponents( String filename ) + { + setSize( 800, 500 ); + + GridBagLayout gblGridBag = new GridBagLayout(); + GridBagConstraints gbcConstraints = new GridBagConstraints(); + + panel = ( JPanel ) getContentPane(); + + panel.setLayout( gblGridBag ); + + e2da = new Excel2DArray( filename ); + + String colNames[] = new String[ e2da.rowLength() ]; + for( int i = 0; i < colNames.length; i++ ) + { + colNames[ i ] = " "; + } + Virtual2DTableModel tm = new Virtual2DTableModel( colNames, null ); + tm.setValues( e2da ); + table = new BaseTable( tm ); + int col = 0; + switch( type ) + { + case TYPE_ADMISSAO: + col = DEFAULT_SELECTION[ 0 ]; + break; + + case TYPE_DEMISSAO: + col = DEFAULT_SELECTION_DEMISSAO[ 0 ]; + break; + } + table.getColumn( col ).setWidth( 200 ); + if( !multipleSelection ) + { + table.getSelectionModel().setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + } + else + { + table.getSelectionModel().setSelectionMode( ListSelectionModel.SINGLE_INTERVAL_SELECTION ); + } + table.getTableHeader().setResizingAllowed( true ); + table.getTableHeader().setReorderingAllowed( false ); + // table.setAutoResizeMode( JTable.AUTO_RESIZE_OFF ); + + for( int i = 0; i < e2da.rowLength(); i++ ) + { + table.getColumn( i ).setMinWidth( 50 ); + //table.getColumn( i ).setResizable( true ); + } + + JScrollPane sp = new JScrollPane( table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + + gbcConstraints.anchor = GridBagConstraints.CENTER; + gbcConstraints.fill = GridBagConstraints.BOTH; + gbcConstraints.insets = new Insets(5, 5, 5, 5); + gbcConstraints.gridwidth = 3; + gbcConstraints.gridheight = 3; + gbcConstraints.weighty = 3; + gbcConstraints.gridx = 0; + gbcConstraints.gridy = 3; + gblGridBag.setConstraints( sp, gbcConstraints ); + + panel.add( sp ); + + JPanel jpButtons = new JPanel(); + final JButton jbOK = new JButton( "Escolher" ); + jbOK.setEnabled( false ); + jpButtons.add( jbOK ); + JButton jbCancel = new JButton( "Cancelar" ); + jpButtons.add( jbCancel ); + + gbcConstraints.gridheight = 1; + gbcConstraints.weightx = 1; + gbcConstraints.weighty = 0; + gbcConstraints.anchor = GridBagConstraints.SOUTH; + gbcConstraints.fill = GridBagConstraints.BOTH; + gbcConstraints.insets = new Insets( 2, 2, 2, 2 ); + gbcConstraints.gridwidth = 3; + gbcConstraints.gridx = 0; + gbcConstraints.gridy = 6; + gblGridBag.setConstraints( jpButtons, gbcConstraints ); + panel.add( jpButtons ); + + table.addMouseListener( new MouseAdapter() { + public void mouseClicked( MouseEvent e ) { + jbOK.setEnabled( true ); + if( e.getButton() == MouseEvent.BUTTON1 + && e.getClickCount() == 2 + && table.columnAtPoint( e.getPoint() ) != -1 + && table.rowAtPoint( e.getPoint() ) != -1 ) + { + acceptResult(); + } + } + public void mousePressed( MouseEvent e ) { + jbOK.setEnabled( true ); + } + }); + + jbOK.addActionListener( new ActionListener() { + public void actionPerformed( ActionEvent a ) { + acceptResult(); + } + }); + + jbCancel.addActionListener( new ActionListener() { + public void actionPerformed( ActionEvent a ) { + setVisible( false ); + dispose(); + canceled = true; + } + }); + + } + + private void acceptResult() + { + if( multipleSelection ) + { + int rows[] = table.getSelectedRows(); + vals = new Object[ rows.length ][]; + for( int i = 0; i < rows.length; ++i ) + { + Vector v = new Vector( Arrays.asList( e2da.getRow( rows[ i ] ) ) ); + v.add( "" ); + vals[ i ] = (Object[]) v.toArray( new Object[ v.size() ] ); + } + } + else + { + Vector v = new Vector( Arrays.asList( e2da.getRow( table.getSelectedRow() ) ) ); + v.add( "" ); + vals = new Object[][] { ( Object[] )v.toArray( new Object[ v.size() ] ) }; + } + +/* + System.out.println( "row: " + table.getSelectedRow() ); + System.out.print( "vals: " ); + for( int i = 0; i < vals.length; i++ ) + { + System.out.print( "[" + vals[ i ] + "]" ); + } + System.out.println(); +*/ + setVisible( false ); + dispose(); + + } + + public Hashtable getData() + { + if( NAMES == null || vals == null ) + { + return null; + } + dcw = new DataChooserWindow( null, NAMES, vals, DEFAULT_SELECTION ); + + if( canceled || ( dcw == null ) ) + { + return null; + } + + return dcw.getData(); + } + + public Hashtable[] getMultipleData() + { + switch( type ) + { + case TYPE_ADMISSAO: + if( NAMES == null || vals == null ) + { + return null; + } + dcw = new DataChooserWindow( null, NAMES, vals, DEFAULT_SELECTION ); + break; + + case TYPE_DEMISSAO: + if( NAMES_DEMISSAO == null || vals == null ) + { + return null; + } + dcw = new DataChooserWindow( null, NAMES_DEMISSAO, vals, DEFAULT_SELECTION_DEMISSAO ); + break; + } + + if( canceled || ( dcw == null ) ) + { + return null; + } + + return dcw.getMultipleData(); + } + + + public static void main( String args[] ) + { +// FileDialog fd = new FileDialog( null, "Escolha um ficheiro Excel:", FileDialog.LOAD ); +// fd.setDirectory( System.getProperty( "user.home" ) ); +// fd.setFilenameFilter( new FilenameFilter() { +// public boolean accept( File dir, String name ) +// { +// return (name!=null) && (name.indexOf( ".xls" ) != -1); +// } +// } ); +// fd.show(); + String filename = "c:\\teste_com_dados.xls"; + //String filename = fd.getFile(); + if( filename != null ) + { + //filename = fd.getDirectory() + File.separator + filename; + try + { + Importer importer = new Importer( null, filename, true, TYPE_ADMISSAO ); + Hashtable hash = importer.getData(); + if( hash != null ) + { + System.out.println( "Data: " + hash ); + } + } + catch( Exception ex ) + { + ex.printStackTrace(); + JOptionPane.showMessageDialog( null, "Erro a importar", "Erro...", JOptionPane.ERROR_MESSAGE ); + } + } +// Importer im = null; +// try +// { +// im = new Importer( null, +// "E:\\test.xls" +// "C:\\Documents and Settings\\psantos\\My Documents\\Devel\\teste.xls" +// "C:\\Documents and Settings\\psantos\\My Documents\\Devel\\Docs\\jexcelapi\\jxlrwtest.xls" +// ); +// +//System.out.println( "Escolhido: " + im.getData() ); +// +// } +// catch( Exception e ) +// { +// e.printStackTrace(); +// } + +// String[][] all = (String[][]) e.getObjects(); +// +// for( int j = 0; j < e.rowLength(); j++ ) +// { +// String[] r = e.getRow( j ); +// for( int i = 0; i < r.length; i++ ) +// { +// System.out.print( "[" + r[ i ] + "]" ); +// } +// System.out.println(); +// } + } +} \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/impressaofichas/FichasPrinter.java b/branches/SIPRP/SIPRPSoft/src/siprp/impressaofichas/FichasPrinter.java new file mode 100644 index 00000000..c8c4f2c7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/impressaofichas/FichasPrinter.java @@ -0,0 +1,174 @@ +/* + * FichasPrinter.java + * + * Created on 20 de Fevereiro de 2006, 0:43 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.impressaofichas; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.text.DateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.Hashtable; +import java.util.Locale; + +import javax.xml.transform.TransformerFactory; + +import siprp.printer.Printer; +import siprp.util.fop.FOPCreator; +import siprp.util.fop.FOPPrinter; +import siprp.util.fop.PDFCreator; + +import com.evolute.utils.Singleton; +import com.evolute.utils.date.DateUtils; +import com.evolute.utils.strings.StringPlainer; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.xml.SimpleXMLElement; + +/** + * + * @author Frederico + */ +public class FichasPrinter extends Thread +{ + protected static final DateFormat D_F = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); + protected static final DateFormat D_F_L = DateFormat.getDateInstance( DateFormat.LONG, new Locale( "pt", "PT" ) ); + + private ImpressaoFichasDataProvider provider; + + protected Integer ids[]; + protected String printerName; + protected String listPath; + protected String nomeEmpresa; + protected String nomeEstabelecimento; + + /** Creates a new instance of FichasPrinter */ + public FichasPrinter( Integer ids[], String printerName, String listPath, + String nomeEmpresa, String nomeEstabelecimento ) + { + this.ids = ids; + this.printerName = printerName; + this.listPath = listPath; + this.nomeEmpresa = nomeEmpresa; + this.nomeEstabelecimento = nomeEstabelecimento; + } + + public void run() + { + try + { + SimpleXMLElement root = new SimpleXMLElement( "LISTA_FICHAS" ); + for( int n = 0; n < ids.length; n++ ) + { + print( ids[ n ] ); + Object dados[] = provider.getDadosForExameID( ids[ n ] ); + SimpleXMLElement linha = new SimpleXMLElement( "FICHA" ); + linha.addElement( new SimpleXMLElement( "NOME", ( String ) dados[ 0 ] ) ); + linha.addElement( new SimpleXMLElement( "DATA_EXAME", D_F.format( ( Date ) dados[ 1 ] ) ) ); + linha.addElement( new SimpleXMLElement( "DATA_PROXIMO_EXAME", dados[ 2 ] != null ? D_F.format( ( Date ) dados[ 2 ] ) : "n/d" ) ); + root.addElement( linha ); + + try + { + sleep( (n % 5 == 0 && n > 0) ? 3000 : 2000 ); + } + catch( InterruptedException iex ) + { + } + } + Date today = ( Date ) Singleton.getInstance( Singleton.TODAY ); + Calendar cal = Calendar.getInstance(); + cal.setTime( today ); + SimpleXMLElement data = new SimpleXMLElement( "DATA_EXTENSO", DateUtils.WEEKDAYS_FULL_PT[ cal.get( Calendar.DAY_OF_WEEK ) - Calendar.MONDAY ] + + ", " + D_F_L.format( today ) ); + root.addElement( data ); + TransformerFactory tFactory = TransformerFactory.newInstance(); + String xml = root.toString(); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + FOPCreator creator = FOPCreator.getFOPCreator(); + InputStream xmlIn = new ByteArrayInputStream( xml.getBytes() ); + creator.createFOfromXML( xmlIn, + FichasPrinter.class.getClassLoader().getResourceAsStream( + "siprp/impressaofichas/lista_fichas.xsl" ), + out ); + byte toPrint[] = out.toByteArray(); + ByteArrayInputStream in = new ByteArrayInputStream( toPrint ); + Hashtable printOptions = new Hashtable(); +//System.out.println( "OUT: " + out.toString() ); +// printOptions.put( FOPPrinterConstants.FOP_MANDATORY_PRINTER_NAME, printerName ); + FOPPrinter.getFOPPrinter().printFO( in, false, true, printOptions ); + byte []pdfData = PDFCreator.getPDFCreator().createPdfFromFo( toPrint ); + File dir = new File( new File( listPath ), StringPlainer.convertString( nomeEmpresa ).replace( ' ', '_' ) ); + if( !dir.exists() ) + { + dir.mkdir(); + } + String fileName = StringPlainer.convertString( nomeEstabelecimento ).replace( ' ', '_' ) + + "_" + DateUtils.plainFormatDate( today ) + ".pdf"; + FileOutputStream fos = new FileOutputStream( new File( dir, fileName ) ); + fos.write( pdfData ); + fos.close(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a imprimir", true ); + } + ids = null; + } + + private void print( Integer exameID ) + throws Exception + { + if( provider == null ) + { + provider = ( ImpressaoFichasDataProvider ) ImpressaoFichasDataProvider.getProvider(); + } +// MetaObject exame = fdpProvider.load( fdpProvider.EXAMES, new DBKey( exameID ) ); +// ExameData exame = (ExameData) JDO.load( ExamesData.class, exameID ); +// byte pdf[] = (byte []) exame.get( ExamesData.PDF ); + + if( /* !printFO( exameID ) && */!printPDF( exameID ) ) + { + throw new Exception( "N\u00e3o existe exame" ); + } + } + + private boolean printFO(int exameID) throws Exception + { + boolean result = false; + byte[] fo = provider.getFO( exameID ); + if(fo != null) + { + Printer.printFO( fo ); + result = true; + } + return result; + } + + private boolean printPDF(int exameID) throws Exception + { + boolean result = false; + byte pdf[] = provider.getPDF( exameID ); + if( pdf != null ) + { + String nomeFicheiro = StringPlainer.convertString( provider.getNomeTrabalhadorForExameID( exameID ) ); + String split[] = nomeFicheiro.split( " " ); + nomeFicheiro = ""; + for( int n = 0; n < split.length; n++ ) + { + nomeFicheiro += split[n] + "_"; + } + Printer.printPDF( pdf, nomeFicheiro, printerName ); + result = true; + } + return result; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/impressaofichas/ImpressaoFichasDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/impressaofichas/ImpressaoFichasDataProvider.java new file mode 100644 index 00000000..8d999540 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/impressaofichas/ImpressaoFichasDataProvider.java @@ -0,0 +1,231 @@ +/* + * HigieneDataProvider.java + * + * Created on February 1, 2006, 10:49 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.impressaofichas; + +import java.text.DateFormat; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.Locale; +import java.util.Vector; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.metadb.MetaProvider; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +import com.evolute.utils.tables.ColumnizedMappable; + +/** + * + * @author fpalma + */ +public class ImpressaoFichasDataProvider extends MetaProvider +{ + private static final DateFormat DATE_FORMAT = + DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "PT", "pt" ) ); + + private static final Object LOCK = new Object(); + private static ImpressaoFichasDataProvider instance = null; + private final Executer executer; + + /** Creates a new instance of HigieneDataProvider */ + public ImpressaoFichasDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + executer = dbm.getSharedExecuter( this ); + } + + public static MetaProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new ImpressaoFichasDataProvider(); + } + } + return instance; + } + + public ColumnizedMappable[] getAllEmpresas() + throws Exception + { + Select select = + new Select( new String[]{ "empresas" }, + new String[]{ "id", "designacao_social", "designacao_social_plain" }, + new Field( "inactivo" ).isDifferent( "y" ), + new String[]{ "designacao_social_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + ColumnizedMappable empresas[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < empresas.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String designacao = ( String ) array.get( n, 1 ); + empresas[ n ] = new ColumnizedMappable( id, designacao ); + } + return empresas; + } + + public ColumnizedMappable[] getAllEstabelecimentosForEmpresa( Integer empresaID ) + throws Exception + { + Select select = + new Select( new String[]{ "estabelecimentos" }, + new String[]{ "id", "nome", "nome_plain" }, + new Field( "empresa_id" ).isEqual( empresaID ).and( + new Field( "inactivo" ).isDifferent( "y" ) ), + new String[]{ "nome_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + ColumnizedMappable estabelecimentos[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < estabelecimentos.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + estabelecimentos[ n ] = new ColumnizedMappable( id, nome ); + } + return estabelecimentos; + } + + public Object [][]getAllFichasForEstabelecimentoAndDatas( Integer estabelecimentoID, Date dataInicio, Date dataFim ) + throws Exception + { + Vector fichas = new Vector(); + Select select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "id", "nome", "nome_plain" }, + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ), + new String[]{ "nome_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + String nomePlain = ( String ) array.get( n, 2 ); + MappableObject fichasTrabalhador[] = getAllFichasForTrabalhadorAndDatas( id, dataInicio, dataFim ); + for( int f = 0; f < fichasTrabalhador.length; f++ ) + { + fichas.add( new Object[]{ fichasTrabalhador[ f ].getID(), nome, fichasTrabalhador[ f ].getValue(), nomePlain } ); + } + } + Object fichasArray[][] = ( Object[][] )fichas.toArray( new Object[ fichas.size() ][] ); + Arrays.sort( fichasArray, new Comparator(){ + public int compare( Object o1, Object o2 ) + { + Object arr1[] = ( Object[] )o1; + Object arr2[] = ( Object[] )o2; + int res = 0; + if( arr1[ 2 ] == null && arr2[ 2 ] == null ) + { + res = 0; + } + else if( arr1[ 2 ] == null ) + { + res = -1; + } + else if( arr2[ 2 ] == null ) + { + res = 1; + } + else + { + res = ( (Date)arr1[ 2 ]).compareTo( (Date)arr2[ 2 ] ); + } + + if( res == 0 ) + { + res = ( (String)arr1[ 3 ]).compareTo( (String)arr2[ 3 ] ); + } + return res; + } + } ); + for( int n = 0; n < fichasArray.length; n++ ) + { + fichasArray[ n ][ 2 ] = fichasArray[ n ][ 2 ] != null? DATE_FORMAT.format( (Date)fichasArray[ n ][ 2 ] ): ""; + } + return fichasArray; + } + + public MappableObject []getAllFichasForTrabalhadorAndDatas( Integer trabalhadorID, Date dataInicio, Date dataFim ) + throws Exception + { + Select select = + new Select( new String[]{ "exames" }, new String[]{ "MAX(id)", "data" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "inactivo" ).isEqual( "n" ) ).and( + new Field( "data" ).between( new Object[]{ dataInicio, dataFim } ) ), + new String[]{ "data DESC" }, new String[]{ "data" } ); + Virtual2DArray array = executer.executeQuery( select ); + MappableObject exames[] = new MappableObject[ array.columnLength() ]; + for( int n = 0; n < exames.length; n++ ) + { + Date date = (Date)array.get( n, 1 ); + Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() ); + exames[ n ] = new MappableObject( id, date ); + } + return exames; + } + + public byte[] getPDF( Integer exameID ) + throws Exception + { + Select select = + new Select( new String[]{ "exames" }, + new String[]{ "pdf" }, + new Field( "id" ).isEqual( exameID ) ); + Virtual2DArray array = executer.executeQuery( select ); + byte pdf[] = ( byte[] ) array.get( 0, 0 ); + return pdf; + } + + public byte[] getFO( Integer exameID ) + throws Exception + { + Select select = + new Select( new String[]{ "exames" }, + new String[]{ "fo" }, + new Field( "id" ).isEqual( exameID ) ); + Virtual2DArray array = executer.executeQuery( select ); + byte fo[] = ( byte[] ) array.get( 0, 0 ); + return fo; + } + + public String getNomeTrabalhadorForExameID( Integer exameID ) + throws Exception + { + Select select = + new Select( new String[]{ "exames", "trabalhadores" }, + new String[]{ "trabalhadores.nome_plain" }, + new Field( "exames.id" ).isEqual( exameID ).and( + new Field( "exames.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + return ( String ) array.get( 0, 0 ); + } + + public Object[] getDadosForExameID( Integer exameID ) + throws Exception + { + Select select = + new Select( new String[]{ "exames", "trabalhadores" }, + new String[]{ "trabalhadores.nome", "exames.data", "exames.proximo_exame" }, + new Field( "exames.id" ).isEqual( exameID ).and( + new Field( "exames.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + return array.getObjects()[ 0 ]; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/impressaofichas/ImpressaoFichasWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/impressaofichas/ImpressaoFichasWindow.java new file mode 100644 index 00000000..ccf982b2 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/impressaofichas/ImpressaoFichasWindow.java @@ -0,0 +1,444 @@ +/* + * ImpressaoFichasUpperPanel.java + * + * Created on 19 de Fevereiro de 2006, 19:00 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.impressaofichas; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.Date; +import java.util.Properties; +import java.util.Vector; + +import javax.print.PrintService; +import javax.print.PrintServiceLookup; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import com.evolute.utils.properties.PropertyHandler; +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.ColumnizedMappable; +import com.evolute.utils.tables.ColumnizedObjectArray; +import com.evolute.utils.tables.VectorTableModel; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import com.evolute.utils.ui.window.EditorWindow; + +/** + * + * @author Frederico + */ +public class ImpressaoFichasWindow extends EditorWindow + implements ListSelectionListener, ActionListener +{ + public final static String TITLE = "Impress\u00e3o de Fichas de Aptid\u00e3o"; + + protected final static String PATH_PROPERTY_SUFFIX = ".path"; + + private final static int iPermissionArray[][] = + new int[][]{ {} }; + + protected JCalendarPanel dataInicioPanel; + protected JCalendarPanel dataFimPanel; + protected VectorTableModel empresasModel; + protected BaseTable empresasTable; + protected VectorTableModel estabelecimentosModel; + protected BaseTable estabelecimentosTable; + protected VectorTableModel fichasModel; + protected BaseTable fichasTable; + protected JButton procurarButton; + protected JTextField pathText; + protected JButton pathButton; + protected JComboBox impressorasCombo; + protected JButton imprimirButton; + protected JButton imprimirTodasButton; + + protected ImpressaoFichasDataProvider provider; + protected PropertyHandler propertyHandler; + + /** Creates a new instance of ImpressaoFichasUpperPanel */ + public ImpressaoFichasWindow() + throws Exception + { + super( iPermissionArray ); + provider = ( ImpressaoFichasDataProvider ) ImpressaoFichasDataProvider.getProvider(); + propertyHandler = new PropertyHandler(); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + setTitle( TITLE ); + empresasModel = new VectorTableModel( new String[]{ "empresas" } ); + empresasTable = new BaseTable( empresasModel ); + empresasTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + empresasTable.setNonResizableNorReordable(); + JScrollPane empresasScroll = + new JScrollPane( empresasTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + empresasTable.getSelectionModel().addListSelectionListener( this ); + estabelecimentosModel = new VectorTableModel( new String[]{ "estabelecimentos" } ); + estabelecimentosTable = new BaseTable( estabelecimentosModel ); + estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + estabelecimentosTable.setNonResizableNorReordable(); + JScrollPane estabelecimentosScroll = + new JScrollPane( estabelecimentosTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + estabelecimentosTable.getSelectionModel().addListSelectionListener( this ); + fichasModel = new VectorTableModel( new String[]{ "trabalhador", "data" } ); + fichasTable = new BaseTable( fichasModel ); + fichasTable.fixColumnWidth( 1, 120 ); + fichasTable.setNonResizableNorReordable(); + fichasTable.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); + fichasTable.getSelectionModel().addListSelectionListener( this ); + JScrollPane fichasScroll = new JScrollPane( fichasTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + JLabel inicioLabel = new JLabel( "In\u00edcio" ); + dataInicioPanel = new JCalendarPanel( null ); + JLabel fimLabel = new JLabel( "Fim" ); + dataFimPanel = new JCalendarPanel( null ); + procurarButton = new JButton( "Carregar" ); + procurarButton.addActionListener( this ); + procurarButton.setEnabled( false ); + pathText = new JTextField(); + pathText.setEditable( false ); + pathButton = new JButton( "Escolher Direct\u00f3rio" ); + pathButton.addActionListener( this ); + impressorasCombo = new JComboBox(); + PrintService printers[] = PrintServiceLookup.lookupPrintServices( null, null ); + for( int n = 0; n < printers.length; n++ ) + { + impressorasCombo.addItem( printers[ n ].getName() ); + } + imprimirButton = new JButton( "Imprimir escolhidas" ); + imprimirButton.addActionListener( this ); + imprimirButton.setEnabled( false ); + imprimirTodasButton = new JButton( "Imprimir Todas" ); + imprimirTodasButton.addActionListener( this ); + imprimirTodasButton.setEnabled( false ); + JPanel upperPad = new JPanel(); + JPanel lowerPad = new JPanel(); + JPanel upperPanel = new JPanel(); + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridheight = 1; + constraints.weighty = 0.35; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( upperPanel, constraints ); + + constraints.gridwidth = 2; + constraints.weightx = 1; + constraints.weighty = 0.65; + constraints.gridheight = GridBagConstraints.REMAINDER; + gridbag.setConstraints( fichasScroll, constraints ); + + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 0; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( inicioLabel, constraints ); + gridbag.setConstraints( dataInicioPanel, constraints ); + gridbag.setConstraints( fimLabel, constraints ); + gridbag.setConstraints( dataFimPanel, constraints ); + gridbag.setConstraints( procurarButton, constraints ); + gridbag.setConstraints( pathText, constraints ); + gridbag.setConstraints( pathButton, constraints ); + gridbag.setConstraints( impressorasCombo, constraints ); + gridbag.setConstraints( imprimirButton, constraints ); + gridbag.setConstraints( imprimirTodasButton, constraints ); + + constraints.weighty = 0.32; + gridbag.setConstraints( upperPad, constraints ); + gridbag.setConstraints( lowerPad, constraints ); + + add( upperPanel ); + add( fichasScroll ); + add( upperPad ); + add( inicioLabel ); + add( dataInicioPanel ); + add( fimLabel ); + add( dataFimPanel ); + add( procurarButton ); + add( lowerPad ); + add( pathButton ); + add( pathText ); + add( impressorasCombo ); + add( imprimirButton ); + add( imprimirTodasButton ); + + upperPanel.setLayout( new GridLayout( 1, 2 ) ); + upperPanel.add( empresasScroll ); + upperPanel.add( estabelecimentosScroll ); + ColumnizedMappable empresas[] = provider.getAllEmpresas(); + Vector values = empresasModel.getValues(); + values.addAll( Arrays.asList( empresas ) ); + empresasModel.setValues( values ); + + Properties properties = propertyHandler.load(); +System.out.println( properties ); + String path = (String) properties.get( getClass().getName() + PATH_PROPERTY_SUFFIX ); + if( path == null ) + { + setDirectorio( System.getProperty( "user.home" ) ); + } + else + { + pathText.setText( path ); + } + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + if( e.getValueIsAdjusting() ) + { + return; + } + if( source.equals( empresasTable.getSelectionModel() ) ) + { + carregarEstabelecimentos(); + } + else if( source.equals( estabelecimentosTable.getSelectionModel() ) ) + { + procurarButton.setEnabled( estabelecimentosTable.getSelectedRow() != -1 ); + } + else if( source.equals( fichasTable.getSelectionModel() ) ) + { + imprimirButton.setEnabled( fichasTable.getSelectedRow() != -1 ); + } + } + + protected void carregarEstabelecimentos() + { + estabelecimentosTable.clearSelection(); + int selected = empresasTable.getSelectedRow(); + estabelecimentosModel.clearAll(); + if( selected > -1 ) + { + try + { + Integer empresaID = ( ( ColumnizedMappable ) empresasModel.getRowAt( selected ) ).getID(); + ColumnizedMappable estabelecimentos[] = provider.getAllEstabelecimentosForEmpresa( empresaID); + Vector values = estabelecimentosModel.getValues(); + values.addAll( Arrays.asList( estabelecimentos ) ); + estabelecimentosModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os estabelecimentos.", true ); + estabelecimentosModel.clearAll(); + } + } + } + + public void clear() + { + empresasTable.clearSelection(); + } + + public void fill( Object value ) + { + if( value == null ) + { + clear(); + } + Integer ids[] = ( Integer [] ) value; + for( int n = 0; n < empresasTable.getRowCount(); n++ ) + { + if( ( ( ColumnizedMappable ) empresasModel.getRowAt( n ) ).getID().equals( ids[ 0 ] ) ) + { + empresasTable.setRowSelectionInterval( n, n ); + break; + } + } + + for( int n = 0; n < estabelecimentosTable.getRowCount(); n++ ) + { + if( ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( n ) ).getID().equals( ids[ 1 ] ) ) + { + estabelecimentosTable.setRowSelectionInterval( n, n ); + break; + } + } + } + + public Object save() + { + int empresaSelected = empresasTable.getSelectedRow(); + int estabelecimentoSelected = estabelecimentosTable.getSelectedRow(); + return new Integer[]{ + empresaSelected == -1 ? null : ( ( ColumnizedMappable ) empresasModel.getRowAt( empresaSelected ) ).getID(), + estabelecimentoSelected == -1 ? null : ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( estabelecimentoSelected ) ).getID() + }; + } + + public void setEnabled( boolean enable ) + { + empresasTable.setEnabled( enable ); + estabelecimentosTable.setEnabled( enable ); + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( procurarButton ) ) + { + procurar(); + } + else if( source.equals( imprimirButton ) ) + { + imprimir(); + } + else if( source.equals( imprimirTodasButton ) ) + { + imprimirTodas(); + } + else if( source.equals( pathButton ) ) + { + escolherDirectorio(); + } + } + + public void procurar() + { + int selected = estabelecimentosTable.getSelectedRow(); + Date dataInicio = dataInicioPanel.getDate(); + Date dataFim = dataFimPanel.getDate(); + if( selected == -1 || ( dataInicio == null && dataFim == null ) ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher pelo menos uma data e um estabelecimento.", "Erro", + JOptionPane.ERROR_MESSAGE ); + return; + } + if( dataInicio == null ) + { + dataInicio = dataFim; + } + else if( dataFim == null ) + { + dataFim = dataInicio; + } + fichasModel.clearAll(); + try + { + Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selected ) ).getID(); + Object fichas[][] = provider.getAllFichasForEstabelecimentoAndDatas( estabelecimentoID, dataInicio, dataFim ); + Vector values = fichasModel.getValues(); + for( int n = 0; n < fichas.length; n++ ) + { + values.add( new ColumnizedObjectArray( fichas[ n ], true ) ); + } + fichasModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar a lista.", true ); + estabelecimentosModel.clearAll(); + } + imprimirTodasButton.setEnabled( fichasTable.getRowCount() > 0 ); + } + + public void imprimir() + { + imprimirLinhas( fichasTable.getSelectedRows() ); + } + + public void imprimirTodas() + { + int linhas[] = new int[ fichasTable.getRowCount() ]; + for( int n = 0; n < linhas.length; n++ ) + { + linhas[ n ] = n; + } + imprimirLinhas( linhas ); + } + + protected void imprimirLinhas( int linhas[] ) + { + try + { + File file = new File( pathText.getText().trim() ); + if( !file.exists() || !file.isDirectory() ) + { + throw new IOException( "Direct\u00f3rio inexistente ou indispon\u00edvel: " + pathText.getText().trim() ); + } + } + catch( IOException ioex ) + { + JOptionPane.showMessageDialog( this, ioex.getMessage(), "Erro...", + JOptionPane.ERROR_MESSAGE ); + return; + } + String impressora = ( String ) impressorasCombo.getSelectedItem(); + Integer ids[] = new Integer[ linhas.length ]; + for( int n = 0; n < ids.length; n++ ) + { + ids[ n ] = ( ( ColumnizedObjectArray )fichasModel.getRowAt( linhas[ n ] ) ).getID(); + } + int option = JOptionPane.showConfirmDialog( this, "Imprimir as " + ids.length + " fichas para a impressora " + impressora + "?", + "Imprimir", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE ); + if( option == 0 ) + { + System.out.println( "imprimir" ); + new FichasPrinter( ids, impressora, pathText.getText().trim(), + empresasModel.getRowAt( empresasTable.getSelectedRow() ).toString(), + estabelecimentosModel.getRowAt( estabelecimentosTable.getSelectedRow() ).toString() ).start(); + } + } + + protected void escolherDirectorio() + { + JFileChooser chooser = new JFileChooser(); + chooser.setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY ); + int returnVal = chooser.showOpenDialog( this ); + if(returnVal == JFileChooser.APPROVE_OPTION) + { + setDirectorio( chooser.getSelectedFile().getAbsolutePath() ); + } + } + + protected void setDirectorio( String path ) + { + if( path != null ) + { + pathText.setText( path ); + Properties properties = propertyHandler.load(); + properties.setProperty( getClass().getName() + PATH_PROPERTY_SUFFIX, path ); + try + { + propertyHandler.save( properties ); + } + catch( IOException ioex ) + { + ioex.printStackTrace(); + } + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/impressaofichas/lista_fichas.xsl b/branches/SIPRP/SIPRPSoft/src/siprp/impressaofichas/lista_fichas.xsl new file mode 100644 index 00000000..98b21d4b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/impressaofichas/lista_fichas.xsl @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + RELAÇÃO DE FICHAS DE APTIDÃO ENVIADAS + + + + + + + + + + NOME + + + DATA EXAME + + + PRÓXIMO EXAME + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/Lembrete.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/Lembrete.java new file mode 100644 index 00000000..cfba5427 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/Lembrete.java @@ -0,0 +1,219 @@ +/* + * Lembrete.java + * + * Created on 12 de Fevereiro de 2007, 23:18 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes; + +import java.util.Date; + +/** + * + * @author Frederico + */ +public class Lembrete +{ + protected Integer id; + protected Integer tipoID; + protected Date data; + protected String descricao; + protected String texto; + protected Integer empresaID; + protected Integer estabelecimentoID; + protected Integer trabalhadorID; + protected Integer marcacaoEstabelecimentoID; + protected Integer marcacaoTrabalhadorID; + protected boolean enviarEmail; + protected Integer periodicidadeDias; + protected Integer periodicidadeMeses; + protected Integer consultaDataID; + protected Integer exameDataID; + + /** Creates a new instance of Lembrete */ + public Lembrete( Integer id, + Integer tipoID, + Date data, + String descricao, + String texto, + Integer empresaID, + Integer estabelecimentoID, + Integer trabalhadorID, + Integer marcacaoEstabelecimentoID, + Integer marcacaoTrabalhadorID, + boolean enviarEmail, + Integer periodicidadeDias, + Integer periodicidadeMeses, + Integer consultaDataID, + Integer exameDataID ) + { + setId( id ); + setTipoID( tipoID ); + setData( data ); + setDescricao( descricao ); + setTexto( texto ); + setEmpresaID( empresaID ); + setEstabelecimentoID( estabelecimentoID ); + setTrabalhadorID( trabalhadorID ); + setMarcacaoEstabelecimentoID( marcacaoEstabelecimentoID ); + setMarcacaoTrabalhadorID( marcacaoTrabalhadorID ); + setEnviarEmail( enviarEmail ); + setPeriodicidadeDias( periodicidadeDias ); + setPeriodicidadeMeses( periodicidadeMeses ); + setConsultaDataID( consultaDataID ); + setExameDataID( exameDataID ); + } + + public Integer getTipoID() + { + return tipoID; + } + + public void setTipoID(Integer tipoID) + { + this.tipoID = tipoID; + } + + public Date getData() + { + return data; + } + + public void setData(Date data) + { + this.data = data; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricao) + { + this.descricao = descricao; + } + + public String getTexto() + { + return texto; + } + + public void setTexto(String texto) + { + this.texto = texto; + } + + public Integer getEmpresaID() + { + return empresaID; + } + + public void setEmpresaID(Integer empresaID) + { + this.empresaID = empresaID; + } + + public Integer getEstabelecimentoID() + { + return estabelecimentoID; + } + + public void setEstabelecimentoID(Integer estabelecimentoID) + { + this.estabelecimentoID = estabelecimentoID; + } + + public Integer getTrabalhadorID() + { + return trabalhadorID; + } + + public void setTrabalhadorID(Integer trabalhadorID) + { + this.trabalhadorID = trabalhadorID; + } + + public Integer getMarcacaoEstabelecimentoID() + { + return marcacaoEstabelecimentoID; + } + + public void setMarcacaoEstabelecimentoID(Integer marcacaoEstabelecimentoID) + { + this.marcacaoEstabelecimentoID = marcacaoEstabelecimentoID; + } + + public Integer getMarcacaoTrabalhadorID() + { + return marcacaoTrabalhadorID; + } + + public void setMarcacaoTrabalhadorID(Integer marcacaoTrabalhadorID) + { + this.marcacaoTrabalhadorID = marcacaoTrabalhadorID; + } + + public boolean isEnviarEmail() + { + return enviarEmail; + } + + public void setEnviarEmail(boolean enviarEmail) + { + this.enviarEmail = enviarEmail; + } + + public Integer getPeriodicidadeDias() + { + return periodicidadeDias; + } + + public void setPeriodicidadeDias(Integer periodicidadeDias) + { + this.periodicidadeDias = periodicidadeDias; + } + + public Integer getPeriodicidadeMeses() + { + return periodicidadeMeses; + } + + public void setPeriodicidadeMeses(Integer periodicidadeMeses) + { + this.periodicidadeMeses = periodicidadeMeses; + } + + public Integer getId() + { + return id; + } + + public void setId(Integer id) + { + this.id = id; + } + + public void setConsultaDataID( Integer consultaDataID ) + { + this.consultaDataID = consultaDataID; + } + + public void setExameDataID( Integer exameDataID ) + { + this.exameDataID = exameDataID; + } + + public Integer getConsultaDataID() + { + return consultaDataID; + } + + public Integer getExameDataID() + { + return exameDataID; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/LembretesConstants.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/LembretesConstants.java new file mode 100644 index 00000000..13f576b7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/LembretesConstants.java @@ -0,0 +1,26 @@ +/* + * LembretesConstants.java + * + * Created on February 12, 2007, 4:44 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes; + +/** + * + * @author fpalma + */ +public interface LembretesConstants +{ + public static final String CODE_EXTERNO = "EXTERNO"; + public static final String CODE_REMARCACOES = "REMARCACOES"; + public static final String CODE_MARCACOES = "MARCACOES"; + public static final String CODE_OUTROS = "OUTROS"; + + public static final String CODES[] = + new String[]{ CODE_EXTERNO, CODE_REMARCACOES, CODE_MARCACOES, + CODE_OUTROS }; +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/LembretesDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/LembretesDataProvider.java new file mode 100644 index 00000000..4bc0f8d9 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/LembretesDataProvider.java @@ -0,0 +1,448 @@ +/* + * LembretesDataProvider.java + * + * Created on February 5, 2007, 6:09 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; + +import siprp.MedicinaConstants; +import siprp.data.outer.ExamesData; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.Trabalhadores; +import siprp.database.cayenne.providers.MedicinaDAO; +import siprp.ficha.FichaAptidaoConstants; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.db.DBException; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; +import com.evolute.utils.sql.Update; + +/** + * + * @author lflores + */ +public class LembretesDataProvider +{ + private static final Object LOCK = new Object(); + private static LembretesDataProvider instance = null; + + private final HashMap TIPOS_LEMBRETES_BY_CODIGO = + new HashMap(); + private final HashMap TIPOS_LEMBRETES_BY_ID = + new HashMap(); + private TipoLembrete tiposLembrete[]; + + private MedicinaDAO medicinaDAO = null ; + + private Executer EXECUTER; + + /** Creates a new instance of LembretesDataProvider */ + public LembretesDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + medicinaDAO = new MedicinaDAO(); + } + + public static LembretesDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new LembretesDataProvider(); + } + } + return instance; + } + + public TipoLembrete[] getTiposLembrete() + throws Exception + { + if( tiposLembrete == null ) + { + Select select = + new Select( new String[]{ "lembretes_tipos" }, + new String[]{ "id", "codigo", "descricao", "ordem" }, + new Field( "activo" ).isEqual( "y" ), + new String[]{ "ordem" }, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + tiposLembrete = new TipoLembrete[ array.columnLength() ]; + for( int n = 0; n < tiposLembrete.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String codigo = ( String ) array.get( n, 1 ); + String descricao = ( String ) array.get( n, 2 ); + Integer ordem = ( Integer ) array.get( n, 3 ); + tiposLembrete[ n ] = new TipoLembrete( id, codigo, descricao, ordem ); + TIPOS_LEMBRETES_BY_CODIGO.put( codigo, tiposLembrete[ n ] ); + TIPOS_LEMBRETES_BY_ID.put( id, tiposLembrete[ n ] ); + } + } + return tiposLembrete; + } + + public Integer getTipoLembreteIDByCodigo( String codigo ) + { + Integer result = null; + TipoLembrete tipo; + try + { + tipo = getTipoLembreteByCodigo( codigo ); + if( tipo != null ) + { + result = tipo.getID(); + } + } catch( Exception e ) + { + e.printStackTrace(); + } + return result; + } + + public TipoLembrete getTipoLembreteByCodigo( String codigo ) + throws Exception + { + getTiposLembrete(); + return TIPOS_LEMBRETES_BY_CODIGO.get( codigo ); + } + + public TipoLembrete getTipoLembreteByID( Integer id ) + throws Exception + { + getTiposLembrete(); + return TIPOS_LEMBRETES_BY_ID.get( id ); + } + + public void criarLembrete( Integer tipoID, + Date data, + String descricao, + String texto, + Integer empresaID, + Integer estabelecimentoID, + Integer trabalhadorID, + Integer marcacaoEstabelecimentoID, + Integer marcacaoTrabalhadorID, + boolean enviarEmail, + Integer periodicidadeDias, + Integer periodicidadeMeses ) + throws Exception + { + Insert insert = + new Insert( "lembretes", + new Assignment[]{ + new Assignment( new Field( "tipo_id" ), tipoID ), + new Assignment( new Field( "data" ), data ), + new Assignment( new Field( "descricao" ), descricao ), + new Assignment( new Field( "texto" ), texto ), + new Assignment( new Field( "empresa_id" ), empresaID ), + new Assignment( new Field( "estabelecimento_id" ), estabelecimentoID ), + new Assignment( new Field( "trabalhador_id" ), trabalhadorID ), + new Assignment( new Field( "marcacao_estabelecimento_id" ), marcacaoEstabelecimentoID ), + new Assignment( new Field( "marcacao_trabalhador_id" ), marcacaoTrabalhadorID ), + new Assignment( new Field( "enviar_email" ), enviarEmail ? "y" : "n" ), + new Assignment( new Field( "periodicidade_dias" ), periodicidadeDias ), + new Assignment( new Field( "periodicidade_meses" ), periodicidadeMeses ) } ); + EXECUTER.executeQuery( insert ); + } + + public void criarLembreteConsulta( Integer tipoID, Date date, String descricao, String texto, Integer empresaID, Integer estabelecimentoID, Integer trabalhadorID, Integer consultaMarcacaoID ) + { + criarLembreteNew( tipoID, date, descricao, texto, empresaID, estabelecimentoID, trabalhadorID, consultaMarcacaoID, true); + } + + public void criarLembreteExame( Integer tipoID, Date date, String descricao, String texto, Integer empresaID, Integer estabelecimentoID, Integer trabalhadorID, Integer consultaExameID ) + { + criarLembreteNew( tipoID, date, descricao, texto, empresaID, estabelecimentoID, trabalhadorID, consultaExameID, false ); + } + + private void criarLembreteNew( Integer tipoID, Date date, String descricao, String texto, Integer empresaID, Integer estabelecimentoID, Integer trabalhadorID, Integer marcacaoID, boolean isConsulta ) + { + try + { + Select2 query = new Select2( + new String[]{ "lembretes" }, + null, + null, + new String[]{ "id" }, + new Field( "tipo_id" ).isEqual( tipoID ). + and( new Field( "data" ).isEqual( date ). + and( new Field( "trabalhador_id" ).isEqual( trabalhadorID ) ) ), + null, null, null, null); + Virtual2DArray array = EXECUTER.executeQuery( query ); + if( array.columnLength() == 0 ) + { + Insert insert = + new Insert( "lembretes", + new Assignment[]{ + new Assignment( new Field( "tipo_id" ), tipoID ), + new Assignment( new Field( "data" ), date ), + new Assignment( new Field( "descricao" ), descricao ), + new Assignment( new Field( "texto" ), texto ), + new Assignment( new Field( "empresa_id" ), empresaID ), + new Assignment( new Field( "estabelecimento_id" ), estabelecimentoID ), + new Assignment( new Field( "trabalhador_id" ), trabalhadorID ), + new Assignment( new Field( isConsulta ? "trabalhadores_consultas_datas_id" : "trabalhadores_ecds_datas_id" ), marcacaoID ) } ); + EXECUTER.executeQuery( insert ); + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + } + + public void apagarLembreteByID( Integer id ) + throws Exception + { + Update update = new Update( "lembretes", new Assignment[]{ new Assignment(new Field("deleted_date"),new Date()) }, new Field("id").isEqual( id ) ); + EXECUTER.executeQuery( update ); + } + + public void apagarLembreteByMarcacaoTrabalhadorID( Integer marcacaoID ) + throws Exception + { + Update update = new Update( "lembretes", new Assignment[]{ new Assignment(new Field("deleted_date"),new Date()) }, new Field("marcacao_trabalhador_id").isEqual( marcacaoID ) ); + EXECUTER.executeQuery( update ); + } + + public int countLembretesByTipo( Integer tipoID ) + throws Exception + { + Select select = + new Select( new String[]{ "lembretes" }, + new String[]{ "COUNT(*)" }, + new Field( "tipo_id" ).isEqual( tipoID ).and( + new Field( "data" ).isLessOrEqual( new Date() ) ).and( + new Field( "deleted_date" ).isEqual( null ) ) ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return 0; + } + else + { + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + + } + + public Lembrete[] getLembretesByTipo( Integer tipoID ) + throws Exception + { + Select select = + new Select( new String[]{ "lembretes" }, + new String[]{ "id", "tipo_id", "data", "descricao", + "texto", "empresa_id", "estabelecimento_id", + "trabalhador_id", "marcacao_estabelecimento_id", + "marcacao_trabalhador_id", "enviar_email", + "periodicidade_dias", "periodicidade_meses" , "trabalhadores_consultas_datas_id", "trabalhadores_ecds_datas_id" }, + new Field( "tipo_id" ).isEqual( tipoID ).and( + new Field( "data" ).isLessOrEqual( new Date() ) ).and( + new Field( "deleted_date" ).isEqual( null ) ) ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Lembrete lembretes[] = new Lembrete[ array.columnLength() ]; + for( int n = 0; n < lembretes.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + Date data = ( Date ) array.get( n, 2 ); + String descricao = ( String ) array.get( n, 3 ); + String texto = ( String ) array.get( n, 4 ); + Integer empresaID = ( Integer ) array.get( n, 5 ); + Integer estabelecimentoID = ( Integer ) array.get( n, 6 ); + Integer trabalhadorID = ( Integer ) array.get( n, 7 ); + Integer marcacaoEstabelecimentoID = ( Integer ) array.get( n, 8 ); + Integer marcacaoTrabalhadorID = ( Integer ) array.get( n, 9 ); + boolean enviarEmail = "y".equals( array.get( n, 10 ) ); + Integer periodicidadeDias = ( Integer ) array.get( n, 11 ); + Integer periodicidadeMeses = ( Integer ) array.get( n, 12 ); + Integer consultaDataID = ( Integer ) array.get( 0, 13 ); + Integer exameDataID = ( Integer ) array.get( 0, 14 ); + lembretes[ n ] = new Lembrete( id, tipoID, data, descricao, texto, + empresaID, estabelecimentoID, trabalhadorID, + marcacaoEstabelecimentoID, marcacaoTrabalhadorID, + enviarEmail, periodicidadeDias, periodicidadeMeses, consultaDataID, exameDataID ); + } + return lembretes; + } + + public Lembrete getLembreteByID( Integer id ) + throws Exception + { + Select select = + new Select( new String[]{ "lembretes" }, + new String[]{ "id", "tipo_id", "data", "descricao", + "texto", "empresa_id", "estabelecimento_id", + "trabalhador_id", "marcacao_estabelecimento_id", + "marcacao_trabalhador_id", "enviar_email", + "periodicidade_dias", "periodicidade_meses", "trabalhadores_consultas_datas_id", "trabalhadores_ecds_datas_id" }, + new Field( "id" ).isEqual( id ).and( + new Field( "deleted_date" ).isEqual( null ) ) ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 ) + { + return null; + } + else + { + Integer tipoID = ( Integer ) array.get( 0, 1 ); + Date data = ( Date ) array.get( 0, 2 ); + String descricao = ( String ) array.get( 0, 3 ); + String texto = ( String ) array.get( 0, 4 ); + Integer empresaID = ( Integer ) array.get( 0, 5 ); + Integer estabelecimentoID = ( Integer ) array.get( 0, 6 ); + Integer trabalhadorID = ( Integer ) array.get( 0, 7 ); + Integer marcacaoEstabelecimentoID = ( Integer ) array.get( 0, 8 ); + Integer marcacaoTrabalhadorID = ( Integer ) array.get( 0, 9 ); + boolean enviarEmail = "y".equals( array.get( 0, 10 ) ); + Integer periodicidadeDias = ( Integer ) array.get( 0, 11 ); + Integer periodicidadeMeses = ( Integer ) array.get( 0, 12 ); + Integer consultaDataID = ( Integer ) array.get( 0, 13 ); + Integer exameDataID = ( Integer ) array.get( 0, 14 ); + return new Lembrete( id, tipoID, data, descricao, texto, + empresaID, estabelecimentoID, trabalhadorID, + marcacaoEstabelecimentoID, marcacaoTrabalhadorID, + enviarEmail, periodicidadeDias, periodicidadeMeses, consultaDataID, exameDataID ); + } + } + + private Calendar makeDateCalendar() + { + Calendar now = Calendar.getInstance(); + Calendar nowDate = Calendar.getInstance(); + nowDate.clear(); + nowDate.set( Calendar.YEAR, now.get( Calendar.YEAR ) ); + nowDate.set( Calendar.MONTH, now.get( Calendar.MONTH ) ); + nowDate.set( Calendar.DAY_OF_MONTH, now.get( Calendar.DAY_OF_MONTH ) ); + return nowDate; + } + + public List getFichasExpiradasID() + { + List fichasExpiradas = new LinkedList(); + try + { + Calendar nowDate = makeDateCalendar(); + Select2 query = new Select2( + new String[]{ "exames" }, + null, + null, + new String[]{ "id" }, + new Field( "proximo_exame" ).isEqual( nowDate.getTime() ). + and( new Field( "tipo" ).isEqual( FichaAptidaoConstants.CODIGO_TIPO_PERIODICO ) ), + null, null, null, null); + Virtual2DArray array = EXECUTER.executeQuery( query ); + for( int i = 0; i < array.columnLength(); fichasExpiradas.add( (Integer) array.get( i, 0 ) ), ++i ); + } catch( DBException e ) + { + e.printStackTrace(); + } + return fichasExpiradas; + } + + +// public List getFichasExpiradasSemData() +// { +// List fichasExpiradas = new LinkedList(); +// try +// { +// Calendar date = makeDateCalendar(); +// date.add( Calendar.MONTH, -22 ); +// Select2 query = new Select2( +// new String[]{ "exames" }, +// null, +// null, +// new String[]{ "id" }, +// new Field( "proximo_exame" ).isEqual( null ).and( new Field( "data" ).isEqual( date.getTime() ) ), +// null, null, null, null); +// Virtual2DArray array = EXECUTER.executeQuery( query ); +// for( int i = 0; i < array.columnLength(); fichasExpiradas.add( (Integer) array.get( i, 0 ) ), ++i ); +// } catch( DBException e ) +// { +// e.printStackTrace(); +// } +// return fichasExpiradas; +// } + + public void createLembretesForFichas( List fichas ) + { + Integer tipoID = getTipoLembreteIDByCodigo( LembretesConstants.CODE_MARCACOES ); + for( Integer fichaID : fichas ) + { + createLembreteForFicha( fichaID, tipoID, new Date() ); + } + } + + private Integer getTrabalhadorIDForFichaID( Integer fichaID ) + { + Integer result = null; + try + { + Select2 query = new Select2( + new String[]{ "exames" }, + null, + null, + new String[]{ "trabalhador_id" }, + new Field( "id" ).isEqual( fichaID ), + null, null, null, null); + Virtual2DArray array = EXECUTER.executeQuery( query ); + result = (Integer) array.get( 0, 0 ); + } catch( DBException e ) + { + e.printStackTrace(); + } + return result; + } + + private void createLembreteForFicha( Integer fichaID, Integer tipoID, Date when ) + { + try + { + Integer trabalhadorID = getTrabalhadorIDForFichaID( fichaID ); + Trabalhadores trabalhador = medicinaDAO.getTrabalhadorByID( trabalhadorID ); + Estabelecimentos estabelecimento = trabalhador.getToEstabelecimentos(); + Empresas empresa = estabelecimento.getToEmpresas(); + criarLembreteConsulta( tipoID, + when == null ? new Date() : when, + MedicinaConstants.LEMBRETE_RENOVACAO_FICHA_APTIDAO_STRING, + null, + empresa.getId(), + estabelecimento.getId(), + trabalhador.getId(), + null + ); + } + catch(Exception e) + { + System.out.println(e); + } + } + + public void criarLembreteFicha( ExamesData exame, Date when ) + { + Integer tipoID = getTipoLembreteIDByCodigo( LembretesConstants.CODE_MARCACOES ); + createLembreteForFicha( (Integer) exame.get( ExamesData.ID ), tipoID, when ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/LembretesDemon.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/LembretesDemon.java new file mode 100644 index 00000000..9d890954 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/LembretesDemon.java @@ -0,0 +1,108 @@ +package siprp.lembretes; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +public class LembretesDemon extends Thread +{ + + private static final long SLEEP_TIME_MILLIS = 60 * 60 * 1000; // one hour + + private static boolean isRunning = false; + + private static LembretesDemon instance = null; + + private LembretesDataProvider lembretesProvider = null; + + private boolean doneForToday = false; + + private Calendar lastIteration = Calendar.getInstance(); + + private LembretesDemon() + { + try + { + lembretesProvider = new LembretesDataProvider(); + } catch( Exception e ) + { + e.printStackTrace(); + } + } + + /** + * Instanciates and starts a LembretesDemon + */ + public static void go() + { + getInstance(); + startDemon(); + } + + /** + * Gets LembretesDemon + * @return + */ + public static LembretesDemon getInstance() + { + if( LembretesDemon.instance == null ) + { + LembretesDemon.instance = new LembretesDemon(); + } + return LembretesDemon.instance; + } + + public static void stopDemon() + { + if( LembretesDemon.isRunning ) + { + LembretesDemon.isRunning = false; + } + } + + public static void startDemon() + { + if( !LembretesDemon.isRunning ) + { + LembretesDemon.isRunning = true; + instance.start(); + } + } + + @Override + public void run() + { + System.out.println( new Date() + ": Starting LembretesDemon" ); + while( isRunning ) + { + try + { + Calendar now = Calendar.getInstance(); + if( !doneForToday || lastIterationWasYesterday( now ) ) + { + doStuff(); + doneForToday = true; + } + lastIteration = now; + Thread.sleep( SLEEP_TIME_MILLIS ); + } catch( InterruptedException e ) + { + e.printStackTrace(); + } + } + System.out.println( new Date() + ": Stopping LembretesDemon" ); + } + + private void doStuff() + { + List fichasExpiradas = lembretesProvider.getFichasExpiradasID(); + lembretesProvider.createLembretesForFichas( fichasExpiradas ); + } + + private boolean lastIterationWasYesterday( Calendar now ) + { + return ( now.get( Calendar.DAY_OF_MONTH ) > lastIteration.get( Calendar.DAY_OF_MONTH ) ) + || + ( now.get( Calendar.DAY_OF_MONTH ) == 1 && lastIteration.get( Calendar.DAY_OF_MONTH ) != 1 ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/LembretesWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/LembretesWindow.java new file mode 100644 index 00000000..0bbf2a6b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/LembretesWindow.java @@ -0,0 +1,368 @@ +/* + * LembretesWindow.java + * + * Created on 13 de Fevereiro de 2007, 11:11 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.List; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.ListSelectionModel; +import javax.swing.SwingUtilities; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.providers.MedicinaDAO; +import siprp.lembretes.externos.LembretesExternosPanel; +import siprp.lembretes.marcacoes.LembretesMarcacaoPanel; +import siprp.lembretes.remarcacoes.LembretesRemarcacaoPanel; + +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.ColumnizedObjectArray; +import com.evolute.utils.tables.VectorTableModel; +import com.evolute.utils.tracker.TrackableWindow; +import com.evolute.utils.ui.DialogException; + +/** + * + * @author Frederico + */ +public class LembretesWindow extends JFrame + implements ActionListener, TrackableWindow, ListSelectionListener, + LembretesConstants +{ + public static final String TITLE = "Lembretes"; + + private static final int LEFT_COLUMN_WIDTH = 302; + + protected VectorTableModel tiposModel; + protected BaseTable tiposTable; + protected JPanel lembretesPanel; + protected JButton recarregarButton; + + private final JPanel leftPanel = new JPanel(); + private final JCheckBox checkEmpresas = new JCheckBox(); + private final JComboBox comboEmpresas = new JComboBox( ); + private final JCheckBox checkEstabelecimentos = new JCheckBox(); + private final JComboBox comboEstabelecimentos = new JComboBox( ); + + private final MedicinaDAO medicinaDao = new MedicinaDAO(); + + protected LembretesDataProvider provider; + + /** Creates a new instance of LembretesWindow */ + public LembretesWindow() + throws Exception + { + provider = LembretesDataProvider.getProvider(); + setupComponents(); + } + + private void setupComponents() + { + setTitle( "Lembretes" ); + tiposModel = new VectorTableModel( new String[]{ "tipo", "quantidade" } ); + tiposTable = new BaseTable( tiposModel ); + tiposTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + tiposTable.fixColumnWidth( 0, 200 ); + tiposTable.fixColumnWidth( 1, 100 ); + tiposTable.getSelectionModel().addListSelectionListener( this ); + JScrollPane scp = + new JScrollPane( tiposTable, JScrollPane.VERTICAL_SCROLLBAR_NEVER, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + scp.setPreferredSize( new Dimension( LEFT_COLUMN_WIDTH, 100 ) ); + lembretesPanel = new JPanel(); + lembretesPanel.setLayout( new GridLayout( 1, 1 ) ); + recarregarButton = new JButton( "Recarregar" ); + recarregarButton.addActionListener( this ); + + loadEmpresas(); + loadEstabelecimentos(); + + double[] cols = new double[]{ TableLayout.MINIMUM, TableLayout.FILL }; + double[] rows = new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, + TableLayout.MINIMUM, TableLayout.MINIMUM, + TableLayout.MINIMUM, TableLayout.MINIMUM, + TableLayout.MINIMUM + }; + TableLayout tableLayout = new TableLayout( cols, rows ); + tableLayout.setHGap( 5 ); + tableLayout.setVGap( 5 ); + leftPanel.setPreferredSize( new Dimension( LEFT_COLUMN_WIDTH, 0 ) ); + leftPanel.setLayout( tableLayout ); + + comboEmpresas.setPreferredSize( new Dimension( LEFT_COLUMN_WIDTH - 50, 0 ) ); + comboEstabelecimentos.setPreferredSize( new Dimension( LEFT_COLUMN_WIDTH - 50, 0 ) ); + checkEstabelecimentos.setEnabled( false ); + comboEstabelecimentos.setEnabled( false ); + + leftPanel.add( scp, new TableLayoutConstraints(0,0,1,0) ); + leftPanel.add( new JSeparator(), new TableLayoutConstraints(0,1,1,1) ); + leftPanel.add( new JLabel( "Filtrar por:"), new TableLayoutConstraints(0,2,1,2) ); + leftPanel.add( checkEmpresas, new TableLayoutConstraints(0,3) ); + leftPanel.add( new JLabel( "Empresa"), new TableLayoutConstraints(1,3) ); + leftPanel.add( comboEmpresas, new TableLayoutConstraints(1,4) ); + leftPanel.add( checkEstabelecimentos, new TableLayoutConstraints(0,5) ); + leftPanel.add( new JLabel( "Estabelecimento"), new TableLayoutConstraints(1,5) ); + leftPanel.add( comboEstabelecimentos, new TableLayoutConstraints(1,6) ); + + cols = new double[]{ TableLayout.PREFERRED, TableLayout.FILL }; + rows = new double[]{ TableLayout.FILL, TableLayout.MINIMUM }; + tableLayout = new TableLayout( cols, rows ); + tableLayout.setHGap( 5 ); + tableLayout.setVGap( 5 ); +// getContentPane().setPreferredSize( new Dimension( 300, 20 ) ); + getContentPane().setLayout( tableLayout ); + + getContentPane().setLayout( tableLayout ); + getContentPane().add( leftPanel, new TableLayoutConstraints( 0, 0 ) ); + getContentPane().add( lembretesPanel, new TableLayoutConstraints( 1, 0 ) ); + getContentPane().add( recarregarButton, new TableLayoutConstraints( 0, 1, 1, 1 ) ); + + addWindowListener( new WindowAdapter(){ + public void windowClosing( WindowEvent e ) + { + close(); + } + + public void windowOpened( WindowEvent e ) + { +// setExtendedState( getExtendedState() | MAXIMIZED_BOTH ); + setSize( 1024, 700 ); + reloadTotais(); + } + } ); + + + + setupComboListeners(); + setupCheckBoxListeners(); + comboEmpresas.setEnabled( false ); + comboEstabelecimentos.setEnabled( false ); + } + + private void setupComboListeners() + { + comboEmpresas.addItemListener( new ItemListener() + { + @Override + public void itemStateChanged( ItemEvent e ) + { + if( e.getStateChange() == ItemEvent.SELECTED ) + { + loadEstabelecimentos(); + if( checkEmpresas.isEnabled() && checkEmpresas.isEnabled() ) + { + reloadLembretes(); + } + } + } + } ); + comboEstabelecimentos.addItemListener( new ItemListener() + { + @Override + public void itemStateChanged( ItemEvent e ) + { + if( e.getStateChange() == ItemEvent.SELECTED && checkEstabelecimentos.isEnabled() ) + { + reloadLembretes(); + } + } + } ); + } + + private void setupCheckBoxListeners() + { + checkEmpresas.addChangeListener( new ChangeListener() + { + @Override + public void stateChanged( ChangeEvent e ) + { + empresasChecked(); + reloadLembretes(); + } + }); + checkEstabelecimentos.addChangeListener( new ChangeListener() + { + @Override + public void stateChanged( ChangeEvent e ) + { + reloadLembretes(); + } + }); + } + + private void empresasChecked() + { + boolean filtrarEmpresas = checkEmpresas.isSelected(); + checkEstabelecimentos.setEnabled( filtrarEmpresas ); + comboEstabelecimentos.setEnabled( filtrarEmpresas ); + } + + public void refresh() + { + } + + public void open() + { + setVisible( true ); + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable() { + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + protected void reloadTotais() + { + try + { + Vector values = tiposModel.getValues(); + values.clear(); + TipoLembrete tipos[] = provider.getTiposLembrete(); + for( int n = 0; n < tipos.length; n++ ) + { + int count = provider.countLembretesByTipo( tipos[ n ].getID() ); + values.add( new ColumnizedObjectArray( + new Object[]{ tipos[ n ].getID(), tipos[ n ].getDescricao(), + "" + count }, true ) ); + } + tiposModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar lembretes", true ); + } + } + + protected void reloadLembretes() + { + lembretesPanel.removeAll(); + int selected = tiposTable.getSelectedRow(); + if( selected != -1 ) + { + ColumnizedObjectArray line = ( ColumnizedObjectArray ) tiposModel.getRowAt( selected ); + Integer tipoID = line.getID(); + Empresas empresa = (Empresas) comboEmpresas.getSelectedItem(); + Estabelecimentos estabelecimento = (Estabelecimentos) comboEstabelecimentos.getSelectedItem(); + Integer empresaID = ( empresa != null && checkEmpresas.isSelected() ) ? empresa.getId() : null; + Integer estabelecimentoID = ( estabelecimento != null && checkEstabelecimentos.isSelected() ) ? estabelecimento.getId() : null; + try + { + TipoLembrete tipo = provider.getTipoLembreteByID( tipoID ); + if( CODE_EXTERNO.equals( tipo.getCodigo() ) ) + { + lembretesPanel.add( new LembretesExternosPanel( empresaID, estabelecimentoID ) ); + } + if( CODE_REMARCACOES.equals( tipo.getCodigo() ) ) + { + lembretesPanel.add( new LembretesRemarcacaoPanel( empresaID, estabelecimentoID ) ); + } + if( CODE_MARCACOES.equals( tipo.getCodigo() ) ) + { + lembretesPanel.add( new LembretesMarcacaoPanel( empresaID, estabelecimentoID ) ); + } + if( CODE_OUTROS.equals( tipo.getCodigo() ) ) + { + } + + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar lembretes", true ); + } + } + validate(); + repaint(); + } + + private void loadEmpresas() + { + comboEmpresas.removeAllItems(); + List allEmpresas = medicinaDao.getAllEmpresas(); + for( Empresas empresa : allEmpresas ) + { + comboEmpresas.addItem( empresa ); + } + + } + + private void loadEstabelecimentos() + { + comboEstabelecimentos.removeAllItems(); + Object selectedEmpresa = comboEmpresas.getSelectedItem(); + if( selectedEmpresa != null ) + { + if( selectedEmpresa instanceof Empresas ) + { + List allEstabelecimentos = ((Empresas) selectedEmpresa).getEstabelecimentosArray(); + for( Estabelecimentos estabelecimento : allEstabelecimentos ) + { + comboEstabelecimentos.addItem( estabelecimento ); + } + } + } + } + + public boolean closeIfPossible() + { + close(); + return true; + } + + public void actionPerformed(ActionEvent e) + { + Object source = e.getSource(); + if( source.equals( recarregarButton ) ) + { + reloadTotais(); + loadEmpresas(); + loadEstabelecimentos(); + } + } + + public void valueChanged(ListSelectionEvent e) + { + if( !e.getValueIsAdjusting() ) + { + reloadLembretes(); + boolean selected = tiposTable.getSelectedRowCount() > 0; + comboEmpresas.setEnabled( selected ); + comboEstabelecimentos.setEnabled( checkEmpresas.isSelected() ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/TipoLembrete.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/TipoLembrete.java new file mode 100644 index 00000000..e5564393 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/TipoLembrete.java @@ -0,0 +1,65 @@ +/* + * TipoLembrete.java + * + * Created on February 5, 2007, 6:28 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes; + +import com.evolute.utils.data.IDObject; + +/** + * + * @author lflores + */ +public class TipoLembrete + implements IDObject, Comparable +{ + protected Integer id; + protected String codigo; + protected String descricao; + protected Integer ordem; + + /** Creates a new instance of TipoLembrete */ + public TipoLembrete( Integer id, String codigo, String descricao, + Integer ordem ) + { + this.id = id; + this.codigo = codigo; + this.descricao = descricao; + this.ordem = ordem; + } + + public Integer getID() + { + return id; + } + + protected String getCodigo() + { + return codigo; + } + + protected String getDescricao() + { + return descricao; + } + + protected Integer getOrdem() + { + return ordem; + } + + public int compareTo( Object other ) + { + if( !( other instanceof TipoLembrete ) ) + { + return 0; + } + TipoLembrete otl = ( TipoLembrete ) other; + return getOrdem().compareTo( otl.getOrdem() ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/externos/ExternosActionFactory.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/externos/ExternosActionFactory.java new file mode 100755 index 00000000..eea41d52 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/externos/ExternosActionFactory.java @@ -0,0 +1,54 @@ +/* + * RemarcacoesActionFactory.java + * + * Created on January 31, 2007, 6:37 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.externos; + +import javax.swing.Action; + +import siprp.lembretes.externos.actions.TratarExternoAction; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.panel.multipleactionlist.ActionFactory; + +/** + * + * @author fpalma + */ +public class ExternosActionFactory implements ActionFactory +{ + public static final int TRABALHADOR = 0; + + protected final int TIPO; + + /** + * Creates a new instance of RemarcacoesActionFactory + */ + public ExternosActionFactory( int tipo ) + { + TIPO = tipo; + } + + public Action createAction(IDObject[] objects) + { + return null; + } + + public Action createAction(IDObject object) + { + switch( TIPO ) + { + case TRABALHADOR: + return new TratarExternoAction( object ); + + default: + return null; + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/externos/LembretesExternosDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/externos/LembretesExternosDataProvider.java new file mode 100755 index 00000000..d80b1baf --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/externos/LembretesExternosDataProvider.java @@ -0,0 +1,141 @@ +/* + * RemarcacoesDataProvider.java + * + * Created on February 14, 2007, 10:56 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.externos; + +import java.text.DateFormat; +import java.util.Date; +import java.util.Locale; + +import siprp.lembretes.LembretesConstants; +import siprp.lembretes.LembretesDataProvider; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; + +/** + * + * @author lflores + */ +public class LembretesExternosDataProvider +{ + private static final DateFormat D_F = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); + + private static final Object LOCK = new Object(); + private static LembretesExternosDataProvider instance = null; + + private Executer EXECUTER; + private LembretesDataProvider lembretesProvider; + + /** Creates a new instance of RemarcacoesDataProvider */ + public LembretesExternosDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + lembretesProvider = LembretesDataProvider.getProvider(); + } + + public static LembretesExternosDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new LembretesExternosDataProvider(); + } + } + return instance; + } + + private Expression whereExpressionLembretesRemarcacao( Integer empresaID, Integer estabelecimentoID ) throws Exception + { + Expression result = new Field( "lembretes.tipo_id" ).isEqual( + lembretesProvider.getTipoLembreteByCodigo( LembretesConstants.CODE_EXTERNO ).getID() ).and( + new Field( "lembretes.data" ).isLessOrEqual( new Field( "current_date" ) ) ).and( + new Field( "lembretes.deleted_date" ).isEqual( null ) ); + if( empresaID != null ) + { + result = result.and( new Field("empresas.id").isEqual( empresaID ) ); + if( estabelecimentoID != null ) + { + result = result.and( new Field("estabelecimentos.id").isEqual( estabelecimentoID ) ); + } + } + return result; + } + + public IDObject[] getLembretesMarcacaoTrabalhador( Integer empresaID, Integer estabelecimentoID ) + throws Exception + { + Select select = + new Select2( new String[]{ "lembretes", "marcacoes_trabalhador", "trabalhadores", + "estabelecimentos", "empresas", "trabalhadores_consultas_datas", "trabalhadores_ecds_datas"}, + new Integer [] { + Select2.JOIN_LEFT_OUTER, Select2.JOIN_LEFT_OUTER, + Select2.JOIN_LEFT_OUTER, Select2.JOIN_LEFT_OUTER, + Select2.JOIN_LEFT_OUTER, Select2.JOIN_LEFT_OUTER + }, + new Expression[]{ + new Field( "lembretes.marcacao_trabalhador_id" ).isEqual( new Field( "marcacoes_trabalhador.id" ) ),/*.or( + new Field( "lembretes.trabalhadores_consultas_datas_id" ).isEqual( new Field( "trabalhadores_consultas_datas.id" ) ) + ).or( + new Field( "lembretes.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ) + ), + */ + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).or( new Field( "lembretes.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ), + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ), + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ), + new Field( "lembretes.trabalhadores_consultas_datas_id" ).isEqual( new Field( "trabalhadores_consultas_datas.id" ) ), + new Field( "lembretes.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ) + }, + new String[]{ "lembretes.id", "lembretes.descricao", + "marcacoes_trabalhador.tipo", "lembretes.data", + "trabalhadores.nome", "estabelecimentos.nome", "empresas.designacao_social", + "trabalhadores.nome_plain" }, + whereExpressionLembretesRemarcacao( empresaID, estabelecimentoID ), + new String[]{ "trabalhadores.nome_plain" }, + null, + null, + null + ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + IDObject lembretes[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < lembretes.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String descricao = ( String ) array.get( n, 1 ); + Date data = ( Date ) array.get( n, 3 ); + + String trabalhador = ( String ) array.get( n, 4 ); + String split[] = trabalhador.split( " " ); + trabalhador = split[ 0 ] + " " + ( split.length > 2 ? split[ 1 ].charAt( 0 ) + ". " : " " ) + + ( split.length > 1 ? split[ split.length - 1 ] : "" ); + String estabelecimento = ( String ) array.get( n, 5 ); + String empresa = ( String ) array.get( n, 6 ); + String str = "" + trabalhador + "" + + "
   " + "" + " de " + D_F.format( data ) + + "
   " + descricao + "" + + "
   " + empresa.substring( 0, empresa.length() > 20 ? 20 : empresa.length() ) + + " / " + estabelecimento.substring( 0, estabelecimento.length() > 10 ? 10 : estabelecimento.length() ) + + ""; + lembretes[ n ] = new MappableObject( id, str ); + } + return lembretes; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/externos/LembretesExternosPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/externos/LembretesExternosPanel.java new file mode 100755 index 00000000..6a828746 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/externos/LembretesExternosPanel.java @@ -0,0 +1,69 @@ +/* + * LembretesRemarcacaoPanel.java + * + * Created on 13 de Fevereiro de 2007, 23:24 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.externos; + +import java.awt.BorderLayout; +import java.awt.GridLayout; + +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; + +import siprp.lembretes.LembretesConstants; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.ui.panel.multipleactionlist.MultipleActionListPanel; + + +public class LembretesExternosPanel extends JPanel + implements LembretesConstants +{ + protected JScrollPane listTrabalhadoresScroll; + protected MultipleActionListPanel listTrabalhadoresPanel; + + protected LembretesExternosDataProvider provider; + + private final Integer empresaID; + private final Integer estabelecimentoID; + + private ProviderInterface JDO; + + /** Creates a new instance of LembretesRemarcacaoPanel */ + public LembretesExternosPanel( Integer empresaID, Integer estabelecimentoID ) + throws Exception + { + this.empresaID = empresaID; + this.estabelecimentoID = estabelecimentoID; + provider = LembretesExternosDataProvider.getProvider(); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + listTrabalhadoresPanel = + new MultipleActionListPanel( + new ExternosActionFactory[]{ }, + new ExternosActionFactory[]{ new ExternosActionFactory( ExternosActionFactory.TRABALHADOR ) } ); + listTrabalhadoresScroll = + new JScrollPane( listTrabalhadoresPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + setLayout( new GridLayout( 1, 2 ) ); + JPanel trabalhadoresPanel = new JPanel(); + add( trabalhadoresPanel ); + + trabalhadoresPanel.setLayout( new BorderLayout() ); + trabalhadoresPanel.add( new JLabel( "Consultas / ECDs", JLabel.CENTER ), BorderLayout.NORTH ); + trabalhadoresPanel.add( listTrabalhadoresScroll, BorderLayout.CENTER ); + + listTrabalhadoresPanel.showList( provider.getLembretesMarcacaoTrabalhador( empresaID, estabelecimentoID ) ); +// listEstabelecimentosPanel.showList( estabelecimentos.toArray( new IDObject[ estabelecimentos.size() ] ) ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/externos/actions/TratarExternoAction.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/externos/actions/TratarExternoAction.java new file mode 100755 index 00000000..4156dbdf --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/externos/actions/TratarExternoAction.java @@ -0,0 +1,102 @@ +/* + * TratarMarcacaoTrabalhadorAction.java + * + * Created on January 31, 2007, 6:21 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.externos.actions; + +import java.awt.Component; +import java.awt.event.ActionEvent; + +import javax.swing.AbstractAction; +import javax.swing.JOptionPane; + +import siprp.SIPRPTracker; +import siprp.SingletonConstants; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.Trabalhadores; +import siprp.database.cayenne.providers.MedicinaDAO; +import siprp.lembretes.Lembrete; +import siprp.lembretes.LembretesDataProvider; +import siprp.medicina.processo.logic.MedicinaProcessoLogic; +import siprp.medicina.processo.ui.MedicinaProcessoWindow; + +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.DialogException; + +/** + * + * @author fpalma + */ +public class TratarExternoAction extends AbstractAction +{ + private static final long serialVersionUID = 1L; + private LembretesDataProvider lembretesProvider; + private SIPRPTracker tracker; + + private Integer lembreteID; + + private MedicinaDAO medicinaDAO = new MedicinaDAO(); + + /** + * Creates a new instance of TratarMarcacaoTrabalhadorAction + */ + public TratarExternoAction(IDObject lembrete) + { + super( "Tratar" ); + try + { + lembreteID = lembrete.getID(); + lembretesProvider = LembretesDataProvider.getProvider(); + } catch( Exception ex ) + { + ex.printStackTrace(); + } + } + + public void actionPerformed( ActionEvent e ) + { + try + { + tracker = (SIPRPTracker) Singleton.getInstance( SingletonConstants.SIPRP_TRACKER ); + Lembrete lembrete = lembretesProvider.getLembreteByID( lembreteID ); + if( lembrete == null ) + { + JOptionPane.showMessageDialog( null, "Este lembrete j\u00e1 foi tratado.", "J\u00e1 tratado", JOptionPane.WARNING_MESSAGE ); + } + else + { + Trabalhadores trabalhador = null; + Estabelecimentos estabelecimento = null; + Empresas empresa = null; + trabalhador = medicinaDAO.getTrabalhadorByID( lembrete.getTrabalhadorID() ); + estabelecimento = trabalhador.getToEstabelecimentos(); + empresa = estabelecimento.getToEmpresas(); + MedicinaProcessoWindow window = tracker.getMedicinaProcessoWindow(); + + window.runActionLater( MedicinaProcessoLogic.SELECT_EMPRESA, empresa ); + window.runActionLater( MedicinaProcessoLogic.SELECT_ESTABELECIMENTO, estabelecimento ); + window.runActionLater( MedicinaProcessoLogic.LOAD_TRABALHADOR, trabalhador ); + window.runActionLater( MedicinaProcessoLogic.SELECT_TRABALHADOR, trabalhador ); + window.runPendingActions(); + window.setVisible( true ); + lembretesProvider.apagarLembreteByID( lembreteID ); + } + Object source = e.getSource(); + if( source instanceof Component ) + { + ((Component) source).setEnabled( false ); + } + } catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a tratar", true ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/marcacoes/LembretesMarcacaoPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/marcacoes/LembretesMarcacaoPanel.java new file mode 100755 index 00000000..b6cba869 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/marcacoes/LembretesMarcacaoPanel.java @@ -0,0 +1,69 @@ +/* + * LembretesRemarcacaoPanel.java + * + * Created on 13 de Fevereiro de 2007, 23:24 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.marcacoes; + +import java.awt.BorderLayout; +import java.awt.GridLayout; + +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; + +import siprp.lembretes.LembretesConstants; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.ui.panel.multipleactionlist.MultipleActionListPanel; + + +public class LembretesMarcacaoPanel extends JPanel + implements LembretesConstants +{ + protected JScrollPane listTrabalhadoresScroll; + protected MultipleActionListPanel listTrabalhadoresPanel; + + protected MarcacoesDataProvider provider; + + private final Integer empresaID; + private final Integer estabelecimentoID; + + private ProviderInterface JDO; + + /** Creates a new instance of LembretesRemarcacaoPanel */ + public LembretesMarcacaoPanel( Integer empresaID, Integer estabelecimentoID ) + throws Exception + { + this.empresaID = empresaID; + this.estabelecimentoID = estabelecimentoID; + provider = MarcacoesDataProvider.getProvider(); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + listTrabalhadoresPanel = + new MultipleActionListPanel( + new MarcacoesActionFactory[]{ }, + new MarcacoesActionFactory[]{ new MarcacoesActionFactory( MarcacoesActionFactory.TRABALHADOR ) } ); + listTrabalhadoresScroll = + new JScrollPane( listTrabalhadoresPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + setLayout( new GridLayout( 1, 2 ) ); + JPanel trabalhadoresPanel = new JPanel(); + add( trabalhadoresPanel ); + + trabalhadoresPanel.setLayout( new BorderLayout() ); + trabalhadoresPanel.add( new JLabel( "Consultas / ECDs", JLabel.CENTER ), BorderLayout.NORTH ); + trabalhadoresPanel.add( listTrabalhadoresScroll, BorderLayout.CENTER ); + + listTrabalhadoresPanel.showList( provider.getLembretesMarcacaoTrabalhador( empresaID, estabelecimentoID ) ); +// listEstabelecimentosPanel.showList( estabelecimentos.toArray( new IDObject[ estabelecimentos.size() ] ) ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/marcacoes/MarcacoesActionFactory.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/marcacoes/MarcacoesActionFactory.java new file mode 100755 index 00000000..c1eafae9 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/marcacoes/MarcacoesActionFactory.java @@ -0,0 +1,54 @@ +/* + * RemarcacoesActionFactory.java + * + * Created on January 31, 2007, 6:37 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.marcacoes; + +import javax.swing.Action; + +import siprp.lembretes.marcacoes.actions.TratarCriacaoProcessoTrabalhadorAction; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.panel.multipleactionlist.ActionFactory; + +/** + * + * @author fpalma + */ +public class MarcacoesActionFactory implements ActionFactory +{ + public static final int TRABALHADOR = 0; + + protected final int TIPO; + + /** + * Creates a new instance of RemarcacoesActionFactory + */ + public MarcacoesActionFactory( int tipo ) + { + TIPO = tipo; + } + + public Action createAction(IDObject[] objects) + { + return null; + } + + public Action createAction(IDObject object) + { + switch( TIPO ) + { + case TRABALHADOR: + return new TratarCriacaoProcessoTrabalhadorAction( object ); + + default: + return null; + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/marcacoes/MarcacoesDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/marcacoes/MarcacoesDataProvider.java new file mode 100755 index 00000000..bda51f2f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/marcacoes/MarcacoesDataProvider.java @@ -0,0 +1,150 @@ +/* + * RemarcacoesDataProvider.java + * + * Created on February 14, 2007, 10:56 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.marcacoes; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; + +import java.text.DateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.Locale; + +import siprp.lembretes.LembretesConstants; +import siprp.lembretes.LembretesDataProvider; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; + +/** + * + * @author lflores + */ +public class MarcacoesDataProvider +{ + private static final DateFormat D_F = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); + + private static final Object LOCK = new Object(); + private static MarcacoesDataProvider instance = null; + + private Executer EXECUTER; + private LembretesDataProvider lembretesProvider; + + /** Creates a new instance of RemarcacoesDataProvider */ + public MarcacoesDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + lembretesProvider = LembretesDataProvider.getProvider(); + } + + public static MarcacoesDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new MarcacoesDataProvider(); + } + } + return instance; + } + + private Expression whereExpressionLembretesRemarcacao( Integer empresaID, Integer estabelecimentoID ) throws Exception + { + Expression result = new Field( "lembretes.tipo_id" ).isEqual( + lembretesProvider.getTipoLembreteByCodigo( LembretesConstants.CODE_MARCACOES ).getID() ).and( + new Field( "lembretes.data" ).isLessOrEqual( new Field( "current_date" ) ) ).and( + new Field( "lembretes.deleted_date" ).isEqual( null ) ); + if( empresaID != null ) + { + result = result.and( new Field("empresas.id").isEqual( empresaID ) ); + if( estabelecimentoID != null ) + { + result = result.and( new Field("estabelecimentos.id").isEqual( estabelecimentoID ) ); + } + } + return result; + } + + public IDObject[] getLembretesMarcacaoTrabalhador( Integer empresaID, Integer estabelecimentoID ) + throws Exception + { + Select select = + new Select2( new String[]{ "lembretes", "marcacoes_trabalhador", "trabalhadores", + "estabelecimentos", "empresas", "trabalhadores_consultas_datas", "trabalhadores_ecds_datas"}, + new Integer [] { + Select2.JOIN_LEFT_OUTER, Select2.JOIN_LEFT_OUTER, + Select2.JOIN_LEFT_OUTER, Select2.JOIN_LEFT_OUTER, + Select2.JOIN_LEFT_OUTER, Select2.JOIN_LEFT_OUTER + }, + new Expression[]{ + new Field( "lembretes.marcacao_trabalhador_id" ).isEqual( new Field( "marcacoes_trabalhador.id" ) ),/*.or( + new Field( "lembretes.trabalhadores_consultas_datas_id" ).isEqual( new Field( "trabalhadores_consultas_datas.id" ) ) + ).or( + new Field( "lembretes.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ) + ), + */ + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).or( new Field( "lembretes.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ), + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ), + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ), + new Field( "lembretes.trabalhadores_consultas_datas_id" ).isEqual( new Field( "trabalhadores_consultas_datas.id" ) ), + new Field( "lembretes.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ) + }, + new String[]{ "lembretes.id", "lembretes.descricao", + "marcacoes_trabalhador.tipo", "lembretes.data", + "trabalhadores.nome", "estabelecimentos.nome", "empresas.designacao_social", + "trabalhadores.nome_plain" }, + whereExpressionLembretesRemarcacao( empresaID, estabelecimentoID ), + new String[]{ "trabalhadores.nome_plain" }, + null, + null, + null + ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + IDObject lembretes[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < lembretes.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String descricao = ( String ) array.get( n, 1 ); + Date data = ( Date ) array.get( n, 3 ); + Calendar c = Calendar.getInstance(); + c.setTime( data ); +// c.add( Calendar.MONTH, 2 ); +// + String trabalhador = ( String ) array.get( n, 4 ); + String split[] = trabalhador.split( " " ); + if( split != null && split.length > 1 && split[0] != null && split[0].length() > 0 && split[1] != null && split[1].length() > 0 ) + { + trabalhador = split[ 0 ] + " " + ( split.length > 2 ? split[ 1 ].charAt( 0 ) + ". " : " " ) + + ( split.length > 1 ? split[ split.length - 1 ] : "" ); + String estabelecimento = ( String ) array.get( n, 5 ); + String empresa = ( String ) array.get( n, 6 ); + String str = "" + trabalhador + "" + + "
   " + "Ficha de aptid" + atilde + "o caduca a " + D_F.format( c.getTime() ) + + "
   " + descricao + "" + + "
   " + empresa.substring( 0, empresa.length() > 20 ? 20 : empresa.length() ) + + " / " + estabelecimento.substring( 0, estabelecimento.length() > 10 ? 10 : estabelecimento.length() ) + + ""; + lembretes[ n ] = new MappableObject( id, str ); + } + } + return lembretes; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/marcacoes/actions/TratarCriacaoProcessoTrabalhadorAction.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/marcacoes/actions/TratarCriacaoProcessoTrabalhadorAction.java new file mode 100644 index 00000000..f903de92 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/marcacoes/actions/TratarCriacaoProcessoTrabalhadorAction.java @@ -0,0 +1,107 @@ +/* + * TratarMarcacaoTrabalhadorAction.java + * + * Created on January 31, 2007, 6:21 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.marcacoes.actions; + +import java.awt.Component; +import java.awt.event.ActionEvent; + +import javax.swing.AbstractAction; +import javax.swing.JOptionPane; + +import siprp.SIPRPTracker; +import siprp.SingletonConstants; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.Trabalhadores; +import siprp.database.cayenne.providers.MedicinaDAO; +import siprp.lembretes.Lembrete; +import siprp.lembretes.LembretesDataProvider; +import siprp.medicina.processo.logic.MedicinaProcessoLogic; +import siprp.medicina.processo.ui.MedicinaProcessoWindow; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.DialogException; + +/** + * + * @author fpalma + */ +public class TratarCriacaoProcessoTrabalhadorAction extends AbstractAction +{ + private LembretesDataProvider lembretesProvider; + private ProviderInterface JDO; + private SIPRPTracker tracker; + + private Integer lembreteID; + + private MedicinaDAO medicinaDAO = new MedicinaDAO(); + + /** + * Creates a new instance of TratarMarcacaoTrabalhadorAction + */ + public TratarCriacaoProcessoTrabalhadorAction( IDObject lembrete ) + { + super( "Tratar" ); + try + { + lembreteID = lembrete.getID(); + lembretesProvider = LembretesDataProvider.getProvider(); + JDO = (ProviderInterface) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + + public void actionPerformed(ActionEvent e) + { + try + { + tracker = ( SIPRPTracker ) Singleton.getInstance( SingletonConstants.SIPRP_TRACKER ); + Lembrete lembrete = lembretesProvider.getLembreteByID( lembreteID ); + if( lembrete == null ) + { + JOptionPane.showMessageDialog( null, "Este lembrete j\u00e1 foi tratado.", "J\u00e1 tratado", + JOptionPane.WARNING_MESSAGE ); + } + else + { + Trabalhadores trabalhador = null; + Estabelecimentos estabelecimento = null; + Empresas empresa = null; + trabalhador = medicinaDAO.getTrabalhadorByID( lembrete.getTrabalhadorID() ); + estabelecimento = trabalhador.getToEstabelecimentos(); + empresa = estabelecimento.getToEmpresas(); + MedicinaProcessoWindow window = tracker.getMedicinaProcessoWindow(); + + window.runActionLater( MedicinaProcessoLogic.SELECT_EMPRESA, empresa ); + window.runActionLater( MedicinaProcessoLogic.SELECT_ESTABELECIMENTO, estabelecimento ); + window.runActionLater( MedicinaProcessoLogic.LOAD_TRABALHADOR, trabalhador ); + window.runActionLater( MedicinaProcessoLogic.SELECT_TRABALHADOR, trabalhador ); + window.runPendingActions(); + window.setVisible( true ); + lembretesProvider.apagarLembreteByID( lembreteID ); + } + Object source = e.getSource(); + if( source instanceof Component ) + { + ((Component) source).setEnabled( false ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a tratar", true ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/remarcacoes/LembretesRemarcacaoPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/remarcacoes/LembretesRemarcacaoPanel.java new file mode 100644 index 00000000..301f1d11 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/remarcacoes/LembretesRemarcacaoPanel.java @@ -0,0 +1,92 @@ +/* + * LembretesRemarcacaoPanel.java + * + * Created on 13 de Fevereiro de 2007, 23:24 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.remarcacoes; + +import java.awt.BorderLayout; +import java.awt.GridLayout; + +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; + +import siprp.lembretes.LembretesConstants; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.ui.panel.multipleactionlist.MultipleActionListPanel; + +/** + * + * @author Frederico + */ +public class LembretesRemarcacaoPanel extends JPanel + implements LembretesConstants +{ + protected JScrollPane listTrabalhadoresScroll; + protected JScrollPane listEstabelecimentosScroll; + protected MultipleActionListPanel listTrabalhadoresPanel; + protected MultipleActionListPanel listEstabelecimentosPanel; + + protected RemarcacoesDataProvider provider; + + private final Integer empresaID; + private final Integer estabelecimentoID; + + private ProviderInterface JDO; + + /** Creates a new instance of LembretesRemarcacaoPanel */ + public LembretesRemarcacaoPanel( Integer empresaID, Integer estabelecimentoID ) + throws Exception + { + this.empresaID = empresaID; + this.estabelecimentoID = estabelecimentoID; + provider = RemarcacoesDataProvider.getProvider(); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + listTrabalhadoresPanel = + new MultipleActionListPanel( + new RemarcacoesActionFactory[]{ }, + new RemarcacoesActionFactory[]{ new RemarcacoesActionFactory( RemarcacoesActionFactory.TRABALHADOR ) } ); + listTrabalhadoresScroll = + new JScrollPane( listTrabalhadoresPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + listEstabelecimentosPanel = + new MultipleActionListPanel( + new RemarcacoesActionFactory[]{ }, + new RemarcacoesActionFactory[]{ new RemarcacoesActionFactory( RemarcacoesActionFactory.ESTABELECIMENTO ) } ); + listEstabelecimentosScroll = + new JScrollPane( listEstabelecimentosPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + setLayout( new GridLayout( 1, 2 ) ); + JPanel trabalhadoresPanel = new JPanel(); + JPanel estabelecimentosPanel = new JPanel(); + add( trabalhadoresPanel ); + add( estabelecimentosPanel ); + + trabalhadoresPanel.setLayout( new BorderLayout() ); + trabalhadoresPanel.add( new JLabel( "Consultas / ECDs", JLabel.CENTER ), BorderLayout.NORTH ); + trabalhadoresPanel.add( listTrabalhadoresScroll, BorderLayout.CENTER ); + + estabelecimentosPanel.setLayout( new BorderLayout() ); + estabelecimentosPanel.add( new JLabel( "Higiene e Seguran\u00e7a", JLabel.CENTER ), BorderLayout.NORTH ); + estabelecimentosPanel.add( listEstabelecimentosScroll, BorderLayout.CENTER ); + + listTrabalhadoresPanel.showList( provider.getLembretesRemarcacaoTrabalhador( empresaID, estabelecimentoID ) ); +// listEstabelecimentosPanel.showList( estabelecimentos.toArray( new IDObject[ estabelecimentos.size() ] ) ); + } + + protected String criarDetalhesMarcacaoTrabalhador( Integer marcacaoID ) + { + return null; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/remarcacoes/RemarcacoesActionFactory.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/remarcacoes/RemarcacoesActionFactory.java new file mode 100644 index 00000000..8b538b5f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/remarcacoes/RemarcacoesActionFactory.java @@ -0,0 +1,59 @@ +/* + * RemarcacoesActionFactory.java + * + * Created on January 31, 2007, 6:37 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.remarcacoes; + +import javax.swing.Action; + +import siprp.lembretes.remarcacoes.actions.TratarMarcacaoEstabelecimentoAction; +import siprp.lembretes.remarcacoes.actions.TratarMarcacaoTrabalhadorAction; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.panel.multipleactionlist.ActionFactory; + +/** + * + * @author fpalma + */ +public class RemarcacoesActionFactory implements ActionFactory +{ + public static final int TRABALHADOR = 0; + public static final int ESTABELECIMENTO = 1; + + protected final int TIPO; + + /** + * Creates a new instance of RemarcacoesActionFactory + */ + public RemarcacoesActionFactory( int tipo ) + { + TIPO = tipo; + } + + public Action createAction(IDObject[] objects) + { + return null; + } + + public Action createAction(IDObject object) + { + switch( TIPO ) + { + case TRABALHADOR: + return new TratarMarcacaoTrabalhadorAction( object ); + + case ESTABELECIMENTO: + return new TratarMarcacaoEstabelecimentoAction( object ); + + default: + return null; + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/remarcacoes/RemarcacoesDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/remarcacoes/RemarcacoesDataProvider.java new file mode 100644 index 00000000..1bc1896d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/remarcacoes/RemarcacoesDataProvider.java @@ -0,0 +1,170 @@ +/* + * RemarcacoesDataProvider.java + * + * Created on February 14, 2007, 10:56 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.remarcacoes; + +import java.text.DateFormat; +import java.util.Date; +import java.util.Locale; + +import siprp.data.Marcacao; +import siprp.lembretes.LembretesConstants; +import siprp.lembretes.LembretesDataProvider; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; + +/** + * + * @author lflores + */ +public class RemarcacoesDataProvider +{ + private static final DateFormat D_F = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); + + private static final Object LOCK = new Object(); + private static RemarcacoesDataProvider instance = null; + + private Executer EXECUTER; + private LembretesDataProvider lembretesProvider; + + /** Creates a new instance of RemarcacoesDataProvider */ + public RemarcacoesDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + lembretesProvider = LembretesDataProvider.getProvider(); + } + + public static RemarcacoesDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new RemarcacoesDataProvider(); + } + } + return instance; + } + + private Expression whereExpressionLembretesRemarcacao( Integer empresaID, Integer estabelecimentoID ) throws Exception + { + Expression result = new Field( "lembretes.tipo_id" ).isEqual( + lembretesProvider.getTipoLembreteByCodigo( LembretesConstants.CODE_REMARCACOES ).getID() ).and( + new Field( "lembretes.data" ).isLessOrEqual( new Field( "current_date" ) ) ).and( + new Field( "lembretes.deleted_date" ).isEqual( null ) ); + if( empresaID != null ) + { + result = result.and( new Field("empresas.id").isEqual( empresaID ) ); + if( estabelecimentoID != null ) + { + result = result.and( new Field("estabelecimentos.id").isEqual( estabelecimentoID ) ); + } + } + return result; + } + + public IDObject[] getLembretesRemarcacaoTrabalhador( Integer empresaID, Integer estabelecimentoID ) + throws Exception + { + Select select = + new Select2( new String[]{ "lembretes", "marcacoes_trabalhador", "trabalhadores", + "estabelecimentos", "empresas", "trabalhadores_consultas_datas", "trabalhadores_ecds_datas"}, + new Integer [] { + Select2.JOIN_LEFT_OUTER, Select2.JOIN_LEFT_OUTER, + Select2.JOIN_LEFT_OUTER, Select2.JOIN_LEFT_OUTER, + Select2.JOIN_LEFT_OUTER, Select2.JOIN_LEFT_OUTER + }, + new Expression[]{ + new Field( "lembretes.marcacao_trabalhador_id" ).isEqual( new Field( "marcacoes_trabalhador.id" ) ),/*.or( + new Field( "lembretes.trabalhadores_consultas_datas_id" ).isEqual( new Field( "trabalhadores_consultas_datas.id" ) ) + ).or( + new Field( "lembretes.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ) + ), + */ + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).or( new Field( "lembretes.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ), + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ), + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ), + new Field( "lembretes.trabalhadores_consultas_datas_id" ).isEqual( new Field( "trabalhadores_consultas_datas.id" ) ), + new Field( "lembretes.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ) + }, + new String[]{ "lembretes.id", "lembretes.descricao", + "marcacoes_trabalhador.tipo", "marcacoes_trabalhador.data", + "trabalhadores.nome", "estabelecimentos.nome", "empresas.designacao_social", + "trabalhadores.nome_plain", "trabalhadores_consultas_datas.data", "trabalhadores_ecds_datas.data" }, + whereExpressionLembretesRemarcacao( empresaID, estabelecimentoID ), + new String[]{ "trabalhadores.nome_plain" }, + null, + null, + null + ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + IDObject lembretes[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < lembretes.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String descricao = ( String ) array.get( n, 1 ); + Integer tipoMarcacao = ( Integer ) array.get( n, 2 ); + Date trabalhadorConsultaDataData = ( Date ) array.get( n, 8 ); + Date trabalhadorExameDataData = ( Date ) array.get( n, 9 ); + Date data = ( Date ) array.get( n, 3 ); + if( tipoMarcacao == null ) + { + if( trabalhadorConsultaDataData != null ) + { + tipoMarcacao = Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA; + data = trabalhadorConsultaDataData; + } + else if( trabalhadorExameDataData != null ) + { + tipoMarcacao = Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES; + data = trabalhadorExameDataData; + } + } + String tipoMarcacaoStr = ""; + if( tipoMarcacao != null ) + { + switch( tipoMarcacao.intValue() ) + { + case Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES: + tipoMarcacaoStr = "ECDs"; + break; + case Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA: + tipoMarcacaoStr = "Consulta"; + break; + } + } + String trabalhador = ( String ) array.get( n, 4 ); + String split[] = trabalhador.split( " " ); + trabalhador = split[ 0 ] + " " + ( split.length > 2 ? split[ 1 ].charAt( 0 ) + ". " : " " ) + + ( split.length > 1 ? split[ split.length - 1 ] : "" ); + String estabelecimento = ( String ) array.get( n, 5 ); + String empresa = ( String ) array.get( n, 6 ); + String str = "" + trabalhador + "" + + "
   " + tipoMarcacaoStr + " de " + D_F.format( data ) + + "
   " + descricao + "" + + "
   " + empresa.substring( 0, empresa.length() > 20 ? 20 : empresa.length() ) + + " / " + estabelecimento.substring( 0, estabelecimento.length() > 10 ? 10 : estabelecimento.length() ) + + ""; + lembretes[ n ] = new MappableObject( id, str ); + } + return lembretes; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/remarcacoes/actions/TratarMarcacaoEstabelecimentoAction.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/remarcacoes/actions/TratarMarcacaoEstabelecimentoAction.java new file mode 100644 index 00000000..81122929 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/remarcacoes/actions/TratarMarcacaoEstabelecimentoAction.java @@ -0,0 +1,50 @@ +/* + * tratarMarcacaoTrabalhadorAction.java + * + * Created on January 31, 2007, 6:21 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.remarcacoes.actions; + +import java.awt.Component; +import java.awt.event.ActionEvent; + +import javax.swing.AbstractAction; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.DialogException; + +/** + * + * @author fpalma + */ +public class TratarMarcacaoEstabelecimentoAction extends AbstractAction +{ + /** + * Creates a new instance of tratarMarcacaoTrabalhadorAction + */ + public TratarMarcacaoEstabelecimentoAction( IDObject marcacaoID ) + { + super( "Tratar" ); + } + + public void actionPerformed(ActionEvent e) + { + try + { + Object source = e.getSource(); + if( source instanceof Component ) + { + ((Component) source).setEnabled( false ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a marcar", true ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/remarcacoes/actions/TratarMarcacaoTrabalhadorAction.java b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/remarcacoes/actions/TratarMarcacaoTrabalhadorAction.java new file mode 100644 index 00000000..e51425ae --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/lembretes/remarcacoes/actions/TratarMarcacaoTrabalhadorAction.java @@ -0,0 +1,157 @@ +/* + * TratarMarcacaoTrabalhadorAction.java + * + * Created on January 31, 2007, 6:21 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.remarcacoes.actions; + +import java.awt.Component; +import java.awt.event.ActionEvent; + +import javax.swing.AbstractAction; +import javax.swing.JOptionPane; + +import siprp.SIPRPTracker; +import siprp.SingletonConstants; +import siprp.data.outer.EmpresasData; +import siprp.data.outer.EstabelecimentosData; +import siprp.data.outer.MarcacoesTrabalhadorData; +import siprp.data.outer.TrabalhadoresData; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.Trabalhadores; +import siprp.database.cayenne.objects.TrabalhadoresConsultas; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatas; +import siprp.database.cayenne.objects.TrabalhadoresEcds; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatas; +import siprp.database.cayenne.objects.TrabalhadoresProcesso; +import siprp.database.cayenne.providers.MedicinaDAO; +import siprp.lembretes.Lembrete; +import siprp.lembretes.LembretesDataProvider; +import siprp.medicina.processo.logic.MedicinaProcessoLogic; +import siprp.medicina.processo.ui.MedicinaProcessoWindow; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.DialogException; + +/** + * + * @author fpalma + */ +public class TratarMarcacaoTrabalhadorAction extends AbstractAction +{ + private LembretesDataProvider lembretesProvider; + private ProviderInterface JDO; + private SIPRPTracker tracker; + + private Integer lembreteID; + + private MedicinaDAO medicinaDAO = new MedicinaDAO(); + + /** + * Creates a new instance of TratarMarcacaoTrabalhadorAction + */ + public TratarMarcacaoTrabalhadorAction( IDObject lembrete ) + { + super( "Tratar" ); + try + { + lembreteID = lembrete.getID(); + lembretesProvider = LembretesDataProvider.getProvider(); + JDO = (ProviderInterface) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + + public void actionPerformed(ActionEvent e) + { + try + { + tracker = ( SIPRPTracker ) Singleton.getInstance( SingletonConstants.SIPRP_TRACKER ); + Lembrete lembrete = lembretesProvider.getLembreteByID( lembreteID ); + if( lembrete == null ) + { + JOptionPane.showMessageDialog( null, "Este lembrete j\u00e1 foi tratado.", "J\u00e1 tratado", + JOptionPane.WARNING_MESSAGE ); + } + else + { + if( lembrete.getMarcacaoTrabalhadorID() != null ) + { + // old model + MarcacoesTrabalhadorData marcacao = ( MarcacoesTrabalhadorData ) JDO.load( MarcacoesTrabalhadorData.class, lembrete.getMarcacaoTrabalhadorID() ); + TrabalhadoresData trabalhador = marcacao.toTrabalhador_id(); + EstabelecimentosData estabelecimento = trabalhador.toEstabelecimento_id(); + EmpresasData empresa = estabelecimento.toEmpresa_id(); + + lembretesProvider.apagarLembreteByID( lembreteID ); + setEnabled( false ); + tracker.getMedicinaWindow().setVisible( true ); + tracker.getMedicinaWindow().setEmpresaAndEstabelecimentoAndTrabalhador( (Integer) empresa.get( EmpresasData.ID ), + ( Integer ) estabelecimento.get( EstabelecimentosData.ID ), + ( Integer ) trabalhador.get( TrabalhadoresData.ID ) ); + } + else + { + // new model + Integer consultaID = lembrete.getConsultaDataID(); + Integer exameID = lembrete.getExameDataID(); + TrabalhadoresConsultasDatas consultaMarcacao = null; + TrabalhadoresConsultas consulta = null; + TrabalhadoresEcdsDatas exameMarcacao = null; + TrabalhadoresEcds exame = null; + TrabalhadoresProcesso processo = null; + Trabalhadores trabalhador = null; + Estabelecimentos estabelecimento = null; + Empresas empresa = null; + if( consultaID != null ) + { + consultaMarcacao = medicinaDAO.getConsultaMarcacaoByID( consultaID ); + consulta = consultaMarcacao.getToTrabalhadoresConsultas(); + processo = consulta.getToTrabalhadoresProcesso(); + } + else if( exameID != null ) + { + exameMarcacao = medicinaDAO.getExameMarcacaoByID( exameID ); + exame = exameMarcacao.getToTrabalhadoresEcds(); + processo = exame.getToTrabalhadoresProcesso(); + } + trabalhador = processo.getToTrabalhadores(); + estabelecimento = trabalhador.getToEstabelecimentos(); + empresa = estabelecimento.getToEmpresas(); + MedicinaProcessoWindow window = tracker.getMedicinaProcessoWindow(); + + window.runActionLater( MedicinaProcessoLogic.SELECT_EMPRESA, empresa ); + window.runActionLater( MedicinaProcessoLogic.SELECT_ESTABELECIMENTO, estabelecimento ); + window.runActionLater( MedicinaProcessoLogic.LOAD_TRABALHADOR, trabalhador ); + window.runActionLater( MedicinaProcessoLogic.SELECT_TRABALHADOR, trabalhador ); + window.runActionLater( MedicinaProcessoLogic.SELECT_PROCESSO, processo ); + window.runActionLater( consulta == null ? MedicinaProcessoLogic.SELECT_EXAME : MedicinaProcessoLogic.SELECT_CONSULTA, consulta == null ? exame : consulta ); + window.runActionLater( consulta == null ? MedicinaProcessoLogic.CREATE_EXAME_MARCACAO : MedicinaProcessoLogic.CREATE_CONSULTA_MARCACAO, null ); + window.runPendingActions(); + window.setVisible( true ); + lembretesProvider.apagarLembreteByID( lembreteID ); + } + } + Object source = e.getSource(); + if( source instanceof Component ) + { + ((Component) source).setEnabled( false ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a tratar", true ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/logic/HigieneSegurancaLogic.java b/branches/SIPRP/SIPRPSoft/src/siprp/logic/HigieneSegurancaLogic.java new file mode 100644 index 00000000..7a64df6d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/logic/HigieneSegurancaLogic.java @@ -0,0 +1,667 @@ +package siprp.logic; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import static com.evolute.utils.strings.UnicodeLatin1Map.iacute; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; + +import javax.swing.tree.DefaultMutableTreeNode; + +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.HsArea; +import siprp.database.cayenne.objects.HsEmailEstabelecimento; +import siprp.database.cayenne.objects.HsEquipamento; +import siprp.database.cayenne.objects.HsLegislacao; +import siprp.database.cayenne.objects.HsLegislacaoCategoria; +import siprp.database.cayenne.objects.HsLegislacaoEmpresa; +import siprp.database.cayenne.objects.HsLegislacaoEstabelecimento; +import siprp.database.cayenne.objects.HsNormalizacao; +import siprp.database.cayenne.objects.HsNormalizacaoEmpresa; +import siprp.database.cayenne.objects.HsNormalizacaoEstabelecimento; +import siprp.database.cayenne.objects.HsPosto; +import siprp.database.cayenne.objects.HsPostoEstabelecimento; +import siprp.database.cayenne.objects.HsPostoRisco; +import siprp.database.cayenne.objects.HsRelatorio; +import siprp.database.cayenne.objects.HsRelatorioArea; +import siprp.database.cayenne.objects.HsRelatorioLegislacao; +import siprp.database.cayenne.objects.HsRelatorioMedida; +import siprp.database.cayenne.objects.HsRelatorioNormalizacao; +import siprp.database.cayenne.objects.HsRelatorioPosto; +import siprp.database.cayenne.objects.HsRelatorioPostoMedida; +import siprp.database.cayenne.objects.HsRelatorioPostoRisco; +import siprp.database.cayenne.objects.HsRelatorioRisco; +import siprp.database.cayenne.objects.HsRelatorioRiscoValorQualitativo; +import siprp.database.cayenne.objects.HsRisco; +import siprp.database.cayenne.objects.HsRiscoEmpresa; +import siprp.database.cayenne.objects.HsRiscoMedida; +import siprp.database.cayenne.objects.HsRiscoTema; +import siprp.database.cayenne.providers.MedicinaDAO; +import siprp.database.cayenne.providers.PlanoActuacaoDAO; +import siprp.logic.node.AreaNode; +import siprp.logic.node.AreaRelatorioNode; +import siprp.logic.node.NodeMedida; +import siprp.logic.node.NodeRisco; +import siprp.logic.node.NodeRiscoTema; +import siprp.logic.node.PostoNode; +import siprp.logic.node.PostoRelatorioNode; + +import com.evolute.utils.error.ErrorLogger; +import com.evolute.utils.ui.trees.TreeTools; + +public class HigieneSegurancaLogic +{ + + private static final PlanoActuacaoDAO planoProvider = new PlanoActuacaoDAO(); + + private static final MedicinaDAO medicinaProvider = new MedicinaDAO(); + + public static DefaultMutableTreeNode getRiscosTree() + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + List temas = planoProvider.getAllRiscoTemas(); + if( temas != null ) + { + for( HsRiscoTema tema : temas ) + { + NodeRiscoTema temaNode = new NodeRiscoTema( tema ); + for( HsRisco risco : tema.getHsRiscoArray() ) + { + NodeRisco riscoNode = new NodeRisco( risco ); + for( HsRiscoMedida rel : risco.getHsRiscoMedidaArray() ) + { + riscoNode.add( new NodeMedida( rel ) ); + } + temaNode.add( riscoNode ); + } + result.add( temaNode ); + } + } + return result; + } + + public static DefaultMutableTreeNode getRiscosTree( Empresas empresa ) + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + for( HsRiscoEmpresa rel : empresa.getHsRiscoEmpresaArray() ) + { + HsRisco risco = rel.getToHsRisco(); + HsRiscoTema tema = risco.getToHsRiscoTema(); + DefaultMutableTreeNode temaNode = TreeTools.findNodeWithUserObject( tema, result ); + if( temaNode == null ) + { + temaNode = new NodeRiscoTema( tema ); + result.add(temaNode); + } + temaNode.add( new NodeRisco( risco ) ); + } + return result; + } + + public static DefaultMutableTreeNode getAreasTree( Empresas empresa ) + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + if( empresa != null ) + { + for( HsArea area : empresa.getHsAreaArray() ) + { + AreaNode areaNode = new AreaNode(area); + for( HsPosto posto : area.getHsPostoArray() ) + { + if( posto != null && posto.getDeletedDate() == null ) + { + areaNode.add( new PostoNode( posto ) ); + } + } + result.add( areaNode ); + } + } + return result; + } + + public static DefaultMutableTreeNode getAreasTree( Estabelecimentos estabelecimento ) + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + if( estabelecimento != null ) + { + List postos = estabelecimento.getHsPostoEstabelecimentoArray(); + for( HsPostoEstabelecimento rel : postos ) + { + HsPosto posto = rel.getToHsPosto(); + HsArea area = posto.getToHsArea(); + DefaultMutableTreeNode areaNode = TreeTools.findNodeWithUserObject( area, result ); + if( areaNode == null ) + { + areaNode = new AreaNode( area ); + result.add( areaNode ); + } + areaNode.add( new PostoNode( posto ) ); + } + TreeTools.sort( result ); + } + return result; + } + + public static DefaultMutableTreeNode getPostosTree( Estabelecimentos estabelecimento ) + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + if( estabelecimento != null ) + { + List postos = estabelecimento.getHsPostoEstabelecimentoArray(); + for( HsPostoEstabelecimento rel : postos ) + { + result.add( new PostoNode( rel.getToHsPosto() ) ); + } + } + return result; + } + + public static List getAllEmpresas() + { + return medicinaProvider.getAllEmpresas(); + } + + public static List getAllValoresQualitativos() + { + return planoProvider.getAllValoresQualitativos(); + } + + public static DefaultMutableTreeNode getAreasRelatorioTree( HsRelatorio relatorio ) + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + if( relatorio != null ) + { + List areas = relatorio.getHsRelatorioArea(); + for( HsRelatorioArea area : areas ) + { + if( area.getDeletedDate() == null ) + { + AreaRelatorioNode areaNode = new AreaRelatorioNode(area); + for( HsRelatorioPosto posto : area.getHsRelatorioPostoArray() ) + { + if( posto.getDeletedDate() == null ) + { + areaNode.add( new PostoRelatorioNode( posto ) ); + } + } + result.add( areaNode ); + } + } + } + return result; + } + + public static void reverterRelatorio( HsRelatorio relatorio ) + { + try + { + if(relatorio != null) + { + Estabelecimentos estabelecimento = relatorio.getToHsMarcacoesEstabelecimento() == null ? null : relatorio.getToHsMarcacoesEstabelecimento().getToEstabelecimentos(); + if( estabelecimento != null ) + { + reverterAreas( relatorio, estabelecimento ); + reverterLegislacao( relatorio, estabelecimento ); + reverterNormalizacao( relatorio, estabelecimento ); + } + } + } + catch( Exception e ) + { + ErrorLogger.logException(e); + } + } + + private static void reverterAreas( HsRelatorio relatorio, Estabelecimentos estabelecimento ) throws Exception + { + List areas = relatorio.getHsRelatorioArea(); + areas = new LinkedList(areas); + int areasSize = areas == null ? 0 : areas.size(); + for( int i = 0; i < areasSize; ++i ) + { + HsRelatorioArea area = areas.get( i ); + List postos = area.getHsRelatorioPostoArray(); + postos = new LinkedList(postos); + int postosSize = postos == null ? 0 : postos.size(); + for( int j = 0; j < postosSize; ++j ) + { + postos.get(j).delete(); + } + area.delete(); + } + relatorio.save(); + List postos = estabelecimento.getHsPostoEstabelecimentoArray(); + reverterPostos(relatorio,postos); + relatorio.save(); + } + + private static void reverterPostos( HsRelatorio relatorio, List postos ) throws Exception + { + HashMap areasInserted = new HashMap(); + for( HsPostoEstabelecimento rel : postos ) + { + HsPosto posto = rel.getToHsPosto(); + HsArea area = posto.getToHsArea(); + HsRelatorioPosto newPosto = createRelatorioPostoFromHsPosto( relatorio, areasInserted.get( area ), posto ); + areasInserted.put( area, newPosto.getToHsRelatorioArea() ); + } + } + + public static HsRelatorioPosto createRelatorioPostoFromHsPosto( HsRelatorio relatorio, HsRelatorioArea rArea, HsPosto posto ) throws Exception + { + HsRelatorioPosto rPosto = new HsRelatorioPosto(); + + HsArea area = posto.getToHsArea(); + if( rArea == null ) + { + rArea = new HsRelatorioArea(); + updateRelatorioAreaFromHsArea( relatorio, rArea, area ); + } + updateRelatorioPostoFromHsPosto( rPosto, rArea, posto ); + revertMedidasAndRiscos( posto, rPosto ); + rPosto.save(); + return rPosto; + } + + public static void updateRelatorioAreaFromHsArea( HsRelatorio relatorio, HsRelatorioArea rArea, HsArea area ) throws Exception + { + rArea.setDescription( area.getDescription() ); + rArea.setOrder( area.getOrder() ); + rArea.setToHsRelatorio( relatorio ); + rArea.setHsAreaId( area.getId() ); + rArea.save(); + } + + public static void updateRelatorioPostoFromHsPosto( HsRelatorioPosto rPosto, HsRelatorioArea rArea, HsPosto posto ) throws Exception + { + rPosto.setDescription( posto.getDescription() ); + rPosto.setIsPrincipal( posto.getIsPrincipal() ); + rPosto.setHsPostoId( posto.getId() ); + rPosto.setToHsRelatorioArea( rArea ); + rPosto.save(); + } + + public static void addRiscoToRelatorioPosto( HsRisco risco, Integer order, HsRelatorioPosto rPosto ) + { + HsRelatorioRisco rRelatorioRisco = new HsRelatorioRisco(); + rRelatorioRisco.setToHsRelatorio( rPosto.getToHsRelatorioArea().getToHsRelatorio() ); + rRelatorioRisco.setDescription( risco.getDescription() ); + HsRelatorioPostoRisco rPostoRisco = new HsRelatorioPostoRisco(); + rPostoRisco.setToHsRelatorioPosto( rPosto ); + rPostoRisco.setToHsRelatorioRisco( rRelatorioRisco ); + rPostoRisco.setOrder( order ); + for( HsRiscoMedida riscoMedida : risco.getHsRiscoMedidaArray() ) + { + HsRelatorioMedida rMedida = new HsRelatorioMedida(); + rMedida.setDescription( riscoMedida.getToHsMedida().getDescription() ); + rMedida.setRequesitosLegais( riscoMedida.getToHsMedida().getRequesitosLegais() ); + rMedida.setToHsRelatorioRisco( rRelatorioRisco ); + HsRelatorioPostoMedida rPostoMedida = new HsRelatorioPostoMedida(); + rPostoMedida.setIsPlanoActuacao( false ); + rPostoMedida.setToHsRelatorioMedida( rMedida ); + rPostoMedida.setToHsRelatorioPosto( rPosto ); + } + } + + private static void revertMedidasAndRiscos( HsPostoRisco postoRisco, HsRelatorioPosto rPosto ) + { + addRiscoToRelatorioPosto(postoRisco.getToHsRisco(), postoRisco.getOrder(), rPosto); + } + + private static void revertMedidasAndRiscos( List postosRiscos, HsRelatorioPosto rPosto ) + { + for( HsPostoRisco postoRisco : postosRiscos ) + { + revertMedidasAndRiscos( postoRisco, rPosto ); + } + } + + private static void revertMedidasAndRiscos( HsPosto posto, HsRelatorioPosto rPosto ) + { + revertMedidasAndRiscos(posto.getHsPostoRiscoArray(),rPosto); + } + + public static void reverterLegislacao( HsRelatorio relatorio, Estabelecimentos estabelecimento ) throws Exception + { + int legislacaoSize = relatorio.getHsRelatorioLegislacaoArray().size(); + for(int i = 0; i < legislacaoSize; ++i ) + { + relatorio.getHsRelatorioLegislacaoArray().get( 0 ).delete(); + } + for( HsLegislacaoEstabelecimento rel : estabelecimento.getHsLegislacaoEstabelecimentoArray() ) + { + HsLegislacao legislacao = rel.getToHsLegislacao(); + HsRelatorioLegislacao relatorioLegislacao = criarRelatorioLegislacao( relatorio, legislacao ); + relatorioLegislacao.setOrdem( rel.getOrdem() ); + relatorioLegislacao.save(); + } + } + + private static HsRelatorioLegislacao criarRelatorioLegislacao( HsRelatorio relatorio, HsLegislacao legislacao ) + { + HsRelatorioLegislacao result = null; + if( relatorio != null && legislacao != null ) + { + result = new HsRelatorioLegislacao(); + result.setCategoria( legislacao.getToHsLegislacaoCategoria() == null ? null : legislacao.getToHsLegislacaoCategoria().getDescription() ); + result.setToHsRelatorio( relatorio ); + result.setHsLegislacaoId( legislacao.getId() ); + result.setDescricao( legislacao.getDescription() ); + } + return result; + } + + public static void reverterNormalizacao( HsRelatorio relatorio, Estabelecimentos estabelecimento ) throws Exception + { + int normalizacaoSize = relatorio.getHsRelatorioNormalizacaoArray().size(); + for(int i = 0; i < normalizacaoSize; ++i ) + { + relatorio.getHsRelatorioNormalizacaoArray().get( 0 ).delete(); + } + for( HsNormalizacaoEstabelecimento rel : estabelecimento.getHsNormalizacaoEstabelecimentoArray() ) + { + HsNormalizacao normalizacao = rel.getToHsNormalizacao(); + HsRelatorioNormalizacao relatorioNormalizacao = criarRelatorioNormalizacao( relatorio, normalizacao ); + relatorioNormalizacao.save(); + } + } + + private static HsRelatorioNormalizacao criarRelatorioNormalizacao( HsRelatorio relatorio, HsNormalizacao normalizacao ) + { + HsRelatorioNormalizacao result = null; + if( relatorio != null && normalizacao != null ) + { + result = new HsRelatorioNormalizacao(); + result.setCodigo( normalizacao.getCodigo() ); + result.setDescricao( normalizacao.getDescricao() ); + result.setToHsRelatorio( relatorio ); + result.setHsNormalizacaoId( normalizacao.getId() ); + result.setPortuguesa( normalizacao.getPortuguesa() ); + } + return result; + } + + public static boolean isProbabilidadeValida( Integer probabilidade ) + { + return probabilidade != null && probabilidade > 0 && probabilidade <= 4; + } + + public static boolean isSeveridadeValida( Integer severidade ) + { + return severidade != null && severidade > 0 && severidade <= 4; + } + + public static boolean isRelatorioRiscoPreenchido( HsRelatorioPostoRisco rel ) + { + boolean hasQual = rel.getToHsRelatorioRiscoValorQualitativo() != null; + boolean hasQuant = false; + if( !hasQual ) + { + hasQuant = HigieneSegurancaLogic.isSeveridadeValida( rel.getSeveridade() ); + hasQuant &= HigieneSegurancaLogic.isProbabilidadeValida( rel.getSeveridade() ); + } + return hasQual || hasQuant; + } + + public static DefaultMutableTreeNode getLegislacaoGeral() + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + for( HsLegislacao legislacao : planoProvider.getAllLegislacaoGeral() ) + { + DefaultMutableTreeNode legislacaoNode = new DefaultMutableTreeNode( legislacao ); + result.add( legislacaoNode ); + } + return result; + } + + public static DefaultMutableTreeNode getLegislacaoEspecifica() + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + for( HsLegislacaoCategoria categoria : planoProvider.getAllLegislacaoCategorias() ) + { + DefaultMutableTreeNode categoriaNode = new DefaultMutableTreeNode( categoria ); + for( HsLegislacao legislacao: categoria.getHsLegislacaoArray() ) + { + if( legislacao.getDeletedDate() == null ) + { + DefaultMutableTreeNode legislacaoNode = new DefaultMutableTreeNode( legislacao ); + categoriaNode.add( legislacaoNode ); + } + } + result.add( categoriaNode ); + } + return result; + } + + public static DefaultMutableTreeNode getNormalizacaoTree( boolean portuguesa ) + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode("Normaliza" + ccedil + atilde + "o " + ( portuguesa ? "Portuguesa" : "Internacional" ) ); + for( HsNormalizacao normalizacao : planoProvider.getNormalizacao( portuguesa ) ) + { + DefaultMutableTreeNode normalizacaoNode = new DefaultMutableTreeNode( normalizacao ); + result.add( normalizacaoNode ); + } + return result; + } + + public static DefaultMutableTreeNode getNormalizacaoTreeForEmpresa( Empresas empresa ) + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + DefaultMutableTreeNode portuguesa = new DefaultMutableTreeNode("Normaliza" + ccedil + atilde + "o Portuguesa" ); + DefaultMutableTreeNode internacional = new DefaultMutableTreeNode("Normaliza" + ccedil + atilde + "o Internacional" ); + for( HsNormalizacao normalizacao : planoProvider.getNormalizacao( true ) ) + { + if( empresa == null || hasEmpresa( normalizacao, empresa ) ) + { + DefaultMutableTreeNode normalizacaoNode = new DefaultMutableTreeNode( normalizacao ); + portuguesa.add( normalizacaoNode ); + } + } + for( HsNormalizacao normalizacao : planoProvider.getNormalizacao( false ) ) + { + if( empresa == null || hasEmpresa( normalizacao, empresa ) ) + { + DefaultMutableTreeNode normalizacaoNode = new DefaultMutableTreeNode( normalizacao ); + internacional.add( normalizacaoNode ); + } + } + result.add( portuguesa ); + result.add( internacional ); + return result; + } + + private static boolean hasEmpresa( HsNormalizacao normalizacao, Empresas empresa ) + { + boolean result = false; + if( normalizacao != null && empresa != null ) + { + for( HsNormalizacaoEmpresa rel : normalizacao.getHsNormalizacaoEmpresaArray()) + { + result = empresa.equals( rel.getToEmpresa() ); + if( result ) + { + break; + } + } + } + return result; + } + + public static DefaultMutableTreeNode getNormalizacaoTreeForEstabelecimento( Estabelecimentos estabelecimento ) + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + DefaultMutableTreeNode portuguesa = new DefaultMutableTreeNode("Normaliza" + ccedil + atilde + "o Portuguesa" ); + DefaultMutableTreeNode internacional = new DefaultMutableTreeNode("Normaliza" + ccedil + atilde + "o Internacional" ); + for( HsNormalizacao normalizacao : planoProvider.getNormalizacao( true ) ) + { + if( estabelecimento == null || hasEstabelecimento( normalizacao, estabelecimento ) ) + { + DefaultMutableTreeNode normalizacaoNode = new DefaultMutableTreeNode( normalizacao ); + portuguesa.add( normalizacaoNode ); + } + } + for( HsNormalizacao normalizacao : planoProvider.getNormalizacao( false ) ) + { + if( estabelecimento == null || hasEstabelecimento( normalizacao, estabelecimento ) ) + { + DefaultMutableTreeNode normalizacaoNode = new DefaultMutableTreeNode( normalizacao ); + internacional.add( normalizacaoNode ); + } + } + result.add( portuguesa ); + result.add( internacional ); + return result; + } + + private static boolean hasEstabelecimento( HsNormalizacao normalizacao, Estabelecimentos estabelecimento ) + { + boolean result = false; + if( normalizacao != null && estabelecimento != null ) + { + for( HsNormalizacaoEstabelecimento rel : normalizacao.getHsNormalizacaoEstabelecimentoArray()) + { + result = estabelecimento.equals( rel.getToEstabelecimento() ); + if( result ) + { + break; + } + } + } + return result; + } + + public static DefaultMutableTreeNode getLegislacaoTreeForEmpresa( Empresas empresa ) + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + DefaultMutableTreeNode geral = new DefaultMutableTreeNode( "Legisla" + ccedil + atilde + "o de aplica" + ccedil + atilde + "o geral" ); + DefaultMutableTreeNode especifica = new DefaultMutableTreeNode( "Legisla" + ccedil + atilde + "o espec" + iacute + "fica" ); + for( HsLegislacao legislacao : planoProvider.getAllLegislacaoGeral() ) + { + if( empresa == null || hasEmpresa( legislacao, empresa ) ) + { + DefaultMutableTreeNode legislacaoNode = new DefaultMutableTreeNode( legislacao ); + geral.add( legislacaoNode ); + } + } + for( HsLegislacaoCategoria categoria : planoProvider.getAllLegislacaoCategorias( ) ) + { + boolean addCategory = false; + DefaultMutableTreeNode categoriaNode = new DefaultMutableTreeNode( categoria ); + for( HsLegislacao legislacao : categoria.getHsLegislacaoArray() ) + { + if( empresa == null || hasEmpresa( legislacao, empresa ) ) + { + DefaultMutableTreeNode legislacaoNode = new DefaultMutableTreeNode( legislacao ); + categoriaNode.add( legislacaoNode ); + addCategory = true; + } + + } + if( addCategory) + { + especifica.add( categoriaNode ); + } + } + result.add( geral ); + result.add( especifica ); + return result; + } + + private static boolean hasEmpresa( HsLegislacao legislacao, Empresas empresa ) + { + boolean result = false; + if( legislacao != null && empresa != null ) + { + for( HsLegislacaoEmpresa rel : legislacao.getHsLegislacaoEmpresaArray() ) + { + result = empresa.equals( rel.getToHsEmpresa() ); + if( result ) + { + break; + } + } + } + return result; + } + + public static DefaultMutableTreeNode getLegislacaoTreeForEstabelecimento( Estabelecimentos estabelecimento ) + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + DefaultMutableTreeNode geral = new DefaultMutableTreeNode( "Legisla" + ccedil + atilde + "o de aplica" + ccedil + atilde + "o geral" ); + DefaultMutableTreeNode especifica = new DefaultMutableTreeNode( "Legisla" + ccedil + atilde + "o espec" + iacute + "fica" ); + if( estabelecimento != null ) + { + for( HsLegislacaoEstabelecimento rel : estabelecimento.getHsLegislacaoEstabelecimentoArray() ) + { + HsLegislacao legislacao = rel.getToHsLegislacao(); + if( legislacao != null ) + { + HsLegislacaoCategoria categoria = legislacao.getToHsLegislacaoCategoria(); + if( categoria == null ) + { + DefaultMutableTreeNode legislacaoNode = new DefaultMutableTreeNode( rel.getToHsLegislacao() ); + geral.add( legislacaoNode ); + } + else + { + DefaultMutableTreeNode categoriaNode = TreeTools.findNodeWithUserObject( categoria, especifica ); + if( categoriaNode == null ) + { + categoriaNode = new DefaultMutableTreeNode(categoria); + especifica.add(categoriaNode); + } + DefaultMutableTreeNode legislacaoNode = new DefaultMutableTreeNode( rel.getToHsLegislacao() ); + categoriaNode.add( legislacaoNode ); + } + } + } + } + result.add( geral ); + result.add( especifica ); + return result; + } + + public static DefaultMutableTreeNode getEquipamentosTree() + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + List equipamentos = planoProvider.getAllEquipamentos(); + if( equipamentos != null ) + { + for( HsEquipamento equipamento : equipamentos ) + { + result.add( new DefaultMutableTreeNode( equipamento ) ); + } + } + return result; + } + + public static DefaultMutableTreeNode getEmailsForEstabelecimento( Estabelecimentos estabelecimento ) + { + DefaultMutableTreeNode result = new DefaultMutableTreeNode(); + List emails = planoProvider.getEmailsForEstabelecimento( estabelecimento ); + if( emails != null ) + { + for( HsEmailEstabelecimento rel : emails ) + { + result.add( new DefaultMutableTreeNode( rel ) ); + } + } + return result; + } + + public static HsRisco findHsRiscoFor( HsRelatorioRisco relatorioRisco ) + { + HsRisco risco = null; + List riscos = planoProvider.findHsRiscosFor( relatorioRisco ); + if( !riscos.isEmpty() ) + { + risco = riscos.get( 0 ); + } + return risco; + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/AreaNode.java b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/AreaNode.java new file mode 100644 index 00000000..48690656 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/AreaNode.java @@ -0,0 +1,17 @@ +package siprp.logic.node; + +import javax.swing.tree.DefaultMutableTreeNode; + +import siprp.database.cayenne.objects.HsArea; + +public class AreaNode extends DefaultMutableTreeNode +{ + + private static final long serialVersionUID = 1L; + + public AreaNode( HsArea area ) + { + super( area ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/AreaRelatorioNode.java b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/AreaRelatorioNode.java new file mode 100644 index 00000000..aedf26bb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/AreaRelatorioNode.java @@ -0,0 +1,17 @@ +package siprp.logic.node; + +import javax.swing.tree.DefaultMutableTreeNode; + +import siprp.database.cayenne.objects.HsRelatorioArea; + +public class AreaRelatorioNode extends DefaultMutableTreeNode +{ + + private static final long serialVersionUID = 1L; + + public AreaRelatorioNode( HsRelatorioArea risco ) + { + super( risco ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/EquipamentoNode.java b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/EquipamentoNode.java new file mode 100644 index 00000000..3a2bf08f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/EquipamentoNode.java @@ -0,0 +1,17 @@ +package siprp.logic.node; + +import javax.swing.tree.DefaultMutableTreeNode; + +import siprp.database.cayenne.objects.HsRelatorioEquipamento; + +public class EquipamentoNode extends DefaultMutableTreeNode +{ + + private static final long serialVersionUID = 1L; + + public EquipamentoNode( HsRelatorioEquipamento equipamento ) + { + super( equipamento ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/MedidaRelatorioNode.java b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/MedidaRelatorioNode.java new file mode 100644 index 00000000..3efebf3f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/MedidaRelatorioNode.java @@ -0,0 +1,16 @@ +package siprp.logic.node; + +import javax.swing.tree.DefaultMutableTreeNode; + +import siprp.database.cayenne.objects.HsRelatorioPostoMedida; + +public class MedidaRelatorioNode extends DefaultMutableTreeNode +{ + private static final long serialVersionUID = 1L; + + public MedidaRelatorioNode( HsRelatorioPostoMedida medida ) + { + super( medida ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/NodeMedida.java b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/NodeMedida.java new file mode 100644 index 00000000..a2e1bd16 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/NodeMedida.java @@ -0,0 +1,17 @@ +package siprp.logic.node; + +import javax.swing.tree.DefaultMutableTreeNode; + +import siprp.database.cayenne.objects.HsRiscoMedida; + +public class NodeMedida extends DefaultMutableTreeNode +{ + + private static final long serialVersionUID = 1L; + + public NodeMedida( HsRiscoMedida rel ) + { + super( rel ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/NodeRisco.java b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/NodeRisco.java new file mode 100644 index 00000000..7a53beaa --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/NodeRisco.java @@ -0,0 +1,17 @@ +package siprp.logic.node; + +import javax.swing.tree.DefaultMutableTreeNode; + +import siprp.database.cayenne.objects.HsRisco; + +public class NodeRisco extends DefaultMutableTreeNode +{ + + private static final long serialVersionUID = 1L; + + public NodeRisco( HsRisco risco ) + { + super( risco ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/NodeRiscoTema.java b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/NodeRiscoTema.java new file mode 100644 index 00000000..6de8eedf --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/NodeRiscoTema.java @@ -0,0 +1,17 @@ +package siprp.logic.node; + +import javax.swing.tree.DefaultMutableTreeNode; + +import siprp.database.cayenne.objects.HsRiscoTema; + +public class NodeRiscoTema extends DefaultMutableTreeNode +{ + + private static final long serialVersionUID = 1L; + + public NodeRiscoTema( HsRiscoTema tema ) + { + super( tema ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/PostoNode.java b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/PostoNode.java new file mode 100644 index 00000000..757454c0 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/PostoNode.java @@ -0,0 +1,17 @@ +package siprp.logic.node; + +import javax.swing.tree.DefaultMutableTreeNode; + +import siprp.database.cayenne.objects.HsPosto; + +public class PostoNode extends DefaultMutableTreeNode +{ + + private static final long serialVersionUID = 1L; + + public PostoNode( HsPosto risco ) + { + super( risco ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/PostoRelatorioNode.java b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/PostoRelatorioNode.java new file mode 100644 index 00000000..eb2af7f5 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/PostoRelatorioNode.java @@ -0,0 +1,17 @@ +package siprp.logic.node; + +import javax.swing.tree.DefaultMutableTreeNode; + +import siprp.database.cayenne.objects.HsRelatorioPosto; + +public class PostoRelatorioNode extends DefaultMutableTreeNode +{ + + private static final long serialVersionUID = 1L; + + public PostoRelatorioNode( HsRelatorioPosto risco ) + { + super( risco ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/RiscoRelatorioNode.java b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/RiscoRelatorioNode.java new file mode 100644 index 00000000..2eaf37ea --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/logic/node/RiscoRelatorioNode.java @@ -0,0 +1,16 @@ +package siprp.logic.node; + +import javax.swing.tree.DefaultMutableTreeNode; + +import siprp.database.cayenne.objects.HsRelatorioPostoRisco; + +public class RiscoRelatorioNode extends DefaultMutableTreeNode +{ + private static final long serialVersionUID = 1L; + + public RiscoRelatorioNode( HsRelatorioPostoRisco risco ) + { + super( risco ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaExtendedPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaExtendedPanel.java new file mode 100644 index 00000000..f92a2213 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaExtendedPanel.java @@ -0,0 +1,30 @@ +/* + * MarcacaoConsultaExtendedPanel.java + * + * Created on 13 de Fevereiro de 2007, 20:36 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina; + +import javax.swing.JPanel; + +/** + * + * @author Frederico + */ +public class MarcacaoConsultaExtendedPanel extends JPanel +{ + + /** Creates a new instance of MarcacaoConsultaExtendedPanel */ + public MarcacaoConsultaExtendedPanel() + { + setupComponents(); + } + + private void setupComponents() + { + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaPanel.java new file mode 100644 index 00000000..f4985f4d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaPanel.java @@ -0,0 +1,317 @@ +package siprp.medicina; + +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.util.Hashtable; +import java.util.Map; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; + +import siprp.data.outer.MarcacoesTrabalhadorData; + +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.data.PropertyObject; +import com.evolute.utils.dataui.ComponentController; +import com.evolute.utils.dataui.ComponentsHashtable; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.dataui.DataClassAware; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.SQLExecuter; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import com.evolute.utils.ui.panel.RadioButtonFixedPanel; +import com.evolute.utils.ui.text.StateTextArea; + +public class MarcacaoConsultaPanel + extends JPanel + implements ControllableComponent, DataClassAware +{ + private MarcacoesTrabalhadorData marcacaoTrabalhadoresData; + private final ComponentsHashtable components = new ComponentsHashtable(); + + protected final SQLExecuter EXECUTER; + + private final JLabel dataLabel = new JLabel( "Data da consulta", JLabel.RIGHT ); + private final JCalendarPanel dataPanel = new JCalendarPanel( null ); + private final JButton emailButton = new JButton( "Enviar Email" ); + private final JLabel dataFichaLabel = new JLabel( "Data da Ficha de Aptid\u00e3o", JLabel.RIGHT ); + private final JCalendarPanel dataFichaPanel = new JCalendarPanel( null ); + private RadioButtonFixedPanel tipoList; + private RadioButtonFixedPanel estadoList; + private final JScrollPane observacoesTextScroll = new JScrollPane(); + private final StateTextArea observacoesText = new StateTextArea(); + + public MarcacaoConsultaPanel() + throws Exception + { + DBManager dbm = ( DBManager )Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + if( dbm != null ) + { + EXECUTER = ( SQLExecuter )dbm.getSharedExecuter( this ); + } + else + { + EXECUTER = null; + } + setupComponents(); + setupComponentsHashtable(); + place(); + } + + public void setupComponents() + throws Exception + { + JComponent MarcacaoConsultaPanel = this; + dataPanel.setMinimumSize( new Dimension( 300, 20 ) ); + dataPanel.setPreferredSize( new Dimension( 100, 20 ) ); + + emailButton.setMinimumSize( new Dimension( 300, 20 ) ); + emailButton.setPreferredSize( new Dimension( 200, 20 ) ); + + dataFichaPanel.setMinimumSize( new Dimension( 300, 20 ) ); + dataFichaPanel.setPreferredSize( new Dimension( 100, 20 ) ); + + IDObject tipoListOptions[] = new IDObject[]{ + new MappableObject( new Integer( 1 ), "Admiss\u00e3o" ), + new MappableObject( new Integer( 2 ), "Peri\u00f3dico" ), + new MappableObject( new Integer( 5 ), "Peri\u00f3dico inicial" ), + new MappableObject( new Integer( 3 ), "Ocasional" ), + }; + tipoList = new RadioButtonFixedPanel( tipoListOptions, 4, 1, RadioButtonFixedPanel.ORIENTATION_VERTICAL, false, null ); + tipoList.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Tipo" ) ); + + IDObject estadoListOptions[] = new IDObject[]{ + new MappableObject( new Integer( 0 ), "Por realizar" ), + new MappableObject( new Integer( 2 ), "Realizada" ), + new MappableObject( new Integer( 3 ), "Desmarcada pelo trabalhador" ), + new MappableObject( new Integer( 4 ), "Desmarcada pela SIPRP" ), + new MappableObject( new Integer( 5 ), "Faltou" ), + }; + estadoList = new RadioButtonFixedPanel( estadoListOptions, 6, 1, RadioButtonFixedPanel.ORIENTATION_VERTICAL, false, null ); + estadoList.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Estado" ) ); + + observacoesTextScroll.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Observa\u00e7\u00f5es" ) ); + observacoesText.setLineWrap( true ); + observacoesText.setWrapStyleWord( true ); + observacoesText.setRows( 5 ); + + } + + public void place() + { + JPanel MarcacaoConsultaPanel = this; + GridBagConstraints MarcacaoConsultaPanelGBC = new GridBagConstraints(); + MarcacaoConsultaPanelGBC.insets = new Insets( 1, 1, 1, 1 ); + GridBagLayout MarcacaoConsultaPanelLayout = new GridBagLayout(); + MarcacaoConsultaPanel.setLayout( MarcacaoConsultaPanelLayout ); + MarcacaoConsultaPanelGBC.gridx = 0; + MarcacaoConsultaPanelGBC.gridy = 0; + MarcacaoConsultaPanelGBC.gridwidth = 1; + MarcacaoConsultaPanelGBC.gridheight = 1; + MarcacaoConsultaPanelGBC.weightx = 0.0; + MarcacaoConsultaPanelGBC.weighty = 0.0; + MarcacaoConsultaPanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoConsultaPanelLayout.setConstraints( dataLabel, MarcacaoConsultaPanelGBC ); + MarcacaoConsultaPanel.add( dataLabel ); + + MarcacaoConsultaPanelGBC.gridx = 1; + MarcacaoConsultaPanelGBC.gridy = 0; + MarcacaoConsultaPanelGBC.gridwidth = 1; + MarcacaoConsultaPanelGBC.gridheight = 1; + MarcacaoConsultaPanelGBC.weightx = 0.5; + MarcacaoConsultaPanelGBC.weighty = 0.0; + MarcacaoConsultaPanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoConsultaPanelLayout.setConstraints( dataPanel, MarcacaoConsultaPanelGBC ); + MarcacaoConsultaPanel.add( dataPanel ); + + MarcacaoConsultaPanelGBC.gridx = 2; + MarcacaoConsultaPanelGBC.gridy = 0; + MarcacaoConsultaPanelGBC.gridwidth = 1; + MarcacaoConsultaPanelGBC.gridheight = 1; + MarcacaoConsultaPanelGBC.weightx = 0.5; + MarcacaoConsultaPanelGBC.weighty = 0.0; + MarcacaoConsultaPanelGBC.fill = GridBagConstraints.NONE; + MarcacaoConsultaPanelLayout.setConstraints( emailButton, MarcacaoConsultaPanelGBC ); + MarcacaoConsultaPanel.add( emailButton ); + + MarcacaoConsultaPanelGBC.gridx = 0; + MarcacaoConsultaPanelGBC.gridy = 1; + MarcacaoConsultaPanelGBC.gridwidth = 1; + MarcacaoConsultaPanelGBC.gridheight = 1; + MarcacaoConsultaPanelGBC.weightx = 0.0; + MarcacaoConsultaPanelGBC.weighty = 0.0; + MarcacaoConsultaPanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoConsultaPanelLayout.setConstraints( dataFichaLabel, MarcacaoConsultaPanelGBC ); + MarcacaoConsultaPanel.add( dataFichaLabel ); + + MarcacaoConsultaPanelGBC.gridx = 1; + MarcacaoConsultaPanelGBC.gridy = 1; + MarcacaoConsultaPanelGBC.gridwidth = 1; + MarcacaoConsultaPanelGBC.gridheight = 1; + MarcacaoConsultaPanelGBC.weightx = 0.5; + MarcacaoConsultaPanelGBC.weighty = 0.0; + MarcacaoConsultaPanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoConsultaPanelLayout.setConstraints( dataFichaPanel, MarcacaoConsultaPanelGBC ); + MarcacaoConsultaPanel.add( dataFichaPanel ); + + MarcacaoConsultaPanelGBC.gridx = 0; + MarcacaoConsultaPanelGBC.gridy = 2; + MarcacaoConsultaPanelGBC.gridwidth = 2; + MarcacaoConsultaPanelGBC.gridheight = 1; + MarcacaoConsultaPanelGBC.weightx = 0.5; + MarcacaoConsultaPanelGBC.weighty = 0.0; + MarcacaoConsultaPanelGBC.fill = GridBagConstraints.BOTH; + MarcacaoConsultaPanelLayout.setConstraints( tipoList, MarcacaoConsultaPanelGBC ); + MarcacaoConsultaPanel.add( tipoList ); + + MarcacaoConsultaPanelGBC.gridx = 2; + MarcacaoConsultaPanelGBC.gridy = 2; + MarcacaoConsultaPanelGBC.gridwidth = 1; + MarcacaoConsultaPanelGBC.gridheight = 1; + MarcacaoConsultaPanelGBC.weightx = 0.5; + MarcacaoConsultaPanelGBC.weighty = 0.0; + MarcacaoConsultaPanelGBC.fill = GridBagConstraints.BOTH; + MarcacaoConsultaPanelLayout.setConstraints( estadoList, MarcacaoConsultaPanelGBC ); + MarcacaoConsultaPanel.add( estadoList ); + + MarcacaoConsultaPanelGBC.gridx = 0; + MarcacaoConsultaPanelGBC.gridy = 3; + MarcacaoConsultaPanelGBC.gridwidth = 3; + MarcacaoConsultaPanelGBC.gridheight = 1; + MarcacaoConsultaPanelGBC.weightx = 1.0; + MarcacaoConsultaPanelGBC.weighty = 1.0; + observacoesTextScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + observacoesTextScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED ); + observacoesTextScroll.setViewportView( observacoesText ); + MarcacaoConsultaPanelGBC.fill = GridBagConstraints.BOTH; + MarcacaoConsultaPanelLayout.setConstraints( observacoesTextScroll, MarcacaoConsultaPanelGBC ); + MarcacaoConsultaPanel.add( observacoesTextScroll ); + + } + + private void setupComponentsHashtable() + { + components.putComponent( MarcacoesTrabalhadorData.DATA, dataPanel ); + components.putComponent( MarcacoesTrabalhadorData.DATA_RELATORIO, dataFichaPanel ); + components.putComponent( MarcacoesTrabalhadorData.MOTIVO, tipoList ); + components.putComponent( MarcacoesTrabalhadorData.ESTADO, estadoList ); + components.putComponent( MarcacoesTrabalhadorData.OBSERVACOES, observacoesText ); + } + + public void fill( Object toFill ) + { + clear(); + if( toFill == null || !( toFill instanceof PropertyObject ) ) + { + return; + } + Map data = null; + if( toFill instanceof PropertyObject ) + { + data = ( (PropertyObject) toFill ).getHashData(); + if( toFill instanceof MarcacoesTrabalhadorData ) + { + marcacaoTrabalhadoresData = (MarcacoesTrabalhadorData) toFill; + } + } + else if( toFill instanceof Hashtable ) + { + data = (Hashtable) toFill; + } + else + { + return; + } + if( marcacaoTrabalhadoresData == null ) + { + marcacaoTrabalhadoresData = new MarcacoesTrabalhadorData(); + marcacaoTrabalhadoresData.setHashData( data ); + } + PropertyObject po = (PropertyObject) toFill; + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.fill( properties, po.getHashData(), components ); + } + + public Object save() + { + if( marcacaoTrabalhadoresData == null ) + { + marcacaoTrabalhadoresData = new MarcacoesTrabalhadorData(); + } + Map data = marcacaoTrabalhadoresData.getHashData(); + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.save( properties, data, components ); + if( !( marcacaoTrabalhadoresData instanceof PropertyObject ) ) + { + return data; + } + marcacaoTrabalhadoresData.setHashData( data ); + return marcacaoTrabalhadoresData; + } + + public void clear() + { + marcacaoTrabalhadoresData = null; + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.clear( properties, components ); + } + + public void setEnabled( boolean enable ) + { + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.setEnabled( properties, enable, components ); + } + + public Class getDataClass() + { + return MarcacoesTrabalhadorData.class; + } + + public JLabel getDataFichaLabel() + { + return dataFichaLabel; + } + + public JCalendarPanel getDataFichaPanel() + { + return dataFichaPanel; + } + + public JLabel getDataLabel() + { + return dataLabel; + } + + public JCalendarPanel getDataPanel() + { + return dataPanel; + } + + public JButton getEmailButton() + { + return emailButton; + } + + public RadioButtonFixedPanel getEstadoList() + { + return estadoList; + } + + public StateTextArea getObservacoesText() + { + return observacoesText; + } + + public RadioButtonFixedPanel getTipoList() + { + return tipoList; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaPanel.xml b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaPanel.xml new file mode 100644 index 00000000..7229c554 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaPanel.xml @@ -0,0 +1,100 @@ + + + + + + + siprp.data.* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tipo + + 4 + + + Admiss\u00e3o + Peri\u00f3dico + Peri\u00f3dico inicial + Ocasional + + + + + Estado + + 6 + + + Por realizar + Realizada + Desmarcada pelo trabalhador + Desmarcada pela SIPRP + Faltou + + + + + + Observa\u00e7\u00f5es + + + 5 + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacaoExamePanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacaoExamePanel.java new file mode 100644 index 00000000..3c0222b5 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacaoExamePanel.java @@ -0,0 +1,277 @@ +package siprp.medicina; + +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.util.Hashtable; +import java.util.Map; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; + +import siprp.data.outer.MarcacoesTrabalhadorData; + +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.data.PropertyObject; +import com.evolute.utils.dataui.ComponentController; +import com.evolute.utils.dataui.ComponentsHashtable; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.dataui.DataClassAware; +import com.evolute.utils.dataui.JPanelControllable; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.SQLExecuter; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import com.evolute.utils.ui.panel.RadioButtonFixedPanel; +import com.evolute.utils.ui.text.StateTextArea; + +public class MarcacaoExamePanel + extends JPanel + implements ControllableComponent, DataClassAware +{ + private MarcacoesTrabalhadorData marcacaoTrabalhadoresData; + private final ComponentsHashtable components = new ComponentsHashtable(); + + protected final SQLExecuter EXECUTER; + + private final JLabel dataLabel = new JLabel( "Data dos Exames", JLabel.RIGHT ); + private final JCalendarPanel dataPanel = new JCalendarPanel( null ); + private final JButton emailButton = new JButton( "Enviar Email" ); + private final JPanelControllable detalhesPanel = new JPanelControllable(); + private RadioButtonFixedPanel estadoList; + private final JScrollPane observacoesTextScroll = new JScrollPane(); + private final StateTextArea observacoesText = new StateTextArea(); + + public MarcacaoExamePanel() + throws Exception + { + DBManager dbm = ( DBManager )Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + if( dbm != null ) + { + EXECUTER = ( SQLExecuter )dbm.getSharedExecuter( this ); + } + else + { + EXECUTER = null; + } + setupComponents(); + setupComponentsHashtable(); + place(); + } + + public void setupComponents() + throws Exception + { + JComponent MarcacaoExamePanel = this; + emailButton.setMinimumSize( new Dimension( 300, 20 ) ); + emailButton.setPreferredSize( new Dimension( 200, 20 ) ); + + detalhesPanel.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Detalhes" ) ); + + IDObject estadoListOptions[] = new IDObject[]{ + new MappableObject( new Integer( 0 ), "Por realizar" ), + new MappableObject( new Integer( 1 ), "Parcialmente realizados" ), + new MappableObject( new Integer( 2 ), "Realizados" ), + new MappableObject( new Integer( 3 ), "Desmarcados pelo trabalhador" ), + new MappableObject( new Integer( 4 ), "Desmarcados pela SIPRP" ), + new MappableObject( new Integer( 5 ), "Faltou" ), + }; + estadoList = new RadioButtonFixedPanel( estadoListOptions, 6, 1, RadioButtonFixedPanel.ORIENTATION_VERTICAL, false, null ); + estadoList.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Estado" ) ); + + observacoesTextScroll.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Observa\u00e7\u00f5es" ) ); + observacoesText.setLineWrap( true ); + observacoesText.setWrapStyleWord( true ); + observacoesText.setRows( 5 ); + + } + + public void place() + { + JPanel MarcacaoExamePanel = this; + GridBagConstraints detalhesPanelGBC = new GridBagConstraints(); + detalhesPanelGBC.insets = new Insets( 1, 1, 1, 1 ); + GridBagLayout detalhesPanelLayout = new GridBagLayout(); + detalhesPanel.setLayout( detalhesPanelLayout ); + GridBagConstraints MarcacaoExamePanelGBC = new GridBagConstraints(); + MarcacaoExamePanelGBC.insets = new Insets( 1, 1, 1, 1 ); + GridBagLayout MarcacaoExamePanelLayout = new GridBagLayout(); + MarcacaoExamePanel.setLayout( MarcacaoExamePanelLayout ); + MarcacaoExamePanelGBC.gridx = 0; + MarcacaoExamePanelGBC.gridy = 0; + MarcacaoExamePanelGBC.gridwidth = 1; + MarcacaoExamePanelGBC.gridheight = 1; + MarcacaoExamePanelGBC.weightx = 0.0; + MarcacaoExamePanelGBC.weighty = 0.0; + MarcacaoExamePanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoExamePanelLayout.setConstraints( dataLabel, MarcacaoExamePanelGBC ); + MarcacaoExamePanel.add( dataLabel ); + + MarcacaoExamePanelGBC.gridx = 1; + MarcacaoExamePanelGBC.gridy = 0; + MarcacaoExamePanelGBC.gridwidth = 1; + MarcacaoExamePanelGBC.gridheight = 1; + MarcacaoExamePanelGBC.weightx = 0.5; + MarcacaoExamePanelGBC.weighty = 0.0; + MarcacaoExamePanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoExamePanelLayout.setConstraints( dataPanel, MarcacaoExamePanelGBC ); + MarcacaoExamePanel.add( dataPanel ); + + MarcacaoExamePanelGBC.gridx = 2; + MarcacaoExamePanelGBC.gridy = 0; + MarcacaoExamePanelGBC.gridwidth = 1; + MarcacaoExamePanelGBC.gridheight = 1; + MarcacaoExamePanelGBC.weightx = 0.5; + MarcacaoExamePanelGBC.weighty = 0.0; + MarcacaoExamePanelGBC.fill = GridBagConstraints.NONE; + MarcacaoExamePanelLayout.setConstraints( emailButton, MarcacaoExamePanelGBC ); + MarcacaoExamePanel.add( emailButton ); + + MarcacaoExamePanelGBC.gridx = 0; + MarcacaoExamePanelGBC.gridy = 1; + MarcacaoExamePanelGBC.gridwidth = 2; + MarcacaoExamePanelGBC.gridheight = 1; + MarcacaoExamePanelGBC.weightx = 0.5; + MarcacaoExamePanelGBC.weighty = 0.0; + MarcacaoExamePanelGBC.fill = GridBagConstraints.BOTH; + MarcacaoExamePanelLayout.setConstraints( detalhesPanel, MarcacaoExamePanelGBC ); + MarcacaoExamePanel.add( detalhesPanel ); + + MarcacaoExamePanelGBC.gridx = 2; + MarcacaoExamePanelGBC.gridy = 1; + MarcacaoExamePanelGBC.gridwidth = 1; + MarcacaoExamePanelGBC.gridheight = 1; + MarcacaoExamePanelGBC.weightx = 0.5; + MarcacaoExamePanelGBC.weighty = 0.0; + MarcacaoExamePanelGBC.fill = GridBagConstraints.BOTH; + MarcacaoExamePanelLayout.setConstraints( estadoList, MarcacaoExamePanelGBC ); + MarcacaoExamePanel.add( estadoList ); + + MarcacaoExamePanelGBC.gridx = 0; + MarcacaoExamePanelGBC.gridy = 2; + MarcacaoExamePanelGBC.gridwidth = 3; + MarcacaoExamePanelGBC.gridheight = 1; + MarcacaoExamePanelGBC.weightx = 1.0; + MarcacaoExamePanelGBC.weighty = 1.0; + observacoesTextScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + observacoesTextScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED ); + observacoesTextScroll.setViewportView( observacoesText ); + MarcacaoExamePanelGBC.fill = GridBagConstraints.BOTH; + MarcacaoExamePanelLayout.setConstraints( observacoesTextScroll, MarcacaoExamePanelGBC ); + MarcacaoExamePanel.add( observacoesTextScroll ); + + } + + private void setupComponentsHashtable() + { + components.putComponent( MarcacoesTrabalhadorData.DATA, dataPanel ); + components.putComponent( MarcacoesTrabalhadorData.ESTADO, estadoList ); + components.putComponent( MarcacoesTrabalhadorData.OBSERVACOES, observacoesText ); + } + + public void fill( Object toFill ) + { + clear(); + if( toFill == null || !( toFill instanceof PropertyObject ) ) + { + return; + } + Map data = null; + if( toFill instanceof PropertyObject ) + { + data = ( (PropertyObject) toFill ).getHashData(); + if( toFill instanceof MarcacoesTrabalhadorData ) + { + marcacaoTrabalhadoresData = (MarcacoesTrabalhadorData) toFill; + } + } + else if( toFill instanceof Hashtable ) + { + data = (Hashtable) toFill; + } + else + { + return; + } + if( marcacaoTrabalhadoresData == null ) + { + marcacaoTrabalhadoresData = new MarcacoesTrabalhadorData(); + marcacaoTrabalhadoresData.setHashData( data ); + } + PropertyObject po = (PropertyObject) toFill; + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.fill( properties, po.getHashData(), components ); + } + + public Object save() + { + if( marcacaoTrabalhadoresData == null ) + { + marcacaoTrabalhadoresData = new MarcacoesTrabalhadorData(); + } + Map data = marcacaoTrabalhadoresData.getHashData(); + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.save( properties, data, components ); + if( !( marcacaoTrabalhadoresData instanceof PropertyObject ) ) + { + return data; + } + marcacaoTrabalhadoresData.setHashData( data ); + return marcacaoTrabalhadoresData; + } + + public void clear() + { + marcacaoTrabalhadoresData = null; + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.clear( properties, components ); + } + + public void setEnabled( boolean enable ) + { + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.setEnabled( properties, enable, components ); + } + + public Class getDataClass() + { + return MarcacoesTrabalhadorData.class; + } + + public JLabel getDataLabel() + { + return dataLabel; + } + + public JCalendarPanel getDataPanel() + { + return dataPanel; + } + + public JPanelControllable getDetalhesPanel() + { + return detalhesPanel; + } + + public JButton getEmailButton() + { + return emailButton; + } + + public RadioButtonFixedPanel getEstadoList() + { + return estadoList; + } + + public StateTextArea getObservacoesText() + { + return observacoesText; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacaoExamePanel.xml b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacaoExamePanel.xml new file mode 100644 index 00000000..bb5e2ab1 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacaoExamePanel.xml @@ -0,0 +1,78 @@ + + + + + + + siprp.data.* + + + + + + + + + + + + + + + + + + + + + Detalhes + + + + + + + + + Estado + + 6 + + + Por realizar + Parcialmente realizados + Realizados + Desmarcados pelo trabalhador + Desmarcados pela SIPRP + Faltou + + + + + + Observa\u00e7\u00f5es + + + 5 + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacoesMedicinaHandler.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacoesMedicinaHandler.java new file mode 100644 index 00000000..e6d84c8f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MarcacoesMedicinaHandler.java @@ -0,0 +1,95 @@ +/* + * MarcacoesMedicinaHandler.java + * + * Created on 28 de Abril de 2006, 9:56 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina; + +import java.util.Date; + +import siprp.data.Marcacao; +import siprp.data.outer.MarcacoesTrabalhadorData; +import siprp.data.outer.TrabalhadoresData; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; + +/** + * Classe auxiliar para tratamento de marcações de Medicina. + * + * @author Frederico + */ +public class MarcacoesMedicinaHandler +{ + /** Creates a new instance of MarcacoesMedicinaHandler */ + public MarcacoesMedicinaHandler() + { + } + + /** + * Ajusta os estado das marações corrente e seguinte para uma trabalhador. + * Este método é usado pelo sistema de marcaç&atild;o de fichas de aptidaão para ajustar + * as marcações existentes às escolhidas na ficha. + * + * @param trabalhadorID um inteiro que representa o trabalhador em questão + * @param motivoCorrente um inteiro que representa o motivo da marcação corrente (admissão/periódico/ocasional) + * @param dataCorrente a data que se pretende para a marcação corrente + * @param motivoSeguinte um inteiro que representa o motivo da marcação seguinte (admissão/periódico/ocasional) + * @param dataSeguinte a data que se pretende para a marcação seguinte + * @throws Exception se houver um erro na comunicação com a Base de Dados + */ + public void ajustarMarcacoes( Integer trabalhadorID, Integer motivoCorrente, Date dataCorrente, + Integer motivoSeguinte, Date dataSeguinte ) + throws Exception + { + Integer idCorrente; + Integer idSeguinte; + MedicinaDataProvider provider = ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); + ProviderInterface JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + TrabalhadoresData trabalhador = (TrabalhadoresData)JDO.load( TrabalhadoresData.class, trabalhadorID ); + + idCorrente = provider.getConsultaIDByTrabalhadorMotivoAndDate( trabalhadorID, motivoCorrente, dataCorrente ); + MarcacoesTrabalhadorData consultaCorrente; + if( idCorrente == null ) + { + consultaCorrente = new MarcacoesTrabalhadorData(); + consultaCorrente.setToTrabalhador_id( trabalhador ); + consultaCorrente.set( MarcacoesTrabalhadorData.TIPO, new Integer( MarcacoesTrabalhadorData.TIPO_CONSULTA ) ); + consultaCorrente.set( Marcacao.DATA, dataCorrente ); + consultaCorrente.set( MarcacoesTrabalhadorData.MOTIVO, motivoCorrente ); + } + else + { + consultaCorrente = ( MarcacoesTrabalhadorData ) JDO.load( MarcacoesTrabalhadorData.class, idCorrente ); + } + consultaCorrente.set( Marcacao.REALIZADA, "y" ); + consultaCorrente.set( MarcacoesTrabalhadorData.ESTADO, new Integer( siprp.medicina.MedicinaDataProvider.ESTADO_REALIZADO ) ); + consultaCorrente.save(); + + idSeguinte = provider.getConsultaIDByTrabalhadorMotivoAndDate( trabalhadorID, motivoSeguinte, dataSeguinte ); + if( idSeguinte == null ) + { + idSeguinte = provider.getProximaConsultaIDByTrabalhadorMotivoAndDate( trabalhadorID, motivoSeguinte, dataCorrente ); + MarcacoesTrabalhadorData consultaSeguinte; + if( idSeguinte == null ) + { + consultaSeguinte = new MarcacoesTrabalhadorData(); + consultaSeguinte.setToTrabalhador_id( trabalhador ); + consultaSeguinte.set( MarcacoesTrabalhadorData.TIPO, new Integer( MarcacoesTrabalhadorData.TIPO_CONSULTA ) ); + consultaSeguinte.set( MarcacoesTrabalhadorData.MOTIVO, motivoSeguinte ); + consultaSeguinte.set( Marcacao.REALIZADA, "y" ); + consultaSeguinte.set( MarcacoesTrabalhadorData.ESTADO, new Integer( siprp.medicina.MedicinaDataProvider.ESTADO_POR_REALIZAR ) ); + } + else + { + consultaSeguinte = ( MarcacoesTrabalhadorData ) JDO.load( MarcacoesTrabalhadorData.class, idSeguinte ); + } + consultaSeguinte.set( Marcacao.DATA, dataSeguinte ); + consultaSeguinte.save(); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MedicinaDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MedicinaDataProvider.java new file mode 100644 index 00000000..755be6a7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MedicinaDataProvider.java @@ -0,0 +1,479 @@ +/* + * MedicinaDataProvider.java + * + * Created on January 29, 2006, 12:27 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina; + +import java.util.Date; +import java.util.HashMap; +import java.util.Vector; + +import siprp.MedicinaConstants; +import siprp.data.Marcacao; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.metadb.MetaProvider; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Delete; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; +import com.evolute.utils.tables.ColumnizedMappable; +/** + * + * @author fpalma + */ +public class MedicinaDataProvider extends MetaProvider + implements MedicinaConstants +{ + + + public static final String TIPOS_CONSULTAS[] = + new String[]{ "", MOTIVO_ADMISSAO_STR, MOTIVO_PERIODICO_STR, MOTIVO_OCASIONAL_STR, "", MOTIVO_PERIODICO_INICIAL_STR }; + + + public static final HashMap SUB_MOTIVOS_BY_ID = + new HashMap(); + + public static final HashMap SUB_MOTIVOS_IDS_BY_MOTIVO_ID = + new HashMap(); + +// public static final String ESTADOS_EXAME_STR[] = +// new String[]{ "Por realizar", "Parcialmente realizado", "Realizado", +// "Desmarcado trabalhador", +// "Desmarcado " + Singleton.getInstance( SingletonConstants.COMPANY_ACRONYM ), +// "Faltou" }; +// +// public static final String ESTADOS_CONSULTA_STR[] = +// new String[]{ "Por realizar", "Parcialmente realizada", "Realizada", +// "Desmarcada trabalhador", +// "Desmarcada " + Singleton.getInstance( SingletonConstants.COMPANY_ACRONYM ), +// "Faltou" }; + + private static final Object LOCK = new Object(); + private static MedicinaDataProvider instance = null; + + static + { + + SUB_MOTIVOS_BY_ID.put( SUB_MOTIVO_APOS_DOENCA_INTEGER, SUB_MOTIVO_APOS_DOENCA_STR ); + SUB_MOTIVOS_BY_ID.put( SUB_MOTIVO_APOS_ACIDENTE_INTEGER, SUB_MOTIVO_APOS_ACIDENTE_STR ); + SUB_MOTIVOS_BY_ID.put( SUB_MOTIVO_PEDIDO_TRABALHADOR_INTEGER, SUB_MOTIVO_PEDIDO_TRABALHADOR_STR ); + SUB_MOTIVOS_BY_ID.put( SUB_MOTIVO_PEDIDO_SERVICO_INTEGER, SUB_MOTIVO_PEDIDO_SERVICO_STR ); + SUB_MOTIVOS_BY_ID.put( SUB_MOTIVO_MUDANCA_FUNCAO_INTEGER, SUB_MOTIVO_MUDANCA_FUNCAO_STR ); + SUB_MOTIVOS_BY_ID.put( SUB_MOTIVO_ALTERACAO_CONDICOES_INTEGER, SUB_MOTIVO_ALTERACAO_CONDICOES_STR ); + SUB_MOTIVOS_BY_ID.put( SUB_MOTIVO_OUTRO_INTEGER, SUB_MOTIVO_OUTRO_STR ); + + SUB_MOTIVOS_IDS_BY_MOTIVO_ID.put( MOTIVO_OCASIONAL_INTEGER, + new Integer[]{ SUB_MOTIVO_APOS_DOENCA_INTEGER, SUB_MOTIVO_APOS_ACIDENTE_INTEGER, + SUB_MOTIVO_PEDIDO_TRABALHADOR_INTEGER, SUB_MOTIVO_PEDIDO_SERVICO_INTEGER, + SUB_MOTIVO_MUDANCA_FUNCAO_INTEGER, SUB_MOTIVO_ALTERACAO_CONDICOES_INTEGER, + SUB_MOTIVO_OUTRO_INTEGER } ); + } + + private final Executer executer; + + public static HashMap getConsultaEstados() + { + HashMap result = new HashMap(); + for( int i = 0; i < MedicinaConstants.ESTADOS_CONSULTA_STR.length; ++i ) + { + if( MedicinaConstants.ESTADOS_CONSULTA_STR[i] != null) + { + result.put( new Integer( i ), MedicinaConstants.ESTADOS_CONSULTA_STR[i] ); + } + } + return result; + } + + /** Creates a new instance of MedicinaDataProvider */ + public MedicinaDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + executer = dbm.getSharedExecuter( this ); + } + + public static MetaProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new MedicinaDataProvider(); + } + } + return instance; + } + + public String []getEmpresaEstabelecimento( Integer empresaID, Integer estabelecimentoID ) + throws Exception + { + String nomes[] = new String[ 2 ]; + Select select = new Select( new String[]{ "empresas" }, + new String[]{ "designacao_social" }, + new Field( "id" ).isEqual( empresaID ) ); + Virtual2DArray array = executer.executeQuery( select ); + nomes[ 0 ] = ( String ) array.get( 0, 0 ); + + select = new Select( new String[]{ "estabelecimentos" }, + new String[]{ "nome" }, + new Field( "id" ).isEqual( estabelecimentoID ) ); + array = executer.executeQuery( select ); + nomes[ 1 ] = ( String ) array.get( 0, 0 ); + + return nomes; + } + + public IDObject[] getDetalhesValidosTrabalhador( Integer empresaID, Integer trabalhadorID ) + throws Exception + { + Select select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "perfil" }, + new Field( "id" ).isEqual( trabalhadorID ) ); + Virtual2DArray array = executer.executeQuery( select ); + Integer perfil = ( Integer ) array.get( 0, 0 ); + if( perfil == null ) + { + return new IDObject[ 0 ]; + } + select = + new Select( new String[]{ "prt_elementos_protocolo", "prt_tipos_elementos_protocolo", + "prt_grupos_protocolo" }, + new String[]{ "prt_grupos_protocolo.id" , "prt_grupos_protocolo.descricao", + "prt_grupos_protocolo.ordem"}, + new Field( "prt_elementos_protocolo.empresa_id" ).isEqual( empresaID ).and( + new Field( "prt_elementos_protocolo.tipo_elemento_protocolo_id" ).isEqual( + new Field( "prt_tipos_elementos_protocolo.id" ) ) ).and( + new Field( "prt_tipos_elementos_protocolo.grupo_protocolo_id" ).isEqual( + new Field( "prt_grupos_protocolo.id" ) ) ).and( + new Field( "prt_elementos_protocolo.numero_perfil" ).isEqual( perfil ) ), + new String[]{ "prt_grupos_protocolo.ordem" }, + null ); + array = executer.executeQuery( select ); + Vector detalhes = new Vector(); + Integer oldID = null; + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + if( id.equals( oldID ) ) + { + continue; + } + oldID = id; + String descricao = ( String ) array.get( n, 1 ); + detalhes.add( new MappableObject( id, descricao ) ); + } + return ( IDObject[] ) detalhes.toArray( new IDObject[ detalhes.size() ] ); + } + + public void setDetalhesRealziadosForMarcacao( Integer marcacaoID, Integer detalhes[] ) + throws Exception + { + Delete delete = + new Delete( "marcacoes_grupos_realizados", + new Field( "marcacao_trabalhador_id" ).isEqual( marcacaoID ) ); + executer.executeQuery( delete ); + Insert insert = + new Insert( "marcacoes_grupos_realizados", + new Assignment[]{ + new Assignment( new Field( "marcacao_trabalhador_id" ), marcacaoID ), + new Assignment( new Field( "grupo_protocolo_id" ), detalhes ) } ); + executer.executeQuery( insert, null ); + } + + public Integer[] getDetalhesRealizadosForMarcacao( Integer marcacaoID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_grupos_realizados" }, + new String[]{ "grupo_protocolo_id" }, + new Field( "marcacao_trabalhador_id" ).isEqual( marcacaoID ) ); + Virtual2DArray array = executer.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + ids[ n ] = ( Integer ) array.get( n, 0 ); + } + return ids; + } + + public Integer[] getDetalhesRealizadosForEstadosMarcacao( Integer marcacaoID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_grupos_realizados", "marcacoes_trabalhador_estados" }, + new String[]{ "grupo_protocolo_id" }, + new Field( "marcacoes_trabalhador_estados.marcacao_id" ).isEqual( marcacaoID ).and( + new Field( "marcacoes_trabalhador_estados.id" ).isEqual( + new Field( "marcacoes_grupos_realizados.marcacoes_trabalhador_estado_id" ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + ids[ n ] = ( Integer ) array.get( n, 0 ); + } + return ids; + } + + public void deleteDetalhesRealizadosForMarcacao( Integer marcacaoID ) + throws Exception + { + Delete delete = + new Delete( "marcacoes_grupos_realizados", + new Field( "marcacao_trabalhador_id" ).isEqual( marcacaoID ) ); + executer.executeQuery( delete ); + } + + public Object[][] getExamesTrabalhador( Integer trabalhadorID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "id", "data", "estado" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ), + new String[]{ "data desc" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + Object data[][] = array.getObjects(); + for( int n = 0; n < data.length; n++ ) + { + int estado = ( ( Integer ) data[ n ][ 2 ] ).intValue(); + data[ n ][ 2 ] = ESTADOS_EXAME_STR[ estado ]; + } + return data; + } + + public Object[][] getConsultasTrabalhador( Integer trabalhadorID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "id", "data", "estado" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ), + new String[]{ "data desc" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + Object data[][] = array.getObjects(); + for( int n = 0; n < data.length; n++ ) + { + int estado = ( ( Integer ) data[ n ][ 2 ] ).intValue(); + data[ n ][ 2 ] = ESTADOS_CONSULTA_STR[ estado ]; + } + + return data; + } + + public ColumnizedMappable[] getAllEmpresas() + throws Exception + { + Select select = + new Select( new String[]{ "empresas" }, + new String[]{ "id", "designacao_social", "designacao_social_plain" }, + new Field( "inactivo" ).isDifferent( "y" ), + new String[]{ "designacao_social_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + ColumnizedMappable empresas[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < empresas.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String designacao = ( String ) array.get( n, 1 ); + empresas[ n ] = new ColumnizedMappable( id, designacao ); + } + return empresas; + } + + public ColumnizedMappable[] getAllEstabelecimentosForEmpresa( Integer empresaID ) + throws Exception + { + Select select = + new Select( new String[]{ "estabelecimentos" }, + new String[]{ "id", "nome", "nome_plain" }, + new Field( "empresa_id" ).isEqual( empresaID ).and( + new Field( "inactivo" ).isDifferent( "y" ) ), + new String[]{ "nome_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + ColumnizedMappable estabelecimentos[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < estabelecimentos.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + estabelecimentos[ n ] = new ColumnizedMappable( id, nome ); + } + return estabelecimentos; + } + + public ColumnizedMappable[] getAllTrabalhadoresForEstabelecimento( Integer estabelecimentoID ) + throws Exception + { + Select select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "id", "nome", "nome_plain" }, + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ).and( + new Field( "inactivo" ).isDifferent( "y" ) ), + new String[]{ "nome_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + ColumnizedMappable trabalhadores[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < trabalhadores.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + trabalhadores[ n ] = new ColumnizedMappable( id, nome ); + } + return trabalhadores; + } + + /** + * Devolve o identificador da consulta de um trabalhador para um dado motivo e dia. + * + * @param trabalhadorID o identificador do trabalhador + * @param motivo o identificador do motivo da marcacao + * @param data a data da marcacao + * @return o identificador da consulta ou null se não houver nenhuma + * @throws Exception se houver um erro na ligaço à Base de Dados + */ + public Integer getConsultaIDByTrabalhadorMotivoAndDate( Integer trabalhadorID, Integer motivo, Date data ) + throws Exception + { + Integer motivos[]; + if( motivo != null && ( motivo.intValue() == MOTIVO_PERIODICO || motivo.intValue() == MOTIVO_PERIODICO_INICIAL ) ) + { + motivos = new Integer[]{ MOTIVO_PERIODICO_INTEGER, MOTIVO_PERIODICO_INICIAL_INTEGER }; + } + else + { + motivos = new Integer[]{ motivo }; + } + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "id" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "data" ).isEqual( data ) ).and( + new Field( "motivo" ).in( motivos ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + Integer id; + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + id = null; + } + else + { + id = ( Integer ) array.get( 0, 0 ); + } + return id; + } + + /** + * Devolve o identificador da primeira consulta de um trabalhador n&ão realizada depois de um diapara um dado motivo. + * + * @param trabalhadorID o identificador do trabalhador + * @param motivo o identificador do motivo da marcacao + * @param data a data de início de procura + * @return o identificador da consulta ou null se não houver nenhuma + * @throws Exception se houver um erro na ligaço à Base de Dados + */ + public Integer getProximaConsultaIDByTrabalhadorMotivoAndDate( Integer trabalhadorID, Integer motivo, Date data ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "id", "data" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "data" ).isGreater( data ) ).and( + new Field( "motivo" ).isEqual( motivo ) ).and( + new Field( "estado" ).isEqual( new Integer( 0 ) ) ), + new String[]{ "data" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + Integer id; + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + id = null; + } + else + { + id = ( Integer ) array.get( 0, 0 ); + } + return id; + } + + public Object[][] getListaConsultasByData( Date data ) + throws Exception + { + Select2 select = + new Select2( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos", "empresas" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ), + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ), + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) }, + new String[]{ "marcacoes_trabalhador.id", "trabalhadores.nome", "trabalhadores.nome_plain", + "empresas.designacao_social", "marcacoes_trabalhador.tipo", "prestador_id" }, + new Field( "marcacoes_trabalhador.data" ).isEqual( data ).and( + new Field( "marcacoes_trabalhador.estado" ).isEqual( + new Integer( Marcacao.ESTADO_POR_REALIZAR ) ) ).and( + new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ), + null, + null, + null, + null ); + Virtual2DArray array = executer.executeQuery( select ); + return array.getObjects(); + } + + public Object[][] getListaECDsByData( Date data ) + throws Exception + { + Select2 select = + new Select2( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos", "empresas" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ), + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ), + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) }, + new String[]{ "marcacoes_trabalhador.id", "trabalhadores.nome", "trabalhadores.nome_plain", + "empresas.designacao_social", "marcacoes_trabalhador.tipo", "prestador_id" }, + new Field( "marcacoes_trabalhador.data" ).isEqual( data ).and( + new Field( "marcacoes_trabalhador.estado" ).isEqual( + new Integer( Marcacao.ESTADO_POR_REALIZAR ) ) ).and( + new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ), + null, + null, + null, + null ); + Virtual2DArray array = executer.executeQuery( select ); + return array.getObjects(); + } + + public Integer getTrabalhadorIDByMarcacaoID( Integer marcacaoID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "trabalhador_id" }, + new Field( "id" ).isEqual( marcacaoID ) ); + Virtual2DArray array = executer.executeQuery( select ); + return ( Integer ) array.get( 0, 0 ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MedicinaUpperPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MedicinaUpperPanel.java new file mode 100644 index 00000000..855c8fc0 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MedicinaUpperPanel.java @@ -0,0 +1,261 @@ +/* + * MedicinaUpperPanel.java + * + * Created on February 1, 2006, 6:48 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.util.Arrays; +import java.util.Vector; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.ColumnizedMappable; +import com.evolute.utils.tables.VectorTableModel; +import com.evolute.utils.ui.DialogException; + +/** + * + * @author fpalma + */ +public class MedicinaUpperPanel extends JPanel + implements ListSelectionListener, ControllableComponent +{ + protected BaseTable empresasTable; + protected VectorTableModel empresasModel; + protected BaseTable estabelecimentosTable; + protected VectorTableModel estabelecimentosModel; + protected BaseTable trabalhadoresTable; + protected VectorTableModel trabalhadoresModel; + + protected MedicinaDataProvider provider; + + protected final Vector listeners; + + protected boolean editing = false; + + /** Creates a new instance of MedicinaUpperPanel */ + public MedicinaUpperPanel() + throws Exception + { + provider = ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); + listeners = new Vector(); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + empresasModel = new VectorTableModel( new String[]{ "empresas" } ); + empresasTable = new BaseTable( empresasModel ); + empresasTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + empresasTable.setNonResizableNorReordable(); + JScrollPane empresasScroll = + new JScrollPane( empresasTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + empresasTable.getSelectionModel().addListSelectionListener( this ); + estabelecimentosModel = new VectorTableModel( new String[]{ "estabelecimentos" } ); + estabelecimentosTable = new BaseTable( estabelecimentosModel ); + estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + estabelecimentosTable.setNonResizableNorReordable(); + JScrollPane estabelecimentosScroll = + new JScrollPane( estabelecimentosTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + estabelecimentosTable.getSelectionModel().addListSelectionListener( this ); + trabalhadoresModel = new VectorTableModel( new String[]{ "trabalhadores" } ); + trabalhadoresTable = new BaseTable( trabalhadoresModel ); + trabalhadoresTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + trabalhadoresTable.setNonResizableNorReordable(); + JScrollPane trabalhadoresScroll = + new JScrollPane( trabalhadoresTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + trabalhadoresTable.getSelectionModel().addListSelectionListener( this ); + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridwidth = 1; + constraints.gridheight = 1; + constraints.weightx = 0.3; + constraints.weighty = 1; + + gridbag.setConstraints( empresasScroll, constraints ); + + gridbag.setConstraints( estabelecimentosScroll, constraints ); + + constraints.weightx = 0.4; + constraints.gridheight = GridBagConstraints.REMAINDER; + gridbag.setConstraints( trabalhadoresScroll, constraints ); + + add( empresasScroll ); + add( estabelecimentosScroll ); + add( trabalhadoresScroll ); + + ColumnizedMappable empresas[] = provider.getAllEmpresas(); + Vector values = empresasModel.getValues(); + values.addAll( Arrays.asList( empresas ) ); + empresasModel.setValues( values ); + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + if( e.getValueIsAdjusting() ) + { + return; + } + if( source.equals( empresasTable.getSelectionModel() ) ) + { + carregarEstabelecimentos(); + } + else if( source.equals( estabelecimentosTable.getSelectionModel() ) ) + { + carregarTrabalhadores(); + } + else if( source.equals( trabalhadoresTable.getSelectionModel() ) ) + { + notifyListeners( e ); + } + } + + protected void carregarEstabelecimentos() + { + estabelecimentosTable.clearSelection(); + int selected = empresasTable.getSelectedRow(); + estabelecimentosModel.clearAll(); + if( selected > -1 ) + { + try + { + Integer empresaID = ( ( ColumnizedMappable ) empresasModel.getRowAt( selected ) ).getID(); + ColumnizedMappable estabelecimentos[] = provider.getAllEstabelecimentosForEmpresa( empresaID); + Vector values = estabelecimentosModel.getValues(); + values.addAll( Arrays.asList( estabelecimentos ) ); + estabelecimentosModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os estabelecimentos.", true ); + estabelecimentosModel.clearAll(); + } + } + } + + protected void carregarTrabalhadores() + { + trabalhadoresTable.clearSelection(); + int selected = estabelecimentosTable.getSelectedRow(); + trabalhadoresModel.clearAll(); + if( selected > -1 ) + { + try + { + Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selected ) ).getID(); + ColumnizedMappable trabalhadores[] = provider.getAllTrabalhadoresForEstabelecimento( estabelecimentoID ); + Vector values = trabalhadoresModel.getValues(); + values.addAll( Arrays.asList( trabalhadores ) ); + trabalhadoresModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar trabalhadores.", true ); + trabalhadoresModel.clearAll(); + } + } + } + + protected void notifyListeners( ListSelectionEvent e ) + { + for( int n = 0; n < listeners.size(); n++ ) + { + ListSelectionEvent event = + new ListSelectionEvent( this, e.getFirstIndex(), e.getLastIndex(), e.getValueIsAdjusting() ); + ( ( ListSelectionListener ) listeners.elementAt( n ) ).valueChanged( event ); + } + } + + public void addListSelectionListener( ListSelectionListener listener ) + { + listeners.add( listener ); + } + + public void removeSelectionListener( ListSelectionListener listener ) + { + listeners.remove( listener ); + } + + public void clear() + { +// empresasTable.clearSelection(); + } + + public void fill( Object value ) + { + if( value == null ) + { + clear(); + } + Integer ids[] = ( Integer [] ) value; + for( int n = 0; n < empresasTable.getRowCount(); n++ ) + { + if( ( ( ColumnizedMappable ) empresasModel.getRowAt( n ) ).getID().equals( ids[ 0 ] ) ) + { + empresasTable.setRowSelectionInterval( n, n ); + break; + } + } + + for( int n = 0; n < estabelecimentosTable.getRowCount(); n++ ) + { + if( ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( n ) ).getID().equals( ids[ 1 ] ) ) + { + estabelecimentosTable.setRowSelectionInterval( n, n ); + break; + } + } + + for( int n = 0; n < trabalhadoresTable.getRowCount(); n++ ) + { + if( ( ( ColumnizedMappable ) trabalhadoresModel.getRowAt( n ) ).getID().equals( ids[ 2 ] ) ) + { + trabalhadoresTable.setRowSelectionInterval( n, n ); + break; + } + } + } + + public Object save() + { + int empresaSelected = empresasTable.getSelectedRow(); + int estabelecimentoSelected = estabelecimentosTable.getSelectedRow(); + int trabalhadorSelected = trabalhadoresTable.getSelectedRow(); + return new Integer[]{ + empresaSelected == -1 ? null : ( ( ColumnizedMappable ) empresasModel.getRowAt( empresaSelected ) ).getID(), + estabelecimentoSelected == -1 ? null : ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( estabelecimentoSelected ) ).getID(), + trabalhadorSelected == -1 ? null : ( ( ColumnizedMappable ) trabalhadoresModel.getRowAt( trabalhadorSelected ) ).getID() + }; + } + + public void setEnabled( boolean enable ) + { + editing = !enable; + empresasTable.setEnabled( enable ); + estabelecimentosTable.setEnabled( enable ); + trabalhadoresTable.setEnabled( enable ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MedicinaWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MedicinaWindow.java new file mode 100644 index 00000000..fa4df806 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/MedicinaWindow.java @@ -0,0 +1,706 @@ +/* + * MedicinaWindow.java + * + * Created on 17 de Janeiro de 2006, 19:43 + * + * To change this template, choose Tools | Options and locate the template under + * the Source Creation and Management node. Right-click the template and choose + * Open. You can then make changes to the template in the Source Editor. + */ + +package siprp.medicina; + +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.DateFormat; +import java.util.Date; +import java.util.Locale; + +import javax.swing.BorderFactory; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import shst.SHSTTrackerInterface; +import shst.medicina.MedicinaWindowInterface; +import siprp.CompanyDataLoader; +import siprp.FichaDataProvider; +import siprp.SingletonConstants; +import siprp.clientes.AvisosPanel; +import siprp.data.AvisoConstants; +import siprp.data.Marcacao; +import siprp.data.outer.ContactosData; +import siprp.data.outer.EstabelecimentosData; +import siprp.data.outer.MarcacoesTrabalhadorData; +import siprp.data.outer.TrabalhadoresData; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Object2DArray; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.panel.CheckBoxPanel; +import com.evolute.utils.ui.panel.TableEditorPanel; +import com.evolute.utils.ui.text.CopyPasteHandler; +import com.evolute.utils.ui.window.TabbedWindow; +/** + * + * @author fpalma + */ +public class MedicinaWindow extends TabbedWindow + implements ActionListener, ListSelectionListener, MedicinaWindowInterface +{ + private static int iPermissionArray[][] = + new int[][]{ {}, + { NEW_INDEX, EDIT_INDEX, SAVE_INDEX, DELETE_INDEX, CANCEL_INDEX }, + { NEW_INDEX, EDIT_INDEX, SAVE_INDEX, DELETE_INDEX, CANCEL_INDEX } }; + + private static final int TAB_CONSULTA = 0; + private static final int TAB_EXAME = 1; + + private static final int INDEX_MAIN = 0; + private static final int INDEX_CONSULTA = 1; + private static final int INDEX_EXAME = 2; + + private static final String tabNames[] = + new String[]{ "Consultas", "Exames" }; + + private static final DateFormat DATE_FORMAT = + DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "PT", "pt" ) ); + + protected MedicinaDataProvider provider; + protected FichaDataProvider fichaProvider; + protected ProviderInterface JDO; + protected SHSTTrackerInterface tracker; + + protected MedicinaUpperPanel upperPanel; + protected MarcacaoConsultaPanel marcacaoConsultaPanel; + protected TableEditorPanel marcacaoConsultaEditorPanel; + protected MarcacaoExamePanel marcacaoExamePanel; + protected TableEditorPanel marcacaoExameEditorPanel; + protected CheckBoxPanel detalhesExamePanel; + + protected Integer empresaID; + protected String empresa; + protected Integer estabelecimentoID; + protected String estabelecimento; + protected Integer trabalhadorID; + protected TrabalhadoresData trabalhador; + protected boolean estado[] = new boolean[]{ false, false }; + + /** Creates a new instance of MedicinaWindow */ + public MedicinaWindow() + throws Exception + { + super( new MedicinaUpperPanel(), tabNames, 0.7, createPermissions( iPermissionArray ) ); + upperPanel = ( MedicinaUpperPanel ) getUpperPanel(); + provider = ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); + fichaProvider = ( FichaDataProvider ) FichaDataProvider.getProvider(); + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + maximizeOnNextActivate(); + } + + private void setupComponents() + throws Exception + { + setTitle( "Medicina" ); + setupConsultaComponents(); + setupExameComponents(); + upperPanel.addListSelectionListener( this ); + } + + private void setupConsultaComponents() + { + JPanel panel = getTab( TAB_CONSULTA ); + + panel.setBorder( + BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Consultas" ) ); + + changeGroupName( INDEX_CONSULTA, "Consultas" ); + setActionName( INDEX_CONSULTA, NEW_INDEX, "Nova" ); + setActionTooltip( INDEX_CONSULTA, NEW_INDEX, "Nova" ); + JPanel toolbar = getToolbarPanel( INDEX_CONSULTA ); + + GridBagLayout gridbag = new GridBagLayout(); + GridBagConstraints constraints = new GridBagConstraints(); + panel.setLayout( gridbag ); + constraints.insets = new Insets( 2, 2, 2, 2 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1.0; + + gridbag.setConstraints( toolbar, constraints ); + panel.add( toolbar ); + + constraints.gridheight = 1; + constraints.weighty = 1.0; + try + { + marcacaoConsultaEditorPanel = + new TableEditorPanel( new String[]{ "Data", + "Estado" }, + new int[]{0,2}, new int[]{0,0}, + 0.0, 1.0, new Dimension( 350, 100 ) ); + marcacaoConsultaPanel = new MarcacaoConsultaPanel(); + new CopyPasteHandler( marcacaoConsultaPanel.getObservacoesText() ); + marcacaoConsultaEditorPanel.addComponent( marcacaoConsultaPanel, + new int[]{0,2}, new int[]{1,2}, + 1.0, 1.0 ); + marcacaoConsultaEditorPanel.addListSelectionListener( new ListSelectionListener(){ + public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent) + { + if( marcacaoConsultaEditorPanel.getID() != null ) + { + reload(INDEX_CONSULTA); + select(INDEX_CONSULTA); + } + else + { + clear( INDEX_CONSULTA ); + } + } + }); + }catch( Exception ex ) + { + DialogException.showException( ex ); + return; + } + gridbag.setConstraints( marcacaoConsultaEditorPanel, constraints ); + panel.add( marcacaoConsultaEditorPanel ); + marcacaoConsultaPanel.getEmailButton().addActionListener( this ); + } + + private void setupExameComponents() + { + JPanel panel = getTab( TAB_EXAME ); + + panel.setBorder( + BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Exames" ) ); + + changeGroupName( INDEX_EXAME, "Exames" ); + JPanel toolbar = getToolbarPanel( INDEX_EXAME ); + + GridBagLayout gridbag = new GridBagLayout(); + GridBagConstraints constraints = new GridBagConstraints(); + panel.setLayout( gridbag ); + constraints.insets = new Insets( 2, 2, 2, 2 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1.0; + + gridbag.setConstraints( toolbar, constraints ); + panel.add( toolbar ); + + constraints.gridheight = 1; + constraints.weighty = 1.0; + try + { + marcacaoExameEditorPanel = + new TableEditorPanel( new String[]{ "Data", + "Estado" }, + new int[]{0,2}, new int[]{0,0}, + 0.0, 1.0, new Dimension( 350, 100 ) ); + marcacaoExamePanel = new MarcacaoExamePanel(); + new CopyPasteHandler( marcacaoExamePanel.getObservacoesText() ); + marcacaoExameEditorPanel.addComponent( marcacaoExamePanel, + new int[]{0,2}, new int[]{1,2}, + 1.0, 1.0 ); + marcacaoExameEditorPanel.addListSelectionListener( new ListSelectionListener(){ + public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent) + { + if( marcacaoExameEditorPanel.getID() != null ) + { + reload(INDEX_EXAME); + select(INDEX_EXAME); + } + else + { + clear( INDEX_EXAME ); + } + } + }); + }catch( Exception ex ) + { + DialogException.showException( ex ); + return; + } + gridbag.setConstraints( marcacaoExameEditorPanel, constraints ); + panel.add( marcacaoExameEditorPanel ); + marcacaoExamePanel.getEmailButton().addActionListener( this ); + } + + public boolean save(int index) + { + Date data; + switch( index ) + { + case INDEX_EXAME: + MarcacoesTrabalhadorData exame = ( MarcacoesTrabalhadorData ) marcacaoExamePanel.save(); + data = ( Date ) exame.get( MarcacoesTrabalhadorData.DATA ); + if( data == null ) + { + JOptionPane.showMessageDialog( this, "Tem de preencher uma data para os exames.", + "Erro", JOptionPane.ERROR_MESSAGE ); + return false; + } + exame.set( MarcacoesTrabalhadorData.TIPO, + new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ); + exame.setToTrabalhador_id( trabalhador ); + try + { + exame.set( MarcacoesTrabalhadorData.REALIZADA, + ( ( Integer )exame.get( MarcacoesTrabalhadorData.ESTADO ) ).intValue() == + provider.ESTADO_REALIZADO ? "y" : "n" ); + exame.save(); + Integer exameID = ( Integer ) exame.get( MarcacoesTrabalhadorData.ID ); + Integer detalhesRealizados[] = detalhesExamePanel.getSelected(); + provider.setDetalhesRealziadosForMarcacao( exameID, detalhesRealizados ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + return false; + } + + break; + + case INDEX_CONSULTA: + MarcacoesTrabalhadorData consulta = ( MarcacoesTrabalhadorData ) marcacaoConsultaPanel.save(); + data = ( Date ) consulta.get( MarcacoesTrabalhadorData.DATA ); + if( data == null ) + { + JOptionPane.showMessageDialog( this, "Tem de preencher uma data para a consulta.", + "Erro", JOptionPane.ERROR_MESSAGE ); + return false; + } + consulta.set( MarcacoesTrabalhadorData.TIPO, + new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ); + consulta.setToTrabalhador_id( trabalhador ); + try + { + consulta.set( MarcacoesTrabalhadorData.REALIZADA, + ( ( Integer )consulta.get( MarcacoesTrabalhadorData.ESTADO ) ).intValue() == + provider.ESTADO_REALIZADO ? "y" : "n" ); + consulta.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + return false; + } + break; + } + reload( INDEX_MAIN ); + return true; + } + + public boolean delete(int index) + { + int option = JOptionPane.showConfirmDialog( this, "Tem a certeza que quer apagar a marca\u00e7\u00e3o?", + "Apagar", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE ); + if( option == 0 ) + { + switch( index ) + { + case INDEX_CONSULTA: + MarcacoesTrabalhadorData consulta = ( MarcacoesTrabalhadorData ) marcacaoConsultaPanel.save(); + try + { + consulta.delete(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a apagar.", true ); + return false; + } + break; + + case INDEX_EXAME: + MarcacoesTrabalhadorData exame = ( MarcacoesTrabalhadorData ) marcacaoExamePanel.save(); + try + { + exame.delete(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a apagar.", true ); + return false; + } + break; + } + reload( INDEX_MAIN ); + return true; + } + return false; + } + + public void clear(int index) + { + switch( index ) + { + case INDEX_MAIN: + empresaID = null; + empresa = null; + estabelecimentoID = null; + estabelecimento = null; + trabalhadorID = null; + trabalhador = null; + upperPanel.clear(); + marcacaoExameEditorPanel.clear(); + marcacaoConsultaEditorPanel.clear(); +// marcacaoExamePanel.getDetalhesPanel().removeAll(); + detalhesExamePanel = null; + break; + + case INDEX_CONSULTA: + marcacaoConsultaPanel.clear(); + marcacaoConsultaPanel.getEmailButton().setText( "Enviar email" ); + break; + + case INDEX_EXAME: + marcacaoExamePanel.clear(); + marcacaoExamePanel.getEmailButton().setText( "Enviar email" ); + if( detalhesExamePanel != null ) + { + detalhesExamePanel.clear(); + } + break; + } + } + + public void enableComponents(int index, boolean enable) + { + switch( index ) + { + case INDEX_MAIN: + + break; + + case INDEX_EXAME: + marcacaoExamePanel.setEnabled( enable ); + marcacaoExamePanel.getEmailButton().setEnabled( enable ); + if( detalhesExamePanel != null ) + { + detalhesExamePanel.setEnabled( enable ); + } + upperPanel.setEnabled( !enable ); + estado[ 0 ] = enable; + break; + + case INDEX_CONSULTA: + marcacaoConsultaPanel.setEnabled( enable ); + marcacaoConsultaPanel.getEmailButton().setEnabled( enable ); + upperPanel.setEnabled( !enable ); + estado[ 1 ] = enable; + break; + } + if( tracker != null ) + { + (( AvisosPanel )tracker.getAvisosPanel()).setEnabled( (!estado[ 0 ]) && (!estado[1]), + AvisoConstants.TIPO_TRABALHADOR ); + } + } + +// public boolean searchByName() +// { +// fichaProvider.setSearch( FichaDataProvider.SEARCH_EMPRESAS ); +// SearchDialog search; +// +// search = new SearchDialog( fichaProvider, null, false, null, true ); +// empresaID = ( Integer )search.getSelected(); +// +// if( empresaID == null ) +// { +// return false; +// } +// +// fichaProvider.setSearch( FichaDataProvider.SEARCH_ESTABELECIMENTOS ); +// fichaProvider.setSearchID( FichaDataProvider.SEARCH_EMPRESAS, empresaID.intValue() ); +// +// search = new SearchDialog( fichaProvider, null, false, null, true ); +// estabelecimentoID = ( Integer )search.getSelected(); +// +// if( estabelecimentoID == null ) +// { +// return false; +// } +// +// fichaProvider.setSearch( FichaDataProvider.SEARCH_TRABALHADORES ); +// fichaProvider.setSearchID( FichaDataProvider.SEARCH_ESTABELECIMENTOS, estabelecimentoID.intValue() ); +// search = new SearchDialog( fichaProvider, null, false, null, true ); +// trabalhadorID = ( Integer )search.getSelected(); +// +// if( trabalhadorID == null ) +// { +// return false; +// } +// reload(0); +// return true; +// } + + protected void enableSelect( int index, boolean select ) + { + switch( index ) + { + case INDEX_EXAME: + marcacaoExameEditorPanel.setEnabled( select ); + break; + + case INDEX_CONSULTA: + marcacaoConsultaEditorPanel.setEnabled( select ); + break; + } + } + + public void reload( int index ) + { + switch( index ) + { + case INDEX_MAIN: + try + { + String nomes[] = + provider.getEmpresaEstabelecimento( empresaID, estabelecimentoID ); + empresa = nomes[ 0 ]; + estabelecimento = nomes[ 1 ]; + trabalhador = ( TrabalhadoresData ) JDO.load( TrabalhadoresData.class, trabalhadorID ); +// upperPanel.getEmpresaText().setText( empresa ); +// upperPanel.getEstabelecimentoText().setText( estabelecimento ); +// upperPanel.getTrabalhadorText().setText( ( String ) trabalhador.get( TrabalhadoresData.NOME ) ); + IDObject detalhesExame[] = provider.getDetalhesValidosTrabalhador( empresaID, trabalhadorID ); + detalhesExamePanel = new CheckBoxPanel( detalhesExame ); + JPanel detalhesExameOuterPanel = marcacaoExamePanel.getDetalhesPanel(); + detalhesExameOuterPanel.setLayout( new GridLayout( 1, 1 ) ); + detalhesExameOuterPanel.removeAll(); + detalhesExameOuterPanel.add( detalhesExamePanel ); + detalhesExameOuterPanel.validate(); + Object examesTrabalhador[][] = provider.getExamesTrabalhador( trabalhadorID ); + Object consultasTrabalhador[][] = provider.getConsultasTrabalhador( trabalhadorID ); + if( examesTrabalhador.length > 0 ) + { + marcacaoExameEditorPanel.setData( new Object2DArray( examesTrabalhador ) ); + } + else + { + marcacaoExameEditorPanel.clear(); + } + if( consultasTrabalhador.length > 0 ) + { + marcacaoConsultaEditorPanel.setData( new Object2DArray( consultasTrabalhador ) ); + } + else + { + marcacaoConsultaEditorPanel.clear(); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os dados.", true ); + } + break; + + case INDEX_EXAME: + Integer exameID = marcacaoExameEditorPanel.getID(); + if( exameID == null ) + { + return; + } + try + { + MarcacoesTrabalhadorData exame = + ( MarcacoesTrabalhadorData ) JDO.load( MarcacoesTrabalhadorData.class, exameID ); + marcacaoExamePanel.fill( exame ); + Date dataEmailExame = ( Date ) exame.get( MarcacoesTrabalhadorData.DATA_EMAIL ); + if( dataEmailExame != null ) + { + marcacaoExamePanel.getEmailButton().setText( "Enviar email (" + DATE_FORMAT.format( dataEmailExame ) + ")" ); + } + else + { + marcacaoExamePanel.getEmailButton().setText( "Enviar email" ); + } + Integer detalhesRealizados[] = provider.getDetalhesRealizadosForMarcacao( exameID ); + detalhesExamePanel.setSelected( detalhesRealizados ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os dados do exame.", true ); + } + break; + + case INDEX_CONSULTA: + Integer consultaID = marcacaoConsultaEditorPanel.getID(); + if( consultaID == null ) + { + return; + } + try + { + MarcacoesTrabalhadorData consulta = + ( MarcacoesTrabalhadorData ) JDO.load( MarcacoesTrabalhadorData.class, consultaID ); + marcacaoConsultaPanel.fill( consulta ); + Date dataEmailConsulta = ( Date ) consulta.get( MarcacoesTrabalhadorData.DATA_EMAIL ); + if( dataEmailConsulta != null ) + { + marcacaoConsultaPanel.getEmailButton().setText( "Enviar email (" + DATE_FORMAT.format( dataEmailConsulta ) + ")" ); + } + else + { + marcacaoConsultaPanel.getEmailButton().setText( "Enviar email" ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os dados da consulta.", true ); + } + break; + } + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( marcacaoExamePanel.getEmailButton() ) ) + { + enviarEmailExame(); + } + else if( source.equals( marcacaoConsultaPanel.getEmailButton() ) ) + { + enviarEmailConsulta(); + } + } + + protected void enviarEmailConsulta() + { + MarcacoesTrabalhadorData consulta = ( MarcacoesTrabalhadorData ) marcacaoConsultaPanel.save(); + + String subject = ( String ) Singleton.getInstance( SingletonConstants.SUBJECT_CONSULTA ); + String texto = ( String ) Singleton.getInstance( SingletonConstants.LETTER_CONSULTA ); + + Date today = new Date(); + marcacaoConsultaPanel.getEmailButton().setText( "Enviar email (" + DATE_FORMAT.format( today ) + ")" ); + + try + { + enviarEmail( subject, texto, ( Date )consulta.get( MarcacoesTrabalhadorData.DATA ) ); + consulta.set( Marcacao.DATA_EMAIL, today ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a enviar mail", true ); + } + } + + protected void enviarEmailExame() + { + MarcacoesTrabalhadorData exame = ( MarcacoesTrabalhadorData ) marcacaoExamePanel.save(); + + String subject = ( String ) Singleton.getInstance( SingletonConstants.SUBJECT_EXAMES ); + String texto = ( String ) Singleton.getInstance( SingletonConstants.LETTER_EXAMES ); + + Date today = new Date(); + marcacaoExamePanel.getEmailButton().setText( "Enviar email (" + DATE_FORMAT.format( today ) + ")" ); + + try + { + enviarEmail( subject, texto, ( Date )exame.get( MarcacoesTrabalhadorData.DATA ) ); + exame.set( Marcacao.DATA_EMAIL, today ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a enviar mail", true ); + } + } + + protected void enviarEmail( String subject, String texto, Date data ) + throws Exception + { + String nome = ( String ) trabalhador.get( TrabalhadoresData.NOME ); + String dataStr = DATE_FORMAT.format( data ); + + subject = subject.replaceAll( CompanyDataLoader.NOME, nome ); + texto = texto.replaceAll( CompanyDataLoader.DATA, dataStr ); + texto = texto.replaceAll( CompanyDataLoader.NOME, nome ); + + EstabelecimentosData estabelecimento = + ( EstabelecimentosData ) JDO.load( EstabelecimentosData.class, estabelecimentoID ); + ContactosData contacto = ( ContactosData ) estabelecimento.toContacto_id(); + String mail = ""; + if( contacto != null ) + { + mail = ( String )contacto.getEmail(); + } + + if( System.getProperty( "os.name" ).startsWith( "Windows" ) ) + { + mail = mail.replaceAll( " ", "%20" ); + subject = subject.replaceAll( " ", "%20" ); + texto = texto.replaceAll( " ", "%20" ); + Process proc = Runtime.getRuntime().exec( "cmd.exe /c start mailto:\"" + mail + + "?subject=" + subject + "&body=" + + + texto + ); + } + else + { + mail = mail.replaceAll( " ", "%20" ); + subject = subject.replaceAll( " ", "%20" ); + texto = texto.replaceAll( " ", "%20" ); + + Process proc = Runtime.getRuntime().exec( new String[]{ "/usr/bin/open", "/Applications/Mail.app", "mailto:" + mail + + "?subject=" + subject + "&body=" + + texto } ); + } + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + if( source.equals( upperPanel ) ) + { + Integer ids[] = ( Integer [] ) upperPanel.save(); + empresaID = ids[ 0 ]; + estabelecimentoID = ids[ 1 ]; + trabalhadorID = ids[ 2 ]; + if( ids[ 2 ] == null ) + { + clear( INDEX_MAIN ); + unselect( INDEX_MAIN ); + } + else + { + reload( INDEX_MAIN ); + select( INDEX_MAIN ); + } + } + } + + public void setEmpresaAndEstabelecimentoAndTrabalhador( Integer empresaID, Integer estabelecimentoID, Integer trabalhadorID ) + { + if( upperPanel.editing ) + { + JOptionPane.showMessageDialog( this, "Esta janela est\u00e1 em edi\u00e7\u00e3o.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + } + else + { + upperPanel.fill( new Integer[]{ empresaID, estabelecimentoID, trabalhadorID } ); + } + } + + public void setTracker( SHSTTrackerInterface tracker ) + { + this.tracker = tracker; + + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/Test.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/Test.java new file mode 100644 index 00000000..1c4c128d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/Test.java @@ -0,0 +1,37 @@ +/* + * Test.java + * + * Created on 17 de Janeiro de 2006, 18:37 + * + * To change this template, choose Tools | Options and locate the template under + * the Source Creation and Management node. Right-click the template and choose + * Open. You can then make changes to the template in the Source Editor. + */ + +package siprp.medicina; + +import javax.swing.JFrame; +/** + * + * @author fpalma + */ +public class Test +{ + + public static void main( String args[] ) + throws Exception + { + JFrame frm = new MedicinaWindow(); +// frm.getContentPane().setLayout( new GridLayout() ); +// frm.getContentPane().add( new MedicinaUpperPanel() ); +// frm.setSize( new Dimension( 600, 600 ) ); + frm.setVisible( true ); + frm.setExtendedState(frm.getExtendedState() | frm.MAXIMIZED_BOTH); + } + + /** Creates a new instance of Test */ + public Test() + { + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/alter.sql b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/alter.sql new file mode 100644 index 00000000..3549ed22 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/alter.sql @@ -0,0 +1,159 @@ +ALTER TABLE empresas ADD a_consultas char(1); +ALTER TABLE empresas ADD a_exames char(1); +ALTER TABLE empresas ADD b_consultas char(1); +ALTER TABLE empresas ADD b_exames char(1); +ALTER TABLE empresas ADD data_cancelamento DATE; + +ALTER TABLE marcacoes_trabalhador ADD motivo INT; +ALTER TABLE marcacoes_trabalhador ADD estado INT; +ALTER TABLE marcacoes_trabalhador ADD observacoes VARCHAR( 2048 ); +UPDATE marcacoes_trabalhador SET estado = 2 WHERE realizada = 'y'; + + +-- PROTOCOLOS + +CREATE TABLE prt_grupos_protocolo +( + id int4 NOT NULL, + descricao varchar(255) NOT NULL, + descricao_plain varchar(255) NOT NULL, + CONSTRAINT grupos_protocolo_pkey PRIMARY KEY (id) +) +WITHOUT OIDS; +ALTER TABLE prt_grupos_protocolo OWNER TO postgres; + + + +CREATE TABLE prt_tipos_elementos_protocolo +( + id int4 NOT NULL, + descricao_plain varchar(255) NOT NULL, + descricao varchar(255) NOT NULL, + grupo_protocolo_id int4 NOT NULL, + CONSTRAINT prt_tipos_elementos_protocolo_pkey PRIMARY KEY (id), + CONSTRAINT prt_tipos_elementos_protocolo_grupo_protocolo_id_fkey FOREIGN KEY (grupo_protocolo_id) REFERENCES prt_grupos_protocolo (id) ON UPDATE RESTRICT ON DELETE RESTRICT +) +WITHOUT OIDS; +ALTER TABLE prt_tipos_elementos_protocolo OWNER TO postgres; + + +CREATE TABLE prt_elementos_protocolo +( + id serial NOT NULL, + tipo_elemento_protocolo_id int4 NOT NULL, + empresa_id int4 NOT NULL, + numero_perfil int4 NOT NULL, + CONSTRAINT prt_elementos_protocolo_pkey PRIMARY KEY (id), + CONSTRAINT prt_elementos_protocolo_empresa_id_fkey FOREIGN KEY (empresa_id) REFERENCES empresas (id) ON UPDATE RESTRICT ON DELETE RESTRICT, + CONSTRAINT prt_elementos_protocolo_tipo_elemento_protocolo_id_fkey FOREIGN KEY (tipo_elemento_protocolo_id) REFERENCES prt_tipos_elementos_protocolo (id) ON UPDATE RESTRICT ON DELETE RESTRICT +) +WITH OIDS; +ALTER TABLE prt_elementos_protocolo OWNER TO postgres; + + +CREATE TABLE marcacoes_grupos_realizados +( + id serial NOT NULL, + marcacao_trabalhador_id int4 NOT NULL, + grupo_protocolo_id int4 NOT NULL, + CONSTRAINT marcacoes_grupos_realizados_pkey PRIMARY KEY (id), + CONSTRAINT marcacoes_grupos_realizados_grupo_protocolo_id_fkey FOREIGN KEY (grupo_protocolo_id) REFERENCES prt_grupos_protocolo (id) ON UPDATE RESTRICT ON DELETE RESTRICT, + CONSTRAINT marcacoes_grupos_realizados_marcacao_trabalhador_id_fkey FOREIGN KEY (marcacao_trabalhador_id) REFERENCES marcacoes_trabalhador (id) ON UPDATE RESTRICT ON DELETE RESTRICT +) +WITH OIDS; +ALTER TABLE marcacoes_grupos_realizados OWNER TO postgres; + +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 1, 'Sangue', 'sangue' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 2, 'Urina', 'urina' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 3, 'RX T\\u00f3rax', 'rx torax' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 4, 'Audiograma', 'audiograma' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 5, 'Rastreio Visual', 'rastreio visual' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 6, 'ECG', 'ecg' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 7, 'Espirometria', 'espirometria' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 8, 'Exsudado Nasofar\\u00edngeo', 'exsudado nasofaringeo' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 9, 'Exame Bacteriol\\u00f3gico (Fezes)', 'exame bacteriologico (fezes)' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 10, 'Coprocultura', 'coprocultura' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 11, 'Outros ECDs', 'outros ecds' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 12, 'Outras An\\u00e1lises', 'outras analises' ); + +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 1, 'Hemograma', 'hemograma', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 2, 'Plaquetas', 'plaquetas', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 3, 'VS', 'vs', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 4, 'Glicemia', 'glicemia', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 5, 'Creatinina', 'creatinina', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 6, 'Colesterol Total', 'colesterol total', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 7, 'colesterol hdl', 'Colesterol hdl', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 8, 'Colesterol LDL', 'colesterol ldl', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 9, 'Trigliceridos', 'trigliceridos', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 10, 'Transaminases', 'transaminases', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 11, 'Gama GT', 'gama gt', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 12, 'Ureia', 'ureia', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 13, '\\u00c1cido \\u00darico', 'acido urico', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 14, 'MBE (Chumbo)', 'mbe (chumbo)', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 15, 'MBE (Outros)', 'mbe (outros)', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 16, 'Serologias Hepatite', 'serologias hepatite', 1 ); + +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 17, 'Urina II', 'urina ii', 2 ); + +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 18, 'RX T\\u00f3rax', 'rx torax', 3 ); + +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 19, 'Audiometria', 'audiometria', 4 ); + +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 20, 'Rastreio Visual', 'rastreio visual', 5 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 21, 'ECG', 'ecg', 6 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 22, 'Espirometria', 'espirometria', 7 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 23, 'Exsudado Nasofar\\u00edngeo', 'exsudado nasofaringeo', 8 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 24, 'Exame Bacteriol\\u00f3gico (Fezes)', 'exame bacteriologico (fezes)', 9 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 25, 'Coprocultura', 'coprocultura', 10 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 26, 'Outros ECDs', 'outros ecds', 11 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 27, 'Outras An\\u00e1lises', 'outras analises', 12 ); + + +ALTER TABLE prt_grupos_protocolo ADD grupo_real char(1); +UPDATE prt_grupos_protocolo SET grupo_real='y' WHERE id <= 4; +UPDATE prt_grupos_protocolo SET grupo_real='n' WHERE id > 4; + +ALTER TABLE prt_grupos_protocolo ADD ordem int4; +UPDATE prt_grupos_protocolo SET ordem=id; + +ALTER TABLE prt_tipos_elementos_protocolo ADD ordem int4; +UPDATE prt_tipos_elementos_protocolo SET ordem=id; \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/exames/logic/RecepcaoExamesLogic.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/exames/logic/RecepcaoExamesLogic.java new file mode 100644 index 00000000..6f2a3160 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/exames/logic/RecepcaoExamesLogic.java @@ -0,0 +1,63 @@ +package siprp.medicina.exames.logic; + +import java.util.Collection; +import java.util.List; + +import leaf.ui.LeafDialog; +import leaf.ui.LeafLogic; +import siprp.database.cayenne.objects.Prestadores; +import siprp.database.cayenne.objects.TrabalhadoresEcd; +import siprp.database.cayenne.providers.MedicinaDAO; + +public class RecepcaoExamesLogic extends LeafLogic +{ + + @Action(isSave = true) + public final static String ACTION_SELECT_ANALISADOR = "ACTION_SELECT_ANALISADOR"; + + @Action(isSave = false) + public final static String ACTION_SELECT_EXAME = "ACTION_SELECT_EXAME"; + + @Action(isSave = false) + public final static String ACTION_FILL_EXAMES = "ACTION_FILL_EXAMES"; + + @Action(isSave = true) + public final static String ACTION_RECEBER_EXAMES = "ACTION_RECEBER_EXAMES"; + + @Action(isSave = false) + public final static String ACTION_SORT = "ACTION_SORT"; + + public Prestadores currentAnalisador = null; + + private MedicinaDAO dao = new MedicinaDAO(); + + @LeafLogicActionBinding(actions = ACTION_SELECT_ANALISADOR) + public void getExamesForAnalisador( Prestadores analisador ) + { + currentAnalisador = analisador; + if( analisador != null ) + { + Collection result = dao.getPendingExamesForAnalisador( currentAnalisador ); + runAction( ACTION_FILL_EXAMES, result ); + } + } + + @LeafLogicActionBinding(actions = ACTION_RECEBER_EXAMES) + public void receberExames( List ecds ) + { + try + { + if( ecds != null ) + { + for( TrabalhadoresEcd ecd : ecds ) + { + ecd.save(); + } + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/exames/ui/RecepcaoExamesWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/exames/ui/RecepcaoExamesWindow.java new file mode 100644 index 00000000..c3a6df9a --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/exames/ui/RecepcaoExamesWindow.java @@ -0,0 +1,235 @@ +package siprp.medicina.exames.ui; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Dimension; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.List; + +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.ListSelectionModel; + +import leaf.ui.LeafButton; +import leaf.ui.LeafInputField; +import leaf.ui.LeafTableModel; +import leaf.ui.LeafWindow; +import leaf.ui.LeafLogic.LeafUIActionBinding; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.Prestadores; +import siprp.database.cayenne.objects.Trabalhadores; +import siprp.database.cayenne.objects.TrabalhadoresEcd; +import siprp.database.cayenne.objects.TrabalhadoresEcds; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatas; +import siprp.medicina.exames.logic.RecepcaoExamesLogic; + +import com.evolute.adt.OrderedMap; +import com.evolute.utils.tables.BaseTable; + +public class RecepcaoExamesWindow extends LeafWindow +{ + private static final long serialVersionUID = 1L; + + public static final String TITLE = "Recep" + ccedil + atilde + "o de ECDs"; + + private static final String TRABALHADOR = "Trabalhador"; + private static final String EMPRESA = "Empresa"; + + public final JLabel labelAnalisador = new JLabel( "Analisador" ); + + @ActionActivation(onSelect = RecepcaoExamesLogic.ACTION_SELECT_EXAME, onChange = "") + public BaseTable examesTable; + public LeafTableModel examesModel; + public JScrollPane examesScroll; + + @ActionActivation(onSelect = "", onChange = RecepcaoExamesLogic.ACTION_SELECT_ANALISADOR) + public final LeafInputField> fieldAnalisador = new LeafInputField>(); + + public final JLabel labelData = new JLabel( "Data de recep" + ccedil + atilde + "o" ); + public final LeafInputField fieldData = new LeafInputField(); + + public final JLabel labelOrder = new JLabel("Ordenar por: "); + @ActionActivation(onSelect="", onChange=RecepcaoExamesLogic.ACTION_SORT) + public final LeafInputField> fieldOrder = new LeafInputField>(); + + @ActionActivation(onSelect=RecepcaoExamesLogic.ACTION_RECEBER_EXAMES, onChange="") + public final LeafButton buttonReceber = new LeafButton( "Receber" ); + + public final JPanel pane = new JPanel(); + + public RecepcaoExamesWindow() + { + super( new RecepcaoExamesLogic() ); + setTitle( TITLE ); + setupLayout(); + setupComponents(); + placeComponents(); + completeSetup(); + } + + private void setupLayout() + { + double[] cols = new double[] { + TableLayout.PREFERRED, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.PREFERRED + }; + double[] rows = new double[] { + TableLayout.PREFERRED, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.PREFERRED + }; + TableLayout layout = new TableLayout( cols, rows ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + pane.setLayout( layout ); + } + + private void setupComponents() + { + setContentPane( pane ); + examesModel = new LeafTableModel( new String[] { + "Empresa", "Estabelecimento", "Trabalhador", "Exame (tipo)", "Exame" + } ); + examesTable = new BaseTable( examesModel ); + examesTable.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); +// examesTable.setNonResizableNorReordable(); + examesTable.getTableHeader().setResizingAllowed( true ); + examesTable.getTableHeader().setReorderingAllowed( false ); + examesScroll = new JScrollPane( examesTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + + OrderedMap orderOptions = new OrderedMap(); + orderOptions.putLast( EMPRESA, EMPRESA ); + orderOptions.putLast( TRABALHADOR, TRABALHADOR ); + fieldOrder.setObject( orderOptions, EMPRESA ); + fieldOrder.setEditable( true ); + } + + private JPanel createMargin(boolean horizontal, int marginSize) + { + JPanel result = new JPanel(); + Dimension dim = new Dimension(horizontal ? 0 : marginSize, horizontal ? marginSize: 0 ); + result.setPreferredSize( dim ); + result.setSize( dim ); + return result; + } + + private void placeComponents() + { + pane.add( createMargin(true, 20), new TableLayoutConstraints(0,0,0,5)); + pane.add( createMargin(true, 20), new TableLayoutConstraints(7,0,7,5)); + pane.add( createMargin(false, 20), new TableLayoutConstraints(0,0,7,0)); + pane.add( createMargin(false, 20), new TableLayoutConstraints(0,5,7,5)); + pane.add( labelAnalisador, new TableLayoutConstraints( 1, 1, 2, 1 ) ); + pane.add( fieldAnalisador, new TableLayoutConstraints( 1, 2, 4, 2 ) ); + pane.add( labelData, new TableLayoutConstraints( 1, 3 ) ); + pane.add( fieldData, new TableLayoutConstraints( 1, 4, 2, 4 ) ); + pane.add( buttonReceber, new TableLayoutConstraints( 4, 4 ) ); + pane.add( examesScroll, new TableLayoutConstraints( 1, 5, 4, 5 ) ); + pane.add( labelOrder, new TableLayoutConstraints( 1, 6 ) ); + pane.add( fieldOrder, new TableLayoutConstraints( 2, 6, 3, 6 ) ); + } + + @LeafUIActionBinding(action = RecepcaoExamesLogic.ACTION_FILL_EXAMES) + public void fillExames(Collection exames) + { + examesTable.clearSelection(); + examesModel.clearAll(); + if(exames != null) + { + OrderedMap orderedMap = new OrderedMap(); + for( TrabalhadoresEcd current : exames ) + { + TrabalhadoresEcdsDatas exameMarcacao = current.getToTrabalhadoresEcdsDatas(); + Empresas empresa = null; + Estabelecimentos estabelecimento = null; + Trabalhadores trabalhador = null; + TrabalhadoresEcds exame = null; + if( exameMarcacao != null ) + { + exame = exameMarcacao.getToTrabalhadoresEcds(); + if( exame != null) + { + trabalhador = exame.getToTrabalhadores(); + if( trabalhador != null ) + { + estabelecimento = trabalhador.getToEstabelecimentos(); + if( estabelecimento != null ) + { + empresa = estabelecimento.getToEmpresas(); + } + } + } + } + orderedMap.putLast( current, empresa, estabelecimento, trabalhador, current.getToPrtTiposElementosProtocolo().getToPrtGruposProtocolo(), current ); + } + orderedMap.order( new int[]{ 0, 1, 2, 3, 4 } ); + examesModel.setValues( orderedMap ); + } + } + + @LeafUIActionBinding(action=RecepcaoExamesLogic.ACTION_SORT) + public void sort() + { + Object selected = fieldOrder.getSelectedObject(); + if( selected != null ) + { + if(selected.toString().equals( TRABALHADOR )) + { + examesModel.order( 2, 3, 4 ); + }else + { + examesModel.order( 0, 1, 2, 3, 4 ); + } + } + } + + @LeafUIActionBinding(action = RecepcaoExamesLogic.ACTION_SELECT_ANALISADOR) + public Prestadores selectAnalisador() + { + return (Prestadores)fieldAnalisador.getSelectedObject(); + } + + @LeafUIActionBinding(action = RecepcaoExamesLogic.ACTION_RECEBER_EXAMES) + public List receberExames() + { + List result = new ArrayList(); + int [] selectedRows = examesTable.getSelectedRows(); + if( selectedRows != null ) + { + for( int i = 0; i < selectedRows.length; ++i) + { + Object ecd = examesModel.getKey( selectedRows[i] ); + if(ecd != null) + { + if( ecd instanceof TrabalhadoresEcd) + { + ((TrabalhadoresEcd) ecd ).setDataRecepcao( fieldData.getObject() ); + result.add( (TrabalhadoresEcd) ecd ); + } + } + } + } + runActionLater( RecepcaoExamesLogic.ACTION_SELECT_ANALISADOR ); + return result; + } + + @LeafUIActionBinding(action = RecepcaoExamesLogic.ACTION_STARTUP) + public void startup() + { + List prestadores = Prestadores.getAllPrestadores(); + Prestadores prestador = (prestadores == null || prestadores.size() == 0) ? null : prestadores.get( 0 ); + OrderedMap allPrestadores = new OrderedMap( prestadores ); + fieldAnalisador.setObject( allPrestadores, prestador ); + fieldAnalisador.setEditable( true ); + + fieldData.setObject( new Date() ); + fieldData.setEditable( true ); + + runActionLater( RecepcaoExamesLogic.ACTION_SELECT_ANALISADOR ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_analise/EnviarAnalisesWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_analise/EnviarAnalisesWindow.java new file mode 100644 index 00000000..10c7aab2 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_analise/EnviarAnalisesWindow.java @@ -0,0 +1,261 @@ +package siprp.medicina.locais_analise; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.text.DateFormat; +import java.util.Date; +import java.util.Locale; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.tracker.TrackableWindow; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import com.evolute.utils.ui.panel.CheckBoxPanel; + +public class EnviarAnalisesWindow extends JFrame + implements TrackableWindow, ActionListener, ChangeListener, ControllableComponent +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public static final String TITLE = "Enviar ECDs SIPRP para An\u00e1lise"; + + protected JCalendarPanel dataPanel; + protected JComboBox prestadorCombo; + protected JPanel ecdsOuterPanel; + protected CheckBoxPanel ecdsPanel; + protected JButton enviarButton; + + protected final EnviarAnalisesWindowLogic logic; + + public EnviarAnalisesWindow() + throws Exception + { + logic = new EnviarAnalisesWindowLogic( this ); + setupComponents(); + } + + private void setupComponents() + { + setTitle( TITLE ); + setSize( 500, 400 ); + + JLabel dataLabel = new JLabel( "Data" ); + dataPanel = new JCalendarPanel( this ); + dataPanel.addChangeListener( this ); + JLabel prestadorLabel = new JLabel( "Analisador" ); + prestadorCombo = new JComboBox(); + ecdsOuterPanel = new JPanel(); + ecdsOuterPanel.setLayout( new GridLayout( 1, 1 ) ); + enviarButton = new JButton( "Gravar" ); + enviarButton.addActionListener( this ); + + TableLayout layout = + new TableLayout( + new double[]{ TableLayoutConstraints.MINIMUM, TableLayoutConstraints.PREFERRED, + TableLayoutConstraints.MINIMUM, TableLayoutConstraints.PREFERRED }, + new double[]{ TableLayoutConstraints.MINIMUM, TableLayoutConstraints.FILL, + TableLayoutConstraints.MINIMUM } ); + layout.setHGap( 2 ); + layout.setVGap( 2 ); + getContentPane().setLayout( layout ); + + getContentPane().add( dataLabel, new TableLayoutConstraints( 0, 0 ) ); + getContentPane().add( dataPanel, new TableLayoutConstraints( 1, 0 ) ); + getContentPane().add( prestadorLabel, new TableLayoutConstraints( 2, 0 ) ); + getContentPane().add( prestadorCombo, new TableLayoutConstraints( 3, 0 ) ); + getContentPane().add( ecdsOuterPanel, new TableLayoutConstraints( 0, 1, 3, 1 ) ); + getContentPane().add( enviarButton, new TableLayoutConstraints( 1, 2, 2, 2 ) ); + + + setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE ); + addWindowListener( new WindowAdapter(){ + public void windowClosing( WindowEvent e ) + { + close(); + } + + public void windowOpened( WindowEvent e ) + { +// setExtendedState( getExtendedState() | MAXIMIZED_BOTH ); + } + + } ); + dataPanel.setDate( new Date() ); + try + { + logic.dateChanged( dataPanel.getDate() ); + } + catch( Exception ex ) + { + if( dataPanel.getDate() != null ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados de " + DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ).format( dataPanel.getDate() ), true ); + } + else + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados de null", true ); + } + } + } + + public void refresh() + { + } + + public void open() + { + setVisible( true ); + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable() { + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + public boolean closeIfPossible() + { + close(); + return true; + } + + protected void setPrestadores( IDObject prestadores[] ) + { + prestadorCombo.removeAllItems(); + for( IDObject prestador : prestadores ) + { + prestadorCombo.addItem( prestador ); + } +// revalidate(); + } + + public void setEcds( IDObject ecds[] ) + { + ecdsPanel = new CheckBoxPanel( ecds ); + ecdsOuterPanel.removeAll(); + ecdsOuterPanel.add( ecdsPanel ); + revalidate(); + } + + @Override + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( enviarButton ) ) + { + try + { + logic.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + } + } + } + + @Override + public void stateChanged( ChangeEvent e ) + { + Object source = e.getSource(); + if( source.equals( dataPanel ) ) + { + Date data = dataPanel.getDate(); + try + { + logic.dateChanged( data ); + } + catch( Exception ex ) + { + if( data != null ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados de " + DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ).format( data ), true ); + } + else + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados de null", true ); + } + } + } + } + + @Override + public void clear() + { + if( prestadorCombo.getItemCount() > 0 ) + { + prestadorCombo.setSelectedIndex( 0 ); + if( ecdsPanel != null ) + { + ecdsPanel.clear(); + } + } + } + + @Override + public void fill( Object value ) + { + clear(); + if( value != null ) + { + Date data = ( Date ) ( ( Object[] ) value )[ 0 ]; + Integer prestadorId = ( Integer ) ( ( Object[] ) value )[ 1 ]; + Integer ecdsEscolhidos[] = ( Integer[] ) ( ( Object[] ) value )[ 2 ]; + if( prestadorId == null ) + { + prestadorCombo.setSelectedIndex( 0 ); + } + else + { + for( int n = 0; n < prestadorCombo.getItemCount(); n++ ) + { + IDObject prestador = ( IDObject ) prestadorCombo.getItemAt( n ); + if( prestadorId.equals( prestador.getID() ) ) + { + prestadorCombo.setSelectedIndex( n ); + } + } + } + ecdsPanel.fill( ecdsEscolhidos ); + } + } + + @Override + public Object save() + { + return new Object[]{ + dataPanel.getDate(), + ( ( IDObject )prestadorCombo.getSelectedItem() ).getID(), + ecdsPanel != null ? ecdsPanel.save() : null }; + } + + private void revalidate() + { + ( ( JPanel ) getContentPane() ).revalidate(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_analise/EnviarAnalisesWindowLogic.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_analise/EnviarAnalisesWindowLogic.java new file mode 100644 index 00000000..ec835ef2 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_analise/EnviarAnalisesWindowLogic.java @@ -0,0 +1,83 @@ +package siprp.medicina.locais_analise; + +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.Date; + +import siprp.medicina.locais_realizacao.LocaisRealizacaoConstants; +import siprp.medicina.locais_realizacao.LocaisRealizacaoDataProvider; +import siprp.medicina.prestadores.PrestadoresDataProvider; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.DialogException; + +class EnviarAnalisesWindowLogic +{ + protected final EnviarAnalisesWindow window; + protected final LocaisAnaliseLogic logic; + protected final PrestadoresDataProvider prestadoresProvider; + protected final LocaisRealizacaoDataProvider locaisRealizacaoProvider; + + public EnviarAnalisesWindowLogic( EnviarAnalisesWindow window ) + throws Exception + { + this.window = window; + logic = LocaisAnaliseLogic.getInstance(); + prestadoresProvider = PrestadoresDataProvider.getProvider(); + locaisRealizacaoProvider = LocaisRealizacaoDataProvider.getProvider(); + initWindow(); + } + + protected void initWindow() + throws Exception + { + window.addWindowListener( new WindowAdapter(){ + public void windowActivated( WindowEvent e ) + { + try + { + IDObject prestadores[] = prestadoresProvider.getPrestadoresActivos(); + IDObject prestadoresCompleto[] = + new IDObject[ prestadores.length + 1 ]; + prestadoresCompleto[ 0 ] = LocaisRealizacaoConstants.PRESTADOR_SIPRP; + for( int n = 0; n < prestadores.length; n++ ) + { + prestadoresCompleto[ n + 1 ] = prestadores[ n ]; + } + window.setPrestadores( prestadoresCompleto ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar prestadores", true ); + } + } + } ); + } + + protected void dateChanged( Date data ) + throws Exception + { +System.out.println( "EnviarAnalisesWindowLogic.dateChanged: " + data ); + if( data != null ) + { + Integer idsMarcacoes[] = + locaisRealizacaoProvider.getMarcacoesEcdsIdsByDataAndPrestadorId( data, LocaisRealizacaoConstants.PRESTADOR_ID_SIPRP ); +System.out.println( "idsMarcacoes.length : " +idsMarcacoes.length ); + IDObject grupos[] = logic.getGruposEcdsByMarcacoes( idsMarcacoes ); + window.setEcds( grupos ); + window.fill( logic.getDataPrestadorEGruposByData( data ) ); + } + else + { + window.setEcds( new IDObject[ 0 ] ); + window.fill( null ); + } + } + + protected void save() + throws Exception + { + Object dados[] = ( Object[] ) window.save(); + logic.savePrestadorEGruposData( ( Date ) dados[ 0 ], ( Integer ) dados[ 1 ], ( Integer[] ) dados[ 2 ] ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_analise/LocaisAnaliseDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_analise/LocaisAnaliseDataProvider.java new file mode 100644 index 00000000..00b7dce9 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_analise/LocaisAnaliseDataProvider.java @@ -0,0 +1,138 @@ +package siprp.medicina.locais_analise; + +import java.util.Date; + +import siprp.medicina.locais_realizacao.LocaisRealizacaoConstants; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Begin; +import com.evolute.utils.sql.Commit; +import com.evolute.utils.sql.Delete; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; + +public class LocaisAnaliseDataProvider +{ + private static final Object LOCK = new Object(); + private static LocaisAnaliseDataProvider instance = null; + + private Executer EXECUTER; + + /** Creates a new instance of LocaisRealizacaoDataProvider */ + private LocaisAnaliseDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + } + + public static LocaisAnaliseDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new LocaisAnaliseDataProvider(); + } + } + return instance; + } + + protected IDObject[] getGruposEcdsByMarcacoes( Integer marcacoesIds[] ) + throws Exception + { + if( marcacoesIds == null || marcacoesIds.length == 0 ) + { + return new IDObject[ 0 ]; + } + Select select = + new Select2( + new String[]{ "trabalhadores_ecd", "prt_tipos_elementos_protocolo", + "prt_grupos_protocolo"}, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "trabalhadores_ecd.ecd_id" ).isEqual( + new Field( "prt_tipos_elementos_protocolo.id" ) ), + new Field( "prt_tipos_elementos_protocolo.grupo_protocolo_id" ).isEqual( + new Field( "prt_grupos_protocolo.id" ) ) + }, + new String[]{ "DISTINCT prt_grupos_protocolo.id", "prt_grupos_protocolo.descricao", + "prt_grupos_protocolo.ordem" }, + new Field( "trabalhadores_ecd.trabalhadores_ecds_datas_id" ).in( marcacoesIds ), + new String[]{ "prt_grupos_protocolo.ordem" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + IDObject grupos[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < grupos.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String descricao = ( String ) array.get( n, 1 ); + grupos[ n ] = new MappableObject( id, descricao ); + } + return grupos; + } + + public void savePrestadorEGruposData( Date data, Integer prestadorId, Integer gruposIds[] ) + throws Exception + { + EXECUTER.executeQuery( Begin.BEGIN ); + Delete delete = + new Delete( "trabalhadores_ecds_analise", + new Field( "data" ).isEqual( data ) ); + EXECUTER.executeQuery( delete ); + if( prestadorId != null && !LocaisRealizacaoConstants.PRESTADOR_ID_SIPRP.equals( prestadorId ) + && gruposIds != null && gruposIds.length > 0 ) + { + Insert insert = + new Insert( "trabalhadores_ecds_analise", + new Assignment[]{ + new Assignment( new Field( "data" ), data ), + new Assignment( new Field( "prestador_id" ), prestadorId ), + new Assignment( new Field( "grupo_ecds_id" ), gruposIds ) + } ); + EXECUTER.executeQuery( insert ); + } + EXECUTER.executeQuery( Commit.COMMIT ); + } + + public Object[] getDataPrestadorEGruposByData( Date data ) + throws Exception + { + Select select = + new Select2( + new String[]{ "trabalhadores_ecds_analise" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "prestador_id", "grupo_ecds_id" }, + new Field( "data" ).isEqual( data ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 ) + { + return null; + } + Integer grupos[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < grupos.length; n++ ) + { + grupos[ n ] = ( Integer ) array.get( n, 1 ); + } + return new Object[]{ data, array.get( 0, 0 ), grupos }; + } +} + + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_analise/LocaisAnaliseLogic.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_analise/LocaisAnaliseLogic.java new file mode 100644 index 00000000..eb4ed982 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_analise/LocaisAnaliseLogic.java @@ -0,0 +1,50 @@ +package siprp.medicina.locais_analise; + +import java.util.Date; + +import com.evolute.utils.data.IDObject; + +public final class LocaisAnaliseLogic +{ + private static final Object LOCK = new Object(); + private static LocaisAnaliseLogic instance; + + private final LocaisAnaliseDataProvider provider; + + private LocaisAnaliseLogic() + throws Exception + { + provider = LocaisAnaliseDataProvider.getProvider(); + } + + public static LocaisAnaliseLogic getInstance() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new LocaisAnaliseLogic(); + } + } + return instance; + } + + protected IDObject[] getGruposEcdsByMarcacoes( Integer marcacoesIds[] ) + throws Exception + { + return provider.getGruposEcdsByMarcacoes( marcacoesIds ); + } + + protected void savePrestadorEGruposData( Date data, Integer prestadorId, Integer gruposIds[] ) + throws Exception + { + provider.savePrestadorEGruposData( data, prestadorId, gruposIds ); + } + + protected Object[] getDataPrestadorEGruposByData( Date data ) + throws Exception + { + return provider.getDataPrestadorEGruposByData( data ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_analise/ReceberAnalisesWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_analise/ReceberAnalisesWindow.java new file mode 100644 index 00000000..c71b0704 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_analise/ReceberAnalisesWindow.java @@ -0,0 +1,6 @@ +package siprp.medicina.locais_analise; + +public class ReceberAnalisesWindow +{ + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/FaxPrinter.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/FaxPrinter.java new file mode 100644 index 00000000..e6ba4b5c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/FaxPrinter.java @@ -0,0 +1,180 @@ +/* + * FaxPrinter.java + * + * Created on March 1, 2007, 3:26 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.locais_realizacao; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.JToggleButton; +import javax.swing.SwingUtilities; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.ui.CustomJDialog; +import com.evolute.utils.ui.panel.CheckBoxPanel; + +/** + * + * @author fpalma + */ +public class FaxPrinter extends CustomJDialog + implements ActionListener +{ + private JTextField deText; + private JTextField deEmailText; + private JTextField deFaxText; + private JTextField deTelefoneText; + private JTextField assuntoText; + private JTextField localText; + private JToggleButton localAutoButton; + private JTextField perfil1Text; + private CheckBoxPanel perfil1Panel; + private JTextField perfil2Text; + private CheckBoxPanel perfil2Panel; + private JTextField horaText; + + private JButton imprimirButton; + private JButton cancelarButton; + + public static void main( String args[] ) + { + FaxPrinter d = new FaxPrinter(); + d.setVisible( true ); + } + + /** Creates a new instance of FaxPrinter */ + public FaxPrinter() + { + super( null, true ); + setupComponents(); + } + + private void setupComponents() + { + setTitle( "Por favor preencha os detalhes do Fax" ); + setSize( 800, 600 ); + + JLabel deLabel = new JLabel( "De" ); + deText = new JTextField(); + JLabel deEmailLabel = new JLabel( "E-mail" ); + deEmailText = new JTextField(); + JLabel deFaxLabel = new JLabel( "Fax" ); + deFaxText = new JTextField(); + JLabel deTelefoneLabel = new JLabel( "N\u00famero de telefone" ); + deTelefoneText = new JTextField(); + JLabel assuntoLabel = new JLabel( "Assunto" ); + assuntoText = new JTextField(); + localAutoButton = new JToggleButton( "Local Autom\u00e1tico" ); + localText = new JTextField(); + JLabel perfil1Label = new JLabel( "Nome" ); + perfil1Text = new JTextField(); + perfil1Panel = new CheckBoxPanel( new IDObject[]{ new MappableObject( new Integer( 1 ), "teste1" ), + new MappableObject( new Integer( 3 ), "teste3" ) } ); + JLabel perfil2Label = new JLabel( "Nome" ); + perfil2Text = new JTextField(); + perfil2Panel = new CheckBoxPanel( new IDObject[]{ new MappableObject( new Integer( 2 ), "teste2" ) } ); + imprimirButton = new JButton( "Imprimir" ); + imprimirButton.addActionListener( this ); + cancelarButton = new JButton( "Cancelar" ); + cancelarButton.addActionListener( this ); + JPanel buttonPanel = new JPanel(); + JPanel perfil1OuterPanel = new JPanel(); + perfil1OuterPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Perfil 1" ) ); + JPanel perfil2OuterPanel = new JPanel(); + perfil2OuterPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Perfil 2" ) ); + + double cols[] = + new double[]{ TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, + TableLayout.FILL, }; + double rows[] = + new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, + TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED }; + + TableLayout tableLayout = new TableLayout( cols,rows ); + setLayout( tableLayout ); + + add( deLabel, new TableLayoutConstraints( 0, 0 ) ); + add( deText, new TableLayoutConstraints( 1, 0 ) ); + add( deEmailLabel, new TableLayoutConstraints( 2, 0 ) ); + add( deEmailText, new TableLayoutConstraints( 3, 0 ) ); + add( deFaxLabel, new TableLayoutConstraints( 0, 1 ) ); + add( deFaxText, new TableLayoutConstraints( 1, 1 ) ); + add( deTelefoneLabel, new TableLayoutConstraints( 2, 1 ) ); + add( deTelefoneText, new TableLayoutConstraints( 3, 1 ) ); + add( assuntoLabel, new TableLayoutConstraints( 0, 2 ) ); + add( assuntoText, new TableLayoutConstraints( 1, 2, 3, 2 ) ); + add( localAutoButton, new TableLayoutConstraints( 0, 3 ) ); + add( localText, new TableLayoutConstraints( 1, 3, 3, 3 ) ); + add( perfil1OuterPanel, new TableLayoutConstraints( 0, 4, 1, 4 ) ); + add( perfil2OuterPanel, new TableLayoutConstraints( 2, 4, 3, 4 ) ); + add( buttonPanel, new TableLayoutConstraints( 0, 5, 3, 5 ) ); + + cols = new double[]{ TableLayout.MINIMUM, TableLayout.FILL }; + rows = new double[]{ TableLayout.PREFERRED, TableLayout.FILL }; + + tableLayout = new TableLayout( cols,rows ); + perfil1OuterPanel.setLayout( tableLayout ); + + perfil1OuterPanel.add( perfil1Label, new TableLayoutConstraints( 0, 0 ) ); + perfil1OuterPanel.add( perfil1Text, new TableLayoutConstraints( 1, 0 ) ); + perfil1OuterPanel.add( perfil1Panel, new TableLayoutConstraints( 0, 1, 1, 1 ) ); + + tableLayout = new TableLayout( cols,rows ); + perfil2OuterPanel.setLayout( tableLayout ); + + perfil2OuterPanel.add( perfil2Label, new TableLayoutConstraints( 0, 0 ) ); + perfil2OuterPanel.add( perfil2Text, new TableLayoutConstraints( 1, 0 ) ); + perfil2OuterPanel.add( perfil2Panel, new TableLayoutConstraints( 0, 1, 1, 1 ) ); + + buttonPanel.setLayout( new FlowLayout( FlowLayout.CENTER ) ); + buttonPanel.add( imprimirButton ); + buttonPanel.add( cancelarButton ); + + } + + public void actionPerformed(ActionEvent e) + { + Object source = e.getSource(); + if( source.equals( imprimirButton ) ) + { + print(); + } + else if( source.equals( cancelarButton ) ) + { + close(); + } + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable(){ + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + public void print() + { + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoConstants.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoConstants.java new file mode 100644 index 00000000..1911b738 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoConstants.java @@ -0,0 +1,11 @@ +package siprp.medicina.locais_realizacao; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; + +public class LocaisRealizacaoConstants +{ + public static final Integer PRESTADOR_ID_SIPRP = new Integer( -1 ); + + public static final IDObject PRESTADOR_SIPRP = new MappableObject( PRESTADOR_ID_SIPRP, "SIPRP" ); +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoDataProvider.java new file mode 100644 index 00000000..fd742f93 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoDataProvider.java @@ -0,0 +1,530 @@ +/* + * LocaisRealizacaoDataProvider.java + * + * Created on February 22, 2007, 10:44 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.locais_realizacao; + +import java.util.Date; + +import siprp.MedicinaConstants; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; +import com.evolute.utils.sql.Union; +import com.evolute.utils.sql.Update; +import com.evolute.utils.tables.ColumnizedMappable; + +/** + * + * @author fpalma + */ +public class LocaisRealizacaoDataProvider +{ + private static final Object LOCK = new Object(); + private static LocaisRealizacaoDataProvider instance = null; + + private Executer EXECUTER; + + /** Creates a new instance of LocaisRealizacaoDataProvider */ + private LocaisRealizacaoDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + } + + public static LocaisRealizacaoDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new LocaisRealizacaoDataProvider(); + } + } + return instance; + } + + public ColumnizedMappable[] getEmpresasComMarcacoes( Date data ) + throws Exception + { + + + Select selectConsultas = + new Select2( + new String[]{ "trabalhadores_consultas_datas", "trabalhadores_consultas", "trabalhadores", "estabelecimentos" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "trabalhadores_consultas_datas.trabalhadores_consultas_id" ).isEqual( new Field( "trabalhadores_consultas.id" ) ), + new Field( "trabalhadores_consultas.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ), + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) }, + new String[]{ "estabelecimentos.empresa_id" }, + new Field( "trabalhadores_consultas_datas.data" ).isEqual( data ).and( + new Field( "trabalhadores_consultas_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ), + null, + null, + null, + null ); + Select selectEcds = + new Select2( + new String[]{ "trabalhadores_ecds_datas", "trabalhadores_ecds", "trabalhadores", "estabelecimentos" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "trabalhadores_ecds_datas.trabalhadores_ecds_id" ).isEqual( new Field( "trabalhadores_ecds.id" ) ), + new Field( "trabalhadores_ecds.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ), + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) }, + new String[]{ "estabelecimentos.empresa_id" }, + new Field( "trabalhadores_ecds_datas.data" ).isEqual( data ).and( + new Field( "trabalhadores_ecds_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ), + null, + null, + null, + null ); + + Select select = + new Select2( + new String[]{ "empresas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "DISTINCT empresas.id", "empresas.designacao_social", "empresas.designacao_social_plain" }, + new Field( "empresas.id" ).in( new Union( new Select[]{ selectConsultas, selectEcds }, new int[]{} ) ), + new String[]{ "empresas.designacao_social_plain" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + ColumnizedMappable empresas[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < empresas.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String designacao = ( String ) array.get( n, 1 ); + empresas[ n ] = new ColumnizedMappable( id, designacao ); + } + return empresas; + } + + public ColumnizedMappable[] getEstabelecimentosComMarcacoesByEmpresa( Integer empresaID, Date data ) + throws Exception + { + Select selectConsultas = + new Select2( + new String[]{ "trabalhadores_consultas_datas", "trabalhadores_consultas", "trabalhadores" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "trabalhadores_consultas_datas.trabalhadores_consultas_id" ).isEqual( new Field( "trabalhadores_consultas.id" ) ), + new Field( "trabalhadores_consultas.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{ "trabalhadores.estabelecimento_id" }, + new Field( "trabalhadores_consultas_datas.data" ).isEqual( data ).and( + new Field( "trabalhadores_consultas_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ), + null, + null, + null, + null ); + Select selectEcds = + new Select2( + new String[]{ "trabalhadores_ecds_datas", "trabalhadores_ecds", "trabalhadores" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "trabalhadores_ecds_datas.trabalhadores_ecds_id" ).isEqual( new Field( "trabalhadores_ecds.id" ) ), + new Field( "trabalhadores_ecds.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{ "trabalhadores.estabelecimento_id" }, + new Field( "trabalhadores_ecds_datas.data" ).isEqual( data ).and( + new Field( "trabalhadores_ecds_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ), + null, + null, + null, + null ); + + Select select = + new Select2( + new String[]{ "estabelecimentos" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "DISTINCT estabelecimentos.id", "estabelecimentos.nome", "estabelecimentos.nome_plain" }, + new Field( "estabelecimentos.id" ).in( new Union( new Select[]{ selectConsultas, selectEcds }, new int[]{} ) ).and( + new Field( "estabelecimentos.inactivo" ).isEqual( "n" ) ).and( + new Field( "empresa_id" ).isEqual( empresaID ) ), + new String[]{ "estabelecimentos.nome_plain" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + ColumnizedMappable estabelecimentos[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < estabelecimentos.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + estabelecimentos[ n ] = new ColumnizedMappable( id, nome ); + } + + return estabelecimentos; + } + + public int getNumeroConsultasByEstabelecimentoAndDate( Integer estabelecimentoId, Date data ) + throws Exception + { + Select select = + new Select2( + new String[]{ "trabalhadores_consultas_datas", "trabalhadores_consultas", "trabalhadores" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "trabalhadores_consultas_datas.trabalhadores_consultas_id" ).isEqual( new Field( "trabalhadores_consultas.id" ) ), + new Field( "trabalhadores_consultas.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{ "COUNT( DISTINCT trabalhadores.id )" }, + new Field( "trabalhadores_consultas_datas.data" ).isEqual( data ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and( + new Field( "trabalhadores_consultas_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + + public Integer[] getPrestadoresConsultaIdByEstabelecimentoAndDate( Integer estabelecimentoId, Date data ) + throws Exception + { + Select selectExterno = + new Select2( + new String[]{ "trabalhadores_consultas_datas", "trabalhadores_consultas", "trabalhadores" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "trabalhadores_consultas_datas.trabalhadores_consultas_id" ).isEqual( new Field( "trabalhadores_consultas.id" ) ), + new Field( "trabalhadores_consultas.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{ "DISTINCT trabalhadores_consultas_datas.prestador_id" }, + new Field( "trabalhadores_consultas_datas.data" ).isEqual( data ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and( + new Field( "trabalhadores_consultas_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ), + null, + null, + null, + null ); + Virtual2DArray arrayExterno = EXECUTER.executeQuery( selectExterno ); + Integer ids[] = new Integer[ arrayExterno.columnLength() ]; + for( int n = 0; n < arrayExterno.columnLength(); n++ ) + { + ids[ n ] = ( Integer ) arrayExterno.get( n, 0 ); + } + return ids; + } + + public void setPrestadorConsultaIdForEstabelecimentoAndDate( Integer estabelecimentoId, Date data, Integer prestadorId ) + throws Exception + { + Select selectConsultas = + new Select2( + new String[]{ "trabalhadores_consultas", "trabalhadores" }, + new Integer[]{ Select2.JOIN_INNER }, + new Expression[]{ + new Field( "trabalhadores_consultas.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{ "DISTINCT trabalhadores_consultas.id" }, + new Field( "trabalhadores_consultas.data" ).isEqual( data ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and( + new Field( "trabalhadores_consultas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ), + null, + null, + null, + null ); + Update updateConsultas = new Update( "trabalhadores_consultas", + new Assignment[]{ + new Assignment( new Field( "prestador_id" ), prestadorId ) + }, + new Field( "id" ).in( selectConsultas ) ); + EXECUTER.executeQuery( updateConsultas ); + + Select selectConsultasDatas = + new Select2( + new String[]{ "trabalhadores_consultas_datas", "trabalhadores_consultas", "trabalhadores" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "trabalhadores_consultas_datas.trabalhadores_consultas_id" ).isEqual( new Field( "trabalhadores_consultas.id" ) ), + new Field( "trabalhadores_consultas.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{ "DISTINCT trabalhadores_consultas_datas.id" }, + new Field( "trabalhadores_consultas_datas.data" ).isEqual( data ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and( + new Field( "trabalhadores_consultas_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ), + null, + null, + null, + null ); + Update updateConsultasDatas = new Update( "trabalhadores_consultas_datas", + new Assignment[]{ + new Assignment( new Field( "prestador_id" ), prestadorId ) + }, + new Field( "id" ).in( selectConsultasDatas ) ); + EXECUTER.executeQuery( updateConsultasDatas ); + } + + protected IDObject[] getGruposEcdsByEstabelecimentoAndDate( Integer estabelecimentoId, Date data ) + throws Exception + { + Select select = + new Select2( + new String[]{ "prt_grupos_protocolo", "prt_tipos_elementos_protocolo", "trabalhadores_ecd", + "trabalhadores_ecds_datas", "trabalhadores_ecds", "trabalhadores" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "prt_grupos_protocolo.id" ).isEqual( new Field( "prt_tipos_elementos_protocolo.grupo_protocolo_id" ) ), + new Field( "prt_tipos_elementos_protocolo.id" ).isEqual( new Field( "trabalhadores_ecd.ecd_id" ) ), + new Field( "trabalhadores_ecd.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ), + new Field( "trabalhadores_ecds_datas.trabalhadores_ecds_id" ).isEqual( new Field( "trabalhadores_ecds.id" ) ), + new Field( "trabalhadores_ecds.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{ "DISTINCT prt_grupos_protocolo.id", "prt_grupos_protocolo.descricao", "prt_grupos_protocolo.ordem", + "prt_grupos_protocolo.descricao_plain" }, + new Field( "trabalhadores_ecds_datas.data" ).isEqual( data ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and( + new Field( "trabalhadores_ecds_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ), + new String[]{ "prt_grupos_protocolo.ordem", "prt_grupos_protocolo.descricao_plain" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + IDObject grupos[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < grupos.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String descricao = ( String ) array.get( n, 1 ); + grupos[ n ] = new MappableObject( id, descricao ); + } + return grupos; + } + + public Integer[] getPrestadoresByGrupoEcdEstabelecimentoAndDate( Integer grupoId, Integer estabelecimentoId, Date data ) + throws Exception + { + Select select = + new Select2( + new String[]{ "prt_tipos_elementos_protocolo", "trabalhadores_ecd", + "trabalhadores_ecds_datas", "trabalhadores_ecds", "trabalhadores" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "prt_tipos_elementos_protocolo.id" ).isEqual( new Field( "trabalhadores_ecd.ecd_id" ) ), + new Field( "trabalhadores_ecd.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ), + new Field( "trabalhadores_ecds_datas.trabalhadores_ecds_id" ).isEqual( new Field( "trabalhadores_ecds.id" ) ), + new Field( "trabalhadores_ecds.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{ "DISTINCT trabalhadores_ecds_datas.prestador_id" }, + new Field( "trabalhadores_ecds_datas.data" ).isEqual( data ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and( + new Field( "prt_tipos_elementos_protocolo.grupo_protocolo_id" ).isEqual( grupoId ) ).and( + new Field( "trabalhadores_ecds_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Integer prestadores[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < prestadores.length; n++ ) + { + prestadores[ n ] = ( Integer ) array.get( n, 0 ); + } + return prestadores; + } + + public int getNumeroMarcacoesByGrupoEcdEstabelecimentoAndDate( Integer grupoId, Integer estabelecimentoId, Date data ) + throws Exception + { + Select select = + new Select2( + new String[]{ "prt_tipos_elementos_protocolo", "trabalhadores_ecd", + "trabalhadores_ecds_datas", "trabalhadores_ecds", "trabalhadores" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "prt_tipos_elementos_protocolo.id" ).isEqual( new Field( "trabalhadores_ecd.ecd_id" ) ), + new Field( "trabalhadores_ecd.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ), + new Field( "trabalhadores_ecds_datas.trabalhadores_ecds_id" ).isEqual( new Field( "trabalhadores_ecds.id" ) ), + new Field( "trabalhadores_ecds.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{ "COUNT( DISTINCT trabalhadores.id)" }, + new Field( "trabalhadores_ecds_datas.data" ).isEqual( data ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and( + new Field( "prt_tipos_elementos_protocolo.grupo_protocolo_id" ).isEqual( grupoId ) ).and( + new Field( "trabalhadores_ecds_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + + public void setPrestadorIdForGruposEcdsEstabelecimentoAndDate( Integer estabelecimentoId, Date data, Integer prestadorId ) + throws Exception + { + Select selectConsultas = + new Select2( + new String[]{ "trabalhadores_consultas", "trabalhadores" }, + new Integer[]{ Select2.JOIN_INNER }, + new Expression[]{ + new Field( "trabalhadores_consultas.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{ "DISTINCT trabalhadores_consultas.id" }, + new Field( "trabalhadores_consultas.data" ).isEqual( data ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and( + new Field( "trabalhadores_consultas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ), + null, + null, + null, + null ); + Update updateConsultas = new Update( "trabalhadores_consultas", + new Assignment[]{ + new Assignment( new Field( "prestador_id" ), prestadorId ) + }, + new Field( "id" ).in( selectConsultas ) ); + EXECUTER.executeQuery( updateConsultas ); + + Select selectConsultasDatas = + new Select2( + new String[]{ "trabalhadores_consultas_datas", "trabalhadores_consultas", "trabalhadores" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "trabalhadores_consultas_datas.trabalhadores_consultas_id" ).isEqual( new Field( "trabalhadores_consultas.id" ) ), + new Field( "trabalhadores_consultas.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{ "DISTINCT trabalhadores_consultas_datas.id" }, + new Field( "trabalhadores_consultas_datas.data" ).isEqual( data ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and( + new Field( "trabalhadores_consultas_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ), + null, + null, + null, + null ); + Update updateConsultasDatas = new Update( "trabalhadores_consultas_datas", + new Assignment[]{ + new Assignment( new Field( "prestador_id" ), prestadorId ) + }, + new Field( "id" ).in( selectConsultasDatas ) ); + EXECUTER.executeQuery( updateConsultasDatas ); + } + + protected IDObject[] getExamesOficiaisByEstabelecimentoAndDate( Integer estabelecimentoId, Date data ) + throws Exception + { + Select select = + new Select2( + new String[]{ "ecd_oficial", "trabalhadores_ecd", + "trabalhadores_ecds_datas", "trabalhadores_ecds", "trabalhadores" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "ecd_oficial.id" ).isEqual( new Field( "trabalhadores_ecd.ecd_oficial_id" ) ), + new Field( "trabalhadores_ecd.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ), + new Field( "trabalhadores_ecds_datas.trabalhadores_ecds_id" ).isEqual( new Field( "trabalhadores_ecds.id" ) ), + new Field( "trabalhadores_ecds.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{ "DISTINCT ecd_oficial.id", "ecd_oficial.descricao", "ecd_oficial.ordem", + "ecd_oficial.descricao_plain" }, + new Field( "trabalhadores_ecds_datas.data" ).isEqual( data ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and( + new Field( "trabalhadores_ecds_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ), + new String[]{ "ecd_oficial.ordem", "ecd_oficial.descricao_plain" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + IDObject ecds[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < ecds.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String descricao = ( String ) array.get( n, 1 ); + ecds[ n ] = new MappableObject( id, descricao ); + } + return ecds; + } + + public Integer[] getPrestadoresByEcdOficialEstabelecimentoAndDate( Integer ecdOficialId, Integer estabelecimentoId, Date data ) + throws Exception + { + Select select = + new Select2( + new String[]{ "trabalhadores_ecd", "trabalhadores_ecds_datas", "trabalhadores_ecds", "trabalhadores" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "trabalhadores_ecd.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ), + new Field( "trabalhadores_ecds_datas.trabalhadores_ecds_id" ).isEqual( new Field( "trabalhadores_ecds.id" ) ), + new Field( "trabalhadores_ecds.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{ "DISTINCT trabalhadores_ecds_datas.prestador_id" }, + new Field( "trabalhadores_ecds_datas.data" ).isEqual( data ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and( + new Field( "trabalhadores_ecd.ecd_oficial_id" ).isEqual( ecdOficialId ) ).and( + new Field( "trabalhadores_ecds_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Integer prestadores[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < prestadores.length; n++ ) + { + prestadores[ n ] = ( Integer ) array.get( n, 0 ); + } + return prestadores; + } + + public int getNumeroMarcacaoesByEcdOficialEstabelecimentoAndDate( Integer ecdOficialId, Integer estabelecimentoId, Date data ) + throws Exception + { + Select select = + new Select2( + new String[]{ "trabalhadores_ecd", "trabalhadores_ecds_datas", "trabalhadores_ecds", "trabalhadores" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "trabalhadores_ecd.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ), + new Field( "trabalhadores_ecds_datas.trabalhadores_ecds_id" ).isEqual( new Field( "trabalhadores_ecds.id" ) ), + new Field( "trabalhadores_ecds.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{ "COUNT( DISTINCT trabalhadores.id)" }, + new Field( "trabalhadores_ecds_datas.data" ).isEqual( data ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and( + new Field( "trabalhadores_ecd.ecd_oficial_id" ).isEqual( ecdOficialId ) ).and( + new Field( "trabalhadores_ecds_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + + public Integer []getMarcacoesEcdsIdsByDataAndPrestadorId( Date data, Integer prestadorId ) + throws Exception + { + if( LocaisRealizacaoConstants.PRESTADOR_ID_SIPRP.equals( prestadorId ) ) + { + prestadorId = null; + } + Select select = + new Select2( + new String[]{ "trabalhadores_ecds_datas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id" }, + new Field( "data" ).isEqual( data ).and( + new Field("prestador_id" ).isEqual( prestadorId ) ).and( + new Field( "estado" ).in( + new Integer[]{ + new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ), + new Integer( MedicinaConstants.ESTADO_PARCIALMENTE_REALIZADO ), + new Integer( MedicinaConstants.ESTADO_REALIZADO ) } ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + ids[ n ] = ( Integer ) array.get( n, 0 ); + } + return ids; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoWindow.java new file mode 100644 index 00000000..c557839e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoWindow.java @@ -0,0 +1,730 @@ +/* + * LocaisRealizacaoWindow.java + * + * Created on February 22, 2007, 10:19 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.locais_realizacao; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.Arrays; +import java.util.Date; +import java.util.Vector; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.ListSelectionModel; +import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import siprp.medicina.prestadores.PrestadoresDataProvider; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.ColumnizedMappable; +import com.evolute.utils.tables.VectorTableModel; +import com.evolute.utils.tracker.TrackableWindow; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.calendar.JCalendarPanel; + +/** + * + * @author fpalma + */ +public class LocaisRealizacaoWindow extends JFrame + implements ActionListener, TrackableWindow, ListSelectionListener +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + protected JCalendarPanel dataPanel; + protected JButton carregarButton; +// protected JButton recarregarPrestadoresButton; + protected VectorTableModel empresasModel; + protected BaseTable empresasTable; + protected VectorTableModel estabelecimentosModel; + protected BaseTable estabelecimentosTable; + protected JLabel numeroConsultasLabel; + protected JComboBox prestadoresConsultasCombo; + protected JButton enviarConsultasButton; + protected JButton faxConsultasButton; + protected JButton enviarECDsButton; + protected JScrollPane listaEcdsScroll; + +// protected JLabel numeroECDsLabel; + protected Integer idsGruposEcds[]; + protected JComboBox prestadoresECDsCombos[]; + protected Integer idsEcdsOficiais[]; + protected JComboBox prestadoresECDsOficiaisCombos[]; +// protected JButton faxECDsButton; + + protected LocaisRealizacaoDataProvider provider; + protected PrestadoresDataProvider prestadoresProvider; + + /** + * Creates a new instance of LocaisRealizacaoWindow + */ + public LocaisRealizacaoWindow() + throws Exception + { + provider = LocaisRealizacaoDataProvider.getProvider(); + prestadoresProvider = PrestadoresDataProvider.getProvider(); + setupComponents(); + } + + private void setupComponents() + { + setTitle( "Locais de Realiza\u00e7\u00e3o" ); + setSize( 1000, 700 ); + JLabel dataLabel = new JLabel( "Data" ); + dataPanel = new JCalendarPanel( this ); + + carregarButton = new JButton( "Carregar" ); + carregarButton.addActionListener( this ); +// recarregarPrestadoresButton = new JButton( "Recarregar Prestadores" ); +// recarregarPrestadoresButton.addActionListener( this ); + empresasModel = new VectorTableModel( new String[]{ "empresa" } ); + empresasTable = new BaseTable( empresasModel ); + empresasTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + empresasTable.getSelectionModel().addListSelectionListener( this ); + JScrollPane empresasScp = new JScrollPane( empresasTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + estabelecimentosModel = new VectorTableModel( new String[]{ "estabelecimento" } ); + estabelecimentosTable = new BaseTable( estabelecimentosModel ); + estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + estabelecimentosTable.getSelectionModel().addListSelectionListener( this ); + JScrollPane estabelecimentosScp = new JScrollPane( estabelecimentosTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + JPanel consultasPanel = new JPanel(); + consultasPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Consultas" ) ); + JLabel consultasLabel = new JLabel( "N\u00ba de Consultas: " ); + numeroConsultasLabel = new JLabel( " " ); + numeroConsultasLabel.setForeground( Color.green.darker() ); + prestadoresConsultasCombo = new JComboBox(); + enviarConsultasButton = new JButton( "Atribuir" ); + enviarConsultasButton.addActionListener( this ); + faxConsultasButton = new JButton( "Fax" ); + faxConsultasButton.addActionListener( this ); + JPanel ecdsPanel = new JPanel(); + ecdsPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "ECDs" ) ); +// JLabel ecdsLabel = new JLabel( "Quantidade " ); +// numeroECDsLabel = new JLabel( " " ); +// numeroECDsLabel.setForeground( Color.green.darker() ); +// prestadoresECDsCombo = new JComboBox(); + listaEcdsScroll = new JScrollPane(); + listaEcdsScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED ); + listaEcdsScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED ); + enviarECDsButton = new JButton( "Atribuir" ); + enviarECDsButton.addActionListener( this ); +// faxECDsButton = new JButton( "Fax" ); +// faxECDsButton.addActionListener( this ); + dataPanel.addChangeListener( new ChangeListener(){ + public void stateChanged(ChangeEvent e) + { + empresasTable.clearSelection(); + Vector values = empresasModel.getValues(); + values.clear(); + empresasModel.setValues( values ); + } + } ); + + TableLayout layout = + new TableLayout( + new double[]{ TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL }, + new double[]{ TableLayout.MINIMUM, TableLayout.FILL, TableLayout.FILL } ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + +// getContentPane().setLayout( new BorderLayout( 5, 5 ) ); + getContentPane().setLayout( layout ); + JPanel upperPanel = new JPanel(); + getContentPane().add( upperPanel, new TableLayoutConstraints( 0, 0, 3, 0 ) ); + getContentPane().add( empresasScp, new TableLayoutConstraints( 0, 1, 1, 1 ) ); + getContentPane().add( estabelecimentosScp, new TableLayoutConstraints( 2, 1, 3, 1 ) ); +// JPanel detalhesPanel = new JPanel(); +// getContentPane().add( detalhesPanel, new TableLayoutConstraints( 0, 2, 1, 2 ) ); + getContentPane().add( consultasPanel, new TableLayoutConstraints( 0, 2 ) ); + getContentPane().add( ecdsPanel, new TableLayoutConstraints( 1, 2, 3, 2 ) ); +// getContentPane().add( upperPanel, BorderLayout.NORTH ); +// JPanel centerPanel = new JPanel(); +// getContentPane().add( centerPanel, BorderLayout.CENTER ); + + upperPanel.setLayout( new FlowLayout( FlowLayout.CENTER ) ); + upperPanel.add( dataLabel ); + upperPanel.add( dataPanel ); + upperPanel.add( carregarButton ); +// upperPanel.add( recarregarPrestadoresButton ); + +// centerPanel.setLayout( new GridLayout( 1, 3 ) ); +// centerPanel.add( empresasScp ); +// centerPanel.add( estabelecimentosScp ); +// JPanel detalhesPanel = new JPanel(); +// centerPanel.add( detalhesPanel ); + + double cols[] = + new double[]{ TableLayout.MINIMUM, TableLayout.FILL }; + double rows[] = + new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM }; + + TableLayout tableLayout = new TableLayout( cols,rows ); + consultasPanel.setLayout( tableLayout ); + + consultasPanel.add( consultasLabel, new TableLayoutConstraints( 0, 0 ) ); + consultasPanel.add( numeroConsultasLabel, new TableLayoutConstraints( 1, 0 ) ); + consultasPanel.add( prestadoresConsultasCombo, new TableLayoutConstraints( 0, 1, 1, 1 ) ); + consultasPanel.add( enviarConsultasButton, new TableLayoutConstraints( 0, 2, 1, 2 ) ); +// consultasPanel.add( faxConsultasButton, new TableLayoutConstraints( 0, 3, 1, 3 ) ); + + rows = new double[]{ TableLayout.FILL, TableLayout.MINIMUM }; + + tableLayout = new TableLayout( cols,rows ); + ecdsPanel.setLayout( tableLayout ); +// +// ecdsPanel.add( ecdsLabel, new TableLayoutConstraints( 0, 0 ) ); +// ecdsPanel.add( numeroECDsLabel, new TableLayoutConstraints( 1, 0 ) ); +// ecdsPanel.add( prestadoresECDsCombo, new TableLayoutConstraints( 0, 1, 1, 1 ) ); + ecdsPanel.add( listaEcdsScroll, new TableLayoutConstraints( 0, 0, 1, 0 ) ); + ecdsPanel.add( enviarECDsButton, new TableLayoutConstraints( 0, 1, 1, 1 ) ); +// ecdsPanel.add( faxECDsButton, new TableLayoutConstraints( 0, 3, 1, 3 ) ); + +// cols = new double[]{ TableLayout.FILL }; +// rows = new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL }; +// +// tableLayout = new TableLayout( cols,rows ); +// detalhesPanel.setLayout( tableLayout ); +// +// detalhesPanel.add( consultasPanel, new TableLayoutConstraints( 0, 0 ) ); +// detalhesPanel.add( ecdsPanel, new TableLayoutConstraints( 0, 1 ) ); + + setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE ); + addWindowListener( new WindowAdapter(){ + public void windowClosing( WindowEvent e ) + { + close(); + } + + public void windowOpened( WindowEvent e ) + { +// setExtendedState( getExtendedState() | MAXIMIZED_BOTH ); + } + + } ); + dataPanel.setDate( new Date() ); + recarregarPrestadores(); + carregar(); + } + + public void refresh() + { + } + + public void open() + { + setVisible( true ); + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable() { + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + public boolean closeIfPossible() + { + close(); + return true; + } + + public void actionPerformed(ActionEvent e) + { + Object source = e.getSource(); + if( source.equals( carregarButton ) ) + { + carregar(); + } +//// else if( source.equals( recarregarPrestadoresButton ) ) +// { +// recarregarPrestadores(); +// } + else if( source.equals( enviarConsultasButton ) ) + { + enviarConsultas(); + } + else if( source.equals( faxConsultasButton ) ) + { + faxConsultas(); + } + else if( source.equals( enviarECDsButton ) ) + { + enviarECDs(); + } +// else if( source.equals( faxECDsButton ) ) +// { +// faxECDs(); +// } + + } + + public void valueChanged(ListSelectionEvent e) + { + Object source = e.getSource(); + if( e.getValueIsAdjusting() ) + { + return; + } + if( source.equals( empresasTable.getSelectionModel() ) ) + { + mudarEmpresa(); + } + else if( source.equals( estabelecimentosTable.getSelectionModel() ) ) + { + mudarEstabelecimento(); + } + } + + protected void carregar() + { + empresasTable.clearSelection(); + Date data = dataPanel.getDate(); + if( data == null ) + { + empresasModel.clearAll(); + return; + } + try + { + ColumnizedMappable empresas[] = provider.getEmpresasComMarcacoes( data ); + Vector values = empresasModel.getValues(); + values.clear(); + values.addAll( Arrays.asList( empresas ) ); + empresasModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar empresas", true ); + } + } + + protected void mudarEmpresa() + { + estabelecimentosTable.clearSelection(); + Date data = dataPanel.getDate(); + int selected = empresasTable.getSelectedRow(); + if( data == null || selected == -1 ) + { + estabelecimentosModel.clearAll(); + return; + } + Integer empresaID = ( ( ColumnizedMappable ) empresasModel.getRowAt( selected ) ).getID(); + try + { + ColumnizedMappable estabelecimentos[] = + provider.getEstabelecimentosComMarcacoesByEmpresa( empresaID, data ); + Vector values = estabelecimentosModel.getValues(); + values.clear(); + values.addAll( Arrays.asList( estabelecimentos ) ); + estabelecimentosModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar estabelecimentos", true ); + } + } + + protected void mudarEstabelecimento() + { + Date data = dataPanel.getDate(); + int selectedEstabelecimento = estabelecimentosTable.getSelectedRow(); + numeroConsultasLabel.setText( " " ); +// numeroECDsLabel.setText( " " ); + enviarConsultasButton.setEnabled( false ); + enviarECDsButton.setEnabled( false ); + if( data == null || selectedEstabelecimento == -1 ) + { + return; + } + Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID(); + try + { + int countConsultas = + provider.getNumeroConsultasByEstabelecimentoAndDate( estabelecimentoID, data ); +// int countECDs = +// provider.getNumeroMarcacoesByEstabelecimentoAndTipo( estabelecimentoID, +// Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data ); + if( countConsultas > 0 ) + { + numeroConsultasLabel.setText( "" + countConsultas ); + enviarConsultasButton.setEnabled( true ); + Integer[] escolhidos = + provider.getPrestadoresConsultaIdByEstabelecimentoAndDate( estabelecimentoID, data ); + if( escolhidos.length == 1 ) + { + numeroConsultasLabel.setForeground( Color.green.darker() ); + } + else + { + numeroConsultasLabel.setForeground( Color.red.darker() ); + } + int e; + for( e = 0; e < escolhidos.length; e++ ) + { + if( escolhidos[ e ] != null ) + { + break; + } + } + if( e == escolhidos.length || escolhidos[ e ] == null ) + { + prestadoresConsultasCombo.setSelectedIndex( 0 ); + } + else + { + for( int p = 0; p < prestadoresConsultasCombo.getItemCount(); p++ ) + { + IDObject prestador = ( IDObject ) prestadoresConsultasCombo.getItemAt( p ); + if( prestador.getID().equals( escolhidos[ e ] ) ) + { + prestadoresConsultasCombo.setSelectedIndex( p ); + } + } + } + enviarConsultasButton.setEnabled( true ); + } + + IDObject prestadoresECDs[] = prestadoresProvider.getPrestadoresECDsActivos(); + + IDObject gruposEcds[] = provider.getGruposEcdsByEstabelecimentoAndDate( estabelecimentoID, data ); + idsGruposEcds = new Integer[ gruposEcds.length ]; + prestadoresECDsCombos = new JComboBox[ gruposEcds.length ]; + JPanel gruposEcdsPanel = new JPanel(); + double rows[] = new double[ gruposEcds.length + 1 ]; + for( int n = 0; n < rows.length - 1; n++ ) + { + rows[ n ] = TableLayoutConstraints.MINIMUM; + } + rows[ rows.length - 1 ] = TableLayoutConstraints.FILL; + TableLayout layout = + new TableLayout( + new double[]{ TableLayoutConstraints.FILL, TableLayoutConstraints.MINIMUM, + TableLayoutConstraints.FILL }, + rows ); + gruposEcdsPanel.setLayout( layout ); + gruposEcdsPanel.setBorder( + BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Protocolo" ) ); + for( int n = 0; n < gruposEcds.length; n++ ) + { + JLabel ecdLabel = new JLabel( "" + gruposEcds[ n ].toString() ); + int numero = + provider.getNumeroMarcacoesByGrupoEcdEstabelecimentoAndDate( + gruposEcds[ n ].getID(), estabelecimentoID, data ); + Integer escolhidos[] = + provider.getPrestadoresByGrupoEcdEstabelecimentoAndDate( + gruposEcds[ n ].getID(), estabelecimentoID, data ); + JLabel numeroLabel = new JLabel( "" + numero, JLabel.RIGHT ); + if( escolhidos.length > 1 ) + { + numeroLabel.setForeground( Color.red.darker() ); + } + else + { + numeroLabel.setForeground( Color.green.darker() ); + } + prestadoresECDsCombos[ n ] = new JComboBox(); + prestadoresECDsCombos[ n ].addItem( LocaisRealizacaoConstants.PRESTADOR_SIPRP ); + for( int p = 0; p < prestadoresECDs.length; p++ ) + { + prestadoresECDsCombos[ n ].addItem( prestadoresECDs[ p ] ); + } + int e; + for( e = 0; e < escolhidos.length; e++ ) + { + if( escolhidos[ e ] != null ) + { + break; + } + } + if( e == escolhidos.length || escolhidos[ e ] == null ) + { + prestadoresECDsCombos[ n ].setSelectedIndex( 0 ); + } + else + { + for( int p = 0; p < prestadoresECDsCombos[ n ].getItemCount(); p++ ) + { + IDObject prestador = ( IDObject ) prestadoresECDsCombos[ n ].getItemAt( p ); + if( prestador.getID().equals( escolhidos[ e ] ) ) + { + prestadoresECDsCombos[ n ].setSelectedIndex( p ); + } + } + } + + gruposEcdsPanel.add( ecdLabel, new TableLayoutConstraints( 0, n ) ); + gruposEcdsPanel.add( numeroLabel, new TableLayoutConstraints( 1, n ) ); + gruposEcdsPanel.add( prestadoresECDsCombos[ n ], new TableLayoutConstraints( 2, n ) ); + } + + + IDObject ecdsOficiais[] = provider.getExamesOficiaisByEstabelecimentoAndDate( estabelecimentoID, data ); + idsEcdsOficiais = new Integer[ ecdsOficiais.length ]; + prestadoresECDsOficiaisCombos = new JComboBox[ ecdsOficiais.length ]; + JPanel ecdsOficiaisPanel = new JPanel(); + rows = new double[ ecdsOficiais.length + 1 ]; + for( int n = 0; n < rows.length - 1; n++ ) + { + rows[ n ] = TableLayoutConstraints.MINIMUM; + } + rows[ rows.length - 1 ] = TableLayoutConstraints.FILL; + layout = new TableLayout( + new double[]{ TableLayoutConstraints.FILL, TableLayoutConstraints.MINIMUM, + TableLayoutConstraints.FILL }, + rows ); + ecdsOficiaisPanel.setLayout( layout ); + ecdsOficiaisPanel.setBorder( + BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Extra protocolo" ) ); + for( int n = 0; n < ecdsOficiais.length; n++ ) + { + JLabel ecdLabel = new JLabel( "" + ecdsOficiais[ n ].toString() ); + int numero = + provider.getNumeroMarcacaoesByEcdOficialEstabelecimentoAndDate( + ecdsOficiais[ n ].getID(), estabelecimentoID, data ); + Integer escolhidos[] = + provider.getPrestadoresByEcdOficialEstabelecimentoAndDate( + ecdsOficiais[ n ].getID(), estabelecimentoID, data ); + JLabel numeroLabel = new JLabel( "" + numero, JLabel.RIGHT ); + if( escolhidos.length > 1 ) + { + numeroLabel.setForeground( Color.red.darker() ); + } + else + { + numeroLabel.setForeground( Color.green.darker() ); + } + prestadoresECDsOficiaisCombos[ n ] = new JComboBox(); + prestadoresECDsOficiaisCombos[ n ].addItem( LocaisRealizacaoConstants.PRESTADOR_SIPRP ); + for( int p = 0; p < prestadoresECDs.length; p++ ) + { + prestadoresECDsOficiaisCombos[ n ].addItem( prestadoresECDs[ p ] ); + } + int e; + for( e = 0; e < escolhidos.length; e++ ) + { + if( escolhidos[ e ] != null ) + { + break; + } + } + if( e == escolhidos.length || escolhidos[ e ] == null ) + { + prestadoresECDsOficiaisCombos[ n ].setSelectedIndex( 0 ); + } + else + { + for( int p = 0; p < prestadoresECDsOficiaisCombos[ n ].getItemCount(); p++ ) + { + IDObject prestador = ( IDObject ) prestadoresECDsOficiaisCombos[ n ].getItemAt( p ); + if( prestador.getID().equals( escolhidos[ e ] ) ) + { + prestadoresECDsOficiaisCombos[ n ].setSelectedIndex( p ); + } + } + } + + ecdsOficiaisPanel.add( ecdLabel, new TableLayoutConstraints( 0, n ) ); + ecdsOficiaisPanel.add( numeroLabel, new TableLayoutConstraints( 1, n ) ); + ecdsOficiaisPanel.add( prestadoresECDsOficiaisCombos[ n ], new TableLayoutConstraints( 2, n ) ); + } + + JPanel ecdsPanel = new JPanel(); + TableLayout ecdsLayout = + new TableLayout( new double[]{ TableLayoutConstraints.FILL }, + new double[]{ TableLayoutConstraints.MINIMUM, TableLayoutConstraints.MINIMUM, + TableLayoutConstraints.FILL } ); + ecdsPanel.setLayout( ecdsLayout ); + ecdsPanel.add( gruposEcdsPanel, new TableLayoutConstraints( 0, 0 ) ); + ecdsPanel.add( ecdsOficiaisPanel, new TableLayoutConstraints( 0, 1 ) ); + listaEcdsScroll.setViewportView( ecdsPanel ); + + enviarECDsButton.setEnabled( true ); +// if( countECDs > 0 ) +// { +// numeroECDsLabel.setText( "" + countECDs ); +// enviarECDsButton.setEnabled( true ); +// Integer[] escolhidos = +// provider.getPrestadoresIDByEstabelecimentoAndTipo( estabelecimentoID, +// Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data ); +// if( escolhidos.length == 1 ) +// { +// numeroECDsLabel.setForeground( Color.green.darker() ); +// } +// else +// { +// numeroECDsLabel.setForeground( Color.red.darker() ); +// } +// int e; +// for( e = 0; e < escolhidos.length; e++ ) +// { +// if( escolhidos[ e ] != null ) +// { +// break; +// } +// } +// if( e == escolhidos.length || escolhidos[ e ] == null ) +// { +// prestadoresECDsCombo.setSelectedIndex( 0 ); +// } +// else +// { +// for( int p = 0; p < prestadoresECDsCombo.getItemCount(); p++ ) +// { +// IDObject prestador = ( IDObject ) prestadoresECDsCombo.getItemAt( p ); +// if( prestador.getID().equals( escolhidos[ e ] ) ) +// { +// prestadoresECDsCombo.setSelectedIndex( p ); +// } +// } +// } +// } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar detalhes", true ); + } + } + + protected void recarregarPrestadores() + { + try + { + IDObject prestadoresConsultas[] = prestadoresProvider.getPrestadoresConsultasActivos(); + IDObject prestadoresECDs[] = prestadoresProvider.getPrestadoresECDsActivos(); + prestadoresConsultasCombo.removeAllItems(); + prestadoresConsultasCombo.addItem( LocaisRealizacaoConstants.PRESTADOR_SIPRP ); + for( int n = 0; n < prestadoresConsultas.length; n++ ) + { + prestadoresConsultasCombo.addItem( prestadoresConsultas[ n ] ); + } +// prestadoresECDsCombo.removeAllItems(); +// prestadoresECDsCombo.addItem( PRESTADOR_SIPRP ); +// for( int n = 0; n < prestadoresECDs.length; n++ ) +// { +// prestadoresECDsCombo.addItem( prestadoresECDs[ n ] ); +// } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar prestadores", true ); + } + } + + protected void enviarECDs() + { + Date data = dataPanel.getDate(); + int selectedEstabelecimento = estabelecimentosTable.getSelectedRow(); + if( data == null || selectedEstabelecimento == -1 ) + { + return; + } + Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID(); + try + { +// Integer prestadorID = ( ( IDObject ) prestadoresECDsCombo.getSelectedItem() ).getID(); +// if( PRESTADOR_ID_SIPRP.equals( prestadorID ) ) +// { +// prestadorID = null; +// } +// provider.setPrestadorIDForEstabelecimentoAndTipo( estabelecimentoID, +// Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data, prestadorID ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a atribuir", true ); + } + } + +// protected void faxECDs() +// { +// Date data = dataPanel.getDate(); +// int selectedEstabelecimento = estabelecimentosTable.getSelectedRow(); +// if( data == null || selectedEstabelecimento == -1 ) +// { +// return; +// } +// Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID(); +// try +// { +// Integer prestadorID = ( ( IDObject ) prestadoresECDsCombo.getSelectedItem() ).getID(); +// if( PRESTADOR_ID_SIPRP.equals( prestadorID ) ) +// { +// prestadorID = null; +// } +// provider.setPrestadorIDForEstabelecimentoAndTipo( estabelecimentoID, +// Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data, prestadorID ); +// } +// catch( Exception ex ) +// { +// DialogException.showExceptionMessage( ex, "Erro a atribuir", true ); +// } +// } + + protected void enviarConsultas() + { + Date data = dataPanel.getDate(); + int selectedEstabelecimento = estabelecimentosTable.getSelectedRow(); + if( data == null || selectedEstabelecimento == -1 ) + { + return; + } + Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID(); + try + { + Integer prestadorID = ( ( IDObject ) prestadoresConsultasCombo.getSelectedItem() ).getID(); + if( LocaisRealizacaoConstants.PRESTADOR_ID_SIPRP.equals( prestadorID ) ) + { + prestadorID = null; + } + provider.setPrestadorConsultaIdForEstabelecimentoAndDate( estabelecimentoID, data, prestadorID ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a atribuir", true ); + } + } + + protected void faxConsultas() + { + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/fax_ecds.xsl b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/fax_ecds.xsl new file mode 100644 index 00000000..6b5e07a7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/fax_ecds.xsl @@ -0,0 +1,283 @@ + + + + + + + + + + + + + FAX + + Nº de Páginas (incluíndo esta) + / + Number of pages (including this one): + + + + + + + + + + + + + + Data + / + Date: + + + + + + + + + + + + Para + / + To: + + + + + + + + + + + + Empresa + / + Company: + + + + + + + + + + + + Nº Fax + / + Fax number: + + + + + + + + + + + + De + / + From: + + + + + + + + + E-mail: + + + + + + + + + + + Nº Fax + / + Fax number: + + + + + + + + + + Nº Tel. + / + Phone number: + + + + + + + + + + + + + + + + + + + + Assunto + / + Subject: + + + + + + + + + + + + + + + + + + + Cliente: + + + + + + + + Local: + + + + + + + + + + Data: + + + + + + + + Hora: + + + + + + + + + + Exmos. Senhores, + + Informo que o + s + seguinte + s + colaborador + es + irão + irá + comparecer nas vossas instalações para colheita: + + + + + + + + + NOME DO FUNCIONÃRIO + + + DATA_NASCIMENTO + + + PERFIL + + + + + + + + + + + + + + + + + + + + + + + + + + + PERFIL + + + : + + , + + + + + + + + + + AGRADEÇO QUE ESTA LISTAGEM NOS SEJA REENVIADA COM INDICAÇÃO DAS + EVENTUAIS FALTAS OCORRIDAS + + + + + Sem outro assunto de momento, aproveitamos para apresentar os nossos melhores cumprimentos, + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/fax_ecds_teste.xml b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/fax_ecds_teste.xml new file mode 100644 index 00000000..8e0366c2 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/locais_realizacao/fax_ecds_teste.xml @@ -0,0 +1,234 @@ + + + + + + 24-01-2007 + Pedro Manuel Silva Bento + Laboratorio ao lado da mercearia + 21 351 45 67 + Paula Dias + pdias@siprp.pt + (+351) 21 789 88 32 + (+351) 21 789 88 32 + Marcação de Colheitas para Análise + Evolute + Laboratorio ao lado da mercearia + 28-01-2007 + 08H00 + 1 + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + + GENÉRICO + Hemograma + Vel. Sedimentação + Glicemia em Jejum + Creatinina + Colesterol Total + Colesterol HDL + Triglicéridos + Transaminases + Gama GT + Urina II + + + MANIPULADORES + Hemograma + Vel. Sedimentação + Glicemia em Jejum + Creatinina + Colesterol Total + Colesterol HDL + Triglicéridos + Transaminases + Gama GT + Urina II + Quistos + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/DetalhesRealizacaoDialog.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/DetalhesRealizacaoDialog.java new file mode 100644 index 00000000..416d4ece --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/DetalhesRealizacaoDialog.java @@ -0,0 +1,108 @@ +/* + * DetalhesRealizacaoDialog.java + * + * Created on February 1, 2007, 11:19 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.CustomJDialog; +import com.evolute.utils.ui.panel.CheckBoxPanel; + +/** + * + * @author fpalma + */ +public class DetalhesRealizacaoDialog extends CustomJDialog + implements ActionListener +{ + protected JButton okButton; + protected JButton cancelButton; + protected CheckBoxPanel opcoesPanel; + + protected IDObject opcoes[]; + + protected Integer selected[]; + + /** Creates a new instance of DetalhesRealizacaoDialog */ + public DetalhesRealizacaoDialog( JFrame owner, IDObject opcoes[] ) + { + super( owner, true ); + this.opcoes = opcoes; + setupComponents(); + if( owner != null ) + { + centerSuper(); + } + else + { + center(); + } + setVisible( true ); + } + + private void setupComponents() + { + setTitle( "Escolha os ECD's realizados" ); + okButton = new JButton( "OK" ); + okButton.addActionListener( this ); + cancelButton = new JButton( "Cancelar" ); + cancelButton.addActionListener( this ); + opcoesPanel = new CheckBoxPanel( opcoes ); + + setLayout( new BorderLayout() ); + add( opcoesPanel, BorderLayout.CENTER ); + JPanel buttonPanel = new JPanel(); + add( buttonPanel, BorderLayout.SOUTH ); + + buttonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) ); + buttonPanel.add( okButton ); + buttonPanel.add( cancelButton ); + + setSize( 250, 300 ); + } + + public void actionPerformed(ActionEvent e) + { + Object source = e.getSource(); + if( source.equals( okButton ) ) + { + selected = opcoesPanel.getSelected(); + close(); + } + else if( source.equals( cancelButton ) ) + { + close(); + } + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable(){ + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + public Integer[] getSelected() + { + return selected; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/ImpressaoAuxiliaresWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/ImpressaoAuxiliaresWindow.java new file mode 100644 index 00000000..e6167b76 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/ImpressaoAuxiliaresWindow.java @@ -0,0 +1,40 @@ +/* + * ImpressaoAuxiliaresWindow.java + * + * Created on 7 de Dezembro de 2006, 16:13 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; + +import com.evolute.utils.ui.calendar.JCalendarPanel; + +/** + * + * @author fpalma + */ +public class ImpressaoAuxiliaresWindow extends JFrame +{ + protected JCalendarPanel calendarPanel; + protected JButton imprimirButton; + + /** Creates a new instance of ImpressaoAuxiliaresWindow */ + public ImpressaoAuxiliaresWindow() + { + setupComponents(); + } + + private void setupComponents() + { + setTitle( "Imprimir" ); + JLabel dataLabel = new JLabel( "Data" ); + calendarPanel = new JCalendarPanel( this ); + imprimirButton = new JButton( "Imprimir" ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/Presenca.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/Presenca.java new file mode 100644 index 00000000..42ef6e57 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/Presenca.java @@ -0,0 +1,106 @@ +/* + * Presenca.java + * + * Created on February 1, 2007, 4:54 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas; + +import com.evolute.utils.data.IDObject; + +/** + * + * @author fpalma + */ +public class Presenca + implements IDObject, Comparable +{ + protected Integer id; + protected String nome; + protected String nomePlain; + protected String nomeEmpresa; + protected Integer tipo; + + /** Creates a new instance of Presenca */ + public Presenca( Integer id, String nome, String nomePlain, String nomeEmpresa, + Integer tipo ) + { + this.setId(id); + this.setNome(nome); + this.setNomePlain(nomePlain); + this.setNomeEmpresa(nomeEmpresa); + this.setTipo(tipo); + } + + public Integer getID() + { + return getId(); + } + + public int compareTo( Object other ) + { + return getNomePlain().compareTo( ( ( Presenca ) other ).getNomePlain() ); + } + + public String toString() + { + String empresa = getNomeEmpresa(); + return "" + getNome() + "
" + + "    (" + empresa.substring( 0, empresa.length() > 50 ? 50 : empresa.length() ) + + ")" + ""; + } + + 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 String getNomePlain() + { + return nomePlain; + } + + public void setNomePlain(String nomePlain) + { + this.nomePlain = nomePlain; + } + + public String getNomeEmpresa() + { + return nomeEmpresa; + } + + public void setNomeEmpresa(String nomeEmpresa) + { + this.nomeEmpresa = nomeEmpresa; + } + + public Integer getTipo() + { + return tipo; + } + + public void setTipo(Integer tipo) + { + this.tipo = tipo; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/PresencasActionFactory.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/PresencasActionFactory.java new file mode 100644 index 00000000..056eed36 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/PresencasActionFactory.java @@ -0,0 +1,81 @@ +/* + * PresencasActionFactory.java + * + * Created on January 31, 2007, 6:37 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas; + +import javax.swing.Action; + +import siprp.medicina.presencas.actions.DesmarcadoSHSTAction; +import siprp.medicina.presencas.actions.DesmarcadoTrabalhadorAction; +import siprp.medicina.presencas.actions.FaltouAction; +import siprp.medicina.presencas.actions.RealizouAction; +import siprp.medicina.presencas.actions.RealizouParcialmenteAction; + +import com.evolute.utils.ui.panel.multipleactionlist.ActionFactory; + +/** + * + * @author fpalma + */ +public class PresencasActionFactory implements ActionFactory +{ + public static final int REALIZOU = 0; + public static final int REALIZOU_PARCIALMENTE = 1; + public static final int TRABALHADOR_DESMARCOU = 2; + public static final int SHST_DESMARCOU = 3; + public static final int FALTOU = 4; + + protected final int TIPO; + + /** Creates a new instance of PresencasActionFactory */ + public PresencasActionFactory( int tipo ) + { + TIPO = tipo; + } + + public Action createAction(Presenca[] objects) + { + switch( TIPO ) + { + case SHST_DESMARCOU: + return new DesmarcadoSHSTAction( DesmarcadoSHSTAction.MULTIPLE, objects ); + + case FALTOU: + return new FaltouAction( FaltouAction.MULTIPLE, objects ); + + default: + return null; + } + } + + public Action createAction(Presenca object) + { + switch( TIPO ) + { + case REALIZOU: + return new RealizouAction( object ); + + case REALIZOU_PARCIALMENTE: + return new RealizouParcialmenteAction( object ); + + case TRABALHADOR_DESMARCOU: + return new DesmarcadoTrabalhadorAction( object ); + + case SHST_DESMARCOU: + return new DesmarcadoSHSTAction( DesmarcadoSHSTAction.SINGLE, new Presenca[]{ object } ); + + case FALTOU: + return new FaltouAction( FaltouAction.SINGLE, new Presenca[]{ object } ); + + default: + return null; + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/PresencasDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/PresencasDataProvider.java new file mode 100644 index 00000000..07b033a5 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/PresencasDataProvider.java @@ -0,0 +1,193 @@ +/* + * PresencasDataProvider.java + * + * Created on February 5, 2007, 5:51 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas; + +import java.util.Date; + +import siprp.MedicinaConstants; +import siprp.lembretes.LembretesConstants; +import siprp.lembretes.LembretesDataProvider; +import siprp.medicina.MedicinaDataProvider; + +import com.evolute.utils.Singleton; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Update; + +/** + * + * @author lflores + */ +public class PresencasDataProvider + implements MedicinaConstants, LembretesConstants +{ + private static final Object LOCK = new Object(); + private static PresencasDataProvider instance = null; + + private MedicinaDataProvider medicinaProvider; + private LembretesDataProvider lembretesProvider; + private Executer EXECUTER; + + /** Creates a new instance of PresencasDataProvider */ + public PresencasDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + medicinaProvider = ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); + lembretesProvider = LembretesDataProvider.getProvider(); + } + + public static PresencasDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new PresencasDataProvider(); + } + } + return instance; + } + + protected void apagarDetalhesRealizacao( Integer marcacaoID ) + throws Exception + { + medicinaProvider.deleteDetalhesRealizadosForMarcacao( marcacaoID ); + } + + public void marcarFaltou( Integer id ) + throws Exception + { + apagarDetalhesRealizacao( id ); + Update update = + new Update( "marcacoes_trabalhador", + new Assignment[]{ + new Assignment( new Field( "realizada" ), "n" ), + new Assignment( new Field( "estado" ), new Integer( ESTADO_FALTOU ) ) + }, + new Field( "id" ).isEqual( id ) ); + EXECUTER.executeQuery( update ); + lembretesProvider.apagarLembreteByMarcacaoTrabalhadorID( id ); + lembretesProvider.criarLembrete( lembretesProvider.getTipoLembreteByCodigo( CODE_REMARCACOES ).getID(), + new Date(), + "Trabalhador Faltou", + null, + null, + null, + null, + null, + id, + false, + null, + null ); + } + + public void marcarDesmarcadoSHST( Integer id ) + throws Exception + { + apagarDetalhesRealizacao( id ); + Update update = + new Update( "marcacoes_trabalhador", + new Assignment[]{ + new Assignment( new Field( "realizada" ), "n" ), + new Assignment( new Field( "estado" ), new Integer( ESTADO_DESMARCADO_EMPRESA ) ) + }, + new Field( "id" ).isEqual( id ) ); + EXECUTER.executeQuery( update ); + lembretesProvider.apagarLembreteByMarcacaoTrabalhadorID( id ); + lembretesProvider.criarLembrete( lembretesProvider.getTipoLembreteByCodigo( CODE_REMARCACOES ).getID(), + new Date(), + "SIPRP Desmarcou", + null, + null, + null, + null, + null, + id, + false, + null, + null ); + } + + public void marcarDesmarcadoTrabalhador( Integer id ) + throws Exception + { + apagarDetalhesRealizacao( id ); + Update update = + new Update( "marcacoes_trabalhador", + new Assignment[]{ + new Assignment( new Field( "realizada" ), "n" ), + new Assignment( new Field( "estado" ), new Integer( ESTADO_DESMARCADO_TRABALHADOR ) ) + }, + new Field( "id" ).isEqual( id ) ); + EXECUTER.executeQuery( update ); + lembretesProvider.apagarLembreteByMarcacaoTrabalhadorID( id ); + lembretesProvider.criarLembrete( lembretesProvider.getTipoLembreteByCodigo( CODE_REMARCACOES ).getID(), + new Date(), + "Trabalhador Desmarcou", + null, + null, + null, + null, + null, + id, + false, + null, + null ); + } + + public void marcarRealizado( Integer id, Integer grupos[] ) + throws Exception + { + apagarDetalhesRealizacao( id ); + medicinaProvider.setDetalhesRealziadosForMarcacao( id, grupos ); + Update update = + new Update( "marcacoes_trabalhador", + new Assignment[]{ + new Assignment( new Field( "realizada" ), "y" ), + new Assignment( new Field( "estado" ), new Integer( ESTADO_REALIZADO ) ) + }, + new Field( "id" ).isEqual( id ) ); + EXECUTER.executeQuery( update ); + lembretesProvider.apagarLembreteByMarcacaoTrabalhadorID( id ); + } + + public void marcarParcialmenteRealizado( Integer id, Integer grupos[] ) + throws Exception + { + apagarDetalhesRealizacao( id ); + medicinaProvider.setDetalhesRealziadosForMarcacao( id, grupos ); + Update update = + new Update( "marcacoes_trabalhador", + new Assignment[]{ + new Assignment( new Field( "realizada" ), "n" ), + new Assignment( new Field( "estado" ), new Integer( ESTADO_PARCIALMENTE_REALIZADO ) ) + }, + new Field( "id" ).isEqual( id ) ); + EXECUTER.executeQuery( update ); + lembretesProvider.apagarLembreteByMarcacaoTrabalhadorID( id ); + lembretesProvider.criarLembrete( lembretesProvider.getTipoLembreteByCodigo( CODE_REMARCACOES ).getID(), + new Date(), + "ECDs por realizar", + null, + null, + null, + null, + null, + id, + false, + null, + null ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/RegistarPresencasWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/RegistarPresencasWindow.java new file mode 100644 index 00000000..b404d2c3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/RegistarPresencasWindow.java @@ -0,0 +1,373 @@ +/* + * RegistarPresencasWindow.java + * + * Created on January 31, 2007, 3:09 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.text.DateFormat; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.Hashtable; +import java.util.List; +import java.util.Locale; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; + +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.output.XMLOutputter; + +import siprp.clientes.ClientesDataProvider; +import siprp.medicina.MedicinaDataProvider; +import siprp.medicina.prestadores.PrestadoresDataProvider; +import siprp.util.fop.FOPCreator; +import siprp.util.fop.FOPPrinter; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.tracker.TrackableWindow; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import com.evolute.utils.ui.panel.multipleactionlist.MultipleActionListPanel; + +/** + * + * @author fpalma + */ +public class RegistarPresencasWindow extends JFrame + implements ActionListener, TrackableWindow +{ + protected static final String PRINT_TEMPLATE = "/siprp/medicina/presencas/auxiliares.xsl"; + protected static final DateFormat D_F = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); + + protected static final Integer PRESTADOR_ID_SIPRP = new Integer( -1 ); + protected static final Integer PRESTADOR_ID_TODOS = new Integer( -2 ); + + protected static final IDObject PRESTADOR_SIPRP = new MappableObject( PRESTADOR_ID_SIPRP, "SIPRP" ); + protected static final IDObject PRESTADOR_TODOS = new MappableObject( PRESTADOR_ID_TODOS, "Todos" ); + + protected JCalendarPanel dataPanel; + protected JButton carregarButton; + protected JComboBox prestadoresCombo; + protected JButton recarregarPrestadoresButton; + protected JButton imprimirAuxiliaresButton; + protected JScrollPane listECDsScroll; + protected JScrollPane listConsultasScroll; + protected MultipleActionListPanel listECDsPanel; + protected MultipleActionListPanel listConsultasPanel; + + protected MedicinaDataProvider provider; + protected PrestadoresDataProvider prestadoresProvider; + + protected Presenca ECDS[]; + + /** Creates a new instance of RegistarPresencasWindow */ + public RegistarPresencasWindow() + throws Exception + { + provider = ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); + prestadoresProvider = PrestadoresDataProvider.getProvider(); + setupComponents(); + + } + + private void setupComponents() + { + setTitle( "Presen\u00e7as" ); + setSize( 1000, 700 ); + JLabel dataLabel = new JLabel( "Data" ); + dataPanel = new JCalendarPanel( this ); + carregarButton = new JButton( "Carregar" ); + carregarButton.addActionListener( this ); + JLabel prestadoresLabel = new JLabel( "Prestador" ); + prestadoresCombo = new JComboBox (); + recarregarPrestadoresButton = new JButton( "Recarregar Prestadores" ); + recarregarPrestadoresButton.addActionListener( this ); + imprimirAuxiliaresButton = new JButton( "Imprimir" ); + imprimirAuxiliaresButton.addActionListener( this ); + + PresencasActionFactory realizouFactory = new PresencasActionFactory( PresencasActionFactory.REALIZOU ); + PresencasActionFactory realizouParcialmenteFactory = new PresencasActionFactory( PresencasActionFactory.REALIZOU_PARCIALMENTE ); + PresencasActionFactory trabalhadorDesmarcouFactory = new PresencasActionFactory( PresencasActionFactory.TRABALHADOR_DESMARCOU ); + PresencasActionFactory shstDesmarcouFactory = new PresencasActionFactory( PresencasActionFactory.SHST_DESMARCOU ); + PresencasActionFactory faltouFactory = new PresencasActionFactory( PresencasActionFactory.FALTOU ); + + getContentPane().setLayout( new BorderLayout( 5, 5 ) ); + JPanel upperPanel = new JPanel(); + getContentPane().add( upperPanel, BorderLayout.NORTH ); + JTabbedPane tabbedPane = new JTabbedPane(); + getContentPane().add( tabbedPane, BorderLayout.CENTER ); + + listECDsPanel = + new MultipleActionListPanel( + new PresencasActionFactory[]{ /*shstDesmarcouFactory, faltouFactory*/ }, + new PresencasActionFactory[]{ realizouFactory, realizouParcialmenteFactory, + trabalhadorDesmarcouFactory, shstDesmarcouFactory, + faltouFactory } ); + listECDsScroll = new JScrollPane( listECDsPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + + listConsultasPanel = + new MultipleActionListPanel( + new PresencasActionFactory[]{ /*shstDesmarcouFactory, faltouFactory*/ }, + new PresencasActionFactory[]{ realizouFactory, trabalhadorDesmarcouFactory, + shstDesmarcouFactory, faltouFactory } ); + listConsultasScroll = new JScrollPane( listConsultasPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + + tabbedPane.add( "ECDs", listECDsScroll ); + tabbedPane.add( "Consultas", listConsultasScroll ); + + upperPanel.setLayout( new FlowLayout( FlowLayout.CENTER ) ); + upperPanel.add( dataLabel ); + upperPanel.add( dataPanel ); + upperPanel.add( carregarButton ); + upperPanel.add( prestadoresLabel ); + upperPanel.add( prestadoresCombo ); + upperPanel.add( recarregarPrestadoresButton ); + upperPanel.add( imprimirAuxiliaresButton ); + + setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE ); + addWindowListener( new WindowAdapter(){ + public void windowClosing( WindowEvent e ) + { + close(); + } + + public void windowOpened( WindowEvent e ) + { +// setExtendedState( getExtendedState() | MAXIMIZED_BOTH ); + } + + } ); + dataPanel.setDate( new Date() ); + recarregarPrestadores(); + carregar(); + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( carregarButton ) ) + { + carregar(); + } + else if( source.equals( recarregarPrestadoresButton ) ) + { + recarregarPrestadores(); + } + else if( source.equals( imprimirAuxiliaresButton ) ) + { + imprimirAuxiliares(); + } + } + + public void refresh() + { + } + + public void open() + { + setVisible( true ); + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable() { + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + public boolean closeIfPossible() + { + close(); + return true; + } + + protected void carregar() + { + ECDS = null; + IDObject prestador = ( IDObject ) prestadoresCombo.getSelectedItem(); + boolean filtrar = true; + Integer prestadorID = null; + if( PRESTADOR_TODOS.equals( prestador ) ) + { + filtrar = false; + } + else if( !PRESTADOR_SIPRP.equals( prestador ) ) + { + prestadorID = prestador.getID(); + } + try + { + Date data = dataPanel.getDate(); + Object ecdsArray[][] = provider.getListaECDsByData( data ); + List ecds = new Vector(); + for( int n = 0; n < ecdsArray.length; n++ ) + { + Integer id = ( Integer ) ecdsArray[ n ][ 0 ]; + String nome = ( String ) ecdsArray[ n ][ 1 ]; + String nomePlain = ( String ) ecdsArray[ n ][ 2 ]; + String empresa = ( String ) ecdsArray[ n ][ 3 ]; + int tipo = ( ( Integer )ecdsArray[ n ][ 4 ] ).intValue(); + Integer prestadorMarcacao = ( Integer )ecdsArray[ n ][ 5 ]; + if( ( !filtrar ) || + ( prestadorID == null ? prestadorMarcacao == null : prestadorID.equals( prestadorMarcacao ) ) ) + { + ecds.add( new Presenca( id, nome, nomePlain, empresa, tipo ) ); + } + } + Collections.sort( ecds ); + ECDS = ecds.toArray( new Presenca[ ecds.size() ] ); + listECDsPanel.showList( ECDS ); + listECDsScroll.setViewportView( listECDsPanel ); + + Object consultasArray[][] = provider.getListaConsultasByData( data ); + List consultas = new Vector(); + for( int n = 0; n < consultasArray.length; n++ ) + { + Integer id = ( Integer ) consultasArray[ n ][ 0 ]; + String nome = ( String ) consultasArray[ n ][ 1 ]; + String nomePlain = ( String ) consultasArray[ n ][ 2 ]; + String empresa = ( String ) consultasArray[ n ][ 3 ]; + int tipo = ( ( Integer )consultasArray[ n ][ 4 ] ).intValue(); + Integer prestadorMarcacao = ( Integer )consultasArray[ n ][ 5 ]; + if( ( !filtrar ) || + ( prestadorID == null ? prestadorMarcacao == null : prestadorID.equals( prestadorMarcacao ) ) ) + { + consultas.add( new Presenca( id, nome, nomePlain, empresa, tipo ) ); + } + } + Collections.sort( consultas ); + listConsultasPanel.showList( consultas.toArray( new Presenca[ ecds.size() ] ) ); + listConsultasScroll.setViewportView( listConsultasPanel ); +// setExtendedState( getExtendedState() | MAXIMIZED_BOTH ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); + } + } + + protected void recarregarPrestadores() + { + try + { + IDObject prestadores[] = prestadoresProvider.getPrestadoresActivos(); + prestadoresCombo.removeAllItems(); + prestadoresCombo.addItem( PRESTADOR_SIPRP ); + prestadoresCombo.addItem( PRESTADOR_TODOS ); + for( int n = 0; n < prestadores.length; n++ ) + { + prestadoresCombo.addItem( prestadores[ n ] ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar prestadores", true ); + } + } + + protected void imprimirAuxiliares() + { + try + { + Date data = dataPanel.getDate(); + if( ECDS == null || data == null || ECDS.length == 0 ) + { + return; + } + ClientesDataProvider clientesProvider = + ( ClientesDataProvider ) ClientesDataProvider.getProvider(); + MedicinaDataProvider medicinaProvider = + ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); + + String dataStr = D_F.format( data ); + + Element rootElement = new Element( "lista-presencas" ); + + for( int n = 0; n < ECDS.length; n++ ) + { + Element presencaElement = new Element( "presenca" ); + + Element trabalhadorElement = new Element( "trabalhador" ); + trabalhadorElement.setText( ECDS[ n ].getNome() ); + presencaElement.addContent( trabalhadorElement ); + + Element empresaElement = new Element( "empresa" ); + empresaElement.setText( ECDS[ n ].getNomeEmpresa() ); + presencaElement.addContent( empresaElement ); + + Element dataElement = new Element( "data" ); + dataElement.setText( dataStr ); + presencaElement.addContent( dataElement ); + + Integer trabalhadorID = medicinaProvider.getTrabalhadorIDByMarcacaoID( ECDS[ n ].getID() ); + Integer empresaID = clientesProvider.getEmpresaIDByTrabalhadorID( trabalhadorID ); + Integer realizados[] = medicinaProvider.getDetalhesRealizadosForEstadosMarcacao( ECDS[ n ].getID() ); + Vector realizadosVector = new Vector(); + realizadosVector.addAll( Arrays.asList( realizados ) ); + IDObject validos[] = medicinaProvider.getDetalhesValidosTrabalhador( empresaID, trabalhadorID ); + for( int v = 0; v < validos.length; v++ ) + { + Integer id = validos[ v ].getID(); + if( !realizadosVector.contains( id ) ) + { + Element ecdElement = new Element( "ecd" ); + ecdElement.setText( validos[ v ].toString() ); + presencaElement.addContent( ecdElement ); + } + } + + rootElement.addContent( presencaElement ); + } + + Document doc = new Document( rootElement ); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + //new XMLOutputter().output( doc, System.out ); + new XMLOutputter().output( doc, baos ); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + FOPCreator creator = FOPCreator.getFOPCreator(); + InputStream xmlIn = new ByteArrayInputStream( baos.toByteArray() ); + creator.createFOfromXML( xmlIn, + getClass().getResourceAsStream( PRINT_TEMPLATE ), + out ); + ByteArrayInputStream in = new ByteArrayInputStream( out.toByteArray() ); + Hashtable printOptions = new Hashtable(); + FOPPrinter.getFOPPrinter().printFO( in, true, true, printOptions ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a imprimir", true ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/actions/DesmarcadoSHSTAction.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/actions/DesmarcadoSHSTAction.java new file mode 100644 index 00000000..6df37359 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/actions/DesmarcadoSHSTAction.java @@ -0,0 +1,61 @@ +/* + * DesmarcadoSHSTAction.java + * + * Created on January 31, 2007, 6:21 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas.actions; + +import java.awt.event.ActionEvent; + +import javax.swing.AbstractAction; + +import siprp.medicina.presencas.Presenca; +import siprp.medicina.presencas.PresencasDataProvider; + +import com.evolute.utils.ui.DialogException; + +/** + * + * @author fpalma + */ +public class DesmarcadoSHSTAction extends AbstractAction +{ + public static final int SINGLE = 0; + public static final int MULTIPLE = 1; + + protected int cardinality; + protected Presenca presencas[]; + + /** Creates a new instance of DesmarcadoSHSTAction */ + public DesmarcadoSHSTAction( int cardinality, Presenca presencas[] ) + { + super( cardinality == SINGLE ? "SIPRP Desmarcou" : "Marcar restantes como \"SIPRP desmarcou\"" ); + this.cardinality = cardinality; + this.presencas = presencas; + } + + public void actionPerformed(ActionEvent e) + { + try + { + PresencasDataProvider provider = PresencasDataProvider.getProvider(); + for( int n = 0; n < presencas.length; n++ ) + { + provider.marcarDesmarcadoSHST( presencas[ n ].getID() ); + } + if( cardinality == SINGLE ) + { + setEnabled( false ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a marcar", true ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/actions/DesmarcadoTrabalhadorAction.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/actions/DesmarcadoTrabalhadorAction.java new file mode 100644 index 00000000..76dba664 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/actions/DesmarcadoTrabalhadorAction.java @@ -0,0 +1,50 @@ +/* + * DesmarcadoTrabalhadorAction.java + * + * Created on January 31, 2007, 6:21 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas.actions; + +import java.awt.event.ActionEvent; + +import javax.swing.AbstractAction; + +import siprp.medicina.presencas.Presenca; +import siprp.medicina.presencas.PresencasDataProvider; + +import com.evolute.utils.ui.DialogException; + +/** + * + * @author fpalma + */ +public class DesmarcadoTrabalhadorAction extends AbstractAction +{ + protected Presenca presenca; + + /** Creates a new instance of DesmarcadoTrabalhadorAction */ + public DesmarcadoTrabalhadorAction( Presenca presenca ) + { + super( "Desmarcou" ); + this.presenca = presenca; + } + + public void actionPerformed(ActionEvent e) + { + try + { + PresencasDataProvider provider = PresencasDataProvider.getProvider(); + provider.marcarDesmarcadoTrabalhador( presenca.getID() ); + setEnabled( false ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a marcar", true ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/actions/FaltouAction.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/actions/FaltouAction.java new file mode 100644 index 00000000..707250fe --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/actions/FaltouAction.java @@ -0,0 +1,60 @@ +/* + * FaltouAction.java + * + * Created on January 31, 2007, 6:21 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas.actions; + +import java.awt.event.ActionEvent; + +import javax.swing.AbstractAction; + +import siprp.medicina.presencas.Presenca; +import siprp.medicina.presencas.PresencasDataProvider; + +import com.evolute.utils.ui.DialogException; + +/** + * + * @author fpalma + */ +public class FaltouAction extends AbstractAction +{ + public static final int SINGLE = 0; + public static final int MULTIPLE = 1; + + protected int cardinality; + protected Presenca presencas[]; + + /** Creates a new instance of FaltouAction */ + public FaltouAction( int cardinality, Presenca presencas[] ) + { + super( cardinality == SINGLE ? "Faltou" : "Marcar restantes como \"Faltou\"" ); + this.cardinality = cardinality; + this.presencas = presencas; + } + + public void actionPerformed(ActionEvent e) + { + try + { + PresencasDataProvider provider = PresencasDataProvider.getProvider(); + for( int n = 0; n < presencas.length; n++ ) + { + provider.marcarFaltou( presencas[ n ].getID() ); + } + if( cardinality == SINGLE ) + { + setEnabled( false ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a marcar", true ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/actions/RealizouAction.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/actions/RealizouAction.java new file mode 100644 index 00000000..971cec4e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/actions/RealizouAction.java @@ -0,0 +1,110 @@ +/* + * RealizouAction.java + * + * Created on January 31, 2007, 6:20 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas.actions; + +import java.awt.event.ActionEvent; +import java.util.Arrays; +import java.util.Vector; + +import javax.swing.AbstractAction; + +import siprp.clientes.ClientesDataProvider; +import siprp.medicina.MedicinaDataProvider; +import siprp.medicina.presencas.DetalhesRealizacaoDialog; +import siprp.medicina.presencas.Presenca; +import siprp.medicina.presencas.PresencasDataProvider; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.DialogException; + +/** + * + * @author fpalma + */ +public class RealizouAction extends AbstractAction +{ + protected Presenca presenca; + + /** Creates a new instance of RealizouAction */ + public RealizouAction( Presenca presenca ) + { + super( "Realizou" ); + this.presenca = presenca; + } + + public void actionPerformed(ActionEvent e) + { + try + { + PresencasDataProvider provider = PresencasDataProvider.getProvider(); + ClientesDataProvider clientesProvider = + ( ClientesDataProvider ) ClientesDataProvider.getProvider(); + MedicinaDataProvider medicinaProvider = + ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); + Integer trabalhadorID = medicinaProvider.getTrabalhadorIDByMarcacaoID( presenca.getID() ); + Integer empresaID = clientesProvider.getEmpresaIDByTrabalhadorID( trabalhadorID ); + Integer realizados[] = medicinaProvider.getDetalhesRealizadosForEstadosMarcacao( presenca.getID() ); + Vector realizadosVector = new Vector(); + realizadosVector.addAll( Arrays.asList( realizados ) ); + IDObject validos[] = medicinaProvider.getDetalhesValidosTrabalhador( empresaID, trabalhadorID ); + Vector aRealizar = new Vector(); + for( int n = 0; n < validos.length; n++ ) + { + Integer id = validos[ n ].getID(); + if( !realizadosVector.contains( id ) ) + { + aRealizar.add( validos[ n ] ); + } + } + DetalhesRealizacaoDialog dialog = + new DetalhesRealizacaoDialog( null, ( IDObject[] ) aRealizar.toArray( new IDObject[ aRealizar.size() ] ) ); + Integer escolhidos[] = dialog.getSelected(); + if( escolhidos != null ) + { + provider.marcarParcialmenteRealizado( presenca.getID(), escolhidos ); + setEnabled( false ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a marcar", true ); + } +// try +// { +// PresencasDataProvider provider = PresencasDataProvider.getProvider(); +// ClientesDataProvider clientesProvider = +// ( ClientesDataProvider ) ClientesDataProvider.getProvider(); +// MedicinaDataProvider medicinaProvider = +// ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); +// Integer trabalhadorID = medicinaProvider.getTrabalhadorIDByMarcacaoID( presenca.getID() ); +// Integer empresaID = clientesProvider.getEmpresaIDByTrabalhadorID( trabalhadorID ); +// Integer realizados[] = medicinaProvider.getDetalhesRealizadosForEstadosMarcacao( presenca.getID() ); +// Vector realizadosVector = new Vector(); +// realizadosVector.addAll( Arrays.asList( realizados ) ); +// IDObject validos[] = medicinaProvider.getDetalhesValidosTrabalhador( empresaID, trabalhadorID ); +// Vector aRealizar = new Vector(); +// for( int n = 0; n < validos.length; n++ ) +// { +// Integer id = validos[ n ].getID(); +// if( !realizadosVector.contains( id ) ) +// { +// aRealizar.add( id ); +// } +// } +// provider.marcarRealizado( presenca.getID(), ( Integer[] ) aRealizar.toArray( new Integer[ aRealizar.size() ] ) ); +// setEnabled( false ); +// } +// catch( Exception ex ) +// { +// DialogException.showExceptionMessage( ex, "Erro a marcar", true ); +// } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/actions/RealizouParcialmenteAction.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/actions/RealizouParcialmenteAction.java new file mode 100644 index 00000000..3c669f3c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/actions/RealizouParcialmenteAction.java @@ -0,0 +1,86 @@ +/* + * RealizouParcialmenteAction.java + * + * Created on January 31, 2007, 6:20 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas.actions; + +import java.awt.event.ActionEvent; +import java.util.Arrays; +import java.util.Vector; + +import javax.swing.AbstractAction; + +import siprp.clientes.ClientesDataProvider; +import siprp.data.Marcacao; +import siprp.medicina.MedicinaDataProvider; +import siprp.medicina.presencas.DetalhesRealizacaoDialog; +import siprp.medicina.presencas.Presenca; +import siprp.medicina.presencas.PresencasDataProvider; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.DialogException; + +/** + * + * @author fpalma + */ +public class RealizouParcialmenteAction extends AbstractAction +{ + protected Presenca presenca; + + /** Creates a new instance of RealizouParcialmenteAction */ + public RealizouParcialmenteAction( Presenca presenca ) + { + super( "Parcialmente" ); + this.presenca = presenca; + if( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA == presenca.getTipo().intValue() ) + { + setEnabled( false ); + } + } + + public void actionPerformed(ActionEvent e) + { + try + { + PresencasDataProvider provider = PresencasDataProvider.getProvider(); + ClientesDataProvider clientesProvider = + ( ClientesDataProvider ) ClientesDataProvider.getProvider(); + MedicinaDataProvider medicinaProvider = + ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); + Integer trabalhadorID = medicinaProvider.getTrabalhadorIDByMarcacaoID( presenca.getID() ); + Integer empresaID = clientesProvider.getEmpresaIDByTrabalhadorID( trabalhadorID ); + Integer realizados[] = medicinaProvider.getDetalhesRealizadosForEstadosMarcacao( presenca.getID() ); + Vector realizadosVector = new Vector(); + realizadosVector.addAll( Arrays.asList( realizados ) ); + IDObject validos[] = medicinaProvider.getDetalhesValidosTrabalhador( empresaID, trabalhadorID ); + Vector aRealizar = new Vector(); + for( int n = 0; n < validos.length; n++ ) + { + Integer id = validos[ n ].getID(); + if( !realizadosVector.contains( id ) ) + { + aRealizar.add( validos[ n ] ); + } + } + DetalhesRealizacaoDialog dialog = + new DetalhesRealizacaoDialog( null, ( IDObject[] ) aRealizar.toArray( new IDObject[ aRealizar.size() ] ) ); + Integer escolhidos[] = dialog.getSelected(); + if( escolhidos != null ) + { + provider.marcarParcialmenteRealizado( presenca.getID(), escolhidos ); + setEnabled( false ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a marcar", true ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/auxiliares.xml b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/auxiliares.xml new file mode 100644 index 00000000..f4372ba8 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/auxiliares.xml @@ -0,0 +1,35 @@ + + + + + + + Frederico Palma + Evolute + 2007/02/21 + RX + ECD + Sangue + Acuidade Visual + + + Luis Flores + Evolute + 2007/02/21 + RX + ECD + Acuidade Visual + + + Smeagol + Evolute + 2007/02/21 + RX + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/auxiliares.xsl b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/auxiliares.xsl new file mode 100644 index 00000000..99496eea --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/presencas/auxiliares.xsl @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Realização de ECDs + + + + + ( + + ) + + + data: + + + hora de entrada: __h__m + + + + + + + + + ECD + + + Rúbrica + + + Motivo de não realização + + + + + + + + + + + + + + + + + + + + + hora de saída: __h__m + assinatura do trabalhador:________________________________________ + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/prestadores/PrestadoresDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/prestadores/PrestadoresDataProvider.java new file mode 100644 index 00000000..35b50313 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/prestadores/PrestadoresDataProvider.java @@ -0,0 +1,238 @@ +/* + * PrestadoresDataProvider.java + * + * Created on February 2, 2007, 9:53 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.prestadores; + +import siprp.data.outer.ContactosData; +import siprp.data.outer.PrestadoresData; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Object2DArray; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Begin; +import com.evolute.utils.sql.Commit; +import com.evolute.utils.sql.Delete; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.Rollback; +import com.evolute.utils.sql.Select; +import com.evolute.utils.ui.search.SearchDialog; +import com.evolute.utils.ui.search.SearchExecuter; + +/** + * + * @author fpalma + */ +public class PrestadoresDataProvider + implements SearchExecuter +{ + private static final Object LOCK = new Object(); + private static PrestadoresDataProvider instance = null; + + private static final String SEARCH_TITLE = "Procurar prestadores"; + private static final String SEARCH_COLUMNS[] = + new String[]{ "Designa\u00e7\u00e3o", "Servi\u00e7os" }; + + private Executer EXECUTER; + + private ProviderInterface JDO; + + /** Creates a new instance of PrestadoresDataProvider */ + public PrestadoresDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + + public static PrestadoresDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new PrestadoresDataProvider(); + } + } + return instance; + } + + public boolean hasDetails() + { + return false; + } + + public String getSearchTitle() + { + return SEARCH_TITLE; + } + + public String[] getColumnNames() + { + return SEARCH_COLUMNS; + } + + public void showDetails(SearchDialog dialog, Object o) throws Exception + { + } + + public Virtual2DArray search(String pattern) throws Exception + { + pattern = pattern.trim().toLowerCase(); + pattern = pattern.replace( ' ', '%' ); + Select select = + new Select( new String[]{ "prestadores" }, + new String[]{ "id", "nome", "faz_consultas", "faz_ecds", "nome_plain" }, + new Field( "nome_plain" ).isLike( "%" + pattern + "%" ), + new String[]{ "nome_plain" }, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Object data[][] = new Object[ array.columnLength() ][ 3 ]; + for( int n = 0; n < data.length; n++ ) + { + data[ n ][ 0 ] = array.get( n, 0 ); + data[ n ][ 1 ] = array.get( n, 1 ); + String str = ""; + if( "y".equals( array.get( n, 2 ) ) ) + { + str += "consultas"; + } + if( "y".equals( array.get( n, 3 ) ) ) + { + str += ( str.length() > 0 ? ", " : "" ) + "ecds"; + } + data[ n ][ 2 ] = str; + } + return new Object2DArray( data ); + } + + public void setGruposProtocoloForPrestador( Integer prestadorID, Integer gruposProtocoloID[] ) + throws Exception + { + EXECUTER.executeQuery( Begin.BEGIN ); + try + { + Delete delete = new Delete( "prestadores_grupos_protocolo", + new Field( "prestador_id" ).isEqual( prestadorID ) ); + EXECUTER.executeQuery( delete ); + Insert insert = + new Insert( "prestadores_grupos_protocolo", + new Assignment[]{ + new Assignment( new Field( "prestador_id" ), prestadorID ), + new Assignment( new Field( "grupo_protocolo_id" ), gruposProtocoloID ) } ); + EXECUTER.executeQuery( insert ); + } + catch( Exception ex ) + { + EXECUTER.executeQuery( Rollback.ROLLBACK ); + } + EXECUTER.executeQuery( Commit.COMMIT ); + } + + public Integer []getGruposProtocoloIDByPrestadorID( Integer prestadorID ) + throws Exception + { + Select select = + new Select( new String[]{ "prestadores_grupos_protocolo" }, + new String[]{ "grupo_protocolo_id" }, + new Field( "prestador_id" ).isEqual( prestadorID ) ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < ids.length; n++ ) + { + ids[ n ] = ( Integer ) array.get( n, 0 ); + } + return ids; + } + + public PrestadoresData getPrestadorByID( Integer id ) + throws Exception + { + return ( PrestadoresData ) JDO.load( PrestadoresData.class, id ); + } + + public void savePrestador( PrestadoresData prestador ) + throws Exception + { + if( prestador.get( PrestadoresData.CONTACTO_ID ) instanceof ContactosData ) + { + ContactosData contacto = ( ContactosData )prestador.get( PrestadoresData.CONTACTO_ID ); + contacto.save(); + prestador.set( PrestadoresData.CONTACTO_ID, contacto.get( ContactosData.ID ) ); + } + prestador.save(); + } + + public IDObject[] getPrestadoresActivos() + throws Exception + { + Select select = + new Select( new String[]{ "prestadores" }, + new String[]{ "id", "nome", "nome_plain" }, + new Field( "activo" ).isEqual( "y" ), + new String[]{ "nome_plain" }, null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + IDObject prestadores[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < prestadores.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + prestadores[ n ] = new MappableObject( id, nome ); + } + return prestadores; + } + + public IDObject[] getPrestadoresConsultasActivos() + throws Exception + { + Select select = + new Select( new String[]{ "prestadores" }, + new String[]{ "id", "nome", "nome_plain" }, + new Field( "activo" ).isEqual( "y" ).and( + new Field( "faz_consultas" ).isEqual( "y" ) ), + new String[]{ "nome_plain" }, null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + IDObject prestadores[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < prestadores.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + prestadores[ n ] = new MappableObject( id, nome ); + } + return prestadores; + } + + public IDObject[] getPrestadoresECDsActivos() + throws Exception + { + Select select = + new Select( new String[]{ "prestadores" }, + new String[]{ "id", "nome", "nome_plain" }, + new Field( "activo" ).isEqual( "y" ).and( + new Field( "faz_ecds" ).isEqual( "y" ) ), + new String[]{ "nome_plain" }, null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + IDObject prestadores[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < prestadores.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + prestadores[ n ] = new MappableObject( id, nome ); + } + return prestadores; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/prestadores/PrestadoresWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/prestadores/PrestadoresWindow.java new file mode 100644 index 00000000..bf15cfff --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/prestadores/PrestadoresWindow.java @@ -0,0 +1,442 @@ +/* + * PrestadoresWindow.java + * + * Created on February 2, 2007, 9:44 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.prestadores; + +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import static com.evolute.utils.strings.UnicodeLatin1Map.otilde; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import javax.swing.BorderFactory; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.JTabbedPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; + +import leaf.ui.LeafDialog; +import siprp.clientes.ClientesDataProvider; +import siprp.clientes.ContactoPanel; +import siprp.data.outer.ContactosData; +import siprp.data.outer.PrestadoresData; +import siprp.database.cayenne.objects.Prestadores; +import siprp.database.cayenne.objects.PrtGruposProtocolo; +import siprp.database.cayenne.providers.MedicinaDAO; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.dataui.ComponentController; +import com.evolute.utils.dataui.ComponentsHashtable; +import com.evolute.utils.dataui.JDOControllable; +import com.evolute.utils.dataui.JTextComponentPlainFillerSaver; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.panel.CheckBoxPanel; +import com.evolute.utils.ui.search.SearchDialog; +import com.evolute.utils.ui.window.EditorWindow; + +/** + * + * @author fpalma + */ +public class PrestadoresWindow extends EditorWindow +{ + private static final long serialVersionUID = 1L; + + public static final String TITLE = "Prestadores"; + + protected JTextField nomeText; + protected JCheckBox activoCheck; + protected JCheckBox consultasCheck; + protected JCheckBox ecdsCheck; + protected CheckBoxPanel ecdsPanel; + protected JTextArea moradaText; + protected JTextField codigoPostalText; + protected JTextField localidadeCodigoPostalText; + protected JTextField localidadeText; + protected ContactoPanel contactoPanel; + protected JTextField contribuinteText; + + private final JLabel labelObservacoes = new JLabel( "Observa" + ccedil + otilde + "es" ); + private final JTextArea textObservacoes = new JTextArea(); + + protected PrestadoresDataProvider provider; + protected ClientesDataProvider clientesProvider; + + protected ComponentsHashtable components; + + protected PrestadoresData prestador; + protected Integer gruposProtocolo[]; + + private final JTabbedPane tabbedPane = new JTabbedPane(); + private final JPanel prestadoresPanel = new JPanel(); + private final JPanel analisadoresPanel = new JPanel(); + + private final JLabel labelGrupos = new JLabel( "Tipos de ECDs" ); + private final JLabel labelAnalisador = new JLabel( "Analisadores" ); + private final JLabel labelMessage = new JLabel( " " ); + + private final Map mapLabel = new HashMap(); + private final Map mapComboBox = new HashMap(); + + private final List listAnalisadores = new ArrayList(); + private final List listGrupos = new ArrayList(); + + private final MedicinaDAO medicinaCayenneDAO = new MedicinaDAO(); + + /** Creates a new instance of PrestadoresWindow */ + public PrestadoresWindow() throws Exception + { + super( new int[][] { + { + NEW_INDEX, EDIT_INDEX, CANCEL_INDEX, SAVE_INDEX, DELETE_INDEX, SELECT_BYNAME_INDEX + } + } ); + provider = PrestadoresDataProvider.getProvider(); + clientesProvider = (ClientesDataProvider) ClientesDataProvider.getProvider(); + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + { + setTitle( TITLE ); + setSize( 800, 600 ); + tabbedPane.addTab( "Prestadores", prestadoresPanel ); + tabbedPane.addTab( "Analisadores", analisadoresPanel ); + + setupAnalisadoresTab(); + setupPrestadoresTab(); + // pack(); + } + + private void setupPrestadoresTab() + { + try + { + JLabel nomeLabel = new JLabel( "Designa\u00e7\u00e3o" ); + nomeText = new JTextField(); + nomeText.setPreferredSize( new Dimension( 500, 20 ) ); + activoCheck = new JCheckBox( "Activo (actualmente fornece servi\u00e7os \u00e0 SIPRP)" ); + consultasCheck = new JCheckBox( "Faz consultas" ); + ecdsCheck = new JCheckBox( "Faz ecds" ); + List gruposProtocolo = new Vector(); + IDObject gruposProtocoloReais[] = clientesProvider.getAllGruposProtocoloReais(); + if( gruposProtocoloReais != null && gruposProtocoloReais.length > 0 ) + { + gruposProtocolo.addAll( Arrays.asList( gruposProtocoloReais ) ); + } + IDObject gruposProtocoloFalsos[] = clientesProvider.getAllGruposProtocoloFalsos(); + if( gruposProtocoloFalsos != null && gruposProtocoloFalsos.length > 0 ) + { + gruposProtocolo.addAll( Arrays.asList( gruposProtocoloFalsos ) ); + } + ecdsPanel = new CheckBoxPanel( gruposProtocolo.toArray( new IDObject[gruposProtocolo.size()] ) ); + JLabel contactoLabel = new JLabel( "Contacto" ); + contactoPanel = new ContactoPanel(); + contactoPanel.setPreferredSize( new Dimension( 350, 120 ) ); + contactoPanel.setBorder( BorderFactory.createEtchedBorder() ); + JLabel moradaLabel = new JLabel( "Morada" ); + moradaText = new JTextArea(); + moradaText.setLineWrap( true ); + moradaText.setWrapStyleWord( true ); + JScrollPane moradaScroll = new JScrollPane( moradaText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + moradaScroll.setPreferredSize( new Dimension( 500, 50 ) ); + JLabel codigoPostalLabel = new JLabel( "C\u00f3digo Postal" ); + codigoPostalText = new JTextField(); + codigoPostalText.setPreferredSize( new Dimension( 100, 50 ) ); + localidadeCodigoPostalText = new JTextField(); + localidadeCodigoPostalText.setPreferredSize( new Dimension( 150, 50 ) ); + JLabel localidadeLabel = new JLabel( "Localidade" ); + localidadeText = new JTextField(); + JLabel contribuinteLabel = new JLabel( "Contribuinte" ); + contribuinteText = new JTextField(); + contribuinteText.setPreferredSize( new Dimension( 100, 50 ) ); + + double cols[] = new double[] { + TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL + }; + double rows[] = new double[] { + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL + }; + TableLayout tableLayout = new TableLayout( cols, rows ); + prestadoresPanel.setLayout( tableLayout ); + + tableLayout = new TableLayout( new double[] { + TableLayout.FILL + }, new double[] { + TableLayout.FILL + } ); + getContentPane().setLayout( tableLayout ); + getContentPane().add( tabbedPane, new TableLayoutConstraints( 0, 0 ) ); + + prestadoresPanel.add( nomeLabel, new TableLayoutConstraints( 0, 0 ) ); + prestadoresPanel.add( nomeText, new TableLayoutConstraints( 1, 0, 3, 0 ) ); + prestadoresPanel.add( activoCheck, new TableLayoutConstraints( 0, 1, 2, 1 ) ); + prestadoresPanel.add( consultasCheck, new TableLayoutConstraints( 0, 2 ) ); + prestadoresPanel.add( ecdsCheck, new TableLayoutConstraints( 0, 3 ) ); + prestadoresPanel.add( ecdsPanel, new TableLayoutConstraints( 1, 3, 2, 3 ) ); + prestadoresPanel.add( contactoLabel, new TableLayoutConstraints( 0, 4 ) ); + prestadoresPanel.add( contactoPanel, new TableLayoutConstraints( 1, 4, 2, 4 ) ); + prestadoresPanel.add( moradaLabel, new TableLayoutConstraints( 0, 5 ) ); + prestadoresPanel.add( moradaScroll, new TableLayoutConstraints( 1, 5, 3, 5 ) ); + prestadoresPanel.add( codigoPostalLabel, new TableLayoutConstraints( 0, 6 ) ); + prestadoresPanel.add( codigoPostalText, new TableLayoutConstraints( 1, 6 ) ); + prestadoresPanel.add( localidadeCodigoPostalText, new TableLayoutConstraints( 2, 6, 3, 6 ) ); + prestadoresPanel.add( localidadeLabel, new TableLayoutConstraints( 0, 7 ) ); + prestadoresPanel.add( localidadeText, new TableLayoutConstraints( 1, 7, 3, 7 ) ); + prestadoresPanel.add( contribuinteLabel, new TableLayoutConstraints( 0, 8 ) ); + prestadoresPanel.add( contribuinteText, new TableLayoutConstraints( 1, 8 ) ); + prestadoresPanel.add( labelObservacoes, new TableLayoutConstraints( 0, 9 ) ); + prestadoresPanel.add( textObservacoes, new TableLayoutConstraints( 0, 10, 3, 10 ) ); + } catch( Exception e ) + { + e.printStackTrace(); + } + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( PrestadoresData.NOME, nomeText ); + components.putComponent( PrestadoresData.NOME_PLAIN, new JTextComponentPlainFillerSaver( nomeText ) ); + components.putComponent( PrestadoresData.MORADA, moradaText ); + components.putComponent( PrestadoresData.CODIGO_POSTAL, codigoPostalText ); + components.putComponent( PrestadoresData.LOCALIDADE_CP, localidadeCodigoPostalText ); + components.putComponent( PrestadoresData.LOCALIDADE, localidadeText ); + components.putComponent( PrestadoresData.CONTRIBUINTE, contribuinteText ); + components.putComponent( PrestadoresData.OBSERVACOES, textObservacoes ); + components.putComponent( PrestadoresData.ACTIVO, activoCheck ); + components.putComponent( PrestadoresData.FAZ_CONSULTAS, consultasCheck ); + components.putComponent( PrestadoresData.FAZ_ECDS, ecdsCheck ); + components.putComponent( PrestadoresData.CONTACTO_ID, + new JDOControllable( (ProviderInterface) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ), ContactosData.class, new String[] { + ContactosData.ID + }, contactoPanel ) ); + } + + public boolean searchByName() + { + SearchDialog search = new SearchDialog( provider ); + Integer id = (Integer) search.getSelected(); + if( id == null ) + { + return false; + } + clear( 0 ); + try + { + prestador = provider.getPrestadorByID( id ); + gruposProtocolo = provider.getGruposProtocoloIDByPrestadorID( id ); + reload( 0 ); + } catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Ocorreu um erro a carregar o prestador.", true ); + return false; + } + + return true; + } + + public void enableComponents( int index, boolean enable ) + { + String names[] = (String[]) components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + ecdsPanel.setEnabled( enable ); + } + + public void reload( int index ) + { + try + { + String names[] = (String[]) components.keySet().toArray( new String[0] ); + ComponentController.fill( names, prestador.getHashData(), components ); + ecdsPanel.setSelected( gruposProtocolo ); + } catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); + + } + } + + public void clear( int index ) + { + String names[] = (String[]) components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + ecdsPanel.clear(); + prestador = null; + gruposProtocolo = null; + } + + public boolean newItem( int index ) + { + return true; + } + + public boolean save( int index ) + { + if( prestador == null ) + { + prestador = new PrestadoresData(); + } + String names[] = (String[]) components.keySet().toArray( new String[0] ); + Map data = prestador.getHashData(); + ComponentController.save( names, data, components ); + prestador.setHashData( data ); + gruposProtocolo = ecdsPanel.getSelected(); + try + { + provider.savePrestador( prestador ); + provider.setGruposProtocoloForPrestador( (Integer) prestador.get( PrestadoresData.ID ), gruposProtocolo ); + } catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a guardar dados", true ); + return false; + } + return true; + } + + private void setupAnalisadoresTab() + { + loadAnalisadoresTabData(); + setupAnalisadoresTabLayout(); + setupAnalisadoresTabComponents(); + placeAnalisadoresTabComponents(); + setupAnalisadoresTabListeners(); + } + + private void loadAnalisadoresTabData() + { + clearAnalisadoresTabData(); + listGrupos.addAll( medicinaCayenneDAO.getAllPrtGruposProtocolo() ); + listAnalisadores.addAll( medicinaCayenneDAO.getAllPrestadores() ); + } + + private void clearAnalisadoresTabData() + { + mapComboBox.clear(); + mapLabel.clear(); + listGrupos.clear(); + listAnalisadores.clear(); + shout( null ); + } + + private void setupAnalisadoresTabLayout() + { + double[] cols = new double[] { + TableLayout.MINIMUM, TableLayout.FILL + }; + double[] rows = new double[1 + listGrupos.size() + 2]; + for( int i = 0; i < rows.length; ++i ) + { + rows[i] = TableLayout.MINIMUM; + } + TableLayout layout = new TableLayout( cols, rows ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + analisadoresPanel.setLayout( layout ); + } + + private void setupAnalisadoresTabComponents() + { + Object[] analisadores = listAnalisadores.toArray(); + for( PrtGruposProtocolo grupo : listGrupos ) + { + JLabel label = new JLabel( grupo.getDescricao() ); + mapLabel.put( grupo, label ); + JComboBox combo = new JComboBox( analisadores ); + Prestadores analisador = grupo.getToAnalisador(); + combo.setSelectedItem( analisador == null ? Prestadores.prestadorNulo : analisador ); + mapComboBox.put( grupo, combo ); + } + labelMessage.setForeground( Color.RED.darker().darker() ); + } + + private void placeAnalisadoresTabComponents() + { + analisadoresPanel.add( labelGrupos, new TableLayoutConstraints( 0, 0 ) ); + analisadoresPanel.add( labelAnalisador, new TableLayoutConstraints( 1, 0 ) ); + for( int i = 0; i < listGrupos.size(); ++i ) + { + PrtGruposProtocolo grupo = listGrupos.get( i ); + JLabel label = mapLabel.get( grupo ); + analisadoresPanel.add( label, new TableLayoutConstraints( 0, i + 1 ) ); + JComboBox combo = mapComboBox.get( grupo ); + analisadoresPanel.add( combo, new TableLayoutConstraints( 1, i + 1 ) ); + } + int line = listGrupos.size() + 1; + analisadoresPanel.add( new JSeparator(), new TableLayoutConstraints( 0, line, 1, line ) ); + ++line; + analisadoresPanel.add( labelMessage, new TableLayoutConstraints( 0, line, 1, line ) ); + } + + private void setupAnalisadoresTabListeners() + { + for( PrtGruposProtocolo grupo : listGrupos ) + { + JComboBox combo = mapComboBox.get( grupo ); + setupListenersFor( combo ); + } + } + + private void setupListenersFor( JComboBox combo ) + { + combo.addItemListener( new ItemListener() + { + + @Override + public void itemStateChanged( ItemEvent itemEvent ) + { + try + { + if( ItemEvent.SELECTED == itemEvent.getStateChange() ) + { + JComboBox combo = (JComboBox) itemEvent.getSource(); + for( PrtGruposProtocolo grupo : mapComboBox.keySet() ) + { + if( mapComboBox.get( grupo ).equals( combo ) ) + { + Prestadores analisador = (Prestadores) combo.getSelectedItem(); + grupo.setToAnalisador( Prestadores.prestadorNulo.equals( analisador ) ? null : analisador ); + grupo.save(); + shout( "Tipo de ECD: " + grupo.getDescricao() + " -> Analisador: " + analisador.getNome() + " [guardado]" ); + } + } + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + + } ); + } + + private void shout( String message ) + { + labelMessage.setText( message == null ? " " : message ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ProcessoDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ProcessoDataProvider.java new file mode 100644 index 00000000..d93a1afc --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ProcessoDataProvider.java @@ -0,0 +1,618 @@ +/* + * ProcessoDataProvider.java + * + * Created on March 20, 2007, 5:14 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo; + +import java.text.DateFormat; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.Locale; +import java.util.Vector; + +import siprp.MedicinaConstants; +import siprp.ProcessoConstants; +import siprp.data.outer.TrabalhadoresConsultasData; +import siprp.data.outer.TrabalhadoresConsultasDatasData; +import siprp.data.outer.TrabalhadoresEcdsData; +import siprp.data.outer.TrabalhadoresEcdsDatasData; +import siprp.data.outer.TrabalhadoresProcessoData; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; +import com.evolute.utils.sql.Update; + +/** + * + * @author fpalma + */ +public class ProcessoDataProvider + implements MedicinaConstants, ProcessoConstants +{ + private static final DateFormat D_F = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); + + public static final HashMap ESTADO_PROCESSO_BY_CODE = + new HashMap(); + + static + { + ESTADO_PROCESSO_BY_CODE.put( PROCESSO_ABERTO_CODE, PROCESSO_ABERTO_DESCRIPTION ); + ESTADO_PROCESSO_BY_CODE.put( PROCESSO_FECHADO_CODE, PROCESSO_FECHADO_DESCRIPTION ); + ESTADO_PROCESSO_BY_CODE.put( PROCESSO_CANCELADO_CODE, PROCESSO_CANCELADO_DESCRIPTION ); + } + + private static final Object LOCK = new Object(); + private static ProcessoDataProvider instance = null; + private Executer EXECUTER; + private ProviderInterface JDO; + + /** Creates a new instance of ProcessoDataProvider */ + public ProcessoDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + + public static ProcessoDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new ProcessoDataProvider(); + } + } + return instance; + } + + public Integer[] getIDsProcessosByTrabalhador( Integer trabalhadorID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_processo" }, + new Integer[ 0 ], + new Expression[ 0 ], + new String[]{ "id", "data_inicio" }, + new Field( "trabalhadores_processo.trabalhador_id" ).isEqual( trabalhadorID ), + new String[]{ "data_inicio DESC" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < ids.length; n++ ) + { + ids[ n ] = ( Integer ) array.get( n, 0 ); + } + return ids; + } + + public TrabalhadoresProcessoData getProcessoByID( Integer id ) + throws Exception + { + return ( TrabalhadoresProcessoData ) JDO.load( TrabalhadoresProcessoData.class, id ); + } + + public void saveProcesso( TrabalhadoresProcessoData processo ) + throws Exception + { + processo.save(); + } + + public String getDescricaoEstadoProcessoByCodigo( String codigo ) + { + return ESTADO_PROCESSO_BY_CODE.get( codigo ); + } + + public Object[][] getElementosProcesso( Integer processoID ) + throws Exception + { + Vector elementosVector = new Vector(); + + Select select = + new Select2( new String[]{ "trabalhadores_ecds" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "data", "estado", "" + TIPO_ECDS }, + new Field( "processo_id" ).isEqual( processoID ), + new String[]{ "data", "id" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + elementosVector.addAll( Arrays.asList( array.getObjects() ) ); + + select = + new Select2( new String[]{ "trabalhadores_consultas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "data", "estado", "" + TIPO_CONSULTA }, + new Field( "processo_id" ).isEqual( processoID ), + new String[]{ "data", "id" }, + null, + null, + null ); + array = EXECUTER.executeQuery( select ); + elementosVector.addAll( Arrays.asList( array.getObjects() ) ); + + select = + new Select2( new String[]{ "trabalhadores_fichas_aptidao", "exames" }, + new Integer[]{ Select2.JOIN_INNER }, + new Expression[]{ new Field( "trabalhadores_fichas_aptidao.exame_id" ).isEqual( new Field( "exames.id" ) ) }, + new String[]{ "exames.id", "exames.data", "resultado", "" + TIPO_FICHA_APTIDAO }, + new Field( "trabalhadores_fichas_aptidao.processo_id" ).isEqual( processoID ).and( + new Field( "exames.inactivo" ).isDifferent( "y" ) ), + new String[]{ "exames.data", "exames.id" }, + null, + null, + null ); + array = EXECUTER.executeQuery( select ); + elementosVector.addAll( Arrays.asList( array.getObjects() ) ); + + Object elementos[][] = elementosVector.toArray( new Object[ elementosVector.size() ][] ); + Arrays.sort( elementos, new Comparator(){ + public int compare( Object o1, Object o2 ) + { + return ( (Date)( ( Object[] ) o1 )[ 1 ] ).compareTo( ( (Date)( ( Object[] ) o2 )[ 1 ] ) ); + } + } ); + return elementos; + } + + public Object[][] getDatasConsulta( Integer consultaID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas_datas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "data", "prestador_id", "estado" }, + new Field( "trabalhadores_consultas_id" ).isEqual( consultaID ), + new String[]{ "data DESC" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + return array.getObjects(); + } + + public Object[][] getDatasECDs( Integer consultaID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_ecds_datas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "data", "estado" }, + new Field( "consulta_id" ).isEqual( consultaID ), + new String[]{ "data DESC" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + return array.getObjects(); + } + + public IDObject getObservacoesConsultaData( Integer consultaDataID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas_datas_observacoes" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "observacao" }, + new Field( "trabalhadores_consultas_datas_id" ).isEqual( consultaDataID ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return null; + } + else + { + return new MappableObject( ( Integer ) array.get( 0, 0 ), ( String ) array.get( 0, 1 ) ); + } + } + + public void saveObservacoesConsultaData( Integer consultaDataID, String observacao ) + throws Exception + { + IDObject observacaoAntiga = getObservacoesConsultaData( consultaDataID ); + if( observacaoAntiga != null ) + { + Update update = + new Update( "trabalhadores_consultas_datas_observacoes", + new Assignment[]{ + new Assignment( "observacao", observacao ) }, + new Field( "id" ).isEqual( observacaoAntiga.getID() ) ); + EXECUTER.executeQuery( update ); + } + else + { + Insert insert = + new Insert( "trabalhadores_consultas_datas_observacoes", + new Assignment[]{ + new Assignment( "observacao", observacao ), + new Assignment( "trabalhadores_consultas_datas_id", consultaDataID ) } ); + EXECUTER.executeQuery( insert ); + } + } + + public IDObject[] getEmailConsultaData( Integer consultaDataID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas_datas_emails" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "data", "subject" }, + new Field( "trabalhadores_consultas_datas_id" ).isEqual( consultaDataID ), + new String[]{ "data DESC" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + IDObject mails[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < mails.length; n++ ) + { + Date data = ( Date ) array.get( n, 1 ); + String desc = D_F.format( data ) + " : " + array.get( n, 2 ); + mails[ n ] = new MappableObject( ( Integer ) array.get( n, 0 ), desc ); + } + return mails; + } + + public void saveEmailConsultaData( Integer consultaDataID, String destination, + String subject, String body ) + throws Exception + { + Insert insert = + new Insert( "trabalhadores_consultas_datas_emails", + new Assignment[]{ + new Assignment( "destination", destination ), + new Assignment( "subject", subject ), + new Assignment( "body", body ), + new Assignment( "data", new Date() ), + new Assignment( "trabalhadores_consultas_datas_id", consultaDataID ) } ); + EXECUTER.executeQuery( insert ); + } + + public Integer getLastConsultaDataIDForConsulta( Integer consultaID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas_datas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "MAX( id )" }, + new Field( "trabalhadores_consultas_id" ).isEqual( consultaID ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return null; + } + else + { + return ( Integer ) array.get( 0, 0 ); + } + } + + public IDObject getObservacoesECDsData( Integer ecdsDataID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas_datas_observacoes" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "observacao" }, + new Field( "trabalhadores_ecds_datas_id" ).isEqual( ecdsDataID ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return null; + } + else + { + return new MappableObject( ( Integer ) array.get( 0, 0 ), ( String ) array.get( 0, 1 ) ); + } + } + + public void saveObservacoesECDsData( Integer ecdsDataID, String observacao ) + throws Exception + { + IDObject observacaoAntiga = getObservacoesECDsData( ecdsDataID ); + if( observacaoAntiga != null ) + { + Update update = + new Update( "trabalhadores_ecds_datas_observacoes", + new Assignment[]{ + new Assignment( "observacao", observacao ) }, + new Field( "id" ).isEqual( observacaoAntiga.getID() ) ); + EXECUTER.executeQuery( update ); + } + else + { + Insert insert = + new Insert( "trabalhadores_ecds_datas_observacoes", + new Assignment[]{ + new Assignment( "observacao", observacao ), + new Assignment( "trabalhadores_ecds_datas_id", ecdsDataID ) } ); + EXECUTER.executeQuery( insert ); + } + } + + public Integer getLastECDsDataIDForECDs( Integer ecdsID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_ecds_datas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "MAX( id )" }, + new Field( "trabalhadores_ecds_id" ).isEqual( ecdsID ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return null; + } + else + { + return ( Integer ) array.get( 0, 0 ); + } + } + + public boolean getProcessoTemConsultasPorRealizar( Integer processoID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "estado" }, + new Field( "processo_id" ).isEqual( processoID ), + new String[]{ "estado" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + return ( array.columnLength() > 0 ) && ( new Integer( ESTADO_POR_REALIZAR ).equals( array.get( 0, 1 ) ) ); + } + + public boolean getProcessoTemECDsPorRealizar( Integer processoID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_ecds" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "estado" }, + new Field( "processo_id" ).isEqual( processoID ), + new String[]{ "estado" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + return ( array.columnLength() > 0 ) && ( new Integer( ESTADO_POR_REALIZAR ).equals( array.get( 0, 1 ) ) ); + } + + public Integer[] getConsultaIDsForProcesso( Integer processoID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id" }, + new Field( "processo_id" ).isEqual( processoID ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < ids.length; n++ ) + { + ids[ n ] = ( Integer ) array.get( n, 0 ); + } + return ids; + } + + public Integer[] getECDsIDsForProcesso( Integer processoID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_ecds" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id" }, + new Field( "processo_id" ).isEqual( processoID ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < ids.length; n++ ) + { + ids[ n ] = ( Integer ) array.get( n, 0 ); + } + return ids; + } + + public Integer getConsultaEmAbertoForProcesso( Integer processoID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id" }, + new Field( "processo_id" ).isEqual( processoID ).and( + new Field( "estado" ).isDifferent( new Integer( ESTADO_REALIZADO ) ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 ) + { + return null; + } + else + { + return ( Integer ) array.get( 0, 0 ); + } + } + + public Integer getECDsEmAbertoForProcesso( Integer processoID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_ecds" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id" }, + new Field( "processo_id" ).isEqual( processoID ).and( + new Field( "estado" ).isDifferent( new Integer( ESTADO_POR_REALIZAR ) ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 ) + { + return null; + } + else + { + return ( Integer ) array.get( 0, 0 ); + } + } + + public TrabalhadoresConsultasData getConsultaByID( Integer id ) + throws Exception + { + return ( TrabalhadoresConsultasData ) JDO.load( TrabalhadoresConsultasData.class, id ); + } + + public void saveConsulta( TrabalhadoresConsultasData consulta ) + throws Exception + { + consulta.save(); + } + + public TrabalhadoresConsultasDatasData getConsultaDataByID( Integer id ) + throws Exception + { + return ( TrabalhadoresConsultasDatasData ) JDO.load( TrabalhadoresConsultasDatasData.class, id ); + } + + public void saveConsultaData( TrabalhadoresConsultasDatasData consultaData ) + throws Exception + { + consultaData.save(); + } + + public TrabalhadoresEcdsData getEcdsByID( Integer id ) + throws Exception + { + return ( TrabalhadoresEcdsData ) JDO.load( TrabalhadoresEcdsData.class, id ); + } + + public void saveEcds( TrabalhadoresEcdsData ecds ) + throws Exception + { + ecds.save(); + } + + public TrabalhadoresEcdsDatasData getEcdsDataByID( Integer id ) + throws Exception + { + return ( TrabalhadoresEcdsDatasData ) JDO.load( TrabalhadoresEcdsDatasData.class, id ); + } + + public void saveEcdsData( TrabalhadoresEcdsDatasData EcdsData ) + throws Exception + { + EcdsData.save(); + } + + public boolean verificarDataValidaForConsulta( Integer consultaID, Date data ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas_datas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id" }, + new Field( "trabalhadores_consultas_id" ).isEqual( consultaID ).and( + new Field( "estado" ).isDifferent( new Integer( ESTADO_POR_REALIZAR ) ) ).and( + new Field( "data" ).isGreater( data ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + return array.columnLength() == 0; + } + + public boolean verificarDataValidaForECDs( Integer ecdsID, Date data ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_ecds_datas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id" }, + new Field( "trabalhadores_ecdss_id" ).isEqual( ecdsID ).and( + new Field( "estado" ).isDifferent( new Integer( ESTADO_POR_REALIZAR ) ) ).and( + new Field( "data" ).isGreater( data ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + return array.columnLength() == 0; + } + + public void saveLigacaoProcessoFichaAptidao( Integer processoID, Integer fichaID ) + throws Exception + { + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/database/MedicinaProcessoDAO.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/database/MedicinaProcessoDAO.java new file mode 100755 index 00000000..81ce3f0f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/database/MedicinaProcessoDAO.java @@ -0,0 +1,6 @@ +package siprp.medicina.processo.database; + +public class MedicinaProcessoDAO +{ + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/ConsultaMutableTreeNode.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/ConsultaMutableTreeNode.java new file mode 100644 index 00000000..eef3d736 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/ConsultaMutableTreeNode.java @@ -0,0 +1,53 @@ +/* + * ConsultaMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 19:31 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +import java.awt.Color; +import java.util.Arrays; + +import siprp.MedicinaConstants; +import siprp.database.cayenne.objects.TrabalhadoresConsultas; + +/** + * + * @author Frederico + */ +public class ConsultaMutableTreeNode extends MarcacaoMutableTreeNode +{ + private static final long serialVersionUID = 1L; + public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/consulta.png"; + + /** Creates a new instance of ConsultaMutableTreeNode */ + public ConsultaMutableTreeNode( TrabalhadoresConsultas userObject ) + { + super( userObject ); + } + + @Override + public Color getColor() + { + Integer[] markedEstados = new Integer[] + { + MedicinaConstants.ESTADO_POR_MARCAR, + MedicinaConstants.ESTADO_POR_REALIZAR, + MedicinaConstants.ESTADO_PARCIALMENTE_REALIZADO + }; + if(userObject != null && Arrays.asList( markedEstados ).contains( ((TrabalhadoresConsultas)userObject).getEstado())) + { + return Color.RED; + } + return Color.BLACK; + } + + protected String getIconPath() + { + return ICON_PATH; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/DataMutableTreeNode.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/DataMutableTreeNode.java new file mode 100644 index 00000000..8b671ece --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/DataMutableTreeNode.java @@ -0,0 +1,32 @@ +/* + * DataMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 19:32 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +/** + * + * @author Frederico + */ +public class DataMutableTreeNode extends EstruturaProcessoMutableTreeNode +{ + + private static final long serialVersionUID = 1L; + public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/data.png"; + + /** Creates a new instance of DataMutableTreeNode */ + public DataMutableTreeNode( Object userObject ) + { + super( userObject ); + } + + protected String getIconPath() + { + return ICON_PATH; + } +} \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/ECDsMutableTreeNode.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/ECDsMutableTreeNode.java new file mode 100644 index 00000000..2dc4bca2 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/ECDsMutableTreeNode.java @@ -0,0 +1,53 @@ +/* + * ECDsMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 19:31 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +import java.awt.Color; +import java.util.Arrays; + +import siprp.MedicinaConstants; +import siprp.database.cayenne.objects.TrabalhadoresEcds; + +/** + * + * @author Frederico + */ +public class ECDsMutableTreeNode extends MarcacaoMutableTreeNode +{ + private static final long serialVersionUID = 1L; + public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/ecds.png"; + + /** Creates a new instance of ECDsMutableTreeNode */ + public ECDsMutableTreeNode( TrabalhadoresEcds userObject ) + { + super( userObject ); + } + + @Override + public Color getColor() + { + Integer[] markedEstados = new Integer[] + { + MedicinaConstants.ESTADO_POR_MARCAR, + MedicinaConstants.ESTADO_POR_REALIZAR, + MedicinaConstants.ESTADO_PARCIALMENTE_REALIZADO + }; + if(userObject != null && Arrays.asList( markedEstados ).contains( ((TrabalhadoresEcds)userObject).getEstado())) + { + return Color.RED; + } + return Color.BLACK; + } + + protected String getIconPath() + { + return ICON_PATH; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoMutableTreeNode.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoMutableTreeNode.java new file mode 100644 index 00000000..72f950a3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoMutableTreeNode.java @@ -0,0 +1,62 @@ +/* + * EstruturaProcessoMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 18:57 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +import java.awt.Color; + +import javax.swing.Icon; +import javax.swing.tree.DefaultMutableTreeNode; + +import com.evolute.utils.images.ImageIconLoader; + +/** + * + * @author Frederico + */ +abstract public class EstruturaProcessoMutableTreeNode extends DefaultMutableTreeNode +{ + protected Icon icon = null; + protected Color color = null; + + + /** Creates a new instance of EstruturaProcessoMutableTreeNode */ + public EstruturaProcessoMutableTreeNode( Object userObject ) + { + super( userObject ); + } + + abstract protected String getIconPath(); + + public Icon getIcon() + { + loadIcon(); + return icon; + } + + public Color getColor() + { + return color; + } + + protected void loadIcon() + { + if( icon == null && getIconPath() != null ) + { + try + { + icon = ImageIconLoader.loadImageIcon( getClass(), getIconPath() ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoPanel.java new file mode 100644 index 00000000..fc58b167 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoPanel.java @@ -0,0 +1,421 @@ +///* +// * EstruturaProcessoPanel.java +// * +// * Created on March 20, 2007, 12:07 PM +// * +// * To change this template, choose Tools | Template Manager +// * and open the template in the editor. +// */ +// +package siprp.medicina.processo.estrutura; +// +//import com.evolute.utils.data.IDObject; +//import com.evolute.utils.ui.DialogException; +//import java.awt.*; +//import java.text.DateFormat; +//import java.util.Arrays; +//import java.util.Date; +//import java.util.Enumeration; +//import java.util.HashMap; +//import java.util.Locale; +//import java.util.Vector; +//import javax.swing.*; +//import javax.swing.event.TreeSelectionEvent; +//import javax.swing.event.TreeSelectionListener; +//import javax.swing.tree.DefaultMutableTreeNode; +//import javax.swing.tree.DefaultTreeModel; +//import javax.swing.tree.TreePath; +//import siprp.medicina.MedicinaConstants; +//import siprp.medicina.MedicinaDataProvider; +//import siprp.medicina.processo.*; +//import siprp.medicina.processo.data.TrabalhadoresConsultasData; +//import siprp.medicina.processo.data.TrabalhadoresProcessoData; +// +///** +// * +// * @author fpalma +// */ +//public class EstruturaProcessoPanel extends JPanel +// implements TreeSelectionListener +//{ +// protected static final DateFormat D_F = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); +// +// protected JScrollPane mainScroll; +// protected TrabalhadorMutableTreeNode rootNode; +// protected JTree mainTree; +// +// protected ProcessoDataProvider provider; +// +// protected IDObject trabalhador; +// protected final HashMap PROCESSOS_POR_ID = +// new HashMap(); +// +// private final Vector PROCESSO_LISTENERS = new Vector(); +// +// /** Creates a new instance of EstruturaProcessoPanel */ +// public EstruturaProcessoPanel() +// throws Exception +// { +// provider = ProcessoDataProvider.getProvider(); +// setupComponents(); +//// setTrabalhador( new MappableObject( new Integer( 12 ), "Alexandre de Matos Monge" ) ); +// } +// +// private void setupComponents() +// { +// mainScroll = new JScrollPane(); +// mainScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED ); +// mainScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED ); +//// rootNode = new DefaultMutableTreeNode( new MappableObject( new Integer( 12 ), "Frederico Palma" ) ); +// rootNode = new TrabalhadorMutableTreeNode( new Integer( -1 ), "" ); +// mainTree = new JTree( rootNode ); +// mainTree.addTreeSelectionListener( this ); +// mainTree.setCellRenderer( new EstruturaProcessoRenderer() ); +// mainScroll.setViewportView( mainTree ); +// setLayout( new GridLayout( 1, 1 ) ); +// add( mainScroll ); +// +// } +// +// public void setTrabalhador( IDObject trabalhador ) +// { +// clear(); +// if( trabalhador == null ) +// { +// return; +// } +// this.trabalhador = trabalhador; +//// rootNode.removeAllChildren(); +//// PROCESSOS_POR_ID.clear(); +// rootNode.setID( trabalhador.getID() ); +// rootNode.setDescricao( trabalhador.toString() ); +// DefaultMutableTreeNode nodes[] = +// loadProcessos( trabalhador.getID() ); +// rootNode.add( criarProcessoVazio() ); +// for( int n = 0; n < nodes.length; n++ ) +// { +// rootNode.add( nodes[ n ] ); +// } +// int count = mainTree.getRowCount(); +// for( int n = count - 1; n >= 0; n-- ) +// { +// mainTree.expandRow( n ); +// } +// } +// +// protected DefaultMutableTreeNode[] loadProcessos( Integer trabalhadorID ) +// { +// try +// { +// Integer ids[] = provider.getIDsProcessosByTrabalhador( trabalhadorID ); +// DefaultMutableTreeNode nodes[] = new DefaultMutableTreeNode[ ids.length ]; +// for( int n = 0; n < ids.length; n++ ) +// { +// nodes[ n ] = loadProcesso( ids[ n ], null ); +// } +////System.out.println( "nl: " + nodes.length ); +// return nodes; +// } +// catch( Exception ex ) +// { +// DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); +// return new DefaultMutableTreeNode[ 0 ]; +// } +// } +// +// protected ProcessoMutableTreeNode loadProcesso( Integer id, ProcessoMutableTreeNode node ) +// throws Exception +// { +// TrabalhadoresProcessoData processo = provider.getProcessoByID( id ); +// Date dataInicio = ( Date ) processo.get( TrabalhadoresProcessoData.DATA_INICIO ); +// Date dataFim = ( Date ) processo.get( TrabalhadoresProcessoData.DATA_FIM ); +// String codigoEstado = ( String ) processo.get( TrabalhadoresProcessoData.ESTADO ); +// String estado = provider.getDescricaoEstadoProcessoByCodigo( codigoEstado ); +// String desc = D_F.format( dataInicio ); +// Integer motivo = ( Integer ) processo.get( TrabalhadoresProcessoData.MOTIVO ); +// desc += ": " + MedicinaDataProvider.MOTIVOS_BY_ID.get( motivo ) + " : " + estado; +// PROCESSOS_POR_ID.put( id, processo ); +// ProcessoMutableTreeNode processoNode; +// if( node == null ) +// { +// processoNode = new ProcessoMutableTreeNode( id, desc ); +// } +// else +// { +// processoNode = node; +// processoNode.setID( id ); +// processoNode.setDescricao( desc ); +// } +// processoNode.removeAllChildren(); +// MarcacaoMutableTreeNode marcacoes[] = loadMarcacoes( id ); +//// processoNode.add( new ECDsMutableTreeNode( new Integer( 35 ), "ECDS de 2006/01/01 : Realizado" ) ); +// for( int n = 0; n < marcacoes.length; n++ ) +// { +// processoNode.add( marcacoes[ n ] ); +// } +// +//// processoNode.add( new FichaAptidaoMutableTreeNode( new Integer( 35 ), "Ficha de Aptid\u00e3o de 2006/01/01 : Apto" ) ); +// ( ( DefaultTreeModel ) mainTree.getModel() ).nodeStructureChanged( processoNode ); +// return processoNode; +// } +// +// public MarcacaoMutableTreeNode[] loadMarcacoes( Integer processoID ) +// { +// try +// { +// Integer consultaIDs[] = provider.getConsultaIDsForProcesso( processoID ); +// Vector nodesVector = new Vector(); +// for( int n = 0; n < consultaIDs.length; n++ ) +// { +// nodesVector.add( loadConsulta( consultaIDs[ n ], null ) ); +// } +// +// MarcacaoMutableTreeNode nodes[] = nodesVector.toArray( new MarcacaoMutableTreeNode[ nodesVector.size() ] ); +// Arrays.sort( nodes ); +// return nodes; +// } +// catch( Exception ex ) +// { +// DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); +// return new MarcacaoMutableTreeNode[ 0 ]; +// } +// } +// +// public ConsultaMutableTreeNode loadConsulta( Integer id, ConsultaMutableTreeNode node ) +// throws Exception +// { +// TrabalhadoresConsultasData consulta = provider.getConsultaByID( id ); +// Date data = ( Date ) consulta.get( TrabalhadoresConsultasData.DATA ); +// Integer estado = ( Integer ) consulta.get( TrabalhadoresConsultasData.ESTADO ); +// String estadoStr = MedicinaConstants.ESTADOS_CONSULTA_STR[ estado != null ? estado.intValue() : 0 ]; +// +// String desc = "Consulta de " + ( data != null ? D_F.format( data ) : "--" ); +// desc += ": " + estadoStr; +// ConsultaMutableTreeNode consultaNode; +// if( node == null ) +// { +// consultaNode = new ConsultaMutableTreeNode( id, desc ); +// consultaNode.setData( data ); +// } +// else +// { +// consultaNode = node; +// consultaNode.setID( id ); +// consultaNode.setDescricao( desc ); +// consultaNode.setData( data ); +// } +// consultaNode.removeAllChildren(); +// Object datas[][] = provider.getDatasConsulta( id ); +// for( int n = 0; n < datas.length; n++ ) +// { +// Integer dataID = ( Integer ) datas[ n ][ 0 ]; +// Date dataData = ( Date ) datas[ n ][ 1 ]; +// Integer dataEstado = ( Integer ) datas[ n ][ 3 ]; +// String dataEstadoStr = MedicinaConstants.ESTADOS_CONSULTA_STR[ dataEstado != null ? dataEstado.intValue() : 0 ]; +// String dataDesc = D_F.format( dataData ) + ": " + dataEstadoStr; +// DataMutableTreeNode dataNode = new DataMutableTreeNode( dataID, dataDesc ); +// IDObject observacoes = provider.getObservacoesConsultaData( dataID ); +// if( observacoes != null ) +// { +// ObservacoesMutableTreeNode observacoesNode = new ObservacoesMutableTreeNode( observacoes.getID(), observacoes.toString() ); +// dataNode.add( observacoesNode ); +// } +// IDObject emails[] = provider.getEmailConsultaData( dataID ); +// for( int em = 0; em < emails.length; em++ ) +// { +// MailMutableTreeNode mailNode = new MailMutableTreeNode( emails[ em ].getID(), emails[ em ].toString() ); +// dataNode.add( mailNode ); +// } +// consultaNode.add( dataNode ); +// } +// +// ( ( DefaultTreeModel ) mainTree.getModel() ).nodeStructureChanged( consultaNode ); +// return consultaNode; +// } +// +// public void valueChanged( TreeSelectionEvent e ) +// { +// Object components[] = e.getPath().getPath(); +// int tipo = ProcessoEvent.ACCAO_ESCOLHER_PROCESSO; +// if( components == null || components.length == 0 || +// components[ components.length - 1 ] instanceof TrabalhadorMutableTreeNode || +// components[ components.length - 1 ] instanceof ProcessoMutableTreeNode ) +// { +// tipo = ProcessoEvent.ACCAO_ESCOLHER_PROCESSO; +// } +// else if( components[ components.length - 1 ] instanceof ConsultaMutableTreeNode ) +// { +// tipo = ProcessoEvent.ACCAO_ESCOLHER_CONSULTA; +// } +// else if( components[ components.length - 1 ] instanceof ECDsMutableTreeNode ) +// { +// tipo = ProcessoEvent.ACCAO_ESCOLHER_ECDS; +// } +// else if( components[ components.length - 1 ] instanceof FichaAptidaoMutableTreeNode ) +// { +// tipo = ProcessoEvent.ACCAO_ESCOLHER_FA; +// } +// else if( components[ components.length - 1 ] instanceof DataMutableTreeNode ) +// { +// tipo = ProcessoEvent.ACCAO_ESCOLHER_DATA; +// } +// else if( components[ components.length - 1 ] instanceof ObservacoesMutableTreeNode ) +// { +// tipo = ProcessoEvent.ACCAO_ESCOLHER_OBSERVACOES; +// } +// else if( components[ components.length - 1 ] instanceof MailMutableTreeNode ) +// { +// tipo = ProcessoEvent.ACCAO_ESCOLHER_MAIL; +// } +// HashMap ids = new HashMap(); +// for( int n = 0; components != null && n < components.length; n++ ) +// { +// Integer id = ( ( EstruturaProcessoMutableTreeNode ) components[ n ] ).getID(); +// if( components[ n ] instanceof ProcessoMutableTreeNode ) +// { +// ids.put( ProcessoEvent.TIPO_PROCESSO, id ); +// } +// else if( components[ n ] instanceof ConsultaMutableTreeNode ) +// { +// ids.put( ProcessoEvent.TIPO_CONSULTA, id ); +// } +// else if( components[ n ] instanceof ECDsMutableTreeNode ) +// { +// ids.put( ProcessoEvent.TIPO_ECDS, id ); +// } +// else if( components[ n ] instanceof FichaAptidaoMutableTreeNode ) +// { +// ids.put( ProcessoEvent.TIPO_FICHA_APTIDAO, id ); +// } +// else if( components[ n ] instanceof DataMutableTreeNode ) +// { +// ids.put( ProcessoEvent.TIPO_DATA, id ); +// } +// else if( components[ n ] instanceof ObservacoesMutableTreeNode ) +// { +// ids.put( ProcessoEvent.TIPO_OBSERVACOES, id ); +// } +// else if( components[ n ] instanceof MailMutableTreeNode ) +// { +// ids.put( ProcessoEvent.TIPO_MAIL, id ); +// } +// } +// ProcessoEvent event = new ProcessoEvent( this, tipo, ids ); +// for( int n = 0; n < PROCESSO_LISTENERS.size(); n++ ) +// { +// PROCESSO_LISTENERS.get( n ).processoStateChanged( event ); +// } +// } +//// +//// public TrabalhadoresProcessoData getProcessoEscolhido() +//// { +//// TreePath path = mainTree.getSelectionPath(); +//// TrabalhadoresProcessoData processo = null; +//// if( path != null ) +//// { +//// EstruturaProcessoMutableTreeNode escolhido = ( EstruturaProcessoMutableTreeNode ) path.getLastPathComponent(); +//// if( escolhido != null ) +//// { +//// processo = PROCESSOS_POR_ID.get( escolhido.getID() ); +//// if( processo == null ) +//// { +//// processo = new TrabalhadoresProcessoData(); +//// PROCESSOS_POR_ID.put( escolhido.getID(), processo ); +//// } +//// } +//// } +//// +//// return processo; +//// } +// +// public void addProcessoListener( ProcessoListener listener ) +// { +// PROCESSO_LISTENERS.add( listener ); +// } +// +// public void removeProcessoListener( ProcessoListener listener ) +// { +// PROCESSO_LISTENERS.remove( listener ); +// } +// +// public IDObject getTrabalhador() +// { +// return trabalhador; +// } +// +// public void actualizarProcessoEscolhido( Integer id ) +// throws Exception +// { +// TreePath path = mainTree.getSelectionPath(); +// Enumeration expandedDescendants = mainTree.getExpandedDescendants( path ); +// ProcessoMutableTreeNode processoNode = ( ProcessoMutableTreeNode ) path.getPathComponent( 1 ); +// boolean vazio = processoNode.getID().intValue() == -1; +// loadProcesso( id, processoNode ); +// ( ( DefaultTreeModel ) mainTree.getModel() ).nodeChanged( processoNode ) ; +// if( vazio ) +// { +// ProcessoMutableTreeNode novo = criarProcessoVazio(); +// rootNode.insert( novo, 0 ); +// ( ( DefaultTreeModel ) mainTree.getModel() ).nodesWereInserted( rootNode, new int[]{ 0 } ) ; +// } +// mainTree.expandPath( path ); +// mainTree.setSelectionPath( path ); +//// while( expandedDescendants.hasMoreElements() ) +//// { +//// mainTree.expandPath( expandedDescendants.nextElement() ); +//// } +// } +// +// public void actualizarMarcacaoEscolhida( Integer processoID, Integer marcacaoID ) +// throws Exception +// { +// TreePath path = mainTree.getSelectionPath(); +// Enumeration expandedDescendants = mainTree.getExpandedDescendants( path ); +// ProcessoMutableTreeNode processoNode = ( ProcessoMutableTreeNode ) path.getPathComponent( 1 ); +// int countOld = processoNode.getChildCount(); +// actualizarProcessoEscolhido( processoID ); +// int count = processoNode.getChildCount(); +// if( count > countOld ) +// { +// ( ( DefaultTreeModel ) mainTree.getModel() ).nodesWereInserted( processoNode, new int[]{ countOld } ) ; +// } +// mainTree.expandPath( path ); +//// mainTree.expandPath( path ); +//// while( expandedDescendants.hasMoreElements() ) +//// { +//// mainTree.expandPath( expandedDescendants.nextElement() ); +//// } +//// TreePath path = mainTree.getSelectionPath(); +//// MarcacaoMutableTreeNode processoNode = ( ProcessoMutableTreeNode ) path.getPathComponent( 1 ); +//// boolean vazio = processoNode.getID().intValue() == -1; +//// loadProcesso( id, processoNode ); +//// ( ( DefaultTreeModel ) mainTree.getModel() ).nodeChanged( processoNode ) ; +//// if( vazio ) +//// { +//// ProcessoMutableTreeNode novo = criarProcessoVazio(); +//// rootNode.insert( novo, 0 ); +//// ( ( DefaultTreeModel ) mainTree.getModel() ).nodesWereInserted( rootNode, new int[]{ 0 } ) ; +//// } +// } +// +// public ProcessoMutableTreeNode criarProcessoVazio() +// { +// return new ProcessoMutableTreeNode( new Integer( -1 ), "Novo Processo..." ); +// } +// +// public void reload() +// { +// } +// +// public void clear() +// { +// mainTree.clearSelection(); +// mainTree.setRootVisible( true ); +// this.trabalhador = null; +// rootNode.removeAllChildren(); +// PROCESSOS_POR_ID.clear(); +// rootNode.setID( null ); +// rootNode.setDescricao( "" ); +// ( ( DefaultTreeModel ) mainTree.getModel() ).nodeStructureChanged( rootNode ); +// } +//} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoRenderer.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoRenderer.java new file mode 100644 index 00000000..7c9d16f8 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoRenderer.java @@ -0,0 +1,58 @@ +/* + * EstruturaProcessoRenderer.java + * + * Created on 29 de Abril de 2007, 18:52 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +import java.awt.Color; +import java.awt.Component; + +import javax.swing.Icon; +import javax.swing.JTree; +import javax.swing.tree.DefaultTreeCellRenderer; + +/** + * + * @author Frederico + */ +public class EstruturaProcessoRenderer extends DefaultTreeCellRenderer +{ + + /** Creates a new instance of EstruturaProcessoRenderer */ + public EstruturaProcessoRenderer() + { + } + + public Component getTreeCellRendererComponent( + JTree tree, + Object value, + boolean sel, + boolean expanded, + boolean leaf, + int row, + boolean hasFocus) { + + super.getTreeCellRendererComponent( + tree, value, sel, + expanded, leaf, row, + hasFocus); + EstruturaProcessoMutableTreeNode node = ( EstruturaProcessoMutableTreeNode ) value; + Icon icon = node.getIcon(); + Color color = node.getColor(); + if( icon != null ) + { + setIcon( icon ); + } + if(color != null) + { + setForeground( color ); + } + + return this; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/FichaAptidaoMutableTreeNode.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/FichaAptidaoMutableTreeNode.java new file mode 100644 index 00000000..fb139f96 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/FichaAptidaoMutableTreeNode.java @@ -0,0 +1,31 @@ +/* + * FichaAptidaoMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 19:32 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +/** + * + * @author Frederico + */ +public class FichaAptidaoMutableTreeNode extends EstruturaProcessoMutableTreeNode +{ + private static final long serialVersionUID = 1L; + public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/fichaaptidao.png"; + + /** Creates a new instance of FichaAptidaoMutableTreeNode */ + public FichaAptidaoMutableTreeNode( Object userObject ) + { + super( userObject ); + } + + protected String getIconPath() + { + return ICON_PATH; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/MailMutableTreeNode.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/MailMutableTreeNode.java new file mode 100644 index 00000000..90923b8c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/MailMutableTreeNode.java @@ -0,0 +1,32 @@ +/* + * MailMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 19:32 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +/** + * + * @author Frederico + */ +public class MailMutableTreeNode extends EstruturaProcessoMutableTreeNode +{ + + private static final long serialVersionUID = 1L; + public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/mail.png"; + + /** Creates a new instance of MailMutableTreeNode */ + public MailMutableTreeNode( Object userObject ) + { + super( userObject ); + } + + protected String getIconPath() + { + return ICON_PATH; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/MarcacaoMutableTreeNode.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/MarcacaoMutableTreeNode.java new file mode 100644 index 00000000..def655ca --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/MarcacaoMutableTreeNode.java @@ -0,0 +1,59 @@ +/* + * MarcacaoMutableTreeNode.java + * + * Created on 18 de Maio de 2007, 7:02 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +import java.util.Date; + +/** + * + * @author Frederico + */ +public abstract class MarcacaoMutableTreeNode extends EstruturaProcessoMutableTreeNode + implements Comparable +{ + protected Date data; + + /** Creates a new instance of MarcacaoMutableTreeNode */ + public MarcacaoMutableTreeNode( Object userObject ) + { + super( userObject ); + } + + public void setData( Date data ) + { + this.data = data; + } + + public Date getData() + { + return data; + } + + public int compareTo( MarcacaoMutableTreeNode other ) + { + if( !( other instanceof MarcacaoMutableTreeNode ) ) + { + return 0; + } + MarcacaoMutableTreeNode om = ( MarcacaoMutableTreeNode ) other; + if( data == null ) + { + return 1; + } + else if( om == null || om.getData() == null ) + { + return -1; + } + else + { + return -1 * getData().compareTo( om.getData() ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/ObservacoesMutableTreeNode.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/ObservacoesMutableTreeNode.java new file mode 100644 index 00000000..6203d147 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/ObservacoesMutableTreeNode.java @@ -0,0 +1,32 @@ +/* + * ObservacoesMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 19:32 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +/** + * + * @author Frederico + */ +public class ObservacoesMutableTreeNode extends EstruturaProcessoMutableTreeNode +{ + + private static final long serialVersionUID = 1L; + public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/observacoes.png"; + + /** Creates a new instance of ObservacoesMutableTreeNode */ + public ObservacoesMutableTreeNode( Object userObject ) + { + super( userObject ); + } + + protected String getIconPath() + { + return ICON_PATH; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/ProcessoMutableTreeNode.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/ProcessoMutableTreeNode.java new file mode 100644 index 00000000..df10dc63 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/ProcessoMutableTreeNode.java @@ -0,0 +1,46 @@ +/* + * ProcessoMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 19:31 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +import java.awt.Color; + +import siprp.ProcessoConstants; +import siprp.database.cayenne.objects.TrabalhadoresProcesso; + +/** + * + * @author Frederico + */ +public class ProcessoMutableTreeNode extends EstruturaProcessoMutableTreeNode +{ + private static final long serialVersionUID = 1L; + public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/processo.png"; + + /** Creates a new instance of ProcessoMutableTreeNode */ + public ProcessoMutableTreeNode( TrabalhadoresProcesso userObject ) + { + super( userObject ); + } + + @Override + public Color getColor() + { + if(userObject != null && ProcessoConstants.PROCESSO_ABERTO_CODE.equals( ((TrabalhadoresProcesso)userObject).getEstado())) + { + return Color.RED; + } + return Color.BLACK; + } + + protected String getIconPath() + { + return ICON_PATH; + } +} \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/TrabalhadorMutableTreeNode.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/TrabalhadorMutableTreeNode.java new file mode 100644 index 00000000..fbb72646 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/TrabalhadorMutableTreeNode.java @@ -0,0 +1,35 @@ +/* + * TrabalhadorMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 23:53 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +/** + * + * @author Frederico + */ +public class TrabalhadorMutableTreeNode extends EstruturaProcessoMutableTreeNode +{ + /** + * + */ + private static final long serialVersionUID = 1L; + public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/trabalhador.png"; + + /** Creates a new instance of TrabalhadorMutableTreeNode */ + public TrabalhadorMutableTreeNode( Object userObject ) + { + super( userObject ); + } + + protected String getIconPath() + { + return null; +// return ICON_PATH; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/briefcase.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/briefcase.png new file mode 100644 index 00000000..7fb1649e Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/briefcase.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/briefcase_add.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/briefcase_add.png new file mode 100644 index 00000000..d303b4eb Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/briefcase_add.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/briefcase_edit.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/briefcase_edit.png new file mode 100644 index 00000000..74b92eee Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/briefcase_edit.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/briefcase_view.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/briefcase_view.png new file mode 100644 index 00000000..d9d2a8ce Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/briefcase_view.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/consulta.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/consulta.png new file mode 100644 index 00000000..f07be69b Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/consulta.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/data.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/data.png new file mode 100644 index 00000000..59f184fc Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/data.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/document_certificate.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/document_certificate.png new file mode 100644 index 00000000..6155bc34 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/document_certificate.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/ecds.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/ecds.png new file mode 100644 index 00000000..4aa424d1 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/ecds.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/fichaaptidao.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/fichaaptidao.png new file mode 100644 index 00000000..ce2d52a5 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/fichaaptidao.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/injection.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/injection.png new file mode 100644 index 00000000..089c9ea3 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/injection.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/lock_new.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/lock_new.png new file mode 100644 index 00000000..89fd5bda Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/lock_new.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/mail.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/mail.png new file mode 100644 index 00000000..8f65c5ac Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/mail.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/observacoes.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/observacoes.png new file mode 100644 index 00000000..1f0856fb Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/observacoes.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/processo.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/processo.png new file mode 100644 index 00000000..f8ea33ee Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/processo.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/trabalhador.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/trabalhador.png new file mode 100644 index 00000000..96ac6bfa Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/trabalhador.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/icons/consulta.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/icons/consulta.png new file mode 100644 index 00000000..f07be69b Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/icons/consulta.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/icons/ecds.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/icons/ecds.png new file mode 100644 index 00000000..4aa424d1 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/icons/ecds.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/icons/fichaaptidao.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/icons/fichaaptidao.png new file mode 100644 index 00000000..ce2d52a5 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/icons/fichaaptidao.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/icons/lock.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/icons/lock.png new file mode 100644 index 00000000..46cc6b58 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/icons/lock.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/logic/MedicinaProcessoLogic.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/logic/MedicinaProcessoLogic.java new file mode 100755 index 00000000..c84beb55 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/logic/MedicinaProcessoLogic.java @@ -0,0 +1,928 @@ +package siprp.medicina.processo.logic; + +import java.util.Date; +import java.util.List; + +import javax.swing.tree.DefaultMutableTreeNode; + +import leaf.ui.LeafDialog; +import leaf.ui.LeafLogic; +import leaf.ui.LeafWindow.LeafObject; +import siprp.MedicinaConstants; +import siprp.ProcessoConstants; +import siprp.database.cayenne.objects.BaseObject; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.Exames; +import siprp.database.cayenne.objects.Lembretes; +import siprp.database.cayenne.objects.Prestadores; +import siprp.database.cayenne.objects.Trabalhadores; +import siprp.database.cayenne.objects.TrabalhadoresConsultas; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatas; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatasEmails; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatasObservacoes; +import siprp.database.cayenne.objects.TrabalhadoresEcd; +import siprp.database.cayenne.objects.TrabalhadoresEcds; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatas; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatasEmails; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatasObservacoes; +import siprp.database.cayenne.objects.TrabalhadoresFichasAptidao; +import siprp.database.cayenne.objects.TrabalhadoresProcesso; +import siprp.database.cayenne.providers.MedicinaDAO; +import siprp.ficha.FichaWindow; +import siprp.ficha.SaveExameListener; +import siprp.lembretes.LembretesConstants; +import siprp.lembretes.LembretesDataProvider; +import siprp.medicina.processo.estrutura.FichaAptidaoMutableTreeNode; + +public class MedicinaProcessoLogic extends LeafLogic +{ + @Action(isSave = false) + public static final String SELECT_EMPRESA = "SELECT_EMPRESA"; + + @Action(isSave = false) + public static final String SELECT_ESTABELECIMENTO = "SELECT_ESTABLECIMENTO"; + + @Action(isSave = false) + public static final String LOAD_TRABALHADOR = "LOAD_TRABALHADOR"; + + @Action(isSave = false) + public static final String SELECT_TRABALHADOR = "SELECT_TRABALHADOR"; + + @Action(isSave = false) + public static final String SELECT_PROCESSO = "SELECT_PROCESSO"; + + @Action(isSave = false) + public static final String SELECT_CONSULTA = "SELECT_CONSULTA"; + + @Action(isSave = false) + public static final String SELECT_CONSULTA_MARCACAO = "SELECT_CONSULTA_MARCACAO"; + + @Action(isSave = false) + public static final String SELECT_CONSULTA_MARCACAO_EMAIL = "SELECT_CONSULTA_MARCACAO_EMAIL"; + + @Action(isSave = false) + public static final String SELECT_CONSULTA_MARCACAO_OBSERVACAO = "SELECT_CONSULTA_MARCACAO_OBSERVACAO"; + + @Action(isSave = false) + public static final String SELECT_EXAME = "SELECT_EXAME"; + + @Action(isSave = false) + public static final String SELECT_EXAME_MARCACAO = "SELECT_EXAME_MARCACAO"; + + @Action(isSave = false) + public static final String SELECT_EXAME_MARCACAO_EMAIL = "SELECT_EXAME_MARCACAO_EMAIL"; + + @Action(isSave = false) + public static final String SELECT_EXAME_MARCACAO_OBSERVACAO = "SELECT_EXAME_MARCACAO_OBSERVACAO"; + + @Action(isSave = false) + public static final String SELECT_FICHA = "SELECT_FICHA"; + + @Action(isSave = false) + public static final String SELECT_TREE_NODE = "SELECT_TREE_NODE"; + + @Action(isSave = false) + public static final String CREATE_PROCESSO = "CREATE_PROCESSO"; + + @Action(isSave = false) + public static final String CREATE_LEMBRETE = "CREATE_LEMBRETE"; + + @Action(isSave = false) + public static final String CREATE_FICHA = "CREATE_FICHA"; + + @Action(isSave = false) + public static final String CREATE_CONSULTA = "CREATE_CONSULTA"; + + @Action(isSave = false) + public static final String CREATE_CONSULTA_MARCACAO = "CREATE_CONSULTA_MARCACAO"; + + @Action(isSave = false) + public static final String CREATE_CONSULTA_MARCACAO_EMAIL = "CREATE_CONSULTA_MARCACAO_EMAIL"; + + @Action(isSave = false) + public static final String CREATE_CONSULTA_MARCACAO_EMAIL_VACINAS = "CREATE_CONSULTA_MARCACAO_EMAIL_VACINAS"; + + @Action(isSave = false) + public static final String CREATE_CONSULTA_MARCACAO_OBSERVACOES = "CREATE_CONSULTA_MARCACAO_OBSERVACOES"; + + @Action(isSave = false) + public static final String CREATE_EXAME = "CREATE_EXAME"; + + @Action(isSave = false) + public static final String CREATE_EXAME_MARCACAO = "CREATE_EXAME_MARCACAO"; + + @Action(isSave = false) + public static final String CREATE_EXAME_MARCACAO_EMAIL = "CREATE_EXAME_MARCACAO_EMAIL"; + + @Action(isSave = false) + public static final String CREATE_EXAME_MARCACAO_OBSERVACOES = "CREATE_EXAME_MARCACAO_OBSERVACOES"; + + @Action(isSave = true) + public static final String SAVE_PROCESSO = "SAVE_PROCESSO"; + + @Action(isSave = true) + public static final String SAVE_LEMBRETE = "SAVE_LEMBRETE"; + + @Action(isSave = true) + public static final String SAVE_CONSULTA = "SAVE_CONSULTA"; + + @Action(isSave = true) + public static final String SAVE_CONSULTA_MARCACAO = "SAVE_CONSULTA_MARCACAO"; + + @Action(isSave = true) + public static final String SAVE_CONSULTA_MARCACAO_EMAIL = "SAVE_CONSULTA_MARCACAO_EMAIL"; + + @Action(isSave = true) + public static final String SAVE_CONSULTA_MARCACAO_OBSERVACOES = "SAVE_CONSULTA_MARCACAO_OBSERVACOES"; + + @Action(isSave = true) + public static final String SAVE_FICHA = "SAVE_FICHA"; + + @Action(isSave = true) + public static final String SAVE_EXAME = "SAVE_EXAME"; + + @Action(isSave = true) + public static final String SAVE_EXAME_MARCACAO = "SAVE_EXAME_MARCACAO"; + + @Action(isSave = true) + public static final String SAVE_EXAME_MARCACAO_EMAIL = "SAVE_EXAME_MARCACAO_EMAIL"; + + @Action(isSave = true) + public static final String SAVE_EXAME_MARCACAO_OBSERVACOES = "SAVE_EXAME_MARCACAO_OBSERVACOES"; + + @Action(isSave = true) + public static final String FECHAR_PROCESSO = "FECHAR_PROCESSO"; + + @Action(isSave = false) + public static final String APAGAR_PROCESSO = "APAGAR_PROCESSO"; + + @Action(isSave = false) + public static final String APAGAR_CONSULTA = "APAGAR_CONSULTA"; + + @Action(isSave = false) + public static final String APAGAR_CONSULTA_MARCACAO = "APAGAR_CONSULTA_MARCACAO"; + + @Action(isSave = false) + public static final String APAGAR_EXAME = "APAGAR_EXAME"; + + @Action(isSave = false) + public static final String APAGAR_EXAME_MARCACAO = "APAGAR_EXAME_MARCACAO"; + + @Action(isSave = false) + public static final String REFRESH = "REFRESH"; + + @Action(isSave = false) + public static final String CLOSE = "CLOSE"; + + @Action(isSave = true) + public static final String DESMARCAR_SIPRP_CONSULTA_MARCACAO = "DESMARCAR_SIPRP_CONSULTA_MARCACAO"; + + @Action(isSave = true) + public static final String DESMARCAR_TRABALHADOR_CONSULTA_MARCACAO = "DESMARCAR_TRABALHADOR_CONSULTA_MARCACAO"; + + @Action(isSave = true) + public static final String REALIZAR_CONSULTA_MARCACAO = "REALIZAR_CONSULTA_MARCACAO"; + + @Action(isSave = true) + public static final String FALTOU_CONSULTA_MARCACAO = "FALTOU_CONSULTA_MARCACAO"; + + @Action(isSave = true) + public static final String DESMARCAR_SIPRP_EXAME_MARCACAO = "DESMARCAR_SIPRP_EXAME_MARCACAO"; + + @Action(isSave = true) + public static final String DESMARCAR_TRABALHADOR_EXAME_MARCACAO = "DESMARCAR_TRABALHADOR_EXAME_MARCACAO"; + + @Action(isSave = true) + public static final String REALIZAR_EXAME_MARCACAO = "REALIZAR_EXAME_MARCACAO"; + + @Action(isSave = true) + public static final String REALIZAR_PARCIAL_EXAME_MARCACAO = "REALIZAR_PARCIAL_EXAME_MARCACAO"; + + @Action(isSave = true) + public static final String FALTOU_EXAME_MARCACAO = "FALTOU_EXAME_MARCACAO"; + + @Action(isSave = true) + public static final String ANULAR_EXAME_MARCACAO = "ANULAR_EXAME_MARCACAO"; + + private LembretesDataProvider lembretesDataProvider = null; + + private MedicinaDAO provider = null; + + public Empresas currentEmpresa = null; + + public Estabelecimentos currentEstabelecimento = null; + + @LeafObject(useWith = LOAD_TRABALHADOR) + public Trabalhadores currentTrabalhador = null; + + @LeafObject(useWith = { + SAVE_PROCESSO, APAGAR_PROCESSO + }) + public TrabalhadoresProcesso currentProcesso = null; + + @LeafObject(useWith = { + SAVE_CONSULTA, APAGAR_CONSULTA + }) + public TrabalhadoresConsultas currentConsulta = null; + + @LeafObject(useWith = { + SAVE_CONSULTA_MARCACAO, APAGAR_CONSULTA_MARCACAO + }) + public TrabalhadoresConsultasDatas currentConsultaMarcacao = null; + + @LeafObject(useWith = SAVE_CONSULTA_MARCACAO_EMAIL) + public TrabalhadoresConsultasDatasEmails currentConsultaMarcacaoEmail = null; + + @LeafObject(useWith = SAVE_CONSULTA_MARCACAO_OBSERVACOES) + public TrabalhadoresConsultasDatasObservacoes currentConsultaMarcacaoObservacao = null; + + @LeafObject(useWith = SAVE_FICHA) + public TrabalhadoresFichasAptidao currentFicha = null; + + @LeafObject(useWith = SAVE_EXAME_MARCACAO_OBSERVACOES) + public TrabalhadoresEcdsDatasObservacoes currentExameMarcacaoObservacao = null; + + @LeafObject(useWith = SAVE_EXAME_MARCACAO_EMAIL) + public TrabalhadoresEcdsDatasEmails currentExameMarcacaoEmail = null; + + @LeafObject(useWith = { + SAVE_EXAME_MARCACAO, REALIZAR_PARCIAL_EXAME_MARCACAO, APAGAR_EXAME_MARCACAO + }) + public TrabalhadoresEcdsDatas currentExameMarcacao = null; + + @LeafObject(useWith = { + SAVE_EXAME, APAGAR_EXAME + }) + public TrabalhadoresEcds currentExame = null; + + public Integer currentFichaExameID = null; + + public MedicinaProcessoLogic() + { + try + { + provider = new MedicinaDAO(); + lembretesDataProvider = new LembretesDataProvider(); + } catch( Exception e ) + { + e.printStackTrace( System.out ); + } + } + + @LeafLogicActionBinding(actions = { + ACTION_STARTUP + }) + public List getAllEmpresas() + { + return provider.getAllEmpresas(); + } + + @LeafLogicActionBinding(actions = { + SELECT_EMPRESA + }) + public Empresas setEmpresa( Empresas empresa ) + { + currentEmpresa = empresa; + return currentEmpresa; + } + + @LeafLogicActionBinding(actions = { + SELECT_ESTABELECIMENTO + }) + public Estabelecimentos setEstabelecimento( Estabelecimentos estabelecimento ) + { + currentEstabelecimento = estabelecimento; + return currentEstabelecimento; + } + + @LeafLogicActionBinding(actions = { + LOAD_TRABALHADOR + }) + public Trabalhadores getDadosTrabalhador( Trabalhadores trabalhador ) + { + // Trabalhadores result = null; + // if( id != null ) + // { + // result = provider.getTrabalhadorByID( id ); + // } + currentTrabalhador = trabalhador; + return currentTrabalhador; + } + + @LeafLogicActionBinding(actions = FECHAR_PROCESSO) + public void fecharProcesso() + { + if( currentProcesso != null ) + { + currentProcesso.setDataFim( new Date() ); + currentProcesso.setEstado( ProcessoConstants.PROCESSO_FECHADO_CODE ); + runActionLater( SAVE_PROCESSO ); + } + } + + @LeafLogicActionBinding(actions = APAGAR_PROCESSO) + public void apagarProcesso() + { + if( currentProcesso != null && currentProcesso.isEmpty() ) + { + currentProcesso.setActivo( "n" ); + runActionLater( SAVE_PROCESSO ); + } + } + + private void novoLembreteRemarcacao( String mensagem, boolean isConsulta ) + { + Integer tipoID = lembretesDataProvider.getTipoLembreteIDByCodigo( LembretesConstants.CODE_REMARCACOES ); + try + { + if( isConsulta && currentEmpresa != null && currentEstabelecimento != null && currentTrabalhador != null && currentConsultaMarcacao != null ) + { + lembretesDataProvider.criarLembreteConsulta( tipoID, new Date(), mensagem, null, currentEmpresa.getId(), currentEstabelecimento.getId(), currentTrabalhador.getId(), currentConsultaMarcacao.getId() ); + } + else + { + lembretesDataProvider.criarLembreteExame( tipoID, new Date(), mensagem, null, currentEmpresa.getId(), currentEstabelecimento.getId(), currentTrabalhador.getId(), currentExameMarcacao.getId() ); + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + } + + @LeafLogicActionBinding(actions = DESMARCAR_SIPRP_CONSULTA_MARCACAO) + public void desmarcarConsultaSiprp() + { + if( currentConsultaMarcacao != null ) + { + currentConsultaMarcacao.setEstado( MedicinaConstants.ESTADO_DESMARCADO_EMPRESA ); + novoLembreteRemarcacao( MedicinaConstants.LEMBRETE_DESMARCOU_SIPRP_STRING, true ); + runActionLater( SAVE_CONSULTA_MARCACAO ); + } + } + + @LeafLogicActionBinding(actions = DESMARCAR_TRABALHADOR_CONSULTA_MARCACAO) + public void desmarcarConsultaTrabalhador() + { + if( currentConsultaMarcacao != null ) + { + currentConsultaMarcacao.setEstado( MedicinaConstants.ESTADO_DESMARCADO_TRABALHADOR ); + novoLembreteRemarcacao( MedicinaConstants.LEMBRETE_DESMARCOU_TRABALHADOR_STRING, true ); + runActionLater( SAVE_CONSULTA_MARCACAO ); + } + } + + @LeafLogicActionBinding(actions = FALTOU_CONSULTA_MARCACAO) + public void faltouConsulta() + { + if( currentConsultaMarcacao != null ) + { + currentConsultaMarcacao.setEstado( MedicinaConstants.ESTADO_FALTOU ); + novoLembreteRemarcacao( MedicinaConstants.LEMBRETE_FALTOU_TRABALHADOR_STRING, true ); + runActionLater( SAVE_CONSULTA_MARCACAO ); + } + } + + @LeafLogicActionBinding(actions = REALIZAR_CONSULTA_MARCACAO) + public void realizarConsulta() + { + if( currentConsultaMarcacao != null ) + { + currentConsultaMarcacao.setEstado( MedicinaConstants.ESTADO_REALIZADO ); + runActionLater( SAVE_CONSULTA_MARCACAO ); + } + } + + @LeafLogicActionBinding(actions = DESMARCAR_SIPRP_EXAME_MARCACAO) + public void desmarcarExameSiprp() + { + if( currentExameMarcacao != null ) + { + currentExameMarcacao.desmarcarSIPRP(); + novoLembreteRemarcacao( MedicinaConstants.LEMBRETE_DESMARCOU_SIPRP_STRING, false ); + runActionLater( SAVE_EXAME_MARCACAO ); + } + } + + @LeafLogicActionBinding(actions = DESMARCAR_TRABALHADOR_EXAME_MARCACAO) + public void desmarcarExameTrabalhador() + { + if( currentExameMarcacao != null ) + { + currentExameMarcacao.desmarcarTrabalhador(); + novoLembreteRemarcacao( MedicinaConstants.LEMBRETE_DESMARCOU_TRABALHADOR_STRING, false ); + runActionLater( SAVE_EXAME_MARCACAO ); + } + } + + @LeafLogicActionBinding(actions = FALTOU_EXAME_MARCACAO) + public void faltouExame() + { + if( currentExameMarcacao != null ) + { + currentExameMarcacao.faltou(); + novoLembreteRemarcacao( MedicinaConstants.LEMBRETE_FALTOU_TRABALHADOR_STRING, false ); + runActionLater( SAVE_EXAME_MARCACAO ); + } + } + + @LeafLogicActionBinding(actions = ANULAR_EXAME_MARCACAO) + public void anularExame() + { + if( currentExameMarcacao != null ) + { + currentExameMarcacao.anular(); + runActionLater( SAVE_EXAME_MARCACAO ); + } + } + + @LeafLogicActionBinding(actions = REALIZAR_EXAME_MARCACAO) + public void realizarExame() + { + if( currentExameMarcacao != null ) + { + currentExameMarcacao.realizar(); + runActionLater( SAVE_EXAME_MARCACAO ); + } + } + + @LeafLogicActionBinding(actions = REALIZAR_PARCIAL_EXAME_MARCACAO) + public void realizarParcialExame() + { + if( currentExameMarcacao != null ) + { + runActionLater( SAVE_EXAME_MARCACAO ); + } + } + + @LeafLogicActionBinding(actions = SELECT_TRABALHADOR) + public Trabalhadores selectTrabalhador( Trabalhadores trabalhador ) + { + this.currentTrabalhador = trabalhador; + return this.currentTrabalhador; + } + + @LeafLogicActionBinding(actions = SELECT_PROCESSO) + public TrabalhadoresProcesso selectProcesso( TrabalhadoresProcesso processo ) + { + this.currentProcesso = processo; + return this.currentProcesso; + } + + @LeafLogicActionBinding(actions = SELECT_CONSULTA) + public TrabalhadoresConsultas selectConsulta( TrabalhadoresConsultas consulta ) + { + this.currentConsulta = consulta; + return this.currentConsulta; + } + + @LeafLogicActionBinding(actions = SELECT_CONSULTA_MARCACAO) + public TrabalhadoresConsultasDatas selectConsultaMarcacao( TrabalhadoresConsultasDatas consultaMarcacao ) + { + this.currentConsultaMarcacao = consultaMarcacao; + return this.currentConsultaMarcacao; + } + + @LeafLogicActionBinding(actions = SELECT_CONSULTA_MARCACAO_EMAIL) + public TrabalhadoresConsultasDatasEmails selectConsultaMarcacaoEmail( TrabalhadoresConsultasDatasEmails consultaMarcacaoEmail ) + { + this.currentConsultaMarcacaoEmail = consultaMarcacaoEmail; + return this.currentConsultaMarcacaoEmail; + } + + @LeafLogicActionBinding(actions = SELECT_CONSULTA_MARCACAO_OBSERVACAO) + public TrabalhadoresConsultasDatasObservacoes selectConsultaMarcacaoObservacoes( TrabalhadoresConsultasDatasObservacoes consultaMarcacaoObservacoes ) + { + this.currentConsultaMarcacaoObservacao = consultaMarcacaoObservacoes; + return this.currentConsultaMarcacaoObservacao; + } + + @LeafLogicActionBinding(actions = SELECT_EXAME) + public TrabalhadoresEcds selectExame( TrabalhadoresEcds exame ) + { + this.currentExame = exame; + return this.currentExame; + } + + @LeafLogicActionBinding(actions = SELECT_EXAME_MARCACAO) + public TrabalhadoresEcdsDatas selectExameMarcacao( TrabalhadoresEcdsDatas exameMarcacao ) + { + this.currentExameMarcacao = exameMarcacao; + return this.currentExameMarcacao; + } + + @LeafLogicActionBinding(actions = SELECT_EXAME_MARCACAO_EMAIL) + public TrabalhadoresEcdsDatasEmails selectExameMarcacaoEmail( TrabalhadoresEcdsDatasEmails exameMarcacaoEmail ) + { + this.currentExameMarcacaoEmail = exameMarcacaoEmail; + return this.currentExameMarcacaoEmail; + } + + @LeafLogicActionBinding(actions = SELECT_EXAME_MARCACAO_OBSERVACAO) + public TrabalhadoresEcdsDatasObservacoes selectExameMarcacaoObservacoes( TrabalhadoresEcdsDatasObservacoes exameMarcacaoObservacoes ) + { + this.currentExameMarcacaoObservacao = exameMarcacaoObservacoes; + return this.currentExameMarcacaoObservacao; + } + + @LeafLogicActionBinding(actions = SELECT_FICHA) + public TrabalhadoresFichasAptidao selectFichaAptidao( TrabalhadoresFichasAptidao ficha ) + { + this.currentFicha = ficha; + return this.currentFicha; + } + + @LeafLogicActionBinding(actions = { + SELECT_TREE_NODE + }) + public DefaultMutableTreeNode nodeSelected( DefaultMutableTreeNode node ) + { + String action = null; + if( node.getUserObject() == null ) + { + } + else if( node.getUserObject() instanceof Trabalhadores ) + { + action = SELECT_TRABALHADOR; + } + else if( node.getUserObject() instanceof TrabalhadoresProcesso ) + { + action = SELECT_PROCESSO; + } + else if( node.getUserObject() instanceof TrabalhadoresConsultas ) + { + action = SELECT_CONSULTA; + } + else if( node.getUserObject() instanceof TrabalhadoresConsultasDatas ) + { + action = SELECT_CONSULTA_MARCACAO; + } + else if( node.getUserObject() instanceof TrabalhadoresConsultasDatasObservacoes ) + { + action = SELECT_CONSULTA_MARCACAO_OBSERVACAO; + } + else if( node.getUserObject() instanceof TrabalhadoresConsultasDatasEmails ) + { + action = SELECT_CONSULTA_MARCACAO_EMAIL; + } + else if( node.getUserObject() instanceof TrabalhadoresEcds ) + { + action = SELECT_EXAME; + } + else if( node.getUserObject() instanceof TrabalhadoresEcdsDatas ) + { + action = SELECT_EXAME_MARCACAO; + } + else if( node.getUserObject() instanceof TrabalhadoresEcdsDatasEmails ) + { + action = SELECT_EXAME_MARCACAO_EMAIL; + } + else if( node.getUserObject() instanceof TrabalhadoresEcdsDatasObservacoes ) + { + action = SELECT_EXAME_MARCACAO_OBSERVACAO; + } + else if( node instanceof FichaAptidaoMutableTreeNode ) + { + action = SELECT_FICHA; + } + runAction( action, node.getUserObject() ); + return node; + } + + @LeafLogicActionBinding(actions = { + CREATE_FICHA + }) + public void createFicha() + { + try + { + FichaWindow fichaWindow = FichaWindow.getWindow(); + if( fichaWindow != null ) + { + currentFicha = new TrabalhadoresFichasAptidao(); + currentFicha.setToTrabalhadoresProcesso( currentProcesso ); + Date data = getUltimaConsultaMarcacaoDateForProcesso(); + fichaWindow.editTrabalhador( currentTrabalhador.getId(), data, currentProcesso.getMotivo(), new SaveExameListener() + { + @Override + public void exameSaved( Integer trabalhadorID, Integer exameID ) + { + try + { + if( trabalhadorID != null && exameID != null ) + { + if( trabalhadorID.equals( currentTrabalhador.getId() ) ) + { + currentFichaExameID = exameID; + Exames exame = provider.getExameForExameID( currentFichaExameID ); + if( exame != null ) + { + currentFicha.setToExames( exame ); + currentFicha.save(); + runAction( REFRESH ); + } + } + } + } catch( Exception e ) + { + LeafDialog.error( e ); + } + } + } ); + } + } catch( Exception e ) + { + e.printStackTrace(); + } + } + + private Date getUltimaConsultaMarcacaoDateForProcesso() + { + Date result = null; + if( currentProcesso != null ) + { + List consultas = currentProcesso.getTrabalhadoresConsultasArray(); + for( TrabalhadoresConsultas consulta : consultas ) + { + if( new Integer( MedicinaConstants.ESTADO_REALIZADO ).equals( consulta.getEstado() ) ) + { + List marcacoes = consulta.getTrabalhadoresConsultasDatasArray(); + for( TrabalhadoresConsultasDatas marcacao : marcacoes ) + { + if( new Integer( MedicinaConstants.ESTADO_REALIZADO ).equals( marcacao.getEstado() ) ) + { + Date marcacaoDate = marcacao.getData(); + if( marcacaoDate != null && (result == null || result.before( marcacaoDate )) ) + { + result = marcacaoDate; + } + } + } + } + } + } + return result; + } + + @LeafLogicActionBinding(actions = { + CREATE_CONSULTA + }) + public TrabalhadoresConsultas createConsulta() + { + currentConsulta = new TrabalhadoresConsultas(); + currentConsulta.setToTrabalhadores( currentTrabalhador ); + currentConsulta.setToTrabalhadoresProcesso( currentProcesso ); + currentConsulta.setToPrestadores( getPrestador( true ) ); + currentConsulta.setEstado( MedicinaConstants.ESTADO_POR_REALIZAR ); + return currentConsulta; + } + + @LeafLogicActionBinding(actions = { + CREATE_CONSULTA_MARCACAO + }) + public TrabalhadoresConsultasDatas createConsultaMarcacao() + { + currentConsultaMarcacao = new TrabalhadoresConsultasDatas(); + currentConsultaMarcacao.setToTrabalhadoresConsultas( currentConsulta ); + currentConsultaMarcacao.setToPrestadores( getPrestador( true ) ); + currentConsultaMarcacao.setEstado( MedicinaConstants.ESTADO_POR_REALIZAR ); + runActionLater( SAVE_CONSULTA_MARCACAO ); + return currentConsultaMarcacao; + } + + @LeafLogicActionBinding(actions = { + CREATE_CONSULTA_MARCACAO_EMAIL + }) + public TrabalhadoresConsultasDatasEmails createConsultaMarcacaoEmails() + { + currentConsultaMarcacaoEmail = new TrabalhadoresConsultasDatasEmails(); + currentConsultaMarcacaoEmail.setToTrabalhadoresConsultasDatas( currentConsultaMarcacao ); + runActionLater( SAVE_CONSULTA_MARCACAO_EMAIL ); + return currentConsultaMarcacaoEmail; + } + + @LeafLogicActionBinding(actions = { + CREATE_CONSULTA_MARCACAO_EMAIL_VACINAS + }) + public TrabalhadoresConsultasDatasEmails createConsultaMarcacaoEmailsVacinas() + { + currentConsultaMarcacaoEmail = new TrabalhadoresConsultasDatasEmails(); + currentConsultaMarcacaoEmail.setToTrabalhadoresConsultasDatas( currentConsultaMarcacao ); + runActionLater( SAVE_CONSULTA_MARCACAO_EMAIL ); + return currentConsultaMarcacaoEmail; + } + + @LeafLogicActionBinding(actions = { + CREATE_CONSULTA_MARCACAO_OBSERVACOES + }) + public TrabalhadoresConsultasDatasObservacoes createConsultaMarcacaoObservacoes() + { + currentConsultaMarcacaoObservacao = new TrabalhadoresConsultasDatasObservacoes(); + currentConsultaMarcacaoObservacao.setToTrabalhadoresConsultasDatas( currentConsultaMarcacao ); + runActionLater( SAVE_CONSULTA_MARCACAO_OBSERVACOES ); + return currentConsultaMarcacaoObservacao; + } + + @LeafLogicActionBinding(actions = CREATE_EXAME) + public TrabalhadoresEcds createExame() + { + currentExame = new TrabalhadoresEcds(); + currentExame.setToTrabalhadores( currentTrabalhador ); + currentExame.setToTrabalhadoresProcesso( currentProcesso ); + currentExame.setEstado( MedicinaConstants.ESTADO_POR_REALIZAR ); + runActionLater( SAVE_EXAME ); + return currentExame; + } + + @LeafLogicActionBinding(actions = CREATE_EXAME_MARCACAO) + public TrabalhadoresEcdsDatas createExameMarcacao() + { + currentExameMarcacao = new TrabalhadoresEcdsDatas(); + currentExameMarcacao.setToTrabalhadoresEcds( currentExame ); + currentExameMarcacao.setToPrestadores( getPrestador( false ) ); + currentExameMarcacao.setToAnalisador( getAnalisador() ); + currentExameMarcacao.porRealizar(); + runActionLater( SAVE_EXAME_MARCACAO ); + return currentExameMarcacao; + } + + @LeafLogicActionBinding(actions = CREATE_EXAME_MARCACAO_OBSERVACOES) + public TrabalhadoresEcdsDatasObservacoes createExameMarcacaoObservacao() + { + currentExameMarcacaoObservacao = new TrabalhadoresEcdsDatasObservacoes(); + currentExameMarcacaoObservacao.setToTrabalhadoresEcdsDatas( currentExameMarcacao ); + runActionLater( SAVE_EXAME_MARCACAO_OBSERVACOES ); + return currentExameMarcacaoObservacao; + } + + @LeafLogicActionBinding(actions = CREATE_EXAME_MARCACAO_EMAIL) + public TrabalhadoresEcdsDatasEmails createExameMarcacaoEmail() + { + currentExameMarcacaoEmail = new TrabalhadoresEcdsDatasEmails(); + currentExameMarcacaoEmail.setToTrabalhadoresEcdsDatas( currentExameMarcacao ); + runActionLater( SAVE_EXAME_MARCACAO_EMAIL ); + return currentExameMarcacaoEmail; + } + + @LeafLogicActionBinding(actions = CREATE_PROCESSO) + public TrabalhadoresProcesso createProcesso() + { + currentProcesso = new TrabalhadoresProcesso(); + currentProcesso.setDataInicio( new Date() ); + currentProcesso.setEstado( ProcessoConstants.PROCESSO_ABERTO_CODE ); + currentProcesso.setToTrabalhadores( currentTrabalhador ); + currentProcesso.setActivo( "y" ); + runActionLater( SAVE_PROCESSO ); + return currentProcesso; + } + + @LeafLogicActionBinding(actions = CREATE_LEMBRETE) + public Lembretes createLembrete() + { + Lembretes result = new Lembretes(); + result.setToTrabalhadores( currentTrabalhador ); + result.setToEmpresas( currentEmpresa ); + result.setToEstabelecimentos( currentEstabelecimento ); + result.setToLembretesTipos( provider.getTipoLembretesCustomizavel() ); + runActionLater( SAVE_LEMBRETE, result ); + return result; + } + + @LeafLogicActionBinding(actions = { + SAVE_PROCESSO, SAVE_LEMBRETE, SAVE_CONSULTA, SAVE_CONSULTA_MARCACAO, SAVE_CONSULTA_MARCACAO_EMAIL, SAVE_CONSULTA_MARCACAO_OBSERVACOES, SAVE_EXAME, SAVE_EXAME_MARCACAO, SAVE_EXAME_MARCACAO_EMAIL, SAVE_EXAME_MARCACAO_OBSERVACOES + }) + public void saveObject( BaseObject object ) + { + try + { + object.save(); + runActionLater( REFRESH ); + } catch( Exception e ) + { + LeafDialog.error(e); + } + } + + @LeafLogicActionBinding(actions = { + APAGAR_CONSULTA, APAGAR_EXAME + }) + public void deleteObject( BaseObject object ) + { + if( object instanceof TrabalhadoresConsultas ) + { + apagarConsulta( (TrabalhadoresConsultas) object ); + } + if( object instanceof TrabalhadoresEcds ) + { + apagarExame( (TrabalhadoresEcds) object ); + } + runActionLater( SELECT_PROCESSO ); + } + + private void apagarConsulta( TrabalhadoresConsultas consulta ) + { + try + { + List marcacoes = consulta.getTrabalhadoresConsultasDatasArray(); + if( marcacoes != null ) + { + for( TrabalhadoresConsultasDatas marcacao : marcacoes ) + { + List emails = marcacao.getTrabalhadoresConsultasDatasEmailsArray(); + if( emails != null ) + { + for( TrabalhadoresConsultasDatasEmails email : emails ) + { + email.delete(); + } + } + List observacoes = marcacao.getTrabalhadoresConsultasDatasObservacoesArray(); + if( observacoes != null ) + { + for( TrabalhadoresConsultasDatasObservacoes observacao : observacoes ) + { + observacao.delete(); + } + } + marcacao.delete(); + } + consulta.delete(); + } + } catch( Exception e ) + { + LeafDialog.error(e); + } + } + + private void apagarExame( TrabalhadoresEcds exame ) + { + try + { + List marcacoes = exame.getTrabalhadoresEcdsDatasArray(); + if( marcacoes != null ) + { + for( TrabalhadoresEcdsDatas marcacao : marcacoes ) + { + List ecds = marcacao.getTrabalhadoresEcdArray(); + if( ecds != null ) + { + for( TrabalhadoresEcd ecd : ecds ) + { + ecd.delete(); + } + } + List emails = marcacao.getTrabalhadoresEcdsDatasEmailsArray(); + if( emails != null ) + { + for( TrabalhadoresEcdsDatasEmails email : emails ) + { + email.delete(); + } + } + List observacoes = marcacao.getTrabalhadoresEcdsDatasObservacoesArray(); + if( observacoes != null ) + { + for( TrabalhadoresEcdsDatasObservacoes observacao : observacoes ) + { + observacao.delete(); + } + } + marcacao.delete(); + } + exame.delete(); + } + } catch( Exception e ) + { + LeafDialog.error(e); + } + } + + @LeafLogicActionBinding(actions = ACTION_CANCEL) + public void abortAction() + { + provider.rollback(); + runAction( LOAD_TRABALHADOR ); + runAction( SELECT_TRABALHADOR ); + } + + private Prestadores getPrestador( boolean consulta ) + { + Prestadores result = null; + if( currentTrabalhador != null && currentTrabalhador.getToEstabelecimentos() != null ) + { + result = consulta ? currentTrabalhador.getToEstabelecimentos().getToPrestadores() : currentTrabalhador.getToEstabelecimentos().getToPrestadores1(); + if( Prestadores.prestadorNulo.equals( result ) ) + { + result = null; + } + } + return result; + } + + private Prestadores getAnalisador() + { + return getPrestador( false ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/ColorChooserDialog.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/ColorChooserDialog.java new file mode 100644 index 00000000..c3ffbbaa --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/ColorChooserDialog.java @@ -0,0 +1,102 @@ +package siprp.medicina.processo.mail; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JButton; +import javax.swing.JColorChooser; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import javax.swing.colorchooser.AbstractColorChooserPanel; + +import com.evolute.utils.ui.CustomJDialog; + +public class ColorChooserDialog extends CustomJDialog + implements ActionListener +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + protected JColorChooser colorChooser; + protected JButton okButton; + protected JButton cancelButton; + + protected Color initialColor; + protected Color selectedColor; + + public ColorChooserDialog( JFrame owner, Color color ) + { + super( owner, true ); + initialColor = color; + setupComponents(); + if( owner != null ) + { + centerSuper(); + } + else + { + center(); + } + } + + private void setupComponents() + { + setTitle( "Escolha a cor" ); + colorChooser = new JColorChooser( initialColor ); + + colorChooser.setChooserPanels( new AbstractColorChooserPanel[]{ colorChooser.getChooserPanels()[ 0 ] } ); + colorChooser.setPreviewPanel( new JPanel() ); + okButton = new JButton( "OK" ); + cancelButton = new JButton( "Cancelar" ); + + setLayout( new BorderLayout() ); + add( colorChooser, BorderLayout.CENTER ); + JPanel buttonPanel = new JPanel(); + add( buttonPanel, BorderLayout.SOUTH ); + + buttonPanel.setLayout( new FlowLayout( FlowLayout.CENTER ) ); + buttonPanel.add( okButton ); + buttonPanel.add( cancelButton ); + + okButton.addActionListener( this ); + cancelButton.addActionListener( this ); + pack(); + } + + @Override + public void actionPerformed(ActionEvent e) + { + Object source = e.getSource(); + if( source.equals( okButton ) ) + { + selectedColor = colorChooser.getColor(); + close(); + } + else + { + close(); + } + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable(){ + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + public Color getColor() + { + return selectedColor; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/MailDialog.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/MailDialog.java new file mode 100644 index 00000000..bc2767ab --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/MailDialog.java @@ -0,0 +1,645 @@ +package siprp.medicina.processo.mail; + +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.FileDialog; +import java.awt.FlowLayout; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.File; +import java.util.Arrays; +import java.util.Comparator; +import java.util.LinkedList; +import java.util.List; +import java.util.Vector; + +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.ActionMap; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.SwingUtilities; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.text.AttributeSet; +import javax.swing.text.DefaultEditorKit; +import javax.swing.text.StyleConstants; +import javax.swing.text.StyledEditorKit; +import javax.swing.text.html.HTMLEditorKit; + +import com.evolute.utils.images.ImageIconLoader; +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.VectorTableModel; +import com.evolute.utils.ui.CustomJDialog; + +public class MailDialog extends CustomJDialog +{ + /** + * + */ + private static final long serialVersionUID = 1L; + protected StyledEditorKit.FontSizeAction FONT_SIZE_ACTIONS[]; + protected int FONT_SIZES[]; + + protected JFrame owner; + + protected JTextField toText; + protected JTextField bccText; + protected JTextField subjectText; + protected BaseTable attachmentsTable; + protected VectorTableModel attachmentsModel; + protected JTextPane bodyPane; + + protected Action removeAttachmentAction; + + private boolean sent = false; +// +// public static void main( String args[] ) +// throws Exception +// { +// MailDialog mailDialog = new MailDialog( null ); +// mailDialog.setTo( "fredPalma@netcabo.pt" ); +// mailDialog.setBcc( "fpalma@evolute.pt" ); +// mailDialog.setSubject( "SIPRP - Marca\u00E7\u00E3o de consulta de 'Frederico Palma'" ); +// mailDialog.setMessage( +// "

" +// + "Vimos pelo presente informar que 'Frederico Palma' deverá comparecer " +// + "nas nossas instalações para a realização da consulta de Medicina " +// + "do Trabalho, no dia '10-01-2008', pelas 08H30. " +// + "

" +// + "

" +// + "Solicitamos, também, que o colaborador seja portador do Boletim de Vacinas e " +// + "dos últimos exames complementares realizados." +// + "

" +// + "

" +// + "Caso não seja possível a comparência deste colaborador na data " +// + "indicada, contacte-nos, por favor, através do telefone 21 350 45 40 " +// + "ou respondendo ao remetente desta mensagem." +// + "

" +// + "

" +// + "Cumprimentos," +// + "

" +// + "

" +// + "SIPRP" +//// color=\"#497895\" +// + "

" +// + "

" +// + "ATRIUM SALDANHA" +// + "

" +// + "

" +// + "Praça Duque de Saldanha, 1 - 9ºG" +// + "

" +// + "

" +// + "1050-094 Lisboa" +// + "

" ); +// mailDialog.setSize( 1024, 768 ); +// mailDialog.setVisible( true ); +// System.exit( 0 ); +// } + + private final String[] additionalBCCs; + + public MailDialog( JFrame owner, String to, String bcc, String subject, String message, Vector files, String ... additionalBCCs) + throws Exception + { + super( owner, true ); + this.additionalBCCs = additionalBCCs; + this.owner = owner; + commonStartup(); + setTo( to ); + setBcc( bcc ); + setSubject( subject ); + setMessage( message ); + attach( files ); + setModal( true ); + setSize( 800, 600 ); + setLocationRelativeTo( null ); + setVisible( true ); + } + +// public MailDialog( JFrame owner ) +// throws Exception +// { +// super( owner, true ); +// this.owner = owner; +// commonStartup(); +// setModal( true ); +// setSize( 1024, 768 ); +// setVisible( true ); +// } + + private void commonStartup() + throws Exception + { + setupComponents(); + if( owner != null ) + { + centerSuper(); + } + else + { + center(); + } + } + + private void setupComponents() + throws Exception + { + setLayout( new BorderLayout() ); + JPanel headerPanel = new JPanel(); + setupHeaderComponents( headerPanel ); + add( headerPanel, BorderLayout.NORTH ); + JPanel htmlPanel = new JPanel(); + setupHTMLComponents( htmlPanel ); + add( htmlPanel, BorderLayout.CENTER ); + } + + private void setupHeaderComponents( JPanel headerPanel ) + throws Exception + { + Action sendAction = new AbstractAction( "send" ){ + /** + * + */ + private static final long serialVersionUID = 1L; + + public void actionPerformed( ActionEvent e ) + { + try + { + setCursor( new Cursor(Cursor.WAIT_CURSOR) ); + send(); + } + finally + { + setCursor( new Cursor(Cursor.DEFAULT_CURSOR ) ); + } + close(); + } + }; + sendAction.putValue( Action.SHORT_DESCRIPTION, "Enviar" ); + JButton sendButton = createButton( sendAction, "siprp/medicina/processo/mail/icons/mail2.png" ); + Action attachAction = new AbstractAction( "attach" ){ + /** + * + */ + private static final long serialVersionUID = 1L; + + public void actionPerformed( ActionEvent e ) + { + FileDialog fd = new FileDialog( owner, "Escolha um ficheiro", FileDialog.LOAD ); + fd.setDirectory( System.getProperty( "user.home" ) ); + fd.setVisible( true ); + // String filename = "c:\\test.xls"; + String filename = fd.getFile(); + if( filename != null ) + { + String dir = fd.getDirectory(); + attach( filename, dir ); + } + } + }; + attachAction.putValue( Action.SHORT_DESCRIPTION, "Acrescentar anexo" ); + JButton attachButton = createButton( attachAction, "siprp/medicina/processo/mail/icons/mail_attachment.png" ); + removeAttachmentAction = new AbstractAction( "remove-attachment" ){ + /** + * + */ + private static final long serialVersionUID = 1L; + + public void actionPerformed( ActionEvent e ) + { + int selected = attachmentsTable.getSelectedRow(); + if( selected > -1 && selected < attachmentsTable.getRowCount() ) + { + attachmentsModel.removeRowAt( selected ); + } + } + }; + removeAttachmentAction.putValue( Action.SHORT_DESCRIPTION, "Remover anexo" ); + JButton removeAttachmentButton = createButton( removeAttachmentAction, "siprp/medicina/processo/mail/icons/delete2.png" ); + removeAttachmentAction.setEnabled( false ); + + JPanel buttonPanel = new JPanel(); + buttonPanel.setLayout( new GridLayout( 1, 2 ) ); + JPanel leftButtonPanel = new JPanel(); + buttonPanel.add( leftButtonPanel ); + JPanel rightButtonPanel = new JPanel(); +// buttonPanel.add( rightButtonPanel ); + leftButtonPanel.setLayout( new FlowLayout( FlowLayout.LEFT ) ); + leftButtonPanel.add( sendButton ); + rightButtonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) ); + rightButtonPanel.add( attachButton ); + rightButtonPanel.add( removeAttachmentButton ); + + JLabel toLabel = new JLabel( "Para:" ); + toText = new JTextField(); + JLabel bccLabel = new JLabel( "C\u00f3pia:" ); + bccText = new JTextField(); + JLabel assuntoLabel = new JLabel( "Assunto:" ); + subjectText = new JTextField(); + attachmentsModel = new VectorTableModel( new String[]{ "" } ); + attachmentsTable = new BaseTable( attachmentsModel ); +// JScrollPane attachmentsScroll = new JScrollPane( attachmentsTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, +// JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED ); + attachmentsTable.getSelectionModel().addListSelectionListener( new ListSelectionListener(){ + + @Override + public void valueChanged(ListSelectionEvent e) + { + removeAttachmentAction.setEnabled( attachmentsTable.getSelectedRow() != -1 ); + } + + } ); + + TableLayout layout = + new TableLayout( + new double[]{ TableLayoutConstraints.MINIMUM, TableLayoutConstraints.FILL }, + new double[]{ TableLayoutConstraints.PREFERRED, TableLayoutConstraints.MINIMUM, TableLayoutConstraints.MINIMUM, + TableLayoutConstraints.MINIMUM } ); + layout.setHGap( 2 ); + layout.setVGap( 2 ); + + headerPanel.setLayout( layout ); + headerPanel.add( buttonPanel, new TableLayoutConstraints( 0, 0, 1, 0 ) ); + headerPanel.add( toLabel, new TableLayoutConstraints( 0, 1 ) ); + headerPanel.add( toText, new TableLayoutConstraints( 1, 1 ) ); +// headerPanel.add( attachmentsScroll, new TableLayoutConstraints( 2, 1, 2, 3 ) ); + headerPanel.add( bccLabel, new TableLayoutConstraints( 0, 2 ) ); + headerPanel.add( bccText, new TableLayoutConstraints( 1, 2 ) ); + headerPanel.add( assuntoLabel, new TableLayoutConstraints( 0, 3 ) ); + headerPanel.add( subjectText, new TableLayoutConstraints( 1, 3 ) ); + } + + private void setupHTMLComponents( JPanel htmlPanel ) + throws Exception + { + HTMLEditorKit kit = new HTMLEditorKit(); + Action actions[] = kit.getActions(); + Vector fontSizeActions = + new Vector(); + for( int n = 0; n < actions.length; n++ ) + { + String str = actions[ n ].getValue( Action.NAME ).toString(); + if( str.toLowerCase().indexOf( "font-size" ) != -1 ) + { + int size = Integer.parseInt( str.split( "-" )[ 2 ] ); + if( size == 16 ) + { + continue; + } + fontSizeActions.add( ( StyledEditorKit.FontSizeAction ) actions[ n ] ); + } + } + + FONT_SIZE_ACTIONS = fontSizeActions.toArray( new StyledEditorKit.FontSizeAction[ fontSizeActions.size() ] ); + Arrays.sort( FONT_SIZE_ACTIONS, new Comparator(){ + public int compare( StyledEditorKit.FontSizeAction fsa1, StyledEditorKit.FontSizeAction fsa2 ) + { + String str1 = fsa1.getValue( Action.NAME ).toString(); + String str2 = fsa2.getValue( Action.NAME ).toString(); + int size1 = Integer.parseInt( str1.split( "-" )[ 2 ] ); + int size2 = Integer.parseInt( str2.split( "-" )[ 2 ] ); + return size1 > size2 ? 1 : -1; + } + } ); + FONT_SIZES = new int[ FONT_SIZE_ACTIONS.length ]; + for( int n = 0; n < FONT_SIZES.length; n++ ) + { + FONT_SIZES[ n ] = Integer.parseInt( FONT_SIZE_ACTIONS[ n ].getValue( Action.NAME ).toString().split( "-" )[ 2 ] ); + } + + bodyPane = new JTextPane(); + bodyPane.setEditorKit( kit ); + ActionMap actionMap = bodyPane.getActionMap(); + + Action cutAction = actionMap.get( DefaultEditorKit.cutAction ); + cutAction.putValue( Action.SHORT_DESCRIPTION, "Cortar" ); + Action copyAction = actionMap.get( DefaultEditorKit.copyAction ); + copyAction.putValue( Action.SHORT_DESCRIPTION, "Copiar" ); + Action pasteAction = actionMap.get( DefaultEditorKit.pasteAction ); + pasteAction.putValue( Action.SHORT_DESCRIPTION, "Colar" ); + + Action boldAction = actionMap.get( "font-bold" ); + boldAction.putValue( Action.SHORT_DESCRIPTION, "Bold" ); + Action italicAction = actionMap.get( "font-italic" ); + italicAction.putValue( Action.SHORT_DESCRIPTION, "It\u00e1lico" ); + Action underlineAction = actionMap.get( "font-underline" ); + underlineAction.putValue( Action.SHORT_DESCRIPTION, "Sublinhado" ); + Action fontBiggerAction = new StyledEditorKit.FontSizeAction( "font-bigger", 30 ){ + /** + * + */ + private static final long serialVersionUID = 1L; + + public void actionPerformed( ActionEvent e ) + { + + int start = bodyPane.getSelectionStart(); + AttributeSet set = bodyPane.getStyledDocument().getCharacterElement( start ).getAttributes(); + int size = StyleConstants.getFontSize( set ); + for( int n = 0; n < FONT_SIZES.length; n++ ) + { + if( size < FONT_SIZES[ n ] ) + { + FONT_SIZE_ACTIONS[ n ].actionPerformed( e ); + break; + } + } + bodyPane.requestFocusInWindow(); + } + }; + fontBiggerAction.putValue( Action.SHORT_DESCRIPTION, "Fonte maior" ); + Action fontSmallerAction = + new StyledEditorKit.FontSizeAction( "font-smaller", 5 ){ + /** + * + */ + private static final long serialVersionUID = 1L; + + public void actionPerformed( ActionEvent e ) + { + + int start = bodyPane.getSelectionStart(); + AttributeSet set = bodyPane.getStyledDocument().getCharacterElement( start ).getAttributes(); + int size = StyleConstants.getFontSize( set ); + for( int n = FONT_SIZES.length - 1; n >= 0; n-- ) + { + if( size > FONT_SIZES[ n ] ) + { + FONT_SIZE_ACTIONS[ n ].actionPerformed( e ); + break; + } + } + bodyPane.requestFocusInWindow(); + } + }; + fontSmallerAction.putValue( Action.SHORT_DESCRIPTION, "Fonte menor" ); + Action colorAction = + new StyledEditorKit.ForegroundAction( "color", Color.black ){ + /** + * + */ + private static final long serialVersionUID = 1L; + + public void actionPerformed( ActionEvent e ) + { + ColorChooserDialog dialog = new ColorChooserDialog( owner, Color.black ); + dialog.setVisible( true ); + Color color = dialog.getColor(); + if( color != null ) + { + bodyPane.requestFocusInWindow(); + Action colorTempAction = new StyledEditorKit.ForegroundAction( "color-temp", color ); + bodyPane.getActionMap().put( "color-temp", colorTempAction ); + colorTempAction.actionPerformed( e ); + } + bodyPane.requestFocusInWindow(); + } + }; + colorAction.putValue( Action.SHORT_DESCRIPTION, "C\u00f4r" ); + String fontFamilies[] = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); + JComboBox fontCombo = new JComboBox(); + for( int n = 0; n < fontFamilies.length; n++ ) + { + fontCombo.addItem( fontFamilies[ n ] ); + } + fontCombo.addItemListener( new ItemListener(){ + + @Override + public void itemStateChanged(ItemEvent e) + { + String selected = ( String ) e.getItem(); + Action fontFamilyAction = + new StyledEditorKit.FontFamilyAction( "font-family-action" , selected ); + bodyPane.getActionMap().put( "font-family-action", fontFamilyAction ); + fontFamilyAction.actionPerformed( + new ActionEvent( e.getSource(), e.getID(), "" ) ); + bodyPane.requestFocusInWindow(); + } + } ); + + Action alignLeftAction = actionMap.get( "left-justify" ); + alignLeftAction.putValue( Action.SHORT_DESCRIPTION, "Alinhado \u00e0 esquerda" ); + Action alignCenterAction = actionMap.get( "center-justify" ); + alignCenterAction.putValue( Action.SHORT_DESCRIPTION, "Centrado" ); + Action alignRightAction = actionMap.get( "right-justify" ); + alignRightAction.putValue( Action.SHORT_DESCRIPTION, "Alinhado \u00e0 direita" ); + Action alignJustifyAction = + new StyledEditorKit.AlignmentAction( "justify", + javax.swing.text.StyleConstants.ALIGN_JUSTIFIED ); + actionMap.put( "justify", alignJustifyAction ); + alignJustifyAction.putValue( Action.SHORT_DESCRIPTION, "Justificado" ); + + JButton exportButton = new JButton( "X" ); + exportButton.addActionListener( new ActionListener(){ + public void actionPerformed( ActionEvent e ) + { + System.out.println( bodyPane.getText() ); + } + } ); + + JPanel upperPanel = new JPanel(); + upperPanel.setLayout( new FlowLayout( FlowLayout.LEFT ) ); + upperPanel.add( exportButton ); + upperPanel.add( createButton( cutAction, "siprp/medicina/processo/mail/icons/cut.png" ) ); + upperPanel.add( createButton( copyAction, "siprp/medicina/processo/mail/icons/copy.png" ) ); + upperPanel.add( createButton( pasteAction, "siprp/medicina/processo/mail/icons/paste.png" ) ); + upperPanel.add( new JLabel( " " ) ); + upperPanel.add( createButton( boldAction, "siprp/medicina/processo/mail/icons/text_bold.png" ) ); + upperPanel.add( createButton( italicAction, "siprp/medicina/processo/mail/icons/text_italics.png" ) ); + upperPanel.add( createButton( underlineAction, "siprp/medicina/processo/mail/icons/text_underlined.png" ) ); + upperPanel.add( createButton( fontBiggerAction, "siprp/medicina/processo/mail/icons/font_bigger.png" ) ); + upperPanel.add( createButton( fontSmallerAction, "siprp/medicina/processo/mail/icons/font_smaller.png" ) ); + upperPanel.add( createButton( colorAction, "siprp/medicina/processo/mail/icons/colorwheel.png" ) ); + upperPanel.add( fontCombo ); + upperPanel.add( new JLabel( " " ) ); + upperPanel.add( createButton( alignLeftAction, "siprp/medicina/processo/mail/icons/text_align_left.png" ) ); + upperPanel.add( createButton( alignCenterAction, "siprp/medicina/processo/mail/icons/text_align_center.png" ) ); + upperPanel.add( createButton( alignRightAction, "siprp/medicina/processo/mail/icons/text_align_right.png" ) ); + upperPanel.add( createButton( alignJustifyAction, "siprp/medicina/processo/mail/icons/text_align_justified.png" ) ); + + htmlPanel.setLayout( new BorderLayout() ); + + htmlPanel.add( upperPanel, BorderLayout.NORTH ); + htmlPanel.add( new JScrollPane( bodyPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ), BorderLayout.CENTER ); + } + + private JButton createButton( Action action, String iconPath ) + throws Exception + { + action.putValue( Action.SMALL_ICON, + ImageIconLoader.loadImageIcon( getClass(), iconPath ) ); + JButton button = new JButton( action ); + button.setText( null ); + + return button; + } + + public void setTo( String to ) + { + toText.setText( to ); + } + + public String getTo() + { + return toText.getText(); + } + + public void setBcc( String bcc ) + { + bccText.setText( bcc ); + } + + public String getBcc() + { + return bccText.getText(); + } + + public void setSubject( String subject ) + { + subjectText.setText( subject ); + } + + public String getSubject() + { + return subjectText.getText(); + } + + public void setMessage( String message ) + { + bodyPane.setText( message ); + } + + public String getMessage() + { + return bodyPane.getText(); + } + + public void send() + { +// close(); + String to = toText.getText(); + String bcc = bccText.getText(); + if( additionalBCCs != null ) + { + String bccconcat = ""; + for( String b : additionalBCCs ) + { + bccconcat += b + ", "; + } + bcc = bccconcat + bcc; + if( bcc.endsWith( ", " ) ) + { + bcc = bcc.substring( 0, bcc.length() - 2 ); + } + } + String subject = subjectText.getText(); + String body = bodyPane.getText(); + String attachmentList[] = new String[ attachmentsTable.getRowCount() ]; + List attachments = new LinkedList(); + Vector values = attachmentsModel.getValues(); + for( int n = 0; n < attachmentList.length; n++ ) + { + String str = values.elementAt( n ); + String name = str.substring( 0, str.indexOf( "(") - 1 ); + String path = str.substring( str.indexOf( "(") + 1, str.indexOf( ")") ); +// try +// { + File file = new File(path + name); + if( file != null && file.exists() ) + { + attachments.add(file); + } +// FileInputStream fis = new FileInputStream( path + name ); +// Vector bytes = new Vector(); +// int available = 0; +// int total = 0; +// while( ( available = fis.available() ) > 0 ) +// { +// byte b[] = new byte[ available ]; +// fis.read( b ); +// bytes.add( b ); +// total += available; +// } +// attachments[ n ] = new byte[ total ]; +// int pos = 0; +// for( byte[] chunk : bytes ) +// { +// System.arraycopy( chunk, 0, attachments[ n ], pos, chunk.length ); +// pos += chunk.length; +// } +// } +// catch( FileNotFoundException fnfex ) +// { +// JOptionPane.showMessageDialog( owner, +// "O ficheiro " + path + name + " n\u00e3o existe.", +// "Ficheiro inexistente", +// JOptionPane.ERROR_MESSAGE ); +// return; +// } +// catch( IOException ioex ) +// { +// DialogException.showExceptionMessage( ioex, "Erro a ler ficheiro " + path + name, true ); +// return; +// } + } + MailSender sender = new MailSender(); + try + { + sender.send( to, bcc, subject, body, attachmentList, attachments ); + sent = true; + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + + public boolean wasSent() + { + return sent; + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable(){ + public void run() + { + setVisible( false ); + dispose(); + } + } ); + + } + + private void attach( Vector files ) + { + for (File file : files ) + { + attach( file.getName(), file.getParent() + File.separator ); + } + } + + public void attach( String filename, String dir ) + { + String full = filename + " (" + dir + ")"; + Vector values = attachmentsModel.getValues(); + values.add( full ); + attachmentsModel.setValues( values ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/MailSender.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/MailSender.java new file mode 100644 index 00000000..58f8d71d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/MailSender.java @@ -0,0 +1,84 @@ +package siprp.medicina.processo.mail; + +import java.io.File; +import java.util.Date; +import java.util.List; +import java.util.Properties; + +import javax.activation.DataHandler; +import javax.activation.DataSource; +import javax.activation.FileDataSource; +import javax.mail.Address; +import javax.mail.Authenticator; +import javax.mail.Message; +import javax.mail.Multipart; +import javax.mail.PasswordAuthentication; +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; + +public class MailSender +{ + public static final String from = "departamentotecnico@siprp.pt"; + protected String mailServer = "mail2.evolute.pt"; + protected String userName = "auto@siprp.pt"; + protected String password = "sdfoyias78e"; + + public MailSender() + { + + } + + public void send( String to, String bcc, String subject, String body, String attachmentNames[], List attachments ) throws Exception + { + Properties props = System.getProperties(); + props.put( "mail.smtp.host", mailServer ); + props.put( "mail.smtp.auth", "true" ); + + Authenticator auth = new SMTPAuthenticator(); + Session session = Session.getInstance( props, auth ); + + MimeMessage msg = new MimeMessage( session ); + + msg.setFrom( new InternetAddress( from ) ); + msg.setReplyTo( new Address[]{ new InternetAddress(from)} ); + msg.setRecipients( Message.RecipientType.TO, InternetAddress.parse( to, true ) ); + msg.setRecipients( Message.RecipientType.CC, InternetAddress.parse( bcc, true ) ); + msg.setSubject( subject ); + + MimeBodyPart bodyPart = new MimeBodyPart(); + bodyPart.setContent( body,"text/html" ); + + Multipart multipart = new MimeMultipart(); + multipart.addBodyPart(bodyPart); + + if( attachmentNames != null && !attachments.isEmpty() ) + { + for(int i = 0; i < attachmentNames.length; ++i ) + { +// String attachName = attachmentNames[i]; + MimeBodyPart attachPart = new MimeBodyPart(); + DataSource dataSource = new FileDataSource(attachments.get(i)); + attachPart.setDataHandler( new DataHandler(dataSource)); + attachPart.setFileName(attachments.get(i).getName()); + multipart.addBodyPart(attachPart, i + 1); + } + } + msg.setContent(multipart); + msg.setHeader( "X-Mailer", "Evolute Mailer" ); + msg.setSentDate( new Date() ); + Transport.send( msg ); + } + + private class SMTPAuthenticator extends javax.mail.Authenticator + { + + public PasswordAuthentication getPasswordAuthentication() + { + return new PasswordAuthentication(userName, password); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/Thumbs.db b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/Thumbs.db new file mode 100644 index 00000000..d1514ff6 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/Thumbs.db differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/arrow_down.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/arrow_down.png new file mode 100644 index 00000000..ad8f6a36 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/arrow_down.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/colorwheel.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/colorwheel.png new file mode 100644 index 00000000..a655727e Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/colorwheel.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/copy.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/copy.png new file mode 100644 index 00000000..87cf5c96 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/copy.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/cut.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/cut.png new file mode 100644 index 00000000..bb623773 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/cut.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/delete2.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/delete2.png new file mode 100644 index 00000000..c617f7dc Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/delete2.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/font.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/font.png new file mode 100644 index 00000000..a87f6e45 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/font.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/font_bigger.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/font_bigger.png new file mode 100644 index 00000000..2f9217ee Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/font_bigger.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/font_smaller.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/font_smaller.png new file mode 100644 index 00000000..e7dafe03 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/font_smaller.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/mail2.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/mail2.png new file mode 100644 index 00000000..6315fdc2 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/mail2.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/mail_attachment.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/mail_attachment.png new file mode 100644 index 00000000..668440ad Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/mail_attachment.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/paste.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/paste.png new file mode 100644 index 00000000..e3397b27 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/paste.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_align_center.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_align_center.png new file mode 100644 index 00000000..fceafc18 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_align_center.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_align_justified.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_align_justified.png new file mode 100644 index 00000000..639e7f63 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_align_justified.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_align_left.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_align_left.png new file mode 100644 index 00000000..d930bf9d Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_align_left.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_align_right.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_align_right.png new file mode 100644 index 00000000..6570be7f Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_align_right.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_bold.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_bold.png new file mode 100644 index 00000000..4fb8dd90 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_bold.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_italics.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_italics.png new file mode 100644 index 00000000..14db2c1d Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_italics.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_underlined.png b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_underlined.png new file mode 100644 index 00000000..0e5fb06c Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/mail/icons/text_underlined.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ui/MedicinaProcessoWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ui/MedicinaProcessoWindow.java new file mode 100755 index 00000000..e72abc63 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ui/MedicinaProcessoWindow.java @@ -0,0 +1,212 @@ +package siprp.medicina.processo.ui; + +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CLOSE; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_LEMBRETE; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.REALIZAR_PARCIAL_EXAME_MARCACAO; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.Dimension; +import java.util.Date; +import java.util.List; + +import javax.swing.JSeparator; + +import leaf.ui.LeafCalendarDialog; +import leaf.ui.LeafOptionDialog; +import leaf.ui.LeafTextDialog; +import leaf.ui.LeafWindow; +import leaf.ui.LeafLogic.LeafUIActionBinding; +import siprp.MedicinaConstants; +import siprp.database.cayenne.objects.Lembretes; +import siprp.database.cayenne.objects.PrtGruposProtocolo; +import siprp.database.cayenne.objects.Trabalhadores; +import siprp.database.cayenne.objects.TrabalhadoresEcd; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatas; +import siprp.medicina.processo.logic.MedicinaProcessoLogic; + +import com.evolute.adt.OrderedMap; + +public class MedicinaProcessoWindow extends LeafWindow +{ + private static final long serialVersionUID = 1L; + + private static final Dimension WINDOW_DIMENSION = new Dimension( 1024, 700 ); + + public static final String TITLE = "Processos de Trabalhadores"; + + private static final Dimension DIMENSION_TRABALHADORES_CHOOSER = new Dimension( 0, 200 ); + private static final Dimension DIMENSION_PROCESSO_TOOLBAR = new Dimension( 150, 0 ); + + public final JSeparator separator = new JSeparator(); + @LeafPanel + public final ProcessoDadosPanel panelProcessoDados; + @LeafPanel + public final ProcessoAccoesPanel panelProcessoToolbar; + @LeafPanel + public final ProcessoTreePanel panelProcessoTree; + @LeafPanel + public final TrabalhadoresChooserPanel panelTrabalhadoresChooser; + + public MedicinaProcessoWindow() throws Exception + { + super( new MedicinaProcessoLogic() ); + panelProcessoDados = new ProcessoDadosPanel( this ); + panelProcessoToolbar = new ProcessoAccoesPanel( this ); + panelProcessoTree = new ProcessoTreePanel( this ); + panelTrabalhadoresChooser = new TrabalhadoresChooserPanel( this ); + + startup(); + } + + public MedicinaProcessoWindow(Trabalhadores trabalhador) throws Exception + { + super( new MedicinaProcessoLogic() ); + panelProcessoDados = new ProcessoDadosPanel( this ); + panelProcessoToolbar = new ProcessoAccoesPanel( this ); + panelProcessoTree = new ProcessoTreePanel( this ); + panelTrabalhadoresChooser = new TrabalhadoresChooserPanel( this ); + startup(); + runAction( MedicinaProcessoLogic.LOAD_TRABALHADOR, trabalhador ); + } + + private void startup() + { + setSize( WINDOW_DIMENSION ); + setTitle( TITLE ); + setupLayout(); + setupComponents(); + placeComponents(); + completeSetup(); + } + + private void setupLayout() + { + double[] cols = new double[] { + TableLayout.PREFERRED, TableLayout.FILL, TableLayout.FILL + }; + double[] rows = new double[] { + TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL + }; + TableLayout layout = new TableLayout( cols, rows ); + layout.setVGap( 5 ); + layout.setHGap( 5 ); + this.setLayout( layout ); + } + + private void setupComponents() + { + panelTrabalhadoresChooser.setPreferredSize( DIMENSION_TRABALHADORES_CHOOSER ); + panelProcessoToolbar.setPreferredSize( DIMENSION_PROCESSO_TOOLBAR ); + } + + private void placeComponents() + { + this.add( panelTrabalhadoresChooser, new TableLayoutConstraints( 0, 0, 2, 0 ) ); + this.add( separator, new TableLayoutConstraints( 0, 1, 2, 1 ) ); + this.add( panelProcessoToolbar, new TableLayoutConstraints( 0, 2 ) ); + this.add( panelProcessoTree, new TableLayoutConstraints( 1, 2 ) ); + this.add( panelProcessoDados, new TableLayoutConstraints( 2, 2 ) ); + } + + @LeafUIActionBinding(action = CLOSE) + public void closeWindow() + { + close(); + } + + @LeafUIActionBinding(action = REALIZAR_PARCIAL_EXAME_MARCACAO) + public void realizarExameParcial( TrabalhadoresEcdsDatas marcacao ) + { + boolean atLeastOneRealizado = false; + boolean atLeastOneFalta = false; + if( marcacao != null ) + { + List ecds = marcacao.getTrabalhadoresEcdArray(); + if( ecds != null ) + { + OrderedMap allGrupos = marcacao.getStatesForeGruposExames(); + OrderedMap grupos = new OrderedMap(); + for( int row = 0; row < allGrupos.rows(); ++row ) + { + List grupo = allGrupos.getRow( row ); + if( grupo != null && grupo.size() > 1 ) + { + String estado = grupo.get( 1 ).toString(); + if( MedicinaConstants.ESTADOS_EXAME_STR[MedicinaConstants.ESTADO_POR_REALIZAR].equals( estado ) ) + { + PrtGruposProtocolo key = allGrupos.getKeyForValue( grupo ); + grupos.addRow( key, grupo ); + } + } + } + + LeafOptionDialog option = new LeafOptionDialog( this, grupos, null, null, "Marcar falta para:", "Faltou >>" ); + List selected = option.getSelected(); + if( selected != null ) + { + for( TrabalhadoresEcd ecd : ecds ) + { + if( selected.contains( ecd.getToPrtTiposElementosProtocolo().getToPrtGruposProtocolo() ) ) + { + ecd.setEstado( MedicinaConstants.ESTADO_FALTOU ); + atLeastOneFalta = true; + } + else + { + ecd.setEstado( MedicinaConstants.ESTADO_REALIZADO ); + atLeastOneRealizado = true; + } + } + } + } + } + if( atLeastOneFalta ) + { + if( atLeastOneRealizado ) + { + marcacao.setEstado( MedicinaConstants.ESTADO_PARCIALMENTE_REALIZADO ); + } + else + { + marcacao.setEstado( MedicinaConstants.ESTADO_FALTOU ); + } + } + else + { + if( atLeastOneRealizado ) + { + marcacao.setEstado( MedicinaConstants.ESTADO_REALIZADO ); + } + else + { + } + } + } + + @LeafUIActionBinding(action = CREATE_LEMBRETE) + public void createLembrete( Lembretes lembrete ) + { + if( lembrete != null ) + { + Date date = new LeafCalendarDialog( this ).getDate(); + if( date != null && date.getTime() != 0 ) + { + String text = new LeafTextDialog( this, null, "", true ).getText(); + if( text != null && !text.trim().equals( "" ) ) + { + lembrete.setData( date ); + lembrete.setDescricao( text ); + } + else + { + abortAction( true ); + } + } + else + { + abortAction( true ); + } + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoAccoesPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoAccoesPanel.java new file mode 100755 index 00000000..3179b01b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoAccoesPanel.java @@ -0,0 +1,551 @@ +package siprp.medicina.processo.ui; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import static com.evolute.utils.strings.UnicodeLatin1Map.otilde; +import static info.clearthought.layout.TableLayoutConstants.FILL; +import static info.clearthought.layout.TableLayoutConstants.MINIMUM; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.ANULAR_EXAME_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.APAGAR_CONSULTA; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.APAGAR_CONSULTA_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.APAGAR_EXAME; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.APAGAR_EXAME_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.APAGAR_PROCESSO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_CONSULTA; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_CONSULTA_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_CONSULTA_MARCACAO_EMAIL; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_CONSULTA_MARCACAO_EMAIL_VACINAS; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_CONSULTA_MARCACAO_OBSERVACOES; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_EXAME; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_EXAME_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_EXAME_MARCACAO_EMAIL; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_EXAME_MARCACAO_OBSERVACOES; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_FICHA; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_LEMBRETE; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_PROCESSO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.DESMARCAR_SIPRP_CONSULTA_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.DESMARCAR_SIPRP_EXAME_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.DESMARCAR_TRABALHADOR_CONSULTA_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.DESMARCAR_TRABALHADOR_EXAME_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.FALTOU_CONSULTA_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.FALTOU_EXAME_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.FECHAR_PROCESSO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.LOAD_TRABALHADOR; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.REALIZAR_CONSULTA_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.REALIZAR_EXAME_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.REALIZAR_PARCIAL_EXAME_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_CONSULTA; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_CONSULTA_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_CONSULTA_MARCACAO_EMAIL; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_CONSULTA_MARCACAO_OBSERVACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_EXAME; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_EXAME_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_EXAME_MARCACAO_EMAIL; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_EXAME_MARCACAO_OBSERVACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_FICHA; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_PROCESSO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_TRABALHADOR; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.CardLayout; +import java.util.List; + +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JPanel; + +import leaf.ui.LeafButton; +import leaf.ui.LeafWindow; +import leaf.ui.LeafLogic.LeafUIActionBinding; +import leaf.ui.LeafWindow.ActionActivation; +import siprp.MedicinaConstants; +import siprp.ProcessoConstants; +import siprp.database.cayenne.objects.Trabalhadores; +import siprp.database.cayenne.objects.TrabalhadoresConsultas; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatas; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatasEmails; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatasObservacoes; +import siprp.database.cayenne.objects.TrabalhadoresEcds; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatas; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatasEmails; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatasObservacoes; +import siprp.database.cayenne.objects.TrabalhadoresFichasAptidao; +import siprp.database.cayenne.objects.TrabalhadoresProcesso; + +public class ProcessoAccoesPanel extends JPanel +{ + private static final long serialVersionUID = 1L; + + private final LeafWindow parentWindow; + + private static final String PANEL_START_NAME = "START_PANEL"; + + private static final String PANEL_TRABALHADOR_NAME = "TRABALHADOR_PANEL"; + + private static final String PANEL_PROCESSO_NAME = "PROCESSO_PANEL"; + + private static final String PANEL_FICHA_NAME = "PANEL_FICHA_NAME"; + + private static final String PANEL_CONSULTA_NAME = "PANEL_CONSULTA_NAME"; + + private static final String PANEL_CONSULTA_MARCACAO_NAME = "PANEL_CONSULTA_MARCACAO_NAME"; + + private static final String PANEL_EXAME_NAME = "EXAME_PANEL"; + + private static final String PANEL_EXAME_MARCACAO_NAME = "PANEL_EXAME_MARCACAO_NAME"; + + private final JPanel cardPanel = new JPanel(); + + private final CardLayout cardLayout = new CardLayout(); + + // panels + private final JPanel panelExame = new JPanel(); + private final JPanel panelExameMarcacao = new JPanel(); + + private final JPanel panelConsulta = new JPanel(); + private final JPanel panelConsultaMarcacao = new JPanel(); + + private final JPanel panelProcesso = new JPanel(); + + private final JPanel panelFicha = new JPanel(); + + private final JPanel panelTrabalhador = new JPanel(); + + private final JPanel panelStart = new JPanel(); + + // trabalhador + @ActionActivation(onSelect = CREATE_PROCESSO, onChange = "") + public final LeafButton buttonNovoTrabalhadorProcesso = new LeafButton( "Novo Processo" ); + + @ActionActivation(onSelect = CREATE_LEMBRETE, onChange = "") + public final LeafButton buttonNovoLembrete = new LeafButton( "Novo Lembrete" ); + + // processo + @ActionActivation(onSelect = FECHAR_PROCESSO, onChange = "") + public final LeafButton buttonFecharProcesso = new LeafButton( "Fechar Processo" ); + + @ActionActivation(onSelect = CREATE_FICHA, onChange = "") + public final LeafButton buttonCriarFicha = new LeafButton( "Ficha de Aptid"+atilde+"o" ); + + @ActionActivation(onSelect = { + CREATE_CONSULTA, CREATE_CONSULTA_MARCACAO + }, onChange = "") + public final LeafButton buttonNovoProcessoConsulta = new LeafButton( "Nova Consulta" ); + + @ActionActivation(onSelect = { + CREATE_EXAME, CREATE_EXAME_MARCACAO + }, onChange = "") + public final LeafButton buttonNovoProcessoExame = new LeafButton( "Novo Exame" ); + + @ActionActivation(onSelect = APAGAR_PROCESSO, onChange = "") + public final LeafButton buttonApagarProcesso = new LeafButton( "Remover Processo" ); + + // consulta + + @ActionActivation(onSelect = APAGAR_CONSULTA, onChange = "") + public final LeafButton buttonApagarConsulta = new LeafButton( "Apagar Consulta" ); + + // marcacao consulta + + @ActionActivation(onSelect = CREATE_CONSULTA_MARCACAO, onChange = "") + public final LeafButton buttonNovoConsultaMarcacao = new LeafButton( "Nova Marca" + ccedil + atilde + "o" ); + + @ActionActivation(onSelect = APAGAR_CONSULTA_MARCACAO, onChange = "") + public final LeafButton buttonApagarConsultaMarcacao = new LeafButton( "Apagar Marca" + ccedil + atilde + "o" ); + + @ActionActivation(onSelect = CREATE_CONSULTA_MARCACAO_EMAIL, onChange = "") + public final LeafButton buttonNovoConsultaMarcacaoEmail = new LeafButton( "e-Mail" ); + + @ActionActivation(onSelect = CREATE_CONSULTA_MARCACAO_EMAIL_VACINAS, onChange = "") + public final LeafButton buttonNovoConsultaMarcacaoEmailVacinas = new LeafButton( "e-Mail: Boletim" ); + + @ActionActivation(onSelect = CREATE_CONSULTA_MARCACAO_OBSERVACOES, onChange = "") + public final LeafButton buttonNovoConsultaMarcacaoObservacoes = new LeafButton( "Adicionar Observa" + ccedil + atilde + "o" ); + + @ActionActivation(onSelect = DESMARCAR_SIPRP_CONSULTA_MARCACAO, onChange = "") + public final LeafButton buttonConsultaMarcacaoDesmarcarSiprp = new LeafButton( "Desmarcar (SIPRP)" ); + + @ActionActivation(onSelect = DESMARCAR_TRABALHADOR_CONSULTA_MARCACAO, onChange = "") + public final LeafButton buttonConsultaMarcacaoDesmarcarTrabalhador = new LeafButton( "Desmarcar (Trab)" ); + + @ActionActivation(onSelect = REALIZAR_CONSULTA_MARCACAO, onChange = "") + public final LeafButton buttonConsultaMarcacaoRealizar = new LeafButton( "Realizar" ); + + @ActionActivation(onSelect = FALTOU_CONSULTA_MARCACAO, onChange = "") + public final LeafButton buttonConsultaMarcacaoFaltou = new LeafButton( "Faltou" ); + + // email marcacao consulta + + // observacoes marcacao consulta + + // exame + @ActionActivation(onSelect = APAGAR_EXAME, onChange = "") + public final LeafButton buttonApagarExame = new LeafButton( "Apagar Exame" ); + + // marcacao exame + + @ActionActivation(onSelect = CREATE_EXAME_MARCACAO, onChange = "") + public final LeafButton buttonNovoExameMarcacao = new LeafButton( "Nova Marca" + ccedil + atilde + "o" ); + + @ActionActivation(onSelect = APAGAR_EXAME_MARCACAO, onChange = "") + public final LeafButton buttonApagarExameMarcacao = new LeafButton( "Apagar Marca" + ccedil + atilde + "o" ); + + @ActionActivation(onSelect = CREATE_EXAME_MARCACAO_EMAIL, onChange = "") + public final LeafButton buttonNovoExameMarcacaoEmail = new LeafButton( "e-Mail" ); + @ActionActivation(onSelect = CREATE_EXAME_MARCACAO_OBSERVACOES, onChange = "") + public final LeafButton buttonNovoExameMarcacaoObservacoes = new LeafButton( "Adicionar Observa" + ccedil + atilde + "o" ); + + @ActionActivation(onSelect = DESMARCAR_SIPRP_EXAME_MARCACAO, onChange = "") + public final LeafButton buttonExameMarcacaoDesmarcarSiprp = new LeafButton( "Desmarcar (SIPRP)" ); + + @ActionActivation(onSelect = DESMARCAR_TRABALHADOR_EXAME_MARCACAO, onChange = "") + public final LeafButton buttonExameMarcacaoDesmarcarTrabalhador = new LeafButton( "Desmarcar (Trab)" ); + + @ActionActivation(onSelect = REALIZAR_EXAME_MARCACAO, onChange = "") + public final LeafButton buttonExameMarcacaoRealizar = new LeafButton( "Realizar" ); + + @ActionActivation(onSelect = REALIZAR_PARCIAL_EXAME_MARCACAO, onChange = "") + public final LeafButton buttonExameMarcacaoRealizarParcial = new LeafButton( "Realizar Parcial." ); + + @ActionActivation(onSelect = FALTOU_EXAME_MARCACAO, onChange = "") + public final LeafButton buttonExameMarcacaoFaltou = new LeafButton( "Faltou" ); + + @ActionActivation(onSelect = ANULAR_EXAME_MARCACAO, onChange = "") + public final LeafButton buttonExameMarcacaoAnular = new LeafButton( "Anular" ); + + // email marcacao exame + + // observacoes marcacao exame + + // control + + public ProcessoAccoesPanel(LeafWindow parentWindow) + { + this.parentWindow = parentWindow; + setupLayout(); + setupComponents(); + placeComponents(); + } + + private void setupLayout() + { + TableLayout layout = new TableLayout( new double[] { + TableLayout.FILL + }, new double[] { + TableLayout.FILL + } ); + this.setLayout( layout ); + cardPanel.setLayout( cardLayout ); + } + + private void setupComponents() + { + this.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Ac" + ccedil + otilde + "es" ) ); + setupStartPanel(); + setupTrabalhadorPanel(); + setupProcessoPanel(); + setupFichaPanel(); + setupConsultaPanel(); + setupConsultaMarcacaoPanel(); + setupExamePanel(); + setupExameMarcacaoPanel(); + } + + private void placeComponents() + { + cardPanel.add( panelStart, PANEL_START_NAME ); + cardPanel.add( panelTrabalhador, PANEL_TRABALHADOR_NAME ); + cardPanel.add( panelProcesso, PANEL_PROCESSO_NAME ); + cardPanel.add( panelFicha, PANEL_FICHA_NAME); + cardPanel.add( panelConsulta, PANEL_CONSULTA_NAME ); + cardPanel.add( panelConsultaMarcacao, PANEL_CONSULTA_MARCACAO_NAME ); + cardPanel.add( panelExame, PANEL_EXAME_NAME ); + cardPanel.add( panelExameMarcacao, PANEL_EXAME_MARCACAO_NAME ); + this.add( cardPanel, new TableLayoutConstraints( 0, 0 ) ); + } + + @LeafUIActionBinding(action = { + LOAD_TRABALHADOR, SELECT_TRABALHADOR + }) + public void setForTrabalhador( Trabalhadores trabalhador ) + { + if( trabalhador != null ) + { + boolean processoAberto = false; + for( TrabalhadoresProcesso processo : (List) trabalhador.getTrabalhadoresProcessoArray() ) + { + if( ProcessoConstants.PROCESSO_ABERTO_CODE.equals( processo.getEstado() ) ) + { + processoAberto = true; + break; + } + } + buttonNovoTrabalhadorProcesso.setEnabled( !processoAberto ); + buttonNovoLembrete.setEnabled( true ); + cardLayout.show( cardPanel, PANEL_TRABALHADOR_NAME ); + } + else + { + cardLayout.show( cardPanel, PANEL_START_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_PROCESSO) + public void setForProcesso( TrabalhadoresProcesso processo ) + { + if( processo != null ) + { + buttonFecharProcesso.setEnabled( !ProcessoConstants.PROCESSO_FECHADO_CODE.equals( processo.getEstado() ) ); + buttonApagarProcesso.setEnabled( processo.isEmpty() ); + boolean consultaAberta = false; + for( TrabalhadoresConsultas consulta : (List) processo.getTrabalhadoresConsultasArray() ) + { + if( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ).equals( consulta.getEstado() ) ) + { + consultaAberta = true; + break; + } + } + buttonNovoProcessoConsulta.setEnabled( !consultaAberta ); + + cardLayout.show( cardPanel, PANEL_PROCESSO_NAME ); + } + else + { + cardLayout.show( cardPanel, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_FICHA) + public void setForFicha( TrabalhadoresFichasAptidao ficha) + { + if( ficha != null ) + { + cardLayout.show( cardPanel, PANEL_FICHA_NAME ); + } + else + { + cardLayout.show( cardPanel, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_CONSULTA) + public void setForConsulta( TrabalhadoresConsultas consulta ) + { + if( consulta != null ) + { + boolean marcacaoAberta = false; + for( TrabalhadoresConsultasDatas marcacao : (List) consulta.getTrabalhadoresConsultasDatasArray() ) + { + if( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ).equals( marcacao.getEstado() ) ) + { + marcacaoAberta = true; + break; + } + } + buttonNovoConsultaMarcacao.setEnabled( !marcacaoAberta && !new Integer( MedicinaConstants.ESTADO_REALIZADO ).equals( consulta.getEstado() ) ); + buttonApagarConsulta.setEnabled( marcacaoAberta ); + cardLayout.show( cardPanel, PANEL_CONSULTA_NAME ); + } + else + { + cardLayout.show( cardPanel, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_CONSULTA_MARCACAO) + public void setForConsultaMarcacao( TrabalhadoresConsultasDatas marcacao ) + { + if( marcacao != null ) + { + boolean porRealizar = new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ).equals( marcacao.getEstado() ); + boolean realizada = new Integer( MedicinaConstants.ESTADO_REALIZADO ).equals( marcacao.getEstado() ); + List list = marcacao.getTrabalhadoresConsultasDatasObservacoesArray(); + boolean noObservacoes = (list == null || list.size() == 0) ? true : false; + buttonConsultaMarcacaoDesmarcarSiprp.setEnabled( porRealizar ); + buttonConsultaMarcacaoDesmarcarTrabalhador.setEnabled( porRealizar ); + buttonConsultaMarcacaoFaltou.setEnabled( porRealizar ); + buttonConsultaMarcacaoRealizar.setEnabled( porRealizar ); + buttonNovoConsultaMarcacaoObservacoes.setEnabled( noObservacoes ); + buttonNovoConsultaMarcacaoEmailVacinas.setEnabled( realizada ); + buttonApagarConsultaMarcacao.setEnabled( porRealizar ); + cardLayout.show( cardPanel, PANEL_CONSULTA_MARCACAO_NAME ); + } + else + { + cardLayout.show( cardPanel, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_CONSULTA_MARCACAO_EMAIL) + public void setForConsultaMarcacaoEmail( TrabalhadoresConsultasDatasEmails email ) + { + if( email != null ) + { + cardLayout.show( cardPanel, PANEL_START_NAME ); + } + else + { + cardLayout.show( cardPanel, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_CONSULTA_MARCACAO_OBSERVACAO) + public void setForConsultaMarcacaoObservacao( TrabalhadoresConsultasDatasObservacoes obs ) + { + if( obs != null ) + { + cardLayout.show( cardPanel, PANEL_START_NAME ); + } + else + { + cardLayout.show( cardPanel, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_EXAME) + public void setForExame( TrabalhadoresEcds exame ) + { + if( exame != null ) + { + boolean porMarcar = new Integer( MedicinaConstants.ESTADO_POR_MARCAR ).equals( exame.getEstado() ); + boolean porRealizado = new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ).equals( exame.getEstado() ); + buttonNovoExameMarcacao.setEnabled( porMarcar ); + buttonApagarExame.setEnabled( porRealizado ); + cardLayout.show( cardPanel, PANEL_EXAME_NAME ); + } + else + { + cardLayout.show( cardPanel, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_EXAME_MARCACAO) + public void setForExameMarcacao( TrabalhadoresEcdsDatas marcacao ) + { + if( marcacao != null ) + { + boolean porRealizar = new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ).equals( marcacao.getEstado() ); + List list = marcacao.getTrabalhadoresEcdsDatasObservacoesArray(); + boolean noObservacoes = (list == null || list.size() == 0) ? true : false; + buttonExameMarcacaoDesmarcarSiprp.setEnabled( porRealizar ); + buttonExameMarcacaoDesmarcarTrabalhador.setEnabled( porRealizar ); + buttonExameMarcacaoFaltou.setEnabled( porRealizar ); + buttonExameMarcacaoRealizar.setEnabled( porRealizar ); + buttonExameMarcacaoRealizarParcial.setEnabled( porRealizar ); + buttonExameMarcacaoAnular.setEnabled( porRealizar ); + buttonApagarExameMarcacao.setEnabled( porRealizar ); + buttonNovoExameMarcacaoObservacoes.setEnabled( noObservacoes ); + cardLayout.show( cardPanel, PANEL_EXAME_MARCACAO_NAME ); + } + else + { + cardLayout.show( cardPanel, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_EXAME_MARCACAO_EMAIL) + public void setForExameMarcacaoEmail( TrabalhadoresEcdsDatasEmails email ) + { + if( email != null ) + { + cardLayout.show( cardPanel, PANEL_START_NAME ); + } + else + { + cardLayout.show( cardPanel, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_EXAME_MARCACAO_OBSERVACAO) + public void setForExameMarcacaoObservacao( TrabalhadoresEcdsDatasObservacoes obs ) + { + if( obs != null ) + { + cardLayout.show( cardPanel, PANEL_START_NAME ); + } + else + { + cardLayout.show( cardPanel, PANEL_TRABALHADOR_NAME ); + } + } + + private void setupStartPanel() + { + } + + private void setupTrabalhadorPanel() + { + setupSimpleActionsPanel( panelTrabalhador, buttonNovoTrabalhadorProcesso, buttonNovoLembrete, new JPanel() ); + } + + private void setupProcessoPanel() + { + JPanel panelTopProcesso = new JPanel(); + JPanel panelBottomProcesso = new JPanel(); + setupSimpleActionsPanel( panelTopProcesso, buttonNovoProcessoConsulta, buttonNovoProcessoExame ); + setupSimpleActionsPanel( panelBottomProcesso, buttonCriarFicha, buttonFecharProcesso, buttonApagarProcesso ); + setupTopBottomSimpleActionsPanel( panelProcesso, panelTopProcesso, panelBottomProcesso ); + } + + private void setupFichaPanel() + { + setupSimpleActionsPanel( panelFicha, new JPanel() ); + } + + private void setupConsultaPanel() + { + setupSimpleActionsPanel( panelConsulta, buttonNovoConsultaMarcacao, buttonApagarConsulta, new JPanel() ); + } + + private void setupConsultaMarcacaoPanel() + { + JPanel consultaMarcacaoUpperPanel = new JPanel(); + JPanel consultaMarcacaoLowerPanel = new JPanel(); + setupSimpleActionsPanel( consultaMarcacaoUpperPanel, buttonNovoConsultaMarcacaoEmail, buttonNovoConsultaMarcacaoEmailVacinas, buttonNovoConsultaMarcacaoObservacoes ); + setupSimpleActionsPanel( consultaMarcacaoLowerPanel, buttonConsultaMarcacaoRealizar, buttonConsultaMarcacaoDesmarcarSiprp, buttonConsultaMarcacaoDesmarcarTrabalhador, buttonConsultaMarcacaoFaltou, buttonApagarConsultaMarcacao); + setupTopBottomSimpleActionsPanel(panelConsultaMarcacao, consultaMarcacaoUpperPanel, consultaMarcacaoLowerPanel); + } + + private void setupExameMarcacaoPanel() + { + JPanel exameMarcacaoUpperPanel = new JPanel(); + JPanel exameMarcacaoLowerPanel = new JPanel(); + setupSimpleActionsPanel( exameMarcacaoUpperPanel, buttonNovoExameMarcacaoEmail, buttonNovoExameMarcacaoObservacoes, new JPanel() ); + setupSimpleActionsPanel( exameMarcacaoLowerPanel, buttonExameMarcacaoRealizar, buttonExameMarcacaoRealizarParcial, buttonExameMarcacaoFaltou, buttonExameMarcacaoAnular, buttonExameMarcacaoDesmarcarTrabalhador, buttonExameMarcacaoDesmarcarSiprp, buttonApagarExameMarcacao ); + setupTopBottomSimpleActionsPanel(panelExameMarcacao, exameMarcacaoUpperPanel, exameMarcacaoLowerPanel); + } + + private void setupExamePanel() + { + setupSimpleActionsPanel( panelExame, buttonNovoExameMarcacao, buttonApagarExame, new JPanel() ); + } + + private void setupTopBottomSimpleActionsPanel(JPanel panel, JPanel top, JPanel bottom) + { + TableLayout layout = new TableLayout(new double[]{TableLayout.FILL}, new double[]{TableLayout.MINIMUM, TableLayout.FILL,TableLayout.MINIMUM}); + panel.setLayout( layout ); + panel.add( top, new TableLayoutConstraints(0,0) ); + panel.add( new JPanel(), new TableLayoutConstraints(0,1) ); + panel.add( bottom, new TableLayoutConstraints(0,2) ); + } + + private void setupSimpleActionsPanel( JPanel panel, JComponent... field ) + { + double[] cols = new double[] { + FILL + }; + double[] rows = new double[field.length]; + for( int i = 0; i < field.length; rows[i++] = MINIMUM ) + ; + rows[rows.length - 1] = FILL; + TableLayout layout = new TableLayout( cols, rows ); + panel.setLayout( layout ); + + for( int i = 0; i < field.length; ++i ) + { + panel.add( field[i], new TableLayoutConstraints( 0, i ) ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoDadosPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoDadosPanel.java new file mode 100755 index 00000000..64a828bd --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoDadosPanel.java @@ -0,0 +1,902 @@ +package siprp.medicina.processo.ui; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import static com.evolute.utils.strings.UnicodeLatin1Map.iacute; +import static com.evolute.utils.strings.UnicodeLatin1Map.otilde; +import static info.clearthought.layout.TableLayoutConstants.FILL; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_CONSULTA_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_CONSULTA_MARCACAO_EMAIL; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_CONSULTA_MARCACAO_EMAIL_VACINAS; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_CONSULTA_MARCACAO_OBSERVACOES; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_EXAME_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_EXAME_MARCACAO_EMAIL; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_EXAME_MARCACAO_OBSERVACOES; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_PROCESSO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.LOAD_TRABALHADOR; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SAVE_CONSULTA_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SAVE_CONSULTA_MARCACAO_OBSERVACOES; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SAVE_EXAME_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SAVE_EXAME_MARCACAO_OBSERVACOES; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SAVE_PROCESSO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_CONSULTA; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_CONSULTA_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_CONSULTA_MARCACAO_EMAIL; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_CONSULTA_MARCACAO_OBSERVACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_EXAME; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_EXAME_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_EXAME_MARCACAO_EMAIL; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_EXAME_MARCACAO_OBSERVACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_FICHA; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_PROCESSO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_TRABALHADOR; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.awt.CardLayout; +import java.io.File; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; + +import leaf.ui.LeafCalendarDialog; +import leaf.ui.LeafInputField; +import leaf.ui.LeafOptionDialog; +import leaf.ui.LeafTextDialog; +import leaf.ui.LeafWindow; +import leaf.ui.LeafLogic.LeafUIActionBinding; +import leaf.ui.LeafWindow.ActionActivation; +import siprp.CompanyDataLoader; +import siprp.MedicinaConstants; +import siprp.ProcessoConstants; +import siprp.SingletonConstants; +import siprp.database.cayenne.objects.Contactos; +import siprp.database.cayenne.objects.Estabelecimentos; +import siprp.database.cayenne.objects.Prestadores; +import siprp.database.cayenne.objects.PrtGruposProtocolo; +import siprp.database.cayenne.objects.Trabalhadores; +import siprp.database.cayenne.objects.TrabalhadoresConsultas; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatas; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatasEmails; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatasObservacoes; +import siprp.database.cayenne.objects.TrabalhadoresEcd; +import siprp.database.cayenne.objects.TrabalhadoresEcds; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatas; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatasEmails; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatasObservacoes; +import siprp.database.cayenne.objects.TrabalhadoresFichasAptidao; +import siprp.database.cayenne.objects.TrabalhadoresProcesso; +import siprp.medicina.MedicinaDataProvider; +import siprp.medicina.processo.mail.MailDialog; + +import com.evolute.adt.OrderedMap; +import com.evolute.utils.Singleton; + +public class ProcessoDadosPanel extends JPanel +{ + private static final long serialVersionUID = 1L; + private final LeafWindow parentWindow; + + private static final String PANEL_START_NAME = "START_PANEL"; + + private static final String PANEL_TRABALHADOR_NAME = "TRABALHADOR_PANEL"; + + private static final String PANEL_PROCESSO_NAME = "PROCESSO_PANEL"; + + private static final String PANEL_FICHA_NAME = "PANEL_FICHA_NAME"; + + private static final String PANEL_CONSULTA_NAME = "PANEL_CONSULTA_NAME"; + private static final String PANEL_CONSULTA_MARCACAO_NAME = "PANEL_CONSULTA_MARCACAO_NAME"; + private static final String PANEL_CONSULTA_MARCACAO_EMAIL_NAME = "PANEL_CONSULTA_MARCACAO_EMAIL_NAME"; + private static final String PANEL_CONSULTA_MARCACAO_OBSERVACOES_NAME = "PANEL_CONSULTA_MARCACAO_OBSERVACOES_NAME"; + + private static final String PANEL_EXAME_NAME = "EXAME_PANEL"; + private static final String PANEL_EXAME_MARCACAO_NAME = "PANEL_EXAME_MARCACAO_NAME"; + private static final String PANEL_EXAME_MARCACAO_EMAIL_NAME = "PANEL_EXAME_MARCACAO_EMAIL_NAME"; + private static final String PANEL_EXAME_MARCACAO_OBSERVACAO_NAME = "PANEL_EXAME_MARCACAO_OBSERVACAO_NAME"; + + private final CardLayout cardLayout = new CardLayout(); + + // panels + private final JPanel panelExame = new JPanel(); + private final JPanel panelExameMarcacao = new JPanel(); + private final JPanel panelExameMarcacaoEmail = new JPanel(); + private final JPanel panelExameMarcacaoObservacao = new JPanel(); + + private final JPanel panelConsulta = new JPanel(); + private final JPanel panelConsultaMarcacao = new JPanel(); + private final JPanel panelConsultaMarcacaoEmail = new JPanel(); + private final JPanel panelConsultaMarcacaoObservacao = new JPanel(); + + private final JPanel panelProcesso = new JPanel(); + + private final JPanel panelTrabalhador = new JPanel(); + + private final JPanel panelFicha = new JPanel(); + + private final JPanel panelStart = new JPanel(); + + // trabalhador + private final JLabel labelTrabalhadorNome = new JLabel( "Nome" ); + private final JLabel labelTrabalhadorSexo = new JLabel( "Sexo" ); + private final JLabel labelTrabalhadoresDataNascimento = new JLabel( "Data de Nascimento" ); + private final JLabel labelTrabalhadorNacionalidade = new JLabel( "Nacionalidade" ); + private final JLabel labelTrabalhadorBI = new JLabel( "B.I." ); + private final JLabel labelTrabalhadorObservacoes = new JLabel( "Observa" + ccedil + otilde + "es" ); + private final JLabel labelTrabalhadoresDataAdmissao = new JLabel( "Data de Admiss" + atilde + "o" ); + + public final LeafInputField inputTrabalhadorNome = new LeafInputField(); + public final LeafInputField> inputTrabalhadorSexo = new LeafInputField>(); + public final LeafInputField inputTrabalhadoresDataNascimento = new LeafInputField(); + public final LeafInputField inputTrabalhadorNacionalidade = new LeafInputField(); + public final LeafInputField inputTrabalhadorBI = new LeafInputField(); + public final LeafInputField inputTrabalhadorObservacoes = new LeafInputField(); + public final LeafInputField inputTrabalhadoresDataAdmissao = new LeafInputField(); + + // processo + + private final JLabel labelProcessoEstado = new JLabel( "Estado" ); + private final JLabel labelProcessoDataInicio = new JLabel( "In" + iacute + "cio" ); + private final JLabel labelProcessoDataFim = new JLabel( "Fim" ); + private final JLabel labelProcessoMotivo = new JLabel( "Motivo" ); + + public final LeafInputField> inputProcessoEstado = new LeafInputField>(); + public final LeafInputField inputProcessoDataInicio = new LeafInputField(); + public final LeafInputField inputProcessoDataFim = new LeafInputField(); + @ActionActivation(onSelect = "", onChange = SAVE_PROCESSO) + public final LeafInputField> inputProcessoMotivo = new LeafInputField>(); + + // consulta + private final JLabel labelConsultaEstado = new JLabel( "Estado" ); + private final JLabel labelConsultaData = new JLabel( "Data" ); + private final JLabel labelConsultaPrestador = new JLabel( "Prestador" ); + + public final LeafInputField> inputConsultaEstado = new LeafInputField>(); + public final LeafInputField inputConsultaData = new LeafInputField(); + public final LeafInputField inputConsultaPrestador = new LeafInputField(); + + // marcacao consulta + private final JLabel labelConsultaMarcacaoEstado = new JLabel( "Estado" ); + private final JLabel labelConsultaMarcacaoData = new JLabel( "Data" ); + private final JLabel labelConsultaMarcacaoPrestador = new JLabel( "Prestador" ); + + public final LeafInputField> inputConsultaMarcacaoEstado = new LeafInputField>(); + public final LeafInputField inputConsultaMarcacaoData = new LeafInputField(); + @ActionActivation(onSelect = "", onChange = SAVE_CONSULTA_MARCACAO) + public final LeafInputField> inputConsultaMarcacaoPrestador = new LeafInputField>(); + + // email marcacao consulta + private final JLabel labelConsultaMarcacaoEmailData = new JLabel( "Data" ); + private final JLabel labelConsultaMarcacaoEmailSubject = new JLabel( "Assunto" ); + private final JLabel labelConsultaMarcacaoEmailBody = new JLabel( "Mensagem" ); + + public final LeafInputField inputConsultaMarcacaoEmailData = new LeafInputField(); + public final LeafInputField inputConsultaMarcacaoEmailSubject = new LeafInputField(); + public final LeafInputField inputConsultaMarcacaoEmailBody = new LeafInputField(); + + // observacao marcacao consulta + @ActionActivation(onSelect = "", onChange = SAVE_CONSULTA_MARCACAO_OBSERVACOES) + public final LeafInputField inputConsultaMarcacaoObsMensagem = new LeafInputField(); + + // exame + private final JLabel labelExameEstado = new JLabel( "Estado" ); + private final JLabel labelExameData = new JLabel( "Data" ); + private final JLabel labelExameGruposEcds = new JLabel( "ECDs" ); + + public final LeafInputField> inputExameEstado = new LeafInputField>(); + public final LeafInputField> inputExameGruposEcds = new LeafInputField>(); + public final LeafInputField inputExameData = new LeafInputField(); + + // marcacao exame + private final JLabel labelExameMarcacaoEstado = new JLabel( "Estado" ); + private final JLabel labelExameMarcacaoData = new JLabel( "Data" ); + private final JLabel labelExameMarcacaoGruposEcds = new JLabel( "ECDs" ); + private final JLabel labelExameMarcacaoPrestador = new JLabel( "Prestador" ); + private final JLabel labelExameMarcacaoAnalisador = new JLabel( "Analisadores" ); + private final JLabel labelExameMarcacaoDataRecepcao = new JLabel( "Data de recep" + ccedil + atilde + "o" ); + + public final LeafInputField> inputExameMarcacaoEstado = new LeafInputField>(); + public final LeafInputField inputExameMarcacaoData = new LeafInputField(); + @ActionActivation(onSelect = "", onChange = SAVE_EXAME_MARCACAO) + public final LeafInputField inputExameMarcacaoDataRecepcao = new LeafInputField(); + public final LeafInputField> inputExameMarcacaoGruposEcds = new LeafInputField>(); + @ActionActivation(onSelect = "", onChange = SAVE_EXAME_MARCACAO) + public final LeafInputField> inputExameMarcacaoPrestador = new LeafInputField>(); + @ActionActivation(onSelect = "", onChange = SAVE_EXAME_MARCACAO) + public final LeafInputField> inputExameMarcacaoAnalisador = new LeafInputField>(); + + // email marcacao exame + private final JLabel labelExameMarcacaoEmailData = new JLabel( "Data" ); + private final JLabel labelExameMarcacaoEmailSubject = new JLabel( "Assunto" ); + private final JLabel labelExameMarcacaoEmailBody = new JLabel( "Mensagem" ); + + public final LeafInputField inputExameMarcacaoEmailData = new LeafInputField(); + public final LeafInputField inputExameMarcacaoEmailSubject = new LeafInputField(); + public final LeafInputField inputExameMarcacaoEmailBody = new LeafInputField(); + + // observacao marcacao exame + @ActionActivation(onSelect = "", onChange = SAVE_EXAME_MARCACAO_OBSERVACOES) + public final LeafInputField inputExameMarcacaoObsMensagem = new LeafInputField(); + + public ProcessoDadosPanel(LeafWindow parentWindow) + { + this.parentWindow = parentWindow; + setupLayout(); + setupComponents(); + placeComponents(); + } + + private void setupLayout() + { + this.setLayout( cardLayout ); + } + + private void setupComponents() + { + setupStartPanel(); + setupTrabalhadorPanel(); + setupProcessoPanel(); + setupFichaPanel(); + setupConsultaPanel(); + setupConsultaMarcacaoPanel(); + setupConsultaMarcacaoEmailPanel(); + setupConsultaMarcacaoObservacoesPanel(); + setupExamePanel(); + setupExameMarcacaoPanel(); + setupExameMarcacaoEmailPanel(); + setupExameMarcacaoObservacoesPanel(); + } + + private void placeComponents() + { + add( panelStart, PANEL_START_NAME ); + add( panelTrabalhador, PANEL_TRABALHADOR_NAME ); + add( panelFicha, PANEL_FICHA_NAME ); + add( panelProcesso, PANEL_PROCESSO_NAME ); + add( panelConsulta, PANEL_CONSULTA_NAME ); + add( panelConsultaMarcacao, PANEL_CONSULTA_MARCACAO_NAME ); + add( panelConsultaMarcacaoEmail, PANEL_CONSULTA_MARCACAO_EMAIL_NAME ); + add( panelConsultaMarcacaoObservacao, PANEL_CONSULTA_MARCACAO_OBSERVACOES_NAME ); + add( panelExame, PANEL_EXAME_NAME ); + add( panelExameMarcacao, PANEL_EXAME_MARCACAO_NAME ); + add( panelExameMarcacaoEmail, PANEL_EXAME_MARCACAO_EMAIL_NAME ); + add( panelExameMarcacaoObservacao, PANEL_EXAME_MARCACAO_OBSERVACAO_NAME ); + } + + private int getIdade( Date nascimento ) + { + int result = 0; + if( nascimento != null ) + { + Calendar now = Calendar.getInstance(); + Calendar birth = Calendar.getInstance(); + birth.setTime( nascimento ); + int birthYear = birth.get( Calendar.YEAR ); + int currentYear = now.get( Calendar.YEAR ); + if( birthYear < currentYear ) + { + result = currentYear - birthYear; + birth.add( Calendar.YEAR, result ); + if( birth.after( now ) ) + { + --result; + } + } + } + return result; + } + + @LeafUIActionBinding(action = { + LOAD_TRABALHADOR, SELECT_TRABALHADOR + }) + public void setForTrabalhador( Trabalhadores trabalhador ) + { + if( trabalhador != null ) + { + inputTrabalhadoresDataNascimento.setObject( trabalhador.getDataNascimento() ); + inputTrabalhadorSexo.setObject( trabalhador.getSexos(), trabalhador.getSexo() ); + inputTrabalhadorNome.setObject( trabalhador.getNome() ); + inputTrabalhadorNacionalidade.setObject( trabalhador.getNacionalidade() ); + inputTrabalhadorBI.setObject( trabalhador.getBi() ); + inputTrabalhadorObservacoes.setObject( trabalhador.getObservacoesGestao() ); + inputTrabalhadoresDataAdmissao.setObject( trabalhador.getDataAdmissao() ); + labelTrabalhadoresDataNascimento.setText( "Data de Nascimento (" + getIdade( trabalhador.getDataNascimento() ) + " anos)" ); + + cardLayout.show( this, PANEL_TRABALHADOR_NAME ); + } + else + { + cardLayout.show( this, PANEL_START_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_PROCESSO) + public void setForProcesso( TrabalhadoresProcesso processo ) + { + if( processo != null ) + { + boolean isFechado = ProcessoConstants.PROCESSO_FECHADO_CODE.equals( processo.getEstado() ); + inputProcessoDataFim.setObject( processo.getDataFim() ); + inputProcessoDataInicio.setObject( processo.getDataInicio() ); + inputProcessoEstado.setObject( processo.getEstados(), processo.getEstado() ); + inputProcessoMotivo.setEditable( !isFechado ); + inputProcessoMotivo.setObject( processo.getMotivos(), processo.getMotivo() ); + cardLayout.show( this, PANEL_PROCESSO_NAME ); + } + else + { + cardLayout.show( this, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_FICHA) + public void setForFicha( TrabalhadoresFichasAptidao ficha ) + { + if( ficha != null ) + { + cardLayout.show( this, PANEL_FICHA_NAME ); + } + else + { + cardLayout.show( this, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_CONSULTA) + public void setForConsulta( TrabalhadoresConsultas consulta ) + { + if( consulta != null ) + { + inputConsultaEstado.setObject( MedicinaDataProvider.getConsultaEstados(), consulta.getEstado() ); + inputConsultaData.setObject( consulta.getData() == null ? new Date( 0 ) : consulta.getData() ); + + inputConsultaPrestador.setObject( (consulta.getToPrestadores() == null || consulta.getToPrestadores().getNome() == null) ? " " : consulta.getToPrestadores().getNome() ); + + cardLayout.show( this, PANEL_CONSULTA_NAME ); + } + else + { + cardLayout.show( this, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_CONSULTA_MARCACAO) + public void setForConsultaMarcacao( TrabalhadoresConsultasDatas marcacao ) + { + if( marcacao != null ) + { + inputConsultaMarcacaoData.setObject( marcacao.getData() ); + inputConsultaMarcacaoEstado.setObject( MedicinaDataProvider.getConsultaEstados(), marcacao.getEstado() ); + + inputConsultaMarcacaoPrestador.setEditable( true ); + + Prestadores prestador = marcacao.getToPrestadores(); + List allPrestadores = Prestadores.getAllPrestadores(); + inputConsultaMarcacaoPrestador.setObject( new OrderedMap( allPrestadores ), prestador == null ? Prestadores.prestadorNulo : prestador ); + cardLayout.show( this, PANEL_CONSULTA_MARCACAO_NAME ); + } + else + { + cardLayout.show( this, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_CONSULTA_MARCACAO_EMAIL) + public void setForConsultaMarcacaoEmail( TrabalhadoresConsultasDatasEmails email ) + { + if( email != null ) + { + inputConsultaMarcacaoEmailBody.setObject( email.getBody() ); + inputConsultaMarcacaoEmailSubject.setObject( email.getSubject() ); + inputConsultaMarcacaoEmailData.setObject( email.getData() ); + cardLayout.show( this, PANEL_CONSULTA_MARCACAO_EMAIL_NAME ); + } + else + { + cardLayout.show( this, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_CONSULTA_MARCACAO_OBSERVACAO) + public void setForConsultaMarcacaoObs( TrabalhadoresConsultasDatasObservacoes obs ) + { + if( obs != null ) + { + inputConsultaMarcacaoObsMensagem.setEditable( true ); + inputConsultaMarcacaoObsMensagem.setObject( obs.getObservacao() == null ? "" : obs.getObservacao() ); + cardLayout.show( this, PANEL_CONSULTA_MARCACAO_OBSERVACOES_NAME ); + } + else + { + cardLayout.show( this, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_EXAME) + public void setForExame( TrabalhadoresEcds exame ) + { + if( exame != null ) + { + inputExameData.setObject( exame.getData() ); + inputExameEstado.setObject( exame.getEstados(), exame.getEstado() ); + OrderedMap grupos = exame.getGruposExamesForPerfil(); + inputExameGruposEcds.setCollapseOptions( false ); + inputExameGruposEcds.setObject( grupos, grupos.getFirst() ); + cardLayout.show( this, PANEL_EXAME_NAME ); + } + else + { + cardLayout.show( this, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_EXAME_MARCACAO) + public void setForExameMarcacao( TrabalhadoresEcdsDatas exameMarcacao ) + { + if( exameMarcacao != null ) + { + inputExameMarcacaoData.setObject( exameMarcacao.getData() ); + Date dataRecepcao = exameMarcacao.getDataRecepcao(); + inputExameMarcacaoDataRecepcao.setObject( dataRecepcao == null ? new Date(0) : dataRecepcao ); + inputExameMarcacaoDataRecepcao.setEditable( true ); + inputExameMarcacaoEstado.setObject( exameMarcacao.getEstados(), exameMarcacao.getEstado() ); + OrderedMap grupos = exameMarcacao.getStatesForeGruposExames(); + inputExameMarcacaoGruposEcds.setCollapseOptions( false ); + inputExameMarcacaoGruposEcds.setObject( grupos, grupos.getFirst() ); + + Prestadores prestador = exameMarcacao.getToPrestadores(); + List allPrestadores = Prestadores.getAllPrestadores(); + + if( prestador == null ) + { + prestador = Prestadores.prestadorNulo; + } + + inputExameMarcacaoPrestador.setEditable( true ); + inputExameMarcacaoPrestador.setObject( new OrderedMap( allPrestadores ), prestador ); + + boolean editable = Prestadores.prestadorNulo.equals( prestador ); + inputExameMarcacaoAnalisador.setCollapseOptions( false ); + + List allECDS = exameMarcacao.getTrabalhadoresEcdArray(); + OrderedMap analisadoresForGrupos = new OrderedMap(); + + if( allECDS != null ) + { + for( TrabalhadoresEcd current : allECDS ) + { + Prestadores currentAnalisador = current.getToAnalisador(); + + if( !prestador.equals( Prestadores.prestadorNulo ) ) + { + currentAnalisador = prestador; + } + else if( currentAnalisador == null ) + { + currentAnalisador = Prestadores.prestadorNulo; + } + + PrtGruposProtocolo grupo = current.getToPrtTiposElementosProtocolo().getToPrtGruposProtocolo(); + if( !analisadoresForGrupos.containsKey( grupo ) ) + { + analisadoresForGrupos.putLast( grupo, grupo.getDescricao() ); + LeafInputField> leaf = new LeafInputField>(); + leaf.setObject( new OrderedMap( allPrestadores ), currentAnalisador ); + leaf.setEditable( editable ); + analisadoresForGrupos.putLast( grupo, leaf ); + } + } + } + + inputExameMarcacaoAnalisador.setObject( analisadoresForGrupos ); + + inputExameMarcacaoAnalisador.setEditable( Prestadores.prestadorNulo.equals( prestador ) ); + + cardLayout.show( this, PANEL_EXAME_MARCACAO_NAME ); + } + else + { + cardLayout.show( this, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_EXAME_MARCACAO_EMAIL) + public void setForExameMarcacaoEmail( TrabalhadoresEcdsDatasEmails email ) + { + if( email != null ) + { + inputExameMarcacaoEmailBody.setObject( email.getBody() ); + inputExameMarcacaoEmailSubject.setObject( email.getSubject() ); + inputExameMarcacaoEmailData.setObject( email.getData() ); + cardLayout.show( this, PANEL_EXAME_MARCACAO_EMAIL_NAME ); + } + else + { + cardLayout.show( this, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = SELECT_EXAME_MARCACAO_OBSERVACAO) + public void setForExameMarcacaoObs( TrabalhadoresEcdsDatasObservacoes obs ) + { + if( obs != null ) + { + inputExameMarcacaoObsMensagem.setObject( obs.getObservacao() == null ? "" : obs.getObservacao() ); + inputExameMarcacaoObsMensagem.setEditable( true ); + cardLayout.show( this, PANEL_EXAME_MARCACAO_OBSERVACAO_NAME ); + } + else + { + cardLayout.show( this, PANEL_TRABALHADOR_NAME ); + } + } + + @LeafUIActionBinding(action = CREATE_PROCESSO) + public void setForNewProcesso( TrabalhadoresProcesso processo ) + { + HashMap tipos = processo.getMotivos(); + LeafOptionDialog option = new LeafOptionDialog( parentWindow, tipos, "Escolha o tipo de processo:" ); + Integer chosen = option.getOption(); + if( chosen != null ) + { + processo.setMotivo( chosen ); + } + inputProcessoMotivo.setObject( tipos, chosen ); + inputProcessoDataInicio.setObject( processo.getDataInicio() ); + inputProcessoDataFim.setObject( processo.getDataFim() ); + inputProcessoEstado.setObject( processo.getEstados(), processo.getEstado() ); + } + + @LeafUIActionBinding(action = CREATE_CONSULTA_MARCACAO) + public void setForNewConsultaMarcacao( TrabalhadoresConsultasDatas marcacao ) + { + LeafCalendarDialog calendar = new LeafCalendarDialog( parentWindow, false, true ); + Date date = calendar.getDate(); + if( date == null ) + { + parentWindow.abortAction( true ); + } + marcacao.setData( date ); + } + + @LeafUIActionBinding(action = CREATE_CONSULTA_MARCACAO_EMAIL) + public void setForNewConsultaMarcacaoEmail( TrabalhadoresConsultasDatasEmails email ) + { + if( email != null ) + { + TrabalhadoresConsultasDatas consultaMarcacao = email.getToTrabalhadoresConsultasDatas(); + if( consultaMarcacao != null ) + { + TrabalhadoresConsultas consulta = consultaMarcacao.getToTrabalhadoresConsultas(); + if( consulta != null ) + { + String[] subjectAndBody = MedicinaConstants.ESTADO_REALIZADO == consulta.getEstado() ? sendMail( consulta.getToTrabalhadores(), consultaMarcacao.getDataString(), "", "" ) : sendMail( consulta.getToTrabalhadores(), consultaMarcacao.getDataString(), SingletonConstants.LETTER_CONSULTA, SingletonConstants.SUBJECT_CONSULTA ); + if( subjectAndBody != null ) + { + email.setSubject( subjectAndBody[0] ); + email.setBody( subjectAndBody[1] ); + } + else + { + parentWindow.abortAction( true ); + } + } + } + } + } + + @LeafUIActionBinding(action = CREATE_CONSULTA_MARCACAO_EMAIL_VACINAS) + public void setForNewConsultaMarcacaoEmailVacinas( TrabalhadoresConsultasDatasEmails email ) + { + if( email != null ) + { + TrabalhadoresConsultasDatas consultaMarcacao = email.getToTrabalhadoresConsultasDatas(); + if( consultaMarcacao != null ) + { + TrabalhadoresConsultas consulta = consultaMarcacao.getToTrabalhadoresConsultas(); + if( consulta != null ) + { + String[] subjectAndBody = sendMail( consulta.getToTrabalhadores(), consultaMarcacao.getDataString(), SingletonConstants.LETTER_CONSULTA_VACINAS, SingletonConstants.SUBJECT_CONSULTA_VACINAS ); + if( subjectAndBody != null ) + { + email.setSubject( subjectAndBody[0] ); + email.setBody( subjectAndBody[1] ); + } + else + { + parentWindow.abortAction( true ); + } + } + } + } + } + + private String[] sendMail( Trabalhadores trabalhador, String data, String letterName, String subjectName ) + { + String[] result = null; + if( trabalhador != null ) + { + Estabelecimentos estabelecimento = trabalhador.getToEstabelecimentos(); + if( estabelecimento != null ) + { + String to = ""; + String bcc = ""; + String subject = ""; + String body = ""; + + subject = (String) Singleton.getInstance( subjectName ); + if( subject == null ) + { + subject = ""; + } + subject = subject.replaceAll( CompanyDataLoader.NOME, trabalhador.getNome() ); + + body = (String) Singleton.getInstance( letterName ); + if( body == null ) + { + body = ""; + } + body = body.replaceAll( CompanyDataLoader.DATA, data ); + body = body.replaceAll( CompanyDataLoader.NOME, trabalhador.getNome() ); + // body = body.replaceAll( CompanyDataLoader.MORADA, morada ); + body = body.replaceAll( "%0A", "
" ); + + Contactos estabelecimentoContacto = estabelecimento.getToContactos(); + if( estabelecimentoContacto != null ) + { + String estabelecimentoEmail = estabelecimentoContacto.getEmail(); + if( estabelecimentoEmail != null ) + { + to = estabelecimentoEmail; + try + { + MailDialog mailDialog = new MailDialog( parentWindow, to, bcc, subject, body, new Vector() ); + result = new String[2]; + result[0] = mailDialog.getSubject(); + result[1] = mailDialog.getMessage(); + } catch( Exception e ) + { + e.printStackTrace( System.out ); + e.printStackTrace(); + result = null; + } + } + } + } + } + return result; + } + + @LeafUIActionBinding(action = CREATE_CONSULTA_MARCACAO_OBSERVACOES) + public void setForNewConsultaMarcacaoObservacoes( TrabalhadoresConsultasDatasObservacoes observacoes ) + { + LeafTextDialog textDialog = new LeafTextDialog( parentWindow, this, "", true ); + String text = textDialog.getText(); + observacoes.setObservacao( text ); + inputConsultaMarcacaoObsMensagem.setEditable( true ); + } + + @LeafUIActionBinding(action = CREATE_EXAME_MARCACAO) + public void setForNewExameMarcacao( TrabalhadoresEcdsDatas marcacao ) + { + LeafCalendarDialog calendar = new LeafCalendarDialog( parentWindow, false, true ); + Date date = calendar.getDate(); + if( date == null ) + { + parentWindow.abortAction( true ); + } + marcacao.setData( date ); + + OrderedMap allGrupos = marcacao.getToTrabalhadoresEcds().getGruposExamesForPerfil(); + OrderedMap grupos = new OrderedMap(); + Map gruposSelected = new HashMap(); + for( int row = 0; row < allGrupos.rows(); ++row ) + { + List grupo = allGrupos.getRow( row ); + if( grupo != null && grupo.size() > 1 ) + { + String estado = grupo.get( 1 ).toString(); + if( MedicinaConstants.ESTADOS_EXAME_STR[MedicinaConstants.ESTADO_POR_MARCAR].equals( estado ) ) + { + PrtGruposProtocolo key = allGrupos.getKeyForValue( grupo ); + gruposSelected.put( key, true ); + grupos.addRow( key, grupo ); + } + } + } + LeafOptionDialog gruposChosen = new LeafOptionDialog( parentWindow, grupos, gruposSelected, null, "Escolha os ECDs para esta marca" + ccedil + atilde + "o", "Marcar >>" ); + for( PrtGruposProtocolo grupo : gruposChosen.getSelected() ) + { + marcacao.marcarGrupoExames( grupo ); + } + } + + @LeafUIActionBinding(action = CREATE_EXAME_MARCACAO_EMAIL) + public void setForNewExameMarcacaoEmail( TrabalhadoresEcdsDatasEmails email ) + { + if( email != null ) + { + TrabalhadoresEcdsDatas exameMarcacao = email.getToTrabalhadoresEcdsDatas(); + if( exameMarcacao != null ) + { + TrabalhadoresEcds exame = exameMarcacao.getToTrabalhadoresEcds(); + if( exame != null ) + { + String[] subjectAndBody = MedicinaConstants.ESTADO_REALIZADO == exame.getEstado() ? + sendMail( exame.getToTrabalhadores(), exame.getDataString(), "", "" ) + : + sendMail( exame.getToTrabalhadores(), exameMarcacao.getDataString(), SingletonConstants.LETTER_EXAMES, SingletonConstants.SUBJECT_EXAMES ); + if( subjectAndBody != null ) + { + email.setSubject( subjectAndBody[0] ); + email.setBody( subjectAndBody[1] ); + } + else + { + parentWindow.abortAction( true ); + } + } + } + } + } + + @LeafUIActionBinding(action = CREATE_EXAME_MARCACAO_OBSERVACOES) + public void setForNewExameMarcacaoObservacoes( TrabalhadoresEcdsDatasObservacoes observacoes ) + { + LeafTextDialog textDialog = new LeafTextDialog( parentWindow, this, "", true ); + String text = textDialog.getText(); + observacoes.setObservacao( text ); + inputExameMarcacaoObsMensagem.setEditable( true ); + } + + @LeafUIActionBinding(action = SAVE_PROCESSO) + public void updateToSaveProcesso( TrabalhadoresProcesso processo ) + { + processo.setMotivo( (Integer) inputProcessoMotivo.getSelectedObject() ); + } + + @LeafUIActionBinding(action = SAVE_CONSULTA_MARCACAO) + public void updateToSaveConsultaMarcacao( TrabalhadoresConsultasDatas marcacao ) + { + Prestadores prestador = (Prestadores) inputConsultaMarcacaoPrestador.getSelectedObject(); + prestador = Prestadores.prestadorNulo.equals( prestador ) ? null : prestador; + marcacao.setToPrestadores( prestador ); + } + + @LeafUIActionBinding(action = SAVE_CONSULTA_MARCACAO_OBSERVACOES) + public void updateToSaveConsultaMarcacaoObservacoes( TrabalhadoresConsultasDatasObservacoes observacoes ) + { + observacoes.setObservacao( inputConsultaMarcacaoObsMensagem.getObject() ); + } + + @LeafUIActionBinding(action = SAVE_EXAME_MARCACAO) + public void updateToSaveExameMarcacao( TrabalhadoresEcdsDatas marcacao ) + { + Date dataRecepcao = inputExameMarcacaoDataRecepcao.getObject(); + if( dataRecepcao == null || dataRecepcao.getTime() == 0l ) + { + marcacao.setDataRecepcao( null ); + } + else + { + marcacao.setDataRecepcao( dataRecepcao ); + } + Prestadores prestador = (Prestadores) inputExameMarcacaoPrestador.getSelectedObject(); + prestador = Prestadores.prestadorNulo.equals( prestador ) ? null : prestador; + marcacao.setToPrestadores( prestador ); + + List allEcd = marcacao.getTrabalhadoresEcdArray(); + if( allEcd != null ) + { + OrderedMap map = inputExameMarcacaoAnalisador.getObject(); + for( TrabalhadoresEcd ecd : allEcd ) + { + PrtGruposProtocolo grupo = ecd.getToPrtTiposElementosProtocolo().getToPrtGruposProtocolo(); + Object value = map.getValue( grupo, 1 ); + if( value != null ) + { + LeafInputField> leaf = (LeafInputField>) value; + Prestadores ecdAnalisador = Prestadores.prestadorNulo.equals( (Prestadores) leaf.getSelectedObject() ) ? null : ((Prestadores) leaf.getSelectedObject()); + ecd.setToAnalisador( ecdAnalisador ); + } + } + } + } + + @LeafUIActionBinding(action = SAVE_EXAME_MARCACAO_OBSERVACOES) + public void updateToSaveExameMarcacaoObservacoes( TrabalhadoresEcdsDatasObservacoes observacoes ) + { + observacoes.setObservacao( inputExameMarcacaoObsMensagem.getObject() ); + } + + private void setupStartPanel() + { + } + + private void setupSimpleDataPanel( JPanel panel, String name, JComponent... field ) + { + double[] cols = new double[] { + FILL + }; + double[] rows = new double[field.length]; + for( int i = 0; i < field.length; rows[i++] = TableLayout.PREFERRED ) + ; + rows[rows.length - 1] = FILL; + TableLayout layout = new TableLayout( cols, rows ); + layout.setHGap( 5 ); + layout.setVGap( 5 ); + panel.setLayout( layout ); + if( name != null ) + { + panel.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), name ) ); + } + + for( int i = 0; i < field.length; ++i ) + { + panel.add( field[i], new TableLayoutConstraints( 0, i ) ); + } + } + + private void setupTrabalhadorPanel() + { + setupSimpleDataPanel( panelTrabalhador, "Trabalhador", labelTrabalhadorNome, inputTrabalhadorNome, labelTrabalhadorSexo, inputTrabalhadorSexo, labelTrabalhadorBI, inputTrabalhadorBI, labelTrabalhadorNacionalidade, inputTrabalhadorNacionalidade, labelTrabalhadoresDataNascimento, inputTrabalhadoresDataNascimento, labelTrabalhadoresDataAdmissao, inputTrabalhadoresDataAdmissao, labelTrabalhadorObservacoes, inputTrabalhadorObservacoes ); + } + + private void setupProcessoPanel() + { + setupSimpleDataPanel( panelProcesso, "Processo", labelProcessoEstado, inputProcessoEstado, labelProcessoDataInicio, inputProcessoDataInicio, labelProcessoDataFim, inputProcessoDataFim, labelProcessoMotivo, inputProcessoMotivo, new JPanel() ); + } + + private void setupConsultaPanel() + { + setupSimpleDataPanel( panelConsulta, "Consulta", labelConsultaEstado, inputConsultaEstado, labelConsultaData, inputConsultaData, labelConsultaPrestador, inputConsultaPrestador, new JPanel() ); + } + + private void setupFichaPanel() + { + setupSimpleDataPanel( panelFicha, "Ficha de Aptid" + atilde + "o", new JPanel() ); + } + + private void setupConsultaMarcacaoPanel() + { + setupSimpleDataPanel( panelConsultaMarcacao, "Marca" + ccedil + atilde + "o de Consulta", labelConsultaMarcacaoEstado, inputConsultaMarcacaoEstado, labelConsultaMarcacaoData, inputConsultaMarcacaoData, labelConsultaMarcacaoPrestador, inputConsultaMarcacaoPrestador, new JPanel() ); + } + + private void setupConsultaMarcacaoEmailPanel() + { + setupSimpleDataPanel( panelConsultaMarcacaoEmail, "Email", labelConsultaMarcacaoEmailData, inputConsultaMarcacaoEmailData, labelConsultaMarcacaoEmailSubject, inputConsultaMarcacaoEmailSubject, labelConsultaMarcacaoEmailBody, inputConsultaMarcacaoEmailBody ); + } + + private void setupConsultaMarcacaoObservacoesPanel() + { + setupSimpleDataPanel( panelConsultaMarcacaoObservacao, "Observa" + ccedil + otilde + "es", inputConsultaMarcacaoObsMensagem ); + } + + private void setupExamePanel() + { + setupSimpleDataPanel( panelExame, "Exame", labelExameEstado, inputExameEstado, labelExameData, inputExameData, labelExameGruposEcds, inputExameGruposEcds, new JPanel() ); + } + + private void setupExameMarcacaoPanel() + { + setupSimpleDataPanel( panelExameMarcacao, "Marca" + ccedil + atilde + "o de Exame", labelExameMarcacaoEstado, inputExameMarcacaoEstado, labelExameMarcacaoData, inputExameMarcacaoData, labelExameMarcacaoGruposEcds, inputExameMarcacaoGruposEcds, labelExameMarcacaoPrestador, inputExameMarcacaoPrestador, labelExameMarcacaoAnalisador, inputExameMarcacaoAnalisador, labelExameMarcacaoDataRecepcao, inputExameMarcacaoDataRecepcao, new JPanel() ); + } + + private void setupExameMarcacaoEmailPanel() + { + setupSimpleDataPanel( panelExameMarcacaoEmail, "Email", labelExameMarcacaoEmailData, inputExameMarcacaoEmailData, labelExameMarcacaoEmailSubject, inputExameMarcacaoEmailSubject, labelExameMarcacaoEmailBody, inputExameMarcacaoEmailBody ); + } + + private void setupExameMarcacaoObservacoesPanel() + { + setupSimpleDataPanel( panelExameMarcacaoObservacao, "Observa" + ccedil + otilde + "es", inputExameMarcacaoObsMensagem ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoTreePanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoTreePanel.java new file mode 100755 index 00000000..b3763f50 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoTreePanel.java @@ -0,0 +1,497 @@ +package siprp.medicina.processo.ui; + +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.APAGAR_CONSULTA; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.APAGAR_CONSULTA_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.APAGAR_EXAME_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.APAGAR_PROCESSO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_CONSULTA; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_CONSULTA_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_CONSULTA_MARCACAO_EMAIL; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_CONSULTA_MARCACAO_OBSERVACOES; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_EXAME; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_EXAME_MARCACAO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_EXAME_MARCACAO_EMAIL; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_EXAME_MARCACAO_OBSERVACOES; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_FICHA; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CREATE_PROCESSO; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.LOAD_TRABALHADOR; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.REFRESH; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_TREE_NODE; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; + +import leaf.ui.LeafWindow; +import leaf.ui.LeafLogic.LeafUIActionBinding; +import leaf.ui.LeafWindow.ActionActivation; + +import org.apache.cayenne.CayenneDataObject; + +import siprp.database.cayenne.objects.Trabalhadores; +import siprp.database.cayenne.objects.TrabalhadoresConsultas; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatas; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatasEmails; +import siprp.database.cayenne.objects.TrabalhadoresConsultasDatasObservacoes; +import siprp.database.cayenne.objects.TrabalhadoresEcds; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatas; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatasEmails; +import siprp.database.cayenne.objects.TrabalhadoresEcdsDatasObservacoes; +import siprp.database.cayenne.objects.TrabalhadoresFichasAptidao; +import siprp.database.cayenne.objects.TrabalhadoresProcesso; +import siprp.medicina.processo.ProcessoDataProvider; +import siprp.medicina.processo.estrutura.ConsultaMutableTreeNode; +import siprp.medicina.processo.estrutura.DataMutableTreeNode; +import siprp.medicina.processo.estrutura.ECDsMutableTreeNode; +import siprp.medicina.processo.estrutura.EstruturaProcessoRenderer; +import siprp.medicina.processo.estrutura.FichaAptidaoMutableTreeNode; +import siprp.medicina.processo.estrutura.MailMutableTreeNode; +import siprp.medicina.processo.estrutura.ObservacoesMutableTreeNode; +import siprp.medicina.processo.estrutura.ProcessoMutableTreeNode; +import siprp.medicina.processo.estrutura.TrabalhadorMutableTreeNode; + +public class ProcessoTreePanel extends JPanel +{ + private static final long serialVersionUID = 1L; + + private final LeafWindow parentWindow; + + private final JScrollPane mainScroll = new JScrollPane();; + + protected TrabalhadorMutableTreeNode rootNode; + + private final Map nodeByObject = new HashMap(); + + @ActionActivation(onSelect = SELECT_TREE_NODE, onChange = "") + public JTree mainTree; + + protected ProcessoDataProvider provider; + + public ProcessoTreePanel(LeafWindow parentWindow) + { + super(); + this.parentWindow = parentWindow; + try + { + provider = ProcessoDataProvider.getProvider(); + + } catch( Exception e ) + { + provider = null; + e.printStackTrace(); + } + setupLayout(); + setupComponents(); + placeComponents(); + } + + private void setupLayout() + { + double[] cols = new double[] { + TableLayout.FILL + }; + double[] rows = new double[] { + TableLayout.FILL + }; + TableLayout layout = new TableLayout( cols, rows ); + this.setLayout( layout ); + } + + private void setupComponents() + { + this.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Processos" ) ); + mainScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED ); + mainScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED ); + rootNode = new TrabalhadorMutableTreeNode( "" ); + mainTree = new JTree( rootNode ); + mainTree.setExpandsSelectedPaths( true ); + mainTree.setCellRenderer( new EstruturaProcessoRenderer() ); + mainScroll.setViewportView( mainTree ); + } + + private void placeComponents() + { + this.add( mainScroll, new TableLayoutConstraints( 0, 0 ) ); + } + + @LeafUIActionBinding(action = LOAD_TRABALHADOR) + public void setTrabalhador( Trabalhadores trabalhador ) + { + clear(); + if( trabalhador == null ) + { + return; + } + rootNode.setUserObject( trabalhador ); + List nodes = loadProcessos( trabalhador ); + for( DefaultMutableTreeNode node : nodes ) + { + addNodeTo( node, rootNode ); + } + ((DefaultTreeModel) mainTree.getModel()).nodeStructureChanged( rootNode ); + int count = mainTree.getRowCount(); + for( int n = count - 1; n >= 0; n-- ) + { + mainTree.expandRow( n ); + } + } + + @LeafUIActionBinding(action = CREATE_PROCESSO) + public void createProcessoNode( TrabalhadoresProcesso processo ) + { + if( processo != null ) + { + ProcessoMutableTreeNode node = new ProcessoMutableTreeNode( processo ); + addAndRefresh( node, rootNode ); + } + } + + @LeafUIActionBinding(action = CREATE_FICHA) + public void createFichaNode() + { + // if( ficha != null ) + // { + // FichaAptidaoMutableTreeNode node = new FichaAptidaoMutableTreeNode( + // ficha ); + // DefaultMutableTreeNode parentNode = nodeByObject.get( + // ficha.getToTrabalhadoresProcesso() ); + // addAndRefresh( node, parentNode ); + // } + } + + @LeafUIActionBinding(action = APAGAR_PROCESSO) + public void apagarProcessoNode( TrabalhadoresProcesso processo ) + { + if( processo != null ) + { + for( int i = 0; i < rootNode.getChildCount(); ++i ) + { + DefaultMutableTreeNode node = (DefaultMutableTreeNode) rootNode.getChildAt( i ); + + if( processo.equals( node.getUserObject() ) ) + { + removeNode( node ); + break; + } + } + } + } + + @LeafUIActionBinding(action = APAGAR_CONSULTA) + public void apagarConsultaNode( TrabalhadoresConsultas consulta ) + { + if( consulta != null ) + { + DefaultMutableTreeNode node = nodeByObject.get( consulta ); + if( node != null ) + { + removeNode( node ); + } + } + } + + @LeafUIActionBinding(action = APAGAR_CONSULTA_MARCACAO) + public void apagarConsultaMarcacaoNode( TrabalhadoresConsultasDatas consulta ) + { + if( consulta != null ) + { + DefaultMutableTreeNode node = nodeByObject.get( consulta ); + if( node != null ) + { + removeNode( node ); + } + } + } + + @LeafUIActionBinding(action = APAGAR_EXAME_MARCACAO) + public void apagarExameMarcacaoNode( TrabalhadoresEcdsDatas exame ) + { + if( exame != null ) + { + DefaultMutableTreeNode node = nodeByObject.get( exame ); + if( node != null ) + { + removeNode( node ); + } + } + } + + @LeafUIActionBinding(action = CREATE_CONSULTA) + public void createConsultaNode( TrabalhadoresConsultas consulta ) + { + if( consulta != null ) + { + DefaultMutableTreeNode parentNode = nodeByObject.get( consulta.getToTrabalhadoresProcesso() ); + ConsultaMutableTreeNode node = new ConsultaMutableTreeNode( consulta ); + node.setData( consulta.getData() ); + addAndRefresh( node, parentNode ); + } + } + + @LeafUIActionBinding(action = CREATE_CONSULTA_MARCACAO) + public void createConsultaMarcacaoNode( TrabalhadoresConsultasDatas marcacao ) + { + if( marcacao != null ) + { + DefaultMutableTreeNode parentNode = nodeByObject.get( marcacao.getToTrabalhadoresConsultas() ); + DataMutableTreeNode node = new DataMutableTreeNode( marcacao ); + addAndRefresh( node, parentNode ); + } + } + + @LeafUIActionBinding(action = CREATE_CONSULTA_MARCACAO_EMAIL) + public void createConsultaMarcacaoEmailNode( TrabalhadoresConsultasDatasEmails email ) + { + if( email != null ) + { + DefaultMutableTreeNode parentNode = nodeByObject.get( email.getToTrabalhadoresConsultasDatas() ); + MailMutableTreeNode node = new MailMutableTreeNode( email ); + addAndRefresh( node, parentNode ); + } + } + + @LeafUIActionBinding(action = CREATE_CONSULTA_MARCACAO_OBSERVACOES) + public void createConsultaMarcacaoObservacoesNode( TrabalhadoresConsultasDatasObservacoes observacoes ) + { + if( observacoes != null ) + { + DefaultMutableTreeNode parentNode = nodeByObject.get( observacoes.getToTrabalhadoresConsultasDatas() ); + ObservacoesMutableTreeNode node = new ObservacoesMutableTreeNode( observacoes ); + addNodeTo( node, parentNode ); + ((DefaultTreeModel) mainTree.getModel()).nodeStructureChanged( parentNode ); + mainTree.setSelectionPath( new TreePath( node.getPath() ) ); + } + } + + @LeafUIActionBinding(action = CREATE_EXAME) + public void createExameNode( TrabalhadoresEcds exame ) + { + if( exame != null ) + { + DefaultMutableTreeNode parentNode = nodeByObject.get( exame.getToTrabalhadoresProcesso() ); + ECDsMutableTreeNode node = new ECDsMutableTreeNode( exame ); + node.setData( exame.getData() ); + addAndRefresh( node, parentNode ); + } + } + + @LeafUIActionBinding(action = CREATE_EXAME_MARCACAO) + public void createExameMarcacaoNode( TrabalhadoresEcdsDatas marcacao ) + { + if( marcacao != null ) + { + DefaultMutableTreeNode parentNode = nodeByObject.get( marcacao.getToTrabalhadoresEcds() ); + DataMutableTreeNode node = new DataMutableTreeNode( marcacao ); + addAndRefresh( node, parentNode ); + } + } + + @LeafUIActionBinding(action = CREATE_EXAME_MARCACAO_EMAIL) + public void createExameMarcacaoEmailNode( TrabalhadoresEcdsDatasEmails email ) + { + if( email != null ) + { + DefaultMutableTreeNode parentNode = nodeByObject.get( email.getToTrabalhadoresEcdsDatas() ); + MailMutableTreeNode node = new MailMutableTreeNode( email ); + addAndRefresh( node, parentNode ); + } + } + + @LeafUIActionBinding(action = CREATE_EXAME_MARCACAO_OBSERVACOES) + public void createConsultaMarcacaoObservacoesNode( TrabalhadoresEcdsDatasObservacoes observacoes ) + { + if( observacoes != null ) + { + DefaultMutableTreeNode parentNode = nodeByObject.get( observacoes.getToTrabalhadoresEcdsDatas() ); + ObservacoesMutableTreeNode node = new ObservacoesMutableTreeNode( observacoes ); + addNodeTo( node, parentNode ); + ((DefaultTreeModel) mainTree.getModel()).nodeStructureChanged( parentNode ); + mainTree.setSelectionPath( new TreePath( node.getPath() ) ); + } + } + + @LeafUIActionBinding(action = REFRESH) + public void refresh() + { + DefaultMutableTreeNode selected = getSelectedNode(); + if( selected != null ) + { + // ((DefaultTreeModel) mainTree.getModel()).nodeStructureChanged( + // rootNode ); + mainTree.setSelectionPath( new TreePath( rootNode.getPath() ) ); + mainTree.setSelectionPath( new TreePath( selected.getPath() ) ); + } + revalidate(); + repaint(); + } + + protected List loadProcessos( Trabalhadores trabalhador ) + { + List result = new ArrayList(); + List processos = trabalhador.getTrabalhadoresProcessoArray(); + for( TrabalhadoresProcesso trabalhadoresProcesso : processos ) + { + result.add( loadProcesso( trabalhadoresProcesso ) ); + } + return result; + } + + private ProcessoMutableTreeNode loadProcesso( TrabalhadoresProcesso processo ) + { + ProcessoMutableTreeNode node = new ProcessoMutableTreeNode( processo ); + node.removeAllChildren(); + for( TrabalhadoresConsultas current : (List) processo.getTrabalhadoresConsultasArray() ) + { + addNodeTo( loadConsulta( current ), node ); + } + for( TrabalhadoresEcds current : (List) processo.getTrabalhadoresEcdsArray() ) + { + addNodeTo( loadExame( current ), node ); + } + + List fichas = processo.getTrabalhadoresFichasAptidaoArray(); + if( fichas != null ) + { + TrabalhadoresFichasAptidao ficha = null; + for( TrabalhadoresFichasAptidao currentFicha : fichas ) + { + if( ficha == null || ficha.getId() < currentFicha.getId() ) + { + ficha = currentFicha; + } + } + if( ficha != null ) + { + addNodeTo( loadFicha( ficha ), node ); + } + } + return node; + } + + private FichaAptidaoMutableTreeNode loadFicha( TrabalhadoresFichasAptidao ficha ) + { + FichaAptidaoMutableTreeNode result = new FichaAptidaoMutableTreeNode( ficha ); + return result; + } + + private ECDsMutableTreeNode loadExame( TrabalhadoresEcds exame ) + { + ECDsMutableTreeNode node = new ECDsMutableTreeNode( exame ); + node.setData( exame.getData() ); + node.removeAllChildren(); + List marcacoes = exame.getTrabalhadoresEcdsDatasArray(); + for( TrabalhadoresEcdsDatas marcacao : marcacoes ) + { + addNodeTo( loadExameMarcacao( marcacao ), node ); + } + return node; + } + + private DataMutableTreeNode loadExameMarcacao( TrabalhadoresEcdsDatas marcacao ) + { + DataMutableTreeNode node = new DataMutableTreeNode( marcacao ); + for( TrabalhadoresEcdsDatasEmails email : (List) marcacao.getTrabalhadoresEcdsDatasEmailsArray() ) + { + addNodeTo( new MailMutableTreeNode( email ), node ); + } + for( TrabalhadoresEcdsDatasObservacoes observacoes : (List) marcacao.getTrabalhadoresEcdsDatasObservacoesArray() ) + { + addNodeTo( new ObservacoesMutableTreeNode( observacoes ), node ); + } + return node; + } + + private ConsultaMutableTreeNode loadConsulta( TrabalhadoresConsultas consulta ) + { + ConsultaMutableTreeNode node = new ConsultaMutableTreeNode( consulta ); + node.setData( consulta.getData() ); + node.removeAllChildren(); + List marcacoes = consulta.getTrabalhadoresConsultasDatasArray(); + for( TrabalhadoresConsultasDatas marcacao : marcacoes ) + { + addNodeTo( loadMarcacao( marcacao ), node ); + } + return node; + } + + private DataMutableTreeNode loadMarcacao( TrabalhadoresConsultasDatas marcacao ) + { + DataMutableTreeNode node = new DataMutableTreeNode( marcacao ); + for( TrabalhadoresConsultasDatasEmails email : (List) marcacao.getTrabalhadoresConsultasDatasEmailsArray() ) + { + addNodeTo( new MailMutableTreeNode( email ), node ); + } + for( TrabalhadoresConsultasDatasObservacoes observacoes : (List) marcacao.getTrabalhadoresConsultasDatasObservacoesArray() ) + { + addNodeTo( new ObservacoesMutableTreeNode( observacoes ), node ); + } + return node; + } + + private void addNodeTo( DefaultMutableTreeNode node, DefaultMutableTreeNode to ) + { + if( node.getUserObject() != null && node.getUserObject() instanceof CayenneDataObject ) + { + nodeByObject.put( (CayenneDataObject) node.getUserObject(), node ); + } + to.add( node ); + } + + private void addAndRefresh( DefaultMutableTreeNode node, DefaultMutableTreeNode parentNode ) + { + addNodeTo( node, parentNode ); + refresh( node, parentNode ); + } + + private void removeNode( DefaultMutableTreeNode node ) + { + if( node != null ) + { + DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node.getParent(); + if( parent == null ) + { + parent = rootNode; + } + node.removeFromParent(); + nodeByObject.remove( node.getUserObject() ); + refresh( parent, rootNode ); + } + } + + private void refresh( DefaultMutableTreeNode newSelection, DefaultMutableTreeNode parentNode ) + { + ((DefaultTreeModel) mainTree.getModel()).nodeStructureChanged( parentNode ); + mainTree.setSelectionPath( new TreePath( newSelection.getPath() ) ); + } + + private DefaultMutableTreeNode getSelectedNode() + { + DefaultMutableTreeNode result = null; + Object[] nodes = mainTree.getSelectionPath() == null ? null : mainTree.getSelectionPath().getPath(); + if( nodes != null && nodes.length > 0 && nodes[nodes.length - 1] instanceof DefaultMutableTreeNode ) + { + result = (DefaultMutableTreeNode) nodes[nodes.length - 1]; + } + return result; + } + + public void clear() + { + rootNode.setUserObject( "" ); + mainTree.clearSelection(); + mainTree.setRootVisible( true ); + rootNode.removeAllChildren(); + ((DefaultTreeModel) mainTree.getModel()).nodeStructureChanged( rootNode ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ui/TrabalhadoresChooserPanel.java b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ui/TrabalhadoresChooserPanel.java new file mode 100755 index 00000000..a878d840 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/medicina/processo/ui/TrabalhadoresChooserPanel.java @@ -0,0 +1,133 @@ +package siprp.medicina.processo.ui; + +import static leaf.ui.LeafLogic.ACTION_STARTUP; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.LOAD_TRABALHADOR; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_EMPRESA; +import static siprp.medicina.processo.logic.MedicinaProcessoLogic.SELECT_ESTABELECIMENTO; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.util.Collection; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.ListSelectionModel; + +import leaf.ui.LeafTableModel; +import leaf.ui.LeafWindow; +import leaf.ui.LeafLogic.LeafUIActionBinding; +import leaf.ui.LeafWindow.ActionActivation; +import siprp.database.cayenne.objects.Empresas; +import siprp.database.cayenne.objects.Estabelecimentos; + +import com.evolute.utils.tables.BaseTable; + +public class TrabalhadoresChooserPanel extends JPanel +{ + private static final long serialVersionUID = 1L; + + private final LeafWindow parentWindow; + + @ActionActivation(onSelect = SELECT_EMPRESA, onChange = "") + public BaseTable empresasTable; + public LeafTableModel empresasModel; + + @ActionActivation(onSelect = SELECT_ESTABELECIMENTO, onChange = "") + public BaseTable estabelecimentosTable; + public LeafTableModel estabelecimentosModel; + + @ActionActivation(onSelect = LOAD_TRABALHADOR, onChange = "") + public BaseTable trabalhadoresTable; + public LeafTableModel trabalhadoresModel; + + public TrabalhadoresChooserPanel(LeafWindow parentWindow) + { + super(); + this.parentWindow = parentWindow; + + setupComponents(); + } + + private void setupComponents() + { + empresasModel = new LeafTableModel( new String[] { + "Empresas" + } ); + empresasTable = new BaseTable( empresasModel ); + empresasTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + empresasTable.setNonResizableNorReordable(); + JScrollPane empresasScroll = new JScrollPane( empresasTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + estabelecimentosModel = new LeafTableModel( new String[] { + "Estabelecimentos" + } ); + estabelecimentosTable = new BaseTable( estabelecimentosModel ); + estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + estabelecimentosTable.setNonResizableNorReordable(); + JScrollPane estabelecimentosScroll = new JScrollPane( estabelecimentosTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + trabalhadoresModel = new LeafTableModel( new String[] { + "Trabalhadores" + } ); + trabalhadoresTable = new BaseTable( trabalhadoresModel ); + trabalhadoresTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + trabalhadoresTable.setNonResizableNorReordable(); + JScrollPane trabalhadoresScroll = new JScrollPane( trabalhadoresTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridwidth = 1; + constraints.gridheight = 1; + constraints.weightx = 0.3; + constraints.weighty = 1; + + gridbag.setConstraints( empresasScroll, constraints ); + + gridbag.setConstraints( estabelecimentosScroll, constraints ); + + constraints.weightx = 0.4; + constraints.gridheight = GridBagConstraints.REMAINDER; + gridbag.setConstraints( trabalhadoresScroll, constraints ); + + add( empresasScroll ); + add( estabelecimentosScroll ); + add( trabalhadoresScroll ); + + } + + @LeafUIActionBinding(action= ACTION_STARTUP) + public void fillEmpresas( Collection allEmpresas ) + { + empresasTable.clearSelection(); + empresasModel.clearAll(); + if( allEmpresas != null ) + { + empresasModel.setValues( allEmpresas ); + } + } + + @LeafUIActionBinding(action = SELECT_EMPRESA) + public void fillEstablecimentos( Empresas empresa ) + { + estabelecimentosTable.clearSelection(); + estabelecimentosModel.clearAll(); + if( empresa != null ) + { + estabelecimentosModel.setValues( empresa.getEstabelecimentosArray() ); + } + } + + @LeafUIActionBinding(action = SELECT_ESTABELECIMENTO) + public void fillTrabalhadores(Estabelecimentos estabelecimento) + { + trabalhadoresTable.clearSelection(); + trabalhadoresModel.clearAll(); + if( estabelecimento != null ) + { + trabalhadoresModel.setValues( estabelecimento.getTrabalhadoresArray() ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/paths b/branches/SIPRP/SIPRPSoft/src/siprp/paths new file mode 100644 index 00000000..f4c4fe58 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/paths @@ -0,0 +1,2 @@ +/home/fpalma/projectos/SIPRP/SIPRPSoft/src/siprp/teste.xml +/home/fpalma/projectos2/SIPRP/SIPRPSoft/src/siprp/analise_acidentes_trabalho.xsl \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/pesquisas/PesquisasProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/pesquisas/PesquisasProvider.java new file mode 100644 index 00000000..b7644da5 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/pesquisas/PesquisasProvider.java @@ -0,0 +1,922 @@ +/* + * EstatisticasProvider.java + * + * Created on 3 de Junho de 2004, 18:23 + */ + +package siprp.pesquisas; + +import java.util.Calendar; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Vector; + +import siprp.data.Marcacao; +import siprp.data.outer.EmpresasData; +import siprp.data.outer.MarcacoesTrabalhadorData; +import siprp.data.outer.TrabalhadoresData; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.metadb.MetaProvider; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; +import com.evolute.utils.sql.expression.Par; +/** + * + * @author fpalma + */ +public class PesquisasProvider extends MetaProvider +{ + private static final Object LOCK = new Object(); + private static PesquisasProvider instance = null; + private final Executer executer; + + private static final int TIPOS_OCASIONAL[] = + new int[]{ 5, //mudanca de posto + 6, //mudancas das condicoes + -1, //apos 30 dias + 4, //iniciativa do medico + 3, //pedido do trabalhador + 2, //acidente de trabalho + 1, //Doenca subita + -1, //Cessacao do contrato + 10 //Outras razoes + }; + public static final String DESCRICAO_TIPOS_OCASIONAL[] = + new String[]{ "MUDAN\u00C7A DE POSTO DE TRABALHO", + "ALTERA\u00C7\u00D5ES NO POSTO DE TRABALHO", + "REGRESSO AO TRABALHO AP\u00D3S AUS\u00CANCIA SUPERIOR A 30 DIAS", + "INICIATIVA DO M\u00C9DICO", + "PEDIDO DO TRABALHADOR", + "ACIDENTE DE TRABALHO", + "DOEN\u00C7A S\u00DABITA", + "POR CESSA\u00C7\u00C3O DO CONTRATO DE TRABALHO", + "OUTRAS RAZ\u00D5ES" }; + + private static final int TIPOS_EXAME[] = + new int[]{ 1, //admissao + 2, //periodico + 3 //ocasional + }; + private static final int TIPO_OCASIONAL = 3; + + public static final String DESCRICAO_TIPOS_EXAME[] = + new String[]{ "TOTAL DE EXAMES DE ADMISS\u00C3O", + "TOTAL DE EXAMES PERI\u00D3DICOS", + "TOTAL DE EXAMES OCASIONAIS" }; + + public static final String PAR_ANO = "PAR_ANO"; + public static final String PAR_EMPRESA = "PAR_EMPRESA"; + public static final String PAR_ESTABELECIMENTO = "PAR_ESTABELECIMENTO"; + public static final String PAR_TIPO_EXAME = "PAR_TIPO_EXAME"; + public static final String PAR_RESULTADO = "PAR_RESULTADO"; + public static final String PAR_SEXO = "PAR_SEXO"; + public static final String PAR_GRUPO_ETARIO = "PAR_GRUPO_ETARIO"; + + /** Creates a new instance of EstatisticasProvider */ + public PesquisasProvider() throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + executer = dbm.getSharedExecuter( this ); + } + + public static MetaProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new PesquisasProvider(); + } + } + return instance; + } + + public IDObject[] getAllEmpresas() + throws Exception + { + Select select = new Select( new String[]{ "empresas" }, + new String[]{ EmpresasData.ID, EmpresasData.DESIGNACAO_SOCIAL, EmpresasData.DESIGNACAO_SOCIAL_PLAIN }, + new Field( EmpresasData.INACTIVO ).isDifferent( "y" ), + new String[]{ EmpresasData.DESIGNACAO_SOCIAL_PLAIN }, null ); +// Select select = new Select( "SELECT e.id, e.designacao_social FROM empresas e ORDER BY lower( e.designacao_social );" ); + Virtual2DArray array = executer.executeQuery( select ); + IDObject empresas[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < empresas.length; n++ ) + { + empresas[ n ] = new MappableObject( (Integer)array.get( n, 0 ), array.get( n, 1 ) ); + } + return empresas; + } + + public IDObject []getAllEstabelecimentosForEmpresa( Integer empresaID ) + throws Exception + { + return ( ( siprp.FichaDataProvider )siprp.FichaDataProvider.getProvider() ).getAllEstabelecimentosForEmpresa( empresaID ); + } + + public int[] countTrabalhadoresEstabelecimentoDezembro( Integer estabelecimentoID, int ano ) + throws Exception + { + Calendar cal = Calendar.getInstance(); + cal.set( Calendar.YEAR, ano ); + cal.set( Calendar.MONTH, 11 ); + cal.set( Calendar.DAY_OF_MONTH, 30 ); + Select select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "COUNT(" + TrabalhadoresData.ID + ")" }, + new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ).and( + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( TrabalhadoresData.SEXO ).isEqual( "m" ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and( + new Par( new Field( TrabalhadoresData.DATA_DEMISSAO ).isGreater( cal.getTime() ).or( + new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + int contagem[] = new int[ 2 ]; + contagem[ 0 ] = ( ( Number ) array.get( 0, 0 ) ).intValue(); + select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "COUNT(" + TrabalhadoresData.ID + ")" }, + new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ).and( + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( TrabalhadoresData.SEXO ).isEqual( "f" ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and( + new Par( new Field( TrabalhadoresData.DATA_DEMISSAO ).isGreater( cal.getTime() ).or( + new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ) ); + array = executer.executeQuery( select ); + contagem[ 1 ] = ( ( Number ) array.get( 0, 0 ) ).intValue(); + return contagem; + } + + public int[][] countTrabalhadoresEstabelecimentoDezembroPorGrupoEtario( Integer estabelecimentoID, int ano ) + throws Exception + { + Calendar eoy = Calendar.getInstance(); + eoy.set( Calendar.YEAR, ano ); + eoy.set( Calendar.MONTH, 11 ); + eoy.set( Calendar.DAY_OF_MONTH, 30 ); + + Calendar today = Calendar.getInstance(); + today.set( Calendar.YEAR, ano ); + today.set( Calendar.MONTH, 11 ); + today.set( Calendar.DAY_OF_MONTH, 31 ); + today.set( Calendar.HOUR_OF_DAY, 23 ); + Calendar age18 = (Calendar) today.clone(); + age18.add( Calendar.YEAR, -18 ); + Calendar age50 = (Calendar) today.clone(); + age50.add( Calendar.YEAR, -50 ); + //0-18 + Select select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "COUNT(" + TrabalhadoresData.ID + ")" }, + new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ).and( + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( TrabalhadoresData.SEXO ).isEqual( "m" ) ).and( + new Field( TrabalhadoresData.DATA_NASCIMENTO ).isGreater( age18.getTime() ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and( + new Par( new Field( TrabalhadoresData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or( + new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + int contagem[][] = new int[ 3 ][ 2 ]; + contagem[ 0 ][ 0 ] = ( ( Number ) array.get( 0, 0 ) ).intValue(); + select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "COUNT(" + TrabalhadoresData.ID + ")" }, + new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ).and( + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( TrabalhadoresData.SEXO ).isEqual( "f" ) ).and( + new Field( TrabalhadoresData.DATA_NASCIMENTO ).isGreater( age18.getTime() ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and( + new Par( new Field( TrabalhadoresData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or( + new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ) ); + array = executer.executeQuery( select ); + contagem[ 0 ][ 1 ] = ( ( Number ) array.get( 0, 0 ) ).intValue(); + //18-49 + select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "COUNT(" + TrabalhadoresData.ID + ")" }, + new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ).and( + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( TrabalhadoresData.SEXO ).isEqual( "m" ) ).and( + new Field( TrabalhadoresData.DATA_NASCIMENTO ).isLessOrEqual( age18.getTime() ) ).and( + new Field( TrabalhadoresData.DATA_NASCIMENTO ).isGreater( age50.getTime() ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and( + new Par( new Field( TrabalhadoresData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or( + new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ) ); + array = executer.executeQuery( select ); + contagem[ 1 ][ 0 ] = ( ( Number ) array.get( 0, 0 ) ).intValue(); + select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "COUNT(" + TrabalhadoresData.ID + ")" }, + new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ).and( + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( TrabalhadoresData.SEXO ).isEqual( "f" ) ).and( + new Field( TrabalhadoresData.DATA_NASCIMENTO ).isLessOrEqual( age18.getTime() ) ).and( + new Field( TrabalhadoresData.DATA_NASCIMENTO ).isGreater( age50.getTime() ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and( + new Par( new Field( TrabalhadoresData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or( + new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ) ); + array = executer.executeQuery( select ); + contagem[ 1 ][ 1 ] = ( ( Number ) array.get( 0, 0 ) ).intValue(); + + //50- + select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "COUNT(" + TrabalhadoresData.ID + ")" }, + new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ).and( + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( TrabalhadoresData.SEXO ).isEqual( "m" ) ).and( + new Field( TrabalhadoresData.DATA_NASCIMENTO ).isLessOrEqual( age50.getTime() ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and( + new Par( new Field( TrabalhadoresData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or( + new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ) ); + array = executer.executeQuery( select ); + contagem[ 2 ][ 0 ] = ( ( Number ) array.get( 0, 0 ) ).intValue(); + select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "COUNT(" + TrabalhadoresData.ID + ")" }, + new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ).and( + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( TrabalhadoresData.SEXO ).isEqual( "f" ) ).and( + new Field( TrabalhadoresData.DATA_NASCIMENTO ).isLessOrEqual( age50.getTime() ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and( + new Par( new Field( TrabalhadoresData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or( + new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ) ); + array = executer.executeQuery( select ); + contagem[ 2 ][ 1 ] = ( ( Number ) array.get( 0, 0 ) ).intValue(); + + return contagem; + } + + public int[][] countExamesEstabelecimentoDezembroPorGrupoEtario( Integer estabelecimentoID, int ano ) + throws Exception + { + Calendar today = Calendar.getInstance(); + today.set( Calendar.YEAR, ano ); + today.set( Calendar.MONTH, 11 ); + today.set( Calendar.DAY_OF_MONTH, 31 ); + today.set( Calendar.HOUR_OF_DAY, 23 ); + Calendar age18 = (Calendar) today.clone(); + age18.add( Calendar.YEAR, -18 ); + Calendar age50 = (Calendar) today.clone(); + age50.add( Calendar.YEAR, -50 ); + Calendar dates[] = new Calendar[]{ null, age18, age50, null }; + String sexos[] = new String[]{ "m", "f" }; + + int contagem[][] = new int[ 4 ][ 6 ]; + for( int t = 0; t < TIPOS_EXAME.length; t++ ) + { + for( int s = 0; s < sexos.length; s++ ) + { + for( int d = 0; d < dates.length - 1; d++ ) + { + Select select = + new Select( new String[]{ "exames", "trabalhadores" }, + new String[]{ "DISTINCT trabalhadores.id, exames.data" }, + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ).and( + new Field( "exames.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ).and( + new Field( TrabalhadoresData.SEXO ).isEqual( sexos[s] ) ).and( + new Field( "YEAR( exames.data )" ).isEqual( new Integer( ano ) ) ).and( + dates[ d ] == null ? new Field( "exames.id" ).isDifferent( null ) : + new Field( TrabalhadoresData.DATA_NASCIMENTO ).isLessOrEqual( dates[ d ].getTime() ) ).and( + dates[ d + 1 ] == null ? new Field( "exames.id" ).isDifferent( null ) : + new Field( TrabalhadoresData.DATA_NASCIMENTO ).isGreater( dates[ d + 1 ].getTime() ) ).and( + new Field( "exames.tipo" ).isEqual( new Integer( TIPOS_EXAME[ t ] ) ) ).and( + new Field( "exames.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) ); + try + { + Virtual2DArray array = executer.executeQuery( select ); + contagem[ t ][ s * 3 + d ] = array.columnLength(); +//System.out.println( select + ": " + contagem[ t ][ s * 3 + d ] ); + } + catch( Exception ex ) + { + contagem[ t ][ s * 3 + d ] = -1; + } + } + } + } + + return contagem; + } + + public int[][] countExamesOcasionaisEstabelecimentoDezembroPorGrupoEtario( Integer estabelecimentoID, int ano ) + throws Exception + { + Calendar today = Calendar.getInstance(); + today.set( Calendar.YEAR, ano ); + today.set( Calendar.MONTH, 11 ); + today.set( Calendar.DAY_OF_MONTH, 31 ); + today.set( Calendar.HOUR_OF_DAY, 23 ); + Calendar age18 = (Calendar) today.clone(); + age18.add( Calendar.YEAR, -18 ); + Calendar age50 = (Calendar) today.clone(); + age50.add( Calendar.YEAR, -50 ); + Calendar dates[] = new Calendar[]{ null, age18, age50, null }; + String sexos[] = new String[]{ "m", "f" }; + + int contagem[][] = new int[ TIPOS_OCASIONAL.length ][ ( dates.length - 1 ) * sexos.length ]; + for( int t = 0; t < TIPOS_OCASIONAL.length; t++ ) + { + for( int s = 0; s < sexos.length; s++ ) + { + for( int d = 0; d < dates.length - 1; d++ ) + { + if( TIPOS_OCASIONAL[t] == -1 ) + { + contagem[ t ][ s * 3 + d ] = -1; + continue; + } + + Select select = + new Select( new String[]{ "exames", "trabalhadores" }, + new String[]{ "DISTINCT trabalhadores.id, exames.data" }, + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ).and( + new Field( "exames.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ).and( + new Field( TrabalhadoresData.SEXO ).isEqual( sexos[s] ) ).and( + new Field( "YEAR( exames.data )" ).isEqual( new Integer( ano ) ) ).and( + dates[ d ] == null ? new Field( "exames.id" ).isDifferent( null ) : + new Field( TrabalhadoresData.DATA_NASCIMENTO ).isLessOrEqual( dates[ d ].getTime() ) ).and( + dates[ d + 1 ] == null ? new Field( "exames.id" ).isDifferent( null ) : + new Field( TrabalhadoresData.DATA_NASCIMENTO ).isGreater( dates[ d + 1 ].getTime() ) ).and( + new Field( "exames.tipo" ).isEqual( new Integer( 3 ) ) ).and( + new Field( "exames.ocasional" ).isEqual( new Integer( TIPOS_OCASIONAL[ t ] ) ) ).and( + new Field( "exames.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) ); + try + { + Virtual2DArray array = executer.executeQuery( select ); + contagem[ t ][ s * 3 + d ] = array.columnLength(); + } + catch( Exception ex ) + { + contagem[ t ][ s * 3 + d ] = -1; + } + } + } + } + + return contagem; + } + + public double[] countNumeroMedioTrabalhadoresEmpresa( Integer empresaID, int ano ) + throws Exception + { + double contagens[] = new double[ 2 ];; + Select select; + String sexos[] = new String[]{ "m", "f" }; + + for( int n = 0; n < sexos.length; n++ ) + { + select = + new Select( new String[]{ "estabelecimentos", "trabalhadores" }, + new String[]{ "COUNT(trabalhadores.id)" }, + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and( + new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLess( new Integer( ano ) ).or( + new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ) ).and( + new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_DEMISSAO + ")" ).isGreater( new Integer( ano ) ).or( + new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ).and( + new Field( "empresa_id" ).isEqual( empresaID ) ).and( + new Field( TrabalhadoresData.SEXO ).isEqual( sexos[ n ] ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + contagens[ n ] = ( ( Number ) array.get( 0, 0 ) ).doubleValue(); + } + for( int n = 0; n < sexos.length; n++ ) + { + select = + new Select( new String[]{ "estabelecimentos", "trabalhadores" }, + new String[]{ "SUM( MONTH( data_demissao ) )" }, + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and( + new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLess( new Integer( ano ) ).or( + new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ) ).and( + new Field( "YEAR(" + TrabalhadoresData.DATA_DEMISSAO + ")" ).isEqual( new Integer( ano ) ) ).and( + new Field( "empresa_id" ).isEqual( empresaID ) ).and( + new Field( TrabalhadoresData.SEXO ).isEqual( sexos[ n ] ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ) ); +System.out.println( "SELECT: " + select ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.get( 0, 0 ) != null ) + { + contagens[ n ] += ( ( Number ) array.get( 0, 0 ) ).doubleValue() / 12.0; + } + } + + for( int n = 0; n < sexos.length; n++ ) + { + select = + new Select( new String[]{ "estabelecimentos", "trabalhadores" }, + new String[]{ "SUM( ( 1 + 12 - MONTH( data_admissao ) ) )" }, + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and( + new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isEqual( new Integer( ano ) ) ).and( + new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_DEMISSAO + ")" ).isGreater( new Integer( ano ) ).or( + new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ).and( + new Field( "empresa_id" ).isEqual( empresaID ) ).and( + new Field( TrabalhadoresData.SEXO ).isEqual( sexos[ n ] ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.get( 0, 0 ) != null ) + { + contagens[ n ] += ( ( Number ) array.get( 0, 0 ) ).doubleValue() / 12.0; + } + } + + for( int n = 0; n < sexos.length; n++ ) + { + select = + new Select( new String[]{ "estabelecimentos", "trabalhadores" }, + new String[]{ "SUM( ( 1 + MONTH( data_demissao ) - MONTH( data_admissao ) ) )" }, + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and( + new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isEqual( new Integer( ano ) ) ).and( + new Field( "YEAR(" + TrabalhadoresData.DATA_DEMISSAO + ")" ).isEqual( new Integer( ano ) ) ).and( + new Field( "empresa_id" ).isEqual( empresaID ) ).and( + new Field( TrabalhadoresData.SEXO ).isEqual( sexos[ n ] ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.get( 0, 0 ) != null ) + { + contagens[ n ] += ( ( Number ) array.get( 0, 0 ) ).doubleValue() / 12.0; + } + } + + return contagens; + } + + public double[] countNumeroTotalTrabalhadoresEmpresa( Integer empresaID, int ano ) + throws Exception + { + double contagens[] = new double[ 2 ];; + Select select; + String sexos[] = new String[]{ "m", "f" }; + + for( int n = 0; n < sexos.length; n++ ) + { + select = + new Select( new String[]{ "estabelecimentos", "trabalhadores" }, + new String[]{ "COUNT(trabalhadores.id)" }, + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and( + new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ) ).and( + new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_DEMISSAO + ")" ).isGreaterOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ).and( + new Field( "empresa_id" ).isEqual( empresaID ) ).and( + new Field( TrabalhadoresData.SEXO ).isEqual( sexos[ n ] ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + contagens[ n ] = ( ( Number ) array.get( 0, 0 ) ).doubleValue(); + } + return contagens; + } + + public String []getNomesExames() + throws Exception + { + String nomes[]; + Select select = + new Select( new String[]{ "tipos_exames_comp" }, + new String[]{ "descricao", "ordem" }, + null, + new String[]{ "ordem" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + nomes = new String[ array.columnLength() ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + nomes[ n ] = ( String )array.get( n, 0 ); + } + return nomes; + } + + public int []countExamesComplementaresEmpresa( Integer empresaID, int ano ) + throws Exception + { +// Vector perfis[] = new Vector[ 2 ]; +// Hashtable contagens[] = new Hashtable[ 2 ]; +// Select select; +// Virtual2DArray array; +// +// for( int p = 0; p < 2; p++ ) +// { +// Integer pAux = new Integer( p + 1 ); +// perfis[ p ] = new Vector(); +// select = new Select( new String[]{"estabelecimentos", "trabalhadores", "marcacoes_trabalhador"}, +// new String[]{"COUNT(marcacoes_trabalhador.id)", TrabalhadoresData.PERFIL }, +// new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( +// new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( +// new Field( "empresa_id" ).isEqual( empresaID ) ).and( +// new Field( MarcacoesTrabalhadorData.TIPO ).isEqual( new Integer( MarcacoesTrabalhadorData.TIPO_EXAMES ) ) ).and( +// new Field( "YEAR( marcacoes_trabalhador.data ) " ).isEqual( new Integer( ano ) ).and( +// new Field( MarcacoesTrabalhadorData.ESTADO ).in( new Integer[]{ new Integer( 1 ), new Integer( 2 ) } ) ) ).and( +// new Field( "trabalhadores.perfil" ).isEqual( pAux ) ) ); +// array = executer.executeQuery( select ); +// +// select = +// new Select( new String[]{ "prt_elementos_protocolo", "prt_tipos_elementos_protocolo" }, +// new String[]{ "DISTINCT prt_tipos_elementos_protocolo.grupo_protocolo_id" }, +// new Field( "prt_elementos_protocolo.empresa_id" ).isEqual( empresaID ).and( +// new Field( "prt_elementos_protocolo.tipo_elemento_protocolo_id" ).isEqual( new Field( "prt_elementos_protocolo.id" ) ) ).and( +// new Field( "pr_elementos_protocolo.perfil" ).isEqual( new Integer( p + 1 ) ) ) ); +// array = executer.executeQuery( select ); +// for( int ecd = 0; ecd < array.columnLength(); ecd++ ) +// { +// perfis[ p ].add( ( Integer ) array.get( 0, 0 ) ); +// } +// } +// +// +// return contagens; + + + int contagens[]; + Select select; + select = new Select( new String[]{"empresas"}, new String[]{ "perfil_1", "perfil_2" }, + new Field( "id" ).isEqual( empresaID ) ); + Virtual2DArray array = executer.executeQuery( select ); + String p1Str = (String)array.get( 0, 0 ); + String p2Str = (String)array.get( 0, 1 ); + Number perfil1 = ( p1Str != null && p1Str.length() > 0 )?new Integer( p1Str ):null; + Number perfil2 = ( p2Str != null && p2Str.length() > 0 )?new Integer( p2Str ):null; + select = + new Select( new String[]{ "tipos_exames_comp" }, + new String[]{ "id", "ordem" }, + null, + new String[]{ "ordem" }, null ); + array = executer.executeQuery( select ); + contagens = new int[ array.columnLength() ]; + Hashtable idExames = new Hashtable(); + for( int n = 0; n < array.columnLength(); n++ ) + { + idExames.put( ( Number )array.get( n, 0 ), new Integer( n ) ); + } + if( perfil1 == null && perfil2 == null ) + { + return contagens; + } + else if( perfil1 == null ) + { + perfil1 = perfil2; + } + else if( perfil2 == null ) + { + perfil2 = perfil1; + } + select = new Select( new String[]{"estabelecimentos", "trabalhadores", "marcacoes_trabalhador"}, + new String[]{"COUNT(marcacoes_trabalhador.id)", TrabalhadoresData.PERFIL }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "empresa_id" ).isEqual( empresaID ) ).and( + new Field( MarcacoesTrabalhadorData.TIPO ).isEqual( new Integer( MarcacoesTrabalhadorData.TIPO_EXAMES ) ) ).and( + new Field( "YEAR( marcacoes_trabalhador.data ) " ).isEqual( new Integer( ano ) ).and( + new Field( Marcacao.REALIZADA ).isEqual( "y" ) ) ), + new String[]{ TrabalhadoresData.PERFIL }, + new String[]{ TrabalhadoresData.PERFIL } ); + array = executer.executeQuery( select ); + int numeroExames[] = new int[ 2 ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer perfil = (Integer)array.get( n, 1 ); + if( perfil == null || perfil.intValue() == 1 ) + { + numeroExames[0] += ( (Number) array.get( n, 0 ) ).intValue(); + } + else if( perfil.intValue() == 2 ) + { + numeroExames[1] += ( (Number) array.get( n, 0 ) ).intValue(); + } + } + + Hashtable hash = new Hashtable(); + select = new Select( new String[]{ "exames_perfis" }, + new String[]{ "tipo", "multiplicador" }, + new Field( "perfil" ).isEqual( perfil1 ) ); + array = executer.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Number tipo = (Number) array.get( n, 0 ); + if( tipo == null ) + { + continue; + } + Number multiplicador = (Number) array.get( n, 1 ); + if( multiplicador == null ) + { + multiplicador = new Integer( 1 ); + } + if( idExames.containsKey( tipo ) ) + { + int pos = ((Integer)idExames.get( tipo )).intValue(); + contagens[ pos ] += numeroExames[0] * multiplicador.intValue(); + } + } + select = new Select( new String[]{ "exames_perfis" }, + new String[]{ "tipo", "multiplicador" }, + new Field( "perfil" ).isEqual( perfil2 ) ); + array = executer.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Number tipo = (Number) array.get( n, 0 ); + if( tipo == null ) + { + continue; + } + Number multiplicador = (Number) array.get( n, 1 ); + if( multiplicador == null ) + { + multiplicador = new Integer( 1 ); + } + if( idExames.containsKey( tipo ) ) + { + int pos = ((Integer)idExames.get( tipo )).intValue(); + contagens[ pos ] += numeroExames[1] * multiplicador.intValue(); + } + } + return contagens; + } + + public HashMap countExamesComplementaresEmpresaNovosProtocolos( Integer empresaId, int ano ) + throws Exception + { + HashMap> perfis = new HashMap>(); + HashMap contagens = null; + + Select select = + new Select2( new String[]{ "prt_elementos_protocolo", "prt_tipos_elementos_protocolo", "prt_grupos_protocolo" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "prt_elementos_protocolo.tipo_elemento_protocolo_id" ).isEqual( new Field( "prt_tipos_elementos_protocolo.id" ) ), + new Field( "prt_tipos_elementos_protocolo.grupo_protocolo_id" ).isEqual( new Field( "prt_grupos_protocolo.id" ) ), + }, + new String[]{ "DISTINCT prt_elementos_protocolo.numero_perfil", "prt_grupos_protocolo.descricao" }, + new Field( "prt_elementos_protocolo.empresa_id" ).isEqual( empresaId ), + null, + null, + null, + null ); + Virtual2DArray array = executer.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer perfil = ( Integer ) array.get( n, 0 ); + String tipo = ( String ) array.get( n, 1 ); + if( !perfis.containsKey( perfil ) ) + { + perfis.put( perfil, new Vector() ); + } + perfis.get( perfil ).add( tipo ); + } + + if( perfis.size() > 0 ) + { + contagens = new HashMap(); + select = new Select2( + new String[]{"trabalhadores", "marcacoes_trabalhador", "empresas"}, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ), + new Field( "trabalhadores.estabelecimentos_id" ).isEqual( new Field( "estabelecimentos.id" ) ), + }, + new String[]{"COUNT(marcacoes_trabalhador.id)", TrabalhadoresData.PERFIL }, + new Field( "estabelecimentos.id.empresa_id" ).isEqual( empresaId ).and( + new Field( MarcacoesTrabalhadorData.TIPO ).isEqual( new Integer( MarcacoesTrabalhadorData.TIPO_EXAMES ) ) ).and( + new Field( "YEAR( marcacoes_trabalhador.data ) " ).isEqual( new Integer( ano ) ).and( + new Field( Marcacao.REALIZADA ).isEqual( "y" ) ) ), + null, + new String[]{ TrabalhadoresData.PERFIL }, + null, + null ); + array = executer.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer perfil = (Integer)array.get( n, 1 ); + Integer count = ( ( Number ) array.get( n, 0 ) ).intValue(); + if( perfil == null ) + { + continue; + } + Vector tipos = perfis.get( perfil ); + for( String tipo : tipos ) + { + if( !contagens.containsKey( tipo ) ) + { + contagens.put( tipo, count ); + } + else + { + contagens.put( tipo, contagens.get( tipo ) + count ); + } + } + } + } + return contagens; + } + + public int []countExamesComplementaresEstabelecimento( Integer estabelecimentoID, int ano ) + throws Exception + { + int contagens[] = null; + Select select; + select = new Select( new String[]{"estabelecimentos", "empresas"}, + new String[]{ "empresas.perfil_1", "empresas.perfil_2" }, + new Field( "estabelecimentos.id" ).isEqual( estabelecimentoID ).and( + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + String p1Str = (String)array.get( 0, 0 ); + String p2Str = (String)array.get( 0, 1 ); + Number perfil1 = ( p1Str != null && p1Str.length() > 0 )?new Integer( p1Str ):null; + Number perfil2 = ( p2Str != null && p2Str.length() > 0 )?new Integer( p2Str ):null; + select = + new Select( new String[]{ "tipos_exames_comp" }, + new String[]{ "id", "ordem" }, + null, + new String[]{ "ordem" }, null ); + array = executer.executeQuery( select ); + contagens = new int[ array.columnLength() ]; + Hashtable idExames = new Hashtable(); + for( int n = 0; n < array.columnLength(); n++ ) + { + idExames.put( ( Number )array.get( n, 0 ), new Integer( n ) ); + } + if( perfil1 == null && perfil2 == null ) + { + return contagens; + } + else if( perfil1 == null ) + { + perfil1 = perfil2; + } + else if( perfil2 == null ) + { + perfil2 = perfil1; + } + select = new Select( new String[]{"trabalhadores", "marcacoes_trabalhador"}, + new String[]{"COUNT(marcacoes_trabalhador.id)", TrabalhadoresData.PERFIL }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( MarcacoesTrabalhadorData.TIPO ).isEqual( new Integer( MarcacoesTrabalhadorData.TIPO_EXAMES ) ) ).and( + new Field( "YEAR( marcacoes_trabalhador.data ) " ).isEqual( new Integer( ano ) ).and( + new Field( Marcacao.REALIZADA ).isEqual( "y" ) ) ), + new String[]{ TrabalhadoresData.PERFIL }, + new String[]{ TrabalhadoresData.PERFIL } ); + array = executer.executeQuery( select ); + int numeroExames[] = new int[ 2 ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer perfil = (Integer)array.get( n, 1 ); + if( perfil == null || perfil.intValue() == 1 ) + { + numeroExames[0] += ( (Number) array.get( n, 0 ) ).intValue(); + } + else if( perfil.intValue() == 2 ) + { + numeroExames[1] += ( (Number) array.get( n, 0 ) ).intValue(); + } + } + + Hashtable hash = new Hashtable(); + select = new Select( new String[]{ "exames_perfis" }, + new String[]{ "tipo", "multiplicador" }, + new Field( "perfil" ).isEqual( perfil1 ) ); + array = executer.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Number tipo = (Number) array.get( n, 0 ); + if( tipo == null ) + { + continue; + } + Number multiplicador = (Number) array.get( n, 1 ); + if( multiplicador == null ) + { + multiplicador = new Integer( 1 ); + } + if( idExames.containsKey( tipo ) ) + { + int pos = ((Integer)idExames.get( tipo )).intValue(); + contagens[ pos ] += numeroExames[0] * multiplicador.intValue(); + } + } + select = new Select( new String[]{ "exames_perfis" }, + new String[]{ "tipo", "multiplicador" }, + new Field( "perfil" ).isEqual( perfil2 ) ); + array = executer.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Number tipo = (Number) array.get( n, 0 ); + if( tipo == null ) + { + continue; + } + Number multiplicador = (Number) array.get( n, 1 ); + if( multiplicador == null ) + { + multiplicador = new Integer( 1 ); + } + if( idExames.containsKey( tipo ) ) + { + int pos = ((Integer)idExames.get( tipo )).intValue(); + contagens[ pos ] += numeroExames[1] * multiplicador.intValue(); + } + } + return contagens; + } + + + public HashMap countExamesComplementaresEstabelecimentoNovosProtocolos( Integer estabelecimentoID, int ano ) + throws Exception + { + HashMap> perfis = new HashMap>(); + HashMap contagens = null; + Select select = + new Select2( new String[]{ "estabelecimentos" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "empresa_id" }, + new Field( "id" ).isEqual( estabelecimentoID ), + null, + null, + null, + null ); + Virtual2DArray array = executer.executeQuery( select ); + Integer empresaId = ( Integer ) array.get( 0, 0 ); + select = + new Select2( new String[]{ "prt_elementos_protocolo", "prt_tipos_elementos_protocolo", "prt_grupos_protocolo" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "prt_elementos_protocolo.tipo_elemento_protocolo_id" ).isEqual( new Field( "prt_tipos_elementos_protocolo.id" ) ), + new Field( "prt_tipos_elementos_protocolo.grupo_protocolo_id" ).isEqual( new Field( "prt_grupos_protocolo.id" ) ), + }, + new String[]{ "DISTINCT prt_elementos_protocolo.numero_perfil", "prt_grupos_protocolo.descricao" }, + new Field( "prt_elementos_protocolo.empresa_id" ).isEqual( empresaId ), + null, + null, + null, + null ); + array = executer.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer perfil = ( Integer ) array.get( n, 0 ); + String tipo = ( String ) array.get( n, 1 ); + if( !perfis.containsKey( perfil ) ) + { + perfis.put( perfil, new Vector() ); + } + perfis.get( perfil ).add( tipo ); + } + + if( perfis.size() > 0 ) + { + contagens = new HashMap(); + select = new Select2( + new String[]{"trabalhadores", "marcacoes_trabalhador"}, + new Integer[]{ Select2.JOIN_INNER }, + new Expression[]{ new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{"COUNT(marcacoes_trabalhador.id)", TrabalhadoresData.PERFIL }, + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ).and( + new Field( MarcacoesTrabalhadorData.TIPO ).isEqual( new Integer( MarcacoesTrabalhadorData.TIPO_EXAMES ) ) ).and( + new Field( "YEAR( marcacoes_trabalhador.data ) " ).isEqual( new Integer( ano ) ).and( + new Field( Marcacao.REALIZADA ).isEqual( "y" ) ) ), + null, + new String[]{ TrabalhadoresData.PERFIL }, + null, + null ); + array = executer.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer perfil = (Integer)array.get( n, 1 ); + Integer count = ( ( Number ) array.get( n, 0 ) ).intValue(); + if( perfil == null ) + { + continue; + } + Vector tipos = perfis.get( perfil ); + for( String tipo : tipos ) + { + if( !contagens.containsKey( tipo ) ) + { + contagens.put( tipo, count ); + } + else + { + contagens.put( tipo, contagens.get( tipo ) + count ); + } + } + } + } + return contagens; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/pesquisas/PesquisasWindow.java b/branches/SIPRP/SIPRPSoft/src/siprp/pesquisas/PesquisasWindow.java new file mode 100644 index 00000000..1aeb0d4a --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/pesquisas/PesquisasWindow.java @@ -0,0 +1,620 @@ +/* + * PesquisasWindow.java + * + * Created on 3 de Junho de 2004, 18:13 + */ + +package siprp.pesquisas; + +import java.awt.Dimension; +import java.awt.FileDialog; +import java.awt.FlowLayout; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Vector; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import siprp.data.outer.ContactosData; +import siprp.data.outer.EmpresasData; +import siprp.data.outer.EstabelecimentosData; + +import com.evolute.entity.ProviderInterface; +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.documents.YearDocument; +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.VectorTableModel; +import com.evolute.utils.tracker.TrackableWindow; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.text.CopyPasteHandler; + +/** + * + * @author fpalma + */ +public class PesquisasWindow extends JFrame + implements TrackableWindow, ListSelectionListener, ActionListener +{ + private ProviderInterface JDO; + private PesquisasProvider provider; + + private JTextField anoText; + private BaseTable empresasTable; + private VectorTableModel empresasModel; + private BaseTable estabelecimentosTable; + private VectorTableModel estabelecimentosModel; + private JButton pesquisarButton; + private JButton exportarButton; + private JEditorPane resultadoText; + +// public static void main( String args[] ) +// throws Exception +// { +// new PesquisasWindow().show(); +// } + + /** Creates a new instance of PesquisasWindow */ + public PesquisasWindow() + throws Exception + { + provider = (PesquisasProvider)PesquisasProvider.getProvider(); + JDO =( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + } + + private void setupComponents() + { + setSize( 1000, 700 ); + setTitle( "Relat\u00f3rio Anual" ); + + JLabel anoLabel = new JLabel( "Ano" ); + anoText = new JTextField(); + anoText.setDocument( new YearDocument() ); + anoText.setPreferredSize( new Dimension( 50, 20 ) ); + new CopyPasteHandler( anoText ); + + empresasModel = new VectorTableModel( new String[]{ "Designa\u00e7\u00e3o Social" } ); + empresasTable = new BaseTable( empresasModel ); + empresasTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + empresasTable.setNonResizableNorReordable(); + empresasTable.getSelectionModel().addListSelectionListener( this ); + JScrollPane empresasScroll = new JScrollPane(); + empresasScroll.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Empresa" ) ); + empresasScroll.setViewportView( empresasTable ); + empresasScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + empresasScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + empresasScroll.getVerticalScrollBar().setBlockIncrement(20); + + estabelecimentosModel = new VectorTableModel( new String[]{ "Nome" } ); + estabelecimentosTable = new BaseTable( estabelecimentosModel ); + estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + estabelecimentosTable.setNonResizableNorReordable(); + estabelecimentosTable.getSelectionModel().addListSelectionListener( this ); + JScrollPane estabelecimentosScroll = new JScrollPane(); + estabelecimentosScroll.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Estabelecimento" ) ); + estabelecimentosScroll.setViewportView( estabelecimentosTable ); + estabelecimentosScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + estabelecimentosScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + + pesquisarButton = new JButton( "Pesquisar" ); + pesquisarButton.addActionListener( this ); + exportarButton = new JButton( "Exportar" ); + exportarButton.addActionListener( this ); + + resultadoText = new JEditorPane( "text/html", "" ); + resultadoText.setEditable( false ); +// resultadoText.setLineWrap( true ); +// resultadoText.setWrapStyleWord( true ); + new CopyPasteHandler( resultadoText ); + JScrollPane resultadoScroll = new JScrollPane(); + resultadoScroll.setViewportView( resultadoText ); + resultadoScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + resultadoScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + + JPanel pad; + + GridBagLayout gridbag = new GridBagLayout(); + getContentPane().setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 5, 5, 5, 5 ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + JPanel anoPanel = new JPanel(); + anoPanel.setLayout( new FlowLayout( FlowLayout.LEFT ) ); + anoPanel.add( anoLabel ); + anoPanel.add( anoText ); + gridbag.setConstraints( anoPanel, constraints ); + getContentPane().add( anoPanel ); + + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 0.2; + constraints.gridheight = 2; + constraints.weightx = 0.3; + constraints.gridwidth = 3; + gridbag.setConstraints( empresasScroll, constraints ); + getContentPane().add( empresasScroll ); + + gridbag.setConstraints( estabelecimentosScroll, constraints ); + getContentPane().add( estabelecimentosScroll ); + + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 0.4; + constraints.gridwidth = GridBagConstraints.REMAINDER; + pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + getContentPane().add( pad ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 0; + constraints.gridwidth = 1; + JPanel buttonPanel = new JPanel(); + buttonPanel.setLayout( new GridLayout( 1, 2 ) ); + buttonPanel.add( pesquisarButton ); + buttonPanel.add( exportarButton ); + gridbag.setConstraints( buttonPanel, constraints ); + getContentPane().add( buttonPanel ); + + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 0.4; + constraints.gridwidth = GridBagConstraints.REMAINDER; + pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + getContentPane().add( pad ); + + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 0.8; + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( resultadoScroll, constraints ); + getContentPane().add( resultadoScroll ); + } + + private boolean close() + { + setVisible( false ); + dispose(); + return true; + } + + public boolean closeIfPossible() + { + return close(); + } + + public void open() + { + empresasTable.clearSelection(); + try + { + IDObject empresas[] = provider.getAllEmpresas(); + empresasModel.setValues( new Vector( Arrays.asList( empresas ) ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); + } + setVisible( true ); + } + + public void refresh() + { + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + if( source.equals( empresasTable.getSelectionModel() ) ) + { + estabelecimentosTable.clearSelection(); + int selected = empresasTable.getSelectedRow(); + if( selected == -1 ) + { + return; + } + IDObject empresa = (IDObject) empresasModel.getRowAt( selected ); + estabelecimentosModel.clearAll(); + IDObject estabelecimentos[]; + try + { + estabelecimentos = provider.getAllEstabelecimentosForEmpresa( empresa.getID() ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os estabelecimentos", true ); + return; + } + Vector v = new Vector( Arrays.asList( estabelecimentos ) ); + v.add( new MappableObject( new Integer( -1 ), "TODOS" ) ); + estabelecimentosModel.setValues( v ); + } +/* else if( source.equals( estabelecimentosTable.getSelectionModel() ) ) + { + }*/ + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( pesquisarButton ) ) + { + int sEmpresa = empresasTable.getSelectedRow(); + int sEstabelecimento = estabelecimentosTable.getSelectedRow(); + String anoStr = anoText.getText(); + int ano = ( anoStr.length() != 0 )? Integer.parseInt( anoStr ): -1; + if( sEmpresa == -1 || ano == -1 ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher ano e empresa", "Erro...", + JOptionPane.ERROR_MESSAGE ); + return; + } + StringBuffer buff = new StringBuffer(); + buff.append( "ANO: " ); + buff.append( "" + ano + "
" ); + buff.append( "
EMPRESA
" ); + try + { + Integer idEmpresa = ( (IDObject)empresasModel.getRowAt( sEmpresa ) ).getID(); + EmpresasData empresa = (EmpresasData)JDO.load( EmpresasData.class, idEmpresa ); + buff.append( " DESIGNA\u00C7\u00C3O SOCIAL: " ); + String designacao = (String)empresa.get( EmpresasData.DESIGNACAO_SOCIAL ); + buff.append( "" + ( designacao == null ? "" : designacao.trim() ) + "
" ); + buff.append( " MORADA: " ); + String morada = (String)empresa.get( EmpresasData.MORADA ); + buff.append( "" + ( morada == null ? "" : morada.trim() ) + "
" ); + buff.append( " LOCALIDADE: " ); + String localidade = ( String ) empresa.get( EmpresasData.LOCALIDADE ); + buff.append( "" + ( localidade == null ? "" : localidade.trim() ) + "
" ); + buff.append( " C\u00D3DIGO POSTAL: " ); + String codigoPostal = ( String ) empresa.get( EmpresasData.CODIGO_POSTAL ); + buff.append( "" + ( codigoPostal == null ? "" : codigoPostal.trim() ) + "
" ); + ContactosData contacto = (ContactosData)empresa.get( EmpresasData.CONTACTO_2 ); + if( contacto == null ) + { + buff.append( " TELEFONE:
" ); + buff.append( " FAX:
" ); + } + else + { + buff.append( " TELEFONE: " ); + String telefone = ( String ) contacto.get( ContactosData.TELEFONE ); + buff.append( "" + ( telefone == null ? "" : telefone.trim() ) + "
" ); + buff.append( " FAX: " ); + String fax = ( String ) contacto.get( ContactosData.TELEFONE ); + buff.append( "" + ( fax == null ? "" : fax.trim() ) + "
" ); + } + buff.append( " DISTRITO: " ); + String distrito = ( String ) empresa.get( EmpresasData.DISTRITO ); + buff.append( "" + ( distrito == null ? "" : distrito ) + "
" ); + buff.append( " CONCELHO: " ); + String concelho = ( String ) empresa.get( EmpresasData.CONCELHO ); + buff.append( "" + ( concelho == null ? "" : concelho ) + "
" ); + buff.append( " N\u00DAMERO PESSOA COLECTIVA: " ); + String contribuinte = ( String ) empresa.get( EmpresasData.CONTRIBUINTE ); + buff.append( "" + ( contribuinte == null ? "" : contribuinte ) + "
" ); + buff.append( " N\u00DAMERO SEGURAN\u00C7A SOCIAL: " ); + String segSocial = ( String ) empresa.get( EmpresasData.SEGURANCA_SOCIAL ); + buff.append( "" + ( segSocial == null ? "" : segSocial ) + "
" ); + buff.append( " CAE: " ); + String CAE = ( String ) empresa.get( EmpresasData.CAE ); + buff.append( "" + ( CAE == null ? "" : CAE ) + "
" ); + buff.append( "
 N\u00DAMERO M\u00C9DIO DE TRABALHADORES DURANTE O ANO" ); + double contagemMedia[] = provider.countNumeroMedioTrabalhadoresEmpresa( idEmpresa, ano ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( ""); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "
    TOTAL HOMENS MULHERES
  TOTAL " + (int)( Math.round( contagemMedia[0] ) + Math.round( contagemMedia[1] ) ) + " " + ( (int)Math.round( contagemMedia[0] ) ) + " " + ( (int)Math.round( contagemMedia[1] ) ) + "
" ); + buff.append( "
 N\u00DAMERO TOTAL DE TRABALHADORES DURANTE O ANO" ); + double contagemTotal[] = provider.countNumeroTotalTrabalhadoresEmpresa( idEmpresa, ano ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( ""); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "
    TOTAL HOMENS MULHERES
  TOTAL " + (int)( Math.round( contagemTotal[0] ) + Math.round( contagemTotal[1] ) ) + " " + ( (int)Math.round( contagemTotal[0] ) ) + " " + ( (int)Math.round( contagemTotal[1] ) ) + "
" ); + + IDObject estabelecimentos[]; + if( sEstabelecimento == -1 || ( ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento ) ).getID().equals( new Integer( -1 ) ) ) + { + estabelecimentos = provider.getAllEstabelecimentosForEmpresa( idEmpresa ); + } + else + { + estabelecimentos = new IDObject[ 1 ]; + estabelecimentos[ 0 ] = ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento ); + } + buff.append( "
" ); + buff.append( "
 ESTABELECIMENTOS
" ); + buff.append( "
" ); + for( int n = 0; n < estabelecimentos.length; n++ ) + { + EstabelecimentosData estabelecimento = (EstabelecimentosData)JDO.load( EstabelecimentosData.class, estabelecimentos[ n ].getID() ); + buff.append( "  NOME: " ); + String nome = (String)estabelecimento.get( EstabelecimentosData.NOME ); + buff.append( "" + ( nome == null ? "" : nome.trim() ) + "
" ); + buff.append( "  MORADA: " ); + morada = (String)estabelecimento.get( EstabelecimentosData.MORADA ); + buff.append( "" + ( morada == null ? "" : morada.trim() ) + "
" ); + buff.append( "  LOCALIDADE: " ); + localidade = (String)estabelecimento.get( EstabelecimentosData.LOCALIDADE ); + buff.append( "" + ( localidade == null ? "" : localidade.trim() ) + "
" ); + buff.append( "  C\u00D3DIGO POSTAL: " ); + codigoPostal = (String)estabelecimento.get( EstabelecimentosData.CODIGO_POSTAL ); + buff.append( "" + ( codigoPostal == null ? "" : codigoPostal.trim() ) + "
" ); + contacto = estabelecimento.toContacto_id(); + if( contacto == null ) + { + buff.append( "  TELEFONE:
" ); + buff.append( "  FAX:
" ); + } + else + { + buff.append( "  TELEFONE: " ); + String telefone = ( String ) contacto.get( ContactosData.TELEFONE ); + buff.append( "" + ( telefone == null ? "" : telefone.trim() ) + "
" ); + buff.append( "  FAX: " ); + String fax = ( String ) contacto.get( ContactosData.TELEFONE ); + buff.append( "" + ( fax == null ? "" : fax.trim() ) + "
" ); + } + int countTrabalhadores[] = provider.countTrabalhadoresEstabelecimentoDezembro( estabelecimentos[ n ].getID(), ano ); + buff.append( "
" ); + buff.append( "  TRABALHADORES A 31 DE DEZEMBRO DE " + ano + ": " ); + buff.append( "
" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" + + "" + + "" + + "" ); + buff.append( "" ); + int countTrabalhadoresEtario[][] = provider.countTrabalhadoresEstabelecimentoDezembroPorGrupoEtario( estabelecimentos[ n ].getID(), ano ); + buff.append( "" ); + buff.append( "" + + "" + + "" + + "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" + + "" + + "" + + "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" + + "" + + "" + + "" ); + buff.append( "" ); + buff.append( "
   TOTALHOMENSMULHERES
  TOTAL " + ( countTrabalhadores[0] + countTrabalhadores[1] ) + " " + ( countTrabalhadores[0] ) + " " + ( countTrabalhadores[1] ) + "
  MENOS DE 18 ANOS " + ( countTrabalhadoresEtario[0][0] + countTrabalhadoresEtario[0][1] ) + " " + ( countTrabalhadoresEtario[0][0] ) + " " + ( countTrabalhadoresEtario[0][1] ) + "
  18 A 49 ANOS " + ( countTrabalhadoresEtario[1][0] + countTrabalhadoresEtario[1][1] ) + " " + ( countTrabalhadoresEtario[1][0] ) + " " + ( countTrabalhadoresEtario[1][1] ) + "
  MAIS DE 50 ANOS " + ( countTrabalhadoresEtario[2][0] + countTrabalhadoresEtario[2][1] ) + " " + ( countTrabalhadoresEtario[2][0] ) + " " + ( countTrabalhadoresEtario[2][1] ) + "
" ); + buff.append( "
" ); + int countExames[][] = provider.countExamesEstabelecimentoDezembroPorGrupoEtario( estabelecimentos[ n ].getID(), ano ); + for( int cE = 0; cE < countExames[ countExames.length - 2 ].length; cE++ ) + { + countExames[ countExames.length - 2 ][ cE ] += countExames[ countExames.length - 1 ][ cE ]; + } + int totais[] = new int[ 6 ]; + for( int cE1 = 0; cE1 < totais.length; cE1++ ) + { + for( int cE2 = 0; cE2 < countExames.length; cE2++ ) + { + totais[ cE1 ] += countExames[ cE2 ][ cE1 ]; + } + } + buff.append( "
" ); + buff.append( "  N\u00DAMERO DE EXAMES DE ADMISS\u00C3O, PERI\u00D3DICOS E OCASIONAIS EFECTUADOS" ); + buff.append( "
" ); + buff.append( "" ); + buff.append( "" + + "" ); + buff.append( "" ); + buff.append( "" ); + for( int t = 0; t < 3; t++ ) + { + buff.append( "" ); + } + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + for( int t = 3; t < 6; t++ ) + { + buff.append( "" ); + } + buff.append( "" ); + String sexos[] = new String[]{ "H", "M" }; + for( int t = 0; t < provider.DESCRICAO_TIPOS_EXAME.length; t++ ) + { + buff.append( "" ); + + for( int s = 0; s < 2; s++ ) + { + buff.append( "" ); + buff.append( "" ); + for( int d = 0; d < 3; d++ ) + { + buff.append( "" ); + } + if( s == 0 ) + { + buff.append( "" ); + } + else + { + buff.append( "" ); + } + } + } + int countExamesOcasionais[][] = provider.countExamesOcasionaisEstabelecimentoDezembroPorGrupoEtario( estabelecimentos[ n ].getID(), ano ); + for( int t = 0; t < provider.DESCRICAO_TIPOS_OCASIONAL.length; t++ ) + { + buff.append( "" ); + + for( int s = 0; s < 2; s++ ) + { + buff.append( "" ); + int sum = countExamesOcasionais[t][s*3]+countExamesOcasionais[t][s*3+1]+countExamesOcasionais[t][s*3+2]; + buff.append( "" ); + for( int d = 0; d < 3; d++ ) + { + int val = countExamesOcasionais[t][s*3+d]; + if( val < 0 ) + { + countExamesOcasionais[t][s*3+d] = 0; + } + buff.append( "" ); + } + if( s == 0 ) + { + buff.append( "" ); + } + else + { + buff.append( "" ); + } + } + } + buff.append( "
      TOTAL INFERIOR A 18 ANOS 18 A 49 ANOS 50 E MAIS ANOS 
   TOTAL DE EXAMES H" + ( totais[0] + totais[1] + totais[2] ) + " " + totais[t] + " 
     M" + ( totais[3] + totais[4] + totais[5] ) + " " + totais[t] + " 
    "+provider.DESCRICAO_TIPOS_EXAME[t]+" " + sexos[ s ] + "" + (countExames[t][s*3]+countExames[t][s*3+1]+countExames[t][s*3+2]) + " " + countExames[t][s*3+d] + " 
    
       "+provider.DESCRICAO_TIPOS_OCASIONAL[t]+" " + sexos[ s ] + "" + ( sum < 0 ? "-" : "" + sum ) + " " + ( val < 0 ? "-" : "" + val ) + " 
       
" ); + buff.append( "
" ); + buff.append( "  EXAMES COMPLEMENTARES REALIZADOS" ); + buff.append( "
" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + String nomesExamesComp[] = provider.getNomesExames(); +// int countExamesComp[] = provider.countExamesComplementaresEmpresa( idEmpresa, ano ); + HashMap countExamesCompNovo = provider.countExamesComplementaresEstabelecimentoNovosProtocolos( estabelecimentos[ n ].getID(), ano ); + if( countExamesCompNovo != null ) + { + String nomesExames[] = countExamesCompNovo.keySet().toArray( new String[ countExamesCompNovo.size() ] ); + Arrays.sort( nomesExames ); + for( String nomeExame : nomesExames ) + { + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + } + } + else + { + int countExamesComp[] = provider.countExamesComplementaresEstabelecimento( estabelecimentos[ n ].getID(), ano ); + for( int nec = 0; nec < nomesExamesComp.length; nec++ ) + { + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + } + } + buff.append( "
   TIPO DE EXAME N\u00BA TOTAL DE EXAMES
   " + nomeExame + " " + countExamesCompNovo.get( nomeExame ) + "
   " + nomesExamesComp[nec] + " " + countExamesComp[nec] + "
" ); + buff.append("


"); + } + + resultadoText.setText( buff.toString() ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados", false ); + return; + } + } + else if( source.equals( exportarButton ) ) + { + exportar(); + } + } + + public void exportar() + { + FileDialog dialog = new FileDialog( this, "Ficheiro de destino", FileDialog.SAVE ); + dialog.setDirectory( System.getProperty( "user.home" ) ); + dialog.setVisible( true ); + String fileName; + String dirName; + fileName = dialog.getFile(); + dirName = dialog.getDirectory(); + if( fileName != null ) + { + int index = fileName.indexOf( '.' ); + if( index == -1 ) + { + fileName += ".html"; + } + if( index == fileName.length() - 1 ) + { + fileName += "html"; + } + String fullName = dirName + fileName; + String text = resultadoText.getText(); + String title = "S.I.P.R.P. - Sociedade Ibérica de Prevenção de Riscos Profissionais"; + String style = ""; + text = text.replace( "", "\n\t\t" + title + "\n" + style ); + text = text.replace( "", "
" ); + text = text.replace( "", "
" ); + text = text.replace( "", "\n
Relatório Anual
" ); +// String title = "S.I.P.R.P. - Sociedade Ibérica de Prevenção de Riscos Profissionais"; +// text = text.replace( "", "\n\t\t" + title + "" ); +// System.out.println( text ); + try + { + FileWriter writer = new FileWriter( new File( fullName ) ); + writer.write( text ); + writer.close(); + } + catch( IOException ex ) + { + DialogException.showException( ex ); + return; + } + } + } +} + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/db/DBConstants.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/db/DBConstants.java new file mode 100644 index 00000000..5f85e99b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/db/DBConstants.java @@ -0,0 +1,27 @@ +package siprp.planoactuacao.db; + +public interface DBConstants +{ + public static final String WEB_URL = "jdbc:postgresql://localhost:5436/siprp"; +// public static final String WEB_URL = "jdbc:postgresql://storage:5432/siprp"; + public static final String WEB_USER = "postgres"; +// public static final String WEB_PASSWORD = "Typein"; + public static final String WEB_PASSWORD = null; + +// public static final String WEB_URL = "jdbc:postgresql://www.evolute.pt:5436/siprp"; +// public static final String WEB_USER = "postgres"; +// public static final String WEB_PASSWORD = "Typein"; + + public static final String LOCAL_URL = "jdbc:postgresql://localhost:5436/siprp_local_3"; +// public static final String LOCAL_URL = "jdbc:postgresql://storage/siprp_local"; + public static final String LOCAL_USER = "postgres"; +// public static final String LOCAL_PASSWORD = "Typein"; + public static final String LOCAL_PASSWORD = null; + +// public static final String LOCAL_URL = "jdbc:postgresql://www.evolute.pt:5436/siprp_local_3"; +// public static final String LOCAL_USER = "postgres"; +// public static final String LOCAL_PASSWORD = "Typein"; + + public static final String WEB_DBMANAGER = "WEB DBMANAGER"; + public static final String LOCAL_DBMANAGER = "LOCAL DBMANAGER"; +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/db/PlanoActuacaoDBInit.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/db/PlanoActuacaoDBInit.java new file mode 100644 index 00000000..c477e744 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/db/PlanoActuacaoDBInit.java @@ -0,0 +1,46 @@ +package siprp.planoactuacao.db; + +import siprp.SingletonConstants; + +import com.evolute.utils.Singleton; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.JDBCManager; +import com.evolute.utils.db.keyretrievers.PostgresqlAutoKeyRetriever; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.strings.UnicodeChecker; + +public class PlanoActuacaoDBInit +{ + public static void initDB( boolean web ) + throws Exception + { + if( web ) + { + String url = DBConstants.WEB_URL; + String user = DBConstants.WEB_USER; + String pwd = DBConstants.WEB_PASSWORD; + DBManager webManager = new JDBCManager( url, user, pwd, 10, 8, 8, null ); + Singleton.setInstance( DBConstants.WEB_DBMANAGER, webManager ); + + url = DBConstants.LOCAL_URL; + user = DBConstants.LOCAL_USER; + pwd = DBConstants.LOCAL_PASSWORD; + DBManager localManager = new JDBCManager( url, user, pwd, 10, 8, 8, null ); + Singleton.setInstance( DBConstants.LOCAL_DBMANAGER, localManager ); + } + else + { + String url = ( String ) Singleton.getInstance( SingletonConstants.WEB_URL_PREFIX ); + url += ( String ) Singleton.getInstance( SingletonConstants.WEB_URL ) + "/"; + url += ( String ) Singleton.getInstance( SingletonConstants.WEB_DB_NAME ) + "/"; + String user = ( String ) Singleton.getInstance( SingletonConstants.WEB_USER ); + String pwd = ( String ) Singleton.getInstance( SingletonConstants.WEB_PASSWORD ); + DBManager webManager = new JDBCManager( url, user, pwd, 10, 8, 8, null ); + Singleton.setInstance( DBConstants.WEB_DBMANAGER, webManager ); + Singleton.setInstance( DBConstants.LOCAL_DBMANAGER, Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ) ); + } + + Insert.setDefaultKeyRetriever( PostgresqlAutoKeyRetriever.RETRIEVER ); + UnicodeChecker.setUseDoubleSlash( true ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/AreaToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/AreaToPrint.java new file mode 100644 index 00000000..29964728 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/AreaToPrint.java @@ -0,0 +1,89 @@ +package siprp.planoactuacao.print; + +import java.util.Vector; + +import org.jdom.Element; + +public class AreaToPrint + implements PrintableInterface, Comparable +{ + protected String designacao; + protected Vector riscos; + protected Integer ordem; + protected boolean generico; + + public AreaToPrint( String designacao, Vector riscos, Integer ordem, boolean generico ) + { + super(); + this.designacao = designacao; + this.riscos = riscos; + this.ordem = ordem; + this.generico = generico; + } + + public String getDesignacao() + { + return designacao; + } + + public void setDesignacao( String designacao ) + { + this.designacao = designacao; + } + + public Vector getRiscos() + { + return riscos; + } + + public void setRiscos( Vector riscos ) + { + this.riscos = riscos; + } + + public void addRisco( RiscoToPrint risco ) + { + riscos.add( risco ); + } + + protected boolean isGenerico() + { + return generico; + } + + @Override + public Element toJdomElement() throws Exception + { + Element areaElement = new Element( "area" ); + Element designacaoElement = new Element( "designacao" ); + designacaoElement.setText( designacao ); + areaElement.addContent( designacaoElement ); + for( RiscoToPrint risco : riscos ) + { + areaElement.addContent( risco.toJdomElement() ); + } + return areaElement; + } + + @Override + public int compareTo(Object o) + { + if( o instanceof AreaToPrint ) + { + if( generico && !( ( AreaToPrint ) o ).generico ) + { + return -1; + } + else if( !generico && ( ( AreaToPrint ) o ).generico ) + { + return 1; + } + if( ordem != null ) + { + return ( ( ( AreaToPrint ) o ).ordem == null ) ? -1 : ordem.compareTo( ( ( AreaToPrint ) o ).ordem ); + } + } + return 0; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/DataToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/DataToPrint.java new file mode 100644 index 00000000..29878bb0 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/DataToPrint.java @@ -0,0 +1,66 @@ +package siprp.planoactuacao.print; + +import java.util.Calendar; +import java.util.Date; + +import org.jdom.Element; + +import com.evolute.utils.date.DateUtils; + +public class DataToPrint + implements PrintableInterface +{ + protected String tag; + protected Date data; + + public DataToPrint( String tag, Date data ) + { + super(); + this.tag = tag; + this.data = data; + } + + @Override + public Element toJdomElement() throws Exception + { + Element dataElement = new Element( tag ); + Calendar cal = Calendar.getInstance(); + cal.setTime( data ); + int ano = cal.get( Calendar.YEAR ); + int mes = cal.get( Calendar.MONTH ); + int dia = cal.get( Calendar.DAY_OF_MONTH ); + Element anoElement = new Element( "ano" ); + anoElement.setText( "" + ano ); + dataElement.addContent( anoElement ); + Element mesElement = new Element( "mes" ); + mesElement.setText( "" + ( mes + 1 ) ); + dataElement.addContent( mesElement ); + Element mesExtensoElement = new Element( "mes-extenso" ); + mesExtensoElement.setText( DateUtils.MONTHS_FULL_PT[ mes ] ); + dataElement.addContent( mesExtensoElement ); + Element diaElement = new Element( "dia" ); + diaElement.setText( "" + dia ); + dataElement.addContent( diaElement ); + return dataElement; + } + + public String getTag() + { + return tag; + } + + public void setTag( String tag ) + { + this.tag = tag; + } + + public Date getData() + { + return data; + } + + public void setData( Date data ) + { + this.data = data; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/EmpresaToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/EmpresaToPrint.java new file mode 100644 index 00000000..d553551c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/EmpresaToPrint.java @@ -0,0 +1,67 @@ +package siprp.planoactuacao.print; + +import org.jdom.Element; + +public class EmpresaToPrint + implements PrintableInterface +{ + protected String designacaoSocial; + protected String logotipo; + protected String estabelecimento; + + public EmpresaToPrint( String designacaoSocial, String logotipo, + String estabelecimento ) + { + super(); + this.designacaoSocial = designacaoSocial; + this.logotipo = logotipo; + this.estabelecimento = estabelecimento; + } + + public String getDesignacaoSocial() + { + return designacaoSocial; + } + + public void setDesignacaoSocial( String designacaoSocial ) + { + this.designacaoSocial = designacaoSocial; + } + + public String getLogotipo() + { + return logotipo; + } + + public void setLogotipo( String logotipo ) + { + this.logotipo = logotipo; + } + + public String getEstabelecimento() + { + return estabelecimento; + } + + public void setEstabelecimento( String estabelecimento ) + { + this.estabelecimento = estabelecimento; + } + + @Override + public Element toJdomElement() throws Exception + { + Element empresaElement = new Element( "empresa" ); + Element designacaoSocialElement = new Element( "designacao-social" ); + designacaoSocialElement.setText( designacaoSocial ); + empresaElement.addContent( designacaoSocialElement ); + Element logotipoElement = new Element( "logotipo" ); + logotipoElement.setText( logotipo ); + empresaElement.addContent( logotipoElement ); + Element estabelecimentoElement = new Element( "estabelecimento" ); + estabelecimentoElement.setText( estabelecimento ); + empresaElement.addContent( estabelecimentoElement ); + return empresaElement; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/LegislacaoAplicavelToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/LegislacaoAplicavelToPrint.java new file mode 100644 index 00000000..0d53ee46 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/LegislacaoAplicavelToPrint.java @@ -0,0 +1,53 @@ +package siprp.planoactuacao.print; + +import java.util.Vector; + +import org.jdom.Element; + +public class LegislacaoAplicavelToPrint + implements PrintableInterface +{ + protected Vector diplomasGerais; + protected String[] nomesGruposEspecificos; + protected Vector[] diplomasEspecificos; + + public LegislacaoAplicavelToPrint( Vector diplomasGerais, + String[] nomesGruposEspecificos, Vector[] diplomasEspecificos ) + { + super(); + this.diplomasGerais = diplomasGerais; + this.nomesGruposEspecificos = nomesGruposEspecificos; + this.diplomasEspecificos = diplomasEspecificos; + } + + @Override + public Element toJdomElement() throws Exception + { + Element legislacaoAplicavelElement = new Element( "legislacao-aplicavel" ); + Element legislacaoGeralElement = new Element( "legislacao-geral" ); + for( String diploma : diplomasGerais ) + { + Element diplomaElement = new Element( "diploma" ); + diplomaElement.setText( diploma ); + legislacaoGeralElement.addContent( diplomaElement ); + } + legislacaoAplicavelElement.addContent( legislacaoGeralElement ); + + for( int e = 0; e < nomesGruposEspecificos.length; e++ ) + { + Element legislacaoEspecificaElement = new Element( "legislacao-especifica" ); + Element designacaoElement = new Element( "designacao" ); + designacaoElement.setText( nomesGruposEspecificos[ e ] ); + legislacaoEspecificaElement.addContent( designacaoElement ); + for( String diploma : diplomasEspecificos[ e ] ) + { + Element diplomaElement = new Element( "diploma" ); + diplomaElement.setText( diploma ); + legislacaoEspecificaElement.addContent( diplomaElement ); + } + legislacaoAplicavelElement.addContent( legislacaoEspecificaElement ); + } + return legislacaoAplicavelElement; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/LogotiposDumper.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/LogotiposDumper.java new file mode 100644 index 00000000..b17d26f1 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/LogotiposDumper.java @@ -0,0 +1,33 @@ +package siprp.planoactuacao.print; + +import java.io.File; +import java.io.FileOutputStream; +import java.util.Date; + +import com.evolute.utils.data.Mappable; + +public class LogotiposDumper +{ + public static void main( String args[] ) + throws Exception + { + System.out.println( "Dumper: " + new Date() ); + dump( args[ 0 ] ); + } + + public static void dump( String path ) + throws Exception + { + Mappable[] logotipos = PlanoActuacaoPrintDataProvider.getProvider( true ).getLogotipos(); + for( Mappable logotipo : logotipos ) + { + File file = new File( path, "" + logotipo.getID() + ".png" ); + file.createNewFile(); + FileOutputStream fos = new FileOutputStream( file ); + fos.write( ( byte[] ) logotipo.getValue() ); + fos.close(); + } + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/LogotiposImporter.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/LogotiposImporter.java new file mode 100644 index 00000000..a74ccac3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/LogotiposImporter.java @@ -0,0 +1,64 @@ +package siprp.planoactuacao.print; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FilenameFilter; +import java.util.Date; +import java.util.Vector; + +public class LogotiposImporter +{ + public static void main( String args[] ) + throws Exception + { + System.out.println( "Importer: " + new Date() ); + load( args[ 0 ] ); + } + + public static void load( String path ) + throws Exception + { + File dir = new File( path ); + File files[] = dir.listFiles( new FilenameFilter(){ + + @Override + public boolean accept( File dir, String name ) + { + return name.length() >= 4 && ".jpg".equals( name.substring( name.length() - 4, name.length() ) ); + } + } ); + for( File file : files ) + { + FileInputStream fis = new FileInputStream( file ); + int ret = 0; + Vector buffers = new Vector(); + Vector sizes = new Vector(); + byte data[]; + int size = 0; + do + { + byte buff[] = new byte[ 1024 ]; + ret = fis.read( buff, 0, buff.length ); + if( ret > 0 ) + { + size += ret; + buffers.add( buff ); + sizes.add( ret ); + } + } while( ret >= 0 ); + fis.close(); + data = new byte[ size ]; + int off = 0; + for( int n = 0; n < buffers.size(); n++ ) + { + byte buff[] = buffers.get( n ); + int s = sizes.get( n ); + System.arraycopy( buff, 0, data, off, s ); + off += s; + } + Integer id = new Integer( file.getName().split( "[.]" )[ 0 ] ); + + PlanoActuacaoPrintDataProvider.getProvider( true ).updateLogotipo( id, data ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/MedidaToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/MedidaToPrint.java new file mode 100644 index 00000000..58c1f15c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/MedidaToPrint.java @@ -0,0 +1,58 @@ +package siprp.planoactuacao.print; + +import java.util.Vector; + +import org.jdom.Element; + +public class MedidaToPrint + implements PrintableInterface +{ + protected String descricao; + protected Vector postos; + + public MedidaToPrint( String descricao, Vector postos ) + { + super(); + this.descricao = descricao; + this.postos = postos; + } + + @Override + public Element toJdomElement() throws Exception + { + Element medidaElement = new Element( "medida" ); + Element descricaoElement = new Element( "descricao" ); + descricaoElement.setText( descricao ); + medidaElement.addContent( descricaoElement ); + for( PostoToPrint posto : postos ) + { + medidaElement.addContent( posto.toJdomElement() ); + } + return medidaElement; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao( String descricao ) + { + this.descricao = descricao; + } + + public Vector getPostos() + { + return postos; + } + + public void setPostos( Vector postos ) + { + this.postos = postos; + } + + public void addPosto( PostoToPrint posto ) + { + postos.add( posto ); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPDFCreator.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPDFCreator.java new file mode 100644 index 00000000..9b3e0a29 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPDFCreator.java @@ -0,0 +1,55 @@ +package siprp.planoactuacao.print; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; + +import org.jdom.Document; +import org.jdom.output.Format; +import org.jdom.output.XMLOutputter; + +import siprp.Main; +import siprp.util.fop.PDFCreator; + +import com.evolute.utils.xml.XSLTransformer; + +public class PlanoActuacaoPDFCreator +{ + + public byte[] createPDF( Integer planoId, boolean web ) throws Exception + { + PlanoActuacaoToPrint plano = PlanoActuacaoPrintDataProvider.getProvider( web ).getPlanoToPrint( planoId ); + Document foDoc = new Document( plano.toJdomElement() ); + XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat()); + ByteArrayOutputStream foBaos = new ByteArrayOutputStream(); + outputter.output( foDoc, foBaos ); + + + byte fo[] = + applyTemplate( + getClass().getClassLoader().getResourceAsStream( + PlanoActuacaoPrintDataProvider.getProvider( web ).empresaUsaPlanoAlargadoPorPlanoId( planoId ) ? + "siprp/planoactuacao/print/plano_actuacao_alargado.xsl" + : "siprp/planoactuacao/print/plano_actuacao.xsl" ), + new ByteArrayInputStream( foBaos.toByteArray() ) ); + + +// FileOutputStream fos = new FileOutputStream("/home/jneto/Desktop/a.fo"); +// fos.write(fo); + + + PDFCreator.setUserConfig(Main.fopConfigFile); + PDFCreator pdfCreator = PDFCreator.getPDFCreator(); + + byte pdf[] = pdfCreator.createPdfFromFo( fo ); + return pdf; + } + + public byte[] applyTemplate( InputStream xsl, InputStream dataStream ) throws Exception + { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + XSLTransformer.getXSLTransformer().transform( dataStream, xsl, baos ); + return baos.toByteArray(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPrintDataProvider.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPrintDataProvider.java new file mode 100644 index 00000000..8f3bb804 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPrintDataProvider.java @@ -0,0 +1,810 @@ +package siprp.planoactuacao.print; + +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.Vector; + +import siprp.planoactuacao.db.DBConstants; +import siprp.planoactuacao.db.PlanoActuacaoDBInit; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.data.Mappable; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.BlobUpdate; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; + + +public class PlanoActuacaoPrintDataProvider +{ + private static final Object LOCK = new Object(); + private static PlanoActuacaoPrintDataProvider instance = null; + protected static final Object UNCONTROLLED = "Incontrolado"; + protected static final Object CONTROLLED = "Controlado"; + protected static final Object INDETERMINATE = "Indeterminado"; + + protected final Executer WEB_EXECUTER; + protected final Executer LOCAL_EXECUTER; + + protected final boolean web; + + public PlanoActuacaoPrintDataProvider( boolean web ) + throws Exception + { + this.web = web; + if( Singleton.getInstance( DBConstants.WEB_DBMANAGER ) == null ) + { + PlanoActuacaoDBInit.initDB( web ); + } + DBManager WEB_DBMANAGER = ( DBManager ) Singleton.getInstance( DBConstants.WEB_DBMANAGER ); + WEB_EXECUTER = WEB_DBMANAGER.getSharedExecuter( this ); + DBManager LOCAL_DBMANAGER = ( DBManager ) Singleton.getInstance( DBConstants.LOCAL_DBMANAGER ); + LOCAL_EXECUTER = LOCAL_DBMANAGER.getSharedExecuter( this ); + } + + public static PlanoActuacaoPrintDataProvider getProvider( boolean web ) + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new PlanoActuacaoPrintDataProvider( web ); + } + } + return instance; + } + + public boolean empresaUsaPlanoAlargadoPorPlanoId( Integer planoId ) + throws Exception + { + try + { + Select select = + new Select2( + new String[]{ "hs_relatorio", "marcacoes_estabelecimento", "estabelecimentos", "empresas" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "hs_relatorio.marcacao_id" ).isEqual( new Field( "marcacoes_estabelecimento.id" ) ), + new Field( "marcacoes_estabelecimento.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ), + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) + }, + new String[]{ "imprimir_tabela_alargada" }, + new Field( "hs_relatorio.id" ).isEqual( planoId ), + null, + null, + null, + null ); + Virtual2DArray array = LOCAL_EXECUTER.executeQuery( select ); + + return array.get( 0, 0 ) != null ? ( ( Boolean ) array.get( 0, 0 ) ).booleanValue() : false; + } + catch( Exception ex ) + { + return true; + } + } + + + public PlanoActuacaoToPrint getPlanoToPrint( Integer id ) + throws Exception + { + Virtual2DArray array; + if( web ) + { + Select select = + new Select2( + new String[]{ "planos_actuacao" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "empresa_id", "nome_empresa", + "estabelecimento_id", "nome_estabelecimento", + "data_relatorio", "data_visita", "observacoes_dl", + "observacoes_dns", "validacao_director_loja", + "validacao_dns" }, + new Field( "id" ).isEqual( id ), + null, + null, + null, + null ); + array = WEB_EXECUTER.executeQuery( select ); + } + else + { + Select select = + new Select2( + new String[]{ "hs_relatorio", "marcacoes_estabelecimento", "estabelecimentos", "empresas" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "hs_relatorio.marcacao_id" ).isEqual( new Field( "marcacoes_estabelecimento.id" ) ), + new Field( "marcacoes_estabelecimento.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ), + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) + }, + new String[]{ "empresas.id", "empresas.designacao_social", + "estabelecimentos.id", "estabelecimentos.nome", + "hs_relatorio.data", "marcacoes_estabelecimento.data", "''", + "''", "false", + "false" }, + new Field( "hs_relatorio.id" ).isEqual( id ), + null, + null, + null, + null ); + array = LOCAL_EXECUTER.executeQuery( select ); + } + Integer empresaId = ( Integer ) array.get( 0, 0 ); + String nomeEmpresa = ( String ) array.get( 0, 1 ); + Integer estabelecimentoId = ( Integer ) array.get( 0, 2 ); + String nomeEstabelecimento = ( String ) array.get( 0, 3 ); + Integer logoId = getLogotipoIdForEmpresaId( empresaId ); + Date dataRelatorio = ( Date ) array.get( 0, 4 ); + Date dataVisita = ( Date ) array.get( 0, 5 ); + String observacoesDl = ( String ) array.get( 0, 6 ); + String observacoesDns = ( String ) array.get( 0, 7 ); + Boolean validacaoDl = ( Boolean ) array.get( 0, 8 ); + Boolean validacaoDns = ( Boolean ) array.get( 0, 9 ); + EmpresaToPrint empresa = new EmpresaToPrint( nomeEmpresa, + "http://www.evolute.pt:13080/SIPRPImages/image?id=" + logoId, +// "http://apdp/siprp/auchan_jumbo_lado.jpg", + nomeEstabelecimento ); + PlanoActuacaoToPrint plano = + new PlanoActuacaoToPrint( + empresa, + dataRelatorio != null ? new DataToPrint( "data-relatorio", dataRelatorio ) : null, + dataVisita != null ? new DataToPrint( "data-hs", dataVisita ) : null, + getLegislacaoAplicavel( id ), + getAreasToPrintByPlanoId( id, validacaoDl, validacaoDns ), + observacoesDl, + observacoesDns, + getTecnicoHS( id ), + getTecnicoSuperiorHS( id ) ); + return plano; + } + + public Integer getLogotipoIdForEmpresaId( Integer empresaId ) + throws Exception + { + Select select = + new Select2( + new String[]{ "empresas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "empresa_logo_id" }, + new Field( "id" ).isEqual( empresaId ), + null, + null, + null, + null ); + Virtual2DArray array = LOCAL_EXECUTER.executeQuery( select ); + return array.columnLength() > 0 ? ( Integer ) array.get( 0, 0 ) : null; + } + + protected Integer getRelatorioIdForPlanoId( Integer planoId ) + throws Exception + { + Integer relatorioId = null; + Select areaSelect = + new Select2( new String[]{ "plano_areas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "plano_areas.area_id" }, + new Field( "plano_areas.plano_id" ).isEqual( planoId ), + null, + null, + null, + null ); + Virtual2DArray areaArray = WEB_EXECUTER.executeQuery( areaSelect ); + if( areaArray.columnLength() > 0 ) + { + Select relatorioSelect = + new Select2( new String[]{ "hs_relatorio_area" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "hs_relatorio_area.relatorio_id" }, + new Field( "hs_relatorio_area.id" ).isEqual( areaArray.get(0, 0) ), + null, + null, + null, + null ); + relatorioId = ( Integer ) LOCAL_EXECUTER.executeQuery( relatorioSelect ).get(0, 0); + } + + return relatorioId; + } + + public LegislacaoAplicavelToPrint getLegislacaoAplicavel( Integer relatorioId ) + throws Exception + { + if( web ) + { + relatorioId = getRelatorioIdForPlanoId( relatorioId ); + } + Vector diplomasGerais = new Vector(); + Vector nomes = new Vector(); + Vector> diplomas = new Vector>(); + if( relatorioId != null ) + { + Select select = + new Select2( + new String[]{ "hs_relatorio_legislacao" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "hs_relatorio_legislacao.categoria", "hs_relatorio_legislacao.descricao", + "COALESCE(hs_relatorio_legislacao.categoria,'A')"}, + new Field( "hs_relatorio_legislacao.hs_relatorio_id" ).isEqual( relatorioId ), + new String[]{ "COALESCE(hs_relatorio_legislacao.categoria,'A')", "ordem" }, + null, + null, + null ); + Virtual2DArray array = LOCAL_EXECUTER.executeQuery( select ); + + String last = null; + for( int n = 0; n < array.columnLength(); n++ ) + { + String categoria = ( String ) array.get( n, 0 ); + String descricao = ( String ) array.get( n, 1 ); + if( categoria == null || categoria.trim().length() == 0 ) + { + diplomasGerais.add( descricao ); + } + else + { + if( !categoria.equals( last ) ) + { + nomes.add( categoria ); + diplomas.add( new Vector() ); + } + last = categoria; + diplomas.lastElement().add( descricao ); + } + } + } + LegislacaoAplicavelToPrint legislacao = + new LegislacaoAplicavelToPrint( diplomasGerais, nomes.toArray( new String[ nomes.size() ] ), + diplomas.toArray( new Vector[ diplomas.size() ] )); + return legislacao; + } + + public Vector getAreasToPrintByPlanoId( Integer planoId, boolean validacaoDl, boolean validacaoDns ) + throws Exception + { + Virtual2DArray array; + Vector areas = new Vector(); + HashMap map = new HashMap(); + if( web ) + { + Select select = + new Select2( + new String[]{ "plano_areas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "area_id", "id" }, + new Field( "plano_id" ).isEqual( planoId ), + null, + null, + null, + null ); + Virtual2DArray arrayTemp = WEB_EXECUTER.executeQuery( select ); + Vector ids = new Vector(); + for( int n = 0; n < arrayTemp.columnLength(); n++ ) + { + ids.add( ( Integer ) arrayTemp.get(n, 0) ); + map.put( ( Integer ) arrayTemp.get(n, 0), ( Integer ) arrayTemp.get(n, 1) ); + } + select = + new Select2( + new String[]{ "hs_relatorio_area" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "description", "ordem" }, + new Field( "id" ).in( ids.toArray( new Integer[ ids.size() ] ) ).and( + new Field( "deleted_date" ).isEqual( null ) ), + new String[]{ "id" }, + null, + null, + null ); + array = LOCAL_EXECUTER.executeQuery( select ); + } + else + { + Select select = + new Select2( + new String[]{ "hs_relatorio_area" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "description", "ordem" }, + new Field( "relatorio_id" ).isEqual( planoId ).and( + new Field( "deleted_date" ).isEqual( null ) ), + new String[]{ "id" }, + null, + null, + null ); + array = LOCAL_EXECUTER.executeQuery( select ); + } + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer areaId = ( Integer ) array.get( n, 0 ); + String areaDescricao = ( String ) array.get( n, 1 ); + Integer ordem = ( Integer ) array.get( n, 2 ); + boolean generico = false; + if( !web ) + { + Select selectGen = + new Select2( + new String[]{ "hs_relatorio_posto" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "COUNT( hs_relatorio_posto.id )" }, + new Field( "hs_relatorio_posto.area_id" ).isEqual( areaId ).and( + new Field( "hs_relatorio_posto.is_principal" ).isEqual( true ) ), + null, + null, + null, + null ); + Virtual2DArray genArray = LOCAL_EXECUTER.executeQuery( selectGen ); + if( genArray.columnLength() > 0 && genArray.get( 0, 0 ) != null ) + { + generico = ( ( Number ) genArray.get( 0, 0 ) ).intValue() > 0; + } + } + Vector riscos = + getRiscosToPrintByAreaId( map.containsKey( areaId ) ? map.get( areaId ) : areaId, validacaoDl, validacaoDns ); + if( riscos.size() > 0 ) + { + areas.add( new AreaToPrint( areaDescricao, riscos, ordem, generico ) ); + } + } + Collections.sort( areas ); + return areas; + } + + public Vector getRiscosToPrintByAreaId( Integer areaId, boolean validacaoDl, boolean validacaoDns ) + throws Exception + { + Virtual2DArray array; + Vector riscos = new Vector(); + if( web ) + { + Select select = + new Select2( + new String[]{ "plano_riscos" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "descricao", "valor", "responsavel_execucao", + "recursos_necessarios", "data_inicio", "data_fim", + "parecer_dl", "parecer_dns", "verificacao_siprp"}, + new Field( "area_id" ).isEqual( areaId ).and( + new Field( "activo" ).isEqual( "y" ) ), + new String[]{ "id" }, + null, + null, + null ); + array = WEB_EXECUTER.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String descricao = ( String ) array.get( n, 1 ); + Integer valor = ( Integer ) array.get( n, 2 ); + String responsavelExecucao = ( String ) array.get( n, 3 ); + String recursosNecessarios = ( String ) array.get( n, 4 ); + Date dataInicio = ( Date ) array.get( n, 5 ); + Date dataFim = ( Date ) array.get( n, 6 ); + String parecerDl = ( String ) array.get( n, 7 ); + if( ( parecerDl == null || parecerDl.trim().length() == 0 ) + && validacaoDl ) + { + parecerDl = "De acordo"; + } + String parecerDns = ( String ) array.get( n, 8 ); + if( ( parecerDns == null || parecerDns.trim().length() == 0 ) + && validacaoDns ) + { + parecerDns = "De acordo"; + } + String verificacaoSiprp = ( String ) array.get( n, 9 ); + riscos.add( + new RiscoToPrint( + descricao, + valor != null ? valor.toString() : "IND", + getMedidasToPrintByRiscoId( id ), + responsavelExecucao, + recursosNecessarios, + dataInicio != null ? new DataToPrint( "data-prevista-inicio", dataInicio ) : null, + dataFim != null ? new DataToPrint( "data-prevista-conclusao", dataFim ) : null, + parecerDl, + parecerDns, + verificacaoSiprp, valor, valor != null ? null : "IND" ) ); + } + } + else + { + Select select = + new Select2( + new String[]{ "hs_relatorio_risco", "hs_relatorio_posto_risco", "hs_relatorio_posto", "hs_relatorio_risco_valor_qualitativo" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_LEFT_OUTER }, + new Expression[]{ + new Field( "hs_relatorio_risco.id" ).isEqual( new Field( "hs_relatorio_posto_risco.risco_id" ) ), + new Field( "hs_relatorio_posto_risco.posto_id" ).isEqual( new Field( "hs_relatorio_posto.id" ) ), + new Field( "hs_relatorio_posto_risco.valor_qualitativo_id" ).isEqual(new Field("hs_relatorio_risco_valor_qualitativo.id")) + }, + new String[]{ "hs_relatorio_risco.id", + "hs_relatorio_risco.description", + "hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade", + "hs_relatorio_risco_valor_qualitativo.description", + "hs_relatorio_posto.id", + "null", + "null", + "null", + "null", + "null" }, + new Field( "hs_relatorio_posto.area_id" ).isEqual( areaId ).and( + new Field( "hs_relatorio_risco.deleted_date" ).isEqual( null ) ).and( + new Field( "hs_relatorio_posto.deleted_date" ).isEqual( null ) ), + new String[]{ "hs_relatorio_risco.id" }, + null, + null, + null ); + array = LOCAL_EXECUTER.executeQuery( select ); + Vector riscosVector = new Vector(); + HashMap> riscosIdMap = new HashMap>(); + HashMap riscoPostoMap = new HashMap(); + HashMap valoresQuantitativos = new HashMap(); + HashMap valoresQualitativos = new HashMap(); + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String descricao = ( String ) array.get( n, 1 ); + Integer risco = ( Integer ) array.get( n, 2 ); + String risco_qual = ((String) array.get( n, 3)); + if(risco_qual!=null){ + risco_qual = risco_qual.substring(0, 3).toUpperCase(); + } + Integer posto = ( Integer ) array.get( n, 4 ); + + String finalRisco; + + if(risco!=null){ + finalRisco = ""+risco; + }else if(risco_qual!=null){ + finalRisco = ""+risco_qual; + }else{ + continue; + } + + String key = descricao + "_" + finalRisco; + if( !riscosIdMap.containsKey( key ) ) + { + riscosIdMap.put( key, new Vector() ); + riscosVector.add( key ); + } + riscosIdMap.get( key ).add( id ); + riscoPostoMap.put(id, posto); + valoresQuantitativos.put( key, risco ); + valoresQualitativos.put( key, ((String) array.get( n, 3)) ); + } + for( String risco : riscosVector ) + { + int index = risco.lastIndexOf( "_" ); + String descricao = risco.substring( 0, index ); + String valor = risco.substring( index + 1, risco.length() ) ; + Vector medidas = new Vector(); + for( Integer id : riscosIdMap.get( risco ) ) + { + Integer posto = riscoPostoMap.get(id); + medidas.addAll( getMedidasToPrintByRiscoId( id , posto) ); + } + if( medidas.size() > 0 ) + { + riscos.add( + new RiscoToPrint( + descricao, + valor, + medidas, + null, + null, + null, + null, + null, + null, + null, + valoresQuantitativos.get( risco ), + valoresQualitativos.get( risco ) ) ); + } + } + } + Collections.sort(riscos, new Comparator(){ + + @Override + public int compare(RiscoToPrint o1, RiscoToPrint o2) { + Integer o1Value = 1000; + Integer o2Value = 1000; + if( o1.valorQuantitativo != null ) + { + o1Value = -o1.valorQuantitativo; + } + else if(o1.valorQualitativo == null) + { + o1Value = 300; + } + else if(o1.valorQualitativo.equals(UNCONTROLLED)) + { + o1Value = 100; + } + else if(o1.valorQualitativo.equals(CONTROLLED)) + { + o1Value = 200; + } + else if(o1.valorQualitativo.equals(INDETERMINATE)) + { + o1Value = 300; + } + if( o2.valorQuantitativo != null ) + { + o2Value = -o2.valorQuantitativo; + } + else if(o2.valorQualitativo == null ) + { + o2Value = 300; + } + else if(o2.valorQualitativo.equals(UNCONTROLLED)) + { + o2Value = 100; + } + else if(o2.valorQualitativo.equals(CONTROLLED)) + { + o2Value = 200; + } + else if(o2.valorQualitativo.equals(INDETERMINATE)) + { + o2Value = 300; + } + return o1Value.compareTo(o2Value); + } + }); + return riscos; + } + + public Vector getMedidasToPrintByRiscoId( Integer riscoId) throws Exception{ + return getMedidasToPrintByRiscoId(riscoId, null); + } + + public Vector getMedidasToPrintByRiscoId( Integer riscoId, Integer posto ) + throws Exception + { + Vector medidas = new Vector(); + Virtual2DArray array; + if( web ) + { + Select select = + new Select2( + new String[]{ "plano_medidas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "descricao", "true" }, + new Field( "risco_id" ).isEqual( riscoId ), + new String[]{ "id" }, + null, + null, + null ); + array = WEB_EXECUTER.executeQuery( select ); + } + else + { + Expression filter = new Field( "hs_relatorio_medida.risco_id" ).isEqual( riscoId ).and( + new Field( "hs_relatorio_medida.deleted_date" ).isEqual( null ) ) + .and(new Field("hs_relatorio_medida.description").isDifferent("")); + + if(posto!=null){ + filter = filter.and(new Field("hs_relatorio_posto_medida.posto_id").isEqual(posto)); + } + + Select select = + new Select2( + new String[]{"hs_relatorio_medida", "hs_relatorio_posto_medida"}, + new Integer[]{Select2.JOIN_INNER}, + new Expression[]{new Field("hs_relatorio_medida.id").isEqual(new Field("hs_relatorio_posto_medida.medida_id"))}, + new String[]{ "hs_relatorio_medida.id", "hs_relatorio_medida.description", "hs_relatorio_posto_medida.is_plano_actuacao" }, + filter, + new String[]{ "hs_relatorio_medida.id" }, + null, + null, + null ); + array = LOCAL_EXECUTER.executeQuery( select ); + } + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String descricao = ( String ) array.get( n, 1 ); + Boolean isPlanoActuacao = ( Boolean ) array.get( n, 2 ); + Vector postos = getPostosToPrintByMedidaId( id ); + if( postos.size() > 0 && isPlanoActuacao) + { + if ( web ) + { + descricao = StringConverterUtils.convertHTMLToText( descricao ); + descricao = StringConverterUtils.stripHTMLTags( descricao ); + } + medidas.add( new MedidaToPrint( descricao, postos ) ); + } + } + return medidas; + } + + public Vector getPostosToPrintByMedidaId( Integer medidaId ) + throws Exception + { + Vector postos = new Vector(); + Virtual2DArray array; + if( web ) + { + Select select = + new Select2( + new String[]{ "plano_postos_trabalho" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "descricao" }, + new Field( "medida_id" ).isEqual( medidaId ), + new String[]{ "id" }, + null, + null, + null ); + array = WEB_EXECUTER.executeQuery( select ); + } + else + { + Select select = + new Select2( + new String[]{ "hs_relatorio_posto", "hs_relatorio_posto_medida" }, + new Integer[]{ Select2.JOIN_INNER }, + new Expression[]{ + new Field( "hs_relatorio_posto.id" ).isEqual( new Field( "hs_relatorio_posto_medida.posto_id" ) ) + }, + new String[]{ "hs_relatorio_posto.id", "hs_relatorio_posto.description" }, + new Field( "hs_relatorio_posto_medida.medida_id" ).isEqual( medidaId ), + new String[]{ "hs_relatorio_posto.id" }, + null, + null, + null ); + array = LOCAL_EXECUTER.executeQuery( select ); + } + for( int n = 0; n < array.columnLength(); n++ ) + { + String descricao = ( String ) array.get( n, 1 ); + postos.add( new PostoToPrint( descricao ) ); + } + return postos; + } + + /** + * Para fazer dump dos logotipos para converter para jpeg + */ + public Mappable[] getLogotipos() + throws Exception + { + Select select = + new Select2( + new String[]{ "image" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "image_data" }, + null, + null, + null, + null, + null ); + Virtual2DArray array = LOCAL_EXECUTER.executeQuery( select ); + Mappable logotipos[] = new Mappable[ array.columnLength() ]; + for( int n = 0; n < logotipos.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + byte data[] = ( byte[] ) array.get( n, 1 ); + logotipos[ n ] = + new MappableObject( id, data ); + } + return logotipos; + } + + /** + * Para fazer import dos logotipos convertidos para jpeg + */ + public void updateLogotipo( Integer id, byte[] data ) + throws Exception + { + BlobUpdate update = + new BlobUpdate( "image", "image_data", data, new Field( "id" ).isEqual( id ) ); + LOCAL_EXECUTER.executeQuery( update ); + } + + public TecnicoHSToPrint getTecnicoHS( Integer relatorioId ) + throws Exception + { + if( web ) + { + relatorioId = getRelatorioIdForPlanoId( relatorioId ); + } + Select select = + new Select2( + new String[]{ "hs_relatorio", "marcacoes_estabelecimento", "marcacoes_tecnicos_hst" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "hs_relatorio.marcacao_id" ).isEqual( new Field( "marcacoes_estabelecimento.id" ) ), + new Field( "marcacoes_estabelecimento.tecnico_hst" ).isEqual( new Field( "marcacoes_tecnicos_hst.id" ) ), + }, + new String[]{ + "marcacoes_tecnicos_hst.id", + "marcacoes_tecnicos_hst.nome", + "marcacoes_tecnicos_hst.cap", + "marcacoes_tecnicos_hst.formacao", + "marcacoes_tecnicos_hst.assinatura",}, + new Field( "hs_relatorio.id" ).isEqual( relatorioId ), + null, + null, + null, + null ); + Virtual2DArray array = LOCAL_EXECUTER.executeQuery( select ); + + if( array.columnLength() == 0 ) + { + return null; + } + else + { + Integer id = ( Integer ) array.get( 0, 0 ); + String nome = ( String ) array.get( 0, 1 ); + String cap = ( String ) array.get( 0, 2 ); + String formacao = ( String ) array.get( 0, 3 ); + Integer assinatura = ( Integer ) array.get( 0, 4 ); + return new TecnicoHSToPrint( id, nome, cap, formacao, "http://www.evolute.pt:13080/SIPRPImages/image?id=" + assinatura, false ); + } + } + + public TecnicoHSToPrint getTecnicoSuperiorHS( Integer relatorioId ) + throws Exception + { + if( web ) + { + relatorioId = getRelatorioIdForPlanoId( relatorioId ); + } + Select select = + new Select2( + new String[]{ "hs_relatorio", "marcacoes_estabelecimento", "marcacoes_tecnicos_hst" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "hs_relatorio.marcacao_id" ).isEqual( new Field( "marcacoes_estabelecimento.id" ) ), + new Field( "marcacoes_estabelecimento.tecnico_superior_hst" ).isEqual( new Field( "marcacoes_tecnicos_hst.id" ) ), + }, + new String[]{ + "marcacoes_tecnicos_hst.id", + "marcacoes_tecnicos_hst.nome", + "marcacoes_tecnicos_hst.cap", + "marcacoes_tecnicos_hst.formacao", + "marcacoes_tecnicos_hst.assinatura",}, + new Field( "hs_relatorio.id" ).isEqual( relatorioId ), + null, + null, + null, + null ); + Virtual2DArray array = LOCAL_EXECUTER.executeQuery( select ); + + if( array.columnLength() == 0 ) + { + return null; + } + else + { + Integer id = ( Integer ) array.get( 0, 0 ); + String nome = ( String ) array.get( 0, 1 ); + String cap = ( String ) array.get( 0, 2 ); + String formacao = ( String ) array.get( 0, 3 ); + Integer assinatura = ( Integer ) array.get( 0, 4 ); + return new TecnicoHSToPrint( id, nome, cap, formacao, "http://www.evolute.pt:13080/SIPRPImages/image?id=" + assinatura, true ); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoToPrint.java new file mode 100644 index 00000000..1c02b073 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoToPrint.java @@ -0,0 +1,165 @@ +package siprp.planoactuacao.print; + +import java.util.Vector; + +import org.jdom.Element; + +public class PlanoActuacaoToPrint + implements PrintableInterface +{ + protected EmpresaToPrint empresa; + protected DataToPrint dataRelatorio; + protected DataToPrint dataHs; + protected LegislacaoAplicavelToPrint legislacaoAplicavel; + protected Vector areas; + protected String observacoesDl; + protected String observacoesDns; + protected TecnicoHSToPrint tecnico; + protected TecnicoHSToPrint tecnicoSuperior; + + public PlanoActuacaoToPrint( EmpresaToPrint empresa, DataToPrint dataRelatorio, + DataToPrint dataHs, LegislacaoAplicavelToPrint legislacaoAplicavel, + Vector areas, String observacoesDl, String observacoesDns, + TecnicoHSToPrint tecnico, TecnicoHSToPrint tecnicoSuperior ) + { + super(); + this.empresa = empresa; + this.dataRelatorio = dataRelatorio; + this.dataHs = dataHs; + this.legislacaoAplicavel = legislacaoAplicavel; + this.areas = areas; + this.observacoesDl = observacoesDl; + this.observacoesDns = observacoesDns; + this.tecnico = tecnico; + this.tecnicoSuperior = tecnicoSuperior; + } + + public EmpresaToPrint getEmpresa() + { + return empresa; + } + + public void setEmpresa( EmpresaToPrint empresa ) + { + this.empresa = empresa; + } + + public DataToPrint getDataRelatorio() + { + return dataRelatorio; + } + + public void setDataRelatorio( DataToPrint dataRelatorio ) + { + this.dataRelatorio = dataRelatorio; + } + + public DataToPrint getDataHs() + { + return dataHs; + } + + public void setDataHs( DataToPrint dataHs ) + { + this.dataHs = dataHs; + } + + public LegislacaoAplicavelToPrint getLegislacaoAplicavel() + { + return legislacaoAplicavel; + } + + public void setLegislacaoAplicavel( + LegislacaoAplicavelToPrint legislacaoAplicavel ) + { + this.legislacaoAplicavel = legislacaoAplicavel; + } + + public Vector getAreas() + { + return areas; + } + + public void setAreas( Vector areas ) + { + this.areas = areas; + } + + public void addArea( AreaToPrint area ) + { + areas.add( area ); + } + + @Override + public Element toJdomElement() throws Exception + { + Element planoElement = new Element( "plano" ); + planoElement.addContent( empresa.toJdomElement() ); + planoElement.addContent( dataRelatorio.toJdomElement() ); + planoElement.addContent( dataHs.toJdomElement() ); + planoElement.addContent( legislacaoAplicavel.toJdomElement() ); + if( areas.size() > 0 ) + { + Element conclusoesElement = new Element( "conclusoes" ); + for( AreaToPrint area : areas ) + { + conclusoesElement.addContent( area.toJdomElement() ); + } + planoElement.addContent( conclusoesElement ); + } + Element observacoesDlElement = new Element( "observacoes-dl" ); + observacoesDlElement.setText( observacoesDl ); + planoElement.addContent( observacoesDlElement ); + Element observacoesDnsElement = new Element( "observacoes-dns" ); + observacoesDnsElement.setText( observacoesDns ); + planoElement.addContent( observacoesDnsElement ); + if( tecnico != null ) + { + planoElement.addContent( tecnico.toJdomElement() ); + } + if( tecnicoSuperior != null ) + { + planoElement.addContent( tecnicoSuperior.toJdomElement() ); + } + return planoElement; + } + + public String getObservacoesDl() + { + return observacoesDl; + } + + public void setObservacoesDl( String observacoesDl ) + { + this.observacoesDl = observacoesDl; + } + + public String getObservacoesDns() + { + return observacoesDns; + } + + public void setObservacoesDns( String observacoesDns ) + { + this.observacoesDns = observacoesDns; + } + + public TecnicoHSToPrint getTecnico() + { + return tecnico; + } + + public void setTecnico(TecnicoHSToPrint tecnico) + { + this.tecnico = tecnico; + } + + public TecnicoHSToPrint getTecnicoSuperior() { + return tecnicoSuperior; + } + + public void setTecnicoSuperior(TecnicoHSToPrint tecnicoSuperior) { + this.tecnicoSuperior = tecnicoSuperior; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/PostoToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/PostoToPrint.java new file mode 100644 index 00000000..037a33ae --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/PostoToPrint.java @@ -0,0 +1,36 @@ +package siprp.planoactuacao.print; + +import org.jdom.Element; + + +public class PostoToPrint + implements PrintableInterface +{ + protected String designacao; + + public PostoToPrint( String designacao ) + { + this.designacao = designacao; + } + + @Override + public Element toJdomElement() + throws Exception + { + Element postoElement = new Element( "posto" ); + Element designacaoElement = new Element( "designacao" ); + designacaoElement.setText( designacao ); + postoElement.addContent( designacaoElement ); + return postoElement; + } + + public String getDesignacao() + { + return designacao; + } + + public void setDesignacao( String designacao ) + { + this.designacao = designacao; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/PrintableInterface.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/PrintableInterface.java new file mode 100644 index 00000000..b9a2fbf3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/PrintableInterface.java @@ -0,0 +1,8 @@ +package siprp.planoactuacao.print; + +import org.jdom.Element; + +public interface PrintableInterface +{ + public Element toJdomElement() throws Exception; +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/RiscoToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/RiscoToPrint.java new file mode 100644 index 00000000..1f56e97f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/RiscoToPrint.java @@ -0,0 +1,188 @@ +package siprp.planoactuacao.print; + +import java.util.Vector; + +import org.jdom.Element; + +public class RiscoToPrint + implements PrintableInterface +{ + protected String descricao; + protected String valor; + protected Vector medidas; + protected String responsavel; + protected String recursos; + protected DataToPrint dataPrevistaInicio; + protected DataToPrint dataPrevistaConclusao; + protected String parecerDl; + protected String parecerDns; + protected String verificacaoSiprp; + protected Integer valorQuantitativo; + protected String valorQualitativo; + + public RiscoToPrint( String descricao, String valor, + Vector medidas, String responsavel, String recursos, + DataToPrint dataPrevistaInicio, DataToPrint dataPrevistaConclusao, + String parecerDl, String parecerDns, String verificacaoSiprp, Integer valorQuantitativo, String valorQualitativo ) + { + super(); + this.descricao = descricao; + this.valor = valor; + this.medidas = medidas; + this.responsavel = responsavel; + this.recursos = recursos; + this.dataPrevistaInicio = dataPrevistaInicio; + this.dataPrevistaConclusao = dataPrevistaConclusao; + this.parecerDl = parecerDl; + this.parecerDns = parecerDns; + this.verificacaoSiprp = verificacaoSiprp; + this.valorQuantitativo = valorQuantitativo; + this.valorQualitativo = valorQualitativo; + } + + @Override + public Element toJdomElement() throws Exception + { + Element riscoElement = new Element( "risco" ); + Element descricaoElement = new Element( "descricao" ); + descricaoElement.setText( descricao ); + riscoElement.addContent( descricaoElement ); + Element valorElement = new Element( "valor" ); + valorElement.setText( valor != null ? valor.toString() : " " ); + riscoElement.addContent( valorElement ); + for( MedidaToPrint medida : medidas ) + { + riscoElement.addContent( medida.toJdomElement() ); + } + Element responsavelElement = new Element( "responsavel" ); + responsavelElement.setText( responsavel ); + riscoElement.addContent( responsavelElement ); + Element recursosElement = new Element( "recursos" ); + recursosElement.setText( recursos ); + riscoElement.addContent( recursosElement ); + if( dataPrevistaInicio != null ) + { + riscoElement.addContent( dataPrevistaInicio.toJdomElement() ); + } + if( dataPrevistaConclusao != null ) + { + riscoElement.addContent( dataPrevistaConclusao.toJdomElement() ); + } + Element parecerDlElement = new Element( "parecer-dl" ); + parecerDlElement.setText( parecerDl ); + riscoElement.addContent( parecerDlElement ); + Element parecerDnsElement = new Element( "parecer-dns" ); + parecerDnsElement.setText( parecerDns ); + riscoElement.addContent( parecerDnsElement ); + Element verificacaoSiprpElement = new Element( "verificacao-siprp" ); + verificacaoSiprpElement.setText( verificacaoSiprp ); + riscoElement.addContent( verificacaoSiprpElement ); + return riscoElement; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao( String descricao ) + { + this.descricao = descricao; + } + + public String getValor() + { + return valor; + } + + public void setValor( String valor ) + { + this.valor = valor; + } + + public Vector getMedidas() + { + return medidas; + } + + public void setMedidas( Vector medidas ) + { + this.medidas = medidas; + } + + public void addMedida( MedidaToPrint medida ) + { + medidas.add( medida ); + } + + public String getResponsavel() + { + return responsavel; + } + + public void setResponsavel( String responsavel ) + { + this.responsavel = responsavel; + } + + public String getRecursos() + { + return recursos; + } + + public void setRecursos( String recursos ) + { + this.recursos = recursos; + } + + public DataToPrint getDataPrevistaInicio() + { + return dataPrevistaInicio; + } + + public void setDataPrevistaInicio( DataToPrint dataPrevistaInicio ) + { + this.dataPrevistaInicio = dataPrevistaInicio; + } + + public DataToPrint getDataPrevistaConclusao() + { + return dataPrevistaConclusao; + } + + public void setDataPrevistaConclusao( DataToPrint dataPrevistaConclusao ) + { + this.dataPrevistaConclusao = dataPrevistaConclusao; + } + + public String getParecerDl() + { + return parecerDl; + } + + public void setParecerDl( String parecerDl ) + { + this.parecerDl = parecerDl; + } + + public String getParecerDns() + { + return parecerDns; + } + + public void setParecerDns( String parecerDns ) + { + this.parecerDns = parecerDns; + } + + public String getVerificacaoSiprp() + { + return verificacaoSiprp; + } + + public void setVerificacaoSiprp( String verificacaoSiprp ) + { + this.verificacaoSiprp = verificacaoSiprp; + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/StringConverterUtils.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/StringConverterUtils.java new file mode 100644 index 00000000..2dc66422 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/StringConverterUtils.java @@ -0,0 +1,63 @@ +package siprp.planoactuacao.print; + +public class StringConverterUtils +{ + public static String stripHTMLTags( String text ) + { + String output = text; + + output = output.replaceAll( "
", "" ); + output = output.replaceAll( "

", "" ); + output = output.replaceAll( "

", "" ); + + return output; + } + + + public static String convertHTMLToText( String text ) + { + String output = text; + + output = output.replaceAll( "À", "À" ); + output = output.replaceAll( "Á", "Ã" ); + output = output.replaceAll( "Â", "Â" ); + output = output.replaceAll( "Ã", "Ã" ); + output = output.replaceAll( "Ç", "Ç" ); + output = output.replaceAll( "È", "È" ); + output = output.replaceAll( "É", "É" ); + output = output.replaceAll( "Ó", "Ó" ); + output = output.replaceAll( "Ò", "Ã’" ); + + output = output.replaceAll( "Ê", "Ê" ); + output = output.replaceAll( "Ì", "ÃŒ" ); + output = output.replaceAll( "Í", "Ã" ); + output = output.replaceAll( "Î", "ÃŽ" ); + output = output.replaceAll( "Ô", "Ô" ); + output = output.replaceAll( "Õ", "Õ" ); + output = output.replaceAll( "Ù", "Ù" ); + output = output.replaceAll( "Ú", "Ú" ); + output = output.replaceAll( "Û", "Û" ); + + output = output.replaceAll( "à", "à" ); + output = output.replaceAll( "á", "á" ); + output = output.replaceAll( "â", "â" ); + output = output.replaceAll( "ã", "ã" ); + output = output.replaceAll( "ç", "ç" ); + output = output.replaceAll( "è", "è" ); + output = output.replaceAll( "é", "é" ); + output = output.replaceAll( "ê", "ê" ); + output = output.replaceAll( "ì", "ì" ); + output = output.replaceAll( "í", "í" ); + output = output.replaceAll( "î", "î" ); + output = output.replaceAll( "ò", "ò" ); + output = output.replaceAll( "ó", "ó" ); + output = output.replaceAll( "ô", "ô" ); + output = output.replaceAll( "õ", "õ" ); + output = output.replaceAll( "ù", "ù" ); + output = output.replaceAll( "ú", "ú" ); + output = output.replaceAll( "û", "û" ); + + output = output.replaceAll( " ", " " ); + return output; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/TecnicoHSToPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/TecnicoHSToPrint.java new file mode 100644 index 00000000..9b127623 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/TecnicoHSToPrint.java @@ -0,0 +1,45 @@ +package siprp.planoactuacao.print; + +import org.jdom.Element; + +public class TecnicoHSToPrint + implements PrintableInterface +{ + protected Integer id; + protected String nome; + protected String cap; + protected String formacao; + protected String assinatura; + protected boolean superior; + + public TecnicoHSToPrint( Integer id, String nome, String cap, + String formacao, String assinatura, boolean superior ) + { + super(); + this.id = id; + this.nome = nome; + this.cap = cap; + this.formacao = formacao; + this.assinatura = assinatura; + this.superior = superior; + } + + @Override + public Element toJdomElement() throws Exception + { + Element tecnicoHSElement = new Element( "tecnico" + ( superior ? "-superior" : "" ) + "-hs" ); + Element nomeElement = new Element( "nome" ); + nomeElement.setText( nome ); + tecnicoHSElement.addContent( nomeElement ); + Element capElement = new Element( "cap" ); + capElement.setText( cap ); + tecnicoHSElement.addContent( capElement ); + Element formacaoElement = new Element( "formacao" ); + formacaoElement.setText( formacao ); + tecnicoHSElement.addContent( formacaoElement ); + Element assinaturaElement = new Element( "assinatura" ); + assinaturaElement.setText( "" + assinatura ); + tecnicoHSElement.addContent( assinaturaElement ); + return tecnicoHSElement; + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/TestPrint.java b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/TestPrint.java new file mode 100644 index 00000000..ca7e80af --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/TestPrint.java @@ -0,0 +1,81 @@ +package siprp.planoactuacao.print; + +import java.io.ByteArrayOutputStream; +import java.io.FileOutputStream; +import java.io.InputStream; + +import siprp.util.fop.PDFCreator; + +import com.evolute.utils.xml.XSLTransformer; + +public class TestPrint +{ + public static void main( String args[] ) + throws Exception + { + new TestPrint().test(); + } + + public void test() + throws Exception + { +// PlanoActuacaoDBInit.initDB(); +// PlanoActuacaoToPrint plano = PlanoActuacaoPrintDataProvider.getProvider().getPlanoToPrint( 6 ); +// Document foDoc = new Document( plano.toJdomElement() ); +// Format pretty = Format.getPrettyFormat(); +// pretty.setIndent("\t"); +// XMLOutputter outputter = new XMLOutputter(pretty); +// ByteArrayOutputStream foBaos = new ByteArrayOutputStream(); +// outputter.output( foDoc, foBaos ); +// FileOutputStream fos = new FileOutputStream( "/home/fpalma/Desktop/in.xml" ); +// fos.write( foBaos.toByteArray() ); +// fos.close(); +// +// byte fo[] = applyTemplate( +//// "siprp/planoactuacao/print/plano_actuacao.xsl", +// getClass().getClassLoader().getResourceAsStream( "siprp/planoactuacao/print/plano_actuacao.xsl" ), +//// "siprp/planoactuacao/print/teste_input.xml" ); +// new ByteArrayInputStream( foBaos.toByteArray() ) ); +//// new ByteArrayInputStream( "".getBytes() ) ); +//// System.out.println( new String( fo ) ); +// createPDFFile( fo, "/home/fpalma/Desktop/out.pdf" ); +//// createPDFFile( fo, "c:/Documents and Settings/Frederico/Ambiente de Trabalho/out.pdf" ); +// +// fos = new FileOutputStream( "/home/fpalma/Desktop/out.xml" ); +// fos.write( fo ); +// fos.close(); + + for( int n = 1; n <= 7; n++ ) + { + byte pdf[] = new PlanoActuacaoPDFCreator().createPDF( n, false ); + FileOutputStream fos = new FileOutputStream( "/home/fpalma/Desktop/" + n + ".pdf" ); + fos.write( pdf ); + fos.close(); + } + } + + public void createPDFFile( byte fo[], String path ) + throws Exception + { + byte pdf[] = PDFCreator.getPDFCreator().createPdfFromFo( fo ); + FileOutputStream fos = new FileOutputStream( path ); + fos.write( pdf ); + fos.close(); + } + + public byte[] applyTemplate( String template, String data ) + throws Exception + { + InputStream xsl = getClass().getClassLoader().getResourceAsStream( template ); + InputStream xml = getClass().getClassLoader().getResourceAsStream( data ); + return( applyTemplate( xsl, xml ) ); + } + + public byte[] applyTemplate( InputStream xsl, InputStream dataStream ) + throws Exception + { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + XSLTransformer.getXSLTransformer().transform( dataStream, xsl, baos ); + return baos.toByteArray(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao.xsl b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao.xsl new file mode 100644 index 00000000..93795116 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao.xsl @@ -0,0 +1,1497 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ATRIUM + SALDANHA   + Praça + Duque de Saldanha, 1 – 9º G   + 1050 – + 094 Lisboa   + Telefone + (+351) 213 504 540   + Fax + (+351) 213 504 549   + geral@siprp.pt +   + www.siprp.com +   + + + Lisboa   + + + + + de + + + + + + + + + + + + + + AVALIAÇÃO DOS + RISCOS PROFISSIONAIS   + Plano de Actuação +   +   +   + + + + + + + + +   + + +   + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + +   + + +   +   + + + + + + + ÃNDICE + + + + + + + + + 1. INTRODUÇÃO + + + + + + 2. AVALIAÇÃO DOS + RISCOS PROFISSIONAIS + + + + + 3. PLANO DE + ACTUAÇÃO + + + + + 3.1. Fase 1: + Preenchimento pela SIPRP + + + + + 3.2. Fase 2: + Preenchimento pela empresa cliente + + + + + 3.3. Fase 3: + Preenchimento pela SIPRP + + + + + 4. TABELA DO + PLANO DE ACTUAÇÃO + + + + + 5. CONSIDERAÇÕES + FINAIS + + + +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   + + + + + + + + 1 - INTRODUÇÃO + + + + + + + + + O empregador deve assegurar aos trabalhadores + condições de segurança e saúde em todos os aspectos relacionados + com o trabalho, aplicando as medidas necessárias tendo em conta os + princípios gerais de prevenção. + + + + + Na aplicação das medidas de prevenção, o empregador + deve mobilizar os meios necessários, nomeadamente nos domínios da + prevenção técnica, da formação, informação e consulta dos + trabalhadores e de serviços adequados, internos ou externos à + empresa. + + + + + De acordo com a Lei nº 102/2009 de 10 de Setembro, + que regulamenta o regime jurídico da promoção e prevenção da + segurança e da saúde no trabalho, a + prevenção dos riscos profissionais + deve assentar numa correcta e permanente avaliação de riscos. + + + + + Enquanto entidade prestadora de serviços externos, a + SIPRP - Sociedade Ibérica de Prevenção de Riscos Profissionais + fomenta a implementação das medidas necessárias para prevenir os + riscos profissionais e promover a segurança e a saúde dos + trabalhadores, nomeadamente através da planificação da prevenção + (integrando a todos os níveis a avaliação dos riscos e respectivas + medidas de prevenção), da avaliação de riscos (com elaboração do + respectivo relatório), da elaboração do plano de prevenção de + riscos profissionais e dos planos detalhados de prevenção e + protecção (planos de actuação). + + + + + Após a emissão do documento referente à avaliação dos + riscos profissionais, onde constam as respectivas medidas de + prevenção consideradas como necessárias, torna-se fundamental + disponibilizar o + plano de prevenção de riscos profissionais (Plano de Actuação). + + + + + + + + + + + + + + 2 - AVALIAÇÃO DOS RISCOS PROFISSIONAIS + + + + + + + + + O presente Plano de Actuação resulta da avaliação dos riscos + profissionais realizada a + + de + + de + + , na + empresa + + + + , estabelecimento de + + + + . + + + + + + + + + + + + + + + 3 - PLANO DE ACTUAÇÃO + + + + + + + + + No Plano de Actuação encontram-se reflectidas as + medidas consideradas como necessárias (após a avaliação dos + riscos), assim como uma linha condutora para a planificação da sua + execução por parte da empresa cliente. + + + + + Por forma a simplificar a leitura e a execução do + processo de planificação, a SIPRP emite uma tabela cujo + preenchimento é realizado em três fases. + + + + + + + 3.1 – Fase 1: Preenchimento pela SIPRP + + + + + A primeira fase do preenchimento da tabela é da + responsabilidade da SIPRP. + São indicadas as seguintes informações + (obtidas pela avaliação dos riscos profissionais): + + + + + + + + + + • + + + + + Posto de trabalho; + + + + + + + • + + + + + Risco; + + + + + + + • + + + + + Valor; + + + + + + + • + + + + + Medidas de prevenção. + + + + + + + + + + 3.2 – Fase 2: Preenchimento pela empresa cliente + + + + + Com o objectivo de orientar a empresa cliente na + integração da avaliação dos riscos para a segurança e a saúde do + trabalhador no conjunto das actividades da empresa, a SIPRP + solicita a indicação dos seguintes aspectos para cada uma das + medidas de prevenção: + + + + + + + + + + • + + + + + Responsável de execução; + + + + + + + • + + + + + Recursos necessários; + + + + + + + • + + + + + Data prevista de início; + + + + + + + • + + + + + Data prevista de conclusão. + + + + + + + + + + 3.3 – Fase 3: Preenchimento pela SIPRP + + + + + A execução das medidas de prevenção são verificadas + através da realização periódica da avaliação dos riscos + profissionais. + + + + + + + + + + + + + + 4 - TABELA DO PLANO DE PREVENÇÃO + + + + + + + + + A tabela do plano de actuação apresentada a seguir tem + como objectivo auxiliar na planificação da execução das medidas de + prevenção necessárias. + +   +   +   + + + + + + + + page + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TABELA DO PLANO DE ACTUAÇÃO +   + + + + + +   + + + + + + EMPRESA + : + + + – + + +   + + + + + +   + + + + + + Data da avaliação: + + + de + + de + + +   + + + + + + Data do + relatório: + + + de + + de + + +   + + + + + +   + + + + + + POSTO TRABALHO + + + RISCO + + + VALOR + + + MEDIDAS A IMPLEMENTAR + (Obrigações Legais e + Recomendações) + + + Responsável de execução + + + Recursos Necessários à + implementação das medidas + + + + Data prevista de início + + + Data prevista de conclusão + + + Verificação SIPRP + + + + + + + + + + + +   + + + + + + page + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + / + + / + + + + + + + + + + + + / + + / + + + + + + + + + + + + + + + + + + + + +   + + + + + + + page + + + + + + + + + + + + + + + + + + + + + +   + + + + + + + + + + + + + + +   + + + + + + + + + + + + + + NOME DO COORDENADOR DO PLANO + DE ACTUAÇÃO: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + +   + + + + + + + + + 5 - CONSIDERAÇÕES FINAIS + + + + + + + + + A SIPRP agradece a disponilidade e o apoio de todos os + colaboradores da empresa e fica ao dispor para qualquer + esclarecimento. + + + + + Lisboa, + + de + + de + + + +   + + +  Realizado por: + + + + + + + + + + + + + + + + + + +   + + + + + + Técnico de Higiene e Segurança +   + + + CAP nº + + + + + + + + + + + +  Verificado por: + + + + + + + + + + + + + + + + + + +   + + + + + + Técnico Superior de Higiene e Segurança +   + + + CAP nº + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao_alargado.xsl b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao_alargado.xsl new file mode 100644 index 00000000..4959f04c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao_alargado.xsl @@ -0,0 +1,1349 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ATRIUM + SALDANHA   + Praça + Duque de Saldanha, 1 – 9º G   + 1050 – + 094 Lisboa   + Telefone + (+351) 213 504 540   + Fax + (+351) 213 504 549   + geral@siprp.pt +   + www.siprp.com +   + + + Lisboa   + + + + + de + + + + + + + + + + + + + + AVALIAÇÃO DOS + RISCOS PROFISSIONAIS   + Plano de Actuação +   +   +   + + + + + + + + +   + + +   + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + +   + + +   +   + + + + + + + ÃNDICE + + + + + + + + + 1. INTRODUÇÃO + + + + + + 2. AVALIAÇÃO DOS + RISCOS PROFISSIONAIS + + + + + 3. PLANO DE + ACTUAÇÃO + + + + + 3.1. Fase 1: + Preenchimento pela SIPRP + + + + + 3.2. Fase 2: + Preenchimento pela empresa cliente + + + + + 3.3. Fase 3: + Preenchimento pela SIPRP + + + + + 4. TABELA DO + PLANO DE ACTUAÇÃO + + + + + 5. CONSIDERAÇÕES + FINAIS + + + +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   + + + + + + + + 1 - INTRODUÇÃO + + + + + + + + + O empregador deve assegurar aos trabalhadores + condições de segurança e saúde em todos os aspectos relacionados + com o trabalho, aplicando as medidas necessárias tendo em conta os + princípios gerais de prevenção. + + + + + Na aplicação das medidas de prevenção, o empregador + deve mobilizar os meios necessários, nomeadamente nos domínios da + prevenção técnica, da formação, informação e consulta dos + trabalhadores e de serviços adequados, internos ou externos à + empresa. + + + + + De acordo com a Lei nº 102/2009 de 10 de Setembro, + que regulamenta o regime jurídico da promoção e prevenção da + segurança e da saúde no trabalho, a + prevenção dos riscos profissionais + deve assentar numa correcta e permanente avaliação de riscos. + + + + + Enquanto entidade prestadora de serviços externos, a + SIPRP - Sociedade Ibérica de Prevenção de Riscos Profissionais + fomenta a implementação das medidas necessárias para prevenir os + riscos profissionais e promover a segurança e a saúde dos + trabalhadores, nomeadamente através da planificação da prevenção + (integrando a todos os níveis a avaliação dos riscos e respectivas + medidas de prevenção), da avaliação de riscos (com elaboração do + respectivo relatório), da elaboração do plano de prevenção de + riscos profissionais e dos planos detalhados de prevenção e + protecção (planos de actuação). + + + + + Após a emissão do documento referente à avaliação dos + riscos profissionais, onde constam as respectivas medidas de + prevenção consideradas como necessárias, torna-se fundamental + disponibilizar o + plano de prevenção de riscos profissionais (Plano de Actuação). + + + + + + + + + + + + + + 2 - AVALIAÇÃO DOS RISCOS PROFISSIONAIS + + + + + + + + + O presente Plano de Actuação resulta da avaliação dos riscos + profissionais realizada a + + de + + de + + , na + empresa + + + + , estabelecimento de + + + + . + + + + + + + + + + + + + + + 3 - PLANO DE ACTUAÇÃO + + + + + + + + + No Plano de Actuação encontram-se reflectidas as + medidas consideradas como necessárias (após a avaliação dos + riscos), assim como uma linha condutora para a planificação da sua + execução por parte da empresa cliente. + + + + + Por forma a simplificar a leitura e a execução do + processo de planificação, a SIPRP emite uma tabela cujo + preenchimento é realizado em três fases. + + + + + + + 3.1 – Fase 1: Preenchimento pela SIPRP + + + + + A primeira fase do preenchimento da tabela é da + responsabilidade da SIPRP. + São indicadas as seguintes informações + (obtidas pela avaliação dos riscos profissionais): + + + + + + + + + + • + + + + + Posto de trabalho; + + + + + + + • + + + + + Risco; + + + + + + + • + + + + + Valor; + + + + + + + • + + + + + Medidas de prevenção. + + + + + + + + + + 3.2 – Fase 2: Preenchimento pela empresa cliente + + + + + Com o objectivo de orientar a empresa cliente na + integração da avaliação dos riscos para a segurança e a saúde do + trabalhador no conjunto das actividades da empresa, a SIPRP + solicita a indicação dos seguintes aspectos para cada uma das + medidas de prevenção: + + + + + + + + + + • + + + + + Responsável de execução; + + + + + + + • + + + + + Recursos necessários; + + + + + + + • + + + + + Data prevista de início; + + + + + + + • + + + + + Data prevista de conclusão. + + + + + + + + + + 3.3 – Fase 3: Preenchimento pela SIPRP + + + + + A execução das medidas de prevenção são verificadas + através da realização periódica da avaliação dos riscos + profissionais. + + + + + + + + + + + + + + 4 - TABELA DO PLANO DE PREVENÇÃO + + + + + + + + + A tabela do plano de actuação apresentada a seguir tem + como objectivo auxiliar na planificação da execução das medidas de + prevenção necessárias. + +   +   +   + + + + + + + + page + + + + + + + + + + + + + + + + + + + + + +   + + + + + + + + + + + TABELA DO PLANO DE ACTUAÇÃO +   + + + + +   + + + + + + EMPRESA + : + + + – + + +   + + + + + +   + + + + + + Data da avaliação: + + + de + + de + + +   + + + + + + Data do relatório: + + + de + + de + + +   + + + + + +   + + + + + POSTO TRABALHO + + + RISCO + + + VALOR + + + MEDIDAS A IMPLEMENTAR + (Obrigações Legais e + Recomendações) + + + Responsável de execução + + + Recursos Necessários à + implementação das medidas + + + Data prevista de início + + + Data prevista de conclusão + + + Parecer DL + + + Parecer DNS + + + Verificação SIPRP + + + + + + + + + + + +   + + + + + + page + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + / + + / + + + + + + + + + + + + / + + / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + + + + + + page + + + + + + + + + + + + + + + + + + + + + +   + + + + + + + + + + + + + + +   + + + + + + + + Observações Gerais DL: + + + + + + + + + + + + + + + + + Observações Gerais DNS: + + + + + + + + + + + + + + + + + + + + + + + NOME DO COORDENADOR DO PLANO + DE ACTUAÇÃO: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + +   + + + + + + + + + 5 - CONSIDERAÇÕES FINAIS + + + + + + + + + A SIPRP agradece a disponilidade e o apoio de todos os + colaboradores da empresa e fica ao dispor para qualquer + esclarecimento. + + + + + Lisboa, + + de + + de + + + +   + + +  Realizado por: + + + + + + + + + + + + + + + + + + +   + + + + + + Técnico de Higiene e Segurança +   + + + CAP nº + + + + + + + + + + + +  Verificado por: + + + + + + + + + + + + + + + + + + +   + + + + + + Técnico Superior de Higiene e Segurança +   + + + CAP nº + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao_alargado_old.xsl b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao_alargado_old.xsl new file mode 100644 index 00000000..b6d14b8d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao_alargado_old.xsl @@ -0,0 +1,1400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ATRIUM SALDANHA   + Praça Duque de Saldanha, 1 – 9º G   + 1050 – 094 Lisboa   + Telefone (+351) 213 504 540   + Fax (+351) 213 504 549   + geral@siprp.pt   + www.siprp.com   + + + Lisboa   + + + + de + + + + + + + + + + + + + + AVALIAÇÃO DE RISCOS LABORAIS   + Plano de Actuação   +   +   + + + + + + + +   + +   + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + +   + + +   +   + ÃNDICE + + 1. OBJECTIVO + + + + + 2. CRITÉRIO DE AVALIAÇÃO APLICADO + + + + + 3. CONSTITUIÇÃO DO PLANO + + + + + 4. ÂMBITO + + + + + 5. LEGISLAÇÃO APLICÃVEL + + + + + 6. RESPONSABILIDADE DO COORDENADOR + + + + + 7. COMO PREENCHER A TABELA DO PLANO + + + + + 8. PARTICIPAÇÃO DA DIRECÇÃO E DOS + TRABALHADORES + + + + + 9. ANEXO + + + +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   + 1. OBJECTIVO   +   + O objectivo do presente documento é estabelecer + um plano de actuação (doravante designado por + Plano), que auxilie a programação das + actividades necessárias à eliminação ou controlo + dos riscos detectados na avaliação inicial de + riscos laborais.   +   + 2. CRITÉRIO DE AVALIAÇÃO APLICADO   +   + A valoração dos riscos associados as perigos + identificados tem como objectivo a definição de + prioridades da execução das medidas preventivas + (hierarquização dos riscos).   + + Para realizar a valoração de um risco + laboral é necessário atender à + probabilidade + de ocorrência (quantas vezes pode ocorrer?) + e da estimativa da + severidade + (gravidade) das consequências da sua + materialização (que dano/lesão pode + resultar?). +   + + As consequências de um risco laboral podem ser + caracterizadas em danos muito leves, em lesões + leves, lesões graves ou lesões muito graves ou + morte.   + No quadro seguinte encontram-se alguns exemplos + de consequências de acordo com o grau de + severidade.   +   + + + + + + + SEVERIDADE (S)   + + + CONSEQUÊNCIAS PREVISÃVEIS   + + + + + Danos muito leves   + + + - Pequenos ferimentos   + - Dor de cabeça ou outros + transtornos leves que não causem + baixa   + - Desconforto, fadiga visual   + - Em geral, lesões ou + transtornos que não requeiram + tratamento médico ou baixa + médica   + + + + + Lesão leve   + + + - Contusões, cortes + superficiais, entorses, + distensões   + - Irritações   + - Pequenas queimaduras + superficiais   + - Em geral, lesões ou + transtornos que requerem + tratamento médico e podem + ocasionar em alguns casos baixa + de curta duração   + + + + + Lesão grave   + + + - Lacerações   + - Queimaduras extensas   + - Comoções/Abalos físicos   + - Pequenas fracturas   + - Doença crónica que conduza a + uma incapacidade menor + (diminuição da audição, + dermatoses, asma)   + - Transtornos + músculo-esqueléticos   + + + + + Lesão muito grave/mortal   + + + - Amputações, lesões múltiplas   + - Facturas maiores   + - Intoxicações   + - Cancro   + - Doenças crónicas que afectam + severamente a vida   + - Incapacidades permanentes   + - Invalidez   + - Morte   + + + + +   +   +   + Um risco laboral pode ser classificado em + improvável, possível, provável ou inevitável, de + acordo com a probabilidade de se vir a + materializar; como se pode verificar no quadro + seguinte.   +   + + + + + + + PROBABILIDADE (P)   + + + CRITÉRIOS APLICADOS   + + + + + Improvável   + + + - Extremamente raro, ainda não + acorreu   + - Não existe exposição ao perigo + em condições normais de trabalho + ou é muito esporádica   + - O dano não é previsível que + ocorra   + + + + + Possível   + + + - É raro que possa ocorrer   + - Se já ocorreu alguma vez   + - Pode-se apresentar em + determinadas circunstâncias   + - A exposição ao perigo é + ocasional   + - O dano ocorreu várias vezes   + + + + + Provável   + + + - Não será estranho que ocorra o + dano   + - Já ocorreu em algumas + situações   + - Existência de vários + incidentes ou acidentes pela + mesma causa   + - Os sistemas e medidas + aplicadas para o controlo dos + riscos não impedem que este se + manifeste em qualquer momento da + exposição   + - O dano ocorrerá em algumas + ocasiões   + - A exposição ao perigo é + frequente ou afecta bastante + pessoas   + + + + + Inevitável   + + + - É o resultado mais provável + quando existe uma exposição + continuada ou afecta a muitas + pessoas   + - Ocorrerá a médio ou a longo + prazo   + - O dano ocorrerá sempre ou + quase sempre   + + + + +   + Com base na frequência da exposição e nas + consequências de um risco, é possível construir + uma matriz de falhas, na qual podem ser + atribuídas cores e números que evidenciem os + diferentes níveis de valoração do risco, como se + pode verificar no seguinte quadro:   +   + + + + + + + +   + + +   + PROBABILIDADE DE MATERIALIZAÇÃO + DO RISCO   +   + + + + + GRAU DE SEVERIDADE POSSÃVEL   + + +   + IMPROVÃVEL   + 1   + + +   + POSSÃVEL   + 2   + + +   + PROVÃVEL   + 3   + + +   + INEVITÃVEL   + 4   + + + + + DANOS MUITO LEVES   + 1   + + +   + IRRELEVANTE   + 1   + + +   + MUITO BAIXO   + 2   + + +   + MUITO BAIXO   + 3   + + +   + BAIXO   + 4   + + + + +   + LESÃO LEVE   + 2   + + +   + MUITO BAIXO   + 2   + + +   + BAIXO   + 4   + + +   + MÉDIO   + 6   + + +   + ALTO   + 8   + + + + +   + LESÃO GRAVE   + 3   + + +   + MUITO BAIXO   + 3   + + +   + MÉDIO   + 6   + + +   + ALTO   + 9   + + +   + MUITO ALTO   + 12   + + + + + LESÃO MUITO GRAVE OU MORTAL   + 4   + + +   + BAIXO   + 4   + + +   + ALTO   + 8   + + +   + MUITO ALTO   + 12   + + +   + EXTREMAMENTE ALTO   + 16   + + + + +   +   + A determinação da valoração do risco permite + hierarquizar as intervenções, definir as acções + e estabelecer prazos de execução, como se + exemplifica no quadro que se segue.   +   + + + + + + + VALORAÇÃO DO RISCO   + + + RECOMENDAÇÕES   + + + + + Irrelevante   + + + Não é necessário estabelecer + nenhuma medida   + + + + + Muito baixo   + + + Não é necessário estabelecer + medidas adicionais às existentes +   + + + + + Baixo   + Prioridade: Baixa   + + + Controlar a situação que pode + materializar o risco   + + + + + Médio   +   + Prioridade: Média   + + + Verificar periodicamente a + eficácia das medidas de controlo + e melhorar a acção preventiva a + médio prazo (se as consequências + poderem ser muito graves ou + mortais, o prazo deve ser + reduzido)   + + + + + Alto   +   +   + Prioridade: Média/Alta   + + + Devem-se implementar medidas + para reduzir o risco a curto + prazo (se as consequências + poderem ser muito graves ou + mortais, o prazo deve ser + reduzido)   + + + + + Muito alto   +   +   +   + Prioridade: Alta   + + + Adoptar medidas provisórias + imediatas e definitivas para a + redução do risco a muito curto + prazo.   + Se o trabalho não se realiza + habitualmente, não se deve + iniciar sem que haja redução do + risco. Avaliar as medidas + adoptadas   + + + + + Extremamente alto   +   +   + Prioridade: Actuação imediata   + + + Não começar ou continuar o + trabalho até que se reduza o + risco. É necessário avaliar o + risco, uma vez corrigido.   + + + + +   + Alguns riscos laborais podem necessitar da + realização de estudos específicos, realizados de + acordo com os critérios estabelecidos na + legislação e normativa portuguesa e + internacional. Nesta situação, os riscos + laborais detectados podem ser classificados como + risco controlado, semi-controlado, incontrolado + e indeterminado, como é mostrado na tabela que + se segue:   +   + + + + + + + + RISCOS DE HIGIENE, ERGONOMICOS + OU PSICOSSOCIAIS DO TRABALHO   + + + CLASSIFICAÇÃO   + + + OBSERVAÇÕES   + + + + + Risco analisado/documentado.   + Informação suficiente.   + + + + + + + + + Controlado   +   + + + As medidas de + controlo + existentes são + adequadas   + + + + + Incontrolado   + + + As medidas de + controlo são + inexistentes, + insuficientes ou + inadequadas.   + + + + + + + + + Risco não estudado/analisado.   + Informação insuficiente.   + + + Indeterminado   + + + É necessário realizar estudo + específico   + + + + +   + Um risco analisado e documentado, é aquele que + tendo sido objecto de uma avaliação específica e + que se encontra documentado, registado e + disponível na empresa.   +   + + Um risco que foi analisado pode encontrar-se + controlado ou incontrolado + , sendo esta última situação referente ao + não cumprimento das medidas de controlo + aconselhadas nos estudos realizados e à não + realização de novos estudos com a + periodicidade obrigatória. +   + +   + + Se não existe informação suficiente para + determinar a magnitude ou nível do risco e + poder adoptar as medidas adequadas, + classifica-se como risco + Indeterminado + . +   + +   +   + 3. CONSTITUIÇÃO DO PLANO   +   + O Plano inclui os seguintes pontos:   +   + 1 - Identificação do posto de trabalho   + 2 - Risco detectado   + 3 - Valoração do risco   + 4 - Medida a implementar   + 5 - Responsável pela execução   + 6 - Recursos necessários   + 7 - Prazo de execução   + +   +   + 4. ÂMBITO   +   + No presente documento tem-se em consideração + todos os riscos que requerem modificação + (compra, reparação, substituição, adequação, + etc) das condições físicas do posto de trabalho + e dos procedimentos de execução das tarefas.   +   +   +   + 5. LEGISLAÇÃO APLICÃVEL   +   + + 5.1 Legislação de aplicação geral   + + + + + + + + + + + • + + + + + + + + . + + + ; + + + + + + + + +   + + + 5.2 Legislação específica   + + + + + + + + + + + + + + + • + + + + + + + + . + + + ; + + + + + + + + + +   + +   +   +   + 6. RESPONSABILIDADE DO COORDENADOR   +   + O coordenador será designado pela empresa, + assessorado pela SIPRP, sendo da sua + responsabilidade fixar as datas, acompanhar a + execução e manter a direcção informada sobre a + implementação do Plano.   +   +   + 7. COMO PREENCHER A TABELA DO PLANO   +   + Com base na avaliação inicial de riscos, a SIPRP + indica os seguintes dados:   +   + 1 - Identificação do(s) posto(s) de trabalho(s) +   + 2 - Risco(s) detectado(s)   + 3 - Valoração do(s) risco(s)   + 4 - Medida(s) a implementar   +   + + + A descrição completa dos mesmos consta da + avaliação de riscos laborais, realizada em + + de + + de + + . + +   + +   + 5 - O coordenador do Plano designará o + responsável pela execução de cada uma das + medidas propostas, de acordo com os + procedimentos internos da empresa.   +   + 6 - O responsável pela execução comunicará os + recursos necessários (humanos e materiais) e os + prazos de realização da medida ao coordenador do + Plano, num prazo máximo de 15 dias.   +   + 7 - O coordenador do Plano fará constar estes + dados na tabela de planificação, devendo enviar + cópia à SIPRP no prazo de 1 mês a contar da data + de entrega deste Plano e posteriormente realizar + o seguimento da implementação das medidas + propostas.   +   +   + 8. PARTICIPAÇÃO DA DIRECÇÃO E DOS TRABALHADORES +   +   + A Direcção deverá disponibilizar os recursos + (humanos e materiais) para a implementação do + Plano.   + Os trabalhadores, assim como os seus + representantes, deverão cooperar na execução + deste Plano, de modo a melhorar as condições de + segurança, higiene e saúde do trabalho.   +   +   +   + 9. ANEXO   +   + Tabela do plano de actuação.   +   +   +   + + + + + + + + page + + + + + + + + + + + + + + + + + + + + + +   + + + + + + + + + + + TABELA DO PLANO DE ACTUAÇÃO +   + + + + +   + + + + + + EMPRESA + : + + + – + + +   + + + + + +   + + + + + + Data da avaliação: + + + de + + de + + +   + + + + + + Data do relatório: + + + de + + de + + +   + + + + + +   + + + + + POSTO TRABALHO + + + RISCO + + + VALOR + + + MEDIDAS A IMPLEMENTAR + (Obrigações Legais e + Recomendações) + + + Responsável de execução + + + Recursos Necessários à + implementação das medidas + + + Data prevista de início + + + Data prevista de conclusão + + + Parecer DL + + + Parecer DNS + + + Verificação SIPRP + + + + + + + + + + + +   + + + + + + page + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + / + + / + + + + + + + + + + + + / + + / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + + + + + + page + + + + + + + + + + + + + + + + + + + + + +   + + + + + + + + + + + + + + +   + + + + + + + + Observações Gerais DL: + + + + + + + + + + + + + + + + + Observações Gerais DNS: + + + + + + + + + + + + + + + + + + + + + + + NOME DO COORDENADOR DO PLANO + DE ACTUAÇÃO: + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao_old.xsl b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao_old.xsl new file mode 100644 index 00000000..631a080d --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao_old.xsl @@ -0,0 +1,1340 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ATRIUM SALDANHA   + Praça Duque de Saldanha, 1 – 9º G   + 1050 – 094 Lisboa   + Telefone (+351) 213 504 540   + Fax (+351) 213 504 549   + geral@siprp.pt   + www.siprp.com   + + + Lisboa   + + + + de + + + + + + + + + + + + + + AVALIAÇÃO DE RISCOS LABORAIS   + Plano de Actuação   +   +   + + + + + + + + +   + +   + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + +   + + +   +   + ÃNDICE + + 1. OBJECTIVO + + + + + 2. CRITÉRIO DE AVALIAÇÃO APLICADO + + + + + 3. CONSTITUIÇÃO DO PLANO + + + + + 4. ÂMBITO + + + + + 5. LEGISLAÇÃO APLICÃVEL + + + + + 6. RESPONSABILIDADE DO COORDENADOR + + + + + 7. COMO PREENCHER A TABELA DO PLANO + + + + + 8. PARTICIPAÇÃO DA DIRECÇÃO E DOS + TRABALHADORES + + + + + 9. ANEXO + + + +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   + 1. OBJECTIVO   +   + O objectivo do presente documento é estabelecer + um plano de actuação (doravante designado por + Plano), que auxilie a programação das + actividades necessárias à eliminação ou controlo + dos riscos detectados na avaliação inicial de + riscos laborais.   +   + 2. CRITÉRIO DE AVALIAÇÃO APLICADO   +   + A valoração dos riscos associados as perigos + identificados tem como objectivo a definição de + prioridades da execução das medidas preventivas + (hierarquização dos riscos).   + + Para realizar a valoração de um risco + laboral é necessário atender à + probabilidade + de ocorrência (quantas vezes pode ocorrer?) + e da estimativa da + severidade + (gravidade) das consequências da sua + materialização (que dano/lesão pode + resultar?). +   + + As consequências de um risco laboral podem ser + caracterizadas em danos muito leves, em lesões + leves, lesões graves ou lesões muito graves ou + morte.   + No quadro seguinte encontram-se alguns exemplos + de consequências de acordo com o grau de + severidade.   +   + + + + + + + SEVERIDADE (S)   + + + CONSEQUÊNCIAS PREVISÃVEIS   + + + + + Danos muito leves   + + + - Pequenos ferimentos   + - Dor de cabeça ou outros + transtornos leves que não causem + baixa   + - Desconforto, fadiga visual   + - Em geral, lesões ou + transtornos que não requeiram + tratamento médico ou baixa + médica   + + + + + Lesão leve   + + + - Contusões, cortes + superficiais, entorses, + distensões   + - Irritações   + - Pequenas queimaduras + superficiais   + - Em geral, lesões ou + transtornos que requerem + tratamento médico e podem + ocasionar em alguns casos baixa + de curta duração   + + + + + Lesão grave   + + + - Lacerações   + - Queimaduras extensas   + - Comoções/Abalos físicos   + - Pequenas fracturas   + - Doença crónica que conduza a + uma incapacidade menor + (diminuição da audição, + dermatoses, asma)   + - Transtornos + músculo-esqueléticos   + + + + + Lesão muito grave/mortal   + + + - Amputações, lesões múltiplas   + - Facturas maiores   + - Intoxicações   + - Cancro   + - Doenças crónicas que afectam + severamente a vida   + - Incapacidades permanentes   + - Invalidez   + - Morte   + + + + +   +   +   + Um risco laboral pode ser classificado em + improvável, possível, provável ou inevitável, de + acordo com a probabilidade de se vir a + materializar; como se pode verificar no quadro + seguinte.   +   + + + + + + + PROBABILIDADE (P)   + + + CRITÉRIOS APLICADOS   + + + + + Improvável   + + + - Extremamente raro, ainda não + acorreu   + - Não existe exposição ao perigo + em condições normais de trabalho + ou é muito esporádica   + - O dano não é previsível que + ocorra   + + + + + Possível   + + + - É raro que possa ocorrer   + - Se já ocorreu alguma vez   + - Pode-se apresentar em + determinadas circunstâncias   + - A exposição ao perigo é + ocasional   + - O dano ocorreu várias vezes   + + + + + Provável   + + + - Não será estranho que ocorra o + dano   + - Já ocorreu em algumas + situações   + - Existência de vários + incidentes ou acidentes pela + mesma causa   + - Os sistemas e medidas + aplicadas para o controlo dos + riscos não impedem que este se + manifeste em qualquer momento da + exposição   + - O dano ocorrerá em algumas + ocasiões   + - A exposição ao perigo é + frequente ou afecta bastante + pessoas   + + + + + Inevitável   + + + - É o resultado mais provável + quando existe uma exposição + continuada ou afecta a muitas + pessoas   + - Ocorrerá a médio ou a longo + prazo   + - O dano ocorrerá sempre ou + quase sempre   + + + + +   + Com base na frequência da exposição e nas + consequências de um risco, é possível construir + uma matriz de falhas, na qual podem ser + atribuídas cores e números que evidenciem os + diferentes níveis de valoração do risco, como se + pode verificar no seguinte quadro:   +   + + + + + + + +   + + +   + PROBABILIDADE DE MATERIALIZAÇÃO + DO RISCO   +   + + + + + GRAU DE SEVERIDADE POSSÃVEL   + + +   + IMPROVÃVEL   + 1   + + +   + POSSÃVEL   + 2   + + +   + PROVÃVEL   + 3   + + +   + INEVITÃVEL   + 4   + + + + + DANOS MUITO LEVES   + 1   + + +   + IRRELEVANTE   + 1   + + +   + MUITO BAIXO   + 2   + + +   + MUITO BAIXO   + 3   + + +   + BAIXO   + 4   + + + + +   + LESÃO LEVE   + 2   + + +   + MUITO BAIXO   + 2   + + +   + BAIXO   + 4   + + +   + MÉDIO   + 6   + + +   + ALTO   + 8   + + + + +   + LESÃO GRAVE   + 3   + + +   + MUITO BAIXO   + 3   + + +   + MÉDIO   + 6   + + +   + ALTO   + 9   + + +   + MUITO ALTO   + 12   + + + + + LESÃO MUITO GRAVE OU MORTAL   + 4   + + +   + BAIXO   + 4   + + +   + ALTO   + 8   + + +   + MUITO ALTO   + 12   + + +   + EXTREMAMENTE ALTO   + 16   + + + + +   + A determinação da valoração do risco permite + hierarquizar as intervenções, definir as acções + e estabelecer prazos de execução, como se + exemplifica no quadro que se segue.   +   + + + + + + + VALORAÇÃO DO RISCO   + + + RECOMENDAÇÕES   + + + + + Irrelevante   + + + Não é necessário estabelecer + nenhuma medida   + + + + + Muito baixo   + + + Não é necessário estabelecer + medidas adicionais às existentes +   + + + + + Baixo   + Prioridade: Baixa   + + + Controlar a situação que pode + materializar o risco   + + + + + Médio   +   + Prioridade: Média   + + + Verificar periodicamente a + eficácia das medidas de controlo + e melhorar a acção preventiva a + médio prazo (se as consequências + poderem ser muito graves ou + mortais, o prazo deve ser + reduzido)   + + + + + Alto   +   +   + Prioridade: Média/Alta   + + + Devem-se implementar medidas + para reduzir o risco a curto + prazo (se as consequências + poderem ser muito graves ou + mortais, o prazo deve ser + reduzido)   + + + + + Muito alto   +   +   +   + Prioridade: Alta   + + + Adoptar medidas provisórias + imediatas e definitivas para a + redução do risco a muito curto + prazo.   + Se o trabalho não se realiza + habitualmente, não se deve + iniciar sem que haja redução do + risco. Avaliar as medidas + adoptadas   + + + + + Extremamente alto   +   +   + Prioridade: Actuação imediata   + + + Não começar ou continuar o + trabalho até que se reduza o + risco. É necessário avaliar o + risco, uma vez corrigido.   + + + + +   + Alguns riscos laborais podem necessitar da + realização de estudos específicos, realizados de + acordo com os critérios estabelecidos na + legislação e normativa portuguesa e + internacional. Nesta situação, os riscos + laborais detectados podem ser classificados como + risco controlado, semi-controlado, incontrolado + e indeterminado, como é mostrado na tabela que + se segue:   +   + + + + + + + + RISCOS DE HIGIENE, ERGONOMICOS + OU PSICOSSOCIAIS DO TRABALHO   + + + CLASSIFICAÇÃO   + + + OBSERVAÇÕES   + + + + + Risco analisado/documentado.   + Informação suficiente.   + + + + + + + + + Controlado   +   + + + As medidas de + controlo + existentes são + adequadas   + + + + + Incontrolado   + + + As medidas de + controlo são + inexistentes, + insuficientes ou + inadequadas.   + + + + + + + + + Risco não estudado/analisado.   + Informação insuficiente.   + + + Indeterminado   + + + É necessário realizar estudo + específico   + + + + +   + Um risco analisado e documentado, é aquele que + tendo sido objecto de uma avaliação específica e + que se encontra documentado, registado e + disponível na empresa.   +   + + Um risco que foi analisado pode encontrar-se + controlado ou incontrolado + , sendo esta última situação referente ao + não cumprimento das medidas de controlo + aconselhadas nos estudos realizados e à não + realização de novos estudos com a + periodicidade obrigatória. +   + +   + + Se não existe informação suficiente para + determinar a magnitude ou nível do risco e + poder adoptar as medidas adequadas, + classifica-se como risco + Indeterminado + . +   + +   +   + 3. CONSTITUIÇÃO DO PLANO   +   + O Plano inclui os seguintes pontos:   +   + 1 - Identificação do posto de trabalho   + 2 - Risco detectado   + 3 - Valoração do risco   + 4 - Medida a implementar   + 5 - Responsável pela execução   + 6 - Recursos necessários   + 7 - Prazo de execução   + +   +   + 4. ÂMBITO   +   + No presente documento tem-se em consideração + todos os riscos que requerem modificação + (compra, reparação, substituição, adequação, + etc) das condições físicas do posto de trabalho + e dos procedimentos de execução das tarefas.   +   +   +   + 5. LEGISLAÇÃO APLICÃVEL   +   + + 5.1 Legislação de aplicação geral   + + + + + + + + + + + • + + + + + + + + . + + + ; + + + + + + + + +   + + + 5.2 Legislação específica   + + + + + + + + + + + + + + + • + + + + + + + + . + + + ; + + + + + + + + + +   + +   +   +   + 6. RESPONSABILIDADE DO COORDENADOR   +   + O coordenador será designado pela empresa, + assessorado pela SIPRP, sendo da sua + responsabilidade fixar as datas, acompanhar a + execução e manter a direcção informada sobre a + implementação do Plano.   +   +   + 7. COMO PREENCHER A TABELA DO PLANO   +   + Com base na avaliação inicial de riscos, a SIPRP + indica os seguintes dados:   +   + 1 - Identificação do(s) posto(s) de trabalho(s) +   + 2 - Risco(s) detectado(s)   + 3 - Valoração do(s) risco(s)   + 4 - Medida(s) a implementar   +   + + + A descrição completa dos mesmos consta da + avaliação de riscos laborais, realizada em + + de + + de + + . + +   + +   + 5 - O coordenador do Plano designará o + responsável pela execução de cada uma das + medidas propostas, de acordo com os + procedimentos internos da empresa.   +   + 6 - O responsável pela execução comunicará os + recursos necessários (humanos e materiais) e os + prazos de realização da medida ao coordenador do + Plano, num prazo máximo de 15 dias.   +   + 7 - O coordenador do Plano fará constar estes + dados na tabela de planificação, devendo enviar + cópia à SIPRP no prazo de 1 mês a contar da data + de entrega deste Plano e posteriormente realizar + o seguimento da implementação das medidas + propostas.   +   +   + 8. PARTICIPAÇÃO DA DIRECÇÃO E DOS TRABALHADORES +   +   + A Direcção deverá disponibilizar os recursos + (humanos e materiais) para a implementação do + Plano.   + Os trabalhadores, assim como os seus + representantes, deverão cooperar na execução + deste Plano, de modo a melhorar as condições de + segurança, higiene e saúde do trabalho.   +   +   +   + 9. ANEXO   +   + Tabela do plano de actuação.   +   +   +   + + + + + + + + page + + + + + + + + + + + + + + + + + + + +   + + + + + + + + + + + TABELA DO PLANO DE ACTUAÇÃO +   + + + + +   + + + + + + EMPRESA + : + + + – + + +   + + + + + +   + + + + + + Data da avaliação: + + + de + + de + + +   + + + + + + Data do relatório: + + + de + + de + + +   + + + + + +   + + + + + POSTO TRABALHO + + + RISCO + + + VALOR + + + MEDIDAS A IMPLEMENTAR + (Obrigações Legais e + Recomendações) + + + Responsável de execução + + + Recursos Necessários à + implementação das medidas + + + Data prevista de início + + + Data prevista de conclusão + + + Verificação SIPRP + + + + + + + + + + + +   + + + + + + page + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + / + + / + + + + + + + + + + + + / + + / + + + + + + + + + + + + + + + + + + + + +   + + + + + + + page + + + + + + + + + + + + + + + + + + + + + +   + + + + + + + + + + + + + + +   + + + + + + + + + + + + + + NOME DO COORDENADOR DO PLANO + DE ACTUAÇÃO: + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/teste_input.xml b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/teste_input.xml new file mode 100644 index 00000000..9ac97fd1 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/planoactuacao/print/teste_input.xml @@ -0,0 +1,91 @@ + + + + + COMPANHIA PORTUGUESA DE HIPERMERCADOS + + ALVERCA + http://apdp/siprp/auchan_jumbo_lado.jpg + + + 2008 + 4 + Abril + 29 + + + 2008 + 3 + Março + 1 + + + + Lei nº 99/2003 de 27 de Agosto regulamentada pela Lei + nº 35/2004 de 29 de Julho – Aprova o novo Código + de Trabalho + + + Decreto-Lei n.º441/91 de 14 de Novembro, alterado pelo + Decreto-Lei n.º133/99 de 21 de Abril – Estabelece o + regime jurídico do enquadramento da segurança, + higiene e saúde do trabalho + + + Decreto-Lei n.º26/94, de 1 de Fevereiro, alterado pela + Lei n.º7/95 de 29 de Março e pelo Decreto-Lei + n.º109/2000 – Regime de Organização e + funcionamento dos serviços da segurança, higiene e + saúde do trabalho + + + + + Área Administrativa + + + Risco de exposição a condições + inadequadas de iluminação + + 6 + + + + Melhorar as condições de iluminação para valores + mínimos de 500 na área focal de trabalho e 300 + lux no seu envolvimento + + + Areas comerciais + + + + Cartazista + + + Frederico Palma + lampadas + + 2008 + 5 + Maio + 1 + + + 2009 + 5 + Maio + 1 + + OK + OK + OK + + + + Área Comercial + + + 1 + 2 + \ No newline at end of file diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/printer/Printer.java b/branches/SIPRP/SIPRPSoft/src/siprp/printer/Printer.java new file mode 100644 index 00000000..788cd162 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/printer/Printer.java @@ -0,0 +1,61 @@ +package siprp.printer; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; + +import siprp.ficha.ExamePDF; +import siprp.ficha.FichaAptidaoCreator; +import siprp.ficha.PDFFilePrinter; + +public class Printer +{ + public static void printFO( byte fo[] ) throws Exception + { + if( fo != null ) + { + byte pdf[] = FichaAptidaoCreator.getCreator().createPDF( fo ); + new PDFFilePrinter( pdf, true ); + } + } + + public static void printPDF( byte[] pdf, String tempFileName, String printerName ) throws Exception + { + ExamePDF ePDF = new ExamePDF(); + ePDF.printSilent( pdf, tempFileName, printerName ); + } + + public static void printFoToFile( byte[] fo, String fileName, boolean deleteIfExists ) throws Exception + { + if( fo != null ) + { + byte pdf[] = FichaAptidaoCreator.getCreator().createPDF( fo ); + printToFile( pdf, fileName, deleteIfExists ); + } + } + + public static void printPDFToFile( byte[] pdf, String fileName, boolean deleteIfExists ) throws Exception + { + if( pdf != null ) + { + printToFile( pdf, fileName, deleteIfExists ); + } + } + + private static void printToFile( byte[] array, String fileName, boolean deleteIfExists ) throws IOException + { + File outFile = new File( fileName ); + if(outFile.exists() && deleteIfExists) + { + outFile.delete(); + } + if( !outFile.exists() ) + { + outFile.createNewFile(); + FileOutputStream fos = new FileOutputStream( outFile ); + fos.write( array ); + fos.close(); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/teste.xml b/branches/SIPRP/SIPRPSoft/src/siprp/teste.xml new file mode 100644 index 00000000..de26bcab --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/teste.xml @@ -0,0 +1,384 @@ + + + + 1 + + + + 2008 + + + 01 + + + 01 + + + + + Companhia Portuguesa de Hipermercados, S.A., com sede na Travessa Teixeira + Júnior, 1 - 1300-553 Lisboa + + + Comércio a Retalho em Supermercados e Hipermercados + + + Jumbo Alfragide + + + + + Mapfre Seguros Gerais, S.A. + + + 1500591100500 + + + + + SIPRP - Sociedade Ibérica de Prevenção de Riscos Profissionais Lda., + com sede no Edifício Atrium Saldanha, Praça Duque de Saldanha, 1 - 9º G + - 1050-094 Lisboa + + + + Tecnico HST teste + + + C1A2P3 + + + + + Medico Trabalho teste + + + C123 + + + + + + Trablhador acidentado + + + + Jumbo de Alfragide + + + + + 1980 + + + 11 + + + 08 + + + + + 1112225585 + + + + Rua de Cima, 3º dto + + + 215465981 + + + + 2004 + + + 10 + + + 01 + + + + Varredor + + + Tarde + + + + António Pedro + + + apedro@hotmail.com + + + + + + + João António + + + + + 2007 + + + 12 + + + 23 + + + + + 12 + + + 35 + + + + 4 + + + + Congelados + + + Corredor Esquerdo + + + + + A varrer + + + Vassoura + + + Chão molhado + + + + Pedro Silva, Marco Pedro + + + Sono + + + Escorregou e caiu + + + + + + + + + Conclusao sem indicios nenhuns q a suportem + + + gritar. correr as voltas em panico + + + + y + + + + + + + 3 + + + + 3487 + + + 23424 + + + + + + 0 + + + + + + + + + + + + + Cabeça + + + + + Tronco + + + + + Membro Superior Direito + + + Mão + + + + + Grave + + + + + Permanente + + + 10 + + + + 2005 + + + 01 + + + 01 + + + + + 2007 + + + 01 + + + 01 + + + + + + + + + + + + + + + + + + + + + + + + + beber mta agua + + + fazer aerobica + + + + + despedir o trabalhador + + + lamber sabao + + + + + + Joao + + + + 2007 + + + 01 + + + 01 + + + + + + Pedro + + + + 2007 + + + 01 + + + 02 + + + + + + Simao + + + + 2007 + + + 01 + + + 03 + + + + + + Rafael + + + + 2007 + + + 01 + + + 04 + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/Update.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/Update.java new file mode 100644 index 00000000..a3298852 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/Update.java @@ -0,0 +1,22 @@ +/* + * Update.java + * + * Created on 26 de Setembro de 2006, 12:13 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update; + +/** + * + * @author fpalma + */ +public interface Update +{ + public double getStartVersion(); + public double getEndVersion(); + public String[] listChanges(); + public void doUpdate() throws Exception; +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/UpdateList.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/UpdateList.java new file mode 100644 index 00000000..fa7e2ca3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/UpdateList.java @@ -0,0 +1,189 @@ +/* + * Updater.java + * + * Created on 26 de Setembro de 2006, 11:49 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update; + +import siprp.update.updates.V10_0_To_V10_1; +import siprp.update.updates.V10_1_To_V10_2; +import siprp.update.updates.V10_2_To_V10_3; +import siprp.update.updates.V10_3_To_V10_4; +import siprp.update.updates.V10_4_To_V10_5; +import siprp.update.updates.V10_5_To_V10_6; +import siprp.update.updates.V10_6_To_V10_7; +import siprp.update.updates.V10_7_To_V10_8; +import siprp.update.updates.V10_8_To_V10_9; +import siprp.update.updates.V10_9_To_V11_0; +import siprp.update.updates.V11_0_To_V11_1; +import siprp.update.updates.V11_1_To_V11_2; +import siprp.update.updates.V11_2_To_V11_3; +import siprp.update.updates.V11_3_To_V11_4; +import siprp.update.updates.V11_4_To_V11_5; +import siprp.update.updates.V11_5_To_V11_6; +import siprp.update.updates.V11_6_To_V11_7; +import siprp.update.updates.V11_7_To_V11_8; +import siprp.update.updates.V11_8_To_V11_9; +import siprp.update.updates.V11_9_To_V12_0; +import siprp.update.updates.V12_0_To_V12_1; +import siprp.update.updates.V12_1_To_V12_2; +import siprp.update.updates.V12_2_To_V12_3; +import siprp.update.updates.V12_3_To_V12_4; +import siprp.update.updates.V12_4_To_V12_5; +import siprp.update.updates.V12_5_To_V12_6; +import siprp.update.updates.V12_6_To_V12_7; +import siprp.update.updates.V12_7_To_V12_8; +import siprp.update.updates.V12_8_To_V12_9; +import siprp.update.updates.V12_9_To_V13_0; +import siprp.update.updates.V6_1_To_V7_0; +import siprp.update.updates.V7_0_To_V7_2; +import siprp.update.updates.V7_2_To_V7_4; +import siprp.update.updates.V7_4_To_V7_5; +import siprp.update.updates.V7_5_To_V7_6; +import siprp.update.updates.V7_6_To_V7_7; +import siprp.update.updates.V7_7_To_V7_8; +import siprp.update.updates.V7_8_To_V7_9; +import siprp.update.updates.V7_9_To_V8_0; +import siprp.update.updates.V8_0_To_V8_1; +import siprp.update.updates.V8_1_To_V8_2; +import siprp.update.updates.V8_2_To_V8_3; +import siprp.update.updates.V8_3_To_V8_4; +import siprp.update.updates.V8_4_To_V8_5; +import siprp.update.updates.V8_5_To_V8_6; +import siprp.update.updates.V8_6_To_V8_7; +import siprp.update.updates.V8_7_To_V8_8; +import siprp.update.updates.V8_8_To_V8_9; +import siprp.update.updates.V8_9_To_V9_0; +import siprp.update.updates.V9_0_To_V9_1; +import siprp.update.updates.V9_1_To_V9_2; +import siprp.update.updates.V9_2_To_V9_3; +import siprp.update.updates.V9_3_To_V9_4; +import siprp.update.updates.V9_4_To_V9_5; +import siprp.update.updates.V9_5_To_V9_6; +import siprp.update.updates.V9_6_To_V9_7; +import siprp.update.updates.V9_7_To_V9_8; +import siprp.update.updates.V9_8_To_V9_9; +import siprp.update.updates.V9_9_To_V10_0; + +import com.evolute.module.updater.AbstractUpdate; + + +/** + * + * @author fpalma + */ +public class UpdateList +{ + public static final AbstractUpdate UPDATE_LIST[] = + new AbstractUpdate[]{ + new V6_1_To_V7_0(), new V7_0_To_V7_2(), + new V7_2_To_V7_4(), new V7_4_To_V7_5(), + new V7_5_To_V7_6(), new V7_6_To_V7_7(), + new V7_7_To_V7_8(), new V7_8_To_V7_9(), + new V7_9_To_V8_0(), new V8_0_To_V8_1(), + new V8_1_To_V8_2(), new V8_2_To_V8_3(), + new V8_3_To_V8_4(), new V8_4_To_V8_5(), + new V8_5_To_V8_6(), new V8_6_To_V8_7(), + new V8_7_To_V8_8(), new V8_8_To_V8_9(), + new V8_9_To_V9_0(), new V9_0_To_V9_1(), + new V9_1_To_V9_2(), new V9_2_To_V9_3(), + new V9_3_To_V9_4(), new V9_4_To_V9_5(), + new V9_5_To_V9_6(), new V9_6_To_V9_7(), + new V9_7_To_V9_8(), new V9_8_To_V9_9(), + new V9_9_To_V10_0(), new V10_0_To_V10_1(), + new V10_1_To_V10_2(), new V10_2_To_V10_3(), + new V10_3_To_V10_4(), new V10_4_To_V10_5(), + new V10_5_To_V10_6(), new V10_6_To_V10_7(), + new V10_7_To_V10_8(), new V10_8_To_V10_9(), + new V10_9_To_V11_0(), new V11_0_To_V11_1(), + new V11_1_To_V11_2(), new V11_2_To_V11_3(), + new V11_3_To_V11_4(), new V11_4_To_V11_5(), + new V11_5_To_V11_6(), new V11_6_To_V11_7(), + new V11_7_To_V11_8(), new V11_8_To_V11_9(), + new V11_9_To_V12_0(), new V12_0_To_V12_1(), + new V12_1_To_V12_2(), new V12_2_To_V12_3(), + new V12_3_To_V12_4(), new V12_4_To_V12_5(), + new V12_5_To_V12_6(), new V12_6_To_V12_7(), + new V12_7_To_V12_8(), new V12_8_To_V12_9(), + new V12_9_To_V13_0() + }; +// +// protected static Executer EXECUTER; +// protected static double version = -1; +// +// private UpdateList() +// { +// } +// +// public static double getCurrentVersion() +// throws Exception +// { +// if( version < 0 ) +// { +// version = getVersion(); +// } +// return version; +// } +// +// public static Update [] getUpdates() +// throws Exception +// { +// if( version < 0 ) +// { +// version = getVersion(); +// } +// Vector validUpdates = new Vector(); +// for( int n = 0; n < UPDATE_LIST.length; n++ ) +// { +// if( version <= UPDATE_LIST[ n ].getStartVersion() ) +// { +// validUpdates.add( UPDATE_LIST[ n ] ); +// } +// } +// return validUpdates.toArray( new Update[ validUpdates.size() ] ); +// } +// +// protected static double getVersion() +// throws Exception +// { +// DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); +// EXECUTER = dbm.getSharedExecuter(); +// try +// { +// return readVersion(); +// } +// catch( Exception ex ) +// { +// createVersionTable(); +// } +// return readVersion(); +// } +// +// protected static double readVersion() +// throws Exception +// { +// Select select = +// new Select( new String[]{ "version" }, +// new String[]{ "MAX(current_version)" }, +// null ); +// Virtual2DArray array = EXECUTER.executeQuery( select ); +// return ( ( Number ) array.get( 0, 0 ) ).doubleValue(); +// } +// +// protected static void createVersionTable() +// throws Exception +// { +// com.evolute.utils.sql.Update update = +// new com.evolute.utils.sql.Update( "CREATE TABLE version( current_version float );" ); +// EXECUTER.executeQuery( update ); +// Insert insert = +// new Insert( "version", +// new Assignment[]{ +// new Assignment( new Field( "current_version" ), new Double( 0.1 ) ) } ); +// EXECUTER.executeQuery( insert ); +// } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_0_To_V10_1.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_0_To_V10_1.java new file mode 100644 index 00000000..5c1a794c --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_0_To_V10_1.java @@ -0,0 +1,36 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +public class V10_0_To_V10_1 extends AbstractUpdate +{ + + public V10_0_To_V10_1() + { + super(10.0,10.1,"Adicionadas normalizacoes para estabelecimentos e empresas"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "CREATE TABLE hs_normalizacao_empresa " + + "( " + + " normalizacao_id int4 REFERENCES hs_normalizacao(id), " + + " empresa_id int4 REFERENCES empresas(id), " + + " CONSTRAINT hs_normalizacao_empresa_pkey PRIMARY KEY(normalizacao_id,empresa_id) " + + "); " + + "CREATE TABLE hs_normalizacao_estabelecimento " + + "( " + + " normalizacao_id int4 REFERENCES hs_normalizacao(id), " + + " estabelecimento_id int4 REFERENCES estabelecimentos(id), " + + " CONSTRAINT hs_normalizacao_estabelecimento_pkey PRIMARY KEY(normalizacao_id,estabelecimento_id) " + + ");" + ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_1_To_V10_2.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_1_To_V10_2.java new file mode 100644 index 00000000..659e2776 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_1_To_V10_2.java @@ -0,0 +1,43 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +public class V10_1_To_V10_2 extends AbstractUpdate +{ + + public V10_1_To_V10_2() + { + super(10.1,10.2,"Adicionadas normalizacoes para estabelecimentos e empresas"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "CREATE TABLE hs_equipamento( " + + "id SERIAL PRIMARY KEY, " + + "tipo VARCHAR(512) NOT NULL, " + + "marca VARCHAR(255), " + + "modelo VARCHAR(255), " + + "deleted_date TIMESTAMP " + + "); " + + "CREATE TABLE hs_relatorio_equipamento( " + + "hs_relatorio_id INT4 REFERENCES hs_relatorio(id), " + + "hs_equipamento INT4 REFERENCES hs_equipamento(id), " + + "CONSTRAINT hs_relatorio_equipamento_pkey PRIMARY KEY (hs_relatorio_id,hs_equipamento) " + + "); " + + "INSERT INTO hs_equipamento(id, tipo) " + + "SELECT id, nome FROM hs_equipamento_medico ; " + + "INSERT INTO hs_relatorio_equipamento(hs_relatorio_id, hs_equipamento) " + + "SELECT hs_relatorio_id, hs_equipamento_medico_id FROM hs_relatorio_equipamento_medico; " + + "DROP TABLE hs_relatorio_equipamento_medico; " + + "DROP TABLE hs_equipamento_medico; " + + "SELECT setval('hs_equipamento_id_seq',1000);" + ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_2_To_V10_3.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_2_To_V10_3.java new file mode 100644 index 00000000..04c13969 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_2_To_V10_3.java @@ -0,0 +1,46 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +public class V10_2_To_V10_3 extends AbstractUpdate +{ + + public V10_2_To_V10_3() + { + super(10.2,10.3,"adicionadas normalizacoes duplicadas para planos de actuacao", + "adicionados campos aos tecnicos de higiene e seguranca"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "alter table hs_relatorio_equipamento drop constraint hs_relatorio_equipamento_hs_equipamento_fkey; " + + "alter table hs_relatorio_equipamento drop constraint hs_relatorio_equipamento_pkey; " + + "alter table hs_relatorio_equipamento add column id serial PRIMARY KEY; " + + "alter table hs_relatorio_equipamento add column tipo varchar(512); " + + "alter table hs_relatorio_equipamento add column marca varchar(256); " + + "alter table hs_relatorio_equipamento add column modelo varchar(256); " + + "select setval('hs_relatorio_equipamento_id_seq',1000);" + + "alter table hs_relatorio_legislacao drop constraint hs_relatorio_legislacao_hs_legislacao_id_fkey; " + + "alter table hs_relatorio_legislacao drop constraint hs_relatorio_legislacao_pkey; " + + "alter table hs_relatorio_legislacao add column id serial PRIMARY KEY; " + + "alter table hs_relatorio_legislacao add column categoria varchar(255); " + + "alter table hs_relatorio_legislacao add column descricao varchar(1024); " + + "alter table hs_relatorio_normalizacao drop constraint hs_relatorio_normalizacao_hs_normalizacao_id_fkey; " + + "alter table hs_relatorio_normalizacao drop constraint hs_relatorio_normalizacao_pkey; " + + "alter table hs_relatorio_normalizacao add column id serial PRIMARY KEY; " + + "alter table hs_relatorio_normalizacao add column codigo varchar(128) NOT NULL; " + + "alter table hs_relatorio_normalizacao add column descricao varchar(1024); " + + "alter table hs_relatorio_normalizacao add column portuguesa boolean NOT NULL; " + + "alter table marcacoes_tecnicos_hst add column cap varchar(128); " + + "alter table marcacoes_tecnicos_hst add column formacao varchar(128); " + + "alter table marcacoes_tecnicos_hst add column assinatura int4 REFERENCES image(id); " + ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_3_To_V10_4.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_3_To_V10_4.java new file mode 100644 index 00000000..2ea3c95f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_3_To_V10_4.java @@ -0,0 +1,25 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +public class V10_3_To_V10_4 extends AbstractUpdate +{ + + public V10_3_To_V10_4() + { + super(10.3,10.4,"Adicionado campo a empresa (Imprimir tabela alargada)"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "alter table empresas add column imprimir_tabela_alargada boolean;" + ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_4_To_V10_5.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_4_To_V10_5.java new file mode 100644 index 00000000..f2abdbdc --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_4_To_V10_5.java @@ -0,0 +1,56 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +public class V10_4_To_V10_5 extends AbstractUpdate +{ + + public V10_4_To_V10_5() + { + super(10.4,10.5,"Remocao dos dados de teste dos relatorio de higiene e seguranca"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "delete from hs_relatorio_posto_risco; " + + "delete from hs_relatorio_posto_medida; " + + "delete from hs_relatorio_posto; " + + "delete from hs_relatorio_medida; " + + "delete from hs_relatorio_area; " + + "delete from hs_relatorio_risco; " + + "delete from hs_relatorio_risco_valor_qualitativo; " + + "delete from hs_relatorio_normalizacao; " + + "delete from hs_relatorio_legislacao; " + + "delete from hs_relatorio_equipamento; " + + "delete from hs_relatorio; " + + "delete from hs_email_estabelecimento; " + + "delete from hs_email_empresa; " + + "delete from hs_email; " + + "delete from hs_equipamento; " + + "delete from hs_posto_risco; " + + "delete from hs_posto_medida; " + + "delete from hs_posto_estabelecimento; " + + "delete from hs_posto; " + + "delete from hs_area; " + + "delete from hs_legislacao_estabelecimento; " + + "delete from hs_legislacao_empresa; " + + "delete from hs_legislacao; " + + "delete from hs_legislacao_categoria; " + + "delete from hs_risco_empresa; " + + "delete from hs_risco_medida; " + + "delete from hs_medida; " + + "delete from hs_risco; " + + "delete from hs_risco_tema; " + + "delete from hs_normalizacao_estabelecimento; " + + "delete from hs_normalizacao_empresa; " + + "delete from hs_normalizacao; " + ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_5_To_V10_6.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_5_To_V10_6.java new file mode 100644 index 00000000..c11e6524 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_5_To_V10_6.java @@ -0,0 +1,28 @@ +package siprp.update.updates; + +import siprp.higiene.gestao.importacao.Importador; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +public class V10_5_To_V10_6 extends AbstractUpdate +{ + + public V10_5_To_V10_6() + { + super(10.5,10.6,"Importa\u00e7\u00e3o de riscos e medidas"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( "alter table hs_medida alter column description type character varying(8192);"); + executer.executeQuery( update ); + update = new com.evolute.utils.sql.Update( "alter table hs_medida alter column requesitos_legais type character varying(8192);"); + executer.executeQuery( update ); + new Importador( executer ).importar(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_6_To_V10_7.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_6_To_V10_7.java new file mode 100644 index 00000000..ba4a776b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_6_To_V10_7.java @@ -0,0 +1,34 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +public class V10_6_To_V10_7 extends AbstractUpdate +{ + + public V10_6_To_V10_7() + { + super(10.6,10.7,"Alteracao de tamanho maximo em campos de descricao"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "alter table hs_risco alter column description type varchar(8192); " + + "alter table hs_relatorio_risco alter column description type varchar(8192); " + + "alter table hs_normalizacao alter column descricao type varchar(8192); " + + "alter table hs_relatorio_normalizacao alter column descricao type varchar(8192); " + + "alter table hs_legislacao alter column description type varchar(8192); " + + "alter table hs_relatorio_legislacao alter column descricao type varchar(8192); " + + "alter table hs_area alter column description type varchar(1024); " + + "alter table hs_relatorio_area alter column description type varchar(1024); " + + "alter table hs_posto alter column description type varchar(1024); " + + "alter table hs_relatorio_posto alter column description type varchar(1024); " + ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_7_To_V10_8.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_7_To_V10_8.java new file mode 100644 index 00000000..dadebe7b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_7_To_V10_8.java @@ -0,0 +1,30 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +public class V10_7_To_V10_8 extends AbstractUpdate +{ + + public V10_7_To_V10_8() + { + super(10.7,10.8,"relatorio de higiene e seguranca: insercao de valores qualitativos"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "insert into hs_relatorio_risco_valor_qualitativo(description) " + + "values('Controlado'); " + + "insert into hs_relatorio_risco_valor_qualitativo(description) " + + "values('Incontrolado'); " + + "insert into hs_relatorio_risco_valor_qualitativo(description)" + + "values('Indeterminado'); " + ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_8_To_V10_9.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_8_To_V10_9.java new file mode 100644 index 00000000..c501a850 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_8_To_V10_9.java @@ -0,0 +1,26 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +public class V10_8_To_V10_9 extends AbstractUpdate +{ + + public V10_8_To_V10_9() + { + super(10.8,10.9,"relatorio de higiene e seguranca: aumentada a capacidade de texto das requesitos(relatorio)"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "alter table hs_relatorio_medida alter column description type varchar(8192); " + + "alter table hs_relatorio_medida alter column requesitos_legais type varchar(8192);" + ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_9_To_V11_0.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_9_To_V11_0.java new file mode 100644 index 00000000..25278416 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V10_9_To_V11_0.java @@ -0,0 +1,25 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +public class V10_9_To_V11_0 extends AbstractUpdate +{ + + public V10_9_To_V11_0() + { + super(10.9,11.0,"relatorio de higiene e seguranca: adicionado campo 'funcionarios'"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "alter table hs_relatorio add column funcionarios varchar(8192); " + ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_0_To_V11_1.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_0_To_V11_1.java new file mode 100644 index 00000000..51327a58 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_0_To_V11_1.java @@ -0,0 +1,98 @@ +package siprp.update.updates; + +import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; +import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; +import static com.evolute.utils.strings.UnicodeLatin1Map.oacute; +import static com.evolute.utils.strings.UnicodeLatin1Map.uacute; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; + +import javax.imageio.ImageIO; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.BlobUpdate; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.Select2; +import com.evolute.utils.sql.Update; + +public class V11_0_To_V11_1 extends AbstractUpdate +{ + + public V11_0_To_V11_1() + { + super(11.0,11.1,"A actualizar informacao dos tecnicos de higiene e seguranca"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + + Update update = new Update( + "alter table image alter column image_data drop not null; " + ); + executer.executeQuery( update ); + + Integer assSoniaID = null; + Integer assCatarinaID = null; + String assSonia = "Assinatura(Sonia Filipa Dias Campos)"; + String assCatarina = "Assinatura(Catarina Leonardo)"; + BufferedImage assSoniaImage = ImageIO.read( getClass().getClassLoader().getResourceAsStream( "siprp/update/updates/V11_0_To_V11_1_Assinatura_Sonia.png" ) ); + BufferedImage assCatarinaImage = ImageIO.read( getClass().getClassLoader().getResourceAsStream( "siprp/update/updates/V11_0_To_V11_1_Assinatura_Catarina.png" ) ); + ByteArrayOutputStream assSoniaBytesStream = new ByteArrayOutputStream(); + ByteArrayOutputStream assCatarinaBytesStream = new ByteArrayOutputStream(); + ImageIO.write( assSoniaImage, "PNG", assSoniaBytesStream ); + ImageIO.write( assCatarinaImage, "PNG", assCatarinaBytesStream ); + if( assSoniaImage == null || assSoniaBytesStream.size() == 0 ) + { + throw new Exception("Erro ao ler assinatura: " + assSonia ); + } + if( assCatarinaImage == null || assCatarinaBytesStream.size() == 0 ) + { + throw new Exception("Erro ao ler assinatura: " + assCatarina ); + } + Insert insertQuery = new Insert( "image", new Assignment[]{ + new Assignment(new Field("name"),assSonia) + } ); + Virtual2DArray array = executer.executeQuery( insertQuery ); + insertQuery = new Insert( "image", new Assignment[]{ + new Assignment(new Field("name"), assCatarina) + } ); + executer.executeQuery( insertQuery ); + Select2 selectQuery = new Select2(new String[]{"image"},null,null,new String[]{"id"},new Field("name").isEqual( assSonia ),null,null,null,null); + array = executer.executeQuery( selectQuery ); + if( array.columnLength() == 1 ) + { + assSoniaID = (Integer) array.get( 0, 0 ); + } + selectQuery = new Select2(new String[]{"image"},null,null,new String[]{"id"},new Field("name").isEqual( assCatarina ),null,null,null,null); + array = executer.executeQuery( selectQuery ); + if( array.columnLength() == 1 ) + { + assCatarinaID = (Integer) array.get( 0, 0 ); + } + if( assSoniaID == null ) + { + throw new Exception("Erro ao inserir assinatura: " + assSonia ); + } + if( assCatarinaID == null ) + { + throw new Exception("Erro ao inserir assinatura: " + assCatarina ); + } + BlobUpdate blobUpdate = new BlobUpdate("image","image_data",assSoniaBytesStream.toByteArray(),new Field("id").isEqual( assSoniaID ) ); + executer.executeQuery( blobUpdate ); + blobUpdate = new BlobUpdate("image","image_data",assCatarinaBytesStream.toByteArray(),new Field("id").isEqual( assCatarinaID ) ); + executer.executeQuery( blobUpdate ); + update = new Update( + "update marcacoes_tecnicos_hst set cap='0601/6505/02', formacao='Ergonomia', assinatura=" + assSoniaID + " where id = 2; " + + "update marcacoes_tecnicos_hst set cap='0310/1156/02', formacao='Sa"+uacute+"de Ambiental, P"+oacute+"s Gradua"+ccedil+atilde+"o em Higiene e Seguran"+ccedil+"a do Trabalho e Mestrado em Ergonomia na Seguran"+ccedil+"a do Trabalho', assinatura=" + assCatarinaID + " where id = 1; " + ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_0_To_V11_1_Assinatura_Catarina.png b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_0_To_V11_1_Assinatura_Catarina.png new file mode 100644 index 00000000..506cb2b9 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_0_To_V11_1_Assinatura_Catarina.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_0_To_V11_1_Assinatura_Sonia.png b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_0_To_V11_1_Assinatura_Sonia.png new file mode 100644 index 00000000..0db7ac33 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_0_To_V11_1_Assinatura_Sonia.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_1_To_V11_2.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_1_To_V11_2.java new file mode 100644 index 00000000..09f4b0a0 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_1_To_V11_2.java @@ -0,0 +1,25 @@ +package siprp.update.updates; + +import siprp.higiene.gestao.importacao.Importador; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +public class V11_1_To_V11_2 extends AbstractUpdate +{ + + public V11_1_To_V11_2() + { + super(11.1,11.2,"Higiene e seguranca: a repor datas de submissao dos relatorios"); + } + + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( "update hs_relatorio set is_submetido = null;" ); + executer.executeQuery( update ); + new Importador( executer ).importar(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_2_To_V11_3.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_2_To_V11_3.java new file mode 100644 index 00000000..8db9fe44 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_2_To_V11_3.java @@ -0,0 +1,33 @@ +package siprp.update.updates; + +import siprp.higiene.gestao.importacao.Importador; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +public class V11_2_To_V11_3 extends AbstractUpdate +{ + + public V11_2_To_V11_3() + { + super(11.2,11.3,"Higiene e seguranca: restruturacao"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "alter table hs_posto add column is_principal boolean; " + + "alter table hs_relatorio_posto add column is_principal boolean; " + + "alter table hs_relatorio_area add column ordem int4; " + + "alter table hs_area add column ordem int4; " + + "alter table hs_relatorio_posto_risco add column ordem int4; " + + "alter table hs_posto_risco add column ordem int4; " + ); + executer.executeQuery( update ); + new Importador( executer ).importar(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_3_To_V11_4.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_3_To_V11_4.java new file mode 100644 index 00000000..cd820fd9 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_3_To_V11_4.java @@ -0,0 +1,29 @@ +package siprp.update.updates; + +import siprp.higiene.gestao.importacao.Importador; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +public class V11_3_To_V11_4 extends AbstractUpdate +{ + + public V11_3_To_V11_4() + { + super(11.3,11.4,"Higiene e seguranca: restruturacao"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "alter table hs_legislacao_estabelecimento add column ordem int4; " + + "alter table hs_relatorio_legislacao add column ordem int4; " + ); + executer.executeQuery( update ); + new Importador( executer ).importar(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_4_To_V11_5.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_4_To_V11_5.java new file mode 100644 index 00000000..8d14aae1 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_4_To_V11_5.java @@ -0,0 +1,27 @@ +package siprp.update.updates; + +import siprp.higiene.gestao.importacao.Importador; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +public class V11_4_To_V11_5 extends AbstractUpdate +{ + + public V11_4_To_V11_5() + { + super(11.4,11.5,"Correc\u00e7\u00e3o de submiss\u00f5es"); + } + + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "update hs_relatorio set is_submetido = '2009-09-17 15:21:35.208' where marcacao_id in (2006, 1911,2174);" + ); + executer.executeQuery( update ); + new Importador( executer ).importar(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_5_To_V11_6.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_5_To_V11_6.java new file mode 100644 index 00000000..b9ddbd94 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_5_To_V11_6.java @@ -0,0 +1,32 @@ +package siprp.update.updates; + +import siprp.higiene.gestao.importacao.Importador; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +public class V11_5_To_V11_6 extends AbstractUpdate +{ + + public V11_5_To_V11_6() + { + super(11.5,11.6,"Adicionadas soft-references aos itens dos relatorios de H&S"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "alter table hs_relatorio_risco add column hs_risco_id int4; " + + "alter table hs_relatorio_posto add column hs_posto_id int4; " + + "alter table hs_relatorio_medida add column hs_medida_id int4; " + + "alter table hs_relatorio_equipamento add column hs_equipamento_id int4; " + + "alter table hs_relatorio_area add column hs_area_id int4; " + ); + executer.executeQuery( update ); + new Importador( executer ).importar(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_6_To_V11_7.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_6_To_V11_7.java new file mode 100644 index 00000000..65a533f2 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_6_To_V11_7.java @@ -0,0 +1,32 @@ +package siprp.update.updates; + +import siprp.higiene.gestao.importacao.Importador; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +public class V11_6_To_V11_7 extends AbstractUpdate +{ + + public V11_6_To_V11_7() + { + super(11.6,11.7,"Adicionado suporte para tecnicos superiores de higiene e seguranca"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "alter table marcacoes_tecnicos_hst add column is_superior char(1); " + + "update marcacoes_tecnicos_hst set is_superior = 'n'; " + + "alter table marcacoes_tecnicos_hst alter column is_superior set not null; " + + "alter table marcacoes_tecnicos_hst add constraint check_is_superior check( is_superior = 'y' or is_superior = 'n' ); " + + "alter table marcacoes_tecnicos_hst alter column is_superior set default 'y'; " + ); + executer.executeQuery( update ); + new Importador( executer ).importar(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_7_To_V11_8.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_7_To_V11_8.java new file mode 100644 index 00000000..6105b958 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_7_To_V11_8.java @@ -0,0 +1,29 @@ +package siprp.update.updates; + +import siprp.higiene.gestao.importacao.Importador; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +public class V11_7_To_V11_8 extends AbstractUpdate +{ + + public V11_7_To_V11_8() + { + super(11.7,11.8,"Adicionado suporte adicional para tecnicos superiores de higiene e seguranca"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "alter table marcacoes_estabelecimento add column tecnico_superior_hst int4 " + + "references marcacoes_tecnicos_hst(id); " + ); + executer.executeQuery( update ); + new Importador( executer ).importar(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_8_To_V11_9.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_8_To_V11_9.java new file mode 100644 index 00000000..056708b2 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_8_To_V11_9.java @@ -0,0 +1,61 @@ +package siprp.update.updates; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; + +import javax.imageio.ImageIO; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.BlobUpdate; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.Select2; + +public class V11_8_To_V11_9 extends AbstractUpdate +{ + + public V11_8_To_V11_9() + { + super(11.8,11.9,"A actualizar informacao dos tecnicos de higiene e seguranca"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + + Integer assDavidID = null; + String assDavid = "Assinatura(David Afonso)"; + BufferedImage assDavidImage = ImageIO.read( getClass().getClassLoader().getResourceAsStream( "siprp/update/updates/V11_8_To_V11_9_David_Afonso.png" ) ); + ByteArrayOutputStream assDavidBytesStream = new ByteArrayOutputStream(); + ImageIO.write( assDavidImage, "PNG", assDavidBytesStream ); + if( assDavidImage == null || assDavidBytesStream.size() == 0 ) + { + throw new Exception("Erro ao ler assinatura: " + assDavid ); + } + Insert insertQuery = new Insert( "image", new Assignment[]{ + new Assignment(new Field("name"),assDavid) + } ); + Virtual2DArray array = executer.executeQuery( insertQuery ); + Select2 selectQuery = new Select2(new String[]{"image"},null,null,new String[]{"id"},new Field("name").isEqual( assDavid ),null,null,null,null); + array = executer.executeQuery( selectQuery ); + if( array.columnLength() == 1 ) + { + assDavidID = (Integer) array.get( 0, 0 ); + } + if( assDavidID == null ) + { + throw new Exception("Erro ao inserir assinatura: " + assDavid ); + } + BlobUpdate blobUpdate = new BlobUpdate("image","image_data",assDavidBytesStream.toByteArray(),new Field("id").isEqual( assDavidID ) ); + executer.executeQuery( blobUpdate ); + com.evolute.utils.sql.Update update = new com.evolute.utils.sql.Update( + "update marcacoes_tecnicos_hst set cap='em emiss\u00e3o', formacao='', assinatura=" + assDavidID + " where id = 3; " + ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_8_To_V11_9_David_Afonso.png b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_8_To_V11_9_David_Afonso.png new file mode 100644 index 00000000..7e2eb05b Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_8_To_V11_9_David_Afonso.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_9_To_V11_10_Ana_Sofia_Jorge.png b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_9_To_V11_10_Ana_Sofia_Jorge.png new file mode 100644 index 00000000..7dfee8e2 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_9_To_V11_10_Ana_Sofia_Jorge.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_9_To_V11_10_Barbara_Goncalves.png b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_9_To_V11_10_Barbara_Goncalves.png new file mode 100644 index 00000000..1e5fa9e7 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_9_To_V11_10_Barbara_Goncalves.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_9_To_V12_0.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_9_To_V12_0.java new file mode 100644 index 00000000..ec349a95 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V11_9_To_V12_0.java @@ -0,0 +1,93 @@ +package siprp.update.updates; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; +import java.util.Vector; + +import javax.imageio.ImageIO; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.BlobUpdate; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.Select2; +import com.evolute.utils.sql.Update; + +public class V11_9_To_V12_0 extends AbstractUpdate +{ + + public V11_9_To_V12_0() + { + super(11.9,12.0,"A actualizar informacao dos tecnicos de higiene e seguranca"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + + String nomes[] = new String[]{ + "David Afonso", + "B\u00e1rbara Gon\u00e7alves", + "Ana Sofia Jorge" + }; + Integer ids[] = new Integer[]{ + 3, + 4, + 5 + }; + String caps[] = new String[]{ + "28291002EC3", + "em emiss\u00e3o - A 100 60 1820 D", + "17050910EC5" }; + String assinaturas[] = new String[]{ + null, + "siprp/update/updates/V11_9_To_V11_10_Barbara_Goncalves.png", + "siprp/update/updates/V11_9_To_V11_10_Ana_Sofia_Jorge.png" }; + + for( int n = 0; n < ids.length; n++ ) + { + Vector assignments = new Vector(); + assignments.add( new Assignment( "cap", caps[ n ] ) ); + if( assinaturas[ n ] != null ) + { + Integer assinaturaID = null; + String assinatura = "Assinatura(" + nomes[ n ] + ")"; + BufferedImage assinaturaImage = ImageIO.read( getClass().getClassLoader().getResourceAsStream( + assinaturas[ n ] ) ); + ByteArrayOutputStream assinaturaBytesStream = new ByteArrayOutputStream(); + ImageIO.write( assinaturaImage, "PNG", assinaturaBytesStream ); + if( assinaturaImage == null || assinaturaBytesStream.size() == 0 ) + { + throw new Exception("Erro ao ler assinatura: " + assinatura ); + } + Insert insertQuery = new Insert( "image", new Assignment[]{ + new Assignment(new Field("name"),assinatura) + } ); + Virtual2DArray array = executer.executeQuery( insertQuery ); + Select2 selectQuery = new Select2(new String[]{"image"},null,null,new String[]{"id"},new Field("name").isEqual( assinatura ),null,null,null,null); + array = executer.executeQuery( selectQuery ); + if( array.columnLength() == 1 ) + { + assinaturaID = (Integer) array.get( 0, 0 ); + } + if( assinaturaID == null ) + { + throw new Exception("Erro ao inserir assinatura: " + assinatura ); + } + BlobUpdate blobUpdate = new BlobUpdate("image","image_data",assinaturaBytesStream.toByteArray(),new Field("id").isEqual( assinaturaID ) ); + executer.executeQuery( blobUpdate ); + assignments.add( new Assignment( "assinatura", assinaturaID ) ); + } + Update update = + new Update( "marcacoes_tecnicos_hst", + assignments.toArray( new Assignment[ assignments.size() ] ), + new Field( "id" ).isEqual( ids[ n ] ) ); + executer.executeQuery( update ); + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_0_To_V12_1.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_0_To_V12_1.java new file mode 100644 index 00000000..ad7c60c8 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_0_To_V12_1.java @@ -0,0 +1,54 @@ +package siprp.update.updates; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; +import java.util.Vector; + +import javax.imageio.ImageIO; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.BlobUpdate; +import com.evolute.utils.sql.Field; + +public class V12_0_To_V12_1 extends AbstractUpdate +{ + + public V12_0_To_V12_1() + { + super(12.0,12.1,"A actualizar assinatura de B\u00e1rbara Gon\u00e7alves"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + + Integer ids[] = new Integer[]{ + 129, + }; + String assinaturas[] = new String[]{ + "siprp/update/updates/V12_0_To_V12_1_Barbara_Goncalves.png" + }; + + for( int n = 0; n < ids.length; n++ ) + { + Vector assignments = new Vector(); + if( assinaturas[ n ] != null ) + { + Integer assinaturaID = null; + BufferedImage assinaturaImage = ImageIO.read( getClass().getClassLoader().getResourceAsStream( + assinaturas[ n ] ) ); + ByteArrayOutputStream assinaturaBytesStream = new ByteArrayOutputStream(); + ImageIO.write( assinaturaImage, "PNG", assinaturaBytesStream ); + + BlobUpdate blobUpdate = new BlobUpdate("image","image_data",assinaturaBytesStream.toByteArray(),new Field("id").isEqual( ids[ n ] ) ); + executer.executeQuery( blobUpdate ); + assignments.add( new Assignment( "assinatura", assinaturaID ) ); + } + + } + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_0_To_V12_1_Barbara_Goncalves.png b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_0_To_V12_1_Barbara_Goncalves.png new file mode 100644 index 00000000..e3b30a83 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_0_To_V12_1_Barbara_Goncalves.png differ diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_1_To_V12_2.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_1_To_V12_2.java new file mode 100644 index 00000000..bb7a6174 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_1_To_V12_2.java @@ -0,0 +1,25 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.sql.Update; + +public class V12_1_To_V12_2 extends AbstractUpdate +{ + + public V12_1_To_V12_2() + { + super(12.1,12.2, + "A corrigir a tabela de marcacoes de trabalhadores", + "A corrigir a tabela de avisos", + "A corrigir a tabela de exames"); + } + + @Override + public void doUpdate() throws Exception + { + executeQuery( new Update( "ALTER TABLE marcacoes_trabalhador ADD CONSTRAINT marcacoes_trabalhador_trabalhador_id_fkey FOREIGN KEY (trabalhador_id) REFERENCES trabalhadores (id); " ) ); + executeQuery( new Update( "ALTER TABLE avisos ADD CONSTRAINT avisos_trabalhador_id_fkey FOREIGN KEY (trabalhador_id) REFERENCES trabalhadores (id); " ) ); + executeQuery( new Update( "ALTER TABLE exames ADD CONSTRAINT exames_trabalhador_id_fkey FOREIGN KEY (trabalhador_id) REFERENCES trabalhadores(id); " ) ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_2_To_V12_3.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_2_To_V12_3.java new file mode 100644 index 00000000..c1e19a57 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_2_To_V12_3.java @@ -0,0 +1,45 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.PSQLSequenceUtils; +import com.evolute.utils.sql.Update; + +public class V12_2_To_V12_3 extends AbstractUpdate +{ + + public V12_2_To_V12_3() + { + super( 12.2, 12.3, "A corrigir chaves primarias" ); + } + + @Override + public void doUpdate() throws Exception + { + fixIdColumn( "avisos", "id" ); + fixIdColumn( "contactos", "id" ); + fixIdColumn( "empresas", "id" ); + fixIdColumn( "estabelecimentos", "id" ); + fixIdColumn( "exames", "id" ); + fixIdColumn( "exames_perfis", "id" ); + fixIdColumn( "historico_estabelecimento", "id" ); + fixIdColumn( "marcacoes_empresa", "id" ); + fixIdColumn( "marcacoes_estabelecimento", "id" ); + fixIdColumn( "marcacoes_tecnicos_hst", "id" ); + fixIdColumn( "marcacoes_trabalhador", "id" ); + fixIdColumn( "medicos", "id" ); + fixIdColumn( "prt_grupos_protocolo", "id" ); + fixIdColumn( "prt_tipos_elementos_protocolo", "id" ); + fixIdColumn( "tipos_exames_comp", "id" ); + fixIdColumn( "trabalhadores", "id" ); + } + + private void fixIdColumn( String columnName, String idField ) throws Exception + { + executeQuery( new Update( + "create sequence " + columnName + "_" + idField + "_seq; " + + "alter table " + columnName + " alter column " + idField + " set default nextval(('" + columnName + "_" + idField + "_seq'::text)::regclass); " + ) ); + PSQLSequenceUtils.fixSequence( columnName, idField ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_3_To_V12_4.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_3_To_V12_4.java new file mode 100644 index 00000000..2eb2dd92 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_3_To_V12_4.java @@ -0,0 +1,36 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.sql.Update; + +public class V12_3_To_V12_4 extends AbstractUpdate +{ + + public V12_3_To_V12_4( ) + { + super( 12.3, 12.4, "Adicionar campos em algumas tabelas." ); + } + + @Override + public void doUpdate() throws Exception + { + + Update update = new Update( + "ALTER TABLE trabalhadores ADD COLUMN nif CHARACTER VARYING( 255 );" + + "ALTER TABLE trabalhadores ADD COLUMN numero_utente CHARACTER VARYING( 255 );" + ); + executeQuery( update ); + + update = new Update( + "ALTER TABLE marcacoes_trabalhador ADD COLUMN medico_id INTEGER;" + + "ALTER TABLE marcacoes_trabalhador ADD COLUMN inserted_stamp TIMESTAMP WITHOUT TIME ZONE DEFAULT now();" + ); + executeQuery( update ); + + update = new Update( + "ALTER TABLE empresas ADD COLUMN codigo_relatorio_unico CHARACTER VARYING( 64 );" + ); + executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_4_To_V12_5.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_4_To_V12_5.java new file mode 100644 index 00000000..711981c7 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_4_To_V12_5.java @@ -0,0 +1,52 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.PSQLSequenceUtils; +import com.evolute.utils.sql.Update; + +public class V12_4_To_V12_5 extends AbstractUpdate +{ + + public V12_4_To_V12_5() + { + super( 12.4, 12.5, "A adicionar novos pagamentos por empresa" ); + } + + @Override + public void doUpdate() throws Exception + { + Update update = new Update( + "begin; " + + "create table empresa_preco_periodicidade_tipo( " + + " id serial primary key, " + + " nome varchar(64) not null " + + "); " + + "insert into empresa_preco_periodicidade_tipo(id,nome) values(1,'Anual'); " + + "insert into empresa_preco_periodicidade_tipo(id,nome) values(2,'Semestral'); " + + "insert into empresa_preco_periodicidade_tipo(id,nome) values(3,'Trimestral'); " + + "insert into empresa_preco_periodicidade_tipo(id,nome) values(4,'Mensal'); " + + "insert into empresa_preco_periodicidade_tipo(id,nome) values(5,'Pontual'); " + + "create table empresa_preco_servico_tipo( " + + " id serial primary key, " + + " nome varchar(64) not null " + + "); " + + "insert into empresa_preco_servico_tipo(id,nome) values(1,'Medicina'); " + + "insert into empresa_preco_servico_tipo(id,nome) values(2,'Higiene e Seguran\\\\u00e7a'); " + + "insert into empresa_preco_servico_tipo(id,nome) values(3,'Outro'); " + + "create table empresa_preco_servico( " + + " id serial primary key, " + + " empresa_preco_servico_tipo_id int4 not null references empresa_preco_servico_tipo(id), " + + " empresa_preco_periodicidade_tipo_id int4 references empresa_preco_periodicidade_tipo(id), " + + " tipo_outro varchar(64), " + + " empresa_id int4 not null references empresas(id), " + + " valor double precision, " + + " iniciado timestamp, " + + " activo boolean not null " + + "); " + + "commit; " ); + getExecuter().executeQuery( update ); + PSQLSequenceUtils.fixSequence("empresa_preco_periodicidade_tipo", "id"); + PSQLSequenceUtils.fixSequence("empresa_preco_servico_tipo", "id"); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_5_To_V12_6.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_5_To_V12_6.java new file mode 100644 index 00000000..1a5c40d6 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_5_To_V12_6.java @@ -0,0 +1,23 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.sql.Update; + +public class V12_5_To_V12_6 extends AbstractUpdate +{ + + public V12_5_To_V12_6() + { + super( 12.5, 12.6, "Adicionar campos em algumas tabelas." ); + } + + @Override + public void doUpdate() throws Exception + { + Update update = new Update( + "ALTER TABLE exames ADD COLUMN impresso_stamp timestamp without time zone;" + ); + executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_6_To_V12_7.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_6_To_V12_7.java new file mode 100644 index 00000000..63bf0144 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_6_To_V12_7.java @@ -0,0 +1,22 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.sql.CreateFunctionPlainUpdate; + +public class V12_6_To_V12_7 extends AbstractUpdate +{ + + public V12_6_To_V12_7() + { + super( 12.6, 12.7, "Adicionar funcao plain()." ); + } + + @Override + public void doUpdate() throws Exception + { + + CreateFunctionPlainUpdate update = new CreateFunctionPlainUpdate( 12.6, 12.7 ); + update.doUpdate(); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_7_To_V12_8.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_7_To_V12_8.java new file mode 100644 index 00000000..fa3bb2f8 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_7_To_V12_8.java @@ -0,0 +1,23 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.sql.Update; + +public class V12_7_To_V12_8 extends AbstractUpdate +{ + + public V12_7_To_V12_8() + { + super( 12.7, 12.8, "Adicionar campo departamento em contactos." ); + } + + @Override + public void doUpdate() throws Exception + { + Update update = new Update( + "ALTER TABLE contactos ADD COLUMN departamento character varying( 256 );" + ); + executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_8_To_V12_9.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_8_To_V12_9.java new file mode 100644 index 00000000..494de270 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_8_To_V12_9.java @@ -0,0 +1,69 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.DBException; +import com.evolute.utils.sql.EvoQuery; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.Select; +import com.evolute.utils.tables.ColumnizedIDObject; + +public class V12_8_To_V12_9 extends AbstractUpdate +{ + + public V12_8_To_V12_9() + { + super( 12.8, 12.9, "A converter valores de pagamentos antigos" ); + } + + @Override + public void doUpdate() throws Exception + { + EvoQuery select = new EvoQuery( getExecuter(), new Select( + "SELECT id, preco_medicina, " + + "CASE " + + "WHEN preco_medicina IS NULL THEN false " + + "ELSE true " + + "END AS preco_medicina_activo, " + + "preco_higiene, " + + "CASE " + + "WHEN preco_higiene IS NULL THEN false " + + "ELSE true " + + "END AS preco_higiene_activo " + + "FROM empresas" + )); + for( ColumnizedIDObject row : select ) + { + Integer empresaId = row.getID(); + +// Number precoFormacao = row.getValue( 0 ); +// Boolean activeFormacao = row.getValue( 1 ); + + Number precoMedicina = row.getValue( 0 ); +// Boolean activeMedicina = row.getValue( 1 ); + Boolean activeMedicina = true; + + Number precoHigiene = row.getValue( 2 ); +// Boolean activeHigiene = row.ge + Boolean activeHigiene = true; + + insertPreco( empresaId, /*precoFormacao, activeFormacao == null ? false : activeFormacao, */precoMedicina, activeMedicina == null ? false : activeMedicina, precoHigiene, activeHigiene == null ? false : activeHigiene); + } + + } + + private void insertPreco(Integer empresaId, /*Number precoFormacao, boolean activeFormacao,*/ Number precoMedicina, boolean activeMedicina, Number precoHigiene, boolean activeHigiene) throws DBException + { + Insert insert = new Insert("insert into empresa_preco_servico(" + + "empresa_preco_servico_tipo_id,empresa_id,valor,activo) " + + "values("+1+","+empresaId+", round( cast( "+precoMedicina+" AS numeric ), 3 ),"+activeMedicina+"); "); + getExecuter().executeQuery(insert); + insert = new Insert("insert into empresa_preco_servico(" + + "empresa_preco_servico_tipo_id,empresa_id,valor,activo) " + + "values("+2+","+empresaId+", round( cast( "+precoHigiene+" AS numeric ), 3 ),"+activeHigiene+"); "); + getExecuter().executeQuery(insert); +// insert = new Insert("insert into empresa_preco_servico(" + +// "empresa_preco_servico_tipo_id,empresa_id,valor,activo) " + +// "values("+3+","+empresaId+","+precoFormacao+","+activeFormacao+"); "); +// getExecuter().executeQuery(insert); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_9_To_V13_0.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_9_To_V13_0.java new file mode 100644 index 00000000..304858ad --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V12_9_To_V13_0.java @@ -0,0 +1,28 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.sql.Update; + +public class V12_9_To_V13_0 extends AbstractUpdate +{ + + public V12_9_To_V13_0() + { + super( 12.9, 13.0, "A remover valores de pagamentos antigos" ); + } + + @Override + public void doUpdate() throws Exception + { + Update update = new Update( + //"alter table empresas drop column preco_formacao; " + + //"alter table empresas drop column preco_formacao_activo; " + + "alter table empresas drop column preco_higiene; " + + //"alter table empresas drop column preco_higiene_activo; " + + "alter table empresas drop column preco_medicina; " + //"alter table empresas drop column preco_medicina_activo; " + ); + getExecuter().executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V6_1_To_V7_0.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V6_1_To_V7_0.java new file mode 100644 index 00000000..0cd34a03 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V6_1_To_V7_0.java @@ -0,0 +1,43 @@ +/* + * V6_1_To_V7_0.java + * + * Created on 26 de Setembro de 2006, 11:48 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + + +/** + * + * @author fpalma + */ +public class V6_1_To_V7_0 extends AbstractUpdate +{ + + public V6_1_To_V7_0() + { + super(6.1,7.0,"Acrescentar campo de contribuinte nos prestadores", + "Acrescentar campo de prestador nas marca\u00e7\u00f5es", + "Acrescentar campo de prestador no hist\u00f3rico das marca\u00e7\u00f5es"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( "ALTER TABLE prestadores ADD contribuinte VARCHAR(64);" ); + executer.executeQuery( update ); + update = new com.evolute.utils.sql.Update( "ALTER TABLE marcacoes_trabalhador ADD prestador_id int4 REFERENCES prestadores( id );" ); + executer.executeQuery( update ); + update = new com.evolute.utils.sql.Update( "ALTER TABLE marcacoes_trabalhador_estados ADD prestador_id int4 REFERENCES prestadores( id );" ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_0_To_V7_2.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_0_To_V7_2.java new file mode 100644 index 00000000..f636627b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_0_To_V7_2.java @@ -0,0 +1,50 @@ +/* + * V7_0_To_V7_2.java + * + * Created on 26 de Setembro de 2006, 11:48 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + + +/** + * + * @author fpalma + */ +public class V7_0_To_V7_2 extends AbstractUpdate +{ + + public V7_0_To_V7_2() + { + super(7.0,7.2,"Criar tabela dos processos"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "CREATE TABLE marcacoes_processo " + + "( " + + "id serial NOT NULL, " + + "trabalhador_id int4 NOT NULL, " + + "estado char(1) NOT NULL DEFAULT 'a'::bpchar, " + + "data_inicio date, " + + "data_fim date, " + + "CONSTRAINT marcacoes_processo_pkey PRIMARY KEY (id), " + + "CONSTRAINT marcacoes_processo_trabalhador_id_fkey FOREIGN KEY (trabalhador_id) " + + "REFERENCES trabalhadores (id) MATCH SIMPLE " + + "ON UPDATE NO ACTION ON DELETE NO ACTION " + + ") " + + "WITHOUT OIDS;" ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_2_To_V7_4.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_2_To_V7_4.java new file mode 100644 index 00000000..56c08183 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_2_To_V7_4.java @@ -0,0 +1,185 @@ +/* + * V7_2_To_V7_4.java + * + * Created on 26 de Setembro de 2006, 11:48 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + + +/** + * + * @author fpalma + */ +public class V7_2_To_V7_4 extends AbstractUpdate +{ + + public V7_2_To_V7_4() + { + super(7.2,7.4,"Acrescentar campo de motivo ao processo", + "Criar tabelas de suporte aos processos"); + } + + public void doUpdate() + throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "ALTER TABLE marcacoes_processo RENAME TO trabalhadores_processo;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "ALTER TABLE trabalhadores_processo ADD motivo int4;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_consultas" + +"(" + +" id serial," + +" trabalhador_id int4 NOT NULL," + +" data date," + +" estado int4," + +" prestador_id int4," + +" processo_id int4," + +" CONSTRAINT trabalhadores_consultas_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_consultas_prestador_id_fkey FOREIGN KEY (prestador_id) REFERENCES prestadores (id) ON UPDATE RESTRICT ON DELETE RESTRICT," + +" CONSTRAINT trabalhadores_consultas_processo_id_fkey FOREIGN KEY (processo_id) REFERENCES trabalhadores_processo (id) ON UPDATE RESTRICT ON DELETE RESTRICT," + +" CONSTRAINT trabalhadores_consultas_trabalhador_id_fkey FOREIGN KEY (trabalhador_id) REFERENCES trabalhadores (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_consultas OWNER TO postgres;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_consultas_datas" + +"(" + +" id serial," + +" data date," + +" trabalhadores_consultas_id int4," + +" estado int4," + +" CONSTRAINT trabalhadores_consultas_datas_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_consultas_datas_trabalhadores_consultas_id_fkey FOREIGN KEY (trabalhadores_consultas_id) REFERENCES trabalhadores_consultas (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_consultas_datas OWNER TO postgres;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_consultas_datas_emails" + +"(" + +" id serial," + +" trabalhadores_consultas_datas_id int4," + +" destination varchar(512)," + +" data date," + +" subject varchar(512)," + +" body varchar(32768)," + +" CONSTRAINT trabalhadores_consultas_datas_emails_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_consultas_data_trabalhadores_consultas_data_fkey1 FOREIGN KEY (trabalhadores_consultas_datas_id) REFERENCES trabalhadores_consultas_datas (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_consultas_datas_emails OWNER TO postgres;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_consultas_datas_observacoes" + +"(" + +" id serial," + +" trabalhadores_consultas_datas_id int4," + +" observacao varchar(4096)," + +" CONSTRAINT trabalhadores_consultas_datas_observacoes_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_consultas_datas_trabalhadores_consultas_data_fkey FOREIGN KEY (trabalhadores_consultas_datas_id) REFERENCES trabalhadores_consultas_datas (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_consultas_datas_observacoes OWNER TO postgres;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_ecds" + +"(" + +" id serial," + +" trabalhador_id int4," + +" estado int4," + +" data date," + +" processo_id int4," + +" CONSTRAINT trabalhadores_ecgs_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_ecds_processo_id_fkey FOREIGN KEY (processo_id) REFERENCES trabalhadores_processo (id) ON UPDATE RESTRICT ON DELETE RESTRICT," + +" CONSTRAINT trabalhadores_ecgs_trabalhador_id_fkey FOREIGN KEY (trabalhador_id) REFERENCES trabalhadores (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_ecds OWNER TO postgres;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_ecds_datas" + +"(" + +" id serial," + +" trabalhadores_ecds_id int4," + +" data date," + +" estado int4," + +" CONSTRAINT trabalhadores_ecds_datas_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_ecds_datas_trabalhadores_ecds_id_fkey FOREIGN KEY (trabalhadores_ecds_id) REFERENCES trabalhadores_ecds (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_ecds_datas OWNER TO postgres;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_ecd" + +"(" + +" id int4 NOT NULL," + +" ecd_id int4," + +" ecd_oficial_id int4," + +" prestador_id int4," + +" estado int4," + +" trabalhadores_ecds_id int4," + +" trabalhadores_ecds_datas_id int4," + +" CONSTRAINT trabalhadores_ecg_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_ecd_trabalhadores_ecds_datas_id_fkey FOREIGN KEY (trabalhadores_ecds_datas_id) REFERENCES trabalhadores_ecds_datas (id) ON UPDATE RESTRICT ON DELETE RESTRICT," + +" CONSTRAINT trabalhadores_ecd_trabalhadores_ecds_id_fkey FOREIGN KEY (trabalhadores_ecds_id) REFERENCES trabalhadores_ecds (id) ON UPDATE RESTRICT ON DELETE RESTRICT," + +" CONSTRAINT trabalhadores_ecg_ecd_id_fkey FOREIGN KEY (ecd_id) REFERENCES prt_tipos_elementos_protocolo (id) ON UPDATE RESTRICT ON DELETE RESTRICT," + +" CONSTRAINT trabalhadores_ecg_ecd_oficial_id_fkey FOREIGN KEY (ecd_oficial_id) REFERENCES ecd_oficial (id) ON UPDATE RESTRICT ON DELETE RESTRICT," + +" CONSTRAINT trabalhadores_ecg_prestador_id_fkey FOREIGN KEY (prestador_id) REFERENCES prestadores (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_ecd OWNER TO postgres;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_ecds_datas_emails" + +"(" + +" id serial," + +" trabalhadores_ecds_datas_id int4," + +" destination varchar(512)," + +" data date," + +" subject varchar(512)," + +" body varchar(32768)," + +" CONSTRAINT trabalhadores_ecds_datas_emails_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_ecds_datas_email_trabalhadores_ecds_datas_id_fkey FOREIGN KEY (trabalhadores_ecds_datas_id) REFERENCES trabalhadores_ecds_datas (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_ecds_datas_emails OWNER TO postgres;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_ecds_datas_observacoes" + +"(" + +" id serial," + +" trabalhadores_ecds_datas_id int4," + +" observacao varchar(4096)," + +" CONSTRAINT trabalhadores_ecds_datas_observacoes_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_ecds_datas_obser_trabalhadores_ecds_datas_id_fkey FOREIGN KEY (trabalhadores_ecds_datas_id) REFERENCES trabalhadores_ecds_datas (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_ecds_datas_observacoes OWNER TO postgres;" ); + executer.executeQuery( update ); + + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_4_To_V7_5.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_4_To_V7_5.java new file mode 100644 index 00000000..8c8370de --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_4_To_V7_5.java @@ -0,0 +1,48 @@ +/* + * V7_4_To_V7_5.java + * + * Created on 26 de Setembro de 2006, 11:48 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + + +/** + * + * @author fpalma + */ +public class V7_4_To_V7_5 extends AbstractUpdate +{ + + public V7_4_To_V7_5() + { + super( 7.4,7.5,"Ligar processo a ficha de aptid\u00e3o"); + } + + public void doUpdate() + throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_fichas_aptidao" + +"(" + +" id serial," + +" processo_id int4," + +" exame_id int4," + +" CONSTRAINT trabalhadores_fichas_aptidao_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_fichas_aptidao_exame_id_fkey FOREIGN KEY (exame_id) REFERENCES exames (id) ON UPDATE RESTRICT ON DELETE RESTRICT," + +" CONSTRAINT trabalhadores_fichas_aptidao_processo_id_fkey FOREIGN KEY (processo_id) REFERENCES trabalhadores_processo (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +")" + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_fichas_aptidao OWNER TO postgres;" ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_5_To_V7_6.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_5_To_V7_6.java new file mode 100644 index 00000000..0d46f4ef --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_5_To_V7_6.java @@ -0,0 +1,38 @@ +/* + * V7_5_To_V7_6.java + * + * Created on 26 de Setembro de 2006, 11:48 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + + +/** + * + * @author fpalma + */ +public class V7_5_To_V7_6 extends AbstractUpdate +{ + + public V7_5_To_V7_6() + { + super(7.5,7.6,"Alterar tabela dos processos"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "ALTER TABLE trabalhadores_processo ADD sub_motivo int4;" ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_6_To_V7_7.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_6_To_V7_7.java new file mode 100644 index 00000000..41b57180 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_6_To_V7_7.java @@ -0,0 +1,47 @@ +/* + * V7_6_To_V7_7.java + * + * Created on May 15, 2007, 3:12 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Field; + +/** + * + * @author lflores + */ +public class V7_6_To_V7_7 extends AbstractUpdate +{ + + public V7_6_To_V7_7() + { + super(7.6,7.7,"Alterar tabela dos exames e criar tabela exames_portaria"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "ALTER TABLE exames ADD fo BYTEA;" ); + executer.executeQuery( update ); + update = new com.evolute.utils.sql.Update( + "CREATE TABLE exames_portaria ( id SERIAL NOT NULL, portaria VARCHAR(255) NOT NULL, " + + "data_entrada timestamp without time zone NOT NULL DEFAULT now(), PRIMARY KEY( id ) );" ); + executer.executeQuery( update ); + com.evolute.utils.sql.Insert insert = + new com.evolute.utils.sql.Insert( "exames_portaria", + new Assignment[]{ new Assignment( new Field( "portaria" ), "Portaria n. 299/2007, de 16 de Mar\u00e7o" ) } ); + executer.executeQuery( insert ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_7_To_V7_8.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_7_To_V7_8.java new file mode 100644 index 00000000..1f8c2c06 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_7_To_V7_8.java @@ -0,0 +1,41 @@ +/* + * V7_7_To_V7_8.java + * + * Created on May 15, 2007, 3:12 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +/** + * + * @author lflores + */ +public class V7_7_To_V7_8 extends AbstractUpdate +{ + + public V7_7_To_V7_8() + { + super(7.7,7.8,"Alterar tabela das datas de exames para incluir o prestador", + "Alterar tabela das datas de consulta para incluir o prestador"); + } + + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "ALTER TABLE trabalhadores_ecds_datas ADD prestador_id INTEGER REFERENCES prestadores( id );" ); + executer.executeQuery( update ); + update = new com.evolute.utils.sql.Update( + "ALTER TABLE trabalhadores_consultas_datas ADD prestador_id INTEGER REFERENCES prestadores( id );" ); + executer.executeQuery( update ); + + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_8_To_V7_9.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_8_To_V7_9.java new file mode 100644 index 00000000..938f1946 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_8_To_V7_9.java @@ -0,0 +1,57 @@ +/* + * V7_8_To_V7_9.java + * + * Created on December 19, 2007, 3:12 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +/** + * + * @author fpalma + */ +public class V7_8_To_V7_9 extends AbstractUpdate +{ + + public V7_8_To_V7_9() + { + super(7.8,7.9,"Alterar tabela dos estabelecimentos para ter prestadores por defeito"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "ALTER TABLE estabelecimentos ADD prestador_consulta_id INTEGER REFERENCES prestadores( id );" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "ALTER TABLE estabelecimentos ADD prestador_ecds_id INTEGER REFERENCES prestadores( id );" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "ALTER TABLE estabelecimentos ADD aux INT REFERENCES contactos(id);" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "UPDATE estabelecimentos SET aux = CAST( contacto AS INTEGER);" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "ALTER TABLE estabelecimentos RENAME contacto TO contacto_backup;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "ALTER TABLE estabelecimentos RENAME aux TO contacto_id;" ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_9_To_V8_0.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_9_To_V8_0.java new file mode 100644 index 00000000..c10af2a9 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V7_9_To_V8_0.java @@ -0,0 +1,49 @@ +/* + * V7_9_To_V8_0.java + * + * Created on December 19, 2007, 3:12 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +/** + * + * @author fpalma + */ +public class V7_9_To_V8_0 extends AbstractUpdate +{ + + public V7_9_To_V8_0() + { + super(7.9,8.0,"Alterar tabela dos ecds"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "ALTER TABLE trabalhadores_ecd DROP CONSTRAINT trabalhadores_ecd_trabalhadores_ecds_id_fkey;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "ALTER TABLE trabalhadores_ecd DROP trabalhadores_ecds_id;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "ALTER TABLE trabalhadores_ecd DROP CONSTRAINT trabalhadores_ecg_prestador_id_fkey;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "ALTER TABLE trabalhadores_ecd DROP prestador_id;" ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_0_To_V8_1.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_0_To_V8_1.java new file mode 100644 index 00000000..1cd5ae0f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_0_To_V8_1.java @@ -0,0 +1,39 @@ +/* + * V8_0_To_V8_1.java + * + * Created on December 19, 2007, 3:12 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; + +/** + * + * @author fpalma + */ +public class V8_0_To_V8_1 extends AbstractUpdate +{ + + public V8_0_To_V8_1() + { + super(8.0,8.1,"Alterar tabela dos ecds"); + } + + @Override + public void doUpdate() throws Exception + { + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "CREATE SEQUENCE trabalhadores_ecd_id_seq;" ); + getExecuter().executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "ALTER TABLE trabalhadores_ecd ALTER COLUMN id SET DEFAULT NEXTVAL('trabalhadores_ecd_id_seq');" ); + getExecuter().executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_1_To_V8_2.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_1_To_V8_2.java new file mode 100644 index 00000000..bc70145b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_1_To_V8_2.java @@ -0,0 +1,72 @@ +/* + * V8_1_To_V8_2.java + * + * Created on December 19, 2007, 3:12 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Delete; + +/** + * + * @author fpalma + */ +public class V8_1_To_V8_2 extends AbstractUpdate +{ + + public V8_1_To_V8_2() + { + super(8.1,8.2,"Alterar tabela dos ecds", "Alterar tabela de marca\u00e7\u00e3o dos ecds"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "ALTER TABLE trabalhadores_ecd ADD enviado CHAR(1);" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "ALTER TABLE trabalhadores_ecds_datas ADD analisador_id INT REFERENCES prestadores( id );" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "ALTER TABLE trabalhadores_ecds_datas ADD data_envio DATE;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "ALTER TABLE trabalhadores_ecds_datas ADD data_recepcao DATE;" ); + executer.executeQuery( update ); + Delete delete = new Delete( "trabalhadores_ecd", null ); + executer.executeQuery( delete ); + delete = new Delete( "trabalhadores_ecds_datas_emails", null ); + executer.executeQuery( delete ); + delete = new Delete( "trabalhadores_ecds_datas_observacoes", null ); + executer.executeQuery( delete ); + delete = new Delete( "trabalhadores_ecds_datas", null ); + executer.executeQuery( delete ); + delete = new Delete( "trabalhadores_ecds", null ); + executer.executeQuery( delete ); + delete = new Delete( "trabalhadores_consultas_datas_emails", null ); + executer.executeQuery( delete ); + delete = new Delete( "trabalhadores_consultas_datas_observacoes", null ); + executer.executeQuery( delete ); + delete = new Delete( "trabalhadores_consultas_datas", null ); + executer.executeQuery( delete ); + delete = new Delete( "trabalhadores_consultas", null ); + executer.executeQuery( delete ); + delete = new Delete( "trabalhadores_fichas_aptidao", null ); + executer.executeQuery( delete ); + delete = new Delete( "trabalhadores_processo", null ); + executer.executeQuery( delete ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_2_To_V8_3.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_2_To_V8_3.java new file mode 100644 index 00000000..10534d55 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_2_To_V8_3.java @@ -0,0 +1,41 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; + +/** + * + * @author fpalma + */ +public class V8_2_To_V8_3 extends AbstractUpdate +{ + + public V8_2_To_V8_3() + { + super(8.2,8.3,"Criar tabela para locais de an\u00e1lise"); + } + + @Override + public void doUpdate() throws Exception + { + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_ecds_analise" + + "(" + + "id serial, " + + "data date NOT NULL, " + + "prestador_id int4 NOT NULL, " + + "grupo_ecds_id int4 NOT NULL, " + + "CONSTRAINT trabalhadores_ecds_analise_pkey PRIMARY KEY (id), " + + "CONSTRAINT trabalhadores_ecds_analise_grupo_ecds_id_fkey FOREIGN KEY (grupo_ecds_id) " + + " REFERENCES prt_grupos_protocolo (id) MATCH SIMPLE " + + " ON UPDATE NO ACTION ON DELETE NO ACTION, " + + "CONSTRAINT trabalhadores_ecds_analise_prestador_id_fkey FOREIGN KEY (prestador_id) " + + " REFERENCES prestadores (id) MATCH SIMPLE " + + " ON UPDATE NO ACTION ON DELETE NO ACTION " + + ") " + + "WITHOUT OIDS; " + + "ALTER TABLE trabalhadores_ecds_analise OWNER TO postgres;" ); + getExecuter().executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_3_To_V8_4.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_3_To_V8_4.java new file mode 100644 index 00000000..7563bdf3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_3_To_V8_4.java @@ -0,0 +1,24 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; + +/** + * + * @author tsimao + * + */ +public class V8_3_To_V8_4 extends AbstractUpdate +{ + public V8_3_To_V8_4() + { + super(8.3,8.4,"Adicionado analisador [prestador] por TrabalhadorEcd"); + } + + @Override + public void doUpdate() throws Exception + { + com.evolute.utils.sql.Update update = new com.evolute.utils.sql.Update( "ALTER TABLE trabalhadores_ecd ADD COLUMN analisador_id int4;" + "ALTER TABLE trabalhadores_ecd ADD CONSTRAINT analisador_id_fkey FOREIGN KEY(analisador_id) REFERENCES prestadores(id);" ); + getExecuter().executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_4_To_V8_5.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_4_To_V8_5.java new file mode 100644 index 00000000..6d2e542b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_4_To_V8_5.java @@ -0,0 +1,25 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; + +/** + * + * @author tsimao + * + */ +public class V8_4_To_V8_5 extends AbstractUpdate +{ + public V8_4_To_V8_5() + { + super(8.4,8.5,"Adicionado analisador [prestador] por PrtGruposProtocolo"); + } + + @Override + public void doUpdate() throws Exception + { + com.evolute.utils.sql.Update update = new com.evolute.utils.sql.Update( "ALTER TABLE prt_grupos_protocolo ADD COLUMN analisador_id int4;" + + "ALTER TABLE prt_grupos_protocolo ADD CONSTRAINT analisador_id_fkey FOREIGN KEY(analisador_id) REFERENCES prestadores(id);" ); + getExecuter().executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_5_To_V8_6.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_5_To_V8_6.java new file mode 100644 index 00000000..4a9a098b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_5_To_V8_6.java @@ -0,0 +1,28 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; + +/** + * + * @author tsimao + * + */ +public class V8_5_To_V8_6 extends AbstractUpdate +{ + public V8_5_To_V8_6() + { + super(8.5,8.6,"Adicionado campo 'activo' a TrabalhadoresProcesso\n"+ + "Adicionada observacao a Prestadores\n"+ + "Adicionado BI a Trabalhadores\n"); + } + + @Override + public void doUpdate() throws Exception + { + com.evolute.utils.sql.Update update = new com.evolute.utils.sql.Update( "ALTER TABLE trabalhadores_processo ADD COLUMN activo char default 'y';" + + "ALTER TABLE prestadores ADD COLUMN observacoes character varying(65535);" + + "ALTER TABLE trabalhadores ADD COLUMN bi character varying(255);"); + getExecuter().executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_6_To_V8_7.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_6_To_V8_7.java new file mode 100644 index 00000000..4c252f76 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_6_To_V8_7.java @@ -0,0 +1,30 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; + +/** + * + * @author fpalma + */ +public class V8_6_To_V8_7 extends AbstractUpdate +{ + + public V8_6_To_V8_7() + { + super(8.6,8.7,"Adicionados campos data_envio e data_recepcao a cada instancia de ECD"); + } + + @Override + public void doUpdate() throws Exception + { + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "ALTER TABLE trabalhadores_ecd ADD data_envio DATE;" ); + getExecuter().executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "ALTER TABLE trabalhadores_ecd ADD data_recepcao DATE;" ); + getExecuter().executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_7_To_V8_8.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_7_To_V8_8.java new file mode 100644 index 00000000..9eaf5b2b --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_7_To_V8_8.java @@ -0,0 +1,30 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; + +/** + * + * @author fpalma + */ +public class V8_7_To_V8_8 extends AbstractUpdate +{ + + public V8_7_To_V8_8() + { + super(8.7,8.8,"Adicionada coluna em 'lembretes' que referencia nova tabela das marcacoes (trabalhadores_consultas_datas)"); + } + + @Override + public void doUpdate() throws Exception + { + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "ALTER TABLE lembretes ADD COLUMN trabalhadores_consultas_datas_id int4 REFERENCES trabalhadores_consultas_datas(id);" ); + getExecuter().executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "ALTER TABLE lembretes ADD COLUMN trabalhadores_ecds_datas_id int4 REFERENCES trabalhadores_ecds_datas(id);" ); + getExecuter().executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_8_To_V8_9.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_8_To_V8_9.java new file mode 100644 index 00000000..2863db86 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_8_To_V8_9.java @@ -0,0 +1,26 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; + +/** + * + * @author fpalma + */ +public class V8_8_To_V8_9 extends AbstractUpdate +{ + + public V8_8_To_V8_9() + { + super(8.8,8.9,"Adicionada coluna em 'lembretes' para marcar lembretes já tratados"); + } + + @Override + public void doUpdate() throws Exception + { + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "alter table lembretes add column deleted_date timestamp;" ); + getExecuter().executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_9_To_V9_0.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_9_To_V9_0.java new file mode 100644 index 00000000..8b299e4e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V8_9_To_V9_0.java @@ -0,0 +1,79 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; + +/** + * + * @author fpalma + */ +public class V8_9_To_V9_0 extends AbstractUpdate +{ + + public V8_9_To_V9_0() + { + super(8.9,9.0, "Criar tabela 'posto_de_trabalho'", + "Criar tabela 'legislacao'", + "Criar tabela relacional 'posto_de_trabalho_estabelecimento'", + "Criar tabela relacional 'legislacao_estabelecimento'", + "Criar tabela 'medida'", + "Criar tabela 'risco'", + "Criar tabela 'medida'", + "Criar tabela relacional 'risco_medida'", + "Criar tabela 'image'", + "Adicionar logotipo a empresa"); + } + + @Override + public void doUpdate() throws Exception + { + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "create table email_plano_de_actuacao(" + + "id serial PRIMARY KEY," + + "description varchar(255) NOT NULL," + + "estabelecimento_id int4 REFERENCES estabelecimentos(id)" + + ");" + + "create table posto_de_trabalho(" + + "id serial PRIMARY KEY," + + "description varchar(1024) NOT NULL" + + ");" + + "create table legislacao(" + + "id serial PRIMARY KEY," + + "parent_id int4 REFERENCES legislacao(id)," + + "description varchar(8192) NOT NULL" + + ");" + + "create table posto_de_trabalho_estabelecimento(" + + "posto_de_trabalho_id int4 REFERENCES posto_de_trabalho(id) NOT NULL," + + "estabelecimento_id int4 REFERENCES estabelecimentos(id) NOT NULL," + + "CONSTRAINT posto_de_trabalho_estabelecimento_pkey PRIMARY KEY(posto_de_trabalho_id, estabelecimento_id)" + + ");" + + "create table legislacao_estabelecimento(" + + "legislacao_id int4 REFERENCES legislacao(id) NOT NULL," + + "estabelecimento_id int4 REFERENCES estabelecimentos(id) NOT NULL," + + "CONSTRAINT legislacao_estabelecimento_pkey PRIMARY KEY(legislacao_id, estabelecimento_id)" + + ");" + + "create table risco(" + + "id serial PRIMARY KEY," + + "description varchar(255) NOT NULL," + + "value int4 NOT NULL" + + ");" + + "create table medida(" + + "id serial PRIMARY KEY," + + "description varchar(255) NOT NULL" + + ");" + + "create table risco_medida(" + + "risco_id int4 REFERENCES risco(id) NOT NULL," + + "medida_id int4 REFERENCES medida(id) NOT NULL," + + "CONSTRAINT risco_medida_pkey PRIMARY KEY(risco_id, medida_id)" + + ");" + + "create table image(" + + "id serial PRIMARY KEY," + + "name varchar(255) NOT NULL," + + "image_data bytea NOT NULL" + + ");" + + "alter table empresas add column empresa_logo_id int4 REFERENCES image(id);" + ); + getExecuter().executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_0_To_V9_1.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_0_To_V9_1.java new file mode 100644 index 00000000..d800c233 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_0_To_V9_1.java @@ -0,0 +1,114 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; + +/** + * + * @author fpalma + */ +public class V9_0_To_V9_1 extends AbstractUpdate +{ + + public V9_0_To_V9_1() + { + super(9.0,9.1,"Refactorizar tabelas de higiene e seguranca","Criar novas tabelas de higiene e seguranca"); + } + + @Override + public void doUpdate() throws Exception + { + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "drop table risco_medida;" + + "drop table risco;" + + "drop table medida;" + + "drop table legislacao_estabelecimento;" + + "drop table legislacao;" + + "drop table posto_de_trabalho_estabelecimento;" + + "drop table posto_de_trabalho;" + + "CREATE TABLE hs_area(" + + " id serial PRIMARY KEY," + + " empresa_id int4 REFERENCES empresas(id)," + + " description varchar(256) NOT NULL" + + ");" + + "CREATE TABLE hs_posto(" + + " id serial PRIMARY KEY," + + " area_id int4 REFERENCES hs_area(id)," + + " description varchar(256) NOT NULL" + + ");" + + "CREATE TABLE hs_medida(" + + " id serial PRIMARY KEY," + + " description varchar(1024) NOT NULL," + + " requesitos_legais varchar(1024)" + + ");" + + "CREATE TABLE hs_risco_tema(" + + " id serial PRIMARY KEY," + + " description varchar(256) NOT NULL" + + ");" + + "CREATE TABLE hs_risco(" + + " id serial PRIMARY KEY," + + " tema_id int4 REFERENCES hs_risco_tema(id)," + + " description varchar(256) NOT NULL" + + ");" + + "CREATE TABLE hs_risco_medida(" + + " risco_id int4 REFERENCES hs_risco(id)," + + " medida_id int4 REFERENCES hs_medida(id)," + + " CONSTRAINT hs_risco_medida_pkey PRIMARY KEY(risco_id, medida_id)" + + ");" + + "create table hs_relatorio(" + + " id serial PRIMARY KEY," + + " data date NOT NULL," + + " deleted_date timestamp" + + ");" + + "create table hs_medida_classificacao(" + + " id serial PRIMARY KEY," + + " description varchar(255) NOT NULL" + + ");" + + "create table hs_relatorio_risco(" + + " id serial PRIMARY KEY," + + " relatorio_id int4 REFERENCES hs_relatorio NOT NULL," + + " description varchar(255) NOT NULL" + + ");" + + "create table hs_relatorio_medida(" + + " id serial PRIMARY KEY," + + " risco_id int4 REFERENCES hs_relatorio_risco NOT NULL," + + " description varchar(1024) NOT NULL," + + " requesitos_legais varchar(1024) NOT NULL," + + " severidade int4," + + " probabilidade int4," + + " classificacao_id int4 REFERENCES hs_medida_classificacao" + + ");" + + "create table hs_normalizacao(" + + " id serial PRIMARY KEY," + + " codigo varchar(128) NOT NULL," + + " descricao varchar(1024) NOT NULL," + + " portuguesa boolean NOT NULL" + + ");" + + "create table hs_equipamento_medico(" + + " id serial PRIMARY KEY," + + " nome varchar(255) NOT NULL" + + ");" + + "create table hs_legislacao_categoria(" + + " id serial PRIMARY KEY," + + " description varchar(255) NOT NULL" + + ");" + + "create table hs_legislacao(" + + " id serial PRIMARY KEY," + + " description varchar(1024) NOT NULL," + + " categoria_id int4 REFERENCES hs_legislacao_categoria(id)" + + ");" + + "create table hs_legislacao_empresa(" + + " legislacao_id int4 REFERENCES hs_legislacao(id)," + + " empresa_id int4 REFERENCES empresas(id)," + + " CONSTRAINT hs_legislacao_empresa_pkey PRIMARY KEY(legislacao_id, empresa_id)" + + ");" + + "create table hs_legislacao_estabelecimento(" + + " legislacao_id int4 REFERENCES hs_legislacao(id)," + + " estabelecimento_id int4 REFERENCES estabelecimentos(id)," + + " CONSTRAINT hs_legislacao_estabelecimento_pkey PRIMARY KEY(legislacao_id, estabelecimento_id)" + + ");" + ); + getExecuter().executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_1_To_V9_2.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_1_To_V9_2.java new file mode 100644 index 00000000..77ddef5f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_1_To_V9_2.java @@ -0,0 +1,37 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; + +/** + * + * @author fpalma + */ +public class V9_1_To_V9_2 extends AbstractUpdate +{ + + public V9_1_To_V9_2() + { + super(9.1,9.2,"Soft-delete nas tabelas de higiene e saude"); + } + + @Override + public void doUpdate() throws Exception + { + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "alter table hs_area add column deleted_date timestamp;" + + "alter table hs_equipamento_medico add column deleted_date timestamp;" + + "alter table hs_legislacao add column deleted_date timestamp;" + + "alter table hs_legislacao_categoria add column deleted_date timestamp;" + + "alter table hs_medida add column deleted_date timestamp;" + + "alter table hs_normalizacao add column deleted_date timestamp;" + + "alter table hs_posto add column deleted_date timestamp;" + + "alter table hs_relatorio_medida add column deleted_date timestamp;" + + "alter table hs_relatorio_risco add column deleted_date timestamp;" + + "alter table hs_risco add column deleted_date timestamp;" + + "alter table hs_risco_tema add column deleted_date timestamp;" + ); + getExecuter().executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_2_To_V9_3.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_2_To_V9_3.java new file mode 100644 index 00000000..b88d5760 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_2_To_V9_3.java @@ -0,0 +1,41 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; + +/** + * + * @author fpalma + */ +public class V9_2_To_V9_3 extends AbstractUpdate +{ + + public V9_2_To_V9_3() + { + super(9.2,9.3,"Adicionados campos ao relatorio"); + } + + @Override + public void doUpdate() throws Exception + { + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "alter table hs_relatorio_medida drop column severidade;" + + "alter table hs_relatorio_medida drop column probabilidade;" + + "alter table hs_relatorio_medida drop column classificacao_id;" + + "drop table hs_medida_classificacao;" + + "alter table hs_relatorio add column marcacao_id int4 REFERENCES marcacoes_estabelecimento;" + + "alter table hs_relatorio add column is_submetido timestamp;" + + "alter table hs_relatorio_risco add column probabilidade int4;" + + "alter table hs_relatorio_risco add column severidade int4;" + + "create table hs_relatorio_risco_valor_qualitativo" + + "(" + + " id serial PRIMARY KEY," + + " description varchar(64)" + + ");" + + "alter table hs_relatorio_risco add column valor_qualitativo_id int4 REFERENCES hs_relatorio_risco_valor_qualitativo;" + + "alter table hs_relatorio_risco add column is_plano_actuacao char(1);" + ); + getExecuter().executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_3_To_V9_4.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_3_To_V9_4.java new file mode 100644 index 00000000..7226bb77 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_3_To_V9_4.java @@ -0,0 +1,37 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; + +/** + * + * @author fpalma + */ +public class V9_3_To_V9_4 extends AbstractUpdate +{ + + public V9_3_To_V9_4() + { + super(9.3,9.4,"Adicionados postos de trabalho relatorio"); + } + + @Override + public void doUpdate() throws Exception + { + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "create table hs_relatorio_medida_area" + + "(" + + " id serial PRIMARY KEY," + + " description varchar(256) NOT NULL" + + ");" + + "create table hs_relatorio_medida_posto" + + "(" + + " id serial PRIMARY KEY," + + " description varchar(256) NOT NULL," + + " area_id int4 REFERENCES hs_relatorio_medida_area(id)" + + ");" + ); + getExecuter().executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_4_To_V9_5.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_4_To_V9_5.java new file mode 100644 index 00000000..26646bdc --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_4_To_V9_5.java @@ -0,0 +1,54 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; + +/** + * + * @author fpalma + */ +public class V9_4_To_V9_5 extends AbstractUpdate +{ + + public V9_4_To_V9_5() + { + super(9.4,9.5,"Refactorizacao do relatorio"); + } + + public void doUpdate() throws Exception + { + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "drop table hs_relatorio_medida_posto;" + + "drop table hs_relatorio_medida_area;" + + "alter table hs_relatorio_risco drop column probabilidade;" + + "alter table hs_relatorio_risco drop column severidade;" + + "alter table hs_relatorio_risco drop column valor_qualitativo_id;" + + "create table hs_posto_risco(" + + " posto_id int4 REFERENCES hs_posto(id)," + + " risco_id int4 REFERENCES hs_risco(id)," + + " CONSTRAINT hs_posto_risco_pkey PRIMARY KEY (posto_id,risco_id)" + + ");" + + "create table hs_relatorio_area(" + + " id serial PRIMARY KEY," + + " description varchar(256) NOT NULL," + + " deleted_date timestamp" + + ");" + + "create table hs_relatorio_posto(" + + " id serial PRIMARY KEY," + + " description varchar(256) NOT NULL," + + " area_id int4 REFERENCES hs_relatorio_area(id)," + + " deleted_date timestamp" + + ");" + + "create table hs_relatorio_posto_risco(" + + " posto_id int4 REFERENCES hs_relatorio_posto(id)," + + " risco_id int4 REFERENCES hs_relatorio_risco(id)," + + " probabilidade int4," + + " severidade int4," + + " valor_qualitativo_id int4 REFERENCES hs_relatorio_risco_valor_qualitativo(id)," + + " CONSTRAINT hs_relatorio_posto_risco_pkey PRIMARY KEY (posto_id,risco_id)" + + ");" + ); + getExecuter().executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_5_To_V9_6.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_5_To_V9_6.java new file mode 100644 index 00000000..bc25d4ac --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_5_To_V9_6.java @@ -0,0 +1,31 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; + +/** + * + * @author fpalma + */ +public class V9_5_To_V9_6 extends AbstractUpdate +{ + + public V9_5_To_V9_6() + { + super(9.5,9.6,"Relacao postoDeTrabalho <-> estabelecimento"); + } + + @Override + public void doUpdate() throws Exception + { + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "create table hs_posto_estabelecimento(" + + " posto_id int4 REFERENCES hs_posto(id)," + + " estabelecimento_id int4 REFERENCES estabelecimentos(id)," + + " CONSTRAINT hs_posto_estabelecimento_pkey PRIMARY KEY(posto_id,estabelecimento_id)" + + ");" + ); + getExecuter().executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_6_To_V9_7.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_6_To_V9_7.java new file mode 100644 index 00000000..a9c66d17 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_6_To_V9_7.java @@ -0,0 +1,40 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; + +/** + * + * @author fpalma + */ +public class V9_6_To_V9_7 extends AbstractUpdate +{ + + public V9_6_To_V9_7() + { + super(9.6,9.7,"Relacao postoDeTrabalho <-> medida"); + } + + public void doUpdate() throws Exception + { + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "drop table hs_posto_risco;" + + "create table hs_posto_medida(" + + " posto_id int4 REFERENCES hs_posto(id)," + + " medida_id int4 REFERENCES hs_medida(id)," + + " CONSTRAINT hs_posto_medida_pkey PRIMARY KEY(posto_id,medida_id)" + + ");" + + "create table hs_relatorio_posto_medida(" + + " posto_id int4 REFERENCES hs_relatorio_posto(id)," + + " medida_id int4 REFERENCES hs_relatorio_medida(id)," + + " CONSTRAINT hs_relatorio_posto_medida_pkey PRIMARY KEY(posto_id,medida_id)" + + ");" + ); + getExecuter().executeQuery( update ); + } + + public String toString() + { + return "v" + getStartVersion() + " para v" + getEndVersion(); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_7_To_V9_8.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_7_To_V9_8.java new file mode 100644 index 00000000..2528dbe3 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_7_To_V9_8.java @@ -0,0 +1,39 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; + +/** + * + * @author fpalma + */ +public class V9_7_To_V9_8 extends AbstractUpdate +{ + + public V9_7_To_V9_8() + { + super(9.7,9.8,"Relacao postoDeTrabalho <-> risco"); + } + + @Override + public void doUpdate() throws Exception + { + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "create table hs_posto_risco(" + + " posto_id int4 REFERENCES hs_posto(id)," + + " risco_id int4 REFERENCES hs_risco(id)," + + " probabilidade int4," + + " severidade int4," + + " valor_qualitativo int4 REFERENCES hs_relatorio_risco_valor_qualitativo," + + " CONSTRAINT hs_posto_risco_pkey PRIMARY KEY(posto_id, risco_id)" + + ");" + + "ALTER TABLE hs_relatorio_risco DROP COLUMN is_plano_actuacao;" + + "ALTER TABLE hs_posto_risco ADD COLUMN is_plano_actuacao char(1);" + + "insert into hs_relatorio_risco_valor_qualitativo (description) values('Controlado');" + + "insert into hs_relatorio_risco_valor_qualitativo (description) values('Incontrolado');" + + "insert into hs_relatorio_risco_valor_qualitativo (description) values('Indeterminado');" + ); + getExecuter().executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_8_To_V9_9.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_8_To_V9_9.java new file mode 100644 index 00000000..1a8c0f7f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_8_To_V9_9.java @@ -0,0 +1,48 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +/** + * + * @author fpalma + */ +public class V9_8_To_V9_9 extends AbstractUpdate +{ + + public V9_8_To_V9_9() + { + super(9.8,9.9,"Criacao de tabelas para associacao de emails e riscos a empresas"); + } + + @Override + public void doUpdate() throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "alter table hs_posto_medida add column is_plano_actuacao char(1); " + + "create table hs_email( " + + " id serial PRIMARY KEY, " + + " email varchar(128) " + + "); " + + "create table hs_email_estabelecimento( " + + " email_id int4 REFERENCES hs_email(id), " + + " estabelecimento_id int4 REFERENCES estabelecimentos(id), " + + " constraint hs_email_estabelecimento_pkey PRIMARY KEY(email_id,estabelecimento_id) " + + "); " + + "create table hs_email_empresa( " + + " email_id int4 REFERENCES hs_email(id), " + + " empresa_id int4 REFERENCES empresas(id), " + + " constraint hs_email_empresa_pkey PRIMARY KEY(email_id,empresa_id) " + + "); " + + "create table hs_risco_empresa( " + + " risco_id int4 REFERENCES hs_risco(id), " + + " empresa_id int4 REFERENCES empresas(id), " + + " constraint hs_risco_empresa_pkey PRIMARY KEY(risco_id,empresa_id) " + + ");" + ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_9_To_V10_0.java b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_9_To_V10_0.java new file mode 100644 index 00000000..4f5018fe --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/update/updates/V9_9_To_V10_0.java @@ -0,0 +1,54 @@ +package siprp.update.updates; + +import com.evolute.module.updater.AbstractUpdate; +import com.evolute.utils.db.Executer; + +/** + * + * @author fpalma + */ +public class V9_9_To_V10_0 extends AbstractUpdate +{ + + public V9_9_To_V10_0() + { + super(9.9,10.0,"extensao da definicao de 'relatorio de higiene e seguranca'"); + } + + @Override + public void doUpdate() + throws Exception + { + Executer executer = getExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "create table hs_relatorio_legislacao( " + + " hs_relatorio_id int4 REFERENCES hs_relatorio(id), " + + " hs_legislacao_id int4 REFERENCES hs_legislacao(id), " + + " CONSTRAINT hs_relatorio_legislacao_pkey PRIMARY KEY (hs_relatorio_id,hs_legislacao_id) " + + "); " + + "create table hs_relatorio_normalizacao( " + + " hs_relatorio_id int4 REFERENCES hs_relatorio(id), " + + " hs_normalizacao_id int4 REFERENCES hs_normalizacao(id), " + + " CONSTRAINT hs_relatorio_normalizacao_pkey PRIMARY KEY (hs_relatorio_id,hs_normalizacao_id) " + + "); " + + "create table hs_relatorio_equipamento_medico( " + + " hs_relatorio_id int4 REFERENCES hs_relatorio(id), " + + " hs_equipamento_medico_id int4 REFERENCES hs_equipamento_medico(id), " + + " CONSTRAINT hs_relatorio_equipamento_medico_pkey PRIMARY KEY (hs_relatorio_id,hs_equipamento_medico_id) " + + "); " + + "alter table hs_relatorio add column avaliacao_inicial boolean; " + + "alter table hs_relatorio add column acompanhante1 varchar(256); " + + "alter table hs_relatorio add column funcao_acompanhante1 varchar(128); " + + "alter table hs_relatorio add column acompanhante2 varchar(256); " + + "alter table hs_relatorio add column funcao_acompanhante2 varchar(128); " + + "alter table hs_relatorio add column acompanhante3 varchar(256); " + + "alter table hs_relatorio add column funcao_acompanhante3 varchar(128);" + + "alter table hs_relatorio_area add column relatorio_id int4 REFERENCES hs_relatorio(id) NOT NULL; " + + "alter table hs_posto_medida drop column is_plano_actuacao;" + + "alter table hs_relatorio_posto_medida add column is_plano_actuacao boolean; " + ); + executer.executeQuery( update ); + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/FOPCreator.java b/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/FOPCreator.java new file mode 100644 index 00000000..4d87b485 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/FOPCreator.java @@ -0,0 +1,64 @@ +/* + * FOPCreator.java + * + * Created on 25 de Maio de 2005, 15:36 + */ + +package siprp.util.fop; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; +/** + * + * @author lflores + */ +public class FOPCreator +{ + private static final Object LOCK = new Object(); + + private static FOPCreator fopCreator; + + /** Creates a new instance of FOPPrinter */ + private FOPCreator() + { + } + + public static FOPCreator getFOPCreator() + { + synchronized( LOCK ) + { + if( fopCreator == null ) + { + fopCreator = new FOPCreator(); + } + } + return fopCreator; + } + + + public void createFOfromXML( InputStream xml, InputStream xslt, OutputStream fo ) + throws IOException, TransformerException + { + try + { + TransformerFactory factory = TransformerFactory.newInstance(); + Transformer transformer = factory.newTransformer( new StreamSource( xslt ) ); + Source src = new StreamSource( xml ); + Result res = new StreamResult( fo ); + transformer.transform( src, res ); + } + finally + { + fo.close(); + } + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/FOPPrinter.java b/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/FOPPrinter.java new file mode 100644 index 00000000..eea68308 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/FOPPrinter.java @@ -0,0 +1,495 @@ +/* + * FOPPrinter.java + * + * Created on 25 de Maio de 2005, 15:43 + */ + +package siprp.util.fop; + +import java.awt.print.Book; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.io.Serializable; +import java.util.Hashtable; + +import javax.print.Doc; +import javax.print.DocFlavor; +import javax.print.DocPrintJob; +import javax.print.PrintException; +import javax.print.PrintService; +import javax.print.PrintServiceLookup; +import javax.print.ServiceUI; +import javax.print.SimpleDoc; +import javax.print.attribute.DocAttributeSet; +import javax.print.attribute.HashDocAttributeSet; +import javax.print.attribute.HashPrintRequestAttributeSet; +import javax.print.attribute.PrintRequestAttributeSet; +import javax.print.attribute.standard.Sides; +import javax.swing.JOptionPane; +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamSource; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.render.awt.AWTRenderer; + + +/** + * Utilities to preview and print FO files in form of generated .fo files + * + * @author lflores + * @author João Neto + */ +public class FOPPrinter implements FOPPrinterConstants +{ + public FopFactory getFopfactory() + { + return fopfactory; + } + + private static final Object LOCK = new Object(); + + // private final Translator translator = new SecureResourceBundle( null ); + + // private final AWTRenderer renderer = new AWTRenderer( translator ); + private final FopFactory fopfactory; + private final FOUserAgent foUserAgent; + private final TransformerFactory factory = TransformerFactory.newInstance(); + private static final DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PAGEABLE; + + private Transformer transformer = null; + + private static File userConfig = null; + + + public static File getUserConfig() + { + return userConfig; + } + + public static void setUserConfig(File userConfig) + { + FOPPrinter.userConfig = userConfig; + } + + private static FOPPrinter fopPrinter = null; + + /** Creates a new instance of FOPPrinter */ + private FOPPrinter() + { + fopfactory = FopFactory.newInstance(); + if (userConfig != null) + { + try + { + fopfactory.setUserConfig(userConfig); + } catch (Exception e) + { + System.err.println("Ignoring invalid user config file"); + e.printStackTrace(); + } + } + foUserAgent = new FOUserAgent(fopfactory); + fopfactory.setStrictValidation(false); + + // driver.setLogger( new ConsoleLogger( ConsoleLogger.LEVEL_INFO ) ); + } + + public static FOPPrinter getFOPPrinter() + { + synchronized (LOCK) + { + if (fopPrinter == null) + { + fopPrinter = new FOPPrinter( ); + } + } + return fopPrinter; + } + + + /** + * Creates a .fo and prints it + * @param xslFile + * @param xmlBytes + ** @param preview + * Flag to activate document preview before printing. If false, + * the printing is immediately activated. + * @param printerDialog + * Flag to activate the printer choosing dialog. If false, the + * default or preferred printer is used. + * @throws Exception + */ + public void print(String xslFile, byte[] xmlBytes, boolean preview, boolean printerDialog ) throws Exception + { + InputStream input = getClass().getClassLoader().getResourceAsStream(xslFile); + print(input, xmlBytes,preview,printerDialog); + } + + /** + * Creates a .fo and prints it + * @param xslStream + * @param xmlBytes + ** @param preview + * Flag to activate document preview before printing. If false, + * the printing is immediately activated. + * @param printerDialog + * Flag to activate the printer choosing dialog. If false, the + * default or preferred printer is used. + * @throws Exception + */ + public void print(InputStream xslStream, byte[] xmlBytes, boolean preview, boolean printerDialog ) throws Exception + { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + FOPCreator.getFOPCreator().createFOfromXML(new ByteArrayInputStream(xmlBytes), xslStream, baos); + printFO( new ByteArrayInputStream( baos.toByteArray() ), preview, printerDialog ); + } + + /** + * Prints a single .fo document. + * + * @param fo + * The generated fo document + * @param preview + * Flag to activate document preview before printing. If false, + * the printing is immediately activated. + * @param dialog + * Flag to activate the printer choosing dialog. If false, the + * default or preferred printer is used. + * @throws Exception + * if the conversion fails + */ + public void printFO(InputStream fo, boolean preview, boolean dialog) throws Exception + { + printFO(new InputStream[] + { fo }, preview, dialog); + } + + /** + * Prints an array of .fo documents. + * + * @param fo + * The array of generated fo documents + * @param preview + * Flag to activate document preview before printing. If false, + * the printing is immediately activated. + * @param dialog + * Flag to activate the printer choosing dialog. If false, the + * default or preferred printer is used. + * @throws Exception + * if the conversion fails + */ + public void printFO(InputStream fo[], boolean preview, boolean dialog) throws Exception + { + printFO(fo, preview, dialog, null); + } + + /** + * Prints a single .fo document with printing options. + * + * @param fo + * The generated fo document + * @param preview + * Flag to activate document preview before printing. If false, + * the printing is immediately activated. + * @param dialog + * Flag to activate the printer choosing dialog. If false, the + * default or preferred printer is used. + * @param options + * Printing options + * @see FOPPrinterConstants + * @throws Exception + * if the conversion fails + */ + public void printFO(InputStream fo, boolean preview, boolean dialog, + Hashtable options) throws Exception + { + printFO(new InputStream[] + { fo }, preview, dialog, options); + } + + /** + * Prints an array of .fo documents with printing options. + * + * @param fo + * The array of generated fo documents + * @param preview + * Flag to activate document preview before printing. If false, + * the printing is immediately activated. + * @param dialog + * Flag to activate the printer choosing dialog. If false, the + * default or preferred printer is used. + * @param options + * Printing options + * @see FOPPrinterConstants + * @throws Exception + * if the conversion fails + */ + public void printFO(InputStream fo[], boolean preview, boolean dialog, + Hashtable options) throws Exception + { + if (options == null) + { + options = new Hashtable(); + } + String defaultPrinter = System.getProperty("evutils.defaultprinter"); + if (defaultPrinter != null) + { + options.put(FOP_PREFERRED_PRINTER_NAME, defaultPrinter); + } + if (fo.length > 1 && preview) + { + throw new Exception("Can't have preview with multi document print"); + } + if (transformer == null) + { + transformer = factory.newTransformer(); + } + // long tic = System.currentTimeMillis(); + + AWTRenderer renderer = new AWTRenderer(); + + foUserAgent.setRendererOverride(renderer); + + if (!preview) + { + renderer.setPreviewDialogDisplayed(false); + } + renderer.setUserAgent(foUserAgent); + + Result res[] = new Result[fo.length]; + for (int i = 0; i < fo.length; ++i) + { + Source src = new StreamSource(fo[i]); + Fop fop = fopfactory.newFop(foUserAgent); + res[i] = new SAXResult(fop.getDefaultHandler()); + transformer.transform(src, res[i]); + } + + if (!preview) + { + Book book = new Book(); + for (int i = 0; i < renderer.getNumberOfPages(); ++i) + { + book.append(renderer.getPrintable(i), renderer.getPageFormat(i)); + } + PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet(); + + PrintService service = chooseService(dialog, options, pras); + if (service != null) + { + // PrintJobAttributeSet pjas = new HashPrintJobAttributeSet(); + DocAttributeSet das = new HashDocAttributeSet(); + // das.add( new NumberUp( 2 ) ); + Doc doc = new SimpleDoc(book, flavor, das); + DocPrintJob job = service.createPrintJob(); + try + { + job.print(doc, pras); + } + catch (PrintException pe) + { + pe.printStackTrace(); + } + } + } + } + + public static PrintService chooseService(boolean dialog, Hashtable options, + PrintRequestAttributeSet pras) + { + if (options.containsKey(FOP_DUPLEX_TYPE)) + { + pras.add((Sides) options.get(FOP_DUPLEX_TYPE)); + } + PrintService printService[] = PrintServiceLookup.lookupPrintServices(flavor, pras); + PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService(); + + boolean hasMandatory = options.containsKey(FOP_MANDATORY_PRINTER_NAME); + boolean hasPreferred = options.containsKey(FOP_PREFERRED_PRINTER_NAME); + String mandatoryName = (String) options.get(FOP_MANDATORY_PRINTER_NAME); + String preferredName = (String) options.get(FOP_PREFERRED_PRINTER_NAME); + PrintService mandatory = null; + PrintService preferred = null; + + if (hasPreferred || hasMandatory) + { + for (int n = 0; n < printService.length; n++) + { + if (hasMandatory) + { + if (printService[n].getName().equals(mandatoryName)) + { + mandatory = printService[n]; + break; + } + } + else if (hasPreferred) + { + if (printService[n].getName().equals(preferredName)) + { + preferred = printService[n]; + break; + } + } + } + } + // long toc = System.currentTimeMillis(); + // System.err.println( "PRINT FO INNER: " + ( toc - tic ) ); + PrintService service; + if (!dialog && !hasMandatory && !hasPreferred) + { + service = defaultService; + } + else if (hasMandatory) + { + if (mandatory == null) + { + JOptionPane.showMessageDialog(null, "A impressora " + mandatoryName + + " n\u00e3o est\u00e1 dispon\u00EDvel.", "Erro...", + JOptionPane.ERROR_MESSAGE); + service = null; + } + else + { + service = mandatory; + } + } + else if ((!dialog) && hasPreferred && preferred != null) + { + + // pras.add((Sides) options.get(FOP_DUPLEX_TYPE)); + service = preferred; + + } + else if (hasPreferred && preferred != null) + { + + // pras.add((Sides) options.get(FOP_DUPLEX_TYPE)); + service = ServiceUI.printDialog(null, 200, 200, printService, preferred, flavor, pras); + + } + else + { + if (printService == null || printService.length == 0) + { + JOptionPane.showMessageDialog(null, + "N\u00e3o existem impressoras dispon\u00edveis neste computador.", "Erro", + JOptionPane.ERROR_MESSAGE); + service = null; + } + else + { + service = ServiceUI.printDialog(null, 200, 200, printService, defaultService, + flavor, pras); + } + } + return service; + } + + // private static PreviewDialog createPreviewDialog(FOUserAgent foUserAgent) + // { + // final PreviewDialog frame = new PreviewDialog(foUserAgent); + // frame.validate(); + // frame.addWindowListener(new WindowAdapter() + // { + // public void windowClosed(WindowEvent we) + // { + // frame.setVisible(false); + // } + // }); + // // center window + // Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + // frame.setSize(screenSize); + // Dimension frameSize = frame.getSize(); + // + // /* + // * if( frameSize.height > screenSize.height ) { frameSize.height = + // * screenSize.height; } if( frameSize.width > screenSize.width ) { + // * frameSize.width = screenSize.width; } + // */ + // frame.setLocation((screenSize.width - frameSize.width) / 2, + // (screenSize.height - frameSize.height) / 2); + // return frame; + // } + + // private PreviewDialog viewFO(InputStream fo) throws IOException, + // FOPException, + // TransformerException + // { + // PreviewDialog frame = createPreviewDialog(foUserAgent); + // frame.setVisible(true); + // // foUserAgent.getRendererOverride().s + // + // + // renderer.setProgressListener(frame); + // renderer.setComponent(frame); + // frame.progress("A Preparar ..."); + // return frame; + // } + + public static void main(String arg[]) throws Exception + { +// PipedInputStream pis = new PipedInputStream(); +// final PipedOutputStream pos = new PipedOutputStream(pis); +// final FOPCreator creator = FOPCreator.getFOPCreator(); + System.out.println("Creating FO"); + + // JFileChooser chooser = new JFileChooser(); + // chooser.setDialogTitle("Select XML data file:"); + // int returnVal = chooser.showOpenDialog(null); + // String dataFile = null; + // if (returnVal == JFileChooser.APPROVE_OPTION) + // { + // dataFile = chooser.getSelectedFile().getAbsolutePath(); + // } + // chooser.setDialogTitle("Select XSL-FO template file:"); + // returnVal = chooser.showOpenDialog(null); + // String templateFile = null; + // if (returnVal == JFileChooser.APPROVE_OPTION) + // { + // templateFile = chooser.getSelectedFile().getAbsolutePath(); + // System.out.println(chooser.getSelectedFile().getAbsolutePath()); + // } + + // final String DATA = dataFile; + // final String TEMPLATE = templateFile; + +// final String DATA = "/home/jneto/Desktop/boletim.xml"; +// final String TEMPLATE = "/home/jneto/Desktop/boletim.xsl"; +// Thread t = new Thread() +// { +// public void run() +// { +// try +// { +// creator.createFOfromXML(new FileInputStream(DATA), +// new FileInputStream(TEMPLATE), pos); +// System.out.println("FO created"); +// } catch (Exception ex) +// { +// ex.printStackTrace(); +// } +// } +// }; +// t.start(); +// t.wait(2); + System.out.println("Starting to print"); + // Hashtable options = new Hashtable(); + // options.put(FOP_DUPLEX_TYPE, + // javax.print.attribute.standard.Sides.TUMBLE); + // new FOPPrinter().printFO(pis, false, true, options); + new FOPPrinter().printFO(new FileInputStream("/home/jneto/Desktop/carta1.fo"), true, + true); + System.out.println("DONE"); + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/FOPPrinterConstants.java b/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/FOPPrinterConstants.java new file mode 100644 index 00000000..995dca7e --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/FOPPrinterConstants.java @@ -0,0 +1,19 @@ +/* + * FOPPrinterConstants.java + * + * Created on 14 de Junho de 2005, 14:49 + */ + +package siprp.util.fop; + +/** + * FOP Printer options + * + * @author fpalma + */ +public interface FOPPrinterConstants +{ + public static final Object FOP_PREFERRED_PRINTER_NAME = new Integer( 1 ); + public static final Object FOP_MANDATORY_PRINTER_NAME = new Integer( 2 ); + public static final Object FOP_DUPLEX_TYPE = new Integer( 3 ); +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/Main.java b/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/Main.java new file mode 100644 index 00000000..d69e6a2f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/Main.java @@ -0,0 +1,38 @@ +package siprp.util.fop; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; + + +public class Main +{ + + /** + * @param args + */ + public static void main(String[] args) + { + + try + { + File userConfigFile = new File("/home/jneto/fopConf.xml"); + FOPPrinter.setUserConfig(userConfigFile); + FOPPrinter fp = FOPPrinter.getFOPPrinter(); + System.out.println(fp.getFopfactory().getFontBaseURL()); + fp.printFO(new FileInputStream("/home/jneto/test.fo"), true, true); + + + } catch (FileNotFoundException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Exception e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/PDFCreator.java b/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/PDFCreator.java new file mode 100644 index 00000000..a3fb3236 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/PDFCreator.java @@ -0,0 +1,190 @@ +/* + * PDFCreator.java + * + * Created on 19 de Abril de 2006, 18:20 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.util.fop; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; + +import javax.swing.JFileChooser; +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamSource; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.xmlgraphics.util.MimeConstants; + + +/** + * PDFCreator creates PDF's using FO. + * + * @author Frederico Palma + * @author João Neto + * @version %I%, %G% + */ +public class PDFCreator +{ + // private final Translator translator = new SecureResourceBundle( null ); + + private static final Object LOCK = new Object(); + + private static PDFCreator pdfCreator; + FopFactory fopFactory; + + private static File userConfig; + + + public static PDFCreator getPDFCreator() + { + synchronized (LOCK) + { + if (pdfCreator == null) + { + pdfCreator = new PDFCreator(); + } + } + return pdfCreator; + } + + public static File getUserConfig() + { + return userConfig; + } + + public static void setUserConfig(File userConfig) + { + PDFCreator.userConfig = userConfig; + } + + public static void main(String arg[]) throws Exception + { + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final FOPCreator creator = FOPCreator.getFOPCreator(); + System.out.println("Creating FO"); + + JFileChooser chooser = new JFileChooser(); + chooser.setDialogTitle("Select XML data file:"); + int returnVal = chooser.showOpenDialog(null); + String dataFile = null; + if (returnVal == JFileChooser.APPROVE_OPTION) + { + dataFile = chooser.getSelectedFile().getAbsolutePath(); + } + chooser.setDialogTitle("Select XSL-FO template file:"); + returnVal = chooser.showOpenDialog(null); + String templateFile = null; + if (returnVal == JFileChooser.APPROVE_OPTION) + { + templateFile = chooser.getSelectedFile().getAbsolutePath(); + System.out.println(chooser.getSelectedFile().getAbsolutePath()); + } + + final String DATA = dataFile; + final String TEMPLATE = templateFile; + creator.createFOfromXML(new FileInputStream(DATA), new FileInputStream(TEMPLATE), baos); + // Thread t = new Thread() { + // public void run() + // { + // try + // { + // creator.createFOfromXML( new FileInputStream( DATA ), + // new FileInputStream( TEMPLATE ), baos ); + // System.out.println( "FO created" ); + // } + // catch( Exception ex ) + // { + // ex.printStackTrace(); + // } + // } }; + // t.start(); + // Thread.currentThread().sleep( 2 ); + System.out.println("Starting to print"); + // options.put( FOP_DUPLEX_TYPE, + // javax.print.attribute.standard.Sides.TUMBLE ); + byte pdf[] = PDFCreator.getPDFCreator().createPdfFromFo(baos.toByteArray()); + // new FOPPrinter().printFO( new FileInputStream( "c:\\simplecol.fo" ), + // true, false ); + File pdfFile = new File("/home/jneto/Desktop/teste.pdf"); + File foFile = new File("/home/jneto/Desktop/teste.fo"); + pdfFile.createNewFile(); + foFile.createNewFile(); + FileOutputStream fos = new FileOutputStream(pdfFile); + FileOutputStream fofos = new FileOutputStream(foFile); + fos.write(pdf); + fofos.write(baos.toByteArray()); + fos.close(); + fofos.close(); + System.out.println("DONE"); + } + +// /** Creates a new instance of PDFCreator */ +// private PDFCreator() +// { +// fopFactory = FopFactory.newInstance(); +// } + + /** Creates a new instance of PDFCreator */ + private PDFCreator() + { + fopFactory = FopFactory.newInstance(); + if (userConfig != null) + { + try + { + fopFactory.setUserConfig(userConfig); + } catch (Exception e) + { + System.err.println("Ignoring invalid user config file"); + e.printStackTrace(); + } + } + } + + + + /** + * Creates PDF content as an array of bytes, given FO content as an array of + * bytes. + * + * @param fo + * the byte[] with the FO content to convert + * @return the PDF content + * @throws Exception + * if the conversion fails + * + */ + public byte[] createPdfFromFo(byte[] fo) throws Exception + { + + fopFactory.setStrictValidation(false); + + ByteArrayOutputStream pdf = new ByteArrayOutputStream(); + TransformerFactory factory = TransformerFactory.newInstance(); + Transformer transformer = factory.newTransformer(); + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + + Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, pdf); + + Source src = new StreamSource(new ByteArrayInputStream(fo)); + Result res = new SAXResult(fop.getDefaultHandler()); + + transformer.transform(src, res); + + return pdf.toByteArray(); + + } +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/fop.xconf b/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/fop.xconf new file mode 100644 index 00000000..c2022028 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/util/fop/fop.xconf @@ -0,0 +1,162 @@ + + + + + + + + + + false + + + + . + + + 72 + + 72 + + + + + + + + + + + flate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/SIPRPSoft/src/siprp/web/WebUpdater.java b/branches/SIPRP/SIPRPSoft/src/siprp/web/WebUpdater.java new file mode 100644 index 00000000..36109d56 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp/web/WebUpdater.java @@ -0,0 +1,1232 @@ +/* + * WebUpdater.java + * + * Created on 27 de Outubro de 2004, 15:54 + */ + +package siprp.web; + +import java.awt.Color; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.event.ActionListener; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.Statement; +import java.util.Calendar; +import java.util.Properties; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.event.DocumentListener; + +//import siprp.*; +//import siprp.clientes.*; + +/** + * + * @author fpalma + */ +public class WebUpdater extends JFrame + implements ActionListener, Runnable, DocumentListener +{ + private Connection softwareConnection; + private Connection webConnection; + + public static final String GET_ULTIMA_ACTUALIZACAO = "SELECT stamp FROM actualizacao"; + + public static final String GET_EMPRESAS = + "SELECT id, designacao_social, perfil_1, perfil_2, codigo_1, codigo_2, " + + "codigo_3, cae, contribuinte, seguranca_social, actividade, servicos, morada, " + + "localidade, codigo_postal, distrito, concelho, inactivo, contacto_1 " + + "FROM empresas WHERE actualizacao >= "; + + public static final String GET_EMAIL = + "SELECT email FROM contactos WHERE id = "; + + public static final String GET_ESTABELECIMENTOS = + "SELECT id, empresa_id, nome, contacto, morada, localidade, codigo_postal, inactivo " + + "FROM estabelecimentos WHERE actualizacao >= "; + + public static final String GET_TRABALHADORES = + "SELECT id, nome, sexo, data_nascimento, numero_mecanografico, categoria, estabelecimento_id, data_demissao, inactivo " + + "FROM trabalhadores WHERE actualizacao >= "; + + public static final String GET_CONTACTO = + "SELECT nome, telefone, telemovel, fax, email, cargo FROM contactos WHERE id = "; + + public static final String GET_MARCACOES_ESTABELECIMENTO = + "SELECT id, data, realizada, data_relatorio FROM marcacoes_estabelecimento " + + "WHERE estabelecimento_id = "; + + public static final String GET_EXAMES_TRABALHADOR = + "SELECT id, data, realizada, data_relatorio FROM marcacoes_trabalhador " + + "WHERE tipo = 0 and trabalhador_id = ?trabalhador_id " + + "ORDER BY data"; + + public static final String GET_CONSULTAS_TRABALHADOR = + "SELECT id, data, realizada, data_relatorio FROM marcacoes_trabalhador " + + "WHERE tipo = 1 and trabalhador_id = ?trabalhador_id " + + "ORDER BY data"; + + public static final String GET_ID_FICHA_APTIDAO = + "SELECT MAX(id) FROM exames WHERE trabalhador_id = ?trabalhador_id AND inactivo <> 'y'"; + + public static final String GET_DADOS_FICHA_APTIDAO = + "SELECT data, resultado FROM exames WHERE id = ?id"; + + public static final String DELETE_TRABALHADOR = + "DELETE FROM trabalhadores WHERE id = "; + + public static final String DELETE_TRABALHADORES_BY_ESTABELECIMENTO = + "DELETE FROM trabalhadores WHERE estabelecimento_id = "; + + public static final String DELETE_ESTABELECIMENTO = + "DELETE FROM estabelecimentos WHERE id = "; + + public static final String DELETE_ESTABELECIMENTOS_BY_EMPRESA = + "DELETE FROM estabelecimentos WHERE empresa_id = "; + + public static final String DELETE_TRABALHADORES_BY_EMPRESA = + "DELETE FROM trabalhadores WHERE estabelecimento_id IN ( SELECT id FROM estabelecimentos WHERE empresa_id = ?empresa_id )"; + + public static final String DELETE_EMPRESA = + "DELETE FROM empresas WHERE id = "; + + public static final String CREATE_EMPRESA = + "INSERT INTO empresas(id) VALUES( ?id )"; + + public static final String CREATE_ESTABELECIMENTO = + "INSERT INTO estabelecimentos(id) VALUES( ?id )"; + + public static final String CREATE_TRABALHADOR = + "INSERT INTO trabalhadores(id) VALUES( ?id )"; + + public static final String UPDATE_EMPRESA = + "UPDATE empresas SET morada = ?morada, codigo_postal = ?codigo_postal, " + + "localidade = ?localidade, distrito = ?distrito, concelho = ?concelho, " + + "perfil_1 = ?perfil_1, perfil_2 = ?perfil_2, codigo = ?codigo, cae = ?cae, " + + "contribuinte = ?contribuinte, seguranca_social = ?seguranca_social, " + + "actividade = ?actividade, servicos = ?servicos, designacao_social = ?designacao_social, " + + "email = ?email " + + "WHERE id = ?id"; + + public static final String UPDATE_ESTABELECIMENTO = + "UPDATE estabelecimentos SET empresa_id = ?empresa_id, morada = ?morada, " + + "codigo_postal = ?codigo_postal, localidade = ?localidade, " + + "ultima_visita = ?ultima_visita, realizada = ?realizada, " + + "proxima_visita = ?proxima_visita, nome = ?nome " + + "WHERE id = ?id"; + + public static final String UPDATE_TRABALHADOR = + "UPDATE trabalhadores SET sexo = ?sexo, data_nascimento = ?data_nascimento, " + + "numero_mecanografico = ?numero_mecanografico, categoria = ?categoria, " + + "ultimo_exame = ?ultimo_exame, realizado = ?realizado, proximo_exame = ?proximo_exame, " + + "ultima_consulta = ?ultima_consulta, realizada = ?realizada, " + + "proxima_consulta = ?proxima_consulta, nome = ?nome, " + + "resultado = ?resultado, data_ficha = ?data_ficha, " + + "estabelecimento_id = ?estabelecimento_id " + + "WHERE id = ?id"; + + public static final String UPDATE_ACTUALIZACAO = "UPDATE actualizacao SET stamp = "; + + + public static final String PROPERTIES_FILE = "updtprop.txt"; + public static final String PROP_LOCAL = "interno"; + public static final String PROP_LOCAL_U = "iuser"; + public static final String PROP_LOCAL_P = "ipasswd"; + public static final String PROP_REMOTE = "externo"; + public static final String PROP_REMOTE_U = "euser"; + public static final String PROP_REMOTE_P = "epasswd"; + public static final String PROP_INTERVAL = "intervalo"; + + + protected Vector deletes; + protected Vector updates; + + protected Thread updateThread; + + protected JTextField servidorInternoText; + protected JTextField servidorExternoText; + protected JTextField intervaloText; + protected JTextField ultimaActualizacaoText; + protected JTextField proximaActualizacaoText; + protected JButton actionButton; + protected JButton saveButton; + protected JButton cancelButton; + protected JLabel stateLabel; + + protected boolean running; + protected String servidorInterno; + protected String servidorExterno; + protected String internalUser; + protected String internalPassword; + protected String externalUser; + protected String externalPassword; + protected long intervalo; + + /** Creates a new instance of WebUpdater */ + public WebUpdater() + { + deletes = new Vector(); + updates = new Vector(); + running = false; + servidorInterno = "ws_fpalma"; + servidorExterno = "localhost:5436"; + intervalo = 10; + setupComponents(); + } + + protected void setupComponents() + { + setSize( 500, 200 ); + setResizable( false ); + setTitle( "Actualiza\u00e7\u00e3o do Site" ); + JLabel servidorInternoLabel = new JLabel( "Servidor Interno" ); + servidorInternoText = new JTextField(); + servidorInternoText.setPreferredSize( new Dimension( 120, 20 ) ); + servidorInternoText.setForeground( Color.red ); + JLabel servidorExternoLabel = new JLabel( "Servidor Externo" ); + servidorExternoText = new JTextField(); + servidorExternoText.setPreferredSize( new Dimension( 120, 20 ) ); + servidorExternoText.setForeground( Color.red ); + JLabel intervaloLabel = new JLabel( "Intervalo de Actualiza\u00e7\u00e3o (minutos)" ); + intervaloText = new JTextField(); + intervaloText.setPreferredSize( new Dimension( 50, 20 ) ); + JLabel ultimaActualizacaoLabel = new JLabel( "\u00daltima Actualiza\u00e7\u00e3o" ); + ultimaActualizacaoText = new JTextField(); + ultimaActualizacaoText.setPreferredSize( new Dimension( 120, 20 ) ); + ultimaActualizacaoText.setEditable( false ); + JLabel proximaActualizacaoLabel = new JLabel( "Pr\u00f3xima Actualiza\u00e7\u00e3o" ); + proximaActualizacaoText = new JTextField(); + proximaActualizacaoText.setPreferredSize( new Dimension( 120, 20 ) ); + proximaActualizacaoText.setEditable( false ); + actionButton = new JButton( "Executar" ); + saveButton = new JButton( "Guardar Altera\u00e7\u00f5es" ); + saveButton.setEnabled( false ); + cancelButton = new JButton( "Cancelar Altera\u00e7\u00f5es" ); + cancelButton.setEnabled( false ); + stateLabel = new JLabel( " " ); + JPanel buttonPanel = new JPanel(); + JPanel pad = new JPanel(); + pad.setPreferredSize( new Dimension( 120, 20 ) ); + + Container container = getContentPane(); + GridBagLayout gridbag = new GridBagLayout(); + container.setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); +// constraints.anchor = GridBagConstraints.EAST; + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 0; + constraints.gridheight = 1; + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( servidorInternoLabel, constraints ); + gridbag.setConstraints( servidorExternoLabel, constraints ); + gridbag.setConstraints( intervaloLabel, constraints ); + gridbag.setConstraints( ultimaActualizacaoLabel, constraints ); + gridbag.setConstraints( proximaActualizacaoLabel, constraints ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( servidorInternoText, constraints ); + gridbag.setConstraints( servidorExternoText, constraints ); + gridbag.setConstraints( ultimaActualizacaoText, constraints ); + gridbag.setConstraints( proximaActualizacaoText, constraints ); + gridbag.setConstraints( buttonPanel, constraints ); + gridbag.setConstraints( stateLabel, constraints ); + + constraints.weightx = 0.5; + constraints.gridwidth = 1; + gridbag.setConstraints( intervaloText, constraints ); + + constraints.weightx = 0.5; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( pad, constraints ); + + container.add( servidorInternoLabel ); + container.add( servidorInternoText ); + container.add( servidorExternoLabel ); + container.add( servidorExternoText ); + container.add( intervaloLabel ); + container.add( intervaloText ); + container.add( pad ); + container.add( ultimaActualizacaoLabel ); + container.add( ultimaActualizacaoText ); + container.add( proximaActualizacaoLabel ); + container.add( proximaActualizacaoText ); + container.add( buttonPanel ); + container.add( stateLabel ); + + buttonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) ); + buttonPanel.add( saveButton ); + buttonPanel.add( cancelButton ); + buttonPanel.add( actionButton ); + + actionButton.addActionListener( this ); + stateLabel.setText( "Parado" ); + stateLabel.setForeground( Color.red ); + +// servidorInternoText.setText( servidorInterno ); +// servidorExternoText.setText( servidorExterno ); +// intervaloText.setText( "" + intervalo ); + reload(); + + servidorInternoText.getDocument().addDocumentListener( this ); + servidorExternoText.getDocument().addDocumentListener( this ); + intervaloText.getDocument().addDocumentListener( this ); + saveButton.addActionListener( this ); + cancelButton.addActionListener( this ); + } + + public void actionPerformed(java.awt.event.ActionEvent actionEvent) + { + Object source = actionEvent.getSource(); + if( actionButton.equals( source ) ) + { + if( running ) + { + running = false; + updateThread.interrupt(); + actionButton.setText( "Executar" ); + stateLabel.setText( "Parado" ); + stateLabel.setBackground( Color.red ); + } + else + { + updateThread = new Thread( this ); + updateThread.start(); + actionButton.setText( "Parar" ); + } + } + else if( saveButton.equals( source ) ) + { + save(); + saveButton.setEnabled( false ); + cancelButton.setEnabled( false ); + } + else if( cancelButton.equals( source ) ) + { + reload(); + saveButton.setEnabled( false ); + cancelButton.setEnabled( false ); + } + } + + + public void changedUpdate(javax.swing.event.DocumentEvent documentEvent) + { + saveButton.setEnabled( true ); + cancelButton.setEnabled( true ); + } + + public void insertUpdate(javax.swing.event.DocumentEvent documentEvent) + { + saveButton.setEnabled( true ); + cancelButton.setEnabled( true ); + } + + public void removeUpdate(javax.swing.event.DocumentEvent documentEvent) + { + saveButton.setEnabled( true ); + cancelButton.setEnabled( true ); + } + + protected void save() + { + Properties props = new Properties(); + try + { + OutputStream out = new FileOutputStream( PROPERTIES_FILE ); + String auxSI = servidorInternoText.getText(); + String auxSE = servidorExternoText.getText(); + String auxI = intervaloText.getText();; + if( auxSI == null || auxSI.length() == 0 || + auxSE == null || auxSE.length() == 0 || + auxI == null || auxI.length() == 0 ) + { + throw new Exception( "" ); + } + intervalo = Long.parseLong( auxI ); + servidorInterno = auxSI; + servidorExterno = auxSE; + props.setProperty( PROP_LOCAL, servidorInterno ); + props.setProperty( PROP_LOCAL_U, internalUser ); + props.setProperty( PROP_LOCAL_P, internalPassword ); + props.setProperty( PROP_REMOTE, servidorExterno ); + props.setProperty( PROP_REMOTE_U, externalUser ); + props.setProperty( PROP_REMOTE_P, externalPassword ); + props.setProperty( PROP_INTERVAL, "" + intervalo ); + props.store( out, "Configura\u00e7\u00e3o da Ferramenta de Actualiza\u00e7\u00e3o da SIPRP" ); + out.close(); + } + catch( Exception ex ) + { + JOptionPane.showMessageDialog( this, "Erro a gravar altera\u00e7\u00f5es", "Erro", + JOptionPane.ERROR_MESSAGE ); + } + } + + protected void reload() + { + Properties props = new Properties(); + try + { + +System.out.println( new File( PROPERTIES_FILE ) ); + InputStream in = new FileInputStream( PROPERTIES_FILE ); + props.load( in ); + internalUser = props.getProperty( PROP_LOCAL_U ); + internalPassword = props.getProperty( PROP_LOCAL_P ); + externalUser = props.getProperty( PROP_REMOTE_U ); + externalPassword = props.getProperty( PROP_REMOTE_P ); + + String aux; + aux = props.getProperty( PROP_LOCAL ); + if( aux != null && aux.length() > 0 ) + { + servidorInterno = aux; + } + aux = props.getProperty( PROP_REMOTE ); + if( aux != null && aux.length() > 0 ) + { + servidorExterno = aux; + } + aux = props.getProperty( PROP_INTERVAL ); + if( aux != null && aux.length() > 0 ) + { + try + { + intervalo = Long.parseLong( aux ); + } + catch( NumberFormatException nfe ) + { + } + } + + } + catch( Exception ex ) + { + JOptionPane.showMessageDialog( this, "Erro a carregar os dados", "Erro", + JOptionPane.ERROR_MESSAGE ); + } + servidorInternoText.setText( servidorInterno ); + servidorExternoText.setText( servidorExterno ); + intervaloText.setText( "" + intervalo ); + } + + public void run() + { + running = true; + while( true ) + { + boolean erro = false; + if( !running ) + { + return; + } + proximaActualizacaoText.setText( "" ); + try + { + stateLabel.setText( "A Actualizar" ); + stateLabel.setForeground( Color.green ); + doUpdates(); + java.util.Date date = new java.util.Date(); + ultimaActualizacaoText.setText( date.toString() ); + } + catch( Exception ex ) + { + erro = true; + stateLabel.setText( "ERRO A ACTUALIZAR!!!" ); + stateLabel.setForeground( Color.red ); + } + if( !running ) + { + return; + } + try + { + if( !erro ) + { + stateLabel.setText( "Em Intervalo (" + intervalo + " minuto" + ( intervalo > 1 ? "s" : "" ) + ")" ); + stateLabel.setForeground( Color.black ); + } + Calendar cal = Calendar.getInstance(); + cal.add( Calendar.MINUTE, (int)intervalo ); + proximaActualizacaoText.setText( "" + cal.getTime() ); + Thread.sleep( intervalo * 60000 ); + } + catch( InterruptedException iex ) + { + } + } + } + + protected void doUpdates() + throws Exception + { + try + { + connect(); + getData(); + updateData(); + } + catch( Exception ex ) + { + ex.printStackTrace(); + throw ex; + } + + } + + /** + * @param args the command line arguments + */ + public static void main( String[] args ) + throws Exception + { + WebUpdater updater = new WebUpdater(); + updater.setVisible( true ); + } + + protected void connect() + throws Exception + { + Class.forName( "org.postgresql.Driver" ); + Class.forName( "com.mysql.jdbc.Driver" ); + webConnection = DriverManager.getConnection( "jdbc:postgresql://" + servidorExterno + "/siprp", externalUser, externalPassword ); + webConnection.setAutoCommit( true ); + softwareConnection = DriverManager.getConnection( "jdbc:mysql://" + servidorInterno + "/siprp", internalUser, internalPassword ); +// softwareConnection = DriverManager.getConnection( "jdbc:postgresql://" + servidorInterno + "/siprp", internalUser, internalPassword ); + softwareConnection.setAutoCommit( true ); + } + + protected void getData() + throws Exception + { + Object r[][]; + r = doQuery( webConnection, GET_ULTIMA_ACTUALIZACAO ); + String actualizacao = "'" + r[0][0] + "'"; + Calendar cal = Calendar.getInstance(); + //int hour = cal.get( Calendar.HOUR_OF_DAY ); + //if( hour < 3 && hour > 1 ) + //{ + // actualizacao = "'1970-01-01 00:00:00'"; + //} + doQuery(softwareConnection, "DELETE FROM actualizacao;", true); + doQuery(softwareConnection, "INSERT INTO actualizacao(hora) VALUES(now());", true); + readTrabalhadores( actualizacao ); + readEstabelecimentos( actualizacao ); + readEmpresas( actualizacao ); + } + + protected void updateData() + throws Exception + { + System.out.println( "DELETES" ); + for( int d = 0; d < deletes.size(); d++ ) + { + try + { + System.out.println( deletes.elementAt( d ).toString() ); + doQuery( webConnection, deletes.elementAt( d ).toString(), true ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + System.out.println( "" ); + System.out.println( "UPDATES" ); + for( int u = 0; u < updates.size(); u++ ) + { + String queries[] = ( String[] ) updates.elementAt( u ); + System.out.println( queries[ 0 ] + "\n " + queries[ 1 ] ); + try + { + doQuery( webConnection, queries[ 0 ], true ); + } + catch( Exception ex ) + { + System.out.println( " ERRO DE INSERT" ); + } + try + { + doQuery( webConnection, queries[ 1 ], true ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + Object r[][] = doQuery( softwareConnection, "SELECT hora FROM actualizacao;" ); + String actualizacao = "'" + r[0][0] + "'"; + doQuery( webConnection, UPDATE_ACTUALIZACAO + actualizacao, true ); + } + + protected void readTrabalhadores( String actualizacao ) + throws Exception + { + Object trabalhadores[][] = doQuery( softwareConnection, GET_TRABALHADORES + actualizacao ); + for( int t = 0; t < trabalhadores.length; t++ ) + { + for( int c = 0; c < trabalhadores[ t ].length; c++ ) + { + if( trabalhadores[ t ][ c ] instanceof String ) + { + trabalhadores[ t ][ c ] = unicodeToHTML( (String) trabalhadores[ t ][ c ] ); + } + } + int id = ( ( Number ) trabalhadores[t][0] ).intValue(); + boolean inactivo = "y".equals( trabalhadores[ t ][ trabalhadores[ t ].length - 1 ] ) || + trabalhadores[ t ][ trabalhadores[ t ].length - 2 ] != null; + if( inactivo ) + { + deletes.add( DELETE_TRABALHADOR + id ); + continue; + } + String queries[] = new String[ 2 ]; + updates.insertElementAt( queries, 0 ); + queries[ 0 ] = CREATE_TRABALHADOR.replaceFirst( "[?]id", "" + id ); + String update = UPDATE_TRABALHADOR.replaceFirst( "[?]id", "" + id ); + + String nome = "'" + trabalhadores[ t ][ 1 ] + "'"; + update = update.replaceFirst( "[?]nome", nome ); + String sexo = "'" + trabalhadores[ t ][ 2 ] + "'"; + update = update.replaceFirst( "[?]sexo", sexo ); + String dataNasc; + if( trabalhadores[ t ][ 3 ] != null ) + { + dataNasc = "'" + trabalhadores[ t ][ 3 ] + "'"; + } + else + { + dataNasc = "''"; + } + update = update.replaceFirst( "[?]data_nascimento", dataNasc ); + String numeroMecanografico; + if( trabalhadores[ t ][ 4 ] != null ) + { + numeroMecanografico = "'" + trabalhadores[ t ][ 4 ] + "'"; + } + else + { + numeroMecanografico = "''"; + } + update = update.replaceFirst( "[?]numero_mecanografico", numeroMecanografico ); + String categoria; + if( trabalhadores[ t ][ 5 ] != null ) + { + categoria = "'" + trabalhadores[ t ][ 5 ] + "'"; + } + else + { + categoria = "''"; + } + update = update.replaceFirst( "[?]categoria", categoria ); + int estabelecimentoID = ( ( Number ) trabalhadores[t][6] ).intValue(); + update = update.replaceFirst( "[?]estabelecimento_id", "" + estabelecimentoID ); + Object exames[][] = doQuery( softwareConnection, + GET_EXAMES_TRABALHADOR.replaceFirst( "[?]trabalhador_id", ""+id ) ); + + if( exames != null && exames.length > 0 ) + { + java.util.Date dataExame2 = ( java.util.Date ) exames[ exames.length - 1 ] [ 1 ]; + String realizado2 = ( String ) exames[ exames.length - 1 ][ 2 ]; + java.util.Date dataExame1; + String realizado1; + if( exames.length >= 2 ) + { + dataExame1 = ( java.util.Date ) exames[ exames.length - 2 ] [ 1 ]; + realizado1 = ( String ) exames[ exames.length - 2 ][ 2 ]; + } + else + { + dataExame1 = dataExame2; + realizado1 = realizado2; + } + if( "y".equals( realizado2 ) ) + { + update = update.replaceFirst( "[?]ultimo_exame", "'" + dataExame2 + "'" ); + update = update.replaceFirst( "[?]realizado", "'" + realizado2 + "'" ); + update = update.replaceFirst( "[?]proximo_exame", "null" ); + } + else if( new java.util.Date().after( dataExame2 ) ) + { + update = update.replaceFirst( "[?]ultimo_exame", "'" + dataExame2 + "'" ); + update = update.replaceFirst( "[?]realizado", "'" + realizado2 + "'" ); + update = update.replaceFirst( "[?]proximo_exame", "null" ); + } + else + { + update = update.replaceFirst( "[?]proximo_exame", "'" + dataExame2 + "'" ); + if( !dataExame2.equals( dataExame1 ) ) + { + update = update.replaceFirst( "[?]ultimo_exame", "'" + dataExame1 + "'" ); + update = update.replaceFirst( "[?]realizado", "'" + realizado1 + "'" ); + } + else + { + update = update.replaceFirst( "[?]ultimo_exame", "null" ); + update = update.replaceFirst( "[?]realizado", "null" ); + } + } + } + else + { + update = update.replaceFirst( "[?]ultimo_exame", "null" ); + update = update.replaceFirst( "[?]realizado", "null" ); + update = update.replaceFirst( "[?]proximo_exame", "null" ); + } + Object consultas[][] = doQuery( softwareConnection, + GET_CONSULTAS_TRABALHADOR.replaceFirst( "[?]trabalhador_id", ""+id ) ); + + if( consultas != null && consultas.length > 0 ) + { + java.util.Date dataConsulta2 = ( java.util.Date ) consultas[ consultas.length - 1 ] [ 1 ]; + String realizada2 = ( String ) consultas[ consultas.length - 1 ][ 2 ]; + java.util.Date dataConsulta1; + java.util.Date dataRelatorio1; + java.util.Date dataRelatorio2 = (java.util.Date) consultas[ consultas.length - 1 ][ 3 ]; + String realizada1; + if( consultas.length >= 2 ) + { + dataConsulta1 = ( java.util.Date ) consultas[ consultas.length - 2 ] [ 1 ]; + realizada1 = ( String ) consultas[ consultas.length - 2 ][ 2 ]; + dataRelatorio1 = (java.util.Date) consultas[ consultas.length - 2 ][ 3 ]; + } + else + { + dataConsulta1 = dataConsulta2; + realizada1 = realizada2; + dataRelatorio1 = dataRelatorio2; + } + if( "y".equals( realizada2 ) ) + { + update = update.replaceFirst( "[?]ultima_consulta", "'" + dataConsulta2 + "'" ); + update = update.replaceFirst( "[?]realizada", "'" + realizada2 + "'" ); + update = update.replaceFirst( "[?]proxima_consulta", "null" ); + if( dataRelatorio2 != null ) + { + update = update.replaceFirst( "[?]data_ficha", "'" + dataRelatorio2 + "'" ); + } + else + { + update = update.replaceFirst( "[?]data_ficha", "null" ); + } + } + else if( new java.util.Date().after( dataConsulta2 ) ) + { + update = update.replaceFirst( "[?]ultima_consulta", "'" + dataConsulta2 + "'" ); + update = update.replaceFirst( "[?]realizada", "'" + realizada2 + "'" ); + update = update.replaceFirst( "[?]proxima_consulta", "null" ); + if( dataRelatorio2 != null ) + { + update = update.replaceFirst( "[?]data_ficha", "'" + dataRelatorio2 + "'" ); + } + else + { + update = update.replaceFirst( "[?]data_ficha", "null" ); + } + } + else + { + update = update.replaceFirst( "[?]proxima_consulta", "'" + dataConsulta2 + "'" ); + if( !dataConsulta2.equals( dataConsulta1 ) ) + { + update = update.replaceFirst( "[?]ultima_consulta", "'" + dataConsulta1 + "'" ); + update = update.replaceFirst( "[?]realizada", "'" + realizada1 + "'" ); + if( dataRelatorio1 != null ) + { + update = update.replaceFirst( "[?]data_ficha", "'" + dataRelatorio1 + "'" ); + } + else + { + update = update.replaceFirst( "[?]data_ficha", "null" ); + } + } + else + { + update = update.replaceFirst( "[?]ultima_consulta", "null" ); + update = update.replaceFirst( "[?]realizada", "null" ); + update = update.replaceFirst( "[?]data_ficha", "null" ); + } + } + } + else + { + update = update.replaceFirst( "[?]ultima_consulta", "null" ); + update = update.replaceFirst( "[?]realizada", "null" ); + update = update.replaceFirst( "[?]proxima_consulta", "null" ); + update = update.replaceFirst( "[?]data_ficha", "null" ); + + } + Object fichas[][] = doQuery( softwareConnection, + GET_ID_FICHA_APTIDAO.replaceFirst( "[?]trabalhador_id", ""+id ) ); + if( fichas != null && fichas.length > 0 && fichas[0].length > 0 && fichas[0][0] != null ) + { + Integer idFicha = (Integer)fichas[0][0]; + fichas = doQuery( softwareConnection, + GET_DADOS_FICHA_APTIDAO.replaceFirst( "[?]id", "" + idFicha ) ); + java.util.Date dataFicha = ( java.util.Date ) fichas[ 0 ][ 0 ]; + /*if( dataFicha != null ) + { + update = update.replaceFirst( "[?]data_ficha", "null" ); + } + else + { + update = update.replaceFirst( "[?]data_ficha", "'" + dataFicha + "'" ); + }*/ + Integer resultadoFicha = (Integer) fichas[ 0 ][ 1 ]; + if( resultadoFicha != null ) + { + switch( resultadoFicha.intValue() ) + { + case 1: + update = update.replaceFirst( "[?]resultado", "'Apto'" ); + break; + case 2: + update = update.replaceFirst( "[?]resultado", "'Apto Condicionalmente'" ); + break; + case 3: + update = update.replaceFirst( "[?]resultado", "'Inapto Temporariamente'" ); + break; + case 4: + update = update.replaceFirst( "[?]resultado", "'Inapto Definitivamente'" ); + break; + default: + update = update.replaceFirst( "[?]resultado", "null" ); + } + } + else + { + update = update.replaceFirst( "[?]resultado", "null" ); + } + } + else + { + update = update.replaceFirst( "[?]data_ficha", "null" ); + update = update.replaceFirst( "[?]resultado", "null" ); + } + + queries[ 1 ] = update; + + } + } + + protected void readEstabelecimentos( String actualizacao ) + throws Exception + { + Object estabelecimentos[][] = doQuery( softwareConnection, GET_ESTABELECIMENTOS + actualizacao ); + //id, empresa_id, nome, contacto, inactivo + for( int t = 0; t < estabelecimentos.length; t++ ) + { + for( int c = 0; c < estabelecimentos[ t ].length; c++ ) + { + if( estabelecimentos[ t ][ c ] instanceof String ) + { + estabelecimentos[ t ][ c ] = unicodeToHTML( (String) estabelecimentos[ t ][ c ] ); + } + } + int id = ( ( Number ) estabelecimentos[t][0] ).intValue(); + boolean inactivo = "y".equals( estabelecimentos[ t ][ estabelecimentos[ t ].length - 1 ] ); + if( inactivo ) + { + deletes.add( DELETE_TRABALHADORES_BY_ESTABELECIMENTO + id ); + deletes.add( DELETE_ESTABELECIMENTO + id ); + continue; + } + String queries[] = new String[ 2 ]; + updates.insertElementAt( queries, 0 ); + queries[ 0 ] = CREATE_ESTABELECIMENTO.replaceFirst( "[?]id", "" + id ); + String update = UPDATE_ESTABELECIMENTO.replaceFirst( "[?]id", "" + id ); + + int empresaID = ( ( Number ) estabelecimentos[t][1] ).intValue(); + update = update.replaceFirst( "[?]empresa_id", "" + empresaID ); + String nome = "'" + estabelecimentos[ t ][ 2 ] + "'"; + update = update.replaceFirst( "[?]nome", nome ); + String morada; + if( estabelecimentos[ t ][ 4 ] != null ) + { + morada = "'" + estabelecimentos[ t ][ 4 ] + "'"; + } + else + { + morada = "''"; + } + update = update.replaceFirst( "[?]morada", morada ); + String localidade; + if( estabelecimentos[ t ][ 5 ] != null ) + { + localidade = "'" + estabelecimentos[ t ][ 5 ] + "'"; + } + else + { + localidade = "''"; + } + update = update.replaceFirst( "[?]localidade", localidade ); + String codigoPostal; + if( estabelecimentos[ t ][ 6 ] != null ) + { + codigoPostal = "'" + estabelecimentos[ t ][ 6 ] + "'"; + } + else + { + codigoPostal = "''"; + } + update = update.replaceFirst( "[?]codigo_postal", codigoPostal ); + + Object marcacoes[][] = doQuery( softwareConnection, + GET_MARCACOES_ESTABELECIMENTO +id ); + + if( marcacoes != null && marcacoes.length > 0 ) + { + java.util.Date dataConsulta2 = ( java.util.Date ) marcacoes[ marcacoes.length - 1 ] [ 1 ]; + String realizada2 = ( String ) marcacoes[ marcacoes.length - 1 ][ 2 ]; + java.util.Date dataConsulta1; + String realizada1; + if( marcacoes.length >= 2 ) + { + dataConsulta1 = ( java.util.Date ) marcacoes[ marcacoes.length - 2 ] [ 1 ]; + realizada1 = ( String ) marcacoes[ marcacoes.length - 2 ][ 2 ]; + } + else + { + dataConsulta1 = dataConsulta2; + realizada1 = realizada2; + } + if( "y".equals( realizada2 ) ) + { + update = update.replaceFirst( "[?]ultima_visita", "'" + dataConsulta2 + "'" ); + update = update.replaceFirst( "[?]realizada", "'" + realizada2 + "'" ); + update = update.replaceFirst( "[?]proxima_visita", "null" ); + } + else if( new java.util.Date().after( dataConsulta2 ) ) + { + update = update.replaceFirst( "[?]ultima_visita", "'" + dataConsulta2 + "'" ); + update = update.replaceFirst( "[?]realizada", "'" + realizada2 + "'" ); + update = update.replaceFirst( "[?]proxima_visita", "null" ); + } + else + { + update = update.replaceFirst( "[?]proxima_visita", "'" + dataConsulta2 + "'" ); + if( !dataConsulta2.equals( dataConsulta1 ) ) + { + update = update.replaceFirst( "[?]ultima_visita", "'" + dataConsulta1 + "'" ); + update = update.replaceFirst( "[?]realizada", "'" + realizada2 + "'" ); + } + else + { + update = update.replaceFirst( "[?]ultima_visita", "null" ); + update = update.replaceFirst( "[?]realizada", "null" ); + } + } + } + else + { + update = update.replaceFirst( "[?]ultima_visita", "null" ); + update = update.replaceFirst( "[?]realizada", "null" ); + update = update.replaceFirst( "[?]proxima_visita", "null" ); + } + + queries[ 1 ] = update; + } + } + + protected void readEmpresas( String actualizacao ) + throws Exception + { + Object empresas[][] = doQuery( softwareConnection, GET_EMPRESAS + actualizacao ); + //id, empresa_id, nome, contacto, inactivo + for( int t = 0; t < empresas.length; t++ ) + { + for( int c = 0; c < empresas[ t ].length; c++ ) + { + if( empresas[ t ][ c ] instanceof String ) + { + empresas[ t ][ c ] = unicodeToHTML( (String) empresas[ t ][ c ] ); + } + } + int id = ( ( Number ) empresas[t][0] ).intValue(); + boolean inactivo = "y".equals( empresas[ t ][ 17 ] ); + if( inactivo ) + { + String str = DELETE_TRABALHADORES_BY_EMPRESA.replaceFirst( "[?]empresa_id", "" + id ); + deletes.add( str ); + deletes.add( DELETE_ESTABELECIMENTOS_BY_EMPRESA + id ); + deletes.add( DELETE_EMPRESA + id ); + continue; + } + String queries[] = new String[ 2 ]; + updates.insertElementAt( queries, 0 ); + queries[ 0 ] = CREATE_EMPRESA.replaceFirst( "[?]id", "" + id ); + String update = UPDATE_EMPRESA.replaceFirst( "[?]id", "" + id ); + + String designacaoSocial = "'" + empresas[ t ][ 1 ] + "'"; + update = update.replaceFirst( "[?]designacao_social", designacaoSocial ); + String cae; + if( empresas[ t ][ 7 ] != null ) + { + cae = "'" + empresas[ t ][ 7 ] + "'"; + } + else + { + cae = "''"; + } + update = update.replaceFirst( "[?]cae", cae ); + String contribuinte; + if( empresas[ t ][ 8 ] != null ) + { + contribuinte = "'" + empresas[ t ][ 8 ] + "'"; + } + else + { + contribuinte = "''"; + } + update = update.replaceFirst( "[?]contribuinte", contribuinte ); + String segurancaSocial; + if( empresas[ t ][ 9 ] != null ) + { + segurancaSocial = "'" + empresas[ t ][ 9 ] + "'"; + } + else + { + segurancaSocial = "''"; + } + update = update.replaceFirst( "[?]seguranca_social", segurancaSocial ); + String actividade; + if( empresas[ t ][ 10 ] != null ) + { + actividade = "'" + empresas[ t ][ 10 ] + "'"; + } + else + { + actividade = "''"; + } + update = update.replaceFirst( "[?]actividade", actividade ); + String morada; + if( empresas[ t ][ 12 ] != null ) + { + morada = "'" + empresas[ t ][ 12 ] + "'"; + } + else + { + morada = "''"; + } + update = update.replaceFirst( "[?]morada", morada ); + String localidade; + if( empresas[ t ][ 13 ] != null ) + { + localidade = "'" + empresas[ t ][ 13 ] + "'"; + } + else + { + localidade = "''"; + } + update = update.replaceFirst( "[?]localidade", localidade ); + String codigoPostal; + if( empresas[ t ][ 14 ] != null ) + { + codigoPostal = "'" + empresas[ t ][ 14 ] + "'"; + } + else + { + codigoPostal = "''"; + } + update = update.replaceFirst( "[?]codigo_postal", codigoPostal ); + String distrito; + if( empresas[ t ][ 15 ] != null ) + { + distrito = "'" + empresas[ t ][ 15 ] + "'"; + } + else + { + distrito = "''"; + } + update = update.replaceFirst( "[?]distrito", distrito ); + String concelho; + if( empresas[ t ][ 16 ] != null ) + { + concelho = "'" + empresas[ t ][ 16 ] + "'"; + } + else + { + concelho = "''"; + } + update = update.replaceFirst( "[?]concelho", concelho ); + String email = null; + if( empresas[ t ][ 18 ] != null ) + { + try + { + Object em[][] = doQuery( softwareConnection, GET_EMAIL + empresas[ t ][ 18 ] ); + if( em != null && em.length > 0 && em[ 0 ][ 0 ] != null ) + { + email = "'" + (String)em[ 0 ][ 0 ] + "'"; + } + } + catch( Exception ex ) + { + } + } + if( email == null ) + { + email = "''"; + } + update = update.replaceFirst( "[?]email", email ); + + String codigo1 = (String) empresas[ t ][ 4 ]; + String codigo2 = (String) empresas[ t ][ 5 ]; + String codigo3 = (String) empresas[ t ][ 6 ]; + String codigo = "'" + ( codigo1 != null ? codigo1 : "_" ) + "/" + + ( codigo2 != null ? codigo2 : "_" ) + "/" + + ( codigo3 != null ? codigo3 : "_" ) + "'"; + update = update.replaceFirst( "[?]codigo", codigo ); + update = update.replaceFirst( "[?]perfil_1", "null" ); + update = update.replaceFirst( "[?]perfil_2", "null" ); + update = update.replaceFirst( "[?]perfil_3", "null" ); + update = update.replaceFirst( "[?]servicos", "null" ); + + queries[ 1 ] = update; + } + } + + protected Object [][]doQuery( Connection con, String query ) + throws Exception + { + return doQuery( con, query, false ); + } + + protected Object [][]doQuery( Connection con, String query, boolean isUpdate ) + throws Exception + { +// if( con == webConnection ) +// { +// System.out.println( "WEB" ); +// } +// else +// { +// System.out.println( "LOCAL" ); +// } +// if( query.indexOf( "INSERT" ) != -1 || query.indexOf( "UPDATE" ) != -1 ) +// { +//// System.out.println( "AAAAAAAAAAAAAHHHHHHH" + query ); +// return new Object[0][0]; +// } + Statement stm = null; + stm = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY ); + if( isUpdate ) + { + stm.executeUpdate( query ); + return null; + } + ResultSet rs = stm.executeQuery( query ); + + if( rs == null ) + { + return null; + } + ResultSetMetaData rsmd = rs.getMetaData(); + int columns = rsmd.getColumnCount(); + rs.last(); + int rows = rs.getRow(); + Object data[][] = new Object[ rows ][ columns ]; + for( int i = 0; i < rows; ++i ) + { + rs.absolute( i + 1 ); + for( int j = 0; j < columns; j++ ) + { + data[ i ][ j ] = rs.getObject( j + 1 ); + } + } + return data; + } + + protected static String unicodeToHTML( String text ) + { + if( text == null || text.length() == 0 ) + { + return ""; + } + + String output = text; + + output = output.replaceAll( "\\\\u0009", " " ); + output = output.replaceAll( "\\\\u000a", "
" ); + + output = output.replaceAll( "\\\\u00a0", " " ); + + output = output.replaceAll( "\\\\u00c0", "À" ); + output = output.replaceAll( "\\\\u00c1", "Á" ); + output = output.replaceAll( "\\\\u00c2", "Â" ); + output = output.replaceAll( "\\\\u00c3", "Ã" ); + output = output.replaceAll( "\\\\u00c7", "Ç" ); + output = output.replaceAll( "\\\\u00c8", "È" ); + output = output.replaceAll( "\\\\u00c9", "É" ); + output = output.replaceAll( "\\\\u00ca", "Ê" ); + output = output.replaceAll( "\\\\u00cc", "Ì" ); + output = output.replaceAll( "\\\\u00cd", "Í" ); + output = output.replaceAll( "\\\\u00ce", "Î" ); + output = output.replaceAll( "\\\\u00d2", "Ò" ); + output = output.replaceAll( "\\\\u00d3", "Ó" ); + output = output.replaceAll( "\\\\u00d4", "Ô" ); + output = output.replaceAll( "\\\\u00d5", "Õ" ); + output = output.replaceAll( "\\\\u00d9", "Ù" ); + output = output.replaceAll( "\\\\u00da", "Ú" ); + output = output.replaceAll( "\\\\u00db", "Û" ); + + output = output.replaceAll( "\\\\u00e0", "à" ); + output = output.replaceAll( "\\\\u00e1", "á" ); + output = output.replaceAll( "\\\\u00e2", "â" ); + output = output.replaceAll( "\\\\u00e3", "ã" ); + output = output.replaceAll( "\\\\u00e7", "ç" ); + output = output.replaceAll( "\\\\u00e8", "è" ); + output = output.replaceAll( "\\\\u00e9", "é" ); + output = output.replaceAll( "\\\\u00ea", "ê" ); + output = output.replaceAll( "\\\\u00ec", "ì" ); + output = output.replaceAll( "\\\\u00ed", "í" ); + output = output.replaceAll( "\\\\u00ee", "î" ); + output = output.replaceAll( "\\\\u00f2", "ò" ); + output = output.replaceAll( "\\\\u00f3", "ó" ); + output = output.replaceAll( "\\\\u00f4", "ô" ); + output = output.replaceAll( "\\\\u00f5", "õ" ); + output = output.replaceAll( "\\\\u00f9", "ù" ); + output = output.replaceAll( "\\\\u00fa", "ú" ); + output = output.replaceAll( "\\\\u00fb", "û" ); + output = output.replaceAll( "\\\\u00aa", "ª" ); + output = output.replaceAll( "\\\\u00ba", "º" ); + + output = output.replaceAll( "\\\\u0153", "œ" ); + + output = output.replaceAll( "\\\\u2013", "-" ); + output = output.replaceAll( "\\\\u2014", "-" ); + output = output.replaceAll( "\\\\u2018|\\\\u2019", "'" ); + output = output.replaceAll( "\\\\u201c|\\\\u201d", "\"" ); + + output = output.replaceAll( "\\\\u2022", "*" ); + output = output.replaceAll( "\\\\u2026", "..." ); + + return output; + } + + +} diff --git a/branches/SIPRP/SIPRPSoft/src/siprp_create.sql b/branches/SIPRP/SIPRPSoft/src/siprp_create.sql new file mode 100644 index 00000000..56b89f27 --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/siprp_create.sql @@ -0,0 +1,569 @@ +-- +-- PostgreSQL database dump +-- + +SET client_encoding = 'LATIN1'; +SET check_function_bodies = false; +SET client_min_messages = warning; + + +-- +-- Name: actualizacao; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE actualizacao ( + hora timestamp without time zone, + id serial NOT NULL +); + + +ALTER TABLE public.actualizacao OWNER TO postgres; + +-- +-- Name: avisos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE avisos ( + id integer NOT NULL, + tipo integer DEFAULT 0 NOT NULL, + empresa_id integer, + estabelecimento_id integer, + trabalhador_id integer, + evento_id integer, + data_aviso date NOT NULL, + data_evento date, + descricao character varying(255) +); + + +ALTER TABLE public.avisos OWNER TO postgres; + +-- +-- Name: contactos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE contactos ( + id integer NOT NULL, + nome character varying(255), + telefone character varying(255), + telemovel character varying(255), + fax character varying(255), + email character varying(255), + cargo character varying(255) +); + + +ALTER TABLE public.contactos OWNER TO postgres; + +-- +-- Name: empresas; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE empresas ( + id integer NOT NULL, + designacao_social character varying(255) DEFAULT ''::character varying NOT NULL, + servico_saude_tipo integer, + servico_saude_designacao character varying(255) DEFAULT 'Sociedade Ibu00e9rica de Prevenu00e7u00e3o de Riscos Profissionais'::character varying, + servico_higiene_tipo integer, + servico_higiene_designacao character varying(255), + inactivo character(1) DEFAULT 'n'::bpchar NOT NULL, + morada character varying(255), + codigo_postal character varying(8), + localidade character varying(255), + distrito character varying(255), + concelho character varying(255), + numero_trabalhadores integer, + data_proposta date, + data_aceitacao date, + perfil_1 character varying(255), + perfil_2 character varying(255), + data_envio_contrato date, + data_recepcao_contrato date, + data_envio_idict date, + cae character varying(255), + contribuinte character varying(255), + seguranca_social character varying(255), + codigo_1 character varying(255), + codigo_2 character varying(255), + codigo_3 character varying(255), + servicos integer, + contacto_1 integer, + contacto_2 integer, + data_relatorio_anual date, + preco_higiene double precision, + preco_medicina double precision, + periodicidade character varying(255), + actividade character varying(255), + actualizacao timestamp without time zone, + designacao_social_plain character varying(255) +); + + +ALTER TABLE public.empresas OWNER TO postgres; + +-- +-- Name: errors; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE errors ( + id integer NOT NULL, + date timestamp without time zone, + "type" character varying(20), + environment character varying(255), + description character varying(65535) +); + + +ALTER TABLE public.errors OWNER TO postgres; + +-- +-- Name: estabelecimentos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE estabelecimentos ( + id integer NOT NULL, + nome character varying(255) DEFAULT ''::character varying NOT NULL, + localidade character varying(255), + inactivo character(1) DEFAULT 'n'::bpchar NOT NULL, + empresa_id integer DEFAULT 0 NOT NULL, + morada character varying(255), + codigo_postal character varying(255), + contacto character varying(255), + historico character varying(65535), + actualizacao timestamp without time zone, + nome_plain character varying(255) +); + + +ALTER TABLE public.estabelecimentos OWNER TO postgres; + +-- +-- Name: exames; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE exames ( + id integer NOT NULL, + data date, + tipo integer DEFAULT 0 NOT NULL, + ocasional integer, + outro_tipo character varying(255), + resultado integer, + outra_funcao_1 character varying(255), + outra_funcao_2 character varying(255), + outra_funcao_3 character varying(255), + outra_funcao_4 character varying(255), + proximo_exame date, + outras_recomendacoes character varying(65535), + inactivo character(1) DEFAULT 'n'::bpchar NOT NULL, + trabalhador_id integer DEFAULT 0 NOT NULL, + medico_id integer DEFAULT 0 NOT NULL, + pdf bytea +); + + +ALTER TABLE public.exames OWNER TO postgres; + +-- +-- Name: exames_perfis; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE exames_perfis ( + id integer NOT NULL, + perfil integer DEFAULT 0 NOT NULL, + tipo integer DEFAULT 0 NOT NULL, + multiplicador integer DEFAULT 0 NOT NULL +); + + +ALTER TABLE public.exames_perfis OWNER TO postgres; + +-- +-- Name: historico_estabelecimento; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE historico_estabelecimento ( + id integer NOT NULL, + estabelecimento_id integer DEFAULT 0 NOT NULL, + data date, + texto character varying(65535) +); + + +ALTER TABLE public.historico_estabelecimento OWNER TO postgres; + +-- +-- Name: ids; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE ids ( + id integer NOT NULL +); + + +ALTER TABLE public.ids OWNER TO postgres; + +-- +-- Name: marcacoes_empresa; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE marcacoes_empresa ( + id integer NOT NULL, + data date NOT NULL, + texto character varying(65535), + empresa_id integer DEFAULT 0 NOT NULL, + realizada character(1) +); + + +ALTER TABLE public.marcacoes_empresa OWNER TO postgres; + +-- +-- Name: marcacoes_estabelecimento; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE marcacoes_estabelecimento ( + id integer NOT NULL, + data date NOT NULL, + realizada character(1) DEFAULT 'n'::bpchar NOT NULL, + data_email date, + data_relatorio date, + estabelecimento_id integer DEFAULT 0 NOT NULL +); + + +ALTER TABLE public.marcacoes_estabelecimento OWNER TO postgres; + +-- +-- Name: marcacoes_trabalhador; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE marcacoes_trabalhador ( + id integer NOT NULL, + data date, + realizada character(1) DEFAULT 'n'::bpchar NOT NULL, + data_email date, + data_relatorio date, + tipo integer, + trabalhador_id integer +); + + +ALTER TABLE public.marcacoes_trabalhador OWNER TO postgres; + +-- +-- Name: medicos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE medicos ( + id integer NOT NULL, + nome character varying(255) DEFAULT ''::character varying NOT NULL, + numero_cedula character varying(255) DEFAULT ''::character varying NOT NULL, + inactivo character(1) DEFAULT 'n'::bpchar NOT NULL +); + + +ALTER TABLE public.medicos OWNER TO postgres; + +-- +-- Name: tipos_exames_comp; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE tipos_exames_comp ( + id integer NOT NULL, + ordem integer DEFAULT 0 NOT NULL, + descricao character varying(255) DEFAULT ''::character varying NOT NULL +); + + +ALTER TABLE public.tipos_exames_comp OWNER TO postgres; + +-- +-- Name: trabalhadores; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE trabalhadores ( + id integer NOT NULL, + nome character varying(255) DEFAULT ''::character varying NOT NULL, + sexo character(1), + data_nascimento date, + nacionalidade character varying(255), + numero_mecanografico character varying(255), + data_admissao date, + categoria character varying(255), + local_trabalho character varying(255), + funcao_proposta character varying(255), + data_admissao_funcao date, + observacoes character varying(65535), + inactivo character(1) DEFAULT 'n'::bpchar NOT NULL, + estabelecimento_id integer DEFAULT 0 NOT NULL, + data_demissao date, + observacoes_gestao character varying(65535), + perfil integer, + actualizacao timestamp without time zone, + nome_plain character varying(255) +); + + +ALTER TABLE public.trabalhadores OWNER TO postgres; + +-- +-- Name: actualizacao_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY actualizacao + ADD CONSTRAINT actualizacao_pkey PRIMARY KEY (id); + + +ALTER INDEX public.actualizacao_pkey OWNER TO postgres; + +-- +-- Name: avisos_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY avisos + ADD CONSTRAINT avisos_pkey PRIMARY KEY (id); + + +ALTER INDEX public.avisos_pkey OWNER TO postgres; + +-- +-- Name: contactos_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY contactos + ADD CONSTRAINT contactos_pkey PRIMARY KEY (id); + + +ALTER INDEX public.contactos_pkey OWNER TO postgres; + +-- +-- Name: empresas_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY empresas + ADD CONSTRAINT empresas_pkey PRIMARY KEY (id); + + +ALTER INDEX public.empresas_pkey OWNER TO postgres; + +-- +-- Name: errors_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY errors + ADD CONSTRAINT errors_pkey PRIMARY KEY (id); + + +ALTER INDEX public.errors_pkey OWNER TO postgres; + +-- +-- Name: estabelecimentos_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY estabelecimentos + ADD CONSTRAINT estabelecimentos_pkey PRIMARY KEY (id); + + +ALTER INDEX public.estabelecimentos_pkey OWNER TO postgres; + +-- +-- Name: exames_perfis_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY exames_perfis + ADD CONSTRAINT exames_perfis_pkey PRIMARY KEY (id); + + +ALTER INDEX public.exames_perfis_pkey OWNER TO postgres; + +-- +-- Name: exames_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY exames + ADD CONSTRAINT exames_pkey PRIMARY KEY (id); + + +ALTER INDEX public.exames_pkey OWNER TO postgres; + +-- +-- Name: historico_estabelecimento_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY historico_estabelecimento + ADD CONSTRAINT historico_estabelecimento_pkey PRIMARY KEY (id); + + +ALTER INDEX public.historico_estabelecimento_pkey OWNER TO postgres; + +-- +-- Name: ids_pk; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY ids + ADD CONSTRAINT ids_pk PRIMARY KEY (id); + + +ALTER INDEX public.ids_pk OWNER TO postgres; + +-- +-- Name: marcacoes_empresa_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY marcacoes_empresa + ADD CONSTRAINT marcacoes_empresa_pkey PRIMARY KEY (id); + + +ALTER INDEX public.marcacoes_empresa_pkey OWNER TO postgres; + +-- +-- Name: marcacoes_estabelecimento_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY marcacoes_estabelecimento + ADD CONSTRAINT marcacoes_estabelecimento_pkey PRIMARY KEY (id); + + +ALTER INDEX public.marcacoes_estabelecimento_pkey OWNER TO postgres; + +-- +-- Name: marcacoes_trabalhador_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY marcacoes_trabalhador + ADD CONSTRAINT marcacoes_trabalhador_pkey PRIMARY KEY (id); + + +ALTER INDEX public.marcacoes_trabalhador_pkey OWNER TO postgres; + +-- +-- Name: medicos_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY medicos + ADD CONSTRAINT medicos_pkey PRIMARY KEY (id); + + +ALTER INDEX public.medicos_pkey OWNER TO postgres; + +-- +-- Name: tipos_exames_comp_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY tipos_exames_comp + ADD CONSTRAINT tipos_exames_comp_pkey PRIMARY KEY (id); + + +ALTER INDEX public.tipos_exames_comp_pkey OWNER TO postgres; + +-- +-- Name: trabalhadores_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY trabalhadores + ADD CONSTRAINT trabalhadores_pkey PRIMARY KEY (id); + + +ALTER INDEX public.trabalhadores_pkey OWNER TO postgres; + + +-- +-- Name: avisos_empresa_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY avisos + ADD CONSTRAINT avisos_empresa_id_fkey FOREIGN KEY (empresa_id) REFERENCES empresas(id); + + +-- +-- Name: avisos_estabelecimento_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY avisos + ADD CONSTRAINT avisos_estabelecimento_id_fkey FOREIGN KEY (estabelecimento_id) REFERENCES estabelecimentos(id); + + +-- +-- Name: empresas_contacto_1_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY empresas + ADD CONSTRAINT empresas_contacto_1_fkey FOREIGN KEY (contacto_1) REFERENCES contactos(id); + + +-- +-- Name: empresas_contacto_2_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY empresas + ADD CONSTRAINT empresas_contacto_2_fkey FOREIGN KEY (contacto_2) REFERENCES contactos(id); + + +-- +-- Name: estabelecimentos_empresa_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY estabelecimentos + ADD CONSTRAINT estabelecimentos_empresa_id_fkey FOREIGN KEY (empresa_id) REFERENCES empresas(id); + + +-- +-- Name: exames_medico_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY exames + ADD CONSTRAINT exames_medico_id_fkey FOREIGN KEY (medico_id) REFERENCES medicos(id); + + +-- +-- Name: exames_perfis_tipo_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY exames_perfis + ADD CONSTRAINT exames_perfis_tipo_fkey FOREIGN KEY (tipo) REFERENCES tipos_exames_comp(id); + + +-- +-- Name: historico_estabelecimento_estabelecimento_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY historico_estabelecimento + ADD CONSTRAINT historico_estabelecimento_estabelecimento_id_fkey FOREIGN KEY (estabelecimento_id) REFERENCES estabelecimentos(id); + + +-- +-- Name: marcacoes_empresa_empresa_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY marcacoes_empresa + ADD CONSTRAINT marcacoes_empresa_empresa_id_fkey FOREIGN KEY (empresa_id) REFERENCES empresas(id); + + +-- +-- Name: marcacoes_estabelecimento_estabelecimento_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY marcacoes_estabelecimento + ADD CONSTRAINT marcacoes_estabelecimento_estabelecimento_id_fkey FOREIGN KEY (estabelecimento_id) REFERENCES estabelecimentos(id); + + +-- +-- Name: trabalhadores_estabelecimento_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY trabalhadores + ADD CONSTRAINT trabalhadores_estabelecimento_id_fkey FOREIGN KEY (estabelecimento_id) REFERENCES estabelecimentos(id); + + + +-- +-- Name: public; Type: ACL; Schema: -; Owner: postgres +-- + +REVOKE ALL ON SCHEMA public FROM PUBLIC; +REVOKE ALL ON SCHEMA public FROM postgres; +GRANT ALL ON SCHEMA public TO postgres; +GRANT ALL ON SCHEMA public TO PUBLIC; + + + diff --git a/branches/SIPRP/SIPRPSoft/src/speedo.properties b/branches/SIPRP/SIPRPSoft/src/speedo.properties new file mode 100644 index 00000000..314b2c4f --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/speedo.properties @@ -0,0 +1,259 @@ +############################################################################### +# Speedo: an implementation of JDO compliant personality on top of JORM generic +# I/O sub-system. +# Copyright (C) 2001-2003 France Telecom R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Contact: speedo@objectweb.org (users list) +# or sebastien.chassande-barrioz@rd.francetelecom.com (project chief) +# +############################################################################### +# This file is the configuration file of Speedo. +VendorName ObjectWeb Consortium +VersionNumber 1.0 + + +############################################################################### +# PersistenceManagerFactory # +############################################################################### +# Class implementing the PersistenceManagerFactory interface. +# Note: The real role of this class is to initialize the component architecture +# (http://fractal.objectweb.org) of Speedo with the initial properies specified +# in this file. The PersistenceManagerFactory role is delegated to the real +# implementation (the SpeedoPersistenceManagerFactory class). +# +# This property must not be changed. It is used by the JDOHelper to knwon the +# PersistenceManagerFactory class of the JDO driver. +# +javax.jdo.PersistenceManagerFactoryClass org.objectweb.speedo.Speedo + + +############################################################################### +# Data Access # +############################################################################### +# This section contains the configuration of the access to the data support. +# +# The first property (org.objectweb.speedo.mapperName) MUST be defined for the +# enhancement time and the runtime. It characterizes the data source type. +# +# In a second part of this data access section, you must choose the way for +# Speedo to reach the data support. The first mean is through a JDBC +# driver and the second is through a connection factory. + +#==============================# +# Data source type # +#==============================# +#mapper name corresponding to your data support type +#org.objectweb.speedo.mapperName rdb.postgres +#org.objectweb.speedo.mapperName rdb.oracle +org.objectweb.speedo.mapperName rdb.mysql +#Other possible values: +# rdb.oracle8, rdb.sqlserver, rdb.firebird, rdb.mckoi, rdb.sapdb, rdb.sybase + +#===============================================# +# JDBC Driver directly (local transaction only) # +#===============================================# +#Driver class name +#javax.jdo.option.DriverName org.postgresql.Driver +#javax.jdo.option.DriverName oracle.jdbc.driver.OracleDriver +javax.jdo.option.DriverName com.mysql.jdbc.Driver +#javax.jdo.option.DriverName com.p6spy.engine.spy.P6SpyDriver + +#url of the database +#javax.jdo.option.ConnectionURL jdbc:postgresql:speedoTest +#javax.jdo.option.ConnectionURL jdbc:oracle:thin:@10.194.3.226:1521:test1 +javax.jdo.option.ConnectionURL jdbc\:mysql\://127.0.0.1/siprp + +#user name +javax.jdo.option.ConnectionUserName root + +#password of the user +javax.jdo.option.ConnectionPassword UNIXLuvsU + +# connection pool size +org.objectweb.speedo.connection.pool.min 0 +org.objectweb.speedo.connection.pool.max 20 +# TTL of the unused connection in term of seconds +# 0 => no TTL (default) +org.objectweb.speedo.connection.pool.ttl 300 +#the max time to wait a free connection in millisecond +org.objectweb.speedo.connection.pool.timeout 500 + + +#======================================# +# Connection factory registred in JNDI # +#======================================# + +# This property is the jndi name of a registered connection factory. A +# connection factory must an implementation of one of these interfaces: +# - javax.sql.Datasource +# - javax.resource.cci.ConnectionFactory +# +#javax.jdo.option.ConnectionFactoryName connFacJndiName + +############################################################################### +# Transaction management # +############################################################################### +# Speedo can be used in stand alone mode or integrated into an application +# server. In the first case (stand alone), the user must demarcates transactions +# in its application code. In the second case (into an application server) the +# transaction can be dermacated by the container of Session bean. Then the +# transactions are potentialy distributed and therefore managed by a +# transactional monitor. +# +# To use speedo in an application server with transactions demarcated by the +# EJB container, the transaction manager instance (implements +# javax.transaction.TransactionManager) MUST be registered into JNDI. If no +# name is specified several attempts are done with classical jndi names used +# in some application servers: +# +# ----------------------------------------------------------- +# | Apps Server | JNDI Name of TransactionManager instance | +# |--------------|------------------------------------------| +# | JOnAS | javax.transaction.UserTransaction | +# | JBoss | java:/TransactionManager | +# | WebLogic | javax.transaction.TransactionManager | +# | WebSphere | ??? | +# | Orion | java:comp/UserTransaction | +# ----------------------------------------------------------- +# +# The default value is the one used in JOnAS, our objectweb partners. +# +#org.objectweb.speedo.jca.TMName javax.transaction.UserTransaction + +# Indicates if transaction are optimisitic or pessimitic. In the optimisitic +# case several threads can use a same persistent object. In case of optimistic +# transaction, each persistent object has several state: one for each user +# (thread). The default case is pessimistic (false). +# +#javax.jdo.option.Optimistic true + + +############################################################################### +# Others JDO Options # +############################################################################### +# Indicates if queries and extends must ingore the instance modified in memory +# and not yet committed into the support. The default value is false (the +# modified instance are flushed into the support before queries). +# +javax.jdo.option.IgnoreCache false + + +# Indicates if several threads can manipulate a same PersistenceManager instance +# in same time (concurrency). The default value is false (no additionnal +# synchronization for concurrent access to a PersistentManager instance). +# +#javax.jdo.option.Multithreaded false + +# when a transaction is commit this property specifies if the modified +# persistent object must be kept in the memory cache. The default value is true +# (persistent objects are kept). +#javax.jdo.option.RetainValues false + + +############################################################################### +# Unsupported JDO Options # +############################################################################### +#javax.jdo.option.RestoreValues false +#javax.jdo.option.NontransactionalRead +#javax.jdo.option.NontransactionalWrite + +############################################################################### +# Speedo Tunning # +############################################################################### +# To active the debug mode +#org.objectweb.speedo.debug true + +#Activation of the data prefetching on each query +#default value is 'on' +#org.objectweb.speedo.query.prefetch off + +# This property permits to the user to listen the transaction life cycle in +# implementing the TransactionListener interface provided in Speedo. However +# Speedo provides a simple implementation calculating statistics. To active the +# use of a listener, you simply have to specify the implementation of the +# interface. +#org.objectweb.speedo.txListener org.objectweb.speedo.workingset.lib.WorkingSetStatistic + +#===========================# +# Data structure Management # +#===========================# +# Specify the mapping structure (ex SQL tables) management. The possibles +# values are the following: +# DO_NOTHING : nothing is done. Then the mapping structures already exist at +# the Speedo starting +# CREATE_IF_REQUIRED : The mapping structures are created if they are not +# already present (default). +# FORCE_CREATE: The mapping structures are removed (if they already exist), and +# and created. +# DELETE_DATA: The data present in the mapping structure are removed. Of course +# if the mapping structure do not exist, they are created. +# +#org.objectweb.speedo.mappingStructure CREATE_IF_REQUIRED + +#=========================# +# Memory Cache Management # +#=========================# +# Memory cache size +#org.objectweb.speedo.cache.size noLimit + +# When the cache is full or when the treshold is reached this property indicates +# how many entry must be tried to free. The possible values are absolute +# value (234) or a percent of the maximal cache size (12%). The default +# value is 7%. +#org.objectweb.speedo.cache.autoCleanSize 7% + +# Is the number of entries since the cache must try to evict entries. The number +# of entries to evict is specified by the 'autoCleanSize' property. The possible +# values are absolute value (234) or a percent of the maximal cache size (75%). +# By default there is no threshold, then there is no auto cleaning process. +org.objectweb.speedo.cache.autoCleanThreshold 0 + +# Replacement politic of the cache: LRU, MRU or FIFO +# The default value is LRU +#org.objectweb.speedo.cache.policy LRU + +#========================================# +# PersistenceManager Pools configuration # +#========================================# +# Size of the pool of PersistenceManager instances +#org.objectweb.speedo.persistencemanager.pool.min 0 +#org.objectweb.speedo.persistencemanager.pool.max 20 +#org.objectweb.speedo.persitencemanager.pool.ttl 300 +#the max time to wait a free persistence manager in millisecond +org.objectweb.speedo.persitencemanager.pool.timeout 1000 + +#=================================# +# Compiled query Cache Management # +#=================================# +# Memory cache size in term of number of persistent objects +#org.objectweb.speedo.compiledquery.cache.size nolimit + +# When the cache is full or when the treshold is reached this property indicates +# how many entry must be tried to free. The possible values are absolute +# value (234) or a percent of the maximal cache size (12%). The default +# value is 7%. +#org.objectweb.speedo.compiledquery.cache.autoCleanSize 7% + +# Is the number of entries since the cache must try to evict entries. The number +# of entries to evict is specified by the 'autoCleanSize' property. The possible +# values are absolute value (234) or a percent of the maximal cache size (75%). +# By default there is no threshold, then there is no auto cleaning process. +#org.objectweb.speedo.compiledquery.cache.autoCleanThreshold 80% + +# Replacement politic of the cache: LRU, MRU or FIFO +# The default value is LRU +#org.objectweb.speedo.compiledquery.cache.policy LRU diff --git a/branches/SIPRP/SIPRPSoft/src/updtprop.txt b/branches/SIPRP/SIPRPSoft/src/updtprop.txt new file mode 100644 index 00000000..6153dbeb --- /dev/null +++ b/branches/SIPRP/SIPRPSoft/src/updtprop.txt @@ -0,0 +1,7 @@ +interno=localhost:5432 +iuser=postgres +ipasswd=Typein +externo=www.evolute.pt:5436 +euser=siprp +epasswd=rg2h-opksiprp +intervalo=10 diff --git a/branches/SIPRP/SIPRPSoft/src/xml-apis-1.3.04.jar b/branches/SIPRP/SIPRPSoft/src/xml-apis-1.3.04.jar new file mode 100644 index 00000000..d42c0ea6 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/xml-apis-1.3.04.jar differ diff --git a/branches/SIPRP/SIPRPSoft/src/xml-apis-ext-1.3.04.jar b/branches/SIPRP/SIPRPSoft/src/xml-apis-ext-1.3.04.jar new file mode 100644 index 00000000..a7869d68 Binary files /dev/null and b/branches/SIPRP/SIPRPSoft/src/xml-apis-ext-1.3.04.jar differ diff --git a/branches/SIPRP/WebImages/WEB-INF/web.xml b/branches/SIPRP/WebImages/WEB-INF/web.xml new file mode 100644 index 00000000..11816d59 --- /dev/null +++ b/branches/SIPRP/WebImages/WEB-INF/web.xml @@ -0,0 +1,18 @@ + + + + + + + siprp.images.servlet.ImagesServlet + Some dummy name + + + + Some dummy name + /image + + + diff --git a/branches/SIPRP/WebImages/src/SIPRPNode.driver.xml b/branches/SIPRP/WebImages/src/SIPRPNode.driver.xml new file mode 100644 index 00000000..3c75ecb8 --- /dev/null +++ b/branches/SIPRP/WebImages/src/SIPRPNode.driver.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/branches/SIPRP/WebImages/src/siprp/images/servlet/ImagesServlet.java b/branches/SIPRP/WebImages/src/siprp/images/servlet/ImagesServlet.java new file mode 100644 index 00000000..611c4a47 --- /dev/null +++ b/branches/SIPRP/WebImages/src/siprp/images/servlet/ImagesServlet.java @@ -0,0 +1,51 @@ +package siprp.images.servlet; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import siprp.database.cayenne.objects.Image; +import siprp.database.cayenne.providers.ImageDAO; + +public final class ImagesServlet extends HttpServlet +{ + private static final long serialVersionUID = 999506147931075031L; + private static final double MAX_WIDTH = 4.5; + private static final double MAX_HEIGHT = 2.0; + + private static final String PARAMETER_ID = "id"; + + public void doGet( HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException + { + response.setContentType( "image/png" ); + ServletOutputStream out = response.getOutputStream(); + String param = request.getParameter( PARAMETER_ID ); + System.out.println(param); + try + { + Integer id = new Integer(param); + Image img = new ImageDAO().getImageForID( id ); +// int width = img.getWidth( null ); +// int height = img.getHeight( null ); +// double wrel = ((double)width ) / MAX_WIDTH; +// double hrel = ((double)height ) / MAX_HEIGHT; +// if( wrel > 1 && wrel > hrel ) +// { +// img = img.getScaledInstance( MAX_WIDTH, -1, Image.SCALE_FAST ); +// } +// else if( hrel > 1 && hrel > wrel ) +// { +// img = img.getScaledInstance( -1, MAX_HEIGHT, Image.SCALE_FAST ); +// } + out.write( img.getImageData() ); + } + catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/branches/SIPRP/build.xml b/branches/SIPRP/build.xml new file mode 100644 index 00000000..6db0126e --- /dev/null +++ b/branches/SIPRP/build.xml @@ -0,0 +1,346 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/common/lib/TableLayout.jar b/branches/SIPRP/common/lib/TableLayout.jar new file mode 100755 index 00000000..81c1fc3c Binary files /dev/null and b/branches/SIPRP/common/lib/TableLayout.jar differ diff --git a/branches/SIPRP/common/lib/ashwood-2.0.jar b/branches/SIPRP/common/lib/ashwood-2.0.jar new file mode 100644 index 00000000..55fcc9b1 Binary files /dev/null and b/branches/SIPRP/common/lib/ashwood-2.0.jar differ diff --git a/branches/SIPRP/common/lib/cayenne-server-3.0M6.jar b/branches/SIPRP/common/lib/cayenne-server-3.0M6.jar new file mode 100644 index 00000000..fdf0d056 Binary files /dev/null and b/branches/SIPRP/common/lib/cayenne-server-3.0M6.jar differ diff --git a/branches/SIPRP/common/lib/commons-collections-3.1.jar b/branches/SIPRP/common/lib/commons-collections-3.1.jar new file mode 100644 index 00000000..41e230fe Binary files /dev/null and b/branches/SIPRP/common/lib/commons-collections-3.1.jar differ diff --git a/branches/SIPRP/common/lib/commons-lang-2.1.jar b/branches/SIPRP/common/lib/commons-lang-2.1.jar new file mode 100644 index 00000000..87b80ab5 Binary files /dev/null and b/branches/SIPRP/common/lib/commons-lang-2.1.jar differ diff --git a/branches/SIPRP/common/lib/commons-logging-1.1.jar b/branches/SIPRP/common/lib/commons-logging-1.1.jar new file mode 100644 index 00000000..2ff9bbd9 Binary files /dev/null and b/branches/SIPRP/common/lib/commons-logging-1.1.jar differ diff --git a/branches/SIPRP/common/lib/evolute.jar b/branches/SIPRP/common/lib/evolute.jar new file mode 100644 index 00000000..122596d7 Binary files /dev/null and b/branches/SIPRP/common/lib/evolute.jar differ diff --git a/branches/SIPRP/common/lib/jcalendar-1.3.2.jar b/branches/SIPRP/common/lib/jcalendar-1.3.2.jar new file mode 100755 index 00000000..b5e5a2d8 Binary files /dev/null and b/branches/SIPRP/common/lib/jcalendar-1.3.2.jar differ diff --git a/branches/SIPRP/common/lib/log4j-1.2.8.jar b/branches/SIPRP/common/lib/log4j-1.2.8.jar new file mode 100644 index 00000000..493a3ccc Binary files /dev/null and b/branches/SIPRP/common/lib/log4j-1.2.8.jar differ diff --git a/branches/SIPRP/common/lib/mail.jar b/branches/SIPRP/common/lib/mail.jar new file mode 100644 index 00000000..59543774 Binary files /dev/null and b/branches/SIPRP/common/lib/mail.jar differ diff --git a/branches/SIPRP/common/src/SIPRPMap.map.xml b/branches/SIPRP/common/src/SIPRPMap.map.xml new file mode 100644 index 00000000..af99153b --- /dev/null +++ b/branches/SIPRP/common/src/SIPRPMap.map.xml @@ -0,0 +1,2117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + ORACLE + + + + + + + + + + ORACLE + ecd_oficial_id_seq + 1 + + + + + + + + ORACLE + email_plano_de_actuacao_id_seq + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ORACLE + etiquetas_id_seq + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ORACLE + exames_portaria_id_seq + 1 + + + + + + + + + + + + + + + + ORACLE + hs_area_id_seq + 1 + + + + + + + ORACLE + hs_email_id_seq + 1 + + + + + + + + + + + + + + + + + + ORACLE + hs_equipamento_id_seq + 1 + + + + + + + + + ORACLE + hs_legislacao_id_seq + 1 + + + + + + + + ORACLE + hs_legislacao_categoria_id_seq + 1 + + + + + + + + + + + + + + + + + + ORACLE + hs_medida_id_seq + 1 + + + + + + + + + + ORACLE + hs_normalizacao_id_seq + 1 + + + + + + + + + + + + + + + + + + ORACLE + hs_posto_id_seq + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ORACLE + hs_relatorio_id_seq + 1 + + + + + + + + + + + ORACLE + hs_relatorio_area_id_seq + 1 + + + + + + + + + + + + ORACLE + hs_relatorio_equipamento_id_seq + 1 + + + + + + + + + + + ORACLE + hs_relatorio_legislacao_id_seq + 1 + + + + + + + + + + + ORACLE + hs_relatorio_medida_id_seq + 1 + + + + + + + + + + + ORACLE + hs_relatorio_legislacao_id_seq + 1 + + + + + + + + + + + ORACLE + hs_relatorio_posto_id_seq + 1 + + + + + + + + + + + + + + + + ORACLE + hs_relatorio_posto_risco_id_seq + 1 + + + + + + + + + + ORACLE + hs_relatorio_risco_id_seq + 1 + + + + + + + + + + + + + ORACLE + hs_risco_id_seq + 1 + + + + + + + + + + + + + + + + ORACLE + hs_risco_tema_id_seq + 1 + + + + + + + + ORACLE + image_id_seq + 1 + + + + + + + + + + + + + + + + + + + ORACLE + lembretes_id_seq + 1 + + + + + + + + + + ORACLE + lembretes_tipos_id_seq + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ORACLE + marcacoes_grupos_realizados_id_seq + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ORACLE + marcacoes_trabalhador_estados_id_seq + 1 + + + + + + + + + + + + + + + + + + + + + + + + ORACLE + prestadores_id_seq + 1 + + + + + + + + ORACLE + prestadores_grupos_protocolo_id_seq + 1 + + + + + + + + + ORACLE + prt_elementos_protocolo_id_seq + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ORACLE + trabalhadores_consultas_id_seq + 1 + + + + + + + + + + ORACLE + trabalhadores_consultas_datas_id_seq + 1 + + + + + + + + + + + ORACLE + trabalhadores_consultas_datas_emails_id_seq + 1 + + + + + + + + ORACLE + trabalhadores_consultas_datas_observacoes_id_seq + 1 + + + + + + + + + + + + + + ORACLE + trabalhadores_ecd_id_seq + 1 + + + + + + + + + + ORACLE + trabalhadores_ecds_id_seq + 1 + + + + + + + + + + + + + + + + + + + ORACLE + trabalhadores_ecds_datas_id_seq + 1 + + + + + + + + + + + ORACLE + trabalhadores_ecds_datas_emails_id_seq + 1 + + + + + + + + ORACLE + trabalhadores_ecds_datas_observacoes_id_seq + 1 + + + + + + + + ORACLE + trabalhadores_fichas_aptidao_id_seq + 1 + + + + + + + + + + + + + ORACLE + trabalhadores_processo_id_seq + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/SIPRP/common/src/cayenne.xml b/branches/SIPRP/common/src/cayenne.xml new file mode 100644 index 00000000..2b962b58 --- /dev/null +++ b/branches/SIPRP/common/src/cayenne.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/branches/SIPRP/lib.netbeans/appbase.jar b/branches/SIPRP/lib.netbeans/appbase.jar new file mode 100644 index 00000000..a72c3466 Binary files /dev/null and b/branches/SIPRP/lib.netbeans/appbase.jar differ diff --git a/branches/SIPRP/lib.netbeans/dataprovider.jar b/branches/SIPRP/lib.netbeans/dataprovider.jar new file mode 100644 index 00000000..349e5f56 Binary files /dev/null and b/branches/SIPRP/lib.netbeans/dataprovider.jar differ diff --git a/branches/SIPRP/lib.netbeans/jsf-api.jar b/branches/SIPRP/lib.netbeans/jsf-api.jar new file mode 100644 index 00000000..c4e24d1e Binary files /dev/null and b/branches/SIPRP/lib.netbeans/jsf-api.jar differ diff --git a/branches/SIPRP/lib.netbeans/jsf-impl.jar b/branches/SIPRP/lib.netbeans/jsf-impl.jar new file mode 100644 index 00000000..c2ee4b9d Binary files /dev/null and b/branches/SIPRP/lib.netbeans/jsf-impl.jar differ diff --git a/branches/SIPRP/lib.netbeans/webui.jar b/branches/SIPRP/lib.netbeans/webui.jar new file mode 100644 index 00000000..556dfc89 Binary files /dev/null and b/branches/SIPRP/lib.netbeans/webui.jar differ diff --git a/branches/SIPRP/lib.tools/bcel-5.1.jar b/branches/SIPRP/lib.tools/bcel-5.1.jar new file mode 100644 index 00000000..524e375c Binary files /dev/null and b/branches/SIPRP/lib.tools/bcel-5.1.jar differ diff --git a/branches/SIPRP/lib.tools/catalina-ant.jar b/branches/SIPRP/lib.tools/catalina-ant.jar new file mode 100644 index 00000000..f4e61e61 Binary files /dev/null and b/branches/SIPRP/lib.tools/catalina-ant.jar differ diff --git a/branches/SIPRP/lib.tools/jdo.jar b/branches/SIPRP/lib.tools/jdo.jar new file mode 100644 index 00000000..2cee6e86 Binary files /dev/null and b/branches/SIPRP/lib.tools/jdo.jar differ diff --git a/branches/SIPRP/lib.tools/jpox-enhancer-1.0.4.jar b/branches/SIPRP/lib.tools/jpox-enhancer-1.0.4.jar new file mode 100644 index 00000000..48c5ab13 Binary files /dev/null and b/branches/SIPRP/lib.tools/jpox-enhancer-1.0.4.jar differ diff --git a/branches/SIPRP/lib.tools/servlet-api.jar b/branches/SIPRP/lib.tools/servlet-api.jar new file mode 100644 index 00000000..38cf06c0 Binary files /dev/null and b/branches/SIPRP/lib.tools/servlet-api.jar differ diff --git a/branches/SIPRP/lib/evospellchecker.jar b/branches/SIPRP/lib/evospellchecker.jar new file mode 100644 index 00000000..ea686619 Binary files /dev/null and b/branches/SIPRP/lib/evospellchecker.jar differ diff --git a/branches/SIPRP/lib/swingx.jar b/branches/SIPRP/lib/swingx.jar new file mode 100644 index 00000000..dec67850 Binary files /dev/null and b/branches/SIPRP/lib/swingx.jar differ diff --git a/branches/SIPRP/web/WEB-INF/web.xml b/branches/SIPRP/web/WEB-INF/web.xml new file mode 100644 index 00000000..1676e79a --- /dev/null +++ b/branches/SIPRP/web/WEB-INF/web.xml @@ -0,0 +1,64 @@ + + + + + + SIPRP WEB + SIPRP WEB + + SIPRP WEB + siprp.pagina.siprpServlet + + + SIPRP WEB + /index.html + + + + Request + siprp.pagina.RequestServlet + + + Request + /request + + + + Schedule + siprp.pagina.ScheduleServlet + + + Schedule + /schedule + + + + Relatorio + siprp.pagina.RelatorioServlet + + + Relatorio + /relatorio + + + + Noticias + siprp.pagina.NewsServlet + + + Noticias + /noticias + + + + Recrutamento + siprp.pagina.RecruitServlet + + + Recrutamento + /recruit + + + diff --git a/branches/SIPRP/web/contents/clientes.html b/branches/SIPRP/web/contents/clientes.html new file mode 100644 index 00000000..75220e84 --- /dev/null +++ b/branches/SIPRP/web/contents/clientes.html @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + +
   os +nossos clientes
+ + + + + + + + + + +

+

+
em +desenvolvimento...
+

+

+
+

+
+ + diff --git a/branches/SIPRP/web/contents/colaboradores.html b/branches/SIPRP/web/contents/colaboradores.html new file mode 100644 index 00000000..1030ce98 --- /dev/null +++ b/branches/SIPRP/web/contents/colaboradores.html @@ -0,0 +1,50 @@ + + + + + SIPRP - Colaboradores + + + + + + + + + + + + + + + +
   parceiros
+ + + + + + + + + + +

+

+

+

+

+
+

+
+ + diff --git a/branches/SIPRP/web/contents/contactos.html b/branches/SIPRP/web/contents/contactos.html new file mode 100644 index 00000000..ccd32346 --- /dev/null +++ b/branches/SIPRP/web/contents/contactos.html @@ -0,0 +1,52 @@ + + + + + SIPRP - Apresentação + + + + + + + + + + + + + + + +
   +contactos
+
+ + + + + + + + + + +

+

+

+

+

+
+

+
+ + diff --git a/branches/SIPRP/web/contents/conteudos/Images/bomba_amostr_ar.jpg b/branches/SIPRP/web/contents/conteudos/Images/bomba_amostr_ar.jpg new file mode 100644 index 00000000..e98b0ee2 Binary files /dev/null and b/branches/SIPRP/web/contents/conteudos/Images/bomba_amostr_ar.jpg differ diff --git a/branches/SIPRP/web/contents/conteudos/Images/bomba_asp_man.jpg b/branches/SIPRP/web/contents/conteudos/Images/bomba_asp_man.jpg new file mode 100644 index 00000000..f27ce08b Binary files /dev/null and b/branches/SIPRP/web/contents/conteudos/Images/bomba_asp_man.jpg differ diff --git a/branches/SIPRP/web/contents/conteudos/Images/dosimetro.jpg b/branches/SIPRP/web/contents/conteudos/Images/dosimetro.jpg new file mode 100644 index 00000000..07c2c3ef Binary files /dev/null and b/branches/SIPRP/web/contents/conteudos/Images/dosimetro.jpg differ diff --git a/branches/SIPRP/web/contents/conteudos/Images/explosivimetro.jpg b/branches/SIPRP/web/contents/conteudos/Images/explosivimetro.jpg new file mode 100644 index 00000000..dc4b9378 Binary files /dev/null and b/branches/SIPRP/web/contents/conteudos/Images/explosivimetro.jpg differ diff --git a/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_.html b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_.html new file mode 100644 index 00000000..361778ee --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_.html @@ -0,0 +1,28 @@ + + + + + SIPRP - Serviços + + + + + + + + + + + + + + +

+

+
+ +
+ + diff --git a/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_BA.html b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_BA.html new file mode 100644 index 00000000..2f346c68 --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_BA.html @@ -0,0 +1,30 @@ + + + + + SIPRP - Serviços + + + + + + + + + + + + + + +

+
Bomba +de Amostragem de Ar
+
+ +
+ + diff --git a/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_Dos.html b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_Dos.html new file mode 100644 index 00000000..7046acc3 --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_Dos.html @@ -0,0 +1,29 @@ + + + + + SIPRP - Serviços + + + + + + + + + + + + + + +

+
Dosímetro
+
+ +
+ + diff --git a/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_Ex.html b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_Ex.html new file mode 100644 index 00000000..ab750922 --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_Ex.html @@ -0,0 +1,29 @@ + + + + + SIPRP - Serviços + + + + + + + + + + + + + + +

+
Explosivímetro
+
+ +
+ + diff --git a/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_Lux.html b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_Lux.html new file mode 100644 index 00000000..48581bb3 --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_Lux.html @@ -0,0 +1,29 @@ + + + + + SIPRP - Serviços + + + + + + + + + + + + + + +

+
Luxímetro
+
+ +
+ + diff --git a/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_MCT.html b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_MCT.html new file mode 100644 index 00000000..d2c5738c --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_MCT.html @@ -0,0 +1,30 @@ + + + + + SIPRP - Serviços + + + + + + + + + + + + + + +

+
Monitor +de Stress Térmico
+
+ +
+ + diff --git a/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_Outr.html b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_Outr.html new file mode 100644 index 00000000..e5e98410 --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_Outr.html @@ -0,0 +1,30 @@ + + + + + SIPRP - Serviços + + + + + + + + + + + + + + +

+
Bomba +de Aspiração Manual
+
+ +
+ + diff --git a/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_RC.html b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_RC.html new file mode 100644 index 00000000..6a8b968c --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_RC.html @@ -0,0 +1,30 @@ + + + + + SIPRP - Serviços + + + + + + + + + + + + + + +

+
Regulador +de Caudal
+
+ +
+ + diff --git a/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_SI.html b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_SI.html new file mode 100644 index 00000000..909a5aaa --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_SI.html @@ -0,0 +1,29 @@ + + + + + SIPRP - Serviços + + + + + + + + + + + + + + +

+
Sonómetro
+
+ +
+ + diff --git a/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_T.html b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_T.html new file mode 100644 index 00000000..4391a445 --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/Images/higiene_foto_equip_T.html @@ -0,0 +1,29 @@ + + + + + SIPRP - Serviços + + + + + + + + + + + + + + +

+
Termoanemómetro
+
+ +
+ + diff --git a/branches/SIPRP/web/contents/conteudos/Images/luximetro.jpg b/branches/SIPRP/web/contents/conteudos/Images/luximetro.jpg new file mode 100644 index 00000000..90407d7b Binary files /dev/null and b/branches/SIPRP/web/contents/conteudos/Images/luximetro.jpg differ diff --git a/branches/SIPRP/web/contents/conteudos/Images/regulador_caudal.jpg b/branches/SIPRP/web/contents/conteudos/Images/regulador_caudal.jpg new file mode 100644 index 00000000..397db268 Binary files /dev/null and b/branches/SIPRP/web/contents/conteudos/Images/regulador_caudal.jpg differ diff --git a/branches/SIPRP/web/contents/conteudos/Images/sonometro.jpg b/branches/SIPRP/web/contents/conteudos/Images/sonometro.jpg new file mode 100644 index 00000000..e54c3cb3 Binary files /dev/null and b/branches/SIPRP/web/contents/conteudos/Images/sonometro.jpg differ diff --git a/branches/SIPRP/web/contents/conteudos/Images/stress_termico.jpg b/branches/SIPRP/web/contents/conteudos/Images/stress_termico.jpg new file mode 100644 index 00000000..9a1652f7 Binary files /dev/null and b/branches/SIPRP/web/contents/conteudos/Images/stress_termico.jpg differ diff --git a/branches/SIPRP/web/contents/conteudos/Images/termoanemometro.jpg b/branches/SIPRP/web/contents/conteudos/Images/termoanemometro.jpg new file mode 100644 index 00000000..bda7a07f Binary files /dev/null and b/branches/SIPRP/web/contents/conteudos/Images/termoanemometro.jpg differ diff --git a/branches/SIPRP/web/contents/conteudos/colaboradores_text.html b/branches/SIPRP/web/contents/conteudos/colaboradores_text.html new file mode 100644 index 00000000..cde0ae2d --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/colaboradores_text.html @@ -0,0 +1,114 @@ + + + + + + SIPRP - Apresentação + + +Área reservada a parceiros da SIPRP.
+Esta página dá acesso a funcionalidades exclusivas e confidenciais.
+
    +
  • + Acesso ao webmail SIPRP +
  • +
  • + Acesso a Aplicações de Gestão de SHST - Acesso reservado +
  • +
  • + Junte-se a Nós
    +
    + +
  • +
+ + diff --git a/branches/SIPRP/web/contents/conteudos/contactos_text.html b/branches/SIPRP/web/contents/conteudos/contactos_text.html new file mode 100644 index 00000000..49d25e25 --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/contactos_text.html @@ -0,0 +1,105 @@ + + + + + SIPRP - Apresentação + + + + +SIPRP – Sociedade Ibérica de Prevenção de Riscos +Profissionais
+
+Edifício Atrium Saldanha
+Praça Duque de Saldanha, 1 – +9º G
+1050 – 094 Lisboa
+
+Telefone: 21 350 45 40
+Fax: 21 350 45 49
+E-mail: geral@siprp.pt
+
+
+Pedir mais informações
+
+ + + + diff --git a/branches/SIPRP/web/contents/conteudos/higiene_foto_equip_BA.html b/branches/SIPRP/web/contents/conteudos/higiene_foto_equip_BA.html new file mode 100644 index 00000000..27998fee --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/higiene_foto_equip_BA.html @@ -0,0 +1,29 @@ + + + + + SIPRP - Serviços + + + + + + + + + + + + + + +

+
Bomba de Amostragem de ar
+
voltar +»
+
+
+ + diff --git a/branches/SIPRP/web/contents/conteudos/higiene_text.html b/branches/SIPRP/web/contents/conteudos/higiene_text.html new file mode 100644 index 00000000..26d9268a --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/higiene_text.html @@ -0,0 +1,59 @@ + + + + + SIPRP - Serviços + + +Para a prestação deste serviço, a SIPRP +colocará à disposição um dos seus +Técnicos Superiores de Higiene e Segurança, que +garantirá o cumprimento das seguintes actividades nas +várias instalações da empresa espalhadas por todo +o país:
+

+ - Identificação e avaliação dos +riscos;
+ - Planeamento da prevenção, integrando-a a todos os +níveis da hierarquia;
+ - Elaboração de um programa de +prevenção de riscos profissionais;
+ - Informação sobre riscos e medidas de +protecção;
+ - Organização de medidas a adoptar em caso de +perigo +grave;
+ - Coordenação das auditorias internas para controlo +da aplicação das medidas a implementar;
+  +- Análise dos acidentes de trabalho e doenças +profissionais;
+  +- Recolha e organização de elementos +estatísticos.
+

+Estas actividades estão englobadas nas várias auditorias, +medições, avaliações e respectivos +relatórios efectuados pelo técnico.
+A SIPRP efectuará, no mínimo, DUAS auditorias por cada +estabelecimento e ano, que originarão os respectivos +relatórios técnicos com o levantamento das +condições verificadas e as recomendações +para a resolução das não conformidades encontradas.
+Com esse relatório será elaborado um Plano de +Actuação que será entregue ao coordenador do +serviço na empresa com as acções a desenvolver, +prazos de implementação e responsabilidades.
+Para além dos serviços incluídos e exigidos pela +legislação, a SIPRP possui capacidade (técnica e +humana) para efectuar avaliações específicas no +âmbito da Higiene e Segurança.
+Desde Estudos de Ruído, Iluminação, Conforto +Térmico, Qualidade do Ar, bem como outros factores relacionados +com outros riscos físicos, químicos ou biológicos.
+Para o cumprimento destes requisitos a SIPRP possui equipamento +técnico próprio, de acordo com as normas nacionais e +internacionais.
+ + diff --git a/branches/SIPRP/web/contents/conteudos/higiene_text_equip.html b/branches/SIPRP/web/contents/conteudos/higiene_text_equip.html new file mode 100644 index 00000000..a972d096 --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/higiene_text_equip.html @@ -0,0 +1,36 @@ + + + + + SIPRP - Serviços + + +Bombas de Amostragem
+ - Para captação do volume de ar pretendido para a +amostra
+Reguladores de Caudal
+ - Para regulação do caudal de ar pretendido para +amostra
+Monitores de Conforto +Térmico
+ - Para determinação dos parâmetros de +conforto térmico
+Termoanemómetros
+ - Para medição da temperatura, humidade relativa e +velocidade do ar
+Explosivímetros
+ - Para medir a concentração de oxigénio, +CO2, Metano, entre outros
+Luxímetros
+ - Para medição de luminância e +iluminância
+Dosímetros
+ - Para avaliação da exposição pessoal +diária de um trabalhador ao ruído
+Sonómetros +Integradores
+ - Para avaliação dos níveis de ruído +ocupacional ou ambiental
+Outros
+ + diff --git a/branches/SIPRP/web/contents/conteudos/links_text.html b/branches/SIPRP/web/contents/conteudos/links_text.html new file mode 100644 index 00000000..d76b4468 --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/links_text.html @@ -0,0 +1,87 @@ + + + + + SIPRP - Apresentação + + +

+ACT +– www.act.gov.pt
+Agência Europeia para a +Segurança +e Saúde do Trabalho – www.agency.osha.eu.int
+American +Institute of Chemical Engineers – www.aiche.org
+American +Industrial Hygiene Association – www.aiha.org
+Associação +Portuguesa de Seguradores – www.apseguradores.pt
+Bureau +of Labour Statistics – www.stats.bls.gov
+Cornell +University Ergonomics Web – www.ergo.human.cornell.edu
+Direcção +Geral de Saúde – www.dgs.pt
+Factor +Segurança – www.factor-segur.pt
+ Gabinete de Estratégia e Planeamento – +www.dgeep.mtss.gov.pt
+Industrial +Safety and Health News – www.ishn.com
+Institut +Nacional de Recherche et de Securité – www.inrs.fr
+Institute +for Research in Construction – +www.irc.nrc-cnrc.gc.ca/irccontents.html
+Instituto +de Apoio às Pequenas e Médias Empresas e ao +Investimento – www.iapmei.pt
+Instituto +Nacional de Estatística – www.ine.pt
+Instituto +para a Qualidade na Formação – +www.inofor.pt
+International +Labor Organization – www.ilo.org
+International +Organization for Standardization – ISO – +www.iso.org/iso/en/isoonline.frontpage
+International +Society for Respiratory Protection – www.isrp.com.au
+Ministério do Trabalho e +da Segurança Social – www.mtss.gov.pt
+National +Fire Protection Association – www.nfpa.org
+Occupational +Safety and Health Administration – OSHA – www.osha.gov
+Ordem +dos Enfermeiros – www.ordemenfermeiros.pt
+Ordem +dos Médicos – www.ordemdosmedicos.pt
+Revista +Proteção – www.protecao.com.br
+Revista +Segurança – www.revistaseguranca.com
+World +Health Organization (OMS) – www.who.int/en

+ + diff --git a/branches/SIPRP/web/contents/conteudos/medicina_text.html b/branches/SIPRP/web/contents/conteudos/medicina_text.html new file mode 100644 index 00000000..cdbeef47 --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/medicina_text.html @@ -0,0 +1,32 @@ + + + + + SIPRP - Serviços + + +A SIPRP possui um gabinete médico completamente equipado na sua +sede do Atrium Saldanha, em Lisboa, onde se encontra a sua Directora +Clínica, especialista em Medicina do Trabalho.
+Para além disso, e uma vez que tem a possibilidade de prestar o +serviço em todo o território nacional, possui uma rede de +clínicas, médicos, enfermeiros e laboratórios de +análises clínicas contratados com capacidade de poder +prestar o serviço dentro dos parâmetros de qualidade que +preconiza.
+Por último, tem, também, capacidade para fazer deslocar +Médicos do Trabalho às empresas, desde que estas possuam +gabinete médico próprio com as condições +mínimas exigidas pela legislação portuguesa.
+A Direcção Clínica da SIPRP desenha perfis +médicos adequados aos riscos a que estão expostos os +trabalhadores das suas empresas Clientes, não excluindo, +inclusivamente, a possibilidade de serem efectuados outros exames +complementares de diagnóstico conforme os riscos +específicos de cada actividade, como sejam os trabalhadores +expostos a factores físicos (como ruído, stress +térmico, iluminação, entre outros), +químicos (por exemplo, pessoal de limpeza) ou biológicos +(por exemplo, manipuladores de alimentos).
+ + diff --git a/branches/SIPRP/web/contents/conteudos/politica_text.html b/branches/SIPRP/web/contents/conteudos/politica_text.html new file mode 100644 index 00000000..3e52de72 --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/politica_text.html @@ -0,0 +1,69 @@ + + + + + SIPRP - Serviços + + + +Porque sabemos que a gestão administrativa do serviço de +SHST é difícil para a empresa, a SIPRP tomará a +seu cargo essas tarefas, simplificando todo o processo.
+Notificações ao ISHST(ex-IDICT) (Mod. 1360)
+ +Relatório Anual de Actividade de SHST
+ +Marcações de Consultas
+ +Informação on line
+ +Informação sobre legislação
+ +Controlos de Qualidade
+ + + diff --git a/branches/SIPRP/web/contents/conteudos/politica_text_20050106.html b/branches/SIPRP/web/contents/conteudos/politica_text_20050106.html new file mode 100644 index 00000000..cc78d7ab --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/politica_text_20050106.html @@ -0,0 +1,59 @@ + + + + + SIPRP - Serviços + + +Porque sabemos que a gestão administrativa do serviço de +SHST é difícil para a empresa, a SIPRP tomará a +seu cargo essas tarefas, simplificando todo o processo.
+Notificações ao ISHST +(ex-IDICT) (Mod. 1360)
+Elaboração e entrega da Notificação em cada +delegação ou subdelegação do ISHST +(ex-IDICT) onde a empresa tenha estabelecimento. Após a +confirmação da recepção desses documentos +por parte do ISHST, serão enviadas cópias autenticadas +para a empresa.
+Relatório Anual de Actividade +de SHST
+Compilação da informação, +elaboração e entrega dos Relatórios (um por cada +estabelecimento) através de suporte informático pela +Internet. Após a confirmação da +recepção desses documentos por parte dos serviços +competentes, serão enviadas cópias para a empresa.
+Marcações de Consultas
+A SIPRP, através do seu avançado sistema +informático, será responsável pela +marcação dos exames de Medicina do Trabalho +(Admissão, Periódico ou Ocasional) conforme a +periodicidade indicada pela legislação (anualmente para +os trabalhadores com menos de 18 e mais de 50 anos e de dois em dois +anos para os restantes).
+Informação on line
+A SIPRP possibilita à empresa, através deste site, a +visualização do histórico do serviço +(consultas efectuadas, marcações, faltas, data da +próxima consulta, se tem Ficha de Aptidão emitida, entre +outros) durante as 24 horas do dia, todos os dias do ano. Essa +informação será, logicamente, confidencial, +não tendo qualquer dado médico (ao abrigo do sigilo +profissional) e exigirá a introdução de uma +palavra passe previamente remetida à empresa.
+Informação sobre +legislação
+A SIPRP será responsável pelo envio, com periodicidade +acordada, da actualização de toda a +legislação de SHST (portuguesa e europeia) sobre a +actividade específica da empresa Cliente, mantendo-a a par de +todas as obrigações legais inerentes.
+Controlos de Qualidade
+Serão efectuados questionários de controlo de qualidade, +por amostragem, tanto aos funcionários da empresas bem como aos +responsáveis directos pelo serviço, com o objectivo de se +poder aperfeiçoar, melhorar ou intervir rapidamente nalgum +aspecto que não corresponda às expectativas da empresa.
+ + diff --git a/branches/SIPRP/web/contents/conteudos/servicos_compl_text.html b/branches/SIPRP/web/contents/conteudos/servicos_compl_text.html new file mode 100644 index 00000000..ce16c605 --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/servicos_compl_text.html @@ -0,0 +1,71 @@ + + + + + SIPRP - Serviços + + + +A SIPRP, devido à sua competência técnica e humana, +põe à disposição dos seus Clientes um leque +de serviços muito abrangente, tendo sempre em conta o respeito +pela legislação vigente e pelos princípios de +rigor, transparência e qualidade.
+
+Poderá consultar, seguidamente, alguns dos serviços que +poderemos oferecer:
+
+
+Segurança, Higiene e Saúde do Trabalho
+ +Formação
+ +Ergonomia
+ +Estudos e Análises Técnicas de Agentes Físicos (Iluminação, Ruído, Radiações, Ambiente Térmico e Vibrações)
+ +Estudos e Análises Técnicas de Contaminantes Químicos (Poeiras, Gases e Vapores, Líquidos e Fumos)
+ +Estudos e Análises Técnicas de Contaminantes Biológicos (Vírus, Bactérias, Fungos e Parasitas)
+ +Outros
+ +
+ + diff --git a/branches/SIPRP/web/contents/conteudos/servicos_compl_text_20050106.html b/branches/SIPRP/web/contents/conteudos/servicos_compl_text_20050106.html new file mode 100644 index 00000000..94ebe148 --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/servicos_compl_text_20050106.html @@ -0,0 +1,71 @@ + + + + + SIPRP - Serviços + + +A SIPRP, devido à sua competência técnica e humana, +põe à disposição dos seus Clientes um leque +de serviços muito abrangente, tendo sempre em conta o respeito +pela legislação vigente e pelos princípios de +rigor, transparência e qualidade.
+
+Poderá consultar, seguidamente, alguns dos serviços que +poderemos oferecer:
+
+

+Segurança, Higiene e Saúde do Trabalho
+ - Serviços à Medida do Cliente ou sua actividade +obedecendo à legislação portuguesa em vigor
+ - Medicina do Trabalho
+ - Levantamento e Avaliação de Riscos
+ - Apoio Administrativo
+Formação
+ - Primeiros Socorros
+ - Acções de Sensibilização em Higiene +e +Segurança e EPI’s
+ - Meios de Combate a Incêndios
+ - Movimentação Mecânica de Cargas +(Empilhadores +e outros)
+ - Manipulação de Cargas
+Ergonomia
+ - Avaliação da Carga Física
+ - Movimentação Manual de Cargas
+ - Prevenção de Lesões +Músculo-Esqueléticas
+ - Análise de Postos de Trabalho
+Estudos e Análises Técnicas de Agentes Físicos +(Iluminação, Ruído, Radiações, +Ambiente Térmico e Vibrações)
+ - Estudos de Luminância e Iluminância
+ - Estudos de Ruído Ocupacional
+ - Estudos de Radiações Ionizantes (i.e. RX) e +Não Ionizantes (i.e. Campos Electromagnéticos dos +Computadores)
+ - Estudos de Conforto e Stress Térmico
+ - Estudos de Vibrações
+Estudos e Análises Técnicas de Contaminantes +Químicos (Poeiras, Gases e Vapores, Líquidos e Fumos)
+ - Estudos de Poeiras (Totais e Respiráveis)
+ - Compostos Orgânicos Voláteis, Formaldaído e +Nicotina
+Estudos e Análises Técnicas de Contaminantes +Biológicos (Vírus, Bactérias, Fungos e Parasitas)
+ - Legionella Pneumóphila
+ - Exames Microbiológicos (i.e. interior de condutas do +sistema AVAC)
+ - Estudos de Microrganismos em Suspensão no Ar
+ Outros
+ - Planos de Emergência / Evacuação
+ - Medicina Curativa
+ - Enfermagem
+ - Análises Clínicas
+ - Exames Complementares de Diagnóstico
+ - Comercialização de Sinalética de +Segurança
+

+ + diff --git a/branches/SIPRP/web/contents/conteudos/siprp_text.html b/branches/SIPRP/web/contents/conteudos/siprp_text.html new file mode 100644 index 00000000..0595b656 --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/siprp_text.html @@ -0,0 +1,27 @@ + + + + + SIPRP - Apresentação + + +A SIPRP - Sociedade Ibérica de Prevenção de Riscos +Profissionais é uma empresa de origem espanhola formada com a +finalidade de optimizar as sinergias entre empresas de sectores e +âmbitos geográficos diferentes, resultando num grupo +sólido e competitivo, capaz de oferecer as respostas adequadas +para uma gestão eficaz dos serviços de Segurança, +Higiene e Saúde do Trabalho (SHST) junto dos seus Clientes.
+
+A SIPRP aposta fortemente na inovação +e pretende ser uma +empresa de referência no sector, assentando a sua +actuação no rigor, seriedade e em compromissos +sólidos com os seus Clientes e suas necessidades.
+
+Porque a prevenção é a base de todo o trabalho +nesta área, na SIPRP temos em conta a especificidade da +actividade de cada empresa, as condições de trabalho dos +seus colaboradores e todos os factores que os rodeiam.
+ + diff --git a/branches/SIPRP/web/contents/conteudos/siprp_text_inovacao.html b/branches/SIPRP/web/contents/conteudos/siprp_text_inovacao.html new file mode 100644 index 00000000..a04576ab --- /dev/null +++ b/branches/SIPRP/web/contents/conteudos/siprp_text_inovacao.html @@ -0,0 +1,22 @@ + + + + + SIPRP - Apresentação + + +Como factores de sucesso na inovação, salientamos:
+
+- Atendimento personalizado, baseado numa sólida plataforma +informática;
+- Informação actualizada on-line;
+- Equipamento técnico de última geração;
+- Instalações modernas e funcionais;
+- Técnicos Superiores qualificados;
+- Acompanhamento permanente das necessidades e exigências dos +Clientes;
+- Diversas opções para prestação dos +serviços (à medida de cada actividade)
+
+ + diff --git a/branches/SIPRP/web/contents/css/funcs.js b/branches/SIPRP/web/contents/css/funcs.js new file mode 100644 index 00000000..099f6df4 --- /dev/null +++ b/branches/SIPRP/web/contents/css/funcs.js @@ -0,0 +1,64 @@ +function showhide( id ) +{ + if( document.getElementById ) + { + obj = document.getElementById( id ); + if ( obj.style.display == "none" ) + { + obj.style.display = ""; + document.getElementById( 'span_' + id ).style.color = "#C13F45"; + } + else + { + obj.style.display = "none"; + document.getElementById( 'span_' + id ).style.color = "#497895"; + } + } +} + +function isValidDate( year, month, day ) +{ + return day > 0 && ( day <= [, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][ month ] || + day == 29 && month == 2 && year % 4 == 0 && ( year % 100 > 0 || year % 400 == 0 ) ); +} + +function isValid( element, type ) +{ + switch( type ) + { + // date + case 0: + if( element.value.search( /^\d\d?\/\d\d?\/\d{1,4}$/ ) != 0 ) + { + alert( "Formato da data incorrecto." ); + window.setTimeout( "document.getElementById( '" + element.name + "').focus()", 1 ); + return false; + } + date_value = element.value.split( "/" ); + if( ! isValidDate( date_value[ 2 ], date_value[ 1 ], date_value[ 0 ] ) ) + { + alert( "Data inválida." ); + window.setTimeout( "document.getElementById( '" + element.name + "').focus()", 1 ); + return false; + } + break; + // integer + case 1: + if( element.value.search( /^\d\d:\d\d$/ ) != 0 ) + { + alert( "Formato da hora incorrecto." ); + window.setTimeout( "document.getElementById( '" + element.name + "' ).focus()", 1 ); + return false; + } + time_value = element.value.split( ":" ); + if( time_value[ 0 ] > 23 || time_value[ 1 ] > 59 ) + { + alert( "Hora inválida." ); + window.setTimeout( "document.getElementById( '" + element.name + "').focus()", 1 ); + return false; + } + break; + } + + return true; +} diff --git a/branches/SIPRP/web/contents/css/style.css b/branches/SIPRP/web/contents/css/style.css new file mode 100644 index 00000000..78159917 --- /dev/null +++ b/branches/SIPRP/web/contents/css/style.css @@ -0,0 +1,129 @@ +body +{ + color: #497895; + font-family: verdana; + margin-top: 0px; +} + +.text +{ + color: #497895; + font-family: verdana; + font-size: 10pt; + text-align: justify; +} + +.noticias +{ + color: #497895; + font-family: verdana; + font-size: 9pt; + text-align: left; +} + +td.asd +{ + border-width: 1px 1px 1px 1px; + border-style: solid; +} + +td.title +{ + color: #ffffff; + font-family: verdana; + font-size: 10pt; + font-weight: bold; +} + +td.noticias +{ + font-size: 9pt; +} + +td.footer +{ + color: #ffffff; + font-family: verdana; + font-size: 8pt; + text-align: right; +} + +a:link, +a:visited, +a:active +{ + color: #497895; + font-family: verdana; + font-size: 10pt; + font-weight: bold; + text-decoration: none; +} + +a:hover +{ + color: #C13F45; + font-family: verdana; + font-size: 10pt; + font-weight: bold; + text-decoration: none; +} + +a.menu:link, +a.menu:visited, +a.menu:active +{ + color: #FFFFFF; + font-family: verdana; + font-size: 10pt; + font-weight: bold; + text-decoration: none; +} + +a.menu:hover +{ + color: #C13F45; + font-family: verdana; + font-size: 10pt; + font-weight: bold; + text-decoration: none; +} + +a.big:link, +a.big:visited, +a.big:active +{ + color: #497895; + font-family: verdana; + font-size: 12pt; + font-weight: bold; + text-decoration: none; +} + +a.big:hover +{ + color: #C13F45; + font-family: verdana; + font-size: 12pt; + font-weight: bold; + text-decoration: none; +} + +a.copy:link, +a.copy:visited, +a.copy:active +{ + color: #FFFFFF; + font-family: verdana; + font-size: 8pt; + font-weight: normal; + text-decoration: underline; +} + +select, +option, +input +{ + color: #497895; + font-family: verdana; + margin-top: 0px; +} diff --git a/branches/SIPRP/web/contents/erro.html b/branches/SIPRP/web/contents/erro.html new file mode 100644 index 00000000..ce6f9d47 --- /dev/null +++ b/branches/SIPRP/web/contents/erro.html @@ -0,0 +1,44 @@ + + + + + SIPRP - Erro + + + + + + + + + + + + + + + +
  erro
+
+ + + + + + + + + + +

+

+
+ $msg +
+

+
+

+
+ + diff --git a/branches/SIPRP/web/contents/frame_erro.html b/branches/SIPRP/web/contents/frame_erro.html new file mode 100644 index 00000000..f97eab0b --- /dev/null +++ b/branches/SIPRP/web/contents/frame_erro.html @@ -0,0 +1,254 @@ + + + + + + SIPRP + + + + + + + + + + + +

+
+ + + + + + + + + + + + + + + +

+

+
a SIPRPserviçoscolaboradorescontactoslinks 
+ + + + + + + + + + + + + + + + +
+ + +
+
+ + + + + + +
+
+ + + + + + + + + + + + + + + +
user
password
+
+
+

+
+ + + + + + + + + + + + + + +
   notícias
+
+ + + + + + + + + + +

+

+
A SIPRP apresenta o +seu novo site em www.siprp.pt.
+
+Além de conteúdos sobre a empresa e o grupo, é +disponibilizado um portal online com funcionalidades para os seus +clientes.

+

+
+

+
+
+
+ + diff --git a/branches/SIPRP/web/contents/higiene.html b/branches/SIPRP/web/contents/higiene.html new file mode 100644 index 00000000..1ef5315b --- /dev/null +++ b/branches/SIPRP/web/contents/higiene.html @@ -0,0 +1,52 @@ + + + + + SIPRP - Higiene + + + + + + + + + + + + + + + +
   +higiene e segurança
+
+ + + + + + + + + + +

+

+

+

+

+
+

+
+ + diff --git a/branches/SIPRP/web/contents/images/Siprp.htm b/branches/SIPRP/web/contents/images/Siprp.htm new file mode 100644 index 00000000..9878b626 --- /dev/null +++ b/branches/SIPRP/web/contents/images/Siprp.htm @@ -0,0 +1,60 @@ + + +Siprp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +









em + construção





+
SIPRP - Sociedade Ibérica de Prevenção + de Riscos Profissionais
+
ATRIUM SALDANHA
+
Praça Duque de Saldanha, 1 - 9º + C
+
1050-094 Lisboa
+
Telefone:  (+351) 213 504 + 540
+
Fax: (+351) 213 504 + 549
+





Desenvolvimento + por: Evolute - Consultoria Informática, Lda

diff --git a/branches/SIPRP/web/contents/images/_vti_cnf/Siprp.htm b/branches/SIPRP/web/contents/images/_vti_cnf/Siprp.htm new file mode 100644 index 00000000..b9799b2a --- /dev/null +++ b/branches/SIPRP/web/contents/images/_vti_cnf/Siprp.htm @@ -0,0 +1,18 @@ +vti_encoding:SR|utf8-nl +vti_timelastmodified:TR|06 Sep 2004 16:01:35 -0000 +vti_extenderversion:SR|5.0.2.2623 +vti_cacheddtm:TX|06 Sep 2004 16:01:35 -0000 +vti_filesize:IR|2907 +vti_cachedtitle:SR|Siprp +vti_cachedbodystyle:SR| +vti_cachedlinkinfo:VX|S|Siprp_ficheiros/logo_siprp.jpg H|mailto:geral@siprp.pt +vti_cachedsvcrellinks:VX|NSUS|images/Siprp_ficheiros/logo_siprp.jpg NHUS|mailto:geral@siprp.pt +vti_cachedneedsrewrite:BR|false +vti_cachedhasbots:BR|false +vti_cachedhastheme:BR|false +vti_cachedhasborder:BR|false +vti_metatags:VR|HTTP-EQUIV=content-type text/html;\\ charset=ISO-8859-1 GENERATOR MSHTML\\ 6.00.2800.1458 +vti_charset:SR|windows-1252 +vti_generator:SR|MSHTML 6.00.2800.1458 +vti_title:SR|Siprp +vti_backlinkinfo:VX| diff --git a/branches/SIPRP/web/contents/images/_vti_cnf/logo_siprp.jpg b/branches/SIPRP/web/contents/images/_vti_cnf/logo_siprp.jpg new file mode 100644 index 00000000..0855abb5 --- /dev/null +++ b/branches/SIPRP/web/contents/images/_vti_cnf/logo_siprp.jpg @@ -0,0 +1,11 @@ +vti_encoding:SR|utf8-nl +vti_author:SR|op233351b +vti_modifiedby:SR|op233351b +vti_timelastmodified:TR|06 Sep 2004 17:07:36 -0000 +vti_timecreated:TR|06 Sep 2004 17:07:36 -0000 +vti_cacheddtm:TX|06 Sep 2004 17:07:36 -0000 +vti_filesize:IR|6174 +vti_extenderversion:SR|5.0.2.2623 +vti_lastwidth:IX|449 +vti_lastheight:IX|101 +vti_backlinkinfo:VX|index.html diff --git a/branches/SIPRP/web/contents/images/base_740.gif b/branches/SIPRP/web/contents/images/base_740.gif new file mode 100644 index 00000000..4525df88 Binary files /dev/null and b/branches/SIPRP/web/contents/images/base_740.gif differ diff --git a/branches/SIPRP/web/contents/images/fundo.jpg b/branches/SIPRP/web/contents/images/fundo.jpg new file mode 100644 index 00000000..75bdae11 Binary files /dev/null and b/branches/SIPRP/web/contents/images/fundo.jpg differ diff --git a/branches/SIPRP/web/contents/images/green.gif b/branches/SIPRP/web/contents/images/green.gif new file mode 100644 index 00000000..3ad4957f Binary files /dev/null and b/branches/SIPRP/web/contents/images/green.gif differ diff --git a/branches/SIPRP/web/contents/images/login.jpg b/branches/SIPRP/web/contents/images/login.jpg new file mode 100644 index 00000000..904f0ff3 Binary files /dev/null and b/branches/SIPRP/web/contents/images/login.jpg differ diff --git a/branches/SIPRP/web/contents/images/logo_siprp.jpg b/branches/SIPRP/web/contents/images/logo_siprp.jpg new file mode 100644 index 00000000..408fba09 Binary files /dev/null and b/branches/SIPRP/web/contents/images/logo_siprp.jpg differ diff --git a/branches/SIPRP/web/contents/images/logout.gif b/branches/SIPRP/web/contents/images/logout.gif new file mode 100644 index 00000000..5499567d Binary files /dev/null and b/branches/SIPRP/web/contents/images/logout.gif differ diff --git a/branches/SIPRP/web/contents/images/noticias_base.jpg b/branches/SIPRP/web/contents/images/noticias_base.jpg new file mode 100644 index 00000000..c684b17c Binary files /dev/null and b/branches/SIPRP/web/contents/images/noticias_base.jpg differ diff --git a/branches/SIPRP/web/contents/images/noticias_top.jpg b/branches/SIPRP/web/contents/images/noticias_top.jpg new file mode 100644 index 00000000..ea853228 Binary files /dev/null and b/branches/SIPRP/web/contents/images/noticias_top.jpg differ diff --git a/branches/SIPRP/web/contents/images/red.gif b/branches/SIPRP/web/contents/images/red.gif new file mode 100644 index 00000000..8939cc78 Binary files /dev/null and b/branches/SIPRP/web/contents/images/red.gif differ diff --git a/branches/SIPRP/web/contents/images/rodape.jpg b/branches/SIPRP/web/contents/images/rodape.jpg new file mode 100644 index 00000000..ef0b3344 Binary files /dev/null and b/branches/SIPRP/web/contents/images/rodape.jpg differ diff --git a/branches/SIPRP/web/contents/images/texto_base.gif b/branches/SIPRP/web/contents/images/texto_base.gif new file mode 100644 index 00000000..cf7fab7a Binary files /dev/null and b/branches/SIPRP/web/contents/images/texto_base.gif differ diff --git a/branches/SIPRP/web/contents/images/texto_base.jpg b/branches/SIPRP/web/contents/images/texto_base.jpg new file mode 100644 index 00000000..3f95026a Binary files /dev/null and b/branches/SIPRP/web/contents/images/texto_base.jpg differ diff --git a/branches/SIPRP/web/contents/images/texto_base_1.jpg b/branches/SIPRP/web/contents/images/texto_base_1.jpg new file mode 100644 index 00000000..3504d370 Binary files /dev/null and b/branches/SIPRP/web/contents/images/texto_base_1.jpg differ diff --git a/branches/SIPRP/web/contents/images/texto_top.jpg b/branches/SIPRP/web/contents/images/texto_top.jpg new file mode 100644 index 00000000..5a5a6612 Binary files /dev/null and b/branches/SIPRP/web/contents/images/texto_top.jpg differ diff --git a/branches/SIPRP/web/contents/images/texto_top_1.jpg b/branches/SIPRP/web/contents/images/texto_top_1.jpg new file mode 100644 index 00000000..92b7c389 Binary files /dev/null and b/branches/SIPRP/web/contents/images/texto_top_1.jpg differ diff --git a/branches/SIPRP/web/contents/images/texto_topo.gif b/branches/SIPRP/web/contents/images/texto_topo.gif new file mode 100644 index 00000000..82c67ebf Binary files /dev/null and b/branches/SIPRP/web/contents/images/texto_topo.gif differ diff --git a/branches/SIPRP/web/contents/images/topo_740.gif b/branches/SIPRP/web/contents/images/topo_740.gif new file mode 100644 index 00000000..61466a24 Binary files /dev/null and b/branches/SIPRP/web/contents/images/topo_740.gif differ diff --git a/branches/SIPRP/web/contents/images/white.gif b/branches/SIPRP/web/contents/images/white.gif new file mode 100644 index 00000000..cdf578c9 Binary files /dev/null and b/branches/SIPRP/web/contents/images/white.gif differ diff --git a/branches/SIPRP/web/contents/images/yellow.gif b/branches/SIPRP/web/contents/images/yellow.gif new file mode 100644 index 00000000..c98503a3 Binary files /dev/null and b/branches/SIPRP/web/contents/images/yellow.gif differ diff --git a/branches/SIPRP/web/contents/index.html b/branches/SIPRP/web/contents/index.html new file mode 100644 index 00000000..0f17056d --- /dev/null +++ b/branches/SIPRP/web/contents/index.html @@ -0,0 +1,229 @@ + + + + + + + SIPRP + + + + + + + + + + + +

+
+ + + + + + + + + + + + + + + +

+

+
a SIPRPserviçosparceiroscontactoslinks 
+ + + + + + + + + + + + + + +

+
+ + + + + + +
+
+ + + + + + + + + + + + + + + +
user
password
+
+
+
+ + + + + + + + + + + + + +
   notícias
+
+ + + + + + + + + + +

+

+
+ +
+

+
+

+
+
+
+ + diff --git a/branches/SIPRP/web/contents/links.html b/branches/SIPRP/web/contents/links.html new file mode 100644 index 00000000..ae2134b2 --- /dev/null +++ b/branches/SIPRP/web/contents/links.html @@ -0,0 +1,52 @@ + + + + + SIPRP - Links + + + + + + + + + + + + + + + +
   +links úteis
+
+ + + + + + + + + + +

+

+

+

+

+
+

+
+ + diff --git a/branches/SIPRP/web/contents/mail/cv_enviado.html b/branches/SIPRP/web/contents/mail/cv_enviado.html new file mode 100644 index 00000000..0bd37216 --- /dev/null +++ b/branches/SIPRP/web/contents/mail/cv_enviado.html @@ -0,0 +1,11 @@ + + + + + + Enviado + + + A sua informação foi enviada com sucesso. + + diff --git a/branches/SIPRP/web/contents/mail/cv_nao_enviado.html b/branches/SIPRP/web/contents/mail/cv_nao_enviado.html new file mode 100644 index 00000000..dd8c1671 --- /dev/null +++ b/branches/SIPRP/web/contents/mail/cv_nao_enviado.html @@ -0,0 +1,12 @@ + + + + + + Erro a enviar + + + Erro a enviar a sua informação.
+ Verifique que preencheu "Nome Completo", "Telefone" e "E-Mail" com um valor válido. + + diff --git a/branches/SIPRP/web/contents/mail/envio_cv.txt b/branches/SIPRP/web/contents/mail/envio_cv.txt new file mode 100644 index 00000000..69a3da74 --- /dev/null +++ b/branches/SIPRP/web/contents/mail/envio_cv.txt @@ -0,0 +1,7 @@ +Envio de CV + +Função: $rec_funcao +Nome: $rec_nome +Morada: $rec_morada +Telefone: $rec_telefone +E-mail: $rec_email diff --git a/branches/SIPRP/web/contents/mail/pedido_enviado.html b/branches/SIPRP/web/contents/mail/pedido_enviado.html new file mode 100644 index 00000000..ec1854c9 --- /dev/null +++ b/branches/SIPRP/web/contents/mail/pedido_enviado.html @@ -0,0 +1,11 @@ + + + + + + Enviado + + + O seu pedido foi enviado com sucesso + + diff --git a/branches/SIPRP/web/contents/mail/pedido_informacao.txt b/branches/SIPRP/web/contents/mail/pedido_informacao.txt new file mode 100644 index 00000000..3178db98 --- /dev/null +++ b/branches/SIPRP/web/contents/mail/pedido_informacao.txt @@ -0,0 +1,5 @@ +Pedido de informação de: +Nome: $request_name +Telefone: $request_phone +E-mail: $request_email +Assunto: $request_details diff --git a/branches/SIPRP/web/contents/mail/pedido_nao_enviado.html b/branches/SIPRP/web/contents/mail/pedido_nao_enviado.html new file mode 100644 index 00000000..4dcb63f4 --- /dev/null +++ b/branches/SIPRP/web/contents/mail/pedido_nao_enviado.html @@ -0,0 +1,11 @@ + + + + + + Erro a enviar + + + Erro a enviar o seu pedido + + diff --git a/branches/SIPRP/web/contents/marcacao/CalendarPopup.js b/branches/SIPRP/web/contents/marcacao/CalendarPopup.js new file mode 100644 index 00000000..03f4daa3 --- /dev/null +++ b/branches/SIPRP/web/contents/marcacao/CalendarPopup.js @@ -0,0 +1,1462 @@ +// =================================================================== +// Author: Matt Kruse +// WWW: http://www.mattkruse.com/ +// +// NOTICE: You may use this code for any purpose, commercial or +// private, without any further permission from the author. You may +// remove this notice from your final code if you wish, however it is +// appreciated by the author if at least my web site address is kept. +// +// You may *NOT* re-distribute this code in any way except through its +// use. That means, you can include it in your product, or your web +// site, or any other form where the code is actually being used. You +// may not put the plain javascript up on your site for download or +// include it in your javascript libraries for download. +// If you wish to share this code with others, please just point them +// to the URL instead. +// Please DO NOT link directly to my .js files from your site. Copy +// the files to your server and use them there. Thank you. +// =================================================================== + + +/* SOURCE FILE: AnchorPosition.js */ + +/* +AnchorPosition.js +Author: Matt Kruse +Last modified: 10/11/02 + +DESCRIPTION: These functions find the position of an tag in a document, +so other elements can be positioned relative to it. + +COMPATABILITY: Netscape 4.x,6.x,Mozilla, IE 5.x,6.x on Windows. Some small +positioning errors - usually with Window positioning - occur on the +Macintosh platform. + +FUNCTIONS: +getAnchorPosition(anchorname) + Returns an Object() having .x and .y properties of the pixel coordinates + of the upper-left corner of the anchor. Position is relative to the PAGE. + +getAnchorWindowPosition(anchorname) + Returns an Object() having .x and .y properties of the pixel coordinates + of the upper-left corner of the anchor, relative to the WHOLE SCREEN. + +NOTES: + +1) For popping up separate browser windows, use getAnchorWindowPosition. + Otherwise, use getAnchorPosition + +2) Your anchor tag MUST contain both NAME and ID attributes which are the + same. For example: + + +3) There must be at least a space between for IE5.5 to see the + anchor tag correctly. Do not do with no space. +*/ + +// getAnchorPosition(anchorname) +// This function returns an object having .x and .y properties which are the coordinates +// of the named anchor, relative to the page. +function getAnchorPosition(anchorname) { + // This function will return an Object with x and y properties + var useWindow=false; + var coordinates=new Object(); + var x=0,y=0; + // Browser capability sniffing + var use_gebi=false, use_css=false, use_layers=false; + if (document.getElementById) { use_gebi=true; } + else if (document.all) { use_css=true; } + else if (document.layers) { use_layers=true; } + // Logic to find position + if (use_gebi && document.all) { + x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]); + y=AnchorPosition_getPageOffsetTop(document.all[anchorname]); + } + else if (use_gebi) { + var o=document.getElementById(anchorname); + x=AnchorPosition_getPageOffsetLeft(o); + y=AnchorPosition_getPageOffsetTop(o); + } + else if (use_css) { + x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]); + y=AnchorPosition_getPageOffsetTop(document.all[anchorname]); + } + else if (use_layers) { + var found=0; + for (var i=0; i9?"":"0")+x} + +// ------------------------------------------------------------------ +// isDate ( date_string, format_string ) +// Returns true if date string matches format of format string and +// is a valid date. Else returns false. +// It is recommended that you trim whitespace around the value before +// passing it to this function, as whitespace is NOT ignored! +// ------------------------------------------------------------------ +function isDate(val,format) { + var date=getDateFromFormat(val,format); + if (date==0) { return false; } + return true; + } + +// ------------------------------------------------------------------- +// compareDates(date1,date1format,date2,date2format) +// Compare two date strings to see which is greater. +// Returns: +// 1 if date1 is greater than date2 +// 0 if date2 is greater than date1 of if they are the same +// -1 if either of the dates is in an invalid format +// ------------------------------------------------------------------- +function compareDates(date1,dateformat1,date2,dateformat2) { + var d1=getDateFromFormat(date1,dateformat1); + var d2=getDateFromFormat(date2,dateformat2); + if (d1==0 || d2==0) { + return -1; + } + else if (d1 > d2) { + return 1; + } + return 0; + } + +// ------------------------------------------------------------------ +// formatDate (date_object, format) +// Returns a date in the output format specified. +// The format string uses the same abbreviations as in getDateFromFormat() +// ------------------------------------------------------------------ +function formatDate(date,format) { + format=format+""; + var result=""; + var i_format=0; + var c=""; + var token=""; + var y=date.getYear()+""; + var M=date.getMonth()+1; + var d=date.getDate(); + var E=date.getDay(); + var H=date.getHours(); + var m=date.getMinutes(); + var s=date.getSeconds(); + var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k; + // Convert real date parts into formatted versions + var value=new Object(); + if (y.length < 4) {y=""+(y-0+1900);} + value["y"]=""+y; + value["yyyy"]=y; + value["yy"]=y.substring(2,4); + value["M"]=M; + value["MM"]=LZ(M); + value["MMM"]=MONTH_NAMES[M-1]; + value["NNN"]=MONTH_NAMES[M+11]; + value["d"]=d; + value["dd"]=LZ(d); + value["E"]=DAY_NAMES[E+7]; + value["EE"]=DAY_NAMES[E]; + value["H"]=H; + value["HH"]=LZ(H); + if (H==0){value["h"]=12;} + else if (H>12){value["h"]=H-12;} + else {value["h"]=H;} + value["hh"]=LZ(value["h"]); + if (H>11){value["K"]=H-12;} else {value["K"]=H;} + value["k"]=H+1; + value["KK"]=LZ(value["K"]); + value["kk"]=LZ(value["k"]); + if (H > 11) { value["a"]="PM"; } + else { value["a"]="AM"; } + value["m"]=m; + value["mm"]=LZ(m); + value["s"]=s; + value["ss"]=LZ(s); + while (i_format < format.length) { + c=format.charAt(i_format); + token=""; + while ((format.charAt(i_format)==c) && (i_format < format.length)) { + token += format.charAt(i_format++); + } + if (value[token] != null) { result=result + value[token]; } + else { result=result + token; } + } + return result; + } + +// ------------------------------------------------------------------ +// Utility functions for parsing in getDateFromFormat() +// ------------------------------------------------------------------ +function _isInteger(val) { + var digits="1234567890"; + for (var i=0; i < val.length; i++) { + if (digits.indexOf(val.charAt(i))==-1) { return false; } + } + return true; + } +function _getInt(str,i,minlength,maxlength) { + for (var x=maxlength; x>=minlength; x--) { + var token=str.substring(i,i+x); + if (token.length < minlength) { return null; } + if (_isInteger(token)) { return token; } + } + return null; + } + +// ------------------------------------------------------------------ +// getDateFromFormat( date_string , format_string ) +// +// This function takes a date string and a format string. It matches +// If the date string matches the format string, it returns the +// getTime() of the date. If it does not match, it returns 0. +// ------------------------------------------------------------------ +function getDateFromFormat(val,format) { + val=val+""; + format=format+""; + var i_val=0; + var i_format=0; + var c=""; + var token=""; + var token2=""; + var x,y; + var now=new Date(); + var year=now.getYear(); + var month=now.getMonth()+1; + var date=1; + var hh=now.getHours(); + var mm=now.getMinutes(); + var ss=now.getSeconds(); + var ampm=""; + + while (i_format < format.length) { + // Get next token from format string + c=format.charAt(i_format); + token=""; + while ((format.charAt(i_format)==c) && (i_format < format.length)) { + token += format.charAt(i_format++); + } + // Extract contents of value based on format token + if (token=="yyyy" || token=="yy" || token=="y") { + if (token=="yyyy") { x=4;y=4; } + if (token=="yy") { x=2;y=2; } + if (token=="y") { x=2;y=4; } + year=_getInt(val,i_val,x,y); + if (year==null) { return 0; } + i_val += year.length; + if (year.length==2) { + if (year > 70) { year=1900+(year-0); } + else { year=2000+(year-0); } + } + } + else if (token=="MMM"||token=="NNN"){ + month=0; + for (var i=0; i11)) { + month=i+1; + if (month>12) { month -= 12; } + i_val += month_name.length; + break; + } + } + } + if ((month < 1)||(month>12)){return 0;} + } + else if (token=="EE"||token=="E"){ + for (var i=0; i12)){return 0;} + i_val+=month.length;} + else if (token=="dd"||token=="d") { + date=_getInt(val,i_val,token.length,2); + if(date==null||(date<1)||(date>31)){return 0;} + i_val+=date.length;} + else if (token=="hh"||token=="h") { + hh=_getInt(val,i_val,token.length,2); + if(hh==null||(hh<1)||(hh>12)){return 0;} + i_val+=hh.length;} + else if (token=="HH"||token=="H") { + hh=_getInt(val,i_val,token.length,2); + if(hh==null||(hh<0)||(hh>23)){return 0;} + i_val+=hh.length;} + else if (token=="KK"||token=="K") { + hh=_getInt(val,i_val,token.length,2); + if(hh==null||(hh<0)||(hh>11)){return 0;} + i_val+=hh.length;} + else if (token=="kk"||token=="k") { + hh=_getInt(val,i_val,token.length,2); + if(hh==null||(hh<1)||(hh>24)){return 0;} + i_val+=hh.length;hh--;} + else if (token=="mm"||token=="m") { + mm=_getInt(val,i_val,token.length,2); + if(mm==null||(mm<0)||(mm>59)){return 0;} + i_val+=mm.length;} + else if (token=="ss"||token=="s") { + ss=_getInt(val,i_val,token.length,2); + if(ss==null||(ss<0)||(ss>59)){return 0;} + i_val+=ss.length;} + else if (token=="a") { + if (val.substring(i_val,i_val+2).toLowerCase()=="am") {ampm="AM";} + else if (val.substring(i_val,i_val+2).toLowerCase()=="pm") {ampm="PM";} + else {return 0;} + i_val+=2;} + else { + if (val.substring(i_val,i_val+token.length)!=token) {return 0;} + else {i_val+=token.length;} + } + } + // If there are any trailing characters left in the value, it doesn't match + if (i_val != val.length) { return 0; } + // Is date valid for month? + if (month==2) { + // Check for leap year + if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year + if (date > 29){ return 0; } + } + else { if (date > 28) { return 0; } } + } + if ((month==4)||(month==6)||(month==9)||(month==11)) { + if (date > 30) { return 0; } + } + // Correct hours value + if (hh<12 && ampm=="PM") { hh=hh-0+12; } + else if (hh>11 && ampm=="AM") { hh-=12; } + var newdate=new Date(year,month-1,date,hh,mm,ss); + return newdate.getTime(); + } + +// ------------------------------------------------------------------ +// parseDate( date_string [, prefer_euro_format] ) +// +// This function takes a date string and tries to match it to a +// number of possible date formats to get the value. It will try to +// match against the following international formats, in this order: +// y-M-d MMM d, y MMM d,y y-MMM-d d-MMM-y MMM d +// M/d/y M-d-y M.d.y MMM-d M/d M-d +// d/M/y d-M-y d.M.y d-MMM d/M d-M +// A second argument may be passed to instruct the method to search +// for formats like d/M/y (european format) before M/d/y (American). +// Returns a Date object or null if no patterns match. +// ------------------------------------------------------------------ +function parseDate(val) { + var preferEuro=(arguments.length==2)?arguments[1]:false; + generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d'); + monthFirst=new Array('M/d/y','M-d-y','M.d.y','MMM-d','M/d','M-d'); + dateFirst =new Array('d/M/y','d-M-y','d.M.y','d-MMM','d/M','d-M'); + var checkList=new Array('generalFormats',preferEuro?'dateFirst':'monthFirst',preferEuro?'monthFirst':'dateFirst'); + var d=null; + for (var i=0; i tags may cause errors. + +USAGE: +// Create an object for a WINDOW popup +var win = new PopupWindow(); + +// Create an object for a DIV window using the DIV named 'mydiv' +var win = new PopupWindow('mydiv'); + +// Set the window to automatically hide itself when the user clicks +// anywhere else on the page except the popup +win.autoHide(); + +// Show the window relative to the anchor name passed in +win.showPopup(anchorname); + +// Hide the popup +win.hidePopup(); + +// Set the size of the popup window (only applies to WINDOW popups +win.setSize(width,height); + +// Populate the contents of the popup window that will be shown. If you +// change the contents while it is displayed, you will need to refresh() +win.populate(string); + +// set the URL of the window, rather than populating its contents +// manually +win.setUrl("http://www.site.com/"); + +// Refresh the contents of the popup +win.refresh(); + +// Specify how many pixels to the right of the anchor the popup will appear +win.offsetX = 50; + +// Specify how many pixels below the anchor the popup will appear +win.offsetY = 100; + +NOTES: +1) Requires the functions in AnchorPosition.js + +2) Your anchor tag MUST contain both NAME and ID attributes which are the + same. For example: + + +3) There must be at least a space between for IE5.5 to see the + anchor tag correctly. Do not do with no space. + +4) When a PopupWindow object is created, a handler for 'onmouseup' is + attached to any event handler you may have already defined. Do NOT define + an event handler for 'onmouseup' after you define a PopupWindow object or + the autoHide() will not work correctly. +*/ + +// Set the position of the popup window based on the anchor +function PopupWindow_getXYPosition(anchorname) { + var coordinates; + if (this.type == "WINDOW") { + coordinates = getAnchorWindowPosition(anchorname); + } + else { + coordinates = getAnchorPosition(anchorname); + } + this.x = coordinates.x; + this.y = coordinates.y; + } +// Set width/height of DIV/popup window +function PopupWindow_setSize(width,height) { + this.width = width; + this.height = height; + } +// Fill the window with contents +function PopupWindow_populate(contents) { + this.contents = contents; + this.populated = false; + } +// Set the URL to go to +function PopupWindow_setUrl(url) { + this.url = url; + } +// Set the window popup properties +function PopupWindow_setWindowProperties(props) { + this.windowProperties = props; + } +// Refresh the displayed contents of the popup +function PopupWindow_refresh() { + if (this.divName != null) { + // refresh the DIV object + if (this.use_gebi) { + document.getElementById(this.divName).innerHTML = this.contents; + } + else if (this.use_css) { + document.all[this.divName].innerHTML = this.contents; + } + else if (this.use_layers) { + var d = document.layers[this.divName]; + d.document.open(); + d.document.writeln(this.contents); + d.document.close(); + } + } + else { + if (this.popupWindow != null && !this.popupWindow.closed) { + if (this.url!="") { + this.popupWindow.location.href=this.url; + } + else { + this.popupWindow.document.open(); + this.popupWindow.document.writeln(this.contents); + this.popupWindow.document.close(); + } + this.popupWindow.focus(); + } + } + } +// Position and show the popup, relative to an anchor object +function PopupWindow_showPopup(anchorname) { + this.getXYPosition(anchorname); + this.x += this.offsetX; + this.y += this.offsetY; + if (!this.populated && (this.contents != "")) { + this.populated = true; + this.refresh(); + } + if (this.divName != null) { + // Show the DIV object + if (this.use_gebi) { + document.getElementById(this.divName).style.left = this.x + "px"; + document.getElementById(this.divName).style.top = this.y + "px"; + document.getElementById(this.divName).style.visibility = "visible"; + } + else if (this.use_css) { + document.all[this.divName].style.left = this.x; + document.all[this.divName].style.top = this.y; + document.all[this.divName].style.visibility = "visible"; + } + else if (this.use_layers) { + document.layers[this.divName].left = this.x; + document.layers[this.divName].top = this.y; + document.layers[this.divName].visibility = "visible"; + } + } + else { + if (this.popupWindow == null || this.popupWindow.closed) { + // If the popup window will go off-screen, move it so it doesn't + if (this.x<0) { this.x=0; } + if (this.y<0) { this.y=0; } + if (screen && screen.availHeight) { + if ((this.y + this.height) > screen.availHeight) { + this.y = screen.availHeight - this.height; + } + } + if (screen && screen.availWidth) { + if ((this.x + this.width) > screen.availWidth) { + this.x = screen.availWidth - this.width; + } + } + var avoidAboutBlank = window.opera || ( document.layers && !navigator.mimeTypes['*'] ) || navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled ); + this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+""); + } + this.refresh(); + } + } +// Hide the popup +function PopupWindow_hidePopup() { + if (this.divName != null) { + if (this.use_gebi) { + document.getElementById(this.divName).style.visibility = "hidden"; + } + else if (this.use_css) { + document.all[this.divName].style.visibility = "hidden"; + } + else if (this.use_layers) { + document.layers[this.divName].visibility = "hidden"; + } + } + else { + if (this.popupWindow && !this.popupWindow.closed) { + this.popupWindow.close(); + this.popupWindow = null; + } + } + } +// Pass an event and return whether or not it was the popup DIV that was clicked +function PopupWindow_isClicked(e) { + if (this.divName != null) { + if (this.use_layers) { + var clickX = e.pageX; + var clickY = e.pageY; + var t = document.layers[this.divName]; + if ((clickX > t.left) && (clickX < t.left+t.clip.width) && (clickY > t.top) && (clickY < t.top+t.clip.height)) { + return true; + } + else { return false; } + } + else if (document.all) { // Need to hard-code this to trap IE for error-handling + var t = window.event.srcElement; + while (t.parentElement != null) { + if (t.id==this.divName) { + return true; + } + t = t.parentElement; + } + return false; + } + else if (this.use_gebi && e) { + var t = e.originalTarget; + while (t.parentNode != null) { + if (t.id==this.divName) { + return true; + } + t = t.parentNode; + } + return false; + } + return false; + } + return false; + } + +// Check an onMouseDown event to see if we should hide +function PopupWindow_hideIfNotClicked(e) { + if (this.autoHideEnabled && !this.isClicked(e)) { + this.hidePopup(); + } + } +// Call this to make the DIV disable automatically when mouse is clicked outside it +function PopupWindow_autoHide() { + this.autoHideEnabled = true; + } +// This global function checks all PopupWindow objects onmouseup to see if they should be hidden +function PopupWindow_hidePopupWindows(e) { + for (var i=0; i0) { + this.type="DIV"; + this.divName = arguments[0]; + } + else { + this.type="WINDOW"; + } + this.use_gebi = false; + this.use_css = false; + this.use_layers = false; + if (document.getElementById) { this.use_gebi = true; } + else if (document.all) { this.use_css = true; } + else if (document.layers) { this.use_layers = true; } + else { this.type = "WINDOW"; } + this.offsetX = 0; + this.offsetY = 0; + // Method mappings + this.getXYPosition = PopupWindow_getXYPosition; + this.populate = PopupWindow_populate; + this.setUrl = PopupWindow_setUrl; + this.setWindowProperties = PopupWindow_setWindowProperties; + this.refresh = PopupWindow_refresh; + this.showPopup = PopupWindow_showPopup; + this.hidePopup = PopupWindow_hidePopup; + this.setSize = PopupWindow_setSize; + this.isClicked = PopupWindow_isClicked; + this.autoHide = PopupWindow_autoHide; + this.hideIfNotClicked = PopupWindow_hideIfNotClicked; + } + +/* SOURCE FILE: CalendarPopup.js */ + +// HISTORY +// ------------------------------------------------------------------ +// Feb 7, 2005: Fixed a CSS styles to use px unit +// March 29, 2004: Added check in select() method for the form field +// being disabled. If it is, just return and don't do anything. +// March 24, 2004: Fixed bug - when month name and abbreviations were +// changed, date format still used original values. +// January 26, 2004: Added support for drop-down month and year +// navigation (Thanks to Chris Reid for the idea) +// September 22, 2003: Fixed a minor problem in YEAR calendar with +// CSS prefix. +// August 19, 2003: Renamed the function to get styles, and made it +// work correctly without an object reference +// August 18, 2003: Changed showYearNavigation and +// showYearNavigationInput to optionally take an argument of +// true or false +// July 31, 2003: Added text input option for year navigation. +// Added a per-calendar CSS prefix option to optionally use +// different styles for different calendars. +// July 29, 2003: Fixed bug causing the Today link to be clickable +// even though today falls in a disabled date range. +// Changed formatting to use pure CSS, allowing greater control +// over look-and-feel options. +// June 11, 2003: Fixed bug causing the Today link to be unselectable +// under certain cases when some days of week are disabled +// March 14, 2003: Added ability to disable individual dates or date +// ranges, display as light gray and strike-through +// March 14, 2003: Removed dependency on graypixel.gif and instead +/// use table border coloring +// March 12, 2003: Modified showCalendar() function to allow optional +// start-date parameter +// March 11, 2003: Modified select() function to allow optional +// start-date parameter +/* +DESCRIPTION: This object implements a popup calendar to allow the user to +select a date, month, quarter, or year. + +COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small +positioning errors - usually with Window positioning - occur on the +Macintosh platform. +The calendar can be modified to work for any location in the world by +changing which weekday is displayed as the first column, changing the month +names, and changing the column headers for each day. + +USAGE: +// Create a new CalendarPopup object of type WINDOW +var cal = new CalendarPopup(); + +// Create a new CalendarPopup object of type DIV using the DIV named 'mydiv' +var cal = new CalendarPopup('mydiv'); + +// Easy method to link the popup calendar with an input box. +cal.select(inputObject, anchorname, dateFormat); +// Same method, but passing a default date other than the field's current value +cal.select(inputObject, anchorname, dateFormat, '01/02/2000'); +// This is an example call to the popup calendar from a link to populate an +// input box. Note that to use this, date.js must also be included!! +Select + +// Set the type of date select to be used. By default it is 'date'. +cal.setDisplayType(type); + +// When a date, month, quarter, or year is clicked, a function is called and +// passed the details. You must write this function, and tell the calendar +// popup what the function name is. +// Function to be called for 'date' select receives y, m, d +cal.setReturnFunction(functionname); +// Function to be called for 'month' select receives y, m +cal.setReturnMonthFunction(functionname); +// Function to be called for 'quarter' select receives y, q +cal.setReturnQuarterFunction(functionname); +// Function to be called for 'year' select receives y +cal.setReturnYearFunction(functionname); + +// Show the calendar relative to a given anchor +cal.showCalendar(anchorname); + +// Hide the calendar. The calendar is set to autoHide automatically +cal.hideCalendar(); + +// Set the month names to be used. Default are English month names +cal.setMonthNames("January","February","March",...); + +// Set the month abbreviations to be used. Default are English month abbreviations +cal.setMonthAbbreviations("Jan","Feb","Mar",...); + +// Show navigation for changing by the year, not just one month at a time +cal.showYearNavigation(); + +// Show month and year dropdowns, for quicker selection of month of dates +cal.showNavigationDropdowns(); + +// Set the text to be used above each day column. The days start with +// sunday regardless of the value of WeekStartDay +cal.setDayHeaders("S","M","T",...); + +// Set the day for the first column in the calendar grid. By default this +// is Sunday (0) but it may be changed to fit the conventions of other +// countries. +cal.setWeekStartDay(1); // week is Monday - Sunday + +// Set the weekdays which should be disabled in the 'date' select popup. You can +// then allow someone to only select week end dates, or Tuedays, for example +cal.setDisabledWeekDays(0,1); // To disable selecting the 1st or 2nd days of the week + +// Selectively disable individual days or date ranges. Disabled days will not +// be clickable, and show as strike-through text on current browsers. +// Date format is any format recognized by parseDate() in date.js +// Pass a single date to disable: +cal.addDisabledDates("2003-01-01"); +// Pass null as the first parameter to mean "anything up to and including" the +// passed date: +cal.addDisabledDates(null, "01/02/03"); +// Pass null as the second parameter to mean "including the passed date and +// anything after it: +cal.addDisabledDates("Jan 01, 2003", null); +// Pass two dates to disable all dates inbetween and including the two +cal.addDisabledDates("January 01, 2003", "Dec 31, 2003"); + +// When the 'year' select is displayed, set the number of years back from the +// current year to start listing years. Default is 2. +// This is also used for year drop-down, to decide how many years +/- to display +cal.setYearSelectStartOffset(2); + +// Text for the word "Today" appearing on the calendar +cal.setTodayText("Hoje"); + +// The calendar uses CSS classes for formatting. If you want your calendar to +// have unique styles, you can set the prefix that will be added to all the +// classes in the output. +// For example, normal output may have this: +// Today +// But if you set the prefix like this: +cal.setCssPrefix("Test"); +// The output will then look like: +// Today +// And you can define that style somewhere in your page. + +// When using Year navigation, you can make the year be an input box, so +// the user can manually change it and jump to any year +cal.showYearNavigationInput(); + +// Set the calendar offset to be different than the default. By default it +// will appear just below and to the right of the anchorname. So if you have +// a text box where the date will go and and anchor immediately after the +// text box, the calendar will display immediately under the text box. +cal.offsetX = 20; +cal.offsetY = 20; + +NOTES: +1) Requires the functions in AnchorPosition.js and PopupWindow.js + +2) Your anchor tag MUST contain both NAME and ID attributes which are the + same. For example: + + +3) There must be at least a space between for IE5.5 to see the + anchor tag correctly. Do not do with no space. + +4) When a CalendarPopup object is created, a handler for 'onmouseup' is + attached to any event handler you may have already defined. Do NOT define + an event handler for 'onmouseup' after you define a CalendarPopup object + or the autoHide() will not work correctly. + +5) The calendar popup display uses style sheets to make it look nice. + +*/ + +// CONSTRUCTOR for the CalendarPopup Object +function CalendarPopup() { + var c; + if (arguments.length>0) { + c = new PopupWindow(arguments[0]); + } + else { + c = new PopupWindow(); + c.setSize(150,175); + } + c.offsetX = -152; + c.offsetY = 25; + c.autoHide(); + // Calendar-specific properties + c.monthNames = new Array("Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outobro","Novembro","Dezembro"); + c.monthAbbreviations = new Array("Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"); + c.dayHeaders = new Array("D","S","T","Q","Q","S","S"); + c.returnFunction = "CP_tmpReturnFunction"; + c.returnMonthFunction = "CP_tmpReturnMonthFunction"; + c.returnQuarterFunction = "CP_tmpReturnQuarterFunction"; + c.returnYearFunction = "CP_tmpReturnYearFunction"; + c.weekStartDay = 0; + c.isShowYearNavigation = false; + c.displayType = "date"; + c.disabledWeekDays = new Object(); + c.disabledDatesExpression = ""; + c.yearSelectStartOffset = 2; + c.currentDate = null; + c.todayText="Hoje"; + c.cssPrefix=""; + c.isShowNavigationDropdowns=false; + c.isShowYearNavigationInput=false; + window.CP_calendarObject = null; + window.CP_targetInput = null; + window.CP_dateFormat = "dd/MM/yyyy"; + // Method mappings + c.copyMonthNamesToWindow = CP_copyMonthNamesToWindow; + c.setReturnFunction = CP_setReturnFunction; + c.setReturnMonthFunction = CP_setReturnMonthFunction; + c.setReturnQuarterFunction = CP_setReturnQuarterFunction; + c.setReturnYearFunction = CP_setReturnYearFunction; + c.setMonthNames = CP_setMonthNames; + c.setMonthAbbreviations = CP_setMonthAbbreviations; + c.setDayHeaders = CP_setDayHeaders; + c.setWeekStartDay = CP_setWeekStartDay; + c.setDisplayType = CP_setDisplayType; + c.setDisabledWeekDays = CP_setDisabledWeekDays; + c.addDisabledDates = CP_addDisabledDates; + c.setYearSelectStartOffset = CP_setYearSelectStartOffset; + c.setTodayText = CP_setTodayText; + c.showYearNavigation = CP_showYearNavigation; + c.showCalendar = CP_showCalendar; + c.hideCalendar = CP_hideCalendar; + c.getStyles = getCalendarStyles; + c.refreshCalendar = CP_refreshCalendar; + c.getCalendar = CP_getCalendar; + c.select = CP_select; + c.setCssPrefix = CP_setCssPrefix; + c.showNavigationDropdowns = CP_showNavigationDropdowns; + c.showYearNavigationInput = CP_showYearNavigationInput; + c.copyMonthNamesToWindow(); + // Return the object + return c; + } +function CP_copyMonthNamesToWindow() { + // Copy these values over to the date.js + if (typeof(window.MONTH_NAMES)!="undefined" && window.MONTH_NAMES!=null) { + window.MONTH_NAMES = new Array(); + for (var i=0; i\n"; + result += '
\n'; + } + else { + result += '
\n'; + result += '
\n'; + result += '
\n'; + } + // Code for DATE display (default) + // ------------------------------- + if (this.displayType=="date" || this.displayType=="week-end") { + if (this.currentDate==null) { this.currentDate = now; } + if (arguments.length > 0) { var month = arguments[0]; } + else { var month = this.currentDate.getMonth()+1; } + if (arguments.length > 1 && arguments[1]>0 && arguments[1]-0==arguments[1]) { var year = arguments[1]; } + else { var year = this.currentDate.getFullYear(); } + var daysinmonth= new Array(0,31,28,31,30,31,30,31,31,30,31,30,31); + if ( ( (year%4 == 0)&&(year%100 != 0) ) || (year%400 == 0) ) { + daysinmonth[2] = 29; + } + var current_month = new Date(year,month-1,1); + var display_year = year; + var display_month = month; + var display_date = 1; + var weekday= current_month.getDay(); + var offset = 0; + + offset = (weekday >= this.weekStartDay) ? weekday-this.weekStartDay : 7-this.weekStartDay+weekday ; + if (offset > 0) { + display_month--; + if (display_month < 1) { display_month = 12; display_year--; } + display_date = daysinmonth[display_month]-offset+1; + } + var next_month = month+1; + var next_month_year = year; + if (next_month > 12) { next_month=1; next_month_year++; } + var last_month = month-1; + var last_month_year = year; + if (last_month < 1) { last_month=12; last_month_year--; } + var date_class; + if (this.type!="WINDOW") { + result += ""; + } + result += '\n'; + var refresh = windowref+'CP_refreshCalendar'; + var refreshLink = 'javascript:' + refresh; + if (this.isShowNavigationDropdowns) { + result += ''; + result += ''; + + result += ''; + } + else { + if (this.isShowYearNavigation) { + result += ''; + result += ''; + result += ''; + result += ''; + + result += ''; + if (this.isShowYearNavigationInput) { + result += ''; + } + else { + result += ''; + } + result += ''; + } + else { + result += '\n'; + result += '\n'; + result += '\n'; + } + } + result += '
 <'+this.monthNames[month-1]+'> <'+year+'><<'+this.monthNames[month-1]+' '+year+'>>
\n'; + result += '\n'; + result += '\n'; + for (var j=0; j<7; j++) { + + result += '\n'; + } + result += '\n'; + for (var row=1; row<=6; row++) { + result += '\n'; + for (var col=1; col<=7; col++) { + var disabled=false; + if (this.disabledDatesExpression!="") { + var ds=""+display_year+LZ(display_month)+LZ(display_date); + eval("disabled=("+this.disabledDatesExpression+")"); + } + var dateClass = ""; + if ((display_month == this.currentDate.getMonth()+1) && (display_date==this.currentDate.getDate()) && (display_year==this.currentDate.getFullYear())) { + dateClass = "cpCurrentDate"; + } + else if (display_month == month) { + dateClass = "cpCurrentMonthDate"; + } + else { + dateClass = "cpOtherMonthDate"; + } + if (disabled || this.disabledWeekDays[col-1]) { + result += ' \n'; + } + else { + var selected_date = display_date; + var selected_month = display_month; + var selected_year = display_year; + if (this.displayType=="week-end") { + var d = new Date(selected_year,selected_month-1,selected_date,0,0,0,0); + d.setDate(d.getDate() + (7-col)); + selected_year = d.getYear(); + if (selected_year < 1000) { selected_year += 1900; } + selected_month = d.getMonth()+1; + selected_date = d.getDate(); + } + result += ' \n'; + } + display_date++; + if (display_date > daysinmonth[display_month]) { + display_date=1; + display_month++; + } + if (display_month > 12) { + display_month=1; + display_year++; + } + } + result += ''; + } + var current_weekday = now.getDay() - this.weekStartDay; + if (current_weekday < 0) { + current_weekday += 7; + } + result += '\n'; + result += '
'+this.dayHeaders[(this.weekStartDay+j)%7]+'
'+display_date+''+display_date+'
\n'; + if (this.disabledDatesExpression!="") { + var ds=""+now.getFullYear()+LZ(now.getMonth()+1)+LZ(now.getDate()); + eval("disabled=("+this.disabledDatesExpression+")"); + } + if (disabled || this.disabledWeekDays[current_weekday+1]) { + result += ' '+this.todayText+'\n'; + } + else { + result += ' '+this.todayText+'\n'; + } + result += '
\n'; + result += '
\n'; + } + + // Code common for MONTH, QUARTER, YEAR + // ------------------------------------ + if (this.displayType=="month" || this.displayType=="quarter" || this.displayType=="year") { + if (arguments.length > 0) { var year = arguments[0]; } + else { + if (this.displayType=="year") { var year = now.getFullYear()-this.yearSelectStartOffset; } + else { var year = now.getFullYear(); } + } + if (this.displayType!="year" && this.isShowYearNavigation) { + result += ""; + result += '\n'; + result += ' \n'; + result += ' \n'; + result += ' \n'; + result += '
<<'+year+'>>
\n'; + } + } + + // Code for MONTH display + // ---------------------- + if (this.displayType=="month") { + // If POPUP, write entire HTML document + result += '\n'; + for (var i=0; i<4; i++) { + result += ''; + for (var j=0; j<3; j++) { + var monthindex = ((i*3)+j); + result += ''; + } + result += ''; + } + result += '
'+this.monthAbbreviations[monthindex]+'
\n'; + } + + // Code for QUARTER display + // ------------------------ + if (this.displayType=="quarter") { + result += '
\n'; + for (var i=0; i<2; i++) { + result += ''; + for (var j=0; j<2; j++) { + var quarter = ((i*2)+j+1); + result += ''; + } + result += ''; + } + result += '

Q'+quarter+'

\n'; + } + + // Code for YEAR display + // --------------------- + if (this.displayType=="year") { + var yearColumnSize = 4; + result += ""; + result += '\n'; + result += ' \n'; + result += ' \n'; + result += '
<<>>
\n'; + result += '\n'; + for (var i=0; i'+currentyear+''; + } + result += ''; + } + result += '
\n'; + } + // Common + if (this.type == "WINDOW") { + result += "\n"; + } + return result; + } diff --git a/branches/SIPRP/web/contents/marcacao/marcacao.html b/branches/SIPRP/web/contents/marcacao/marcacao.html new file mode 100644 index 00000000..0418a3c1 --- /dev/null +++ b/branches/SIPRP/web/contents/marcacao/marcacao.html @@ -0,0 +1,14 @@ + + + + + +Empresa: $empresa
+Estabelecimento: $estabelecimento
+Funcionário: $funcionario
+
+Pedido de marcação de $marcacao_tipo + data(s): $data#if( $marcacao_tipo == 'Consulta' ) + Horário: $hora#end.
+ + diff --git a/branches/SIPRP/web/contents/marcacao/marcacao_consulta.html b/branches/SIPRP/web/contents/marcacao/marcacao_consulta.html new file mode 100644 index 00000000..96d6b4ea --- /dev/null +++ b/branches/SIPRP/web/contents/marcacao/marcacao_consulta.html @@ -0,0 +1,49 @@ + + + + + Marcação de consulta + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ Marcação de Consulta para:
+ $funcionario +
Data(s)*:
Horário:
+ Nota: a marcação está sujeita a confirmação via email.
+ * - campo de preenchimento obrigatório +
+ +
+
+ + diff --git a/branches/SIPRP/web/contents/marcacao/marcacao_enviada.html b/branches/SIPRP/web/contents/marcacao/marcacao_enviada.html new file mode 100644 index 00000000..481963aa --- /dev/null +++ b/branches/SIPRP/web/contents/marcacao/marcacao_enviada.html @@ -0,0 +1,11 @@ + + + + + Marcação de consulta / exame + + + + O pedido de marcação foi enviado com sucesso. + + diff --git a/branches/SIPRP/web/contents/marcacao/marcacao_exame.html b/branches/SIPRP/web/contents/marcacao/marcacao_exame.html new file mode 100644 index 00000000..3bcddc85 --- /dev/null +++ b/branches/SIPRP/web/contents/marcacao/marcacao_exame.html @@ -0,0 +1,43 @@ + + + + + Marcação de exames + + + + + +
+ + + + + + + + + + + + + + +
+ Marcação de Exames para:
+ $funcionario +
Data(s)*:
+ Nota: a marcação está sujeita a confirmação via email.
+ * - campo de preenchimento obrigatório +
+ +
+
+ + diff --git a/branches/SIPRP/web/contents/marcacao/marcacao_menu.html b/branches/SIPRP/web/contents/marcacao/marcacao_menu.html new file mode 100644 index 00000000..0c605749 --- /dev/null +++ b/branches/SIPRP/web/contents/marcacao/marcacao_menu.html @@ -0,0 +1,62 @@ + + + + + Marcação de consulta / exame + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ Marcação para:
+ $funcionario +
+ Consulta + Exame +
Data:dd/mm/aaaa
Hora:hh:mm
+ Nota: a marcação está sujeita a confirmação via email. +
+ +
+
+ + diff --git a/branches/SIPRP/web/contents/marcacao/marcacao_nao_enviada.html b/branches/SIPRP/web/contents/marcacao/marcacao_nao_enviada.html new file mode 100644 index 00000000..5621b521 --- /dev/null +++ b/branches/SIPRP/web/contents/marcacao/marcacao_nao_enviada.html @@ -0,0 +1,11 @@ + + + + + Marcação de consulta / exame + + + + Ocorreu um erro a enviar o pedido de marcação. + + diff --git a/branches/SIPRP/web/contents/marcacao/marcacao_sessao_expirou.html b/branches/SIPRP/web/contents/marcacao/marcacao_sessao_expirou.html new file mode 100644 index 00000000..3a84b5fc --- /dev/null +++ b/branches/SIPRP/web/contents/marcacao/marcacao_sessao_expirou.html @@ -0,0 +1,11 @@ + + + + + Sessão expirou + + + + A sua sessão expirou. Para efectuar uma marcação, autentique-se novamente. + + diff --git a/branches/SIPRP/web/contents/medicina.html b/branches/SIPRP/web/contents/medicina.html new file mode 100644 index 00000000..d52815fb --- /dev/null +++ b/branches/SIPRP/web/contents/medicina.html @@ -0,0 +1,52 @@ + + + + + SIPRP - Medicina + + + + + + + + + + + + + + + +
   +medicina do trabalho
+
+ + + + + + + + + + +

+

+

+

+

+
+

+
+ + diff --git a/branches/SIPRP/web/contents/noticias/mostrar_noticias.html b/branches/SIPRP/web/contents/noticias/mostrar_noticias.html new file mode 100644 index 00000000..ddea30a6 --- /dev/null +++ b/branches/SIPRP/web/contents/noticias/mostrar_noticias.html @@ -0,0 +1,11 @@ + + + + + Notícias + + + + $noticias + + diff --git a/branches/SIPRP/web/contents/politica.html b/branches/SIPRP/web/contents/politica.html new file mode 100644 index 00000000..3713c26b --- /dev/null +++ b/branches/SIPRP/web/contents/politica.html @@ -0,0 +1,52 @@ + + + + + SIPRP + + + + + + + + + + + + + + + +
   +política de qualidade e apoio administrativo
+
+ + + + + + + + + + +

+

+

+

+

+
+

+
+ + diff --git a/branches/SIPRP/web/contents/relatorio/pedido.html b/branches/SIPRP/web/contents/relatorio/pedido.html new file mode 100644 index 00000000..427733c2 --- /dev/null +++ b/branches/SIPRP/web/contents/relatorio/pedido.html @@ -0,0 +1,9 @@ + + + + +Empresa: $empresa
+
+Pedido de envio de relatório do ano: $ano
+ + diff --git a/branches/SIPRP/web/contents/relatorio/pedido_enviado.html b/branches/SIPRP/web/contents/relatorio/pedido_enviado.html new file mode 100644 index 00000000..9b530aa6 --- /dev/null +++ b/branches/SIPRP/web/contents/relatorio/pedido_enviado.html @@ -0,0 +1,11 @@ + + + + + Envio de dados do relatório anual + + + + O pedido foi enviado com sucesso. + + diff --git a/branches/SIPRP/web/contents/relatorio/pedido_nao_enviado.html b/branches/SIPRP/web/contents/relatorio/pedido_nao_enviado.html new file mode 100644 index 00000000..196da035 --- /dev/null +++ b/branches/SIPRP/web/contents/relatorio/pedido_nao_enviado.html @@ -0,0 +1,11 @@ + + + + + Envio de dados do relatório anual + + + + Ocorreu um erro a enviar o pedido. + + diff --git a/branches/SIPRP/web/contents/relatorio/pedido_relatorio.html b/branches/SIPRP/web/contents/relatorio/pedido_relatorio.html new file mode 100644 index 00000000..5dd5bf9f --- /dev/null +++ b/branches/SIPRP/web/contents/relatorio/pedido_relatorio.html @@ -0,0 +1,35 @@ + + + + + Pedido de dados do relatório anual + + + + + +
+ + + + + + + + + + +
+ Pedido de dados do relatório anual +
Ano pretendido:
+ +
+
+ + diff --git a/branches/SIPRP/web/contents/relatorio/pedido_sessao_expirou.html b/branches/SIPRP/web/contents/relatorio/pedido_sessao_expirou.html new file mode 100644 index 00000000..0311eda3 --- /dev/null +++ b/branches/SIPRP/web/contents/relatorio/pedido_sessao_expirou.html @@ -0,0 +1,11 @@ + + + + + Sessão expirou + + + + A sua sessão expirou. Para efectuar o pedido, autentique-se novamente. + + diff --git a/branches/SIPRP/web/contents/servicos.html b/branches/SIPRP/web/contents/servicos.html new file mode 100644 index 00000000..f4585f4f --- /dev/null +++ b/branches/SIPRP/web/contents/servicos.html @@ -0,0 +1,31 @@ + + + + + SIPRP - Serviços + + + + + + + + + + + + +

+
-Serviços +Complementares
+ -Medicina do +Trabalho
+ -Política de +Qualidade e Apoio Administrativo
+ -Higiene e +Segurança
+ + diff --git a/branches/SIPRP/web/contents/servicos_compl.html b/branches/SIPRP/web/contents/servicos_compl.html new file mode 100644 index 00000000..163977df --- /dev/null +++ b/branches/SIPRP/web/contents/servicos_compl.html @@ -0,0 +1,52 @@ + + + + + SIPRP - Serviços + + + + + + + + + + + + + + + +
   +serviços complementares
+
+ + + + + + + + + + +

+

+

+

+

+
+

+
+ + diff --git a/branches/SIPRP/web/contents/siprp.html b/branches/SIPRP/web/contents/siprp.html new file mode 100644 index 00000000..37d5babe --- /dev/null +++ b/branches/SIPRP/web/contents/siprp.html @@ -0,0 +1,52 @@ + + + + + SIPRP - Apresentação + + + + + + + + + + + + + + + +
   +a +siprp
+ + + + + + + + + + +

+

+

+

+

+
+

+
+ + diff --git a/branches/SIPRP/web/contents/user.html b/branches/SIPRP/web/contents/user.html new file mode 100644 index 00000000..b3d8a59f --- /dev/null +++ b/branches/SIPRP/web/contents/user.html @@ -0,0 +1,396 @@ + + + + + SIPRP + + + + + + + + + + + + + +

+ + + + + + + + + + #if( $userRole != "manager" ) + + + #end + + + +
   $userName    pedido de relatório anual...logout »   
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + #if( $query == "empresas" ) + #set( $listaTitle = "empresas" ) + #elseif( $query == "estabelecimentos" ) + #set( $listaTitle = "estabelecimentos" ) + #elseif( $query == "trabalhadores" || $query == "trabalhadores_tudo" || $query == "trabalhadores_pendentes" ) + #set( $listaTitle = "funcionários:" ) + #set( $lista_funcionarios = 1 ) + #else ##( $query == "trabalhador" ) + #set( $listaTitle = "funcionário" ) + #end + + + #if( $lista_funcionarios ) + + + + #end + + + + + + + + + + + + + + +
   acesso restrito
+ + + + + + + + + + + + + + +
+ #if( $userRole == "manager" && $empresa_nome ) + Empresa: $!empresa_nome + #else + Empresa: $!empresa_nome + #end +
+ #if( $estabelecimento_id ) + Estabelecimento: $!estabelecimento_nome + #else + Estabelecimento: + #end +
+ #if( $query == "trabalhador" ) + Funcionário: $!funcionario.nome  - Data de Nascimento: $!funcionario.data_nascimento + #else + Funcionário: + #end + + #if( $query == "trabalhador" ) + + #end +
+ +
+
+ + + + + + + + +
   funcionários:   todos   com ficha de aptidão   com pendências         imprimir
+ #else +
   $listaTitle
+ #if ($query == "trabalhador") + (*)ECD - Exames Complementares de Diagnóstico

+ + + + + + + + + + + + + + + + + + + + +
Último ECD(*)RealizadoÚltima ConsultaRealizadaResultadoPróximo ECD(*)Próxima Consulta
$!funcionario.ultimo_exame $!funcionario.realizado $!funcionario.ultima_consulta $!funcionario.realizada $!funcionario.resultado $!funcionario.proximo_exame $!funcionario.proxima_consulta 
+ #elseif( $query == "trabalhadores" ) + (*)ECD - Exames Complementares de Diagnóstico

+ + + + + + + + #foreach( $element in $v1 ) + #set ( $counter = $velocityCount - 1 ) + #set ( $dados_trabalhador = $v2.get($counter) ) + + + + + + + #end +
  NomeÚltimo ECD(*)Última consultaPróxima consulta
$dados_trabalhador.Nome $dados_trabalhador.ultimo_exame $dados_trabalhador.ultima_consulta $dados_trabalhador.proxima_consulta 
+ #elseif( $query == "trabalhadores_tudo" ) + + + + + + #foreach( $element in $v1 ) + #set ( $counter = $velocityCount - 1 ) + #set ( $dados_trabalhador = $v2.get($counter) ) + + + + + #end +
  NomeData da Ficha de Aptidão
  $dados_trabalhador.Nome$dados_trabalhador.Data  
+ #elseif( $query == "trabalhadores_pendentes" ) + - pendente    + - marcado    + - tratado
+ (*)ECD - Exames Complementares de Diagnóstico

+ + + + + + + #foreach( $element in $v1 ) + #set ( $counter = $velocityCount - 1 ) + #set ( $dados_trabalhador = $v2.get($counter) ) + + + + + + #end +
  NomeECD(*)Consulta
  $dados_trabalhador.Nome
+ #else + #foreach( $element in $v1 ) + #set ( $counter = $velocityCount - 1 ) + $v2.get($counter)
+ #end + #end +
+
+
+ + diff --git a/branches/SIPRP/web/contents/user_print.html b/branches/SIPRP/web/contents/user_print.html new file mode 100644 index 00000000..821ac555 --- /dev/null +++ b/branches/SIPRP/web/contents/user_print.html @@ -0,0 +1,284 @@ + + + + + SIPRP + + + + + + + + + + + +

+ + + + + + +
+ +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + #if( $query == "trabalhadores" ) + #set( $listaTitle = "Todos os Funcionários" ) + #elseif( $query == "trabalhadores_tudo" ) + #set( $listaTitle = "Funcionários com Tudo Resolvido" ) + #elseif( $query == "trabalhadores_pendentes" ) + #set( $listaTitle = "Funcionários com Pendências" ) + #end + + + + + + + + + + + + +
   
+ + + + + + + + + + +
+ Empresa: $!empresa_nome +
+ Estabelecimento: $!estabelecimento_nome +
+ +
+
   $listaTitle
+ #if( $query == "trabalhadores" ) + (*)ECD - Exames Complementares de Diagnóstico

+ + + + + + + + #foreach( $element in $v1 ) + #set ( $counter = $velocityCount - 1 ) + #set ( $dados_trabalhador = $v2.get($counter) ) + + + + + + + #end +
  NomeÚltimo ECD(*)Última consultaPróxima consulta
$dados_trabalhador.Nome $dados_trabalhador.ultimo_exame $dados_trabalhador.ultima_consulta $dados_trabalhador.proxima_consulta 
+ + #elseif( $query == "trabalhadores_tudo" ) + + + + + + #foreach( $element in $v1 ) + #set ( $counter = $velocityCount - 1 ) + #set ( $dados_trabalhador = $v2.get($counter) ) + + + + + #end +
  NomeData da Ficha de Aptidão
  $dados_trabalhador.Nome$dados_trabalhador.Data  
+ #elseif( $query == "trabalhadores_pendentes" ) + + (*)ECD - Exames Complementares de Diagnóstico

+ + + + + + + #foreach( $element in $v1 ) + #set ( $counter = $velocityCount - 1 ) + #set ( $dados_trabalhador = $v2.get($counter) ) + + + + + + + #end +
  NomeECD(*)Consulta
  $dados_trabalhador.Nome$dados_trabalhador.Exame_estado$dados_trabalhador.Consulta_estado
+ #end +
+
+
+ + diff --git a/branches/SIPRP/web/lib/commons-email-1.0-dev.jar b/branches/SIPRP/web/lib/commons-email-1.0-dev.jar new file mode 100644 index 00000000..aab523d5 Binary files /dev/null and b/branches/SIPRP/web/lib/commons-email-1.0-dev.jar differ diff --git a/branches/SIPRP/web/lib/commons-fileupload-1.0.jar b/branches/SIPRP/web/lib/commons-fileupload-1.0.jar new file mode 100644 index 00000000..1ca4a9cd Binary files /dev/null and b/branches/SIPRP/web/lib/commons-fileupload-1.0.jar differ diff --git a/branches/SIPRP/web/lib/postgresql-8.2-504.jdbc3.jar b/branches/SIPRP/web/lib/postgresql-8.2-504.jdbc3.jar new file mode 100644 index 00000000..b450671d Binary files /dev/null and b/branches/SIPRP/web/lib/postgresql-8.2-504.jdbc3.jar differ diff --git a/branches/SIPRP/web/lib/velocity-dep-1.4.jar b/branches/SIPRP/web/lib/velocity-dep-1.4.jar new file mode 100644 index 00000000..375712b0 Binary files /dev/null and b/branches/SIPRP/web/lib/velocity-dep-1.4.jar differ diff --git a/branches/SIPRP/web/src/siprp/pagina/GlobalConstants.java b/branches/SIPRP/web/src/siprp/pagina/GlobalConstants.java new file mode 100644 index 00000000..5f145417 --- /dev/null +++ b/branches/SIPRP/web/src/siprp/pagina/GlobalConstants.java @@ -0,0 +1,38 @@ +/* + * GlobalConstant.java + * + * Created on 27 de Abril de 2005, 18:20 + */ + +package siprp.pagina; + +/** + * + * @author fpalma + */ +public interface GlobalConstants +{ + // BD + public static final String bdHost = "127.0.0.1"; + public static final String bdPort = "5436"; + public static final String bdUsername = "siprp"; + public static final String bdPassword = ""; + public static final String bdDriver = "org.postgresql.Driver"; + public static final String bdUrl = "jdbc:postgresql://" + bdHost + ":" + bdPort + "/siprp"; + + public static final String bdLocalHost = "127.0.0.1"; + public static final String bdLocalPort = "5436"; + public static final String bdLocalUsername = "siprp"; + public static final String bdLocalPassword = ""; + public static final String bdLocalDriver = "org.postgresql.Driver"; + public static final String bdLocalUrl = "jdbc:postgresql://" + bdHost + ":" + bdPort + "/siprp_local_3"; + + public static final String DEFAULT_EMAIL = "geral@siprp.pt"; + + public static final int TIPO_MARCACAO_EXAMES = 0; + public static final int TIPO_MARCACAO_CONSULTA = 1; + + public static final Integer ESTADO_POR_REALIZAR = new Integer( 0 ); + public static final Integer ESTADO_PARCIALMENTE_REALIZADO = new Integer( 1 ); + public static final Integer ESTADO_REALIZADO = new Integer( 2 ); +} diff --git a/branches/SIPRP/web/src/siprp/pagina/MailerServlet.java b/branches/SIPRP/web/src/siprp/pagina/MailerServlet.java new file mode 100644 index 00000000..35013af8 --- /dev/null +++ b/branches/SIPRP/web/src/siprp/pagina/MailerServlet.java @@ -0,0 +1,240 @@ +/* + * ServletAux.java + * + * Created on 10 de Marco de 2005, 12:24 + */ + +package siprp.pagina; + +import javax.activation.*; +import java.io.*; +import java.util.*; + +import javax.mail.*; +import javax.mail.internet.*; +import javax.servlet.*; +import javax.servlet.http.*; +import java.sql.*; + +import org.apache.commons.mail.*; +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +import com.evolute.utils.arrays.*; +/** + * + * @author psantos + */ +public class MailerServlet extends HttpServlet + implements GlobalConstants +{ + public static final String EMAIL = "email"; + public static final String EMAIL_MARCACAO = "email_marcacao"; + public static final String EMAIL_RECRUTAMENTO = "email_recrutamento"; + + protected static Hashtable PROPERTIES; + + public void init() + { + + try + { + String TEMPLATE_DIR = this.getServletContext().getRealPath( "/" ) + "html/"; + + Properties props = new Properties(); + props.setProperty( "file.resource.loader.path", TEMPLATE_DIR ); + Velocity.init( props ); + if( PROPERTIES == null ) + { + Class.forName(bdDriver); + Connection con = DriverManager.getConnection( bdUrl, bdUsername, bdPassword ); + Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + ResultSet2DArray array = new ResultSet2DArray( + stmt.executeQuery( "Select name, value FROM properties;" ) ); + PROPERTIES = new Hashtable(); + for( int n = 0; n < array.columnLength(); n++ ) + { + PROPERTIES.put( array.get( n, 0 ), array.get( n, 1 ) ); + } + con.close(); + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + } + + protected String createContent( Hashtable parameters, String[] form_fields, String template ) + { + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + + try + { + for( int i = 0; i < form_fields.length; i++ ) + { + context.put( form_fields[ i ], parameters.get( form_fields[ i ] ) ); + } + + Velocity.mergeTemplate( template, Velocity.ENCODING_DEFAULT, context, output ); + + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + + return null; + } + + protected String showResultPage( boolean success, String success_template, String fail_template ) + { + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + String template; + if( success ) + { + template = success_template; + } + else + { + template = fail_template; + } + try + { + Velocity.mergeTemplate( template, Velocity.ENCODING_DEFAULT, context, output ); + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + + return null; + } + + protected boolean sendMail( String from, String destination, String subject, String content, boolean html ) + { + String smtp_server = "localhost"; + String mailer = "Evolute Mailer"; + + Properties props = System.getProperties(); + props.put( "mail.smtp.host", smtp_server ); + + String content_type = ( html ) ? "text/html" : "text/plain"; + + Session session = Session.getInstance( props, null ); + Message msg = new MimeMessage( session ); + try + { + if( from != null ) + { + msg.setFrom( new InternetAddress( from ) ); + } + msg.setRecipients( Message.RecipientType.TO, InternetAddress.parse( destination, true ) ); + msg.setSubject( subject ); + + msg.setContent( content.toString(), content_type ); + + msg.setHeader( "X-Mailer", mailer ); + msg.setSentDate( new java.util.Date() ); + Transport.send( msg ); + + return true; + } + catch( Exception e ) + { + e.printStackTrace(); + } + + return false; + } + + protected boolean sendMail( String from, String destination, String subject, String content, boolean html, + String filename, byte attachment[], String type ) + { + String smtp_server = "localhost"; + String mailer = "Evolute Mailer"; + + Properties props = System.getProperties(); + props.put( "mail.smtp.host", smtp_server ); + + String content_type = ( html ) ? "text/html" : "text/plain"; + + Session session = Session.getInstance( props, null ); + Message msg = new MimeMessage( session ); + try + { + if( from != null ) + { + msg.setFrom( new InternetAddress( from ) ); + } + msg.setRecipients( Message.RecipientType.TO, InternetAddress.parse( destination, true ) ); + msg.setSubject( subject ); + msg.setHeader( "X-Mailer", mailer ); + msg.setSentDate( new java.util.Date() ); + + Multipart multipart = new MimeMultipart(); + BodyPart messageBodyPart = new MimeBodyPart(); + messageBodyPart.setContent( content.toString(), content_type ); + multipart.addBodyPart(messageBodyPart); + + messageBodyPart = new MimeBodyPart(); +// messageBodyPart.setDataHandler( +// new DataHandler( new ByteArrayDataSource( attachment, "/siprpWeb/test.txt" ))); + messageBodyPart.setContent( attachment, content_type ); + DataSource source = new ByteArrayDataSource(attachment, type); + messageBodyPart.setDataHandler( + new DataHandler(source)); + messageBodyPart.setFileName(filename); + + multipart.addBodyPart(messageBodyPart); + msg.setContent(multipart); + + Transport.send( msg ); + + return true; + } + catch( Exception e ) + { + e.printStackTrace(); + } + + return false; + } + + private String checkParameter( String parameter ) + { + if( parameter != null && parameter.trim().length() > 0 ) + { + return parameter.trim(); + } + + return null; + } + + protected Hashtable parseParameters( Hashtable parameters ) + { + Hashtable tmp = new Hashtable(); + String[] element; + String key; + String new_element; + for( Enumeration e = parameters.keys(); e.hasMoreElements(); ) + { + key = ( String ) e.nextElement(); + element = ( String[] ) parameters.get( key ); + if( element != null ) + { + new_element = checkParameter( element[ 0 ] ); + if( new_element != null ) + { + tmp.put( key, new_element ); + } + } + } + + return tmp; + } +} diff --git a/branches/SIPRP/web/src/siprp/pagina/NewsServlet.java b/branches/SIPRP/web/src/siprp/pagina/NewsServlet.java new file mode 100644 index 00000000..5122d6b2 --- /dev/null +++ b/branches/SIPRP/web/src/siprp/pagina/NewsServlet.java @@ -0,0 +1,168 @@ +/* + * NewsServlet.java + * + * Created on 20 de Maio de 2005, 17:48 + */ + +package siprp.pagina; + +import java.io.*; +import java.util.*; +import javax.servlet.*; +import javax.servlet.http.*; +import java.sql.*; +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.db.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.strings.*; + +/** + * + * @author lflores + */ +public class NewsServlet extends HttpServlet + implements GlobalConstants +{ + private static DBManager DBM = null; + + private static final Select SELECT = new Select( new String[]{ "not_noticias" }, + new String[]{"data", "noticia"}, new Field( "id" ).in( + new Field( "( SELECT MAX( id ) FROM not_noticias )" ) ) ); + + private SQLExecuter executer = null; + + private static boolean velocityInit = false; + + public void init() + { + if( !velocityInit ) + { + try + { + String TEMPLATE_DIR = this.getServletContext().getRealPath( "/" ) + "html/"; + + Properties props = new Properties(); + props.setProperty( "file.resource.loader.path", TEMPLATE_DIR ); + Velocity.init( props ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + velocityInit = true; + } + + if( DBM != null ) + { + return; + } + + try + { + DBM = new JDBCManager( bdUrl + "?prepareThreshold=1", + bdUsername, bdPassword , 8, 8, 0, new SQLQuery[] {} ); + } + catch( Exception e ) + { + e.printStackTrace(); + } + } + + private void close() + { + try + { + DBM.close(); + DBM = null; + } + catch( Exception ex ) + { + // we come here after an error + // so we discard this exception + } + } + + private String getNews() + { +//System.err.println( "NEWS: BEGIN" ); + try + { + if( executer == null ) + { + executer = ( SQLExecuter )DBM.getSharedExecuter(); + } + Virtual2DArray array = executer.executeQuery( SELECT ); + Object o[][] = array.getObjects(); + if( o != null && o.length > 0 ) + { +//System.err.println( "NEWS: " + o[ 0 ][ 0 ].toString() ); + return + //o[ 0 ][ 0 ].toString() + + StringConverter.unicodeToHTML( o[ 0 ][ 1 ].toString() ); + } + } + catch( Exception ex ) + { +//System.err.println( "NEWS: EX" ); + ex.printStackTrace(); + close(); + } +//System.err.println( "NEWS: END" ); + return null; + } + + public void doGet( HttpServletRequest req, HttpServletResponse res ) + throws IOException + { +//System.err.println( "NEWS: GET BEGIN" ); + init(); +//System.err.println( "NEWS: AF INIT" ); + ServletOutputStream out = res.getOutputStream(); +// String queryString = req.getQueryString(); + res.setContentType( "text/html" ); + String news = getNews(); + Hashtable parameters = new Hashtable(); + if( news == null ) + { + parameters.put( "noticias", "" ); + } + else + { + parameters.put( "noticias", news ); + } +//System.err.println( "NEWS: BF SHOW" ); + out.println( showPage( "noticias/mostrar_noticias.html", parameters ) ); + } + + private String showPage( String page, Hashtable parameters ) + { + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + + try + { + if( parameters != null ) + { + String key; + for( Enumeration e = parameters.keys(); e.hasMoreElements(); ) + { + key = ( String ) e.nextElement(); + context.put( key, parameters.get( key ) ); + } + } + + Velocity.mergeTemplate( page, Velocity.ENCODING_DEFAULT, context, output ); + + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + return null; + } +} diff --git a/branches/SIPRP/web/src/siprp/pagina/RecruitServlet.java b/branches/SIPRP/web/src/siprp/pagina/RecruitServlet.java new file mode 100644 index 00000000..ff69f10d --- /dev/null +++ b/branches/SIPRP/web/src/siprp/pagina/RecruitServlet.java @@ -0,0 +1,127 @@ +/* + * RequestServlet.java + * + * Created on 4 de Marco de 2005, 18:19 + */ + +package siprp.pagina; + +import java.io.*; +import java.util.*; + +import javax.servlet.*; +import javax.servlet.http.*; + +import org.apache.commons.fileupload.*; + +/** + * + * @author psantos + */ +public class RecruitServlet extends MailerServlet +{ + private final static String REC_FUNCAO = "rec_funcao"; + private final static String REC_NOME = "rec_nome"; + private final static String REC_MORADA = "rec_morada"; + private final static String REC_TELEFONE = "rec_telefone"; + private final static String REC_EMAIL = "rec_email"; + private final static String REC_CV = "rec_cv"; + + private final static String[] FORM_FIELDS = new String[]{ + REC_FUNCAO, REC_NOME, REC_MORADA, + REC_TELEFONE, REC_EMAIL, REC_CV + }; + + public void doPost( HttpServletRequest req, HttpServletResponse res ) + throws IOException + { + Hashtable parameters; + String fileName = ""; + String type = ""; + byte file[] = new byte[0]; + boolean isMultipart = FileUpload.isMultipartContent( req ); + + ServletOutputStream out = res.getOutputStream(); + res.setContentType( "text/html" ); + + if( isMultipart ) + { + parameters = new Hashtable(); + DiskFileUpload upload = new DiskFileUpload(); + upload.setSizeThreshold(1000000); + upload.setSizeMax(1000000); + List items; + try + { + items = upload.parseRequest(req); + } + catch( FileUploadException ex ) + { + out.println( showResultPage( false, "mail/pedido_enviado.html", "mail/pedido_nao_enviado.html" ) ); + return; + } + Iterator iter = items.iterator(); + while( iter.hasNext() ) + { + FileItem item = (FileItem) iter.next(); + + if (item.isFormField()) + { + String name = item.getFieldName(); + String value = item.getString(); + parameters.put( name, value ); + } + else + { + String fieldName = item.getFieldName(); + fileName = item.getName(); + file = item.get(); + if( file == null || file.length == 0 ) + { + isMultipart = false; + } + type = item.getContentType(); + } + } + } + else + { + parameters = parseParameters( new Hashtable( req.getParameterMap() ) ); + } + String content = createContent( parameters, FORM_FIELDS, "mail/envio_cv.txt" ); + + String email = DEFAULT_EMAIL; + if( PROPERTIES != null && PROPERTIES.containsKey( EMAIL_RECRUTAMENTO ) ) + { + email = ( String ) PROPERTIES.get( EMAIL_RECRUTAMENTO ); + } + String from = email; + String destination = email; + String subject = "Envio de CV atrav\u00e9s do site www.siprp.pt"; + // manda mail + boolean success; + String nome = ( String ) parameters.get( REC_NOME ); + String telefone = ( String ) parameters.get( REC_TELEFONE ); + String mail = ( String ) parameters.get( REC_EMAIL ); + if( nome == null || nome.trim().length() == 0 || telefone == null || telefone.trim().length() == 0 || + mail == null || mail.trim().length() == 0 || mail.indexOf( '@' ) == -1 ) + { +System.out.println( "nome: " + nome + " teefone: " + telefone + " email : " + email ); + success = false; + } + else if( isMultipart ) + { +System.out.println( "Multipart" ); + success = sendMail( from, destination, subject, content, false, fileName, file, type ); + } + else + { +System.out.println( "Normal" ); + success = sendMail( from, destination, subject, content, false ); + } + + // mostra pagina correspondente + + out.println( showResultPage( success, "mail/cv_enviado.html", "mail/cv_nao_enviado.html" ) ); + } +} diff --git a/branches/SIPRP/web/src/siprp/pagina/RelatorioServlet.java b/branches/SIPRP/web/src/siprp/pagina/RelatorioServlet.java new file mode 100644 index 00000000..7a7c5e9b --- /dev/null +++ b/branches/SIPRP/web/src/siprp/pagina/RelatorioServlet.java @@ -0,0 +1,121 @@ +/* + * RelatorioServlet.java + * + * Created on 27 de Abril de 2005, 16:16 + */ + +package siprp.pagina; + +import java.io.*; +import java.util.*; + +import javax.servlet.*; +import javax.servlet.http.*; + +import org.apache.velocity.*; +import org.apache.velocity.app.*; +/** + * + * @author fpalma + */ +public class RelatorioServlet extends MailerServlet +{ + private final static String EMPRESA = "empresa"; + private final static String EMAIL_EMPRESA = "email_empresa"; + private final static String ANO = "ano"; + + private final static String[] FORM_FIELDS = new String[]{ + EMPRESA, ANO, EMAIL_EMPRESA }; + + public void doGet( HttpServletRequest req, HttpServletResponse res ) + throws IOException + { + ServletOutputStream out = res.getOutputStream(); + String queryString = req.getQueryString(); + res.setContentType( "text/html" ); + + Hashtable parameters = new Hashtable(); + + // Ir buscar os parametros 'a sessao + HttpSession session = req.getSession( false ); + if( session == null ) + { + // timeout + out.println( showPage( "relatorio/pedido_sessao_expirou.html", null ) ); + return; + } + + out.println( showPage( "relatorio/pedido_relatorio.html", parameters ) ); + } + + public void doPost( HttpServletRequest req, HttpServletResponse res ) + throws IOException + { + ServletOutputStream out = res.getOutputStream(); + String queryString = req.getQueryString(); + res.setContentType( "text/html" ); + + // Info de marcacao + // Dados que vem no pedido: marcacao_tipo, data, hora + Hashtable parameters = parseParameters( new Hashtable( req.getParameterMap() ) ); + + // Ir buscar o resto dos parametros 'a sessao + HttpSession session = req.getSession( false ); + if( session == null ) + { + // timeout + out.println( showPage( "relatorio/pedido_sessao_expirou.html", null ) ); + return; + } + + parameters.put( EMPRESA, session.getAttribute( siprpServlet.sessionCompanyName ) ); + String from = ( String ) session.getAttribute( siprpServlet.sessionCompanyEmail ); + + String email = DEFAULT_EMAIL; + if( PROPERTIES != null && PROPERTIES.containsKey( EMAIL ) ) + { + email = ( String ) PROPERTIES.get( EMAIL ); + } + String destination = email; + String subject = "Pedido de envio de relatorio via web"; + if( parameters.get( ANO ) == null ) + { + parameters.put( ANO, "corrente" ); + } + String content = createContent( parameters, FORM_FIELDS, "relatorio/pedido.html" ); + // manda mail + boolean success = sendMail( from, destination, subject, content, true ); + + // mostra pagina correspondente + out.println( showResultPage( success, "relatorio/pedido_enviado.html", "relatorio/pedido_nao_enviado.html" ) ); + } + + private String showPage( String page, Hashtable parameters ) + { + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + + try + { + if( parameters != null ) + { + String key; + for( Enumeration e = parameters.keys(); e.hasMoreElements(); ) + { + key = ( String ) e.nextElement(); + context.put( key, parameters.get( key ) ); + } + } + + Velocity.mergeTemplate( page, Velocity.ENCODING_DEFAULT, context, output ); + + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + + return null; + } +} diff --git a/branches/SIPRP/web/src/siprp/pagina/RequestServlet.java b/branches/SIPRP/web/src/siprp/pagina/RequestServlet.java new file mode 100644 index 00000000..10891c80 --- /dev/null +++ b/branches/SIPRP/web/src/siprp/pagina/RequestServlet.java @@ -0,0 +1,63 @@ +/* + * RequestServlet.java + * + * Created on 4 de Marco de 2005, 18:19 + */ + +package siprp.pagina; + +import java.io.*; +import java.util.*; + +import javax.servlet.*; +import javax.servlet.http.*; + +/** + * + * @author psantos + */ +public class RequestServlet extends MailerServlet +{ + private final static String REQUEST_NAME = "request_name"; + private final static String REQUEST_PHONE = "request_phone"; + private final static String REQUEST_EMAIL = "request_email"; + private final static String REQUEST_DETAILS = "request_details"; + + private final static String[] FORM_FIELDS = new String[]{ + REQUEST_NAME, REQUEST_PHONE, + REQUEST_EMAIL, REQUEST_DETAILS + }; + + public void doPost( HttpServletRequest req, HttpServletResponse res ) + throws IOException + { + ServletOutputStream out = res.getOutputStream(); + res.setContentType( "text/html" ); + + /* + parametros: + request_name + request_phone + request_email + request_details + */ + // recebe info de contacto + Hashtable parameters = parseParameters( new Hashtable( req.getParameterMap() ) ); + + String content = createContent( parameters, FORM_FIELDS, "mail/pedido_informacao.txt" ); + + String from = ( String ) parameters.get( REQUEST_EMAIL ); + String email = DEFAULT_EMAIL; + if( PROPERTIES != null && PROPERTIES.containsKey( EMAIL ) ) + { + email = ( String ) PROPERTIES.get( EMAIL ); + } + String destination = email; + String subject = "Pedido de informacao atrav\u00e9s do site www.siprp.pt"; + // manda mail + boolean success = sendMail( from, destination, subject, content, false ); + + // mostra pagina correspondente + out.println( showResultPage( success, "mail/pedido_enviado.html", "mail/pedido_nao_enviado.html" ) ); + } +} diff --git a/branches/SIPRP/web/src/siprp/pagina/ScheduleServlet.java b/branches/SIPRP/web/src/siprp/pagina/ScheduleServlet.java new file mode 100644 index 00000000..ad66ee43 --- /dev/null +++ b/branches/SIPRP/web/src/siprp/pagina/ScheduleServlet.java @@ -0,0 +1,142 @@ +/* + * ScheduleServlet.java + * + * Created on 10 de Marco de 2005, 12:22 + */ + +package siprp.pagina; + +import java.io.*; +import java.util.*; + +import javax.servlet.*; +import javax.servlet.http.*; + +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +/** + * + * @author psantos + */ +public class ScheduleServlet extends MailerServlet +{ + private final static String EMPRESA = "empresa"; + private final static String ESTABELECIMENTO = "estabelecimento"; + private final static String FUNCIONARIO = "funcionario"; + private final static String MARCACAO_TIPO = "marcacao_tipo"; + private final static String DATA = "data"; + private final static String HORA = "hora"; + private final static String EMAIL_EMPRESA = "email_empresa"; + + private final static String[] FORM_FIELDS = new String[]{ + EMPRESA, ESTABELECIMENTO, FUNCIONARIO, + MARCACAO_TIPO, DATA, HORA, EMAIL_EMPRESA + }; + + public void doGet( HttpServletRequest req, HttpServletResponse res ) + throws IOException + { + ServletOutputStream out = res.getOutputStream(); + String queryString = req.getQueryString(); + res.setContentType( "text/html" ); + + Hashtable parameters = new Hashtable(); + + // Ir buscar os parametros 'a sessao + HttpSession session = req.getSession( false ); + if( session == null ) + { + // timeout + out.println( showPage( "marcacao/marcacao_sessao_expirou.html", null ) ); + return; + } + + parameters.put( EMPRESA, session.getAttribute( siprpServlet.sessionCompanyName ) ); + parameters.put( ESTABELECIMENTO, session.getAttribute( "session_estabelecimento_nome" ) ); + parameters.put( FUNCIONARIO, session.getAttribute( "session_funcionario_nome" ) ); + + String tokens[] = queryString.split( "[?]" ); + if( tokens.length > 0 && tokens[ tokens.length - 1 ].equals( "consulta" ) ) + { + out.println( showPage( "marcacao/marcacao_consulta.html", parameters ) ); + } + else + { + out.println( showPage( "marcacao/marcacao_exame.html", parameters ) ); + } + } + + public void doPost( HttpServletRequest req, HttpServletResponse res ) + throws IOException + { + ServletOutputStream out = res.getOutputStream(); + String queryString = req.getQueryString(); + res.setContentType( "text/html" ); + + // Info de marcacao + // Dados que vem no pedido: marcacao_tipo, data, hora + Hashtable parameters = parseParameters( new Hashtable( req.getParameterMap() ) ); + + // Ir buscar o resto dos parametros 'a sessao + HttpSession session = req.getSession( false ); + if( session == null ) + { + // timeout + out.println( showPage( "marcacao/marcacao_sessao_expirou.html", null ) ); + return; + } + + parameters.put( EMPRESA, session.getAttribute( siprpServlet.sessionCompanyName ) ); + parameters.put( ESTABELECIMENTO, session.getAttribute( "session_estabelecimento_nome" ) ); + parameters.put( FUNCIONARIO, session.getAttribute( "session_funcionario_nome" ) ); + //parameters.put( session.getAttribute( "session_funcionario_numero" ) ); + + String from = ( String ) session.getAttribute( siprpServlet.sessionCompanyEmail ); + + String marcacao_tipo = ( String )parameters.get( MARCACAO_TIPO ); + + String email = DEFAULT_EMAIL; + if( PROPERTIES != null && PROPERTIES.containsKey( EMAIL_MARCACAO ) ) + { + email = ( String ) PROPERTIES.get( EMAIL_MARCACAO ); + } + String destination = email; + String subject = "Pedido de marca\u00e7\u00e3o de " + marcacao_tipo + " via web"; + String content = createContent( parameters, FORM_FIELDS, "marcacao/marcacao.html" ); + // manda mail + boolean success = sendMail( from, destination, subject, content, true ); + + // mostra pagina correspondente + out.println( showResultPage( success, "marcacao/marcacao_enviada.html", "marcacao/marcacao_nao_enviada.html" ) ); + } + + private String showPage( String page, Hashtable parameters ) + { + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + + try + { + if( parameters != null ) + { + String key; + for( Enumeration e = parameters.keys(); e.hasMoreElements(); ) + { + key = ( String ) e.nextElement(); + context.put( key, parameters.get( key ) ); + } + } + + Velocity.mergeTemplate( page, Velocity.ENCODING_DEFAULT, context, output ); + + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + + return null; + } +} diff --git a/branches/SIPRP/web/src/siprp/pagina/doGetListaEmpresas.java b/branches/SIPRP/web/src/siprp/pagina/doGetListaEmpresas.java new file mode 100644 index 00000000..60303b2f --- /dev/null +++ b/branches/SIPRP/web/src/siprp/pagina/doGetListaEmpresas.java @@ -0,0 +1,113 @@ +package siprp.pagina; + +import com.evolute.utils.arrays.*; +import com.evolute.utils.strings.*; +import java.io.*; +import java.util.*; +import java.sql.*; +import java.lang.reflect.Array; +import javax.servlet.*; +import javax.servlet.http.*; +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +public class doGetListaEmpresas extends siprpServlet{ + + /** Creates a new instance of doGetListaEmpresas */ + public doGetListaEmpresas(HttpServletRequest req, HttpServletResponse res) throws IOException + { + ServletOutputStream out = res.getOutputStream(); + Connection con = null ; + Statement stmt = null ; + ResultSet2DArray rs; + StringBuffer dbQuery; + String userRole="", temp=""; + HttpSession session = req.getSession(false); + Vector links = new Vector(); + Vector desc = new Vector(); +String empresa_nome; + try + { + userRole = (String)session.getAttribute(super.sessionUserRole); +empresa_nome = ( String ) session.getAttribute( sessionCompanyName ); + + if (userRole == null) + { + throw new IllegalStateException(); + } + + if ( userRole.equals ( super.superUserRole ) ) + { +empresa_nome = null; + Class.forName(super.bdDriver); + con = DriverManager.getConnection( bdLocalUrl, bdLocalUsername, bdLocalPassword ); + dbQuery = new StringBuffer(); + dbQuery.append( "SELECT id, designacao_social, designacao_social_plain FROM empresas WHERE inactivo <> 'y' ORDER BY designacao_social_plain" ); + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + + int index=0; + int max = rs.columnLength(); + + while ( index < max ) + { + String str = (String)rs.get(index,1); + if( str != null && str.trim().length() > 0 ) + { + temp=""+rs.get(index,0); // converter de int para String + dbQuery = new StringBuffer(); + dbQuery.append("/"+super.servletName+"/?"+temp); // contruir url + links.add(dbQuery.toString()); + desc.add((String)rs.get(index,1)); + } + ++index; + } + stmt.close(); + con.close(); + + +session.setAttribute( sessionEstabelecimentoId, null ); + +HashMap hmValues = new HashMap(); +//hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) ); +hmValues.put( "empresa_nome", empresa_nome ); +hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) ); +hmValues.put( "estabelecimento_id", session.getAttribute( sessionEstabelecimentoId ) ); +hmValues.put( "userRole", userRole ); +hmValues.put( "userName", session.getAttribute( sessionUser ) ); +hmValues.put( msgTemplate , super.msgListaEmpresas ) ; +hmValues.put( templateUserRole, userRole); +hmValues.put( templateQuery, super.queryStringEmpresas ); +hmValues.put( templateVector1,links); +hmValues.put( templateVector2,desc); +hmValues.put( templateVector3,null); +out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate)); + + + //out.println( mergeTemplate( super.msgListaEmpresas, userRole, super.queryStringEmpresas, links, desc, null, super.authenticatedUserTemplate) ); + + } + else + { + out.println( mergeTemplate( super.msgAcessoNegado , userRole, super.errorTemplate) ); + } + + } + catch ( IllegalStateException e ) // session timeout + { + e.printStackTrace(); + out.println( mergeTemplate(msgSessionTimeout, super.errorTemplate) ); + } + catch ( SQLException e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgErroBd , super.errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgGenericError , userRole, super.errorTemplate) ); + } + } + +} diff --git a/branches/SIPRP/web/src/siprp/pagina/doGetListaEstabelecimentos.java b/branches/SIPRP/web/src/siprp/pagina/doGetListaEstabelecimentos.java new file mode 100644 index 00000000..4e8b9642 --- /dev/null +++ b/branches/SIPRP/web/src/siprp/pagina/doGetListaEstabelecimentos.java @@ -0,0 +1,105 @@ +package siprp.pagina; + +import com.evolute.utils.arrays.*; +import com.evolute.utils.strings.*; +import java.io.*; +import java.util.*; +import java.sql.*; +import java.lang.reflect.Array; +import javax.servlet.*; +import javax.servlet.http.*; +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +public class doGetListaEstabelecimentos extends siprpServlet{ + + /** Creates a new instance of doGetListaEstabelecimentos */ + public doGetListaEstabelecimentos(HttpServletRequest req, HttpServletResponse res) throws IOException + { + ServletOutputStream out = res.getOutputStream(); + Connection con = null ; + Statement stmt = null ; + ResultSet2DArray rs; + StringBuffer dbQuery, sBuffer; + String userRole, empresaId, temp; + HttpSession session = req.getSession(false); + Vector links = new Vector(); + Vector desc = new Vector(); + try + { + userRole = (String)session.getAttribute(super.sessionUserRole); + empresaId = (String)session.getAttribute(super.sessionEmpresaId); + + if ( userRole.equals ( super.superUserRole ) || userRole.equals ( empresaId ) ) + { + Class.forName(super.bdDriver); + con = DriverManager.getConnection( bdLocalUrl, bdLocalUsername, bdLocalPassword ); + dbQuery = new StringBuffer(); + dbQuery.append( " SELECT id, nome, nome_plain FROM estabelecimentos WHERE inactivo <> 'y' AND empresa_id = '"+empresaId+"' order by nome_plain" ); + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + + int index=0; + int max = rs.columnLength(); + + while ( index < max ) + { + temp=""+rs.get(index,0); // converter de int para String + dbQuery = new StringBuffer(); + dbQuery.append("/"+super.servletName+"/?"+empresaId+"/"+temp); // contruir url + links.add(dbQuery.toString()); + desc.add((String)rs.get(index,1)); + ++index; + } + sBuffer = new StringBuffer(); + sBuffer.append(""+super.nomeEmpresa(con,empresaId)+""); + +if( userRole.equals( "manager" ) ) +{ + session.setAttribute( sessionCompanyName, nomeEmpresa( con, ( String ) session.getAttribute( sessionEmpresaId ) ) ); +} +else +{ + session.setAttribute( sessionCompanyName, nomeEmpresa( con, userRole ) ); +} + +session.setAttribute( sessionCompanyEmail, emailEmpresa( con, empresaId ) ); + +session.setAttribute( sessionEstabelecimentoId, null ); + +HashMap hmValues = new HashMap(); +hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) ); +hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) ); +hmValues.put( "estabelecimento_id", session.getAttribute( sessionEstabelecimentoId ) ); +hmValues.put( "userRole", userRole ); +hmValues.put( "userName", session.getAttribute( sessionUser ) ); +hmValues.put( msgTemplate , sBuffer.toString() ) ; +hmValues.put( templateUserRole, userRole); +hmValues.put( templateQuery, super.queryStringEstabelecimentos ); +hmValues.put( templateVector1,links); +hmValues.put( templateVector2,desc); +hmValues.put( templateVector3,null); +out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate)); + +// out.println( mergeTemplate( sBuffer.toString(), userRole, super.queryStringEstabelecimentos, links, desc, null, super.authenticatedUserTemplate) ); + stmt.close(); + con.close(); + } + else + { + out.println( mergeTemplate( super.msgAcessoNegado , userRole, super.errorTemplate) ); + } + } + catch ( SQLException e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgErroBd , super.errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgGenericError , super.errorTemplate) ); + } + } + +} diff --git a/branches/SIPRP/web/src/siprp/pagina/doGetListaTrabalhadores.java b/branches/SIPRP/web/src/siprp/pagina/doGetListaTrabalhadores.java new file mode 100644 index 00000000..a10858a0 --- /dev/null +++ b/branches/SIPRP/web/src/siprp/pagina/doGetListaTrabalhadores.java @@ -0,0 +1,299 @@ +package siprp.pagina; + +import com.evolute.utils.arrays.*; +import com.evolute.utils.strings.*; +import java.io.*; +import java.util.*; +import java.sql.*; +import java.lang.reflect.Array; +import javax.servlet.*; +import javax.servlet.http.*; +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +public class doGetListaTrabalhadores extends siprpServlet{ + + /** Creates a new instance of doGetListaTrabalhadores */ + public doGetListaTrabalhadores(HttpServletRequest req, HttpServletResponse res, String query) throws IOException + { + boolean print = false; + if( query != null ) + { + print = query.indexOf( "_print" ) != -1; + if( query.indexOf( "trabalhadores_tudo" ) == 0 ) + { + new doGetListaTrabalhadoresTudo( req, res, print ); + return; + } + else if( query.indexOf( "trabalhadores_pendentes" ) == 0 ) + { + new doGetListaTrabalhadoresPendentes( req, res, print ); + return; + } + } + ServletOutputStream out = res.getOutputStream(); + Connection con = null ; + Statement stmt = null ; + ResultSet2DArray rs, rsTrab; + StringBuffer sBuffer; + String userRole, empresaId, estabelecimentoId, temp; + HttpSession session = req.getSession(false); + Vector links = new Vector(); + Vector desc = new Vector(); + Vector descAdicional = new Vector(); + java.util.Date today = new java.util.Date(); + try + { + userRole = (String)session.getAttribute(super.sessionUserRole); + empresaId = (String)session.getAttribute(super.sessionEmpresaId); + estabelecimentoId = (String)session.getAttribute(super.sessionEstabelecimentoId); + + if ( userRole.equals ( super.superUserRole ) || userRole.equals ( empresaId ) ) + { + Class.forName(super.bdDriver); + con = DriverManager.getConnection( bdLocalUrl, bdLocalUsername, bdLocalPassword ); + if ( super.verificaEstabelecimento(con, empresaId, estabelecimentoId) ) // estabelecimento pertence 'a empresa ?? + { + //Class.forName(super.bdDriver); + //con = DriverManager.getConnection( super.bdUrl, super.bdUsername, super.bdPassword ); + String dbQuery = "SELECT id, nome, nome_plain FROM trabalhadores WHERE inactivo <> 'y' AND data_demissao IS NULL AND estabelecimento_id = '"+estabelecimentoId+"' ORDER BY nome_plain"; + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rsTrab = new ResultSet2DArray( stmt.executeQuery( dbQuery ) ); + rsTrab.getObjects(); + stmt.close(); + + final int max = rsTrab.columnLength(); + + for ( int index = 0; index < max; index++ ) + { + Integer id = (Integer)rsTrab.get(index,0); + String link = "/"+super.servletName+"/?"+empresaId+"/"+estabelecimentoId+"/"+id; + links.add(link); + HashMap trabalhador = new HashMap(); + trabalhador.put( "Nome", (String)rsTrab.get(index,1) ); + + + dbQuery = "SELECT id, data, estado FROM marcacoes_trabalhador " + + "WHERE tipo = 1 and trabalhador_id = " + id + + " ORDER BY data DESC"; + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery ) ); + rs.getObjects(); + stmt.close(); + if( rs.columnLength() > 0 ) + { + java.util.Date dataConsulta2 = ( java.util.Date ) rs.get( 0, 1 ); + Integer estado2 = ( Integer ) rs.get( 0, 2 ); + java.util.Date dataConsulta1; + // java.util.Date dataRelatorio1; + // java.util.Date dataRelatorio2 = (java.util.Date) rs.get( 0, 3 ); + Integer estado1; + String realizada1 = ""; + String realizada2 = ""; + if( rs.columnLength() >= 2 ) + { + dataConsulta1 = ( java.util.Date ) rs.get( 1, 1 ); + estado1 = ( Integer ) rs.get( 1, 2 ); + // dataRelatorio1 = (java.util.Date) rs.get( 1, 3 ); + } + else + { + dataConsulta1 = dataConsulta2; + estado1 = estado2; + // dataRelatorio1 = dataRelatorio2; + } + if( ESTADO_REALIZADO.equals( estado2 ) || today.after( dataConsulta2 ) ) + { + trabalhador.put( "ultima_consulta", dataConsulta2 ); + if( estado2.equals( ESTADO_POR_REALIZAR ) ) + { + realizada2 = "não"; + } + else if( estado2.equals( ESTADO_REALIZADO ) ) + { + realizada2 = "sim"; + } + trabalhador.put( "realizada", realizada2 ); + trabalhador.put( "proxima_consulta", "" ); + } + else + { + try + { + for( int c = 1; c < rs.columnLength(); c++ ) + { + java.util.Date dataTemp = ( java.util.Date ) rs.get( c, 1 ); + dataConsulta1 = dataTemp; + estado1 = ( Integer ) rs.get( c, 2 ); + if( dataTemp.after( today ) ) + { + dataConsulta2 = dataTemp; + } + else + { + break; + } + } + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + trabalhador.put( "proxima_consulta", dataConsulta2 ); + + if( !dataConsulta2.equals( dataConsulta1 ) ) + { + if( estado1.equals( ESTADO_POR_REALIZAR ) ) + { + realizada1 = "não"; + } + else if( estado1.equals( ESTADO_REALIZADO ) ) + { + realizada1 = "sim"; + } + trabalhador.put( "realizada", realizada1 ); + trabalhador.put( "ultima_consulta", dataConsulta1 ); + } + else + { + trabalhador.put( "ultima_consulta", "" ); + trabalhador.put( "realizada", null ); + } + } + } + else + { + trabalhador.put( "ultima_consulta", "" ); + trabalhador.put( "realizada", null ); + trabalhador.put( "proxima_consulta", "" ); + } + + + dbQuery = "SELECT id, data, estado FROM marcacoes_trabalhador " + + "WHERE tipo = 0 and trabalhador_id = " + id + + " ORDER BY data DESC"; + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery ) ); + rs.getObjects(); + stmt.close(); + if( rs.columnLength() > 0 ) + { + java.util.Date dataConsulta2 = ( java.util.Date ) rs.get( 0, 1 ); + Integer estado2 = ( Integer ) rs.get( 0, 2 ); + Integer estado1; + java.util.Date dataConsulta1; + // java.util.Date dataRelatorio1; + // java.util.Date dataRelatorio2 = (java.util.Date) rs.get( 0, 3 ); + String realizada1 = ""; + String realizada2 = ""; + if( rs.columnLength() >= 2 ) + { + dataConsulta1 = ( java.util.Date ) rs.get( 1, 1 ); + estado1 = ( Integer ) rs.get( 1, 2 ); + // dataRelatorio1 = (java.util.Date) rs.get( 1, 3 ); + } + else + { + dataConsulta1 = dataConsulta2; + estado1 = estado2; + // dataRelatorio1 = dataRelatorio2; + } + if( ESTADO_REALIZADO.equals( estado2 ) || today.after( dataConsulta2 ) ) + { + trabalhador.put( "ultimo_exame", dataConsulta2 ); + if( estado2.equals( ESTADO_POR_REALIZAR ) ) + { + realizada2 = "não"; + } + else if( estado2.equals( ESTADO_REALIZADO ) ) + { + realizada2 = "sim"; + } + trabalhador.put( "realizado", realizada2 ); + trabalhador.put( "proximo_exame", "" ); + } + else + { + trabalhador.put( "proximo_exame", dataConsulta2 ); + if( !dataConsulta2.equals( dataConsulta1 ) ) + { + if( estado1.equals( ESTADO_POR_REALIZAR ) ) + { + realizada1 = "não"; + } + else if( estado1.equals( ESTADO_REALIZADO ) ) + { + realizada1 = "sim"; + } + trabalhador.put( "realizado", realizada1 ); + trabalhador.put( "ultimo_exame", dataConsulta1 ); + } + else + { + trabalhador.put( "ultimo_exame", "" ); + trabalhador.put( "realizado", null ); + } + } + } + else + { + trabalhador.put( "ultimo_exame", "" ); + trabalhador.put( "realizado", null ); + trabalhador.put( "proximo_exame", "" ); + } + + desc.add( trabalhador ); + } + + + sBuffer = new StringBuffer(); + sBuffer.append(""+super.nomeEmpresa(con,empresaId)+"

" + +super.nomeEstabelecimento(con, estabelecimentoId)+"" ); + + HashMap hmValues = new HashMap(); + hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) ); + hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) ); + hmValues.put( "estabelecimento_nome", super.nomeEstabelecimento( con, estabelecimentoId ) ); + hmValues.put( "estabelecimento_id", estabelecimentoId ); + hmValues.put( "userRole", userRole ); + hmValues.put( "userName", session.getAttribute( sessionUser ) ); + hmValues.put( msgTemplate , sBuffer.toString() ) ; + hmValues.put( templateUserRole, userRole); + hmValues.put( templateQuery, super.queryStringTrabalhadores ); + hmValues.put( templateVector1,links); + hmValues.put( templateVector2,desc); + hmValues.put( templateVector3,null); + if( !print ) + { + out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate)); + } + else + { + out.println( mergeTemplate( hmValues, super.authenticatedUserPrintTemplate)); + } +// out.println( mergeTemplate( sBuffer.toString(), userRole, super.queryStringTrabalhadores, links, desc, null, super.authenticatedUserTemplate) ); + } + else // est nao pertence 'a empresa + { + out.println( mergeTemplate( super.msgLinkFormatError , userRole, super.errorTemplate) ); + } + con.close(); + } + else // Role nao permite ver esta informacao + { + out.println( mergeTemplate( super.msgAcessoNegado , userRole, super.errorTemplate) ); + } + } + catch ( SQLException e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgErroBd , super.errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgGenericError , super.errorTemplate) ); + } + } + +} diff --git a/branches/SIPRP/web/src/siprp/pagina/doGetListaTrabalhadoresPendentes.java b/branches/SIPRP/web/src/siprp/pagina/doGetListaTrabalhadoresPendentes.java new file mode 100644 index 00000000..2eb9acc9 --- /dev/null +++ b/branches/SIPRP/web/src/siprp/pagina/doGetListaTrabalhadoresPendentes.java @@ -0,0 +1,879 @@ +/* + * doGetListaTrabalhadoresPendentes.java + * + * Created on 22 de Abril de 2005, 15:56 + */ + +package siprp.pagina; + +import java.io.*; +import java.lang.reflect.Array; +import javax.servlet.*; +import javax.servlet.http.*; +import java.sql.*; +import java.util.*; + +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +import com.evolute.utils.arrays.*; +import com.evolute.utils.data.*; +import com.evolute.utils.db.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.strings.*; + +/** + * + * @author fpalma + */ +public class doGetListaTrabalhadoresPendentes + extends siprpServlet +{ + private static final long TRES_MESES = 3L * 30L * 24L * 60L * 60L * 1000L; + private static final long CATORZE_DIAS = 14L * 24L * 60L * 60L * 1000L; + + protected static final int ESTADO_NAO_APLICAVEL = 0; + protected static final int ESTADO_PENDENTE = 1; + protected static final int ESTADO_MARCADO = 2; + protected static final int ESTADO_TRATADO = 3; + + protected static int MOTIVO_ADMISSAO = 1; + protected static int MOTIVO_PERIODICA = 2; + protected static int MOTIVO_OCASIONAL = 3; + protected static int MOTIVO_PERIODICA_INICIAL = 5; + + protected static final Hashtable CORES_ESTADOS = new Hashtable(); + protected static final Hashtable TEXTOS_ESTADOS = new Hashtable(); + static + { + CORES_ESTADOS.put( new Integer( ESTADO_NAO_APLICAVEL ), "white" ); + CORES_ESTADOS.put( new Integer( ESTADO_PENDENTE ), "red" ); + CORES_ESTADOS.put( new Integer( ESTADO_MARCADO ), "yellow" ); + CORES_ESTADOS.put( new Integer( ESTADO_TRATADO ), "green" ); + + TEXTOS_ESTADOS.put( new Integer( ESTADO_NAO_APLICAVEL ), "n.a." ); + TEXTOS_ESTADOS.put( new Integer( ESTADO_PENDENTE ), "pendente" ); + TEXTOS_ESTADOS.put( new Integer( ESTADO_MARCADO ), "pendente" ); +// TEXTOS_ESTADOS.put( new Integer( ESTADO_TRATADO ), "green" ); + } + + protected java.sql.Date today; + protected long todayMillis; + + /** Creates a new instance of doGetListaTrabalhadores */ +// public doGetListaTrabalhadoresPendentes(HttpServletRequest req, HttpServletResponse res, boolean print) +// throws IOException +// { +// ServletOutputStream out = res.getOutputStream(); +// Connection con = null ; +// Statement stmt = null ; +// ResultSet2DArray rs; +// StringBuffer dbQuery, sBuffer; +// String userRole, empresaId, estabelecimentoId, temp; +// HttpSession session = req.getSession(false); +// Vector links = new Vector(); +// Vector desc = new Vector(); +// Vector descAdicional = new Vector(); +//// today = new java.util.Date(); +//// todayMillis = today.getTime(); +// +// try +// { +// stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); +// rs = new ResultSet2DArray( stmt.executeQuery( "SELECT CURRENT_DATE" ) ); +// today = ( java.sql.Date ) rs.get( 0, 0 ); +// stmt.close(); +// todayMillis = today.getTime(); +// +// userRole = (String)session.getAttribute(super.sessionUserRole); +// empresaId = (String)session.getAttribute(super.sessionEmpresaId); +// estabelecimentoId = (String)session.getAttribute(super.sessionEstabelecimentoId); +// +// if ( userRole.equals ( super.superUserRole ) || userRole.equals ( empresaId ) ) +// { +// Class.forName(super.bdDriver); +// con = DriverManager.getConnection( bdLocalUrl, bdLocalUsername, bdLocalPassword ); +// if ( super.verificaEstabelecimento(con, empresaId, estabelecimentoId) ) // estabelecimento pertence a empresa ?? +// { +// //Class.forName(super.bdDriver); +// //con = DriverManager.getConnection( super.bdUrl, super.bdUsername, super.bdPassword ); +// dbQuery = new StringBuffer(); +// dbQuery.append( "SELECT trabalhadores.id, trabalhadores.nome, " +// + "marcacoes_trabalhador.tipo, marcacoes_trabalhador.data, marcacoes_trabalhador.estado, " +// + " trabalhadores.nome_plain, marcacoes_trabalhador.motivo " +// + "FROM trabalhadores LEFT JOIN marcacoes_trabalhador ON ( marcacoes_trabalhador.trabalhador_id = trabalhadores.id )" +// + "WHERE estabelecimento_id = " + estabelecimentoId +// + " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL " +// + " AND marcacoes_trabalhador.estado NOT IN ( 3, 4, 5) " +// + "ORDER BY 6, 3, 4 DESC " ); +// // dbQuery.append( "SELECT id, nome, ( ultima_consulta IS NOT NULL AND realizada = 'y' )," +// // + " ( ultimo_exame IS NOT NULL AND realizado = 'y' )," +// // + " proxima_consulta IS NOT NULL, proximo_exame IS NOT NULL, " +// // + " ( proxima_consulta IS NOT NULL AND proxima_consulta - current_date <= 14 ), " +// // + " ( proximo_exame IS NOT NULL AND proximo_exame - current_date <= 14 )" +// // + " FROM trabalhadores " +// // + " WHERE estabelecimento_id = '"+estabelecimentoId+"'" +// // + " AND ( ultima_consulta IS NULL OR realizada = 'n' OR" +// // + " ( proxima_consulta IS NOT NULL AND proxima_consulta - current_date <= 14 )" +// // + " OR ( proximo_exame IS NOT NULL AND proximo_exame - current_date <= 14 ) )" +// // + " ORDER BY nome" ); +// stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); +// rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); +// +// int index=0; +// int max = rs.columnLength(); +// +// Integer trabalhadorID = new Integer( -1 ); +// String nomeTrabalhador = ""; +// Vector consultas = new Vector(); +// Vector exames = new Vector(); +// +// for ( index = 0; index <= max; index++ ) +// { +// Integer id = index < max ? ( Integer ) rs.get( index, 0 ) : new Integer( -1 ); +// if( !id.equals( trabalhadorID ) ) +// { +// Object listaConsultas[][] = ( Object[][] ) consultas.toArray( new Object[consultas.size()][3] ); +// Object listaExames[][] = ( Object[][] ) exames.toArray( new Object[exames.size()][3] ); +// if( trabalhadorID.intValue() > -1 && +// verificarTrabalhador( listaConsultas, listaExames ) ) +// { +// temp=""+rs.get(index - 1,0); // converter de int para String +// dbQuery = new StringBuffer(); +// dbQuery.append("/"+super.servletName+"/?"+empresaId+"/"+estabelecimentoId+"/"+temp); // contruir url +// links.add(dbQuery.toString()); +// desc.add( criarDadosTrabalhador( con, trabalhadorID, nomeTrabalhador, listaConsultas, listaExames ) ); +// } +// exames.clear(); +// consultas.clear(); +// } +// if( index == max ) +// { +// break; +// } +// Integer tipo = ( Integer ) rs.get( index, 2 ); +// +// String nome = ( String ) rs.get( index, 1 ); +// java.util.Date data = ( java.util.Date ) rs.get( index, 3 ); +// Integer estado = ( Integer ) rs.get( index, 4 ); +// Integer motivo = ( Integer ) rs.get( index, 6 ); +// trabalhadorID = id; +// nomeTrabalhador = nome; +// Object marcacao[] = new Object[]{ data, estado, motivo }; +// if( tipo == null ) +// { +// continue; +// } +// switch( tipo.intValue() ) +// { +// case TIPO_MARCACAO_EXAMES: +// exames.add( marcacao ); +// break; +// +// case TIPO_MARCACAO_CONSULTA: +// consultas.add( marcacao ); +// break; +// } +// } +// stmt.close(); +// +// sBuffer = new StringBuffer(); +// sBuffer.append(""+super.nomeEmpresa(con,empresaId)+"

" +// +super.nomeEstabelecimento(con, estabelecimentoId)+"" ); +// +// HashMap hmValues = new HashMap(); +// hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) ); +// hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) ); +// hmValues.put( "estabelecimento_nome", super.nomeEstabelecimento( con, estabelecimentoId ) ); +// hmValues.put( "estabelecimento_id", estabelecimentoId ); +// hmValues.put( "userRole", userRole ); +// hmValues.put( "userName", session.getAttribute( sessionUser ) ); +// hmValues.put( msgTemplate , sBuffer.toString() ) ; +// hmValues.put( templateUserRole, userRole); +// hmValues.put( templateQuery, "trabalhadores_pendentes" ); +// hmValues.put( templateVector1,links); +// hmValues.put( templateVector2,desc); +// hmValues.put( templateVector3,null); +// if( !print ) +// { +// out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate)); +// } +// else +// { +// out.println( mergeTemplate( hmValues, super.authenticatedUserPrintTemplate)); +// } +//// out.println( mergeTemplate( sBuffer.toString(), userRole, super.queryStringTrabalhadores, links, desc, null, super.authenticatedUserTemplate) ); +// } +// else // est nao pertence 'a empresa +// { +// out.println( mergeTemplate( super.msgLinkFormatError , userRole, super.errorTemplate) ); +// } +// con.close(); +// } +// else // Role nao permite ver esta informacao +// { +// out.println( mergeTemplate( super.msgAcessoNegado , userRole, super.errorTemplate) ); +// } +// } +// catch ( SQLException e ) +// { +// e.printStackTrace(); +// out.println( mergeTemplate( super.msgErroBd , super.errorTemplate) ); +// } +// catch ( Exception e ) +// { +// e.printStackTrace(); +// out.println( mergeTemplate( super.msgGenericError , super.errorTemplate) ); +// } +// } + + public doGetListaTrabalhadoresPendentes(HttpServletRequest req, HttpServletResponse res, boolean print ) + throws IOException + { + ServletOutputStream out = res.getOutputStream(); + String userRole, empresaId, estabelecimentoId; + HttpSession session = req.getSession(false); + Vector links = new Vector(); + Vector desc = new Vector(); + Vector descAdicional = new Vector(); +// today = new java.util.Date(); +// todayMillis = today.getTime(); + + try + { + Executer executer = getExecuter(); + Virtual2DArray array = executer.executeQuery( new Select( "SELECT CURRENT_DATE" ) ); + today = ( java.sql.Date ) array.get( 0, 0 ); + todayMillis = today.getTime(); + + userRole = (String)session.getAttribute(sessionUserRole); + empresaId = (String)session.getAttribute(sessionEmpresaId); + estabelecimentoId = (String)session.getAttribute(sessionEstabelecimentoId); + + if ( userRole.equals ( superUserRole ) || userRole.equals ( empresaId ) ) + { + if ( verificaEstabelecimento(null, empresaId, estabelecimentoId) ) // estabelecimento pertence 'a empresa ?? + { + //Class.forName(super.bdDriver); + //con = DriverManager.getConnection( super.bdUrl, super.bdUsername, super.bdPassword ); + String query = "( SELECT trabalhadores.id, trabalhadores.nome, " + + "marcacoes_trabalhador.tipo, marcacoes_trabalhador.data, marcacoes_trabalhador.estado, " + + " trabalhadores.nome_plain, marcacoes_trabalhador.motivo, marcacoes_trabalhador.data " + + "FROM trabalhadores LEFT JOIN marcacoes_trabalhador ON ( marcacoes_trabalhador.trabalhador_id = trabalhadores.id ) " + + "WHERE estabelecimento_id = " + estabelecimentoId + + " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL " + + " AND marcacoes_trabalhador.estado NOT IN ( 3, 4, 5) " + + " AND marcacoes_trabalhador.tipo = " + TIPO_MARCACAO_CONSULTA + + " AND marcacoes_trabalhador.motivo <> " + MOTIVO_OCASIONAL + " )" + + " UNION " + + "( SELECT trabalhadores.id, trabalhadores.nome, " + + "marcacoes_trabalhador.tipo, marcacoes_trabalhador.data, marcacoes_trabalhador.estado, " + + " trabalhadores.nome_plain, marcacoes_trabalhador.motivo, marcacoes_trabalhador.data + 90 " + + "FROM trabalhadores LEFT JOIN marcacoes_trabalhador ON ( marcacoes_trabalhador.trabalhador_id = trabalhadores.id ) " + + "WHERE estabelecimento_id = " + estabelecimentoId + + " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL " + + " AND marcacoes_trabalhador.estado NOT IN ( 3, 4, 5) " + + " AND marcacoes_trabalhador.tipo = " + TIPO_MARCACAO_EXAMES + " )" + + "ORDER BY 6, 8, 3 DESC "; + array = executer.executeQuery( new Select( query ) ); + + query = "SELECT trabalhadores.id, trabalhadores.nome, " + + "marcacoes_trabalhador.tipo, marcacoes_trabalhador.data, marcacoes_trabalhador.estado, " + + " trabalhadores.nome_plain, marcacoes_trabalhador.motivo, marcacoes_trabalhador.data " + + "FROM trabalhadores LEFT JOIN marcacoes_trabalhador ON ( marcacoes_trabalhador.trabalhador_id = trabalhadores.id ) " + + "WHERE estabelecimento_id = " + estabelecimentoId + + " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL " + + " AND marcacoes_trabalhador.estado NOT IN ( 3, 4, 5) " + + " AND marcacoes_trabalhador.tipo = " + TIPO_MARCACAO_CONSULTA + + " AND marcacoes_trabalhador.motivo = " + MOTIVO_OCASIONAL + + " ORDER BY 6, 8, 3 DESC"; + Virtual2DArray ocasionaisArray = executer.executeQuery( new Select( query ) ); + + query = "SELECT trabalhadores.id, trabalhadores.nome " + + "FROM trabalhadores " + + "WHERE estabelecimento_id = " + estabelecimentoId + + " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL;"; + Virtual2DArray trabalhadoresArray = executer.executeQuery( new Select( query ) ); + + Hashtable marcacoesPorID = new Hashtable(); + Hashtable ocasionaisPorID = new Hashtable(); + Hashtable nomesPorID = new Hashtable(); + for( int n = 0; n < trabalhadoresArray.columnLength(); n++ ) + { + nomesPorID.put( trabalhadoresArray.get( n, 0 ), trabalhadoresArray.get( n, 1 ) ); + } + + preencherMarcacoes( array, nomesPorID, marcacoesPorID ); + preencherMarcacoes( ocasionaisArray, nomesPorID, ocasionaisPorID ); + + Integer ids[] = ( Integer[] ) nomesPorID.keySet().toArray( new Integer[0] ); + IDObject trabalhadores[] = new IDObject[ ids.length ]; + for( int n = 0; n < ids.length; n++ ) + { + trabalhadores[ n ] = new MappableObject( ids[ n ], nomesPorID.get( ids[ n ] ) ); + } + Arrays.sort( trabalhadores, new Comparator(){ + public int compare( Object o1, Object o2 ) + { + String nome1 = StringPlainer.convertString( o1.toString() ); + String nome2 = StringPlainer.convertString( o2.toString() ); + return nome1.compareTo( nome2 ); + } + } ); + + for( int n = 0; n < trabalhadores.length; n++ ) + { + Object marcacoes[][]; + if( marcacoesPorID.containsKey( trabalhadores[ n ].getID() ) ) + { + marcacoes = ( Object[][] ) ( ( Vector )marcacoesPorID.get( trabalhadores[ n ].getID() ) ).toArray( new Object[ 0 ][] ); + } + else + { + marcacoes = new Object[0][]; + } + Object ocasionais[][]; + if( ocasionaisPorID.containsKey( trabalhadores[ n ].getID() ) ) + { + ocasionais = ( Object[][] ) ( ( Vector )ocasionaisPorID.get( trabalhadores[ n ].getID() ) ).toArray( new Object[ 0 ][] ); + } + else + { + ocasionais = new Object[ 0 ][]; + } + Object agrupadas[][] = agruparMarcacoes( marcacoes, ocasionais ); + acrescentarTrabalhador( empresaId, estabelecimentoId, + trabalhadores[ n ], null, + agrupadas, links, desc, + perfilTemConsultas( trabalhadores[ n ].getID(), new Integer( empresaId ) ), + perfilTemExames( trabalhadores[ n ].getID(), new Integer( empresaId ) ) ); + } + + HashMap hmValues = new HashMap(); + hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) ); + hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) ); + hmValues.put( "estabelecimento_nome", nomeEstabelecimento( null, estabelecimentoId ) ); + hmValues.put( "estabelecimento_id", estabelecimentoId ); + hmValues.put( "userRole", userRole ); + hmValues.put( "userName", session.getAttribute( sessionUser ) ); + hmValues.put( msgTemplate , ""+nomeEmpresa(null,empresaId)+"

" + +nomeEstabelecimento(null, estabelecimentoId)+"" ) ; + hmValues.put( templateUserRole, userRole); + hmValues.put( templateQuery, "trabalhadores_pendentes" ); + hmValues.put( templateVector1,links); + hmValues.put( templateVector2,desc); + hmValues.put( templateVector3,null); + if( !print ) + { + out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate)); + } + else + { + out.println( mergeTemplate( hmValues, super.authenticatedUserPrintTemplate)); + } +// out.println( mergeTemplate( sBuffer.toString(), userRole, super.queryStringTrabalhadores, links, desc, null, super.authenticatedUserTemplate) ); + } + else // est nao pertence 'a empresa + { + out.println( mergeTemplate( super.msgLinkFormatError , userRole, super.errorTemplate) ); + } + } + else // Role nao permite ver esta informacao + { + out.println( mergeTemplate( super.msgAcessoNegado , userRole, super.errorTemplate) ); + } + } + catch ( SQLException e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgErroBd , super.errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgGenericError , super.errorTemplate) ); + } + } + + protected void preencherMarcacoes( Virtual2DArray array, Hashtable nomesPorID, Hashtable marcacoesPorID ) + { + int max = array.columnLength(); + for( int index = 0; index < max; index++ ) + { + Integer id = index < max ? ( Integer ) array.get( index, 0 ) : new Integer( -1 ); + Integer tipo = ( Integer ) array.get( index, 2 ); + String nome = ( String ) array.get( index, 1 ); + java.util.Date data = ( java.util.Date ) array.get( index, 3 ); + Integer estado = ( Integer ) array.get( index, 4 ); + Integer motivo = ( Integer ) array.get( index, 6 ); + if( !marcacoesPorID.containsKey( id ) ) + { + nomesPorID.put( id, nome ); + marcacoesPorID.put( id, new Vector() ); + } + if( data != null ) + { + Object marcacao[] = new Object[]{ data, estado, motivo, tipo }; + ( ( Vector ) marcacoesPorID.get( id ) ).add( marcacao ); + } + } + } + + protected Object[][] agruparMarcacoes( Object marcacoes[][], Object ocasionais[][] ) + { + long tresMeses = TRES_MESES; + java.util.Date dataExame = null; + Integer estadoExame = null; + java.util.Date dataConsulta = null; + Integer motivoConsulta = null; + Integer estadoConsulta = null; + Object grupo[] = null; + Vector grupos = new Vector(); + + if( marcacoes != null ) + { + for( int n = 0; n < marcacoes.length; n++ ) + { + if( grupo == null ) + { + grupo = new Object[ 5 ]; + dataExame = null; + estadoExame = null; + dataConsulta = null; + motivoConsulta = null; + estadoConsulta = null; + grupos.add( grupo ); + } + + java.util.Date data = ( java.util.Date ) marcacoes[ n ][ 0 ]; + Integer estado = ( Integer ) marcacoes[ n ][ 1 ]; + Integer motivo = ( Integer ) marcacoes[ n ][ 2 ]; + Integer tipo = ( Integer ) marcacoes[ n ][ 3 ]; + switch( tipo.intValue() ) + { + case TIPO_MARCACAO_EXAMES: + if( dataConsulta == null && + ( dataExame == null || estadoExame.intValue() < 2 ) ) + { + dataExame = data; + estadoExame = estado; + } + else if( dataConsulta != null && Math.abs( dataConsulta.getTime() - data.getTime() ) < tresMeses ) + { + dataExame = data; + estadoExame = estado; + } + else + { + grupo = null; + n--; + } + if( grupo != null ) + { + grupo[ 3 ] = dataExame; + grupo[ 4 ] = estadoExame; + } + break; + + case TIPO_MARCACAO_CONSULTA: + if( dataExame == null || Math.abs( dataExame.getTime() - data.getTime() ) < tresMeses ) + { + dataConsulta = data; + estadoConsulta = estado; + motivoConsulta = motivo; + } + else + { + grupo = null; + n--; + } + if( grupo != null ) + { + grupo[ 0 ] = dataConsulta; + grupo[ 1 ] = estadoConsulta; + grupo[ 2 ] = motivoConsulta; + } + break; + } + } + } + if( ocasionais != null ) + { + for( int n = 0; n < ocasionais.length; n++ ) + { + grupo = new Object[ 5 ]; + for( int i = 0; i < 3; i++ ) + { + grupo[ i ] = ocasionais[ n ][ i ]; + } + grupos.add( grupo ); + } + } + + Object agrupadas[][] = ( Object[][] ) grupos.toArray( new Object[ grupos.size() ][] ); + Arrays.sort( agrupadas, new Comparator(){ + public int compare( Object o1, Object o2 ) + { + Object g1[] = ( Object[] ) o1; + Object g2[] = ( Object[] ) o2; + java.util.Date d1 = ( java.util.Date ) ( g1[ 0 ] != null ? g1[ 0 ] : g1[ 3 ] ); + java.util.Date d2 = ( java.util.Date ) ( g2[ 0 ] != null ? g2[ 0 ] : g2[ 3 ] ); + return d2.compareTo( d1 ); + } + } ); + return agrupadas; + } + + protected void acrescentarTrabalhador( String empresaID, String estabelecimentoID, + IDObject trabalhador, java.util.Date dataFicha, + Object marcacoes[][], Vector links, Vector dados, + boolean perfilConsultas, boolean perfilExames ) + { + int estado[] = new int[ 2 ]; + int index = 0; + boolean pendente = false; + if( marcacoes.length == 0 ) + { + estado[ 0 ] = perfilConsultas ? ESTADO_PENDENTE : ESTADO_NAO_APLICAVEL; + estado[ 1 ] = perfilExames ? ESTADO_PENDENTE : ESTADO_NAO_APLICAVEL; + } + else + { + java.util.Date dataConsulta; + java.util.Date dataExame; + index = -1; + for( ; index + 1 < marcacoes.length; index++ ) + { + int n = index + 1; + dataConsulta = ( java.util.Date ) marcacoes[ n ][ 0 ]; + dataExame = ( java.util.Date ) marcacoes[ n ][ 3 ]; + boolean temConsulta = dataConsulta != null; + boolean consultaAntiga = temConsulta && dataConsulta.before( today ); + boolean temExame = dataExame != null; + boolean exameAntigo = temExame && dataExame.before( today ); + + if( ( temConsulta && consultaAntiga && temExame && exameAntigo ) || + ( temConsulta && consultaAntiga && !temExame && !exameAntigo ) || + ( !temConsulta && !consultaAntiga && temExame && exameAntigo ) ) + { + break; + } + } + if( index == -1 ) + { + index = 0; + } +// else if( index < marcacoes.length - 1 ) +// { +// index = 0; +// } + for( ; index < marcacoes.length; index++ ) + { + dataConsulta = ( java.util.Date ) marcacoes[ index ][ 0 ]; + dataExame = ( java.util.Date ) marcacoes[ index ][ 3 ]; + boolean temConsulta = dataConsulta != null; + long diffConsulta = temConsulta ? dataConsulta.getTime() - today.getTime() : 0; + boolean temExame = dataExame != null; + long diffExame = temExame ? dataExame.getTime() - today.getTime() : 0; + if( ( temConsulta && diffConsulta < CATORZE_DIAS ) || ( temExame && diffExame < CATORZE_DIAS ) ) + { + break; + } + } + if( index >= marcacoes.length ) + { + index = marcacoes.length - 1; + } + else + { + if( marcacoes.length > 1 ) + { + dataConsulta = ( java.util.Date ) marcacoes[ index ][ 0 ]; + dataExame = ( java.util.Date ) marcacoes[ index ][ 3 ]; + Calendar calToday = Calendar.getInstance(); + calToday.setTime( today ); + calToday.add( Calendar.YEAR, -2 ); + if( ( dataConsulta != null && dataConsulta.before( calToday.getTime() ) ) + || ( dataConsulta == null && dataExame != null && dataExame.before( calToday.getTime() ) ) ) + { + if( index > 0 ) + { + index--; + } + else + { + pendente = true; + } + } + } + } + dataConsulta = ( java.util.Date ) marcacoes[ index ][ 0 ]; + Integer estadoConsulta = ( Integer ) marcacoes[ index ][ 1 ]; + Integer motivoConsulta = ( Integer ) marcacoes[ index ][ 2 ]; + dataExame = ( java.util.Date ) marcacoes[ index ][ 3 ]; + Integer estadoExame = ( Integer ) marcacoes[ index ][ 4 ]; + if( perfilConsultas ) + { + if( dataConsulta == null || pendente ) + { + estado[ 0 ] = ESTADO_PENDENTE; + } + else if( estadoConsulta == null || estadoConsulta.intValue() != 2 ) + { + estado[ 0 ] = ESTADO_MARCADO; + } + else + { + estado[ 0 ] = ESTADO_TRATADO; + } + } + else + { + estado[ 0 ] = ESTADO_NAO_APLICAVEL; + } + if( perfilExames ) + { + if( dataExame == null || pendente ) + { + if( motivoConsulta != null && motivoConsulta.intValue() != MOTIVO_OCASIONAL ) + { + estado[ 1 ] = ESTADO_PENDENTE; + } + else + { + estado[ 1 ] = ESTADO_NAO_APLICAVEL; + } + } + else if( estadoExame == null || estadoExame.intValue() != 2 ) + { + estado[ 1 ] = ESTADO_MARCADO; + } + else + { + estado[ 1 ] = ESTADO_TRATADO; + } + } + else + { + estado[ 1 ] = ESTADO_NAO_APLICAVEL; + } + } + if( estado[ 0 ] == 1 || estado[ 0 ] == 2 || + estado[ 1 ] == 1 || estado[ 1 ] == 2 ) + { + links.add( "/"+servletName+"/?"+empresaID+"/"+estabelecimentoID+"/"+trabalhador.getID() ); + HashMap dadosTrabalhador = new HashMap(); + dadosTrabalhador.put( "Nome", trabalhador.toString() ); + dadosTrabalhador.put( "Consulta", CORES_ESTADOS.get( new Integer( estado[ 0 ] ) ) ); + Object text = TEXTOS_ESTADOS.get( new Integer( estado[ 0 ] ) ); + dadosTrabalhador.put( "Consulta_estado", text != null ? text : marcacoes[ index ][ 0 ] ); + dadosTrabalhador.put( "Exame", CORES_ESTADOS.get( new Integer( estado[ 1 ] ) ) ); + text = TEXTOS_ESTADOS.get( new Integer( estado[ 1 ] ) ); + dadosTrabalhador.put( "Exame_estado", text != null ? text : marcacoes[ index ][ 3 ] ); + dados.add( dadosTrabalhador ); + } + } + + protected boolean perfilTemConsultas( Integer trabalhadorID, Integer empresaID ) + throws Exception + { + Executer executer = getExecuter(); + String query = "SELECT a_consultas, b_consultas FROM empresas WHERE id = " + empresaID; + Virtual2DArray array = executer.executeQuery( new Select( query ) ); + boolean consultas[] = new boolean[]{ "y".equals( array.get( 0, 0 ) ), "n".equals( array.get( 0, 0 ) ) }; + query = "SELECT perfil FROM trabalhadores WHERE id = " + trabalhadorID; + array = executer.executeQuery( new Select( query ) ); + Integer perfil = ( Integer )array.get( 0, 0 ); + if( perfil != null ) + { + return consultas[ perfil.intValue() - 1 ]; + } + else + { + return false; + } + } + + protected boolean perfilTemExames( Integer trabalhadorID, Integer empresaID ) + throws Exception + { + Executer executer = getExecuter(); + String query = "SELECT a_exames, b_exames FROM empresas WHERE id = " + empresaID; + Virtual2DArray array = executer.executeQuery( new Select( query ) ); + boolean consultas[] = new boolean[]{ "y".equals( array.get( 0, 0 ) ), "n".equals( array.get( 0, 0 ) ) }; + query = "SELECT perfil FROM trabalhadores WHERE id = " + trabalhadorID; + array = executer.executeQuery( new Select( query ) ); + Integer perfil = ( Integer )array.get( 0, 0 ); + if( perfil != null ) + { + return consultas[ perfil.intValue() - 1 ]; + } + else + { + return false; + } + } + +// protected boolean verificarTrabalhador( Object consultas[][], Object exames[][] ) +// { +// boolean estadoConsultas = false; +// boolean estadoExames = ( exames.length == 0 ) || ( ( java.util.Date )exames[ 0 ][ 0 ] ).before(today) || +// ( ( ( ( java.util.Date )exames[ 0 ][ 0 ] ).getTime() - todayMillis ) / 86400000 > 14 ); +// if( consultas.length > 0 ) +// { +// int anterior; +// int proxima; +// if( ( (java.util.Date) consultas[ 0 ][ 0 ] ).after( today ) ) +// { +// proxima = 0; +// if( consultas.length >= 2 ) +// { +// anterior = 1; +// } +// else +// { +// anterior = -1; +// } +// } +// else +// { +// proxima = -1; +// anterior = 0; +// } +// estadoConsultas = anterior >= 0 && "y".equals( consultas[ anterior ][ 1 ] ) && +// ( proxima == -1 || ( ( ( java.util.Date )consultas[ proxima ][ 0 ] ).getTime() - todayMillis ) / 86400000 > 14 ); +// } +// return !(estadoConsultas && estadoExames); +// } + +// protected HashMap criarDadosTrabalhador( Integer id, String nome, +// Object consultas[][], Object exames[][] ) +// throws Exception +// { +//// dbQuery.append( "SELECT id, nome, ( ultima_consulta IS NOT NULL AND realizada = 'y' )," +//// + " ( ultimo_exame IS NOT NULL AND realizado = 'y' )," +//// + " proxima_consulta IS NOT NULL, proximo_exame IS NOT NULL, " +//// + " ( proxima_consulta IS NOT NULL AND proxima_consulta - current_date <= 14 ), " +//// + " ( proximo_exame IS NOT NULL AND proximo_exame - current_date <= 14 )" +//// + " FROM trabalhadores " +//// + " WHERE estabelecimento_id = '"+estabelecimentoId+"'" +//// + " AND ( ultima_consulta IS NULL OR realizada = 'n' OR" +//// + " ( proxima_consulta IS NOT NULL AND proxima_consulta - current_date <= 14 )" +//// + " OR ( proximo_exame IS NOT NULL AND proximo_exame - current_date <= 14 ) )" +//// + " ORDER BY nome" ); +// HashMap trabalhador = new HashMap(); +// trabalhador.put( "Nome", nome ); +// boolean uc = false; +// boolean ue = false; +// boolean pc = false; +// boolean pe = false; +// boolean quase_c = false; +// boolean quase_e = false; +// java.util.Date consultaAnterior = null; +// java.util.Date exameAnterior = null; +// if( consultas.length > 0 ) +// { +// int anterior; +// int proxima; +// if( ( (java.util.Date) consultas[ 0 ][ 0 ] ).after( today ) ) +// { +// proxima = 0; +// if( consultas.length >= 2 ) +// { +// anterior = 1; +// } +// else +// { +// anterior = -1; +// } +// } +// else +// { +// proxima = -1; +// anterior = 0; +// } +// long diff = proxima > -1 ? ( ( ( java.util.Date )consultas[ proxima ][ 0 ] ).getTime() - todayMillis ) / 86400000 : 15; +// uc = anterior > -1 && "y".equals( consultas[ anterior ][ 1 ] ); +// if( uc ) +// { +// consultaAnterior = ( java.util.Date ) consultas[ anterior ][ 0 ]; +// } +// pc = proxima > -1; +// quase_c = pc && diff <= 14; +// } +// +// if( exames.length > 0 ) +// { +// int anterior; +// int proximo; +// if( ( (java.util.Date) exames[ 0 ][ 0 ] ).after( today ) ) +// { +// proximo = 0; +// if( exames.length >= 2 ) +// { +// anterior = 1; +// } +// else +// { +// anterior = -1; +// } +// } +// else +// { +// proximo = -1; +// anterior = 0; +// } +// long diff = proximo > -1 ? ( ( ( java.util.Date )exames[ proximo ][ 0 ] ).getTime() - todayMillis ) / 86400000 : 15; +// ue = anterior > -1 && "y".equals( exames[ anterior ][ 1 ] ); +// if( ue ) +// { +// exameAnterior = ( java.util.Date ) exames[ anterior ][ 0 ]; +// } +// pe = proximo > -1; +// quase_e = pe && diff <= 14; +// } +// +// if( quase_c ) +// { +// trabalhador.put( "Consulta", "yellow" ); +// trabalhador.put( "Consulta_estado", "pendente" ); +// } +// else if( uc ) +// { +// trabalhador.put( "Consulta", "green" ); +// trabalhador.put( "Consulta_estado", consultaAnterior ); +// } +// else if( pc ) +// { +// trabalhador.put( "Consulta", "yellow" ); +// trabalhador.put( "Consulta_estado", "pendente" ); +// } +// else +// { +// trabalhador.put( "Consulta", "red" ); +// trabalhador.put( "Consulta_estado", "pendente" ); +// } +// +// if( quase_e ) +// { +// trabalhador.put( "Exame", "yellow" ); +// trabalhador.put( "Exame_estado", "pendente" ); +// } +// else if( ue ) +// { +// trabalhador.put( "Exame", "green" ); +// trabalhador.put( "Exame_estado", exameAnterior ); +// } +// else if( pe ) +// { +// trabalhador.put( "Exame", "yellow" ); +// trabalhador.put( "Exame_estado", "pendente" ); +// } +// else +// { +// trabalhador.put( "Exame", "red" ); +// trabalhador.put( "Exame_estado", "pendente" ); +// } +// return trabalhador; +// } +} diff --git a/branches/SIPRP/web/src/siprp/pagina/doGetListaTrabalhadoresTudo.java b/branches/SIPRP/web/src/siprp/pagina/doGetListaTrabalhadoresTudo.java new file mode 100644 index 00000000..ddcd9b46 --- /dev/null +++ b/branches/SIPRP/web/src/siprp/pagina/doGetListaTrabalhadoresTudo.java @@ -0,0 +1,255 @@ +/* + * doGetListaTrabalhadoresTudo.java + * + * Created on 21 de Abril de 2005, 17:35 + */ + +package siprp.pagina; + +import java.io.*; +import java.util.*; +import java.sql.*; +import java.lang.reflect.Array; +import javax.servlet.*; +import javax.servlet.http.*; + +import org.apache.velocity.*; +import org.apache.velocity.app.*; + + +import com.evolute.utils.arrays.*; +import com.evolute.utils.db.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.strings.*; +/** + * + * @author fpalma + */ +public class doGetListaTrabalhadoresTudo + extends siprpServlet + implements GlobalConstants +{ + protected java.util.Date today; + protected long todayMillis; + + /** Creates a new instance of doGetListaTrabalhadores */ + public doGetListaTrabalhadoresTudo(HttpServletRequest req, HttpServletResponse res, boolean print) throws IOException + { + ServletOutputStream out = res.getOutputStream(); + Connection con = null ; + Statement stmt = null ; + ResultSet2DArray rs; + StringBuffer dbQuery, sBuffer; + String userRole, empresaId, estabelecimentoId, temp; + HttpSession session = req.getSession(false); + Vector links = new Vector(); + Vector desc = new Vector(); + Vector descAdicional = new Vector(); + today = new java.util.Date(); + todayMillis = today.getTime(); + + try + { + userRole = (String)session.getAttribute(super.sessionUserRole); + empresaId = (String)session.getAttribute(super.sessionEmpresaId); + estabelecimentoId = (String)session.getAttribute(super.sessionEstabelecimentoId); + + if ( userRole.equals ( super.superUserRole ) || userRole.equals ( empresaId ) ) + { + Class.forName(super.bdDriver); + con = DriverManager.getConnection( bdLocalUrl, bdLocalUsername, bdLocalPassword ); + if ( super.verificaEstabelecimento(con, empresaId, estabelecimentoId) ) // estabelecimento pertence 'a empresa ?? + { + //Class.forName(super.bdDriver); + //con = DriverManager.getConnection( super.bdUrl, super.bdUsername, super.bdPassword ); + dbQuery = new StringBuffer(); +// dbQuery.append( "SELECT id, nome, data_ficha FROM trabalhadores " +// + "WHERE estabelecimento_id = '"+estabelecimentoId+"'" +// + " AND ultima_consulta IS NOT NULL AND realizada = 'y' AND" +// + " ( proxima_consulta IS NULL OR proxima_consulta - current_date > 14 )" +// + " AND ( proximo_exame IS NULL OR proximo_exame - current_date > 14 )" +// + " ORDER BY nome" ); + dbQuery.append( "SELECT trabalhadores.id, trabalhadores.nome, " + + "marcacoes_trabalhador.tipo, marcacoes_trabalhador.data, marcacoes_trabalhador.estado, " + + " trabalhadores.nome_plain " + + "FROM trabalhadores, marcacoes_trabalhador " + + "WHERE estabelecimento_id = " + estabelecimentoId + + " AND marcacoes_trabalhador.trabalhador_id = trabalhadores.id " + + " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL " + + "ORDER BY 6, 3, 4 DESC " ); + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + + int index=0; + int max = rs.columnLength(); + + Integer trabalhadorID = new Integer( -1 ); + String nomeTrabalhador = ""; + Vector consultas = new Vector(); + Vector exames = new Vector(); + + for ( index = 0; index <= max; index++ ) + { + Integer id = index < max ? ( Integer ) rs.get( index, 0 ) : new Integer( -1 ); + if( !id.equals( trabalhadorID ) ) + { + Object listaConsultas[][] = ( Object[][] ) consultas.toArray( new Object[consultas.size()][2] ); + Object listaExames[][] = ( Object[][] ) exames.toArray( new Object[exames.size()][2] ); + if( trabalhadorID.intValue() > -1 && + verificarTrabalhador( listaConsultas, listaExames ) ) + { + temp=""+rs.get(index - 1,0); // converter de int para String + java.util.Date dataUltimaConsulta = null; + for( int c = 0; c < listaConsultas.length; c++ ) + { + if( new Integer( 2 ).equals( listaConsultas[ c ][ 1 ] ) ) + { + dataUltimaConsulta = ( java.util.Date ) listaConsultas[ c ][ 0 ]; + break; + } + } + HashMap dadosTrabalhador = criarDadosTrabalhador( trabalhadorID, nomeTrabalhador, dataUltimaConsulta ); + if( dadosTrabalhador != null ) + { + dbQuery = new StringBuffer(); + dbQuery.append("/"+super.servletName+"/?"+empresaId+"/"+estabelecimentoId+"/"+temp); // construir url + links.add(dbQuery.toString()); + desc.add( dadosTrabalhador ); + } + } + exames.clear(); + consultas.clear(); + } + if( index == max ) + { + break; + } + Integer tipo = ( Integer ) rs.get( index, 2 ); + String nome = ( String ) rs.get( index, 1 ); + java.util.Date data = ( java.util.Date ) rs.get( index, 3 ); + Integer estado = ( Integer ) rs.get( index, 4 ); + trabalhadorID = id; + nomeTrabalhador = nome; + Object marcacao[] = new Object[]{ data, estado }; + switch( tipo.intValue() ) + { + case TIPO_MARCACAO_EXAMES: + exames.add( marcacao ); + break; + + case TIPO_MARCACAO_CONSULTA: + consultas.add( marcacao ); + break; + } + } + stmt.close(); + + sBuffer = new StringBuffer(); + sBuffer.append(""+super.nomeEmpresa(con,empresaId)+"

" + +super.nomeEstabelecimento(con, estabelecimentoId)+"" ); + + HashMap hmValues = new HashMap(); + hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) ); + hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) ); + hmValues.put( "estabelecimento_nome", super.nomeEstabelecimento( con, estabelecimentoId ) ); + hmValues.put( "estabelecimento_id", estabelecimentoId ); + hmValues.put( "userRole", userRole ); + hmValues.put( "userName", session.getAttribute( sessionUser ) ); + hmValues.put( msgTemplate , sBuffer.toString() ) ; + hmValues.put( templateUserRole, userRole); + hmValues.put( templateQuery, "trabalhadores_tudo" ); + hmValues.put( templateVector1,links); + hmValues.put( templateVector2,desc); + hmValues.put( templateVector3,null); + if( !print ) + { + out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate)); + } + else + { + out.println( mergeTemplate( hmValues, super.authenticatedUserPrintTemplate)); + } +// out.println( mergeTemplate( sBuffer.toString(), userRole, super.queryStringTrabalhadores, links, desc, null, super.authenticatedUserTemplate) ); + } + else // est nao pertence 'a empresa + { + out.println( mergeTemplate( super.msgLinkFormatError , userRole, super.errorTemplate) ); + } + con.close(); + } + else // Role nao permite ver esta informacao + { + out.println( mergeTemplate( super.msgAcessoNegado , userRole, super.errorTemplate) ); + } + } + catch ( SQLException e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgErroBd , super.errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgGenericError , super.errorTemplate) ); + } + } + + protected boolean verificarTrabalhador( Object consultas[][], Object exames[][] ) + { + boolean estadoConsultas = false; + boolean estadoExames = ( exames.length == 0 ) || ( ( java.util.Date )exames[ 0 ][ 0 ] ).before(today) || + ( ( ( ( java.util.Date )exames[ 0 ][ 0 ] ).getTime() - todayMillis ) / 86400000 > 14 ); + if( consultas.length > 0 ) + { + int anterior; + int proxima; + if( ( (java.util.Date) consultas[ 0 ][ 0 ] ).after( today ) ) + { + proxima = 0; + if( consultas.length >= 2 ) + { + anterior = 1; + } + else + { + anterior = -1; + } + } + else + { + proxima = -1; + anterior = 0; + } + estadoConsultas = anterior >= 0 && new Integer( 2 ).equals( consultas[ anterior ][ 1 ] ) && + ( proxima == -1 || ( ( ( java.util.Date )consultas[ proxima ][ 0 ] ).getTime() - todayMillis ) / 86400000 > 14 ); + } + return estadoConsultas && estadoExames; + } + + protected HashMap criarDadosTrabalhador( Integer id, String nome, java.util.Date ultimaConsulta ) + throws Exception + { + Executer executer = getExecuter(); + HashMap trabalhador = new HashMap(); + trabalhador.put( "Nome", nome ); + Select select = + new Select( new String[]{ "exames" }, new String[]{ "data" }, + new Field( "trabalhador_id" ).isEqual( id ).and( + new Field( "data" ).isGreaterOrEqual( ultimaConsulta ) ), + new String[]{ "data" }, null ); + +// Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); +// ResultSet2DArray rs = new ResultSet2DArray( stmt.executeQuery( select.toString() ) ); + Virtual2DArray rs = executer.executeQuery( select ); + Object data_ficha = rs.columnLength() > 0 ? rs.get( 0, 0 ) : null; +// stmt.close(); + if( data_ficha == null ) + { + return null; +// data_ficha = ""; + } + trabalhador.put( "Data", data_ficha ); + return trabalhador; + } +} + diff --git a/branches/SIPRP/web/src/siprp/pagina/doGetTrabalhador.java b/branches/SIPRP/web/src/siprp/pagina/doGetTrabalhador.java new file mode 100644 index 00000000..267421e7 --- /dev/null +++ b/branches/SIPRP/web/src/siprp/pagina/doGetTrabalhador.java @@ -0,0 +1,324 @@ +package siprp.pagina; + +import com.evolute.utils.arrays.*; +import com.evolute.utils.strings.*; +import java.io.*; +import java.util.*; +import java.sql.*; +import java.lang.reflect.Array; +import javax.servlet.*; +import javax.servlet.http.*; +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +public class doGetTrabalhador extends siprpServlet +{ + + /** Creates a new instance of doGetTrabalhador */ + public doGetTrabalhador(HttpServletRequest req, HttpServletResponse res) throws IOException + { + ServletOutputStream out = res.getOutputStream(); + Connection con = null ; + Statement stmt = null ; + ResultSet2DArray rs; + StringBuffer dbQuery, sBuffer; + String userRole, empresaId, estabelecimentoId, trabalhadorId, temp; + HttpSession session = req.getSession(false); + Vector names = new Vector(); + Vector values = new Vector(); + java.util.Date today = new java.util.Date(); + + try + { + userRole = (String)session.getAttribute(super.sessionUserRole); + empresaId = (String)session.getAttribute(super.sessionEmpresaId); + estabelecimentoId = (String)session.getAttribute(super.sessionEstabelecimentoId); + trabalhadorId = (String)session.getAttribute(super.sessionTrabalhadorId); + + Class.forName(super.bdDriver); + con = DriverManager.getConnection( bdLocalUrl, bdLocalUsername, bdLocalPassword ); + + if ( ( userRole.equals ( super.superUserRole ) || userRole.equals ( empresaId ) ) + && super.verificaEstabelecimento(con, empresaId, estabelecimentoId) + && super.verificaTrabalhador(con, estabelecimentoId, trabalhadorId) ) + { + + dbQuery = new StringBuffer(); + dbQuery.append( " SELECT sexo, categoria, data_nascimento, nome, numero_mecanografico " + + "FROM trabalhadores where id='"+trabalhadorId+"'"); + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + + // int index=0; + // int max = super.trabalhadorDescFields.length; + + HashMap hmFuncionario = new HashMap(); + if( rs.columnLength() > 0 ) + { + String tmp; + hmFuncionario.put( "sexo", rs.get( 0, "sexo" ) ); + hmFuncionario.put( "categoria", rs.get( 0, "categoria" ) ); + hmFuncionario.put( "data_nascimento", rs.get( 0, "data_nascimento" ) ); + hmFuncionario.put( "nome", rs.get( 0, "nome" ) ); + hmFuncionario.put( "numero", rs.get( 0, "numero_mecanografico" ) ); + stmt.close(); + + String query = "SELECT id, data, estado, data_relatorio FROM marcacoes_trabalhador " + + "WHERE tipo = 0 and trabalhador_id = " + trabalhadorId + + " ORDER BY data DESC"; + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( query ) ); + if( rs.columnLength() > 0 ) + { + java.util.Date dataExame2 = ( java.util.Date ) rs.get( 0, 1 ); + Integer estado1; + Integer estado2 = ( Integer ) rs.get( 0, 2 ); + java.util.Date dataExame1; + String realizado1 = ""; + String realizado2 = ""; + if( rs.columnLength() > 1 ) + { + dataExame1 = ( java.util.Date ) rs.get( 1, 1 ); + estado1 = ( Integer ) rs.get( 1, 2 ); + } + else + { + dataExame1 = dataExame2; + estado1 = estado2; + } + if( ESTADO_REALIZADO.equals( estado2 ) || ESTADO_PARCIALMENTE_REALIZADO.equals( estado2 ) + || today.after( dataExame2 ) ) + { + hmFuncionario.put( "ultimo_exame", dataExame2 ); + if( estado2.equals( ESTADO_REALIZADO ) || estado2.equals( ESTADO_PARCIALMENTE_REALIZADO ) ) + { + realizado2 = "sim"; + } + else + { + realizado2 = "não"; + } + hmFuncionario.put( "realizado", realizado2 ); + hmFuncionario.put( "proximo_exame", null ); + } + else + { + hmFuncionario.put( "proximo_exame", dataExame2 ); + if( !dataExame2.equals( dataExame1 ) ) + { + hmFuncionario.put( "ultimo_exame", dataExame1 ); + if( estado1.equals( ESTADO_REALIZADO ) || estado1.equals( ESTADO_PARCIALMENTE_REALIZADO ) ) + { + realizado1 = "sim"; + } + else + { + realizado1 = "não"; + } + hmFuncionario.put( "realizado", realizado1 ); + } + else + { + hmFuncionario.put( "ultimo_exame", null ); + hmFuncionario.put( "realizado", null ); + } + } + } + else + { + hmFuncionario.put( "ultimo_exame", null ); + hmFuncionario.put( "realizado", null ); + hmFuncionario.put( "proximo_exame", null ); + } + stmt.close(); + + query = "SELECT MAX(id) FROM exames WHERE trabalhador_id = " + trabalhadorId + " AND inactivo <> 'y'"; + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( query ) ); + Integer fichaId = null; + if( rs.columnLength() > 0 ) + { + fichaId = ( Integer ) rs.get( 0, 0 ); + } + stmt.close(); + + if( fichaId != null ) + { + query = "SELECT data, resultado FROM exames WHERE id = " + fichaId; + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( query ) ); + Integer resultadoFicha = (Integer) rs.get( 0, 1 ); + stmt.close(); + if( resultadoFicha != null ) + { + switch( resultadoFicha.intValue() ) + { + case 1: + hmFuncionario.put( "resultado", "Apto" ); + break; + case 2: + hmFuncionario.put( "resultado", "Apto Condicionalmente" ); + break; + case 3: + hmFuncionario.put( "resultado", "Inapto Temporariamente" ); + break; + case 4: + hmFuncionario.put( "resultado", "Inapto Definitivamente" ); + break; + default: + hmFuncionario.put( "resultado", null ); + } + } + else + { + hmFuncionario.put( "resultado", null ); + } + } + else + { + hmFuncionario.put( "resultado", null ); + } + + query = "SELECT id, data, estado FROM marcacoes_trabalhador " + + "WHERE tipo = 1 and trabalhador_id = " + trabalhadorId + + " ORDER BY data DESC"; + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( query ) ); + if( rs.columnLength() > 0 ) + { + java.util.Date dataConsulta2 = ( java.util.Date ) rs.get( 0, 1 ); + Integer estado1; + Integer estado2 = ( Integer ) rs.get( 0, 2 ); + java.util.Date dataConsulta1; +// java.util.Date dataRelatorio1; +// java.util.Date dataRelatorio2 = (java.util.Date) rs.get( 0, 3 ); + String realizada1 = ""; + String realizada2 = ""; + if( rs.columnLength() >= 2 ) + { + dataConsulta1 = ( java.util.Date ) rs.get( 1, 1 ); + estado1 = ( Integer ) rs.get( 1, 2 ); +// dataRelatorio1 = (java.util.Date) rs.get( 1, 3 ); + } + else + { + dataConsulta1 = dataConsulta2; + estado1 = estado2; +// dataRelatorio1 = dataRelatorio2; + } + if( ESTADO_REALIZADO.equals( estado2 ) || today.after( dataConsulta2 ) ) + { + hmFuncionario.put( "ultima_consulta", dataConsulta2 ); + if( estado2.equals( ESTADO_REALIZADO ) ) + { + realizada2 = "sim"; + } + else + { + realizada2 = "não"; + } + hmFuncionario.put( "realizada", realizada2 ); + hmFuncionario.put( "proxima_consulta", null ); + } + else + { + try + { + for( int c = 1; c < rs.columnLength(); c++ ) + { + java.util.Date dataTemp = ( java.util.Date ) rs.get( c, 1 ); + dataConsulta1 = dataTemp; + estado1 = ( Integer ) rs.get( c, 2 ); + if( dataTemp.after( today ) ) + { + dataConsulta2 = dataTemp; + } + else + { + break; + } + } + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + hmFuncionario.put( "proxima_consulta", dataConsulta2 ); + if( !dataConsulta2.equals( dataConsulta1 ) ) + { + if( estado1.equals( ESTADO_REALIZADO ) ) + { + realizada1 = "sim"; + } + else + { + realizada1 = "não"; + } + hmFuncionario.put( "realizada", realizada1 ); + hmFuncionario.put( "ultima_consulta", dataConsulta1 ); + } + else + { + hmFuncionario.put( "ultima_consulta", null ); + hmFuncionario.put( "realizada", null ); + } + } + } + else + { + hmFuncionario.put( "ultima_consulta", null ); + hmFuncionario.put( "realizada", null ); + hmFuncionario.put( "proxima_consulta", null ); + } + stmt.close(); + } + + sBuffer = new StringBuffer(); + sBuffer.append(""+super.nomeEmpresa(con,empresaId)+"

" + +super.nomeEstabelecimento(con, estabelecimentoId)+"" ); + + HashMap hmValues = new HashMap(); + hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) ); + hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) ); + hmValues.put( "estabelecimento_nome", super.nomeEstabelecimento( con, estabelecimentoId ) ); + + /*Dados para marcacao de consulta/exame*/ + session.setAttribute( "session_estabelecimento_nome", hmValues.get( "estabelecimento_nome" ) ); + session.setAttribute( "session_funcionario_nome", hmFuncionario.get( "nome" ) ); + session.setAttribute( "session_funcionario_numero", hmFuncionario.get( "numero" ) ); + + hmValues.put( "estabelecimento_id", estabelecimentoId ); + hmValues.put( "userRole", userRole ); + hmValues.put( "userName", session.getAttribute( sessionUser ) ); + hmValues.put( msgTemplate , sBuffer.toString() ) ; + hmValues.put( templateUserRole, userRole); + hmValues.put( templateQuery, super.queryStringTrabalhador ); + hmValues.put( "funcionario", hmFuncionario ); + //hmValues.put( templateVector1,names); + //hmValues.put( templateVector2,values); + //hmValues.put( templateVector3,null); + out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate)); + + // out.println( mergeTemplate( sBuffer.toString(), userRole, super.queryStringTrabalhador, names, values, null, super.authenticatedUserTemplate) ); + + } + else + { + out.println( mergeTemplate( super.msgLinkFormatError , userRole, super.errorTemplate) ); + } + con.close(); + } + catch ( SQLException e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgErroBd , super.errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgGenericError , super.errorTemplate) ); + } + + } + +} diff --git a/branches/SIPRP/web/src/siprp/pagina/doPostLogin.java b/branches/SIPRP/web/src/siprp/pagina/doPostLogin.java new file mode 100644 index 00000000..e9c41eec --- /dev/null +++ b/branches/SIPRP/web/src/siprp/pagina/doPostLogin.java @@ -0,0 +1,122 @@ +package siprp.pagina; + +import com.evolute.utils.arrays.*; +import com.evolute.utils.strings.*; +import java.io.*; +import java.util.*; +import java.sql.*; +import java.lang.reflect.Array; +import javax.servlet.*; +import javax.servlet.http.*; +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +public class doPostLogin extends siprpServlet +{ + + /** Creates a new instance of doPostLogin */ + public doPostLogin(HttpServletRequest req, HttpServletResponse res) throws IOException + { +System.out.println( "doPostLogin()" ); + ServletOutputStream out = res.getOutputStream(); + StringBuffer dbQuery; + ResultSet2DArray rs; + Connection con = null ; + Statement stmt = null ; + String user, userRole, password; + + try + { + user = req.getParameter("user"); + password = req.getParameter("password"); + + if (user.equals("")) + { + out.println( mergeTemplate( msgErroNoUser, errorTemplate) ); + } + else + { + Class.forName(bdDriver); + con = DriverManager.getConnection( bdUrl, bdUsername, bdPassword ); + dbQuery = new StringBuffer(); + dbQuery.append( "SELECT password FROM users WHERE username = '"+user+"'"); + + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + + + if ( rs.columnLength() > 0 && password.equals((String)rs.get(0,0))) + { + // Obter Role + + dbQuery = new StringBuffer(); + dbQuery.append( "SELECT role FROM roles WHERE username = '"+user+"'"); + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + userRole = (String)rs.get(0,0); + + // UPDATE HTTP SESSION + HttpSession session = req.getSession(true); + session.setMaxInactiveInterval(sessionTimeout); + + session.setAttribute(sessionUser, user); + session.setAttribute(sessionUserRole, userRole); + session.setAttribute(sessionPassword, password); + + HashMap hmValues = new HashMap(); + session.setAttribute( sessionEmpresaId, userRole ); + if( userRole.equals( "manager" ) ) + { + // session.setAttribute( sessionCompanyName, nomeEmpresa( con, "" + session.getAttribute( sessionEmpresaId ) ) ); + session.setAttribute( sessionCompanyName, null ); + session.setAttribute( sessionEstabelecimentoId, null ); + //hmValues.put( templateQuery, super.queryStringEmpresas ); + new doGetListaEmpresas( req, res ); + } + else + { + session.setAttribute( sessionCompanyName, + nomeEmpresa( DriverManager.getConnection( bdLocalUrl, bdLocalUsername, bdLocalPassword ), + userRole ) ); + session.setAttribute( sessionEstabelecimentoId, "-1" ); + //hmValues.put( templateQuery, super.queryStringEstabelecimentos ); + new doGetListaEstabelecimentos( req, res ); + } + stmt.close(); + con.close(); + + hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) ); + hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) ); + hmValues.put( "estabelecimento_id", session.getAttribute( sessionEstabelecimentoId ) ); + hmValues.put( "userRole", userRole ); + hmValues.put( "userName", user ); + //out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate)); + + //out.println( mergeTemplate( user, userRole, super.authenticatedUserTemplate)); + } + else + { + out.println( mergeTemplate( msgErroAuthFail, super.errorTemplate) ); + } + } + + } + catch ( SQLException e ) + { + e.printStackTrace(); + out.println( mergeTemplate( msgErroBd , super.errorTemplate) ); + } + catch ( IllegalStateException e ) // session timeout + { + e.printStackTrace(); + out.println( mergeTemplate(msgSessionTimeout, super.errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + out.println( mergeTemplate( msgGenericError , super.errorTemplate) ); + } + } + +} diff --git a/branches/SIPRP/web/src/siprp/pagina/siprpServlet.java b/branches/SIPRP/web/src/siprp/pagina/siprpServlet.java new file mode 100644 index 00000000..088c3f3b --- /dev/null +++ b/branches/SIPRP/web/src/siprp/pagina/siprpServlet.java @@ -0,0 +1,667 @@ +package siprp.pagina; + +import java.io.IOException; +import java.io.StringWriter; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Properties; +import java.util.StringTokenizer; +import java.util.Vector; + +import javax.servlet.ServletContext; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.Velocity; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.ResultSet2DArray; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.db.JDBCManager; +import com.evolute.utils.sql.Select; +import com.evolute.utils.strings.UnicodeChecker; + +public class siprpServlet extends HttpServlet + implements GlobalConstants +{ + // MSG + public static final String msgErroNoUser = "Tem+de+especificar+um+utilizador."; + public static final String msgErroAuthFail = "Utilizador+inexistente+e/ou+Password+errada."; + public static final String msgErroBd = "Erro+na+ligaç&atiolde;o+à+base+de+dados."; + public static final String msgGenericError = "Erro"; + public static final String msgListaEmpresas = "Empresas"; + public static final String msgAcessoNegado = "Acesso+Negado."; + public static final String msgLinkFormatError ="URL+inválido."; + public static final String msgLogin = "Login"; + public static final String msgNovaPasswordErrada="Erro+ao+criar+a+nova+password,+nova+password+inválida."; + public static final String msgButtonNotSuported = "funcionalidade+ainda+não+suportada."; + public static final String msgSessionTimeout = "Por+razões+de+segurança+o+tempo+da+sua+sessão+expirou
" + + "Por+favor+efectue+novamente+o+seu+login.
"; + + // Templates - Nomes e valores + //public static final String loginTemplate = "login.html"; + + public static final String indexTemplate = "index.html"; + public static final String authenticatedUserTemplate = "user.html"; + public static final String authenticatedUserPrintTemplate = "user_print.html"; + public static final String errorTemplate = "frame_erro.html"; + public static final String innerErrorTemplate = "erro.html"; + + public static final String mainTemplate = "main.html"; + //public static final String criticalErrorTemplate = "critical.html"; + public static final String templateVector1 ="v1"; + public static final String templateVector2 ="v2"; + public static final String templateVector3 ="v3"; + public static final String templateUserRole ="userRole"; + public static final String msgTemplate ="msg"; + public static final String templateQuery ="query"; + public static final String buttonPressedTemplate ="buttonPressed"; + + // Query Strings , usadas para na template do velocity saber o que mostar + public static final String queryStringErro = "erro"; + public static final String queryStringEmpresas = "empresas"; + public static final String queryStringEstabelecimentos="estabelecimentos"; + public static final String queryStringTrabalhadores ="trabalhadores"; + public static final String queryStringTrabalhador ="trabalhador"; + + //Botoes, saber qual o botao escholido, campo value dos forms + public static final String botaoLogin = "Entrar"; + public static final String botaoMarcarProximoExame = "Marcar Exame"; + + // Var da Session + public static final String sessionUser="user"; + public static final String sessionUserRole="userRole"; + public static final String sessionPassword="password"; + public static final String sessionEmpresaId="empresaId"; + public static final String sessionEstabelecimentoId="estabelecimentoId"; + public static final String sessionTrabalhadorId="trabalhadorId"; + public static final String sessionCompanyName = "sessionCompanyName"; + public static final String sessionCompanyEmail = "sessionCompanyEmail"; + public static final int sessionTimeout = 3600; // segundos + + public static final String servletName="siprpWeb"; + public static final String superUserRole="manager"; + +// // BD +// public static final String bdHost = "127.0.0.1"; +// public static final String bdPort = "5436"; +// public static final String bdUsername = "siprp"; +// public static final String bdPassword = ""; +// public static final String bdDriver = "org.postgresql.Driver"; +// public static final String bdUrl = "jdbc:postgresql://" + bdHost + ":" + bdPort + "/siprp"; + + public static final String bdEmpresaIdRef = "id"; // campo que contem id da empresa + public static final String bdEmpresaNomeRef = "designacao_social"; // campo que contem nome da empresa + public static final String bdEstIdRef = "id"; // campo que contem nome do estabelecimento + public static final String bdEstNomeRef = "nome"; // campo que contem nome do estabelecimento + public static final String bdTrabIdRef = "id"; // campo que contem id do trabalhador + public static final String bdTrabNomeRef = "nome"; // campo que contem nome do trabalhador + public static final String bdNullString = ""; // String a mostrar quando o campo lido da BD e' null + public static final String bdEmailEmpresa = "email"; // campo que contem email da empresa + + protected static ServletContext CONTEXT; + + // Arrays + public static final String[][] trabalhadorDescFields = new String [][] + { // nome que o user ve, nome do campo na tabela + {"Nome", "nome"}, + {"N\u00ba", "numero_mecanografico",}, + {"\u00DAltimo Exame", "ultimo_exame"}, + {"Realizado", "realizado"}, + {"Pr\u00F3ximo Exame", "proximo_exame"}, + {"\u00DAltima Consulta", "ultima_consulta"}, + {"Realizada", "realizada"}, + {"Pr\u00F3xima Consulta", "proxima_consulta"} + }; + + public void init() + { + + try { + CONTEXT = this.getServletContext(); + String TEMPLATE_DIR = this.getServletContext().getRealPath( "/" ) + "html/"; +System.out.println( "DIR: " + TEMPLATE_DIR ); + Properties props = new Properties(); + props.setProperty( "file.resource.loader.path", TEMPLATE_DIR ); + Velocity.init( props ); + Class.forName(bdDriver); + } + catch( Exception e ) + { + e.printStackTrace(); + } + } + + public void doGet( HttpServletRequest req, HttpServletResponse res ) + throws IOException + { + String queryString = req.getQueryString(); + String backUri = req.getRequestURI(); + ServletOutputStream out = res.getOutputStream(); + res.setContentType( "text/html" ); + try + { +System.out.println( "query: " + queryString ); + HttpSession session = req.getSession(true); + session.setMaxInactiveInterval(sessionTimeout); + + if ( queryString == null ) // Reload, 1a vez, etc ... + { + session.invalidate(); + out.println( mergeTemplate ( msgLogin, indexTemplate ) ) ; + } + else if ( session.isNew() && !( queryString.indexOf(queryStringErro) == 0 ) ) // session timeout + { + session.invalidate(); + out.println( mergeTemplate( msgGenericError , errorTemplate ) ); +// doErro(queryString, out); + } + else if ( queryString.equals(queryStringEmpresas) ) // Listar Empresas + { + new doGetListaEmpresas(req,res); + } + else if ( queryString.indexOf(queryStringErro) == 0 ) // Listar Empresas + { +// System.out.println( "entrou" ); + doErro(queryString, out); + } + else // interpretar query string + { + String empresa = null, estabelecimento=null, trabalhador=null; + String query = null; + int checkInt; + + StringTokenizer sToken = new StringTokenizer(queryString,"/") ; + empresa = sToken.nextToken(); // empresa ID + checkInt = Integer.parseInt(empresa); // check int, NumberFormatException + + if (sToken.hasMoreElements()) + { + estabelecimento = sToken.nextToken(); // estabelecimento ID + checkInt = Integer.parseInt(estabelecimento); // check int, NumberFormatException + if (sToken.hasMoreElements()) + { + trabalhador = sToken.nextToken(); // trabalhador ID + try + { + checkInt = Integer.parseInt(trabalhador); // check int, NumberFormatException + } + catch( NumberFormatException nfex ) + { + query = trabalhador; + if( query.indexOf( "trabalhadores_tudo" ) != 0 && query.indexOf( "trabalhadores_pendentes" ) != 0 && + query.indexOf( "_print" ) == -1 ) + { + throw nfex; + } + } + } + } + + if ( estabelecimento == null ) // empresa query + { + session.setAttribute(sessionEmpresaId, empresa); // update HTTP Session + + new doGetListaEstabelecimentos(req,res); + + //out.println( mergeTemplate ( empresa, loginTemplate ) ) ; + } + else if ( trabalhador == null || query != null ) // estabelecimento query + { + session.setAttribute(sessionEmpresaId, empresa); // update HTTP Session + session.setAttribute(sessionEstabelecimentoId, estabelecimento); + + new doGetListaTrabalhadores(req,res, query); + + //out.println( mergeTemplate ( " chama oGetListaTrabalhadores", loginTemplate ) ) ; + } + else // trabalhador query + { + session.setAttribute(sessionEmpresaId, empresa); // update HTTP Session + session.setAttribute(sessionEstabelecimentoId, estabelecimento); + session.setAttribute(sessionTrabalhadorId, trabalhador); + + new doGetTrabalhador(req,res); + + //out.println( mergeTemplate ( trabalhador, loginTemplate ) ) ; + } + } + } + catch ( NumberFormatException e ) // argumentos invalidos + { + e.printStackTrace(); + out.println( mergeTemplate( msgLinkFormatError, backUri, errorTemplate) ); + } + catch ( IllegalStateException e ) // session timeout + { + e.printStackTrace(); + out.println( mergeTemplate(msgSessionTimeout, errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); +// out.println( mergeTemplate( msgGenericError , backUri, errorTemplate ) ); + out.println( mergeTemplate( msgGenericError , errorTemplate ) ); + } +// System.out.println( "fim - " + queryString + " bu " + backUri ); + } + + public void doPost(HttpServletRequest req, HttpServletResponse res) + throws IOException + { + ServletOutputStream out = res.getOutputStream(); + //StringBuffer dbQuery; + //ResultSet2DArray rs; + //Connection con = null ; + //Statement stmt = null ; + //String user, userRole, password; + String buttonPressed = req.getParameter("form"); + res.setContentType( "text/html" ); + try + { + if ( buttonPressed.equals(botaoLogin)) + { + new doPostLogin(req,res); + } + else + { + out.println( mergeTemplate( msgButtonNotSuported, errorTemplate) ); + } + } + /*catch ( SQLException e ) + { + e.printStackTrace(); + out.println( mergeTemplate( msgErroBd , criticalErrorTemplate) ); + }*/ + catch ( IllegalStateException e ) // session timeout + { + e.printStackTrace(); + out.println( mergeTemplate(msgSessionTimeout, errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + out.println( mergeTemplate( msgGenericError , errorTemplate) ); + } + } + + + public String mergeTemplate( HashMap values, String template ) + { + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + + try + { + for( Iterator i = values.keySet().iterator(); i.hasNext(); ) + { + String key = ( String ) i.next(); + context.put ( key, values.get( key ) ) ; +//fpalma +// Object value = values.get( key ); +// context.put ( key, value != null ? +// UnicodeChecker.parseToUnicode( "&#x", 2, ";", value.toString(), true ) +// : null ); + } + + Velocity.mergeTemplate(template, Velocity.ENCODING_DEFAULT, context, output ); + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + return null; + } + + + + public String mergeTemplate (String msg, String template ) // #1 + { + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + + try + { + context.put ( msgTemplate , msg ) ; + Velocity.mergeTemplate(template, Velocity.ENCODING_DEFAULT, context, output ); + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + return null; + } + + public String mergeTemplate (String msg, String userRole, String template ) // #1 + { + + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + + try + { + context.put ( msgTemplate , msg ) ; + context.put ( templateUserRole, userRole); + Velocity.mergeTemplate(template, Velocity.ENCODING_DEFAULT, context, output ); + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + return null; + } + + public String mergeTemplate ( String msg, String userRole, String querySelected, Vector vector1, Vector vector2, Vector vector3, String template ) // #2 + { + + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + + try + { + context.put ( msgTemplate , msg ) ; + context.put ( templateUserRole, userRole); + context.put ( templateQuery, querySelected ); + context.put ( templateVector1,vector1); + context.put ( templateVector2,vector2); + context.put ( templateVector3,vector3); + Velocity.mergeTemplate(template, Velocity.ENCODING_DEFAULT, context, output ); + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + return null; + } + + public void destroy() + { + } + + public void handleSessionTimeout(HttpServletResponse res, String template) + throws IOException + { + ServletOutputStream out = res.getOutputStream(); + try + { + out.println( mergeTemplate( msgSessionTimeout, template) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + + } + } + + public boolean verificaEstabelecimento(Connection con, java.lang.String empresaId, java.lang.String estabelecimentoId) + // verifica se o establecimento pertence 'a empresa + { + //Connection con = null ; + Statement stmt = null ; + Virtual2DArray rs; + String query; + try + { + //con = DriverManager.getConnection( bdUrl, bdUsername, bdPassword ); + query = "SELECT empresa_id FROM estabelecimentos where id='"+estabelecimentoId+"'"; + if( con != null ) + { + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( query ) ); + } + else + { + rs = getExecuter().executeQuery( new Select( query ) ); + } + String temp=""+rs.get(0,0); // converter de int para String + if( con != null ) + { + stmt.close(); + } + if ( empresaId.equals(temp) ) // estabelecimento pertence 'a empresa + { + return true; + } + else + { + return false; + } + } + catch ( Exception e ) + { + e.printStackTrace(); + } + return false; + } + + public boolean verificaTrabalhador(Connection con, java.lang.String estabelecimentoId, java.lang.String trabalhadorId) + // verifica se o trabalhador pertence ao estabelecimento + { + //Connection con = null ; + Statement stmt = null ; + ResultSet2DArray rs; + StringBuffer dbQuery; + try + { + //con = DriverManager.getConnection( bdUrl, bdUsername, bdPassword ); + dbQuery = new StringBuffer(); + dbQuery.append( "SELECT estabelecimento_id FROM trabalhadores where id='"+trabalhadorId+"'"); + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + String temp=""+rs.get(0,0); // converter de int para String + stmt.close(); + if ( estabelecimentoId.equals(temp) ) // estabelecimento pertence 'a empresa + { + return true; + } + else + { + return false; + } + } + catch ( Exception e ) + { + e.printStackTrace(); + } + return false; + } + + public void closeSqlCon(Connection con) + { + try + { + if (con != null ) con.close(); + } + catch ( Exception e ) + { + e.printStackTrace(); + } + + } + + public String emailEmpresa(Connection con, String empresaId) + { + Statement stmt = null ; + ResultSet2DArray rs; + StringBuffer dbQuery; + String returnString; + + try + { + dbQuery = new StringBuffer(); + dbQuery.append( "SELECT email FROM empresas, contactos " + + "WHERE empresas.id ='"+empresaId+"' AND empresas.contacto_1 = contactos.id"); + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + if( rs.columnLength() > 0 ) + { + returnString = (String)rs.get(0,0); + stmt.close(); + return returnString; + } + else + { + return null; + } + } + catch ( Exception e ) + { + e.printStackTrace(); + } + return null; + } + + public String nomeEmpresa(Connection con, String empresaId) + { + Statement stmt = null ; + Virtual2DArray rs; + String returnString; + + try + { + String query = "SELECT designacao_social FROM empresas WHERE id ='"+empresaId+"'"; + if( con != null ) + { + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( query ) ); + } + else + { + rs = getExecuter().executeQuery( new Select( query ) ); + } + if( rs.columnLength() > 0 ) + { + returnString = (String)rs.get(0,0); + if( con != null ) + { + stmt.close(); + } + return returnString; + } + else + { + return null; + } + } + catch ( Exception e ) + { + e.printStackTrace(); + } + return null; + } + + public String nomeEstabelecimento(Connection con, java.lang.String estabelecimentoId) + { + Statement stmt = null ; + Virtual2DArray rs; + StringBuffer dbQuery; + String returnString; + + try + { + String query = "SELECT nome FROM estabelecimentos WHERE id ='"+estabelecimentoId+"'"; + if( con != null ) + { + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( query ) ); + } + else + { + rs = getExecuter().executeQuery( new Select( query ) ); + } + if( rs.columnLength() > 0 ) + { + returnString = (String)rs.get(0,0); + if( con != null ) + { + stmt.close(); + } + return returnString; + } + else + { + return null; + } + } + catch ( Exception e ) + { + e.printStackTrace(); + } + return null; + } + + public String nomeTrabalhador(Connection con, java.lang.String trabalhadorId) + { + Statement stmt = null ; + ResultSet2DArray rs; + StringBuffer dbQuery; + String returnString; + + try + { + dbQuery = new StringBuffer(); + dbQuery.append( "SELECT nome FROM trabalhadores where id='"+trabalhadorId+"'"); + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + if( rs.columnLength() > 0 ) + { + returnString = (String)rs.get(0,0); + stmt.close(); + return returnString; + } + else + { + return null; + } + } + catch ( Exception e ) + { + e.printStackTrace(); + } + return null; + } + + public void doErro( String queryString, ServletOutputStream out ) + throws Exception + { + String split[] = queryString.split( "=" ); + String err; + if( split.length > 1 ) + { + err = split[ 1 ]; + } + else + { + err = "Erro"; + } + err = err.replace( '+', ' ' ); + out.println( mergeTemplate( err, innerErrorTemplate) ); + } + + protected Executer getExecuter() + throws Exception + { + ServletContext context = CONTEXT; + DBManager dbm = ( DBManager ) context.getAttribute( Singleton.DEFAULT_DBMANAGER ); + if( dbm == null ) + { + dbm = new JDBCManager( bdLocalUrl, bdLocalUsername, bdLocalPassword , 500, 499, 1, null ); + context.setAttribute( Singleton.DEFAULT_DBMANAGER, dbm ); + } + return dbm.getSharedExecuter(); + } +} +