diff --git a/trunk/SIPRPSoft/dist9.tar b/trunk/SIPRPSoft/dist.tar similarity index 99% rename from trunk/SIPRPSoft/dist9.tar rename to trunk/SIPRPSoft/dist.tar index 7f51eefd..6ccfdeed 100644 Binary files a/trunk/SIPRPSoft/dist9.tar and b/trunk/SIPRPSoft/dist.tar differ diff --git a/trunk/SIPRPSoft/dist5.tar b/trunk/SIPRPSoft/dist5.tar deleted file mode 100644 index a7b84196..00000000 Binary files a/trunk/SIPRPSoft/dist5.tar and /dev/null differ diff --git a/trunk/SIPRPSoft/src/siprp/Main.java b/trunk/SIPRPSoft/src/siprp/Main.java index fb6bc03c..6cc9de62 100644 --- a/trunk/SIPRPSoft/src/siprp/Main.java +++ b/trunk/SIPRPSoft/src/siprp/Main.java @@ -62,7 +62,7 @@ import com.evolute.utils.ui.window.LoginWindow; public class Main implements com.evolute.utils.ui.window.Connector { - public final static String SHST_VERSION = "11.1.2"; + public final static String SHST_VERSION = "11.1.3"; private final static ClassLoader classLoader = new EVUtilsImageLib().getClass().getClassLoader(); @@ -121,7 +121,7 @@ public class Main implements com.evolute.utils.ui.window.Connector // new IBookDataLoader().load(); dbase = (String)Singleton.getInstance( SingletonConstants.LOCAL_DB_NAME ); - dbase = "siprp_local3"; +// dbase = "siprp_local3"; /* Calendar cal = Calendar.getInstance(); cal.set( 2004, 06, 14 ); if( cal.before( Calendar.getInstance() ) ) @@ -214,7 +214,7 @@ public class Main implements com.evolute.utils.ui.window.Connector { //server = "192.168.1.191"; server = (String)Singleton.getInstance( SingletonConstants.LOCAL_URL ); - server = "storage"; +// server = "storage"; // server = "ws_fpalma"; } String prefix = (String)Singleton.getInstance( SingletonConstants.LOCAL_URL_PREFIX ); diff --git a/trunk/SIPRPSoft/src/siprp/planoactuacao/print/LegislacaoAplicavelToPrint.java b/trunk/SIPRPSoft/src/siprp/planoactuacao/print/LegislacaoAplicavelToPrint.java index 17149347..66850fd5 100644 --- a/trunk/SIPRPSoft/src/siprp/planoactuacao/print/LegislacaoAplicavelToPrint.java +++ b/trunk/SIPRPSoft/src/siprp/planoactuacao/print/LegislacaoAplicavelToPrint.java @@ -38,7 +38,7 @@ public class LegislacaoAplicavelToPrint { Element diplomaElement = new Element( "diploma" ); diplomaElement.setText( diploma ); - legislacaoAplicavelElement.addContent( diploma ); + legislacaoAplicavelElement.addContent( diplomaElement ); } return legislacaoAplicavelElement; } diff --git a/trunk/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPDFCreator.java b/trunk/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPDFCreator.java index bcedacf5..6e4aba09 100644 --- a/trunk/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPDFCreator.java +++ b/trunk/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPDFCreator.java @@ -6,6 +6,7 @@ import java.io.FileOutputStream; import java.io.InputStream; import org.jdom.Document; +import org.jdom.output.Format; import org.jdom.output.XMLOutputter; import siprp.Main; @@ -20,9 +21,11 @@ public class PlanoActuacaoPDFCreator { PlanoActuacaoToPrint plano = PlanoActuacaoPrintDataProvider.getProvider( web ).getPlanoToPrint( planoId ); Document foDoc = new Document( plano.toJdomElement() ); - XMLOutputter outputter = new XMLOutputter(); + XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat()); ByteArrayOutputStream foBaos = new ByteArrayOutputStream(); outputter.output( foDoc, foBaos ); + + byte fo[] = applyTemplate( getClass().getClassLoader().getResourceAsStream( @@ -32,8 +35,8 @@ public class PlanoActuacaoPDFCreator new ByteArrayInputStream( foBaos.toByteArray() ) ); - FileOutputStream fos = new FileOutputStream("/home/jneto/Desktop/a.fo"); - fos.write(fo); +// FileOutputStream fos = new FileOutputStream("/home/jneto/Desktop/a.fo"); +// fos.write(fo); PDFCreator.setUserConfig(Main.fopConfigFile); diff --git a/trunk/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPrintDataProvider.java b/trunk/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPrintDataProvider.java index ae91a7c4..22f1f31a 100644 --- a/trunk/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPrintDataProvider.java +++ b/trunk/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPrintDataProvider.java @@ -179,33 +179,75 @@ public class PlanoActuacaoPrintDataProvider return array.columnLength() > 0 ? ( Integer ) array.get( 0, 0 ) : null; } +// public LegislacaoAplicavelToPrint getLegislacaoAplicavel( Integer planoId ) +// throws Exception +// { +// Select select = +// new Select2( +// new String[]{ "hs_relatorio_legislacao" }, +// new Integer[]{}, +// new Expression[]{}, +// new String[]{ "hs_relatorio_legislacao.categoria", "hs_relatorio_legislacao.descricao" }, +// new Field( "hs_relatorio_legislacao.hs_relatorio_id" ).isEqual( planoId ).and( +// new Field( "hs_relatorio_legislacao.categoria" ).isEqual( null ) ), +// null, +// null, +// null, +// null ); +// Virtual2DArray array = LOCAL_EXECUTER.executeQuery( select ); +// Vector diplomas = new Vector(); +// for( int n = 0; n < array.columnLength(); n++ ) +// { +// String descricao = ( String ) array.get( n, 0 ); +// diplomas.add( descricao ); +// } +// LegislacaoAplicavelToPrint legislacao = +// new LegislacaoAplicavelToPrint( diplomas ); +// +// return legislacao; +// } + public LegislacaoAplicavelToPrint getLegislacaoAplicavel( Integer planoId ) - throws Exception + throws Exception +{ + Select select = + new Select2( + new String[]{ "hs_relatorio_legislacao" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "hs_relatorio_legislacao.categoria", "hs_relatorio_legislacao.descricao" }, + new Field( "hs_relatorio_legislacao.hs_relatorio_id" ).isEqual( planoId ), + new String[]{ "hs_relatorio_legislacao.categoria DESC" }, + null, + null, + null ); + Virtual2DArray array = LOCAL_EXECUTER.executeQuery( select ); + Vector diplomasGerais = new Vector(); + Vector nomes = new Vector(); + Vector> diplomas = new Vector>(); + String last = null; + for( int n = 0; n < array.columnLength(); n++ ) { - Select select = - new Select2( - new String[]{ "hs_relatorio_legislacao" }, - new Integer[]{}, - new Expression[]{}, - new String[]{ "hs_relatorio_legislacao.categoria", "hs_relatorio_legislacao.descricao" }, - new Field( "hs_relatorio_legislacao.hs_relatorio_id" ).isEqual( planoId ).and( - new Field( "hs_relatorio_legislacao.categoria" ).isEqual( null ) ), - null, - null, - null, - null ); - Virtual2DArray array = LOCAL_EXECUTER.executeQuery( select ); - Vector diplomas = new Vector(); - for( int n = 0; n < array.columnLength(); n++ ) + String categoria = ( String ) array.get( n, 0 ); + String descricao = ( String ) array.get( n, 1 ); + if( categoria == null || categoria.trim().length() == 0 ) { - String descricao = ( String ) array.get( n, 0 ); - diplomas.add( descricao ); + diplomasGerais.add( descricao ); + } + else + { + if( !categoria.equals( last ) ) + { + nomes.add( categoria ); + diplomas.add( new Vector() ); + } + diplomas.lastElement().add( descricao ); } - LegislacaoAplicavelToPrint legislacao = - new LegislacaoAplicavelToPrint( diplomas ); - - return legislacao; } + LegislacaoAplicavelToPrint legislacao = + new LegislacaoAplicavelToPrint( diplomasGerais); + return legislacao; +} public Vector getAreasToPrintByPlanoId( Integer planoId, boolean validacaoDl, boolean validacaoDns ) throws Exception @@ -303,7 +345,7 @@ public class PlanoActuacaoPrintDataProvider riscos.add( new RiscoToPrint( descricao, - valor, + valor+"", getMedidasToPrintByRiscoId( id ), responsavelExecucao, recursosNecessarios, @@ -318,17 +360,18 @@ public class PlanoActuacaoPrintDataProvider { Select select = new Select2( - new String[]{ "hs_relatorio_risco", "hs_relatorio_posto_risco", "hs_relatorio_posto" }, - new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER }, + new String[]{ "hs_relatorio_risco", "hs_relatorio_posto_risco", "hs_relatorio_posto", "hs_relatorio_risco_valor_qualitativo" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_LEFT_OUTER }, new Expression[]{ new Field( "hs_relatorio_risco.id" ).isEqual( new Field( "hs_relatorio_posto_risco.risco_id" ) ), - new Field( "hs_relatorio_posto_risco.posto_id" ).isEqual( new Field( "hs_relatorio_posto.id" ) ) + new Field( "hs_relatorio_posto_risco.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", + "hs_relatorio_risco_valor_qualitativo.description", + "hs_relatorio_posto.id", "null", "null", "null", @@ -344,32 +387,47 @@ public class PlanoActuacaoPrintDataProvider array = LOCAL_EXECUTER.executeQuery( select ); Vector riscosVector = new Vector(); HashMap> riscosIdMap = new HashMap>(); + HashMap riscoPostoMap = new HashMap(); for( int n = 0; n < array.columnLength(); n++ ) { Integer id = ( Integer ) array.get( n, 0 ); String descricao = ( String ) array.get( n, 1 ); Integer risco = ( Integer ) array.get( n, 2 ); - if( risco == null ) - { + String risco_qual = ((String) array.get( n, 3)); + if(risco_qual!=null){ + risco_qual = risco_qual.substring(0, 3).toUpperCase(); + } + Integer posto = ( Integer ) array.get( n, 4 ); + + String finalRisco; + + if(risco!=null){ + finalRisco = ""+risco; + }else if(risco_qual!=null){ + finalRisco = ""+risco_qual; + }else{ continue; } - String key = descricao + "_" + risco; + + String key = descricao + "_" + finalRisco; if( !riscosIdMap.containsKey( key ) ) { riscosIdMap.put( key, new Vector() ); riscosVector.add( key ); } riscosIdMap.get( key ).add( id ); + riscoPostoMap.put(id, posto); } for( String risco : riscosVector ) { int index = risco.lastIndexOf( "_" ); String descricao = risco.substring( 0, index ); - Integer valor = new Integer( risco.substring( index + 1, risco.length() ) ); + String valor = risco.substring( index + 1, risco.length() ) ; Vector medidas = new Vector(); for( Integer id : riscosIdMap.get( risco ) ) { - medidas.addAll( getMedidasToPrintByRiscoId( id ) ); + Integer posto = riscoPostoMap.get(id); + medidas.addAll( getMedidasToPrintByRiscoId( id , posto) ); } if( medidas.size() > 0 ) { @@ -392,7 +450,11 @@ public class PlanoActuacaoPrintDataProvider return riscos; } - public Vector getMedidasToPrintByRiscoId( Integer riscoId ) + public Vector getMedidasToPrintByRiscoId( Integer riscoId) throws Exception{ + return getMedidasToPrintByRiscoId(riscoId, null); + } + + public Vector getMedidasToPrintByRiscoId( Integer riscoId, Integer posto ) throws Exception { Vector medidas = new Vector(); @@ -414,15 +476,21 @@ public class PlanoActuacaoPrintDataProvider } else { + Expression filter = new Field( "hs_relatorio_medida.risco_id" ).isEqual( riscoId ).and( + new Field( "hs_relatorio_medida.deleted_date" ).isEqual( null ) ) + .and(new Field("hs_relatorio_medida.description").isDifferent("")); + + if(posto!=null){ + filter = filter.and(new Field("hs_relatorio_posto_medida.posto_id").isEqual(posto)); + } + Select select = new Select2( - new String[]{ "hs_relatorio_medida" }, - new Integer[]{}, - new Expression[]{}, - new String[]{ "hs_relatorio_medida.id", "hs_relatorio_medida.description" }, - new Field( "hs_relatorio_medida.risco_id" ).isEqual( riscoId ).and( - new Field( "hs_relatorio_medida.deleted_date" ).isEqual( null ) ) - .and(new Field("hs_relatorio_medida.description").isDifferent("")), + new String[]{"hs_relatorio_medida", "hs_relatorio_posto_medida"}, + new Integer[]{Select2.JOIN_INNER}, + new Expression[]{new Field("hs_relatorio_medida.id").isEqual(new Field("hs_relatorio_posto_medida.medida_id"))}, + new String[]{ "hs_relatorio_medida.id", "hs_relatorio_medida.description", "hs_relatorio_posto_medida.is_plano_actuacao" }, + filter, new String[]{ "hs_relatorio_medida.id" }, null, null, @@ -433,8 +501,9 @@ public class PlanoActuacaoPrintDataProvider { Integer id = ( Integer ) array.get( n, 0 ); String descricao = ( String ) array.get( n, 1 ); + Boolean isPlanoActuacao = ( Boolean ) array.get( n, 2 ); Vector postos = getPostosToPrintByMedidaId( id ); - if( postos.size() > 0 ) + if( postos.size() > 0 && isPlanoActuacao) { medidas.add( new MedidaToPrint( descricao, postos ) ); } diff --git a/trunk/SIPRPSoft/src/siprp/planoactuacao/print/RiscoToPrint.java b/trunk/SIPRPSoft/src/siprp/planoactuacao/print/RiscoToPrint.java index 92d2ec69..e904dcd9 100644 --- a/trunk/SIPRPSoft/src/siprp/planoactuacao/print/RiscoToPrint.java +++ b/trunk/SIPRPSoft/src/siprp/planoactuacao/print/RiscoToPrint.java @@ -8,7 +8,7 @@ public class RiscoToPrint implements PrintableInterface { protected String descricao; - protected Integer valor; + protected String valor; protected Vector medidas; protected String responsavel; protected String recursos; @@ -18,7 +18,7 @@ public class RiscoToPrint protected String parecerDns; protected String verificacaoSiprp; - public RiscoToPrint( String descricao, Integer valor, + public RiscoToPrint( String descricao, String valor, Vector medidas, String responsavel, String recursos, DataToPrint dataPrevistaInicio, DataToPrint dataPrevistaConclusao, String parecerDl, String parecerDns, String verificacaoSiprp ) @@ -86,12 +86,12 @@ public class RiscoToPrint this.descricao = descricao; } - public Integer getValor() + public String getValor() { return valor; } - public void setValor( Integer valor ) + public void setValor( String valor ) { this.valor = valor; } diff --git a/trunk/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao.xsl b/trunk/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao.xsl index ca17c2f6..c2b3f985 100644 --- a/trunk/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao.xsl +++ b/trunk/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao.xsl @@ -91,8 +91,8 @@       -   -   + @@ -146,7 +146,7 @@     - ÍNDICE   + ÍNDICE 1. OBJECTIVO @@ -574,7 +574,7 @@ -   +   A determinação da valoração do risco permite hierarquizar as intervenções, definir as acções e estabelecer prazos de execução, como se diff --git a/trunk/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao_alargado.xsl b/trunk/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao_alargado.xsl index 553fea8a..fa909aa4 100644 --- a/trunk/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao_alargado.xsl +++ b/trunk/SIPRPSoft/src/siprp/planoactuacao/print/plano_actuacao_alargado.xsl @@ -91,8 +91,8 @@       -   -   + @@ -147,7 +147,7 @@     - ÍNDICE   + ÍNDICE 1. OBJECTIVO @@ -576,6 +576,7 @@   +   A determinação da valoração do risco permite hierarquizar as intervenções, definir as acções e estabelecer prazos de execução, como se