forked from Coded/SIPRP
git-svn-id: https://svn.coded.pt/svn/SIPRP@543 bb69d46d-e84e-40c8-a05a-06db0d633741
parent
98669a1a22
commit
dc3a631a3a
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="web/src"/>
|
||||
<classpathentry kind="src" path="SIPRPSoft/src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/evolute"/>
|
||||
<classpathentry kind="lib" path="/evolute/lib/jdo.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>SIPRP</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@ -0,0 +1,32 @@
|
||||
UPDATE trabalhadores SET perfil=1 WHERE perfil IS NULL;
|
||||
UPDATE marcacoes_trabalhador SET motivo =
|
||||
( SELECT tipo FROM exames WHERE exames.trabalhador_id = marcacoes_trabalhador.trabalhador_id AND
|
||||
exames.data = marcacoes_trabalhador.data )
|
||||
WHERE motivo IS NULL AND realizada = 'y';
|
||||
|
||||
CREATE TABLE etiquetas
|
||||
(
|
||||
id serial NOT NULL,
|
||||
descricao varchar(255) NOT NULL,
|
||||
descricao_plain varchar,
|
||||
altura float4,
|
||||
largura float4,
|
||||
margem_esquerda float4,
|
||||
margem_cima float4,
|
||||
colunas int4,
|
||||
linhas int4,
|
||||
continua char(1) NOT NULL DEFAULT 'n'::bpchar,
|
||||
altura_folha float4,
|
||||
largura_folha float4,
|
||||
margem_vertical_folha float4,
|
||||
margem_horizontal_folha float4,
|
||||
CONSTRAINT etiquetas_pkey PRIMARY KEY (id)
|
||||
)
|
||||
WITHOUT OIDS;
|
||||
ALTER TABLE etiquetas OWNER TO postgres;
|
||||
|
||||
ALTER TABLE estabelecimentos ADD medico_id int4 REFERENCES medicos( id );
|
||||
|
||||
insert into etiquetas ( descricao, descricao_plain, altura, largura, margem_esquerda, margem_cima, colunas, linhas, continua, altura_folha, largura_folha,
|
||||
margem_horizontal_folha, margem_vertical_folha )
|
||||
values( 'Etiquetas em folha A4', 'etiquetas em folha a4', 3.7125, 10.5, 0.0, 0.0, 2, 8, 'n', 29.7, 21.0, 0.7, 0.5 );
|
||||
@ -0,0 +1,2 @@
|
||||
alter table empresas add inicio_contrato date;
|
||||
alter table empresas add duracao int;
|
||||
@ -0,0 +1,154 @@
|
||||
-- Table: ecd_oficial
|
||||
|
||||
-- DROP TABLE ecd_oficial;
|
||||
|
||||
CREATE TABLE ecd_oficial
|
||||
(
|
||||
id serial NOT NULL,
|
||||
descricao varchar(255),
|
||||
descricao_plain varchar(255),
|
||||
ordem int4,
|
||||
activo char(1),
|
||||
CONSTRAINT ecd_oficial_pkey PRIMARY KEY (id)
|
||||
)
|
||||
WITHOUT OIDS;
|
||||
ALTER TABLE ecd_oficial OWNER TO postgres;
|
||||
|
||||
|
||||
-- Table: prestadores
|
||||
|
||||
-- DROP TABLE prestadores;
|
||||
|
||||
CREATE TABLE prestadores
|
||||
(
|
||||
id serial NOT NULL,
|
||||
nome varchar(255),
|
||||
nome_plain varchar(255),
|
||||
morada varchar(2048),
|
||||
codigo_postal varchar(16),
|
||||
localidade varchar(255),
|
||||
localidade_cp varchar(255),
|
||||
contacto_id int4,
|
||||
activo char(1),
|
||||
faz_consultas char(1),
|
||||
faz_ecds char(1),
|
||||
CONSTRAINT prestadores_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT prestadores_contacto_id_fkey FOREIGN KEY (contacto_id)
|
||||
REFERENCES contactos (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||
)
|
||||
WITHOUT OIDS;
|
||||
ALTER TABLE prestadores OWNER TO postgres;
|
||||
|
||||
|
||||
-- Table: prestadores_grupos_protocolo
|
||||
|
||||
-- DROP TABLE prestadores_grupos_protocolo;
|
||||
|
||||
CREATE TABLE prestadores_grupos_protocolo
|
||||
(
|
||||
id serial NOT NULL,
|
||||
prestador_id int4 NOT NULL,
|
||||
grupo_protocolo_id int4 NOT NULL,
|
||||
CONSTRAINT prestadores_grupos_protocolo_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT prestadores_grupos_protocolo_grupo_protocolo_id_fkey FOREIGN KEY (grupo_protocolo_id)
|
||||
REFERENCES prt_grupos_protocolo (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||
CONSTRAINT prestadores_grupos_protocolo_prestador_id_fkey FOREIGN KEY (prestador_id)
|
||||
REFERENCES prestadores (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||
)
|
||||
WITHOUT OIDS;
|
||||
ALTER TABLE prestadores_grupos_protocolo OWNER TO postgres;
|
||||
|
||||
|
||||
|
||||
-- Table: marcacoes_trabalhador_estados
|
||||
|
||||
-- DROP TABLE marcacoes_trabalhador_estados;
|
||||
|
||||
CREATE TABLE marcacoes_trabalhador_estados
|
||||
(
|
||||
id serial NOT NULL,
|
||||
data date,
|
||||
estado int4,
|
||||
marcacao_id int4,
|
||||
CONSTRAINT marcacoes_trabalhador_estados_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT marcacoes_trabalhador_estados_marcacao_id_fkey FOREIGN KEY (marcacao_id)
|
||||
REFERENCES marcacoes_trabalhador (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||
)
|
||||
WITHOUT OIDS;
|
||||
ALTER TABLE marcacoes_trabalhador_estados OWNER TO postgres;
|
||||
|
||||
alter table marcacoes_grupos_realizados add marcacoes_trabalhador_estado_id int4 references marcacoes_trabalhador_estados(id);
|
||||
|
||||
-- Table: lembretes_tipos
|
||||
|
||||
-- DROP TABLE lembretes_tipos;
|
||||
|
||||
CREATE TABLE lembretes_tipos
|
||||
(
|
||||
id serial NOT NULL,
|
||||
codigo varchar(16) NOT NULL,
|
||||
descricao varchar(255) NOT NULL,
|
||||
ordem int4 NOT NULL,
|
||||
activo char(1) NOT NULL DEFAULT 'y'::bpchar,
|
||||
CONSTRAINT lembretes_tipos_pkey PRIMARY KEY (id)
|
||||
)
|
||||
WITHOUT OIDS;
|
||||
ALTER TABLE lembretes_tipos OWNER TO postgres;
|
||||
|
||||
INSERT INTO lembretes_tipos (codigo, descricao, ordem, activo )
|
||||
VALUES( 'EXTERNO','Avisos Externos', 1, 'y' );
|
||||
INSERT INTO lembretes_tipos (codigo, descricao, ordem, activo )
|
||||
VALUES( 'REMARCACOES', 'Remarca\\u00e7\\u00f5es', 3 , 'y' );
|
||||
INSERT INTO lembretes_tipos (codigo, descricao, ordem, activo )
|
||||
VALUES( 'MARCACOES', 'Marca\\u00e7\\u00f5es Pendentes', 2, 'y' );
|
||||
INSERT INTO lembretes_tipos (codigo, descricao, ordem, activo )
|
||||
VALUES( 'OUTROS','Outros',4,'y' );
|
||||
|
||||
-- Table: lembretes
|
||||
|
||||
-- DROP TABLE lembretes;
|
||||
|
||||
CREATE TABLE lembretes
|
||||
(
|
||||
id serial NOT NULL,
|
||||
tipo_id int4 NOT NULL,
|
||||
data date NOT NULL,
|
||||
descricao varchar(255) NOT NULL,
|
||||
texto varchar(16384),
|
||||
empresa_id int4,
|
||||
estabelecimento_id int4,
|
||||
trabalhador_id int4,
|
||||
marcacao_estabelecimento_id int4,
|
||||
marcacao_trabalhador_id int4,
|
||||
enviar_email char(1) DEFAULT 'n'::bpchar,
|
||||
periodicidade_dias int4,
|
||||
periodicidade_meses int4,
|
||||
ultimo_envio date,
|
||||
CONSTRAINT lembretes_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT lembretes_empresa_id_fkey FOREIGN KEY (empresa_id)
|
||||
REFERENCES empresas (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||
CONSTRAINT lembretes_estabelecimento_id_fkey FOREIGN KEY (estabelecimento_id)
|
||||
REFERENCES estabelecimentos (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||
CONSTRAINT lembretes_marcacao_estabelecimento_id_fkey FOREIGN KEY (marcacao_estabelecimento_id)
|
||||
REFERENCES marcacoes_estabelecimento (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||
CONSTRAINT lembretes_marcacao_trabalhador_id_fkey FOREIGN KEY (marcacao_trabalhador_id)
|
||||
REFERENCES marcacoes_trabalhador (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||
CONSTRAINT lembretes_tipo_id_fkey FOREIGN KEY (tipo_id)
|
||||
REFERENCES lembretes_tipos (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||
CONSTRAINT lembretes_trabalhador_id_fkey FOREIGN KEY (trabalhador_id)
|
||||
REFERENCES trabalhadores (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||
)
|
||||
WITHOUT OIDS;
|
||||
ALTER TABLE lembretes OWNER TO postgres;
|
||||
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
ALTER TABLE prestadores ADD contribuinte VARCHAR(64);
|
||||
ALTER TABLE marcacoes_trabalhador ADD prestador_id int4 REFERENCES prestadores( id );
|
||||
ALTER TABLE marcacoes_trabalhador_estados ADD prestador_id int4 REFERENCES prestadores( id );
|
||||
@ -0,0 +1,90 @@
|
||||
<project name="SIPRP" default="compile" basedir=".">
|
||||
<target name="init">
|
||||
<!-- directory definition -->
|
||||
<property name="src" value="${basedir}"/>
|
||||
<property name="build" value="${basedir}/build"/>
|
||||
<property name="dist" value="${basedir}/../jars"/>
|
||||
<property environment="env"/>
|
||||
<condition property="etc" value="${env.SPEEDO_CONF}">
|
||||
<isset property="env.SPEEDO_CONF"/>
|
||||
</condition>
|
||||
<property name="etc" value="${basedir}/../siprp"/>
|
||||
<property file="${etc}/speedo.properties"/>
|
||||
<fail unless="org.objectweb.speedo.mapperName"
|
||||
message="YOU MUST CONFIGURE THE FILE ${etc}/speedo.properties"/>
|
||||
<condition property="speedo.archive.exist">
|
||||
<available file="${dist}/speedo.jar"/>
|
||||
</condition>
|
||||
<fail unless="speedo.archive.exist"
|
||||
message="YOU MUST BUILD SPEEDO ARCHIVE in the speedo distribution by lauching the build.xml (Ant)"/>
|
||||
|
||||
<!-- Building of a path which contains external jars -->
|
||||
<path id="classpath">
|
||||
<pathelement location="${etc}"/>
|
||||
<pathelement location="${basedir}/../evutils"/>
|
||||
<pathelement location="${basedir}/../siprp"/>
|
||||
<pathelement location="${basedir}/../images"/>
|
||||
<pathelement location="${build}"/>
|
||||
<fileset dir="${dist}">
|
||||
<include name="speedo.jar"/>
|
||||
<include name="jcalendar.jar"/>
|
||||
<include name="jxl.jar"/>
|
||||
<!-- <include name="lib/log/log4j.jar"/> -->
|
||||
<include name="mysql*.jar"/>
|
||||
<include name="iText.jar"/>
|
||||
</fileset>
|
||||
</path>
|
||||
</target>
|
||||
|
||||
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- ======================= Generation =========================== -->
|
||||
<!-- ============================================================== -->
|
||||
|
||||
<target name="compile" depends="init">
|
||||
<mkdir dir="${build}"/>
|
||||
<javac srcdir="${src}" destdir="${build}" debug="on">
|
||||
<classpath refid="classpath"/>
|
||||
<include name="**/*.java"/>
|
||||
</javac>
|
||||
<taskdef name ="speedo"
|
||||
classname="org.objectweb.speedo.ant.AntSpeedo"
|
||||
classpathref="classpath" />
|
||||
<speedo confFile="${etc}/speedo.properties"
|
||||
output="${build}"
|
||||
src="${src}"
|
||||
classpathref="classpath"/>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- ======================== Cleaning ============================ -->
|
||||
<!-- ============================================================== -->
|
||||
<target name="clean" depends="init">
|
||||
<delete dir="${build}"/>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- =========================== Run ============================== -->
|
||||
<!-- ============================================================== -->
|
||||
<target name="createDataStruct" depends="init"
|
||||
description="Create the data structure for persistent classes">
|
||||
<property environment="env"/>
|
||||
<java classname="org.objectweb.speedo.tools.DataStructureCreation"
|
||||
fork="yes" classpathref="classpath">
|
||||
<arg line="siprp.data.Contacto siprp.data.Empresa siprp.data.Estabelecimento siprp.data.Trabalhador siprp.data.Aviso siprp.data.Marcacao siprp.data.MarcacaoEstabelecimento siprp.data.MarcacaoTrabalhador"/>
|
||||
<!--<arg line="siprp.data.Contacto invoice.Address invoice.Invoice invoice.Product invoice.ProductUnits"/>-->
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="run" depends="init">
|
||||
<java classname="siprp.Main" fork="yes" classpathref="classpath">
|
||||
<sysproperty key="server.address"
|
||||
value="ws_fpalma"
|
||||
/>
|
||||
<arg value="${etc}/speedo.properties"/>
|
||||
</java>
|
||||
</target>
|
||||
</project>
|
||||
@ -0,0 +1,7 @@
|
||||
cd build
|
||||
cd classes
|
||||
java -cp .;../../evutils;../../jpox;../../jpox/jpox-1.0.4.jar;../../jpox/jpox-enhancer-1.0.4.jar;../../jars/log4j-1.2.8.jar;../../jdo/jdo.jar;../../jdo;../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/data/package.jdo
|
||||
java -cp .;../../evutils;../../jpox;../../jpox/jpox-1.0.4.jar;../../jpox/jpox-enhancer-1.0.4.jar;../../jars/log4j-1.2.8.jar;../../jdo/jdo.jar;../../jdo;../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/medicina/prestadores/data/package.jdo
|
||||
java -cp .;../../evutils;../../jpox;../../jpox/jpox-1.0.4.jar;../../jpox/jpox-enhancer-1.0.4.jar;../../jars/log4j-1.2.8.jar;../../jdo/jdo.jar;../../jdo;../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/medicina/processo/data/package.jdo
|
||||
cd ..
|
||||
cd ..
|
||||
@ -0,0 +1,7 @@
|
||||
cd build
|
||||
cd classes
|
||||
java -cp .:../../evutils:../../jpox:../../jpox/jpox-1.0.4.jar:../../jpox/jpox-enhancer-1.0.4.jar:../../jars/log4j-1.2.8.jar:../../jdo/jdo.jar:../../jdo:../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/data/package.jdo
|
||||
java -cp .:../../evutils:../../jpox:../../jpox/jpox-1.0.4.jar:../../jpox/jpox-enhancer-1.0.4.jar:../../jars/log4j-1.2.8.jar:../../jdo/jdo.jar:../../jdo:../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/medicina/prestadores/data/package.jdo
|
||||
java -cp .:../../evutils:../../jpox:../../jpox/jpox-1.0.4.jar:../../jpox/jpox-enhancer-1.0.4.jar:../../jars/log4j-1.2.8.jar:../../jdo/jdo.jar:../../jdo:../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/medicina/processo/data/package.jdo
|
||||
cd ..
|
||||
cd ..
|
||||
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- JNLP File for CIMCP Application -->
|
||||
<jnlp
|
||||
spec="1.0+"
|
||||
codebase="http://www.evolute.pt/~siprp/shst/"
|
||||
href="siprp.jnlp">
|
||||
<information>
|
||||
<title>SIPRP</title>
|
||||
<vendor>EVOLUTE 2005</vendor>
|
||||
<homepage href="http://www.siprp.pt/"/>
|
||||
<description>SIPRP, v3.2</description>
|
||||
<description kind="short">SIPRP</description>
|
||||
<icon href="images/logo_combo.jpg"/>
|
||||
<icon kind="splash" href="images/logo_combo.jpg"/>
|
||||
<offline-allowed/>
|
||||
<shortcut online="false">
|
||||
<desktop/>
|
||||
</shortcut>
|
||||
</information>
|
||||
<security>
|
||||
<all-permissions/>
|
||||
</security>
|
||||
<resources>
|
||||
<property name="server.address" value="10.158.2.2" />
|
||||
<j2se version="1.4+"/>
|
||||
<jar href="lib/ssiprp.jar"/>
|
||||
<jar href="lib/sevutils.jar"/>
|
||||
<jar href="lib/simages.jar"/>
|
||||
<jar href="lib/sjdo_jpox.jar"/>
|
||||
<jar href="lib/sjcalendar.jar"/>
|
||||
<jar href="lib/sjxl.jar"/>
|
||||
<jar href="lib/sjdo.jar"/>
|
||||
<jar href="lib/sjpox-1.0.4.jar"/>
|
||||
<jar href="lib/slog4j-1.2.8.jar"/>
|
||||
<jar href="lib/siText.jar"/>
|
||||
<jar href="lib/sjpox-1.0.4.jar"/>
|
||||
<jar href="lib/smysql-connector-java-3.0.11-stable-bin.jar"/>
|
||||
</resources>
|
||||
<application-desc main-class="siprp.Main"/>
|
||||
</jnlp>
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
log4j.rootCategory=ERROR, dest1
|
||||
log4j.appender.dest1=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
|
||||
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 27 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* CompanyDataLoader.java
|
||||
*
|
||||
* Created on 25 de Janeiro de 2005, 13:18
|
||||
*/
|
||||
|
||||
package siprp;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public interface CompanyDataLoader
|
||||
{
|
||||
public static final String DATA = "XDATAX";
|
||||
public static final String NOME = "XNOMEX";
|
||||
public static final String MORADA = "XMORADAX";
|
||||
public static final String HORA = "XHORAX";
|
||||
public void load();
|
||||
}
|
||||
@ -0,0 +1,698 @@
|
||||
/*
|
||||
* FichaDataProvider.java
|
||||
*
|
||||
* Created on 30 de Marco de 2004, 11:31
|
||||
*/
|
||||
|
||||
package siprp;
|
||||
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.arrays.*;
|
||||
import com.evolute.utils.data.*;
|
||||
import com.evolute.utils.db.*;
|
||||
import com.evolute.utils.db.keyretrievers.*;
|
||||
import com.evolute.utils.metadb.*;
|
||||
import com.evolute.utils.ui.search.*;
|
||||
import com.evolute.utils.sql.*;
|
||||
import com.evolute.utils.strings.*;
|
||||
|
||||
import siprp.data.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author pars
|
||||
*/
|
||||
public class FichaDataProvider extends MetaProvider implements SearchExecuter {
|
||||
|
||||
private static final Object LOCK = new Object();
|
||||
private static FichaDataProvider instance = null;
|
||||
private final Executer executer;
|
||||
|
||||
public static final String SIPRP = "SIPRP - Sociedade Ib\u00e9rica de Preven\u00e7\u00e3o de Riscos Profissionais";
|
||||
|
||||
// empresas
|
||||
public static final String T_EMPRESAS = "empresas";
|
||||
public static final String ID = "id";
|
||||
public static final String DESIGNACAO_SOCIAL = "designacao_social";
|
||||
public static final String SERVICO_SAUDE_TIPO = "servico_saude_tipo";
|
||||
public static final String SERVICO_SAUDE_DESIGNACAO = "servico_saude_designacao";
|
||||
public static final String SERVICO_HIGIENE_TIPO = "servico_higiene_tipo";
|
||||
public static final String SERVICO_HIGIENE_DESIGNACAO = "servico_higiene_designacao";
|
||||
public static final String INACTIVO = "inactivo";
|
||||
|
||||
public static final DBTable EMPRESAS =
|
||||
new DBTable( T_EMPRESAS,
|
||||
new String[]{ DESIGNACAO_SOCIAL,
|
||||
SERVICO_SAUDE_TIPO,
|
||||
SERVICO_SAUDE_DESIGNACAO,
|
||||
SERVICO_HIGIENE_TIPO,
|
||||
SERVICO_HIGIENE_DESIGNACAO,
|
||||
INACTIVO },
|
||||
ID );
|
||||
|
||||
// estabelecimentos
|
||||
public static final String T_ESTABELECIMENTOS = "estabelecimentos";
|
||||
// ID
|
||||
public static final String NOME = "nome";
|
||||
public static final String LOCALIDADE = "localidade";
|
||||
public static final String EMPRESA_ID = "empresa_id";
|
||||
// INACTIVO
|
||||
|
||||
public static final DBTable ESTABELECIMENTOS =
|
||||
new DBTable( T_ESTABELECIMENTOS,
|
||||
new String[]{ NOME, LOCALIDADE, EMPRESA_ID, INACTIVO },
|
||||
ID );
|
||||
|
||||
// trabalhadores
|
||||
public static final String T_TRABALHADORES = "trabalhadores";
|
||||
// ID
|
||||
// public static final String NOME = "nome";
|
||||
public static final String SEXO = "sexo";
|
||||
public static final String DATA_NASCIMENTO = "data_nascimento";
|
||||
public static final String NACIONALIDADE = "nacionalidade";
|
||||
public static final String NUMERO_MECANOGRAFICO = "numero_mecanografico";
|
||||
public static final String DATA_ADMISSAO = "data_admissao";
|
||||
public static final String CATEGORIA = "categoria";
|
||||
public static final String LOCAL_TRABALHO = "local_trabalho";
|
||||
public static final String FUNCAO_PROPOSTA = "funcao_proposta";
|
||||
public static final String DATA_ADMISSAO_FUNCAO = "data_admissao_funcao";
|
||||
public static final String OBSERVACOES = "observacoes";
|
||||
public static final String ESTABELECIMENTO_ID = "estabelecimento_id";
|
||||
// INACTIVO
|
||||
|
||||
public static final DBTable TRABALHADORES =
|
||||
new DBTable( T_TRABALHADORES,
|
||||
new String[]{ NOME, SEXO, DATA_NASCIMENTO,
|
||||
NACIONALIDADE, NUMERO_MECANOGRAFICO,
|
||||
DATA_ADMISSAO, CATEGORIA, LOCAL_TRABALHO,
|
||||
FUNCAO_PROPOSTA, DATA_ADMISSAO_FUNCAO,
|
||||
OBSERVACOES, ESTABELECIMENTO_ID, INACTIVO },
|
||||
ID );
|
||||
|
||||
//medicos
|
||||
public static final String T_MEDICOS = "medicos";
|
||||
|
||||
public static final String NUMERO_CEDULA = "numero_cedula";
|
||||
|
||||
public static final DBTable MEDICOS =
|
||||
new DBTable( T_MEDICOS,
|
||||
new String[]{ NOME, NUMERO_CEDULA }, ID );
|
||||
|
||||
// exames
|
||||
public static final String T_EXAMES = "exames";
|
||||
// ID
|
||||
public static final String DATA = "data";
|
||||
public static final String TIPO = "tipo";
|
||||
public static final String OCASIONAL = "ocasional";
|
||||
public static final String OUTRO_TIPO = "outro_tipo";
|
||||
public static final String RESULTADO = "resultado";
|
||||
public static final String OUTRA_FUNCAO_1 = "outra_funcao_1";
|
||||
public static final String OUTRA_FUNCAO_2 = "outra_funcao_2";
|
||||
public static final String OUTRA_FUNCAO_3 = "outra_funcao_3";
|
||||
public static final String OUTRA_FUNCAO_4 = "outra_funcao_4";
|
||||
public static final String PROXIMO_EXAME = "proximo_exame";
|
||||
public static final String OUTRAS_RECOMENDACOES = "outras_recomendacoes";
|
||||
public static final String TRABALHADOR_ID = "trabalhador_id";
|
||||
public static final String MEDICO_ID = "medico_id";
|
||||
public static final String PDF = "pdf";
|
||||
|
||||
public static final DBTable EXAMES =
|
||||
new DBTable( T_EXAMES,
|
||||
new String[]{ DATA, TIPO, OCASIONAL,
|
||||
OUTRO_TIPO, RESULTADO, OUTRA_FUNCAO_1,
|
||||
OUTRA_FUNCAO_2, OUTRA_FUNCAO_3,
|
||||
OUTRA_FUNCAO_4, PROXIMO_EXAME,
|
||||
OUTRAS_RECOMENDACOES, TRABALHADOR_ID, MEDICO_ID, PDF, INACTIVO },
|
||||
ID );
|
||||
|
||||
public static DBReference R_ESTABELECIMENTO_EMPRESA = new DBReference( ESTABELECIMENTOS.getFieldByName( EMPRESA_ID ) );
|
||||
public static DBReference R_TRABALHADOR_ESTABELECIMENTO = new DBReference( TRABALHADORES.getFieldByName( ESTABELECIMENTO_ID ) );
|
||||
public static DBReference R_EXAME_TRABALHADOR = new DBReference( EXAMES.getFieldByName( TRABALHADOR_ID ) );
|
||||
public static DBReference R_EXAME_MEDICO = new DBReference( EXAMES.getFieldByName( MEDICO_ID ) );
|
||||
static
|
||||
{
|
||||
try
|
||||
{
|
||||
EXAMES.addRelation( MEDICOS,
|
||||
new DBField[]{ EXAMES.getFieldByName( MEDICO_ID ) },
|
||||
"R_EXAMES_MEDICOS" );
|
||||
EXAMES.addRelation( TRABALHADORES,
|
||||
new DBField[]{ EXAMES.getFieldByName( TRABALHADOR_ID ) },
|
||||
"R_EXAMES_TRABALHADORES" );
|
||||
TRABALHADORES.addRelation( ESTABELECIMENTOS,
|
||||
new DBField[]{ TRABALHADORES.getFieldByName( ESTABELECIMENTO_ID ) },
|
||||
"R_TRABALHADORES_ESTABELECIMENTOS" );
|
||||
ESTABELECIMENTOS.addRelation( EMPRESAS,
|
||||
new DBField[]{ ESTABELECIMENTOS.getFieldByName( EMPRESA_ID ) },
|
||||
"R_ESTABELECIMENTOS_EMPRESAS" );
|
||||
EMPRESAS.disableSave( INACTIVO );
|
||||
ESTABELECIMENTOS.disableSave( INACTIVO );
|
||||
TRABALHADORES.disableSave( INACTIVO );
|
||||
EXAMES.disableSave( PDF );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
throw new RuntimeException( e );
|
||||
}
|
||||
}
|
||||
|
||||
public static final int SEARCH_EMPRESAS = 0;
|
||||
public static final int SEARCH_ESTABELECIMENTOS = 1;
|
||||
public static final int SEARCH_TRABALHADORES = 2;
|
||||
public static final int SEARCH_EXAMES = 3;
|
||||
private int SEARCH = 0;
|
||||
private int SEARCH_EMPRESAS_ID = -1;
|
||||
private int SEARCH_ESTABELECIMENTOS_ID = -1;
|
||||
private int SEARCH_TRABALHADORES_ID = -1;
|
||||
private int SEARCH_EXAMES_ID = -1;
|
||||
|
||||
protected final Hashtable medicosEstabelecimentosHash = new Hashtable();
|
||||
|
||||
/** Creates a new instance of FichaDataProvider */
|
||||
public FichaDataProvider()
|
||||
throws Exception
|
||||
{
|
||||
DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ );
|
||||
executer = dbm.getSharedExecuter( this );
|
||||
|
||||
setDBTable( EXAMES );
|
||||
|
||||
}
|
||||
|
||||
public static MetaProvider getProvider()
|
||||
throws Exception
|
||||
{
|
||||
synchronized( LOCK )
|
||||
{
|
||||
if( instance == null )
|
||||
{
|
||||
instance = new FichaDataProvider();
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public String[] getColumnNames() {
|
||||
return new String[]{ "Nome" };
|
||||
}
|
||||
|
||||
public String getSearchTitle() {
|
||||
switch( SEARCH )
|
||||
{
|
||||
case SEARCH_EMPRESAS:
|
||||
return "Procurar empresa";
|
||||
case SEARCH_ESTABELECIMENTOS:
|
||||
return "Procurar estabelecimento";
|
||||
case SEARCH_TRABALHADORES:
|
||||
return "Procurar trabalhador";
|
||||
case SEARCH_EXAMES:
|
||||
return "Procurar exame";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean hasDetails() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setSearch( int what )
|
||||
{
|
||||
switch( what )
|
||||
{
|
||||
case SEARCH_EMPRESAS:
|
||||
case SEARCH_ESTABELECIMENTOS:
|
||||
case SEARCH_TRABALHADORES:
|
||||
case SEARCH_EXAMES:
|
||||
SEARCH = what;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void setSearchID( int what, int id )
|
||||
{
|
||||
switch( what )
|
||||
{
|
||||
case SEARCH_EMPRESAS:
|
||||
SEARCH_EMPRESAS_ID = id;
|
||||
break;
|
||||
case SEARCH_ESTABELECIMENTOS:
|
||||
SEARCH_ESTABELECIMENTOS_ID = id;
|
||||
break;
|
||||
case SEARCH_TRABALHADORES:
|
||||
SEARCH_TRABALHADORES_ID = id;
|
||||
break;
|
||||
case SEARCH_EXAMES:
|
||||
SEARCH_EXAMES_ID = id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public Virtual2DArray search( String pattern ) throws Exception {
|
||||
switch( SEARCH )
|
||||
{
|
||||
case SEARCH_EMPRESAS:
|
||||
return searchEmpresas( pattern );
|
||||
case SEARCH_ESTABELECIMENTOS:
|
||||
return searchEstabelecimentos( pattern );
|
||||
case SEARCH_TRABALHADORES:
|
||||
return searchTrabalhadores( pattern );
|
||||
case SEARCH_EXAMES:
|
||||
return searchExames( pattern );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Virtual2DArray searchEmpresas( String pattern ) throws Exception {
|
||||
Select select = new Select( new String[]{ T_EMPRESAS },
|
||||
new String[]{ ID, DESIGNACAO_SOCIAL, "designacao_social_plain" },
|
||||
new Field( "designacao_social_plain" ).isLike( "%" + StringPlainer.convertString( pattern, false, false ) + "%" ).and(
|
||||
new Field( INACTIVO ).isDifferent( "y" ) ),
|
||||
new String[]{ "designacao_social_plain" }, null );
|
||||
// Select select = new Select( "SELECT e.id, e.designacao_social FROM empresas e ORDER BY lower( e.designacao_social );" );
|
||||
return executer.executeQuery( select );
|
||||
}
|
||||
|
||||
public Virtual2DArray searchEstabelecimentos( String pattern ) throws Exception {
|
||||
// Select select = new Select( "SELECT e.id, e.nome FROM estabelecimentos e WHERE empresa_id = " + SEARCH_EMPRESAS_ID
|
||||
// + " ORDER BY lower( e.nome )");
|
||||
Select select = new Select( new String[]{ T_ESTABELECIMENTOS },
|
||||
new String[]{ ID, NOME, "nome_plain" },
|
||||
new Field( "nome_plain" ).isLike( "%" + StringPlainer.convertString( pattern, false, false ) + "%" ).and(
|
||||
new Field( EMPRESA_ID ).isEqual( new Integer( SEARCH_EMPRESAS_ID ) ) ).and(
|
||||
new Field( INACTIVO ).isDifferent( "y" ) ),
|
||||
new String[]{ "nome_plain" }, null );
|
||||
return executer.executeQuery( select );
|
||||
}
|
||||
|
||||
public Virtual2DArray searchTrabalhadores( String pattern ) throws Exception {
|
||||
// Select select =
|
||||
// new Select( "SELECT t.id, t.nome FROM trabalhadores t, estabelecimentos es "
|
||||
// + " WHERE t.estabelecimento_id = es.id "
|
||||
// + " AND es.empresa_id = " + SEARCH_EMPRESAS_ID + " ORDER BY lower(t.nome);" );
|
||||
Select select = new Select( new String[]{ T_TRABALHADORES, T_ESTABELECIMENTOS },
|
||||
new String[]{ T_TRABALHADORES + "." + ID, T_TRABALHADORES + "." + NOME },
|
||||
new Field( T_TRABALHADORES + ".nome_plain" ).isLike( "%" + StringPlainer.convertString( pattern, false, false ) + "%" ).and(
|
||||
new Field( ESTABELECIMENTO_ID ).isEqual( new Field( T_ESTABELECIMENTOS + "." + ID ) ) ).and(
|
||||
new Field( ESTABELECIMENTO_ID ).isEqual( new Integer( SEARCH_ESTABELECIMENTOS_ID ) ) ).and(
|
||||
new Field( EMPRESA_ID ).isEqual( new Integer( SEARCH_EMPRESAS_ID ) ) ).and(
|
||||
new Field( T_TRABALHADORES + "." + INACTIVO ).isDifferent( "y" ) ),
|
||||
new String[]{ T_TRABALHADORES + ".nome_plain" }, null );
|
||||
return executer.executeQuery( select );
|
||||
}
|
||||
|
||||
public Virtual2DArray searchExames( String pattern ) throws Exception {
|
||||
Select select = new Select( "SELECT e.id, e.data FROM exames e "
|
||||
+ " WHERE e.trabalhador_id = " + SEARCH_TRABALHADORES_ID
|
||||
+ " ORDER BY e.data DESC;" );
|
||||
return executer.executeQuery( select );
|
||||
}
|
||||
|
||||
public void showDetails(SearchDialog dialog, Object o) throws Exception {
|
||||
}
|
||||
|
||||
public Object [][]getAllMedicos()
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_MEDICOS },
|
||||
new String[]{ ID, NOME, NUMERO_CEDULA },
|
||||
null, new String[]{ NOME }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
return array.getObjects();
|
||||
}
|
||||
|
||||
public void savePDF( MetaObject exame )
|
||||
throws Exception
|
||||
{
|
||||
if( exame == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
DBKey key = exame.getPrimaryKeyValue();
|
||||
DBField fields[] = EXAMES.getPrimaryKey();
|
||||
Integer id = new Integer( ((Number)key.getFieldValue( fields[ 0 ] )).intValue() );
|
||||
if( id == null )
|
||||
{
|
||||
throw new Exception( "Error saving pdf: id is null" );
|
||||
}
|
||||
byte []pdf = (byte[]) exame.getProperty( PDF );
|
||||
BlobUpdate bUpdate = new BlobUpdate( T_EXAMES, PDF, pdf, new Field( ID ).isEqual( id ) );
|
||||
executer.executeQuery( bUpdate );
|
||||
}
|
||||
|
||||
public Integer getLastExameIDForTrabalhador( Integer trabalhadorID )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_EXAMES },
|
||||
new String[]{ ID, DATA },
|
||||
new Field( TRABALHADOR_ID ).isEqual( trabalhadorID ),
|
||||
new String[]{ DATA + " DESC", ID + " DESC" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Integer( ( (Number) array.get( 0, 0 ) ).intValue() );
|
||||
}
|
||||
|
||||
public IDObject []getAllFichasForTrabalhador( Integer trabalhadorID )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ T_EXAMES }, new String[]{ "MAX("+ID+")", DATA },
|
||||
new Field( TRABALHADOR_ID ).isEqual( trabalhadorID ).and(
|
||||
new Field( INACTIVO ).isEqual( "n" ) ),
|
||||
new String[]{ DATA + " DESC" }, new String[]{ DATA } );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
IDObject exames[] = new IDObject[ array.columnLength() ];
|
||||
DateFormat df = DateFormat.getDateInstance( DateFormat.SHORT );
|
||||
for( int n = 0; n < exames.length; n++ )
|
||||
{
|
||||
Date date = (Date)array.get( n, 1 );
|
||||
Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() );
|
||||
exames[ n ] = new MappableObject( id, date != null? df.format( date ): "" );
|
||||
}
|
||||
return exames;
|
||||
}
|
||||
|
||||
public IDObject []getAllEstabelecimentosForEmpresa( Integer empresaID )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_ESTABELECIMENTOS },
|
||||
new String[]{ ID, NOME, "nome_plain" },
|
||||
new Field( EMPRESA_ID ).isEqual( empresaID ).and(
|
||||
new Field( INACTIVO ).isDifferent( "y" ) ),
|
||||
new String[]{ "nome_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
IDObject objects[] = new IDObject[ array.columnLength() ];
|
||||
for( int n = 0; n < objects.length; n++ )
|
||||
{
|
||||
Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() );
|
||||
String desc = (String)array.get( n, 1 );
|
||||
objects[ n ] = new MappableObject( id, desc );
|
||||
}
|
||||
return objects;
|
||||
}
|
||||
|
||||
public IDObject []getAllTrabalhadoresForEmpresa( Integer empresaID )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_TRABALHADORES, T_ESTABELECIMENTOS },
|
||||
new String[]{ T_TRABALHADORES + "." + ID,
|
||||
T_TRABALHADORES + "." + NOME,
|
||||
T_TRABALHADORES + ".nome_plain" },
|
||||
new Field( T_ESTABELECIMENTOS + "." + EMPRESA_ID ).isEqual( empresaID ).and(
|
||||
new Field( T_TRABALHADORES + "." + ESTABELECIMENTO_ID ).isEqual(
|
||||
new Field( T_ESTABELECIMENTOS + "." + ID ) ) ),
|
||||
new String[]{ T_TRABALHADORES + ".nome_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
IDObject objects[] = new IDObject[ array.columnLength() ];
|
||||
for( int n = 0; n < objects.length; n++ )
|
||||
{
|
||||
Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() );
|
||||
String desc = (String)array.get( n, 1 );
|
||||
objects[ n ] = new MappableObject( id, desc );
|
||||
}
|
||||
return objects;
|
||||
}
|
||||
|
||||
public IDObject []getAllTrabalhadoresForEstabelecimento( Integer estabelecimentoID )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_TRABALHADORES },
|
||||
new String[]{ ID, NOME, "nome_plain" },
|
||||
new Field( ESTABELECIMENTO_ID ).isEqual( estabelecimentoID ).and(
|
||||
new Field( INACTIVO ).isDifferent( "y" ) ),
|
||||
new String[]{ "nome_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
IDObject objects[] = new IDObject[ array.columnLength() ];
|
||||
for( int n = 0; n < objects.length; n++ )
|
||||
{
|
||||
Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() );
|
||||
String desc = (String)array.get( n, 1 );
|
||||
objects[ n ] = new MappableObject( id, desc );
|
||||
}
|
||||
return objects;
|
||||
}
|
||||
|
||||
public Integer getEstabelecimentoIDForTrabalhador( Integer trabalhadorID )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_TRABALHADORES },
|
||||
new String[]{ ESTABELECIMENTO_ID },
|
||||
new Field( ID ).isEqual( trabalhadorID ).and(
|
||||
new Field( INACTIVO ).isDifferent( "y" ) ),
|
||||
null, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
Integer estabelecimentoID = null;
|
||||
if( array != null && array.columnLength() > 0 )
|
||||
{
|
||||
estabelecimentoID = ( Integer )array.get( 0, 0 );
|
||||
}
|
||||
return estabelecimentoID;
|
||||
}
|
||||
|
||||
public Integer getEmpresaIDForEstabelecimento( Integer estabelecimentoID )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_ESTABELECIMENTOS },
|
||||
new String[]{ EMPRESA_ID },
|
||||
new Field( ID ).isEqual( estabelecimentoID ).and(
|
||||
new Field( INACTIVO ).isDifferent( "y" ) ),
|
||||
null, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
Integer empresaID = null;
|
||||
if( array != null && array.columnLength() > 0 )
|
||||
{
|
||||
empresaID = ( Integer )array.get( 0, 0 );
|
||||
}
|
||||
return empresaID;
|
||||
}
|
||||
|
||||
public Integer []getAvisosIDByTipoAndDate( Integer tipo, Date date )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ "avisos" }, new String[]{ "id", "data_evento" },
|
||||
new Field( "tipo" ).isEqual( tipo ).and(
|
||||
new Field( "data_aviso" ).isLessOrEqual( date )),
|
||||
new String[]{ "data_evento" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
Integer ids[] = new Integer[ array.columnLength() ];
|
||||
for( int n = 0; n < ids.length; n++ )
|
||||
{
|
||||
ids[ n ] = new Integer( ((Number)array.get( n, 0 )).intValue() );
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
public Object [][]getAvisosTrabalhadorByDate( Date date )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ "avisos", "empresas", "estabelecimentos", "trabalhadores" },
|
||||
new String[]{ "avisos.id", "avisos.data_evento", "avisos.descricao",
|
||||
"empresas.designacao_social", "estabelecimentos.nome",
|
||||
"trabalhadores.nome", "data_aviso" },
|
||||
new Field( "tipo" ).isEqual( new Integer( AvisoConstants.TIPO_TRABALHADOR ) ).and(
|
||||
new Field( "data_aviso" ).isLessOrEqual( date ) ).and(
|
||||
new Field( "avisos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ).and(
|
||||
new Field( "avisos.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "avisos.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ),
|
||||
new String[]{ "data_evento" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
return array.getObjects();
|
||||
}
|
||||
|
||||
public Object [][]getAvisosEstabelecimentoByDate( Date date )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ "avisos", "empresas", "estabelecimentos" },
|
||||
new String[]{ "avisos.id", "avisos.data_evento", "avisos.descricao",
|
||||
"empresas.designacao_social", "estabelecimentos.nome", "data_aviso" },
|
||||
new Field( "tipo" ).isEqual( new Integer( AvisoConstants.TIPO_ESTABELECIMENTO ) ).and(
|
||||
new Field( "data_aviso" ).isLessOrEqual( date ) ).and(
|
||||
new Field( "avisos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ).and(
|
||||
new Field( "avisos.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ),
|
||||
new String[]{ "data_evento" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
return array.getObjects();
|
||||
}
|
||||
|
||||
public Object [][]getAvisosEmpresaByDate( Date date )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ "avisos", "empresas" },
|
||||
new String[]{ "avisos.id", "avisos.data_evento", "avisos.descricao",
|
||||
"empresas.designacao_social", "data_aviso" },
|
||||
new Field( "tipo" ).isEqual( new Integer( AvisoConstants.TIPO_EMPRESA ) ).and(
|
||||
new Field( "data_aviso" ).isLessOrEqual( date ) ).and(
|
||||
new Field( "avisos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ),
|
||||
new String[]{ "data_evento" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
return array.getObjects();
|
||||
}
|
||||
|
||||
public Integer getMarcacaoIDByTrabalhador( Integer trabalhadorID )
|
||||
throws Exception
|
||||
{
|
||||
Select realizadaSelect =
|
||||
new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ "MAX(data)" },
|
||||
new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and(
|
||||
new Field( "estado" ).isEqual( new Integer( 2 ) ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( siprp.data.MarcacaoTrabalhadorData.TIPO_CONSULTA ) ) ) );
|
||||
Virtual2DArray realizadaArray = executer.executeQuery( realizadaSelect );
|
||||
Date realizada = (Date) realizadaArray.get( 0, 0 );
|
||||
Select select;
|
||||
if( realizada == null )
|
||||
{
|
||||
select = new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ "MIN(id)" },
|
||||
new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and(
|
||||
new Field( "estado" ).isEqual( new Integer( 0 ) ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( siprp.data.MarcacaoTrabalhadorData.TIPO_CONSULTA ) ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
select = new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ "MIN(id)" },
|
||||
new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and(
|
||||
new Field( "estado" ).isEqual( new Integer( 0 ) ) ).and(
|
||||
new Field( "data" ).isGreater( realizada ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( siprp.data.MarcacaoTrabalhadorData.TIPO_CONSULTA ) ) ) );
|
||||
}
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Integer( ( ( Number ) array.get( 0, 0 ) ).intValue() );
|
||||
}
|
||||
|
||||
public IDObject[] getAllEmpresasDeleted()
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_EMPRESAS },
|
||||
new String[]{ ID, DESIGNACAO_SOCIAL, "designacao_social_plain" },
|
||||
new Field( INACTIVO ).isEqual( "y" ),
|
||||
new String[]{ "designacao_social_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
IDObject empresas[] = new IDObject[ array.columnLength() ];
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() );
|
||||
String designacao = ( String ) array.get( n, 1 );
|
||||
empresas[ n ] = new MappableObject( id, designacao );
|
||||
}
|
||||
return empresas;
|
||||
}
|
||||
|
||||
public IDObject []getAllEstabelecimentosDeletedForEmpresa( Integer empresaID )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_ESTABELECIMENTOS },
|
||||
new String[]{ ID, NOME, "nome_plain" },
|
||||
new Field( EMPRESA_ID ).isEqual( empresaID ).and(
|
||||
new Field( INACTIVO ).isEqual( "y" ) ),
|
||||
new String[]{ "nome_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
IDObject objects[] = new IDObject[ array.columnLength() ];
|
||||
for( int n = 0; n < objects.length; n++ )
|
||||
{
|
||||
Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() );
|
||||
String desc = (String)array.get( n, 1 );
|
||||
objects[ n ] = new MappableObject( id, desc );
|
||||
}
|
||||
return objects;
|
||||
}
|
||||
|
||||
public IDObject []getAllTrabalhadoresDeletedForEstabelecimento( Integer estabelecimentoID )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_TRABALHADORES },
|
||||
new String[]{ ID, NOME, "nome_plain" },
|
||||
new Field( ESTABELECIMENTO_ID ).isEqual( estabelecimentoID ).and(
|
||||
new Field( INACTIVO ).isEqual( "y" ) ),
|
||||
new String[]{ "nome_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
IDObject objects[] = new IDObject[ array.columnLength() ];
|
||||
for( int n = 0; n < objects.length; n++ )
|
||||
{
|
||||
Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() );
|
||||
String desc = (String)array.get( n, 1 );
|
||||
objects[ n ] = new MappableObject( id, desc );
|
||||
}
|
||||
return objects;
|
||||
}
|
||||
|
||||
public Object[] getDadosUltimaMarcacao( Integer trabalhadorID )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ "MAX( data )" },
|
||||
new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and(
|
||||
new Field( "realizada" ).isEqual( "y" ).or(
|
||||
new Field( "estado" ).isEqual( new Integer( 2 ) ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return new Object[]{ null, null };
|
||||
}
|
||||
Date data = ( Date ) array.get( 0, 0 );
|
||||
select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ "motivo", "id" },
|
||||
new Field( "data" ).isEqual( data ).and(
|
||||
new Field( "trabalhador_id" ).isEqual( trabalhadorID ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and(
|
||||
new Field( "realizada" ).isEqual( "y" ).or(
|
||||
new Field( "estado" ).isEqual( new Integer( 2 ) ) ) ),
|
||||
new String[]{ "id" }, null );
|
||||
array = executer.executeQuery( select );
|
||||
Integer tipo = ( Integer ) array.get( 0, 0 );
|
||||
if( tipo.intValue() == 5 )
|
||||
{
|
||||
tipo = new Integer( 2 );
|
||||
}
|
||||
return new Object[]{ data, tipo };
|
||||
}
|
||||
|
||||
public void setMedicoForEstabelecimento( Integer estabelecimentoID, Integer medicoID )
|
||||
throws Exception
|
||||
{
|
||||
Integer medicoAntigo = ( Integer ) medicosEstabelecimentosHash.get( estabelecimentoID );
|
||||
if( !medicoID.equals( medicoAntigo ) )
|
||||
{
|
||||
Update update =
|
||||
new Update( "estabelecimentos",
|
||||
new Assignment[]{
|
||||
new Assignment( new Field( "medico_id" ), medicoID ) },
|
||||
new Field( "id" ).isEqual( estabelecimentoID ) );
|
||||
executer.executeQuery( update );
|
||||
medicosEstabelecimentosHash.put( estabelecimentoID, medicoID );
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getMedicoForEstabelecimento( Integer estabelecimentoID )
|
||||
throws Exception
|
||||
{
|
||||
if( !medicosEstabelecimentosHash.containsKey( estabelecimentoID ) )
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "estabelecimentos" },
|
||||
new String[]{ "medico_id" },
|
||||
new Field( "id" ).isEqual( estabelecimentoID ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
Integer medicoID = ( Integer ) array.get( 0, 0 );
|
||||
if( medicoID == null )
|
||||
{
|
||||
medicoID = new Integer( -1 );
|
||||
}
|
||||
medicosEstabelecimentosHash.put( estabelecimentoID, medicoID );
|
||||
}
|
||||
return ( Integer ) medicosEstabelecimentosHash.get( estabelecimentoID );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,285 @@
|
||||
package siprp;
|
||||
|
||||
import siprp.companydataloaders.*;
|
||||
import siprp.data.*;
|
||||
import siprp.clientes.*;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.db.*;
|
||||
import com.evolute.utils.db.keyretrievers.*;
|
||||
import com.evolute.utils.error.*;
|
||||
import com.evolute.utils.jdbc.*;
|
||||
import com.evolute.utils.jdo.*;
|
||||
import com.evolute.utils.sql.*;
|
||||
import com.evolute.utils.ui.*;
|
||||
import com.evolute.utils.ui.window.*;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.*;
|
||||
import siprp.update.UpdateWindow;
|
||||
|
||||
public class Main implements com.evolute.utils.ui.window.Connector
|
||||
{
|
||||
public final static String SHST_VERSION = "7.8";
|
||||
|
||||
private final static ClassLoader classLoader = new EVUtilsImageLib().getClass().getClassLoader();
|
||||
|
||||
private static String dbase;
|
||||
private SIPRPTracker siprpTracker;
|
||||
|
||||
private static AvisosPanel avisos = null;
|
||||
|
||||
static
|
||||
{
|
||||
JDOObject.registerOperationHandlerForClass( DisableDeleteHandler.INSTANCE, EmpresaData.class );
|
||||
JDOObject.registerOperationHandlerForClass( DisableDeleteHandler.INSTANCE, EstabelecimentoData.class );
|
||||
JDOObject.registerOperationHandlerForClass( DisableDeleteHandler.INSTANCE, TrabalhadorData.class );
|
||||
|
||||
JDOObject.registerOperationHandlerForClass( ActualizacaoSaveHandler.INSTANCE, EmpresaData.class );
|
||||
JDOObject.registerOperationHandlerForClass( ActualizacaoSaveHandler.INSTANCE, EstabelecimentoData.class );
|
||||
JDOObject.registerOperationHandlerForClass( ActualizacaoSaveHandler.INSTANCE, TrabalhadorData.class );
|
||||
|
||||
JDOObject.registerOperationHandlerForClass( MarcacaoSaveAndDeleteHandler.INSTANCE, MarcacaoEmpresaData.class );
|
||||
JDOObject.registerOperationHandlerForClass( MarcacaoSaveAndDeleteHandler.INSTANCE, MarcacaoEstabelecimentoData.class );
|
||||
JDOObject.registerOperationHandlerForClass( MarcacaoSaveAndDeleteHandler.INSTANCE, MarcacaoTrabalhadorData.class );
|
||||
}
|
||||
|
||||
public static void main( String args[] )
|
||||
throws Exception
|
||||
{
|
||||
// Singleton.setInstance( SingletonConstants.COMPANY_NAME, "Centro Cl\u00ednico Avenida" );
|
||||
// Singleton.setInstance( SingletonConstants.COMPANY_LOGO, "logo_evo.jpg" );
|
||||
// Singleton.setInstance( SingletonConstants.WEB_AWARE, Boolean.FALSE );
|
||||
// Singleton.setInstance( SingletonConstants.DB_NAME, "shst" );
|
||||
|
||||
// Singleton.setInstance( SingletonConstants.COMPANY_NAME, "SIPRP - Sociedade Ib\u00e9rica de Preven\u00e7\u00e3o de Riscos Profissionais" );
|
||||
// Singleton.setInstance( SingletonConstants.COMPANY_LOGO, "logo_combo.jpg" );
|
||||
// Singleton.setInstance( SingletonConstants.WEB_AWARE, Boolean.TRUE );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp" );
|
||||
new SIPRPDataLoader().load();
|
||||
// new ClinicaAvenidaDataLoader().load();
|
||||
// new IBookDataLoader().load();
|
||||
|
||||
dbase = (String)Singleton.getInstance( SingletonConstants.LOCAL_DB_NAME );
|
||||
/* Calendar cal = Calendar.getInstance();
|
||||
cal.set( 2004, 06, 14 );
|
||||
if( cal.before( Calendar.getInstance() ) )
|
||||
{
|
||||
com.evolute.utils.ui.DialogException.showException( new RuntimeException( "Unknown error ocurred." ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
*/ Insert.setDefaultKeyRetriever( JDBCAutoKeyRetriever.DEFAULT );
|
||||
String server = System.getProperty( "server.address" );
|
||||
// if( server == null )
|
||||
// {
|
||||
// server = "ws_fpalma";
|
||||
// }
|
||||
//
|
||||
// String user = "root";
|
||||
// String passwd = "UNIXLuvsU";
|
||||
//
|
||||
// DBManager dbm = new JDBCManager( "jdbc:mysql://" + server + "/" + dbase,
|
||||
// user, passwd , 10, 8, 8, null );
|
||||
|
||||
UnicodeChecker.setUseDoubleSlash( true );
|
||||
// Singleton.setInstance( Singleton.DEFAULT_DBMANAGER, dbm );
|
||||
|
||||
// StatementExecuterFactory.initialize(
|
||||
// new DBStatementExecuter( dbm.getSharedExecuter() ) );
|
||||
// }
|
||||
// FichaWindow window = new FichaWindow();
|
||||
/* window.setLogo( new ImageIcon(
|
||||
new Main().getClass().getClassLoader().getResource( "logo/logo_w400.png" )
|
||||
).getImage() );*/
|
||||
// window.show();
|
||||
avisos = new AvisosPanel();
|
||||
String logoFileName = ( String ) Singleton.getInstance( SingletonConstants.COMPANY_LOGO );
|
||||
LoginWindow loginWindow = new LoginWindow( new Main(), /*"logo"+File.separator +*/ logoFileName,//"logo"+File.separator + "logo_w400.jpg",
|
||||
new String[] { (String) Singleton.getInstance( SingletonConstants.SOFTWARE_NAME ) },
|
||||
new String[] { "Vers\u00E3o " + SHST_VERSION, "(EVOLUTE 2004-2006)" }, "",
|
||||
(String)Singleton.getInstance( SingletonConstants.LOCAL_USER ),
|
||||
(String)Singleton.getInstance( SingletonConstants.LOCAL_PASSWORD ), avisos, false );
|
||||
loginWindow.setTitle( (String) Singleton.getInstance( SingletonConstants.SOFTWARE_NAME ) );
|
||||
JPanel left = loginWindow.getLeftPanel();
|
||||
left.setBackground( Color.white );
|
||||
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
loginWindow.setExtendedState(loginWindow.getExtendedState() | loginWindow.MAXIMIZED_BOTH);
|
||||
loginWindow.setVisible( true );
|
||||
loginWindow.expandAll();
|
||||
new UpdateWindow().update();
|
||||
}
|
||||
|
||||
public boolean connect( String user, String passwd )
|
||||
{
|
||||
try
|
||||
{
|
||||
// run initialization SQL
|
||||
SQLQuery initQuery[] = new SQLQuery[] {};
|
||||
String server = System.getProperty( "server.address" );
|
||||
if( server == null )
|
||||
{
|
||||
//server = "192.168.1.191";
|
||||
server = (String)Singleton.getInstance( SingletonConstants.LOCAL_URL );
|
||||
// server = "ws_fpalma";
|
||||
}
|
||||
String prefix = (String)Singleton.getInstance( SingletonConstants.LOCAL_URL_PREFIX );
|
||||
String url = prefix + server + "/" + dbase;
|
||||
// System.out.println( "url: " + url + " user: " + user + " ps: " + passwd );
|
||||
DBManager dbm = new JDBCManager( url, user, passwd , 10, 8, 8, null );
|
||||
// UnicodeChecker.setUseDoubleSlash( true );
|
||||
Singleton.setInstance( Singleton.DEFAULT_DBMANAGER, dbm );
|
||||
|
||||
StatementExecuterFactory.initialize(
|
||||
new DBStatementExecuter( dbm.getSharedExecuter() ) );
|
||||
initializeJPOX( url, user, passwd );
|
||||
StatementExecuterFactory.initialize(
|
||||
new DBStatementExecuter( dbm.getSharedExecuter() ) );
|
||||
StatementExecuterFactory.initialize(
|
||||
new DBStatementExecuter( dbm.getSharedExecuter() ) );
|
||||
Singleton.setInstance( Singleton.TODAY, new Date() );
|
||||
|
||||
//cleanData( dbm.getSharedExecuter() );
|
||||
//msg( dbm.getSharedExecuter() );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "N\u00E3o foi poss\u00EDvel estabelecer"
|
||||
+ " a liga\u00E7\u00E3o \u00E0 base de dados.", false );
|
||||
return false;
|
||||
}
|
||||
Singleton.setInstance( Singleton.USERNAME, user );
|
||||
try
|
||||
{
|
||||
ErrorLogger.initializeLogger( new SHSTLogger() );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
}
|
||||
//Singleton.setInstance( Singleton.USERNAME, user );
|
||||
siprpTracker = new SIPRPTracker( avisos );
|
||||
|
||||
avisos.refresh();
|
||||
// new Exception().printStackTrace();
|
||||
// try
|
||||
// {
|
||||
// Thread.sleep( 1000 );
|
||||
// }
|
||||
// catch( Exception ex ){}
|
||||
// new Exception().printStackTrace();
|
||||
return true;
|
||||
}
|
||||
|
||||
// public static void reconnectJDO()
|
||||
// {
|
||||
// PersistenceManagerFactory pmf = ( PersistenceManagerFactory ) Singleton.getInstance( Singleton.DEFAULT_PERSISTENCE_MANAGER_FACTORY );
|
||||
// PersistenceManager pm = pmf.getPersistenceManager();
|
||||
// Singleton.setInstance( SingletonConstants.PERSISTENCE_MANAGER, pm );
|
||||
// com.evolute.utils.jdo.JDOObject.setPersistentManager( pm );
|
||||
// }
|
||||
|
||||
public boolean disconnect()
|
||||
{
|
||||
if( siprpTracker.quit() )
|
||||
{
|
||||
siprpTracker = null;
|
||||
try
|
||||
{
|
||||
( ( DBManager )Singleton.getInstance(
|
||||
Singleton.DEFAULT_DBMANAGER ) ).close();
|
||||
Singleton.clear();
|
||||
}
|
||||
catch( DBException ex )
|
||||
{
|
||||
DialogException.showException( ex );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void executeAction( DefaultMutableTreeNode node )
|
||||
{
|
||||
try
|
||||
{
|
||||
siprpTracker.openWindow( ( String )node.getUserObject() );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showException( ex );
|
||||
}
|
||||
}
|
||||
|
||||
public void exit()
|
||||
{
|
||||
if( siprpTracker == null || siprpTracker.quit() )
|
||||
{
|
||||
System.exit( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
public MutableTreeNode getTree()
|
||||
{
|
||||
return siprpTracker.getRoot();
|
||||
}
|
||||
|
||||
public void initializeJPOX(String url, String user, String password)
|
||||
{
|
||||
Date d = new Date();
|
||||
System.out.println( "INIT: " + d );
|
||||
|
||||
|
||||
Properties jpoxProps;
|
||||
jpoxProps = System.getProperties();//new Properties();
|
||||
// Set the PersistenceManagerFactoryClass to the TJDO class.
|
||||
jpoxProps.setProperty( "javax.jdo.PersistenceManagerFactoryClass",
|
||||
"org.jpox.PersistenceManagerFactoryImpl" );
|
||||
// Set the JDBC driver name.
|
||||
jpoxProps.setProperty( "javax.jdo.option.ConnectionDriverName", (String) Singleton.getInstance( SingletonConstants.LOCAL_DRIVER_NAME ) );
|
||||
jpoxProps.setProperty( "org.jpox.identifier.fullyQualifiedNames", "false" );
|
||||
// props.setProperty("com.triactive.jdo.transactionIsolation",
|
||||
// "read-uncommitted" );
|
||||
|
||||
// Set the connection URL
|
||||
// jpoxProps.setProperty( "javax.jdo.option.ConnectionURL", "jdbc:informix-sqli://192.168.0.3:6666"
|
||||
// + "/apdp_db:informixserver=server" );
|
||||
jpoxProps.setProperty( "javax.jdo.option.ConnectionURL", url );
|
||||
jpoxProps.setProperty( "javax.jdo.option.ConnectionUserName", user );
|
||||
jpoxProps.setProperty( "javax.jdo.option.ConnectionPassword", password );
|
||||
// jpoxProps.setProperty( "javax.jdo.option.IgnoreCache", "true" );
|
||||
// jpoxProps.setProperty( "javax.jdo.option.NonTransactionalRead", "true" );
|
||||
jpoxProps.setProperty( "javax.jdo.option.RetainValues", "true" );
|
||||
|
||||
jpoxProps.setProperty( "org.jpox.autoCreateTables", "false" );
|
||||
jpoxProps.setProperty( "org.jpox.autoCreateSchema", "false" );
|
||||
jpoxProps.setProperty( "org.jpox.autoCreateConstraints", "false" );
|
||||
jpoxProps.setProperty( "org.jpox.validateTables", "false" );
|
||||
jpoxProps.setProperty( "org.jpox.validateConstraints", "false" );
|
||||
jpoxProps.setProperty( "org.jpox.autoStartMechanismMode", "Ignored" );
|
||||
jpoxProps.setProperty( "org.jpox.autoStartMechanism", "None" );
|
||||
|
||||
// jpoxProps.setProperty( "javax.jdo.option.RetainValues", "true" );
|
||||
// jpoxProps.setProperty( "javax.jdo.option.Optimistic", "true" );
|
||||
|
||||
// jpoxProps.setProperty( "org.jpox.identifier.defaultSchemaName", "informix" );
|
||||
jpoxProps.setProperty( "org.jpox.rdbms.CheckExistTablesOrViews", "false" );
|
||||
|
||||
System.setProperty( "org.jpox.catalogName", (String)Singleton.getInstance( SingletonConstants.LOCAL_DB_NAME ) );
|
||||
System.setProperty( "org.jpox.schemaName", "" );
|
||||
|
||||
// PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory( jpoxProps );
|
||||
//// pmf.setOptimistic( true );
|
||||
//System.out.print( "Loading PM: " + new Date() );
|
||||
// // ( ( PersistenceManagerFactoryImpl )pmf ).setTransactionIsolation( Connection.TRANSACTION_READ_UNCOMMITTED );
|
||||
// // Retrieve a PersistenceManager from the PersistenceManagerFactory.
|
||||
// PersistenceManager pm = pmf.getPersistenceManager();
|
||||
// JDOObject.setPersistentManager( pm );
|
||||
// Singleton.setInstance( Singleton.DEFAULT_PERSISTENCE_MANAGER_FACTORY, pmf );
|
||||
// Singleton.setInstance( SingletonConstants.PERSISTENCE_MANAGER, pm );
|
||||
JDOProvider jdoProvider = new JDOProvider( jpoxProps );
|
||||
Singleton.setInstance( Singleton.DEFAULT_JDO_PROVIDER, jdoProvider );
|
||||
System.out.println( "PM done " + new Date() + "JDO: " + jdoProvider );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,112 @@
|
||||
/*
|
||||
* SIPRPLogger.java
|
||||
*
|
||||
* Created on 15 de Marco de 2005, 15:31
|
||||
*/
|
||||
|
||||
package siprp;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.db.*;
|
||||
import com.evolute.utils.error.*;
|
||||
import com.evolute.utils.sql.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author lflores
|
||||
|
||||
* MySQL
|
||||
CREATE TABLE errors
|
||||
(
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY( id ),
|
||||
date TIMESTAMP NOT NULL DEFAULT 'now()',
|
||||
type VARCHAR(20),
|
||||
environment VARCHAR( 255 ),
|
||||
description TEXT
|
||||
);
|
||||
*
|
||||
*PostgreSQL
|
||||
CREATE TABLE errors
|
||||
(
|
||||
id SERIAL,
|
||||
PRIMARY KEY( id ),
|
||||
date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
type VARCHAR(20),
|
||||
environment VARCHAR( 255 ),
|
||||
description VARCHAR( 256000 )
|
||||
)
|
||||
|
||||
*/
|
||||
public class SHSTLogger implements Logger
|
||||
{
|
||||
private final String java = System.getProperty( "java.version" )
|
||||
+ "-" + System.getProperty( "java.vm.version" );
|
||||
private final String os = System.getProperty( "os.name" ) + " - " +
|
||||
System.getProperty( "os.version" );
|
||||
private final String user = ( String )Singleton.getInstance( Singleton.USERNAME );
|
||||
private final String ENV = "Java: " + java + " \nOS: " + os + " \nUser: " + user
|
||||
+ "\n Software: " + ( String )Singleton.getInstance( SingletonConstants.SOFTWARE_NAME )
|
||||
+ "\n Version: " + Main.SHST_VERSION;
|
||||
private final Executer executer;
|
||||
|
||||
/** Creates a new instance of SIPRPLogger */
|
||||
public SHSTLogger()
|
||||
throws Exception
|
||||
{
|
||||
DBManager dbm = ( DBManager )Singleton.getInstance( Singleton.DEFAULT_DBMANAGER );
|
||||
executer = dbm.getExclusiveExecuter( this );
|
||||
}
|
||||
|
||||
public void log( String str )
|
||||
{
|
||||
String mem = "(" + Runtime.getRuntime().freeMemory() + "/" +
|
||||
Runtime.getRuntime().maxMemory() + ")";
|
||||
if( str.length() > 254000 )
|
||||
{
|
||||
str = str.substring( 0, 254000 ) + " Message too big (" + str.length() + "), truncated.";
|
||||
}
|
||||
try
|
||||
{
|
||||
executer.executeQuery( new Insert( "errors", new Assignment[] {
|
||||
new Assignment( new Field( "type" ), "LOG" ),
|
||||
new Assignment( new Field( "environment" ), ENV + mem ),
|
||||
new Assignment( new Field( "description" ), str )
|
||||
} ), null );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
logException( ex );
|
||||
}
|
||||
}
|
||||
|
||||
public void logException( Throwable ex )
|
||||
{
|
||||
StackTraceElement ste[] = ex.getStackTrace();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for( int i = 0; i < ste.length; ++i )
|
||||
{
|
||||
sb.append( ste[ i ].toString() );
|
||||
}
|
||||
String str = "Exception Message: " + ex.getMessage() + "\nStack Trace: " + sb.toString();
|
||||
String mem = "(" + Runtime.getRuntime().freeMemory() + "/" +
|
||||
Runtime.getRuntime().maxMemory() + ")";
|
||||
if( str.length() > 254000 )
|
||||
{
|
||||
str = str.substring( 0, 254000 ) + " Message too big (" + str.length() + "), truncated.";
|
||||
}
|
||||
try
|
||||
{
|
||||
executer.executeQuery( new Insert( "errors", new Assignment[] {
|
||||
new Assignment( new Field( "type" ), "ERROR" ),
|
||||
new Assignment( new Field( "environment" ), ENV + mem ),
|
||||
new Assignment( new Field( "description" ), str )
|
||||
} ), new SQLRetriever() );
|
||||
}
|
||||
catch( Exception ex1 )
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,267 @@
|
||||
/*
|
||||
* SIPRPTracker.java
|
||||
*
|
||||
* Created on 18 de Maio de 2004, 19:46
|
||||
*/
|
||||
|
||||
package siprp;
|
||||
|
||||
import javax.swing.tree.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.tracker.*;
|
||||
import siprp.ficha.*;
|
||||
import siprp.clientes.*;
|
||||
import siprp.estatistica.*;
|
||||
import siprp.higiene.mapa.*;
|
||||
import siprp.higiene.marcacoes.*;
|
||||
import siprp.impressaofichas.*;
|
||||
import siprp.lembretes.LembretesWindow;
|
||||
import siprp.medicina.*;
|
||||
import siprp.medicina.locais_realizacao.LocaisRealizacaoWindow;
|
||||
import siprp.medicina.presencas.RegistarPresencasWindow;
|
||||
import siprp.medicina.prestadores.PrestadoresWindow;
|
||||
import siprp.medicina.processo.ProcessoWindow;
|
||||
import siprp.pesquisas.*;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class SIPRPTracker extends WindowTracker
|
||||
{
|
||||
public static final String FICHA_APTIDAO = "Ficha de Aptid\u00e3o";
|
||||
public static final String CRIACAO_FICHA_APTIDAO = "Cria\u00e7\u00e3o de Fichas de Aptid\u00e3o";
|
||||
public static final String GESTAO_CLIENTES = "Gest\u00e3o de Clientes";
|
||||
public static final String MEDICINA = "Medicina";
|
||||
public static final String MEDICINA_MARCACOES = "Marca\u00e7\u00f5es";
|
||||
public static final String MEDICINA_LOCAIS = "Locais de Realiza\u00e7\u00e3o";
|
||||
public static final String MEDICINA_PRESENCAS = "Presen\u00e7as";
|
||||
public static final String HIGIENE_SEGURANCA = "Higiene e Seguran\u00e7a";
|
||||
public static final String RELATORIO_ANUAL = "Relat\u00f3rio Anual";
|
||||
public static final String LISTAGENS = "Listagens";
|
||||
|
||||
private final AvisosPanel avisos;
|
||||
private ClientesWindow clientesWindow;
|
||||
private MedicinaWindow medicinaWindow;
|
||||
private MarcacoesHigieneWindow higieneWindow;
|
||||
|
||||
/** Creates a new instance of SIPRPTracker */
|
||||
public SIPRPTracker( AvisosPanel avisosP )
|
||||
{
|
||||
Singleton.setInstance( SingletonConstants.SIPRP_TRACKER, this );
|
||||
this.avisos = avisosP;
|
||||
avisos.setTracker( this );
|
||||
Hashtable creators = new Hashtable();
|
||||
DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(
|
||||
Singleton.getInstance( SingletonConstants.COMPANY_ACRONYM ) );
|
||||
|
||||
boolean hasFicha = ( (Boolean)Singleton.getInstance( SingletonConstants.MODULE_FICHA ) ).booleanValue();
|
||||
boolean hasGestao = ( (Boolean)Singleton.getInstance( SingletonConstants.MODULE_CLIENTES ) ).booleanValue();
|
||||
boolean hasRelatorio = ( (Boolean)Singleton.getInstance( SingletonConstants.MODULE_RELATORIO ) ).booleanValue();
|
||||
boolean hasListagens = ( (Boolean)Singleton.getInstance( SingletonConstants.MODULE_LISTAGENS ) ).booleanValue();
|
||||
|
||||
if( hasGestao )
|
||||
{
|
||||
try
|
||||
{
|
||||
clientesWindow = new ClientesWindow( avisos );
|
||||
clientesWindow.setTracker( this );
|
||||
medicinaWindow = new MedicinaWindow();
|
||||
medicinaWindow.setTracker( this );
|
||||
higieneWindow = new MarcacoesHigieneWindow();
|
||||
higieneWindow.setTracker( this );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
clientesWindow = null;
|
||||
medicinaWindow = null;
|
||||
higieneWindow = null;
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
clientesWindow = null;
|
||||
medicinaWindow = null;
|
||||
}
|
||||
|
||||
if( hasFicha )
|
||||
{
|
||||
DefaultMutableTreeNode fichaNode = new DefaultMutableTreeNode( FICHA_APTIDAO );
|
||||
|
||||
fichaNode.add( new DefaultMutableTreeNode( CRIACAO_FICHA_APTIDAO ) );
|
||||
creators.put( CRIACAO_FICHA_APTIDAO, new WindowCreator() {
|
||||
public TrackableWindow create()
|
||||
throws Exception
|
||||
{
|
||||
return FichaWindow.getWindow();
|
||||
}
|
||||
} );
|
||||
|
||||
fichaNode.add( new DefaultMutableTreeNode( ImpressaoFichasWindow.TITLE ) );
|
||||
creators.put( ImpressaoFichasWindow.TITLE, new WindowCreator() {
|
||||
public TrackableWindow create()
|
||||
throws Exception
|
||||
{
|
||||
return new ImpressaoFichasWindow();
|
||||
}
|
||||
} );
|
||||
|
||||
rootNode.add( fichaNode );
|
||||
}
|
||||
|
||||
if( hasGestao )
|
||||
{
|
||||
rootNode.add( new DefaultMutableTreeNode( GESTAO_CLIENTES ) );
|
||||
creators.put( GESTAO_CLIENTES, new WindowCreator() {
|
||||
public TrackableWindow create()
|
||||
throws Exception
|
||||
{
|
||||
if( clientesWindow == null )
|
||||
{
|
||||
clientesWindow = new ClientesWindow( avisos );
|
||||
clientesWindow.setTracker( SIPRPTracker.this );
|
||||
}
|
||||
return clientesWindow;
|
||||
}
|
||||
} );
|
||||
|
||||
rootNode.add( new DefaultMutableTreeNode( LembretesWindow.TITLE ) );
|
||||
creators.put( LembretesWindow.TITLE, new WindowCreator() {
|
||||
public TrackableWindow create()
|
||||
throws Exception
|
||||
{
|
||||
return new LembretesWindow();
|
||||
}
|
||||
} );
|
||||
|
||||
DefaultMutableTreeNode medicinaNode = new DefaultMutableTreeNode( MEDICINA );
|
||||
|
||||
medicinaNode.add( new DefaultMutableTreeNode( ProcessoWindow.TITLE ) );
|
||||
creators.put( ProcessoWindow.TITLE, new WindowCreator() {
|
||||
public TrackableWindow create()
|
||||
throws Exception
|
||||
{
|
||||
return new ProcessoWindow();
|
||||
}
|
||||
} );
|
||||
|
||||
medicinaNode.add( new DefaultMutableTreeNode( MEDICINA_MARCACOES ) );
|
||||
creators.put( MEDICINA_MARCACOES, new WindowCreator() {
|
||||
public TrackableWindow create()
|
||||
throws Exception
|
||||
{
|
||||
if( medicinaWindow == null )
|
||||
{
|
||||
medicinaWindow = new MedicinaWindow();
|
||||
medicinaWindow.setTracker( SIPRPTracker.this );
|
||||
}
|
||||
return medicinaWindow;
|
||||
}
|
||||
} );
|
||||
|
||||
medicinaNode.add( new DefaultMutableTreeNode( MEDICINA_LOCAIS ) );
|
||||
creators.put( MEDICINA_LOCAIS, new WindowCreator() {
|
||||
public TrackableWindow create()
|
||||
throws Exception
|
||||
{
|
||||
return new LocaisRealizacaoWindow();
|
||||
}
|
||||
} );
|
||||
|
||||
medicinaNode.add( new DefaultMutableTreeNode( MEDICINA_PRESENCAS ) );
|
||||
creators.put( MEDICINA_PRESENCAS, new WindowCreator() {
|
||||
public TrackableWindow create()
|
||||
throws Exception
|
||||
{
|
||||
return new RegistarPresencasWindow();
|
||||
}
|
||||
} );
|
||||
|
||||
medicinaNode.add( new DefaultMutableTreeNode( PrestadoresWindow.TITLE ) );
|
||||
creators.put( PrestadoresWindow.TITLE, new WindowCreator() {
|
||||
public TrackableWindow create()
|
||||
throws Exception
|
||||
{
|
||||
return new PrestadoresWindow();
|
||||
}
|
||||
} );
|
||||
|
||||
rootNode.add( medicinaNode );
|
||||
|
||||
DefaultMutableTreeNode higieneNode = new DefaultMutableTreeNode( HIGIENE_SEGURANCA );
|
||||
|
||||
higieneNode.add( new DefaultMutableTreeNode( MarcacoesHigieneWindow.TITLE ) );
|
||||
creators.put( MarcacoesHigieneWindow.TITLE, new WindowCreator() {
|
||||
public TrackableWindow create()
|
||||
throws Exception
|
||||
{
|
||||
if( higieneWindow == null )
|
||||
{
|
||||
higieneWindow = new MarcacoesHigieneWindow();
|
||||
higieneWindow.setTracker( SIPRPTracker.this );
|
||||
}
|
||||
return higieneWindow;
|
||||
}
|
||||
} );
|
||||
|
||||
higieneNode.add( new DefaultMutableTreeNode( MapaHigieneWindow.TITLE ) );
|
||||
creators.put( MapaHigieneWindow.TITLE, new WindowCreator() {
|
||||
public TrackableWindow create()
|
||||
throws Exception
|
||||
{
|
||||
return new MapaHigieneWindow();
|
||||
}
|
||||
} );
|
||||
|
||||
rootNode.add( higieneNode );
|
||||
}
|
||||
|
||||
if( hasRelatorio )
|
||||
{
|
||||
rootNode.add( new DefaultMutableTreeNode( RELATORIO_ANUAL ) );
|
||||
creators.put( RELATORIO_ANUAL, new WindowCreator() {
|
||||
public TrackableWindow create()
|
||||
throws Exception
|
||||
{
|
||||
return new PesquisasWindow();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
if( hasListagens )
|
||||
{
|
||||
rootNode.add( new DefaultMutableTreeNode( LISTAGENS ) );
|
||||
creators.put( LISTAGENS, new WindowCreator() {
|
||||
public TrackableWindow create()
|
||||
throws Exception
|
||||
{
|
||||
return new EstatisticaWindow();
|
||||
}
|
||||
} );
|
||||
}
|
||||
setRoot( rootNode );
|
||||
setCreators( creators );
|
||||
}
|
||||
|
||||
public ClientesWindow getClientesWindow()
|
||||
{
|
||||
return clientesWindow;
|
||||
}
|
||||
|
||||
public MedicinaWindow getMedicinaWindow()
|
||||
{
|
||||
return medicinaWindow;
|
||||
}
|
||||
|
||||
public MarcacoesHigieneWindow getHigieneWindow()
|
||||
{
|
||||
return higieneWindow;
|
||||
}
|
||||
|
||||
public AvisosPanel getAvisosPanel()
|
||||
{
|
||||
return avisos;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* SingletonConstants.java
|
||||
*
|
||||
* Created on 25 de Maio de 2004, 13:34
|
||||
*/
|
||||
|
||||
package siprp;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class SingletonConstants
|
||||
{
|
||||
public static final String PERSISTENCE_MANAGER = "PERSISTENCE_MANAGER";
|
||||
public static final String SOFTWARE_NAME = "software_name";
|
||||
public static final String COMPANY_NAME = "company_name";
|
||||
public static final String COMPANY_LOGO = "company_logo";
|
||||
public static final String COMPANY_ACRONYM = "company_acronym";
|
||||
public static final String SUBJECT_CONSULTA = "subject_consulta";
|
||||
public static final String LETTER_CONSULTA = "letter_consulta";
|
||||
public static final String SUBJECT_EXAMES = "subject_exames";
|
||||
public static final String LETTER_EXAMES = "letter_exames";
|
||||
public static final String SUBJECT_VISITA = "subject_visita";
|
||||
public static final String LETTER_VISITA = "letter_visita";
|
||||
public static final String USES_HOUR = "uses_hour";
|
||||
public static final String CODIGO_EMPRESA_FORMAT = "codigo_empresa_format";
|
||||
public static final String FICHA_MARCA_EXAMES = "ficha_marca_exames";
|
||||
public static final String EXCEL_FORMAT = "excel_format";
|
||||
public static final String EXCEL_FORMAT_DEMISSAO = "excel_format_demissao";
|
||||
|
||||
public static final String MODULE_FICHA = "module_ficha";
|
||||
public static final String MODULE_CLIENTES = "module_clientes";
|
||||
public static final String WEB_AWARE = "web_aware";
|
||||
public static final String MODULE_RELATORIO = "module_relatorio";
|
||||
public static final String MODULE_LISTAGENS = "module_listagens";
|
||||
|
||||
public static final String WEB_USER = "web_user";
|
||||
public static final String WEB_PASSWORD = "web_password";
|
||||
public static final String WEB_URL_PREFIX = "web_url_prefix";
|
||||
public static final String WEB_URL = "web_url";
|
||||
public static final String WEB_DB_NAME = "web_db_name";
|
||||
public static final String WEB_DRIVER_NAME = "web_driver_name";
|
||||
|
||||
public static final String LOCAL_USER = "local_user";
|
||||
public static final String LOCAL_PASSWORD = "local_password";
|
||||
public static final String LOCAL_URL_PREFIX = "local_url_prefix";
|
||||
public static final String LOCAL_URL = "local_url";
|
||||
public static final String LOCAL_DB_NAME = "local_db_name";
|
||||
public static final String LOCAL_DRIVER_NAME = "local_driver_name";
|
||||
|
||||
public static final String SIPRP_TRACKER = "SIPRP_TRACKER";
|
||||
|
||||
/** Creates a new instance of SingletonConstants */
|
||||
private SingletonConstants()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,589 @@
|
||||
/*
|
||||
* AvisosPanel.java
|
||||
*
|
||||
* Created on 21 de Maio de 2004, 13:06
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.dataui.*;
|
||||
import com.evolute.utils.jdo.*;
|
||||
import com.evolute.utils.ui.*;
|
||||
|
||||
import siprp.*;
|
||||
import siprp.data.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class AvisosPanel extends JPanel
|
||||
implements ActionListener, ControllableComponent
|
||||
{
|
||||
private static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( DateFormat.SHORT );
|
||||
private JDOProvider JDO;
|
||||
private FichaDataProvider provider;
|
||||
private SIPRPTracker tracker;
|
||||
|
||||
private JPanel empresaPanel;
|
||||
private JPanel estabelecimentosPanel;
|
||||
private JPanel trabalhadoresPanel;
|
||||
|
||||
// private AvisoData avisos[];
|
||||
// private AvisoData avisosEmpresa[];
|
||||
// private AvisoData avisosEstabelecimento[];
|
||||
// private AvisoData avisosTrabalhador[];
|
||||
|
||||
private Object avisosEmpresa[][];
|
||||
private Object avisosEstabelecimento[][];
|
||||
private Object avisosTrabalhador[][];
|
||||
|
||||
private boolean refreshed = false;
|
||||
|
||||
private Hashtable buttonHash;
|
||||
private Hashtable buttonTypeHash;
|
||||
|
||||
/** Creates a new instance of AvisosPanel */
|
||||
public AvisosPanel(/* AvisoData avisosEmpresa[], AvisoData avisosEstabelecimento[], AvisoData avisosTrabalhador[]*/ )
|
||||
throws Exception
|
||||
{
|
||||
// this.avisosEmpresa = new AvisoData[ 0 ];
|
||||
// this.avisosEstabelecimento = new AvisoData[ 0 ];
|
||||
// this.avisosTrabalhador = new AvisoData[ 0 ];
|
||||
// setupComponents();
|
||||
buttonHash = new Hashtable();
|
||||
buttonTypeHash = new Hashtable();
|
||||
JDO = (JDOProvider) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
|
||||
// System.out.println( "public AvisosPanel() JDO: " + JDO );
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
empresaPanel = new JPanel();
|
||||
empresaPanel.setBorder(
|
||||
BorderFactory.createTitledBorder(
|
||||
BorderFactory.createLineBorder( new Color( 0.0f, 0.0f, 0.0f, 0.0f ), 1 ), "Empresas" ) );
|
||||
empresaPanel.setLayout( new GridLayout( avisosEmpresa.length, 1 ) );
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 1, 1, 1, 1 );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weighty = 0;
|
||||
for( int n = 0; n < avisosEmpresa.length; n++ )
|
||||
{
|
||||
JPanel pan = new JPanel();
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
pan.setBorder( BorderFactory.createLineBorder( Color.black, 1 ) );
|
||||
// EmpresaData empresa = (EmpresaData)avisosEmpresa[ n ].get( AvisoData.EMPRESA );
|
||||
pan.setLayout( gridbag );
|
||||
constraints.gridheight = GridBagConstraints.REMAINDER;
|
||||
constraints.gridx = 0;
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
JButton tratarButton = new JButton( "Tratar" );
|
||||
gridbag.setConstraints( tratarButton, constraints );
|
||||
pan.add( tratarButton );
|
||||
//buttonHash.put( tratarButton, avisosEmpresa[ n ] );
|
||||
// buttonHash.put( tratarButton, new Integer( n ) );
|
||||
// buttonHash.put( tratarButton, avisosEmpresa[ n ].get( AvisoData.ID ) );
|
||||
buttonHash.put( tratarButton, avisosEmpresa[ n ][ 0 ] );
|
||||
buttonTypeHash.put( tratarButton, new Integer( AvisoConstants.TIPO_EMPRESA ) );
|
||||
tratarButton.addActionListener( this );
|
||||
|
||||
constraints.gridx = 1;
|
||||
constraints.weightx = 1;
|
||||
constraints.gridheight = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
// JLabel empresaLabel = new JLabel( "" + empresa.get( EmpresaData.DESIGNACAO_SOCIAL ) );
|
||||
JLabel empresaLabel = new JLabel( "" + avisosEmpresa[ n ][ 3 ] );
|
||||
gridbag.setConstraints( empresaLabel, constraints );
|
||||
pan.add( empresaLabel );
|
||||
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
//JLabel descricaoLabel = new JLabel( (String)avisosEmpresa[ n ].get( AvisoData.DESCRICAO ) );
|
||||
JLabel descricaoLabel = criarDescricao( avisosEmpresa[ n ] );
|
||||
gridbag.setConstraints( descricaoLabel, constraints );
|
||||
pan.add( descricaoLabel );
|
||||
|
||||
empresaPanel.add( pan );
|
||||
}
|
||||
|
||||
estabelecimentosPanel = new JPanel();
|
||||
estabelecimentosPanel.setBorder(
|
||||
BorderFactory.createTitledBorder(
|
||||
BorderFactory.createLineBorder( new Color( 0.0f, 0.0f, 0.0f, 0.0f ), 1 ), "Estabelecimentos" ) );
|
||||
estabelecimentosPanel.setLayout( new GridLayout( avisosEstabelecimento.length, 1 ) );
|
||||
|
||||
for( int n = 0; n < avisosEstabelecimento.length; n++ )
|
||||
{
|
||||
Date dataAviso = ( Date ) avisosEstabelecimento[ n ][ 5 ];
|
||||
Date dataEvento = ( Date ) avisosEstabelecimento[ n ][ 1 ];
|
||||
Calendar calAviso = Calendar.getInstance();
|
||||
calAviso.setTime( dataAviso );
|
||||
Calendar calEvento = Calendar.getInstance();
|
||||
calEvento.setTime( dataEvento );
|
||||
boolean mesmoDia =
|
||||
( calAviso.get( Calendar.YEAR ) == calEvento.get( Calendar.YEAR ) ) &&
|
||||
( calAviso.get( Calendar.MONTH ) == calEvento.get( Calendar.MONTH ) ) &&
|
||||
( calAviso.get( Calendar.DAY_OF_MONTH ) == calEvento.get( Calendar.DAY_OF_MONTH ) );
|
||||
JPanel pan = new JPanel();
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
pan.setBorder( BorderFactory.createLineBorder( Color.black, 1 ) );
|
||||
// EstabelecimentoData estabelecimento = (EstabelecimentoData)avisosEstabelecimento[ n ].get( AvisoData.ESTABELECIMENTO );
|
||||
// EmpresaData empresa = (EmpresaData)estabelecimento.get( EstabelecimentoData.EMPRESA );
|
||||
pan.setLayout( gridbag );
|
||||
constraints.gridheight = GridBagConstraints.REMAINDER;
|
||||
constraints.gridx = 0;
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
JButton tratarButton = new JButton( mesmoDia ? "Confirmar" : "Marcar" );
|
||||
gridbag.setConstraints( tratarButton, constraints );
|
||||
pan.add( tratarButton );
|
||||
//buttonHash.put( tratarButton, avisosEstabelecimento[ n ] );
|
||||
// buttonHash.put( tratarButton, new Integer( n + avisosEmpresa.length ) );
|
||||
// buttonHash.put( tratarButton, avisosEstabelecimento[ n ].get( AvisoData.ID ) );
|
||||
buttonHash.put( tratarButton, avisosEstabelecimento[ n ][ 0 ] );
|
||||
buttonTypeHash.put( tratarButton, new Integer( AvisoConstants.TIPO_ESTABELECIMENTO ) );
|
||||
tratarButton.addActionListener( this );
|
||||
|
||||
constraints.gridx = 1;
|
||||
constraints.weightx = 1;
|
||||
constraints.gridheight = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
// JLabel empresaLabel = new JLabel( "" + empresa.get( EmpresaData.DESIGNACAO_SOCIAL ) );
|
||||
JLabel empresaLabel = new JLabel( "" + avisosEstabelecimento[ n ][ 3 ] );
|
||||
gridbag.setConstraints( empresaLabel, constraints );
|
||||
pan.add( empresaLabel );
|
||||
|
||||
// JLabel estabelecimentoLabel = new JLabel( "" + estabelecimento.get( EstabelecimentoData.NOME ) );
|
||||
JLabel estabelecimentoLabel = new JLabel( "" + avisosEstabelecimento[ n ][ 4 ] );
|
||||
gridbag.setConstraints( estabelecimentoLabel, constraints );
|
||||
pan.add( estabelecimentoLabel );
|
||||
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
//JLabel descricaoLabel = new JLabel( (String)avisosEstabelecimento[ n ].get( AvisoData.DESCRICAO ) );
|
||||
JLabel descricaoLabel = criarDescricao( avisosEstabelecimento[ n ] );
|
||||
gridbag.setConstraints( descricaoLabel, constraints );
|
||||
pan.add( descricaoLabel );
|
||||
|
||||
estabelecimentosPanel.add( pan );
|
||||
}
|
||||
|
||||
trabalhadoresPanel = new JPanel();
|
||||
trabalhadoresPanel.setBorder(
|
||||
BorderFactory.createTitledBorder(
|
||||
BorderFactory.createLineBorder( new Color( 0.0f, 0.0f, 0.0f, 0.0f ), 1 ), "Trabalhadores" ) );
|
||||
trabalhadoresPanel.setLayout( new GridLayout( avisosTrabalhador.length, 1 ) );
|
||||
|
||||
for( int n = 0; n < avisosTrabalhador.length; n++ )
|
||||
{
|
||||
Date dataAviso = ( Date ) avisosTrabalhador[ n ][ 6 ];
|
||||
Date dataEvento = ( Date ) avisosTrabalhador[ n ][ 1 ];
|
||||
Calendar calAviso = Calendar.getInstance();
|
||||
calAviso.setTime( dataAviso );
|
||||
Calendar calEvento = Calendar.getInstance();
|
||||
calEvento.setTime( dataEvento );
|
||||
boolean mesmoDia =
|
||||
( calAviso.get( Calendar.YEAR ) == calEvento.get( Calendar.YEAR ) ) &&
|
||||
( calAviso.get( Calendar.MONTH ) == calEvento.get( Calendar.MONTH ) ) &&
|
||||
( calAviso.get( Calendar.DAY_OF_MONTH ) == calEvento.get( Calendar.DAY_OF_MONTH ) );
|
||||
JPanel pan = new JPanel();
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
pan.setBorder( BorderFactory.createLineBorder( Color.black, 1 ) );
|
||||
// TrabalhadorData trabalhador = (TrabalhadorData)avisosTrabalhador[ n ].get( AvisoData.TRABALHADOR );
|
||||
// EstabelecimentoData estabelecimento = (EstabelecimentoData)trabalhador.get( TrabalhadorData.ESTABELECIMENTO );
|
||||
// EmpresaData empresa = (EmpresaData)estabelecimento.get( EstabelecimentoData.EMPRESA );
|
||||
pan.setLayout( gridbag );
|
||||
constraints.gridheight = GridBagConstraints.REMAINDER;
|
||||
constraints.gridx = 0;
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
JButton tratarButton = new JButton( mesmoDia ? "Confirmar" : "Marcar" );
|
||||
gridbag.setConstraints( tratarButton, constraints );
|
||||
pan.add( tratarButton );
|
||||
//buttonHash.put( tratarButton, avisosTrabalhador[ n ] );
|
||||
// buttonHash.put( tratarButton, new Integer( n + avisosEmpresa.length + avisosEstabelecimento.length ) );
|
||||
// buttonHash.put( tratarButton, avisosTrabalhador[ n ].get( AvisoData.ID ) );
|
||||
buttonHash.put( tratarButton, avisosTrabalhador[ n ][ 0 ] );
|
||||
buttonTypeHash.put( tratarButton, new Integer( AvisoConstants.TIPO_TRABALHADOR ) );
|
||||
tratarButton.addActionListener( this );
|
||||
|
||||
constraints.gridx = 1;
|
||||
constraints.weightx = 1;
|
||||
constraints.gridheight = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
// JLabel empresaLabel = new JLabel( "" + empresa.get( EmpresaData.DESIGNACAO_SOCIAL ) );
|
||||
JLabel empresaLabel = new JLabel( "" + avisosTrabalhador[ n ][ 3 ] );
|
||||
gridbag.setConstraints( empresaLabel, constraints );
|
||||
pan.add( empresaLabel );
|
||||
|
||||
// JLabel estabelecimentoLabel = new JLabel( "" + estabelecimento.get( EstabelecimentoData.NOME ) );
|
||||
JLabel estabelecimentoLabel = new JLabel( "" + avisosTrabalhador[ n ][ 4 ] );
|
||||
gridbag.setConstraints( estabelecimentoLabel, constraints );
|
||||
pan.add( estabelecimentoLabel );
|
||||
|
||||
// JLabel trabalhadorLabel = new JLabel( "" + trabalhador.get( TrabalhadorData.NOME ) );
|
||||
JLabel trabalhadorLabel = new JLabel( "" + avisosTrabalhador[ n ][ 5 ] );
|
||||
gridbag.setConstraints( trabalhadorLabel, constraints );
|
||||
pan.add( trabalhadorLabel );
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
//JLabel descricaoLabel = new JLabel( (String)avisosTrabalhador[ n ].get( AvisoData.DESCRICAO ) );
|
||||
JLabel descricaoLabel = criarDescricao( avisosTrabalhador[ n ] );
|
||||
gridbag.setConstraints( descricaoLabel, constraints );
|
||||
pan.add( descricaoLabel );
|
||||
|
||||
trabalhadoresPanel.add( pan );
|
||||
}
|
||||
|
||||
// Vector v = new Vector( Arrays.asList( avisosEmpresa ) );
|
||||
// v.addAll( Arrays.asList( avisosTrabalhador ) );
|
||||
// v.addAll( Arrays.asList( avisosEstabelecimento ) );
|
||||
// avisos = (AvisoData []) v.toArray( new AvisoData[0] );
|
||||
|
||||
JScrollPane scp = new JScrollPane();
|
||||
setLayout( new GridLayout( 1, 1 ) );
|
||||
add( scp );
|
||||
JPanel contentPanel = new JPanel();
|
||||
scp.setViewportView( contentPanel );
|
||||
// contentPanel.setLayout( new BoxLayout( contentPanel, BoxLayout.Y_AXIS ) );
|
||||
// contentPanel.setLayout( new FlowLayout() );
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
contentPanel.setLayout( gridbag );
|
||||
constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 1, 1, 1, 1 );
|
||||
constraints.fill = GridBagConstraints.BOTH;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
constraints.weightx = 1;
|
||||
constraints.gridheight = 1;
|
||||
constraints.weighty = 0;
|
||||
if( avisosEmpresa.length > 0 )
|
||||
{
|
||||
gridbag.setConstraints( empresaPanel, constraints );
|
||||
contentPanel.add( empresaPanel );
|
||||
}
|
||||
if( avisosTrabalhador.length > 0 )
|
||||
{
|
||||
// contentPanel.add( new JLabel( " " ) );
|
||||
gridbag.setConstraints( trabalhadoresPanel, constraints );
|
||||
contentPanel.add( trabalhadoresPanel );
|
||||
}
|
||||
if( avisosEstabelecimento.length > 0 )
|
||||
{
|
||||
// contentPanel.add( new JLabel( " " ) );
|
||||
gridbag.setConstraints( estabelecimentosPanel, constraints );
|
||||
contentPanel.add( estabelecimentosPanel );
|
||||
}
|
||||
}
|
||||
|
||||
public void refresh()
|
||||
{
|
||||
if( refreshed )
|
||||
{
|
||||
return;
|
||||
}
|
||||
refreshed = true;
|
||||
try
|
||||
{
|
||||
provider = ( FichaDataProvider ) FichaDataProvider.getProvider();
|
||||
// Collection c = AvisoData.load( AvisoData.class, " estabelecimento_id == \"null\" ",
|
||||
// AvisoData.DATA_EVENTO + " ascending" );
|
||||
|
||||
// Collection c = AvisoData.load( AvisoData.class, "(tipo == " + AvisoData.TIPO_EMPRESA+")",// + ") && ( data_aviso <= CURRENT_DATE )",
|
||||
// AvisoData.DATA_EVENTO + " ascending" );
|
||||
// Collection c = AvisoData.load( AvisoData.class, new Object[]{ /*new Integer( AvisoData.TIPO_EMPRESA ), */new Date() },
|
||||
// new String[]{ /*"tipo", */"data_aviso" },
|
||||
// new String[]{ "=="/*, "==" */},
|
||||
// new String[]{ AvisoData.DATA_EVENTO + " ascending" } );
|
||||
|
||||
// if( c == null )
|
||||
// {
|
||||
// avisosEmpresa = new AvisoData[ 0 ];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
//
|
||||
// avisosEmpresa = ( AvisoData[] )c.toArray( new AvisoData[ c.size() ] );
|
||||
// }
|
||||
|
||||
// Integer ids[] = provider.getAvisosIDByTipoAndDate( new Integer( AvisoConstants.TIPO_EMPRESA ), new Date() );
|
||||
// avisosEmpresa = new AvisoData[ ids.length ];
|
||||
// if( JDO == null )
|
||||
// {
|
||||
// JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
|
||||
// }
|
||||
//// System.out.println( "JDO: " + JDO );
|
||||
// for( int n = 0; n < avisosEmpresa.length; n++ )
|
||||
// {
|
||||
// avisosEmpresa[ n ] = (AvisoData) JDO.load( AvisoData.class, ids[ n ] );
|
||||
// }
|
||||
//
|
||||
////System.out.println( "EmpresaData " + avisosEmpresa.length );
|
||||
//// c = AvisoData.load( AvisoData.class, " tipo == " + AvisoData.TIPO_ESTABELECIMENTO,// + ") && ( data_aviso <= new Date() )",
|
||||
//// AvisoData.DATA_EVENTO + " ascending" );
|
||||
//// c = AvisoData.load( AvisoData.class, "estabelecimento_id != \"null\" "
|
||||
//// + " && trabalhador_id == \"null\"", AvisoData.DATA_EVENTO + " ascending" );
|
||||
//// if( c == null )
|
||||
//// {
|
||||
//// avisosEstabelecimento = new AvisoData[ 0 ];
|
||||
//// }
|
||||
//// else
|
||||
//// {
|
||||
//// avisosEstabelecimento = ( AvisoData[] )c.toArray( new AvisoData[ c.size() ] );
|
||||
//// }
|
||||
//
|
||||
// ids = provider.getAvisosIDByTipoAndDate( new Integer( AvisoConstants.TIPO_ESTABELECIMENTO ), new Date() );
|
||||
// avisosEstabelecimento = new AvisoData[ ids.length ];
|
||||
// for( int n = 0; n < avisosEstabelecimento.length; n++ )
|
||||
// {
|
||||
// avisosEstabelecimento[ n ] = (AvisoData) JDO.load( AvisoData.class, new Object[]{ids[ n ]}, new String[]{ "id" } );
|
||||
// }
|
||||
////System.out.println( "EstabelecimentoData " + avisosEstabelecimento.length );
|
||||
//// c = AvisoData.load( AvisoData.class, " tipo == " + AvisoData.TIPO_TRABALHADOR,// + ") && ( data_aviso <= new Date() )",
|
||||
//// AvisoData.DATA_EVENTO + " ascending" );
|
||||
//// c = AvisoData.load( AvisoData.class, "trabalhador_id != \"null\"", AvisoData.DATA_EVENTO + " ascending" );
|
||||
//// if( c == null )
|
||||
//// {
|
||||
//// avisosTrabalhador = new AvisoData[ 0 ];
|
||||
//// }
|
||||
//// else
|
||||
//// {
|
||||
//// avisosTrabalhador = ( AvisoData[] )c.toArray( new AvisoData[ c.size() ] );
|
||||
//// }
|
||||
// ids = provider.getAvisosIDByTipoAndDate( new Integer( AvisoConstants.TIPO_TRABALHADOR ), new Date() );
|
||||
//
|
||||
// avisosTrabalhador = new AvisoData[ ids.length ];
|
||||
// for( int n = 0; n < avisosTrabalhador.length; n++ )
|
||||
// {
|
||||
// avisosTrabalhador[ n ] = (AvisoData) JDO.load( AvisoData.class, ids[ n ] );
|
||||
// }
|
||||
//System.out.println( "trabalhador " + avisosTrabalhador.length );
|
||||
avisosEmpresa = provider.getAvisosEmpresaByDate( new Date() );
|
||||
avisosEstabelecimento = provider.getAvisosEstabelecimentoByDate( new Date() );
|
||||
avisosTrabalhador = provider.getAvisosTrabalhadorByDate( new Date() );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
setupComponents();
|
||||
setVisible( true );
|
||||
repaint();
|
||||
}
|
||||
|
||||
private JLabel criarDescricao( Object aviso[] )
|
||||
{
|
||||
Date dataEvento = ( Date )aviso[ 1 ];
|
||||
|
||||
String descricao = (String)aviso[ 2 ];
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime( dataEvento );
|
||||
cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 );
|
||||
cal.set( Calendar.MILLISECOND, 0 );
|
||||
dataEvento = cal.getTime();
|
||||
|
||||
cal = Calendar.getInstance();
|
||||
cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 );
|
||||
cal.set( Calendar.MILLISECOND, 0 );
|
||||
Date hoje = cal.getTime();
|
||||
|
||||
if( !hoje.after( dataEvento ) && !hoje.before( dataEvento ) )
|
||||
{
|
||||
descricao += " hoje";
|
||||
}
|
||||
else
|
||||
{
|
||||
descricao += " no dia " + DATE_FORMAT.format( dataEvento );
|
||||
}
|
||||
JLabel descricaoLabel = new JLabel( descricao );
|
||||
if( hoje.after( dataEvento ) )
|
||||
{
|
||||
descricaoLabel.setForeground( Color.red );
|
||||
}
|
||||
else if( hoje.equals( dataEvento ) )
|
||||
{
|
||||
descricaoLabel.setForeground( Color.green.darker() );
|
||||
}
|
||||
return descricaoLabel;
|
||||
}
|
||||
|
||||
// private JLabel criarDescricao( AvisoData aviso )
|
||||
// {
|
||||
// Date dataEvento = ( Date )aviso.get( AvisoData.DATA_EVENTO );
|
||||
//
|
||||
// String descricao = (String)aviso.get( AvisoData.DESCRICAO );
|
||||
// String descricao2 = (String)aviso.get( AvisoData.DESCRICAO );
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// cal.setTime( dataEvento );
|
||||
// cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 );
|
||||
// cal.set( Calendar.MILLISECOND, 0 );
|
||||
// dataEvento = cal.getTime();
|
||||
//
|
||||
// cal = Calendar.getInstance();
|
||||
// cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 );
|
||||
// cal.set( Calendar.MILLISECOND, 0 );
|
||||
// Date hoje = cal.getTime();
|
||||
//
|
||||
// if( !hoje.after( dataEvento ) && !hoje.before( dataEvento ) )
|
||||
// {
|
||||
// descricao += " hoje";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// descricao += " no dia " + DATE_FORMAT.format( dataEvento );
|
||||
// }
|
||||
// JLabel descricaoLabel = new JLabel( descricao );
|
||||
// if( hoje.after( dataEvento ) )
|
||||
// {
|
||||
// descricaoLabel.setForeground( Color.red );
|
||||
// }
|
||||
// else if( hoje.equals( dataEvento ) )
|
||||
// {
|
||||
// descricaoLabel.setForeground( Color.green.darker() );
|
||||
// }
|
||||
// return descricaoLabel;
|
||||
// }
|
||||
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
if( JDO == null )
|
||||
{
|
||||
JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
|
||||
}
|
||||
Object source = e.getSource();
|
||||
if( source instanceof JButton )
|
||||
{
|
||||
// AvisoData aviso = (AvisoData) buttonHash.get( source );
|
||||
try
|
||||
{
|
||||
( (JButton) source ).setEnabled( false );
|
||||
Integer id = (Integer)buttonHash.get( source );
|
||||
if( id == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
buttonHash.remove( source );
|
||||
AvisoData aviso = (AvisoData) JDO.load( AvisoData.class, id );
|
||||
if( aviso == null )
|
||||
{
|
||||
JOptionPane.showMessageDialog( null, "Este aviso j\u00e1 foi tratado.", "J\u00e1 tratado",
|
||||
JOptionPane.WARNING_MESSAGE );
|
||||
return;
|
||||
}
|
||||
Hashtable dataHash = aviso.getHashData();
|
||||
Date dataEvento = (Date)dataHash.get( AvisoData.DATA_EVENTO );
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime( dataEvento );
|
||||
cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 );
|
||||
cal.set( Calendar.MILLISECOND, 0 );
|
||||
dataEvento = cal.getTime();
|
||||
|
||||
cal = Calendar.getInstance();
|
||||
cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 10, 0, 0 );
|
||||
cal.set( Calendar.MILLISECOND, 0 );
|
||||
Date hoje = cal.getTime();
|
||||
if( hoje.before( dataEvento ) )
|
||||
{
|
||||
AvisoData novoAviso = new AvisoData();
|
||||
novoAviso.setHashData( dataHash );
|
||||
novoAviso.set( AvisoData.DATA_AVISO, dataEvento );
|
||||
novoAviso.save();
|
||||
}
|
||||
|
||||
Integer tipo = (Integer) aviso.get( AvisoData.TIPO );
|
||||
TrabalhadorData trabalhador;
|
||||
EstabelecimentoData estabelecimento;
|
||||
EmpresaData empresa;
|
||||
|
||||
switch( tipo.intValue() )
|
||||
{
|
||||
case AvisoConstants.TIPO_TRABALHADOR:
|
||||
trabalhador = (TrabalhadorData) aviso.get( AvisoData.TRABALHADOR );
|
||||
estabelecimento = (EstabelecimentoData) trabalhador.get( TrabalhadorData.ESTABELECIMENTO );
|
||||
empresa = (EmpresaData) estabelecimento.get( EstabelecimentoData.EMPRESA );
|
||||
aviso.delete();
|
||||
tracker.getMedicinaWindow().setVisible( true );
|
||||
tracker.getMedicinaWindow().setEmpresaAndEstabelecimentoAndTrabalhador( (Integer) empresa.get( EmpresaData.ID ),
|
||||
( Integer ) estabelecimento.get( EstabelecimentoData.ID ),
|
||||
( Integer ) trabalhador.get( TrabalhadorData.ID ) );
|
||||
break;
|
||||
|
||||
case AvisoConstants.TIPO_ESTABELECIMENTO:
|
||||
estabelecimento = (EstabelecimentoData) aviso.get( AvisoData.ESTABELECIMENTO );
|
||||
empresa = (EmpresaData) estabelecimento.get( EstabelecimentoData.EMPRESA );
|
||||
aviso.delete();
|
||||
tracker.getHigieneWindow().setVisible( true );
|
||||
tracker.getHigieneWindow().setEmpresaAndEstabelecimento( (Integer) empresa.get( EmpresaData.ID ),
|
||||
( Integer ) estabelecimento.get( EstabelecimentoData.ID ) );
|
||||
break;
|
||||
|
||||
case AvisoConstants.TIPO_EMPRESA:
|
||||
empresa = (EmpresaData) aviso.get( AvisoData.EMPRESA );
|
||||
aviso.delete();
|
||||
ClientesWindow clientesWindow = tracker.getClientesWindow();
|
||||
clientesWindow.setVisible( true );
|
||||
clientesWindow.setJDOObject( empresa );
|
||||
break;
|
||||
}
|
||||
System.out.println( "delete aviso" );
|
||||
// aviso.set( AvisoData.TRABALHADOR, null );
|
||||
// aviso.set( AvisoData.ESTABELECIMENTO, null );
|
||||
// aviso.set( AvisoData.EMPRESA, null );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a limpar o aviso", true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
}
|
||||
|
||||
public void fill(Object value)
|
||||
{
|
||||
}
|
||||
|
||||
public Object save()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enable )
|
||||
{
|
||||
Set buttonSet = buttonHash.keySet();
|
||||
JButton buttons[] = (JButton[]) buttonSet.toArray( new JButton[0] );
|
||||
for( int n = 0;n < buttons.length; n++ )
|
||||
{
|
||||
buttons[ n ].setEnabled( enable );
|
||||
}
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enable, int type )
|
||||
{
|
||||
Set buttonSet = buttonHash.keySet();
|
||||
JButton buttons[] = (JButton[]) buttonSet.toArray( new JButton[0] );
|
||||
for( int n = 0;n < buttons.length; n++ )
|
||||
{
|
||||
Integer buttonType = ( Integer ) buttonTypeHash.get( buttons[ n ] );
|
||||
if( buttonType.intValue() == type )
|
||||
{
|
||||
buttons[ n ].setEnabled( enable );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setTracker( SIPRPTracker tracker )
|
||||
{
|
||||
this.tracker = tracker;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,210 @@
|
||||
/*
|
||||
* ClientesDataProvider.java
|
||||
*
|
||||
* Created on January 27, 2006, 12:50 AM
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.arrays.*;
|
||||
import com.evolute.utils.data.*;
|
||||
import com.evolute.utils.db.*;
|
||||
import com.evolute.utils.metadb.*;
|
||||
import com.evolute.utils.sql.*;
|
||||
import com.evolute.utils.strings.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class ClientesDataProvider extends MetaProvider
|
||||
{
|
||||
private static final Object LOCK = new Object();
|
||||
private static ClientesDataProvider instance = null;
|
||||
private final Executer executer;
|
||||
|
||||
private Integer etiquetaID;
|
||||
|
||||
/** Creates a new instance of ClientesDataProvider */
|
||||
public ClientesDataProvider()
|
||||
throws Exception
|
||||
{
|
||||
DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ );
|
||||
executer = dbm.getSharedExecuter( this );
|
||||
}
|
||||
|
||||
public static MetaProvider getProvider()
|
||||
throws Exception
|
||||
{
|
||||
synchronized( LOCK )
|
||||
{
|
||||
if( instance == null )
|
||||
{
|
||||
instance = new ClientesDataProvider();
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public IDObject[] getAllGruposProtocoloReais()
|
||||
throws Exception
|
||||
{
|
||||
return getAllGruposProtocoloPorTipo( true );
|
||||
}
|
||||
|
||||
public IDObject[] getAllGruposProtocoloFalsos()
|
||||
throws Exception
|
||||
{
|
||||
return getAllGruposProtocoloPorTipo( false );
|
||||
}
|
||||
|
||||
public IDObject[] getAllGruposProtocoloPorTipo( boolean real )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "prt_grupos_protocolo" },
|
||||
new String[]{ "id", "descricao", "ordem" },
|
||||
new Field( "grupo_real" ).isEqual( real ? "y" : "n" ),
|
||||
new String[]{ "ordem" },
|
||||
null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
IDObject grupos[] = new IDObject[ array.columnLength() ];
|
||||
for( int n = 0; n < grupos.length; n++ )
|
||||
{
|
||||
grupos[ n ] = new MappableObject( ( Integer ) array.get( n, 0 ), ( String ) array.get( n, 1 ) );
|
||||
}
|
||||
return grupos;
|
||||
}
|
||||
|
||||
public Hashtable getAllTiposElementosProtocoloByGrupo()
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "prt_tipos_elementos_protocolo" },
|
||||
new String[]{ "id", "descricao", "ordem", "grupo_protocolo_id" },
|
||||
null,
|
||||
new String[]{ "grupo_protocolo_id", "ordem" },
|
||||
null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
Hashtable tipos = new Hashtable();
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
IDObject tipo = new MappableObject( ( Integer ) array.get( n, 0 ), ( String ) array.get( n, 1 ) );
|
||||
Integer grupoID = ( Integer ) array.get( n, 3 );
|
||||
if( !tipos.containsKey( grupoID ) )
|
||||
{
|
||||
tipos.put( grupoID, new Vector() );
|
||||
}
|
||||
Vector tiposGrupo = ( Vector ) tipos.get( grupoID );
|
||||
tiposGrupo.add( tipo );
|
||||
}
|
||||
return tipos;
|
||||
}
|
||||
|
||||
public void setElementosProtocoloForEmpresa( Integer empresaID, Integer elementos[][] )
|
||||
throws Exception
|
||||
{
|
||||
// executer.executeQuery( Begin.BEGIN );
|
||||
try
|
||||
{
|
||||
Delete delete =
|
||||
new Delete( "prt_elementos_protocolo",
|
||||
new Field( "empresa_id" ).isEqual( empresaID ) );
|
||||
executer.executeQuery( delete );
|
||||
for( int p = 0; p < elementos.length; p++ )
|
||||
{
|
||||
Integer numeroPerfil = new Integer( p + 1 );
|
||||
for( int e = 0; e < elementos[ p ].length; e++ )
|
||||
{
|
||||
Insert insert =
|
||||
new Insert( "prt_elementos_protocolo",
|
||||
new Assignment[]{
|
||||
new Assignment( new Field( "empresa_id" ), empresaID ),
|
||||
new Assignment( new Field( "tipo_elemento_protocolo_id" ), elementos[ p ][ e ] ),
|
||||
new Assignment( new Field( "numero_perfil" ), numeroPerfil ) } );
|
||||
executer.executeQuery( insert, null );
|
||||
}
|
||||
}
|
||||
// executer.executeQuery( Commit.COMMIT );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
// executer.executeQuery( Rollback.ROLLBACK );
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public Integer[][] getElementosProtocoloForEmpresa( Integer empresaID, int numeroPerfis )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "prt_elementos_protocolo" },
|
||||
new String[]{ "tipo_elemento_protocolo_id", "numero_perfil" },
|
||||
new Field( "empresa_id" ).isEqual( empresaID ) ,
|
||||
new String[]{ "numero_perfil" },
|
||||
null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
Vector data[] = new Vector[ numeroPerfis ];
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
int perfil = ( ( Integer ) array.get( n, 1 ) ).intValue() - 1;
|
||||
Integer tipo = ( Integer ) array.get( n, 0 );
|
||||
if( data[ perfil ] == null )
|
||||
{
|
||||
data[ perfil ] = new Vector();
|
||||
}
|
||||
data[ perfil ].add( tipo );
|
||||
}
|
||||
Integer elementos[][] = new Integer[ numeroPerfis ][];
|
||||
for( int n = 0; n < numeroPerfis; n++ )
|
||||
{
|
||||
if( data[ n ] == null )
|
||||
{
|
||||
elementos[ n ] = new Integer[ 0 ];
|
||||
}
|
||||
else
|
||||
{
|
||||
elementos[ n ] = ( Integer [] ) data[ n ].toArray( new Integer[ data[ n ].size() ] );
|
||||
}
|
||||
}
|
||||
return elementos;
|
||||
}
|
||||
|
||||
public Integer getEtiquetaID()
|
||||
throws Exception
|
||||
{
|
||||
if( etiquetaID == null )
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "etiquetas" },
|
||||
new String[]{ "max(id)" },
|
||||
null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
etiquetaID = ( Integer ) array.get( 0, 0 );
|
||||
}
|
||||
return etiquetaID;
|
||||
}
|
||||
|
||||
public Integer getEmpresaIDByTrabalhadorID( Integer trabalhadorID )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "trabalhadores", "estabelecimentos" },
|
||||
new String[]{ "estabelecimentos.empresa_id" },
|
||||
new Field( "trabalhadores.id" ).isEqual( trabalhadorID ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual(
|
||||
new Field( "estabelecimentos.id" ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
return ( Integer ) array.get( 0, 0 );
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,181 @@
|
||||
/*
|
||||
* ContactoPanel.java
|
||||
*
|
||||
* Created on 14 de Maio de 2004, 15:26
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.dataui.*;
|
||||
import com.evolute.utils.ui.text.*;
|
||||
|
||||
import siprp.data.*;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class ContactoPanel extends JPanel
|
||||
implements ControllableComponent
|
||||
{
|
||||
private ContactoData contacto;
|
||||
private ComponentsHashtable components;
|
||||
|
||||
private JTextField nomeText;
|
||||
private JTextField cargoText;
|
||||
private JTextField telefoneText;
|
||||
private JTextField telemovelText;
|
||||
private JTextField faxText;
|
||||
private JTextField emailText;
|
||||
|
||||
/** Creates a new instance of ContactoPanel */
|
||||
public ContactoPanel()
|
||||
{
|
||||
setupComponents();
|
||||
setupComponentsHashtable();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
JLabel nomeLabel = new JLabel( "Nome" );
|
||||
nomeText = new JTextField();
|
||||
JLabel cargoLabel = new JLabel( "Cargo" );
|
||||
cargoText = new JTextField();
|
||||
JLabel telefoneLabel = new JLabel( "Telef." );
|
||||
telefoneText = new JTextField();
|
||||
JLabel telemovelLabel = new JLabel( "Tlm." );
|
||||
telemovelText = new JTextField();
|
||||
JLabel faxLabel = new JLabel( "Fax" );
|
||||
faxText = new JTextField();
|
||||
JLabel emailLabel = new JLabel( "Email" );
|
||||
emailText = new JTextField();
|
||||
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
setLayout( gridbag );
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 1, 1, 1, 1 );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.gridheight = 1;
|
||||
constraints.weighty = 0;
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( nomeLabel, constraints );
|
||||
add( nomeLabel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( nomeText, constraints );
|
||||
add( nomeText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( cargoLabel, constraints );
|
||||
add( cargoLabel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( cargoText, constraints );
|
||||
add( cargoText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( telefoneLabel, constraints );
|
||||
add( telefoneLabel );
|
||||
|
||||
constraints.weightx = .5;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( telefoneText, constraints );
|
||||
add( telefoneText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( telemovelLabel, constraints );
|
||||
add( telemovelLabel );
|
||||
|
||||
constraints.weightx = .5;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( telemovelText, constraints );
|
||||
add( telemovelText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( faxLabel, constraints );
|
||||
add( faxLabel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( faxText, constraints );
|
||||
add( faxText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( emailLabel, constraints );
|
||||
add( emailLabel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( emailText, constraints );
|
||||
add( emailText );
|
||||
|
||||
new CopyPasteHandler( nomeText );
|
||||
new CopyPasteHandler( cargoText );
|
||||
new CopyPasteHandler( telefoneText );
|
||||
new CopyPasteHandler( telemovelText );
|
||||
new CopyPasteHandler( faxText );
|
||||
new CopyPasteHandler( emailText );
|
||||
}
|
||||
|
||||
private void setupComponentsHashtable()
|
||||
{
|
||||
components = new ComponentsHashtable();
|
||||
components.putComponent( ContactoData.NOME, nomeText );
|
||||
components.putComponent( ContactoData.CARGO, cargoText );
|
||||
components.putComponent( ContactoData.TELEFONE, telefoneText );
|
||||
components.putComponent( ContactoData.TELEMOVEL, telemovelText );
|
||||
components.putComponent( ContactoData.FAX, faxText );
|
||||
components.putComponent( ContactoData.EMAIL, emailText );
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.clear( names, components );
|
||||
contacto = null;
|
||||
}
|
||||
|
||||
public void fill(Object value)
|
||||
{
|
||||
clear();
|
||||
contacto = ( ContactoData ) value;
|
||||
if( contacto == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
String names[] = contacto.getFieldNames();
|
||||
ComponentController.fill( names, contacto.getHashData(), components );
|
||||
}
|
||||
|
||||
public Object save()
|
||||
{
|
||||
if( contacto == null )
|
||||
{
|
||||
contacto = new ContactoData();
|
||||
}
|
||||
|
||||
String names[] = contacto.getFieldNames();
|
||||
Hashtable hash = new Hashtable();
|
||||
ComponentController.save( names, hash, components );
|
||||
contacto.setHashData( hash );
|
||||
return contacto;
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enable )
|
||||
{
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.setEnabled( names, enable, components );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,956 @@
|
||||
/*
|
||||
* EmpresaPanel.java
|
||||
*
|
||||
* Created on 12 de Maio de 2004, 19:08
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.data.*;
|
||||
import com.evolute.utils.dataui.*;
|
||||
import com.evolute.utils.documents.*;
|
||||
import com.evolute.utils.jdo.*;
|
||||
import com.evolute.utils.tables.*;
|
||||
import com.evolute.utils.ui.*;
|
||||
import com.evolute.utils.ui.calendar.*;
|
||||
import com.evolute.utils.ui.text.*;
|
||||
|
||||
import siprp.*;
|
||||
import siprp.data.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class EmpresaPanel extends JPanel
|
||||
implements ControllableComponent, ListSelectionListener
|
||||
{
|
||||
private JDOProvider JDO;
|
||||
|
||||
private FichaDataProvider provider;
|
||||
private EmpresaData empresa;
|
||||
private ComponentsHashtable components;
|
||||
|
||||
private Integer id;
|
||||
|
||||
private JTextField designacaoSocialText;
|
||||
private JTextField moradaText;
|
||||
private JTextField codigoPostalText;
|
||||
private JTextField localText;
|
||||
private JTextField distritoText;
|
||||
private JTextField concelhoText;
|
||||
private JTextField codigo1Text;
|
||||
private JTextField codigo2Text;
|
||||
private JTextField codigo3Text;
|
||||
// private JTextField perfil1Text;
|
||||
// private JTextField perfil2Text;
|
||||
private JComboBox servicosCombo;
|
||||
private JTextField precoHigieneText;
|
||||
private JTextField precoMedicinaText;
|
||||
private JTextField modalidadePagamentoText;
|
||||
private ContactoPanel contacto1Panel;
|
||||
private ContactoPanel contacto2Panel;
|
||||
private JCalendarPanel envioPropostaPanel;
|
||||
private JCalendarPanel aceitacaoPropostaPanel;
|
||||
private JCalendarPanel inicioContratoPanel;
|
||||
private JTextField duracaoContratoText;
|
||||
private JCalendarPanel cancelamentoPanel;
|
||||
private JCalendarPanel envioContratoPanel;
|
||||
private JCalendarPanel recepcaoContratoPanel;
|
||||
private JCalendarPanel envioIdictPanel;
|
||||
private JCalendarPanel relatorioAnualPanel;
|
||||
private JTextField caeText;
|
||||
private JTextField actividadeText;
|
||||
private JTextField contribuinteText;
|
||||
private JTextField segSocialText;
|
||||
private JPanel marcacoesPanel;
|
||||
private JPanel listaMarcacoesPanel;
|
||||
private BaseTable marcacoesTable;
|
||||
private MarcacaoEmpresaPanel marcacaoPanel;
|
||||
private CardLayout marcacoesCardLayout;
|
||||
private ProtocoloPanel protocoloPanel;
|
||||
// private UserPanel userPanel;
|
||||
|
||||
private BaseTable estabelecimentosTable;
|
||||
private VectorTableModel estabelecimentosModel;
|
||||
|
||||
private boolean webAware;
|
||||
|
||||
private Vector listSelectionListeners;
|
||||
|
||||
/** Creates a new instance of EmpresaPanel */
|
||||
public EmpresaPanel()
|
||||
throws Exception
|
||||
{
|
||||
webAware = ( ( Boolean ) Singleton.getInstance( SingletonConstants.WEB_AWARE ) ).booleanValue();
|
||||
provider = (FichaDataProvider)FichaDataProvider.getProvider();
|
||||
listSelectionListeners = new Vector();
|
||||
JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
|
||||
setupComponents();
|
||||
setupComponentsHashtable();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
throws Exception
|
||||
{
|
||||
String codeFormat = ( String ) Singleton.getInstance( SingletonConstants.CODIGO_EMPRESA_FORMAT );
|
||||
String formatElements[] = codeFormat.split( " " );
|
||||
int formatFieldLengths[] = new int[ formatElements.length ];
|
||||
String fieldSeparators[] = new String[ formatElements.length ];
|
||||
int n1 = 0;
|
||||
int n2 = 0;
|
||||
for( ; n1 < formatElements.length; n1++ )
|
||||
{
|
||||
try
|
||||
{
|
||||
formatFieldLengths[ n2 ] = Integer.parseInt( formatElements[ n1 ] );
|
||||
n2++;
|
||||
}
|
||||
catch( NumberFormatException ex )
|
||||
{
|
||||
fieldSeparators[ n2 - 1 ] = formatElements[ n1 ];
|
||||
}
|
||||
}
|
||||
int countFields = n2;
|
||||
|
||||
JLabel designacaoSocialLabel = new JLabel( "Designa\u00e7\u00e3o Social" );
|
||||
designacaoSocialText = new StateTextField();
|
||||
JLabel codigoLabel = new JLabel( "C\u00f3digo" );
|
||||
JPanel codigoPanel = new JPanel();
|
||||
codigo1Text = new StateTextField();
|
||||
if( countFields > 0 && formatFieldLengths[ 0 ] > 0 )
|
||||
{
|
||||
codigo1Text.setDocument( new MaximumLengthDocument( formatFieldLengths[ 0 ] ) );
|
||||
}
|
||||
codigo2Text = new StateTextField();
|
||||
if( countFields > 1 && formatFieldLengths[ 1 ] > 0 )
|
||||
{
|
||||
codigo2Text.setDocument( new MaximumLengthDocument( formatFieldLengths[ 1 ] ) );
|
||||
}
|
||||
codigo3Text = new StateTextField();
|
||||
if( countFields > 2 && formatFieldLengths[ 2 ] > 0 )
|
||||
{
|
||||
codigo3Text.setDocument( new MaximumLengthDocument( formatFieldLengths[ 2 ] ) );
|
||||
}
|
||||
// JLabel perfisLabel = new JLabel( "Perfis (A/B)" );
|
||||
// perfil1Text = new JTextField();
|
||||
// JLabel perfil2Label = new JLabel( "/" );
|
||||
// perfil2Text = new JTextField();
|
||||
servicosCombo = new JComboBox();
|
||||
servicosCombo.setPreferredSize( new Dimension( 120, 20 ) );
|
||||
|
||||
JLabel precoLabel = new JLabel( "Pre\u00e7os" );
|
||||
JLabel precoHigieneLabel = new JLabel( " Higiene" );
|
||||
precoHigieneText = new JTextField();
|
||||
precoHigieneText.setDocument( new DoubleDocument( 15, true ) );
|
||||
JLabel higieneEuroLabel = new JLabel( "\u20ac" );
|
||||
JLabel precoMedicinaLabel = new JLabel( " Medicina" );
|
||||
precoMedicinaText = new JTextField();
|
||||
precoMedicinaText.setDocument( new DoubleDocument( 15, true ) );
|
||||
JLabel medicinaEuroLabel = new JLabel( "\u20ac" );
|
||||
JLabel modalidadePagamentoLabel = new JLabel( "Periodicidade" );
|
||||
modalidadePagamentoText = new JTextField();
|
||||
|
||||
JLabel moradaLabel = new JLabel( "Morada" );
|
||||
moradaText = new StateTextField();
|
||||
JLabel codigoPostalLabel = new JLabel( "C\u00f3digo Postal" );
|
||||
codigoPostalText = new StateTextField();
|
||||
codigoPostalText.setPreferredSize( new Dimension( 50, 20 ) );
|
||||
codigoPostalText.setDocument( new MaximumLengthDocument( 8 ) );
|
||||
JLabel localLabel = new JLabel( "Localidade" );
|
||||
localText = new StateTextField();
|
||||
JLabel distritoLabel = new JLabel( "Distrito" );
|
||||
distritoText = new JTextField();
|
||||
JLabel concelhoLabel = new JLabel( "Concelho" );
|
||||
concelhoText = new JTextField();
|
||||
contacto1Panel = new ContactoPanel();
|
||||
contacto1Panel.setBorder( BorderFactory.createEtchedBorder() );
|
||||
contacto2Panel = new ContactoPanel();
|
||||
contacto2Panel.setBorder( BorderFactory.createEtchedBorder() );
|
||||
JLabel envioPropostaLabel = new JLabel( "Proposta" );
|
||||
envioPropostaPanel = new JCalendarPanel( null );
|
||||
JLabel aceitacaoPropostaLabel = new JLabel( "Aceita\u00e7\u00e3o" );
|
||||
aceitacaoPropostaPanel = new JCalendarPanel( null );
|
||||
JLabel inicioContratoLabel = new JLabel( "In\u00edcio" );
|
||||
inicioContratoPanel = new JCalendarPanel( null );
|
||||
JLabel duracaoContratoLabel = new JLabel( "Dura\u00e7\u00e3o (meses)" );
|
||||
duracaoContratoText = new JTextField();
|
||||
duracaoContratoText.setDocument( new IntegerDocument( 5, false ) );
|
||||
JLabel cancelamentoLabel = new JLabel( "Cancelamento" );
|
||||
cancelamentoPanel = new JCalendarPanel( null );
|
||||
JLabel envioContratoLabel = new JLabel( "Envio Contrato" );
|
||||
envioContratoPanel = new JCalendarPanel( null );
|
||||
JLabel recepcaoContratoLabel = new JLabel( "Recep\u00e7\u00e3o" );
|
||||
recepcaoContratoPanel = new JCalendarPanel( null );
|
||||
JLabel envioIdictLabel = new JLabel( "Mod. 1360" );
|
||||
envioIdictPanel = new JCalendarPanel( null );
|
||||
JLabel relatorioAnualLabel = new JLabel( "Relat\u00f3rio Anual" );
|
||||
relatorioAnualPanel = new JCalendarPanel( null );
|
||||
JTabbedPane tabbedPane = new JTabbedPane();
|
||||
JLabel caeLabel = new JLabel( "CAE" );
|
||||
caeText = new JTextField();
|
||||
JLabel actividadeLabel = new JLabel( " - " );
|
||||
actividadeText = new JTextField();
|
||||
JLabel contribuinteLabel = new JLabel( "Contribuinte" );
|
||||
contribuinteText = new JTextField();
|
||||
JLabel segSocialLabel = new JLabel( "Seguran\u00e7a Social" );
|
||||
segSocialText = new JTextField();
|
||||
JPanel moradaPanel = new JPanel();
|
||||
marcacoesPanel = new JPanel();
|
||||
protocoloPanel = new ProtocoloPanel();
|
||||
// userPanel = new UserPanel();
|
||||
|
||||
JScrollPane estabelecimentosScroll = new JScrollPane();
|
||||
estabelecimentosScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
||||
estabelecimentosModel = new VectorTableModel( new String[]{ "Estabelecimentos" } );
|
||||
estabelecimentosTable = new BaseTable( estabelecimentosModel );
|
||||
estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
|
||||
estabelecimentosTable.getSelectionModel().addListSelectionListener( this );
|
||||
estabelecimentosScroll.setViewportView( estabelecimentosTable );
|
||||
|
||||
JPanel dadosEmpresaPanel = new JPanel();
|
||||
JPanel contactosPanel = new JPanel();
|
||||
JScrollPane contactosScroll = new JScrollPane();
|
||||
contactosScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
||||
contactosScroll.setViewportView( contactosPanel );
|
||||
contactosScroll.setBorder( BorderFactory.createTitledBorder(
|
||||
BorderFactory.createEtchedBorder(), "Contactos" ) );
|
||||
JPanel formalidadesPanel = new JPanel();
|
||||
|
||||
JPanel pad;
|
||||
|
||||
JPanel upperPanel = new JPanel();
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
upperPanel.setLayout( gridbag );
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 1, 1, 1, 1 );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weighty = 0;
|
||||
constraints.gridheight = 1;
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( designacaoSocialLabel, constraints );
|
||||
upperPanel.add( designacaoSocialLabel );
|
||||
|
||||
constraints.weightx = 0.9;
|
||||
constraints.gridwidth = 5;
|
||||
gridbag.setConstraints( designacaoSocialText, constraints );
|
||||
upperPanel.add( designacaoSocialText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( codigoLabel, constraints );
|
||||
upperPanel.add( codigoLabel );
|
||||
|
||||
constraints.weightx = 0.1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( codigoPanel, constraints );
|
||||
upperPanel.add( codigoPanel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
// gridbag.setConstraints( moradaLabel, constraints );
|
||||
// upperPanel.add( moradaLabel );
|
||||
gridbag.setConstraints( caeLabel, constraints );
|
||||
upperPanel.add( caeLabel );
|
||||
|
||||
constraints.weightx = 0.2;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( caeText, constraints );
|
||||
upperPanel.add( caeText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
// gridbag.setConstraints( moradaLabel, constraints );
|
||||
// upperPanel.add( moradaLabel );
|
||||
gridbag.setConstraints( actividadeLabel, constraints );
|
||||
upperPanel.add( actividadeLabel );
|
||||
|
||||
constraints.weightx = 0.6;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( actividadeText, constraints );
|
||||
upperPanel.add( actividadeText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
// gridbag.setConstraints( codigoPostalLabel, constraints );
|
||||
// upperPanel.add( codigoPostalLabel );
|
||||
gridbag.setConstraints( contribuinteLabel, constraints );
|
||||
upperPanel.add( contribuinteLabel );
|
||||
|
||||
constraints.weightx = 0.1;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( contribuinteText, constraints );
|
||||
upperPanel.add( contribuinteText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 2;
|
||||
// gridbag.setConstraints( localLabel, constraints );
|
||||
// upperPanel.add( localLabel );
|
||||
gridbag.setConstraints( segSocialLabel, constraints );
|
||||
upperPanel.add( segSocialLabel );
|
||||
|
||||
constraints.weightx = 0.1;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( segSocialText, constraints );
|
||||
upperPanel.add( segSocialText );
|
||||
|
||||
|
||||
gridbag = new GridBagLayout();
|
||||
dadosEmpresaPanel.setLayout( gridbag );
|
||||
constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 1, 1, 1, 1 );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weighty = 0;
|
||||
constraints.gridheight = 1;
|
||||
|
||||
contactosPanel.setLayout( new GridLayout( 1, 2 ) );
|
||||
contactosPanel.add( contacto1Panel );
|
||||
contactosPanel.add( contacto2Panel );
|
||||
|
||||
gridbag = new GridBagLayout();
|
||||
formalidadesPanel.setLayout( gridbag );
|
||||
constraints.weighty = 0;
|
||||
constraints.gridheight = 1;
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( envioPropostaLabel, constraints );
|
||||
formalidadesPanel.add( envioPropostaLabel );
|
||||
|
||||
constraints.weightx = 0.3;
|
||||
gridbag.setConstraints( envioPropostaPanel, constraints );
|
||||
formalidadesPanel.add( envioPropostaPanel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
gridbag.setConstraints( inicioContratoLabel, constraints );
|
||||
formalidadesPanel.add( inicioContratoLabel );
|
||||
|
||||
constraints.weightx = 0.2;
|
||||
constraints.gridwidth = 1;
|
||||
// JPanel perfisPanel = new JPanel();
|
||||
gridbag.setConstraints( inicioContratoPanel, constraints );
|
||||
formalidadesPanel.add( inicioContratoPanel );
|
||||
|
||||
constraints.weightx = 0.4;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( precoLabel, constraints );
|
||||
formalidadesPanel.add( precoLabel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( aceitacaoPropostaLabel, constraints );
|
||||
formalidadesPanel.add( aceitacaoPropostaLabel );
|
||||
|
||||
constraints.weightx = 0.3;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( aceitacaoPropostaPanel, constraints );
|
||||
formalidadesPanel.add( aceitacaoPropostaPanel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
gridbag.setConstraints( duracaoContratoLabel, constraints );
|
||||
formalidadesPanel.add( duracaoContratoLabel );
|
||||
|
||||
constraints.weightx = 0.2;
|
||||
constraints.gridwidth = 1;
|
||||
// JPanel perfisPanel = new JPanel();
|
||||
gridbag.setConstraints( duracaoContratoText, constraints );
|
||||
formalidadesPanel.add( duracaoContratoText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( precoHigieneLabel, constraints );
|
||||
formalidadesPanel.add( precoHigieneLabel );
|
||||
|
||||
constraints.weightx = 0.4;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( precoHigieneText, constraints );
|
||||
formalidadesPanel.add( precoHigieneText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( higieneEuroLabel, constraints );
|
||||
formalidadesPanel.add( higieneEuroLabel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( envioContratoLabel, constraints );
|
||||
formalidadesPanel.add( envioContratoLabel );
|
||||
|
||||
constraints.weightx = 0.3;
|
||||
gridbag.setConstraints( envioContratoPanel, constraints );
|
||||
formalidadesPanel.add( envioContratoPanel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
gridbag.setConstraints( cancelamentoLabel, constraints );
|
||||
formalidadesPanel.add( cancelamentoLabel );
|
||||
|
||||
constraints.weightx = 0.2;
|
||||
constraints.gridwidth = 1;
|
||||
// JPanel perfisPanel = new JPanel();
|
||||
gridbag.setConstraints( cancelamentoPanel, constraints );
|
||||
formalidadesPanel.add( cancelamentoPanel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( precoMedicinaLabel, constraints );
|
||||
formalidadesPanel.add( precoMedicinaLabel );
|
||||
|
||||
constraints.weightx = 0.4;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( precoMedicinaText, constraints );
|
||||
formalidadesPanel.add( precoMedicinaText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( medicinaEuroLabel, constraints );
|
||||
formalidadesPanel.add( medicinaEuroLabel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( recepcaoContratoLabel, constraints );
|
||||
formalidadesPanel.add( recepcaoContratoLabel );
|
||||
|
||||
constraints.weightx = 0.3;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( recepcaoContratoPanel, constraints );
|
||||
formalidadesPanel.add( recepcaoContratoPanel );
|
||||
|
||||
constraints.weightx = 0.2;
|
||||
constraints.gridwidth = 2;
|
||||
gridbag.setConstraints( servicosCombo, constraints );
|
||||
formalidadesPanel.add( servicosCombo );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( modalidadePagamentoLabel, constraints );
|
||||
formalidadesPanel.add( modalidadePagamentoLabel );
|
||||
|
||||
constraints.weightx = 0.4;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( modalidadePagamentoText, constraints );
|
||||
formalidadesPanel.add( modalidadePagamentoText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( envioIdictLabel, constraints );
|
||||
formalidadesPanel.add( envioIdictLabel );
|
||||
|
||||
constraints.weightx = 0.3;
|
||||
gridbag.setConstraints( envioIdictPanel, constraints );
|
||||
formalidadesPanel.add( envioIdictPanel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( relatorioAnualLabel, constraints );
|
||||
formalidadesPanel.add( relatorioAnualLabel );
|
||||
|
||||
constraints.weightx = 0.2;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( relatorioAnualPanel, constraints );
|
||||
formalidadesPanel.add( relatorioAnualPanel );
|
||||
|
||||
constraints.weightx = 0.4;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
pad = new JPanel();
|
||||
gridbag.setConstraints( pad, constraints );
|
||||
formalidadesPanel.add( pad );
|
||||
|
||||
// constraints.weightx = 0.5;
|
||||
// constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
// pad = new JPanel();
|
||||
// gridbag.setConstraints( pad, constraints );
|
||||
// formalidadesPanel.add( pad );
|
||||
|
||||
setLayout( new BorderLayout() );
|
||||
add( upperPanel, BorderLayout.NORTH );
|
||||
JPanel lowerPanel = new JPanel();
|
||||
add( lowerPanel, BorderLayout.CENTER );
|
||||
|
||||
gridbag = new GridBagLayout();
|
||||
lowerPanel.setLayout( gridbag );
|
||||
constraints.fill = GridBagConstraints.BOTH;
|
||||
constraints.insets = new Insets( 0, 0, 0, 0 );
|
||||
constraints.weighty = 1;
|
||||
constraints.gridheight = GridBagConstraints.REMAINDER;
|
||||
|
||||
constraints.weightx = 0.55;
|
||||
constraints.gridwidth = 1;
|
||||
// lowerPanel.setLayout( new BorderLayout() );
|
||||
//lowerPanel.add( dadosEmpresaPanel );
|
||||
//lowerPanel.add( new JPanel() );
|
||||
gridbag.setConstraints( tabbedPane, constraints );
|
||||
lowerPanel.add( tabbedPane );
|
||||
// lowerPanel.add( tabbedPane, BorderLayout.CENTER );
|
||||
tabbedPane.add( "Contactos", contactosPanel );
|
||||
tabbedPane.add( "Morada", moradaPanel );
|
||||
tabbedPane.add( "Formalidades", formalidadesPanel );
|
||||
tabbedPane.add( "Protocolo", protocoloPanel );
|
||||
tabbedPane.add( "Tarefas", marcacoesPanel );
|
||||
|
||||
// if( webAware )
|
||||
// {
|
||||
// tabbedPane.add( "Utilizador da P\u00e1gina", userPanel );
|
||||
// }
|
||||
|
||||
constraints.weightx = 0.45;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( estabelecimentosScroll, constraints );
|
||||
lowerPanel.add( estabelecimentosScroll );
|
||||
// lowerPanel.add( estabelecimentosScroll, BorderLayout.EAST );
|
||||
|
||||
gridbag = new GridBagLayout();
|
||||
codigoPanel.setLayout( gridbag );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.insets = new Insets( 1, 0, 1, 2 );
|
||||
constraints.weighty = 1;
|
||||
constraints.gridheight = GridBagConstraints.REMAINDER;
|
||||
|
||||
if( countFields > 0 )
|
||||
{
|
||||
constraints.weightx = 0.2;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( codigo1Text, constraints );
|
||||
codigoPanel.add( codigo1Text );
|
||||
|
||||
if( fieldSeparators[ 0 ] != null )
|
||||
{
|
||||
constraints.weightx = 0;
|
||||
JLabel divLabel = new JLabel( fieldSeparators[ 0 ] );
|
||||
gridbag.setConstraints( divLabel, constraints );
|
||||
codigoPanel.add( divLabel );
|
||||
}
|
||||
}
|
||||
|
||||
if( countFields > 1 )
|
||||
{
|
||||
constraints.weightx = 0.5;
|
||||
gridbag.setConstraints( codigo2Text, constraints );
|
||||
codigoPanel.add( codigo2Text );
|
||||
|
||||
if( fieldSeparators[ 1 ] != null )
|
||||
{
|
||||
constraints.weightx = 0;
|
||||
JLabel divLabel = new JLabel( fieldSeparators[ 1 ] );
|
||||
gridbag.setConstraints( divLabel, constraints );
|
||||
codigoPanel.add( divLabel );
|
||||
}
|
||||
// constraints.weightx = 0;
|
||||
// JLabel divLabel = new JLabel( "/" );
|
||||
// gridbag.setConstraints( divLabel, constraints );
|
||||
// codigoPanel.add( divLabel );
|
||||
}
|
||||
|
||||
if( countFields > 2 )
|
||||
{
|
||||
constraints.weightx = 0.2;
|
||||
// constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( codigo3Text, constraints );
|
||||
codigoPanel.add( codigo3Text );
|
||||
|
||||
if( fieldSeparators[ 2 ] != null )
|
||||
{
|
||||
constraints.weightx = 0;
|
||||
JLabel divLabel = new JLabel( fieldSeparators[ 2 ] );
|
||||
gridbag.setConstraints( divLabel, constraints );
|
||||
codigoPanel.add( divLabel );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// gridbag = new GridBagLayout();
|
||||
// perfisPanel.setLayout( gridbag );
|
||||
// constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
// constraints.insets = new Insets( 1, 0, 1, 2 );
|
||||
// constraints.weighty = 1;
|
||||
// constraints.gridheight = GridBagConstraints.REMAINDER;
|
||||
//
|
||||
// constraints.weightx = 0.5;
|
||||
// constraints.gridwidth = 1;
|
||||
// gridbag.setConstraints( perfil1Text, constraints );
|
||||
// perfisPanel.add( perfil1Text );
|
||||
//
|
||||
// constraints.weightx = 0;
|
||||
// constraints.gridwidth = 1;
|
||||
// gridbag.setConstraints( perfil2Label, constraints );
|
||||
// perfisPanel.add( perfil2Label );
|
||||
//
|
||||
// constraints.weightx = 0.5;
|
||||
// //constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
// gridbag.setConstraints( perfil2Text, constraints );
|
||||
// perfisPanel.add( perfil2Text );
|
||||
|
||||
|
||||
gridbag = new GridBagLayout();
|
||||
moradaPanel.setLayout( gridbag );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weighty = 0;
|
||||
constraints.gridheight = 1;
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( moradaLabel, constraints );
|
||||
moradaPanel.add( moradaLabel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( moradaText, constraints );
|
||||
moradaPanel.add( moradaText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( codigoPostalLabel, constraints );
|
||||
moradaPanel.add( codigoPostalLabel );
|
||||
|
||||
constraints.weightx = 0.3;
|
||||
gridbag.setConstraints( codigoPostalText, constraints );
|
||||
moradaPanel.add( codigoPostalText );
|
||||
|
||||
constraints.weightx = 0.7;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
pad = new JPanel();
|
||||
gridbag.setConstraints( pad, constraints );
|
||||
moradaPanel.add( pad );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( localLabel, constraints );
|
||||
moradaPanel.add( localLabel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( localText, constraints );
|
||||
moradaPanel.add( localText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( distritoLabel, constraints );
|
||||
moradaPanel.add( distritoLabel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( distritoText, constraints );
|
||||
moradaPanel.add( distritoText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( concelhoLabel, constraints );
|
||||
moradaPanel.add( concelhoLabel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( concelhoText, constraints );
|
||||
moradaPanel.add( concelhoText );
|
||||
|
||||
|
||||
listaMarcacoesPanel = new JPanel();
|
||||
listaMarcacoesPanel.setLayout( new GridLayout( 1, 1 ) );
|
||||
VectorTableModel marcacoesModel = new VectorTableModel( new String[]{ "Data", "Realizada", "Texto" } );
|
||||
marcacoesTable = new BaseTable( marcacoesModel );
|
||||
marcacoesTable.setToolTipColumn( 2 );
|
||||
marcacoesTable.fixColumnWidth( 0, 150 );
|
||||
marcacoesTable.fixColumnWidth( 1, 80 );
|
||||
marcacoesTable.setNonResizableNorReordable();
|
||||
JScrollPane marcacoesScp = new JScrollPane( marcacoesTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
|
||||
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
||||
listaMarcacoesPanel.add( marcacoesScp );
|
||||
|
||||
marcacoesCardLayout = new CardLayout();
|
||||
marcacaoPanel = new MarcacaoEmpresaPanel( this );
|
||||
marcacoesPanel.setLayout( marcacoesCardLayout );
|
||||
marcacoesPanel.add( MarcacaoEmpresaPanel.LIST_PANEL, listaMarcacoesPanel );
|
||||
marcacoesPanel.add( MarcacaoEmpresaPanel.EDIT_PANEL, marcacaoPanel );
|
||||
|
||||
marcacoesTable.getSelectionModel().addListSelectionListener( new ListSelectionListener(){
|
||||
public void valueChanged( ListSelectionEvent e )
|
||||
{
|
||||
int selected = marcacoesTable.getSelectedRow();
|
||||
if( selected == -1 || e.getValueIsAdjusting() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
Object row = ( (VectorTableModel)marcacoesTable.getModel() ).getRowAt( selected );
|
||||
marcacoesTable.clearSelection();
|
||||
marcacaoPanel.setEmpresa( empresa );
|
||||
if( row != null && row instanceof MarcacaoEmpresaData )
|
||||
{
|
||||
marcacaoPanel.fill( row );
|
||||
}
|
||||
else
|
||||
{
|
||||
marcacaoPanel.fill( null );
|
||||
}
|
||||
marcacoesCardLayout.show( marcacoesPanel, MarcacaoEmpresaPanel.EDIT_PANEL );
|
||||
}
|
||||
} );
|
||||
|
||||
servicosCombo.addItem( new MappableObject( new Integer( 1 ), "SHST" ) );
|
||||
servicosCombo.addItem( new MappableObject( new Integer( 2 ), "Medicina do Trabalho" ) );
|
||||
servicosCombo.addItem( new MappableObject( new Integer( 3 ), "Higiene e Seguran\u00e7a" ) );
|
||||
servicosCombo.addItem( new MappableObject( new Integer( 4 ), "Forma\u00e7\u00e3o" ) );
|
||||
servicosCombo.addItem( new MappableObject( new Integer( 5 ), "Estudos Especificos HS" ) );
|
||||
servicosCombo.addItem( new MappableObject( new Integer( 6 ), "Sinal\u00e9tica" ) );
|
||||
|
||||
new CopyPasteHandler( designacaoSocialText );
|
||||
new CopyPasteHandler( moradaText );
|
||||
new CopyPasteHandler( codigoPostalText );
|
||||
new CopyPasteHandler( localText );
|
||||
new CopyPasteHandler( distritoText );
|
||||
new CopyPasteHandler( concelhoText );
|
||||
new CopyPasteHandler( codigo1Text );
|
||||
new CopyPasteHandler( codigo2Text );
|
||||
new CopyPasteHandler( codigo3Text );
|
||||
// new CopyPasteHandler( perfil1Text );
|
||||
// new CopyPasteHandler( perfil2Text );
|
||||
new CopyPasteHandler( precoHigieneText );
|
||||
new CopyPasteHandler( precoMedicinaText );
|
||||
new CopyPasteHandler( modalidadePagamentoText );
|
||||
new CopyPasteHandler( caeText );
|
||||
new CopyPasteHandler( actividadeText );
|
||||
new CopyPasteHandler( contribuinteText );
|
||||
new CopyPasteHandler( segSocialText );
|
||||
}
|
||||
|
||||
private void setupComponentsHashtable()
|
||||
{
|
||||
components = new ComponentsHashtable();
|
||||
components.putComponent( EmpresaData.DESIGNACAO_SOCIAL, designacaoSocialText );
|
||||
components.putComponent( EmpresaData.MORADA, moradaText );
|
||||
components.putComponent( EmpresaData.CODIGO_POSTAL, codigoPostalText );
|
||||
components.putComponent( EmpresaData.LOCALIDADE, localText );
|
||||
components.putComponent( EmpresaData.DISTRITO, distritoText );
|
||||
components.putComponent( EmpresaData.CONCELHO, concelhoText );
|
||||
components.putComponent( EmpresaData.DATA_PROPOSTA, envioPropostaPanel );
|
||||
components.putComponent( EmpresaData.DATA_ACEITACAO, aceitacaoPropostaPanel );
|
||||
components.putComponent( EmpresaData.INICIO_CONTRATO, inicioContratoPanel );
|
||||
components.putComponent( EmpresaData.DURACAO, duracaoContratoText );
|
||||
components.putComponent( EmpresaData.DATA_CANCELAMENTO, cancelamentoPanel );
|
||||
components.putDummy( EmpresaData.PERFIL_1 );
|
||||
components.putDummy( EmpresaData.PERFIL_2);
|
||||
components.putComponent( EmpresaData.DATA_ENVIO_CONTRATO, envioContratoPanel );
|
||||
components.putComponent( EmpresaData.DATA_RECEPCAO_CONTRATO, recepcaoContratoPanel );
|
||||
components.putComponent( EmpresaData.DATA_ENVIO_IDICT, envioIdictPanel );
|
||||
components.putComponent( EmpresaData.DATA_RELATORIO_ANUAL, relatorioAnualPanel );
|
||||
components.putComponent( EmpresaData.CODIGO_1, codigo1Text );
|
||||
components.putComponent( EmpresaData.CODIGO_2, codigo2Text );
|
||||
components.putComponent( EmpresaData.CODIGO_3, codigo3Text );
|
||||
components.putComponent( EmpresaData.CAE, caeText );
|
||||
components.putComponent( EmpresaData.ACTIVIDADE, actividadeText );
|
||||
components.putComponent( EmpresaData.CONTRIBUINTE, contribuinteText );
|
||||
components.putComponent( EmpresaData.SEGURANCA_SOCIAL, segSocialText );
|
||||
components.putComponent( EmpresaData.CONTACTO_1, contacto1Panel );
|
||||
components.putComponent( EmpresaData.CONTACTO_2, contacto2Panel );
|
||||
components.putComponent( EmpresaData.SERVICOS, servicosCombo );
|
||||
components.putComponent( EmpresaData.PRECO_HIGIENE, precoHigieneText );
|
||||
components.putComponent( EmpresaData.PRECO_MEDICINA, precoMedicinaText );
|
||||
components.putComponent( EmpresaData.PERIODICIDADE, modalidadePagamentoText );
|
||||
components.putDummy( EmpresaData.SERVICO_SAUDE_TIPO );
|
||||
components.putDummy( EmpresaData.SERVICO_SAUDE_DESIGNACAO );
|
||||
components.putDummy( EmpresaData.SERVICO_HIGIENE_TIPO );
|
||||
components.putDummy( EmpresaData.SERVICO_HIGIENE_DESIGNACAO );
|
||||
components.putDummy( EmpresaData.DESIGNACAO_SOCIAL_PLAIN );
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.clear( names, components );
|
||||
estabelecimentosModel.clearAll();
|
||||
protocoloPanel.clear();
|
||||
clearMarcacoes();
|
||||
empresa = null;
|
||||
}
|
||||
|
||||
public void fill(Object value)
|
||||
{
|
||||
clear();
|
||||
|
||||
if( value == null || ( ( Object[] )value )[ 0 ] == null )
|
||||
{
|
||||
// userPanel.setEmpresaID( null );
|
||||
return;
|
||||
}
|
||||
empresa = ( EmpresaData ) ( ( Object [] )value )[ 0 ];
|
||||
Integer elementosProtocolo[][] = ( Integer [][] ) ( ( Object [] )value )[ 1 ];
|
||||
|
||||
String names[] = ( String[] ) components.keySet().toArray( new String[ components.size() ] );
|
||||
ComponentController.fill( names, empresa.getHashData(), components );
|
||||
id = (Integer) empresa.get( EmpresaData.ID );
|
||||
IDObject estabelecimentos[];
|
||||
try
|
||||
{
|
||||
estabelecimentos = provider.getAllEstabelecimentosForEmpresa( id );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a carregar a lista de estabelecimentos", true );
|
||||
estabelecimentos = new IDObject[0];
|
||||
}
|
||||
reloadMarcacoes();
|
||||
Vector v = new Vector( Arrays.asList( estabelecimentos ) );
|
||||
estabelecimentosModel.setValues( v );
|
||||
|
||||
Vector dadosProtocolo[] = new Vector[]{ new Vector(), new Vector() };
|
||||
boolean analisesExamesA[] = new boolean[2];
|
||||
analisesExamesA[ 0 ] = "y".equals( empresa.get( EmpresaData.A_CONSULTAS ) );
|
||||
analisesExamesA[ 1 ] = "y".equals( empresa.get( EmpresaData.A_EXAMES ) );
|
||||
dadosProtocolo[ 0 ].add( analisesExamesA );
|
||||
dadosProtocolo[ 0 ].add( elementosProtocolo[ 0 ] );
|
||||
boolean analisesExamesB[] = new boolean[2];
|
||||
analisesExamesB[ 0 ] = "y".equals( empresa.get( EmpresaData.B_CONSULTAS ) );
|
||||
analisesExamesB[ 1 ] = "y".equals( empresa.get( EmpresaData.B_EXAMES ) );
|
||||
dadosProtocolo[ 1 ].add( analisesExamesB );
|
||||
dadosProtocolo[ 1 ].add( elementosProtocolo[ 1 ] );
|
||||
protocoloPanel.fill( dadosProtocolo );
|
||||
// if( webAware )
|
||||
// {
|
||||
// userPanel.setEmpresaID( (Integer) empresa.get( EmpresaData.ID ) );
|
||||
// userPanel.setEnabled( id != null );
|
||||
// }
|
||||
}
|
||||
|
||||
public Object save()
|
||||
{
|
||||
if( empresa == null )
|
||||
{
|
||||
empresa = new EmpresaData();
|
||||
}
|
||||
|
||||
String names[] = ( String[] ) components.keySet().toArray( new String[ components.size() ] );
|
||||
Hashtable hash = empresa.getHashData();
|
||||
ComponentController.save( names, hash, components );
|
||||
empresa.setHashData( hash );
|
||||
Vector dadosProtocolo[] = ( Vector[] ) protocoloPanel.save();
|
||||
boolean analisesExamesA[] = ( boolean [] ) dadosProtocolo[ 0 ].elementAt( 0 );
|
||||
empresa.set( EmpresaData.A_CONSULTAS, analisesExamesA[ 0 ] ? "y" : "n" );
|
||||
empresa.set( EmpresaData.A_EXAMES, analisesExamesA[ 1 ] ? "y" : "n" );
|
||||
boolean analisesExamesB[] = ( boolean [] ) dadosProtocolo[ 1 ].elementAt( 0 );
|
||||
empresa.set( EmpresaData.B_CONSULTAS, analisesExamesB[ 0 ] ? "y" : "n" );
|
||||
empresa.set( EmpresaData.B_EXAMES, analisesExamesB[ 1 ] ? "y" : "n" );
|
||||
Integer elementosProtocolo[][] =
|
||||
new Integer[][]{ ( Integer [] ) dadosProtocolo[ 0 ].elementAt( 1 ),
|
||||
( Integer [] ) dadosProtocolo[ 1 ].elementAt( 1 ) };
|
||||
return new Object[] { empresa, elementosProtocolo };
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enable )
|
||||
{
|
||||
super.setEnabled( enable );
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.setEnabled( names, enable, components );
|
||||
protocoloPanel.setEnabled( enable );
|
||||
//estabelecimentosTable.setEnabled( enable );
|
||||
}
|
||||
|
||||
public void addListSelectionListener( ListSelectionListener listener )
|
||||
{
|
||||
listSelectionListeners.add( listener );
|
||||
}
|
||||
|
||||
public void removeListSelectionListener( ListSelectionListener listener )
|
||||
{
|
||||
listSelectionListeners.remove( listener );
|
||||
}
|
||||
|
||||
public void valueChanged( ListSelectionEvent e )
|
||||
{
|
||||
for( int n = 0; n < listSelectionListeners.size(); n++ )
|
||||
{
|
||||
ListSelectionEvent newEvent =
|
||||
new ListSelectionEvent( this, e.getFirstIndex(), e.getLastIndex(), e.getValueIsAdjusting() );
|
||||
( (ListSelectionListener) listSelectionListeners.elementAt( n ) ).valueChanged( newEvent );
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getSelectedEstabelecimento()
|
||||
{
|
||||
int selected = estabelecimentosTable.getSelectedRow();
|
||||
if( selected == -1 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return ( (IDObject) estabelecimentosModel.getRowAt( selected ) ).getID();
|
||||
}
|
||||
|
||||
public void reload()
|
||||
{
|
||||
int selected = estabelecimentosTable.getSelectedRow();
|
||||
fill( empresa );
|
||||
if( selected != -1 )
|
||||
{
|
||||
estabelecimentosTable.setRowSelectionInterval( selected, selected );
|
||||
}
|
||||
}
|
||||
|
||||
public JTable getEstabelecimentosTable()
|
||||
{
|
||||
return estabelecimentosTable;
|
||||
}
|
||||
|
||||
public void setSelectedEstabelecimento( EstabelecimentoData estab )
|
||||
{
|
||||
IDObject lista[] = (IDObject [])estabelecimentosModel.getValues().toArray( new IDObject[ 0 ] );
|
||||
Integer id = (Integer)estab.get( EstabelecimentoData.ID );
|
||||
for( int n = 0; n < lista.length; n++ )
|
||||
{
|
||||
if( lista[ n ].getID().equals( id ) )
|
||||
{
|
||||
estabelecimentosTable.setRowSelectionInterval( n, n );
|
||||
return;
|
||||
}
|
||||
}
|
||||
estabelecimentosTable.clearSelection();
|
||||
}
|
||||
|
||||
protected void reloadMarcacoes()
|
||||
{
|
||||
try
|
||||
{
|
||||
Collection marcacoesCollection =
|
||||
JDO.listLoad( MarcacaoEmpresa.class, new Object[]{ empresa.get( EmpresaData.ID ) },
|
||||
new String []{ "empresa.id" }, new String[]{ "data descending" } );
|
||||
Vector marcacoes = new Vector();
|
||||
marcacoes.add( new ColumnizedObject(){
|
||||
public Object getValue( int col )
|
||||
{
|
||||
switch( col )
|
||||
{
|
||||
case 0: case 1:
|
||||
return "";
|
||||
case 2:
|
||||
return "NOVA TAREFA...";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
} );
|
||||
if( marcacoesCollection != null )
|
||||
{
|
||||
marcacoes.addAll( marcacoesCollection );
|
||||
}
|
||||
marcacoesTable.clearSelection();
|
||||
( (VectorTableModel) marcacoesTable.getModel() ).setValues( marcacoes );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a carregar as Marca\u00e7\u00f5es", true );
|
||||
}
|
||||
showMarcacoes();
|
||||
}
|
||||
|
||||
protected void showMarcacoes()
|
||||
{
|
||||
marcacoesCardLayout.show( marcacoesPanel, MarcacaoEmpresaPanel.LIST_PANEL );
|
||||
}
|
||||
|
||||
protected void clearMarcacoes()
|
||||
{
|
||||
( (VectorTableModel) marcacoesTable.getModel() ).clearAll();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,450 @@
|
||||
/*
|
||||
* EstabelecimentoPanel.java
|
||||
*
|
||||
* Created on 14 de Maio de 2004, 12:21
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.data.*;
|
||||
import com.evolute.utils.dataui.*;
|
||||
import com.evolute.utils.documents.*;
|
||||
import com.evolute.utils.jdo.*;
|
||||
import com.evolute.utils.tables.*;
|
||||
import com.evolute.utils.ui.*;
|
||||
import com.evolute.utils.ui.text.*;
|
||||
|
||||
import siprp.*;
|
||||
import siprp.data.*;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class EstabelecimentoPanel extends JPanel
|
||||
implements ControllableComponent, ListSelectionListener, ActionListener
|
||||
{
|
||||
public static int disables = 0;
|
||||
|
||||
private JDOProvider JDO;
|
||||
|
||||
private EstabelecimentoData estabelecimento;
|
||||
private ComponentsHashtable components;
|
||||
|
||||
private EmpresaData empresa;
|
||||
|
||||
private JTable estabelecimentosTable;
|
||||
private JPanel toolbarPanel;
|
||||
|
||||
private JTextField designacaoText;
|
||||
private JTextField moradaText;
|
||||
private JTextField localText;
|
||||
private JTextField codigoPostalText;
|
||||
private ContactoPanel contactoPanel;
|
||||
private JTextArea historicoText;
|
||||
private JButton marcacoesButton;
|
||||
|
||||
private JPanel historicoPanel;
|
||||
private JPanel listaHistoricoPanel;
|
||||
private BaseTable historicoTable;
|
||||
private HistoricoEstabelecimentoPanel edicaoHistoricoPanel;
|
||||
private CardLayout historicoCardLayout;
|
||||
|
||||
// private MarcacaoPanel marcacaoPanel;
|
||||
private SIPRPTracker tracker;
|
||||
|
||||
private boolean lastEnable = false;
|
||||
|
||||
/** Creates a new instance of EstabelecimentoPanel */
|
||||
public EstabelecimentoPanel( JPanel toolbarPanel, JTextField designacaoText, JTable estabelecimentosTable )
|
||||
{
|
||||
this.toolbarPanel = toolbarPanel;
|
||||
this.designacaoText = designacaoText;
|
||||
this.estabelecimentosTable = estabelecimentosTable;
|
||||
JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
|
||||
setupComponents();
|
||||
setupComponentsHashtable();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
JPanel dadosEstabelecimentoPanel = new JPanel();
|
||||
JLabel designacaoLabel = new JLabel( "Designa\u00e7\u00e3o" );
|
||||
//designacaoText = new JTextField();
|
||||
JLabel moradaLabel = new JLabel( "Morada" );
|
||||
moradaText = new JTextField();
|
||||
JLabel codigoPostalLabel = new JLabel( "C\u00f3digo Postal" );
|
||||
codigoPostalText = new JTextField();
|
||||
codigoPostalText.setDocument( new MaximumLengthDocument( 8 ) );
|
||||
JLabel localLabel = new JLabel( "Local" );
|
||||
localText = new JTextField();
|
||||
contactoPanel = new ContactoPanel();
|
||||
contactoPanel.setBorder( BorderFactory.createTitledBorder(
|
||||
BorderFactory.createEtchedBorder(),
|
||||
"Contacto" ) );
|
||||
marcacoesButton = new JButton( "Marca\u00e7\u00f5es" );
|
||||
marcacoesButton.addActionListener( this );
|
||||
JPanel pad;
|
||||
historicoText = new JTextArea();
|
||||
new CopyPasteHandler( historicoText );
|
||||
historicoText.setLineWrap( true );
|
||||
historicoText.setWrapStyleWord( true );
|
||||
JScrollPane observacoesScp = new JScrollPane( historicoText, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
|
||||
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
||||
observacoesScp.setBorder( BorderFactory.createTitledBorder(
|
||||
BorderFactory.createEtchedBorder(), "Observa\u00e7\u00f5es" ) );
|
||||
historicoPanel = new JPanel();
|
||||
historicoPanel.setBorder( BorderFactory.createTitledBorder(
|
||||
BorderFactory.createEtchedBorder(), "Hist\u00f3rico" ) );
|
||||
// marcacaoPanel = new MarcacaoPanel( true, "Realizada", "Relat\u00f3rio", Marcacao.TIPO_MARCACAO_ESTABELECIMENTO );
|
||||
// marcacaoPanel.setCalendarDialogOrientation( JCalendarDialog.ABOVE, JCalendarDialog.LEFT );
|
||||
// marcacaoPanel.setBorder( BorderFactory.createTitledBorder(
|
||||
// BorderFactory.createEtchedBorder(),
|
||||
// "Visita" ) );
|
||||
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
dadosEstabelecimentoPanel.setLayout( gridbag );
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 1, 1, 1, 1 );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.gridheight = 1;
|
||||
constraints.weighty = 0;
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( toolbarPanel, constraints );
|
||||
dadosEstabelecimentoPanel.add( toolbarPanel );
|
||||
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weighty = 1;
|
||||
pad = new JPanel();
|
||||
gridbag.setConstraints( pad, constraints );
|
||||
dadosEstabelecimentoPanel.add( pad );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weighty = 0;
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( moradaLabel, constraints );
|
||||
dadosEstabelecimentoPanel.add( moradaLabel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( moradaText, constraints );
|
||||
dadosEstabelecimentoPanel.add( moradaText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( codigoPostalLabel, constraints );
|
||||
dadosEstabelecimentoPanel.add( codigoPostalLabel );
|
||||
|
||||
constraints.weightx = 0.3;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( codigoPostalText, constraints );
|
||||
dadosEstabelecimentoPanel.add( codigoPostalText );
|
||||
|
||||
constraints.weightx = 0.7;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
pad = new JPanel();
|
||||
gridbag.setConstraints( pad, constraints );
|
||||
dadosEstabelecimentoPanel.add( pad );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( localLabel, constraints );
|
||||
dadosEstabelecimentoPanel.add( localLabel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( localText, constraints );
|
||||
dadosEstabelecimentoPanel.add( localText );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( marcacoesButton, constraints );
|
||||
dadosEstabelecimentoPanel.add( marcacoesButton );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( contactoPanel, constraints );
|
||||
|
||||
gridbag = new GridBagLayout();
|
||||
setLayout( gridbag );
|
||||
constraints.fill = GridBagConstraints.BOTH;
|
||||
constraints.weighty = 0;
|
||||
constraints.gridheight = 1;
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( dadosEstabelecimentoPanel, constraints );
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( contactoPanel, constraints );
|
||||
constraints.weightx = 0.5;
|
||||
constraints.weighty = 1;
|
||||
constraints.gridwidth = 1;
|
||||
constraints.gridheight = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( historicoPanel, constraints );
|
||||
constraints.weightx = 0.5;
|
||||
constraints.weighty = 1;
|
||||
constraints.gridheight = GridBagConstraints.REMAINDER;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( observacoesScp, constraints );
|
||||
add( dadosEstabelecimentoPanel );
|
||||
add( contactoPanel );
|
||||
add( historicoPanel );
|
||||
add( observacoesScp );
|
||||
|
||||
listaHistoricoPanel = new JPanel();
|
||||
listaHistoricoPanel.setLayout( new GridLayout( 1, 1 ) );
|
||||
VectorTableModel marcacoesModel = new VectorTableModel( new String[]{ "Data", "Texto" } );
|
||||
historicoTable = new BaseTable( marcacoesModel );
|
||||
historicoTable.setToolTipColumn( 1 );
|
||||
historicoTable.fixColumnWidth( 0, 150 );
|
||||
historicoTable.setNonResizableNorReordable();
|
||||
JScrollPane listaHistoricoScp = new JScrollPane( historicoTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
|
||||
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
||||
listaHistoricoPanel.add( listaHistoricoScp );
|
||||
|
||||
historicoCardLayout = new CardLayout();
|
||||
edicaoHistoricoPanel = new HistoricoEstabelecimentoPanel( this );
|
||||
historicoPanel.setLayout( historicoCardLayout );
|
||||
historicoPanel.add( HistoricoEstabelecimentoPanel.LIST_PANEL, listaHistoricoPanel );
|
||||
historicoPanel.add( HistoricoEstabelecimentoPanel.EDIT_PANEL, edicaoHistoricoPanel );
|
||||
|
||||
historicoTable.getSelectionModel().addListSelectionListener( new ListSelectionListener(){
|
||||
public void valueChanged( ListSelectionEvent e )
|
||||
{
|
||||
int selected = historicoTable.getSelectedRow();
|
||||
if( selected == -1 || e.getValueIsAdjusting() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
Object row = ( (VectorTableModel)historicoTable.getModel() ).getRowAt( selected );
|
||||
historicoTable.clearSelection();
|
||||
edicaoHistoricoPanel.setEstabelecimento( estabelecimento );
|
||||
if( row != null && row instanceof HistoricoEstabelecimentoData )
|
||||
{
|
||||
edicaoHistoricoPanel.fill( row );
|
||||
}
|
||||
else
|
||||
{
|
||||
edicaoHistoricoPanel.fill( null );
|
||||
}
|
||||
historicoCardLayout.show( historicoPanel, HistoricoEstabelecimentoPanel.EDIT_PANEL );
|
||||
}
|
||||
} );
|
||||
|
||||
new CopyPasteHandler( designacaoText );
|
||||
new CopyPasteHandler( moradaText );
|
||||
new CopyPasteHandler( localText );
|
||||
new CopyPasteHandler( codigoPostalText );
|
||||
}
|
||||
|
||||
private void setupComponentsHashtable()
|
||||
{
|
||||
components = new ComponentsHashtable();
|
||||
components.putComponent( EstabelecimentoData.NOME, designacaoText );
|
||||
components.putComponent( EstabelecimentoData.MORADA, moradaText );
|
||||
components.putComponent( EstabelecimentoData.LOCALIDADE, localText );
|
||||
components.putComponent( EstabelecimentoData.CODIGO_POSTAL, codigoPostalText );
|
||||
components.putComponent( EstabelecimentoData.CONTACTO, contactoPanel );
|
||||
// components.putComponent( EstabelecimentoData.HISTORICO, historicoText );
|
||||
components.putComponent( EstabelecimentoData.HISTORICO, historicoText );
|
||||
components.putDummy( EstabelecimentoData.EMPRESA );
|
||||
components.putDummy( EstabelecimentoData.NOME_PLAIN );
|
||||
// components.putDummy( EstabelecimentoData.INACTIVO );
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.clear( names, components );
|
||||
clearHistorico();
|
||||
estabelecimento = null;
|
||||
}
|
||||
|
||||
public void fill(Object value)
|
||||
{
|
||||
clear();
|
||||
estabelecimento = ( EstabelecimentoData ) value;
|
||||
// marcacaoPanel.setEnabled( estabelecimento != null );
|
||||
// marcacaoPanel.fill( estabelecimento );
|
||||
if( estabelecimento == null )
|
||||
{
|
||||
estabelecimentosTable.clearSelection();
|
||||
return;
|
||||
}
|
||||
String names[] = estabelecimento.getFieldNames();
|
||||
ComponentController.fill( names, estabelecimento.getHashData(), components );
|
||||
reloadHistorico();
|
||||
}
|
||||
|
||||
public Object save()
|
||||
{
|
||||
if( estabelecimento == null )
|
||||
{
|
||||
estabelecimento = new EstabelecimentoData();
|
||||
}
|
||||
|
||||
String names[] = estabelecimento.getFieldNames();
|
||||
Hashtable hash = new Hashtable();
|
||||
ComponentController.save( names, hash, components );
|
||||
estabelecimento.setHashData( hash );
|
||||
estabelecimento.set( EstabelecimentoData.EMPRESA, empresa );
|
||||
return estabelecimento;
|
||||
}
|
||||
|
||||
public void postSave()
|
||||
{
|
||||
int selected = estabelecimentosTable.getSelectedRow();
|
||||
if( estabelecimento != null )
|
||||
{
|
||||
IDObject obj = new MappableObject( (Integer) estabelecimento.get( EstabelecimentoData.ID ), estabelecimento.get( EstabelecimentoData.NOME ) );
|
||||
VectorTableModel model = (VectorTableModel)estabelecimentosTable.getModel();
|
||||
if( selected == -1 )
|
||||
{
|
||||
model.insertRowAt( obj, estabelecimentosTable.getRowCount() );
|
||||
estabelecimentosTable.setRowSelectionInterval( estabelecimentosTable.getRowCount() - 1, estabelecimentosTable.getRowCount() - 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
model.removeRowAt( selected );
|
||||
model.insertRowAt( obj, selected );
|
||||
estabelecimentosTable.setRowSelectionInterval( selected, selected );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enable )
|
||||
{
|
||||
super.setEnabled( enable );
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.setEnabled( names, enable, components );
|
||||
if( enable != lastEnable )
|
||||
{
|
||||
if( enable )
|
||||
{
|
||||
disables++;
|
||||
}
|
||||
else
|
||||
{
|
||||
disables--;
|
||||
}
|
||||
lastEnable = enable;
|
||||
}
|
||||
estabelecimentosTable.setEnabled( disables == 0 );
|
||||
// if( estabelecimento == null )
|
||||
// {
|
||||
// marcacaoPanel.setEnabled( false );
|
||||
// }
|
||||
}
|
||||
|
||||
public void valueChanged( ListSelectionEvent e )
|
||||
{
|
||||
Object source = e.getSource();
|
||||
if( source instanceof EmpresaPanel )
|
||||
{
|
||||
Integer id = ( ( EmpresaPanel ) source ).getSelectedEstabelecimento();
|
||||
if( id != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
EstabelecimentoData estab = ( EstabelecimentoData ) JDO.load( EstabelecimentoData.class, id );
|
||||
fill( estab );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a carregar o estabelecimento", true );
|
||||
clear();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void reload()
|
||||
{
|
||||
fill( estabelecimento );
|
||||
}
|
||||
|
||||
public void setEmpresa( EmpresaData empresa )
|
||||
{
|
||||
this.empresa = empresa;
|
||||
}
|
||||
|
||||
protected void reloadHistorico()
|
||||
{
|
||||
try
|
||||
{
|
||||
Collection historicoCollection =
|
||||
JDO.listLoad( HistoricoEstabelecimento.class, new Object[]{ estabelecimento.get( EstabelecimentoData.ID ) },
|
||||
new String []{ "estabelecimento.id" }, new String[]{ "data descending" } );
|
||||
Vector historico = new Vector();
|
||||
historico.add( new ColumnizedObject(){
|
||||
public Object getValue( int col )
|
||||
{
|
||||
switch( col )
|
||||
{
|
||||
case 0:
|
||||
return "";
|
||||
case 1:
|
||||
return "NOVO EVENTO...";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
} );
|
||||
if( historicoCollection != null )
|
||||
{
|
||||
historico.addAll( historicoCollection );
|
||||
}
|
||||
historicoTable.clearSelection();
|
||||
( (VectorTableModel) historicoTable.getModel() ).setValues( historico );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a carregar as Marca\u00e7\u00f5es", true );
|
||||
}
|
||||
showHistorico();
|
||||
}
|
||||
|
||||
protected void showHistorico()
|
||||
{
|
||||
historicoCardLayout.show( historicoPanel, HistoricoEstabelecimentoPanel.LIST_PANEL );
|
||||
}
|
||||
|
||||
protected void clearHistorico()
|
||||
{
|
||||
( (VectorTableModel) historicoTable.getModel() ).clearAll();
|
||||
}
|
||||
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
Object source = e.getSource();
|
||||
if( source.equals( marcacoesButton ) )
|
||||
{
|
||||
if( empresa == null || estabelecimento == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
tracker.getHigieneWindow().setVisible( true );
|
||||
tracker.getHigieneWindow().setEmpresaAndEstabelecimento( (Integer) empresa.get( EmpresaData.ID ),
|
||||
( Integer ) estabelecimento.get( EstabelecimentoData.ID ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setTracker( SIPRPTracker tracker )
|
||||
{
|
||||
this.tracker = tracker;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* EtiquetaChooserPanel.java
|
||||
*
|
||||
* Created on 27 de Fevereiro de 2006, 11:21
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.ui.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Frederico
|
||||
*/
|
||||
public class EtiquetaChooserDialog extends CustomJDialog
|
||||
implements ActionListener
|
||||
{
|
||||
private int rows;
|
||||
private int cols;
|
||||
private final Hashtable<JButton,int[]> positionHash = new Hashtable<JButton,int[]>();
|
||||
|
||||
private int choice[];
|
||||
|
||||
/** Creates a new instance of EtiquetaChooserPanel */
|
||||
public EtiquetaChooserDialog( JFrame owner, int rows, int cols )
|
||||
{
|
||||
super( owner, true );
|
||||
this.rows = rows;
|
||||
this.cols = cols;
|
||||
setupComponents();
|
||||
if( owner != null )
|
||||
{
|
||||
centerSuper();
|
||||
}
|
||||
else
|
||||
{
|
||||
center();
|
||||
}
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
setTitle( "Escolha a posi\u00e7\u00e3o" );
|
||||
setSize( cols * 200, rows * 50 );
|
||||
setLayout( new GridLayout( rows, cols ) );
|
||||
for( int r = 0; r < rows; r++ )
|
||||
{
|
||||
for( int c = 0; c < cols; c++ )
|
||||
{
|
||||
JButton button = new JButton( "( " + ( r + 1 ) + " , " + ( c + 1 ) + " )" );
|
||||
add( button );
|
||||
positionHash.put( button, new int[]{ r, c } );
|
||||
button.addActionListener( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void close()
|
||||
{
|
||||
SwingUtilities.invokeLater( new Runnable(){
|
||||
public void run()
|
||||
{
|
||||
setVisible( false );
|
||||
dispose();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
public int[] choose()
|
||||
{
|
||||
setVisible( true );
|
||||
return choice;
|
||||
}
|
||||
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
Object source = e.getSource();
|
||||
choice = positionHash.get( ( JButton ) source );
|
||||
close();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,200 @@
|
||||
/*
|
||||
* EtiquetaPrinter.java
|
||||
*
|
||||
* Created on 27 de Fevereiro de 2006, 14:41
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import java.io.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.fop.*;
|
||||
import com.evolute.utils.ui.*;
|
||||
import com.evolute.utils.xml.*;
|
||||
|
||||
import siprp.data.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Frederico
|
||||
*/
|
||||
public class EtiquetaPrinter
|
||||
{
|
||||
protected static final DecimalFormat N_F = new DecimalFormat();
|
||||
|
||||
static
|
||||
{
|
||||
DecimalFormatSymbols dfs = new DecimalFormatSymbols( new Locale( "pt", "PT" ) );
|
||||
dfs.setDecimalSeparator( '.' );
|
||||
N_F.setDecimalFormatSymbols( dfs );
|
||||
N_F.setMaximumFractionDigits( 4 );
|
||||
N_F.setMinimumFractionDigits( 0 );
|
||||
}
|
||||
|
||||
protected Double altura;
|
||||
protected Double largura;
|
||||
protected Double margemEsquerda;
|
||||
protected Double margemCima;
|
||||
protected Integer colunas;
|
||||
protected Integer linhas;
|
||||
protected boolean continua;
|
||||
protected Double alturaFolha;
|
||||
protected Double larguraFolha;
|
||||
protected Double margemVerticalFolha;
|
||||
protected Double margemHorizontalFolha;
|
||||
|
||||
/** Creates a new instance of EtiquetaPrinter */
|
||||
public EtiquetaPrinter( EtiquetaData etiqueta )
|
||||
{
|
||||
altura = ( Double ) etiqueta.get( EtiquetaData.ALTURA );
|
||||
largura = ( Double ) etiqueta.get( EtiquetaData.LARGURA );
|
||||
margemEsquerda = ( Double ) etiqueta.get( EtiquetaData.MARGEM_ESQUERDA );
|
||||
margemCima = ( Double ) etiqueta.get( EtiquetaData.MARGEM_CIMA );
|
||||
colunas = ( Integer ) etiqueta.get( EtiquetaData.COLUNAS );
|
||||
linhas = ( Integer ) etiqueta.get( EtiquetaData.LINHAS );
|
||||
continua = "y".equals( etiqueta.get( EtiquetaData.CONTINUA ) );
|
||||
alturaFolha = ( Double ) etiqueta.get( EtiquetaData.ALTURA_FOLHA );
|
||||
larguraFolha = ( Double ) etiqueta.get( EtiquetaData.LARGURA_FOLHA );
|
||||
margemVerticalFolha = ( Double ) etiqueta.get( EtiquetaData.MARGEM_VERTICAL_FOLHA );
|
||||
margemHorizontalFolha = ( Double ) etiqueta.get( EtiquetaData.MARGEM_HORIZONTAL_FOLHA );
|
||||
}
|
||||
|
||||
public void print( Vector<Object[]> data )
|
||||
{
|
||||
int pos[] = new EtiquetaChooserDialog( null, linhas.intValue(), colunas.intValue() ).choose();
|
||||
if( pos == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
int row = pos[ 0 ];
|
||||
int col = pos[ 1 ];
|
||||
String header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
|
||||
SimpleXMLElement styleSheet =
|
||||
new SimpleXMLElement( "xsl:stylesheet" );
|
||||
styleSheet.addAttribute( "version", "1.1" );
|
||||
styleSheet.addAttribute( "xmlns:xsl", "http://www.w3.org/1999/XSL/Transform" );
|
||||
styleSheet.addAttribute( "xmlns:fo", "http://www.w3.org/1999/XSL/Format" );
|
||||
styleSheet.addAttribute( "exclude-result-prefixes", "fo" );
|
||||
styleSheet.setCompact( false );
|
||||
|
||||
SimpleXMLElement output =
|
||||
new SimpleXMLElement( "xsl:output" );
|
||||
styleSheet.addElement( output );
|
||||
output.addAttribute( "method", "xml" );
|
||||
output.addAttribute( "version", "1.0" );
|
||||
output.addAttribute( "omit-xml-declaration", "no" );
|
||||
output.addAttribute( "indent", "yes" );
|
||||
|
||||
SimpleXMLElement template =
|
||||
new SimpleXMLElement( "xsl:template" );
|
||||
styleSheet.addElement( template );
|
||||
template.addAttribute( "match", "ETIQUETA" );
|
||||
|
||||
SimpleXMLElement root =
|
||||
new SimpleXMLElement( "fo:root" );
|
||||
template.addElement( root );
|
||||
|
||||
SimpleXMLElement layoutMasterSet =
|
||||
new SimpleXMLElement( "fo:layout-master-set" );
|
||||
root.addElement( layoutMasterSet );
|
||||
|
||||
SimpleXMLElement simplePageMaster =
|
||||
new SimpleXMLElement( "fo:simple-page-master" );
|
||||
layoutMasterSet.addElement( simplePageMaster );
|
||||
simplePageMaster.addAttribute( "master-name", "simpleA4" );
|
||||
simplePageMaster.addAttribute( "page-height", N_F.format( alturaFolha ) + "cm" );
|
||||
simplePageMaster.addAttribute( "page-width", N_F.format( larguraFolha ) + "cm" );
|
||||
simplePageMaster.addAttribute( "margin-top", N_F.format( ( row == 0 ? margemVerticalFolha : 0.0 ) + row * ( altura + margemCima ) ) + "cm" );
|
||||
simplePageMaster.addAttribute( "margin-bottom", "0.5cm" );
|
||||
simplePageMaster.addAttribute( "margin-left", N_F.format( ( col == 0 ? margemHorizontalFolha : 0.0 ) + col * ( largura + margemEsquerda ) ) + "cm" );
|
||||
simplePageMaster.addAttribute( "margin-right", N_F.format( col == colunas - 1 ? margemHorizontalFolha : 0.0 ) );
|
||||
|
||||
SimpleXMLElement regionBody =
|
||||
new SimpleXMLElement( "fo:region-body" );
|
||||
simplePageMaster.addElement( regionBody );
|
||||
|
||||
SimpleXMLElement pageSequence =
|
||||
new SimpleXMLElement( "fo:page-sequence" );
|
||||
root.addElement( pageSequence );
|
||||
pageSequence.addAttribute( "master-reference", "simpleA4" );
|
||||
|
||||
SimpleXMLElement flow =
|
||||
new SimpleXMLElement( "fo:flow" );
|
||||
pageSequence.addElement( flow );
|
||||
flow.addAttribute( "flow-name", "xsl-region-body" );
|
||||
|
||||
for( Object line[] : data )
|
||||
{
|
||||
SimpleXMLElement lineXML = createLine( line, largura - ( col == 0 || col == colunas - 1 ? margemHorizontalFolha : 0.0 ) );
|
||||
flow.addElement( lineXML );
|
||||
}
|
||||
//System.out.println( "XSL: " + styleSheet.toString() );
|
||||
String xml = "<ETIQUETA></ETIQUETA>";
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
FOPCreator creator = FOPCreator.getFOPCreator();
|
||||
InputStream xmlIn = new ByteArrayInputStream( xml.getBytes() );
|
||||
try
|
||||
{
|
||||
creator.createFOfromXML( xmlIn, new ByteArrayInputStream( (header+styleSheet).getBytes() ), out );
|
||||
ByteArrayInputStream in = new ByteArrayInputStream( out.toString().getBytes() );
|
||||
Hashtable printOptions = new Hashtable();
|
||||
//System.out.println( "OUT: " + out.toString() );
|
||||
FOPPrinter printer = FOPPrinter.getFOPPrinter();
|
||||
printer.printFO( in, false, true, printOptions );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a imprimir", true );
|
||||
}
|
||||
}
|
||||
|
||||
protected SimpleXMLElement createLine( Object[] line, Double larguraDisponival )
|
||||
{
|
||||
SimpleXMLElement table =
|
||||
new SimpleXMLElement( "fo:table" );
|
||||
table.addAttribute( "table-layout", "fixed" );
|
||||
table.addAttribute( "width", N_F.format( larguraDisponival ) + "cm" );
|
||||
table.addAttribute( "space-before.optimum", "0pt" );
|
||||
table.addAttribute( "space-after.optimum", "0pt" );
|
||||
|
||||
for( int n = 1; n < line.length; n += 2 )
|
||||
{
|
||||
SimpleXMLElement tableColumn =
|
||||
new SimpleXMLElement( "fo:table-column" );
|
||||
table.addElement( tableColumn );
|
||||
tableColumn.addAttribute( "column-width", N_F.format( ( ( Double ) line[ n ] ) * larguraDisponival ) + "cm" );
|
||||
}
|
||||
|
||||
SimpleXMLElement tableBody =
|
||||
new SimpleXMLElement( "fo:table-body" );
|
||||
table.addElement( tableBody );
|
||||
|
||||
SimpleXMLElement tableRow =
|
||||
new SimpleXMLElement( "fo:table-row" );
|
||||
tableBody.addElement( tableRow );
|
||||
|
||||
for( int n = 0; n < line.length; n += 2 )
|
||||
{
|
||||
SimpleXMLElement tableCell =
|
||||
new SimpleXMLElement( "fo:table-cell" );
|
||||
tableRow.addElement( tableCell );
|
||||
|
||||
SimpleXMLElement block =
|
||||
new SimpleXMLElement( "fo:block" );
|
||||
tableCell.addElement( block );
|
||||
block.addAttribute( "font-size", "10pt" );
|
||||
block.addAttribute( "text-align", "left" );
|
||||
// block.addAttribute( "wrap-option", "no-wrap" );
|
||||
// block.addAttribute( "overflow", "scroll" );
|
||||
|
||||
block.addTextElement( ( String ) line[ n ] );
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,276 @@
|
||||
/*
|
||||
* HistoricoEstabelecimentoPanel.java
|
||||
*
|
||||
* Created on 7 de Dezembro de 2004, 15:17
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.dataui.*;
|
||||
import com.evolute.utils.ui.*;
|
||||
import com.evolute.utils.ui.calendar.*;
|
||||
import com.evolute.utils.ui.text.*;
|
||||
|
||||
import siprp.data.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class HistoricoEstabelecimentoPanel extends JPanel
|
||||
implements ControllableComponent, DocumentListener, ChangeListener, ActionListener
|
||||
{
|
||||
protected static final String LIST_PANEL = "LIST_PANEL";
|
||||
protected static final String FULL_LIST_PANEL = "FULL_LIST_PANEL";
|
||||
protected static final String EDIT_PANEL = "EDIT_PANEL";
|
||||
|
||||
private ComponentsHashtable components;
|
||||
private EstabelecimentoPanel owner;
|
||||
|
||||
private JCalendarPanel calendarPanel;
|
||||
private JTextArea text;
|
||||
private JButton saveButton;
|
||||
private JButton cancelButton;
|
||||
|
||||
private EstabelecimentoData estabelecimento;
|
||||
private boolean changed = false;
|
||||
private boolean filling = false;
|
||||
|
||||
private HistoricoEstabelecimentoData historico;
|
||||
|
||||
public HistoricoEstabelecimentoPanel( EstabelecimentoPanel owner )
|
||||
{
|
||||
this.owner = owner;
|
||||
setupComponents();
|
||||
setupComponentsHashtable();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
calendarPanel = new JCalendarPanel( null );
|
||||
// calendarPanel.addDocumentListener( this );
|
||||
text = new JTextArea();
|
||||
new CopyPasteHandler( text );
|
||||
// text.getDocument().addDocumentListener( this );
|
||||
text.setLineWrap( true );
|
||||
text.setWrapStyleWord( true );
|
||||
JScrollPane textScp = new JScrollPane( text, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
|
||||
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
||||
saveButton = new JButton( "Guardar" );
|
||||
saveButton.addActionListener( this );
|
||||
cancelButton = new JButton( "Voltar" );
|
||||
cancelButton.addActionListener( this );
|
||||
|
||||
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
setLayout( gridbag );
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 1, 1, 1, 1 );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
constraints.weighty = 0;
|
||||
constraints.gridheight = 1;
|
||||
calendarPanel.setPreferredSize( new Dimension( 130, 30 ) );
|
||||
gridbag.setConstraints( calendarPanel, constraints );
|
||||
add( calendarPanel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
JPanel buttonPanel = new JPanel();
|
||||
gridbag.setConstraints( buttonPanel, constraints );
|
||||
add( buttonPanel );
|
||||
|
||||
constraints.fill = GridBagConstraints.BOTH;
|
||||
constraints.weighty = 1;
|
||||
constraints.gridheight = GridBagConstraints.REMAINDER;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
constraints.weightx = 1;
|
||||
gridbag.setConstraints( textScp, constraints );
|
||||
add( textScp );
|
||||
|
||||
buttonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) );
|
||||
initButtons();
|
||||
buttonPanel.add( cancelButton );
|
||||
buttonPanel.add( saveButton );
|
||||
}
|
||||
|
||||
private void setupComponentsHashtable()
|
||||
{
|
||||
components = new ComponentsHashtable();
|
||||
components.putComponent( HistoricoEstabelecimentoData.DATA, calendarPanel );
|
||||
components.putComponent( HistoricoEstabelecimentoData.TEXTO, text );
|
||||
components.putDummy( HistoricoEstabelecimentoData.ESTABELECIMENTO );
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.clear( names, components );
|
||||
historico = null;
|
||||
}
|
||||
|
||||
public void fill(Object value)
|
||||
{
|
||||
filling = true;
|
||||
clear();
|
||||
initButtons();
|
||||
historico = (HistoricoEstabelecimentoData)value;
|
||||
if( historico == null )
|
||||
{
|
||||
filling = false;
|
||||
return;
|
||||
}
|
||||
String names[] = historico.getFieldNames();
|
||||
ComponentController.fill( names, historico.getHashData(), components );
|
||||
filling = false;
|
||||
}
|
||||
|
||||
public Object save()
|
||||
{
|
||||
if( historico == null )
|
||||
{
|
||||
historico = new HistoricoEstabelecimentoData();
|
||||
}
|
||||
|
||||
String names[] = historico.getFieldNames();
|
||||
Hashtable hash = new Hashtable();
|
||||
|
||||
ComponentController.save( names, hash, components );
|
||||
hash.put( HistoricoEstabelecimentoData.ESTABELECIMENTO, estabelecimento );
|
||||
historico.setHashData( hash );
|
||||
return historico;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enable)
|
||||
{
|
||||
super.setEnabled( enable );
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.setEnabled( names, enable, components );
|
||||
}
|
||||
|
||||
public void changedUpdate(javax.swing.event.DocumentEvent documentEvent)
|
||||
{
|
||||
startEditedState();
|
||||
}
|
||||
|
||||
public void insertUpdate(javax.swing.event.DocumentEvent documentEvent)
|
||||
{
|
||||
startEditedState();
|
||||
}
|
||||
|
||||
public void removeUpdate(javax.swing.event.DocumentEvent documentEvent)
|
||||
{
|
||||
startEditedState();
|
||||
}
|
||||
|
||||
private void startEditedState()
|
||||
{
|
||||
if( !filling )
|
||||
{
|
||||
calendarPanel.removeChangeListener( this );
|
||||
text.getDocument().removeDocumentListener( this );
|
||||
changed = true;
|
||||
saveButton.setEnabled( true );
|
||||
changeButton();
|
||||
}
|
||||
}
|
||||
|
||||
private void initButtons()
|
||||
{
|
||||
saveButton.setEnabled( false );
|
||||
calendarPanel.addChangeListener( this );
|
||||
text.getDocument().addDocumentListener( this );
|
||||
ClassLoader cl = new EVUtilsImageLib().getClass().getClassLoader();
|
||||
Icon normal = new ImageIcon( cl.getResource( "buttons/save_normal.gif" ) );
|
||||
Icon rollover = new ImageIcon( cl.getResource( "buttons/save_rollover.gif" ) );
|
||||
Icon pressed = new ImageIcon( cl.getResource( "buttons/save_pressed.gif" ) );
|
||||
Icon disabled = new ImageIcon( cl.getResource( "buttons/save_disabled.gif" ) );
|
||||
saveButton.setIcon( normal );
|
||||
saveButton.setRolloverIcon( rollover );
|
||||
saveButton.setPressedIcon( pressed );
|
||||
saveButton.setDisabledIcon( disabled );
|
||||
saveButton.setText( null );
|
||||
saveButton.setBorderPainted( false );
|
||||
saveButton.setRequestFocusEnabled( false );
|
||||
saveButton.setMargin( new Insets( 0, 0, 0, 0 ) );
|
||||
saveButton.setToolTipText( "Gravar" );
|
||||
|
||||
normal = new ImageIcon( cl.getResource( "buttons/shiftl_normal.gif" ) );
|
||||
rollover = new ImageIcon( cl.getResource( "buttons/shiftl_rollover.gif" ) );
|
||||
pressed = new ImageIcon( cl.getResource( "buttons/shiftl_pressed.gif" ) );
|
||||
disabled = new ImageIcon( cl.getResource( "buttons/shiftl_disabled.gif" ) );
|
||||
cancelButton.setIcon( normal );
|
||||
cancelButton.setRolloverIcon( rollover );
|
||||
cancelButton.setPressedIcon( pressed );
|
||||
cancelButton.setDisabledIcon( disabled );
|
||||
cancelButton.setText( null );
|
||||
cancelButton.setBorderPainted( false );
|
||||
cancelButton.setRequestFocusEnabled( false );
|
||||
cancelButton.setMargin( new Insets( 0, 0, 0, 0 ) );
|
||||
cancelButton.setToolTipText( "Voltar \u00e0 lista" );
|
||||
|
||||
}
|
||||
|
||||
private void changeButton()
|
||||
{
|
||||
ClassLoader cl = new EVUtilsImageLib().getClass().getClassLoader();
|
||||
Icon normal = new ImageIcon( cl.getResource( "buttons/cancel_normal.gif" ) );
|
||||
Icon rollover = new ImageIcon( cl.getResource( "buttons/cancel_rollover.gif" ) );
|
||||
Icon pressed = new ImageIcon( cl.getResource( "buttons/cancel_pressed.gif" ) );
|
||||
Icon disabled = new ImageIcon( cl.getResource( "buttons/cancel_disabled.gif" ) );
|
||||
cancelButton.setIcon( normal );
|
||||
cancelButton.setRolloverIcon( rollover );
|
||||
cancelButton.setPressedIcon( pressed );
|
||||
cancelButton.setDisabledIcon( disabled );
|
||||
cancelButton.setToolTipText( "Cancelar" );
|
||||
}
|
||||
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
Object source = e.getSource();
|
||||
if( source.equals( saveButton ) )
|
||||
{
|
||||
if( calendarPanel.getDate() == null )
|
||||
{
|
||||
JOptionPane.showMessageDialog( this, "Tem de escolher uma data", "Erro...", JOptionPane.ERROR_MESSAGE );
|
||||
return;
|
||||
}
|
||||
HistoricoEstabelecimentoData hist = ( HistoricoEstabelecimentoData ) save();
|
||||
|
||||
try
|
||||
{
|
||||
hist.save();
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a gravar", true );
|
||||
return;
|
||||
}
|
||||
owner.reloadHistorico();
|
||||
}
|
||||
else if( source.equals( cancelButton ) )
|
||||
{
|
||||
owner.showHistorico();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setEstabelecimento( EstabelecimentoData estabelecimento )
|
||||
{
|
||||
this.estabelecimento = estabelecimento;
|
||||
}
|
||||
|
||||
public void stateChanged(ChangeEvent e)
|
||||
{
|
||||
startEditedState();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,288 @@
|
||||
/*
|
||||
* MarcacaoEmpresaPanel.java
|
||||
*
|
||||
* Created on 25 de Junho de 2004, 20:32
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.dataui.*;
|
||||
import com.evolute.utils.toolbar.*;
|
||||
import com.evolute.utils.tables.*;
|
||||
import com.evolute.utils.ui.*;
|
||||
import com.evolute.utils.ui.calendar.*;
|
||||
import com.evolute.utils.ui.text.*;
|
||||
|
||||
import siprp.data.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class MarcacaoEmpresaPanel extends JPanel
|
||||
implements ControllableComponent, DocumentListener, ActionListener, ChangeListener
|
||||
{
|
||||
protected static final String LIST_PANEL = "LIST_PANEL";
|
||||
protected static final String EDIT_PANEL = "EDIT_PANEL";
|
||||
|
||||
private ComponentsHashtable components;
|
||||
private EmpresaPanel owner;
|
||||
|
||||
private JCalendarPanel calendarPanel;
|
||||
private JTextArea text;
|
||||
private JCheckBox realizadaCheck;
|
||||
private JButton saveButton;
|
||||
private JButton cancelButton;
|
||||
|
||||
private EmpresaData empresa;
|
||||
private boolean changed = false;
|
||||
private boolean filling = false;
|
||||
|
||||
private MarcacaoEmpresaData marcacao;
|
||||
|
||||
/** Creates a new instance of MarcacaoEmpresaPanel */
|
||||
public MarcacaoEmpresaPanel( EmpresaPanel owner )
|
||||
{
|
||||
this.owner = owner;
|
||||
setupComponents();
|
||||
setupComponentsHashtable();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
calendarPanel = new JCalendarPanel( null );
|
||||
// calendarPanel.addDocumentListener( this );
|
||||
text = new JTextArea();
|
||||
new CopyPasteHandler( text );
|
||||
// text.getDocument().addDocumentListener( this );
|
||||
text.setLineWrap( true );
|
||||
text.setWrapStyleWord( true );
|
||||
JScrollPane textScp = new JScrollPane( text, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
|
||||
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
||||
realizadaCheck = new JCheckBox( "Realizada" );
|
||||
saveButton = new JButton( "Guardar" );
|
||||
saveButton.addActionListener( this );
|
||||
cancelButton = new JButton( "Voltar" );
|
||||
cancelButton.addActionListener( this );
|
||||
|
||||
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
setLayout( gridbag );
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 1, 1, 1, 1 );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
constraints.weighty = 0;
|
||||
constraints.gridheight = 1;
|
||||
calendarPanel.setPreferredSize( new Dimension( 130, 30 ) );
|
||||
gridbag.setConstraints( calendarPanel, constraints );
|
||||
add( calendarPanel );
|
||||
|
||||
gridbag.setConstraints( realizadaCheck, constraints );
|
||||
add( realizadaCheck );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
JPanel buttonPanel = new JPanel();
|
||||
gridbag.setConstraints( buttonPanel, constraints );
|
||||
add( buttonPanel );
|
||||
|
||||
constraints.fill = GridBagConstraints.BOTH;
|
||||
constraints.weighty = 1;
|
||||
constraints.gridheight = GridBagConstraints.REMAINDER;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
constraints.weightx = 1;
|
||||
gridbag.setConstraints( textScp, constraints );
|
||||
add( textScp );
|
||||
|
||||
buttonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) );
|
||||
initButtons();
|
||||
buttonPanel.add( cancelButton );
|
||||
buttonPanel.add( saveButton );
|
||||
}
|
||||
|
||||
private void setupComponentsHashtable()
|
||||
{
|
||||
components = new ComponentsHashtable();
|
||||
components.putComponent( MarcacaoEmpresaData.DATA, calendarPanel );
|
||||
components.putComponent( MarcacaoEmpresaData.TEXTO, text );
|
||||
components.putComponent( MarcacaoEmpresaData.REALIZADA, realizadaCheck );
|
||||
components.putDummy( MarcacaoEmpresaData.EMPRESA );
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.clear( names, components );
|
||||
marcacao = null;
|
||||
}
|
||||
|
||||
public void fill(Object value)
|
||||
{
|
||||
filling = true;
|
||||
clear();
|
||||
initButtons();
|
||||
marcacao = (MarcacaoEmpresaData)value;
|
||||
if( marcacao == null )
|
||||
{
|
||||
filling = false;
|
||||
return;
|
||||
}
|
||||
String names[] = marcacao.getFieldNames();
|
||||
ComponentController.fill( names, marcacao.getHashData(), components );
|
||||
filling = false;
|
||||
}
|
||||
|
||||
public Object save()
|
||||
{
|
||||
if( marcacao == null )
|
||||
{
|
||||
marcacao = new MarcacaoEmpresaData();
|
||||
}
|
||||
|
||||
String names[] = marcacao.getFieldNames();
|
||||
Hashtable hash = new Hashtable();
|
||||
|
||||
ComponentController.save( names, hash, components );
|
||||
hash.put( MarcacaoEmpresaData.EMPRESA, empresa );
|
||||
marcacao.setHashData( hash );
|
||||
System.out.println( "EMPRESA:: " + marcacao.get( MarcacaoEmpresaData.EMPRESA ) );
|
||||
return marcacao;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enable)
|
||||
{
|
||||
super.setEnabled( enable );
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.setEnabled( names, enable, components );
|
||||
}
|
||||
|
||||
public void changedUpdate(javax.swing.event.DocumentEvent documentEvent)
|
||||
{
|
||||
startEditedState();
|
||||
}
|
||||
|
||||
public void insertUpdate(javax.swing.event.DocumentEvent documentEvent)
|
||||
{
|
||||
startEditedState();
|
||||
}
|
||||
|
||||
public void removeUpdate(javax.swing.event.DocumentEvent documentEvent)
|
||||
{
|
||||
startEditedState();
|
||||
}
|
||||
|
||||
private void startEditedState()
|
||||
{
|
||||
if( !filling )
|
||||
{
|
||||
calendarPanel.removeChangeListener( this );
|
||||
text.getDocument().removeDocumentListener( this );
|
||||
realizadaCheck.removeChangeListener( this );
|
||||
changed = true;
|
||||
saveButton.setEnabled( true );
|
||||
changeButton();
|
||||
}
|
||||
}
|
||||
|
||||
private void initButtons()
|
||||
{
|
||||
saveButton.setEnabled( false );
|
||||
calendarPanel.addChangeListener( this );
|
||||
realizadaCheck.addChangeListener( this );
|
||||
text.getDocument().addDocumentListener( this );
|
||||
ClassLoader cl = new EVUtilsImageLib().getClass().getClassLoader();
|
||||
Icon normal = new ImageIcon( cl.getResource( "buttons/save_normal.gif" ) );
|
||||
Icon rollover = new ImageIcon( cl.getResource( "buttons/save_rollover.gif" ) );
|
||||
Icon pressed = new ImageIcon( cl.getResource( "buttons/save_pressed.gif" ) );
|
||||
Icon disabled = new ImageIcon( cl.getResource( "buttons/save_disabled.gif" ) );
|
||||
saveButton.setIcon( normal );
|
||||
saveButton.setRolloverIcon( rollover );
|
||||
saveButton.setPressedIcon( pressed );
|
||||
saveButton.setDisabledIcon( disabled );
|
||||
saveButton.setText( null );
|
||||
saveButton.setBorderPainted( false );
|
||||
saveButton.setRequestFocusEnabled( false );
|
||||
saveButton.setMargin( new Insets( 0, 0, 0, 0 ) );
|
||||
saveButton.setToolTipText( "Gravar" );
|
||||
|
||||
normal = new ImageIcon( cl.getResource( "buttons/shiftl_normal.gif" ) );
|
||||
rollover = new ImageIcon( cl.getResource( "buttons/shiftl_rollover.gif" ) );
|
||||
pressed = new ImageIcon( cl.getResource( "buttons/shiftl_pressed.gif" ) );
|
||||
disabled = new ImageIcon( cl.getResource( "buttons/shiftl_disabled.gif" ) );
|
||||
cancelButton.setIcon( normal );
|
||||
cancelButton.setRolloverIcon( rollover );
|
||||
cancelButton.setPressedIcon( pressed );
|
||||
cancelButton.setDisabledIcon( disabled );
|
||||
cancelButton.setText( null );
|
||||
cancelButton.setBorderPainted( false );
|
||||
cancelButton.setRequestFocusEnabled( false );
|
||||
cancelButton.setMargin( new Insets( 0, 0, 0, 0 ) );
|
||||
cancelButton.setToolTipText( "Voltar \u00e0 lista" );
|
||||
|
||||
}
|
||||
|
||||
private void changeButton()
|
||||
{
|
||||
ClassLoader cl = new EVUtilsImageLib().getClass().getClassLoader();
|
||||
Icon normal = new ImageIcon( cl.getResource( "buttons/cancel_normal.gif" ) );
|
||||
Icon rollover = new ImageIcon( cl.getResource( "buttons/cancel_rollover.gif" ) );
|
||||
Icon pressed = new ImageIcon( cl.getResource( "buttons/cancel_pressed.gif" ) );
|
||||
Icon disabled = new ImageIcon( cl.getResource( "buttons/cancel_disabled.gif" ) );
|
||||
cancelButton.setIcon( normal );
|
||||
cancelButton.setRolloverIcon( rollover );
|
||||
cancelButton.setPressedIcon( pressed );
|
||||
cancelButton.setDisabledIcon( disabled );
|
||||
cancelButton.setToolTipText( "Cancelar" );
|
||||
}
|
||||
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
Object source = e.getSource();
|
||||
if( source.equals( saveButton ) )
|
||||
{
|
||||
if( calendarPanel.getDate() == null )
|
||||
{
|
||||
JOptionPane.showMessageDialog( this, "Tem de escolher uma data", "Erro...", JOptionPane.ERROR_MESSAGE );
|
||||
return;
|
||||
}
|
||||
MarcacaoEmpresaData marc = ( MarcacaoEmpresaData ) save();
|
||||
|
||||
try
|
||||
{
|
||||
marc.save();
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a gravar", true );
|
||||
return;
|
||||
}
|
||||
owner.reloadMarcacoes();
|
||||
}
|
||||
else if( source.equals( cancelButton ) )
|
||||
{
|
||||
owner.showMarcacoes();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setEmpresa( EmpresaData empresa )
|
||||
{
|
||||
this.empresa = empresa;
|
||||
}
|
||||
|
||||
public void stateChanged(javax.swing.event.ChangeEvent changeEvent)
|
||||
{
|
||||
startEditedState();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,594 @@
|
||||
/*
|
||||
* MarcacaoPanel.java
|
||||
*
|
||||
* Created on 14 de Maio de 2004, 15:52
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.dataui.*;
|
||||
import com.evolute.utils.ui.*;
|
||||
import com.evolute.utils.ui.calendar.*;
|
||||
import com.evolute.utils.ui.panel.*;
|
||||
|
||||
import siprp.*;
|
||||
import siprp.data.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class MarcacaoPanel extends JPanel
|
||||
implements ControllableComponent, ActionListener
|
||||
{
|
||||
private final String COLUMN_NAMES_REL[];
|
||||
private static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( DateFormat.SHORT );
|
||||
|
||||
private Marcacao marcacoes[];
|
||||
private ComponentsHashtable components;
|
||||
private int tipo;
|
||||
|
||||
private final boolean comRelatorio;
|
||||
|
||||
private Box anteriorPanel;
|
||||
private JPanel correntePanel;
|
||||
|
||||
private String realizadoLabelText;
|
||||
private String relatorioLabelText;
|
||||
|
||||
private JLabel dataMarcacaoAnteriorLabel;
|
||||
private JCheckBox realizadaCheckBox;
|
||||
private JCalendarPanel dataRelatorioPanel;
|
||||
private JCalendarPanel dataMarcacaoPanel;
|
||||
private JButton enviarEmailButton;
|
||||
private JLabel dataEnvioMailLabel;
|
||||
private JButton historicoButton;
|
||||
|
||||
private TrabalhadorData trabalhador;
|
||||
private EstabelecimentoData estabelecimento;
|
||||
|
||||
private MarcacaoListLoader loader;
|
||||
private Marcacao current;
|
||||
private Marcacao last;
|
||||
|
||||
private boolean filling = false;
|
||||
|
||||
/** Creates a new instance of MarcacaoPanel */
|
||||
public MarcacaoPanel( boolean comRelatorio, String realizadoLabelText, String relatorioLabelText, int tipo )
|
||||
{
|
||||
this.comRelatorio = comRelatorio;
|
||||
this.realizadoLabelText = realizadoLabelText;
|
||||
this.relatorioLabelText = relatorioLabelText;
|
||||
this.tipo = tipo;
|
||||
COLUMN_NAMES_REL = new String[ comRelatorio ? 3 : 2 ];
|
||||
COLUMN_NAMES_REL[ 0 ] = "Data";
|
||||
COLUMN_NAMES_REL[ 1 ] = realizadoLabelText;
|
||||
if( comRelatorio )
|
||||
{
|
||||
COLUMN_NAMES_REL[ 2 ] = relatorioLabelText;
|
||||
}
|
||||
loader = new MarcacaoListLoader();
|
||||
setupComponents();
|
||||
setupComponentsHashtable();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
anteriorPanel = new Box( BoxLayout.X_AXIS );
|
||||
anteriorPanel.setBorder( BorderFactory.createTitledBorder(
|
||||
BorderFactory.createEtchedBorder(),
|
||||
"Anterior" ) );
|
||||
correntePanel = new JPanel();
|
||||
// correntePanel.setBorder( BorderFactory.createTitledBorder(
|
||||
// BorderFactory.createEtchedBorder(),
|
||||
// "Corrente" ) );
|
||||
JPanel dataPanel = new JPanel();
|
||||
Box relatorioBox = new Box( BoxLayout.X_AXIS );
|
||||
|
||||
dataMarcacaoAnteriorLabel = new JLabel( "-" );
|
||||
dataEnvioMailLabel = new JLabel( "" );
|
||||
realizadaCheckBox = new JCheckBox( realizadoLabelText + " " );
|
||||
realizadaCheckBox.addChangeListener( new ChangeListener(){
|
||||
public void stateChanged( ChangeEvent e )
|
||||
{
|
||||
System.out.println( "stateChanged" );
|
||||
if( last != null && !filling )
|
||||
{
|
||||
System.out.println( "stateChanged2" );
|
||||
last.set( Marcacao.REALIZADA, realizadaCheckBox.isSelected() ? "y": "n" );
|
||||
try
|
||||
{
|
||||
last.save();
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a gravar", true );
|
||||
realizadaCheckBox.setSelected( realizadaCheckBox.isSelected() );
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
JLabel relatorioLabel = new JLabel( relatorioLabelText );
|
||||
dataRelatorioPanel = new JCalendarPanel( null );
|
||||
dataRelatorioPanel.addChangeListener( new ChangeListener(){
|
||||
public void stateChanged(ChangeEvent e)
|
||||
{
|
||||
if( !filling )
|
||||
{
|
||||
marcarRelatorio();
|
||||
}
|
||||
}
|
||||
|
||||
private void marcarRelatorio()
|
||||
{
|
||||
last.set( Marcacao.DATA_RELATORIO, dataRelatorioPanel.getDate() );
|
||||
try
|
||||
{
|
||||
last.save();
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a gravar", true );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
dataMarcacaoPanel = new JCalendarPanel( null );
|
||||
dataMarcacaoPanel.addChangeListener( new ChangeListener(){
|
||||
public void stateChanged(ChangeEvent e)
|
||||
{
|
||||
if( !filling )
|
||||
{
|
||||
marcar();
|
||||
}
|
||||
}
|
||||
} );
|
||||
enviarEmailButton = new JButton( "Enviar Email" );
|
||||
enviarEmailButton.addActionListener( this );
|
||||
historicoButton = new JButton( "H" );
|
||||
historicoButton.addActionListener( this );
|
||||
|
||||
anteriorPanel.add( dataPanel );
|
||||
if( comRelatorio )
|
||||
{
|
||||
anteriorPanel.add( relatorioBox );
|
||||
anteriorPanel.add( relatorioLabel );
|
||||
anteriorPanel.add( dataRelatorioPanel );
|
||||
}
|
||||
|
||||
dataPanel.setLayout( new GridLayout( 1, 2 ) );
|
||||
dataPanel.add( dataMarcacaoAnteriorLabel );
|
||||
dataPanel.add( realizadaCheckBox );
|
||||
|
||||
correntePanel.setLayout( new GridLayout( 1, 2 ) );
|
||||
correntePanel.add( dataMarcacaoPanel );
|
||||
correntePanel.add( enviarEmailButton );
|
||||
|
||||
//setLayout( new BoxLayout( this, BoxLayout.Y_AXIS ) );
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
setLayout( gridbag );
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 1, 1, 1, 1 );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weighty = 0.5;
|
||||
constraints.gridheight = 1;
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = 1;
|
||||
|
||||
gridbag.setConstraints( anteriorPanel, constraints );
|
||||
add( anteriorPanel );
|
||||
|
||||
constraints.fill = GridBagConstraints.BOTH;
|
||||
constraints.weighty = 1;
|
||||
constraints.gridheight = 2;
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
historicoButton.setPreferredSize( new Dimension( 20, 40 ) );
|
||||
gridbag.setConstraints( historicoButton, constraints );
|
||||
add( historicoButton );
|
||||
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weighty = 0.5;
|
||||
constraints.gridheight = 1;
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = 1;
|
||||
constraints.gridx = 0;
|
||||
gridbag.setConstraints( correntePanel, constraints );
|
||||
add( correntePanel );
|
||||
}
|
||||
|
||||
private void setupComponentsHashtable()
|
||||
{
|
||||
components = new ComponentsHashtable();
|
||||
components.putComponent( Marcacao.DATA, dataMarcacaoPanel );
|
||||
components.putComponent( Marcacao.REALIZADA, realizadaCheckBox );
|
||||
components.putComponent( Marcacao.DATA_RELATORIO, dataRelatorioPanel );
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.clear( names, components );
|
||||
dataMarcacaoAnteriorLabel.setText( "" );
|
||||
dataEnvioMailLabel.setText( "" );
|
||||
marcacoes = null;
|
||||
trabalhador = null;
|
||||
estabelecimento = null;
|
||||
current = null;
|
||||
last = null;
|
||||
}
|
||||
|
||||
public void fill( Object value )
|
||||
{
|
||||
filling = true;
|
||||
clear();
|
||||
if( value == null )
|
||||
{
|
||||
setEnabled( false );
|
||||
filling = false;
|
||||
return;
|
||||
}
|
||||
switch( tipo )
|
||||
{
|
||||
case Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES: case Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA:
|
||||
if( ! ( value instanceof TrabalhadorData ) )
|
||||
{
|
||||
filling = false;
|
||||
return ;
|
||||
}
|
||||
trabalhador = (TrabalhadorData) value;
|
||||
try
|
||||
{
|
||||
marcacoes = loader.load( tipo, (Integer)trabalhador.get( TrabalhadorData.ID ) );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a carregar as marca\u00e7\u00f5es", true );
|
||||
marcacoes = null;
|
||||
}
|
||||
break;
|
||||
|
||||
case Marcacao.TIPO_MARCACAO_ESTABELECIMENTO:
|
||||
if( ! ( value instanceof EstabelecimentoData ) )
|
||||
{
|
||||
filling = false;
|
||||
return ;
|
||||
}
|
||||
estabelecimento = (EstabelecimentoData) value;
|
||||
try
|
||||
{
|
||||
marcacoes = loader.load( tipo, (Integer)estabelecimento.get( EstabelecimentoData.ID ) );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a carregar as marca\u00e7\u00f5es", true );
|
||||
marcacoes = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if( marcacoes == null || marcacoes.length == 0 )
|
||||
{
|
||||
filling = false;
|
||||
return;
|
||||
}
|
||||
Date lastDate = (Date) marcacoes[ 0 ].get( Marcacao.DATA );
|
||||
current = null;
|
||||
last = null;
|
||||
if( !lastDate.after( new Date() ) )
|
||||
{
|
||||
current = null;
|
||||
last = marcacoes[ 0 ];
|
||||
}
|
||||
else
|
||||
{
|
||||
current = marcacoes[ 0 ];
|
||||
if( marcacoes.length > 1 )
|
||||
{
|
||||
last = marcacoes[ 1 ];
|
||||
}
|
||||
}
|
||||
fillCurrent();
|
||||
fillLast();
|
||||
filling = false;
|
||||
}
|
||||
|
||||
private void fillCurrent()
|
||||
{
|
||||
if( current != null )
|
||||
{
|
||||
Date dataMarcacao = (Date) current.get( Marcacao.DATA );
|
||||
dataMarcacaoPanel.setDate( dataMarcacao );
|
||||
Date dataMail = (Date) current.get( Marcacao.DATA_EMAIL );
|
||||
if( dataMail == null )
|
||||
{
|
||||
enviarEmailButton.setEnabled( dataMarcacao != null );
|
||||
dataEnvioMailLabel.setText( "" );
|
||||
}
|
||||
else
|
||||
{
|
||||
enviarEmailButton.setEnabled( false );
|
||||
dataEnvioMailLabel.setText( DATE_FORMAT.format( dataMail ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
enviarEmailButton.setEnabled( false );
|
||||
}
|
||||
}
|
||||
|
||||
private void fillLast()
|
||||
{
|
||||
if( last != null )
|
||||
{
|
||||
Date dataMarcacao = (Date) last.get( Marcacao.DATA );
|
||||
dataMarcacaoAnteriorLabel.setText( DATE_FORMAT.format( dataMarcacao ) );
|
||||
String realizada = (String) last.get( Marcacao.REALIZADA );
|
||||
boolean isRealizada = "y".equals( realizada );
|
||||
realizadaCheckBox.setSelected( isRealizada );
|
||||
realizadaCheckBox.setEnabled( !isRealizada );
|
||||
Date dataRelatorio = (Date) last.get( Marcacao.DATA_RELATORIO );
|
||||
dataRelatorioPanel.setDate( dataRelatorio );
|
||||
}
|
||||
else
|
||||
{
|
||||
realizadaCheckBox.setEnabled( false );
|
||||
dataRelatorioPanel.setEnabled( false );
|
||||
}
|
||||
}
|
||||
|
||||
public Object save()
|
||||
{
|
||||
// if( marcacoes == null )
|
||||
// {
|
||||
// marcacoes = new Marcacao[ 0 ];
|
||||
// }
|
||||
// if( marcacoes[ marcacoes.length - 1 ] == null )
|
||||
// {
|
||||
// marcacoes[ marcacoes.length - 1 ] = Marcacao.getMarcacao( tipo );
|
||||
// }
|
||||
// if( marcacoes.length > 1 )
|
||||
// {
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enable )
|
||||
{
|
||||
filling = true;
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.setEnabled( names, enable, components );
|
||||
if( !enable )
|
||||
{
|
||||
enviarEmailButton.setEnabled( false );
|
||||
}
|
||||
if( last == null )
|
||||
{
|
||||
realizadaCheckBox.setEnabled( false );
|
||||
dataRelatorioPanel.setEnabled( false );
|
||||
}
|
||||
filling = false;
|
||||
}
|
||||
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
Object source = e.getSource();
|
||||
if( source.equals( enviarEmailButton ) )
|
||||
{
|
||||
Date today = new Date();
|
||||
current.set( Marcacao.DATA_EMAIL, today );
|
||||
String subject = ".";
|
||||
String texto = "";
|
||||
EstabelecimentoData estab = null;
|
||||
if( current instanceof MarcacaoTrabalhadorData )
|
||||
{
|
||||
TrabalhadorData trab = ( TrabalhadorData )current.get( MarcacaoTrabalhadorData.TRABALHADOR );
|
||||
String nome = ( String )trab.get( TrabalhadorData.NOME );
|
||||
String data = DateFormat.getDateInstance( DateFormat.SHORT ).format( ( Date )current.get( MarcacaoTrabalhadorData.DATA ) );
|
||||
if( ( ( Number )current.get( MarcacaoTrabalhadorData.TIPO ) ).intValue() == MarcacaoTrabalhadorConstants.TIPO_EXAMES )
|
||||
{
|
||||
subject = ( String ) Singleton.getInstance( SingletonConstants.SUBJECT_EXAMES );
|
||||
subject = subject.replaceAll( CompanyDataLoader.NOME, nome );
|
||||
texto = ( String ) Singleton.getInstance( SingletonConstants.LETTER_EXAMES );
|
||||
texto = texto.replaceAll( CompanyDataLoader.DATA, data );
|
||||
texto = texto.replaceAll( CompanyDataLoader.NOME, nome );
|
||||
// subject = "Marca\u00E7\u00E3o de exame";
|
||||
// texto = "Vimos pelo presente informar que '" + nome + "' dever\u00E1 comparecer "
|
||||
// + "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o dos exames de Medicina "
|
||||
// + "do Trabalho, no dia '" + data + "', pelas 08H30."
|
||||
// + "%0A%0A"
|
||||
// + "Relembramos que o colaborador dever\u00E1 comparecer em jejum."
|
||||
// + "%0A%0A"
|
||||
// + "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data "
|
||||
// + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 350 45 40 "
|
||||
//// + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 210 21 21 "
|
||||
// + "ou respondendo ao remetente desta mensagem."
|
||||
// + "%0A%0A%0A"
|
||||
// + "Cumprimentos,%0A%0ASIPRP";
|
||||
//// + "Cumprimentos,";
|
||||
}
|
||||
else
|
||||
{
|
||||
subject = ( String ) Singleton.getInstance( SingletonConstants.SUBJECT_CONSULTA );
|
||||
subject = subject.replaceAll( CompanyDataLoader.NOME, nome );
|
||||
texto = ( String ) Singleton.getInstance( SingletonConstants.LETTER_CONSULTA );
|
||||
texto = texto.replaceAll( CompanyDataLoader.DATA, data );
|
||||
texto = texto.replaceAll( CompanyDataLoader.NOME, nome );
|
||||
// subject = "Marca\u00E7\u00E3o de consulta";
|
||||
// texto = "Vimos pelo presente informar que '" + nome + "' dever\u00E1 comparecer "
|
||||
// + "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o da consulta de Medicina "
|
||||
// + "do Trabalho, no dia '" + data + "', pelas 08H30."
|
||||
// + "%0A%0A"
|
||||
// + "%0A%0A"
|
||||
// + "Solicitamos, tamb\u00E9m, que o colaborador seja portador do Boletim de Vacinas e "
|
||||
// + "dos \u00FAltimos exames complementares realizados."
|
||||
// + "%0A%0A"
|
||||
// + "%0A%0A"
|
||||
// + "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data "
|
||||
// + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 350 45 40 "
|
||||
//// + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 210 21 21 "
|
||||
// + "ou respondendo ao remetente desta mensagem."
|
||||
// + "%0A%0A%0A"
|
||||
// + "Cumprimentos,"
|
||||
// + "%0A%0ASIPRP"
|
||||
// + "%0A%0AATRIUM SALDANHA"
|
||||
// + "%0A%0APra\u00e7a Duque de Saldanha, 1 - 9\u00BAC"
|
||||
// + "%0A%0A1050-094 Lisboa";
|
||||
}
|
||||
estab = ( EstabelecimentoData )trab.get( TrabalhadorData.ESTABELECIMENTO );
|
||||
}
|
||||
else
|
||||
{
|
||||
estab = ( EstabelecimentoData )current.get( MarcacaoEstabelecimentoData.ESTABELECIMENTO );
|
||||
String sede = ( String )estab.get( EstabelecimentoData.NOME );
|
||||
subject = ( String ) Singleton.getInstance( SingletonConstants.SUBJECT_VISITA );
|
||||
subject = subject.replaceAll( CompanyDataLoader.NOME, sede );
|
||||
String morada = ( String )estab.get( EstabelecimentoData.MORADA );
|
||||
String data = DateFormat.getDateInstance( DateFormat.SHORT ).format( ( Date )current.get( MarcacaoEstabelecimentoData.DATA ) );
|
||||
texto = ( String ) Singleton.getInstance( SingletonConstants.LETTER_VISITA );
|
||||
texto = texto.replaceAll( CompanyDataLoader.DATA, data );
|
||||
texto = texto.replaceAll( CompanyDataLoader.NOME, sede );
|
||||
texto = texto.replaceAll( CompanyDataLoader.MORADA, morada );
|
||||
// texto = "Vimos pelo presente informar que iremos efectuar a auditoria de Higiene e "
|
||||
// + "Seguran\u00E7a \u00E0s vossas instala\u00E7\u00F5es de '" + sede + "', no dia '" + data + "'."
|
||||
// + "%0A%0A"
|
||||
// + "Agradecemos que nos confirme, pela mesma via, o nome do representante "
|
||||
// + "da empresa que nos ir\u00E1 acompanhar e a vossa disponibilidade para a "
|
||||
// + "realiza\u00E7\u00E3o da visita na data indicada."
|
||||
// + "%0A%0A"
|
||||
// + "Caso necessite de qualquer esclarecimento, contacte-nos, por favor, "
|
||||
// + "atrav\u00E9s dos telefones 21 350 45 43 (Pedro Vieira), 21 350 45 44 "
|
||||
// + "(Catarina Leonardo) ou responda ao remetente desta mensagem."
|
||||
//// + "atrav\u00E9s dos telefones 21 210 21 21 (Colaborador), 21 210 21 21 "
|
||||
//// + "(Outro Colaborador) ou responda ao remetente desta mensagem."
|
||||
// + "%0A%0A%0A"
|
||||
// + "Cumprimentos,%0A%0ASIPRP";
|
||||
//// + "Cumprimentos,";
|
||||
|
||||
|
||||
}
|
||||
ContactoData cont = ( ContactoData )estab.get( EstabelecimentoData.CONTACTO );
|
||||
String mail = "";
|
||||
if( cont != null )
|
||||
{
|
||||
mail = ( String )cont.get( ContactoData.EMAIL );
|
||||
}
|
||||
try
|
||||
{
|
||||
current.save();
|
||||
if( System.getProperty( "os.name" ).startsWith( "Windows" ) )
|
||||
{
|
||||
mail = mail.replaceAll( " ", "%20" );
|
||||
subject = subject.replaceAll( " ", "%20" );
|
||||
texto = texto.replaceAll( " ", "%20" );
|
||||
Process proc = Runtime.getRuntime().exec( "cmd.exe /c start mailto:\"" + mail
|
||||
+ "?subject=" + subject + "&body="
|
||||
// + "?subject=" + subject + "&body="
|
||||
+ texto
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
mail = mail.replaceAll( " ", "%20" );
|
||||
subject = subject.replaceAll( " ", "%20" );
|
||||
texto = texto.replaceAll( " ", "%20" );
|
||||
// System.out.println( "mailto:" + mail
|
||||
// // + "?subject=SIPRP - " + subject + "&body="
|
||||
// + "?subject=" + subject + "&body="
|
||||
// + texto );
|
||||
Process proc = Runtime.getRuntime().exec( new String[]{ "/usr/bin/open", "/Applications/Mail.app", "mailto:" + mail
|
||||
// + "?subject=SIPRP - " + subject + "&body="
|
||||
+ "?subject=" + subject + "&body="
|
||||
+ texto } );
|
||||
}
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a enviar mail", true );
|
||||
}
|
||||
dataEnvioMailLabel.setText( DATE_FORMAT.format( today ) );
|
||||
}
|
||||
else if( source.equals( historicoButton ) )
|
||||
{
|
||||
Vector v = new Vector();
|
||||
if( marcacoes != null )
|
||||
{
|
||||
v.addAll( Arrays.asList( marcacoes ) );
|
||||
}
|
||||
ListActionDialog dialog =
|
||||
new ListActionDialog( null, "Anteriores",
|
||||
COLUMN_NAMES_REL,
|
||||
v, null );
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
public void marcar()
|
||||
{
|
||||
System.out.println( "MARCAR" );
|
||||
Date data = dataMarcacaoPanel.getDate();
|
||||
Vector aux = new Vector();
|
||||
if( marcacoes != null )
|
||||
{
|
||||
aux.addAll( Arrays.asList( marcacoes ) );
|
||||
}
|
||||
if( current == null && data != null )
|
||||
{
|
||||
current = Marcacao.getMarcacao( tipo );
|
||||
current.set( Marcacao.REALIZADA, "n" );
|
||||
|
||||
aux.insertElementAt( current, 0 );
|
||||
switch( tipo )
|
||||
{
|
||||
case Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES: case Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA:
|
||||
current.set( MarcacaoTrabalhadorData.TRABALHADOR, trabalhador );
|
||||
current.set( MarcacaoTrabalhadorData.TIPO, new Integer( tipo ) );
|
||||
break;
|
||||
|
||||
case Marcacao.TIPO_MARCACAO_ESTABELECIMENTO:
|
||||
current.set( MarcacaoEstabelecimentoData.ESTABELECIMENTO, estabelecimento );
|
||||
break;
|
||||
}
|
||||
marcacoes = ( Marcacao [])aux.toArray( new Marcacao[0] );
|
||||
// System.out.println( "INSERI ! !! ! ! !! ! " );
|
||||
}
|
||||
else if( current != null && data == null )
|
||||
{
|
||||
aux.remove( 0 );
|
||||
marcacoes = ( Marcacao [])aux.toArray( new Marcacao[0] );
|
||||
// System.out.println( "REMOVI ! !! ! ! !! ! " );
|
||||
}
|
||||
current.set( Marcacao.DATA, data );
|
||||
|
||||
try
|
||||
{
|
||||
if( data != null )
|
||||
{
|
||||
current.save();
|
||||
enviarEmailButton.setEnabled( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println( "DELETE DA MARCACAO" );
|
||||
current.delete();
|
||||
}
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a gravar", true );
|
||||
}
|
||||
}
|
||||
|
||||
public void setCalendarDialogOrientation( int vertical, int horizontal )
|
||||
{
|
||||
dataRelatorioPanel.setOrientation( vertical, horizontal );
|
||||
dataMarcacaoPanel.setOrientation( vertical, horizontal );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* NoticiasDataProvider.java
|
||||
*
|
||||
* Created on 24 de Maio de 2005, 15:39
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.arrays.*;
|
||||
import com.evolute.utils.data.*;
|
||||
import com.evolute.utils.db.*;
|
||||
import com.evolute.utils.metadb.*;
|
||||
import com.evolute.utils.ui.search.*;
|
||||
import com.evolute.utils.sql.*;
|
||||
|
||||
import siprp.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class NoticiasDataProvider extends MetaProvider
|
||||
{
|
||||
private static final Object LOCK = new Object();
|
||||
private static NoticiasDataProvider instance = null;
|
||||
private final Executer executer;
|
||||
|
||||
/** Creates a new instance of NoticiasDataProvider */
|
||||
public NoticiasDataProvider()
|
||||
throws Exception
|
||||
{
|
||||
boolean webAware = ( ( Boolean ) Singleton.getInstance( SingletonConstants.WEB_AWARE ) ).booleanValue();
|
||||
DBManager dbm;
|
||||
if( webAware )
|
||||
{
|
||||
String url = ( String ) Singleton.getInstance( SingletonConstants.WEB_URL_PREFIX );
|
||||
url += ( String ) Singleton.getInstance( SingletonConstants.WEB_URL ) + "/";
|
||||
url += ( String ) Singleton.getInstance( SingletonConstants.WEB_DB_NAME ) + "/";
|
||||
String user = ( String ) Singleton.getInstance( SingletonConstants.WEB_USER );
|
||||
String pwd = ( String ) Singleton.getInstance( SingletonConstants.WEB_PASSWORD );
|
||||
dbm = new JDBCManager( url, user, pwd, 10, 8, 8, null );
|
||||
executer = dbm.getSharedExecuter( this );
|
||||
}
|
||||
else
|
||||
{
|
||||
dbm = null;
|
||||
executer = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static MetaProvider getProvider()
|
||||
throws Exception
|
||||
{
|
||||
synchronized( LOCK )
|
||||
{
|
||||
if( instance == null )
|
||||
{
|
||||
instance = new NoticiasDataProvider();
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public String getNoticias()
|
||||
throws Exception
|
||||
{
|
||||
Select subSelect =
|
||||
new Select( new String[]{ "not_noticias" },
|
||||
new String[]{ "MAX(id)" }, null );
|
||||
|
||||
Select select =
|
||||
new Select( new String[]{ "not_noticias" },
|
||||
new String[]{ "noticia" },
|
||||
new Field( "id" ).isEqual( subSelect ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return array.get( 0, 0 ).toString().trim();
|
||||
}
|
||||
|
||||
public void saveNoticias( String noticias )
|
||||
throws Exception
|
||||
{
|
||||
|
||||
|
||||
Insert insert =
|
||||
new Insert( "not_noticias",
|
||||
new Assignment[]{ new Assignment( new Field( "utilizador" ), Singleton.getInstance( Singleton.USERNAME ) ),
|
||||
new Assignment( new Field( "data" ), Singleton.getInstance( Singleton.TODAY ) ),
|
||||
new Assignment( new Field( "noticia" ), noticias.trim() ) } );
|
||||
executer.executeQuery( insert );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* NoticiasPanel.java
|
||||
*
|
||||
* Created on 24 de Maio de 2005, 15:12
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
import com.evolute.utils.ui.*;
|
||||
import com.evolute.utils.ui.panel.*;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class NoticiasDialog extends CustomJDialog
|
||||
implements ActionListener
|
||||
{
|
||||
protected HTMLEditorPanel textText;
|
||||
protected JButton okButton;
|
||||
protected JButton cancelButton;
|
||||
|
||||
protected NoticiasDataProvider provider;
|
||||
|
||||
/** Creates a new instance of NoticiasPanel */
|
||||
public NoticiasDialog( JFrame owner )
|
||||
throws Exception
|
||||
{
|
||||
super( owner, true );
|
||||
provider = (NoticiasDataProvider)NoticiasDataProvider.getProvider();
|
||||
setupComponents();
|
||||
if( owner != null )
|
||||
{
|
||||
centerSuper();
|
||||
}
|
||||
else
|
||||
{
|
||||
center();
|
||||
}
|
||||
textText.fill( provider.getNoticias() );
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
setTitle( "Editar Texto das Not\u00edcias" );
|
||||
setSize( 300, 200 );
|
||||
|
||||
textText = new HTMLEditorPanel( true );
|
||||
// textText.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(),
|
||||
// "Texto" ) );
|
||||
okButton = new JButton( "OK" );
|
||||
okButton.addActionListener( this );
|
||||
cancelButton = new JButton( "Cancelar" );
|
||||
cancelButton.addActionListener( this );
|
||||
|
||||
getContentPane().setLayout( new BorderLayout() );
|
||||
getContentPane().add( textText, BorderLayout.CENTER );
|
||||
JPanel buttonPanel = new JPanel();
|
||||
getContentPane().add( buttonPanel, BorderLayout.SOUTH );
|
||||
|
||||
buttonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) );
|
||||
buttonPanel.add( okButton );
|
||||
buttonPanel.add( cancelButton );
|
||||
}
|
||||
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
Object source = e.getSource();
|
||||
if( source.equals( okButton ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
provider.saveNoticias( (String) textText.save() );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a gravar not\u00edcias", true );
|
||||
return;
|
||||
}
|
||||
close();
|
||||
}
|
||||
else if( source.equals( cancelButton ) )
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
public void close()
|
||||
{
|
||||
SwingUtilities.invokeLater( new Thread(){
|
||||
public void run()
|
||||
{
|
||||
setVisible( false );
|
||||
dispose();
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,153 @@
|
||||
/*
|
||||
* PerfilProtocoloPanel.java
|
||||
*
|
||||
* Created on January 27, 2006, 12:24 AM
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.data.*;
|
||||
import com.evolute.utils.dataui.*;
|
||||
import com.evolute.utils.ui.panel.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class PerfilProtocoloPanel extends JPanel
|
||||
implements ControllableComponent, ItemListener
|
||||
{
|
||||
protected JCheckBox consultasCheck;
|
||||
protected JCheckBox examesCheck;
|
||||
protected CheckBoxPanel tiposCheck[];
|
||||
|
||||
protected IDObject grupos[];
|
||||
protected IDObject tipos[][];
|
||||
|
||||
/** Creates a new instance of PerfilProtocoloPanel */
|
||||
public PerfilProtocoloPanel( IDObject grupos[], IDObject tipos[][] )
|
||||
{
|
||||
this.grupos = grupos;
|
||||
this.tipos = tipos;
|
||||
setupComponents();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
consultasCheck = new JCheckBox( "Consultas" );
|
||||
examesCheck = new JCheckBox( "Exames" );
|
||||
examesCheck.addItemListener( this );
|
||||
tiposCheck = new CheckBoxPanel[ grupos.length ];
|
||||
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
setLayout( gridbag );
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 1, 1, 1, 1 );
|
||||
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weighty = 0;
|
||||
constraints.weightx = 1;
|
||||
constraints.gridheight = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( consultasCheck, constraints );
|
||||
gridbag.setConstraints( examesCheck, constraints );
|
||||
|
||||
add( consultasCheck );
|
||||
add( examesCheck );
|
||||
|
||||
constraints.fill = GridBagConstraints.BOTH;
|
||||
constraints.weighty = grupos.length > 0 ? 1.0 / grupos.length : 0.0;
|
||||
for( int n = 0; n < grupos.length; n++ )
|
||||
{
|
||||
tiposCheck[ n ] = setupComponentsGrupo( n );
|
||||
gridbag.setConstraints( tiposCheck[ n ], constraints );
|
||||
add( tiposCheck[ n ] );
|
||||
tiposCheck[ n ].setEnabled( false );
|
||||
}
|
||||
}
|
||||
|
||||
private CheckBoxPanel setupComponentsGrupo( int indice )
|
||||
{
|
||||
String desc = grupos[ indice ].toString();
|
||||
CheckBoxPanel panel = new CheckBoxPanel( tipos[ indice ] );
|
||||
panel.setBorder( BorderFactory.createTitledBorder(
|
||||
BorderFactory.createEtchedBorder(), desc ) );
|
||||
return panel;
|
||||
}
|
||||
|
||||
public void fill( Object data )
|
||||
{
|
||||
clear();
|
||||
if( data != null )
|
||||
{
|
||||
Vector list = ( Vector ) data;
|
||||
boolean consultasExames[] = (boolean[]) list.elementAt( 0 );
|
||||
Integer tiposEscolhidos[] = ( Integer [] ) list.elementAt( 1 );
|
||||
consultasCheck.setSelected( consultasExames[ 0 ] );
|
||||
examesCheck.setSelected( consultasExames[ 1 ] );
|
||||
for( int n = 0; n < tiposCheck.length; n++ )
|
||||
{
|
||||
tiposCheck[ n ].fill( tiposEscolhidos );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Object save()
|
||||
{
|
||||
boolean consultasExames[] = new boolean[ 2 ];
|
||||
consultasExames[ 0 ] = consultasCheck.isSelected();
|
||||
consultasExames[ 1 ] = examesCheck.isSelected();
|
||||
Vector tiposEscolhidos = new Vector();
|
||||
if( consultasExames[ 1 ] )
|
||||
{
|
||||
for( int n = 0; n < tiposCheck.length; n++ )
|
||||
{
|
||||
tiposEscolhidos.addAll( Arrays.asList( tiposCheck[ n ].getSelected() ) );
|
||||
}
|
||||
}
|
||||
Vector list = new Vector();
|
||||
list.add( consultasExames );
|
||||
list.add( tiposEscolhidos.toArray( new Integer[ tiposEscolhidos.size() ] ) );
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enable )
|
||||
{
|
||||
consultasCheck.setEnabled( enable );
|
||||
examesCheck.setEnabled( enable );
|
||||
for( int n = 0; n < tiposCheck.length; n++ )
|
||||
{
|
||||
tiposCheck[ n ].setEnabled( enable && examesCheck.isSelected() );
|
||||
}
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
consultasCheck.setSelected( false );
|
||||
examesCheck.setSelected( false );
|
||||
for( int n = 0; n < tiposCheck.length; n++ )
|
||||
{
|
||||
tiposCheck[ n ].clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void itemStateChanged( ItemEvent e )
|
||||
{
|
||||
Object source = e.getSource();
|
||||
if( source.equals( examesCheck ) )
|
||||
{
|
||||
for( int n = 0; n < tiposCheck.length; n++ )
|
||||
{
|
||||
tiposCheck[ n ].setEnabled( examesCheck.isEnabled() && examesCheck.isSelected() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,111 @@
|
||||
/*
|
||||
* ProtocoloPanel.java
|
||||
*
|
||||
* Created on January 27, 2006, 12:23 AM
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.data.*;
|
||||
import com.evolute.utils.dataui.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class ProtocoloPanel extends JPanel
|
||||
implements ControllableComponent
|
||||
{
|
||||
protected ClientesDataProvider provider;
|
||||
|
||||
protected IDObject grupos[];
|
||||
protected IDObject tipos[][];
|
||||
|
||||
protected PerfilProtocoloPanel perfisPanels[];
|
||||
|
||||
/** Creates a new instance of ProtocoloPanel */
|
||||
public ProtocoloPanel()
|
||||
throws Exception
|
||||
{
|
||||
provider = ( ClientesDataProvider ) ClientesDataProvider.getProvider();
|
||||
IDObject gruposReais[] = provider.getAllGruposProtocoloReais();
|
||||
Vector gruposAux = new Vector( Arrays.asList( gruposReais ) );
|
||||
gruposAux.add( new MappableObject( new Integer( 0 ), "Outros" ) );
|
||||
grupos = ( IDObject[] ) gruposAux.toArray( new IDObject[ gruposReais.length + 1 ] );
|
||||
|
||||
IDObject gruposFalsos[] = provider.getAllGruposProtocoloFalsos();
|
||||
|
||||
Hashtable tiposHash = provider.getAllTiposElementosProtocoloByGrupo();
|
||||
tipos = new IDObject[ grupos.length ][];
|
||||
for( int n = 0; n < gruposReais.length; n++ )
|
||||
{
|
||||
Vector tiposGrupo = ( Vector ) tiposHash.get( gruposReais[ n ].getID() );
|
||||
tipos[ n ] = ( IDObject[] ) tiposGrupo.toArray( new IDObject[ tiposGrupo.size() ] );
|
||||
}
|
||||
Vector outros = new Vector();
|
||||
for( int n = 0; n < gruposFalsos.length; n++ )
|
||||
{
|
||||
Vector tiposGrupo = ( Vector ) tiposHash.get( gruposFalsos[ n ].getID() );
|
||||
outros.addAll( tiposGrupo );
|
||||
}
|
||||
tipos[ gruposReais.length ] = ( IDObject[] ) outros.toArray( new IDObject[ outros.size() ] );
|
||||
setupComponents();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
perfisPanels = new PerfilProtocoloPanel[ 2 ];
|
||||
|
||||
setLayout( new GridLayout( 1, 2 ) );
|
||||
|
||||
perfisPanels[ 0 ] = new PerfilProtocoloPanel( grupos, tipos );
|
||||
JScrollPane perfilAScp =
|
||||
new JScrollPane( perfisPanels[ 0 ], JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
|
||||
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
perfilAScp.setBorder( BorderFactory.createTitledBorder(
|
||||
BorderFactory.createEtchedBorder(), "Perfil A" ) );
|
||||
add( perfilAScp );
|
||||
|
||||
perfisPanels[ 1 ] = new PerfilProtocoloPanel( grupos, tipos );
|
||||
JScrollPane perfilBScp =
|
||||
new JScrollPane( perfisPanels[ 1 ], JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
|
||||
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
perfilBScp.setBorder( BorderFactory.createTitledBorder(
|
||||
BorderFactory.createEtchedBorder(), "Perfil B" ) );
|
||||
add( perfilBScp );
|
||||
}
|
||||
|
||||
public void fill( Object data )
|
||||
{
|
||||
Vector lists[] = ( Vector [] ) data;
|
||||
perfisPanels[ 0 ].fill( lists[ 0 ] );
|
||||
perfisPanels[ 1 ].fill( lists[ 1 ] );
|
||||
}
|
||||
|
||||
public Object save()
|
||||
{
|
||||
Vector lists[] = new Vector[ 2 ];
|
||||
lists[ 0 ] = ( Vector ) perfisPanels[ 0 ].save();
|
||||
lists[ 1 ] = ( Vector ) perfisPanels[ 1 ].save();
|
||||
return lists;
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enable )
|
||||
{
|
||||
perfisPanels[ 0 ].setEnabled( enable );
|
||||
perfisPanels[ 1 ].setEnabled( enable );
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
perfisPanels[ 0 ].clear();
|
||||
perfisPanels[ 1 ].clear();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,612 @@
|
||||
/*
|
||||
* TrabalhadorPanel.java
|
||||
*
|
||||
* Created on 14 de Maio de 2004, 12:29
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.data.*;
|
||||
import com.evolute.utils.dataui.*;
|
||||
import com.evolute.utils.date.*;
|
||||
import com.evolute.utils.metadb.*;
|
||||
import com.evolute.utils.tables.*;
|
||||
import com.evolute.utils.ui.*;
|
||||
import com.evolute.utils.ui.calendar.*;
|
||||
import com.evolute.utils.ui.panel.*;
|
||||
import com.evolute.utils.ui.text.*;
|
||||
|
||||
import siprp.*;
|
||||
import siprp.data.*;
|
||||
import siprp.importer.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class TrabalhadorPanel extends JPanel
|
||||
implements ControllableComponent, ListSelectionListener, ActionListener
|
||||
{
|
||||
private FichaDataProvider provider;
|
||||
private TrabalhadorData trabalhador;
|
||||
private ComponentsHashtable components;
|
||||
|
||||
private EstabelecimentoData estabelecimento;
|
||||
private JTable estabelecimentosTable;
|
||||
|
||||
private JPanel toolbarPanel;
|
||||
|
||||
private JPanel dadosTrabalhadorPanel;
|
||||
|
||||
private JTextField nomeText;
|
||||
private RadioButtonFixedPanel sexoPanel;
|
||||
private JCalendarPanel dataNascimentoPanel;
|
||||
private JTextField nacionalidadeText;
|
||||
private JTextField numeroMecanograficoText;
|
||||
private JCalendarPanel dataAdmissaoPanel;
|
||||
private JTextField categoriaText;
|
||||
private JTextField localText;
|
||||
private JTextField funcaoText;
|
||||
private JCalendarPanel dataAdmissaoFuncaoPanel;
|
||||
private JCalendarPanel dataDemissaoPanel;
|
||||
private JTextField observacoesText;
|
||||
//private JComboBox perfilCombo;
|
||||
private RadioButtonFixedPanel perfilPanel;
|
||||
|
||||
private SIPRPTracker tracker;
|
||||
|
||||
private BaseTable trabalhadoresTable;
|
||||
private VectorTableModel trabalhadoresModel;
|
||||
|
||||
private JButton marcacoesButton;
|
||||
// private MarcacaoPanel examesPanel;
|
||||
// private MarcacaoPanel consultaPanel;
|
||||
|
||||
private Vector listeners;
|
||||
|
||||
private boolean lastEnable = false;
|
||||
|
||||
/** Creates a new instance of TrabalhadorPanel */
|
||||
public TrabalhadorPanel( JPanel toolbarPanel, JTable estabelecimentosTable )
|
||||
throws Exception
|
||||
{
|
||||
this.toolbarPanel = toolbarPanel;
|
||||
this.estabelecimentosTable = estabelecimentosTable;
|
||||
provider = ( FichaDataProvider )FichaDataProvider.getProvider();
|
||||
listeners = new Vector();
|
||||
setupComponents();
|
||||
setupComponentsHashtable();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
dadosTrabalhadorPanel = new JPanel();
|
||||
// JPanel marcacoesPanel = new JPanel();
|
||||
|
||||
JLabel nomeLabel = new JLabel( "Nome" );
|
||||
nomeText = new JTextField();
|
||||
JLabel sexoLabel = new JLabel( "Sexo" );
|
||||
sexoPanel =
|
||||
new RadioButtonFixedPanel(
|
||||
new IDObject[]{ new MappableObject( new Integer( 1 ), "M" ),
|
||||
new MappableObject( new Integer( 2 ), "F" ) },
|
||||
1, 2, RadioButtonPanel.ORIENTATION_HORIZONTAL, false );
|
||||
JLabel dataNascimentoLabel = new JLabel( "Data de Nascimento" );
|
||||
dataNascimentoPanel = new JCalendarPanel( null );
|
||||
JLabel nacionalidadeLabel = new JLabel( "Nacionalidade" );
|
||||
nacionalidadeText = new JTextField();
|
||||
JLabel numeroMecanograficoLabel = new JLabel( "N\u00famero Mecanogr\u00e1fico/Outro" );
|
||||
numeroMecanograficoText = new JTextField();
|
||||
JLabel dataAdmissaoLabel = new JLabel( "Data de Admiss\u00e3o" );
|
||||
dataAdmissaoPanel = new JCalendarPanel( null );
|
||||
JLabel categoriaLabel = new JLabel( "Categoria Profissional" );
|
||||
categoriaText = new JTextField();
|
||||
JLabel localLabel = new JLabel( "Local de Trabalho" );
|
||||
localText = new JTextField();
|
||||
JLabel funcaoLabel = new JLabel( "Fun\u00e7\u00e3o Proposta" );
|
||||
funcaoText = new JTextField();
|
||||
JLabel dataAdmissaoFuncaoLabel = new JLabel( "Data de Admiss\u00e3o na Fun\u00e7\u00e3o" );
|
||||
dataAdmissaoFuncaoPanel = new JCalendarPanel( null );
|
||||
JLabel perfilLabel = new JLabel( "Perfil" );
|
||||
// perfilCombo = new JComboBox();
|
||||
// perfilCombo.addItem( new MappableObject( new Integer( 1 ), "A" ) );
|
||||
// perfilCombo.addItem( new MappableObject( new Integer( 2 ), "B" ) );
|
||||
perfilPanel = new RadioButtonFixedPanel(
|
||||
new IDObject[]{ new MappableObject( new Integer( 1 ), "A" ),
|
||||
new MappableObject( new Integer( 2 ), "B" ) },
|
||||
1, 2, RadioButtonPanel.ORIENTATION_HORIZONTAL, false );
|
||||
JLabel dataDemissaoLabel = new JLabel( "Data de Demiss\u00e3o" );
|
||||
dataDemissaoPanel = new JCalendarPanel( null );
|
||||
JLabel observacoesLabel = new JLabel( "Observa\u00e7\u00f5es" );
|
||||
observacoesText = new JTextField();
|
||||
marcacoesButton = new JButton( "Marca\u00e7\u00f5es" );
|
||||
marcacoesButton.addActionListener( this );
|
||||
|
||||
JScrollPane trabalhadoresScroll = new JScrollPane();
|
||||
trabalhadoresScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
||||
trabalhadoresScroll.setPreferredSize( new Dimension( 250, 300 ) );
|
||||
trabalhadoresModel = new VectorTableModel( new String[]{ "Trabalhadores" } );
|
||||
trabalhadoresTable = new BaseTable( trabalhadoresModel );
|
||||
trabalhadoresTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
|
||||
trabalhadoresTable.setNonResizableNorReordable();
|
||||
trabalhadoresScroll.setViewportView( trabalhadoresTable );
|
||||
|
||||
JPanel pad;
|
||||
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
dadosTrabalhadorPanel.setLayout( gridbag );
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 1, 1, 1, 1 );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weighty = 0;
|
||||
constraints.gridheight = 1;
|
||||
constraints.gridwidth = 1;
|
||||
constraints.weightx = 0;
|
||||
|
||||
gridbag.setConstraints( nomeLabel, constraints );
|
||||
dadosTrabalhadorPanel.add( nomeLabel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = 3;
|
||||
gridbag.setConstraints( nomeText, constraints );
|
||||
dadosTrabalhadorPanel.add( nomeText );
|
||||
|
||||
constraints.gridwidth = 1;
|
||||
constraints.weightx = 0;
|
||||
gridbag.setConstraints( sexoLabel, constraints );
|
||||
dadosTrabalhadorPanel.add( sexoLabel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
//constraints.gridwidth = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
JPanel sexoOuterPanel = new JPanel();
|
||||
sexoOuterPanel.setLayout( new GridLayout( 1, 2 ) );
|
||||
sexoOuterPanel.add( sexoPanel );
|
||||
sexoOuterPanel.add( new JPanel() );
|
||||
gridbag.setConstraints( sexoOuterPanel, constraints );
|
||||
dadosTrabalhadorPanel.add( sexoOuterPanel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 2;
|
||||
gridbag.setConstraints( nacionalidadeLabel, constraints );
|
||||
dadosTrabalhadorPanel.add( nacionalidadeLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( nacionalidadeText, constraints );
|
||||
dadosTrabalhadorPanel.add( nacionalidadeText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( dataNascimentoLabel, constraints );
|
||||
dadosTrabalhadorPanel.add( dataNascimentoLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( dataNascimentoPanel, constraints );
|
||||
dadosTrabalhadorPanel.add( dataNascimentoPanel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 2;
|
||||
gridbag.setConstraints( numeroMecanograficoLabel, constraints );
|
||||
dadosTrabalhadorPanel.add( numeroMecanograficoLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( numeroMecanograficoText, constraints );
|
||||
dadosTrabalhadorPanel.add( numeroMecanograficoText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( dataAdmissaoLabel, constraints );
|
||||
dadosTrabalhadorPanel.add( dataAdmissaoLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( dataAdmissaoPanel, constraints );
|
||||
dadosTrabalhadorPanel.add( dataAdmissaoPanel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 2;
|
||||
gridbag.setConstraints( categoriaLabel, constraints );
|
||||
dadosTrabalhadorPanel.add( categoriaLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( categoriaText, constraints );
|
||||
dadosTrabalhadorPanel.add( categoriaText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
gridbag.setConstraints( localLabel, constraints );
|
||||
dadosTrabalhadorPanel.add( localLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( localText, constraints );
|
||||
dadosTrabalhadorPanel.add( localText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 2;
|
||||
gridbag.setConstraints( funcaoLabel, constraints );
|
||||
dadosTrabalhadorPanel.add( funcaoLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( funcaoText, constraints );
|
||||
dadosTrabalhadorPanel.add( funcaoText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( dataAdmissaoFuncaoLabel, constraints );
|
||||
dadosTrabalhadorPanel.add( dataAdmissaoFuncaoLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( dataAdmissaoFuncaoPanel, constraints );
|
||||
dadosTrabalhadorPanel.add( dataAdmissaoFuncaoPanel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 2;
|
||||
gridbag.setConstraints( perfilLabel, constraints );
|
||||
dadosTrabalhadorPanel.add( perfilLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = 1;
|
||||
// gridbag.setConstraints( perfilCombo, constraints );
|
||||
// dadosTrabalhadorPanel.add( perfilCombo );
|
||||
gridbag.setConstraints( perfilPanel, constraints );
|
||||
dadosTrabalhadorPanel.add( perfilPanel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( dataDemissaoLabel, constraints );
|
||||
dadosTrabalhadorPanel.add( dataDemissaoLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( dataDemissaoPanel, constraints );
|
||||
dadosTrabalhadorPanel.add( dataDemissaoPanel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( observacoesLabel, constraints );
|
||||
dadosTrabalhadorPanel.add( observacoesLabel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( observacoesText, constraints );
|
||||
dadosTrabalhadorPanel.add( observacoesText );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( marcacoesButton, constraints );
|
||||
dadosTrabalhadorPanel.add( marcacoesButton );
|
||||
|
||||
// examesPanel = new MarcacaoPanel( false, "Realizados", "", Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES );
|
||||
// examesPanel.setCalendarDialogOrientation( JCalendarDialog.ABOVE, JCalendarDialog.RIGHT );
|
||||
// examesPanel.setBorder( BorderFactory.createTitledBorder(
|
||||
// BorderFactory.createEtchedBorder(),
|
||||
// "Exames" ) );
|
||||
// consultaPanel = new MarcacaoPanel( true, "Realizada", "Ficha de Aptid\u00e3o", Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA );
|
||||
// consultaPanel.setCalendarDialogOrientation( JCalendarDialog.ABOVE, JCalendarDialog.LEFT );
|
||||
// consultaPanel.setBorder( BorderFactory.createTitledBorder(
|
||||
// BorderFactory.createEtchedBorder(),
|
||||
// "Consulta" ) );
|
||||
// //marcacoesPanel.setLayout( new BoxLayout( marcacoesPanel, BoxLayout.X_AXIS ) );
|
||||
// marcacoesPanel.setLayout( new GridLayout( 1, 2 ) );
|
||||
// marcacoesPanel.add( examesPanel );
|
||||
// marcacoesPanel.add( consultaPanel );
|
||||
|
||||
JPanel leftPanel = new JPanel();
|
||||
leftPanel.setLayout( new BorderLayout() );
|
||||
leftPanel.add( toolbarPanel, BorderLayout.NORTH );
|
||||
leftPanel.add( trabalhadoresScroll, BorderLayout.CENTER );
|
||||
|
||||
setLayout( new BorderLayout() );
|
||||
add( leftPanel, BorderLayout.WEST );
|
||||
add( dadosTrabalhadorPanel, BorderLayout.CENTER );
|
||||
// add( marcacoesPanel, BorderLayout.SOUTH );
|
||||
|
||||
trabalhadoresTable.getSelectionModel().addListSelectionListener( this );
|
||||
|
||||
new CopyPasteHandler( nomeText );
|
||||
new CopyPasteHandler( nacionalidadeText );
|
||||
new CopyPasteHandler( numeroMecanograficoText );
|
||||
new CopyPasteHandler( categoriaText );
|
||||
new CopyPasteHandler( localText );
|
||||
new CopyPasteHandler( funcaoText );
|
||||
new CopyPasteHandler( observacoesText );
|
||||
}
|
||||
|
||||
private void setupComponentsHashtable()
|
||||
{
|
||||
components = new ComponentsHashtable();
|
||||
components.putComponent( TrabalhadorData.NOME, nomeText );
|
||||
components.putComponent( TrabalhadorData.SEXO, new ControllableComponent()
|
||||
{
|
||||
public void fill( Object value )
|
||||
{
|
||||
if( value != null && value.equals( "f" ) )
|
||||
{
|
||||
sexoPanel.fill( new Integer(2) );
|
||||
}
|
||||
else
|
||||
{
|
||||
sexoPanel.fill( new Integer(1) );
|
||||
}
|
||||
}
|
||||
|
||||
public Object save()
|
||||
{
|
||||
Integer id = (Integer)sexoPanel.save();
|
||||
if( id != null && id.intValue() == 1 )
|
||||
{
|
||||
return "m";
|
||||
}
|
||||
return "f";
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
sexoPanel.clear();
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enable )
|
||||
{
|
||||
sexoPanel.setEnabled( enable );
|
||||
}
|
||||
} );
|
||||
components.putComponent( TrabalhadorData.DATA_NASCIMENTO, dataNascimentoPanel );
|
||||
components.putComponent( TrabalhadorData.NACIONALIDADE, nacionalidadeText );
|
||||
components.putComponent( TrabalhadorData.NUMERO_MECANOGRAFICO, numeroMecanograficoText );
|
||||
components.putComponent( TrabalhadorData.DATA_ADMISSAO, dataAdmissaoPanel );
|
||||
components.putComponent( TrabalhadorData.CATEGORIA, categoriaText );
|
||||
components.putComponent( TrabalhadorData.LOCAL_TRABALHO, localText );
|
||||
components.putComponent( TrabalhadorData.FUNCAO_PROPOSTA, funcaoText );
|
||||
components.putComponent( TrabalhadorData.DATA_ADMISSAO_FUNCAO, dataAdmissaoFuncaoPanel );
|
||||
components.putComponent( TrabalhadorData.DATA_DEMISSAO, dataDemissaoPanel );
|
||||
components.putDummy( TrabalhadorData.OBSERVACOES );
|
||||
components.putComponent( TrabalhadorData.OBSERVACOES_GESTAO, observacoesText );
|
||||
components.putComponent( TrabalhadorData.PERFIL, perfilPanel );
|
||||
// components.putDummy( TrabalhadorData.INACTIVO );
|
||||
components.putDummy( TrabalhadorData.ESTABELECIMENTO );
|
||||
components.putDummy( TrabalhadorData.NOME_PLAIN );
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.clear( names, components );
|
||||
trabalhador = null;
|
||||
}
|
||||
|
||||
public void fill(Object value)
|
||||
{
|
||||
clear();
|
||||
trabalhador = ( TrabalhadorData ) value;
|
||||
// examesPanel.setEnabled( trabalhador != null );
|
||||
// examesPanel.fill( trabalhador );
|
||||
// consultaPanel.setEnabled( trabalhador != null );
|
||||
// consultaPanel.fill( trabalhador );
|
||||
if( trabalhador == null )
|
||||
{
|
||||
trabalhadoresTable.clearSelection();
|
||||
return;
|
||||
}
|
||||
String names[] = trabalhador.getFieldNames();
|
||||
ComponentController.fill( names, trabalhador.getHashData(), components );
|
||||
}
|
||||
|
||||
public Object save()
|
||||
{
|
||||
|
||||
if( trabalhador == null )
|
||||
{
|
||||
trabalhador = new TrabalhadorData();
|
||||
}
|
||||
|
||||
String names[] = trabalhador.getFieldNames();
|
||||
Hashtable hash = new Hashtable();
|
||||
ComponentController.save( names, hash, components );
|
||||
trabalhador.setHashData( hash );
|
||||
trabalhador.set( TrabalhadorData.ESTABELECIMENTO, estabelecimento );
|
||||
return trabalhador;
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enable )
|
||||
{
|
||||
super.setEnabled( enable );
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.setEnabled( names, enable, components );
|
||||
trabalhadoresTable.setEnabled( !enable );
|
||||
if( lastEnable != enable )
|
||||
{
|
||||
if( enable )
|
||||
{
|
||||
EstabelecimentoPanel.disables++;
|
||||
}
|
||||
else
|
||||
{
|
||||
EstabelecimentoPanel.disables--;
|
||||
}
|
||||
lastEnable = enable;
|
||||
}
|
||||
estabelecimentosTable.setEnabled( EstabelecimentoPanel.disables == 0 );
|
||||
// if( trabalhador == null )
|
||||
// {
|
||||
// examesPanel.setEnabled( false );
|
||||
// consultaPanel.setEnabled( false );
|
||||
// }
|
||||
}
|
||||
|
||||
public void reloaList()
|
||||
throws Exception
|
||||
{
|
||||
if( estabelecimento == null )
|
||||
{
|
||||
trabalhadoresModel.clearAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
Integer id = ( Integer )estabelecimento.get( EstabelecimentoData.ID );
|
||||
IDObject []trabalhadores = provider.getAllTrabalhadoresForEstabelecimento( id );
|
||||
trabalhadoresModel.setValues( new Vector( Arrays.asList( trabalhadores ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
public void valueChanged( ListSelectionEvent e )
|
||||
{
|
||||
Object source = e.getSource();
|
||||
if( source instanceof EmpresaPanel )
|
||||
{
|
||||
Integer id = ( ( EmpresaPanel ) source ).getSelectedEstabelecimento();
|
||||
if( id != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
IDObject []trabalhadores = provider.getAllTrabalhadoresForEstabelecimento( id );
|
||||
trabalhadoresModel.setValues( new Vector( Arrays.asList( trabalhadores ) ) );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a carregar os trabalhadores", true );
|
||||
clear();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
trabalhadoresModel.clearAll();
|
||||
clear();
|
||||
}
|
||||
}
|
||||
else if( source.equals( trabalhadoresTable.getSelectionModel() ) )
|
||||
{
|
||||
// int selected = trabalhadoresTable.getSelectedRow();
|
||||
// if( selected == -1 )
|
||||
// {
|
||||
// clear();
|
||||
//
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Integer id = ( ( IDObject ) trabalhadoresModel.getRowAt( selected ) ).getID();;
|
||||
// try
|
||||
// {
|
||||
// TrabalhadorData trabalhador = (TrabalhadorData) TrabalhadorData.load( TrabalhadorData.class, id );
|
||||
// fill( trabalhador );
|
||||
// }
|
||||
// catch( Exception ex )
|
||||
// {
|
||||
// DialogException.showExceptionMessage( ex, "Erro a carregar o trabalhador", true );
|
||||
// clear();
|
||||
// }
|
||||
for( int n = 0; n < listeners.size(); n++ )
|
||||
{
|
||||
ListSelectionEvent newEvent =
|
||||
new ListSelectionEvent( this, e.getFirstIndex(), e.getLastIndex(), e.getValueIsAdjusting() );
|
||||
( (ListSelectionListener) listeners.elementAt( n ) ).valueChanged( newEvent );
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
public void postSave()
|
||||
{
|
||||
int selected = trabalhadoresTable.getSelectedRow();
|
||||
//System.out.println( "postSave TRABALHADOR PANEL " + selected + " : " + ( trabalhador == null ) );
|
||||
if( trabalhador != null )
|
||||
{
|
||||
IDObject obj = new MappableObject( (Integer) trabalhador.get( TrabalhadorData.ID ), trabalhador.get( TrabalhadorData.NOME ) );
|
||||
if( selected == -1 )
|
||||
{
|
||||
trabalhadoresModel.insertRowAt( obj, trabalhadoresTable.getRowCount() );
|
||||
trabalhadoresTable.setRowSelectionInterval( trabalhadoresTable.getRowCount() - 1, trabalhadoresTable.getRowCount() - 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
trabalhadoresModel.removeRowAt( selected );
|
||||
trabalhadoresModel.insertRowAt( obj, selected );
|
||||
trabalhadoresTable.setRowSelectionInterval( selected, selected );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void reload()
|
||||
{
|
||||
fill( trabalhador );
|
||||
}
|
||||
|
||||
public void addListSelectionListener( ListSelectionListener listener )
|
||||
{
|
||||
listeners.add( listener );
|
||||
}
|
||||
|
||||
public void removeListSelectionListener( ListSelectionListener listener )
|
||||
{
|
||||
listeners.remove( listener );
|
||||
}
|
||||
|
||||
public Integer getSelectedTrabalhador()
|
||||
{
|
||||
int selected = trabalhadoresTable.getSelectedRow();
|
||||
if( selected == -1 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return ( (IDObject) trabalhadoresModel.getRowAt( selected ) ).getID();
|
||||
}
|
||||
|
||||
public void setEstabelecimento( EstabelecimentoData estabelecimento )
|
||||
{
|
||||
this.estabelecimento = estabelecimento;
|
||||
}
|
||||
|
||||
public void setSelectedTrabalhador( TrabalhadorData trab )
|
||||
{
|
||||
IDObject lista[] = (IDObject [])trabalhadoresModel.getValues().toArray( new IDObject[ 0 ] );
|
||||
Integer id = (Integer)trab.get( TrabalhadorData.ID );
|
||||
for( int n = 0; n < lista.length; n++ )
|
||||
{
|
||||
if( lista[ n ].getID().equals( id ) )
|
||||
{
|
||||
trabalhadoresTable.setRowSelectionInterval( n, n );
|
||||
return;
|
||||
}
|
||||
}
|
||||
trabalhadoresTable.clearSelection();
|
||||
}
|
||||
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
Object source = e.getSource();
|
||||
if( source.equals( marcacoesButton ) )
|
||||
{
|
||||
if( trabalhador == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
EstabelecimentoData estabelecimento = ( EstabelecimentoData ) trabalhador.get( TrabalhadorData.ESTABELECIMENTO );
|
||||
EmpresaData empresa = ( EmpresaData ) estabelecimento.get( EstabelecimentoData.EMPRESA );
|
||||
tracker.getMedicinaWindow().setVisible( true );
|
||||
tracker.getMedicinaWindow().setEmpresaAndEstabelecimentoAndTrabalhador( (Integer) empresa.get( EmpresaData.ID ),
|
||||
( Integer ) estabelecimento.get( EstabelecimentoData.ID ),
|
||||
( Integer ) trabalhador.get( TrabalhadorData.ID ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setTracker( SIPRPTracker tracker )
|
||||
{
|
||||
this.tracker = tracker;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,156 @@
|
||||
/*
|
||||
* UserDataProvider.java
|
||||
*
|
||||
* Created on 8 de Novembro de 2004, 18:38
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.arrays.*;
|
||||
import com.evolute.utils.data.*;
|
||||
import com.evolute.utils.db.*;
|
||||
import com.evolute.utils.metadb.*;
|
||||
import com.evolute.utils.ui.search.*;
|
||||
import com.evolute.utils.sql.*;
|
||||
|
||||
import siprp.*;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class UserDataProvider extends MetaProvider
|
||||
{
|
||||
private static final String RESERVED_ROLES_MANAGER = "manager";
|
||||
private static final String RESERVED_ROLES_ADMIN = "admin";
|
||||
private static final Object LOCK = new Object();
|
||||
private static UserDataProvider instance = null;
|
||||
private final Executer executer;
|
||||
|
||||
protected final Expression excludeReserved;
|
||||
|
||||
/** Creates a new instance of UserDataProvider */
|
||||
public UserDataProvider()
|
||||
throws Exception
|
||||
{
|
||||
boolean webAware = ( ( Boolean ) Singleton.getInstance( SingletonConstants.WEB_AWARE ) ).booleanValue();
|
||||
DBManager dbm;
|
||||
if( webAware )
|
||||
{
|
||||
String url = ( String ) Singleton.getInstance( SingletonConstants.WEB_URL_PREFIX );
|
||||
url += ( String ) Singleton.getInstance( SingletonConstants.WEB_URL ) + "/";
|
||||
url += ( String ) Singleton.getInstance( SingletonConstants.WEB_DB_NAME ) + "/";
|
||||
String user = ( String ) Singleton.getInstance( SingletonConstants.WEB_USER );
|
||||
String pwd = ( String ) Singleton.getInstance( SingletonConstants.WEB_PASSWORD );
|
||||
dbm = new JDBCManager( url, user, pwd, 10, 8, 8, null );
|
||||
executer = dbm.getSharedExecuter( this );
|
||||
}
|
||||
else
|
||||
{
|
||||
dbm = null;
|
||||
executer = null;
|
||||
}
|
||||
excludeReserved = new Field( "role" ).isDifferent( RESERVED_ROLES_MANAGER ).and(
|
||||
new Field( "role" ).isDifferent( RESERVED_ROLES_ADMIN ) );
|
||||
}
|
||||
|
||||
public static MetaProvider getProvider()
|
||||
throws Exception
|
||||
{
|
||||
synchronized( LOCK )
|
||||
{
|
||||
if( instance == null )
|
||||
{
|
||||
instance = new UserDataProvider();
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public String getUserName( Integer empresaID )
|
||||
throws Exception
|
||||
{
|
||||
System.out.println( "getUserName( " +empresaID+ " )" ) ;
|
||||
Select select = new Select( new String[]{ "roles" }, new String[]{ "username" },
|
||||
new Field( "role" ).isEqual( empresaID == null ? "siprpuser" : empresaID.toString() ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return array.get( 0, 0 ).toString();
|
||||
}
|
||||
|
||||
public void saveUser( String userName, String password, Integer empresaID, boolean isNew )
|
||||
throws Exception
|
||||
{
|
||||
if( isNew )
|
||||
{
|
||||
Insert insert =
|
||||
new Insert( "roles",
|
||||
new Assignment[]{ new Assignment( new Field( "username" ), userName ),
|
||||
new Assignment( new Field( "role" ), empresaID == null ? "siprpuser" : empresaID.toString() ) } );
|
||||
executer.executeQuery( insert, null );
|
||||
insert =
|
||||
new Insert( "users",
|
||||
new Assignment[]{ new Assignment( new Field( "username" ), userName ),
|
||||
new Assignment( new Field( "password" ), password ) } );
|
||||
executer.executeQuery( insert, null );
|
||||
}
|
||||
else
|
||||
{
|
||||
Select select = new Select( new String[]{ "roles" }, new String[]{ "username" },
|
||||
new Field( "role" ).isEqual( empresaID == null ? "siprpuser" : empresaID.toString() ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 )
|
||||
{
|
||||
saveUser( userName, password, empresaID, true );
|
||||
return;
|
||||
}
|
||||
String oldName = array.get( 0, 0 ).toString();
|
||||
Update update =
|
||||
new Update( "roles",
|
||||
new Assignment[]{ new Assignment( new Field( "username" ), userName ),
|
||||
new Assignment( new Field( "role" ), empresaID == null ? "siprpuser" : empresaID.toString() ) },
|
||||
new Field( "username" ).isEqual( oldName ).and( excludeReserved ) );
|
||||
executer.executeQuery( update );
|
||||
update =
|
||||
new Update( "users",
|
||||
new Assignment[]{ new Assignment( new Field( "username" ), userName ),
|
||||
new Assignment( new Field( "password" ), password ) },
|
||||
new Field( "username" ).isEqual( oldName ) );
|
||||
executer.executeQuery( update );
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkNewName( String name, Integer empresaID )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ "roles" }, new String[]{ "username" },
|
||||
new Field( "role" ).isDifferent( empresaID == null ? "siprpuser" : empresaID.toString() ).and(
|
||||
new Field( "lower( username )" ).isEqual( new Field( "lower( '" + name + "' )" ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() != 0 )
|
||||
{
|
||||
if( empresaID != null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
select = new Select( new String[]{ "roles" }, new String[]{ "username" },
|
||||
new Field( "role" ).isEqual( empresaID == null ? "siprpuser" : empresaID.toString() ).and(
|
||||
new Field( "lower( username )" ).isEqual( new Field( "lower( '" + name + "' )" ) ) ) );
|
||||
array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,232 @@
|
||||
/*
|
||||
* UserPanel.java
|
||||
*
|
||||
* Created on 8 de Novembro de 2004, 17:03
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.*;
|
||||
|
||||
import com.evolute.utils.ui.*;
|
||||
import com.evolute.utils.ui.text.*;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class UserPanel extends JPanel
|
||||
implements DocumentListener, FocusListener, ActionListener
|
||||
{
|
||||
private UserDataProvider provider;
|
||||
|
||||
private JTextField userNameText;
|
||||
private JTextField passwordText;
|
||||
private JButton applyButton;
|
||||
private JButton cancelButton;
|
||||
|
||||
private boolean passwordEdited = false;
|
||||
private boolean hasPassword = false;
|
||||
private boolean error = false;
|
||||
private Integer empresaID;
|
||||
|
||||
// public static void main( String args[] )
|
||||
// {
|
||||
// JFrame frame = new JFrame();
|
||||
// frame.setSize( 300, 200 );
|
||||
// frame.getContentPane().setLayout( new GridLayout( 1, 1 ) );
|
||||
// frame.getContentPane().add( new UserPanel() );
|
||||
// frame.show();
|
||||
// }
|
||||
|
||||
/** Creates a new instance of UserPanel */
|
||||
public UserPanel()
|
||||
throws Exception
|
||||
{
|
||||
provider = ( UserDataProvider ) UserDataProvider.getProvider();
|
||||
setupComponents();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
JLabel userNameLabel = new JLabel( "Utilizador" );
|
||||
userNameText = new JTextField();
|
||||
JLabel passwordLabel = new JLabel( "Senha" );
|
||||
passwordText = new JTextField();
|
||||
applyButton = new JButton( "Actualizar" );
|
||||
cancelButton = new JButton( "Cancelar" );
|
||||
|
||||
userNameText.setPreferredSize( new Dimension( 200, 20 ) );
|
||||
passwordText.setPreferredSize( new Dimension( 200, 20 ) );
|
||||
passwordText.setText( "<N\u00e3o Definida>" );
|
||||
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
setLayout( gridbag );
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 1, 1, 1, 1 );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weighty = 0;
|
||||
constraints.gridheight = 1;
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( userNameLabel, constraints );
|
||||
gridbag.setConstraints( passwordLabel, constraints );
|
||||
gridbag.setConstraints( userNameText, constraints );
|
||||
gridbag.setConstraints( passwordText, constraints );
|
||||
JPanel buttonPanel = new JPanel();
|
||||
gridbag.setConstraints( buttonPanel, constraints );
|
||||
|
||||
add( userNameLabel );
|
||||
add( userNameText );
|
||||
add( passwordLabel );
|
||||
add( passwordText );
|
||||
add( buttonPanel );
|
||||
|
||||
buttonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) );
|
||||
buttonPanel.add( applyButton );
|
||||
buttonPanel.add( cancelButton );
|
||||
|
||||
passwordText.addFocusListener( this );
|
||||
passwordText.getDocument().addDocumentListener( this );
|
||||
|
||||
applyButton.addActionListener( this );
|
||||
cancelButton.addActionListener( this );
|
||||
|
||||
new CopyPasteHandler( userNameText );
|
||||
new CopyPasteHandler( passwordText );
|
||||
}
|
||||
|
||||
public void changedUpdate(javax.swing.event.DocumentEvent documentEvent)
|
||||
{
|
||||
passwordEdited = true;
|
||||
}
|
||||
|
||||
public void insertUpdate(javax.swing.event.DocumentEvent documentEvent)
|
||||
{
|
||||
passwordEdited = true;
|
||||
}
|
||||
|
||||
public void removeUpdate(javax.swing.event.DocumentEvent documentEvent)
|
||||
{
|
||||
passwordEdited = true;
|
||||
}
|
||||
|
||||
public void focusGained(java.awt.event.FocusEvent focusEvent)
|
||||
{
|
||||
if( !passwordEdited )
|
||||
{
|
||||
passwordText.getDocument().removeDocumentListener( this );
|
||||
passwordText.setText( "" );
|
||||
passwordText.getDocument().addDocumentListener( this );
|
||||
}
|
||||
}
|
||||
|
||||
public void focusLost(java.awt.event.FocusEvent focusEvent)
|
||||
{
|
||||
}
|
||||
|
||||
public void actionPerformed(java.awt.event.ActionEvent actionEvent)
|
||||
{
|
||||
try
|
||||
{
|
||||
Object source = actionEvent.getSource();
|
||||
if( applyButton.equals( source ) )
|
||||
{
|
||||
if( save() )
|
||||
{
|
||||
hasPassword = true;
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
else if( cancelButton.equals( source ) )
|
||||
{
|
||||
reload();
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro na liga\u00e7\u00e3o \u00e0 Base de Dados WEB", true );
|
||||
}
|
||||
}
|
||||
|
||||
private void refresh()
|
||||
{
|
||||
passwordText.getDocument().removeDocumentListener( this );
|
||||
if( !passwordEdited )
|
||||
{
|
||||
if( hasPassword )
|
||||
{
|
||||
passwordText.setText( "<Definida>" );
|
||||
}
|
||||
else
|
||||
{
|
||||
passwordText.setText( "<N\u00e3o Definida>" );
|
||||
}
|
||||
}
|
||||
passwordText.getDocument().addDocumentListener( this );
|
||||
}
|
||||
|
||||
public void setEmpresaID( Integer empresaID )
|
||||
{
|
||||
try
|
||||
{
|
||||
userNameText.setText( "" );
|
||||
passwordText.setText( "" );
|
||||
passwordEdited = false;
|
||||
hasPassword = false;
|
||||
this.empresaID = empresaID;
|
||||
// if( empresaID == null )
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
reload();
|
||||
refresh();
|
||||
error = false;
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro na liga\u00e7\u00e3o \u00e0 Base de Dados WEB", true );
|
||||
userNameText.setText( "Erro na liga\u00e7\u00e3o" );
|
||||
setEnabled( false );
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean save()
|
||||
throws Exception
|
||||
{
|
||||
if( !provider.checkNewName( userNameText.getText(), empresaID ) )
|
||||
{
|
||||
JOptionPane.showMessageDialog( null, "O Utilizador " + userNameText.getText() + " j\u00e1 est\u00e1 em uso por outra entidade." );
|
||||
return false;
|
||||
}
|
||||
provider.saveUser( userNameText.getText(), passwordText.getText(), empresaID, !hasPassword );
|
||||
passwordEdited = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean reload()
|
||||
throws Exception
|
||||
{
|
||||
String userName = provider.getUserName( empresaID );
|
||||
if( userName != null )
|
||||
{
|
||||
userNameText.setText( userName );
|
||||
hasPassword = true;
|
||||
}
|
||||
passwordEdited = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enable )
|
||||
{
|
||||
userNameText.setEnabled( enable && !error );
|
||||
passwordText.setEnabled( enable && !error );
|
||||
applyButton.setEnabled( enable && !error );
|
||||
cancelButton.setEnabled( enable && !error );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* UserWindow.java
|
||||
*
|
||||
* Created on 15 de Marco de 2005, 11:35
|
||||
*/
|
||||
|
||||
package siprp.clientes;
|
||||
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.jdo.*;
|
||||
import com.evolute.utils.ui.*;
|
||||
|
||||
import siprp.data.*;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class UserWindow extends CustomJDialog
|
||||
{
|
||||
protected JDOProvider JDO;
|
||||
// protected JTextField empresaText;
|
||||
protected UserPanel userPanel;
|
||||
protected Integer empresaID;
|
||||
|
||||
/** Creates a new instance of UserWindow */
|
||||
public UserWindow( JFrame owner, Integer empresaID )
|
||||
throws Exception
|
||||
{
|
||||
super( owner, true );
|
||||
this.empresaID = empresaID;
|
||||
JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
|
||||
setupComponents();
|
||||
centerSuper();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
throws Exception
|
||||
{
|
||||
setSize( 500, 200 );
|
||||
userPanel = new UserPanel();
|
||||
// empresaText = new JTextField();
|
||||
getContentPane().setLayout( new BorderLayout() );
|
||||
// getContentPane().add( empresaText, BorderLayout.NORTH );
|
||||
getContentPane().add( userPanel, BorderLayout.CENTER );
|
||||
|
||||
if( empresaID == null )
|
||||
{
|
||||
// empresaText.setText( "SIPRP" );
|
||||
setTitle( "SIPRP" );
|
||||
}
|
||||
else
|
||||
{
|
||||
EmpresaData empresa = ( EmpresaData )JDO.load( EmpresaData.class, empresaID );
|
||||
if( empresa == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
// empresaText.setText( (String)empresa.get( EmpresaData.DESIGNACAO_SOCIAL ) );
|
||||
setTitle( (String)empresa.get( EmpresaData.DESIGNACAO_SOCIAL ) );
|
||||
}
|
||||
userPanel.setEmpresaID( empresaID );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo">
|
||||
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes"/>
|
||||
<xsl:template match="GUIA">
|
||||
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
|
||||
<fo:layout-master-set>
|
||||
<fo:simple-page-master master-name="simpleA4"
|
||||
page-height="29.7cm"
|
||||
page-width="21cm"
|
||||
margin-top="2cm"
|
||||
margin-bottom="2cm"
|
||||
margin-left="2cm"
|
||||
margin-right="2cm">
|
||||
<fo:region-body />
|
||||
</fo:simple-page-master>
|
||||
</fo:layout-master-set>
|
||||
<fo:page-sequence master-reference="simpleA4">
|
||||
<fo:flow flow-name="xsl-region-body">
|
||||
<fo:table table-layout="fixed" width="100%" space-before.optimum="0pt" space-after.optimum="0pt">
|
||||
<fo:table-column column-width="10cm"/>
|
||||
<fo:table-column/>
|
||||
<fo:table-column/>
|
||||
<fo:table-column/>
|
||||
<fo:table-column/>
|
||||
<fo:table-header>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border="0.7pt solid #000000">
|
||||
<fo:block font-size="10pt" text-align="center" font-weight="bold">
|
||||
Cuidado Prestado
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border="0.7pt solid #000000">
|
||||
<fo:block font-size="10pt" text-align="center" font-weight="bold">
|
||||
Código
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border="0.7pt solid #000000">
|
||||
<fo:block font-size="10pt" text-align="center" font-weight="bold">
|
||||
Valor
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border="0.7pt solid #000000">
|
||||
<fo:block font-size="10pt" text-align="center" font-weight="bold">
|
||||
Benef.
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border="0.7pt solid #000000">
|
||||
<fo:block font-size="10pt" text-align="center" font-weight="bold">
|
||||
Entidade
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</fo:table-header>
|
||||
<fo:table-body>
|
||||
<xsl:for-each select="CORPO/LINHA_CORPO">
|
||||
<fo:table-row>
|
||||
<fo:table-cell border="0.7pt solid #000000">
|
||||
<fo:block font-size="10pt" text-align="left">
|
||||
<xsl:value-of select="PRODUTO/DESCRICAO" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border="0.7pt solid #000000">
|
||||
<fo:block font-size="10pt" text-align="right">
|
||||
<xsl:value-of select="PRODUTO/CODIGO_TABELA" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border="0.7pt solid #000000">
|
||||
<fo:block font-size="10pt" text-align="right">
|
||||
<xsl:value-of select="PRECO/PRECO_TOTAL" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border="0.7pt solid #000000">
|
||||
<fo:block font-size="10pt" text-align="right">
|
||||
<xsl:value-of select="PRECO/PRECO_BENEFICIARIO" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border="0.7pt solid #000000">
|
||||
<fo:block font-size="10pt" text-align="right">
|
||||
<xsl:value-of select="PRECO/PRECO_ENTIDADE" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</xsl:for-each>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
</fo:flow>
|
||||
</fo:page-sequence>
|
||||
</fo:root>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!ELEMENT LISTA_MENSAL (CABECALHO,CORPO,RODAPE)>
|
||||
<!ELEMENT CABECALHO (MES,ANO,DATA)>
|
||||
<!ELEMENT DATA (DIA,MES,ANO)>
|
||||
<!ELEMENT DIA (#PCDATA)>
|
||||
<!ELEMENT MES (#PCDATA)>
|
||||
<!ELEMENT ANO (#PCDATA)>
|
||||
<!ELEMENT CORPO (GUIA*)>
|
||||
<!ELEMENT GUIA (#PCDATA)>
|
||||
<!ELEMENT RODAPE (TOTAL_C?,TOTAL_C_E?,TOTAL_K?,TOTAL_K_E?,TOTAL_E?,NUMERO_GUIAS?)>
|
||||
<!ELEMENT TOTAL_C (#PCDATA)>
|
||||
<!ELEMENT TOTAL_C_E (#PCDATA)>
|
||||
<!ELEMENT TOTAL_K (#PCDATA)>
|
||||
<!ELEMENT TOTAL_K_E (#PCDATA)>
|
||||
<!ELEMENT TOTAL_E (#PCDATA)>
|
||||
<!ELEMENT NUMERO_GUIAS (#PCDATA)>
|
||||
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* SIPRPDataLoader.java
|
||||
*
|
||||
* Created on 25 de Janeiro de 2005, 13:19
|
||||
*/
|
||||
|
||||
package siprp.companydataloaders;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
|
||||
import siprp.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class IBookDataLoader implements CompanyDataLoader
|
||||
{
|
||||
|
||||
/** Creates a new instance of SIPRPDataLoader */
|
||||
public IBookDataLoader()
|
||||
{
|
||||
}
|
||||
|
||||
public void load()
|
||||
{
|
||||
Singleton.setInstance( SingletonConstants.SOFTWARE_NAME, "SHSTSoft" );
|
||||
Singleton.setInstance( SingletonConstants.COMPANY_NAME, "SHST" );
|
||||
Singleton.setInstance( SingletonConstants.COMPANY_LOGO, "logo_evo.jpg" );
|
||||
Singleton.setInstance( SingletonConstants.COMPANY_ACRONYM, "SHST" );
|
||||
Singleton.setInstance( SingletonConstants.SUBJECT_CONSULTA, "SHST - Marca\u00E7\u00E3o de consulta");
|
||||
Singleton.setInstance( SingletonConstants.LETTER_CONSULTA, "Vimos pelo presente informar que '" + NOME + "' dever\u00E1 comparecer "
|
||||
+ "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o da consulta de Medicina "
|
||||
+ "do Trabalho, no dia '" + DATA + "', pelas 08H30."
|
||||
+ "%0A%0A"
|
||||
+ "%0A%0A"
|
||||
+ "Solicitamos, tamb\u00E9m, que o colaborador seja portador do Boletim de Vacinas e "
|
||||
+ "dos \u00FAltimos exames complementares realizados."
|
||||
+ "%0A%0A"
|
||||
+ "%0A%0A"
|
||||
+ "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data "
|
||||
+ "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 212 12 12 "
|
||||
+ "ou respondendo ao remetente desta mensagem."
|
||||
+ "%0A%0A%0A"
|
||||
+ "Cumprimentos,"
|
||||
+ "%0A%0ASHST" );
|
||||
Singleton.setInstance( SingletonConstants.SUBJECT_EXAMES, "SHST - Marca\u00E7\u00E3o de exame");
|
||||
Singleton.setInstance( SingletonConstants.LETTER_EXAMES, "Vimos pelo presente informar que '" + NOME + "' dever\u00E1 comparecer "
|
||||
+ "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o dos exames de Medicina "
|
||||
+ "do Trabalho, no dia '" + DATA + "', pelas 08H30."
|
||||
+ "%0A%0A"
|
||||
+ "Relembramos que o colaborador dever\u00E1 comparecer em jejum."
|
||||
+ "%0A%0A"
|
||||
+ "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data "
|
||||
+ "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 212 12 12 "
|
||||
+ "ou respondendo ao remetente desta mensagem."
|
||||
+ "%0A%0A%0A"
|
||||
+ "Cumprimentos,%0A%0ASHST" );
|
||||
Singleton.setInstance( SingletonConstants.SUBJECT_VISITA, "SHST - Marca\u00E7\u00E3o de visita de higiene e seguran\u00E7a");
|
||||
Singleton.setInstance( SingletonConstants.LETTER_VISITA, "Vimos pelo presente informar que iremos efectuar a auditoria de Higiene e "
|
||||
+ "Seguran\u00E7a \u00E0s vossas instala\u00E7\u00F5es de '" + NOME + "', no dia '" + DATA + "'."
|
||||
+ "%0A%0A"
|
||||
+ "Agradecemos que nos confirme, pela mesma via, o nome do representante "
|
||||
+ "da empresa que nos ir\u00E1 acompanhar e a vossa disponibilidade para a "
|
||||
+ "realiza\u00E7\u00E3o da visita na data indicada."
|
||||
+ "%0A%0A"
|
||||
+ "Caso necessite de qualquer esclarecimento, contacte-nos, por favor, "
|
||||
+ "atrav\u00E9s do telefone 21 212 12 12 "
|
||||
+ "ou responda ao remetente desta mensagem."
|
||||
+ "%0A%0A%0A"
|
||||
+ "Cumprimentos,%0A%0ASHST" );
|
||||
Singleton.setInstance( SingletonConstants.USES_HOUR, Boolean.FALSE );
|
||||
Singleton.setInstance( SingletonConstants.CODIGO_EMPRESA_FORMAT, "2 6 / 2" );
|
||||
Singleton.setInstance( SingletonConstants.FICHA_MARCA_EXAMES, Boolean.TRUE );
|
||||
Singleton.setInstance( SingletonConstants.EXCEL_FORMAT, new int[]{ 0, 2, 3, 1, -1, 4, 5, 7, 6, -1 } );
|
||||
|
||||
Singleton.setInstance( SingletonConstants.MODULE_FICHA, Boolean.TRUE );
|
||||
Singleton.setInstance( SingletonConstants.MODULE_CLIENTES, Boolean.TRUE );
|
||||
Singleton.setInstance( SingletonConstants.WEB_AWARE, Boolean.FALSE );
|
||||
Singleton.setInstance( SingletonConstants.MODULE_RELATORIO, Boolean.TRUE );
|
||||
Singleton.setInstance( SingletonConstants.MODULE_LISTAGENS, Boolean.TRUE );
|
||||
|
||||
Singleton.setInstance( SingletonConstants.WEB_USER, "" );
|
||||
Singleton.setInstance( SingletonConstants.WEB_PASSWORD, "" );
|
||||
Singleton.setInstance( SingletonConstants.WEB_URL_PREFIX, "" );
|
||||
Singleton.setInstance( SingletonConstants.WEB_URL, "" );
|
||||
Singleton.setInstance( SingletonConstants.WEB_DB_NAME, "" );
|
||||
Singleton.setInstance( SingletonConstants.WEB_DRIVER_NAME, "" );
|
||||
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_URL, "192.168.1.1:5432" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" );
|
||||
|
||||
Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" );
|
||||
Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" );
|
||||
Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" );
|
||||
Singleton.setInstance( SingletonConstants.LOCAL_URL, "localhost:5432" );
|
||||
Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" );
|
||||
Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" );
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* SIPRPDataLoader.java
|
||||
*
|
||||
* Created on 25 de Janeiro de 2005, 13:19
|
||||
*/
|
||||
|
||||
package siprp.companydataloaders;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
|
||||
import siprp.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class SIPRPDataLoader implements CompanyDataLoader
|
||||
{
|
||||
|
||||
/** Creates a new instance of SIPRPDataLoader */
|
||||
public SIPRPDataLoader()
|
||||
{
|
||||
}
|
||||
|
||||
public void load()
|
||||
{
|
||||
Singleton.setInstance( SingletonConstants.SOFTWARE_NAME, "SIPRPSoft" );
|
||||
Singleton.setInstance( SingletonConstants.COMPANY_NAME, "SIPRP - Sociedade Ib\u00e9rica de Preven\u00e7\u00e3o de Riscos Profissionais" );
|
||||
Singleton.setInstance( SingletonConstants.COMPANY_LOGO, "logo_combo.jpg" );
|
||||
Singleton.setInstance( SingletonConstants.COMPANY_ACRONYM, "SIPRP" );
|
||||
Singleton.setInstance( SingletonConstants.SUBJECT_CONSULTA, "SIPRP - Marca\u00E7\u00E3o de consulta de '" + NOME + "'");
|
||||
Singleton.setInstance( SingletonConstants.LETTER_CONSULTA, "Vimos pelo presente informar que '" + NOME + "' dever\u00E1 comparecer "
|
||||
+ "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o da consulta de Medicina "
|
||||
+ "do Trabalho, no dia '" + DATA + "', pelas 08H30."
|
||||
+ "%0A%0A"
|
||||
+ "%0A%0A"
|
||||
+ "Solicitamos, tamb\u00E9m, que o colaborador seja portador do Boletim de Vacinas e "
|
||||
+ "dos \u00FAltimos exames complementares realizados."
|
||||
+ "%0A%0A"
|
||||
+ "%0A%0A"
|
||||
+ "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data "
|
||||
+ "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 350 45 40 "
|
||||
+ "ou respondendo ao remetente desta mensagem."
|
||||
+ "%0A%0A%0A"
|
||||
+ "Cumprimentos,"
|
||||
+ "%0A%0ASIPRP"
|
||||
+ "%0A%0AATRIUM SALDANHA"
|
||||
+ "%0A%0APra\u00e7a Duque de Saldanha, 1 - 9\u00BAG"
|
||||
+ "%0A%0A1050-094 Lisboa" );
|
||||
Singleton.setInstance( SingletonConstants.SUBJECT_EXAMES, "SIPRP - Marca\u00E7\u00E3o de exame de '" + NOME + "'");
|
||||
Singleton.setInstance( SingletonConstants.LETTER_EXAMES, "Vimos pelo presente informar que '" + NOME + "' dever\u00E1 comparecer "
|
||||
+ "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o dos exames de Medicina "
|
||||
+ "do Trabalho, no dia '" + DATA + "', pelas 08H30."
|
||||
+ "%0A%0A"
|
||||
+ "Relembramos que o colaborador dever\u00E1 comparecer em jejum."
|
||||
+ "%0A%0A"
|
||||
+ "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data "
|
||||
+ "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 350 45 40 "
|
||||
+ "ou respondendo ao remetente desta mensagem."
|
||||
+ "%0A%0A%0A"
|
||||
+ "Cumprimentos,%0A%0ASIPRP" );
|
||||
Singleton.setInstance( SingletonConstants.SUBJECT_VISITA, "SIPRP - Marca\u00E7\u00E3o de visita de higiene e seguran\u00E7a a '" + NOME + "'" );
|
||||
Singleton.setInstance( SingletonConstants.LETTER_VISITA, "Vimos pelo presente informar que iremos efectuar a auditoria de Higiene e "
|
||||
+ "Seguran\u00E7a \u00E0s vossas instala\u00E7\u00F5es de '" + NOME + "', no dia '" + DATA + "'."
|
||||
+ "%0A%0A"
|
||||
+ "Agradecemos que nos confirme, pela mesma via, o nome do representante "
|
||||
+ "da empresa que nos ir\u00E1 acompanhar e a vossa disponibilidade para a "
|
||||
+ "realiza\u00E7\u00E3o da visita na data indicada."
|
||||
+ "%0A%0A"
|
||||
+ "Caso necessite de qualquer esclarecimento, contacte-nos, por favor, "
|
||||
+ "atrav\u00E9s dos telefones 21 350 45 43 (Pedro Vieira), 21 350 45 44 "
|
||||
+ "(Catarina Leonardo) ou responda ao remetente desta mensagem."
|
||||
+ "%0A%0A%0A"
|
||||
+ "Cumprimentos,%0A%0ASIPRP" );
|
||||
Singleton.setInstance( SingletonConstants.USES_HOUR, Boolean.FALSE );
|
||||
Singleton.setInstance( SingletonConstants.CODIGO_EMPRESA_FORMAT, "2 6 / 2" );
|
||||
Singleton.setInstance( SingletonConstants.FICHA_MARCA_EXAMES, Boolean.TRUE );
|
||||
Singleton.setInstance( SingletonConstants.EXCEL_FORMAT, new int[]{ 0, 2, 3, 1, -1, 4, 5, 7, 6, -1 } );
|
||||
Singleton.setInstance( SingletonConstants.EXCEL_FORMAT_DEMISSAO, new int[]{ 0, 1 } );
|
||||
|
||||
Singleton.setInstance( SingletonConstants.MODULE_FICHA, Boolean.TRUE );
|
||||
Singleton.setInstance( SingletonConstants.MODULE_CLIENTES, Boolean.TRUE );
|
||||
Singleton.setInstance( SingletonConstants.WEB_AWARE, Boolean.TRUE );
|
||||
Singleton.setInstance( SingletonConstants.MODULE_RELATORIO, Boolean.TRUE );
|
||||
Singleton.setInstance( SingletonConstants.MODULE_LISTAGENS, Boolean.TRUE );
|
||||
|
||||
Singleton.setInstance( SingletonConstants.WEB_USER, "siprp" );
|
||||
Singleton.setInstance( SingletonConstants.WEB_PASSWORD, "rg2h-opksiprp" );
|
||||
Singleton.setInstance( SingletonConstants.WEB_URL_PREFIX, "jdbc:postgresql://" );
|
||||
Singleton.setInstance( SingletonConstants.WEB_URL, "www.evolute.pt:5436" );
|
||||
Singleton.setInstance( SingletonConstants.WEB_DB_NAME, "siprp" );
|
||||
Singleton.setInstance( SingletonConstants.WEB_DRIVER_NAME, "org.postgresql.Driver" );
|
||||
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_USER, "slony" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "-rg2hevoevo" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_URL, "www.evolute.pt:5436" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local_3" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" );
|
||||
|
||||
Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" );
|
||||
Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" );
|
||||
Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" );
|
||||
Singleton.setInstance( SingletonConstants.LOCAL_URL, "10.158.2.3:5432" );
|
||||
Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" );
|
||||
Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" );
|
||||
//
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_URL, "localhost:5432" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" );
|
||||
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_URL, "192.168.1.1:5432" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" );
|
||||
// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" );
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* StampSaveHandler.java
|
||||
*
|
||||
* Created on 15 de Marco de 2005, 15:00
|
||||
*/
|
||||
|
||||
package siprp.data;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.jdo.*;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class ActualizacaoSaveHandler implements JDOOperationHandlerInterface
|
||||
{
|
||||
public static final ActualizacaoSaveHandler INSTANCE = new ActualizacaoSaveHandler();
|
||||
|
||||
/** Creates a new instance of StampSaveHandler */
|
||||
public ActualizacaoSaveHandler()
|
||||
{
|
||||
}
|
||||
|
||||
public boolean handle(JDOObject object, int operation, int moment) throws Exception
|
||||
{
|
||||
if( !( object instanceof ActualizacaoSaveable ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
switch( operation )
|
||||
{
|
||||
case OP_SAVE:
|
||||
return save( object, moment );
|
||||
|
||||
case OP_DELETE:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean save( JDOObject object, int moment )
|
||||
{
|
||||
if( moment != MOMENT_BEFORE )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
object.set( ActualizacaoSaveable.ACTUALIZACAO, new Date() );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* ActualizacaoSaveable.java
|
||||
*
|
||||
* Created on 15 de Marco de 2005, 15:32
|
||||
*/
|
||||
|
||||
package siprp.data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public interface ActualizacaoSaveable
|
||||
{
|
||||
public static final String ACTUALIZACAO = "actualizacao";
|
||||
}
|
||||
@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Aviso.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 13/Out/2004
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.Date;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class Aviso implements JDOInnerObject
|
||||
{
|
||||
private Integer id;
|
||||
private Integer tipo;
|
||||
private Empresa empresa;
|
||||
private Estabelecimento estabelecimento;
|
||||
private Trabalhador trabalhador;
|
||||
private Integer evento_id;
|
||||
private Date data_aviso;
|
||||
private Date data_evento;
|
||||
private String descricao;
|
||||
|
||||
public Aviso()
|
||||
{
|
||||
}
|
||||
|
||||
public Object getField( String fieldName )
|
||||
{
|
||||
if( fieldName == AvisoData.ID )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName == AvisoData.TIPO )
|
||||
{
|
||||
return tipo;
|
||||
}
|
||||
else if( fieldName == AvisoData.EMPRESA )
|
||||
{
|
||||
return empresa;
|
||||
}
|
||||
else if( fieldName == AvisoData.ESTABELECIMENTO )
|
||||
{
|
||||
return estabelecimento;
|
||||
}
|
||||
else if( fieldName == AvisoData.TRABALHADOR )
|
||||
{
|
||||
return trabalhador;
|
||||
}
|
||||
else if( fieldName == AvisoData.EVENTO_ID )
|
||||
{
|
||||
return evento_id;
|
||||
}
|
||||
else if( fieldName == AvisoData.DATA_AVISO )
|
||||
{
|
||||
return data_aviso;
|
||||
}
|
||||
else if( fieldName == AvisoData.DATA_EVENTO )
|
||||
{
|
||||
return data_evento;
|
||||
}
|
||||
else if( fieldName == AvisoData.DESCRICAO )
|
||||
{
|
||||
return descricao;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.ID ) )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.TIPO ) )
|
||||
{
|
||||
return tipo;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.EMPRESA ) )
|
||||
{
|
||||
return empresa;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.ESTABELECIMENTO ) )
|
||||
{
|
||||
return estabelecimento;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.TRABALHADOR ) )
|
||||
{
|
||||
return trabalhador;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.EVENTO_ID ) )
|
||||
{
|
||||
return evento_id;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.DATA_AVISO ) )
|
||||
{
|
||||
return data_aviso;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.DATA_EVENTO ) )
|
||||
{
|
||||
return data_evento;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.DESCRICAO ) )
|
||||
{
|
||||
return descricao;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setField( String fieldName, Object value )
|
||||
{
|
||||
if( fieldName == AvisoData.ID )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == AvisoData.TIPO )
|
||||
{
|
||||
tipo = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == AvisoData.EMPRESA )
|
||||
{
|
||||
empresa = ( Empresa ) value;
|
||||
}
|
||||
else if( fieldName == AvisoData.ESTABELECIMENTO )
|
||||
{
|
||||
estabelecimento = ( Estabelecimento ) value;
|
||||
}
|
||||
else if( fieldName == AvisoData.TRABALHADOR )
|
||||
{
|
||||
trabalhador = ( Trabalhador ) value;
|
||||
}
|
||||
else if( fieldName == AvisoData.EVENTO_ID )
|
||||
{
|
||||
evento_id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == AvisoData.DATA_AVISO )
|
||||
{
|
||||
data_aviso = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == AvisoData.DATA_EVENTO )
|
||||
{
|
||||
data_evento = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == AvisoData.DESCRICAO )
|
||||
{
|
||||
descricao = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.ID ) )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.TIPO ) )
|
||||
{
|
||||
tipo = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.EMPRESA ) )
|
||||
{
|
||||
empresa = ( Empresa ) value;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.ESTABELECIMENTO ) )
|
||||
{
|
||||
estabelecimento = ( Estabelecimento ) value;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.TRABALHADOR ) )
|
||||
{
|
||||
trabalhador = ( Trabalhador ) value;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.EVENTO_ID ) )
|
||||
{
|
||||
evento_id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.DATA_AVISO ) )
|
||||
{
|
||||
data_aviso = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.DATA_EVENTO ) )
|
||||
{
|
||||
data_evento = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( AvisoData.DESCRICAO ) )
|
||||
{
|
||||
descricao = ( String ) value;
|
||||
}
|
||||
}
|
||||
|
||||
public Class getOuterClass()
|
||||
{
|
||||
return AvisoData.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* AvisoConstants.java
|
||||
*
|
||||
* Created on 11 de Outubro de 2004, 13:03
|
||||
*/
|
||||
|
||||
package siprp.data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public interface AvisoConstants
|
||||
{
|
||||
public static final int TIPO_TRABALHADOR = 0;
|
||||
public static final int TIPO_ESTABELECIMENTO = 1;
|
||||
public static final int TIPO_EMPRESA = 2;
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* AvisoData.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 13/Out/2004
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class AvisoData extends JDOObject
|
||||
implements AvisoConstants
|
||||
{
|
||||
public static final String ID = "id";
|
||||
public static final String TIPO = "tipo";
|
||||
public static final String EMPRESA = "empresa";
|
||||
public static final String ESTABELECIMENTO = "estabelecimento";
|
||||
public static final String TRABALHADOR = "trabalhador";
|
||||
public static final String EVENTO_ID = "evento_id";
|
||||
public static final String DATA_AVISO = "data_aviso";
|
||||
public static final String DATA_EVENTO = "data_evento";
|
||||
public static final String DESCRICAO = "descricao";
|
||||
|
||||
public static final String FIELD_NAMES[] = new String[]{
|
||||
TIPO, EMPRESA, ESTABELECIMENTO, TRABALHADOR, EVENTO_ID, DATA_AVISO, DATA_EVENTO,
|
||||
DESCRICAO, };
|
||||
|
||||
|
||||
protected static final String ALL_FIELD_NAMES[] = new String[]{
|
||||
ID, TIPO, EMPRESA, ESTABELECIMENTO, TRABALHADOR, EVENTO_ID, DATA_AVISO, DATA_EVENTO,
|
||||
DESCRICAO, };
|
||||
|
||||
private HashMap dataHash;
|
||||
|
||||
public AvisoData()
|
||||
{
|
||||
dataHash = new HashMap();
|
||||
}
|
||||
|
||||
protected Object innerGet( String fieldName )
|
||||
throws Exception
|
||||
{
|
||||
return dataHash.get( fieldName );
|
||||
}
|
||||
|
||||
protected void innerSet( String fieldName, Object value )
|
||||
throws Exception
|
||||
{
|
||||
dataHash.put( fieldName, value );
|
||||
}
|
||||
|
||||
public String []getFieldNames()
|
||||
{
|
||||
return FIELD_NAMES;
|
||||
}
|
||||
|
||||
protected String []getAllFieldNames()
|
||||
{
|
||||
return ALL_FIELD_NAMES;
|
||||
}
|
||||
|
||||
public Class getInnerClass()
|
||||
{
|
||||
return Aviso.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* AvisoID.java
|
||||
*
|
||||
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 13/Out/2004
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import com.evolute.utils.jdo.jpox.*;
|
||||
|
||||
public final class AvisoID extends IntegerID
|
||||
{
|
||||
public AvisoID()
|
||||
{
|
||||
}
|
||||
|
||||
public AvisoID( String str )
|
||||
{
|
||||
super( str );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Contacto.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 13/Out/2004
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.Date;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class Contacto implements JDOInnerObject
|
||||
{
|
||||
private Integer id;
|
||||
private String nome;
|
||||
private String cargo;
|
||||
private String telefone;
|
||||
private String telemovel;
|
||||
private String fax;
|
||||
private String email;
|
||||
|
||||
public Contacto()
|
||||
{
|
||||
}
|
||||
|
||||
public Object getField( String fieldName )
|
||||
{
|
||||
if( fieldName == ContactoData.ID )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName == ContactoData.NOME )
|
||||
{
|
||||
return nome;
|
||||
}
|
||||
else if( fieldName == ContactoData.CARGO )
|
||||
{
|
||||
return cargo;
|
||||
}
|
||||
else if( fieldName == ContactoData.TELEFONE )
|
||||
{
|
||||
return telefone;
|
||||
}
|
||||
else if( fieldName == ContactoData.TELEMOVEL )
|
||||
{
|
||||
return telemovel;
|
||||
}
|
||||
else if( fieldName == ContactoData.FAX )
|
||||
{
|
||||
return fax;
|
||||
}
|
||||
else if( fieldName == ContactoData.EMAIL )
|
||||
{
|
||||
return email;
|
||||
}
|
||||
else if( fieldName.equals( ContactoData.ID ) )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName.equals( ContactoData.NOME ) )
|
||||
{
|
||||
return nome;
|
||||
}
|
||||
else if( fieldName.equals( ContactoData.CARGO ) )
|
||||
{
|
||||
return cargo;
|
||||
}
|
||||
else if( fieldName.equals( ContactoData.TELEFONE ) )
|
||||
{
|
||||
return telefone;
|
||||
}
|
||||
else if( fieldName.equals( ContactoData.TELEMOVEL ) )
|
||||
{
|
||||
return telemovel;
|
||||
}
|
||||
else if( fieldName.equals( ContactoData.FAX ) )
|
||||
{
|
||||
return fax;
|
||||
}
|
||||
else if( fieldName.equals( ContactoData.EMAIL ) )
|
||||
{
|
||||
return email;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setField( String fieldName, Object value )
|
||||
{
|
||||
if( fieldName == ContactoData.ID )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == ContactoData.NOME )
|
||||
{
|
||||
nome = ( String ) value;
|
||||
}
|
||||
else if( fieldName == ContactoData.CARGO )
|
||||
{
|
||||
cargo = ( String ) value;
|
||||
}
|
||||
else if( fieldName == ContactoData.TELEFONE )
|
||||
{
|
||||
telefone = ( String ) value;
|
||||
}
|
||||
else if( fieldName == ContactoData.TELEMOVEL )
|
||||
{
|
||||
telemovel = ( String ) value;
|
||||
}
|
||||
else if( fieldName == ContactoData.FAX )
|
||||
{
|
||||
fax = ( String ) value;
|
||||
}
|
||||
else if( fieldName == ContactoData.EMAIL )
|
||||
{
|
||||
email = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( ContactoData.ID ) )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( ContactoData.NOME ) )
|
||||
{
|
||||
nome = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( ContactoData.CARGO ) )
|
||||
{
|
||||
cargo = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( ContactoData.TELEFONE ) )
|
||||
{
|
||||
telefone = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( ContactoData.TELEMOVEL ) )
|
||||
{
|
||||
telemovel = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( ContactoData.FAX ) )
|
||||
{
|
||||
fax = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( ContactoData.EMAIL ) )
|
||||
{
|
||||
email = ( String ) value;
|
||||
}
|
||||
}
|
||||
|
||||
public Class getOuterClass()
|
||||
{
|
||||
return ContactoData.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* ContactoData.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 13/Out/2004
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class ContactoData extends JDOObject
|
||||
{
|
||||
public static final String ID = "id";
|
||||
public static final String NOME = "nome";
|
||||
public static final String CARGO = "cargo";
|
||||
public static final String TELEFONE = "telefone";
|
||||
public static final String TELEMOVEL = "telemovel";
|
||||
public static final String FAX = "fax";
|
||||
public static final String EMAIL = "email";
|
||||
|
||||
public static final String FIELD_NAMES[] = new String[]{
|
||||
NOME, CARGO, TELEFONE, TELEMOVEL, FAX, EMAIL, };
|
||||
|
||||
|
||||
protected static final String ALL_FIELD_NAMES[] = new String[]{
|
||||
ID, NOME, CARGO, TELEFONE, TELEMOVEL, FAX, EMAIL, };
|
||||
|
||||
private HashMap dataHash;
|
||||
|
||||
public ContactoData()
|
||||
{
|
||||
dataHash = new HashMap();
|
||||
}
|
||||
|
||||
protected Object innerGet( String fieldName )
|
||||
throws Exception
|
||||
{
|
||||
return dataHash.get( fieldName );
|
||||
}
|
||||
|
||||
protected void innerSet( String fieldName, Object value )
|
||||
throws Exception
|
||||
{
|
||||
dataHash.put( fieldName, value );
|
||||
}
|
||||
|
||||
public String []getFieldNames()
|
||||
{
|
||||
return FIELD_NAMES;
|
||||
}
|
||||
|
||||
protected String []getAllFieldNames()
|
||||
{
|
||||
return ALL_FIELD_NAMES;
|
||||
}
|
||||
|
||||
public Class getInnerClass()
|
||||
{
|
||||
return Contacto.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* ContactoID.java
|
||||
*
|
||||
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 13/Out/2004
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import com.evolute.utils.jdo.jpox.*;
|
||||
|
||||
public final class ContactoID extends IntegerID
|
||||
{
|
||||
public ContactoID()
|
||||
{
|
||||
}
|
||||
|
||||
public ContactoID( String str )
|
||||
{
|
||||
super( str );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* DeleteHandler.java
|
||||
*
|
||||
* Created on 11 de Outubro de 2004, 16:04
|
||||
*/
|
||||
|
||||
package siprp.data;
|
||||
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class DisableDeleteHandler implements JDOOperationHandlerInterface
|
||||
{
|
||||
public static final DisableDeleteHandler INSTANCE = new DisableDeleteHandler();
|
||||
|
||||
/** Creates a new instance of DeleteHandler */
|
||||
public DisableDeleteHandler()
|
||||
{
|
||||
}
|
||||
|
||||
public boolean handle( JDOObject object, int operation, int moment )
|
||||
throws Exception
|
||||
{
|
||||
if( !( object instanceof DisableDeleteable ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
switch( operation )
|
||||
{
|
||||
case OP_SAVE:
|
||||
return save( object, moment );
|
||||
|
||||
case OP_DELETE:
|
||||
return delete( object, moment );
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean save( JDOObject object, int moment )
|
||||
throws Exception
|
||||
{
|
||||
if( moment != MOMENT_BEFORE )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
String old = (String) object.get( DisableDeleteable.INACTIVO );
|
||||
if( old == null )
|
||||
{
|
||||
object.set( DisableDeleteable.INACTIVO, "n" );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean delete( JDOObject object, int moment )
|
||||
throws Exception
|
||||
{
|
||||
if( moment != MOMENT_INSTEAD )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
object.set( DisableDeleteable.INACTIVO, "y" );
|
||||
object.save();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* DisableDeleteable.java
|
||||
*
|
||||
* Created on 11 de Outubro de 2004, 16:09
|
||||
*/
|
||||
|
||||
package siprp.data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public interface DisableDeleteable
|
||||
{
|
||||
public static final String INACTIVO = "inactivo";
|
||||
}
|
||||
@ -0,0 +1,747 @@
|
||||
/*
|
||||
* Empresa.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 17/Mai/2006
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.Date;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class Empresa implements JDOInnerObject
|
||||
{
|
||||
private Integer id;
|
||||
private String designacao_social;
|
||||
private String designacao_social_plain;
|
||||
private Integer servico_saude_tipo;
|
||||
private String servico_saude_designacao;
|
||||
private Integer servico_higiene_tipo;
|
||||
private String servico_higiene_designacao;
|
||||
private String morada;
|
||||
private String codigo_postal;
|
||||
private String localidade;
|
||||
private String distrito;
|
||||
private String concelho;
|
||||
private Date data_proposta;
|
||||
private Date data_aceitacao;
|
||||
private Date inicio_contrato;
|
||||
private Integer duracao;
|
||||
private Date data_cancelamento;
|
||||
private String perfil_1;
|
||||
private String perfil_2;
|
||||
private Date data_envio_contrato;
|
||||
private Date data_recepcao_contrato;
|
||||
private Date data_envio_idict;
|
||||
private Date data_relatorio_anual;
|
||||
private String codigo_1;
|
||||
private String codigo_2;
|
||||
private String codigo_3;
|
||||
private String cae;
|
||||
private String actividade;
|
||||
private String contribuinte;
|
||||
private String seguranca_social;
|
||||
private Double preco_higiene;
|
||||
private Double preco_medicina;
|
||||
private String periodicidade;
|
||||
private Contacto contacto_1;
|
||||
private Contacto contacto_2;
|
||||
private Integer servicos;
|
||||
private String inactivo;
|
||||
private Date actualizacao;
|
||||
private String a_consultas;
|
||||
private String a_exames;
|
||||
private String b_consultas;
|
||||
private String b_exames;
|
||||
|
||||
public Empresa()
|
||||
{
|
||||
}
|
||||
|
||||
public Object getField( String fieldName )
|
||||
{
|
||||
if( fieldName == EmpresaData.ID )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DESIGNACAO_SOCIAL )
|
||||
{
|
||||
return designacao_social;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DESIGNACAO_SOCIAL_PLAIN )
|
||||
{
|
||||
return designacao_social_plain;
|
||||
}
|
||||
else if( fieldName == EmpresaData.SERVICO_SAUDE_TIPO )
|
||||
{
|
||||
return servico_saude_tipo;
|
||||
}
|
||||
else if( fieldName == EmpresaData.SERVICO_SAUDE_DESIGNACAO )
|
||||
{
|
||||
return servico_saude_designacao;
|
||||
}
|
||||
else if( fieldName == EmpresaData.SERVICO_HIGIENE_TIPO )
|
||||
{
|
||||
return servico_higiene_tipo;
|
||||
}
|
||||
else if( fieldName == EmpresaData.SERVICO_HIGIENE_DESIGNACAO )
|
||||
{
|
||||
return servico_higiene_designacao;
|
||||
}
|
||||
else if( fieldName == EmpresaData.MORADA )
|
||||
{
|
||||
return morada;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CODIGO_POSTAL )
|
||||
{
|
||||
return codigo_postal;
|
||||
}
|
||||
else if( fieldName == EmpresaData.LOCALIDADE )
|
||||
{
|
||||
return localidade;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DISTRITO )
|
||||
{
|
||||
return distrito;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CONCELHO )
|
||||
{
|
||||
return concelho;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DATA_PROPOSTA )
|
||||
{
|
||||
return data_proposta;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DATA_ACEITACAO )
|
||||
{
|
||||
return data_aceitacao;
|
||||
}
|
||||
else if( fieldName == EmpresaData.INICIO_CONTRATO )
|
||||
{
|
||||
return inicio_contrato;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DURACAO )
|
||||
{
|
||||
return duracao;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DATA_CANCELAMENTO )
|
||||
{
|
||||
return data_cancelamento;
|
||||
}
|
||||
else if( fieldName == EmpresaData.PERFIL_1 )
|
||||
{
|
||||
return perfil_1;
|
||||
}
|
||||
else if( fieldName == EmpresaData.PERFIL_2 )
|
||||
{
|
||||
return perfil_2;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DATA_ENVIO_CONTRATO )
|
||||
{
|
||||
return data_envio_contrato;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DATA_RECEPCAO_CONTRATO )
|
||||
{
|
||||
return data_recepcao_contrato;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DATA_ENVIO_IDICT )
|
||||
{
|
||||
return data_envio_idict;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DATA_RELATORIO_ANUAL )
|
||||
{
|
||||
return data_relatorio_anual;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CODIGO_1 )
|
||||
{
|
||||
return codigo_1;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CODIGO_2 )
|
||||
{
|
||||
return codigo_2;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CODIGO_3 )
|
||||
{
|
||||
return codigo_3;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CAE )
|
||||
{
|
||||
return cae;
|
||||
}
|
||||
else if( fieldName == EmpresaData.ACTIVIDADE )
|
||||
{
|
||||
return actividade;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CONTRIBUINTE )
|
||||
{
|
||||
return contribuinte;
|
||||
}
|
||||
else if( fieldName == EmpresaData.SEGURANCA_SOCIAL )
|
||||
{
|
||||
return seguranca_social;
|
||||
}
|
||||
else if( fieldName == EmpresaData.PRECO_HIGIENE )
|
||||
{
|
||||
return preco_higiene;
|
||||
}
|
||||
else if( fieldName == EmpresaData.PRECO_MEDICINA )
|
||||
{
|
||||
return preco_medicina;
|
||||
}
|
||||
else if( fieldName == EmpresaData.PERIODICIDADE )
|
||||
{
|
||||
return periodicidade;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CONTACTO_1 )
|
||||
{
|
||||
return contacto_1;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CONTACTO_2 )
|
||||
{
|
||||
return contacto_2;
|
||||
}
|
||||
else if( fieldName == EmpresaData.SERVICOS )
|
||||
{
|
||||
return servicos;
|
||||
}
|
||||
else if( fieldName == EmpresaData.INACTIVO )
|
||||
{
|
||||
return inactivo;
|
||||
}
|
||||
else if( fieldName == EmpresaData.ACTUALIZACAO )
|
||||
{
|
||||
return actualizacao;
|
||||
}
|
||||
else if( fieldName == EmpresaData.A_CONSULTAS )
|
||||
{
|
||||
return a_consultas;
|
||||
}
|
||||
else if( fieldName == EmpresaData.A_EXAMES )
|
||||
{
|
||||
return a_exames;
|
||||
}
|
||||
else if( fieldName == EmpresaData.B_CONSULTAS )
|
||||
{
|
||||
return b_consultas;
|
||||
}
|
||||
else if( fieldName == EmpresaData.B_EXAMES )
|
||||
{
|
||||
return b_exames;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.ID ) )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DESIGNACAO_SOCIAL ) )
|
||||
{
|
||||
return designacao_social;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DESIGNACAO_SOCIAL_PLAIN ) )
|
||||
{
|
||||
return designacao_social_plain;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.SERVICO_SAUDE_TIPO ) )
|
||||
{
|
||||
return servico_saude_tipo;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.SERVICO_SAUDE_DESIGNACAO ) )
|
||||
{
|
||||
return servico_saude_designacao;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.SERVICO_HIGIENE_TIPO ) )
|
||||
{
|
||||
return servico_higiene_tipo;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.SERVICO_HIGIENE_DESIGNACAO ) )
|
||||
{
|
||||
return servico_higiene_designacao;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.MORADA ) )
|
||||
{
|
||||
return morada;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CODIGO_POSTAL ) )
|
||||
{
|
||||
return codigo_postal;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.LOCALIDADE ) )
|
||||
{
|
||||
return localidade;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DISTRITO ) )
|
||||
{
|
||||
return distrito;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CONCELHO ) )
|
||||
{
|
||||
return concelho;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DATA_PROPOSTA ) )
|
||||
{
|
||||
return data_proposta;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DATA_ACEITACAO ) )
|
||||
{
|
||||
return data_aceitacao;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.INICIO_CONTRATO ) )
|
||||
{
|
||||
return inicio_contrato;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DURACAO ) )
|
||||
{
|
||||
return duracao;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DATA_CANCELAMENTO ) )
|
||||
{
|
||||
return data_cancelamento;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.PERFIL_1 ) )
|
||||
{
|
||||
return perfil_1;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.PERFIL_2 ) )
|
||||
{
|
||||
return perfil_2;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DATA_ENVIO_CONTRATO ) )
|
||||
{
|
||||
return data_envio_contrato;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DATA_RECEPCAO_CONTRATO ) )
|
||||
{
|
||||
return data_recepcao_contrato;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DATA_ENVIO_IDICT ) )
|
||||
{
|
||||
return data_envio_idict;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DATA_RELATORIO_ANUAL ) )
|
||||
{
|
||||
return data_relatorio_anual;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CODIGO_1 ) )
|
||||
{
|
||||
return codigo_1;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CODIGO_2 ) )
|
||||
{
|
||||
return codigo_2;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CODIGO_3 ) )
|
||||
{
|
||||
return codigo_3;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CAE ) )
|
||||
{
|
||||
return cae;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.ACTIVIDADE ) )
|
||||
{
|
||||
return actividade;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CONTRIBUINTE ) )
|
||||
{
|
||||
return contribuinte;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.SEGURANCA_SOCIAL ) )
|
||||
{
|
||||
return seguranca_social;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.PRECO_HIGIENE ) )
|
||||
{
|
||||
return preco_higiene;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.PRECO_MEDICINA ) )
|
||||
{
|
||||
return preco_medicina;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.PERIODICIDADE ) )
|
||||
{
|
||||
return periodicidade;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CONTACTO_1 ) )
|
||||
{
|
||||
return contacto_1;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CONTACTO_2 ) )
|
||||
{
|
||||
return contacto_2;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.SERVICOS ) )
|
||||
{
|
||||
return servicos;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.INACTIVO ) )
|
||||
{
|
||||
return inactivo;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.ACTUALIZACAO ) )
|
||||
{
|
||||
return actualizacao;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.A_CONSULTAS ) )
|
||||
{
|
||||
return a_consultas;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.A_EXAMES ) )
|
||||
{
|
||||
return a_exames;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.B_CONSULTAS ) )
|
||||
{
|
||||
return b_consultas;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.B_EXAMES ) )
|
||||
{
|
||||
return b_exames;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setField( String fieldName, Object value )
|
||||
{
|
||||
if( fieldName == EmpresaData.ID )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DESIGNACAO_SOCIAL )
|
||||
{
|
||||
designacao_social = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DESIGNACAO_SOCIAL_PLAIN )
|
||||
{
|
||||
designacao_social_plain = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.SERVICO_SAUDE_TIPO )
|
||||
{
|
||||
servico_saude_tipo = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.SERVICO_SAUDE_DESIGNACAO )
|
||||
{
|
||||
servico_saude_designacao = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.SERVICO_HIGIENE_TIPO )
|
||||
{
|
||||
servico_higiene_tipo = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.SERVICO_HIGIENE_DESIGNACAO )
|
||||
{
|
||||
servico_higiene_designacao = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.MORADA )
|
||||
{
|
||||
morada = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CODIGO_POSTAL )
|
||||
{
|
||||
codigo_postal = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.LOCALIDADE )
|
||||
{
|
||||
localidade = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DISTRITO )
|
||||
{
|
||||
distrito = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CONCELHO )
|
||||
{
|
||||
concelho = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DATA_PROPOSTA )
|
||||
{
|
||||
data_proposta = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DATA_ACEITACAO )
|
||||
{
|
||||
data_aceitacao = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.INICIO_CONTRATO )
|
||||
{
|
||||
inicio_contrato = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DURACAO )
|
||||
{
|
||||
duracao = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DATA_CANCELAMENTO )
|
||||
{
|
||||
data_cancelamento = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.PERFIL_1 )
|
||||
{
|
||||
perfil_1 = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.PERFIL_2 )
|
||||
{
|
||||
perfil_2 = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DATA_ENVIO_CONTRATO )
|
||||
{
|
||||
data_envio_contrato = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DATA_RECEPCAO_CONTRATO )
|
||||
{
|
||||
data_recepcao_contrato = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DATA_ENVIO_IDICT )
|
||||
{
|
||||
data_envio_idict = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.DATA_RELATORIO_ANUAL )
|
||||
{
|
||||
data_relatorio_anual = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CODIGO_1 )
|
||||
{
|
||||
codigo_1 = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CODIGO_2 )
|
||||
{
|
||||
codigo_2 = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CODIGO_3 )
|
||||
{
|
||||
codigo_3 = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CAE )
|
||||
{
|
||||
cae = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.ACTIVIDADE )
|
||||
{
|
||||
actividade = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CONTRIBUINTE )
|
||||
{
|
||||
contribuinte = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.SEGURANCA_SOCIAL )
|
||||
{
|
||||
seguranca_social = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.PRECO_HIGIENE )
|
||||
{
|
||||
preco_higiene = ( Double ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.PRECO_MEDICINA )
|
||||
{
|
||||
preco_medicina = ( Double ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.PERIODICIDADE )
|
||||
{
|
||||
periodicidade = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CONTACTO_1 )
|
||||
{
|
||||
contacto_1 = ( Contacto ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.CONTACTO_2 )
|
||||
{
|
||||
contacto_2 = ( Contacto ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.SERVICOS )
|
||||
{
|
||||
servicos = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.INACTIVO )
|
||||
{
|
||||
inactivo = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.ACTUALIZACAO )
|
||||
{
|
||||
actualizacao = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.A_CONSULTAS )
|
||||
{
|
||||
a_consultas = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.A_EXAMES )
|
||||
{
|
||||
a_exames = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.B_CONSULTAS )
|
||||
{
|
||||
b_consultas = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EmpresaData.B_EXAMES )
|
||||
{
|
||||
b_exames = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.ID ) )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DESIGNACAO_SOCIAL ) )
|
||||
{
|
||||
designacao_social = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DESIGNACAO_SOCIAL_PLAIN ) )
|
||||
{
|
||||
designacao_social_plain = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.SERVICO_SAUDE_TIPO ) )
|
||||
{
|
||||
servico_saude_tipo = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.SERVICO_SAUDE_DESIGNACAO ) )
|
||||
{
|
||||
servico_saude_designacao = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.SERVICO_HIGIENE_TIPO ) )
|
||||
{
|
||||
servico_higiene_tipo = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.SERVICO_HIGIENE_DESIGNACAO ) )
|
||||
{
|
||||
servico_higiene_designacao = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.MORADA ) )
|
||||
{
|
||||
morada = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CODIGO_POSTAL ) )
|
||||
{
|
||||
codigo_postal = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.LOCALIDADE ) )
|
||||
{
|
||||
localidade = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DISTRITO ) )
|
||||
{
|
||||
distrito = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CONCELHO ) )
|
||||
{
|
||||
concelho = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DATA_PROPOSTA ) )
|
||||
{
|
||||
data_proposta = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DATA_ACEITACAO ) )
|
||||
{
|
||||
data_aceitacao = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.INICIO_CONTRATO ) )
|
||||
{
|
||||
inicio_contrato = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DURACAO ) )
|
||||
{
|
||||
duracao = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DATA_CANCELAMENTO ) )
|
||||
{
|
||||
data_cancelamento = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.PERFIL_1 ) )
|
||||
{
|
||||
perfil_1 = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.PERFIL_2 ) )
|
||||
{
|
||||
perfil_2 = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DATA_ENVIO_CONTRATO ) )
|
||||
{
|
||||
data_envio_contrato = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DATA_RECEPCAO_CONTRATO ) )
|
||||
{
|
||||
data_recepcao_contrato = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DATA_ENVIO_IDICT ) )
|
||||
{
|
||||
data_envio_idict = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.DATA_RELATORIO_ANUAL ) )
|
||||
{
|
||||
data_relatorio_anual = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CODIGO_1 ) )
|
||||
{
|
||||
codigo_1 = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CODIGO_2 ) )
|
||||
{
|
||||
codigo_2 = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CODIGO_3 ) )
|
||||
{
|
||||
codigo_3 = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CAE ) )
|
||||
{
|
||||
cae = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.ACTIVIDADE ) )
|
||||
{
|
||||
actividade = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CONTRIBUINTE ) )
|
||||
{
|
||||
contribuinte = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.SEGURANCA_SOCIAL ) )
|
||||
{
|
||||
seguranca_social = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.PRECO_HIGIENE ) )
|
||||
{
|
||||
preco_higiene = ( Double ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.PRECO_MEDICINA ) )
|
||||
{
|
||||
preco_medicina = ( Double ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.PERIODICIDADE ) )
|
||||
{
|
||||
periodicidade = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CONTACTO_1 ) )
|
||||
{
|
||||
contacto_1 = ( Contacto ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.CONTACTO_2 ) )
|
||||
{
|
||||
contacto_2 = ( Contacto ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.SERVICOS ) )
|
||||
{
|
||||
servicos = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.INACTIVO ) )
|
||||
{
|
||||
inactivo = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.ACTUALIZACAO ) )
|
||||
{
|
||||
actualizacao = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.A_CONSULTAS ) )
|
||||
{
|
||||
a_consultas = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.A_EXAMES ) )
|
||||
{
|
||||
a_exames = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.B_CONSULTAS ) )
|
||||
{
|
||||
b_consultas = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EmpresaData.B_EXAMES ) )
|
||||
{
|
||||
b_exames = ( String ) value;
|
||||
}
|
||||
}
|
||||
|
||||
public Class getOuterClass()
|
||||
{
|
||||
return EmpresaData.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,114 @@
|
||||
/*
|
||||
* EmpresaData.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 17/Mai/2006
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class EmpresaData extends JDOObject
|
||||
implements DisableDeleteable, ActualizacaoSaveable
|
||||
{
|
||||
public static final String ID = "id";
|
||||
public static final String DESIGNACAO_SOCIAL = "designacao_social";
|
||||
public static final String DESIGNACAO_SOCIAL_PLAIN = "designacao_social_plain";
|
||||
public static final String SERVICO_SAUDE_TIPO = "servico_saude_tipo";
|
||||
public static final String SERVICO_SAUDE_DESIGNACAO = "servico_saude_designacao";
|
||||
public static final String SERVICO_HIGIENE_TIPO = "servico_higiene_tipo";
|
||||
public static final String SERVICO_HIGIENE_DESIGNACAO = "servico_higiene_designacao";
|
||||
public static final String MORADA = "morada";
|
||||
public static final String CODIGO_POSTAL = "codigo_postal";
|
||||
public static final String LOCALIDADE = "localidade";
|
||||
public static final String DISTRITO = "distrito";
|
||||
public static final String CONCELHO = "concelho";
|
||||
public static final String DATA_PROPOSTA = "data_proposta";
|
||||
public static final String DATA_ACEITACAO = "data_aceitacao";
|
||||
public static final String INICIO_CONTRATO = "inicio_contrato";
|
||||
public static final String DURACAO = "duracao";
|
||||
public static final String DATA_CANCELAMENTO = "data_cancelamento";
|
||||
public static final String PERFIL_1 = "perfil_1";
|
||||
public static final String PERFIL_2 = "perfil_2";
|
||||
public static final String DATA_ENVIO_CONTRATO = "data_envio_contrato";
|
||||
public static final String DATA_RECEPCAO_CONTRATO = "data_recepcao_contrato";
|
||||
public static final String DATA_ENVIO_IDICT = "data_envio_idict";
|
||||
public static final String DATA_RELATORIO_ANUAL = "data_relatorio_anual";
|
||||
public static final String CODIGO_1 = "codigo_1";
|
||||
public static final String CODIGO_2 = "codigo_2";
|
||||
public static final String CODIGO_3 = "codigo_3";
|
||||
public static final String CAE = "cae";
|
||||
public static final String ACTIVIDADE = "actividade";
|
||||
public static final String CONTRIBUINTE = "contribuinte";
|
||||
public static final String SEGURANCA_SOCIAL = "seguranca_social";
|
||||
public static final String PRECO_HIGIENE = "preco_higiene";
|
||||
public static final String PRECO_MEDICINA = "preco_medicina";
|
||||
public static final String PERIODICIDADE = "periodicidade";
|
||||
public static final String CONTACTO_1 = "contacto_1";
|
||||
public static final String CONTACTO_2 = "contacto_2";
|
||||
public static final String SERVICOS = "servicos";
|
||||
public static final String INACTIVO = "inactivo";
|
||||
public static final String ACTUALIZACAO = "actualizacao";
|
||||
public static final String A_CONSULTAS = "a_consultas";
|
||||
public static final String A_EXAMES = "a_exames";
|
||||
public static final String B_CONSULTAS = "b_consultas";
|
||||
public static final String B_EXAMES = "b_exames";
|
||||
|
||||
public static final String FIELD_NAMES[] = new String[]{
|
||||
DESIGNACAO_SOCIAL, DESIGNACAO_SOCIAL_PLAIN, SERVICO_SAUDE_TIPO,
|
||||
SERVICO_SAUDE_DESIGNACAO, SERVICO_HIGIENE_TIPO, SERVICO_HIGIENE_DESIGNACAO,
|
||||
MORADA, CODIGO_POSTAL, LOCALIDADE, DISTRITO, CONCELHO, DATA_PROPOSTA,
|
||||
DATA_ACEITACAO, INICIO_CONTRATO, DURACAO, DATA_CANCELAMENTO, PERFIL_1, PERFIL_2,
|
||||
DATA_ENVIO_CONTRATO, DATA_RECEPCAO_CONTRATO, DATA_ENVIO_IDICT,
|
||||
DATA_RELATORIO_ANUAL, CODIGO_1, CODIGO_2, CODIGO_3, CAE, ACTIVIDADE, CONTRIBUINTE,
|
||||
SEGURANCA_SOCIAL, PRECO_HIGIENE, PRECO_MEDICINA, PERIODICIDADE, CONTACTO_1,
|
||||
CONTACTO_2, SERVICOS, A_CONSULTAS, A_EXAMES, B_CONSULTAS, B_EXAMES, };
|
||||
|
||||
|
||||
protected static final String ALL_FIELD_NAMES[] = new String[]{
|
||||
ID, DESIGNACAO_SOCIAL, DESIGNACAO_SOCIAL_PLAIN, SERVICO_SAUDE_TIPO,
|
||||
SERVICO_SAUDE_DESIGNACAO, SERVICO_HIGIENE_TIPO, SERVICO_HIGIENE_DESIGNACAO,
|
||||
MORADA, CODIGO_POSTAL, LOCALIDADE, DISTRITO, CONCELHO, DATA_PROPOSTA,
|
||||
DATA_ACEITACAO, INICIO_CONTRATO, DURACAO, DATA_CANCELAMENTO, PERFIL_1, PERFIL_2,
|
||||
DATA_ENVIO_CONTRATO, DATA_RECEPCAO_CONTRATO, DATA_ENVIO_IDICT,
|
||||
DATA_RELATORIO_ANUAL, CODIGO_1, CODIGO_2, CODIGO_3, CAE, ACTIVIDADE, CONTRIBUINTE,
|
||||
SEGURANCA_SOCIAL, PRECO_HIGIENE, PRECO_MEDICINA, PERIODICIDADE, CONTACTO_1,
|
||||
CONTACTO_2, SERVICOS, INACTIVO, ACTUALIZACAO, A_CONSULTAS, A_EXAMES, B_CONSULTAS,
|
||||
B_EXAMES, };
|
||||
|
||||
private HashMap dataHash;
|
||||
|
||||
public EmpresaData()
|
||||
{
|
||||
dataHash = new HashMap();
|
||||
}
|
||||
|
||||
protected Object innerGet( String fieldName )
|
||||
throws Exception
|
||||
{
|
||||
return dataHash.get( fieldName );
|
||||
}
|
||||
|
||||
protected void innerSet( String fieldName, Object value )
|
||||
throws Exception
|
||||
{
|
||||
dataHash.put( fieldName, value );
|
||||
}
|
||||
|
||||
public String []getFieldNames()
|
||||
{
|
||||
return FIELD_NAMES;
|
||||
}
|
||||
|
||||
protected String []getAllFieldNames()
|
||||
{
|
||||
return ALL_FIELD_NAMES;
|
||||
}
|
||||
|
||||
public Class getInnerClass()
|
||||
{
|
||||
return Empresa.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* EmpresaID.java
|
||||
*
|
||||
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 17/Mai/2006
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import com.evolute.utils.jdo.jpox.*;
|
||||
|
||||
public final class EmpresaID extends IntegerID
|
||||
implements Serializable
|
||||
{
|
||||
public EmpresaID()
|
||||
{
|
||||
}
|
||||
|
||||
public EmpresaID( String str )
|
||||
{
|
||||
super( str );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,220 @@
|
||||
/*
|
||||
* Estabelecimento.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 24/Nov/2005
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.Date;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class Estabelecimento implements JDOInnerObject
|
||||
{
|
||||
private Integer id;
|
||||
private String nome;
|
||||
private String nome_plain;
|
||||
private String morada;
|
||||
private String codigo_postal;
|
||||
private String localidade;
|
||||
private String historico;
|
||||
private Empresa empresa;
|
||||
private Contacto contacto;
|
||||
private String inactivo;
|
||||
private Date actualizacao;
|
||||
|
||||
public Estabelecimento()
|
||||
{
|
||||
}
|
||||
|
||||
public Object getField( String fieldName )
|
||||
{
|
||||
if( fieldName == EstabelecimentoData.ID )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.NOME )
|
||||
{
|
||||
return nome;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.NOME_PLAIN )
|
||||
{
|
||||
return nome_plain;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.MORADA )
|
||||
{
|
||||
return morada;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.CODIGO_POSTAL )
|
||||
{
|
||||
return codigo_postal;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.LOCALIDADE )
|
||||
{
|
||||
return localidade;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.HISTORICO )
|
||||
{
|
||||
return historico;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.EMPRESA )
|
||||
{
|
||||
return empresa;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.CONTACTO )
|
||||
{
|
||||
return contacto;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.INACTIVO )
|
||||
{
|
||||
return inactivo;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.ACTUALIZACAO )
|
||||
{
|
||||
return actualizacao;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.ID ) )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.NOME ) )
|
||||
{
|
||||
return nome;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.NOME_PLAIN ) )
|
||||
{
|
||||
return nome_plain;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.MORADA ) )
|
||||
{
|
||||
return morada;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.CODIGO_POSTAL ) )
|
||||
{
|
||||
return codigo_postal;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.LOCALIDADE ) )
|
||||
{
|
||||
return localidade;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.HISTORICO ) )
|
||||
{
|
||||
return historico;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.EMPRESA ) )
|
||||
{
|
||||
return empresa;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.CONTACTO ) )
|
||||
{
|
||||
return contacto;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.INACTIVO ) )
|
||||
{
|
||||
return inactivo;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.ACTUALIZACAO ) )
|
||||
{
|
||||
return actualizacao;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setField( String fieldName, Object value )
|
||||
{
|
||||
if( fieldName == EstabelecimentoData.ID )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.NOME )
|
||||
{
|
||||
nome = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.NOME_PLAIN )
|
||||
{
|
||||
nome_plain = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.MORADA )
|
||||
{
|
||||
morada = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.CODIGO_POSTAL )
|
||||
{
|
||||
codigo_postal = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.LOCALIDADE )
|
||||
{
|
||||
localidade = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.HISTORICO )
|
||||
{
|
||||
historico = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.EMPRESA )
|
||||
{
|
||||
empresa = ( Empresa ) value;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.CONTACTO )
|
||||
{
|
||||
contacto = ( Contacto ) value;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.INACTIVO )
|
||||
{
|
||||
inactivo = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EstabelecimentoData.ACTUALIZACAO )
|
||||
{
|
||||
actualizacao = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.ID ) )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.NOME ) )
|
||||
{
|
||||
nome = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.NOME_PLAIN ) )
|
||||
{
|
||||
nome_plain = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.MORADA ) )
|
||||
{
|
||||
morada = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.CODIGO_POSTAL ) )
|
||||
{
|
||||
codigo_postal = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.LOCALIDADE ) )
|
||||
{
|
||||
localidade = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.HISTORICO ) )
|
||||
{
|
||||
historico = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.EMPRESA ) )
|
||||
{
|
||||
empresa = ( Empresa ) value;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.CONTACTO ) )
|
||||
{
|
||||
contacto = ( Contacto ) value;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.INACTIVO ) )
|
||||
{
|
||||
inactivo = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EstabelecimentoData.ACTUALIZACAO ) )
|
||||
{
|
||||
actualizacao = ( Date ) value;
|
||||
}
|
||||
}
|
||||
|
||||
public Class getOuterClass()
|
||||
{
|
||||
return EstabelecimentoData.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* EstabelecimentoData.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 24/Nov/2005
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class EstabelecimentoData extends JDOObject
|
||||
implements DisableDeleteable, ActualizacaoSaveable
|
||||
{
|
||||
public static final String ID = "id";
|
||||
public static final String NOME = "nome";
|
||||
public static final String NOME_PLAIN = "nome_plain";
|
||||
public static final String MORADA = "morada";
|
||||
public static final String CODIGO_POSTAL = "codigo_postal";
|
||||
public static final String LOCALIDADE = "localidade";
|
||||
public static final String HISTORICO = "historico";
|
||||
public static final String EMPRESA = "empresa";
|
||||
public static final String CONTACTO = "contacto";
|
||||
public static final String INACTIVO = "inactivo";
|
||||
public static final String ACTUALIZACAO = "actualizacao";
|
||||
|
||||
public static final String FIELD_NAMES[] = new String[]{
|
||||
NOME, NOME_PLAIN, MORADA, CODIGO_POSTAL, LOCALIDADE, HISTORICO, EMPRESA, CONTACTO, };
|
||||
|
||||
|
||||
protected static final String ALL_FIELD_NAMES[] = new String[]{
|
||||
ID, NOME, NOME_PLAIN, MORADA, CODIGO_POSTAL, LOCALIDADE, HISTORICO, EMPRESA, CONTACTO,
|
||||
INACTIVO, ACTUALIZACAO, };
|
||||
|
||||
private HashMap dataHash;
|
||||
|
||||
public EstabelecimentoData()
|
||||
{
|
||||
dataHash = new HashMap();
|
||||
}
|
||||
|
||||
protected Object innerGet( String fieldName )
|
||||
throws Exception
|
||||
{
|
||||
return dataHash.get( fieldName );
|
||||
}
|
||||
|
||||
protected void innerSet( String fieldName, Object value )
|
||||
throws Exception
|
||||
{
|
||||
dataHash.put( fieldName, value );
|
||||
}
|
||||
|
||||
public String []getFieldNames()
|
||||
{
|
||||
return FIELD_NAMES;
|
||||
}
|
||||
|
||||
protected String []getAllFieldNames()
|
||||
{
|
||||
return ALL_FIELD_NAMES;
|
||||
}
|
||||
|
||||
public Class getInnerClass()
|
||||
{
|
||||
return Estabelecimento.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* EstabelecimentoID.java
|
||||
*
|
||||
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 24/Nov/2005
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import com.evolute.utils.jdo.jpox.*;
|
||||
|
||||
public final class EstabelecimentoID extends IntegerID
|
||||
implements Serializable
|
||||
{
|
||||
public EstabelecimentoID()
|
||||
{
|
||||
}
|
||||
|
||||
public EstabelecimentoID( String str )
|
||||
{
|
||||
super( str );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,270 @@
|
||||
/*
|
||||
* Etiqueta.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 27/Fev/2006
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class Etiqueta implements JDOInnerObject
|
||||
{
|
||||
private Integer id;
|
||||
private String descricao;
|
||||
private String descricao_plain;
|
||||
private Double altura;
|
||||
private Double largura;
|
||||
private Double margem_esquerda;
|
||||
private Double margem_cima;
|
||||
private Integer colunas;
|
||||
private Integer linhas;
|
||||
private String continua;
|
||||
private Double altura_folha;
|
||||
private Double largura_folha;
|
||||
private Double margem_vertical_folha;
|
||||
private Double margem_horizontal_folha;
|
||||
|
||||
public Etiqueta()
|
||||
{
|
||||
}
|
||||
|
||||
public Object getField( String fieldName )
|
||||
{
|
||||
if( fieldName == EtiquetaData.ID )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.DESCRICAO )
|
||||
{
|
||||
return descricao;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.DESCRICAO_PLAIN )
|
||||
{
|
||||
return descricao_plain;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.ALTURA )
|
||||
{
|
||||
return altura;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.LARGURA )
|
||||
{
|
||||
return largura;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.MARGEM_ESQUERDA )
|
||||
{
|
||||
return margem_esquerda;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.MARGEM_CIMA )
|
||||
{
|
||||
return margem_cima;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.COLUNAS )
|
||||
{
|
||||
return colunas;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.LINHAS )
|
||||
{
|
||||
return linhas;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.CONTINUA )
|
||||
{
|
||||
return continua;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.ALTURA_FOLHA )
|
||||
{
|
||||
return altura_folha;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.LARGURA_FOLHA )
|
||||
{
|
||||
return largura_folha;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.MARGEM_VERTICAL_FOLHA )
|
||||
{
|
||||
return margem_vertical_folha;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.MARGEM_HORIZONTAL_FOLHA )
|
||||
{
|
||||
return margem_horizontal_folha;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.ID ) )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.DESCRICAO ) )
|
||||
{
|
||||
return descricao;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.DESCRICAO_PLAIN ) )
|
||||
{
|
||||
return descricao_plain;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.ALTURA ) )
|
||||
{
|
||||
return altura;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.LARGURA ) )
|
||||
{
|
||||
return largura;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.MARGEM_ESQUERDA ) )
|
||||
{
|
||||
return margem_esquerda;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.MARGEM_CIMA ) )
|
||||
{
|
||||
return margem_cima;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.COLUNAS ) )
|
||||
{
|
||||
return colunas;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.LINHAS ) )
|
||||
{
|
||||
return linhas;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.CONTINUA ) )
|
||||
{
|
||||
return continua;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.ALTURA_FOLHA ) )
|
||||
{
|
||||
return altura_folha;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.LARGURA_FOLHA ) )
|
||||
{
|
||||
return largura_folha;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.MARGEM_VERTICAL_FOLHA ) )
|
||||
{
|
||||
return margem_vertical_folha;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.MARGEM_HORIZONTAL_FOLHA ) )
|
||||
{
|
||||
return margem_horizontal_folha;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setField( String fieldName, Object value )
|
||||
{
|
||||
if( fieldName == EtiquetaData.ID )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.DESCRICAO )
|
||||
{
|
||||
descricao = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.DESCRICAO_PLAIN )
|
||||
{
|
||||
descricao_plain = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.ALTURA )
|
||||
{
|
||||
altura = ( Double ) value;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.LARGURA )
|
||||
{
|
||||
largura = ( Double ) value;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.MARGEM_ESQUERDA )
|
||||
{
|
||||
margem_esquerda = ( Double ) value;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.MARGEM_CIMA )
|
||||
{
|
||||
margem_cima = ( Double ) value;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.COLUNAS )
|
||||
{
|
||||
colunas = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.LINHAS )
|
||||
{
|
||||
linhas = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.CONTINUA )
|
||||
{
|
||||
continua = ( String ) value;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.ALTURA_FOLHA )
|
||||
{
|
||||
altura_folha = ( Double ) value;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.LARGURA_FOLHA )
|
||||
{
|
||||
largura_folha = ( Double ) value;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.MARGEM_VERTICAL_FOLHA )
|
||||
{
|
||||
margem_vertical_folha = ( Double ) value;
|
||||
}
|
||||
else if( fieldName == EtiquetaData.MARGEM_HORIZONTAL_FOLHA )
|
||||
{
|
||||
margem_horizontal_folha = ( Double ) value;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.ID ) )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.DESCRICAO ) )
|
||||
{
|
||||
descricao = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.DESCRICAO_PLAIN ) )
|
||||
{
|
||||
descricao_plain = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.ALTURA ) )
|
||||
{
|
||||
altura = ( Double ) value;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.LARGURA ) )
|
||||
{
|
||||
largura = ( Double ) value;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.MARGEM_ESQUERDA ) )
|
||||
{
|
||||
margem_esquerda = ( Double ) value;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.MARGEM_CIMA ) )
|
||||
{
|
||||
margem_cima = ( Double ) value;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.COLUNAS ) )
|
||||
{
|
||||
colunas = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.LINHAS ) )
|
||||
{
|
||||
linhas = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.CONTINUA ) )
|
||||
{
|
||||
continua = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.ALTURA_FOLHA ) )
|
||||
{
|
||||
altura_folha = ( Double ) value;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.LARGURA_FOLHA ) )
|
||||
{
|
||||
largura_folha = ( Double ) value;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.MARGEM_VERTICAL_FOLHA ) )
|
||||
{
|
||||
margem_vertical_folha = ( Double ) value;
|
||||
}
|
||||
else if( fieldName.equals( EtiquetaData.MARGEM_HORIZONTAL_FOLHA ) )
|
||||
{
|
||||
margem_horizontal_folha = ( Double ) value;
|
||||
}
|
||||
}
|
||||
|
||||
public Class getOuterClass()
|
||||
{
|
||||
return EtiquetaData.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* EtiquetaData.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 27/Fev/2006
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class EtiquetaData extends JDOObject
|
||||
{
|
||||
public static final String ID = "id";
|
||||
public static final String DESCRICAO = "descricao";
|
||||
public static final String DESCRICAO_PLAIN = "descricao_plain";
|
||||
public static final String ALTURA = "altura";
|
||||
public static final String LARGURA = "largura";
|
||||
public static final String MARGEM_ESQUERDA = "margem_esquerda";
|
||||
public static final String MARGEM_CIMA = "margem_cima";
|
||||
public static final String COLUNAS = "colunas";
|
||||
public static final String LINHAS = "linhas";
|
||||
public static final String CONTINUA = "continua";
|
||||
public static final String ALTURA_FOLHA = "altura_folha";
|
||||
public static final String LARGURA_FOLHA = "largura_folha";
|
||||
public static final String MARGEM_VERTICAL_FOLHA = "margem_vertical_folha";
|
||||
public static final String MARGEM_HORIZONTAL_FOLHA = "margem_horizontal_folha";
|
||||
|
||||
public static final String FIELD_NAMES[] = new String[]{
|
||||
DESCRICAO, DESCRICAO_PLAIN, ALTURA, LARGURA, MARGEM_ESQUERDA, MARGEM_CIMA, COLUNAS,
|
||||
LINHAS, CONTINUA, ALTURA_FOLHA, LARGURA_FOLHA, MARGEM_VERTICAL_FOLHA,
|
||||
MARGEM_HORIZONTAL_FOLHA, };
|
||||
|
||||
|
||||
protected static final String ALL_FIELD_NAMES[] = new String[]{
|
||||
ID, DESCRICAO, DESCRICAO_PLAIN, ALTURA, LARGURA, MARGEM_ESQUERDA, MARGEM_CIMA,
|
||||
COLUNAS, LINHAS, CONTINUA, ALTURA_FOLHA, LARGURA_FOLHA, MARGEM_VERTICAL_FOLHA,
|
||||
MARGEM_HORIZONTAL_FOLHA, };
|
||||
|
||||
private HashMap dataHash;
|
||||
|
||||
public EtiquetaData()
|
||||
{
|
||||
dataHash = new HashMap();
|
||||
}
|
||||
|
||||
protected Object innerGet( String fieldName )
|
||||
throws Exception
|
||||
{
|
||||
return dataHash.get( fieldName );
|
||||
}
|
||||
|
||||
protected void innerSet( String fieldName, Object value )
|
||||
throws Exception
|
||||
{
|
||||
dataHash.put( fieldName, value );
|
||||
}
|
||||
|
||||
public String []getFieldNames()
|
||||
{
|
||||
return FIELD_NAMES;
|
||||
}
|
||||
|
||||
protected String []getAllFieldNames()
|
||||
{
|
||||
return ALL_FIELD_NAMES;
|
||||
}
|
||||
|
||||
public Class getInnerClass()
|
||||
{
|
||||
return Etiqueta.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* EtiquetaID.java
|
||||
*
|
||||
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 27/Fev/2006
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import com.evolute.utils.jdo.jpox.*;
|
||||
|
||||
public final class EtiquetaID extends IntegerID
|
||||
implements Serializable
|
||||
{
|
||||
public EtiquetaID()
|
||||
{
|
||||
}
|
||||
|
||||
public EtiquetaID( String str )
|
||||
{
|
||||
super( str );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,322 @@
|
||||
/*
|
||||
* Exame.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 28/Jan/2005
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.Date;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class Exame implements JDOInnerObject
|
||||
{
|
||||
private Integer id;
|
||||
private Date data;
|
||||
private Integer tipo;
|
||||
private Integer ocasional;
|
||||
private String outro_tipo;
|
||||
private Integer resultado;
|
||||
private String outra_funcao_1;
|
||||
private String outra_funcao_2;
|
||||
private String outra_funcao_3;
|
||||
private String outra_funcao_4;
|
||||
private Date proximo_exame;
|
||||
private String outras_recomendacoes;
|
||||
private Trabalhador trabalhador;
|
||||
private Medico medico;
|
||||
private byte[] pdf;
|
||||
private byte[] fo;
|
||||
private String inactivo;
|
||||
|
||||
public Exame()
|
||||
{
|
||||
}
|
||||
|
||||
public Object getField( String fieldName )
|
||||
{
|
||||
if( fieldName == ExameData.ID )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName == ExameData.DATA )
|
||||
{
|
||||
return data;
|
||||
}
|
||||
else if( fieldName == ExameData.TIPO )
|
||||
{
|
||||
return tipo;
|
||||
}
|
||||
else if( fieldName == ExameData.OCASIONAL )
|
||||
{
|
||||
return ocasional;
|
||||
}
|
||||
else if( fieldName == ExameData.OUTRO_TIPO )
|
||||
{
|
||||
return outro_tipo;
|
||||
}
|
||||
else if( fieldName == ExameData.RESULTADO )
|
||||
{
|
||||
return resultado;
|
||||
}
|
||||
else if( fieldName == ExameData.OUTRA_FUNCAO_1 )
|
||||
{
|
||||
return outra_funcao_1;
|
||||
}
|
||||
else if( fieldName == ExameData.OUTRA_FUNCAO_2 )
|
||||
{
|
||||
return outra_funcao_2;
|
||||
}
|
||||
else if( fieldName == ExameData.OUTRA_FUNCAO_3 )
|
||||
{
|
||||
return outra_funcao_3;
|
||||
}
|
||||
else if( fieldName == ExameData.OUTRA_FUNCAO_4 )
|
||||
{
|
||||
return outra_funcao_4;
|
||||
}
|
||||
else if( fieldName == ExameData.PROXIMO_EXAME )
|
||||
{
|
||||
return proximo_exame;
|
||||
}
|
||||
else if( fieldName == ExameData.OUTRAS_RECOMENDACOES )
|
||||
{
|
||||
return outras_recomendacoes;
|
||||
}
|
||||
else if( fieldName == ExameData.TRABALHADOR )
|
||||
{
|
||||
return trabalhador;
|
||||
}
|
||||
else if( fieldName == ExameData.MEDICO )
|
||||
{
|
||||
return medico;
|
||||
}
|
||||
else if( fieldName == ExameData.PDF )
|
||||
{
|
||||
return pdf;
|
||||
}
|
||||
else if( fieldName == ExameData.FO )
|
||||
{
|
||||
return fo;
|
||||
}
|
||||
else if( fieldName == ExameData.INACTIVO )
|
||||
{
|
||||
return inactivo;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.ID ) )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.DATA ) )
|
||||
{
|
||||
return data;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.TIPO ) )
|
||||
{
|
||||
return tipo;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.OCASIONAL ) )
|
||||
{
|
||||
return ocasional;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.OUTRO_TIPO ) )
|
||||
{
|
||||
return outro_tipo;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.RESULTADO ) )
|
||||
{
|
||||
return resultado;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.OUTRA_FUNCAO_1 ) )
|
||||
{
|
||||
return outra_funcao_1;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.OUTRA_FUNCAO_2 ) )
|
||||
{
|
||||
return outra_funcao_2;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.OUTRA_FUNCAO_3 ) )
|
||||
{
|
||||
return outra_funcao_3;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.OUTRA_FUNCAO_4 ) )
|
||||
{
|
||||
return outra_funcao_4;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.PROXIMO_EXAME ) )
|
||||
{
|
||||
return proximo_exame;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.OUTRAS_RECOMENDACOES ) )
|
||||
{
|
||||
return outras_recomendacoes;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.TRABALHADOR ) )
|
||||
{
|
||||
return trabalhador;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.MEDICO ) )
|
||||
{
|
||||
return medico;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.PDF ) )
|
||||
{
|
||||
return pdf;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.FO ) )
|
||||
{
|
||||
return fo;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.INACTIVO ) )
|
||||
{
|
||||
return inactivo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setField( String fieldName, Object value )
|
||||
{
|
||||
if( fieldName == ExameData.ID )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == ExameData.DATA )
|
||||
{
|
||||
data = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == ExameData.TIPO )
|
||||
{
|
||||
tipo = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == ExameData.OCASIONAL )
|
||||
{
|
||||
ocasional = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == ExameData.OUTRO_TIPO )
|
||||
{
|
||||
outro_tipo = ( String ) value;
|
||||
}
|
||||
else if( fieldName == ExameData.RESULTADO )
|
||||
{
|
||||
resultado = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == ExameData.OUTRA_FUNCAO_1 )
|
||||
{
|
||||
outra_funcao_1 = ( String ) value;
|
||||
}
|
||||
else if( fieldName == ExameData.OUTRA_FUNCAO_2 )
|
||||
{
|
||||
outra_funcao_2 = ( String ) value;
|
||||
}
|
||||
else if( fieldName == ExameData.OUTRA_FUNCAO_3 )
|
||||
{
|
||||
outra_funcao_3 = ( String ) value;
|
||||
}
|
||||
else if( fieldName == ExameData.OUTRA_FUNCAO_4 )
|
||||
{
|
||||
outra_funcao_4 = ( String ) value;
|
||||
}
|
||||
else if( fieldName == ExameData.PROXIMO_EXAME )
|
||||
{
|
||||
proximo_exame = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == ExameData.OUTRAS_RECOMENDACOES )
|
||||
{
|
||||
outras_recomendacoes = ( String ) value;
|
||||
}
|
||||
else if( fieldName == ExameData.TRABALHADOR )
|
||||
{
|
||||
trabalhador = ( Trabalhador ) value;
|
||||
}
|
||||
else if( fieldName == ExameData.MEDICO )
|
||||
{
|
||||
medico = ( Medico ) value;
|
||||
}
|
||||
else if( fieldName == ExameData.PDF )
|
||||
{
|
||||
pdf = ( byte[] ) value;
|
||||
}
|
||||
else if( fieldName == ExameData.FO )
|
||||
{
|
||||
fo = ( byte[] ) value;
|
||||
}
|
||||
else if( fieldName == ExameData.INACTIVO )
|
||||
{
|
||||
inactivo = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.ID ) )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.DATA ) )
|
||||
{
|
||||
data = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.TIPO ) )
|
||||
{
|
||||
tipo = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.OCASIONAL ) )
|
||||
{
|
||||
ocasional = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.OUTRO_TIPO ) )
|
||||
{
|
||||
outro_tipo = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.RESULTADO ) )
|
||||
{
|
||||
resultado = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.OUTRA_FUNCAO_1 ) )
|
||||
{
|
||||
outra_funcao_1 = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.OUTRA_FUNCAO_2 ) )
|
||||
{
|
||||
outra_funcao_2 = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.OUTRA_FUNCAO_3 ) )
|
||||
{
|
||||
outra_funcao_3 = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.OUTRA_FUNCAO_4 ) )
|
||||
{
|
||||
outra_funcao_4 = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.PROXIMO_EXAME ) )
|
||||
{
|
||||
proximo_exame = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.OUTRAS_RECOMENDACOES ) )
|
||||
{
|
||||
outras_recomendacoes = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.TRABALHADOR ) )
|
||||
{
|
||||
trabalhador = ( Trabalhador ) value;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.MEDICO ) )
|
||||
{
|
||||
medico = ( Medico ) value;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.PDF ) )
|
||||
{
|
||||
pdf = ( byte[] ) value;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.FO ) )
|
||||
{
|
||||
fo = ( byte[] ) value;
|
||||
}
|
||||
else if( fieldName.equals( ExameData.INACTIVO ) )
|
||||
{
|
||||
inactivo = ( String ) value;
|
||||
}
|
||||
}
|
||||
|
||||
public Class getOuterClass()
|
||||
{
|
||||
return ExameData.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* ExameData.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 28/Jan/2005
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class ExameData extends JDOObject
|
||||
implements DisableDeleteable
|
||||
{
|
||||
public static final String ID = "id";
|
||||
public static final String DATA = "data";
|
||||
public static final String TIPO = "tipo";
|
||||
public static final String OCASIONAL = "ocasional";
|
||||
public static final String OUTRO_TIPO = "outro_tipo";
|
||||
public static final String RESULTADO = "resultado";
|
||||
public static final String OUTRA_FUNCAO_1 = "outra_funcao_1";
|
||||
public static final String OUTRA_FUNCAO_2 = "outra_funcao_2";
|
||||
public static final String OUTRA_FUNCAO_3 = "outra_funcao_3";
|
||||
public static final String OUTRA_FUNCAO_4 = "outra_funcao_4";
|
||||
public static final String PROXIMO_EXAME = "proximo_exame";
|
||||
public static final String OUTRAS_RECOMENDACOES = "outras_recomendacoes";
|
||||
public static final String TRABALHADOR = "trabalhador";
|
||||
public static final String MEDICO = "medico";
|
||||
public static final String PDF = "pdf";
|
||||
public static final String FO = "fo";
|
||||
public static final String INACTIVO = "inactivo";
|
||||
|
||||
public static final String FIELD_NAMES[] = new String[]{
|
||||
DATA, TIPO, OCASIONAL, OUTRO_TIPO, RESULTADO, OUTRA_FUNCAO_1, OUTRA_FUNCAO_2,
|
||||
OUTRA_FUNCAO_3, OUTRA_FUNCAO_4, PROXIMO_EXAME, OUTRAS_RECOMENDACOES,
|
||||
TRABALHADOR, MEDICO, PDF, FO, };
|
||||
|
||||
|
||||
protected static final String ALL_FIELD_NAMES[] = new String[]{
|
||||
ID, DATA, TIPO, OCASIONAL, OUTRO_TIPO, RESULTADO, OUTRA_FUNCAO_1, OUTRA_FUNCAO_2,
|
||||
OUTRA_FUNCAO_3, OUTRA_FUNCAO_4, PROXIMO_EXAME, OUTRAS_RECOMENDACOES,
|
||||
TRABALHADOR, MEDICO, PDF, FO, INACTIVO, };
|
||||
|
||||
private HashMap dataHash;
|
||||
|
||||
public ExameData()
|
||||
{
|
||||
dataHash = new HashMap();
|
||||
}
|
||||
|
||||
protected Object innerGet( String fieldName )
|
||||
throws Exception
|
||||
{
|
||||
return dataHash.get( fieldName );
|
||||
}
|
||||
|
||||
protected void innerSet( String fieldName, Object value )
|
||||
throws Exception
|
||||
{
|
||||
dataHash.put( fieldName, value );
|
||||
}
|
||||
|
||||
public String []getFieldNames()
|
||||
{
|
||||
return FIELD_NAMES;
|
||||
}
|
||||
|
||||
protected String []getAllFieldNames()
|
||||
{
|
||||
return ALL_FIELD_NAMES;
|
||||
}
|
||||
|
||||
public Class getInnerClass()
|
||||
{
|
||||
return Exame.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* ExameID.java
|
||||
*
|
||||
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 28/Jan/2005
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import com.evolute.utils.jdo.jpox.*;
|
||||
|
||||
public final class ExameID extends IntegerID
|
||||
{
|
||||
public ExameID()
|
||||
{
|
||||
}
|
||||
|
||||
public ExameID( String str )
|
||||
{
|
||||
super( str );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Historico.java
|
||||
*
|
||||
* Created on 7 de Dezembro de 2004, 16:50
|
||||
*/
|
||||
|
||||
package siprp.data;
|
||||
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.jdo.*;
|
||||
import com.evolute.utils.tables.*;
|
||||
|
||||
import siprp.*;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public abstract class Historico extends JDOObject
|
||||
implements ColumnizedObject
|
||||
{
|
||||
protected static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( DateFormat.SHORT );
|
||||
|
||||
public static final String DATA = "data";
|
||||
public static final String TEXTO = "texto";
|
||||
|
||||
/** Creates a new instance of Historico */
|
||||
public Historico()
|
||||
{
|
||||
}
|
||||
|
||||
public Object getValue(int col)
|
||||
{
|
||||
switch( col )
|
||||
{
|
||||
case 0:
|
||||
Date data = (Date) get( DATA );
|
||||
String dataStr = DATE_FORMAT.format( data );
|
||||
return dataStr;
|
||||
|
||||
case 1:
|
||||
String textoStr = (String ) get( TEXTO );
|
||||
if( textoStr == null )
|
||||
{
|
||||
textoStr = "";
|
||||
}
|
||||
textoStr = textoStr.trim();
|
||||
int index = textoStr.indexOf( "\n" );
|
||||
if( index != -1 )
|
||||
{
|
||||
textoStr = textoStr.substring( 0, index );
|
||||
}
|
||||
return textoStr;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* HistoricoEstabelecimento.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 7/Dez/2004
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.Date;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class HistoricoEstabelecimento implements JDOInnerObject
|
||||
{
|
||||
private Integer id;
|
||||
private Date data;
|
||||
private String texto;
|
||||
private Estabelecimento estabelecimento;
|
||||
|
||||
public HistoricoEstabelecimento()
|
||||
{
|
||||
}
|
||||
|
||||
public Object getField( String fieldName )
|
||||
{
|
||||
if( fieldName == HistoricoEstabelecimentoData.ID )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName == HistoricoEstabelecimentoData.DATA )
|
||||
{
|
||||
return data;
|
||||
}
|
||||
else if( fieldName == HistoricoEstabelecimentoData.TEXTO )
|
||||
{
|
||||
return texto;
|
||||
}
|
||||
else if( fieldName == HistoricoEstabelecimentoData.ESTABELECIMENTO )
|
||||
{
|
||||
return estabelecimento;
|
||||
}
|
||||
else if( fieldName.equals( HistoricoEstabelecimentoData.ID ) )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName.equals( HistoricoEstabelecimentoData.DATA ) )
|
||||
{
|
||||
return data;
|
||||
}
|
||||
else if( fieldName.equals( HistoricoEstabelecimentoData.TEXTO ) )
|
||||
{
|
||||
return texto;
|
||||
}
|
||||
else if( fieldName.equals( HistoricoEstabelecimentoData.ESTABELECIMENTO ) )
|
||||
{
|
||||
return estabelecimento;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setField( String fieldName, Object value )
|
||||
{
|
||||
if( fieldName == HistoricoEstabelecimentoData.ID )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == HistoricoEstabelecimentoData.DATA )
|
||||
{
|
||||
data = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == HistoricoEstabelecimentoData.TEXTO )
|
||||
{
|
||||
texto = ( String ) value;
|
||||
}
|
||||
else if( fieldName == HistoricoEstabelecimentoData.ESTABELECIMENTO )
|
||||
{
|
||||
estabelecimento = ( Estabelecimento ) value;
|
||||
}
|
||||
else if( fieldName.equals( HistoricoEstabelecimentoData.ID ) )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( HistoricoEstabelecimentoData.DATA ) )
|
||||
{
|
||||
data = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( HistoricoEstabelecimentoData.TEXTO ) )
|
||||
{
|
||||
texto = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( HistoricoEstabelecimentoData.ESTABELECIMENTO ) )
|
||||
{
|
||||
estabelecimento = ( Estabelecimento ) value;
|
||||
}
|
||||
}
|
||||
|
||||
public Class getOuterClass()
|
||||
{
|
||||
return HistoricoEstabelecimentoData.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* HistoricoEstabelecimentoData.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 7/Dez/2004
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class HistoricoEstabelecimentoData extends Historico
|
||||
{
|
||||
public static final String ID = "id";
|
||||
public static final String DATA = "data";
|
||||
public static final String TEXTO = "texto";
|
||||
public static final String ESTABELECIMENTO = "estabelecimento";
|
||||
|
||||
public static final String FIELD_NAMES[] = new String[]{
|
||||
DATA, TEXTO, ESTABELECIMENTO, };
|
||||
|
||||
|
||||
protected static final String ALL_FIELD_NAMES[] = new String[]{
|
||||
ID, DATA, TEXTO, ESTABELECIMENTO, };
|
||||
|
||||
private HashMap dataHash;
|
||||
|
||||
public HistoricoEstabelecimentoData()
|
||||
{
|
||||
dataHash = new HashMap();
|
||||
}
|
||||
|
||||
protected Object innerGet( String fieldName )
|
||||
throws Exception
|
||||
{
|
||||
return dataHash.get( fieldName );
|
||||
}
|
||||
|
||||
protected void innerSet( String fieldName, Object value )
|
||||
throws Exception
|
||||
{
|
||||
dataHash.put( fieldName, value );
|
||||
}
|
||||
|
||||
public String []getFieldNames()
|
||||
{
|
||||
return FIELD_NAMES;
|
||||
}
|
||||
|
||||
protected String []getAllFieldNames()
|
||||
{
|
||||
return ALL_FIELD_NAMES;
|
||||
}
|
||||
|
||||
public Class getInnerClass()
|
||||
{
|
||||
return HistoricoEstabelecimento.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* HistoricoEstabelecimentoID.java
|
||||
*
|
||||
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 7/Dez/2004
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import com.evolute.utils.jdo.jpox.*;
|
||||
|
||||
public final class HistoricoEstabelecimentoID extends IntegerID
|
||||
{
|
||||
public HistoricoEstabelecimentoID()
|
||||
{
|
||||
}
|
||||
|
||||
public HistoricoEstabelecimentoID( String str )
|
||||
{
|
||||
super( str );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,352 @@
|
||||
/*
|
||||
* Marcacao.java
|
||||
*
|
||||
* Created on 21 de Maio de 2004, 16:59
|
||||
*/
|
||||
|
||||
package siprp.data;
|
||||
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.jdo.*;
|
||||
import com.evolute.utils.tables.*;
|
||||
|
||||
import siprp.*;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public abstract class Marcacao extends JDOObject
|
||||
implements ColumnizedObject
|
||||
//, JDOOperationHandlerInterface
|
||||
{
|
||||
public static final int TIPO_MARCACAO_TRABALHADOR_EXAMES = 0;
|
||||
public static final int TIPO_MARCACAO_TRABALHADOR_CONSULTA = 1;
|
||||
public static final int TIPO_MARCACAO_ESTABELECIMENTO = 2;
|
||||
public static final int TIPO_MARCACAO_EMPRESA = 3;
|
||||
|
||||
public static final int ESTADO_POR_REALIZAR = 0;
|
||||
public static final int ESTADO_PARCIALMENTE_REALIZADA = 1;
|
||||
public static final int ESTADO_REALIZADA = 2;
|
||||
public static final int ESTADO_DESMARCADA_TRABALHADOR = 3;
|
||||
public static final int ESTADO_DESMARCADA_SHST = 4;
|
||||
public static final int ESTADO_FALTOU = 5;
|
||||
|
||||
public static final String DATA = "data";
|
||||
public static final String REALIZADA = "realizada";
|
||||
public static final String DATA_EMAIL = "data_email";
|
||||
public static final String DATA_RELATORIO = "data_relatorio";
|
||||
public static final String ANTECEDENCIA_AVISO = "antecedencia_aviso";
|
||||
|
||||
protected static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( DateFormat.SHORT );
|
||||
protected static JDOProvider JDO;
|
||||
|
||||
|
||||
public static Marcacao getMarcacao( int tipo )
|
||||
{
|
||||
switch( tipo )
|
||||
{
|
||||
case TIPO_MARCACAO_TRABALHADOR_EXAMES: case TIPO_MARCACAO_TRABALHADOR_CONSULTA:
|
||||
return new MarcacaoTrabalhadorData();
|
||||
|
||||
case TIPO_MARCACAO_ESTABELECIMENTO:
|
||||
return new MarcacaoEstabelecimentoData();
|
||||
|
||||
case TIPO_MARCACAO_EMPRESA:
|
||||
return new MarcacaoEmpresaData();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object getValue( int col )
|
||||
{
|
||||
switch( col )
|
||||
{
|
||||
case 0:
|
||||
Date data = (Date) get( DATA );
|
||||
String dataStr = DATE_FORMAT.format( data );
|
||||
return dataStr;
|
||||
|
||||
case 1:
|
||||
String realizada = (String) get( REALIZADA );
|
||||
// if( this instanceof MarcacaoEmpresaData )
|
||||
// {
|
||||
// return new Boolean( "y".equals( realizada ) );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
|
||||
realizada = "y".equals( realizada ) ? "Sim" : "N\u00e3o";
|
||||
return realizada;
|
||||
// }
|
||||
|
||||
case 2:
|
||||
if( this instanceof MarcacaoEmpresaData )
|
||||
{
|
||||
String textoStr = (String ) get( MarcacaoEmpresaData.TEXTO );
|
||||
if( textoStr == null )
|
||||
{
|
||||
textoStr = "";
|
||||
}
|
||||
textoStr = textoStr.trim();
|
||||
int index = textoStr.indexOf( "\n" );
|
||||
if( index != -1 )
|
||||
{
|
||||
textoStr = textoStr.substring( 0, index );
|
||||
}
|
||||
return textoStr;
|
||||
}
|
||||
else
|
||||
{
|
||||
Date dataRelatorio = (Date) get( DATA_RELATORIO );
|
||||
String dataRelatorioStr = ( dataRelatorio != null ? DATE_FORMAT.format( dataRelatorio ) : "" );
|
||||
return dataRelatorioStr;
|
||||
}
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveMarcacaoConsultaForTrabalhadorID( Integer trabalhadorID, Date date )
|
||||
throws Exception
|
||||
{
|
||||
if( date != null )
|
||||
{
|
||||
date = (Date)date.clone();
|
||||
}
|
||||
FichaDataProvider provider = (FichaDataProvider) FichaDataProvider.getProvider();
|
||||
if( trabalhadorID == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
Integer marcacaoID = provider.getMarcacaoIDByTrabalhador( trabalhadorID );
|
||||
MarcacaoTrabalhadorData marcacao;
|
||||
if( marcacaoID == null )
|
||||
{
|
||||
marcacao = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( JDO == null )
|
||||
{
|
||||
JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
|
||||
}
|
||||
marcacao = ( MarcacaoTrabalhadorData ) JDO.load( MarcacaoTrabalhadorData.class, marcacaoID );
|
||||
}
|
||||
if( date == null && marcacao != null )
|
||||
{
|
||||
marcacao.delete();
|
||||
}
|
||||
else if( date != null && marcacao != null )
|
||||
{
|
||||
marcacao.set( Marcacao.DATA, date );
|
||||
marcacao.save();
|
||||
}
|
||||
else if( date != null && marcacao == null )
|
||||
{
|
||||
marcacao = new MarcacaoTrabalhadorData();
|
||||
if( JDO == null )
|
||||
{
|
||||
JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
|
||||
}
|
||||
TrabalhadorData trab = (TrabalhadorData)JDO.load( TrabalhadorData.class, trabalhadorID );
|
||||
marcacao.set( MarcacaoTrabalhadorData.TRABALHADOR, trab );
|
||||
marcacao.set( MarcacaoTrabalhadorData.TIPO, new Integer( MarcacaoTrabalhadorData.TIPO_CONSULTA ) );
|
||||
marcacao.set( Marcacao.DATA, date );
|
||||
marcacao.set( Marcacao.REALIZADA, "n" );
|
||||
marcacao.set( MarcacaoTrabalhadorData.ESTADO, new Integer( siprp.medicina.MedicinaDataProvider.ESTADO_POR_REALIZAR ) );
|
||||
marcacao.set( MarcacaoTrabalhadorData.MOTIVO, new Integer( 2 ) );
|
||||
marcacao.save();
|
||||
}
|
||||
}
|
||||
//
|
||||
// public boolean handle( JDOObject object, int operation, int moment )
|
||||
// throws Exception
|
||||
// {
|
||||
// switch( operation )
|
||||
// {
|
||||
// case JDOOperationHandlerInterface.OP_SAVE:
|
||||
// switch( moment )
|
||||
// {
|
||||
// case JDOOperationHandlerInterface.MOMENT_BEFORE:
|
||||
// return preSave( (Marcacao) object );
|
||||
//
|
||||
// case JDOOperationHandlerInterface.MOMENT_AFTER:
|
||||
// return postSave( (Marcacao) object );
|
||||
// }
|
||||
// return false;
|
||||
//
|
||||
// case JDOOperationHandlerInterface.OP_DELETE:
|
||||
// switch( moment )
|
||||
// {
|
||||
// case JDOOperationHandlerInterface.MOMENT_BEFORE:
|
||||
// return preDelete( (Marcacao) object );
|
||||
//
|
||||
// case JDOOperationHandlerInterface.MOMENT_AFTER:
|
||||
// return postDelete( (Marcacao) object );
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// protected boolean preSave( Marcacao object )
|
||||
// throws Exception
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// protected boolean postSave( Marcacao object )
|
||||
// throws Exception
|
||||
// {
|
||||
// if( object instanceof MarcacaoEmpresaData )
|
||||
// {
|
||||
// AvisoData aviso = (AvisoData) load( AvisoData.class, new Object[]{ get( MarcacaoEmpresaData.ID ), new Integer( AvisoData.TIPO_EMPRESA ) }, new String[]{ AvisoData.EVENTO_ID, AvisoData.TIPO } );
|
||||
// if( aviso == null )
|
||||
// {
|
||||
// aviso = new AvisoData();
|
||||
// }
|
||||
// aviso.set( AvisoData.TIPO, new Integer( AvisoData.TIPO_EMPRESA ) );
|
||||
// EmpresaData empresa = ( EmpresaData ) object.get( MarcacaoEmpresaData.EMPRESA );
|
||||
// aviso.set( AvisoData.EMPRESA, empresa );
|
||||
// aviso.set( AvisoData.EVENTO_ID, object.get( MarcacaoEmpresaData.ID ) );
|
||||
// Date dataEvento = (Date) object.get( DATA );
|
||||
// aviso.set( AvisoData.DATA_EVENTO, dataEvento );
|
||||
// aviso.set( AvisoData.DATA_AVISO, dataEvento );
|
||||
// String descricao = "Tarefa ";
|
||||
// aviso.set( AvisoData.DESCRICAO, descricao );
|
||||
// aviso.save();
|
||||
// }
|
||||
// else if( object instanceof MarcacaoEstabelecimentoData )
|
||||
// {
|
||||
// AvisoData aviso = (AvisoData) load( AvisoData.class, new Object[]{ get( MarcacaoEstabelecimentoData.ID ), new Integer( AvisoData.TIPO_ESTABELECIMENTO ) }, new String[]{ AvisoData.EVENTO_ID, AvisoData.TIPO } );
|
||||
// if( aviso == null )
|
||||
// {
|
||||
// aviso = new AvisoData();
|
||||
// }
|
||||
// aviso.set( AvisoData.TIPO, new Integer( AvisoData.TIPO_ESTABELECIMENTO ) );
|
||||
// EstabelecimentoData estabelecimento = ( EstabelecimentoData ) object.get( MarcacaoEstabelecimentoData.ESTABELECIMENTO );
|
||||
// aviso.set( AvisoData.ESTABELECIMENTO, estabelecimento );
|
||||
// EmpresaData empresa = ( EmpresaData )estabelecimento.get( EstabelecimentoData.EMPRESA );
|
||||
// aviso.set( AvisoData.EMPRESA, empresa );
|
||||
// aviso.set( AvisoData.EVENTO_ID, object.get( MarcacaoEstabelecimentoData.ID ) );
|
||||
// Date dataEvento = (Date) object.get( DATA );
|
||||
// Date dataAviso = new Date( dataEvento.getTime() );
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// cal.setTime( dataAviso );
|
||||
// cal.add( Calendar.DAY_OF_MONTH, -14 );
|
||||
// dataAviso = cal.getTime();
|
||||
// aviso.set( AvisoData.DATA_AVISO, dataAviso );
|
||||
// aviso.set( AvisoData.DATA_EVENTO, dataEvento );
|
||||
// String descricao = "Visita ";
|
||||
// aviso.set( AvisoData.DESCRICAO, descricao );
|
||||
// cal = Calendar.getInstance();
|
||||
// cal.setTime( dataEvento );
|
||||
// cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 );
|
||||
// cal.set( Calendar.MILLISECOND, 0 );
|
||||
// dataEvento = cal.getTime();
|
||||
//
|
||||
// cal = Calendar.getInstance();
|
||||
// cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 10, 0, 0 );
|
||||
// cal.set( Calendar.MILLISECOND, 0 );
|
||||
// Date hoje = cal.getTime();
|
||||
// if( hoje.before( dataEvento ) )
|
||||
// {
|
||||
// aviso.save();
|
||||
// }
|
||||
// }
|
||||
// if( object instanceof MarcacaoTrabalhadorData )
|
||||
// {
|
||||
// AvisoData aviso = (AvisoData) load( AvisoData.class, new Object[]{ object.get( MarcacaoTrabalhadorData.ID ), new Integer( AvisoData.TIPO_TRABALHADOR ) }, new String[]{ AvisoData.EVENTO_ID, AvisoData.TIPO } );
|
||||
// if( aviso == null )
|
||||
// {
|
||||
// aviso = new AvisoData();
|
||||
// }
|
||||
// aviso.set( AvisoData.TIPO, new Integer( AvisoData.TIPO_TRABALHADOR ) );
|
||||
// TrabalhadorData trab = ( TrabalhadorData ) object.get( MarcacaoTrabalhadorData.TRABALHADOR );
|
||||
// aviso.set( AvisoData.TRABALHADOR, trab );
|
||||
// EstabelecimentoData estabelecimento = ( EstabelecimentoData ) trab.get( TrabalhadorData.ESTABELECIMENTO );
|
||||
// aviso.set( AvisoData.ESTABELECIMENTO, estabelecimento );
|
||||
// EmpresaData empresa = ( EmpresaData ) estabelecimento.get( EstabelecimentoData.EMPRESA );
|
||||
// aviso.set( AvisoData.EMPRESA, empresa );
|
||||
// aviso.set( AvisoData.EVENTO_ID, object.get( MarcacaoTrabalhadorData.ID ) );
|
||||
// Date dataEvento = (Date) object.get( DATA );
|
||||
// Date dataAviso = new Date( dataEvento.getTime() );
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// cal.setTime( dataAviso );
|
||||
// cal.add( Calendar.DAY_OF_MONTH, -14 );
|
||||
// dataAviso = cal.getTime();
|
||||
// aviso.set( AvisoData.DATA_AVISO, dataAviso );
|
||||
// aviso.set( AvisoData.DATA_EVENTO, dataEvento );
|
||||
// String descricao = "";
|
||||
// switch( ( ( Integer ) object.get( MarcacaoTrabalhadorData.TIPO ) ).intValue() )
|
||||
// {
|
||||
// case MarcacaoTrabalhadorData.TIPO_EXAMES:
|
||||
// descricao = "Exames ";
|
||||
// break;
|
||||
//
|
||||
// case MarcacaoTrabalhadorData.TIPO_CONSULTA:
|
||||
// descricao = "Consulta ";
|
||||
// break;
|
||||
// }
|
||||
// aviso.set( AvisoData.DESCRICAO, descricao );
|
||||
// cal = Calendar.getInstance();
|
||||
// cal.setTime( dataEvento );
|
||||
// cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 );
|
||||
// cal.set( Calendar.MILLISECOND, 0 );
|
||||
// dataEvento = cal.getTime();
|
||||
//
|
||||
// cal = Calendar.getInstance();
|
||||
// cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 10, 0, 0 );
|
||||
// cal.set( Calendar.MILLISECOND, 0 );
|
||||
// Date hoje = cal.getTime();
|
||||
// if( hoje.before( dataEvento ) )
|
||||
// {
|
||||
// aviso.save();
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// protected boolean preDelete( Marcacao object )
|
||||
// throws Exception
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// protected boolean postDelete( Marcacao object )
|
||||
// throws Exception
|
||||
// {
|
||||
// Integer tipo;
|
||||
// if( object instanceof MarcacaoEmpresaData )
|
||||
// {
|
||||
// tipo = new Integer( AvisoData.TIPO_EMPRESA );
|
||||
// }
|
||||
// else if( object instanceof MarcacaoEstabelecimentoData )
|
||||
// {
|
||||
// tipo = new Integer( AvisoData.TIPO_ESTABELECIMENTO );
|
||||
// }
|
||||
// if( object instanceof MarcacaoTrabalhadorData )
|
||||
// {
|
||||
// tipo = new Integer( AvisoData.TIPO_TRABALHADOR );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// AvisoData aviso = (AvisoData) load( AvisoData.class, new Object[]{ object.get( "id" ), tipo }, new String[]{ AvisoData.EVENTO_ID, AvisoData.TIPO } );
|
||||
// if( aviso != null )
|
||||
// {
|
||||
// aviso.delete();
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
}
|
||||
@ -0,0 +1,118 @@
|
||||
/*
|
||||
* MarcacaoEmpresa.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 7/Dez/2004
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.Date;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class MarcacaoEmpresa implements JDOInnerObject
|
||||
{
|
||||
private Integer id;
|
||||
private Date data;
|
||||
private String texto;
|
||||
private String realizada;
|
||||
private Empresa empresa;
|
||||
|
||||
public MarcacaoEmpresa()
|
||||
{
|
||||
}
|
||||
|
||||
public Object getField( String fieldName )
|
||||
{
|
||||
if( fieldName == MarcacaoEmpresaData.ID )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName == MarcacaoEmpresaData.DATA )
|
||||
{
|
||||
return data;
|
||||
}
|
||||
else if( fieldName == MarcacaoEmpresaData.TEXTO )
|
||||
{
|
||||
return texto;
|
||||
}
|
||||
else if( fieldName == MarcacaoEmpresaData.REALIZADA )
|
||||
{
|
||||
return realizada;
|
||||
}
|
||||
else if( fieldName == MarcacaoEmpresaData.EMPRESA )
|
||||
{
|
||||
return empresa;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEmpresaData.ID ) )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEmpresaData.DATA ) )
|
||||
{
|
||||
return data;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEmpresaData.TEXTO ) )
|
||||
{
|
||||
return texto;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEmpresaData.REALIZADA ) )
|
||||
{
|
||||
return realizada;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEmpresaData.EMPRESA ) )
|
||||
{
|
||||
return empresa;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setField( String fieldName, Object value )
|
||||
{
|
||||
if( fieldName == MarcacaoEmpresaData.ID )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoEmpresaData.DATA )
|
||||
{
|
||||
data = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoEmpresaData.TEXTO )
|
||||
{
|
||||
texto = ( String ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoEmpresaData.REALIZADA )
|
||||
{
|
||||
realizada = ( String ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoEmpresaData.EMPRESA )
|
||||
{
|
||||
empresa = ( Empresa ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEmpresaData.ID ) )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEmpresaData.DATA ) )
|
||||
{
|
||||
data = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEmpresaData.TEXTO ) )
|
||||
{
|
||||
texto = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEmpresaData.REALIZADA ) )
|
||||
{
|
||||
realizada = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEmpresaData.EMPRESA ) )
|
||||
{
|
||||
empresa = ( Empresa ) value;
|
||||
}
|
||||
}
|
||||
|
||||
public Class getOuterClass()
|
||||
{
|
||||
return MarcacaoEmpresaData.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* MarcacaoEmpresaData.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 7/Dez/2004
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class MarcacaoEmpresaData extends Marcacao
|
||||
{
|
||||
public static final String ID = "id";
|
||||
public static final String DATA = "data";
|
||||
public static final String TEXTO = "texto";
|
||||
public static final String REALIZADA = "realizada";
|
||||
public static final String EMPRESA = "empresa";
|
||||
|
||||
public static final String FIELD_NAMES[] = new String[]{
|
||||
DATA, TEXTO, REALIZADA, EMPRESA, };
|
||||
|
||||
|
||||
protected static final String ALL_FIELD_NAMES[] = new String[]{
|
||||
ID, DATA, TEXTO, REALIZADA, EMPRESA, };
|
||||
|
||||
private HashMap dataHash;
|
||||
|
||||
public MarcacaoEmpresaData()
|
||||
{
|
||||
dataHash = new HashMap();
|
||||
}
|
||||
|
||||
protected Object innerGet( String fieldName )
|
||||
throws Exception
|
||||
{
|
||||
return dataHash.get( fieldName );
|
||||
}
|
||||
|
||||
protected void innerSet( String fieldName, Object value )
|
||||
throws Exception
|
||||
{
|
||||
dataHash.put( fieldName, value );
|
||||
}
|
||||
|
||||
public String []getFieldNames()
|
||||
{
|
||||
return FIELD_NAMES;
|
||||
}
|
||||
|
||||
protected String []getAllFieldNames()
|
||||
{
|
||||
return ALL_FIELD_NAMES;
|
||||
}
|
||||
|
||||
public Class getInnerClass()
|
||||
{
|
||||
return MarcacaoEmpresa.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* MarcacaoEmpresaID.java
|
||||
*
|
||||
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 7/Dez/2004
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import com.evolute.utils.jdo.jpox.*;
|
||||
|
||||
public final class MarcacaoEmpresaID extends IntegerID
|
||||
{
|
||||
public MarcacaoEmpresaID()
|
||||
{
|
||||
}
|
||||
|
||||
public MarcacaoEmpresaID( String str )
|
||||
{
|
||||
super( str );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,186 @@
|
||||
/*
|
||||
* MarcacaoEstabelecimento.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on Feb 1, 2006
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.Date;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class MarcacaoEstabelecimento implements JDOInnerObject
|
||||
{
|
||||
private Integer id;
|
||||
private Date data;
|
||||
private String realizada;
|
||||
private Integer estado;
|
||||
private Integer tecnico_hst;
|
||||
private Date data_email;
|
||||
private Date data_relatorio;
|
||||
private Estabelecimento estabelecimento;
|
||||
private String observacoes;
|
||||
|
||||
public MarcacaoEstabelecimento()
|
||||
{
|
||||
}
|
||||
|
||||
public Object getField( String fieldName )
|
||||
{
|
||||
if( fieldName == MarcacaoEstabelecimentoData.ID )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName == MarcacaoEstabelecimentoData.DATA )
|
||||
{
|
||||
return data;
|
||||
}
|
||||
else if( fieldName == MarcacaoEstabelecimentoData.REALIZADA )
|
||||
{
|
||||
return realizada;
|
||||
}
|
||||
else if( fieldName == MarcacaoEstabelecimentoData.ESTADO )
|
||||
{
|
||||
return estado;
|
||||
}
|
||||
else if( fieldName == MarcacaoEstabelecimentoData.TECNICO_HST )
|
||||
{
|
||||
return tecnico_hst;
|
||||
}
|
||||
else if( fieldName == MarcacaoEstabelecimentoData.DATA_EMAIL )
|
||||
{
|
||||
return data_email;
|
||||
}
|
||||
else if( fieldName == MarcacaoEstabelecimentoData.DATA_RELATORIO )
|
||||
{
|
||||
return data_relatorio;
|
||||
}
|
||||
else if( fieldName == MarcacaoEstabelecimentoData.ESTABELECIMENTO )
|
||||
{
|
||||
return estabelecimento;
|
||||
}
|
||||
else if( fieldName == MarcacaoEstabelecimentoData.OBSERVACOES )
|
||||
{
|
||||
return observacoes;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.ID ) )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.DATA ) )
|
||||
{
|
||||
return data;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.REALIZADA ) )
|
||||
{
|
||||
return realizada;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.ESTADO ) )
|
||||
{
|
||||
return estado;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.TECNICO_HST ) )
|
||||
{
|
||||
return tecnico_hst;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.DATA_EMAIL ) )
|
||||
{
|
||||
return data_email;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.DATA_RELATORIO ) )
|
||||
{
|
||||
return data_relatorio;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.ESTABELECIMENTO ) )
|
||||
{
|
||||
return estabelecimento;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.OBSERVACOES ) )
|
||||
{
|
||||
return observacoes;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setField( String fieldName, Object value )
|
||||
{
|
||||
if( fieldName == MarcacaoEstabelecimentoData.ID )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoEstabelecimentoData.DATA )
|
||||
{
|
||||
data = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoEstabelecimentoData.REALIZADA )
|
||||
{
|
||||
realizada = ( String ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoEstabelecimentoData.ESTADO )
|
||||
{
|
||||
estado = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoEstabelecimentoData.TECNICO_HST )
|
||||
{
|
||||
tecnico_hst = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoEstabelecimentoData.DATA_EMAIL )
|
||||
{
|
||||
data_email = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoEstabelecimentoData.DATA_RELATORIO )
|
||||
{
|
||||
data_relatorio = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoEstabelecimentoData.ESTABELECIMENTO )
|
||||
{
|
||||
estabelecimento = ( Estabelecimento ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoEstabelecimentoData.OBSERVACOES )
|
||||
{
|
||||
observacoes = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.ID ) )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.DATA ) )
|
||||
{
|
||||
data = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.REALIZADA ) )
|
||||
{
|
||||
realizada = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.ESTADO ) )
|
||||
{
|
||||
estado = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.TECNICO_HST ) )
|
||||
{
|
||||
tecnico_hst = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.DATA_EMAIL ) )
|
||||
{
|
||||
data_email = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.DATA_RELATORIO ) )
|
||||
{
|
||||
data_relatorio = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.ESTABELECIMENTO ) )
|
||||
{
|
||||
estabelecimento = ( Estabelecimento ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoEstabelecimentoData.OBSERVACOES ) )
|
||||
{
|
||||
observacoes = ( String ) value;
|
||||
}
|
||||
}
|
||||
|
||||
public Class getOuterClass()
|
||||
{
|
||||
return MarcacaoEstabelecimentoData.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* MarcacaoEstabelecimentoData.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on Feb 1, 2006
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class MarcacaoEstabelecimentoData extends Marcacao
|
||||
{
|
||||
public static final String ID = "id";
|
||||
public static final String DATA = "data";
|
||||
public static final String REALIZADA = "realizada";
|
||||
public static final String ESTADO = "estado";
|
||||
public static final String TECNICO_HST = "tecnico_hst";
|
||||
public static final String DATA_EMAIL = "data_email";
|
||||
public static final String DATA_RELATORIO = "data_relatorio";
|
||||
public static final String ESTABELECIMENTO = "estabelecimento";
|
||||
public static final String OBSERVACOES = "observacoes";
|
||||
|
||||
public static final String FIELD_NAMES[] = new String[]{
|
||||
DATA, REALIZADA, ESTADO, TECNICO_HST, DATA_EMAIL, DATA_RELATORIO, ESTABELECIMENTO,
|
||||
OBSERVACOES, };
|
||||
|
||||
|
||||
protected static final String ALL_FIELD_NAMES[] = new String[]{
|
||||
ID, DATA, REALIZADA, ESTADO, TECNICO_HST, DATA_EMAIL, DATA_RELATORIO,
|
||||
ESTABELECIMENTO, OBSERVACOES, };
|
||||
|
||||
private HashMap dataHash;
|
||||
|
||||
public MarcacaoEstabelecimentoData()
|
||||
{
|
||||
dataHash = new HashMap();
|
||||
}
|
||||
|
||||
protected Object innerGet( String fieldName )
|
||||
throws Exception
|
||||
{
|
||||
return dataHash.get( fieldName );
|
||||
}
|
||||
|
||||
protected void innerSet( String fieldName, Object value )
|
||||
throws Exception
|
||||
{
|
||||
dataHash.put( fieldName, value );
|
||||
}
|
||||
|
||||
public String []getFieldNames()
|
||||
{
|
||||
return FIELD_NAMES;
|
||||
}
|
||||
|
||||
protected String []getAllFieldNames()
|
||||
{
|
||||
return ALL_FIELD_NAMES;
|
||||
}
|
||||
|
||||
public Class getInnerClass()
|
||||
{
|
||||
return MarcacaoEstabelecimento.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* MarcacaoEstabelecimentoID.java
|
||||
*
|
||||
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Feb 1, 2006
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import com.evolute.utils.jdo.jpox.*;
|
||||
|
||||
public final class MarcacaoEstabelecimentoID extends IntegerID
|
||||
implements Serializable
|
||||
{
|
||||
public MarcacaoEstabelecimentoID()
|
||||
{
|
||||
}
|
||||
|
||||
public MarcacaoEstabelecimentoID( String str )
|
||||
{
|
||||
super( str );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* MarcacaoListLoader.java
|
||||
*
|
||||
* Created on 27 de Maio de 2004, 16:18
|
||||
*/
|
||||
|
||||
package siprp.data;
|
||||
|
||||
import javax.jdo.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
import siprp.*;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class MarcacaoListLoader
|
||||
{
|
||||
// private static PersistenceManager MANAGER = null;
|
||||
private JDOProvider JDO;
|
||||
|
||||
/** Creates a new instance of MarcacaoListLoader */
|
||||
public MarcacaoListLoader()
|
||||
{
|
||||
JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
|
||||
}
|
||||
|
||||
public Marcacao[] load( int tipo, Integer targetID )
|
||||
throws Exception
|
||||
{
|
||||
Class theClass;
|
||||
String filterString;
|
||||
switch( tipo )
|
||||
{
|
||||
case Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES: case Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA:
|
||||
theClass = MarcacaoTrabalhador.class;
|
||||
filterString = "(trabalhador.id == " + targetID + ") && (tipo == " + tipo + ")";
|
||||
break;
|
||||
|
||||
case Marcacao.TIPO_MARCACAO_ESTABELECIMENTO:
|
||||
theClass = MarcacaoEstabelecimento.class;
|
||||
filterString = "estabelecimento.id == " + targetID;
|
||||
break;
|
||||
|
||||
default:
|
||||
return new Marcacao[ 0 ];
|
||||
}
|
||||
// if( MANAGER == null )
|
||||
// {
|
||||
// MANAGER = (PersistenceManager) Singleton.getInstance( SingletonConstants.PERSISTENCE_MANAGER );
|
||||
// }
|
||||
// Transaction tx = MANAGER.currentTransaction();
|
||||
Object sessionID = null;
|
||||
try
|
||||
{
|
||||
sessionID = JDO.begin();
|
||||
Query q = JDO.getManager().newQuery( theClass, filterString );
|
||||
q.setOrdering( Marcacao.DATA + " descending" );
|
||||
Collection c = ( Collection )q.execute();
|
||||
JDOInnerObject innerObjects[] = ( JDOInnerObject [] ) c.toArray( new JDOInnerObject[0] );
|
||||
JDO.commit( sessionID );
|
||||
Marcacao marcacoes[] = new Marcacao[ innerObjects.length ];
|
||||
for( int n = 0; n < marcacoes.length; n++ )
|
||||
{
|
||||
marcacoes[ n ] = ( Marcacao ) innerObjects[ n ].getOuterClass().newInstance();
|
||||
marcacoes[ n ].setInnerObject( innerObjects[ n ] );
|
||||
}
|
||||
return marcacoes;
|
||||
}
|
||||
catch( RuntimeException ex )
|
||||
{
|
||||
JDO.rollback( sessionID );
|
||||
// Main.reconnectJDO();
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,258 @@
|
||||
/*
|
||||
* MarcacaoSaveAndDeleteHandler.java
|
||||
*
|
||||
* Created on 13 de Outubro de 2004, 18:31
|
||||
*/
|
||||
|
||||
package siprp.data;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
import siprp.medicina.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class MarcacaoSaveAndDeleteHandler
|
||||
implements JDOOperationHandlerInterface
|
||||
{
|
||||
public static final MarcacaoSaveAndDeleteHandler INSTANCE = new MarcacaoSaveAndDeleteHandler();
|
||||
|
||||
public JDOProvider JDO;
|
||||
protected MedicinaDataProvider medicinaProvider;
|
||||
|
||||
/** Creates a new instance of MarcacaoSaveAndDeleteHandler */
|
||||
public MarcacaoSaveAndDeleteHandler()
|
||||
{
|
||||
JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
|
||||
}
|
||||
|
||||
public boolean handle( JDOObject object, int operation, int moment )
|
||||
throws Exception
|
||||
{
|
||||
if( JDO == null )
|
||||
{
|
||||
JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
|
||||
}
|
||||
switch( operation )
|
||||
{
|
||||
case JDOOperationHandlerInterface.OP_SAVE:
|
||||
switch( moment )
|
||||
{
|
||||
case JDOOperationHandlerInterface.MOMENT_BEFORE:
|
||||
return preSave( (Marcacao) object );
|
||||
|
||||
case JDOOperationHandlerInterface.MOMENT_AFTER:
|
||||
return postSave( (Marcacao) object );
|
||||
}
|
||||
return false;
|
||||
|
||||
case JDOOperationHandlerInterface.OP_DELETE:
|
||||
switch( moment )
|
||||
{
|
||||
case JDOOperationHandlerInterface.MOMENT_BEFORE:
|
||||
return preDelete( (Marcacao) object );
|
||||
|
||||
case JDOOperationHandlerInterface.MOMENT_AFTER:
|
||||
return postDelete( (Marcacao) object );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean preSave( Marcacao object )
|
||||
throws Exception
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean postSave( Marcacao object )
|
||||
throws Exception
|
||||
{
|
||||
if( object instanceof MarcacaoEmpresaData )
|
||||
{
|
||||
AvisoData aviso = (AvisoData) JDO.load( AvisoData.class,
|
||||
new Object[]{ object.get( MarcacaoEmpresaData.ID ), new Integer( AvisoData.TIPO_EMPRESA ) },
|
||||
new String[]{ AvisoData.EVENTO_ID, AvisoData.TIPO } );
|
||||
if( aviso == null )
|
||||
{
|
||||
aviso = new AvisoData();
|
||||
}
|
||||
aviso.set( AvisoData.TIPO, new Integer( AvisoData.TIPO_EMPRESA ) );
|
||||
EmpresaData empresa = ( EmpresaData ) object.get( MarcacaoEmpresaData.EMPRESA );
|
||||
aviso.set( AvisoData.EMPRESA, empresa );
|
||||
aviso.set( AvisoData.EVENTO_ID, object.get( MarcacaoEmpresaData.ID ) );
|
||||
Date dataEvento = (Date) object.get( Marcacao.DATA );
|
||||
aviso.set( AvisoData.DATA_EVENTO, dataEvento );
|
||||
aviso.set( AvisoData.DATA_AVISO, dataEvento );
|
||||
String descricao = "Tarefa ";
|
||||
aviso.set( AvisoData.DESCRICAO, descricao );
|
||||
aviso.save();
|
||||
|
||||
empresa.save();
|
||||
}
|
||||
else if( object instanceof MarcacaoEstabelecimentoData )
|
||||
{
|
||||
AvisoData aviso = (AvisoData) JDO.load( AvisoData.class,
|
||||
new Object[]{ object.get( MarcacaoEstabelecimentoData.ID ), new Integer( AvisoData.TIPO_ESTABELECIMENTO ) },
|
||||
new String[]{ AvisoData.EVENTO_ID, AvisoData.TIPO } );
|
||||
if( aviso == null )
|
||||
{
|
||||
aviso = new AvisoData();
|
||||
}
|
||||
aviso.set( AvisoData.TIPO, new Integer( AvisoData.TIPO_ESTABELECIMENTO ) );
|
||||
EstabelecimentoData estabelecimento = ( EstabelecimentoData ) object.get( MarcacaoEstabelecimentoData.ESTABELECIMENTO );
|
||||
aviso.set( AvisoData.ESTABELECIMENTO, estabelecimento );
|
||||
EmpresaData empresa = ( EmpresaData )estabelecimento.get( EstabelecimentoData.EMPRESA );
|
||||
aviso.set( AvisoData.EMPRESA, empresa );
|
||||
aviso.set( AvisoData.EVENTO_ID, object.get( MarcacaoEstabelecimentoData.ID ) );
|
||||
Date dataEvento = (Date) object.get( Marcacao.DATA );
|
||||
Date dataAviso = new Date( dataEvento.getTime() );
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime( dataAviso );
|
||||
cal.add( Calendar.DAY_OF_MONTH, -14 );
|
||||
dataAviso = cal.getTime();
|
||||
aviso.set( AvisoData.DATA_AVISO, dataAviso );
|
||||
aviso.set( AvisoData.DATA_EVENTO, dataEvento );
|
||||
String descricao = "Visita ";
|
||||
aviso.set( AvisoData.DESCRICAO, descricao );
|
||||
cal = Calendar.getInstance();
|
||||
cal.setTime( dataEvento );
|
||||
cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 );
|
||||
cal.set( Calendar.MILLISECOND, 0 );
|
||||
dataEvento = cal.getTime();
|
||||
|
||||
cal = Calendar.getInstance();
|
||||
cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 10, 0, 0 );
|
||||
cal.set( Calendar.MILLISECOND, 0 );
|
||||
Date hoje = cal.getTime();
|
||||
if( hoje.before( dataEvento ) )
|
||||
{
|
||||
aviso.save();
|
||||
}
|
||||
|
||||
estabelecimento.save();
|
||||
}
|
||||
if( object instanceof MarcacaoTrabalhadorData )
|
||||
{
|
||||
AvisoData aviso = (AvisoData) JDO.load( AvisoData.class,
|
||||
new Object[]{ object.get( MarcacaoTrabalhadorData.ID ), new Integer( AvisoData.TIPO_TRABALHADOR ) },
|
||||
new String[]{ AvisoData.EVENTO_ID, AvisoData.TIPO } );
|
||||
System.out.println( "AVISO LOADED: " + aviso + " id: " + ( aviso != null ? aviso.get( AvisoData.ID ) : "n/a" )
|
||||
+ " MT.ID: " + object.get( MarcacaoTrabalhadorData.ID )
|
||||
+ " AD.TIPO: " + new Integer( AvisoData.TIPO_TRABALHADOR ) );
|
||||
if( aviso == null )
|
||||
{
|
||||
System.out.println( "novo aviso" );
|
||||
aviso = new AvisoData();
|
||||
}
|
||||
aviso.set( AvisoData.TIPO, new Integer( AvisoData.TIPO_TRABALHADOR ) );
|
||||
TrabalhadorData trab = ( TrabalhadorData ) object.get( MarcacaoTrabalhadorData.TRABALHADOR );
|
||||
aviso.set( AvisoData.TRABALHADOR, trab );
|
||||
EstabelecimentoData estabelecimento = ( EstabelecimentoData ) trab.get( TrabalhadorData.ESTABELECIMENTO );
|
||||
aviso.set( AvisoData.ESTABELECIMENTO, estabelecimento );
|
||||
EmpresaData empresa = ( EmpresaData ) estabelecimento.get( EstabelecimentoData.EMPRESA );
|
||||
aviso.set( AvisoData.EMPRESA, empresa );
|
||||
aviso.set( AvisoData.EVENTO_ID, object.get( MarcacaoTrabalhadorData.ID ) );
|
||||
Date dataEvento = (Date) object.get( Marcacao.DATA );
|
||||
Date dataAviso = new Date( dataEvento.getTime() );
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime( dataAviso );
|
||||
cal.add( Calendar.DAY_OF_MONTH, -14 );
|
||||
dataAviso = cal.getTime();
|
||||
aviso.set( AvisoData.DATA_AVISO, dataAviso );
|
||||
aviso.set( AvisoData.DATA_EVENTO, dataEvento.clone() );
|
||||
String descricao = "";
|
||||
switch( ( ( Integer ) object.get( MarcacaoTrabalhadorData.TIPO ) ).intValue() )
|
||||
{
|
||||
case MarcacaoTrabalhadorData.TIPO_EXAMES:
|
||||
descricao = "Exames";
|
||||
break;
|
||||
|
||||
case MarcacaoTrabalhadorData.TIPO_CONSULTA:
|
||||
Integer motivo = ( ( Integer ) object.get( MarcacaoTrabalhadorData.MOTIVO ) );
|
||||
descricao = "Consulta " + ( motivo == null ? "" : ("(" + MedicinaDataProvider.TIPOS_CONSULTAS[ motivo.intValue() ] + ")" ) );
|
||||
break;
|
||||
}
|
||||
aviso.set( AvisoData.DESCRICAO, descricao );
|
||||
cal = Calendar.getInstance();
|
||||
cal.setTime( dataEvento );
|
||||
cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 );
|
||||
cal.set( Calendar.MILLISECOND, 0 );
|
||||
dataEvento = cal.getTime();
|
||||
|
||||
cal = Calendar.getInstance();
|
||||
cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 10, 0, 0 );
|
||||
cal.set( Calendar.MILLISECOND, 0 );
|
||||
Date hoje = cal.getTime();
|
||||
if( hoje.before( dataEvento ) )
|
||||
{
|
||||
if( !hoje.before( dataAviso ) )
|
||||
{
|
||||
aviso.set( AvisoData.DATA_AVISO, dataEvento.clone() );
|
||||
}
|
||||
aviso.save();
|
||||
}
|
||||
|
||||
trab.save();
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean preDelete( Marcacao object )
|
||||
throws Exception
|
||||
{
|
||||
if( object instanceof MarcacaoTrabalhadorData &&
|
||||
( ( Integer ) object.get( MarcacaoTrabalhadorData.TIPO ) ).intValue() == MarcacaoTrabalhadorData.TIPO_EXAMES )
|
||||
{
|
||||
if( medicinaProvider == null )
|
||||
{
|
||||
medicinaProvider = (MedicinaDataProvider)MedicinaDataProvider.getProvider();
|
||||
}
|
||||
medicinaProvider.deleteDetalhesRealizadosForMarcacao( ( Integer ) object.get( MarcacaoTrabalhadorData.ID ) );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean postDelete( Marcacao object )
|
||||
throws Exception
|
||||
{
|
||||
System.out.println( "!delete!" );
|
||||
Integer tipo;
|
||||
if( object instanceof MarcacaoEmpresaData )
|
||||
{
|
||||
tipo = new Integer( AvisoData.TIPO_EMPRESA );
|
||||
}
|
||||
else if( object instanceof MarcacaoEstabelecimentoData )
|
||||
{
|
||||
tipo = new Integer( AvisoData.TIPO_ESTABELECIMENTO );
|
||||
}
|
||||
if( object instanceof MarcacaoTrabalhadorData )
|
||||
{
|
||||
tipo = new Integer( AvisoData.TIPO_TRABALHADOR );
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
AvisoData aviso = (AvisoData) JDO.load( AvisoData.class,
|
||||
new Object[]{ object.get( "id" ), tipo },
|
||||
new String[]{ AvisoData.EVENTO_ID, AvisoData.TIPO } );
|
||||
if( aviso != null )
|
||||
{
|
||||
aviso.delete();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,203 @@
|
||||
/*
|
||||
* MarcacaoTrabalhador.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on Jan 28, 2006
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.Date;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class MarcacaoTrabalhador implements JDOInnerObject
|
||||
{
|
||||
private Integer id;
|
||||
private Date data;
|
||||
private String realizada;
|
||||
private Integer estado;
|
||||
private Integer motivo;
|
||||
private Date data_email;
|
||||
private Date data_relatorio;
|
||||
private Integer tipo;
|
||||
private Trabalhador trabalhador;
|
||||
private String observacoes;
|
||||
|
||||
public MarcacaoTrabalhador()
|
||||
{
|
||||
}
|
||||
|
||||
public Object getField( String fieldName )
|
||||
{
|
||||
if( fieldName == MarcacaoTrabalhadorData.ID )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.DATA )
|
||||
{
|
||||
return data;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.REALIZADA )
|
||||
{
|
||||
return realizada;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.ESTADO )
|
||||
{
|
||||
return estado;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.MOTIVO )
|
||||
{
|
||||
return motivo;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.DATA_EMAIL )
|
||||
{
|
||||
return data_email;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.DATA_RELATORIO )
|
||||
{
|
||||
return data_relatorio;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.TIPO )
|
||||
{
|
||||
return tipo;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.TRABALHADOR )
|
||||
{
|
||||
return trabalhador;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.OBSERVACOES )
|
||||
{
|
||||
return observacoes;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.ID ) )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.DATA ) )
|
||||
{
|
||||
return data;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.REALIZADA ) )
|
||||
{
|
||||
return realizada;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.ESTADO ) )
|
||||
{
|
||||
return estado;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.MOTIVO ) )
|
||||
{
|
||||
return motivo;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.DATA_EMAIL ) )
|
||||
{
|
||||
return data_email;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.DATA_RELATORIO ) )
|
||||
{
|
||||
return data_relatorio;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.TIPO ) )
|
||||
{
|
||||
return tipo;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.TRABALHADOR ) )
|
||||
{
|
||||
return trabalhador;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.OBSERVACOES ) )
|
||||
{
|
||||
return observacoes;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setField( String fieldName, Object value )
|
||||
{
|
||||
if( fieldName == MarcacaoTrabalhadorData.ID )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.DATA )
|
||||
{
|
||||
data = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.REALIZADA )
|
||||
{
|
||||
realizada = ( String ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.ESTADO )
|
||||
{
|
||||
estado = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.MOTIVO )
|
||||
{
|
||||
motivo = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.DATA_EMAIL )
|
||||
{
|
||||
data_email = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.DATA_RELATORIO )
|
||||
{
|
||||
data_relatorio = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.TIPO )
|
||||
{
|
||||
tipo = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.TRABALHADOR )
|
||||
{
|
||||
trabalhador = ( Trabalhador ) value;
|
||||
}
|
||||
else if( fieldName == MarcacaoTrabalhadorData.OBSERVACOES )
|
||||
{
|
||||
observacoes = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.ID ) )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.DATA ) )
|
||||
{
|
||||
data = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.REALIZADA ) )
|
||||
{
|
||||
realizada = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.ESTADO ) )
|
||||
{
|
||||
estado = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.MOTIVO ) )
|
||||
{
|
||||
motivo = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.DATA_EMAIL ) )
|
||||
{
|
||||
data_email = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.DATA_RELATORIO ) )
|
||||
{
|
||||
data_relatorio = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.TIPO ) )
|
||||
{
|
||||
tipo = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.TRABALHADOR ) )
|
||||
{
|
||||
trabalhador = ( Trabalhador ) value;
|
||||
}
|
||||
else if( fieldName.equals( MarcacaoTrabalhadorData.OBSERVACOES ) )
|
||||
{
|
||||
observacoes = ( String ) value;
|
||||
}
|
||||
}
|
||||
|
||||
public Class getOuterClass()
|
||||
{
|
||||
return MarcacaoTrabalhadorData.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* MarcacaoTrabalhadorConstants.java
|
||||
*
|
||||
* Created on 11 de Outubro de 2004, 13:18
|
||||
*/
|
||||
|
||||
package siprp.data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public interface MarcacaoTrabalhadorConstants
|
||||
{
|
||||
public static final int TIPO_EXAMES = 0;
|
||||
public static final int TIPO_CONSULTA = 1;
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* MarcacaoTrabalhadorData.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on Jan 28, 2006
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class MarcacaoTrabalhadorData extends Marcacao
|
||||
implements MarcacaoTrabalhadorConstants
|
||||
{
|
||||
public static final String ID = "id";
|
||||
public static final String DATA = "data";
|
||||
public static final String REALIZADA = "realizada";
|
||||
public static final String ESTADO = "estado";
|
||||
public static final String MOTIVO = "motivo";
|
||||
public static final String DATA_EMAIL = "data_email";
|
||||
public static final String DATA_RELATORIO = "data_relatorio";
|
||||
public static final String TIPO = "tipo";
|
||||
public static final String TRABALHADOR = "trabalhador";
|
||||
public static final String OBSERVACOES = "observacoes";
|
||||
|
||||
public static final String FIELD_NAMES[] = new String[]{
|
||||
DATA, REALIZADA, ESTADO, MOTIVO, DATA_EMAIL, DATA_RELATORIO, TIPO, TRABALHADOR,
|
||||
OBSERVACOES, };
|
||||
|
||||
|
||||
protected static final String ALL_FIELD_NAMES[] = new String[]{
|
||||
ID, DATA, REALIZADA, ESTADO, MOTIVO, DATA_EMAIL, DATA_RELATORIO, TIPO, TRABALHADOR,
|
||||
OBSERVACOES, };
|
||||
|
||||
private HashMap dataHash;
|
||||
|
||||
public MarcacaoTrabalhadorData()
|
||||
{
|
||||
dataHash = new HashMap();
|
||||
}
|
||||
|
||||
protected Object innerGet( String fieldName )
|
||||
throws Exception
|
||||
{
|
||||
return dataHash.get( fieldName );
|
||||
}
|
||||
|
||||
protected void innerSet( String fieldName, Object value )
|
||||
throws Exception
|
||||
{
|
||||
dataHash.put( fieldName, value );
|
||||
}
|
||||
|
||||
public String []getFieldNames()
|
||||
{
|
||||
return FIELD_NAMES;
|
||||
}
|
||||
|
||||
protected String []getAllFieldNames()
|
||||
{
|
||||
return ALL_FIELD_NAMES;
|
||||
}
|
||||
|
||||
public Class getInnerClass()
|
||||
{
|
||||
return MarcacaoTrabalhador.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* MarcacaoTrabalhadorID.java
|
||||
*
|
||||
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Jan 28, 2006
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import com.evolute.utils.jdo.jpox.*;
|
||||
|
||||
public final class MarcacaoTrabalhadorID extends IntegerID
|
||||
implements Serializable
|
||||
{
|
||||
public MarcacaoTrabalhadorID()
|
||||
{
|
||||
}
|
||||
|
||||
public MarcacaoTrabalhadorID( String str )
|
||||
{
|
||||
super( str );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Medico.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 27/Jan/2005
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class Medico implements JDOInnerObject
|
||||
{
|
||||
private Integer id;
|
||||
private String nome;
|
||||
private String numero_cedula;
|
||||
private String inactivo;
|
||||
|
||||
public Medico()
|
||||
{
|
||||
}
|
||||
|
||||
public Object getField( String fieldName )
|
||||
{
|
||||
if( fieldName == MedicoData.ID )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName == MedicoData.NOME )
|
||||
{
|
||||
return nome;
|
||||
}
|
||||
else if( fieldName == MedicoData.NUMERO_CEDULA )
|
||||
{
|
||||
return numero_cedula;
|
||||
}
|
||||
else if( fieldName == MedicoData.INACTIVO )
|
||||
{
|
||||
return inactivo;
|
||||
}
|
||||
else if( fieldName.equals( MedicoData.ID ) )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName.equals( MedicoData.NOME ) )
|
||||
{
|
||||
return nome;
|
||||
}
|
||||
else if( fieldName.equals( MedicoData.NUMERO_CEDULA ) )
|
||||
{
|
||||
return numero_cedula;
|
||||
}
|
||||
else if( fieldName.equals( MedicoData.INACTIVO ) )
|
||||
{
|
||||
return inactivo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setField( String fieldName, Object value )
|
||||
{
|
||||
if( fieldName == MedicoData.ID )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == MedicoData.NOME )
|
||||
{
|
||||
nome = ( String ) value;
|
||||
}
|
||||
else if( fieldName == MedicoData.NUMERO_CEDULA )
|
||||
{
|
||||
numero_cedula = ( String ) value;
|
||||
}
|
||||
else if( fieldName == MedicoData.INACTIVO )
|
||||
{
|
||||
inactivo = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( MedicoData.ID ) )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( MedicoData.NOME ) )
|
||||
{
|
||||
nome = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( MedicoData.NUMERO_CEDULA ) )
|
||||
{
|
||||
numero_cedula = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( MedicoData.INACTIVO ) )
|
||||
{
|
||||
inactivo = ( String ) value;
|
||||
}
|
||||
}
|
||||
|
||||
public Class getOuterClass()
|
||||
{
|
||||
return MedicoData.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* MedicoData.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 27/Jan/2005
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class MedicoData extends JDOObject
|
||||
implements DisableDeleteable
|
||||
{
|
||||
public static final String ID = "id";
|
||||
public static final String NOME = "nome";
|
||||
public static final String NUMERO_CEDULA = "numero_cedula";
|
||||
public static final String INACTIVO = "inactivo";
|
||||
|
||||
public static final String FIELD_NAMES[] = new String[]{
|
||||
NOME, NUMERO_CEDULA, };
|
||||
|
||||
|
||||
protected static final String ALL_FIELD_NAMES[] = new String[]{
|
||||
ID, NOME, NUMERO_CEDULA, INACTIVO, };
|
||||
|
||||
private HashMap dataHash;
|
||||
|
||||
public MedicoData()
|
||||
{
|
||||
dataHash = new HashMap();
|
||||
}
|
||||
|
||||
protected Object innerGet( String fieldName )
|
||||
throws Exception
|
||||
{
|
||||
return dataHash.get( fieldName );
|
||||
}
|
||||
|
||||
protected void innerSet( String fieldName, Object value )
|
||||
throws Exception
|
||||
{
|
||||
dataHash.put( fieldName, value );
|
||||
}
|
||||
|
||||
public String []getFieldNames()
|
||||
{
|
||||
return FIELD_NAMES;
|
||||
}
|
||||
|
||||
protected String []getAllFieldNames()
|
||||
{
|
||||
return ALL_FIELD_NAMES;
|
||||
}
|
||||
|
||||
public Class getInnerClass()
|
||||
{
|
||||
return Medico.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* MedicoID.java
|
||||
*
|
||||
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 27/Jan/2005
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import com.evolute.utils.jdo.jpox.*;
|
||||
|
||||
public final class MedicoID extends IntegerID
|
||||
{
|
||||
public MedicoID()
|
||||
{
|
||||
}
|
||||
|
||||
public MedicoID( String str )
|
||||
{
|
||||
super( str );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,180 @@
|
||||
/*
|
||||
* SearchExecuterFactory.java
|
||||
*
|
||||
* Created on 24 de Maio de 2004, 19:30
|
||||
*/
|
||||
|
||||
package siprp.data;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.arrays.*;
|
||||
import com.evolute.utils.db.*;
|
||||
import com.evolute.utils.sql.*;
|
||||
import com.evolute.utils.ui.search.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class SearchExecuterFactory
|
||||
{
|
||||
private static SearchExecuter empresaExecuter;
|
||||
private static SearchExecuter estabelecimentoExecuter;
|
||||
private static SearchExecuter trabalhadorExecuter;
|
||||
|
||||
|
||||
|
||||
/** Creates a new instance of SearchExecuterFactory */
|
||||
private SearchExecuterFactory()
|
||||
{
|
||||
}
|
||||
|
||||
public static SearchExecuter getSearchExecuter( Class objectClass )
|
||||
{
|
||||
if( objectClass.equals( EmpresaData.class ) )
|
||||
{
|
||||
System.out.println( "Empresa" );
|
||||
return getEmpresaSearchExecuter();
|
||||
}
|
||||
else if( objectClass == EstabelecimentoData.class )
|
||||
{
|
||||
return getEstabelecimentoSearchExecuter();
|
||||
}
|
||||
else if( objectClass == TrabalhadorData.class )
|
||||
{
|
||||
return getTrabalhadorSearchExecuter();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static SearchExecuter getEmpresaSearchExecuter()
|
||||
{
|
||||
if( empresaExecuter == null )
|
||||
{
|
||||
empresaExecuter = new SearchExecuter(){
|
||||
|
||||
private final DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ );
|
||||
|
||||
public Virtual2DArray search( String pattern )
|
||||
throws Exception
|
||||
{
|
||||
|
||||
Executer executer = dbm.getSharedExecuter( this );
|
||||
Select select = new Select( new String[]{ "empresas" },
|
||||
new String[]{ EmpresaData.ID, EmpresaData.DESIGNACAO_SOCIAL, EmpresaData.DESIGNACAO_SOCIAL_PLAIN },
|
||||
new Field( EmpresaData.DESIGNACAO_SOCIAL_PLAIN ).isLike( "%" + com.evolute.utils.strings.StringPlainer.convertString( pattern, false, false ) + "%" ).and(
|
||||
new Field( EmpresaData.INACTIVO ).isDifferent( "y" ) ),
|
||||
new String[]{ EmpresaData.DESIGNACAO_SOCIAL_PLAIN }, null );
|
||||
System.out.println( "SELECT : " + select );
|
||||
return executer.executeQuery( select );
|
||||
}
|
||||
|
||||
public boolean hasDetails()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void showDetails( SearchDialog dialog, Object o )
|
||||
throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
public String getSearchTitle()
|
||||
{
|
||||
return "Procurar Empresa";
|
||||
}
|
||||
|
||||
public String[] getColumnNames()
|
||||
{
|
||||
return new String[]{ "Designa\u00e7\u00e3o Social" };
|
||||
}
|
||||
};
|
||||
}
|
||||
return empresaExecuter;
|
||||
}
|
||||
|
||||
private static SearchExecuter getEstabelecimentoSearchExecuter()
|
||||
{
|
||||
if( estabelecimentoExecuter == null )
|
||||
{
|
||||
estabelecimentoExecuter = new SearchExecuter(){
|
||||
private final DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ );
|
||||
|
||||
public Virtual2DArray search( String pattern )
|
||||
throws Exception
|
||||
{
|
||||
Executer executer = dbm.getSharedExecuter( this );
|
||||
Select select = new Select( new String[]{ "estabelecimentos" },
|
||||
new String[]{ EstabelecimentoData.ID, EstabelecimentoData.NOME, EstabelecimentoData.NOME_PLAIN },
|
||||
new Field( EstabelecimentoData.NOME_PLAIN ).isLike( "%" + com.evolute.utils.strings.StringPlainer.convertString( pattern, false, false ) + "%" ),
|
||||
new String[]{ EstabelecimentoData.NOME_PLAIN }, null );
|
||||
return executer.executeQuery( select );
|
||||
}
|
||||
|
||||
public boolean hasDetails()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void showDetails( SearchDialog dialog, Object o )
|
||||
throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
public String getSearchTitle()
|
||||
{
|
||||
return "Procurar Estabelecimento";
|
||||
}
|
||||
|
||||
public String[] getColumnNames()
|
||||
{
|
||||
return new String[]{ "Designa\u00e7\u00e3o" };
|
||||
}
|
||||
};
|
||||
}
|
||||
return estabelecimentoExecuter;
|
||||
}
|
||||
|
||||
|
||||
private static SearchExecuter getTrabalhadorSearchExecuter()
|
||||
{
|
||||
if( trabalhadorExecuter == null )
|
||||
{
|
||||
trabalhadorExecuter = new SearchExecuter(){
|
||||
private final DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ );
|
||||
|
||||
public Virtual2DArray search( String pattern )
|
||||
throws Exception
|
||||
{
|
||||
Executer executer = dbm.getSharedExecuter( this );
|
||||
Select select = new Select( new String[]{ "trabalhadores" },
|
||||
new String[]{ TrabalhadorData.ID, TrabalhadorData.NOME, TrabalhadorData.NOME_PLAIN },
|
||||
new Field( TrabalhadorData.NOME_PLAIN ).isLike( "%" + com.evolute.utils.strings.StringPlainer.convertString( pattern, false, false ) + "%" ),
|
||||
new String[]{ TrabalhadorData.NOME_PLAIN }, null );
|
||||
return executer.executeQuery( select );
|
||||
}
|
||||
|
||||
public boolean hasDetails()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void showDetails( SearchDialog dialog, Object o )
|
||||
throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
public String getSearchTitle()
|
||||
{
|
||||
return "Procurar Trablhador";
|
||||
}
|
||||
|
||||
public String[] getColumnNames()
|
||||
{
|
||||
return new String[]{ "Nome" };
|
||||
}
|
||||
};
|
||||
}
|
||||
return trabalhadorExecuter;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* TecnicoHST.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on Feb 1, 2006
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class TecnicoHST implements JDOInnerObject
|
||||
{
|
||||
private Integer id;
|
||||
private String nome;
|
||||
private String nome_plain;
|
||||
private String iniciais;
|
||||
private Integer identificador;
|
||||
private String inactivo;
|
||||
|
||||
public TecnicoHST()
|
||||
{
|
||||
}
|
||||
|
||||
public Object getField( String fieldName )
|
||||
{
|
||||
if( fieldName == TecnicoHSTData.ID )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName == TecnicoHSTData.NOME )
|
||||
{
|
||||
return nome;
|
||||
}
|
||||
else if( fieldName == TecnicoHSTData.NOME_PLAIN )
|
||||
{
|
||||
return nome_plain;
|
||||
}
|
||||
else if( fieldName == TecnicoHSTData.INICIAIS )
|
||||
{
|
||||
return iniciais;
|
||||
}
|
||||
else if( fieldName == TecnicoHSTData.IDENTIFICADOR )
|
||||
{
|
||||
return identificador;
|
||||
}
|
||||
else if( fieldName == TecnicoHSTData.INACTIVO )
|
||||
{
|
||||
return inactivo;
|
||||
}
|
||||
else if( fieldName.equals( TecnicoHSTData.ID ) )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName.equals( TecnicoHSTData.NOME ) )
|
||||
{
|
||||
return nome;
|
||||
}
|
||||
else if( fieldName.equals( TecnicoHSTData.NOME_PLAIN ) )
|
||||
{
|
||||
return nome_plain;
|
||||
}
|
||||
else if( fieldName.equals( TecnicoHSTData.INICIAIS ) )
|
||||
{
|
||||
return iniciais;
|
||||
}
|
||||
else if( fieldName.equals( TecnicoHSTData.IDENTIFICADOR ) )
|
||||
{
|
||||
return identificador;
|
||||
}
|
||||
else if( fieldName.equals( TecnicoHSTData.INACTIVO ) )
|
||||
{
|
||||
return inactivo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setField( String fieldName, Object value )
|
||||
{
|
||||
if( fieldName == TecnicoHSTData.ID )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == TecnicoHSTData.NOME )
|
||||
{
|
||||
nome = ( String ) value;
|
||||
}
|
||||
else if( fieldName == TecnicoHSTData.NOME_PLAIN )
|
||||
{
|
||||
nome_plain = ( String ) value;
|
||||
}
|
||||
else if( fieldName == TecnicoHSTData.INICIAIS )
|
||||
{
|
||||
iniciais = ( String ) value;
|
||||
}
|
||||
else if( fieldName == TecnicoHSTData.IDENTIFICADOR )
|
||||
{
|
||||
identificador = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == TecnicoHSTData.INACTIVO )
|
||||
{
|
||||
inactivo = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( TecnicoHSTData.ID ) )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( TecnicoHSTData.NOME ) )
|
||||
{
|
||||
nome = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( TecnicoHSTData.NOME_PLAIN ) )
|
||||
{
|
||||
nome_plain = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( TecnicoHSTData.INICIAIS ) )
|
||||
{
|
||||
iniciais = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( TecnicoHSTData.IDENTIFICADOR ) )
|
||||
{
|
||||
identificador = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( TecnicoHSTData.INACTIVO ) )
|
||||
{
|
||||
inactivo = ( String ) value;
|
||||
}
|
||||
}
|
||||
|
||||
public Class getOuterClass()
|
||||
{
|
||||
return TecnicoHSTData.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* TecnicoHSTData.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on Feb 1, 2006
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class TecnicoHSTData extends JDOObject
|
||||
implements DisableDeleteable
|
||||
{
|
||||
public static final String ID = "id";
|
||||
public static final String NOME = "nome";
|
||||
public static final String NOME_PLAIN = "nome_plain";
|
||||
public static final String INICIAIS = "iniciais";
|
||||
public static final String IDENTIFICADOR = "identificador";
|
||||
public static final String INACTIVO = "inactivo";
|
||||
|
||||
public static final String FIELD_NAMES[] = new String[]{
|
||||
NOME, NOME_PLAIN, INICIAIS, IDENTIFICADOR, };
|
||||
|
||||
|
||||
protected static final String ALL_FIELD_NAMES[] = new String[]{
|
||||
ID, NOME, NOME_PLAIN, INICIAIS, IDENTIFICADOR, INACTIVO, };
|
||||
|
||||
private HashMap dataHash;
|
||||
|
||||
public TecnicoHSTData()
|
||||
{
|
||||
dataHash = new HashMap();
|
||||
}
|
||||
|
||||
protected Object innerGet( String fieldName )
|
||||
throws Exception
|
||||
{
|
||||
return dataHash.get( fieldName );
|
||||
}
|
||||
|
||||
protected void innerSet( String fieldName, Object value )
|
||||
throws Exception
|
||||
{
|
||||
dataHash.put( fieldName, value );
|
||||
}
|
||||
|
||||
public String []getFieldNames()
|
||||
{
|
||||
return FIELD_NAMES;
|
||||
}
|
||||
|
||||
protected String []getAllFieldNames()
|
||||
{
|
||||
return ALL_FIELD_NAMES;
|
||||
}
|
||||
|
||||
public Class getInnerClass()
|
||||
{
|
||||
return TecnicoHST.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* TecnicoHSTID.java
|
||||
*
|
||||
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Feb 1, 2006
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import com.evolute.utils.jdo.jpox.*;
|
||||
|
||||
public final class TecnicoHSTID extends IntegerID
|
||||
implements Serializable
|
||||
{
|
||||
public TecnicoHSTID()
|
||||
{
|
||||
}
|
||||
|
||||
public TecnicoHSTID( String str )
|
||||
{
|
||||
super( str );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,356 @@
|
||||
/*
|
||||
* Trabalhador.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 24/Nov/2005
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.Date;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class Trabalhador implements JDOInnerObject
|
||||
{
|
||||
private Integer id;
|
||||
private String nome;
|
||||
private String nome_plain;
|
||||
private String sexo;
|
||||
private Date data_nascimento;
|
||||
private String nacionalidade;
|
||||
private String numero_mecanografico;
|
||||
private Date data_admissao;
|
||||
private String categoria;
|
||||
private String local_trabalho;
|
||||
private String funcao_proposta;
|
||||
private Date data_admissao_funcao;
|
||||
private String observacoes;
|
||||
private Estabelecimento estabelecimento;
|
||||
private Date data_demissao;
|
||||
private String observacoes_gestao;
|
||||
private Integer perfil;
|
||||
private String inactivo;
|
||||
private Date actualizacao;
|
||||
|
||||
public Trabalhador()
|
||||
{
|
||||
}
|
||||
|
||||
public Object getField( String fieldName )
|
||||
{
|
||||
if( fieldName == TrabalhadorData.ID )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.NOME )
|
||||
{
|
||||
return nome;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.NOME_PLAIN )
|
||||
{
|
||||
return nome_plain;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.SEXO )
|
||||
{
|
||||
return sexo;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.DATA_NASCIMENTO )
|
||||
{
|
||||
return data_nascimento;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.NACIONALIDADE )
|
||||
{
|
||||
return nacionalidade;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.NUMERO_MECANOGRAFICO )
|
||||
{
|
||||
return numero_mecanografico;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.DATA_ADMISSAO )
|
||||
{
|
||||
return data_admissao;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.CATEGORIA )
|
||||
{
|
||||
return categoria;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.LOCAL_TRABALHO )
|
||||
{
|
||||
return local_trabalho;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.FUNCAO_PROPOSTA )
|
||||
{
|
||||
return funcao_proposta;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.DATA_ADMISSAO_FUNCAO )
|
||||
{
|
||||
return data_admissao_funcao;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.OBSERVACOES )
|
||||
{
|
||||
return observacoes;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.ESTABELECIMENTO )
|
||||
{
|
||||
return estabelecimento;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.DATA_DEMISSAO )
|
||||
{
|
||||
return data_demissao;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.OBSERVACOES_GESTAO )
|
||||
{
|
||||
return observacoes_gestao;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.PERFIL )
|
||||
{
|
||||
return perfil;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.INACTIVO )
|
||||
{
|
||||
return inactivo;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.ACTUALIZACAO )
|
||||
{
|
||||
return actualizacao;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.ID ) )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.NOME ) )
|
||||
{
|
||||
return nome;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.NOME_PLAIN ) )
|
||||
{
|
||||
return nome_plain;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.SEXO ) )
|
||||
{
|
||||
return sexo;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.DATA_NASCIMENTO ) )
|
||||
{
|
||||
return data_nascimento;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.NACIONALIDADE ) )
|
||||
{
|
||||
return nacionalidade;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.NUMERO_MECANOGRAFICO ) )
|
||||
{
|
||||
return numero_mecanografico;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.DATA_ADMISSAO ) )
|
||||
{
|
||||
return data_admissao;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.CATEGORIA ) )
|
||||
{
|
||||
return categoria;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.LOCAL_TRABALHO ) )
|
||||
{
|
||||
return local_trabalho;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.FUNCAO_PROPOSTA ) )
|
||||
{
|
||||
return funcao_proposta;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.DATA_ADMISSAO_FUNCAO ) )
|
||||
{
|
||||
return data_admissao_funcao;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.OBSERVACOES ) )
|
||||
{
|
||||
return observacoes;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.ESTABELECIMENTO ) )
|
||||
{
|
||||
return estabelecimento;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.DATA_DEMISSAO ) )
|
||||
{
|
||||
return data_demissao;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.OBSERVACOES_GESTAO ) )
|
||||
{
|
||||
return observacoes_gestao;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.PERFIL ) )
|
||||
{
|
||||
return perfil;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.INACTIVO ) )
|
||||
{
|
||||
return inactivo;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.ACTUALIZACAO ) )
|
||||
{
|
||||
return actualizacao;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setField( String fieldName, Object value )
|
||||
{
|
||||
if( fieldName == TrabalhadorData.ID )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.NOME )
|
||||
{
|
||||
nome = ( String ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.NOME_PLAIN )
|
||||
{
|
||||
nome_plain = ( String ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.SEXO )
|
||||
{
|
||||
sexo = ( String ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.DATA_NASCIMENTO )
|
||||
{
|
||||
data_nascimento = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.NACIONALIDADE )
|
||||
{
|
||||
nacionalidade = ( String ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.NUMERO_MECANOGRAFICO )
|
||||
{
|
||||
numero_mecanografico = ( String ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.DATA_ADMISSAO )
|
||||
{
|
||||
data_admissao = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.CATEGORIA )
|
||||
{
|
||||
categoria = ( String ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.LOCAL_TRABALHO )
|
||||
{
|
||||
local_trabalho = ( String ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.FUNCAO_PROPOSTA )
|
||||
{
|
||||
funcao_proposta = ( String ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.DATA_ADMISSAO_FUNCAO )
|
||||
{
|
||||
data_admissao_funcao = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.OBSERVACOES )
|
||||
{
|
||||
observacoes = ( String ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.ESTABELECIMENTO )
|
||||
{
|
||||
estabelecimento = ( Estabelecimento ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.DATA_DEMISSAO )
|
||||
{
|
||||
data_demissao = ( Date ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.OBSERVACOES_GESTAO )
|
||||
{
|
||||
observacoes_gestao = ( String ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.PERFIL )
|
||||
{
|
||||
perfil = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.INACTIVO )
|
||||
{
|
||||
inactivo = ( String ) value;
|
||||
}
|
||||
else if( fieldName == TrabalhadorData.ACTUALIZACAO )
|
||||
{
|
||||
actualizacao = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.ID ) )
|
||||
{
|
||||
id = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.NOME ) )
|
||||
{
|
||||
nome = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.NOME_PLAIN ) )
|
||||
{
|
||||
nome_plain = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.SEXO ) )
|
||||
{
|
||||
sexo = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.DATA_NASCIMENTO ) )
|
||||
{
|
||||
data_nascimento = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.NACIONALIDADE ) )
|
||||
{
|
||||
nacionalidade = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.NUMERO_MECANOGRAFICO ) )
|
||||
{
|
||||
numero_mecanografico = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.DATA_ADMISSAO ) )
|
||||
{
|
||||
data_admissao = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.CATEGORIA ) )
|
||||
{
|
||||
categoria = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.LOCAL_TRABALHO ) )
|
||||
{
|
||||
local_trabalho = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.FUNCAO_PROPOSTA ) )
|
||||
{
|
||||
funcao_proposta = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.DATA_ADMISSAO_FUNCAO ) )
|
||||
{
|
||||
data_admissao_funcao = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.OBSERVACOES ) )
|
||||
{
|
||||
observacoes = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.ESTABELECIMENTO ) )
|
||||
{
|
||||
estabelecimento = ( Estabelecimento ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.DATA_DEMISSAO ) )
|
||||
{
|
||||
data_demissao = ( Date ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.OBSERVACOES_GESTAO ) )
|
||||
{
|
||||
observacoes_gestao = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.PERFIL ) )
|
||||
{
|
||||
perfil = ( Integer ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.INACTIVO ) )
|
||||
{
|
||||
inactivo = ( String ) value;
|
||||
}
|
||||
else if( fieldName.equals( TrabalhadorData.ACTUALIZACAO ) )
|
||||
{
|
||||
actualizacao = ( Date ) value;
|
||||
}
|
||||
}
|
||||
|
||||
public Class getOuterClass()
|
||||
{
|
||||
return TrabalhadorData.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* TrabalhadorData.java
|
||||
*
|
||||
* Generated by com.evutils.codegen.JDOObjectGenerator on 24/Nov/2005
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.evolute.utils.jdo.*;
|
||||
|
||||
public final class TrabalhadorData extends JDOObject
|
||||
implements DisableDeleteable, ActualizacaoSaveable
|
||||
{
|
||||
public static final String ID = "id";
|
||||
public static final String NOME = "nome";
|
||||
public static final String NOME_PLAIN = "nome_plain";
|
||||
public static final String SEXO = "sexo";
|
||||
public static final String DATA_NASCIMENTO = "data_nascimento";
|
||||
public static final String NACIONALIDADE = "nacionalidade";
|
||||
public static final String NUMERO_MECANOGRAFICO = "numero_mecanografico";
|
||||
public static final String DATA_ADMISSAO = "data_admissao";
|
||||
public static final String CATEGORIA = "categoria";
|
||||
public static final String LOCAL_TRABALHO = "local_trabalho";
|
||||
public static final String FUNCAO_PROPOSTA = "funcao_proposta";
|
||||
public static final String DATA_ADMISSAO_FUNCAO = "data_admissao_funcao";
|
||||
public static final String OBSERVACOES = "observacoes";
|
||||
public static final String ESTABELECIMENTO = "estabelecimento";
|
||||
public static final String DATA_DEMISSAO = "data_demissao";
|
||||
public static final String OBSERVACOES_GESTAO = "observacoes_gestao";
|
||||
public static final String PERFIL = "perfil";
|
||||
public static final String INACTIVO = "inactivo";
|
||||
public static final String ACTUALIZACAO = "actualizacao";
|
||||
|
||||
public static final String FIELD_NAMES[] = new String[]{
|
||||
NOME, NOME_PLAIN, SEXO, DATA_NASCIMENTO, NACIONALIDADE, NUMERO_MECANOGRAFICO,
|
||||
DATA_ADMISSAO, CATEGORIA, LOCAL_TRABALHO, FUNCAO_PROPOSTA,
|
||||
DATA_ADMISSAO_FUNCAO, OBSERVACOES, ESTABELECIMENTO, DATA_DEMISSAO,
|
||||
OBSERVACOES_GESTAO, PERFIL, };
|
||||
|
||||
|
||||
protected static final String ALL_FIELD_NAMES[] = new String[]{
|
||||
ID, NOME, NOME_PLAIN, SEXO, DATA_NASCIMENTO, NACIONALIDADE, NUMERO_MECANOGRAFICO,
|
||||
DATA_ADMISSAO, CATEGORIA, LOCAL_TRABALHO, FUNCAO_PROPOSTA,
|
||||
DATA_ADMISSAO_FUNCAO, OBSERVACOES, ESTABELECIMENTO, DATA_DEMISSAO,
|
||||
OBSERVACOES_GESTAO, PERFIL, INACTIVO, ACTUALIZACAO, };
|
||||
|
||||
private HashMap dataHash;
|
||||
|
||||
public TrabalhadorData()
|
||||
{
|
||||
dataHash = new HashMap();
|
||||
}
|
||||
|
||||
protected Object innerGet( String fieldName )
|
||||
throws Exception
|
||||
{
|
||||
return dataHash.get( fieldName );
|
||||
}
|
||||
|
||||
protected void innerSet( String fieldName, Object value )
|
||||
throws Exception
|
||||
{
|
||||
dataHash.put( fieldName, value );
|
||||
}
|
||||
|
||||
public String []getFieldNames()
|
||||
{
|
||||
return FIELD_NAMES;
|
||||
}
|
||||
|
||||
protected String []getAllFieldNames()
|
||||
{
|
||||
return ALL_FIELD_NAMES;
|
||||
}
|
||||
|
||||
public Class getInnerClass()
|
||||
{
|
||||
return Trabalhador.class;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* TrabalhadorID.java
|
||||
*
|
||||
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 24/Nov/2005
|
||||
*
|
||||
* Use but DON'T TOUCH
|
||||
*/
|
||||
package siprp.data;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import com.evolute.utils.jdo.jpox.*;
|
||||
|
||||
public final class TrabalhadorID extends IntegerID
|
||||
implements Serializable
|
||||
{
|
||||
public TrabalhadorID()
|
||||
{
|
||||
}
|
||||
|
||||
public TrabalhadorID( String str )
|
||||
{
|
||||
super( str );
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,777 @@
|
||||
/*
|
||||
* EstatisticaDataProvider.java
|
||||
*
|
||||
* Created on 16 de Dezembro de 2004, 12:50
|
||||
*/
|
||||
|
||||
package siprp.estatistica;
|
||||
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.evolute.utils.*;
|
||||
import com.evolute.utils.arrays.*;
|
||||
import com.evolute.utils.data.*;
|
||||
import com.evolute.utils.db.*;
|
||||
import com.evolute.utils.db.keyretrievers.*;
|
||||
import com.evolute.utils.metadb.*;
|
||||
import com.evolute.utils.sql.*;
|
||||
import com.evolute.utils.sql.expression.*;
|
||||
|
||||
import siprp.data.*;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class EstatisticaDataProvider extends MetaProvider
|
||||
{
|
||||
private static final Object LOCK = new Object();
|
||||
private static EstatisticaDataProvider instance = null;
|
||||
private final Executer executer;
|
||||
|
||||
public static final DateFormat DF = DateFormat.getDateInstance( DateFormat.SHORT );
|
||||
|
||||
/** Creates a new instance of EstatisticaDataProvider */
|
||||
public EstatisticaDataProvider()
|
||||
throws Exception
|
||||
{
|
||||
DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ );
|
||||
executer = dbm.getSharedExecuter( this );
|
||||
}
|
||||
|
||||
public static MetaProvider getProvider()
|
||||
throws Exception
|
||||
{
|
||||
synchronized( LOCK )
|
||||
{
|
||||
if( instance == null )
|
||||
{
|
||||
instance = new EstatisticaDataProvider();
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public String[][] getMarcacoesPeriodo( Date dataInicio, Date dataFim )
|
||||
throws Exception
|
||||
{
|
||||
String [][]result = null;
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ MarcacaoTrabalhadorData.DATA,
|
||||
"trabalhador_id",
|
||||
MarcacaoTrabalhadorData.REALIZADA,
|
||||
MarcacaoTrabalhadorData.TIPO },
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ),
|
||||
new String[]{ "data" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
result = new String[ array.columnLength() ][ 5 ];
|
||||
for( int n = 0; n < result.length; n++ )
|
||||
{
|
||||
Date data = ( Date ) array.get( n, 0 );
|
||||
int trabalhadorID = ( ( Number ) array.get( n, 1 ) ).intValue();
|
||||
boolean realizada = "y".equals( array.get( n, 2 ) );
|
||||
int tipo = ( ( Number ) array.get( n, 3 ) ).intValue();
|
||||
String nomeEstabEmp[] = getNomeEstabelecimentoEmpresaForTrabalhador( trabalhadorID );
|
||||
result[ n ][ 0 ] = nomeEstabEmp[ 2 ];
|
||||
result[ n ][ 1 ] = nomeEstabEmp[ 0 ];
|
||||
result[ n ][ 2 ] = nomeEstabEmp[ 1 ];
|
||||
result[ n ][ 3 ] = DF.format( data );
|
||||
result[ n ][ 4 ] = ( tipo == Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ? "(Exame)" : "(Consulta)" );
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public String[] getNomeEstabelecimentoEmpresaForTrabalhador( int trabalhadorID )
|
||||
throws Exception
|
||||
{
|
||||
String data[] = new String[ 3 ];
|
||||
Select select =
|
||||
new Select( new String[]{ "trabalhadores", "estabelecimentos", "empresas"},
|
||||
new String[]{ "trabalhadores.nome", "estabelecimentos.nome", "empresas.designacao_social" },
|
||||
new Field( "trabalhadores.id" ).isEqual( new Integer( trabalhadorID ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 1 )
|
||||
{
|
||||
data[ 0 ] = ( String ) array.get( 0, 0 );
|
||||
data[ 1 ] = ( String ) array.get( 0, 1 );
|
||||
data[ 2 ] = ( String ) array.get( 0, 2 );
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public int countExamesPeriodo( Date dataInicio, Date dataFim )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ "count(*)" },
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
}
|
||||
|
||||
public int countConsultasPeriodo( Date dataInicio, Date dataFim )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ "count(*)" },
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
}
|
||||
|
||||
public int countExamesPeriodoForEmpresa( Date dataInicio, Date dataFim, Integer empresaID )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" },
|
||||
new String[]{ "count(*)" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
}
|
||||
|
||||
public int countConsultasPeriodoForEmpresa( Date dataInicio, Date dataFim, Integer empresaID )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" },
|
||||
new String[]{ "count(*)" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
}
|
||||
|
||||
public String[][] getMarcacoesPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID )
|
||||
throws Exception
|
||||
{
|
||||
String [][]result = null;
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" },
|
||||
new String[]{ MarcacaoTrabalhadorData.DATA,
|
||||
"trabalhador_id",
|
||||
MarcacaoTrabalhadorData.REALIZADA,
|
||||
MarcacaoTrabalhadorData.TIPO },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ),
|
||||
new String[]{ "data" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
result = new String[ array.columnLength() ][ 5 ];
|
||||
for( int n = 0; n < result.length; n++ )
|
||||
{
|
||||
Date data = ( Date ) array.get( n, 0 );
|
||||
int trabalhadorID = ( ( Number ) array.get( n, 1 ) ).intValue();
|
||||
boolean realizada = "y".equals( array.get( n, 2 ) );
|
||||
int tipo = ( ( Number ) array.get( n, 3 ) ).intValue();
|
||||
String nomeEstabEmp[] = getNomeEstabelecimentoEmpresaForTrabalhador( trabalhadorID );
|
||||
result[ n ][ 0 ] = nomeEstabEmp[ 2 ];
|
||||
result[ n ][ 1 ] = nomeEstabEmp[ 0 ];
|
||||
result[ n ][ 2 ] = nomeEstabEmp[ 1 ];
|
||||
result[ n ][ 3 ] = DF.format( data );
|
||||
result[ n ][ 4 ] = ( tipo == Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ? "(Exame)" : "(Consulta)" );
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public int countExamesPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" },
|
||||
new String[]{ "count(*)" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
}
|
||||
|
||||
public int countConsultasPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" },
|
||||
new String[]{ "count(*)" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
}
|
||||
|
||||
public String[][] getTrabalhadoresSemExamesOuConsultas( Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
// Select subSelect =
|
||||
// new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
// new String[]{ "trabalhador_id" },
|
||||
// new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ).and(
|
||||
// new Field( "realizada" ).isEqual( "y" ) ) );
|
||||
Select select =
|
||||
new Select( new String[]{ "empresas", "estabelecimentos",
|
||||
"trabalhadores LEFT OUTER JOIN marcacoes_trabalhador ON "
|
||||
+ "( trabalhadores.id = marcacoes_trabalhador.trabalhador_id AND marcacoes_trabalhador.tipo = "
|
||||
+ (exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA) + " AND marcacoes_trabalhador.realizada = 'y' )" },
|
||||
new String[]{ "empresas.designacao_social", "estabelecimentos.nome", "trabalhadores.nome",
|
||||
"empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" },
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( null ) ).and(
|
||||
new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ).or(
|
||||
new Field( "marcacoes_trabalhador.realizada" ).isDifferent( "y" ) ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ),
|
||||
new String[]{ "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
String data[][] = new String[ array.columnLength() ][ 3 ];
|
||||
for( int r = 0; r < array.columnLength(); r++ )
|
||||
{
|
||||
for( int c = 0; c < 3; c++ )
|
||||
{
|
||||
data[ r ][ c ] = (String) array.get( r, c );
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int countTrabalhadoresSemExamesOuConsultas( Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "trabalhadores" }, new String[]{ "COUNT(*)" },
|
||||
new Field( "inactivo" ).isDifferent( "y" ) );
|
||||
int totalCount = 0;
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
{
|
||||
Number n = (Number) array.get( 0, 0 );
|
||||
if( n != null )
|
||||
{
|
||||
totalCount = n.intValue();
|
||||
}
|
||||
}
|
||||
|
||||
// select =
|
||||
// new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
// new String[]{ "COUNT(*)" },
|
||||
// new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ).and(
|
||||
// new Field( "realizada" ).isEqual( "y" ) ).and(
|
||||
// new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) );
|
||||
// int subCount = 0;
|
||||
// array = executer.executeQuery( select );
|
||||
// if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
// {
|
||||
// Number n = (Number) array.get( 0, 0 );
|
||||
// if( n != null )
|
||||
// {
|
||||
// subCount = n.intValue();
|
||||
// }
|
||||
// }
|
||||
|
||||
return totalCount - countTrabalhadoresComExamesOuConsultasPeriodo( dataInicio, dataFim, exames );
|
||||
}
|
||||
|
||||
public String[][] getTrabalhadoresSemExamesOuConsultasEstabelecimento( Integer estabelecimentoID, Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ "trabalhador_id" },
|
||||
new Field( "tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "realizada" ).isEqual( "y" ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
Integer ids[] = new Integer[ array.columnLength() ];
|
||||
for( int n = 0; n < ids.length; n++ )
|
||||
{
|
||||
ids[ n ] = ( Integer ) array.get( n, 0 );
|
||||
}
|
||||
if( ids.length == 0 )
|
||||
{
|
||||
ids = new Integer[]{ new Integer( -1 ) };
|
||||
}
|
||||
select =
|
||||
new Select( new String[]{ "estabelecimentos",
|
||||
"trabalhadores" },
|
||||
new String[]{ "estabelecimentos.nome", "trabalhadores.nome" },
|
||||
new Field( "estabelecimentos.id" ).isEqual( estabelecimentoID ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "trabalhadores.id" ).notIn( ids ) ),
|
||||
new String[]{ "trabalhadores.nome" }, null );
|
||||
// Select select =
|
||||
// new Select( new String[]{ "estabelecimentos",
|
||||
// "trabalhadores LEFT OUTER JOIN marcacoes_trabalhador ON "
|
||||
// + "( trabalhadores.id = marcacoes_trabalhador.trabalhador_id AND marcacoes_trabalhador.tipo = "
|
||||
// + (exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA) + " AND marcacoes_trabalhador.realizada = 'y' )" },
|
||||
// new String[]{ "estabelecimentos.nome", "trabalhadores.nome" },
|
||||
// new Field( "estabelecimentos.id" ).isEqual( estabelecimentoID ).and(
|
||||
// new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
// new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and(
|
||||
// new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( null ).or(
|
||||
// new Field( "marcacoes_trabalhador.realizada" ).isDifferent( "y" ) ) ).and(
|
||||
// new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
// new Field( "data" ).isLessOrEqual( dataFim ) ).and(
|
||||
// new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ),
|
||||
// new String[]{ "trabalhadores.nome" }, null );
|
||||
array = executer.executeQuery( select );
|
||||
String data[][] = new String[ array.columnLength() ][ 2 ];
|
||||
for( int r = 0; r < array.columnLength(); r++ )
|
||||
{
|
||||
for( int c = 0; c < 2; c++ )
|
||||
{
|
||||
data[ r ][ c ] = (String) array.get( r, c );
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public Object[][] getCountTrabalhadoresSemExamesOuConsultasPeriodoForAllEmpresas( Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "empresas" },
|
||||
new String[]{ "id", "designacao_social", "designacao_social_plain" },
|
||||
new Field( "inactivo" ).isDifferent( "y" ),
|
||||
new String[]{ "designacao_social_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
Object data[][] = new Object[ array.columnLength() ][ 3 ];
|
||||
for( int n = 0; n < data.length; n++ )
|
||||
{
|
||||
data[ n ][ 0 ] = array.get( n, 1 );
|
||||
Integer empresaID = (Integer)array.get( n, 0 );
|
||||
data[ n ][ 1 ] = new Integer( countTrabalhadoresSemExamesOuConsultasEmpresa( empresaID, dataInicio, dataFim, exames ) );
|
||||
data[ n ][ 2 ] = empresaID;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public int countTrabalhadoresSemExamesOuConsultasEmpresa( Integer empresaID, Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "trabalhadores", "estabelecimentos" }, new String[]{ "COUNT(*)" },
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and(
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and(
|
||||
new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) );
|
||||
int totalCount = 0;
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
{
|
||||
Number n = (Number) array.get( 0, 0 );
|
||||
if( n != null )
|
||||
{
|
||||
totalCount = n.intValue();
|
||||
}
|
||||
}
|
||||
|
||||
// select =
|
||||
// new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" },
|
||||
// new String[]{ "COUNT(*)" },
|
||||
// new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
// new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
// new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and(
|
||||
// new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ).and(
|
||||
// new Field( "realizada" ).isEqual( "y" ) ).and(
|
||||
// new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) );
|
||||
// int subCount = 0;
|
||||
// array = executer.executeQuery( select );
|
||||
// if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
// {
|
||||
// Number n = (Number) array.get( 0, 0 );
|
||||
// if( n != null )
|
||||
// {
|
||||
// subCount = n.intValue();
|
||||
// }
|
||||
// }
|
||||
return totalCount - countTrabalhadoresComExamesOuConsultasPeriodoForEmpresa( dataInicio, dataFim, empresaID, exames );
|
||||
}
|
||||
|
||||
public int countTrabalhadoresSemExamesOuConsultasEstabelecimento( Integer estabelecimentoID, Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "trabalhadores" }, new String[]{ "COUNT(*)" },
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) );
|
||||
int totalCount = 0;
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
{
|
||||
Number n = (Number) array.get( 0, 0 );
|
||||
if( n != null )
|
||||
{
|
||||
totalCount = n.intValue();
|
||||
}
|
||||
}
|
||||
|
||||
// select =
|
||||
// new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" },
|
||||
// new String[]{ "COUNT(*)" },
|
||||
// new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
// new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
// new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ).and(
|
||||
// new Field( "realizada" ).isEqual( "y" ) ).and(
|
||||
// new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) );
|
||||
// int subCount = 0;
|
||||
// array = executer.executeQuery( select );
|
||||
// if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
// {
|
||||
// Number n = (Number) array.get( 0, 0 );
|
||||
// if( n != null )
|
||||
// {
|
||||
// subCount = n.intValue();
|
||||
// }
|
||||
// }
|
||||
return totalCount - countTrabalhadoresComExamesOuConsultasPeriodoForEstabelecimento( dataInicio, dataFim, estabelecimentoID, exames );
|
||||
}
|
||||
|
||||
public String[][]getTrabalhadoresComExamesOuConsultasPeriodo( Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "empresas", "estabelecimentos",
|
||||
"trabalhadores", "marcacoes_trabalhador" },
|
||||
new String[]{ "empresas.designacao_social", "estabelecimentos.nome", "trabalhadores.nome",
|
||||
"empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" },
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ).and(
|
||||
new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and(
|
||||
new Field( "marcacoes_trabalhador.realizada" ).isEqual( "y" ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ),
|
||||
new String[]{ "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
String data[][] = new String[ array.columnLength() ][ 3 ];
|
||||
for( int r = 0; r < array.columnLength(); r++ )
|
||||
{
|
||||
for( int c = 0; c < 3; c++ )
|
||||
{
|
||||
data[ r ][ c ] = (String) array.get( r, c );
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public int countTrabalhadoresComExamesOuConsultasPeriodo( Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" },
|
||||
new String[]{ "COUNT(*)" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and(
|
||||
new Field( "realizada" ).isEqual( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ) );
|
||||
int count = 0;
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
{
|
||||
Number n = (Number) array.get( 0, 0 );
|
||||
if( n != null )
|
||||
{
|
||||
count = n.intValue();
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public String[][]getTrabalhadoresComExamesOuConsultasPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "estabelecimentos",
|
||||
"trabalhadores", "marcacoes_trabalhador" },
|
||||
new String[]{ "estabelecimentos.nome", "trabalhadores.nome" },
|
||||
new Field( "estabelecimentos.id" ).isEqual( estabelecimentoID ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ).and(
|
||||
new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and(
|
||||
new Field( "marcacoes_trabalhador.realizada" ).isEqual( "y" ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ),
|
||||
new String[]{ "estabelecimentos.nome", "trabalhadores.nome" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
String data[][] = new String[ array.columnLength() ][ 2 ];
|
||||
for( int r = 0; r < array.columnLength(); r++ )
|
||||
{
|
||||
for( int c = 0; c < 2; c++ )
|
||||
{
|
||||
data[ r ][ c ] = (String) array.get( r, c );
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public Object[][] getCountTrabalhadoresComExamesOuConsultasPeriodoForAllEmpresas( Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "empresas" },
|
||||
new String[]{ "id", "designacao_social", "designacao_social_plain" },
|
||||
new Field( "inactivo" ).isDifferent( "y" ),
|
||||
new String[]{ "designacao_social_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
Object data[][] = new Object[ array.columnLength() ][ 3 ];
|
||||
for( int n = 0; n < data.length; n++ )
|
||||
{
|
||||
data[ n ][ 0 ] = array.get( n, 1 );
|
||||
Integer empresaID = (Integer)array.get( n, 0 );
|
||||
data[ n ][ 1 ] = new Integer( countTrabalhadoresComExamesOuConsultasPeriodoForEmpresa( dataInicio, dataFim, empresaID, exames ) );
|
||||
data[ n ][ 2 ] = empresaID;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public int countTrabalhadoresComExamesOuConsultasPeriodoForEmpresa( Date dataInicio, Date dataFim, Integer empresaID, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" },
|
||||
new String[]{ "COUNT(*)" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and(
|
||||
new Field( "realizada" ).isEqual( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ) );
|
||||
int count = 0;
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
{
|
||||
Number n = (Number) array.get( 0, 0 );
|
||||
if( n != null )
|
||||
{
|
||||
count = n.intValue();
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public int countTrabalhadoresComExamesOuConsultasPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" },
|
||||
new String[]{ "COUNT(*)" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and(
|
||||
new Field( "realizada" ).isEqual( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ) );
|
||||
int count = 0;
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
{
|
||||
Number n = (Number) array.get( 0, 0 );
|
||||
if( n != null )
|
||||
{
|
||||
count = n.intValue();
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public String [][]getDadosTrabalhadoresPeriodo( Date dataInicio, Date dataFim )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "empresas", "estabelecimentos", "trabalhadores" },
|
||||
new String[]{ "empresas.designacao_social", "estabelecimentos.nome", "trabalhadores.nome", "trabalhadores.id",
|
||||
"empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" },
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and(
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ).and(
|
||||
new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ),
|
||||
new String[]{ "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, null );
|
||||
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
String data[][] = new String[ array.columnLength() ][ 7 ];
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
data[ n ][ 0 ] = ( String ) array.get( n, 0 );
|
||||
data[ n ][ 1 ] = ( String ) array.get( n, 1 );
|
||||
data[ n ][ 2 ] = ( String ) array.get( n, 2 );
|
||||
Integer id = new Integer( ( (Number) array.get( n, 3 ) ).intValue() );
|
||||
Select exameSelect =
|
||||
new Select( new String[]{ "trabalhadores", "marcacoes_trabalhador" },
|
||||
new String[]{ "data", "realizada" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.id" ).isEqual( id ) ).and(
|
||||
new Field( "marcacoes_trabalhador.data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ),
|
||||
new String[]{ "data desc" }, null );
|
||||
Virtual2DArray exameArray = executer.executeQuery( exameSelect );
|
||||
if( exameArray.columnLength() > 0 )
|
||||
{
|
||||
Date dataExame = ( Date ) exameArray.get( 0, 0 );
|
||||
String estado = ( String ) exameArray.get( 0, 1 );
|
||||
data[ n ][ 3 ] = DF.format( dataExame );
|
||||
data[ n ][ 4 ] = "y".equals( estado ) ? "Realizado" : "Faltou";
|
||||
}
|
||||
else
|
||||
{
|
||||
data[ n ][ 3 ] = "--";
|
||||
data[ n ][ 4 ] = "--";
|
||||
}
|
||||
|
||||
Select consultaSelect =
|
||||
new Select( new String[]{ "trabalhadores", "marcacoes_trabalhador" },
|
||||
new String[]{ "data", "realizada" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.id" ).isEqual( id ) ).and(
|
||||
new Field( "marcacoes_trabalhador.data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ),
|
||||
new String[]{ "data desc" }, null );
|
||||
Virtual2DArray consultaArray = executer.executeQuery( consultaSelect );
|
||||
if( consultaArray.columnLength() > 0 )
|
||||
{
|
||||
Date dataConsulta = ( Date ) consultaArray.get( 0, 0 );
|
||||
String estado = ( String ) consultaArray.get( 0, 1 );
|
||||
data[ n ][ 5 ] = DF.format( dataConsulta );
|
||||
data[ n ][ 6 ] = "y".equals( estado ) ? "Realizada" : "Faltou";
|
||||
}
|
||||
else
|
||||
{
|
||||
data[ n ][ 5 ] = "--";
|
||||
data[ n ][ 6 ] = "--";
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public String[][]getDadosHigieneSeguranca()
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "empresas", "estabelecimentos" },
|
||||
new String[]{ "empresas.designacao_social", "estabelecimentos.nome", "estabelecimentos.id",
|
||||
"empresas.designacao_social_plain", "estabelecimentos.nome_plain" },
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ).and(
|
||||
new Field( "empresas.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ),
|
||||
new String[]{ "empresas.designacao_social_plain", "estabelecimentos.nome_plain" }, null );
|
||||
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
String data[][] = new String[ array.columnLength() ][ 6 ];
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
data[ n ][ 0 ] = ( String ) array.get( n, 0 );
|
||||
data[ n ][ 1 ] = ( String ) array.get( n, 1 );
|
||||
Integer id = new Integer( ( (Number) array.get( n, 2 ) ).intValue() );
|
||||
Select ultimaSelect =
|
||||
new Select( new String[]{ "marcacoes_estabelecimento" },
|
||||
new String[]{ "data", "realizada", "data_relatorio" },
|
||||
new Field( "marcacoes_estabelecimento.estabelecimento_id" ).isEqual( id ).and(
|
||||
new Field( "marcacoes_estabelecimento.data" ).isLessOrEqual( new Date() ) ),
|
||||
new String[]{ "data desc" }, null );
|
||||
Virtual2DArray ultimaArray = executer.executeQuery( ultimaSelect );
|
||||
if( ultimaArray.columnLength() > 0 )
|
||||
{
|
||||
Date dataAud = ( Date ) ultimaArray.get( 0, 0 );
|
||||
String estado = ( String ) ultimaArray.get( 0, 1 );
|
||||
Date dataRel = ( Date ) ultimaArray.get( 0, 2 );
|
||||
data[ n ][ 2 ] = DF.format( dataAud );
|
||||
data[ n ][ 3 ] = "y".equals( estado ) ? "Realizada" : "Não Realizada";
|
||||
data[ n ][ 4 ] = dataRel != null ? DF.format( dataRel ) : "--";
|
||||
}
|
||||
else
|
||||
{
|
||||
data[ n ][ 2 ] = "--";
|
||||
data[ n ][ 3 ] = "--";
|
||||
data[ n ][ 4 ] = "--";
|
||||
}
|
||||
|
||||
Select proximaSelect =
|
||||
new Select( new String[]{ "marcacoes_estabelecimento" },
|
||||
new String[]{ "data" },
|
||||
new Field( "marcacoes_estabelecimento.estabelecimento_id" ).isEqual( id ).and(
|
||||
new Field( "marcacoes_estabelecimento.data" ).isGreaterOrEqual( new Date() ) ),
|
||||
new String[]{ "data desc" }, null );
|
||||
Virtual2DArray proximaArray = executer.executeQuery( proximaSelect );
|
||||
if( proximaArray.columnLength() > 0 )
|
||||
{
|
||||
Date dataProx = ( Date ) proximaArray.get( 0, 0 );
|
||||
data[ n ][ 5 ] = DF.format( dataProx );
|
||||
}
|
||||
else
|
||||
{
|
||||
data[ n ][ 5 ] = "--";
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* EstatisticasWindow.java
|
||||
*
|
||||
* Created on 11 de Maio de 2004, 17:57
|
||||
*/
|
||||
|
||||
package siprp.estatisticas;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import com.evolute.utils.ui.window.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class EstatisticasWindow
|
||||
extends CustomJFrame
|
||||
{
|
||||
private JPanel filtrosPanel;
|
||||
private JPanel agrupamentosPanel;
|
||||
private JPanel buttonPanel;
|
||||
|
||||
private JComboBox filtroEmpresa;
|
||||
|
||||
/** Creates a new instance of EstatisticasWindow */
|
||||
public EstatisticasWindow()
|
||||
{
|
||||
setupComponents();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue