Providers convertidos para select e select2.

Update das bibliotecas.
Adicionadas as coisas do evolute.jar (scripts ant e lib.tools)

git-svn-id: https://svn.coded.pt/svn/SIPRP@2023 bb69d46d-e84e-40c8-a05a-06db0d633741
lxbfYeaa
Carlos Roque 11 years ago
parent 3d0cbe4a34
commit 41bc11ee9a

@ -1,77 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/activation.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/appbase.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/ashwood-2.0.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/avalon-framework-4.2.0.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/batik-all-1.7.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-beanutils-1.8.3.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-beanutils.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-codec-1.3.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-collections-3.1.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-collections.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-digester-1.8.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-digester.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-el-1.0.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-fileupload-1.0.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-httpclient-3.1.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-io-1.4.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-lang-2.4.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-logging-1.1.1.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-logging.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-validator-1.3.1.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-vfs-1.0.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/dataprovider.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/defaulttheme.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/dom4j-1.6.1.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/errorhandler.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/evologger.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/evolute.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/fop.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/httpclient-4.0.1.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/iText-2.0.8.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/jai_imageio.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/jakarta-oro-2.0.8.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/jdbcappender.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/jdom.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/jsf-api.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/jsf-impl.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/jsfcl.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/jstl.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/log4j-1.2.15.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/mail.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/org.springframework.beans-3.0.0.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/org.springframework.context-3.0.0.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/org.springframework.core-3.0.0.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/poi-3.5-beta6-20090622.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/poi-ooxml-3.5-beta6-20090622.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/postgresql-9.0-801.jdbc4.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/rowset-1.0.1.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/serializer-2.7.0.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/shst.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/spring-ws-core-1.5.9.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/spring-ws-core-tiger-1.5.9.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/spring-ws-support-1.5.9.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/spring-xml-1.5.9.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/sqlx.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/standard.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/tomahawk-1.1.10.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/truelicense.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/webui.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/xalan-2.7.0.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/xercesImpl-2.7.1.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/xml-apis-1.3.04.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/xml-apis-ext-1.3.04.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/xmlgraphics-commons-1.3.1.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/xmlParserAPIs-2.0.2.jar"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v6.0">
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0 - Java 7">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-1.7.0-openjdk-1.7.0.71-2.5.3.0.fc20.x86_64">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Apache Tomcat v6.0"/>
<runtime name="Apache Tomcat v7.0 - Java 7"/>
<installed facet="java" version="1.6"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="jst.web" version="2.5"/>

@ -0,0 +1,68 @@
<project name="evo-app-build-common" basedir="../../">
<import file="evo-app-compile-common.xml" />
<target name="app-build" description="Compiles all application classes" depends="app-prepare,app-pre-build">
<mkdir dir="${app.build.dir}" />
<depend srcdir="${app.src.dir}" destdir="${app.build.dir}" cache="${app.dependencies.chache.dir}">
<include name="**/*.java" />
</depend>
<javac srcdir="${app.src.dir}" destdir="${app.build.dir}" classpathref="app.build.classpath" debug="on" deprecation="on" fork="true" memoryMaximumSize="512M" includeantruntime="false" />
<antcall target="create-app-properties-file"/>
<antcall target="app-post-build"/>
</target>
<target name="create-app-properties-file">
<propertyfile file="${app.build.dir}/${app.name}.properties">
<entry key="timestamp" type="date" value="now"/>
<entry key="user" value="${user.name}"/>
</propertyfile>
</target>
<target name="run-codegen" description="Runs codegen for this project" depends="load-properties">
<available file="${codegen.project.ant}" property="codegen.project.exists"/>
<antcall target="show-codegen-project-error"/>
<antcall target="run-codegen-if-project-exists"/>
</target>
<target name="run-codegen-if-project-exists" if="codegen.project.exists">
<available file="${codegen.properties.file}" property="codegen.properties.exists"/>
<antcall target="show-codegen-properties-error"/>
<antcall target="run-codegen-if-exists"/>
</target>
<target name="show-codegen-project-error" unless="codegen.project.exists">
<echo message="Codegen's build-file not found at ${codegen.project.ant}"/>
</target>
<target name="run-codegen-if-exists" if="codegen.properties.exists">
<ant inheritall="false" antfile="${codegen.project.ant}" target="app-run">
<property name="app.run.args" value="${basedir}" />
</ant>
</target>
<target name="show-codegen-properties-error" unless="codegen.properties.exists">
<echo message="Project's codegen configuration file not found at ${codegen.properties.file}"/>
</target>
<target name="run-batch-deployer" description="Batches multiple deploys" depends="load-properties">
<path id="deployer.classpath">
<fileset dir="${lib.tools.dir}" />
<path refid="app.build.classpath" />
</path>
<java jvmversion="${app.java.version}" classname="${deployer.main}" classpathref="deployer.classpath" fork="true" dir="${app.build.dir}">
<arg value="${basedir}"/>
</java>
</target>
<target name="run-LEAF" description="Runs LEAF for this project" depends="load-properties">
<path id="leaf.classpath">
<fileset dir="${lib.tools.dir}" />
<path refid="app.build.classpath" />
</path>
<java jvmversion="${app.java.version}" classname="${leaf.main}" classpathref="leaf.classpath" fork="true" dir="${app.build.dir}">
<arg value="${app.src.dir}"/>
</java>
</target>
</project>

@ -0,0 +1,62 @@
<project name="evo-app-build-obfuscate-common" basedir="../../">
<path id="lib.tools.classpath"/>
<target name="obfuscate">
<taskdef resource="proguard/ant/task.properties" classpath="${app.dir}/lib.tools/proguard.jar" />
<delete file="${app.deploy.dist.dir}/${evolute.jar.name}" failonerror="false" />
<proguard printmapping="${app.dir}/${app.name}.map">
<injar file="${app.lib.dir}/evologger.jar" />
<outjar file="${app.deploy.dist.lib.dir}/evologger.jar" />
<injar file="${app.lib.dir}/evolute.jar" />
<outjar file="${app.deploy.dist.lib.dir}/evolute.jar" />
<injar file="${app.deploy.dist.dir}/${app.jar.name}" />
<outjar file="${app.deploy.dist.dir}/${app.jar.name}_guard.jar" />
<libraryjar file="${evolute.lib.dir}" />
<libraryjar file="${app.lib.dir}" />
<libraryjar file="${java.home}/lib/jce.jar" />
<libraryjar file="${java.home}/lib/jsse.jar" />
<libraryjar file="${java.home}/lib/rt.jar" />
-printseeds
-verbose
-dontskipnonpubliclibraryclasses
-keepclasseswithmembers public class * {
public static void main(java.lang.String[]);
}
</proguard>
<delete file="${app.deploy.dist.dir}/${app.jar.name}" failonerror="true" />
<move file="${app.deploy.dist.dir}/${app.jar.name}_guard.jar" tofile="${app.deploy.dist.dir}/${app.jar.name}" />
</target>
<target name="ProguardTask">
<property file="${app.version.file}" prefix="version" />
<typedef classpathref="lib.tools.classpath" resource="net/jtools/classloadertask/antlib.xml">
<classpath>
<path refid="lib.tools.classpath"/>
</classpath>
</typedef>
<classloader loader="project">
<classpath>
<fileset dir="${lib.tools.dir}" includes="*.jar"/>
<fileset dir="${app.lib.dir}" includes="*.jar"/>
</classpath>
</classloader>
<taskdef name="proguardtask" classpathref="lib.tools.classpath" classname="com.evolute.ant.ProguardTask" onerror="ignore" />
<proguardtask filePath="${app.dir}/${app.name}.map" version="${version.major}.${version.minor}.${version.build}" fileName="${app.name}.map" projectName="${app.name}" />
</target>
<target name="pre-deploy">
<antcall target="obfuscate" />
<antcall target="ProguardTask" />
</target>
</project>

@ -0,0 +1,111 @@
<project name="evo-app-compile-common" basedir="../../">
<import file="evo-app-load-properties.xml" />
<!-- BUILD -->
<target name="app-post-build" />
<target name="app-pre-build" />
<target name="app-build" />
<target name="cifrar" depends="app-properties-exists" if="app.properties.exists" >
<echo message="Encrypting app.properties" />
<typedef classpathref="lib.tools.classpath" resource="net/jtools/classloadertask/antlib.xml">
<classpath>
<path refid="lib.tools.classpath"/>
</classpath>
</typedef>
<classloader loader="project">
<classpath>
<fileset dir="${lib.tools.dir}" includes="*.jar"/>
</classpath>
</classloader>
<taskdef name="cifrar-props" classpathref="lib.tools.classpath" classname="com.evolute.ant.PropsEncryptorTask" onerror="fail" />
<cifrar-props filepath="${properties.dir}${file.separator}app.properties" destpath="${app.build.dir}${file.separator}app.properties"/>
</target>
<target name="app-properties-exists">
<available file="${properties.dir}${file.separator}app.properties" property="app.properties.exists"/>
</target>
<target name="app-prepare" depends="load-properties">
<echo message="Dealing with package-info.java files (ant compilation problem workaround)" />
<delete failonerror="false">
<fileset dir="${app.build.dir}" includes="**/package-info.java"/>
</delete>
<echo message="Copying non-java files to build directory" />
<copy failonerror="false" overwrite="true" verbose="true" todir="${app.build.dir}" file="${app.version.file}"/>
<copy verbose="true" failonerror="true" overwrite="true" todir="${app.build.dir}">
<fileset dir="${app.src.dir}">
<exclude name="**/*.java" />
<exclude name="*.java" />
</fileset>
<fileset dir="${properties.dir}">
<exclude name="app.properties" />
<include name="**/*" />
</fileset>
</copy>
<antcall target="cifrar"/>
</target>
<target name="app-clean" description="Removes all generated files" depends="load-static-properties">
<delete verbose="true" failonerror="false">
<fileset dir="${app.build.dir}">
<include name="**/*" />
</fileset>
</delete>
<delete dir="${app.build.dir}" verbose="true" failonerror="true" />
<delete dir="${app.dist.dir}" verbose="true" failonerror="true" />
<delete dir="${app.deploy.dist.dir}" verbose="true" failonerror="true" />
</target>
<target name="app-run" description="Runs the application" depends="app-build">
<java jvmversion="${app.java.version}" classname="${app.main}" maxmemory="${app.max.mem}" classpathref="app.build.classpath" fork="true" dir="${app.build.dir}">
<jvmarg value="${jvm.run.args}" />
<arg value="${app.run.args}"/>
</java>
</target>
<!-- JAR -->
<target name="app-deploy-create-jar" depends="app-clean, app-build" >
<mkdir dir="${app.deploy.dist.dir}" />
<jar destfile="${app.deploy.dist.dir}/${app.jar.name}" >
<fileset dir="${app.build.dir}">
<include name="**/*" />
</fileset>
<manifest>
<attribute name="Permissions" value="all-permissions" />
</manifest>
</jar>
<copy todir="${app.deploy.dist.lib.dir}">
<fileset dir="${app.lib.dir}">
<include name="**/*" />
</fileset>
</copy>
</target>
<target name="app-create-jar" description="Make application Jar" depends="app-clean, app-build" >
<pathconvert property="jar.classpath.converted" refid="app.jar.classpath" pathsep=" ">
<map from="${app.dir}/" to="" />
<map from="${basedir}/" to="" />
</pathconvert>
<mkdir dir="${app.dist.dir}" />
<jar destfile="${app.dist.dir}/${app.jar.name}">
<fileset dir="${app.build.dir}">
<include name="**/*" />
</fileset>
<manifest>
<attribute name="Main-Class" value="${app.main}" />
<attribute name="Class-Path" value="${jar.classpath.converted}" />
</manifest>
</jar>
<copy todir="${app.dist.lib.dir}">
<fileset dir="${app.lib.dir}">
<include name="**/*" />
</fileset>
</copy>
</target>
</project>

