@ -486,6 +486,9 @@ public class ListaPlanos extends AbstractPageBean
// Perform application initialization that must complete
// *after* managed components are initialized
// TODO - add your own initialization code here
siprp = getSessionBean1 ( ) . isSiprp ( ) ;
}
/ * *
@ -500,6 +503,138 @@ public class ListaPlanos extends AbstractPageBean
{
}
private Boolean siprp = Boolean . FALSE ;
public Boolean getSiprp ( )
{
return siprp ;
}
public void setSiprp ( Boolean siprp )
{
this . siprp = siprp ;
}
private DropDown dropEmpresasActuais = new DropDown ( ) ;
public void setDropEmpresasActuais ( DropDown dropEmpresasActuais )
{
this . dropEmpresasActuais = dropEmpresasActuais ;
}
public void dropEmpresasActuais_valueChangeListener ( ValueChangeEvent event )
{
Integer _old ;
Integer _new ;
if ( event . getNewValue ( ) ! = null & & event . getNewValue ( ) instanceof Integer )
{
_new = ( Integer ) event . getNewValue ( ) ;
_old = event . getOldValue ( ) ! = null & &
event . getOldValue ( ) instanceof Integer ? ( Integer ) event . getOldValue ( ) : null ;
if ( _old = = null | | ! _new . equals ( _old ) )
{
Utils . fillEstabelecimentos ( _new , dropEstabelecimentosActuais ) ;
dropEstabelecimentosActuais . setSelected ( null ) ;
}
}
}
public DropDown getDropEmpresasActuais ( )
{
return dropEmpresasActuais ;
}
private DropDown dropEstabelecimentosActuais = new DropDown ( ) ;
public DropDown getDropEstabelecimentosActuais ( )
{
return dropEstabelecimentosActuais ;
}
public void setDropEstabelecimentosActuais ( DropDown dropEstabelecimentos )
{
this . dropEstabelecimentosActuais = dropEstabelecimentos ;
}
private DropDown dropEmpresasSeguimento = new DropDown ( ) ;
public void setDropEmpresasSeguimento ( DropDown dropEmpresasSeguimento )
{
this . dropEmpresasSeguimento = dropEmpresasSeguimento ;
}
public void dropEmpresasSeguimento_valueChangeListener ( ValueChangeEvent event )
{
Integer _old ;
Integer _new ;
if ( event . getNewValue ( ) ! = null & & event . getNewValue ( ) instanceof Integer )
{
_new = ( Integer ) event . getNewValue ( ) ;
_old = event . getOldValue ( ) ! = null & &
event . getOldValue ( ) instanceof Integer ? ( Integer ) event . getOldValue ( ) : null ;
if ( _old = = null | | ! _new . equals ( _old ) )
{
Utils . fillEstabelecimentos ( _new , dropEstabelecimentosSeguimento ) ;
dropEstabelecimentosSeguimento . setSelected ( null ) ;
}
}
}
public DropDown getDropEmpresasSeguimento ( )
{
return dropEmpresasSeguimento ;
}
private DropDown dropEstabelecimentosSeguimento = new DropDown ( ) ;
public DropDown getDropEstabelecimentosSeguimento ( )
{
return dropEstabelecimentosSeguimento ;
}
public void setDropEstabelecimentosSeguimento ( DropDown dropEstabelecimentos )
{
this . dropEstabelecimentosSeguimento = dropEstabelecimentos ;
}
private DropDown dropEmpresasConclusao = new DropDown ( ) ;
public void setDropEmpresasConclusao ( DropDown dropEmpresasConclusao )
{
this . dropEmpresasConclusao = dropEmpresasConclusao ;
}
public void dropEmpresasConclusao_valueChangeListener ( ValueChangeEvent event )
{
Integer _old ;
Integer _new ;
if ( event . getNewValue ( ) ! = null & & event . getNewValue ( ) instanceof Integer )
{
_new = ( Integer ) event . getNewValue ( ) ;
_old = event . getOldValue ( ) ! = null & &
event . getOldValue ( ) instanceof Integer ? ( Integer ) event . getOldValue ( ) : null ;
if ( _old = = null | | ! _new . equals ( _old ) )
{
Utils . fillEstabelecimentos ( _new , dropEstabelecimentosConclusao ) ;
dropEstabelecimentosConclusao . setSelected ( null ) ;
}
}
}
public DropDown getDropEmpresasConclusao ( )
{
return dropEmpresasConclusao ;
}
private DropDown dropEstabelecimentosConclusao = new DropDown ( ) ;
public DropDown getDropEstabelecimentosConclusao ( )
{
return dropEstabelecimentosConclusao ;
}
public void setDropEstabelecimentosConclusao ( DropDown dropEstabelecimentos )
{
this . dropEstabelecimentosConclusao = dropEstabelecimentos ;
}
/ * *
* < p > Callback method that is called just before rendering takes place .
* This method will < strong > only < / strong > be called for the page that
@ -515,10 +650,30 @@ public class ListaPlanos extends AbstractPageBean
HttpServletRequest request = ( HttpServletRequest ) getExternalContext ( ) . getRequest ( ) ;
String referer = request . getRequestURI ( ) ;
String pageFrom = Utils . getPageFrom ( referer ) ;
if ( ! pageFrom . matches ( "FormMedico.jsp" )
| | dropCurrentYear . getItems ( ) = = null )
if ( ! pageFrom . matches ( "ListaPlanos.jsp" ) | | dropCurrentYear . getItems ( ) = = null )
{
fillCurrentYearDrop ( ) ;
Utils . fillEmpresas ( dropEmpresasActuais , dropEmpresasSeguimento , dropEmpresasConclusao ) ;
if ( ! siprp )
{
dropEmpresasActuais . setSelected ( getSessionBean1 ( ) . getCurrentUser ( ) . getEmpresa_id ( ) ) ;
dropEmpresasSeguimento . setSelected ( getSessionBean1 ( ) . getCurrentUser ( ) . getEmpresa_id ( ) ) ;
dropEmpresasConclusao . setSelected ( getSessionBean1 ( ) . getCurrentUser ( ) . getEmpresa_id ( ) ) ;
Utils . fillEstabelecimentos ( getSessionBean1 ( ) . getCurrentUser ( ) . getEmpresa_id ( ) ,
dropEstabelecimentosActuais , dropEstabelecimentosSeguimento , dropEstabelecimentosConclusao ) ;
}
else
{
dropEmpresasActuais . setSelected ( Global . AUCHAN ) ;
dropEmpresasSeguimento . setSelected ( Global . AUCHAN ) ;
dropEmpresasConclusao . setSelected ( Global . AUCHAN ) ;
Utils . fillEstabelecimentos ( Global . AUCHAN ,
dropEstabelecimentosActuais , dropEstabelecimentosSeguimento , dropEstabelecimentosConclusao ) ;
}
fillInitialForm ( ) ;
}
}
@ -886,7 +1041,8 @@ public class ListaPlanos extends AbstractPageBean
}
private List < PlanoActuacao > searchPlanosActivos ( Utilizador u , String nome , String estabelecimento , String dataVisita , Integer ano )
private List < PlanoActuacao > searchPlanosActivos ( Utilizador u , String nome , Integer empresa , String
estabelecimento , String dataVisita , Integer ano )
{
List < PlanoActuacao > list = null ;
try
@ -894,7 +1050,7 @@ public class ListaPlanos extends AbstractPageBean
if ( u . getTipo ( ) . intValue ( ) ! = Global . DIRECTOR_SIPRP & & u . getTipo ( ) . intValue ( ) ! = Global . GESTOR & & u . getTipo ( ) . intValue ( ) ! = Global . DIRECTOR_GERAL_RH )
{
PlanosDataProvider pdp = PlanosDataProvider . getInstance ( ) ;
list = pdp . searchPlanosActivos ( u , nome , e stabelecimento, dataVisita , ano ) ;
list = pdp . searchPlanosActivos ( u , nome , e mpresa, e stabelecimento, dataVisita , ano ) ;
}
}
catch ( Exception e )
@ -906,16 +1062,17 @@ public class ListaPlanos extends AbstractPageBean
private List < PlanoActuacao > getPlanosActivos ( Utilizador u , Integer ano )
{
return searchPlanosActivos ( u , null , null , null , ano ) ;
return searchPlanosActivos ( u , null , u . getEmpresa_id ( ) , null , null , ano ) ;
}
private List < PlanoActuacao > searchPlanosSeguimento ( Utilizador u , String nome , String estabelecimento , String dataVisita , Integer ano )
private List < PlanoActuacao > searchPlanosSeguimento ( Utilizador u , String nome , Integer empresa ,
String estabelecimento , String dataVisita , Integer ano )
{
List < PlanoActuacao > list = null ;
try
{
PlanosDataProvider pdp = PlanosDataProvider . getInstance ( ) ;
list = pdp . searchPlanosSeguimento ( u , nome , e stabelecimento, dataVisita , ano ) ;
list = pdp . searchPlanosSeguimento ( u , nome , e mpresa, e stabelecimento, dataVisita , ano ) ;
}
catch ( Exception ex )
{
@ -926,16 +1083,17 @@ public class ListaPlanos extends AbstractPageBean
private List < PlanoActuacao > getPlanosSeguimento ( Utilizador u , Integer ano )
{
return searchPlanosSeguimento ( u , null , null , null , ano ) ;
return searchPlanosSeguimento ( u , null , u . getEmpresa_id ( ) , null , null , ano ) ;
}
private List < PlanoActuacao > searchPlanosConcluidos ( Utilizador u , String nome , String estabelecimento , String dataVisita , Integer ano )
private List < PlanoActuacao > searchPlanosConcluidos ( Utilizador u , String nome , Integer empresa ,
String estabelecimento , String dataVisita , Integer ano )
{
List < PlanoActuacao > list = null ;
try
{
PlanosDataProvider pdp = PlanosDataProvider . getInstance ( ) ;
list = pdp . searchPlanosConcluidos ( u , nome , e stabelecimento, dataVisita , ano ) ;
list = pdp . searchPlanosConcluidos ( u , nome , e mpresa, e stabelecimento, dataVisita , ano ) ;
}
catch ( Exception ex )
{
@ -946,7 +1104,7 @@ public class ListaPlanos extends AbstractPageBean
private List < PlanoActuacao > getPlanosConcluidos ( Utilizador u , Integer ano )
{
return searchPlanosConcluidos ( u , null , null , null , ano ) ;
return searchPlanosConcluidos ( u , null , u . getEmpresa_id ( ) , null , null , ano ) ;
}
public String buttonFilterActual_action ( )
@ -962,13 +1120,39 @@ public class ListaPlanos extends AbstractPageBean
}
String estabelecimento = null ;
if ( textFilterEstabelecimentoActual . getText ( ) ! = null )
Integer selectedEmpresa ;
if ( dropEmpresasActuais . getSelected ( ) instanceof Integer )
{
estabelecimento = ( ( String ) textFilterEstabelecimentoActual . getText ( ) ) . trim ( ) ;
if ( estabelecimento . length ( ) = = 0 )
{
estabelecimento = null ;
}
selectedEmpresa = ( Integer ) dropEmpresasActuais . getSelected ( ) ;
}
else
{
selectedEmpresa = Utils . getSelectedID ( dropEmpresasActuais ) ;
}
if ( selectedEmpresa = = null )
{
selectedEmpresa = getSessionBean1 ( ) . getCurrentUser ( ) . getEmpresa_id ( ) ;
}
Integer estabelecimentoID ;
if ( dropEstabelecimentosActuais . getSelected ( ) instanceof Integer )
{
estabelecimentoID = ( Integer ) dropEstabelecimentosActuais . getSelected ( ) ;
}
else
{
estabelecimentoID = Utils . getSelectedID ( dropEstabelecimentosActuais ) ;
}
try
{
estabelecimento = PlanosDataProvider . getInstance ( ) . getEstabelecimentoByID ( estabelecimentoID ) ;
}
catch ( Exception e )
{
ErrorLogger . logException ( e ) ;
}
String visitaDateStr = calFilterDate = = null ? null : D_F . format ( calFilterDate ) ;
@ -977,7 +1161,8 @@ public class ListaPlanos extends AbstractPageBean
getSessionBean1 ( ) . setIsSearchingPlanosActuacao ( Boolean . TRUE ) ;
getSessionBean1 ( ) . getPlanosActualDataProvider ( ) . setList (
searchPlanosActivos ( getSessionBean1 ( ) . getCurrentUser ( ) , nome , estabelecimento , visitaDateStr , ano ) ) ;
searchPlanosActivos ( getSessionBean1 ( ) . getCurrentUser ( ) , nome , selectedEmpresa , estabelecimento , visitaDateStr ,
ano ) ) ;
return null ;
}
@ -995,13 +1180,39 @@ public class ListaPlanos extends AbstractPageBean
}
String estabelecimento = null ;
if ( textFilterEstabelecimentoSeg . getText ( ) ! = null )
Integer selectedEmpresa ;
if ( dropEmpresasSeguimento . getSelected ( ) instanceof Integer )
{
estabelecimento = ( ( String ) textFilterEstabelecimentoSeg . getText ( ) ) . trim ( ) ;
if ( estabelecimento . length ( ) = = 0 )
{
estabelecimento = null ;
}
selectedEmpresa = ( Integer ) dropEmpresasSeguimento . getSelected ( ) ;
}
else
{
selectedEmpresa = Utils . getSelectedID ( dropEmpresasSeguimento ) ;
}
if ( selectedEmpresa = = null )
{
selectedEmpresa = getSessionBean1 ( ) . getCurrentUser ( ) . getEmpresa_id ( ) ;
}
Integer estabelecimentoID ;
if ( dropEstabelecimentosSeguimento . getSelected ( ) instanceof Integer )
{
estabelecimentoID = ( Integer ) dropEstabelecimentosSeguimento . getSelected ( ) ;
}
else
{
estabelecimentoID = Utils . getSelectedID ( dropEstabelecimentosSeguimento ) ;
}
try
{
estabelecimento = PlanosDataProvider . getInstance ( ) . getEstabelecimentoByID ( estabelecimentoID ) ;
}
catch ( Exception e )
{
ErrorLogger . logException ( e ) ;
}
String visitaDateStr = calFilterDateSeguimento = = null ? null : D_F . format ( calFilterDateSeguimento ) ;
@ -1010,7 +1221,8 @@ public class ListaPlanos extends AbstractPageBean
getSessionBean1 ( ) . setIsSearchingPlanosActuacao ( Boolean . TRUE ) ;
getSessionBean1 ( ) . getPlanosSeguimentoDataProvider ( ) . setList (
searchPlanosSeguimento ( getSessionBean1 ( ) . getCurrentUser ( ) , nome , estabelecimento , visitaDateStr , ano ) ) ;
searchPlanosSeguimento ( getSessionBean1 ( ) . getCurrentUser ( ) , nome , selectedEmpresa , estabelecimento ,
visitaDateStr , ano ) ) ;
return null ;
}
@ -1028,13 +1240,39 @@ public class ListaPlanos extends AbstractPageBean
}
String estabelecimento = null ;
if ( textFilterEstabelecimentoConc . getText ( ) ! = null )
Integer selectedEmpresa ;
if ( dropEmpresasConclusao . getSelected ( ) instanceof Integer )
{
estabelecimento = ( ( String ) textFilterEstabelecimentoConc . getText ( ) ) . trim ( ) ;
if ( estabelecimento . length ( ) = = 0 )
{
estabelecimento = null ;
}
selectedEmpresa = ( Integer ) dropEmpresasConclusao . getSelected ( ) ;
}
else
{
selectedEmpresa = Utils . getSelectedID ( dropEmpresasConclusao ) ;
}
if ( selectedEmpresa = = null )
{
selectedEmpresa = getSessionBean1 ( ) . getCurrentUser ( ) . getEmpresa_id ( ) ;
}
Integer estabelecimentoID ;
if ( dropEstabelecimentosConclusao . getSelected ( ) instanceof Integer )
{
estabelecimentoID = ( Integer ) dropEstabelecimentosConclusao . getSelected ( ) ;
}
else
{
estabelecimentoID = Utils . getSelectedID ( dropEstabelecimentosConclusao ) ;
}
try
{
estabelecimento = PlanosDataProvider . getInstance ( ) . getEstabelecimentoByID ( estabelecimentoID ) ;
}
catch ( Exception e )
{
ErrorLogger . logException ( e ) ;
}
String visitaDateStr = calFilterDateConcluidos = = null ? null : D_F . format ( calFilterDateConcluidos ) ;
@ -1043,7 +1281,8 @@ public class ListaPlanos extends AbstractPageBean
getSessionBean1 ( ) . setIsSearchingPlanosActuacao ( Boolean . TRUE ) ;
getSessionBean1 ( ) . getPlanosConcluidosDataProvider ( ) . setList (
searchPlanosConcluidos ( getSessionBean1 ( ) . getCurrentUser ( ) , nome , estabelecimento , visitaDateStr , ano ) ) ;
searchPlanosConcluidos ( getSessionBean1 ( ) . getCurrentUser ( ) , nome , selectedEmpresa , estabelecimento ,
visitaDateStr , ano ) ) ;
return null ;
}