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

lxbfYeaa
Diogo Neves 14 years ago
parent 312bdc8a9b
commit d62fe7a6b5

@ -282,10 +282,9 @@ public class CreatePlanosDataProvider extends GenericDataProvider
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
{
Statement st = createLocalStatement();
String sql = "select valor from ";
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 ";
@ -301,27 +300,29 @@ public class CreatePlanosDataProvider extends GenericDataProvider
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 += "order by subquery.valor";
System.out.println("VALORES BY RISCO : " + sql);
ResultSet rs = st.executeQuery(sql);
System.out.println( "VALORES BY RISCO : " + sql );
Statement st = createLocalStatement();
ResultSet rs = st.executeQuery( sql );
List< Valor > valores = new LinkedList< Valor >();
// Integer valor = null;
if(rs.isBeforeFirst())
if ( rs.isBeforeFirst() )
{
rs.first();
do
{
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);
// valor = null;
}
else
{
v.setValor((Integer) oValor);
v.setValor( ( Integer ) oValor );
//r.setValor((Integer) oValor);
// valor = (Integer) oValor;
}
@ -329,8 +330,8 @@ public class CreatePlanosDataProvider extends GenericDataProvider
//int valor = rs.getInt("valor");
//v.setValor(new Integer(valor));
//v.setMedidas(getMedidasByValor(v, r, a));
valores.add(v);
}while(rs.next());
valores.add( v );
} while ( rs.next() );
}
return valores;
//return valor;

Loading…
Cancel
Save