@ -0,0 +1,950 @@
<project name="evo-app-deploy-common" basedir="../../" >
<!--xmlns:ac="antlib:net.sf.antcontrib"-->
<import file="evo-app-load-properties.xml" />
<!-- PROPERTIES -->
<property name="properties.key.name" value="name" />
<property name="properties.key.major" value="major" />
<property name="properties.key.minor" value="minor" />
<property name="properties.key.build" value="build" />
<path id="lib.dir-jars">
<fileset dir="lib" >
<include name="*.jar"/>
</fileset>
</path>
<!-- SETUP -->
<target name="prepare-deploy-location">
</target>
<target name="run-jnlp-task" >
<typedef classpathref="lib.classpath" resource="net/jtools/classloadertask/antlib.xml">
<classpath>
<path refid="lib.classpath"/>
</classpath>
</typedef>
<classloader loader="project">
<classpath>
<fileset dir="${app.lib.dir}" includes="*.jar"/>
</classpath>
</classloader>
<taskdef name="generate-jnlp" classpathref="lib.classpath" classname="com.evolute.ant.JNLPGeneratorTask" onerror="ignore"/>
<if>
<isset property="TESTDEPLOY"/>
<then>
<generate-jnlp propertiesDir="${properties.dir}" basedir="${app.dir}" production="false"/>
</then>
<else>
<generate-jnlp propertiesDir="${properties.dir}" basedir="${app.dir}" production="true"/>
</else>
</if>
<antcall target="send-jnlp"/>
</target>
<!-- DEPLOY -->
<target name="load-properties" />
<target name="pre-deploy" />
<target name="ask-deploy.version" unless="deploy.version">
<input defaultvalue="" addproperty="deploy.version">
<handler classpathref="lib.tools.classpath" classname="com.evolute.ant.VersionInputHandler" />
</input>
</target>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${basedir}/lib.tools/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<target name="ask-deploy.jars" unless="deploy.jars">
<property name="deploy.jars" refid="lib.dir-jars"/>
<var name="deploy.jars" value="${basedir}/${app.appName}.jar:${deploy.jars} "/>
</target>
<target name="ask-deploy.user" unless="deploy.user">
<input message="" addproperty="deploy.user">
<handler classpathref="lib.tools.classpath" classname="com.evolute.ant.UserInputHandler" />
</input>
</target>
<target name="ask-deploy.password" unless="deploy.password">
<input message="password:>" addproperty="deploy.password">
<handler classpathref="lib.tools.classpath" classname="com.evolute.ant.PasswordInputHandler" />
</input>
</target>
<target name="app-deploy-version" if="deploy.version" depends="ask-deploy.jars,ask-deploy.user,ask-deploy.password" >
<antcall target="app-deploy-create-jar"/>
<antcall target="pre-deploy" />
<antcall target="run-jnlp-task" />
<antcall target="update-jar-jnlp"/>
<condition property="do.abort">
<equals arg1="${deploy.jars}" arg2="null"/>
</condition>
<fail if="do.abort">Deploy cancelled</fail>
<antcall target="app-deploy-version-jars"/>
</target>
<!--<scriptdef language="javascript" name="upper">
<attribute name="string" />
<attribute name="to" />
project.setProperty( attributes.get( "to" ),
attributes.get( "string" ).toUpperCase() );
</scriptdef>-->
<target name="update-jar-jnlp">
<mkdir dir="${app.build.dir}/JNLP-INF"/>
<!--<upper string="${app.name}" to="app.name.upper"/>-->
<!--<echo message="olha auqui o nome em maiusculas ${app.name.upper}"></echo>-->
<if>
<isset property="TESTDEPLOY"/>
<then>
<copy file="${basedir}/jnlp/test/${app.name}.jnlp" tofile="${app.build.dir}/JNLP-INF/APPLICATION.JNLP"/>
</then>
<else>
<copy file="${basedir}/jnlp/production/${app.name}.jnlp" tofile="${app.build.dir}/JNLP-INF/APPLICATION.JNLP"/>
</else>
</if>
<jar destfile="${app.deploy.dist.dir}/${app.jar.name}" update="true" >
<fileset dir="${app.build.dir}">
<include name="**/*" />
</fileset>
</jar>
<copy todir="${app.deploy.dist.lib.dir}">
<fileset dir="${app.lib.dir}">
<include name="**/*" />
</fileset>
</copy>
</target>
<target name="app-version-increase-test">
<property name="TESTDEPLOY" value="yes"/>
<antcall target="app-version-increase-build"/>
</target>
<target name="app-version-increase-major">
<propertyfile file="${app.version.file}" comment="${app.version.comment}" >
<entry key="${properties.key.name}" value="${app.name}"/>
<entry key="${properties.key.major}" type="int" operation="+" value="1" pattern="0" />
<entry key="${properties.key.minor}" type="int" operation="=" value="0" pattern="0" />
<entry key="${properties.key.build}" type="int" operation="=" value="0" pattern="0" />
</propertyfile>
<antcall target="app-deploy-version"/>
</target>
<target name="app-version-increase-minor">
<propertyfile file="${app.version.file}" comment="${app.version.comment}" >
<entry key="${properties.key.name}" value="${app.name}"/>
<entry key="${properties.key.major}" type="int" operation="+" value="0" pattern="0" />
<entry key="${properties.key.minor}" type="int" operation="+" value="1" pattern="0" />
<entry key="${properties.key.build}" type="int" operation="=" value="0" pattern="0" />
</propertyfile>
<antcall target="app-deploy-version"/>
</target>
<target name="app-version-increase-build">
<exec executable="hostname" outputproperty="computer.hostname"/>
<propertyfile file="${app.version.file}" comment="${app.version.comment}" >
<entry key="${properties.key.name}" value="${app.name}"/>
<entry key="${properties.key.major}" type="int" operation="+" value="0" pattern="0" />
<entry key="${properties.key.minor}" type="int" operation="+" value="0" pattern="0" />
<entry key="${properties.key.build}" type="int" operation="+" value="1" pattern="0" />
<entry key="timestamp" type="date" value="now"/>
<entry key="user" value="${user.name}"/>
<entry key="computer" value="${computer.hostname}"/>
</propertyfile>
<antcall target="app-deploy-version"/>
</target>
<target name="deploy-test" if="TESTDEPLOY">
</target>
<!-- NEW -->
<path id="lib.classpath">
<fileset dir="${app.lib.dir}">
<include name="*.jar"/>
</fileset>
</path>
<target name="send-jnlp">
<if>
<isset property="TESTDEPLOY"/>
<then>
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="mkdir -p /home/software/public_html/versoes_teste/${app.appName}/lib" password="${deploy.password}" />
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chmod -R -f g+w /home/software/public_html/versoes_teste/${app.appName}; true" password="${deploy.password}" />
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chown -R -f :software /home/software/public_html/versoes_teste/${app.appName}; true" password="${deploy.password}" />
</then>
<else>
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="mkdir -p /home/software/public_html/${app.appName}/lib" password="${deploy.password}" />
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chmod -R -f g+w /home/software/public_html/${app.appName}; true" password="${deploy.password}" />
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chown -R -f :software /home/software/public_html/${app.appName}; true" password="${deploy.password}" />
</else>
</if>
<if>
<isset property="TESTDEPLOY"/>
<then>
<if>
<available file="${basedir}/jnlp/test" type="dir"/>
<then>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/versoes_teste/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/jnlp/test" includes="*.jnlp"/>
</scp>
</then>
</if>
<if>
<available file="${basedir}/jnlp/extensions/test" type="dir"/>
<then>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/versoes_teste/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/jnlp/extensions/test" includes="*.jnlp"/>
</scp>
</then>
</if>
</then>
<else>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/jnlp/production" includes="*.jnlp"/>
</scp>
<if>
<available file="${basedir}/jnlp/extensions/production" type="dir"/>
<then>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/jnlp/extensions/production" includes="*.jnlp"/>
</scp>
</then>
</if>
</else>
</if>
</target>
<!-- CORRER INICIALMENTE -->
<path id="pack.dir-jars">
<fileset dir="signed/packed" >
<include name="lib/*.jar*"/>
<include name="${app.jar.name}*"/>
</fileset>
</path>
<target name="inicial">
<echo message="Jars: ${deploy.jars}"/>
<delete dir="signed"/>
<mkdir dir="signed/lib"/>
<mkdir dir="signed/packed/lib"/>
<property name="unsigned.jars" value=""/>
<property name="signed.jars" value=""/>
<for list="${deploy.jars}" param="jar" delimiter=":">
<sequential>
<echo message="A verificar se @{jar} esta assinado"/>
<exec dir="deploy" command="jarsigner" outputproperty="@{jar}.verify">
<arg line="-verify"/>
<arg line="@{jar}"/>
</exec>
<if>
<contains string="${@{jar}.verify}" substring="jar is unsigned"/>
<then>
<var name="unsigned.jars" value="${unsigned.jars} @{jar}"/>
</then>
<else>
<if>
<contains string="${@{jar}.verify}" substring="jar verified"/>
<then>
<var name="signed.jars" value="${signed.jars} @{jar}"/>
</then>
</if>
</else>
</if>
</sequential>
</for>
<echo message="unsigned: ${unsigned.jars}"/>
<echo message="Signed jars = ${signed.jars}"/>
<echo message="Repacking..."/>
<for list="${unsigned.jars}" param="jar" delimiter=" ">
<sequential>
<echo message="Repacking @{jar}"/>
<apply executable="pack200" parallel="false" failonerror="false">
<arg value="-J-Xmx1g"/>
<arg value="--repack"/>
<arg value="--segment-limit=-1"/>
<fileset file="@{jar}" />
</apply>
</sequential>
</for>
<echo message=" home = ${user.home}"/>
<echo message="Signing..."/>
<for list="${unsigned.jars}" param="jar" delimiter=" ">
<sequential>
<signjar destDir="signed/lib" alias="id evolute, consultoria informática do comodo ca limited" storetype="pkcs12" keystore="ant/evolute.keystore" storepass="Typein" >
<path>
<fileset file="@{jar}" />
</path>
</signjar>
</sequential>
</for>
<echo message="A assinar ${app.name}.jar"/>
<signjar destDir="signed" alias="id evolute, consultoria informática do comodo ca limited" storetype="pkcs12" keystore="ant/evolute.keystore" storepass="Typein" >
<path>
<fileset dir="deploy" includes="*.jar" />
</path>
</signjar>
<property name="deploy.jars.copy" value=""/>
<for list="${deploy.jars}" param="jar" delimiter=":">
<sequential>
<var name="deploy.jars.copy" value="${deploy.jars.copy} '@{jar}'"/>
</sequential>
</for>
<for list="${deploy.jars.copy}" param="jar" delimiter=" ">
<sequential>
<delete file="@{jar}.pack.gz"/>
</sequential>
</for>
<if>
<equals arg1="${jnlp.resources.property.jnlp.packEnabled}" arg2="true"/>
<then>
<echo message="Packing..."/>
<for list="${unsigned.jars}" param="jar" delimiter=" ">
<sequential>
<apply executable="pack200" parallel="false" dest="signed/packed/lib" failonerror="false">
<arg value="-J-Xmx1g"/>
<arg value="--segment-limit=-1"/>
<targetfile/>
<srcfile/>
<fileset file="@{jar}" />
<mapper type="glob" from="*" to="*.pack.gz" />
</apply>
</sequential>
</for>
</then>
</if>
<for list="${signed.jars}" param="jar" delimiter=" ">
<sequential>
<echo message="@{jar}"/>
<copy failonerror="false" verbose="true" overwrite="true" toDir="signed/lib" >
<fileset file="@{jar}"/>
</copy>
</sequential>
</for>
<property name="pack.jars" refid="pack.dir-jars"/>
<echo message="Pack jars = ${pack.jars}"/>
<property name="pack.jars.copy" value=""/>
<for list="${pack.jars}" param="jar" delimiter=":">
<sequential>
<var name="pack.jars.copy" value="${pack.jars.copy} @{jar}"/>
</sequential>
</for>
<echo message="Pack jars = ${pack.jars.copy}"/>
<echo message="Argumentos = ${basedir} ${deploy.jars.copy} ${pack.jars.copy} inicial"/>
<java fork="true" failonerror="yes" classname="com.evolute.xml.BuildXML" classpathref="lib.tools.classpath">
<arg line="${basedir} ${deploy.jars.copy} ${pack.jars.copy} inicial"/>
</java>
<if>
<isset property="TESTDEPLOY"/>
<then>
<echo message="isto é um teste"/>
<echo message="other jars = ${other.jars}"/>
<echo message="deploy.jars = ${deploy.jars}"/>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/versoes_teste/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/signed" includes="**/*.jar"/>
</scp>
</then>
<else>
<echo message="other jars = ${other.jars}"/>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/signed" includes="**/*.jar"/>
</scp>
</else>
</if>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/signed/packed" includes="**/*.pack.gz"/>
</scp>
<if>
<isset property="TESTDEPLOY"/>
<then>
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chmod -R -f g+w /home/software/public_html/versoes_teste/${app.appName}; true" password="${deploy.password}" />
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chown -R -f :software /home/software/public_html/versoes_teste/${app.appName}; true" password="${deploy.password}" />
</then>
<else>
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chmod -R -f g+w /home/software/public_html/${app.appName}; true" password="${deploy.password}" />
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chown -R -f :software /home/software/public_html/${app.appName}; true" password="${deploy.password}" />
</else>
</if>
<delete file="signed/${app.appName}.jar"/>
<delete file="signed/packed/${app.appName}.jar.pack.gz"/>
</target>
<!-- FIM CORRER INICIALMENTE -->
<target name="deploy-production">
<echo message="Deploying to ${deploy.user}@${app.deploy.server}"/>
<if>
<available file="${basedir}/clientJars.xml" type="file"/>
<then>
<xmlproperty file="clientJars.xml"/>
<if>
<not>
<isset property="project.signed-jar-files.name"/>
</not>
<then>
<antcall target="inicial"/>
</then>
<else>
<antcall target="create-new-xml-client-jar"/>
<antcall target="delete-principal-jar"/>
</else>
</if>
</then>
<else>
<antcall target="inicial"/>
</else>
</if>
</target>
<target name="create-new-xml-client-jar">
<property name="deploy.jars.copy" value=""/>
<for list="${deploy.jars}" param="jar" delimiter=":">
<sequential>
<var name="deploy.jars.copy" value="${deploy.jars.copy} '@{jar}'"/>
</sequential>
</for>
<echo message="Basedir: ${basedir}"/>
<echo message="deploy jars copy: ${deploy.jars.copy}"/>
<java fork="true" failonerror="yes" classname="com.evolute.xml.BuildXML" classpathref="lib.tools.classpath">
<arg line="${basedir} ${deploy.jars.copy} novo"/>
</java>
</target>
<target name="recognize-xml-2">
<xmlproperty file="clientJars.xml"/>
<xmlproperty file="newClientJars.xml"/>
</target>
<target name="compare-old-and-current-2" depends="recognize-xml-2">
<property name="different.jars" value=" "/>
<property name="toDeploy.packed" value=" "/>
<echo message="project.jar-files = ${project.jar-files.name}"/>
<echo message="project.new-jar-files = ${project.new-jar-files.name}"/>
<for list="${project.new-jar-files.name}" param="jar">
<sequential>
<if>
<and>
<equals arg1="${jnlp.resources.property.jnlp.packEnabled}" arg2="true"/>
<not>
<available file="${basedir}/signed/packed/${project.new-jar-files.name(@{jar}-path)}@{jar}.pack.gz" type="file"/>
</not>
<not>
<contains string="${signed.jars}" substring="@{jar}"/>
</not>
</and>
<then>
<var name="toDeploy.packed" value="${toDeploy.packed} ${project.new-jar-files.name(@{jar}-path)}@{jar}"/>
</then>
</if>
<if>
<not>
<available file="${basedir}/signed/${project.new-jar-files.name(@{jar}-path)}@{jar}" type="file"/>
</not>
<then>
<var name="different.jars" value="${different.jars} ${project.new-jar-files.name(@{jar}-path)}@{jar}"/>
</then>
<else>
<for list="${project.jar-files.name}" param="oldJar">
<sequential>
<if>
<equals arg1="@{jar}" arg2="@{oldJar}"/>
<then>
<property name="@{jar}-name-exists" value=""/>
<if>
<not>
<equals arg1="${project.jar-files.name(@{jar}-md5)}" arg2="${project.new-jar-files.name(@{oldJar}-md5)}"/>
</not>
<then>
<var name="different.jars" value="${different.jars} ${project.new-jar-files.name(@{jar}-path)}@{jar}"/>
</then>
</if>
</then>
</if>
</sequential>
</for>
<if>
<not>
<isset property="@{jar}-name-exists"/>
</not>
<then>
<var name="different.jars" value="${different.jars} ${project.new-jar-files.name(@{jar}-path)}@{jar}"/>
</then>
</if>
</else>
</if>
</sequential>
</for>
<echo message="different jars = ${different.jars}"/>
</target>
<target name="check-if-is-signed" depends="compare-old-and-current-2">
<property name="unsigned.jars" value=""/>
<property name="signed.jars" value=""/>
<for list="${different.jars}" param="jar" delimiter=" ">
<sequential>
<exec dir="deploy" command="jarsigner" outputproperty="@{jar}.verify">
<arg line="-verify"/>
<arg line="@{jar}"/>
</exec>
<if>
<contains string="${@{jar}.verify}" substring="jar is unsigned"/>
<then>
<var name="unsigned.jars" value="${unsigned.jars} @{jar}"/>
</then>
<else>
<if>
<contains string="${@{jar}.verify}" substring="jar verified"/>
<then>
<var name="signed.jars" value="${signed.jars} @{jar}"/>
</then>
</if>
</else>
</if>
</sequential>
</for>
<echo message="unsigned: ${unsigned.jars}"/>
<echo message="Signed jars = ${signed.jars}"/>
</target>
<target name="repack-jars" depends="check-if-is-signed">
<if>
<not>
<equals arg1="${unsigned.jars}" arg2=""/>
</not>
<then>
<apply executable="pack200" parallel="false" failonerror="false">
<arg value="-J-Xmx1g"/>
<arg value="--repack"/>
<arg value="--segment-limit=-1"/>
<fileset dir="deploy" includes="${unsigned.jars}" />
</apply>
</then>
</if>
</target>
<target name="sign-jars-2" depends="repack-jars">
<echo message="Signing jars..."/>
<mkdir dir="signed/lib"/>
<mkdir dir="signed/packed/lib"/>
<echo message="Unsigned jars: ${unsigned.jars}"/>
<for list="${unsigned.jars}" param="jar" delimiter=" ">
<sequential>
<echo message="Signing jar @{jar}"/>
<signjar destDir="signed" alias="id evolute, consultoria informática do comodo ca limited" storetype="pkcs12" keystore="ant/evolute.keystore" storepass="Typein" >
<path>
<fileset dir="deploy" includes="@{jar}"/>
</path>
</signjar>
</sequential>
</for>
<signjar destDir="signed" alias="id evolute, consultoria informática do comodo ca limited" storetype="pkcs12" keystore="ant/evolute.keystore" storepass="Typein" >
<path>
<fileset dir="deploy" includes="*.jar"/>
</path>
</signjar>
<for list="${unsigned.jars}" param="jar" delimiter=" ">
<sequential>
<delete file="${basedir}/signed/packed/@{jar}.pack.gz"/>
</sequential>
</for>
</target>
<target name="copy-signed" depends="sign-jars-2">
<if>
<contains string="${signed.jars}" substring=" "/>
<then>
<copy failonerror="false" verbose="true" overwrite="true" toDir="signed" >
<fileset dir="deploy" includes="${signed.jars}"/>
</copy>
</then>
</if>
</target>
<target name="pack-jars-2" depends="copy-signed">
<echo message="Unsigned: ${unsigned.jars} "/>
<for list="${unsigned.jars}" param="jar" delimiter=" ">
<sequential>
<if>
<not>
<contains string="${toDeploy.packed}" substring="@{jar}"/>
</not>
<then>
<var name="toDeploy.packed" value="${toDeploy.packed} @{jar}"/>
</then>
</if>
</sequential>
</for>
<property name="toDeploy.packed.copy" value=""/>
<property name="deploy.signed" value=""/>
<if>
<equals arg1="${jnlp.resources.property.jnlp.packEnabled}" arg2="true"/>
<then>
<for list="${deploy.jars}" param="jar" delimiter=":">
<sequential>
<exec dir="deploy/lib" command="jarsigner" outputproperty="@{jar}.verify">
<arg line="-verify"/>
<arg line="@{jar}"/>
</exec>
<if>
<contains string="${@{jar}.verify}" substring="jar verified"/>
<then>
<var name="deploy.signed" value="${deploy.signed} @{jar}"/>
</then>
</if>
</sequential>
</for>
</then>
</if>
<for list="${toDeploy.packed}" param="jar" delimiter=" ">
<sequential>
<if>
<not>
<contains string="${deploy.signed}" substring="@{jar}"/>
</not>
<then>
<var name="toDeploy.packed.copy" value="${toDeploy.packed.copy} @{jar}"/>
</then>
</if>
</sequential>
</for>
<if>
<equals arg1="${jnlp.resources.property.jnlp.packEnabled}" arg2="true"/>
<then>
<echo message="Packing jars..."/>
<echo message="toDeploy.packed.copy = ${toDeploy.packed.copy}"/>
<apply executable="pack200" parallel="false" dest="signed/packed" failonerror="false">
<arg value="-J-Xmx1g"/>
<arg value="--modification-time=latest"/>
<arg value="--deflate-hint=true"/>
<arg value="--segment-limit=-1"/>
<targetfile/>
<srcfile/>
<fileset dir="signed" includes="${toDeploy.packed.copy}" />
<mapper type="glob" from="*" to="*.pack.gz" />
</apply>
</then>
</if>
</target>
<target name="alter-client-jar-xml" depends="pack-jars-2">
<property name="deploy.jars.copy" value=""/>
<for list="${deploy.jars}" param="jar" delimiter=":">
<sequential>
<var name="deploy.jars.copy" value="${deploy.jars.copy} '@{jar}'"/>
</sequential>
</for>
<property name="pack.jars" refid="pack.dir-jars"/>
<echo message="Pack jars = ${pack.jars}"/>
<property name="pack.jars.copy" value=""/>
<for list="${pack.jars}" param="jar" delimiter=":">
<sequential>
<var name="pack.jars.copy" value="${pack.jars.copy} '@{jar}'"/>
</sequential>
</for>
<echo message="Deploy jars = ${deploy.jars.copy}"/>
<echo message="Pack jars = ${pack.jars.copy}"/>
<java fork="true" failonerror="yes" classname="com.evolute.xml.BuildXML" classpathref="lib.tools.classpath">
<arg line="${basedir} ${deploy.jars.copy} ${pack.jars.copy} inicial"/>
</java>
</target>
<target name="verify-jars-at-server-2" depends="alter-client-jar-xml">
<echo message="nome da aplicacao = ${app.name}"/>
<if>
<isset property="TESTDEPLOY"/>
<then>
<sshexec verbose="false" failonerror="true" trust="yes" host="${app.deploy.server}" username="${deploy.user}" command='find /home/software/public_html/versoes_teste/${app.name} -name "*.jar*" -exec md5sum {} +' password="${deploy.password}" output="jarsAtServer.txt" outputproperty="trash" />
<java fork="true" failonerror="yes" classname="com.evolute.xml.ServerJarsXml" classpathref="lib.tools.classpath">
<arg line="versoes_teste/${app.appName}"/>
</java>
</then>
<else>
<sshexec verbose="false" failonerror="true" trust="yes" host="${app.deploy.server}" username="${deploy.user}" command='find "/home/software/public_html/${app.name}" -name "*.jar*" -exec md5sum {} +' password="${deploy.password}" output="jarsAtServer.txt" outputproperty="trash" />
<java fork="true" failonerror="yes" classname="com.evolute.xml.ServerJarsXml" classpathref="lib.tools.classpath">
<arg line="'${app.appName}'"/>
</java>
</else>
</if>
<xmlproperty file="currentServerJars.xml"/>
</target>
<target name="compare-client-and-server-jars" depends="verify-jars-at-server-2">
<xmlproperty file="clientJars.xml" prefix="new"/>
<xmlproperty file="currentServerJars.xml"/>
<property name="toDeploy.jars" value=""/>
<for list="${new.project.signed-jar-files.name}" param="jar">
<sequential>
<for list="${current-server-jar-files.name}" param="currJar">
<sequential>
<if>
<and>
<equals arg1="@{jar}" arg2="@{currJar}"/>
<equals arg1="${new.project.signed-jar-files.name(@{jar}-md5)}" arg2="${current-server-jar-files.name(@{currJar}-md5)}"/>
</and>
<then>
<property name="@{jar}-exists-on-server" value=""/>
</then>
</if>
</sequential>
</for>
<if>
<not>
<isset property="@{jar}-exists-on-server"/>
</not>
<then>
<var name="toDeploy.jars" value="${toDeploy.jars};${new.project.signed-jar-files.name(@{jar}-path)}@{jar}"/>
</then>
</if>
</sequential>
</for>
<echo message="toDeploy.jars = ${toDeploy.jars}"/>
</target>
<target name="send-main-jar">
<if>
<isset property="TESTDEPLOY"/>
<then>
<echo message="scp @{jar} ${deploy.user}@${app.deploy.server}:/home/software/public_html/versoes_teste/${app.appName}"/>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/versoes_teste/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/signed" includes="*.jar"/>
</scp>
</then>
<else>
<echo message="scp @{jar} ${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}"/>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/signed" includes="*.jar"/>
</scp>
</else>
</if>
</target>
<target name="send-jars-to-server-2" depends="compare-client-and-server-jars, send-main-jar">
<echo message="Jars to deploy: ${toDeploy.jars}"/>
<for list="${toDeploy.jars}" param="jar" delimiter=";">
<sequential>
<if>
<and>
<contains string="@{jar}" substring=".pack.gz"/>
<equals arg1="${jnlp.resources.property.jnlp.packEnabled}" arg2="true"/>
</and>
<then>
<if>
<isset property="TESTDEPLOY"/>
<then>
<echo message="scp @{jar} ${deploy.user}@${app.deploy.server}:/home/software/public_html/versoes_teste/${app.appName}"/>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/versoes_teste/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/signed/packed" includes="@{jar}"/>
</scp>
</then>
<else>
<echo message="scp @{jar} ${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}"/>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/signed/packed" includes="@{jar}"/>
</scp>
</else>
</if>
</then>
<else>
<if>
<and>
<not>
<contains string="@{jar}" substring=".pack.gz"/>
</not>
<not>
<equals arg1="${jnlp.resources.property.jnlp.packEnabled}" arg2="true"/>
</not>
</and>
<then>
<if>
<isset property="TESTDEPLOY"/>
<then>
<echo message="scp @{jar} ${deploy.user}@${app.deploy.server}:/home/software/public_html/versoes_teste/${app.appName}"/>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/versoes_teste/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/signed" includes="@{jar}"/>
</scp>
</then>
<else>
<echo message="scp @{jar} ${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}"/>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/signed" includes="@{jar}"/>
</scp>
</else>
</if>
</then>
</if>
</else>
</if>
</sequential>
</for>
<if>
<isset property="TESTDEPLOY"/>
<then>
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chmod -R -f g+w /home/software/public_html/versoes_teste/${app.appName}; true" password="${deploy.password}" />
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chown -R -f :software /home/software/public_html/versoes_teste/${app.appName}; true" password="${deploy.password}" />
</then>
<else>
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chmod -R -f g+w /home/software/public_html/${app.appName}; true" password="${deploy.password}" />
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chown -R -f :software /home/software/public_html/${app.appName}; true" password="${deploy.password}" />
</else>
</if>
</target>
<target name="delete-principal-jar" depends="send-jars-to-server-2">
<delete file="signed/${app.appName}.jar"/>
<delete file="signed/packed/${app.appName}.jar.pack.gz"/>
<delete file="currentServerJars.xml"/>
<delete file="jarsAtServer.txt"/>
<delete file="newClientJars.xml"/>
</target>
<!-- END NEW -->
<!-- TEST PROJECT -->
<target name="test-project">
<property file="script.properties"/>
<echo message="${svn_repo} ${user} ${pass} ${target} ${build}"/>
<antcall target="app-create-jar"/>
</target>
<target name="deploy-project-script">
<property file="script.properties"/>
<antcall target="app-deploy"/>
</target>
<!-- END TEST PROJECT -->
<target name="app-deploy-version-jars-user-pass" if="deploy.password">
<antcall target="prepare-deploy-location" />
<echo message="Uploading files: ${deploy.jars}"/>
<scp todir="${deploy.user}@${app.deploy.server}:${app.deploy.path}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${app.deploy.dist.dir}" includes="${deploy.jars}"/>
</scp>
<echo message="Uploading jnlps"/>
<antcall target="deploy-test"/>
<antcall target="deploy-production"/>
</target>
<target name="app-deploy-version-jars-user" if="deploy.user">
<antcall target="app-deploy-version-jars-user-pass"/>
</target>
<target name="app-deploy-version-jars" if="deploy.jars" >
<antcall target="app-deploy-version-jars-user" />
</target>
<target name="app-deploy-choose-version" if="deploy.version" >
<antcall target="app-version-increase-${deploy.version}" />
</target>
<target name="app-deploy" description="Deploys application" depends="load-properties,ask-deploy.version">
<antcall target="app-deploy-choose-version"/>
<antcall target="app-create-software-evo-licensor"/>
</target>
<target name="app-create-software-evo-licensor" depends="load-properties">
<property file="${app.version.file}" prefix="version" />
<typedef classpathref="lib.tools.classpath" resource="net/jtools/classloadertask/antlib.xml">
<classpath>
<path refid="lib.tools.classpath"/>
</classpath>
</typedef>
<classloader loader="project">
<classpath>
<fileset dir="${lib.tools.dir}" includes="*.jar"/>
<fileset dir="${app.lib.dir}" includes="*.jar"/>
</classpath>
</classloader>
<taskdef name="createTask" classpathref="lib.tools.classpath" classname="com.evolute.ant.CreateSoftwareAntTask" onerror="ignore"/>
<createTask projectVersion="${version.major}.${version.minor}.${version.build}" projectName="${app.name}" />
</target>
<!-- DOCUMENTATION -->
<target name="docs-generate-upload" description="Generates and uploads the project documentation" depends="load-properties,docs-generate,docs-upload"/>
<target name="docs-generate">
<mkdir dir="${docs.api.dir}"/>
<javadoc verbose="true" classpath="lib.docs.classpath" destdir="${docs.api.dir}" docencoding="UTF-8" doctitle="${app.name}" sourcepath="${app.src.dir}" />
</target>
<target name="docs-upload">
<input message="" addproperty="deploy.user">
<handler classpathref="lib.tools.classpath" classname="com.evolute.ant.UserInputHandler" />
</input>
<input message="password:>" addproperty="deploy.password">
<handler classpathref="lib.tools.classpath" classname="com.evolute.ant.PasswordInputHandler" />
</input>
<typedef classpathref="lib.tools.classpath" resource="net/jtools/classloadertask/antlib.xml">
<classpath>
<path refid="lib.tools.classpath"/>
</classpath>
</typedef>
<classloader loader="project">
<classpath>
<fileset dir="${lib.tools.dir}" includes="*.jar"/>
</classpath>
</classloader>
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="sh ${app.docs.prepare.script} ${app.name}" password="${deploy.password}" />
<scp todir="${deploy.user}@${app.deploy.docs.server}:${app.deploy.docs.path}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${docs.dir}"/>
</scp>
</target>
</project>

@ -0,0 +1,88 @@
<project name="evo-app-load-properties" basedir="../../">
<property name="properties.base.dir" value="${basedir}/properties" />
<property name="lib.tools.dir" value="${basedir}/lib.tools" />
<path id="lib.tools.classpath">
<fileset dir="${lib.tools.dir}" />
</path>
<target name="load-static-properties" >
<property name="app.dir" value="${basedir}" />
<property name="evolute.dir" value="${basedir}/../evolute" />
<property name="evolute.lib.dir" value="${evolute.dir}/lib" />
<property name="evolute.lib.tools.dir" value="${evolute.dir}/lib.tools" />
<property name="evolute.ant.dir" value="${evolute.dir}/ant" />
<property name="evolute.jar.name" value="evolute.jar" />
<property name="docs.dir" value="${app.dir}/docs" />
<property name="docs.api.dir" value="${docs.dir}/api" />
<property name="app.src.dir" value="${app.dir}/src" />
<property name="app.lib.dir" value="${app.dir}/lib" />
<property name="deploy.project.relative.lib.dir" value="lib" />
<property name="app.dist.dir" value="${app.dir}/dist" />
<property name="app.dist.lib.dir" value="${app.dist.dir}/lib" />
<property name="app.deploy.dist.dir" value="${app.dir}/deploy" />
<property name="app.deploy.dist.lib.dir" value="${app.deploy.dist.dir}/lib" />
<property name="app.build.dir" value="${app.dir}/build" />
<property name="app.dependencies.chache.dir" value="${app.dir}/dependenciesCache" />
<property name="codegen.project.ant" value="${basedir}/../codegen/build.xml"/>
<property name="codegen.properties.file" value="${basedir}/properties/codegen.xml"/>
<property name="leaf.project.ant" value="${basedir}/../LEAF/build.xml"/>
<path id="app.jar.classpath">
<fileset dir="${app.lib.dir}" />
</path>
<path id="app.build.classpath">
<pathelement location="${app.build.dir}" />
<path refid="app.jar.classpath" />
</path>
<path id="lib.docs.classpath">
<path refid="lib.tools.classpath" />
<path refid="app.jar.classpath" />
</path>
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="lib.tools.classpath" />
</target>
<target name="load-properties-file" >
<property name="properties.dir" value="${properties.base.dir}" />
<property file="${properties.dir}/app.properties" />
<property file="${properties.dir}/project.properties" />
<antcall target="load-static-properties"/>
</target>
<target name="load-properties" depends="load-static-properties,load-properties-file">
<property name="app.name" value="${app.appName}" />
<property name="app.main" value="${app.main-class}" />
<property name="app.jar.name" value="${app.name}.jar" />
<property name="jnlp.dir" value="${app.dir}/jnlp" />
<property name="jnlp.extensions.dir" value="${jnlp.dir}/extensions" />
<property name="app.java.version" value="${java.version}" />
<property name="app.deploy.server" value="www.evolute.pt" />
<property name="app.deploy.path" value="/home/software/src_${app.name}" />
<property name="app.deploy.jnlp.path" value="${app.deploy.path}/jnlp" />
<property name="app.deploy.production.script" value="/home/software/auto_deploy.sh ${app.name}" />
<property name="app.deploy.test.script" value="/home/software/auto_test_deploy.sh ${app.name}" />
<property name="deploy.prepare.script" value="/home/software/auto_prepare_deploy.sh ${app.name}" />
<property name="app.deploy.docs.server" value="${app.deploy.server}" />
<property name="app.deploy.docs.path" value="/home/software/public_html/docs/${app.name}" />
<property name="app.docs.prepare.script" value="/home/software/auto_prepare_docs_upload.sh" />
<property name="app.version.file" value="${properties.base.dir}/version.properties" />
<property name="app.version.comment" value="${app.name} versioning file" />
<property name="app.run.args" value="" />
<property name="jvm.run.args" value="-XX:-UseGCOverheadLimit" />
<property name="app.ws.wsdl.url" value="${app.ws.wsdl.url.protocol}://${app.ws.wsdl.url.host}:${app.ws.wsdl.url.port}${app.ws.wsdl.url.path}" />
<property name="app.max.mem" value="512M" />
<property name="leaf.main" value="com.evolute.leaf.Main" />
<property name="deployer.main" value="com.evolute.deploy.Main" />
</target>
</project>

@ -0,0 +1,22 @@
<project name="evo-app-multiple-client-common" basedir="../../">
<target name="load-properties-file" depends="ask-target">
<property file="${properties.dir}/app.properties" />
<property file="${properties.dir}/project.properties" />
<property file="${properties.base.dir}/app.properties" />
<property file="${properties.base.dir}/project.properties" />
<copy verbose="true" failonerror="true" overwrite="true" todir="${basedir}/build">
<fileset dir="${properties.dir}">
<include name="*" />
<include name="**/*" />
</fileset>
</copy>
</target>
<target name="ask-target" unless="properties.dir">
<input defaultvalue="${properties.base.dir}" addproperty="properties.dir">
<handler classpathref="lib.tools.classpath" classname="com.evolute.ant.ProjectClientInputHandler" />
</input>
</target>
</project>

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="evo-web-build-common" basedir="../../">
<import file="evo-web-compile-common.xml" />
<target name="web-build" description="Compiles all application classes" depends="web-prepare,web-pre-build">
<mkdir dir="${web.build.dir}" />
<depend srcdir="${web.src.dir}" destdir="${web.build.dir}" cache="${web.dependencies.chache.dir}">
<include name="**/*.java" />
</depend>
<javac srcdir="${web.src.dir}" destdir="${web.build.dir}" classpathref="web.build.classpath" debug="on" deprecation="on" fork="true" memoryMaximumSize="512M" />
<antcall target="create-web-properties-file"/>
<antcall target="web-post-build"/>
</target>
<target name="create-web-properties-file">
<propertyfile file="${web.build.dir}/AnalisesAcidentesTrabalho.properties">
<entry key="timestamp" type="date" value="now"/>
<entry key="user" value="${user.name}"/>
</propertyfile>
</target>
</project>

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="evo-web-compile-common" basedir="../../">
<import file="evo-web-load-properties.xml" />
<!-- BUILD -->
<target name="web-post-build" />
<target name="web-pre-build" />
<target name="web-build" />
<target name="cifrar" depends="web-properties-exists" if="web.properties.exists" >
<echo message="Encrypting web.properties" />
<typedef classpathref="lib.tools.classpath" resource="net/jtools/classloadertask/antlib.xml">
<classpath>
<path refid="lib.tools.classpath"/>
</classpath>
</typedef>
<classloader loader="project">
<classpath>
<fileset dir="${lib.tools.dir}" includes="*.jar"/>
</classpath>
</classloader>
<taskdef name="cifrar-props" classpathref="lib.tools.classpath" classname="com.evolute.ant.PropsEncryptorTask" onerror="fail" />
<cifrar-props filepath="${properties.dir}${file.separator}app.properties" destpath="${web.build.dir}${file.separator}app.properties"/>
</target>
<target name="web-properties-exists">
<available file="${properties.dir}${file.separator}app.properties" property="web.properties.exists"/>
</target>
<target name="web-prepare" depends="load-properties">
<echo message="Dealing with package-info.java files (ant compilation problem workaround)" />
<delete failonerror="false">
<fileset dir="${web.build.dir}" includes="**/package-info.java"/>
</delete>
<echo message="Copying non-java files to build directory" />
<copy failonerror="false" overwrite="true" verbose="true" todir="${web.build.dir}" file="${web.version.file}"/>
<copy verbose="true" failonerror="true" overwrite="true" todir="${web.build.dir}">
<!-- <fileset dir="${web.src.dir}">
<exclude name="**/*.java" />
<exclude name="*.java" />
</fileset>-->
<fileset dir="${properties.dir}">
<exclude name="app.properties" />
<include name="**/*" />
</fileset>
</copy>
<antcall target="cifrar"/>
</target>
<target name="web-clean" description="Removes all generated files" depends="load-static-properties">
<delete verbose="true" failonerror="false">
<fileset dir="${web.build.dir}">
<include name="**/*" />
</fileset>
</delete>
<delete dir="${web.build.dir}" verbose="true" failonerror="true" />
<delete dir="${web.dist.dir}" verbose="true" failonerror="true" />
<delete dir="${web.deploy.dist.dir}" verbose="true" failonerror="true" />
</target>
<!-- JAR -->
<target name="web-create-jar" description="Make application Jar" depends="web-clean, web-build" >
<pathconvert property="jar.classpath.converted" refid="web.jar.classpath" pathsep=" ">
<map from="${web.dir}/" to="" />
<map from="${basedir}/" to="" />
</pathconvert>
<mkdir dir="${web.dist.dir}" />
<jar destfile="${web.dist.dir}${file.separator}AnalisesAcidentesTrabalho.jar">
<fileset dir="${web.build.dir}">
<include name="**/*" />
</fileset>
</jar>
<copy todir="${web.dist.lib.dir}">
<fileset dir="${web.lib.dir}">
<include name="**/*" />
</fileset>
</copy>
</target>
</project>

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="evo-web-load-properties" basedir="../../">
<property name="properties.base.dir" value="${basedir}/properties" />
<property name="lib.tools.dir" value="${basedir}/lib.tools" />
<path id="lib.tools.classpath">
<fileset dir="${lib.tools.dir}" />
</path>
<target name="load-static-properties" >
<property name="web.dir" value="${basedir}" />
<property name="evolute.dir" value="${basedir}/../evolute" />
<property name="evolute.lib.dir" value="${evolute.dir}/lib" />
<property name="evolute.lib.tools.dir" value="${evolute.dir}/lib.tools" />
<property name="evolute.ant.dir" value="${evolute.dir}/ant" />
<property name="evolute.jar.name" value="evolute.jar" />
<property name="docs.dir" value="${web.dir}/docs" />
<property name="docs.api.dir" value="${docs.dir}/api" />
<property name="web.src.dir" value="${web.dir}/src" />
<property name="web.lib.dir" value="${web.dir}/lib" />
<property name="deploy.project.relative.lib.dir" value="lib" />
<property name="web.dist.dir" value="${web.dir}/dist" />
<property name="web.dist.lib.dir" value="${web.dist.dir}/lib" />
<property name="web.deploy.dist.dir" value="${web.dir}/deploy" />
<property name="web.deploy.dist.lib.dir" value="${web.deploy.dist.dir}/lib" />
<property name="web.build.dir" value="${web.dir}/build" />
<property name="web.dependencies.chache.dir" value="${web.dir}/dependenciesCache" />
<property name="codegen.project.ant" value="${basedir}/../codegen/build.xml"/>
<property name="codegen.properties.file" value="${basedir}/properties/codegen.xml"/>
<property name="leaf.project.ant" value="${basedir}/../LEAF/build.xml"/>
<path id="web.jar.classpath">
<fileset dir="${web.lib.dir}" />
<fileset dir="${basedir}/web/WEB-INF/lib" />
<fileset file="${basedir}/lib.tools/servlet-api.jar" />
<fileset file="${basedir}/lib.tools/jsp-api.jar" />
<fileset file="${basedir}/lib.tools/el-api.jar" />
</path>
<path id="web.build.classpath">
<pathelement location="${web.build.dir}" />
<path refid="web.jar.classpath" />
</path>
<path id="lib.docs.classpath">
<path refid="lib.tools.classpath" />
<path refid="web.jar.classpath" />
</path>
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="lib.tools.classpath" />
</target>
<target name="load-properties-file" >
<property name="properties.dir" value="${properties.base.dir}" />
<property file="${properties.dir}/app.properties" />
<antcall target="load-static-properties"/>
</target>
<target name="load-properties" depends="load-static-properties,load-properties-file">
<property name="web.name" value="${web.appName}" />
<property name="web.jar.name" value="${web.name}.jar" />
<property name="jnlp.dir" value="${web.dir}/jnlp" />
<property name="jnlp.extensions.dir" value="${jnlp.dir}/extensions" />
<property name="web.java.version" value="${java.version}" />
<property name="web.deploy.server" value="www.evolute.pt" />
<property name="web.deploy.path" value="/home/software/src_${web.name}" />
<property name="web.deploy.jnlp.path" value="${web.deploy.path}/jnlp" />
<property name="web.deploy.production.script" value="/home/software/auto_deploy.sh ${web.name}" />
<property name="web.deploy.test.script" value="/home/software/auto_test_deploy.sh ${web.name}" />
<property name="deploy.prepare.script" value="/home/software/auto_prepare_deploy.sh ${web.name}" />
<property name="web.deploy.docs.server" value="${web.deploy.server}" />
<property name="web.deploy.docs.path" value="/home/software/public_html/docs/${web.name}" />
<property name="web.docs.prepare.script" value="/home/software/auto_prepare_docs_upload.sh" />
<property name="web.version.file" value="${properties.base.dir}/version.properties" />
<property name="web.version.comment" value="${web.name} versioning file" />
<property name="web.run.args" value="" />
<property name="jvm.run.args" value="-XX:-UseGCOverheadLimit" />
<property name="web.ws.wsdl.url" value="${web.ws.wsdl.url.protocol}://${web.ws.wsdl.url.host}:${web.ws.wsdl.url.port}${web.ws.wsdl.url.path}" />
<property name="web.max.mem" value="512M" />
<property name="leaf.main" value="com.evolute.leaf.Main" />
<property name="deployer.main" value="com.evolute.deploy.Main" />
</target>
</project>

