|
|
|
|
@ -4,6 +4,7 @@ import static com.evolute.utils.strings.UnicodeLatin1Map.atilde;
|
|
|
|
|
import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil;
|
|
|
|
|
import static com.evolute.utils.strings.UnicodeLatin1Map.iacute;
|
|
|
|
|
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@ -169,7 +170,8 @@ public class HigieneSegurancaLogic
|
|
|
|
|
DefaultMutableTreeNode result = new DefaultMutableTreeNode();
|
|
|
|
|
if( relatorio != null )
|
|
|
|
|
{
|
|
|
|
|
for( HsRelatorioArea area : relatorio.getHsRelatorioArea() )
|
|
|
|
|
List<HsRelatorioArea> areas = relatorio.getHsRelatorioArea();
|
|
|
|
|
for( HsRelatorioArea area : areas )
|
|
|
|
|
{
|
|
|
|
|
AreaRelatorioNode areaNode = new AreaRelatorioNode(area);
|
|
|
|
|
for( HsRelatorioPosto posto : area.getHsRelatorioPostoArray() )
|
|
|
|
|
@ -196,7 +198,8 @@ public class HigieneSegurancaLogic
|
|
|
|
|
reverterNormalizacao( relatorio, estabelecimento );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch( Exception e )
|
|
|
|
|
}
|
|
|
|
|
catch( Exception e )
|
|
|
|
|
{
|
|
|
|
|
LeafDialog.error(e);
|
|
|
|
|
}
|
|
|
|
|
@ -230,6 +233,7 @@ public class HigieneSegurancaLogic
|
|
|
|
|
{
|
|
|
|
|
rArea = new HsRelatorioArea();
|
|
|
|
|
rArea.setDescription( area.getDescription() );
|
|
|
|
|
rArea.setOrder( area.getOrder() );
|
|
|
|
|
rArea.setToHsRelatorio( relatorio );
|
|
|
|
|
areasInserted.put(area,rArea);
|
|
|
|
|
}
|
|
|
|
|
@ -248,6 +252,7 @@ public class HigieneSegurancaLogic
|
|
|
|
|
HsRelatorioPostoRisco rPostoRisco = new HsRelatorioPostoRisco();
|
|
|
|
|
rPostoRisco.setToHsRelatorioPosto( rPosto );
|
|
|
|
|
rPostoRisco.setToHsRelatorioRisco( rRelatorioRisco );
|
|
|
|
|
rPostoRisco.setOrder( postoRisco.getOrder() );
|
|
|
|
|
for( HsRiscoMedida riscoMedida : postoRisco.getToHsRisco().getHsRiscoMedidaArray() )
|
|
|
|
|
{
|
|
|
|
|
HsRelatorioMedida rMedida = new HsRelatorioMedida();
|
|
|
|
|
@ -264,14 +269,16 @@ public class HigieneSegurancaLogic
|
|
|
|
|
|
|
|
|
|
private static void reverterLegislacao( HsRelatorio relatorio, Estabelecimentos estabelecimento ) throws Exception
|
|
|
|
|
{
|
|
|
|
|
for(HsRelatorioLegislacao legislacao : relatorio.getHsRelatorioLegislacaoArray())
|
|
|
|
|
int legislacaoSize = relatorio.getHsRelatorioLegislacaoArray().size();
|
|
|
|
|
for(int i = 0; i < legislacaoSize; ++i )
|
|
|
|
|
{
|
|
|
|
|
legislacao.delete();
|
|
|
|
|
relatorio.getHsRelatorioLegislacaoArray().get( 0 ).delete();
|
|
|
|
|
}
|
|
|
|
|
for( HsLegislacaoEstabelecimento rel : estabelecimento.getHsLegislacaoEstabelecimentoArray() )
|
|
|
|
|
{
|
|
|
|
|
HsLegislacao legislacao = rel.getToHsLegislacao();
|
|
|
|
|
HsRelatorioLegislacao relatorioLegislacao = criarRelatorioLegislacao( relatorio, legislacao );
|
|
|
|
|
relatorioLegislacao.setOrdem( rel.getOrdem() );
|
|
|
|
|
relatorioLegislacao.save();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -292,9 +299,10 @@ public class HigieneSegurancaLogic
|
|
|
|
|
|
|
|
|
|
private static void reverterNormalizacao( HsRelatorio relatorio, Estabelecimentos estabelecimento ) throws Exception
|
|
|
|
|
{
|
|
|
|
|
for(HsRelatorioNormalizacao normalizacao : relatorio.getHsRelatorioNormalizacaoArray() )
|
|
|
|
|
int normalizacaoSize = relatorio.getHsRelatorioNormalizacaoArray().size();
|
|
|
|
|
for(int i = 0; i < normalizacaoSize; ++i )
|
|
|
|
|
{
|
|
|
|
|
normalizacao.delete();
|
|
|
|
|
relatorio.getHsRelatorioNormalizacaoArray().get( 0 ).delete();
|
|
|
|
|
}
|
|
|
|
|
for( HsNormalizacaoEstabelecimento rel : estabelecimento.getHsNormalizacaoEstabelecimentoArray() )
|
|
|
|
|
{
|
|
|
|
|
@ -527,54 +535,37 @@ public class HigieneSegurancaLogic
|
|
|
|
|
DefaultMutableTreeNode result = new DefaultMutableTreeNode();
|
|
|
|
|
DefaultMutableTreeNode geral = new DefaultMutableTreeNode( "Legisla" + ccedil + atilde + "o de aplica" + ccedil + atilde + "o geral" );
|
|
|
|
|
DefaultMutableTreeNode especifica = new DefaultMutableTreeNode( "Legisla" + ccedil + atilde + "o espec" + iacute + "fica" );
|
|
|
|
|
for( HsLegislacao legislacao : planoProvider.getAllLegislacaoGeral() )
|
|
|
|
|
if( estabelecimento != null )
|
|
|
|
|
{
|
|
|
|
|
if( estabelecimento == null || hasEstabelecimento( legislacao, estabelecimento ) )
|
|
|
|
|
for( HsLegislacaoEstabelecimento rel : estabelecimento.getHsLegislacaoEstabelecimentoArray() )
|
|
|
|
|
{
|
|
|
|
|
DefaultMutableTreeNode legislacaoNode = new DefaultMutableTreeNode( legislacao );
|
|
|
|
|
geral.add( legislacaoNode );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for( HsLegislacaoCategoria categoria : planoProvider.getAllLegislacaoCategorias( ) )
|
|
|
|
|
{
|
|
|
|
|
boolean addCategory = false;
|
|
|
|
|
DefaultMutableTreeNode categoriaNode = new DefaultMutableTreeNode( categoria );
|
|
|
|
|
for( HsLegislacao legislacao : categoria.getHsLegislacaoArray() )
|
|
|
|
|
{
|
|
|
|
|
if( estabelecimento == null || hasEstabelecimento( legislacao, estabelecimento ) )
|
|
|
|
|
HsLegislacao legislacao = rel.getToHsLegislacao();
|
|
|
|
|
if( legislacao != null )
|
|
|
|
|
{
|
|
|
|
|
DefaultMutableTreeNode legislacaoNode = new DefaultMutableTreeNode( legislacao );
|
|
|
|
|
categoriaNode.add( legislacaoNode );
|
|
|
|
|
addCategory = true;
|
|
|
|
|
HsLegislacaoCategoria categoria = legislacao.getToHsLegislacaoCategoria();
|
|
|
|
|
if( categoria == null )
|
|
|
|
|
{
|
|
|
|
|
DefaultMutableTreeNode legislacaoNode = new DefaultMutableTreeNode( rel.getToHsLegislacao() );
|
|
|
|
|
geral.add( legislacaoNode );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DefaultMutableTreeNode categoriaNode = TreeTools.findNodeWithUserObject( categoria, especifica );
|
|
|
|
|
if( categoriaNode == null )
|
|
|
|
|
{
|
|
|
|
|
categoriaNode = new DefaultMutableTreeNode(categoria);
|
|
|
|
|
especifica.add(categoriaNode);
|
|
|
|
|
}
|
|
|
|
|
DefaultMutableTreeNode legislacaoNode = new DefaultMutableTreeNode( rel.getToHsLegislacao() );
|
|
|
|
|
categoriaNode.add( legislacaoNode );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if( addCategory)
|
|
|
|
|
{
|
|
|
|
|
especifica.add( categoriaNode );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
result.add( geral );
|
|
|
|
|
result.add( especifica );
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static boolean hasEstabelecimento( HsLegislacao legislacao, Estabelecimentos estabelecimento )
|
|
|
|
|
{
|
|
|
|
|
boolean result = false;
|
|
|
|
|
if( legislacao != null && estabelecimento != null )
|
|
|
|
|
{
|
|
|
|
|
for( HsLegislacaoEstabelecimento rel : legislacao.getHsLegislacaoEstabelecimentoArray() )
|
|
|
|
|
{
|
|
|
|
|
result = estabelecimento.equals( rel.getToHsEstabelecimento());
|
|
|
|
|
if( result )
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static DefaultMutableTreeNode getEquipamentosTree()
|
|
|
|
|
{
|
|
|
|
|
|