forked from Coded/SIPRP
				
			git-svn-id: https://svn.coded.pt/svn/SIPRP@1300 bb69d46d-e84e-40c8-a05a-06db0d633741
	
		
	
				
					
				
			
							parent
							
								
									a56aa1f7aa
								
							
						
					
					
						commit
						7c26aa59b8
					
				| @ -0,0 +1,209 @@ | |||||||
|  | package siprp.database.cayenne.providers; | ||||||
|  | 
 | ||||||
|  | import java.util.Collection; | ||||||
|  | import java.util.HashMap; | ||||||
|  | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
|  | 
 | ||||||
|  | import siprp.MedicinaConstants; | ||||||
|  | import siprp.ProcessoConstants; | ||||||
|  | import siprp.data.outer.EmpresasData; | ||||||
|  | import siprp.data.outer.ExamesData; | ||||||
|  | import siprp.data.outer.LembretesTiposData; | ||||||
|  | import siprp.data.outer.PrestadoresData; | ||||||
|  | import siprp.data.outer.PrtGruposProtocoloData; | ||||||
|  | import siprp.data.outer.TrabalhadoresConsultasDatasData; | ||||||
|  | import siprp.data.outer.TrabalhadoresData; | ||||||
|  | import siprp.data.outer.TrabalhadoresEcdData; | ||||||
|  | import siprp.data.outer.TrabalhadoresEcdsDatasData; | ||||||
|  | import siprp.data.outer.TrabalhadoresProcessoData; | ||||||
|  | import siprp.database.cayenne.objects.Prestadores; | ||||||
|  | 
 | ||||||
|  | import com.evolute.entity.ProviderInterface; | ||||||
|  | import com.evolute.utils.Singleton; | ||||||
|  | import com.evolute.utils.dataedition.persistence.Persistent; | ||||||
|  | import com.evolute.utils.db.DBManager; | ||||||
|  | import com.evolute.utils.db.Executer; | ||||||
|  | import com.evolute.utils.error.ErrorLogger; | ||||||
|  | 
 | ||||||