@ -0,0 +1,113 @@
<project name="evo-app-build-5" basedir="../">
<import file="common/evo-app-load-properties.xml" />
<import file="common/evo-app-deploy-common.xml" />
<!-- CLASSPATH -->
<path id="app.jar.classpath">
<fileset dir="${app.lib.dir}" />
</path>
<path id="app.build.classpath">
<path refid="app.jar.classpath" />
<pathelement location="${app.build.dir}" />
</path>
<path id="svn.classpath">
<fileset dir="${evolute.lib.tools.dir}" />
</path>
<path id="jsch.classpath">
<fileset dir="${evolute.lib.tools.dir}" />
</path>
<path id="lib.tools.classpath">
<fileset dir="${lib.tools.dir}" />
</path>
<!-- BUILD -->
<target name="app-prepare" depends="load-properties">
<echo message="Copying non-java files to build directory" />
<copy todir="${app.build.dir}">
<fileset dir="${app.src.dir}">
<exclude name="**/*.java" />
<exclude name="*.java" />
</fileset>
<fileset dir="${properties.dir}">
<include name="*" />
<include name="**/*" />
</fileset>
</copy>
</target>
<target name="app-build" description="Compiles all application classes" depends="app-prepare">
<mkdir dir="${app.build.dir}" />
<depend srcdir="${app.src.dir}" destdir="${app.build.dir}" cache="${app.dependencies.chache.dir}">
<include name="**/*.java" />
</depend>
<javac srcdir="${app.src.dir}" destdir="${app.build.dir}" classpathref="app.build.classpath" debug="on" deprecation="on" fork="true" memoryMaximumSize="512M" source="1.5" target="1.5" />
<!-- <antcall target="app-datanucleus"/>-->
</target>
<!-- <target name="app-datanucleus">
<path id="jpox.enhancer.classpath">
<fileset dir="${lib.tools.dir}" />
<path refid="app.build.classpath" />
</path>
<taskdef name="jpoxEnhancer" description="JPOX Enhancer" classpathref="jpox.enhancer.classpath" classname="org.datanucleus.enhancer.tools.EnhancerTask" />
<jpoxEnhancer maxmemory="256M" classpathref="jpox.enhancer.classpath" dir="${app.build.dir}" verbose="true"/>
</target>-->
<target name="app-clean" description="Removes all generated files">
<delete failonerror="false">
<fileset dir="${app.build.dir}">
<include name="**/*" />
</fileset>
</delete>
<delete dir="${app.build.dir}" failonerror="false" />
<delete dir="${app.dist.dir}" failonerror="false" />
<delete dir="${app.deploy.dist.dir}" failonerror="false" />
</target>
<target name="app-run" description="Runs the application" depends="app-build">
<java classname="${app.main}" classpathref="app.build.classpath" fork="true" dir="${app.build.dir}" />
</target>
<!-- JAR -->
<target name="app-deploy-create-jar" depends="app-clean, app-build" >
<mkdir dir="${app.deploy.dist.dir}" />
<jar destfile="${app.deploy.dist.dir}/${app.jar.name}" >
<fileset dir="${app.build.dir}">
<include name="**/*" />
</fileset>
</jar>
<copy todir="${app.deploy.dist.lib.dir}">
<fileset dir="${app.lib.dir}">
<include name="**/*" />
</fileset>
</copy>
</target>
<target name="app-create-jar" description="Make application Jar" depends="app-clean, app-build" >
<pathconvert property="jar.classpath.converted" refid="app.jar.classpath" pathsep=" ">
<map from="${app.dir}/" to="" />
<map from="${basedir}/" to="" />
</pathconvert>
<mkdir dir="${app.dist.dir}" />
<jar destfile="${app.dist.dir}/${app.jar.name}">
<fileset dir="${app.build.dir}">
<include name="**/*" />
</fileset>
<manifest>
<attribute name="Main-Class" value="${app.main}" />
<attribute name="Class-Path" value="${jar.classpath.converted}" />
</manifest>
</jar>
<copy todir="${app.dist.lib.dir}">
<fileset dir="${app.lib.dir}">
<include name="**/*" />
</fileset>
</copy>
</target>
</project>

