git-svn-id: https://svn.coded.pt/svn/SIPRP@1705 bb69d46d-e84e-40c8-a05a-06db0d633741

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Diogo Neves 14 years ago
parent 312bdc8a9b
commit d62fe7a6b5

@ -282,10 +282,9 @@ public class CreatePlanosDataProvider extends GenericDataProvider
return riscos; return riscos;
} }
private List<Valor> getValoresByRisco(Risco r, Area a) throws Exception private List< Valor > getValoresByRisco( Risco r, Area a ) throws Exception
//private Integer getValorByRisco(Risco r, Area a) throws Exception //private Integer getValorByRisco(Risco r, Area a) throws Exception
{ {
Statement st = createLocalStatement();
String sql = "select valor from "; String sql = "select valor from ";
sql += "(select distinct hs_relatorio_posto_risco.risco_id, "; sql += "(select distinct hs_relatorio_posto_risco.risco_id, ";
sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null "; sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null ";
@ -301,27 +300,29 @@ public class CreatePlanosDataProvider extends GenericDataProvider
sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id "; sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id ";
sql += "where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + ") subquery "; sql += "where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + ") subquery ";
sql += "order by subquery.valor"; sql += "order by subquery.valor";
System.out.println("VALORES BY RISCO : " + sql); System.out.println( "VALORES BY RISCO : " + sql );
ResultSet rs = st.executeQuery(sql);
Statement st = createLocalStatement();
ResultSet rs = st.executeQuery( sql );
List< Valor > valores = new LinkedList< Valor >(); List< Valor > valores = new LinkedList< Valor >();
// Integer valor = null; // Integer valor = null;
if(rs.isBeforeFirst()) if ( rs.isBeforeFirst() )
{ {
rs.first(); rs.first();
do do
{ {
Valor v = new Valor(); Valor v = new Valor();
Object oValor = rs.getObject("valor"); Object oValor = rs.getObject( "valor" );
if(oValor == null) if ( oValor == null )
{ {
v.setValor(null); v.setValor( null );
//r.setValor(null); //r.setValor(null);
// valor = null; // valor = null;
} }
else else
{ {
v.setValor((Integer) oValor); v.setValor( ( Integer ) oValor );
//r.setValor((Integer) oValor); //r.setValor((Integer) oValor);
// valor = (Integer) oValor; // valor = (Integer) oValor;
} }
@ -329,8 +330,8 @@ public class CreatePlanosDataProvider extends GenericDataProvider
//int valor = rs.getInt("valor"); //int valor = rs.getInt("valor");
//v.setValor(new Integer(valor)); //v.setValor(new Integer(valor));
//v.setMedidas(getMedidasByValor(v, r, a)); //v.setMedidas(getMedidasByValor(v, r, a));
valores.add(v); valores.add( v );
}while(rs.next()); } while ( rs.next() );
} }
return valores; return valores;
//return valor; //return valor;

Loading…
Cancel
Save