|  | public class MedicinaDataProvider  | ||||||
|  | { | ||||||
|  | 	private static MedicinaDataProvider INSTANCE = null; | ||||||
|  | 
 | ||||||
|  | 	private ProviderInterface< Persistent< ? >, Exception > ENTITY_PROVIDER; | ||||||
|  | 	private Executer executer; | ||||||
|  | 	 | ||||||
|  | 	private MedicinaDataProvider() throws Exception | ||||||
|  | 	{ | ||||||
|  | 		DBManager manager = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); | ||||||
|  | 		executer = manager.getSharedExecuter( this ); | ||||||
|  | 		ENTITY_PROVIDER = ( ProviderInterface< Persistent< ? >, Exception > ) Singleton.getInstance( Singleton.DEFAULT_EVO_DATA_PROVIDER ); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	public static synchronized MedicinaDataProvider getInstance() throws Exception | ||||||
|  | 	{ | ||||||
|  | 		if ( INSTANCE == null ) | ||||||
|  | 		{ | ||||||
|  | 			INSTANCE = new MedicinaDataProvider(); | ||||||
|  | 		} | ||||||
|  | 		return INSTANCE; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	public TrabalhadoresData getTrabalhadorByID( Integer id ) | ||||||
|  | 	{ | ||||||
|  | 		TrabalhadoresData result = null; | ||||||
|  | 		try  | ||||||
|  | 		{ | ||||||
|  | 			result = ENTITY_PROVIDER.load( TrabalhadoresData.class, id ); | ||||||
|  | 		}  | ||||||
|  | 		catch (Exception e)  | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	public TrabalhadoresConsultasDatasData getConsultaMarcacaoByID( Integer id )  | ||||||
|  | 	{ | ||||||
|  | 		TrabalhadoresConsultasDatasData result = null; | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			result = ENTITY_PROVIDER.load( TrabalhadoresConsultasDatasData.class, id ); | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	public ExamesData getExameForExameID( Integer currentFichaExameID ) | ||||||
|  | 	{ | ||||||
|  | 		ExamesData result = null; | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			result = ENTITY_PROVIDER.load( ExamesData.class, currentFichaExameID ); | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	public LembretesTiposData getTipoLembretesCustomizavel() | ||||||
|  | 	{ | ||||||
|  | 		LembretesTiposData result = null; | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			result = ENTITY_PROVIDER.load( LembretesTiposData.class, 1 ); | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public List< EmpresasData > getAllEmpresas() | ||||||
|  | 	{ | ||||||
|  | 		List< EmpresasData > result = null; | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			result = ENTITY_PROVIDER.listLoad( EmpresasData.class,  | ||||||
|  | 			new Object[] { "y" },  | ||||||
|  | 			new String[] { EmpresasData.INACTIVO },  | ||||||
|  | 			new String[] { EmpresasData.DESIGNACAO_SOCIAL_PLAIN } ); | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	public List< PrestadoresData > getAllPrestadores()  | ||||||
|  | 	{ | ||||||
|  | 		List< PrestadoresData > result = null; | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			result = ENTITY_PROVIDER.listLoad( PrestadoresData.class, | ||||||
|  | 			new Object[] { "y" }, new String[] { PrestadoresData.ACTIVO }, | ||||||
|  | 			new String[] { PrestadoresData.NOME } ); | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	public List< PrtGruposProtocoloData > getAllPrtGruposProtocolo()  | ||||||
|  | 	{ | ||||||
|  | 		List< PrtGruposProtocoloData > result = null; | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			result = ENTITY_PROVIDER.listLoad( PrtGruposProtocoloData.class, | ||||||
|  | 			new String[] { PrtGruposProtocoloData.DESCRICAO_PLAIN } ); | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	public void fecharProcesso( TrabalhadoresProcessoData currentProcesso ) | ||||||
|  | 	{ | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			currentProcesso.setEstado( ProcessoConstants.PROCESSO_FECHADO_CODE ); | ||||||
|  | 			currentProcesso.save(); | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	//FIXME : substituir por PrestadoresData.prestadorNulo -> fazer alteracoes aqui
 | ||||||
|  | 	public PrestadoresData getDefaultPrestador() | ||||||
|  | 	{ | ||||||
|  | 		PrestadoresData prestadorNulo = new PrestadoresData(); | ||||||
|  | 		prestadorNulo.setNome( "SIPRP" ); | ||||||
|  | 		return prestadorNulo; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public Collection< TrabalhadoresEcdData > getPendingExamesForAnalisador( Prestadores currentAnalisador ) | ||||||
|  | 	{ | ||||||
|  | 		Map< TrabalhadoresEcdData, TrabalhadoresEcdData > resultMap = new HashMap< TrabalhadoresEcdData, TrabalhadoresEcdData >(); | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			List< TrabalhadoresEcdData > all = ENTITY_PROVIDER.listLoad( TrabalhadoresEcdData.class,  | ||||||
|  | 				new Object[] { null }, new String[] { TrabalhadoresEcdData.DATA_RECEPCAO }, null ); | ||||||
|  | 			for ( TrabalhadoresEcdData ecd : all ) | ||||||
|  | 			{ | ||||||
|  | 				TrabalhadoresEcdsDatasData data = ecd.toTrabalhadores_ecds_datas_id(); | ||||||
|  | 				 | ||||||
|  | 				if ( new Integer( MedicinaConstants.ESTADO_REALIZADO ).equals( data.getEstado() ) ) | ||||||
|  | 				{ | ||||||
|  | 					if ( currentAnalisador.equals( ecd.toAnalisador_id() ) ) | ||||||
|  | 					{ | ||||||
|  | 						resultMap.put( ecd ,ecd ); | ||||||
|  | 					} | ||||||
|  | 					else if ( Prestadores.prestadorNulo.equals( currentAnalisador ) && ecd.toAnalisador_id() == null ) | ||||||
|  | 					{ | ||||||
|  | 						resultMap.put( ecd, ecd ); | ||||||
|  | 					} | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return resultMap.values(); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | } | ||||||
| @ -0,0 +1,351 @@ | |||||||
|  | package siprp.database.cayenne.providers; | ||||||
|  | 
 | ||||||
|  | import java.util.ArrayList; | ||||||
|  | import java.util.Date; | ||||||
|  | import java.util.LinkedList; | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | import siprp.data.outer.EmailPlanoDeActuacaoData; | ||||||
|  | import siprp.data.outer.EstabelecimentosData; | ||||||
|  | import siprp.data.outer.HsEmailEstabelecimentoData; | ||||||
|  | import siprp.data.outer.HsEquipamentoData; | ||||||
|  | import siprp.data.outer.HsLegislacaoCategoriaData; | ||||||
|  | import siprp.data.outer.HsLegislacaoData; | ||||||
|  | import siprp.data.outer.HsNormalizacaoData; | ||||||
|  | import siprp.data.outer.HsPostoData; | ||||||
|  | import siprp.data.outer.HsPostoRiscoData; | ||||||
|  | import siprp.data.outer.HsRelatorioData; | ||||||
|  | import siprp.data.outer.HsRelatorioRiscoData; | ||||||
|  | import siprp.data.outer.HsRelatorioRiscoValorQualitativoData; | ||||||
|  | import siprp.data.outer.HsRiscoData; | ||||||
|  | import siprp.data.outer.HsRiscoTemaData; | ||||||
|  | import siprp.data.outer.MarcacoesEstabelecimentoData; | ||||||
|  | 
 | ||||||
|  | import com.evolute.entity.ProviderInterface; | ||||||
|  | import com.evolute.utils.Singleton; | ||||||
|  | import com.evolute.utils.arrays.Virtual2DArray; | ||||||
|  | import com.evolute.utils.dataedition.persistence.Persistent; | ||||||
|  | import com.evolute.utils.db.DBManager; | ||||||
|  | import com.evolute.utils.db.Executer; | ||||||
|  | import com.evolute.utils.error.ErrorLogger; | ||||||
|  | import com.evolute.utils.sql.Expression; | ||||||
|  | import com.evolute.utils.sql.Field; | ||||||
|  | import com.evolute.utils.sql.Select2; | ||||||
|  | 
 | ||||||
|  | public class PlanoActuacaoDataProvider  | ||||||
|  | { | ||||||
|  | 	private static PlanoActuacaoDataProvider INSTANCE = null; | ||||||
|  | 
 | ||||||
|  | 	private ProviderInterface< Persistent< ? >, Exception > ENTITY_PROVIDER; | ||||||
|  | 	private Executer executer; | ||||||
|  | 
 | ||||||
|  | 	private static final Integer ID_COMPANHIA_HIPERMERCADOS = 32; | ||||||
|  | 	 | ||||||
|  | 	private PlanoActuacaoDataProvider() throws Exception | ||||||
|  | 	{ | ||||||
|  | 		DBManager manager = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); | ||||||
|  | 		executer = manager.getSharedExecuter( this ); | ||||||
|  | 		ENTITY_PROVIDER = ( ProviderInterface< Persistent< ? >, Exception > ) Singleton.getInstance( Singleton.DEFAULT_EVO_DATA_PROVIDER ); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	public static synchronized PlanoActuacaoDataProvider getInstance() throws Exception | ||||||
|  | 	{ | ||||||
|  | 		if ( INSTANCE == null ) | ||||||
|  | 		{ | ||||||
|  | 			INSTANCE = new PlanoActuacaoDataProvider(); | ||||||
|  | 		} | ||||||
|  | 		return INSTANCE; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	 | ||||||
|  | 	public EstabelecimentosData getEstabelecimentoByID( Integer id )  | ||||||
|  | 	{ | ||||||
|  | 		EstabelecimentosData result = null; | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			result = ENTITY_PROVIDER.load( EstabelecimentosData.class, id ); | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public void addEmailToEstabelecimento( String email, EstabelecimentosData estabelecimento ) | ||||||
|  | 	{ | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			EmailPlanoDeActuacaoData emailObject = new EmailPlanoDeActuacaoData(); | ||||||
|  | 			emailObject.setDescription( email ); | ||||||
|  | 			emailObject.setToEstabelecimento_id( estabelecimento ); | ||||||
|  | 			emailObject.save(); | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public List< HsRiscoTemaData > getAllRiscoTemas() | ||||||
|  | 	{ | ||||||
|  | 		List< HsRiscoTemaData > result = null; | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			result = ENTITY_PROVIDER.listLoad( HsRiscoTemaData.class,  | ||||||
|  | 			new Object[] { null }, new String[] { HsRiscoTemaData.DELETED_DATE },  | ||||||
|  | 			new String[] { HsRiscoTemaData.DESCRIPTION } ); | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public HsRelatorioData criarRelatorioForVisita( MarcacoesEstabelecimentoData visita ) | ||||||
|  | 	{ | ||||||
|  | 		HsRelatorioData result = null; | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			if( visita != null ) | ||||||
|  | 			{ | ||||||
|  | 				result = new HsRelatorioData(); | ||||||
|  | 				result.setToMarcacao_id( visita ); | ||||||
|  | 				result.setData( new Date() ); | ||||||
|  | 				result.save(); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public HsPostoRiscoData createValoresFor( HsRiscoData risco, HsPostoData posto ) | ||||||
|  | 	{ | ||||||
|  | 		HsPostoRiscoData result = null; | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			if( risco != null && posto != null ) | ||||||
|  | 			{ | ||||||
|  | 				result = new HsPostoRiscoData(); | ||||||
|  | 				result.setToPosto_id( posto ); | ||||||
|  | 				result.setToRisco_id( risco ); | ||||||
|  | 				result.setIs_plano_actuacao( "n" ); | ||||||
|  | 				result.save(); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public List< HsRelatorioRiscoValorQualitativoData > getAllValoresQualitativos() | ||||||
|  | 	{ | ||||||
|  | 		List< HsRelatorioRiscoValorQualitativoData > result = null; | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			result = ENTITY_PROVIDER.listLoad( HsRelatorioRiscoValorQualitativoData.class ); | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * Get  | ||||||
|  | 	 * @param dates | ||||||
|  | 	 * @param estabelecimentoID | ||||||
|  | 	 * @return | ||||||
|  | 	 */ | ||||||
|  | 	public List< HsRelatorioData > getRelatoriosNotIn( List< Date > dates, Integer estabelecimentoID ) | ||||||
|  | 	{ | ||||||
|  | 		List< HsRelatorioData > result = new LinkedList< HsRelatorioData >(); | ||||||
|  | 		dates = dates != null ? dates : new LinkedList< Date >(); | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			Expression where = new Field( HsRelatorioData.IS_SUBMETIDO ).isDifferent( null ).and( | ||||||
|  | 				new Field( HsRelatorioData.DELETED_DATE ).isEqual( null ) | ||||||
|  | 			);		 | ||||||
|  | 			List< HsRelatorioData > all = ENTITY_PROVIDER.listLoad( HsRelatorioData.class, where, null, null ); | ||||||
|  | 			 | ||||||
|  | 			for( HsRelatorioData relatorio : all ) | ||||||
|  | 			{ | ||||||
|  | 				MarcacoesEstabelecimentoData visita = relatorio.toMarcacao_id(); | ||||||
|  | 				if( visita != null ) | ||||||
|  | 				{ | ||||||
|  | 					if ( visita.toEstabelecimento_id() != null && visita.toEstabelecimento_id().toEmpresa_id().getId().equals( ID_COMPANHIA_HIPERMERCADOS ) ) | ||||||
|  | 					{ | ||||||
|  | 						if( estabelecimentoID == null || estabelecimentoID != null && estabelecimentoID.equals( visita.getEstabelecimento_id() ) ) | ||||||
|  | 						{ | ||||||
|  | 							Date dateVisita = visita.getData(); | ||||||
|  | 							if( dateVisita != null && !dates.contains( dateVisita ) ) | ||||||
|  | 							{ | ||||||
|  | 								result.add( relatorio ); | ||||||
|  | 							} | ||||||
|  | 						} | ||||||
|  | 					} | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  |     public List< HsRelatorioData > getRelatoriosNotIn( List< Integer > knownEstabelecimentosIDs ) | ||||||
|  | 	{ | ||||||
|  | 		List< HsRelatorioData > result = new LinkedList< HsRelatorioData >(); | ||||||
|  | 		knownEstabelecimentosIDs = knownEstabelecimentosIDs != null ? knownEstabelecimentosIDs : new LinkedList< Integer >(); | ||||||
|  | 		 | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			Expression where = new Field( HsRelatorioData.IS_SUBMETIDO ).isDifferent( null ).and( | ||||||
|  | 				new Field( HsRelatorioData.DELETED_DATE ).isEqual( null ) | ||||||
|  | 			);		 | ||||||
|  | 			List< HsRelatorioData > all = ENTITY_PROVIDER.listLoad( HsRelatorioData.class, where, null, null ); | ||||||
|  | 	 | ||||||
|  | 			for( HsRelatorioData relatorio : all ) | ||||||
|  | 			{ | ||||||
|  | 				MarcacoesEstabelecimentoData visita = relatorio.toMarcacao_id(); | ||||||
|  | 				if( visita != null ) | ||||||
|  | 				{ | ||||||
|  | 					if( visita.toEstabelecimento_id() != null && visita.toEstabelecimento_id().toEmpresa_id().getId().equals( ID_COMPANHIA_HIPERMERCADOS ) ) | ||||||
|  | 					{ | ||||||
|  | 	                    Integer estabelecimentoID = visita.toEstabelecimento_id().getId(); | ||||||
|  | 						if( ! knownEstabelecimentosIDs.contains( estabelecimentoID ) ) | ||||||
|  | 						{ | ||||||
|  | 	                        result.add( relatorio ); | ||||||
|  | 						} | ||||||
|  | 					} | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public List< HsLegislacaoData > getAllLegislacaoGeral() | ||||||
|  | 	{ | ||||||
|  | 		List< HsLegislacaoData > result = null; | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			result = ENTITY_PROVIDER.listLoad( HsLegislacaoData.class,  | ||||||
|  | 				new Object[] { null, null }, new String[] { HsLegislacaoData.DELETED_DATE, HsLegislacaoData.CATEGORIA_ID }, | ||||||
|  | 				new String[] { HsLegislacaoData.DESCRIPTION } ); | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	public List< HsLegislacaoCategoriaData > getAllLegislacaoCategorias() | ||||||
|  | 	{ | ||||||
|  | 		List< HsLegislacaoCategoriaData > result = null; | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			result = ENTITY_PROVIDER.listLoad( HsLegislacaoCategoriaData.class,  | ||||||
|  | 				new Object[] { null }, new String[] { HsLegislacaoCategoriaData.DELETED_DATE },  | ||||||
|  | 				new String[] { HsLegislacaoCategoriaData.DESCRIPTION } ); | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public List< HsNormalizacaoData > getNormalizacao( boolean portuguesa ) | ||||||
|  | 	{ | ||||||
|  | 		List< HsNormalizacaoData > result = null; | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			result = ENTITY_PROVIDER.listLoad( HsNormalizacaoData.class,  | ||||||
|  | 				new Object[] { null, portuguesa }, new String[] { HsNormalizacaoData.DELETED_DATE, HsNormalizacaoData.PORTUGUESA },  | ||||||
|  | 				new String[] {} ); | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public List< HsEquipamentoData > getAllEquipamentos() | ||||||
|  | 	{ | ||||||
|  | 		List< HsEquipamentoData > result = null; | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			result = ENTITY_PROVIDER.listLoad( HsEquipamentoData.class,  | ||||||
|  | 				new Object[] { null }, new String[] { HsEquipamentoData.DELETED_DATE }, | ||||||
|  | 				new String[] { HsEquipamentoData.TIPO } ); | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public List< HsEmailEstabelecimentoData > getEmailsForEstabelecimento( EstabelecimentosData estabelecimento ) | ||||||
|  | 	{ | ||||||
|  | 		List< HsEmailEstabelecimentoData > result = null; | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			result = ENTITY_PROVIDER.listLoad( HsEmailEstabelecimentoData.class, | ||||||
|  | 				new Object[] { estabelecimento.getId() }, new String[] { HsEmailEstabelecimentoData.ESTABELECIMENTO_ID }, | ||||||
|  | 				null ); | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public List< HsRiscoData > findHsRiscosFor( HsRelatorioRiscoData relatorioRisco ) | ||||||
|  | 	{ | ||||||
|  | 		List< HsRiscoData > result = null; | ||||||
|  | 		try | ||||||
|  | 		{ | ||||||
|  | 			Select2 query = new Select2( | ||||||
|  | 				new String[] { HsRiscoData.TABLENAME }, | ||||||
|  | 				new Integer[] { }, | ||||||
|  | 				new Expression[] { }, | ||||||
|  | 				new String[] { HsRiscoData.ID_FULL }, | ||||||
|  | 				new Field( HsRiscoData.DESCRIPTION_FULL ).isILike( relatorioRisco.getDescription() ), | ||||||
|  | 				null, null, null, null | ||||||
|  | 			); | ||||||
|  | 			Virtual2DArray array = executer.executeQuery( query ); | ||||||
|  | 			result = new ArrayList< HsRiscoData >(); | ||||||
|  | 			for ( int i = 0; i < array.columnLength(); i++ ) | ||||||
|  | 			{ | ||||||
|  | 				Integer id = array.get( i, 0 ); | ||||||
|  | 				result.add( loadHsRiscoDataByID( id ) ); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		catch ( Exception e ) | ||||||
|  | 		{ | ||||||
|  | 			ErrorLogger.logException( e ); | ||||||
|  | 		} | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	public HsRiscoData loadHsRiscoDataByID( Integer id ) throws Exception | ||||||
|  | 	{ | ||||||
|  | 		return ENTITY_PROVIDER.load( HsRiscoData.class, id ); | ||||||
|  | 	} | ||||||
|  | } | ||||||
					Loading…
					
					
				
		Reference in new issue