diff --git a/trunk/PlanosActuacao/src/importer/PlanosActuacaoImporterProvider.java b/trunk/PlanosActuacao/src/importer/PlanosActuacaoImporterProvider.java index ade56417..d5575084 100644 --- a/trunk/PlanosActuacao/src/importer/PlanosActuacaoImporterProvider.java +++ b/trunk/PlanosActuacao/src/importer/PlanosActuacaoImporterProvider.java @@ -116,7 +116,8 @@ public class PlanosActuacaoImporterProvider extends GenericDataProvider + " inner join hs_relatorio_risco on hs_relatorio_risco.id = hs_relatorio_medida.risco_id " + " inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id " + " inner join hs_relatorio_area on hs_relatorio_area.id = hs_relatorio_posto.area_id " - + " where hs_relatorio.id = " + relatorioID + " " + + " where hs_relatorio.id = " + relatorioID + " and hs_relatorio_posto_medida.is_plano_actuacao " + + " and hs_relatorio_posto.deleted_date is null and hs_relatorio_area.deleted_date is null " + " group by area, descricao, ordem" + " order by area "; System.out.println( "\n\t\t\t\t\t\tprovider . getAreasByPlano( " + plano.getId() + ", " + relatorioID + " ) : " ); @@ -152,7 +153,10 @@ public class PlanosActuacaoImporterProvider extends GenericDataProvider ErrorLogger.logException( ex ); a.setRiscos( null ); } - areas.add( a ); + if( a.getRiscos().size() > 0 ) + { + areas.add( a ); + } } } while ( rs.next() ); @@ -170,7 +174,7 @@ public class PlanosActuacaoImporterProvider extends GenericDataProvider + " inner join hs_relatorio_risco on hs_relatorio_risco.id = hs_relatorio_medida.risco_id " + " inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id " + " inner join hs_relatorio_area on hs_relatorio_area.id = area_id " - + " where area_id = " + a.getId() + " " + + " where area_id = " + a.getId() + " and hs_relatorio_posto_medida.is_plano_actuacao and hs_relatorio_posto.deleted_date is null " + " order by hs_relatorio_risco.id "; System.out.println( "\t\t\t\t\t\t\tprovider . getRiscosByArea( " + a.getId() + " ) : " ); System.out.println( "\t\t\t\t\t\t\t\t\tSQL : " + sql ); @@ -193,7 +197,10 @@ public class PlanosActuacaoImporterProvider extends GenericDataProvider r.setValores( getValoresByRisco( r, a ) ); r.setRisco_id( new Integer( rs.getInt( "id" ) ) ); r.setMedidas( getMedidasByRisco( r, a ) ); - riscos.add( r ); + if( r.getMedidas().size() > 0 ) + { + riscos.add( r ); + } } } while ( rs.next() ); @@ -217,7 +224,7 @@ public class PlanosActuacaoImporterProvider extends GenericDataProvider + " inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id " + " inner join hs_relatorio_area on hs_relatorio_area.id = area_id " + " left outer join hs_relatorio_risco_valor_qualitativo on ( hs_relatorio_risco_valor_qualitativo.id = hs_relatorio_posto_risco.valor_qualitativo_id ) " - + " where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + ") subquery " + + " where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + " and hs_relatorio_posto.deleted_date is null) subquery " + " order by subquery.valor"; System.out.println( "\t\t\t\t\t\t\t\tprovider . getValoresByRisco( " + r.getId() + ", " + a.getId() + " ) : " ); @@ -299,7 +306,9 @@ public class PlanosActuacaoImporterProvider extends GenericDataProvider + " inner join hs_relatorio_posto_risco on (hs_relatorio_posto_risco.posto_id = hs_relatorio_posto.id and hs_relatorio_posto_risco.risco_id = hs_relatorio_risco.id) " + " inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id " + " inner join hs_relatorio_area on hs_relatorio_area.id = area_id " - + " where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + " and hs_relatorio_posto_medida.is_plano_actuacao = true" + ") subquery " + + " where hs_relatorio_medida.description is not null and length( hs_relatorio_medida.description ) > 0 " + + " and hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + " and hs_relatorio_posto_medida.is_plano_actuacao " + + " and hs_relatorio_posto.deleted_date is null and hs_relatorio_medida.deleted_date is null ) subquery " //+ " where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + ") subquery " //+ " where valor = " + v.getValorQuantitativo() + " " + " order by subquery.medida_id, valor"; @@ -317,10 +326,14 @@ public class PlanosActuacaoImporterProvider extends GenericDataProvider Medida m = new Medida(); m.setId( new Integer( rs.getInt("medida_id") ) ); m.setMedida_id( m.getId() ); - m.setDescricao( Utils.unicodeToHTML( rs.getString( "descricao" ) ) ); - //m.setPostos(getPostosByMedidaAndValor(m, v, a)); - m.setPostos( getPostosByMedida( r, m, a ) ); - medidas.add( m ); + String descricao = rs.getString( "descricao" ); + if( descricao != null && descricao.trim().length() > 8) + { + m.setDescricao( Utils.unicodeToHTML( descricao ) ); + //m.setPostos(getPostosByMedidaAndValor(m, v, a)); + m.setPostos( getPostosByMedida( r, m, a ) ); + medidas.add( m ); + } } while ( rs.next() ); }