@ -0,0 +1,25 @@
<project name="evo-app-build-jdo" basedir="../">
<import file="common/evo-app-compile-common.xml" />
<import file="common/evo-app-deploy-common.xml" />
<target name="app-build" description="Compiles all application classes" depends="app-prepare,app-pre-build">
<mkdir dir="${app.build.dir}" />
<depend srcdir="${app.src.dir}" destdir="${app.build.dir}" cache="${app.dependencies.chache.dir}">
<include name="**/*.java" />
</depend>
<javac srcdir="${app.src.dir}" destdir="${app.build.dir}" classpathref="app.build.classpath" debug="on" deprecation="on" fork="true" memoryMaximumSize="512M" />
<antcall target="app-datanucleus"/>
<antcall target="app-post-build"/>
</target>
<target name="app-datanucleus">
<path id="jpox.enhancer.classpath">
<fileset dir="${lib.tools.dir}" />
<path refid="app.build.classpath" />
</path>
<taskdef name="jpoxEnhancer" description="JPOX Enhancer" classpathref="jpox.enhancer.classpath" classname="org.datanucleus.enhancer.tools.EnhancerTask" />
<jpoxEnhancer maxmemory="256M" classpathref="jpox.enhancer.classpath" dir="${app.build.dir}" verbose="true"/>
</target>
</project>

@ -0,0 +1,6 @@
<project name="evo-app-build-obfuscate-jdo" basedir="../">
<import file="common/evo-app-compile-common.xml" />
<import file="common/evo-app-deploy-common.xml" />
</project>

@ -0,0 +1,7 @@
<project name="evo-app-build-obfuscate" basedir="../">
<import file="common/evo-app-build-common.xml" />
<import file="common/evo-app-build-obfuscate-common.xml" />
<import file="common/evo-app-deploy-common.xml" />
</project>

@ -0,0 +1,6 @@
<project name="evo-app-build" basedir="../">
<import file="common/evo-app-build-common.xml" />
<import file="common/evo-app-deploy-common.xml" />
</project>

@ -0,0 +1,7 @@
<project name="evo-app-multiple-client-build" basedir="../">
<import file="common/evo-app-multiple-client-common.xml" />
<import file="common/evo-app-build-common.xml" />
<import file="common/evo-app-deploy-common.xml" />
</project>

@ -0,0 +1,6 @@
<project name="evo-app-multiple-client-build" basedir="../">
<import file="common/evo-app-multiple-client-common.xml" />
<import file="evo-app-build-obfuscate.xml" />
</project>

@ -0,0 +1,31 @@
<project name="evo-app-ws-client-build" basedir="../">
<import file="common/evo-app-build-common.xml" />
<path id="jaxws.classpath">
<path refid="lib.tools.classpath"/>
<pathelement location="${java.home}/../lib/tools.jar" />
</path>
<target name="receitas-gen-client" depends="app-build" description="generates client">
<taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport" onerror="ignore">
<classpath refid="lib.tools.classpath" />
</taskdef>
<java fork="false" classname="com.evolute.ssl.InstallCert" classpathref="app.build.classpath">
<arg value="${app.ws.wsdl.url.host}"/>
<arg value="${app.ws.wsdl.url.port}"/>
<arg value="${app.ssl.truststore.file}"/>
<arg value="${app.ssl.truststore.pass}"/>
<arg value="true"/>
<arg value="true"/>
</java>
<wsimport fork="false" debug="true" verbose="true" keep="true" sourcedestdir="${app.src.dir}" package="${app.ws.dest.package}" wsdl="${app.ws.wsdl.url}">
<jvmarg value="-Djavax.net.ssl.trustStore=${basedir}/jssecacerts" />
<jvmarg value="-Djavax.net.ssl.trustStorePassword=changeit" />
<jvmarg value="-Djavax.net.ssl.keyStore=${basedir}/jssecacerts" />
<jvmarg value="-Djavax.net.ssl.keyStorePassword=changeit" />
</wsimport>
</target>
</project>

@ -0,0 +1,14 @@
<project name="evo-gwt-library-build" default="library-deploy" basedir="../">
<target name="app-pre-build">
<copy verbose="true" failonerror="true" overwrite="true" todir="${app.build.dir}">
<fileset dir="${app.src.dir}">
<include name="**/*.java" />
<include name="*.java" />
</fileset>
</copy>
</target>
<import file="evo-library-build.xml" />
</project>

@ -0,0 +1,21 @@
<project name="evo-library-build" default="library-deploy" basedir="../">
<import file="common/evo-app-build-common.xml" />
<target name="deploy-default-project" depends="app-create-jar">
<mkdir dir="${deploy.project.dir}${file.separator}${deploy.project.relative.lib.dir}"/>
<copy failonerror="false" verbose="true" file="${app.dist.dir}/${app.jar.name}" toDir="${deploy.project.dir}${file.separator}${deploy.project.relative.lib.dir}" />
</target>
<target name="deploy-project" if="deploy.project.dir">
<antcall target="deploy-default-project" />
</target>
<target name="library-deploy" description="Deploys current version of evolute utilities" depends="load-static-properties">
<input defaultvalue="${basedir}" addproperty="deploy.project.dir">
<handler classpathref="lib.tools.classpath" classname="com.evolute.ant.ProjectInputHandler" />
</input>
<antcall target="deploy-project" />
</target>
</project>

@ -0,0 +1,21 @@
<project name="evo-tool-build" default="tool-deploy" basedir="../">
<import file="common/evo-app-build-common.xml" />
<target name="deploy-default-tool" depends="app-create-jar">
<mkdir dir="${deploy.project.dir}/lib.tools"/>
<copy failonerror="false" verbose="true" file="${app.dist.dir}/${app.jar.name}" toDir="${deploy.project.dir}/lib.tools" />
</target>
<target name="deploy-to-project" if="deploy.project.dir">
<antcall target="deploy-default-tool" />
</target>
<target name="tool-deploy" description="Deploys current version of evolute utilities" depends="load-static-properties">
<input defaultvalue="${basedir}" addproperty="deploy.project.dir">
<handler classpathref="lib.tools.classpath" classname="com.evolute.ant.ProjectInputHandler" />
</input>
<antcall target="deploy-to-project" />
</target>
</project>

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="evo-web-build" basedir="../" default="build-war">
<import file="common/evo-web-build-common.xml" />
<target name="build-war" depends="web-clean,web-create-jar">
<war destfile="${web.dist.dir}/${ant.project.name}.war" webxml="${basedir}/web/WEB-INF/web.xml">
<fileset dir="${basedir}/web">
<include name="**/*.*" />
<exclude name="WEB-INF/web.xml" />
</fileset>
<lib file="${web.dist.dir}/AnalisesAcidentesTrabalho.jar"/>
</war>
</target>
</project>

