forked from Coded/SIPRP
				
			29/10/2008
	
		
	
				
					
				
			git-svn-id: https://svn.coded.pt/svn/SIPRP@795 bb69d46d-e84e-40c8-a05a-06db0d633741lxbfYeaa
							parent
							
								
									8222705b24
								
							
						
					
					
						commit
						6c74847437
					
				| @ -1,8 +1,8 @@ | |||||||
| build.xml.data.CRC32=a8b7045a | build.xml.data.CRC32=3084e562 | ||||||
| build.xml.script.CRC32=fa3993b7 | build.xml.script.CRC32=fa3993b7 | ||||||
| build.xml.stylesheet.CRC32=cfd7ba16 | build.xml.stylesheet.CRC32=cfd7ba16 | ||||||
| # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. | ||||||
| # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. | ||||||
| nbproject/build-impl.xml.data.CRC32=a8b7045a | nbproject/build-impl.xml.data.CRC32=3084e562 | ||||||
| nbproject/build-impl.xml.script.CRC32=64f15e59 | nbproject/build-impl.xml.script.CRC32=db27eab1 | ||||||
| nbproject/build-impl.xml.stylesheet.CRC32=8926891b | nbproject/build-impl.xml.stylesheet.CRC32=8926891b | ||||||
|  | |||||||
| @ -0,0 +1,122 @@ | |||||||
|  | /* | ||||||
|  |  * To change this template, choose Tools | Templates | ||||||
|  |  * and open the template in the editor. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | package planosactuacao; | ||||||
|  | 
 | ||||||
|  | import db.entidades.PlanoActuacao; | ||||||
|  | import db.entidades.Utilizador; | ||||||
|  | import db.providers.PlanosDataProvider; | ||||||
|  | import global.Global; | ||||||
|  | import java.util.ArrayList; | ||||||
|  | import java.util.Date; | ||||||
|  | import java.util.Iterator; | ||||||
|  | import java.util.List; | ||||||
|  | import siprp.database.cayenne.objects.HsRelatorio; | ||||||
|  | import siprp.database.cayenne.providers.PlanoActuacaoDAO; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * | ||||||
|  |  * @author lluis | ||||||
|  |  */ | ||||||
|  | public class PlanosActuacao { | ||||||
|  |     PlanosDataProvider pdp = new PlanosDataProvider(); | ||||||
|  |     List<PlanoActuacao> planosList; | ||||||
|  |     List<Date> planosOnlineList; | ||||||
|  |     PlanoActuacaoDAO pa = new PlanoActuacaoDAO();     | ||||||
|  |      | ||||||
|  |      | ||||||
|  |     public PlanosActuacao(){ | ||||||
|  |         List<Date> planosOnlineList = getPlanosOnline(); | ||||||
|  |         List<HsRelatorio> listRelatorios = getRelatorios(planosOnlineList); | ||||||
|  |         putPlanosOnline(listRelatorios); | ||||||
|  |          | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     private List<Date> getPlanosOnline() | ||||||
|  |     { | ||||||
|  |         List<Date> list = null; | ||||||
|  |         try | ||||||
|  |         { | ||||||
|  |             list = pdp.getPlanosOnline(); | ||||||
|  |         } | ||||||
|  |         catch(Exception ex) | ||||||
|  |         { | ||||||
|  |              | ||||||
|  |         } | ||||||
|  |         return list; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     private List<HsRelatorio> getRelatorios(List<Date> list) | ||||||
|  |     { | ||||||
|  |         List<HsRelatorio> listRelatorios = pa.getRelatoriosNotIn(list);   | ||||||
|  |         return listRelatorios; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     private void putPlanosOnline(List<HsRelatorio> listRelatorios) | ||||||
|  |     { | ||||||
|  | 
 | ||||||
|  |         Iterator<HsRelatorio> iter = listRelatorios.iterator(); | ||||||
|  |          | ||||||
|  |         while(iter.hasNext()) | ||||||
|  |         { | ||||||
|  |             HsRelatorio relatorio = iter.next(); | ||||||
|  |             PlanoActuacao p = new PlanoActuacao(); | ||||||
|  |             p.setData_visita(relatorio.getToHsMarcacoesEstabelecimento().getData()); | ||||||
|  |             p.setFase(new Integer(Global.FASE_SEGURANCA_PREENCHIMENTO)); | ||||||
|  |             p.setEstabelecimento_id(relatorio.getToHsMarcacoesEstabelecimento().getToEstabelecimentos().getId()); | ||||||
|  |             p.setNome_estabelecimento(relatorio.getToHsMarcacoesEstabelecimento().getToEstabelecimentos().getNome()); | ||||||
|  |             try | ||||||
|  |             { | ||||||
|  |                 pdp.createPlano(p); | ||||||
|  |             } | ||||||
|  |             catch(Exception ex) | ||||||
|  |             { | ||||||
|  |                 ex.printStackTrace(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     public List<PlanoActuacao> getPlanosActivos(Utilizador u) | ||||||
|  |     { | ||||||
|  |         ArrayList list = new ArrayList(); | ||||||
|  |         try | ||||||
|  |         { | ||||||
|  |             list = pdp.getPlanosActivos(u); | ||||||
|  |         } | ||||||
|  |         catch(Exception ex) | ||||||
|  |         { | ||||||
|  |              | ||||||
|  |         } | ||||||
|  |         return list; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     public List<PlanoActuacao> getPlanosSeguimento(Utilizador u) | ||||||
|  |     { | ||||||
|  |         ArrayList list = new ArrayList(); | ||||||
|  |         try | ||||||
|  |         { | ||||||
|  |             list = pdp.getPlanosSeguimento(u); | ||||||
|  |         } | ||||||
|  |         catch(Exception ex) | ||||||
|  |         { | ||||||
|  |              | ||||||
|  |         } | ||||||
|  |         return list; | ||||||
|  |     }  | ||||||
|  |      | ||||||
|  |     public List<PlanoActuacao> getPlanosConcluidos() | ||||||
|  |     { | ||||||
|  |         ArrayList list = new ArrayList(); | ||||||
|  |         try | ||||||
|  |         { | ||||||
|  |             list = pdp.getPlanosConcluidos(); | ||||||
|  |         } | ||||||
|  |         catch(Exception ex) | ||||||
|  |         { | ||||||
|  |              | ||||||
|  |         } | ||||||
|  |         return list;         | ||||||
|  |     }     | ||||||
|  | } | ||||||
| After Width: | Height: | Size: 3.1 KiB | 
					Loading…
					
					
				
		Reference in new issue