diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/AreaToPrint.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/AreaToPrint.java index 3de55e7a..02c12a73 100644 --- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/AreaToPrint.java +++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/AreaToPrint.java @@ -8,38 +8,13 @@ public class AreaToPrint implements PrintableInterface { protected String designacao; - protected Vector riscos; + protected Vector postos; - public AreaToPrint( String designacao, Vector riscos ) + public AreaToPrint( String designacao, Vector postos ) { super(); this.designacao = designacao; - this.riscos = riscos; - } - - public String getDesignacao() - { - return designacao; - } - - public void setDesignacao( String designacao ) - { - this.designacao = designacao; - } - - public Vector getRiscos() - { - return riscos; - } - - public void setRiscos( Vector riscos ) - { - this.riscos = riscos; - } - - public void addRisco( RiscoToPrint risco ) - { - riscos.add( risco ); + this.postos = postos; } @Override @@ -49,9 +24,9 @@ public class AreaToPrint Element designacaoElement = new Element( "designacao" ); designacaoElement.setText( designacao ); areaElement.addContent( designacaoElement ); - for( RiscoToPrint risco : riscos ) + for( PostoToPrint posto : postos ) { - areaElement.addContent( risco.toJdomElement() ); + areaElement.addContent( posto.toJdomElement() ); } return areaElement; } diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/MedidaToPrint.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/MedidaToPrint.java index 0082a733..d343cc60 100644 --- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/MedidaToPrint.java +++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/MedidaToPrint.java @@ -1,58 +1,25 @@ package siprp.higiene.relatorio.print; -import java.util.Vector; - import org.jdom.Element; public class MedidaToPrint implements PrintableInterface { - protected String descricao; - protected Vector postos; + protected String requisitosLegais; - public MedidaToPrint( String descricao, Vector postos ) + public MedidaToPrint( String requisitosLegais ) { super(); - this.descricao = descricao; - this.postos = postos; + this.requisitosLegais = requisitosLegais; } @Override public Element toJdomElement() throws Exception { Element medidaElement = new Element( "medida" ); - Element descricaoElement = new Element( "descricao" ); - descricaoElement.setText( descricao ); - medidaElement.addContent( descricaoElement ); - for( PostoToPrint posto : postos ) - { - medidaElement.addContent( posto.toJdomElement() ); - } + Element requisitosLegaisElement = new Element( "requisitos-legais" ); + requisitosLegaisElement.setText( requisitosLegais ); + medidaElement.addContent( requisitosLegaisElement ); return medidaElement; } - - public String getDescricao() - { - return descricao; - } - - public void setDescricao( String descricao ) - { - this.descricao = descricao; - } - - public Vector getPostos() - { - return postos; - } - - public void setPostos( Vector postos ) - { - this.postos = postos; - } - - public void addPosto( PostoToPrint posto ) - { - postos.add( posto ); - } } diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/PlanoActuacaoPDFCreator.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/PlanoActuacaoPDFCreator.java deleted file mode 100644 index 1c9ef30d..00000000 --- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/PlanoActuacaoPDFCreator.java +++ /dev/null @@ -1,41 +0,0 @@ -package siprp.higiene.relatorio.print; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; - -import org.jdom.Document; -import org.jdom.output.XMLOutputter; - -import com.evolute.utils.fop.PDFCreator; -import com.evolute.utils.xml.XSLTransformer; - -public class PlanoActuacaoPDFCreator -{ - - public byte[] createPDF( Integer planoId, boolean web ) throws Exception - { - RelatorioToPrint plano = RelatorioPrintDataProvider.getProvider( web ).getPlanoToPrint( planoId ); - Document foDoc = new Document( plano.toJdomElement() ); - XMLOutputter outputter = new XMLOutputter(); - ByteArrayOutputStream foBaos = new ByteArrayOutputStream(); - outputter.output( foDoc, foBaos ); - byte fo[] = - applyTemplate( - getClass().getClassLoader().getResourceAsStream( - RelatorioPrintDataProvider.getProvider( web ).empresaUsaPlanoAlargadoPorPlanoId( planoId ) ? - "siprp/planoactuacao/print/plano_actuacao_alargado.xsl" - : "siprp/planoactuacao/print/plano_actuacao.xsl" ), - new ByteArrayInputStream( foBaos.toByteArray() ) ); - byte pdf[] = PDFCreator.getPDFCreator().createPdfFromFo( fo ); - return pdf; - } - - public byte[] applyTemplate( InputStream xsl, InputStream dataStream ) throws Exception - { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - XSLTransformer.getXSLTransformer().transform( dataStream, xsl, baos ); - return baos.toByteArray(); - } - -} diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/PostoToPrint.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/PostoToPrint.java index ee281bee..d5a00bdb 100644 --- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/PostoToPrint.java +++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/PostoToPrint.java @@ -1,5 +1,7 @@ package siprp.higiene.relatorio.print; +import java.util.Vector; + import org.jdom.Element; @@ -7,10 +9,12 @@ public class PostoToPrint implements PrintableInterface { protected String designacao; + protected Vector riscos; - public PostoToPrint( String designacao ) + public PostoToPrint( String designacao, Vector riscos ) { this.designacao = designacao; + this.riscos = riscos; } @Override @@ -21,16 +25,10 @@ public class PostoToPrint Element designacaoElement = new Element( "designacao" ); designacaoElement.setText( designacao ); postoElement.addContent( designacaoElement ); + for( RiscoToPrint risco : riscos ) + { + postoElement.addContent( risco.toJdomElement() ); + } return postoElement; } - - public String getDesignacao() - { - return designacao; - } - - public void setDesignacao( String designacao ) - { - this.designacao = designacao; - } } diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioPrintDataProvider.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioPrintDataProvider.java index 53978e11..a7803737 100644 --- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioPrintDataProvider.java +++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioPrintDataProvider.java @@ -83,7 +83,7 @@ public class RelatorioPrintDataProvider } - public RelatorioToPrint getPlanoToPrint( Integer id ) + public RelatorioToPrint getRelatorioToPrint( Integer id ) throws Exception { Virtual2DArray array; @@ -99,9 +99,7 @@ public class RelatorioPrintDataProvider }, new String[]{ "empresas.id", "empresas.designacao_social", "empresas.actividade", "estabelecimentos.id", "estabelecimentos.nome", - "hs_relatorio.data", "marcacoes_estabelecimento.data", "''", - "''", "false", - "false" }, + "hs_relatorio.data", "marcacoes_estabelecimento.data" }, new Field( "hs_relatorio.id" ).isEqual( id ), null, null, @@ -116,23 +114,20 @@ public class RelatorioPrintDataProvider Integer logoId = getLogotipoIdForEmpresaId( empresaId ); Date dataRelatorio = ( Date ) array.get( 0, 5 ); Date dataVisita = ( Date ) array.get( 0, 6 ); - String observacoesDl = ( String ) array.get( 0, 7 ); - String observacoesDns = ( String ) array.get( 0, 8 ); - Boolean validacaoDl = ( Boolean ) array.get( 0, 9 ); - Boolean validacaoDns = ( Boolean ) array.get( 0, 10 ); EmpresaToPrint empresa = new EmpresaToPrint( nomeEmpresa, "http://www.evolute.pt:13080/SIPRPImages/image?id=" + logoId, nomeEstabelecimento, actividadeEmpresa ); //TODO: RelatorioToPrint plano = null; -// new RelatorioToPrint( -// empresa, -// dataRelatorio != null ? new DataToPrint( "data-relatorio", dataRelatorio ) : null, -// dataVisita != null ? new DataToPrint( "data-hs", dataVisita ) : null, -// getLegislacaoAplicavel( empresaId, estabelecimentoId ), -// getAreasToPrintByPlanoId( id, validacaoDl, validacaoDns ), -// observacoesDl, -// observacoesDns ); + new RelatorioToPrint( + empresa, + dataRelatorio != null ? new DataToPrint( "data-relatorio", dataRelatorio ) : null, + dataVisita != null ? new DataToPrint( "data-hs", dataVisita ) : null, + null, //TODO: proxima hs + getLegislacaoAplicavel( id ), + getNormalizacaoAplicavel( id ), + getEquipamento( id ), + getAreasToPrint( id ) ); return plano; } @@ -230,7 +225,34 @@ public class RelatorioPrintDataProvider return new NormalizacaoToPrint( portuguesas, internacionais ); } - public Vector getAreasToPrintByPlanoId( Integer planoId, boolean validacaoDl, boolean validacaoDns ) + public EquipamentosToPrint getEquipamento( Integer relatorioId ) + throws Exception + { + Select select = + new Select2( + new String[]{ "hs_relatorio_equipamento" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "hs_relatorio_equipamento.tipo", "hs_relatorio_equipamento.marca", + "hs_relatorio_equipamento.modelo" }, + new Field( "hs_relatorio_equipamento.relatorio_id" ).isEqual( relatorioId ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + EquipamentoToPrint equipamentos[] = new EquipamentoToPrint[ array.columnLength() ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + String tipo = ( String ) array.get( n, 0 ); + String marca = ( String ) array.get( n, 1 ); + String modelo = ( String ) array.get( n, 2 ); + equipamentos[ n ] = new EquipamentoToPrint( tipo, marca, modelo ); + } + return new EquipamentosToPrint( equipamentos ); + } + + public Vector getAreasToPrint( Integer relatorioId ) throws Exception { Virtual2DArray array; @@ -242,7 +264,7 @@ public class RelatorioPrintDataProvider new Integer[]{}, new Expression[]{}, new String[]{ "id", "description" }, - new Field( "relatorio_id" ).isEqual( planoId ).and( + new Field( "relatorio_id" ).isEqual( relatorioId ).and( new Field( "deleted_date" ).isEqual( null ) ), new String[]{ "id" }, null, @@ -254,39 +276,60 @@ public class RelatorioPrintDataProvider { Integer areaId = ( Integer ) array.get( n, 0 ); String areaDescricao = ( String ) array.get( n, 1 ); - Vector riscos = getRiscosToPrintByAreaId( areaId, validacaoDl, validacaoDns ); - if( riscos.size() > 0 ) + Vector postos = getPostosToPrintByAreaId( areaId ); + if( postos.size() > 0 ) { - areas.add( new AreaToPrint( areaDescricao, riscos ) ); + areas.add( new AreaToPrint( areaDescricao, postos ) ); } } return areas; } - public Vector getRiscosToPrintByAreaId( Integer areaId, boolean validacaoDl, boolean validacaoDns ) + public Vector getPostosToPrintByAreaId( Integer areaId ) + throws Exception + { + Vector postos = new Vector(); + Virtual2DArray array; + Select select = + new Select2( + new String[]{ "hs_relatorio_posto" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "hs_relatorio_posto.id", "hs_relatorio_posto.description" }, + new Field( "hs_relatorio_posto.area_id" ).isEqual( areaId ), + new String[]{ "hs_relatorio_posto.id" }, + null, + null, + null ); + array = EXECUTER.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String descricao = ( String ) array.get( n, 1 ); + postos.add( new PostoToPrint( descricao, getRiscosToPrintByPostoId( id ) ) ); + } + return postos; + } + + public Vector getRiscosToPrintByPostoId( Integer postoId ) throws Exception { Virtual2DArray array; Vector riscos = new Vector(); Select select = new Select2( - new String[]{ "hs_relatorio_risco", "hs_relatorio_posto_risco", "hs_relatorio_posto" }, + new String[]{ "hs_relatorio_risco", "hs_relatorio_posto_risco", "hs_relatorio_risco_valor_qualitativo" }, new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER }, new Expression[]{ new Field( "hs_relatorio_risco.id" ).isEqual( new Field( "hs_relatorio_posto_risco.risco_id" ) ), - new Field( "hs_relatorio_posto_risco.posto_id" ).isEqual( new Field( "hs_relatorio_posto.id" ) ) + new Field( "hs_relatorio_posto_risco.valor_qualitativo_id" ).isEqual( new Field( "hs_relatorio_risco_valor_qualitativo.id" ) ) }, new String[]{ "hs_relatorio_risco.id", "hs_relatorio_risco.description", - "hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade", - "null", - "null", - "null", - "null", - "null", - "null", - "null" }, - new Field( "hs_relatorio_posto.area_id" ).isEqual( areaId ).and( + "hs_relatorio_posto_risco.probabilidade", + "hs_relatorio_posto_risco.severidade", + "hs_relatorio_risco_valor_qualitativo.description" }, + new Field( "hs_relatorio_posto.posto_id" ).isEqual( postoId ).and( new Field( "hs_relatorio_risco.deleted_date" ).isEqual( null ) ).and( new Field( "hs_relatorio_posto.deleted_date" ).isEqual( null ) ), new String[]{ "hs_relatorio_risco.id" }, @@ -300,44 +343,16 @@ public class RelatorioPrintDataProvider { Integer id = ( Integer ) array.get( n, 0 ); String descricao = ( String ) array.get( n, 1 ); - Integer risco = ( Integer ) array.get( n, 2 ); - if( risco == null ) - { - continue; - } - String key = descricao + "_" + risco; - if( !riscosIdMap.containsKey( key ) ) - { - riscosIdMap.put( key, new Vector() ); - riscosVector.add( key ); - } - riscosIdMap.get( key ).add( id ); - } - for( String risco : riscosVector ) - { - int index = risco.lastIndexOf( "_" ); - String descricao = risco.substring( 0, index ); - Integer valor = new Integer( risco.substring( index + 1, risco.length() ) ); - Vector medidas = new Vector(); - for( Integer id : riscosIdMap.get( risco ) ) - { - medidas.addAll( getMedidasToPrintByRiscoId( id ) ); - } - if( medidas.size() > 0 ) - { - riscos.add( - new RiscoToPrint( - descricao, - valor, - medidas, - null, - null, - null, - null, - null, - null, - null ) ); - } + Integer probabilidade = ( Integer ) array.get( n, 2 ); + Integer severidade = ( Integer ) array.get( n, 3 ); + String valorQualitativo = ( String ) array.get( n, 4 ); + riscos.add( + new RiscoToPrint( + descricao, + severidade, + probabilidade, + valorQualitativo, + getMedidasToPrintByRiscoId( id ) ) ); } return riscos; @@ -347,48 +362,25 @@ public class RelatorioPrintDataProvider throws Exception { Vector medidas = new Vector(); - Virtual2DArray array; Select select = new Select2( new String[]{ "hs_relatorio_medida" }, new Integer[]{}, new Expression[]{}, - new String[]{ "hs_relatorio_medida.id", "hs_relatorio_medida.description" }, + new String[]{ "hs_relatorio_medida.id", "hs_relatorio_medida.requisitos_legais" }, new Field( "hs_relatorio_medida.risco_id" ).isEqual( riscoId ).and( new Field( "hs_relatorio_medida.deleted_date" ).isEqual( null ) ), new String[]{ "hs_relatorio_medida.id" }, null, null, null ); - array = EXECUTER.executeQuery( select ); - return medidas; - } - - public Vector getPostosToPrintByMedidaId( Integer medidaId ) - throws Exception - { - Vector postos = new Vector(); - Virtual2DArray array; - Select select = - new Select2( - new String[]{ "hs_relatorio_posto", "hs_relatorio_posto_medida" }, - new Integer[]{ Select2.JOIN_INNER }, - new Expression[]{ - new Field( "hs_relatorio_posto.id" ).isEqual( new Field( "hs_relatorio_posto_medida.posto_id" ) ) - }, - new String[]{ "hs_relatorio_posto.id", "hs_relatorio_posto.description" }, - new Field( "hs_relatorio_posto_medida.medida_id" ).isEqual( medidaId ), - new String[]{ "hs_relatorio_posto.id" }, - null, - null, - null ); - array = EXECUTER.executeQuery( select ); + Virtual2DArray array = EXECUTER.executeQuery( select ); for( int n = 0; n < array.columnLength(); n++ ) { - String descricao = ( String ) array.get( n, 1 ); - postos.add( new PostoToPrint( descricao ) ); + String requisitosLegais = ( String ) array.get( n, 1 ); + medidas.add( new MedidaToPrint( requisitosLegais ) ); } - return postos; + return medidas; } /** diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioToPrint.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioToPrint.java index 2ab74179..cee83520 100644 --- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioToPrint.java +++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/RelatorioToPrint.java @@ -13,12 +13,14 @@ public class RelatorioToPrint protected DataToPrint dataProximaHs; protected LegislacaoAplicavelToPrint legislacaoAplicavel; protected NormalizacaoToPrint normalizacaoAplicavel; + protected EquipamentosToPrint equipamentos; protected Vector areas; public RelatorioToPrint( EmpresaToPrint empresa, DataToPrint dataRelatorio, DataToPrint dataHs, DataToPrint dataProximaHs, LegislacaoAplicavelToPrint legislacaoAplicavel, NormalizacaoToPrint normalizacaoAplicavel, + EquipamentosToPrint equipamentos, Vector areas ) { super(); @@ -28,6 +30,7 @@ public class RelatorioToPrint this.dataProximaHs = dataProximaHs; this.legislacaoAplicavel = legislacaoAplicavel; this.normalizacaoAplicavel = normalizacaoAplicavel; + this.equipamentos = equipamentos; this.areas = areas; } @@ -82,6 +85,16 @@ public class RelatorioToPrint this.legislacaoAplicavel = legislacaoAplicavel; } + public EquipamentosToPrint getEquipamentos() + { + return equipamentos; + } + + public void setEquipamentos( EquipamentosToPrint equipamentos ) + { + this.equipamentos = equipamentos; + } + public Vector getAreas() { return areas; @@ -107,6 +120,7 @@ public class RelatorioToPrint planoElement.addContent( dataProximaHs.toJdomElement() ); planoElement.addContent( legislacaoAplicavel.toJdomElement() ); planoElement.addContent( normalizacaoAplicavel.toJdomElement() ); + planoElement.addContent( equipamentos.toJdomElement() ); if( areas.size() > 0 ) { Element conclusoesElement = new Element( "conclusoes" ); diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/RiscoToPrint.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/RiscoToPrint.java index a5ed2f63..25a2e15b 100644 --- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/RiscoToPrint.java +++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/RiscoToPrint.java @@ -8,32 +8,20 @@ public class RiscoToPrint implements PrintableInterface { protected String descricao; - protected Integer valor; + protected Integer severidade; + protected Integer probabilidade; + protected String valorQualitativo; protected Vector medidas; - protected String responsavel; - protected String recursos; - protected DataToPrint dataPrevistaInicio; - protected DataToPrint dataPrevistaConclusao; - protected String parecerDl; - protected String parecerDns; - protected String verificacaoSiprp; - public RiscoToPrint( String descricao, Integer valor, - Vector medidas, String responsavel, String recursos, - DataToPrint dataPrevistaInicio, DataToPrint dataPrevistaConclusao, - String parecerDl, String parecerDns, String verificacaoSiprp ) + public RiscoToPrint( String descricao, Integer severidade, Integer probabilidade, + String valorQualitativo, Vector medidas ) { super(); this.descricao = descricao; - this.valor = valor; + this.severidade = severidade; + this.probabilidade = probabilidade; + this.valorQualitativo = valorQualitativo; this.medidas = medidas; - this.responsavel = responsavel; - this.recursos = recursos; - this.dataPrevistaInicio = dataPrevistaInicio; - this.dataPrevistaConclusao = dataPrevistaConclusao; - this.parecerDl = parecerDl; - this.parecerDns = parecerDns; - this.verificacaoSiprp = verificacaoSiprp; } @Override @@ -43,142 +31,23 @@ public class RiscoToPrint Element descricaoElement = new Element( "descricao" ); descricaoElement.setText( descricao ); riscoElement.addContent( descricaoElement ); + Element severidadeElement = new Element( "severidade" ); + severidadeElement.setText( severidade != null ? severidade.toString() : " " ); + riscoElement.addContent( severidadeElement ); + Element probabilidadeElement = new Element( "probabilidade" ); + probabilidadeElement.setText( probabilidade != null ? probabilidade.toString() : " " ); + riscoElement.addContent( probabilidadeElement ); Element valorElement = new Element( "valor" ); - valorElement.setText( valor != null ? valor.toString() : " " ); + valorElement.setText( ( severidade != null && probabilidade != null ) ? "" + ( severidade * probabilidade ) : " " ); riscoElement.addContent( valorElement ); + Element valorQualitativoElement = new Element( "valor-qualitativo" ); + valorQualitativoElement.setText( valorQualitativo != null ? valorQualitativo : " " ); + riscoElement.addContent( valorQualitativoElement ); for( MedidaToPrint medida : medidas ) { riscoElement.addContent( medida.toJdomElement() ); } - Element responsavelElement = new Element( "responsavel" ); - responsavelElement.setText( responsavel ); - riscoElement.addContent( responsavelElement ); - Element recursosElement = new Element( "recursos" ); - recursosElement.setText( recursos ); - riscoElement.addContent( recursosElement ); - if( dataPrevistaInicio != null ) - { - riscoElement.addContent( dataPrevistaInicio.toJdomElement() ); - } - if( dataPrevistaConclusao != null ) - { - riscoElement.addContent( dataPrevistaConclusao.toJdomElement() ); - } - Element parecerDlElement = new Element( "parecer-dl" ); - parecerDlElement.setText( parecerDl ); - riscoElement.addContent( parecerDlElement ); - Element parecerDnsElement = new Element( "parecer-dns" ); - parecerDnsElement.setText( parecerDns ); - riscoElement.addContent( parecerDnsElement ); - Element verificacaoSiprpElement = new Element( "verificacao-siprp" ); - verificacaoSiprpElement.setText( verificacaoSiprp ); - riscoElement.addContent( verificacaoSiprpElement ); + return riscoElement; } - - public String getDescricao() - { - return descricao; - } - - public void setDescricao( String descricao ) - { - this.descricao = descricao; - } - - public Integer getValor() - { - return valor; - } - - public void setValor( Integer valor ) - { - this.valor = valor; - } - - public Vector getMedidas() - { - return medidas; - } - - public void setMedidas( Vector medidas ) - { - this.medidas = medidas; - } - - public void addMedida( MedidaToPrint medida ) - { - medidas.add( medida ); - } - - public String getResponsavel() - { - return responsavel; - } - - public void setResponsavel( String responsavel ) - { - this.responsavel = responsavel; - } - - public String getRecursos() - { - return recursos; - } - - public void setRecursos( String recursos ) - { - this.recursos = recursos; - } - - public DataToPrint getDataPrevistaInicio() - { - return dataPrevistaInicio; - } - - public void setDataPrevistaInicio( DataToPrint dataPrevistaInicio ) - { - this.dataPrevistaInicio = dataPrevistaInicio; - } - - public DataToPrint getDataPrevistaConclusao() - { - return dataPrevistaConclusao; - } - - public void setDataPrevistaConclusao( DataToPrint dataPrevistaConclusao ) - { - this.dataPrevistaConclusao = dataPrevistaConclusao; - } - - public String getParecerDl() - { - return parecerDl; - } - - public void setParecerDl( String parecerDl ) - { - this.parecerDl = parecerDl; - } - - public String getParecerDns() - { - return parecerDns; - } - - public void setParecerDns( String parecerDns ) - { - this.parecerDns = parecerDns; - } - - public String getVerificacaoSiprp() - { - return verificacaoSiprp; - } - - public void setVerificacaoSiprp( String verificacaoSiprp ) - { - this.verificacaoSiprp = verificacaoSiprp; - } - } diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/TestPrint.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/TestPrint.java index 142d542d..0130c8db 100644 --- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/TestPrint.java +++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/print/TestPrint.java @@ -24,44 +24,44 @@ public class TestPrint public void test() throws Exception { - FileOutputStream fos; - -// PlanoActuacaoDBInit.initDB(); -// PlanoActuacaoToPrint plano = PlanoActuacaoPrintDataProvider.getProvider().getPlanoToPrint( 6 ); - Element evoluteElement = new Element( "evolute" ); - Document foDoc = new Document( evoluteElement ); - Format pretty = Format.getPrettyFormat(); - pretty.setIndent("\t"); - XMLOutputter outputter = new XMLOutputter(pretty); - ByteArrayOutputStream foBaos = new ByteArrayOutputStream(); - outputter.output( foDoc, foBaos ); -// FileOutputStream fos = new FileOutputStream( "/home/fpalma/Desktop/in.xml" ); -// fos.write( foBaos.toByteArray() ); +// FileOutputStream fos; +// +//// PlanoActuacaoDBInit.initDB(); +//// PlanoActuacaoToPrint plano = PlanoActuacaoPrintDataProvider.getProvider().getPlanoToPrint( 6 ); +// Element evoluteElement = new Element( "evolute" ); +// Document foDoc = new Document( evoluteElement ); +// Format pretty = Format.getPrettyFormat(); +// pretty.setIndent("\t"); +// XMLOutputter outputter = new XMLOutputter(pretty); +// ByteArrayOutputStream foBaos = new ByteArrayOutputStream(); +// outputter.output( foDoc, foBaos ); +//// FileOutputStream fos = new FileOutputStream( "/home/fpalma/Desktop/in.xml" ); +//// fos.write( foBaos.toByteArray() ); +//// fos.close(); +// +// byte fo[] = applyTemplate( +//// "siprp/planoactuacao/print/plano_actuacao.xsl", +//// getClass().getClassLoader().getResourceAsStream( "siprp/higiene/relatorio/relatorio.xsl" ), +// new FileInputStream( "/home/fpalma/projectos2/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/relatorio.xsl" ), +//// "siprp/planoactuacao/print/teste_input.xml" ); +// new FileInputStream( "/home/fpalma/projectos2/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/teste_input.xml" ) ); +//// new ByteArrayInputStream( foBaos.toByteArray() ) ); +//// new ByteArrayInputStream( "".getBytes() ) ); +//// System.out.println( new String( fo ) ); +// createPDFFile( fo, "/home/fpalma/Desktop/out.pdf" ); +//// createPDFFile( fo, "c:/Documents and Settings/Frederico/Ambiente de Trabalho/out.pdf" ); +// +// fos = new FileOutputStream( "/home/fpalma/Desktop/out.xml" ); +// fos.write( fo ); // fos.close(); - byte fo[] = applyTemplate( -// "siprp/planoactuacao/print/plano_actuacao.xsl", -// getClass().getClassLoader().getResourceAsStream( "siprp/higiene/relatorio/relatorio.xsl" ), - new FileInputStream( "/home/fpalma/projectos2/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/relatorio.xsl" ), -// "siprp/planoactuacao/print/teste_input.xml" ); - new FileInputStream( "/home/fpalma/projectos2/SIPRP/SIPRPSoft/src/siprp/higiene/relatorio/teste_input.xml" ) ); -// new ByteArrayInputStream( foBaos.toByteArray() ) ); -// new ByteArrayInputStream( "".getBytes() ) ); -// System.out.println( new String( fo ) ); - createPDFFile( fo, "/home/fpalma/Desktop/out.pdf" ); -// createPDFFile( fo, "c:/Documents and Settings/Frederico/Ambiente de Trabalho/out.pdf" ); - - fos = new FileOutputStream( "/home/fpalma/Desktop/out.xml" ); - fos.write( fo ); - fos.close(); - -// for( int n = 1; n <= 7; n++ ) -// { -// byte pdf[] = new PlanoActuacaoPDFCreator().createPDF( n, false ); -// FileOutputStream fos = new FileOutputStream( "/home/fpalma/Desktop/" + n + ".pdf" ); -// fos.write( pdf ); -// fos.close(); -// } + for( int n = 49; n <= 49; n++ ) + { + byte pdf[] = new RelatorioPDFCreator().createPDF( n, false ); + FileOutputStream fos = new FileOutputStream( "/home/fpalma/Desktop/" + n + ".pdf" ); + fos.write( pdf ); + fos.close(); + } } public void createPDFFile( byte fo[], String path )