@ -881,7 +881,8 @@ public class GestaoUtilizadores extends AbstractPageBean
public void prerender()
{
Utilizador u = getSessionBean1().getCurrentUser();
FacesContext fc = getFacesContext().getCurrentInstance();
getFacesContext();
FacesContext fc = FacesContext.getCurrentInstance();
if(u.getTipo().intValue() != Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP && u.getTipo().intValue() != Global.TIPO_UTILIZADOR_DIRECTOR_GERAL_RH)
{
try

@ -9,7 +9,10 @@
package beans;
import db.data.siprp.outer.AcidentadosData;
import java.io.Serializable;
import java.sql.Date;
/**
*
@ -33,12 +36,155 @@ public class Acidentado implements Serializable
private String nome_superior_hierarquico;
private String email_superior_hierarquico;
private String estabelecimento_origem;
private java.sql.Date data_email_superior_hierarquico;
private java.sql.Date data_email_superior_hierarquico;
/** Creates a new instance of Acidentado */
public Acidentado() {
}
public Integer getId() {
public Acidentado( AcidentadosData acidentadosData )
{
this
.withBilhete_identidade( acidentadosData.getBilhete_identidade() )
.withCod_postal( acidentadosData.getCod_postal() )
.withContacto_telefonico( acidentadosData.getContacto_telefonico() )
.withEmail_superior_hierarquico( acidentadosData.getEmail_superior_hierarquico() )
.withEstabelecimento_origem( acidentadosData.getEstabelecimento_origem() )
.withFuncao( acidentadosData.getFuncao() )
.withId( acidentadosData.getId() )
.withLocalidade( acidentadosData.getLocalidade() )
.withMorada( acidentadosData.getMorada() )
.withNome( acidentadosData.getNome() )
.withNome_superior_hierarquico( acidentadosData.getNome_superior_hierarquico() )
.withNumero_mecanografico( acidentadosData.getNumero_mecanografico() )
.withTrabalhador_id( acidentadosData.getTrabalhador_id() )
.withTurno( acidentadosData.getTurno() );
Date date;
if( acidentadosData.getData_admissao() != null )
{
date = new Date( acidentadosData.getData_admissao().getTime() );
this.setData_admissao( date );
}
if( acidentadosData.getData_email_superior_hierarquico() != null )
{
date = new Date( acidentadosData.getData_email_superior_hierarquico().getTime() );
this.setData_email_superior_hierarquico( date );
}
if( acidentadosData.getData_nascimento() != null )
{
date = new Date( acidentadosData.getData_nascimento().getTime() );
this.setData_nascimento( date );
}
}
public Acidentado withId( final Integer id )
{
this.id = id;
return this;
}
public Acidentado withNome( final String nome )
{
this.nome = nome;
return this;
}
public Acidentado withData_nascimento( final java.sql.Date data_nascimento )
{
this.data_nascimento = data_nascimento;
return this;
}
public Acidentado withBilhete_identidade( final String bilhete_identidade )
{
this.bilhete_identidade = bilhete_identidade;
return this;
}
public Acidentado withMorada( final String morada )
{
this.morada = morada;
return this;
}
public Acidentado withCod_postal( final String cod_postal )
{
this.cod_postal = cod_postal;
return this;
}
public Acidentado withLocalidade( final String localidade )
{
this.localidade = localidade;
return this;
}
public Acidentado withContacto_telefonico( final String contacto_telefonico )
{
this.contacto_telefonico = contacto_telefonico;
return this;
}
public Acidentado withData_admissao( final java.sql.Date data_admissao )
{
this.data_admissao = data_admissao;
return this;
}
public Acidentado withFuncao( final String funcao )
{
this.funcao = funcao;
return this;
}
public Acidentado withTurno( final String turno )
{
this.turno = turno;
return this;
}
public Acidentado withTrabalhador_id( final Integer trabalhador_id )
{
this.trabalhador_id = trabalhador_id;
return this;
}
public Acidentado withNumero_mecanografico( final String numero_mecanografico )
{
this.numero_mecanografico = numero_mecanografico;
return this;
}
public Acidentado withNome_superior_hierarquico( final String nome_superior_hierarquico )
{
this.nome_superior_hierarquico = nome_superior_hierarquico;
return this;
}
public Acidentado withEmail_superior_hierarquico( final String email_superior_hierarquico )
{
this.email_superior_hierarquico = email_superior_hierarquico;
return this;
}
public Acidentado withEstabelecimento_origem( final String estabelecimento_origem )
{
this.estabelecimento_origem = estabelecimento_origem;
return this;
}
public Acidentado withData_email_superior_hierarquico( final java.sql.Date data_email_superior_hierarquico )
{
this.data_email_superior_hierarquico = data_email_superior_hierarquico;
return this;
}
public Integer getId() {
return id;
}

@ -148,7 +148,7 @@ public class AnaliseAcidente implements Serializable
private String comentario_desactivacao;
private Boolean participado;
private String participado_str;
//private String participado_str;
private String nomeResponsavelParticipacao;
private java.util.Date dataParticipacao;
@ -157,7 +157,705 @@ public class AnaliseAcidente implements Serializable
public AnaliseAcidente() {
}
public Integer getId() {
//fluent interface
public static AnaliseAcidente build( )
{
return new AnaliseAcidente( );
}
public AnaliseAcidente end( )
{
return this;
}
public AnaliseAcidente withId( final Integer id )
{
this.id = id;
return this;
}
public AnaliseAcidente withNr( final Integer nr )
{
this.nr = nr;
return this;
}
public AnaliseAcidente withAnalise_nr( final String analise_nr )
{
this.analise_nr = analise_nr;
return this;
}
public AnaliseAcidente withData_acidente( final Date data_acidente )
{
this.data_acidente = data_acidente;
return this;
}
public AnaliseAcidente withAcidentado_id( final Integer acidentado_id )
{
this.acidentado_id = acidentado_id;
return this;
}
public AnaliseAcidente withNome_acidentado( final String nome_acidentado )
{
this.nome_acidentado = nome_acidentado;
return this;
}
public AnaliseAcidente withNumero_mecanografico( final String numero_mecanografico )
{
this.numero_mecanografico = numero_mecanografico;
return this;
}
public AnaliseAcidente withEmpresa_id( final Integer empresa_id )
{
this.empresa_id = empresa_id;
return this;
}
public AnaliseAcidente withEstabelecimento_id( final Integer estabelecimento_id )
{
this.estabelecimento_id = estabelecimento_id;
return this;
}
public AnaliseAcidente withNome_estabelecimento( final String nome_estabelecimento )
{
this.nome_estabelecimento = nome_estabelecimento;
return this;
}
public AnaliseAcidente withEstado( final Integer estado )
{
this.estado = estado;
return this;
}
public AnaliseAcidente withEstado_assinatura( final Integer estado_assinatura )
{
this.estado_assinatura = estado_assinatura;
return this;
}
public AnaliseAcidente withFase( final String fase )
{
this.fase = fase;
return this;
}
public AnaliseAcidente withMorada( final String morada )
{
this.morada = morada;
return this;
}
public AnaliseAcidente withTelefone( final String telefone )
{
this.telefone = telefone;
return this;
}
public AnaliseAcidente withHoras_turno( final Integer horas_turno )
{
this.horas_turno = horas_turno;
return this;
}
public AnaliseAcidente withSeccao( final String seccao )
{
this.seccao = seccao;
return this;
}
public AnaliseAcidente withDepartamento_id( final Integer departamento_id )
{
this.departamento_id = departamento_id;
return this;
}
public AnaliseAcidente withSeccao_id( final Integer seccao_id )
{
this.seccao_id = seccao_id;
return this;
}
public AnaliseAcidente withLocal_trabalho( final String local_trabalho )
{
this.local_trabalho = local_trabalho;
return this;
}
public AnaliseAcidente withTarefa( final String tarefa )
{
this.tarefa = tarefa;
return this;
}
public AnaliseAcidente withSubstancias( final String substancias )
{
this.substancias = substancias;
return this;
}
public AnaliseAcidente withCondicoes( final String condicoes )
{
this.condicoes = condicoes;
return this;
}
public AnaliseAcidente withTestemunhas( final String testemunhas )
{
this.testemunhas = testemunhas;
return this;
}
public AnaliseAcidente withCausas( final Integer causas )
{
this.causas = causas;
return this;
}
public AnaliseAcidente withDescricao( final String descricao )
{
this.descricao = descricao;
return this;
}
public AnaliseAcidente withConclusoes( final String conclusoes )
{
this.conclusoes = conclusoes;
return this;
}
public AnaliseAcidente withAccoes( final String accoes )
{
this.accoes = accoes;
return this;
}
public AnaliseAcidente withHora_acidente( final Time hora_acidente )
{
this.hora_acidente = hora_acidente;
return this;
}
public AnaliseAcidente withFormacao_shst( final String formacao_shst )
{
this.formacao_shst = formacao_shst;
return this;
}
public AnaliseAcidente withFormacao_shst_nao_porque( final String formacao_shst_nao_porque )
{
this.formacao_shst_nao_porque = formacao_shst_nao_porque;
return this;
}
public AnaliseAcidente withOutros_acidentes_com_colaborador( final String outros_acidentes_com_colaborador )
{
this.outros_acidentes_com_colaborador = outros_acidentes_com_colaborador;
return this;
}
public AnaliseAcidente withNr_acidentes_com_colaborador( final Integer nr_acidentes_com_colaborador )
{
this.nr_acidentes_com_colaborador = nr_acidentes_com_colaborador;
return this;
}
public AnaliseAcidente withNr_relatorio_acidente_colaborador1( final Integer nr_relatorio_acidente_colaborador1 )
{
this.nr_relatorio_acidente_colaborador1 = nr_relatorio_acidente_colaborador1;
return this;
}
public AnaliseAcidente withNr_relatorio_acidente_colaborador2( final Integer nr_relatorio_acidente_colaborador2 )
{
this.nr_relatorio_acidente_colaborador2 = nr_relatorio_acidente_colaborador2;
return this;
}
public AnaliseAcidente withNr_relatorio_acidente_colaborador3( final Integer nr_relatorio_acidente_colaborador3 )
{
this.nr_relatorio_acidente_colaborador3 = nr_relatorio_acidente_colaborador3;
return this;
}
public AnaliseAcidente withNr_relatorio_acidente_colaborador4( final Integer nr_relatorio_acidente_colaborador4 )
{
this.nr_relatorio_acidente_colaborador4 = nr_relatorio_acidente_colaborador4;
return this;
}
public AnaliseAcidente withAcidentes_outros_colaboradores( final String acidentes_outros_colaboradores )
{
this.acidentes_outros_colaboradores = acidentes_outros_colaboradores;
return this;
}
public AnaliseAcidente withNr_acidentes_outros_colaboradores( final Integer nr_acidentes_outros_colaboradores )
{
this.nr_acidentes_outros_colaboradores = nr_acidentes_outros_colaboradores;
return this;
}
public AnaliseAcidente withNr_relatorio_acidente_outros_colaboradores1( final Integer nr_relatorio_acidente_outros_colaboradores1 )
{
this.nr_relatorio_acidente_outros_colaboradores1 = nr_relatorio_acidente_outros_colaboradores1;
return this;
}
public AnaliseAcidente withNr_relatorio_acidente_outros_colaboradores2( final Integer nr_relatorio_acidente_outros_colaboradores2 )
{
this.nr_relatorio_acidente_outros_colaboradores2 = nr_relatorio_acidente_outros_colaboradores2;
return this;
}
public AnaliseAcidente withNr_relatorio_acidente_outros_colaboradores3( final Integer nr_relatorio_acidente_outros_colaboradores3 )
{
this.nr_relatorio_acidente_outros_colaboradores3 = nr_relatorio_acidente_outros_colaboradores3;
return this;
}
public AnaliseAcidente withNr_relatorio_acidente_outros_colaboradores4( final Integer nr_relatorio_acidente_outros_colaboradores4 )
{
this.nr_relatorio_acidente_outros_colaboradores4 = nr_relatorio_acidente_outros_colaboradores4;
return this;
}
public AnaliseAcidente withLesao_cabeca( final String lesao_cabeca )
{
this.lesao_cabeca = lesao_cabeca;
return this;
}
public AnaliseAcidente withLesao_pescoco( final String lesao_pescoco )
{
this.lesao_pescoco = lesao_pescoco;
return this;
}
public AnaliseAcidente withLesao_tronco( final String lesao_tronco )
{
this.lesao_tronco = lesao_tronco;
return this;
}
public AnaliseAcidente withLesao_membro_sup_dir( final String lesao_membro_sup_dir )
{
this.lesao_membro_sup_dir = lesao_membro_sup_dir;
return this;
}
public AnaliseAcidente withLesao_membro_sup_esq( final String lesao_membro_sup_esq )
{
this.lesao_membro_sup_esq = lesao_membro_sup_esq;
return this;
}
public AnaliseAcidente withLesao_membro_inf_dir( final String lesao_membro_inf_dir )
{
this.lesao_membro_inf_dir = lesao_membro_inf_dir;
return this;
}
public AnaliseAcidente withLesao_membro_inf_esq( final String lesao_membro_inf_esq )
{
this.lesao_membro_inf_esq = lesao_membro_inf_esq;
return this;
}
public AnaliseAcidente withEspecif1( final String especif1 )
{
this.especif1 = especif1;
return this;
}
public AnaliseAcidente withEspecif2( final String especif2 )
{
this.especif2 = especif2;
return this;
}
public AnaliseAcidente withEspecif3( final String especif3 )
{
this.especif3 = especif3;
return this;
}
public AnaliseAcidente withEspecif4( final String especif4 )
{
this.especif4 = especif4;
return this;
}
public AnaliseAcidente withTipo_lesao( final String tipo_lesao )
{
this.tipo_lesao = tipo_lesao;
return this;
}
public AnaliseAcidente withTipo_incapacidade( final String tipo_incapacidade )
{
this.tipo_incapacidade = tipo_incapacidade;
return this;
}
public AnaliseAcidente withCoef_incapacidade( final Integer coef_incapacidade )
{
this.coef_incapacidade = coef_incapacidade;
return this;
}
public AnaliseAcidente withData_aval_incapacidade( final Date data_aval_incapacidade )
{
this.data_aval_incapacidade = data_aval_incapacidade;
return this;
}
public AnaliseAcidente withData_rev_incapacidade( final Date data_rev_incapacidade )
{
this.data_rev_incapacidade = data_rev_incapacidade;
return this;
}
public AnaliseAcidente withPeriodo_incapacidade_de( final Date periodo_incapacidade_de )
{
this.periodo_incapacidade_de = periodo_incapacidade_de;
return this;
}
public AnaliseAcidente withPeriodo_incapacidade_a( final Date periodo_incapacidade_a )
{
this.periodo_incapacidade_a = periodo_incapacidade_a;
return this;
}
public AnaliseAcidente withImg_flexao( final String img_flexao )
{
this.img_flexao = img_flexao;
return this;
}
public AnaliseAcidente withImg_ext1( final String img_ext1 )
{
this.img_ext1 = img_ext1;
return this;
}
public AnaliseAcidente withImg_ext2( final String img_ext2 )
{
this.img_ext2 = img_ext2;
return this;
}
public AnaliseAcidente withImg_cab2( final String img_cab2 )
{
this.img_cab2 = img_cab2;
return this;
}
public AnaliseAcidente withImg_cab3( final String img_cab3 )
{
this.img_cab3 = img_cab3;
return this;
}
public AnaliseAcidente withImg_ma2( final String img_ma2 )
{
this.img_ma2 = img_ma2;
return this;
}
public AnaliseAcidente withImg_ma3( final String img_ma3 )
{
this.img_ma3 = img_ma3;
return this;
}
public AnaliseAcidente withImg_ma5( final String img_ma5 )
{
this.img_ma5 = img_ma5;
return this;
}
public AnaliseAcidente withImg_ma6( final String img_ma6 )
{
this.img_ma6 = img_ma6;
return this;
}
public AnaliseAcidente withImg_ma8( final String img_ma8 )
{
this.img_ma8 = img_ma8;
return this;
}
public AnaliseAcidente withImg_ma10( final String img_ma10 )
{
this.img_ma10 = img_ma10;
return this;
}
public AnaliseAcidente withImg_rot1( final String img_rot1 )
{
this.img_rot1 = img_rot1;
return this;
}
public AnaliseAcidente withImg_rot2( final String img_rot2 )
{
this.img_rot2 = img_rot2;
return this;
}
public AnaliseAcidente withImg_cab1( final String img_cab1 )
{
this.img_cab1 = img_cab1;
return this;
}
public AnaliseAcidente withImg_cab4( final String img_cab4 )
{
this.img_cab4 = img_cab4;
return this;
}
public AnaliseAcidente withImg_ma1( final String img_ma1 )
{
this.img_ma1 = img_ma1;
return this;
}
public AnaliseAcidente withImg_ma4( final String img_ma4 )
{
this.img_ma4 = img_ma4;
return this;
}
public AnaliseAcidente withImg_ma7( final String img_ma7 )
{
this.img_ma7 = img_ma7;
return this;
}
public AnaliseAcidente withImg_ma9( final String img_ma9 )
{
this.img_ma9 = img_ma9;
return this;
}
public AnaliseAcidente withRestricao_carga( final Integer restricao_carga )
{
this.restricao_carga = restricao_carga;
return this;
}
public AnaliseAcidente withRestricao_motricidade( final String restricao_motricidade )
{
this.restricao_motricidade = restricao_motricidade;
return this;
}
public AnaliseAcidente withRestricao_conducao( final String restricao_conducao )
{
this.restricao_conducao = restricao_conducao;
return this;
}
public AnaliseAcidente withRestricao_vibracoes( final String restricao_vibracoes )
{
this.restricao_vibracoes = restricao_vibracoes;
return this;
}
public AnaliseAcidente withRestricao_outras( final String restricao_outras )
{
this.restricao_outras = restricao_outras;
return this;
}
public AnaliseAcidente withMed_observ( final String med_observ )
{
this.med_observ = med_observ;
return this;
}
public AnaliseAcidente withMedico_id( final Integer medico_id )
{
this.medico_id = medico_id;
return this;
}
public AnaliseAcidente withTecnico_saude_id( final Integer tecnico_saude_id )
{
this.tecnico_saude_id = tecnico_saude_id;
return this;
}
public AnaliseAcidente withAss_consolidacao( final String ass_consolidacao )
{
this.ass_consolidacao = ass_consolidacao;
return this;
}
public AnaliseAcidente withAss_resp_seg( final String ass_resp_seg )
{
this.ass_resp_seg = ass_resp_seg;
return this;
}
public AnaliseAcidente withAss_resp_rh( final String ass_resp_rh )
{
this.ass_resp_rh = ass_resp_rh;
return this;
}
public AnaliseAcidente withData_consolidacao( final Date data_consolidacao )
{
this.data_consolidacao = data_consolidacao;
return this;
}
public AnaliseAcidente withData_assinatura_seg( final Date data_assinatura_seg )
{
this.data_assinatura_seg = data_assinatura_seg;
return this;
}
public AnaliseAcidente withData_assinatura_rh( final Date data_assinatura_rh )
{
this.data_assinatura_rh = data_assinatura_rh;
return this;
}
public AnaliseAcidente withNome_resp_seg( final String nome_resp_seg )
{
this.nome_resp_seg = nome_resp_seg;
return this;
}
public AnaliseAcidente withNome_resp_rh( final String nome_resp_rh )
{
this.nome_resp_rh = nome_resp_rh;
return this;
}
public AnaliseAcidente withCorrecao( final String correcao )
{
this.correcao = correcao;
return this;
}
public AnaliseAcidente withEstado_antes_correcao( final Integer estado_antes_correcao )
{
this.estado_antes_correcao = estado_antes_correcao;
return this;
}
public AnaliseAcidente withObservacoes_correcao( final String observacoes_correcao )
{
this.observacoes_correcao = observacoes_correcao;
return this;
}
public AnaliseAcidente withAss_superior( final String ass_superior )
{
this.ass_superior = ass_superior;
return this;
}
public AnaliseAcidente withNome_superior( final String nome_superior )
{
this.nome_superior = nome_superior;
return this;
}
public AnaliseAcidente withData_assinatura_superior( final Date data_assinatura_superior )
{
this.data_assinatura_superior = data_assinatura_superior;
return this;
}
public AnaliseAcidente withAveriguador( final String averiguador )
{
this.averiguador = averiguador;
return this;
}
public AnaliseAcidente withAveriguacao_posterior( final String averiguacao_posterior )
{
this.averiguacao_posterior = averiguacao_posterior;
return this;
}
public AnaliseAcidente withAveriguacao_obs( final String averiguacao_obs )
{
this.averiguacao_obs = averiguacao_obs;
return this;
}
public AnaliseAcidente withNome_resp_consolidacao( final String nome_resp_consolidacao )
{
this.nome_resp_consolidacao = nome_resp_consolidacao;
return this;
}
public AnaliseAcidente withData_inicio_processo( final Date data_inicio_processo )
{
this.data_inicio_processo = data_inicio_processo;
return this;
}
public AnaliseAcidente withRh_fase4( final Integer rh_fase4 )
{
this.rh_fase4 = rh_fase4;
return this;
}
public AnaliseAcidente withConcluido_por_desactivacao( final Boolean concluido_por_desactivacao )
{
this.concluido_por_desactivacao = concluido_por_desactivacao;
return this;
}
public AnaliseAcidente withData_desactivacao( final java.util.Date data_desactivacao )
{
this.data_desactivacao = data_desactivacao;
return this;
}
public AnaliseAcidente withComentario_desactivacao( final String comentario_desactivacao )
{
this.comentario_desactivacao = comentario_desactivacao;
return this;
}
public AnaliseAcidente withParticipado( final Boolean participado )
{
this.participado = participado;
return this;
}
public AnaliseAcidente withNomeResponsavelParticipacao( final String nomeResponsavelParticipacao )
{
this.nomeResponsavelParticipacao = nomeResponsavelParticipacao;
return this;
}
public AnaliseAcidente withDataParticipacao( final java.util.Date dataParticipacao )
{
this.dataParticipacao = dataParticipacao;
return this;
}
//Tradicional getters and setters
public Integer getId() {
return id;
}

@ -9,6 +9,8 @@
package beans;
import db.data.siprp.outer.CausasData;
import java.io.Serializable;
/**
@ -24,7 +26,25 @@ public class Causa implements Serializable
public Causa() {
}
public Integer getId() {
public Causa( CausasData causa )
{
this.withId( causa.getId() )
.withCausa( causa.getCausa() );
}
public Causa withId( final Integer id )
{
this.id = id;
return this;
}
public Causa withCausa( final String causa )
{
this.causa = causa;
return this;
}
public Integer getId() {
return id;
}

@ -9,6 +9,8 @@
package beans;
import db.data.siprp.outer.DepartamentosData;
import java.io.Serializable;
/**
@ -25,7 +27,32 @@ public class Departamento implements Serializable
public Departamento() {
}
public Integer getId() {
public Departamento( DepartamentosData departamentosData )
{
this.withId( departamentosData.getId() )
.withDescricao( departamentosData.getDescricao() )
.withActivo( departamentosData.getActivo() );
}
public Departamento withId( final Integer id )
{
this.id = id;
return this;
}
public Departamento withDescricao( final String descricao )
{
this.descricao = descricao;
return this;
}
public Departamento withActivo( final String activo )
{
this.activo = activo;
return this;
}
public Integer getId() {
return id;
}

@ -9,6 +9,8 @@
package beans;
import db.data.siprp_local.outer.EstabelecimentosData;
import java.io.Serializable;
/**
@ -25,7 +27,32 @@ public class Estabelecimento implements Serializable
public Estabelecimento() {
}
public Integer getId() {
public Estabelecimento( EstabelecimentosData estabelecimentosData )
{
this.withId( estabelecimentosData.getId() )
.withNome( estabelecimentosData.getNome() )
.withNome_plain( estabelecimentosData.getNome_plain() );
}
public Estabelecimento withId( final Integer id )
{
this.id = id;
return this;
}
public Estabelecimento withNome_plain( final String nome_plain )
{
this.nome_plain = nome_plain;
return this;
}
public Estabelecimento withNome( final String nome )
{
this.nome = nome;
return this;
}
public Integer getId() {
return id;
}

@ -15,7 +15,7 @@ public class EstatisticaProcessoBean implements Serializable
{
private Integer estado = null;
private String fase = null;
private Long count = new Long( 0 );
private Long count = 0l;
public EstatisticaProcessoBean()
{

@ -9,6 +9,8 @@
package beans;
import db.data.siprp_local.outer.MedicosData;
import java.io.Serializable;
/**
@ -25,7 +27,33 @@ public class Medico implements Serializable
public Medico() {
}
public Integer getId() {
public Medico( MedicosData medicosData )
{
this.withId( medicosData.getId() )
.withNome( medicosData.getNome() )
.withNumero_cedula( medicosData.getNumero_cedula() );
}
public Medico withId( final Integer id )
{
this.id = id;
return this;
}
public Medico withNome( final String nome )
{
this.nome = nome;
return this;
}
public Medico withNumero_cedula( final String numero_cedula )
{
this.numero_cedula = numero_cedula;
return this;
}
public Integer getId() {
return id;
}

@ -9,6 +9,8 @@
package beans;
import db.data.siprp.outer.MedidasData;
import java.io.Serializable;
/**
@ -25,7 +27,32 @@ public class Medida implements Serializable
public Medida() {
}
public Integer getId() {
public Medida( MedidasData medidasData )
{
this.withId( medidasData.getId() )
.withAnalise_id( medidasData.getAnalise_id() )
.withMedida( medidasData.getMedida() );
}
public Medida withId( final Integer id )
{
this.id = id;
return this;
}
public Medida withAnalise_id( final Integer analise_id )
{
this.analise_id = analise_id;
return this;
}
public Medida withMedida( final String medida )
{
this.medida = medida;
return this;
}
public Integer getId() {
return id;
}

@ -9,6 +9,8 @@
package beans;
import db.data.siprp.outer.RecomendacoesData;
import java.io.Serializable;
/**
@ -25,7 +27,32 @@ public class Recomendacao implements Serializable
public Recomendacao() {
}
public Integer getId() {
public Recomendacao( RecomendacoesData recomendacoesData )
{
this.withId( recomendacoesData.getId() )
.withAnalise_id( recomendacoesData.getAnalise_id() )
.withRecomendacao( recomendacoesData.getRecomendacao() );
}
public Recomendacao withId( final Integer id )
{
this.id = id;
return this;
}
public Recomendacao withAnalise_id( final Integer analise_id )
{
this.analise_id = analise_id;
return this;
}
public Recomendacao withRecomendacao( final String recomendacao )
{
this.recomendacao = recomendacao;
return this;
}
public Integer getId() {
return id;
}

@ -9,6 +9,8 @@
package beans;
import db.data.siprp.outer.SeccoesData;
import java.io.Serializable;
/**
@ -26,7 +28,39 @@ public class Seccao implements Serializable
public Seccao() {
}
public Integer getId() {
public Seccao( SeccoesData seccoesData )
{
this.withId( seccoesData.getId() )
.withActivo( seccoesData.getActivo() )
.withDepartamento_id( seccoesData.getDepartamento_id() )
.withDescricao( seccoesData.getDescricao() );
}
public Seccao withId( final Integer id )
{
this.id = id;
return this;
}
public Seccao withDescricao( final String descricao )
{
this.descricao = descricao;
return this;
}
public Seccao withDepartamento_id( final Integer departamento_id )
{
this.departamento_id = departamento_id;
return this;
}
public Seccao withActivo( final String activo )
{
this.activo = activo;
return this;
}
public Integer getId() {
return id;
}

@ -9,6 +9,8 @@
package beans;
import db.data.siprp_local.outer.MarcacoesTecnicosHstData;
import java.io.Serializable;
/**
@ -24,7 +26,24 @@ public class TecnicoSaude implements Serializable
public TecnicoSaude() {
}
public Integer getId() {
public TecnicoSaude( MarcacoesTecnicosHstData marcacoesTecnicosHstData )
{
this.withId( marcacoesTecnicosHstData.getId() ).withNome( marcacoesTecnicosHstData.getNome() );
}
public TecnicoSaude withId( final Integer id )
{
this.id = id;
return this;
}
public TecnicoSaude withNome( final String nome )
{
this.nome = nome;
return this;
}
public Integer getId() {
return id;
}

@ -9,6 +9,8 @@
package beans;
import db.data.siprp.outer.TiposUtilizadoresData;
import java.io.Serializable;
/**
@ -27,7 +29,75 @@ public class TipoUtilizador implements Serializable
public TipoUtilizador() {
}
public Integer getId() {
public TipoUtilizador( TiposUtilizadoresData tiposUtilizadoresData )
{
this.withId( tiposUtilizadoresData.getId() )
.withOrdem( tiposUtilizadoresData.getOrdem() )
.withActivo( tiposUtilizadoresData.getActivo() )
.withDescricao( tiposUtilizadoresData.getDescricao() )
.withTipo( tiposUtilizadoresData.getTipo() );
}
public TipoUtilizador( TiposUtilizadoresData tiposUtilizadoresData, Integer permissao )
{
if( permissao.equals( 7 ) )
{
if( tiposUtilizadoresData.getTipo().equals( 1 ) ||
tiposUtilizadoresData.getTipo().equals( 2 ) ||
tiposUtilizadoresData.getTipo().equals( 6 ) )
{
this.withId( tiposUtilizadoresData.getId() )
.withDescricao( tiposUtilizadoresData.getDescricao() )
.withOrdem( tiposUtilizadoresData.getOrdem() )
.withActivo( tiposUtilizadoresData.getActivo() )
.withTipo( tiposUtilizadoresData.getTipo() );
}
else
{
this.withTipo( tiposUtilizadoresData.getTipo() );
}
}
else
{
this.withId( tiposUtilizadoresData.getId() )
.withOrdem( tiposUtilizadoresData.getOrdem() )
.withActivo( tiposUtilizadoresData.getActivo() )
.withDescricao( tiposUtilizadoresData.getDescricao() )
.withTipo( tiposUtilizadoresData.getTipo() );
}
}
public TipoUtilizador withId( final Integer id )
{
this.id = id;
return this;
}
public TipoUtilizador withTipo( final Integer tipo )
{
this.tipo = tipo;
return this;
}
public TipoUtilizador withDescricao( final String descricao )
{
this.descricao = descricao;
return this;
}
public TipoUtilizador withActivo( final String activo )
{
this.activo = activo;
return this;
}
public TipoUtilizador withOrdem( final Integer ordem )
{
this.ordem = ordem;
return this;
}
public Integer getId() {
return id;
}

@ -9,7 +9,10 @@
package beans;
import db.data.siprp_local.outer.TrabalhadoresData;
import java.io.Serializable;
import java.sql.Date;
/**
*
@ -31,7 +34,73 @@ public class Trabalhador implements Serializable
public Trabalhador() {
}
public Integer getId() {
public Trabalhador( TrabalhadoresData trabalhadoresData )
{
this
.withId( trabalhadoresData.getId() )
.withNome( trabalhadoresData.getNome() )
.withNumero_mecanografico( trabalhadoresData.getNumero_mecanografico() )
.withFuncao( trabalhadoresData.getFuncao_proposta() )
.withEstabelecimento_id( trabalhadoresData.getEstabelecimento_id() )
.withEstabelecimento( trabalhadoresData.toEstabelecimento_id().getNome() )
.withData_admissao( new Date( trabalhadoresData.getData_admissao().getTime() ) )
.withData_nascimento( new Date( trabalhadoresData.getData_nascimento().getTime() ) );
}
public static Trabalhador createTrabalhador( )
{
return new Trabalhador();
}
public Trabalhador withId( final Integer id )
{
this.id = id;
return this;
}
public Trabalhador withNome( final String nome )
{
this.nome = nome;
return this;
}
public Trabalhador withData_nascimento( final java.sql.Date data_nascimento )
{
this.data_nascimento = data_nascimento;
return this;
}
public Trabalhador withFuncao( final String funcao )
{
this.funcao = funcao;
return this;
}
public Trabalhador withData_admissao( final java.sql.Date data_admissao )
{
this.data_admissao = data_admissao;
return this;
}
public Trabalhador withNumero_mecanografico( final String numero_mecanografico )
{
this.numero_mecanografico = numero_mecanografico;
return this;
}
public Trabalhador withEstabelecimento_id( final Integer estabelecimento_id )
{
this.estabelecimento_id = estabelecimento_id;
return this;
}
public Trabalhador withEstabelecimento( final String estabelecimento )
{
this.estabelecimento = estabelecimento;
return this;
}
public Integer getId() {
return id;
}

@ -9,6 +9,9 @@
package beans;
import db.data.siprp.outer.UtilizadoresData;
import org.apache.commons.lang.builder.ToStringBuilder;
import java.io.Serializable;
import java.sql.Date;
@ -58,7 +61,181 @@ public class Utilizador implements Serializable
public Utilizador() {
}
public Integer getId() {
public Utilizador( UtilizadoresData utilizadoresData )
{
this.withId( utilizadoresData.getId() )
.withLogin( utilizadoresData.getLogin() )
.withPassword( utilizadoresData.getPassword() )
.withData_password( new Date( utilizadoresData.getData_password().getTime() ) )
.withEmail( utilizadoresData.getEmail() )
.withEmpresa_id( utilizadoresData.getEmpresa_id() )
.withEstabelecimento_id( utilizadoresData.getEstabelecimento_id() )
.withAdministrador( utilizadoresData.getAdministrador() )
.withTipo( utilizadoresData.getTipo() )
.withNumero_cedula( utilizadoresData.getNumero_cedula() )
.withCap( utilizadoresData.getCap() )
.withNome( utilizadoresData.getNome() )
.withMedico_id( utilizadoresData.getMedico_id() )
.withFuncionario_hst_id( utilizadoresData.getFuncionario_hst_id() )
.withActivo( utilizadoresData.getActivo() )
.withResponsavel_loja( utilizadoresData.getResponsavel_loja() )
.withGestor_geral( utilizadoresData.getGestor_geral() )
.withPrimeiro_login( utilizadoresData.getPrimeiro_login() )
.withApagado( utilizadoresData.getApagado() );
}
public Utilizador withId( final Integer id )
{
this.id = id;
return this;
}
public Utilizador withLogin( final String login )
{
this.login = login;
return this;
}
public Utilizador withPassword( final String password )
{
this.password = password;
return this;
}
public Utilizador withEmail( final String email )
{
this.email = email;
return this;
}
public Utilizador withEmpresa_id( final Integer empresa_id )
{
this.empresa_id = empresa_id;
return this;
}
public Utilizador withEstabelecimento_id( final Integer estabelecimento_id )
{
this.estabelecimento_id = estabelecimento_id;
return this;
}
public Utilizador withAdministrador( final String administrador )
{
this.administrador = administrador;
return this;
}
public Utilizador withTipo( final Integer tipo )
{
this.tipo = tipo;
return this;
}
public Utilizador withNumero_cedula( final String numero_cedula )
{
this.numero_cedula = numero_cedula;
return this;
}
public Utilizador withCap( final String cap )
{
this.cap = cap;
return this;
}
public Utilizador withCodigo_permissao( final Integer codigo_permissao )
{
this.codigo_permissao = codigo_permissao;
return this;
}
public Utilizador withNome( final String nome )
{
this.nome = nome;
return this;
}
public Utilizador withMedico_id( final Integer medico_id )
{
this.medico_id = medico_id;
return this;
}
public Utilizador withFuncionario_hst_id( final Integer funcionario_hst_id )
{
this.funcionario_hst_id = funcionario_hst_id;
return this;
}
public Utilizador withActivo( final String activo )
{
this.activo = activo;
return this;
}
public Utilizador withAcesso( final Integer acesso )
{
this.acesso = acesso;
return this;
}
public Utilizador withResponsavel_loja( final String responsavel_loja )
{
this.responsavel_loja = responsavel_loja;
return this;
}
public Utilizador withGestor_geral( final String gestor_geral )
{
this.gestor_geral = gestor_geral;
return this;
}
public Utilizador withNumero_mecanografico( final String numero_mecanografico )
{
this.numero_mecanografico = numero_mecanografico;
return this;
}
public Utilizador withCategoria( final String categoria )
{
this.categoria = categoria;
return this;
}
public Utilizador withNome_estabelecimento( final String nome_estabelecimento )
{
this.nome_estabelecimento = nome_estabelecimento;
return this;
}
public Utilizador withPrimeiro_login( final String primeiro_login )
{
this.primeiro_login = primeiro_login;
return this;
}
public Utilizador withApagado( final String apagado )
{
this.apagado = apagado;
return this;
}
public Utilizador withData_password( final Date data_password )
{
this.data_password = data_password;
return this;
}
public Utilizador withEstabelecimento_gestor( final Integer estabelecimento_gestor )
{
this.estabelecimento_gestor = estabelecimento_gestor;
return this;
}
public Integer getId() {
return id;
}
@ -270,5 +447,20 @@ public class Utilizador implements Serializable
public void setEstabelecimento_gestor(Integer estabelecimento_gestor) {
this.estabelecimento_gestor = estabelecimento_gestor;
}
public static Utilizador createUtilizador( )
{
return new Utilizador( );
}
public static Utilizador createUtilizador( UtilizadoresData utilizadoresData )
{
return new Utilizador( utilizadoresData );
}
@Override
public String toString()
{
return new ToStringBuilder( this ).append( "id", id ).append( "login", login ).append( "password", password ).append( "email", email ).append( "empresa_id", empresa_id ).append( "estabelecimento_id", estabelecimento_id ).append( "administrador", administrador ).append( "tipo", tipo ).append( "numero_cedula", numero_cedula ).append( "cap", cap ).append( "codigo_permissao", codigo_permissao ).append( "nome", nome ).append( "medico_id", medico_id ).append( "funcionario_hst_id", funcionario_hst_id ).append( "activo", activo ).append( "acesso", acesso ).append( "responsavel_loja", responsavel_loja ).append( "gestor_geral", gestor_geral ).append( "numero_mecanografico", numero_mecanografico ).append( "categoria", categoria ).append( "nome_estabelecimento", nome_estabelecimento ).append( "primeiro_login", primeiro_login ).append( "apagado", apagado ).append( "data_password", data_password ).append( "estabelecimento_gestor", estabelecimento_gestor ).toString();
}
}

@ -18,12 +18,6 @@ public interface DBConstants
public static final String DEFAULT_PROVIDER = Singleton.DEFAULT_OBJECT_PROVIDER;
public static final String LOCAL_PROVIDER = "LOCAL_PROVIDER";
public static final String DEFAULT_DBMANAGER = "DEFAULT_DBMANAGER";
public static final String LOCAL_DBMANAGER = "LOCAL_DBMANAGER";
public static final String SESSION_CONNECTION = "SESSION_CONNECTION";
public static final String SESSION_CONNECTION_LOCAL = "SESSION_CONNECTION_LOCAL";
public static final String SERVER_SIPRP = "server.siprp";
public static final String PORT_SIPRP = "port.siprp";
public static final String DATABASE_SIPRP = "database.siprp";

@ -5,6 +5,9 @@
package db;
import db.data.siprp.outer.AcidentadosData;
import db.data.siprp.outer.AnalisesAcidentesData;
/**
*
* @author dneves
@ -18,25 +21,26 @@ public interface EstatisticasConstants
//TODO: falta os 2 ultimos
};
public static final String KEY_POR = "acidentados.numero_mecanografico";
public static final String KEY_NOME = "acidentados.nome";
public static final String KEY_POR = AcidentadosData.NUMERO_MECANOGRAFICO_FULL;
public static final String KEY_NOME = AcidentadosData.NOME_FULL;
public static final String KEY_ANO_OCORRENCIA = "date_part( 'year', " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )";
public static final String KEY_DATA_OCORRENCIA = AnalisesAcidentesData.DATA_ACIDENTE_FULL;
public static final String KEY_HORA_OCORRENCIA = AnalisesAcidentesData.HORA_ACIDENTE_FULL;
public static final String KEY_HORAS_TRABALHADAS = AnalisesAcidentesData.HORAS_TURNO_FULL;
public static final String KEY_ANO_OCORRENCIA = "date_part( 'year', analises_acidentes.data_acidente )";
public static final String KEY_DATA_OCORRENCIA = "analises_acidentes.data_acidente";
public static final String KEY_HORA_OCORRENCIA = "analises_acidentes.hora_acidente";
public static final String KEY_HORAS_TRABALHADAS = "analises_acidentes.horas_turno";
public static final String KEY_ESTABELECIMENTO = AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL;
public static final String KEY_EMPRESA = AnalisesAcidentesData.EMPRESA_ID_FULL;
// public static final String KEY_DEPARTAMENTO = "departamentos.descricao";
public static final String KEY_ESTABELECIMENTO = "analises_acidentes.estabelecimento_id";
public static final String KEY_SECCAO = "analises_acidentes.seccao_id";
public static final String KEY_SECCAO = AnalisesAcidentesData.SECCAO_ID_FULL;
public static final String KEY_CAUSAS_ACIDENTE = "analises_acidentes.causas";
public static final String KEY_CAUSAS_ACIDENTE = AnalisesAcidentesData.CAUSAS_FULL;
public static final String KEY_TURNO_TRABALHO = "acidentados.turno";
public static final String KEY_TURNO_TRABALHO = AcidentadosData.TURNO_FULL;
public static final String KEY_FORMACAO_SHST = "analises_acidentes.formacao_shst";
public static final String KEY_FORMACAO_SHST = AnalisesAcidentesData.FORMACAO_SHST_FULL;
public static final String KEY_PARTICIPADO_SEGURO = "analises_acidentes.participado";
public static final String KEY_PARTICIPADO_SEGURO = AnalisesAcidentesData.PARTICIPADO_FULL;
public static final String KEY_POSTO_ACIDENTADO = "posto_acidentado";
public static final String KEY_OUTROS_ACIDENTADOS = "outros_acidentados";

@ -8,6 +8,8 @@
package db.data.siprp.outer;
import beans.Correcao;
public final class AnalisesAcidentesData extends db.data.siprp.inner.AnalisesAcidentes
{
@ -15,4 +17,12 @@ public final class AnalisesAcidentesData extends db.data.siprp.inner.AnalisesAci
{
super();
}
public void update( Correcao c )
{
this.setCorrecao( c.getCorrecao() );
this.setEstado( c.getEstado_corr() );
this.setEstado_antes_correcao( c.getEstado_actual() );
this.setObservacoes_correcao( c.getObservacoes() );
}
}

@ -8,6 +8,11 @@
package db.data.siprp.outer;
import beans.Permissao;
import com.evolute.entity.ProviderInterface;
import com.evolute.entity.evo.EvoDataException;
import com.evolute.entity.evo.EvoDataObject;
public final class PermissoesData extends db.data.siprp.inner.Permissoes
{
@ -15,4 +20,51 @@ public final class PermissoesData extends db.data.siprp.inner.Permissoes
{
super();
}
public PermissoesData( Permissao permissao )
{
this.withCodigo_permissao( permissao.getCodigo_permissao() )
.withUser_id( permissao.getUser_id() );
}
public static PermissoesData createPermissao( Permissao permissao )
{
return new PermissoesData( permissao );
}
public PermissoesData withCodigo_permissao( final Integer codigo_permissao )
{
this.setCodigo_permissao( codigo_permissao );
return this;
}
public PermissoesData withUser_id( final Integer user_id )
{
this.setUser_id( user_id );
return this;
}
public PermissoesData withId( final Integer id )
{
this.setId( id );
return this;
}
public PermissoesData withProvider( ProviderInterface< EvoDataObject< ? >, EvoDataException > provider )
{
this.setProvider( provider );
return this;
}
public PermissoesData refreshMe() throws EvoDataException
{
this.refresh();
return this;
}
public PermissoesData saveMe() throws EvoDataException
{
this.save();
return this;
}
}

@ -8,6 +8,11 @@
package db.data.siprp.outer;
import beans.Utilizador;
import com.evolute.entity.ProviderInterface;
import com.evolute.entity.evo.EvoDataException;
import com.evolute.entity.evo.EvoDataObject;
public final class UtilizadoresData extends db.data.siprp.inner.Utilizadores
{
@ -15,4 +20,186 @@ public final class UtilizadoresData extends db.data.siprp.inner.Utilizadores
{
super();
}
public static UtilizadoresData createUtilizador( )
{
return new UtilizadoresData( );
}
public static UtilizadoresData createUtilizador( Utilizador utilizador )
{
return new UtilizadoresData( utilizador );
}
public UtilizadoresData( Utilizador utilizador )
{
update( utilizador );
}
public UtilizadoresData withBackup_email2( final String backup_email2 )
{
this.setBackup_email2( backup_email2 );
return this;
}
public UtilizadoresData withData_password( final java.util.Date data_password )
{
this.setData_password( data_password );
return this;
}
public UtilizadoresData withApagado( final String apagado )
{
this.setApagado( apagado );
return this;
}
public UtilizadoresData withPrimeiro_login( final String primeiro_login )
{
this.setPrimeiro_login( primeiro_login );
return this;
}
public UtilizadoresData withGestor_geral( final String gestor_geral )
{
this.setGestor_geral( gestor_geral );
return this;
}
public UtilizadoresData withNumero_mecanografico( final String numero_mecanografico )
{
this.setNumero_mecanografico( numero_mecanografico );
return this;
}
public UtilizadoresData withResponsavel_loja( final String responsavel_loja )
{
this.setResponsavel_loja( responsavel_loja );
return this;
}
public UtilizadoresData withActivo( final String activo )
{
this.setActivo( activo );
return this;
}
public UtilizadoresData withFuncionario_hst_id( final Integer funcionario_hst_id )
{
this.setFuncionario_hst_id( funcionario_hst_id );
return this;
}
public UtilizadoresData withNome( final String nome )
{
this.setNome( nome );
return this;
}
public UtilizadoresData withCap( final String cap )
{
this.setCap( cap );
return this;
}
public UtilizadoresData withNumero_cedula( final String numero_cedula )
{
this.setNumero_cedula( numero_cedula );
return this;
}
public UtilizadoresData withTipo( final Integer tipo )
{
this.setTipo( tipo );
return this;
}
public UtilizadoresData withMedico_id( final Integer medico_id )
{
this.setMedico_id( medico_id );
return this;
}
public UtilizadoresData withAdministrador( final String administrador )
{
this.setAdministrador( administrador );
return this;
}
public UtilizadoresData withEstabelecimento_id( final Integer estabelecimento_id )
{
this.setEstabelecimento_id( estabelecimento_id );
return this;
}
public UtilizadoresData withEmpresa_id( final Integer empresa_id )
{
this.setEmpresa_id( empresa_id );
return this;
}
public UtilizadoresData withEmail( final String email )
{
this.setEmail( email );
return this;
}
public UtilizadoresData withPassword( final String password )
{
this.setPassword( password );
return this;
}
public UtilizadoresData withLogin( final String login )
{
this.setLogin( login );
return this;
}
public UtilizadoresData withId( final Integer id )
{
this.setId( id );
return this;
}
public UtilizadoresData withProvider( final ProviderInterface< EvoDataObject< ? >, EvoDataException > provider )
{
this.setProvider( provider );
return this;
}
public UtilizadoresData saveMe( ) throws EvoDataException
{
this.save();
return this;
}
public UtilizadoresData refreshMe( ) throws EvoDataException
{
this.refresh();
return this;
}
public UtilizadoresData update( Utilizador utilizador )
{
return this.withActivo( utilizador.getActivo() )
.withAdministrador( utilizador.getAdministrador() )
.withApagado( utilizador.getApagado() )
.withCap( utilizador.getCap() )
.withData_password( utilizador.getData_password() )
.withEmail( utilizador.getEmail() )
.withEmpresa_id( utilizador.getEmpresa_id() )
.withEstabelecimento_id( utilizador.getEstabelecimento_id() )
.withFuncionario_hst_id( utilizador.getFuncionario_hst_id() )
.withGestor_geral( utilizador.getGestor_geral() )
.withLogin( utilizador.getLogin() )
.withMedico_id( utilizador.getMedico_id() )
.withNome( utilizador.getNome() )
.withNumero_cedula( utilizador.getNumero_cedula() )
.withNumero_mecanografico( utilizador.getNumero_mecanografico() )
.withPassword( utilizador.getPassword() )
.withPrimeiro_login( utilizador.getPrimeiro_login() )
.withResponsavel_loja( utilizador.getResponsavel_loja() )
.withTipo( utilizador.getTipo() );
}
}

@ -14,10 +14,11 @@ import com.evolute.utils.sql.Field;
import com.evolute.utils.sql.Select;
import com.evolute.utils.sql.Select2;
import com.sun.rave.web.ui.model.Option;
import db.data.siprp.outer.AcidentadosData;
import db.data.siprp.outer.AnalisesAcidentesData;
import db.data.siprp.outer.CausasData;
import db.data.siprp.outer.SeccoesData;
import db.data.siprp_local.outer.EstabelecimentosData;
import global.Global;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -51,15 +52,6 @@ public class EstatisticasDataProvider extends GenericDataProvider
return INSTANCE;
}
// private Statement createStatement()
// {
// if ( db == null )
// {
// db = new Db();
// }
// return db.createStatement();
// }
public List< EstatisticaProcessoBean > getEstatisticas( Map< String, Object > searchProperties )
{
String por = ( String ) searchProperties.get( EstatisticasConstants.KEY_POR );
@ -68,52 +60,52 @@ public class EstatisticasDataProvider extends GenericDataProvider
Date dataOcorrencia = ( Date ) searchProperties.get( EstatisticasConstants.KEY_DATA_OCORRENCIA );
String horaOcorrencia = ( String ) searchProperties.get( EstatisticasConstants.KEY_HORA_OCORRENCIA );
String horasTrabalhadas = ( String ) searchProperties.get( EstatisticasConstants.KEY_HORAS_TRABALHADAS );
// String departamento = ( String ) searchProperties.get( EstatisticasConstants.KEY_DEPARTAMENTO );
Integer estabelecimentoID = ( Integer ) searchProperties.get( EstatisticasConstants.KEY_ESTABELECIMENTO );
Integer seccaoID = ( Integer ) searchProperties.get( EstatisticasConstants.KEY_SECCAO );
Integer causas = ( Integer ) searchProperties.get( EstatisticasConstants.KEY_CAUSAS_ACIDENTE );
String turno = ( String ) searchProperties.get( EstatisticasConstants.KEY_TURNO_TRABALHO );
Boolean formacao_shst = ( Boolean ) searchProperties.get( EstatisticasConstants.KEY_FORMACAO_SHST );
Boolean participado_seguro = ( Boolean ) searchProperties.get( EstatisticasConstants.KEY_PARTICIPADO_SEGURO );
Boolean postoAcidentado = ( Boolean ) searchProperties.get( EstatisticasConstants.KEY_POSTO_ACIDENTADO );
Boolean outrosAcidentados = ( Boolean ) searchProperties.get( EstatisticasConstants.KEY_OUTROS_ACIDENTADOS );
String tableNames = "analises_acidentes";
String joinConditions = "";
String whereConditions = " analises_acidentes.apagada = 'n' ";
String[] tables;
Expression[] joins;
Expression where = new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" );
Integer[] joinTypes;
if ( por != null || nome != null || turno != null )
{
tableNames += ", acidentados";
joinConditions += " analises_acidentes.acidentado_id = acidentados.id ";
tables = new String[] { AnalisesAcidentesData.TABLENAME, AcidentadosData.TABLENAME };
joins = new Expression[] { new Field( AnalisesAcidentesData.ACIDENTADO_ID_FULL ).isEqual( AcidentadosData.ID_FULL ) };
joinTypes = new Integer[] { Select2.JOIN_INNER };
}
else
{
joins = new Expression[] { };
tables = new String[] { AnalisesAcidentesData.TABLENAME };
joinTypes = new Integer[] { };
}
// if ( departamento != null )
// {
// tableNames += ", departamentos";
// joinConditions += ( "".equals( joinConditions ) ? "" : " AND " ) + " analises_acidentes.departamento_id = departamentos.id ";
// }
if ( por != null )
{
whereConditions += " AND " + EstatisticasConstants.KEY_POR + " = '" + por + "' ";
where = where.and( new Field( EstatisticasConstants.KEY_POR ).isEqual( por ) );
}
if ( nome != null )
{
nome = nome.replaceAll( " ", "%" );
whereConditions += " AND " + EstatisticasConstants.KEY_NOME + " ILIKE '%" + nome + "%' ";
where = where.and( new Field( EstatisticasConstants.KEY_NOME ).isILike( "'%" + nome + "%'" ) );
}
if ( turno != null )
{
whereConditions += " AND " + EstatisticasConstants.KEY_TURNO_TRABALHO + " = '" + turno + "' ";
where = where.and( new Field( EstatisticasConstants.KEY_TURNO_TRABALHO ).isEqual( turno ) );
}
if ( anoOcorrencia != null )
{
whereConditions += " AND " + EstatisticasConstants.KEY_ANO_OCORRENCIA + " = '" + anoOcorrencia + "' ";
where = where.and( new Field( EstatisticasConstants.KEY_ANO_OCORRENCIA ).isEqual( anoOcorrencia ) );
}
if ( dataOcorrencia != null )
{
whereConditions += " AND " + EstatisticasConstants.KEY_DATA_OCORRENCIA + " = '" + D_F.format( dataOcorrencia ) + "' ";
where = where.and( new Field( EstatisticasConstants.KEY_DATA_OCORRENCIA ).isEqual( D_F.format( dataOcorrencia ) ) );
}
if ( horaOcorrencia != null )
{
@ -129,7 +121,7 @@ public class EstatisticasDataProvider extends GenericDataProvider
}
if ( hora != null )
{
whereConditions += " AND " + EstatisticasConstants.KEY_HORA_OCORRENCIA + " = '" + hora + "' " ;
where = where.and( new Field( EstatisticasConstants.KEY_HORA_OCORRENCIA ).isEqual( hora ) );
}
}
if ( horasTrabalhadas != null )
@ -145,52 +137,39 @@ public class EstatisticasDataProvider extends GenericDataProvider
}
if ( nrHoras != null )
{
whereConditions += " AND " + EstatisticasConstants.KEY_HORAS_TRABALHADAS + " = " + nrHoras + " ";
where = where.and( new Field( EstatisticasConstants.KEY_HORAS_TRABALHADAS ).isEqual( nrHoras ) );
}
}
if ( causas != null )
{
whereConditions += " AND " + EstatisticasConstants.KEY_CAUSAS_ACIDENTE + " = " + causas + " ";
where = where.and( new Field( EstatisticasConstants.KEY_CAUSAS_ACIDENTE ).isEqual( causas ) );
}
// if ( departamento != null )
// {
// departamento = departamento.replaceAll( " ", "%" );
// whereConditions += " AND " + EstatisticasConstants.KEY_DEPARTAMENTO + " ILIKE '%" + departamento + "%' ";
// }
if ( estabelecimentoID != null )
{
whereConditions += " AND " + EstatisticasConstants.KEY_ESTABELECIMENTO + " = " + estabelecimentoID + " ";
where = where.and( new Field( EstatisticasConstants.KEY_ESTABELECIMENTO ).isEqual( estabelecimentoID ) );
}
if ( seccaoID != null )
{
whereConditions += " AND " + EstatisticasConstants.KEY_SECCAO + " = " + seccaoID + " ";
where = where.and( new Field( EstatisticasConstants.KEY_SECCAO ).isEqual( seccaoID ) );
}
if ( formacao_shst != null )
{
/**
* opcoes possiveis : 'y', 'n', 't' ( AnaliseAcidentesTrabalho.java )
* 'y' -> if ( yes selected )
* 'n' -> if ( ! yes selected ) && ( no selected )
* 't' -> else
*/
whereConditions += " AND " + EstatisticasConstants.KEY_FORMACAO_SHST + " = '" + ( formacao_shst ? "y" : "n" ) + "' ";
where = where.and( new Field( EstatisticasConstants.KEY_FORMACAO_SHST ).isEqual( formacao_shst ? "y" : "n" ) );
}
if( participado_seguro != null )
{
whereConditions += " AND " + EstatisticasConstants.KEY_PARTICIPADO_SEGURO + " = '" + ( participado_seguro ? "y" : "n" ) + "' ";
where = where.and( new Field( EstatisticasConstants.KEY_PARTICIPADO_SEGURO ).isEqual( participado_seguro ? "y" : "n" ) );
}
String sql = "SELECT analises_acidentes.estado, COUNT( analises_acidentes.* ) AS count " +
"FROM " + tableNames + " " +
"WHERE " + ( "".equals( joinConditions ) ? "" : joinConditions + " AND " ) + whereConditions + " " +
"GROUP BY analises_acidentes.estado " +
"ORDER BY analises_acidentes.estado";
Select select = new Select2( tables, joinTypes, joins,
new String[]{ AnalisesAcidentesData.ESTADO_FULL, "COUNT( analises_acidentes.* ) AS count" },
where, new String[]{ AnalisesAcidentesData.ESTADO_FULL }, new String[]{ AnalisesAcidentesData.ESTADO_FULL }, null, null );
List< EstatisticaProcessoBean > stats = new LinkedList< EstatisticaProcessoBean >();
try
{
stats = getEstatisticasForSQL( sql );
stats = getEstatisticasForSQL( select );
}
catch ( Exception ex )
{
@ -200,17 +179,17 @@ public class EstatisticasDataProvider extends GenericDataProvider
}
private List< EstatisticaProcessoBean > getEstatisticasForSQL( String sql ) throws Exception
private List< EstatisticaProcessoBean > getEstatisticasForSQL( Select select ) throws Exception
{
System.out.println( "\nEstatisticasQuery : " + sql + "\n" );
System.out.println( "\nEstatisticasQuery : " + select.toString() + "\n" );
List< EstatisticaProcessoBean > stats = new LinkedList< EstatisticaProcessoBean >();
AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
Virtual2DArray array = getExecuter().executeQuery( new Select( sql ) );
Virtual2DArray array = getExecuter().executeQuery( select );
if ( array != null )
{
for ( int i = 0; i < array.columnLength(); i++ )
for ( int i = 0; i < array.rowCount(); i++ )
{
Integer estado = array.get( i, 0 );
Long count = array.get( i, 1 );
@ -229,9 +208,9 @@ public class EstatisticasDataProvider extends GenericDataProvider
return stats;
}
public com.sun.rave.web.ui.model.Option[] getSeccoesList( ) throws Exception
public Option[] getSeccoesList( ) throws Exception
{
com.sun.rave.web.ui.model.Option[] options = null;
Option[] options = null;
Select2 query = new Select2(
new String[] { SeccoesData.TABLENAME },
new Integer[] { },
@ -245,9 +224,9 @@ public class EstatisticasDataProvider extends GenericDataProvider
Virtual2DArray array = getExecuter().executeQuery( query );
if ( array != null )
{
options = new com.sun.rave.web.ui.model.Option[ array.columnLength() + 1 ];
options = new Option[ array.rowCount() + 1 ];
options[ 0 ] = new Option( "", "" );
for ( int i = 0; i < array.columnLength(); i++ )
for ( int i = 0; i < array.rowCount(); i++ )
{
Integer seccaoID = array.get( i, 0 );
String seccao = array.get( i, 1 );
@ -260,14 +239,14 @@ public class EstatisticasDataProvider extends GenericDataProvider
public SeccoesData loadSeccaoByID( Integer seccaoID ) throws Exception
{
return getProvider().load( SeccoesData.class, seccaoID, SeccoesData.ID );
return getProvider().load( SeccoesData.class, seccaoID, SeccoesData.ID, null );
}
public String getCausaByID( Integer causaID ) throws Exception
{
String causa = "";
CausasData causaData = getProvider().load( CausasData.class, causaID, CausasData.ID );
CausasData causaData = getProvider().load( CausasData.class, causaID, CausasData.ID, null );
if ( causaData != null )
{
causa = causaData.getCausa();
@ -275,27 +254,28 @@ public class EstatisticasDataProvider extends GenericDataProvider
return causa;
}
public com.sun.rave.web.ui.model.Option[] getEstabelecimentos() throws Exception
public Option[] getEstabelecimentos( ) throws Exception
{
com.sun.rave.web.ui.model.Option[] options = null;
Option[] options = null;
Expression where = new Field( db.data.siprp_local.outer.EstabelecimentosData.INACTIVO_FULL ).isDifferent( "y" );
Select2 query = new Select2(
new String[] { EstabelecimentosData.TABLENAME },
new String[] { db.data.siprp_local.outer.EstabelecimentosData.TABLENAME },
new Integer[] { },
new Expression[] {},
new String[] {
EstabelecimentosData.ID_FULL, EstabelecimentosData.NOME_FULL
new String[] {
db.data.siprp_local.outer.EstabelecimentosData.ID_FULL, db.data.siprp_local.outer.EstabelecimentosData.NOME_FULL
},
new Field( EstabelecimentosData.INACTIVO_FULL ).isDifferent( "y" )
.and( new Field( EstabelecimentosData.EMPRESA_ID_FULL ).isEqual( Global.AUCHAN ) ),
new String[] { EstabelecimentosData.NOME_FULL },
where,
new String[] { db.data.siprp_local.outer.EstabelecimentosData.NOME_FULL },
null, null, null );
Virtual2DArray array = getLocalExecuter().executeQuery( query );
if ( array != null )
{
options = new com.sun.rave.web.ui.model.Option[ array.columnLength() + 1 ];
options = new Option[ array.rowCount() + 1 ];
options[ 0 ] = new Option( "", "" );
for ( int i = 0; i < array.columnLength(); i++ )
for ( int i = 0; i < array.rowCount(); i++ )
{
Integer estabelecimentoID = array.get( i, 0 );
String estabelecimentoNome = array.get( i, 1 );
@ -308,7 +288,7 @@ public class EstatisticasDataProvider extends GenericDataProvider
public String getEstabelecimentoByID( Integer estabelecimentoID ) throws Exception
{
String estabelecimento = "";
EstabelecimentosData estabelecimentoData = getLocalProvider().load( EstabelecimentosData.class, estabelecimentoID, EstabelecimentosData.ID );
db.data.siprp_local.outer.EstabelecimentosData estabelecimentoData = getLocalProvider().load( db.data.siprp_local.outer.EstabelecimentosData.class, estabelecimentoID, db.data.siprp_local.outer.EstabelecimentosData.ID, null );
if ( estabelecimentoData != null )
{
estabelecimento = estabelecimentoData.getNome();

@ -17,7 +17,6 @@ import com.evolute.utils.db.DBException;
import com.evolute.utils.db.DBManager;
import com.evolute.utils.db.Executer;
import com.evolute.utils.db.JDBCManager;
import com.evolute.utils.error.ErrorLogger;
import com.evolute.utils.jdbc.DBStatementExecuter;
import com.evolute.utils.jdbc.StatementExecuterFactory;
import com.evolute.utils.sql.SQLQuery;
@ -25,13 +24,6 @@ import com.evolute.utils.sql.backend.BackendProvider;
import com.evolute.utils.strings.UnicodeChecker;
import db.DBConstants;
import db.DBPropertiesLoader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;
/**
*
@ -71,16 +63,12 @@ public class EvoBaseProvider
String username = DBPropertiesLoader.getInstance().findProperty( DBConstants.USERNAME_SIPRP );
String password = DBPropertiesLoader.getInstance().findProperty( DBConstants.PASSWORD_SIPRP );
// System.out.println( "\t" + server + " : " + port + " : " + dbname + " : " + username + " : " + password );
String server_local = DBPropertiesLoader.getInstance().findProperty( DBConstants.SERVER_SIPRP_LOCAL );
int port_local = DBPropertiesLoader.getInstance().findProperty( DBConstants.PORT_SIPRP_LOCAL, -1 );
String dbname_local = DBPropertiesLoader.getInstance().findProperty( DBConstants.DATABASE_SIPRP_LOCAL );
String username_local = DBPropertiesLoader.getInstance().findProperty( DBConstants.USERNAME_SIPRP_LOCAL );
String password_local = DBPropertiesLoader.getInstance().findProperty( DBConstants.PASSWORD_SIPRP_LOCAL );
// System.out.println( "\t" + server_local + " : " + port_local + " : " + dbname_local + " : " + username_local + " : " + password_local );
init( DBConstants.DB.SIPRP, server, port, dbname, username, password );
init( DBConstants.DB.SIPRP_LOCAL, server_local, port_local, dbname_local, username_local, password_local );
}
@ -112,12 +100,10 @@ public class EvoBaseProvider
dbManager.close();
}
String dbUrl = ( String ) Singleton.getInstance( DBConstants.CONNECTION_URL );
DBManager manager = new JDBCManager( dbUrl, username, password , 14, 7, 7, new SQLQuery[] { } );
DBManager manager = new JDBCManager( dbUrl, username, password , 14, 7, new SQLQuery[] { } );
StatementExecuterFactory.initialize( new DBStatementExecuter( manager.getSharedExecuter( EvoBaseProvider.class ) ) );
UnicodeChecker.setUseDoubleSlash( true );
// Insert.setDefaultKeyRetriever( PostgresqlAutoKeyRetriever.RETRIEVER );
dbManager = manager;
// System.out.println( "\nDBManager : " + dbManager );
}
else if ( DBConstants.DB.SIPRP_LOCAL.equals( db ) )
{
@ -126,13 +112,11 @@ public class EvoBaseProvider
localDBManager.close();
}
String dbUrl = ( String ) Singleton.getInstance( DBConstants.LOCAL_CONNECTION_URL );
DBManager manager = new JDBCManager( dbUrl, username, password , 14, 7, 7, new SQLQuery[] { } );
DBManager manager = new JDBCManager( dbUrl, username, password , 14, 7, new SQLQuery[] { } );
StatementExecuterFactory.initialize( new DBStatementExecuter( manager.getSharedExecuter( EvoBaseProvider.class ) ) );
UnicodeChecker.setUseDoubleSlash( true );
// Insert.setDefaultKeyRetriever( PostgresqlAutoKeyRetriever.RETRIEVER );
localDBManager = manager;
Singleton.setInstance( Singleton.DEFAULT_DBMANAGER, localDBManager );
// System.out.println( "\nLocalDBManager : " + localDBManager );
}
}
@ -151,6 +135,7 @@ public class EvoBaseProvider
}
}
@SuppressWarnings( "unchecked" )
private static ProviderInterface< EvoDataObject< ? >, EvoDataException > createInstance( DBConstants.DB db, String url, String user, String password )
{
ProviderRegistry.registerDefaultProviderFactory( new EvoDataProviderFactory() );
@ -178,6 +163,11 @@ public class EvoBaseProvider
return getProvider( DBConstants.DB.SIPRP );
}
public ProviderInterface< EvoDataObject< ? >, EvoDataException > getLocalProvider()
{
return getProvider( DBConstants.DB.SIPRP_LOCAL );
}
public ProviderInterface< EvoDataObject< ? >, EvoDataException > getProvider( DBConstants.DB db )
{
ProviderInterface< EvoDataObject< ? >, EvoDataException > provider = null;
@ -214,20 +204,12 @@ public class EvoBaseProvider
}
public Executer getExecuter() throws DBException
{
return getExecuter( this );
}
private Executer getExecuter( Object clazz ) throws DBException
{
if ( getDbManager() == null )
{
init();
}
// DBManager dbm = ( DBManager ) Singleton.getInstance( DBConstants.DEFAULT_DBMANAGER );
// return dbm.getSharedExecuter( this );
DBManager dbm = getDbManager( DBConstants.DB.SIPRP );
if ( dbm != null )
{
@ -237,18 +219,11 @@ public class EvoBaseProvider
}
public Executer getLocalExecuter() throws DBException
{
return getLocalExecuter( this );
}
private Executer getLocalExecuter( Object clazz ) throws DBException
{
if ( getDbManager( DBConstants.DB.SIPRP_LOCAL ) == null )
{
init();
}
// DBManager dbm = ( DBManager ) Singleton.getInstance( DBConstants.LOCAL_DBMANAGER );
// return dbm.getSharedExecuter( this );
DBManager dbm = getDbManager( DBConstants.DB.SIPRP_LOCAL );
if ( dbm != null )
@ -258,113 +233,4 @@ public class EvoBaseProvider
return null;
}
@Deprecated
public Statement createStatement()
{
String connectionURL = ( String ) Singleton.getInstance( DBConstants.CONNECTION_URL );
String username = DBPropertiesLoader.getInstance().findProperty( DBConstants.USERNAME_SIPRP );
String password = DBPropertiesLoader.getInstance().findProperty( DBConstants.PASSWORD_SIPRP );
return getStatement( DBConstants.DB.SIPRP, connectionURL, username, password );
}
@Deprecated
public Statement createLocalStatement()
{
String connectionURL = ( String ) Singleton.getInstance( DBConstants.LOCAL_CONNECTION_URL );
String username = DBPropertiesLoader.getInstance().findProperty( DBConstants.USERNAME_SIPRP_LOCAL );
String password = DBPropertiesLoader.getInstance().findProperty( DBConstants.PASSWORD_SIPRP_LOCAL );
return getStatement( DBConstants.DB.SIPRP_LOCAL, connectionURL, username, password );
}
private Statement getStatement( DBConstants.DB db, String connectionURL, String username, String password )
{
Statement stm = null;
try
{
Connection connection = getConnection( db, connectionURL, username, password );
if ( connection != null )
{
stm = connection.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY );
}
}
catch ( Exception e )
{
ErrorLogger.logException( e );
}
return stm;
}
private Connection getConnection( DBConstants.DB db, String connectionURL, String username, String password ) throws Exception
{
Connection connection = null;
// System.out.println( "\nEvoBaseProvider . getConnection( " + connectionURL + ", " + username + " ) : " );
FacesContext fc = FacesContext.getCurrentInstance();
// System.out.println( "\tFacesContext : " + fc );
if ( fc != null )
{
ExternalContext ec = fc.getExternalContext();
// System.out.println( "\tExternalContext : " + ec );
if ( ec != null )
{
HttpSession session = ( HttpSession ) ec.getSession( false );
// System.out.println( "\tSession : " + session );
if ( session != null )
{
if ( DBConstants.DB.SIPRP.equals( db ) )
{
connection = ( Connection ) session.getAttribute( DBConstants.SESSION_CONNECTION );
if ( connection == null )
{
// System.out.println( "\n-> Creating new SIPRP connection ..." );
Class.forName( "org.postgresql.Driver" ).newInstance();
connection = DriverManager.getConnection( connectionURL, username, password );
session.setAttribute( DBConstants.SESSION_CONNECTION, connection );
}
}
else if ( DBConstants.DB.SIPRP_LOCAL.equals( db ) )
{
connection = ( Connection ) session.getAttribute( DBConstants.SESSION_CONNECTION_LOCAL );
if ( connection == null )
{
// System.out.println( "\n-> Creating new SIPRP_LOCAL connection ..." );
Class.forName( "org.postgresql.Driver" ).newInstance();
connection = DriverManager.getConnection( connectionURL, username, password );
session.setAttribute( DBConstants.SESSION_CONNECTION_LOCAL, connection );
}
}
}
}
}
if ( connection == null )
{
connection = ( Connection ) Singleton.getInstance( "CONNECTION_OBJECT" );
if ( connection == null )
{
// System.out.println( "\nEvoBaseProvider . getConnection() : session is null !" );
if ( DBConstants.DB.SIPRP.equals( db ) )
{
// System.out.println( "\t-> Creating new SIPRP connection ..." );
Class.forName( "org.postgresql.Driver" ).newInstance();
connection = DriverManager.getConnection( connectionURL, username, password );
}
else if ( DBConstants.DB.SIPRP_LOCAL.equals( db ) )
{
// System.out.println( "\t-> Creating new SIPRP_LOCAL connection ..." );
Class.forName( "org.postgresql.Driver" ).newInstance();
connection = DriverManager.getConnection( connectionURL, username, password );
}
Singleton.setInstance( "CONNECTION_OBJECT", connection );
}
}
// System.out.println( "<-- getConnection() : " + connection );
return connection;
}
}

@ -8,13 +8,8 @@ package db.providers;
import com.evolute.entity.ProviderInterface;
import com.evolute.entity.evo.EvoDataException;
import com.evolute.entity.evo.EvoDataObject;
import com.evolute.utils.arrays.Virtual2DArray;
import com.evolute.utils.db.DBException;
import com.evolute.utils.db.Executer;
import com.evolute.utils.error.ErrorLogger;
import db.DBConstants;
import java.sql.ResultSet;
import java.sql.Statement;
public abstract class GenericDataProvider
@ -53,81 +48,4 @@ public abstract class GenericDataProvider
{
return localProvider;
}
// public void checkConnection()
// {
// Db db = Db.getInstance();
// if ( db.getConnection() == null )
// {
// try
// {
// db.connect();
// }
// catch ( Exception ex )
// {
// ErrorLogger.logException( ex );
// }
// }
// }
protected Integer getInsertedID( Virtual2DArray array )
{
Integer id = null;
if ( array != null && array.columnLength() > 0 )
{
id = array.get( 0, 0 );
}
return id;
}
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()
{
try
{
// Db db = Db.getInstance();
// return db.createStatement();
return EvoBaseProvider.getInstance().createStatement();
}
catch ( DBException ex )
{
ErrorLogger.logException( ex );
}
return null;
}
protected Statement createLocalStatement()
{
try
{
return EvoBaseProvider.getInstance().createLocalStatement();
}
catch ( DBException ex )
{
ErrorLogger.logException( ex );
}
return null;
}
}

@ -11,9 +11,9 @@ package db.providers;
import beans.Medico;
import beans.Permissao;
import beans.TecnicoSaude;
import beans.Utilizador;
import com.evolute.utils.arrays.Virtual2DArray;
import com.evolute.utils.db.DBException;
import com.evolute.utils.error.ErrorLogger;
import com.evolute.utils.sql.Expression;
import com.evolute.utils.sql.Field;
@ -21,17 +21,15 @@ import com.evolute.utils.sql.Select;
import com.evolute.utils.sql.Select2;
import com.evolute.utils.sql.expression.Par;
import com.evolute.utils.strings.StringPlainer;
import com.sun.rave.web.ui.model.Option;
import db.data.siprp.outer.EmpresasData;
import db.data.siprp.outer.PermissoesData;
import db.data.siprp.outer.TiposUtilizadoresData;
import db.data.siprp.outer.UtilizadoresData;
import global.Global;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import utils.Utils;
/**
@ -56,238 +54,94 @@ public class UtilizadoresDataProvider extends GenericDataProvider
return INSTANCE;
}
public Integer getMaxUserId()
{
Integer newId = new Integer( 1 );
Statement st = createStatement();
String sql = "SELECT max( utilizadores.id ) + 1 AS MAXUSERID FROM utilizadores";
try
{
ResultSet rs = st.executeQuery( sql );
rs.first();
newId = new Integer( rs.getInt( "MAXUSERID" ) );
if ( newId.intValue() == 0 )
{
newId = new Integer( 1 );
}
}
catch ( Exception ex )
{
ErrorLogger.logException( ex );
}
return newId;
}
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;
return UtilizadoresData.createUtilizador( u )
.withProvider( EvoBaseProvider.getInstance().getProvider() )
.saveMe().refreshMe().getID();
}
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);
EvoBaseProvider.getInstance().getProvider().load(
UtilizadoresData.class,
new Object[]{ u.getId() }, new String[]{ UtilizadoresData.ID_FULL }, null ).update( u ).save();
}
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);
EvoBaseProvider.getInstance().getProvider().load(
UtilizadoresData.class,
new Object[]{ userID }, new String[]{ UtilizadoresData.ID_FULL }, null ).withActivo( "n" ).withApagado( "y" ).save();
}
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);
if ( 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;
return Utilizador.createUtilizador( EvoBaseProvider.getInstance().getProvider().load( UtilizadoresData.class, new Object[]{ login, "n" }, new String[]{ UtilizadoresData.LOGIN_FULL, UtilizadoresData.APAGADO_FULL }, null ) );
}
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);
if ( 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;
return Utilizador.createUtilizador( EvoBaseProvider.getInstance().getProvider().load(
UtilizadoresData.class,
new Object[]{ id }, new String[]{ UtilizadoresData.ID_FULL }, null ) );
}
public ArrayList getUtilizadoresListByTipo( Integer tipo, String responsavel_loja, Integer estabelecimento_id )
public ArrayList< Utilizador > getUtilizadoresListByTipo( Integer tipo, String responsavel_loja, Integer estabelecimento_id )
throws Exception
{
ArrayList list = new ArrayList();
Statement st = createStatement();
String sql = "SELECT * FROM utilizadores WHERE activo = 'y' AND apagado = 'n' AND tipo = " + tipo;
String estabelecimento_constraint = "";
if( tipo != null && ( tipo.intValue() == Global.TIPO_UTILIZADOR_RH || tipo.intValue() == Global.TIPO_UTILIZADOR_SEGURANCA ) )
{
estabelecimento_constraint = " AND estabelecimento_id = " + estabelecimento_id;
}
sql += estabelecimento_constraint;
ArrayList<Utilizador> list = new ArrayList<Utilizador>();
if ( "y".equals( responsavel_loja ) )
{
sql += " AND responsavel_loja = '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
// {
while ( rs != null && rs.next() )
{
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());
List<UtilizadoresData> utilizadoresData;
if( tipo != null && ( tipo == Global.TIPO_UTILIZADOR_RH || tipo == Global.TIPO_UTILIZADOR_SEGURANCA ) )
{
utilizadoresData = getProvider().listLoad( UtilizadoresData.class, new Object[]{ "y", "n", tipo, estabelecimento_id, responsavel_loja }, new String[]{ UtilizadoresData.ACTIVO_FULL, UtilizadoresData.APAGADO_FULL, UtilizadoresData.TIPO_FULL, UtilizadoresData.ESTABELECIMENTO_ID_FULL, UtilizadoresData.RESPONSAVEL_LOJA_FULL }, new String[]{ UtilizadoresData.NOME_FULL }, null );
}
else
{
utilizadoresData = getProvider().listLoad( UtilizadoresData.class, new Object[]{ "y", "n", tipo, responsavel_loja }, new String[]{ UtilizadoresData.ACTIVO_FULL, UtilizadoresData.APAGADO_FULL, UtilizadoresData.TIPO_FULL, UtilizadoresData.RESPONSAVEL_LOJA_FULL }, new String[]{ UtilizadoresData.NOME_FULL }, null );
}
for( UtilizadoresData utilizadorData : utilizadoresData )
{
list.add( Utilizador.createUtilizador( utilizadorData ) );
}
return list;
}
@SuppressWarnings( { "ConstantConditions", "UnusedParameters" } )
public List< Utilizador > getUtilizadoresList( String por, String nome, String login, Integer estabelecimentoID, String activo, String dirRH )
throws Exception
{
List< Utilizador > listUtilizadores = new LinkedList< Utilizador >();
// por = por == null ? "" : por;
nome = nome == null ? null : StringPlainer.convertString( nome.replaceAll( " ", "%" ) );
login = login == null ? null : StringPlainer.convertString( login.replaceAll( " ", "%" ) );
activo = activo == null ? "y" : activo;
dirRH = dirRH == null ? "n" : dirRH;
boolean isDirRH = "y".equals( dirRH );
Expression whereExpression = new Field( UtilizadoresData.APAGADO_FULL ).isEqual( "n" );
whereExpression = whereExpression.and( new Field( UtilizadoresData.ACTIVO_FULL ).isEqual( activo ) );
whereExpression = whereExpression.and( new Field( UtilizadoresData.TIPO_FULL ).isDifferent( Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP ) );
if ( por != null )
if( por != null )
{
whereExpression = whereExpression.and( new Field( "plain( " + UtilizadoresData.NUMERO_MECANOGRAFICO_FULL + " )" ).isILike( "%" + por + "%" ) );
}
if ( nome != null )
if( nome != null )
{
Expression nomeExpression = new Field( "plain( " + UtilizadoresData.NOME_FULL + " )" ).isILike( "%" + nome + "%" ).or(
new Field( "plain_utf8( " + UtilizadoresData.NOME_FULL + " )" ).isILike( "%" + nome + "%" ) );
whereExpression = whereExpression.and( new Par( nomeExpression ) );
}
if ( login != null )
if( login != null )
{
Expression loginExpression = new Field( "plain( " + UtilizadoresData.LOGIN_FULL + " )" ).isILike( "%" + login + "%" ).or(
new Field( "plain_utf8( " + UtilizadoresData.LOGIN_FULL + " )" ).isILike( "%" + login + "%" ) );
whereExpression = whereExpression.and( new Par( loginExpression ) );
}
if ( estabelecimentoID != null )
if( estabelecimentoID != null )
{
whereExpression = whereExpression.and( new Field( UtilizadoresData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimentoID ) );
}
@ -319,7 +173,7 @@ public class UtilizadoresDataProvider extends GenericDataProvider
Virtual2DArray array = getExecuter().executeQuery( query );
if ( array != null )
{
for ( int i = 0; i < array.columnLength(); i++ )
for ( int i = 0; i < array.rowCount(); i++ )
{
Integer userID = array.get( i, 0 );
String loginUtilizador = array.get( i, 1 );
@ -338,7 +192,6 @@ public class UtilizadoresDataProvider extends GenericDataProvider
String responsavelLoja = array.get( i, 14 );
String numeroMecanografico = array.get( i, 15 );
String gestorGeral = array.get( i, 16 );
String primeiroLogin = array.get( i, 17 );
String apagado = array.get( i, 18 );
Date dataPassword = array.get( i, 19 );
java.sql.Date sqlDataPassword = dataPassword == null ? null : new java.sql.Date( dataPassword.getTime() );
@ -354,224 +207,63 @@ public class UtilizadoresDataProvider extends GenericDataProvider
ErrorLogger.logException( e );
}
Utilizador u = new Utilizador();
u.setId( userID );
u.setLogin( loginUtilizador );
u.setPassword( password );
u.setData_password( sqlDataPassword );
u.setEmail( email );
u.setEmpresa_id( empresaID );
u.setEstabelecimento_id( estabelecimento_ID );
u.setAdministrador( administrador );
u.setTipo( tipoTIPO );
u.setNumero_cedula( numeroCedula );
u.setCap( cap );
u.setNome( Utils.htmlToText( Utils.unicodeToHTML( nomeUtilizador ) ) );
u.setMedico_id( medicoID );
u.setFuncionario_hst_id( funcionarioHSTID );
u.setActivo( activoUtilizador );
u.setResponsavel_loja( responsavelLoja );
u.setGestor_geral( gestorGeral );
u.setNumero_mecanografico( numeroMecanografico );
u.setCategoria( categoria );
u.setApagado( apagado );
u.setNome_estabelecimento( Utils.htmlToText( Utils.unicodeToHTML( nomeEstabelecimento ) ) );
listUtilizadores.add( u );
listUtilizadores.add(
Utilizador.createUtilizador( )
.withId( userID )
.withLogin( loginUtilizador )
.withPassword( password )
.withData_password( sqlDataPassword )
.withEmail( email )
.withEmpresa_id( empresaID )
.withEstabelecimento_id( estabelecimento_ID )
.withAdministrador( administrador )
.withTipo( tipoTIPO )
.withNumero_cedula( numeroCedula )
.withCap( cap )
.withNome( Utils.htmlToText( Utils.unicodeToHTML( nomeUtilizador ) ) )
.withMedico_id( medicoID )
.withFuncionario_hst_id( funcionarioHSTID )
.withActivo( activoUtilizador )
.withResponsavel_loja( responsavelLoja )
.withGestor_geral( gestorGeral )
.withNumero_mecanografico( numeroMecanografico )
.withCategoria( categoria )
.withApagado( apagado )
.withNome_estabelecimento( Utils.htmlToText( Utils.unicodeToHTML( nomeEstabelecimento ) ) ) );
}
}
return listUtilizadores;
}
// public List< Utilizador > getUtilizadoresList(String por, String nome, Integer estabelecimento_id, String activo, String booDirRh) throws Exception
// {
// StringTokenizer stk = null;
// AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
// List< Utilizador > list = new LinkedList< Utilizador >();
// 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;
// }
// 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;
// }
// 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;
// }
// 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;
// }
// 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
// {
// 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)
// {
// ErrorLogger.logException( e );
// }
//
// 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)
public ArrayList< Utilizador > 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;
ArrayList<Utilizador> list = null;
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;
List<UtilizadoresData> utilizadoresDatas;
utilizadoresDatas = getProvider().listLoad( UtilizadoresData.class,
new Object[]{ "y", Global.TIPO_UTILIZADOR_RH, "n", "y", estabelecimento_id },
new String[]{ UtilizadoresData.ACTIVO_FULL, UtilizadoresData.TIPO_FULL, UtilizadoresData.APAGADO_FULL,
UtilizadoresData.RESPONSAVEL_LOJA_FULL, UtilizadoresData.ESTABELECIMENTO_ID_FULL },
new String[]{ UtilizadoresData.NOME_FULL }, null );
list = new ArrayList<Utilizador>();
for( UtilizadoresData utilizadoresData : utilizadoresDatas )
{
list.add( Utilizador.createUtilizador().withId( utilizadoresData.getId() )
.withNome( utilizadoresData.getNome() ).withLogin( utilizadoresData.getLogin() )
.withEmail( utilizadoresData.getEmail() ) );
}
}
catch(Exception ex)
{
ErrorLogger.logException( ex );
return null;
}
}
return list;
}
public Medico getMedico( Integer estabelecimentoID )
@ -579,19 +271,20 @@ public class UtilizadoresDataProvider extends GenericDataProvider
Medico result = null;
try
{
Expression whereExpression = new Field( UtilizadoresData.ACTIVO_FULL ).isEqual( "y" )
.and( new Field( UtilizadoresData.APAGADO_FULL ).isEqual( "n" ) )
.and( new Field( UtilizadoresData.TIPO_FULL ).isEqual( Global.TIPO_UTILIZADOR_MEDICO ) )
.and( new Field( UtilizadoresData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimentoID ) );
Select2 query = new Select2(
new String[] { UtilizadoresData.TABLENAME },
new Integer[] {},
new Expression[] {},
new String[] { UtilizadoresData.ID_FULL, UtilizadoresData.NOME_FULL, UtilizadoresData.NUMERO_CEDULA_FULL },
new Field( UtilizadoresData.ACTIVO_FULL ).isEqual( "y" )
.and( new Field( UtilizadoresData.APAGADO_FULL ).isEqual( "n" ) )
.and( new Field( UtilizadoresData.TIPO_FULL ).isEqual( Global.TIPO_UTILIZADOR_MEDICO ) )
.and( new Field( UtilizadoresData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimentoID ) ),
null, null, null, null
whereExpression, null, null, null, null
);
Virtual2DArray array = getExecuter().executeQuery( query );
if ( array.columnLength() > 0 )
if ( array.rowCount() > 0 )
{
Integer medicoID = array.get( 0, 0 );
String nome = array.get( 0, 1 );
@ -610,142 +303,37 @@ public class UtilizadoresDataProvider extends GenericDataProvider
return result;
}
// 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)
// {
// ErrorLogger.logException( 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)
{
ErrorLogger.logException( ex );
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;
return PermissoesData.createPermissao( p )
.withProvider( EvoBaseProvider.getInstance().getProvider() )
.saveMe().refreshMe().getID();
}
public Integer getPermissionCode( Integer userId ) throws Exception
{
Integer permission = null;
Statement st = createStatement();
String sql = "SELECT * FROM permissoes WHERE user_id = " + userId;
ResultSet rs = st.executeQuery( sql );
if ( rs.first() )
{
permission = new Integer( rs.getInt( "codigo_permissao" ) );
}
return permission;
Expression dataFilter = new Field( PermissoesData.USER_ID_FULL ).isEqual( userId );
Select select = new Select2( PermissoesData.TABLENAME, dataFilter, PermissoesData.CODIGO_PERMISSAO_FULL );
Virtual2DArray array = getExecuter().executeQuery( select );
Integer rPermission = 0;
if( array.rowCount() > 0 )
{
rPermission = array.get( 0, 0 );
}
return rPermission;
}
public Boolean isSiprp( Utilizador utilizador ) throws DBException
{
Select select = new Select2( EmpresasData.TABLENAME, new Field( EmpresasData.DESIGNACAO_SOCIAL_FULL ).isILike( "siprp%" )
.and( new Field( EmpresasData.ID_FULL ).isEqual( utilizador.getEmpresa_id() ) ), "1" );
Select outer = new Select( "select exists( " + select.toString() + " )" );
Virtual2DArray array = getExecuter().executeQuery( outer );
return array.rowCount() > 0 ? ( Boolean ) array.get( 0, 1 ) : Boolean.FALSE;
}
}

@ -147,5 +147,10 @@ public class Strings {
output = output.replaceAll( "\\\\u00", "\\\\'" );
return output;
}
public static String nullToEmpty( String string )
{
return string == null ? "" : string;
}
}

Loading…
Cancel
Save