|
|
|
|
@ -21,13 +21,14 @@ import db.providers.PlanosDataProvider;
|
|
|
|
|
import global.Global;
|
|
|
|
|
import java.text.DateFormat;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.LinkedList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import javax.faces.FacesException;
|
|
|
|
|
import javax.faces.component.html.HtmlPanelGrid;
|
|
|
|
|
import javax.faces.context.FacesContext;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import org.richfaces.component.html.HtmlCalendar;
|
|
|
|
|
import shst.higiene.planoactuacao.print.PlanoActuacaoPDFCreator;
|
|
|
|
|
import tabledataproviders.PlanosActualDataProvider;
|
|
|
|
|
import tabledataproviders.PlanosConcluidosDataProvider;
|
|
|
|
|
@ -765,18 +766,17 @@ public class ListaPlanos extends AbstractPageBean
|
|
|
|
|
System.out.println( "\tGETTING INITIAL VALUES FOR EACH TABLE." );
|
|
|
|
|
long startedTime = System.currentTimeMillis();
|
|
|
|
|
|
|
|
|
|
List listPlanosActivos = getPlanosActivos( u );
|
|
|
|
|
List< PlanoActuacao > listPlanosActivos = getPlanosActivos( u );
|
|
|
|
|
getSessionBean1().getPlanosActualDataProvider().setList( listPlanosActivos );
|
|
|
|
|
|
|
|
|
|
List listPlanosSeguimento = getPlanosSeguimento( u );
|
|
|
|
|
List< PlanoActuacao > listPlanosSeguimento = getPlanosSeguimento( u );
|
|
|
|
|
getSessionBean1().getPlanosSeguimentoDataProvider().setList( listPlanosSeguimento );
|
|
|
|
|
|
|
|
|
|
List listPlanosConcluidos = getPlanosConcluidos( u );
|
|
|
|
|
List< PlanoActuacao > listPlanosConcluidos = getPlanosConcluidos( u );
|
|
|
|
|
getSessionBean1().getPlanosConcluidosDataProvider().setList( listPlanosConcluidos );
|
|
|
|
|
|
|
|
|
|
long endedTime = System.currentTimeMillis();
|
|
|
|
|
System.out.println( "\nGot Planos List in : " + getTime( startedTime, endedTime ) );
|
|
|
|
|
//2010-11-12 : user scampos : 1 min (debug mode)
|
|
|
|
|
}
|
|
|
|
|
//checkPlanosDelayed();
|
|
|
|
|
}
|
|
|
|
|
@ -791,7 +791,7 @@ public class ListaPlanos extends AbstractPageBean
|
|
|
|
|
RowKey rk = tableRowGroup1.getRowKey();
|
|
|
|
|
int k = Integer.parseInt( rk.getRowId() );
|
|
|
|
|
PlanosActualDataProvider provider = ( PlanosActualDataProvider ) tableRowGroup1.getSourceData();
|
|
|
|
|
ArrayList list = ( ArrayList ) provider.getList();
|
|
|
|
|
List< PlanoActuacao > list = ( LinkedList< PlanoActuacao > ) provider.getList();
|
|
|
|
|
PlanoActuacao p = ( PlanoActuacao ) list.get( k );
|
|
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
@ -801,7 +801,7 @@ public class ListaPlanos extends AbstractPageBean
|
|
|
|
|
RowKey rk = tableRowGroup2.getRowKey();
|
|
|
|
|
int k = Integer.parseInt( rk.getRowId() );
|
|
|
|
|
PlanosSeguimentoDataProvider provider = ( PlanosSeguimentoDataProvider ) tableRowGroup2.getSourceData();
|
|
|
|
|
ArrayList list = ( ArrayList ) provider.getList();
|
|
|
|
|
List< PlanoActuacao > list = ( LinkedList< PlanoActuacao > ) provider.getList();
|
|
|
|
|
PlanoActuacao p = ( PlanoActuacao ) list.get( k );
|
|
|
|
|
|
|
|
|
|
return p;
|
|
|
|
|
@ -812,69 +812,15 @@ public class ListaPlanos extends AbstractPageBean
|
|
|
|
|
RowKey rk = tableRowGroup3.getRowKey();
|
|
|
|
|
int k = Integer.parseInt( rk.getRowId() );
|
|
|
|
|
PlanosConcluidosDataProvider provider = ( PlanosConcluidosDataProvider ) tableRowGroup3.getSourceData();
|
|
|
|
|
ArrayList list = ( ArrayList ) provider.getList();
|
|
|
|
|
List< PlanoActuacao > list = ( LinkedList< PlanoActuacao > ) provider.getList();
|
|
|
|
|
PlanoActuacao p = ( PlanoActuacao ) list.get( k );
|
|
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void checkPlanosDelayed()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// private void showPlano(PlanoActuacao p)
|
|
|
|
|
// {
|
|
|
|
|
// System.out.println("PLANO : " + p.getData_visita_str() + " | " + p.getFase_nome() + " | " + p.getNome_estabelecimento());
|
|
|
|
|
// System.out.println("=================================================================");
|
|
|
|
|
// showAreas(p.getAreas());
|
|
|
|
|
// System.out.println("=================================================================");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// private void showAreas(List<Area> areas)
|
|
|
|
|
// {
|
|
|
|
|
// for(Area a : areas)
|
|
|
|
|
// {
|
|
|
|
|
// System.out.println(" " + a.getDescricao());
|
|
|
|
|
// showRiscos(a.getRiscos());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// private void showRiscos(List<Risco> riscos)
|
|
|
|
|
// {
|
|
|
|
|
// for(Risco r : riscos)
|
|
|
|
|
// {
|
|
|
|
|
// System.out.println(" " + r.getDescricao());
|
|
|
|
|
// showValores(r.getValores());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// private void showValores(List<Valor> valores)
|
|
|
|
|
// {
|
|
|
|
|
// for(Valor v : valores)
|
|
|
|
|
// {
|
|
|
|
|
// System.out.println(" " + v.getValor());
|
|
|
|
|
// showMedidas(v.getMedidas());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// private void showMedidas(List<Medida> medidas)
|
|
|
|
|
// {
|
|
|
|
|
// for(Medida m : medidas)
|
|
|
|
|
// {
|
|
|
|
|
// System.out.println(" " + m.getDescricao());
|
|
|
|
|
// showPostos(m.getPostos());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// private void showPostos(List<PostoTrabalho> postos)
|
|
|
|
|
// {
|
|
|
|
|
// for(PostoTrabalho p : postos)
|
|
|
|
|
// {
|
|
|
|
|
// System.out.println(" " + p.getDescricao());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
public List<PlanoActuacao> searchPlanosActivos( Utilizador u, String nome, String estabelecimento, String dataVisita )
|
|
|
|
|
private List< PlanoActuacao > searchPlanosActivos( Utilizador u, String nome, String estabelecimento, String dataVisita )
|
|
|
|
|
{
|
|
|
|
|
List<PlanoActuacao> list = new ArrayList<PlanoActuacao>();
|
|
|
|
|
List< PlanoActuacao > list = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if ( u.getTipo().intValue() != Global.DIRECTOR_SIPRP && u.getTipo().intValue() != Global.GESTOR && u.getTipo().intValue() != Global.DIRECTOR_GERAL_RH )
|
|
|
|
|
@ -887,33 +833,17 @@ public class ListaPlanos extends AbstractPageBean
|
|
|
|
|
{
|
|
|
|
|
ErrorLogger.logException( e );
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
return list == null ? new LinkedList< PlanoActuacao >() : list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<PlanoActuacao> getPlanosActivos( Utilizador u )
|
|
|
|
|
private List<PlanoActuacao> getPlanosActivos( Utilizador u )
|
|
|
|
|
{
|
|
|
|
|
return searchPlanosActivos( u, null, null, null );
|
|
|
|
|
// List< PlanoActuacao > list = new ArrayList();
|
|
|
|
|
// try
|
|
|
|
|
// {
|
|
|
|
|
// if ( u.getTipo().intValue() != Global.DIRECTOR_SIPRP
|
|
|
|
|
// && u.getTipo().intValue() != Global.GESTOR
|
|
|
|
|
// && u.getTipo().intValue() != Global.DIRECTOR_GERAL_RH )
|
|
|
|
|
// {
|
|
|
|
|
//// list = pdp.getPlanosActivos(u);
|
|
|
|
|
// list = pdp.searchPlanosActivos( u, null, null );
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// catch(Exception ex)
|
|
|
|
|
// {
|
|
|
|
|
// ErrorLogger.logException( ex );
|
|
|
|
|
// }
|
|
|
|
|
// return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<PlanoActuacao> searchPlanosSeguimento( Utilizador u, String nome, String estabelecimento, String dataVisita )
|
|
|
|
|
private List< PlanoActuacao > searchPlanosSeguimento( Utilizador u, String nome, String estabelecimento, String dataVisita )
|
|
|
|
|
{
|
|
|
|
|
List<PlanoActuacao> list = new ArrayList();
|
|
|
|
|
List< PlanoActuacao > list = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
PlanosDataProvider pdp = PlanosDataProvider.getInstance();
|
|
|
|
|
@ -923,28 +853,17 @@ public class ListaPlanos extends AbstractPageBean
|
|
|
|
|
{
|
|
|
|
|
ErrorLogger.logException( ex );
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
return list == null ? new LinkedList< PlanoActuacao >() : list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<PlanoActuacao> getPlanosSeguimento( Utilizador u )
|
|
|
|
|
private List< PlanoActuacao > getPlanosSeguimento( Utilizador u )
|
|
|
|
|
{
|
|
|
|
|
return searchPlanosSeguimento( u, null, null, null );
|
|
|
|
|
// List< PlanoActuacao > list = new ArrayList();
|
|
|
|
|
// try
|
|
|
|
|
// {
|
|
|
|
|
//// list = pdp.getPlanosSeguimento(u);
|
|
|
|
|
// list = pdp.searchPlanosSeguimento( u, null, null );
|
|
|
|
|
// }
|
|
|
|
|
// catch(Exception ex)
|
|
|
|
|
// {
|
|
|
|
|
// ErrorLogger.logException( ex );
|
|
|
|
|
// }
|
|
|
|
|
// return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<PlanoActuacao> searchPlanosConcluidos( Utilizador u, String nome, String estabelecimento, String dataVisita )
|
|
|
|
|
private List< PlanoActuacao > searchPlanosConcluidos( Utilizador u, String nome, String estabelecimento, String dataVisita )
|
|
|
|
|
{
|
|
|
|
|
List<PlanoActuacao> list = new ArrayList();
|
|
|
|
|
List< PlanoActuacao > list = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
PlanosDataProvider pdp = PlanosDataProvider.getInstance();
|
|
|
|
|
@ -954,23 +873,12 @@ public class ListaPlanos extends AbstractPageBean
|
|
|
|
|
{
|
|
|
|
|
ErrorLogger.logException( ex );
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
return list == null ? new LinkedList< PlanoActuacao >() : list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<PlanoActuacao> getPlanosConcluidos( Utilizador u )
|
|
|
|
|
private List< PlanoActuacao > getPlanosConcluidos( Utilizador u )
|
|
|
|
|
{
|
|
|
|
|
return searchPlanosConcluidos( u, null, null, null );
|
|
|
|
|
// List< PlanoActuacao > list = new ArrayList();
|
|
|
|
|
// try
|
|
|
|
|
// {
|
|
|
|
|
//// list = pdp.getPlanosConcluidos(u);
|
|
|
|
|
// list = pdp.searchPlanosConcluidos( u, null, null );
|
|
|
|
|
// }
|
|
|
|
|
// catch(Exception ex)
|
|
|
|
|
// {
|
|
|
|
|
// ErrorLogger.logException( ex );
|
|
|
|
|
// }
|
|
|
|
|
// return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String buttonFilterActual_action()
|
|
|
|
|
@ -995,16 +903,7 @@ public class ListaPlanos extends AbstractPageBean
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Date visitaDate = ( Date ) calFilterDateActual.getValue();
|
|
|
|
|
String visitaDateStr = null;
|
|
|
|
|
if ( calFilterDate != null )
|
|
|
|
|
{
|
|
|
|
|
visitaDateStr = D_F.format( calFilterDate );
|
|
|
|
|
}
|
|
|
|
|
// if ( visitaDate != null )
|
|
|
|
|
// {
|
|
|
|
|
// visitaDateStr = D_F.format( visitaDate );
|
|
|
|
|
// }
|
|
|
|
|
String visitaDateStr = calFilterDate == null ? null : D_F.format( calFilterDate );
|
|
|
|
|
|
|
|
|
|
getSessionBean1().setIsSearchingPlanosActuacao( Boolean.TRUE );
|
|
|
|
|
getSessionBean1().getPlanosActualDataProvider().setList(
|
|
|
|
|
@ -1035,16 +934,7 @@ public class ListaPlanos extends AbstractPageBean
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Date visitaDate = ( Date ) calFilterDateSeg.getValue();
|
|
|
|
|
String visitaDateStr = null;
|
|
|
|
|
if ( calFilterDateSeguimento != null )
|
|
|
|
|
{
|
|
|
|
|
visitaDateStr = D_F.format( calFilterDateSeguimento );
|
|
|
|
|
}
|
|
|
|
|
// if ( visitaDate != null )
|
|
|
|
|
// {
|
|
|
|
|
// visitaDateStr = D_F.format( visitaDate );
|
|
|
|
|
// }
|
|
|
|
|
String visitaDateStr = calFilterDateSeguimento == null ? null : D_F.format( calFilterDateSeguimento );
|
|
|
|
|
|
|
|
|
|
getSessionBean1().setIsSearchingPlanosActuacao( Boolean.TRUE );
|
|
|
|
|
getSessionBean1().getPlanosSeguimentoDataProvider().setList(
|
|
|
|
|
@ -1075,16 +965,7 @@ public class ListaPlanos extends AbstractPageBean
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Date visitaDate = ( Date ) calFilterDateConc.getValue();
|
|
|
|
|
String visitaDateStr = null;
|
|
|
|
|
if ( calFilterDateConcluidos != null )
|
|
|
|
|
{
|
|
|
|
|
visitaDateStr = D_F.format( calFilterDateConcluidos );
|
|
|
|
|
}
|
|
|
|
|
// if ( visitaDate != null )
|
|
|
|
|
// {
|
|
|
|
|
// visitaDateStr = D_F.format( visitaDate );
|
|
|
|
|
// }
|
|
|
|
|
String visitaDateStr = calFilterDateConcluidos == null ? null : D_F.format( calFilterDateConcluidos );
|
|
|
|
|
|
|
|
|
|
getSessionBean1().setIsSearchingPlanosActuacao( Boolean.TRUE );
|
|
|
|
|
getSessionBean1().getPlanosConcluidosDataProvider().setList(
|
|
|
|
|
|