git-svn-id: https://svn.coded.pt/svn/SIPRP@592 bb69d46d-e84e-40c8-a05a-06db0d633741lxbfYeaa
@ -1,8 +1,8 @@
|
|||||||
build.xml.data.CRC32=f9aca309
|
build.xml.data.CRC32=2ba63215
|
||||||
build.xml.script.CRC32=ab1471e9
|
build.xml.script.CRC32=ab1471e9
|
||||||
build.xml.stylesheet.CRC32=95be3570
|
build.xml.stylesheet.CRC32=95be3570
|
||||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||||
nbproject/build-impl.xml.data.CRC32=f9aca309
|
nbproject/build-impl.xml.data.CRC32=2ba63215
|
||||||
nbproject/build-impl.xml.script.CRC32=39ccfd31
|
nbproject/build-impl.xml.script.CRC32=cae04df0
|
||||||
nbproject/build-impl.xml.stylesheet.CRC32=ac43bae1
|
nbproject/build-impl.xml.stylesheet.CRC32=ac43bae1
|
||||||
|
|||||||
@ -0,0 +1,138 @@
|
|||||||
|
/*
|
||||||
|
* Acidentado.java
|
||||||
|
*
|
||||||
|
* Created on October 16, 2007, 2:36 PM
|
||||||
|
*
|
||||||
|
* To change this template, choose Tools | Template Manager
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package analiseacidentestrabalho;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author lluis
|
||||||
|
*/
|
||||||
|
public class Acidentado {
|
||||||
|
private Integer id;
|
||||||
|
private String nome;
|
||||||
|
private java.sql.Date data_nascimento;
|
||||||
|
private String bilhete_identidade;
|
||||||
|
private String morada;
|
||||||
|
private String cod_postal;
|
||||||
|
private String localidade;
|
||||||
|
private String contacto_telefonico;
|
||||||
|
private java.sql.Date data_admissao;
|
||||||
|
private String funcao;
|
||||||
|
private String turno;
|
||||||
|
private Integer trabalhador_id;
|
||||||
|
private String numero_mecanografico;
|
||||||
|
/** Creates a new instance of Acidentado */
|
||||||
|
public Acidentado() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public java.sql.Date getData_nascimento() {
|
||||||
|
return data_nascimento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData_nascimento(java.sql.Date data_nascimento) {
|
||||||
|
this.data_nascimento = data_nascimento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBilhete_identidade() {
|
||||||
|
return bilhete_identidade;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBilhete_identidade(String bilhete_identidade) {
|
||||||
|
this.bilhete_identidade = bilhete_identidade;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMorada() {
|
||||||
|
return morada;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMorada(String morada) {
|
||||||
|
this.morada = morada;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCod_postal() {
|
||||||
|
return cod_postal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCod_postal(String cod_postal) {
|
||||||
|
this.cod_postal = cod_postal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLocalidade() {
|
||||||
|
return localidade;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocalidade(String localidade) {
|
||||||
|
this.localidade = localidade;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContacto_telefonico() {
|
||||||
|
return contacto_telefonico;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContacto_telefonico(String contacto_telefonico) {
|
||||||
|
this.contacto_telefonico = contacto_telefonico;
|
||||||
|
}
|
||||||
|
|
||||||
|
public java.sql.Date getData_admissao() {
|
||||||
|
return data_admissao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData_admissao(java.sql.Date data_admissao) {
|
||||||
|
this.data_admissao = data_admissao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFuncao() {
|
||||||
|
return funcao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFuncao(String funcao) {
|
||||||
|
this.funcao = funcao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getTrabalhador_id() {
|
||||||
|
return trabalhador_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrabalhador_id(Integer trabalhador_id) {
|
||||||
|
this.trabalhador_id = trabalhador_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNome() {
|
||||||
|
return nome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNome(String nome) {
|
||||||
|
this.nome = nome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTurno() {
|
||||||
|
return turno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTurno(String turno) {
|
||||||
|
this.turno = turno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNumero_mecanografico() {
|
||||||
|
return numero_mecanografico;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumero_mecanografico(String numero_mecanografico) {
|
||||||
|
this.numero_mecanografico = numero_mecanografico;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Empresa.java
|
||||||
|
*
|
||||||
|
* Created on October 11, 2007, 5:19 PM
|
||||||
|
*
|
||||||
|
* To change this template, choose Tools | Template Manager
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package analiseacidentestrabalho;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author lluis
|
||||||
|
*/
|
||||||
|
public class Estabelecimento {
|
||||||
|
private Integer id;
|
||||||
|
private String nome_plain;
|
||||||
|
|
||||||
|
/** Creates a new instance of Empresa */
|
||||||
|
public Estabelecimento() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNome_plain() {
|
||||||
|
return nome_plain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNome_plain(String nome_plain) {
|
||||||
|
this.nome_plain = nome_plain;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Medico.java
|
||||||
|
*
|
||||||
|
* Created on October 12, 2007, 11:00 AM
|
||||||
|
*
|
||||||
|
* To change this template, choose Tools | Template Manager
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package analiseacidentestrabalho;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author lluis
|
||||||
|
*/
|
||||||
|
public class Medico {
|
||||||
|
private Integer id;
|
||||||
|
private String nome;
|
||||||
|
private String numero_cedula;
|
||||||
|
|
||||||
|
/** Creates a new instance of Medico */
|
||||||
|
public Medico() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNome() {
|
||||||
|
return nome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNome(String nome) {
|
||||||
|
this.nome = nome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNumero_cedula() {
|
||||||
|
return numero_cedula;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumero_cedula(String numero_cedula) {
|
||||||
|
this.numero_cedula = numero_cedula;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return utils.Utils.unicodeToHTML(nome);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Medida.java
|
||||||
|
*
|
||||||
|
* Created on October 19, 2007, 4:59 PM
|
||||||
|
*
|
||||||
|
* To change this template, choose Tools | Template Manager
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package analiseacidentestrabalho;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author lluis
|
||||||
|
*/
|
||||||
|
public class Medida {
|
||||||
|
private Integer id;
|
||||||
|
private Integer analise_id;
|
||||||
|
private String medida;
|
||||||
|
|
||||||
|
/** Creates a new instance of Medida */
|
||||||
|
public Medida() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getAnalise_id() {
|
||||||
|
return analise_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnalise_id(Integer analise_id) {
|
||||||
|
this.analise_id = analise_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMedida() {
|
||||||
|
return medida;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMedida(String medida) {
|
||||||
|
this.medida = medida;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Permissao.java
|
||||||
|
*
|
||||||
|
* Created on October 25, 2007, 4:40 PM
|
||||||
|
*
|
||||||
|
* To change this template, choose Tools | Template Manager
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package analiseacidentestrabalho;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author lluis
|
||||||
|
*/
|
||||||
|
public class Permissao {
|
||||||
|
private Integer id;
|
||||||
|
private Integer user_id;
|
||||||
|
private Integer codigo_permissao;
|
||||||
|
|
||||||
|
/** Creates a new instance of Permissao */
|
||||||
|
public Permissao() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getUser_id() {
|
||||||
|
return user_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser_id(Integer user_id) {
|
||||||
|
this.user_id = user_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCodigo_permissao() {
|
||||||
|
return codigo_permissao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodigo_permissao(Integer codigo_permissao) {
|
||||||
|
this.codigo_permissao = codigo_permissao;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Recomendacao.java
|
||||||
|
*
|
||||||
|
* Created on October 16, 2007, 3:13 PM
|
||||||
|
*
|
||||||
|
* To change this template, choose Tools | Template Manager
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package analiseacidentestrabalho;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author lluis
|
||||||
|
*/
|
||||||
|
public class Recomendacao {
|
||||||
|
private Integer id;
|
||||||
|
private Integer analise_id;
|
||||||
|
private String recomendacao;
|
||||||
|
|
||||||
|
/** Creates a new instance of Recomendacao */
|
||||||
|
public Recomendacao() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getAnalise_id() {
|
||||||
|
return analise_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnalise_id(Integer analise_id) {
|
||||||
|
this.analise_id = analise_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRecomendacao() {
|
||||||
|
return recomendacao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecomendacao(String recomendacao) {
|
||||||
|
this.recomendacao = recomendacao;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* TecnicoSaude.java
|
||||||
|
*
|
||||||
|
* Created on October 12, 2007, 11:00 AM
|
||||||
|
*
|
||||||
|
* To change this template, choose Tools | Template Manager
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package analiseacidentestrabalho;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author lluis
|
||||||
|
*/
|
||||||
|
public class TecnicoSaude {
|
||||||
|
private Integer id;
|
||||||
|
private String nome;
|
||||||
|
|
||||||
|
/** Creates a new instance of TecnicoSaude */
|
||||||
|
public TecnicoSaude() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNome() {
|
||||||
|
return nome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNome(String nome) {
|
||||||
|
this.nome = nome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return utils.Utils.unicodeToHTML(nome);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* TipoUtilizador.java
|
||||||
|
*
|
||||||
|
* Created on October 11, 2007, 4:32 PM
|
||||||
|
*
|
||||||
|
* To change this template, choose Tools | Template Manager
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package analiseacidentestrabalho;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author lluis
|
||||||
|
*/
|
||||||
|
public class TipoUtilizador {
|
||||||
|
private Integer id;
|
||||||
|
private Integer tipo;
|
||||||
|
private String descricao;
|
||||||
|
private String activo;
|
||||||
|
private Integer ordem;
|
||||||
|
|
||||||
|
/** Creates a new instance of TipoUtilizador */
|
||||||
|
public TipoUtilizador() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getTipo() {
|
||||||
|
return tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipo(Integer tipo) {
|
||||||
|
this.tipo = tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescricao() {
|
||||||
|
return descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescricao(String descricao) {
|
||||||
|
this.descricao = descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getActivo() {
|
||||||
|
return activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivo(String activo) {
|
||||||
|
this.activo = activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOrdem() {
|
||||||
|
return ordem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrdem(Integer ordem) {
|
||||||
|
this.ordem = ordem;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,168 @@
|
|||||||
|
/*
|
||||||
|
* Pdf.java
|
||||||
|
*
|
||||||
|
* Created on November 13, 2007, 11:33 AM
|
||||||
|
*
|
||||||
|
* To change this template, choose Tools | Template Manager
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package pdf;
|
||||||
|
|
||||||
|
import analiseacidentestrabalho.Acidentado;
|
||||||
|
import analiseacidentestrabalho.AnaliseAcidente;
|
||||||
|
import com.lowagie.text.Chunk;
|
||||||
|
import com.lowagie.text.Document;
|
||||||
|
import com.lowagie.text.Font;
|
||||||
|
import com.lowagie.text.FontFactory;
|
||||||
|
import com.lowagie.text.Paragraph;
|
||||||
|
import com.lowagie.text.Rectangle;
|
||||||
|
import com.lowagie.text.pdf.BaseFont;
|
||||||
|
import com.lowagie.text.pdf.PdfAction;
|
||||||
|
import com.lowagie.text.pdf.PdfPCell;
|
||||||
|
import com.lowagie.text.pdf.PdfPTable;
|
||||||
|
import com.lowagie.text.pdf.PdfWriter;
|
||||||
|
import db.AnalisesDataProvider;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author lluis
|
||||||
|
*/
|
||||||
|
public class Pdf {
|
||||||
|
|
||||||
|
PdfPCell cell = null;
|
||||||
|
Paragraph p = null;
|
||||||
|
private final static int FONT_SIZE = 5;
|
||||||
|
/** Creates a new instance of Pdf */
|
||||||
|
public Pdf() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void generatePdf(String folder, AnaliseAcidente a)
|
||||||
|
{
|
||||||
|
PdfPTable table = null;
|
||||||
|
FacesContext ctx = FacesContext.getCurrentInstance();
|
||||||
|
////HttpServletResponse response = (HttpServletResponse)ctx.getExternalContext().getResponse();
|
||||||
|
Document document = new Document();
|
||||||
|
////response.setContentType("application/pdf");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
////PdfWriter writer = PdfWriter.getInstance(document, response.getOutputStream());
|
||||||
|
PdfWriter.getInstance(document, new FileOutputStream(folder + "/" + a.getId().toString() + ".pdf"));
|
||||||
|
document.open();
|
||||||
|
//document.add(new Paragraph("Hello World"));
|
||||||
|
//document.add(new Paragraph(new Date().toString()));
|
||||||
|
|
||||||
|
table = createTableEmpresa(a);
|
||||||
|
document.add(table);
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
document.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private PdfPTable createTableHeader(AnaliseAcidente a)
|
||||||
|
{
|
||||||
|
PdfPTable table = new PdfPTable(3);
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
private PdfPTable createTableEmpresa(AnaliseAcidente a)
|
||||||
|
{
|
||||||
|
String empresa_str = "";
|
||||||
|
String estabelecimento_str = "";
|
||||||
|
String trabalhador_str = "";
|
||||||
|
AnalisesDataProvider adp = new AnalisesDataProvider();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
String nome_empresa = adp.getEmpresaNome(a.getEmpresa_id());
|
||||||
|
empresa_str = utils.Utils.unicodeToHTML(nome_empresa);
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
estabelecimento_str = adp.getEstabelecimentoNome(a.getEstabelecimento_id());
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Acidentado ac = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ac = adp.getAcidentado(a.getAcidentado_id());
|
||||||
|
trabalhador_str = ac.getNome();
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
//TableEvents event = new TableEvents();
|
||||||
|
|
||||||
|
float[] widths = { 1f, 4f };
|
||||||
|
PdfPTable table = new PdfPTable(widths);
|
||||||
|
table.getDefaultCell().setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP | Rectangle.BOTTOM);
|
||||||
|
//PdfPCell cell = new PdfPCell(new Paragraph("header with colspan 3"));
|
||||||
|
//cell.setColspan(3);
|
||||||
|
//table.addCell(cell);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cell = new PdfPCell(new Paragraph("Empresa:", FontFactory.getFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED, FONT_SIZE)));
|
||||||
|
cell.setBorder(Rectangle.NO_BORDER);
|
||||||
|
cell.setBackgroundColor(new Color(102, 133, 151));
|
||||||
|
table.addCell(cell);
|
||||||
|
|
||||||
|
cell = new PdfPCell(new Paragraph(empresa_str, FontFactory.getFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED, FONT_SIZE, Font.NORMAL, new Color(255, 255, 255)) ));
|
||||||
|
cell.setBorder(Rectangle.NO_BORDER);
|
||||||
|
cell.setBackgroundColor(new Color(102, 133, 151));
|
||||||
|
table.addCell(cell);
|
||||||
|
|
||||||
|
cell = new PdfPCell(new Paragraph("Estabelecimento:", FontFactory.getFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED, FONT_SIZE)));
|
||||||
|
cell.setBorder(Rectangle.NO_BORDER);
|
||||||
|
cell.setBackgroundColor(new Color(102, 133, 151));
|
||||||
|
table.addCell(cell);
|
||||||
|
|
||||||
|
cell = new PdfPCell(new Paragraph(estabelecimento_str, FontFactory.getFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED, FONT_SIZE, Font.NORMAL, new Color(255, 255, 255))));
|
||||||
|
cell.setBorder(Rectangle.NO_BORDER);
|
||||||
|
cell.setBackgroundColor(new Color(102, 133, 151));
|
||||||
|
table.addCell(cell);
|
||||||
|
|
||||||
|
cell = new PdfPCell(new Paragraph("Trabalhador:", FontFactory.getFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED, FONT_SIZE)));
|
||||||
|
cell.setBorder(Rectangle.NO_BORDER);
|
||||||
|
cell.setBackgroundColor(new Color(102, 133, 151));
|
||||||
|
|
||||||
|
table.addCell(cell);
|
||||||
|
|
||||||
|
cell = new PdfPCell(new Paragraph(trabalhador_str, FontFactory.getFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED, FONT_SIZE, Font.NORMAL, new Color(255, 255, 255))));
|
||||||
|
cell.setBorder(Rectangle.NO_BORDER);
|
||||||
|
cell.setBackgroundColor(new Color(102, 133, 151));
|
||||||
|
table.addCell(cell);
|
||||||
|
table.getDefaultCell().setBackgroundColor(new Color(102, 133, 151));
|
||||||
|
table.getDefaultCell().setPadding(0f);
|
||||||
|
table.setSpacingAfter(0f);
|
||||||
|
table.setSpacingBefore(0f);
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
private PdfPTable createTableEmpresaHs(AnaliseAcidente a)
|
||||||
|
{
|
||||||
|
PdfPTable table = new PdfPTable(3);
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,151 @@
|
|||||||
|
/*
|
||||||
|
* Strings.java
|
||||||
|
*
|
||||||
|
* Created on October 8, 2007, 9:17 AM
|
||||||
|
*
|
||||||
|
* To change this template, choose Tools | Template Manager
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author lluis
|
||||||
|
*/
|
||||||
|
public class Strings {
|
||||||
|
public static String unicodeToHTML( String text )
|
||||||
|
{
|
||||||
|
if( text == null || text.length() < 6 )
|
||||||
|
{
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
String output = text;
|
||||||
|
output = output.replace( "\\u0009", " " );
|
||||||
|
output = output.replace( "\\u000a", "<br>" );
|
||||||
|
|
||||||
|
output = output.replace( "\\u00a0", " " );
|
||||||
|
output = output.replace( "\\u00aa", "ª" );
|
||||||
|
output = output.replace( "\\u00ba", "º" );
|
||||||
|
|
||||||
|
output = output.replace( "\\u00c0", "À" );
|
||||||
|
output = output.replace( "\\u00c1", "Á" );
|
||||||
|
output = output.replace( "\\u00c2", "Â" );
|
||||||
|
output = output.replace( "\\u00c3", "Ã" );
|
||||||
|
output = output.replace( "\\u00c7", "Ç" );
|
||||||
|
output = output.replace( "\\u00c8", "È" );
|
||||||
|
output = output.replace( "\\u00c9", "É" );
|
||||||
|
|
||||||
|
output = output.replace( "\\u00ca", "Ê" );
|
||||||
|
output = output.replace( "\\u00cc", "Ì" );
|
||||||
|
output = output.replace( "\\u00cd", "Í" );
|
||||||
|
output = output.replace( "\\u00ce", "Î" );
|
||||||
|
output = output.replace( "\\u00d2", "ò" );
|
||||||
|
output = output.replace( "\\u00d3", "ó" );
|
||||||
|
output = output.replace( "\\u00d4", "ô" );
|
||||||
|
output = output.replace( "\\u00d5", "õ" );
|
||||||
|
output = output.replace( "\\u00d9", "Ù" );
|
||||||
|
output = output.replace( "\\u00da", "Ú" );
|
||||||
|
output = output.replace( "\\u00db", "Û" );
|
||||||
|
|
||||||
|
output = output.replace( "\\u00e0", "à" );
|
||||||
|
output = output.replace( "\\u00e1", "á" );
|
||||||
|
output = output.replace( "\\u00e2", "â" );
|
||||||
|
output = output.replace( "\\u00e3", "ã" );
|
||||||
|
output = output.replace( "\\u00e7", "ç" );
|
||||||
|
output = output.replace( "\\u00e8", "è" );
|
||||||
|
output = output.replace( "\\u00e9", "é" );
|
||||||
|
output = output.replace( "\\u00ea", "ê" );
|
||||||
|
output = output.replace( "\\u00ec", "ì" );
|
||||||
|
output = output.replace( "\\u00ed", "í" );
|
||||||
|
output = output.replace( "\\u00ee", "î" );
|
||||||
|
output = output.replace( "\\u00f2", "ò" );
|
||||||
|
output = output.replace( "\\u00f3", "ó" );
|
||||||
|
output = output.replace( "\\u00f4", "ô" );
|
||||||
|
output = output.replace( "\\u00f5", "õ" );
|
||||||
|
output = output.replace( "\\u00f9", "ù" );
|
||||||
|
output = output.replace( "\\u00fa", "ú" );
|
||||||
|
output = output.replace( "\\u00fb", "û" );
|
||||||
|
|
||||||
|
output = output.replace( "\\u0153", "œ" );
|
||||||
|
|
||||||
|
output = output.replace( "\\u2013", "-" );
|
||||||
|
output = output.replace( "\\u2014", "-" );
|
||||||
|
output = output.replace( "\\u2018|\\u2019", "'" );
|
||||||
|
output = output.replace( "\\u201c|\\u201d", "\"" );
|
||||||
|
|
||||||
|
output = output.replace( "\\u2022", "*" );
|
||||||
|
output = output.replace( "\\u2026", "..." );
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String textToUnicode( String text )
|
||||||
|
{
|
||||||
|
String output = text;
|
||||||
|
output = output.replace( "À", "\\u00c0" );
|
||||||
|
output = output.replace( "Á", "\\u00c1" );
|
||||||
|
output = output.replace( "Â", "\\u00c2" );
|
||||||
|
output = output.replace( "Ã", "\\u00c3" );
|
||||||
|
output = output.replace( "Ç", "\\u00c7" );
|
||||||
|
output = output.replace( "È", "\\u00c8" );
|
||||||
|
output = output.replace( "É", "\\u00c9" );
|
||||||
|
|
||||||
|
output = output.replace( "Ê", "\\u00ca" );
|
||||||
|
output = output.replace( "Ì", "\\u00cc" );
|
||||||
|
output = output.replace( "Í", "\\u00cd" );
|
||||||
|
output = output.replace( "Î", "\\u00ce" );
|
||||||
|
output = output.replace( "ò", "\\u00d2" );
|
||||||
|
output = output.replace( "ó", "\\u00d3" );
|
||||||
|
output = output.replace( "ô", "\\u00d4" );
|
||||||
|
output = output.replace( "õ", "\\u00d5" );
|
||||||
|
output = output.replace( "Ù", "\\u00d9" );
|
||||||
|
output = output.replace( "Ú", "\\u00da" );
|
||||||
|
output = output.replace( "Û", "\\u00db" );
|
||||||
|
|
||||||
|
output = output.replace( "à", "\\u00e0" );
|
||||||
|
output = output.replace( "á", "\\u00e1" );
|
||||||
|
output = output.replace( "â", "\\u00e2" );
|
||||||
|
output = output.replace( "ã", "\\u00e3" );
|
||||||
|
output = output.replace( "ç", "\\u00e7" );
|
||||||
|
output = output.replace( "è", "\\u00e8" );
|
||||||
|
output = output.replace( "é", "\\u00e9" );
|
||||||
|
output = output.replace( "ê", "\\u00ea" );
|
||||||
|
output = output.replace( "ì", "\\u00ec" );
|
||||||
|
output = output.replace( "í", "\\u00ed" );
|
||||||
|
output = output.replace( "î", "\\u00ee" );
|
||||||
|
output = output.replace( "ò", "\\u00f2" );
|
||||||
|
output = output.replace( "ó", "\\u00f3" );
|
||||||
|
output = output.replace( "ô", "\\u00f4" );
|
||||||
|
output = output.replace( "õ", "\\u00f5" );
|
||||||
|
output = output.replace( "ù", "\\u00f9" );
|
||||||
|
output = output.replace( "ú", "\\u00fa" );
|
||||||
|
output = output.replace( "û", "\\u00fb" );
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String RTFToUnicode( String text )
|
||||||
|
{
|
||||||
|
if( text == null || text.length() < 4 )
|
||||||
|
{
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
String output = text;
|
||||||
|
output = output.replaceAll( "\\'", "\\u00" );
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String unicodeToRTF( String text )
|
||||||
|
{
|
||||||
|
if( text == null || text.length() < 6 )
|
||||||
|
{
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
String output = text;
|
||||||
|
output = output.replaceAll( "\\\\u00", "\\\\'" );
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,133 @@
|
|||||||
|
/*
|
||||||
|
* Utils.java
|
||||||
|
*
|
||||||
|
* Created on October 12, 2007, 9:39 AM
|
||||||
|
*
|
||||||
|
* To change this template, choose Tools | Template Manager
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package utils;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author lluis
|
||||||
|
*/
|
||||||
|
public class Utils {
|
||||||
|
|
||||||
|
/** Creates a new instance of Utils */
|
||||||
|
public Utils() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String unicodeToHTML( String text )
|
||||||
|
{
|
||||||
|
if( text == null || text.length() < 6 )
|
||||||
|
{
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
String output = text;
|
||||||
|
output = output.replace( "\\u0009", " " );
|
||||||
|
output = output.replace( "\\u000a", "<br>" );
|
||||||
|
|
||||||
|
output = output.replace( "\\u00a0", " " );
|
||||||
|
output = output.replace( "\\u00aa", "ª" );
|
||||||
|
output = output.replace( "\\u00ba", "º" );
|
||||||
|
|
||||||
|
output = output.replace( "\\u00c0", "À" );
|
||||||
|
output = output.replace( "\\u00c1", "Á" );
|
||||||
|
output = output.replace( "\\u00c2", "Â" );
|
||||||
|
output = output.replace( "\\u00c3", "Ã" );
|
||||||
|
output = output.replace( "\\u00c7", "Ç" );
|
||||||
|
output = output.replace( "\\u00c8", "È" );
|
||||||
|
output = output.replace( "\\u00c9", "É" );
|
||||||
|
|
||||||
|
output = output.replace( "\\u00ca", "Ê" );
|
||||||
|
output = output.replace( "\\u00cc", "Ì" );
|
||||||
|
output = output.replace( "\\u00cd", "Í" );
|
||||||
|
output = output.replace( "\\u00ce", "Î" );
|
||||||
|
output = output.replace( "\\u00d2", "ò" );
|
||||||
|
output = output.replace( "\\u00d3", "ó" );
|
||||||
|
output = output.replace( "\\u00d4", "ô" );
|
||||||
|
output = output.replace( "\\u00d5", "õ" );
|
||||||
|
output = output.replace( "\\u00d9", "Ù" );
|
||||||
|
output = output.replace( "\\u00da", "Ú" );
|
||||||
|
output = output.replace( "\\u00db", "Û" );
|
||||||
|
|
||||||
|
output = output.replace( "\\u00e0", "à" );
|
||||||
|
output = output.replace( "\\u00e1", "á" );
|
||||||
|
output = output.replace( "\\u00e2", "â" );
|
||||||
|
output = output.replace( "\\u00e3", "ã" );
|
||||||
|
output = output.replace( "\\u00e7", "ç" );
|
||||||
|
output = output.replace( "\\u00e8", "è" );
|
||||||
|
output = output.replace( "\\u00e9", "é" );
|
||||||
|
output = output.replace( "\\u00ea", "ê" );
|
||||||
|
output = output.replace( "\\u00ec", "ì" );
|
||||||
|
output = output.replace( "\\u00ed", "í" );
|
||||||
|
output = output.replace( "\\u00ee", "î" );
|
||||||
|
output = output.replace( "\\u00f2", "ò" );
|
||||||
|
output = output.replace( "\\u00f3", "ó" );
|
||||||
|
output = output.replace( "\\u00f4", "ô" );
|
||||||
|
output = output.replace( "\\u00f5", "õ" );
|
||||||
|
output = output.replace( "\\u00f9", "ù" );
|
||||||
|
output = output.replace( "\\u00fa", "ú" );
|
||||||
|
output = output.replace( "\\u00fb", "û" );
|
||||||
|
|
||||||
|
output = output.replace( "\\u0153", "œ" );
|
||||||
|
|
||||||
|
output = output.replace( "\\u2013", "-" );
|
||||||
|
output = output.replace( "\\u2014", "-" );
|
||||||
|
output = output.replace( "\\u2018|\\u2019", "'" );
|
||||||
|
output = output.replace( "\\u201c|\\u201d", "\"" );
|
||||||
|
|
||||||
|
output = output.replace( "\\u2022", "*" );
|
||||||
|
output = output.replace( "\\u2026", "..." );
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getPageFrom(String referer)
|
||||||
|
{
|
||||||
|
String pageFrom = referer.substring(referer.lastIndexOf("/")+1);
|
||||||
|
return pageFrom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isValidEmail(String email){
|
||||||
|
boolean res = true;
|
||||||
|
|
||||||
|
int indexOfAtChar=email.indexOf("@");
|
||||||
|
|
||||||
|
if(indexOfAtChar > 0)
|
||||||
|
{
|
||||||
|
int indexOfDotChar =
|
||||||
|
email.indexOf(".",indexOfAtChar);
|
||||||
|
if(indexOfDotChar > 0)
|
||||||
|
{
|
||||||
|
res = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
res = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
res = false;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String dateToYYYYMMDD(Date ddate)
|
||||||
|
{
|
||||||
|
Calendar cal = new GregorianCalendar();
|
||||||
|
cal.setTime(ddate);
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
|
||||||
|
String date_str = dateFormat.format(cal.getTime());
|
||||||
|
return date_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 79 B |