- 'desactivar plano' revised. (should appear only to HS and Dir Siprp);

- EditarPlano: textareas estavam a por a pagina demasiado grande. 100 columns cabe em 800x600;
- passagens de fase verificadas: estao a funcionar - os emails sao enviados (desde que os emails sejam validos ...)


git-svn-id: https://svn.coded.pt/svn/SIPRP@1634 bb69d46d-e84e-40c8-a05a-06db0d633741
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Diogo Neves 15 years ago
parent 5a92e1c8b7
commit f4f9a5ef56

@ -136,24 +136,28 @@ public class UtilizadoresDataProvider extends GenericDataProvider
throws Exception
{
List< Utilizador > list = new LinkedList< Utilizador >();
int type = tipo.intValue();
Expression where = new Field( UtilizadoresData.ACTIVO_FULL ).isEqual( "y" ).and(
new Field( UtilizadoresData.APAGADO_FULL ).isEqual( "n" ) ).and(
new Field( UtilizadoresData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id )
);
Expression where = new Field( UtilizadoresData.ACTIVO_FULL ).isEqual( "y" );
where = where.and( new Field( UtilizadoresData.APAGADO_FULL ).isEqual( "n" ) );
where = where.and( new Field( UtilizadoresData.TIPO_FULL ).isEqual( type ) );
if ( type == Global.RESPONSAVEL_SEGURANCA || type == Global.DIRECTOR_LOJA )
{
where = where.and( new Field( UtilizadoresData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) );
}
if ( type == Global.RESPONSAVEL_SEGURANCA && "y".equals( responsavel_loja ) )
{
where = where.and( new Field( UtilizadoresData.RESPONSAVEL_LOJA_FULL ).isEqual( "y" ) );
}
if ( type == Global.DIRECTOR_LOJA || type == Global.RESPONSAVEL_SEGURANCA || type == Global.DIRECTOR_NACIONAL_SEGURANCA || type == Global.TECNICO_HS )
if ( type == Global.DIRECTOR_LOJA || type == Global.TECNICO_HS || type == Global.DIRECTOR_NACIONAL_SEGURANCA
|| ( type == Global.RESPONSAVEL_SEGURANCA && "y".equals( responsavel_loja ) ) )
{
System.out.println( "UtilizadoresDataProvider . getUtilizadoresListByTipo() : " + where.toString() );
System.out.println( "\nUtilizadoresDataProvider . getUtilizadoresListByTipo( " + tipo + ", " + responsavel_loja + ", " + estabelecimento_id + " ) : " );
System.out.println( "\tSQL : SELECT * FROM utilizadores WHERE " + where.toString() );
List< UtilizadoresData > listData = getProvider().listLoad( UtilizadoresData.class, where, new String[] { UtilizadoresData.NOME }, null );
List< UtilizadoresData > listData = getProvider().listLoad(
UtilizadoresData.class, where, new String[] { UtilizadoresData.NOME }, null );
for ( UtilizadoresData userData : listData )
{
list.add( copyFrom( userData ) );
@ -161,49 +165,49 @@ public class UtilizadoresDataProvider extends GenericDataProvider
}
// Statement st = createStatement();
// String sql = "";
// String estabelecimento_constraint = "";
// if(tipo.intValue() == Global.DIRECTOR_LOJA || tipo.intValue() == Global.RESPONSAVEL_SEGURANCA || tipo.intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA)
// if ( type == Global.DIRECTOR_LOJA || type == Global.RESPONSAVEL_SEGURANCA || type == Global.DIRECTOR_NACIONAL_SEGURANCA )
// {
// estabelecimento_constraint = " AND estabelecimento_id = " + estabelecimento_id;
// }
// if(tipo.intValue() == Global.RESPONSAVEL_SEGURANCA && responsavel_loja.matches("y"))
// if ( type == Global.RESPONSAVEL_SEGURANCA && responsavel_loja.matches( "y" ) )
// {
// sql = "SELECT * FROM utilizadores WHERE activo = 'y' AND apagado = 'n' AND responsavel_loja = 'y' AND tipo = " + tipo + estabelecimento_constraint;
// sql = "SELECT * FROM utilizadores WHERE activo = 'y' AND apagado = 'n' AND tipo = " + tipo + estabelecimento_constraint + " AND responsavel_loja = 'y'";
// }
// else if(tipo.intValue() == Global.DIRECTOR_LOJA || tipo.intValue() == Global.TECNICO_HS || tipo.intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA)
// else if ( type == Global.DIRECTOR_LOJA || type == Global.TECNICO_HS || type == Global.DIRECTOR_NACIONAL_SEGURANCA )
// {
// sql = "SELECT * FROM utilizadores WHERE activo = 'y' AND apagado = 'n' AND tipo = " + tipo + estabelecimento_constraint;
// }
//
// System.out.println("UTILIZADORES LIST BY TIPO SQL : " + sql);
// ResultSet rs = st.executeQuery(sql);
// if(rs.isBeforeFirst())
// System.out.println( "UTILIZADORES LIST BY TIPO SQL : " + sql );
// Statement st = createStatement();
// ResultSet rs = st.executeQuery( sql );
// if ( rs.isBeforeFirst() )
// {
// rs.first();
// do
// {
// Utilizador u = new Utilizador();
// u.setId(new Integer(rs.getInt("id")));
// u.setLogin(rs.getString("login"));
// u.setPassword(rs.getString("password"));
// u.setData_password(rs.getDate("data_password"));
// u.setEmail(rs.getString("email"));
// u.setEmpresa_id(new Integer(rs.getInt("empresa_id")));
// u.setEstabelecimento_id(new Integer(rs.getInt("estabelecimento_id")));
// u.setAdministrador(rs.getString("administrador"));
// u.setTipo(new Integer(rs.getInt("tipo")));
// u.setNumero_cedula(rs.getString("numero_cedula"));
// u.setCap(rs.getString("cap"));
// u.setNome(rs.getString("nome"));
// u.setMedico_id(new Integer(rs.getInt("medico_id")));
// u.setFuncionario_hst_id(new Integer(rs.getInt("funcionario_hst_id")));
// u.setActivo(rs.getString("activo"));
// u.setResponsavel_loja(rs.getString("responsavel_loja"));
// list.add(u);
// }while(rs.next());
// u.setId( new Integer( rs.getInt( "id" ) ) );
// u.setLogin( rs.getString( "login" ) );
// u.setPassword( rs.getString( "password" ) );
// u.setData_password( rs.getDate( "data_password" ) );
// u.setEmail( rs.getString( "email" ) );
// u.setEmpresa_id( new Integer( rs.getInt( "empresa_id" ) ) );
// u.setEstabelecimento_id( new Integer( rs.getInt( "estabelecimento_id" ) ) );
// u.setAdministrador( rs.getString( "administrador" ) );
// u.setTipo( new Integer( rs.getInt( "tipo" ) ) );
// u.setNumero_cedula( rs.getString( "numero_cedula" ) );
// u.setCap( rs.getString( "cap" ) );
// u.setNome( rs.getString( "nome" ) );
// u.setMedico_id( new Integer( rs.getInt( "medico_id" ) ) );
// u.setFuncionario_hst_id( new Integer( rs.getInt( "funcionario_hst_id" ) ) );
// u.setActivo( rs.getString( "activo" ) );
// u.setResponsavel_loja( rs.getString( "responsavel_loja" ) );
// list.add( u );
// }
// while ( rs.next() );
// }
return list;

@ -5,6 +5,8 @@
package global;
import com.sun.webui.jsf.component.TextArea;
/**
*
* @author lluis
@ -58,4 +60,7 @@ public class Global
public static final int ESTADO_MEDIDA_IMPLEMENTADA = 1;
public static final int ESTADO_MEDIDA_NAO_IMPLEMENTADA = 2;
public static final int ESTADO_MEDIDA_EM_IMPLEMENTACAO = 3;
public static final int MAX_TEXTAREA_CHARS = 100;
}

@ -3,7 +3,6 @@
*
* Created on Aug 29, 2008, 2:57:16 PM
*/
package planosactuacao;
import com.evolute.utils.date.DateUtils;
@ -53,56 +52,64 @@ public class ListaPlanos extends AbstractPageBean
* This method is automatically generated, so any user-specified code inserted
* here is subject to being replaced.</p>
*/
private void _init() throws Exception {
private void _init() throws Exception
{
}
private Table table1 = new Table();
public Table getTable1() {
public Table getTable1()
{
return table1;
}
public void setTable1(Table t) {
public void setTable1( Table t )
{
this.table1 = t;
}
private TableRowGroup tableRowGroup1 = new TableRowGroup();
public TableRowGroup getTableRowGroup1() {
public TableRowGroup getTableRowGroup1()
{
return tableRowGroup1;
}
public void setTableRowGroup1(TableRowGroup trg) {
public void setTableRowGroup1( TableRowGroup trg )
{
this.tableRowGroup1 = trg;
}
private TableRowGroup tableRowGroup2 = new TableRowGroup();
public TableRowGroup getTableRowGroup2() {
public TableRowGroup getTableRowGroup2()
{
return tableRowGroup2;
}
public void setTableRowGroup2(TableRowGroup trg) {
public void setTableRowGroup2( TableRowGroup trg )
{
this.tableRowGroup2 = trg;
}
private TableRowGroup tableRowGroup3 = new TableRowGroup();
public TableRowGroup getTableRowGroup3() {
public TableRowGroup getTableRowGroup3()
{
return tableRowGroup3;
}
public void setTableRowGroup3(TableRowGroup trg) {
public void setTableRowGroup3( TableRowGroup trg )
{
this.tableRowGroup3 = trg;
}
private HtmlPanelGrid gridActual = new HtmlPanelGrid();
public HtmlPanelGrid getGridActual() {
public HtmlPanelGrid getGridActual()
{
return gridActual;
}
public void setGridActual(HtmlPanelGrid hpg) {
public void setGridActual( HtmlPanelGrid hpg )
{
this.gridActual = hpg;
}
private TableColumn tableColumn55 = new TableColumn();
public TableColumn getTableColumn55()
@ -114,18 +121,17 @@ public class ListaPlanos extends AbstractPageBean
{
this.tableColumn55 = c;
}
private Button buttonDesactivar = new Button();
public Button getButtonDesactivar() {
public Button getButtonDesactivar()
{
return buttonDesactivar;
}
public void setButtonDesactivar( Button b ) {
public void setButtonDesactivar( Button b )
{
this.buttonDesactivar = b;
}
private TableColumn tableColumn56 = new TableColumn();
public TableColumn getTableColumn56()
@ -137,199 +143,223 @@ public class ListaPlanos extends AbstractPageBean
{
this.tableColumn56 = c;
}
private Button buttonDesactivarSeguimento = new Button();
public Button getButtonDesactivarSeguimento() {
public Button getButtonDesactivarSeguimento()
{
return buttonDesactivarSeguimento;
}
public void setButtonDesactivarSeguimento( Button b ) {
public void setButtonDesactivarSeguimento( Button b )
{
this.buttonDesactivarSeguimento = b;
}
private HtmlPanelGrid gridPanelFilterActual = new HtmlPanelGrid();
public HtmlPanelGrid getGridPanelFilterActual()
{
return this.gridPanelFilterActual;
}
public void setGridPanelFilterActual( HtmlPanelGrid pg )
{
this.gridPanelFilterActual = pg;
}
private PanelGroup groupPanelFilterActual = new PanelGroup();
public PanelGroup getGroupPanelFilterActual()
{
return this.groupPanelFilterActual;
}
public void setGroupPanelFilterActual( PanelGroup pg )
{
this.groupPanelFilterActual = pg;
}
private TextField textFilterNameActual = new TextField();
public TextField getTextFilterNameActual()
{
return this.textFilterNameActual;
}
public void setTextFilterNameActual( TextField tf )
{
this.textFilterNameActual = tf;
}
private TextField textFilterEstabelecimentoActual = new TextField();
public TextField getTextFilterEstabelecimentoActual() {
public TextField getTextFilterEstabelecimentoActual()
{
return textFilterEstabelecimentoActual;
}
public void setTextFilterEstabelecimentoActual(TextField textFilterEstabelecimentoActual) {
public void setTextFilterEstabelecimentoActual( TextField textFilterEstabelecimentoActual )
{
this.textFilterEstabelecimentoActual = textFilterEstabelecimentoActual;
}
private com.sun.webui.jsf.component.Calendar calFilterDateActual = new com.sun.webui.jsf.component.Calendar();
public com.sun.webui.jsf.component.Calendar getCalFilterDateActual() {
public com.sun.webui.jsf.component.Calendar getCalFilterDateActual()
{
return calFilterDateActual;
}
public void setCalFilterDateActual(com.sun.webui.jsf.component.Calendar calFilterDateActual) {
public void setCalFilterDateActual( com.sun.webui.jsf.component.Calendar calFilterDateActual )
{
this.calFilterDateActual = calFilterDateActual;
}
private Button buttonFilterActual = new Button();
public Button getButtonFilterActual()
{
return this.buttonFilterActual;
}
public void setButtonFilterActual( Button b )
{
this.buttonFilterActual = b;
}
private HtmlPanelGrid gridPanelFilterSeg = new HtmlPanelGrid();
public HtmlPanelGrid getGridPanelFilterSeg()
{
return this.gridPanelFilterSeg;
}
public void setGridPanelFilterSeg( HtmlPanelGrid pg )
{
this.gridPanelFilterSeg = pg;
}
private PanelGroup groupPanelFilterSeg = new PanelGroup();
public PanelGroup getGroupPanelFilterSeg()
{
return this.groupPanelFilterSeg;
}
public void setGroupPanelFilterSeg( PanelGroup pg )
{
this.groupPanelFilterSeg = pg;
}
private TextField textFilterNameSeg = new TextField();
public TextField getTextFilterNameSeg()
{
return this.textFilterNameSeg;
}
public void setTextFilterNameSeg( TextField tf )
{
this.textFilterNameSeg = tf;
}
private TextField textFilterEstabelecimentoSeg = new TextField();
public TextField getTextFilterEstabelecimentoSeg() {
public TextField getTextFilterEstabelecimentoSeg()
{
return textFilterEstabelecimentoSeg;
}
public void setTextFilterEstabelecimentoSeg(TextField textFilterEstabelecimentoSeg) {
public void setTextFilterEstabelecimentoSeg( TextField textFilterEstabelecimentoSeg )
{
this.textFilterEstabelecimentoSeg = textFilterEstabelecimentoSeg;
}
private com.sun.webui.jsf.component.Calendar calFilterDateSeg = new com.sun.webui.jsf.component.Calendar();
public com.sun.webui.jsf.component.Calendar getCalFilterDateSeg() {
public com.sun.webui.jsf.component.Calendar getCalFilterDateSeg()
{
return calFilterDateSeg;
}
public void setCalFilterDateSeg(com.sun.webui.jsf.component.Calendar calFilterDateSeg) {
public void setCalFilterDateSeg( com.sun.webui.jsf.component.Calendar calFilterDateSeg )
{
this.calFilterDateSeg = calFilterDateSeg;
}
private Button buttonFilterSeg = new Button();
public Button getButtonFilterSeg()
{
return this.buttonFilterSeg;
}
public void setButtonFilterSeg( Button b )
{
this.buttonFilterSeg = b;
}
private HtmlPanelGrid gridPanelFilterConc = new HtmlPanelGrid();
public HtmlPanelGrid getGridPanelFilterConc()
{
return this.gridPanelFilterConc;
}
public void setGridPanelFilterConc( HtmlPanelGrid pg )
{
this.gridPanelFilterConc = pg;
}
private PanelGroup groupPanelFilterConc = new PanelGroup();
public PanelGroup getGroupPanelFilterConc()
{
return this.groupPanelFilterConc;
}
public void setGroupPanelFilterConc( PanelGroup pg )
{
this.groupPanelFilterConc = pg;
}
private TextField textFilterNameConc = new TextField();
public TextField getTextFilterNameConc()
{
return this.textFilterNameConc;
}
public void setTextFilterNameConc( TextField tf )
{
this.textFilterNameConc = tf;
}
private TextField textFilterEstabelecimentoConc = new TextField();
public TextField getTextFilterEstabelecimentoConc() {
public TextField getTextFilterEstabelecimentoConc()
{
return textFilterEstabelecimentoConc;
}
public void setTextFilterEstabelecimentoConc(TextField textFilterEstabelecimentoConc) {
public void setTextFilterEstabelecimentoConc( TextField textFilterEstabelecimentoConc )
{
this.textFilterEstabelecimentoConc = textFilterEstabelecimentoConc;
}
private com.sun.webui.jsf.component.Calendar calFilterDateConc = new com.sun.webui.jsf.component.Calendar();
public com.sun.webui.jsf.component.Calendar getCalFilterDateConc() {
public com.sun.webui.jsf.component.Calendar getCalFilterDateConc()
{
return calFilterDateConc;
}
public void setCalFilterDateConc(com.sun.webui.jsf.component.Calendar calFilterDateConc) {
public void setCalFilterDateConc( com.sun.webui.jsf.component.Calendar calFilterDateConc )
{
this.calFilterDateConc = calFilterDateConc;
}
private Button buttonFilterConc = new Button();
public Button getButtonFilterConc()
{
return this.buttonFilterConc;
}
public void setButtonFilterConc( Button b )
{
this.buttonFilterConc = b;
}
private static final DateFormat D_F = new SimpleDateFormat( "yyyy-MM-dd" );
// </editor-fold>
/**
* <p>Construct a new Page bean instance.</p>
*/
public ListaPlanos() {
public ListaPlanos()
{
}
/**
@ -345,7 +375,8 @@ public class ListaPlanos extends AbstractPageBean
* property values that were saved for this view when it was rendered.</p>
*/
@Override
public void init() {
public void init()
{
// Perform initializations inherited from our superclass
super.init();
// Perform application initialization that must complete
@ -355,12 +386,15 @@ public class ListaPlanos extends AbstractPageBean
// <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
// Initialize automatically managed components
// *Note* - this logic should NOT be modified
try {
try
{
_init();
} catch (Exception e) {
}
catch ( Exception e )
{
ErrorLogger.logException( e );
log("ListaPlanos Initialization Failure", e);
throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
log( "ListaPlanos Initialization Failure", e );
throw e instanceof FacesException ? ( FacesException ) e : new FacesException( e );
}
// </editor-fold>
@ -377,7 +411,8 @@ public class ListaPlanos extends AbstractPageBean
* resources that will be required in your event handlers.</p>
*/
@Override
public void preprocess() {
public void preprocess()
{
}
/**
@ -391,7 +426,7 @@ public class ListaPlanos extends AbstractPageBean
@Override
public void prerender()
{
System.out.println("LISTA PLANOS - PRERENDER");
System.out.println( "LISTA PLANOS - PRERENDER" );
Utilizador u = getSessionBean1().getCurrentUser();
System.out.println( "\tUser Logged In : " + ( u == null ? "NONE !" : "[" + u.getId() + "] : " + u.getLogin() ) );
@ -399,29 +434,32 @@ public class ListaPlanos extends AbstractPageBean
FacesContext fc = getFacesContext();
String estab_gestor = JSFUtils.getRequestParameter( fc, "estab_gestor" );
boolean renderOrNot = false;
if ( u != null )
{
if ( u.getTipo() != null && u.getTipo().intValue() == Global.GESTOR )
{
try
{
Integer estabelecimento_gestor = new Integer(Integer.parseInt(estab_gestor));
System.out.println("ESTABELECIMENTO GESTOR : " + estabelecimento_gestor.intValue());
u.setEstabelecimento_gestor(estabelecimento_gestor);
} catch (Exception ex2)
Integer estabelecimento_gestor = new Integer( Integer.parseInt( estab_gestor ) );
System.out.println( "ESTABELECIMENTO GESTOR : " + estabelecimento_gestor.intValue() );
u.setEstabelecimento_gestor( estabelecimento_gestor );
}
catch ( Exception ex2 )
{
ErrorLogger.logException(ex2);
ErrorLogger.logException( ex2 );
}
}
if (u.getTipo().intValue() == Global.DIRECTOR_SIPRP || u.getTipo().intValue() == Global.RH || u.getTipo().intValue() == Global.DIRECTOR_GERAL_RH || u.getTipo().intValue() == Global.GESTOR)
if ( u.getTipo().intValue() == Global.DIRECTOR_SIPRP || u.getTipo().intValue() == Global.RH || u.getTipo().intValue() == Global.DIRECTOR_GERAL_RH || u.getTipo().intValue() == Global.GESTOR )
{
gridActual.setRendered( false );
tableRowGroup2.setEmptyDataMsg( "Sem registos" );
tableRowGroup3.setEmptyDataMsg( "Sem registos" );
}
if (u.getTipo().intValue() != Global.DIRECTOR_SIPRP && u.getTipo().intValue() != Global.RH && u.getTipo().intValue() != Global.DIRECTOR_GERAL_RH)
if ( u.getTipo().intValue() != Global.DIRECTOR_SIPRP && u.getTipo().intValue() != Global.RH && u.getTipo().intValue() != Global.DIRECTOR_GERAL_RH )
{
getSessionBean1().setDisableMenuUtilizadores( true );
tableRowGroup1.setEmptyDataMsg( "Sem registos" );
@ -430,21 +468,23 @@ public class ListaPlanos extends AbstractPageBean
}
//Column para desactivar plano - mostra se o utilizador for DIRECTOR SIPRP
int uType = u.getTipo().intValue();
boolean renderOrNot = uType == Global.DIRECTOR_SIPRP || uType == Global.TECNICO_HS;
tableColumn55.setRendered(renderOrNot);
buttonDesactivar.setRendered(renderOrNot);
tableColumn56.setRendered(renderOrNot);
buttonDesactivarSeguimento.setRendered(renderOrNot);
if ( u.getTipo() != null )
{
int uType = u.getTipo();
renderOrNot = uType == Global.DIRECTOR_SIPRP || uType == Global.TECNICO_HS;
}
initialize();
}
else
{
getSessionBean1().setMsg("Utilizador inv&aacute;lido.");
getSessionBean1().setMsg( "Utilizador inv&aacute;lido." );
}
tableColumn55.setRendered( renderOrNot );
buttonDesactivar.setRendered( renderOrNot );
tableColumn56.setRendered( renderOrNot );
buttonDesactivarSeguimento.setRendered( renderOrNot );
}
/**
@ -456,7 +496,8 @@ public class ListaPlanos extends AbstractPageBean
* acquired during execution of an event handler).</p>
*/
@Override
public void destroy() {
public void destroy()
{
}
/**
@ -464,8 +505,9 @@ public class ListaPlanos extends AbstractPageBean
*
* @return reference to the scoped data bean
*/
protected RequestBean1 getRequestBean1() {
return (RequestBean1) getBean("RequestBean1");
protected RequestBean1 getRequestBean1()
{
return ( RequestBean1 ) getBean( "RequestBean1" );
}
/**
@ -473,8 +515,9 @@ public class ListaPlanos extends AbstractPageBean
*
* @return reference to the scoped data bean
*/
protected ApplicationBean1 getApplicationBean1() {
return (ApplicationBean1) getBean("ApplicationBean1");
protected ApplicationBean1 getApplicationBean1()
{
return ( ApplicationBean1 ) getBean( "ApplicationBean1" );
}
/**
@ -482,11 +525,13 @@ public class ListaPlanos extends AbstractPageBean
*
* @return reference to the scoped data bean
*/
protected SessionBean1 getSessionBean1() {
return (SessionBean1) getBean("SessionBean1");
protected SessionBean1 getSessionBean1()
{
return ( SessionBean1 ) getBean( "SessionBean1" );
}
public String hyperlink1_action() {
public String hyperlink1_action()
{
// TODO: Process the action. Return value is a navigation
// case name where null will return to the same page.
return "editar_plano";
@ -530,12 +575,12 @@ public class ListaPlanos extends AbstractPageBean
}
}
public String goEditarPlano_action() {
public String goEditarPlano_action()
{
// TODO: Process the action. Return value is a navigation
// case name where null will return to the same page.
PlanoActuacao p = getTableActivosRowData();
getSessionBean1().setPlanoActuacao(p);
getSessionBean1().setPlanoActuacao( p );
//showPlano(p);
@ -544,15 +589,17 @@ public class ListaPlanos extends AbstractPageBean
return "editar_plano";
}
public String goVerPlanoFromSeguimento_action(){
public String goVerPlanoFromSeguimento_action()
{
PlanoActuacao p = getTableSeguimentoRowData();
getSessionBean1().setPlanoActuacao(p);
getSessionBean1().setPlanoActuacao( p );
return "ver_plano";
}
public String goVerPlanoFromConcluidos_action(){
public String goVerPlanoFromConcluidos_action()
{
PlanoActuacao p = getTableConcluidosRowData();
getSessionBean1().setPlanoActuacao(p);
getSessionBean1().setPlanoActuacao( p );
return "ver_plano";
}
@ -577,14 +624,13 @@ public class ListaPlanos extends AbstractPageBean
int userType = currentUser == null ? -1 : currentUser.getTipo();
PlanoActuacao p = getTableConcluidosRowData();
if ( ! p.getConcluidoPorDesactivacao() || ( userType == Global.DIRECTOR_SIPRP ) )
if ( !p.getConcluidoPorDesactivacao() || ( userType == Global.DIRECTOR_SIPRP ) )
{
createPdf( p.getId() );
}
return null;
}
//*** IMPRIMIR PLANO COM RISCOS PATRIMONIAIS ***//
public String goImprimirPlanoPatrimoniais_action()
{
@ -606,15 +652,13 @@ public class ListaPlanos extends AbstractPageBean
int userType = currentUser == null ? -1 : currentUser.getTipo();
PlanoActuacao p = getTableConcluidosRowData();
if ( ! p.getConcluidoPorDesactivacao() || ( userType == Global.DIRECTOR_SIPRP ) )
if ( !p.getConcluidoPorDesactivacao() || ( userType == Global.DIRECTOR_SIPRP ) )
{
createPdf( p.getId(), true );
}
return null;
}
private void createPdf( Integer pID )
{
createPdf( pID, false );
@ -662,32 +706,31 @@ public class ListaPlanos extends AbstractPageBean
System.out.println( "SHOW PDF done." );
}
private void initialize()
{
Utilizador u = getSessionBean1().getCurrentUser();
Integer estabelecimento_id = null;
if(u.getTipo().intValue() != Global.TECNICO_HS)
{
estabelecimento_id = u.getEstabelecimento_id();
}
// Integer estabelecimento_id = null;
// if ( u.getTipo().intValue() != Global.TECNICO_HS )
// {
// estabelecimento_id = u.getEstabelecimento_id();
// }
System.out.println( "INITIALIZE:" );
if ( ! getSessionBean1().getIsSearchingPlanosActuacao() )
if ( !getSessionBean1().getIsSearchingPlanosActuacao() )
{
System.out.println( "\tGETTING INITIAL VALUES FOR EACH TABLE." );
long startedTime = System.currentTimeMillis();
List listPlanosActivos = getPlanosActivos(u);
getSessionBean1().getPlanosActualDataProvider().setList(listPlanosActivos);
List listPlanosActivos = getPlanosActivos( u );
getSessionBean1().getPlanosActualDataProvider().setList( listPlanosActivos );
List listPlanosSeguimento = getPlanosSeguimento(u);
getSessionBean1().getPlanosSeguimentoDataProvider().setList(listPlanosSeguimento);
List listPlanosSeguimento = getPlanosSeguimento( u );
getSessionBean1().getPlanosSeguimentoDataProvider().setList( listPlanosSeguimento );
List listPlanosConcluidos = getPlanosConcluidos(u);
getSessionBean1().getPlanosConcluidosDataProvider().setList(listPlanosConcluidos);
List listPlanosConcluidos = getPlanosConcluidos( u );
getSessionBean1().getPlanosConcluidosDataProvider().setList( listPlanosConcluidos );
long endedTime = System.currentTimeMillis();
System.out.println( "\nGot Planos List in : " + getTime( startedTime, endedTime ) );
@ -701,24 +744,23 @@ public class ListaPlanos extends AbstractPageBean
return DateUtils.getTimePassed( start, end );
}
private PlanoActuacao getTableActivosRowData()
{
RowKey rk = tableRowGroup1.getRowKey();
int k = Integer.parseInt(rk.getRowId());
PlanosActualDataProvider provider = (PlanosActualDataProvider) tableRowGroup1.getSourceData();
ArrayList list = (ArrayList) provider.getList();
PlanoActuacao p = (PlanoActuacao)list.get(k);
int k = Integer.parseInt( rk.getRowId() );
PlanosActualDataProvider provider = ( PlanosActualDataProvider ) tableRowGroup1.getSourceData();
ArrayList list = ( ArrayList ) provider.getList();
PlanoActuacao p = ( PlanoActuacao ) list.get( k );
return p;
}
private PlanoActuacao getTableSeguimentoRowData()
{
RowKey rk = tableRowGroup2.getRowKey();
int k = Integer.parseInt(rk.getRowId());
PlanosSeguimentoDataProvider provider = (PlanosSeguimentoDataProvider) tableRowGroup2.getSourceData();
ArrayList list = (ArrayList) provider.getList();
PlanoActuacao p = (PlanoActuacao)list.get(k);
int k = Integer.parseInt( rk.getRowId() );
PlanosSeguimentoDataProvider provider = ( PlanosSeguimentoDataProvider ) tableRowGroup2.getSourceData();
ArrayList list = ( ArrayList ) provider.getList();
PlanoActuacao p = ( PlanoActuacao ) list.get( k );
return p;
}
@ -726,20 +768,17 @@ public class ListaPlanos extends AbstractPageBean
private PlanoActuacao getTableConcluidosRowData()
{
RowKey rk = tableRowGroup3.getRowKey();
int k = Integer.parseInt(rk.getRowId());
PlanosConcluidosDataProvider provider = (PlanosConcluidosDataProvider) tableRowGroup3.getSourceData();
ArrayList list = (ArrayList) provider.getList();
PlanoActuacao p = (PlanoActuacao)list.get(k);
int k = Integer.parseInt( rk.getRowId() );
PlanosConcluidosDataProvider provider = ( PlanosConcluidosDataProvider ) tableRowGroup3.getSourceData();
ArrayList list = ( ArrayList ) 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());
@ -791,15 +830,12 @@ public class ListaPlanos extends AbstractPageBean
// System.out.println(" " + p.getDescricao());
// }
// }
public List< PlanoActuacao > searchPlanosActivos( Utilizador u, String nome, String estabelecimento, String dataVisita )
public List<PlanoActuacao> searchPlanosActivos( Utilizador u, String nome, String estabelecimento, String dataVisita )
{
List< PlanoActuacao > list = new ArrayList< PlanoActuacao >();
List<PlanoActuacao> list = new ArrayList<PlanoActuacao>();
try
{
if ( u.getTipo().intValue() != Global.DIRECTOR_SIPRP
&& u.getTipo().intValue() != Global.GESTOR
&& u.getTipo().intValue() != Global.DIRECTOR_GERAL_RH )
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, estabelecimento, dataVisita );
@ -812,7 +848,7 @@ public class ListaPlanos extends AbstractPageBean
return list;
}
public List<PlanoActuacao> getPlanosActivos(Utilizador u)
public List<PlanoActuacao> getPlanosActivos( Utilizador u )
{
return searchPlanosActivos( u, null, null, null );
// List< PlanoActuacao > list = new ArrayList();
@ -833,22 +869,22 @@ public class ListaPlanos extends AbstractPageBean
// return list;
}
public List< PlanoActuacao > searchPlanosSeguimento( Utilizador u, String nome, String estabelecimento, String dataVisita )
public List<PlanoActuacao> searchPlanosSeguimento( Utilizador u, String nome, String estabelecimento, String dataVisita )
{
List< PlanoActuacao > list = new ArrayList();
List<PlanoActuacao> list = new ArrayList();
try
{
PlanosDataProvider pdp = PlanosDataProvider.getInstance();
list = pdp.searchPlanosSeguimento( u, nome, estabelecimento, dataVisita );
}
catch(Exception ex)
catch ( Exception ex )
{
ErrorLogger.logException( ex );
}
return list;
}
public List<PlanoActuacao> getPlanosSeguimento(Utilizador u)
public List<PlanoActuacao> getPlanosSeguimento( Utilizador u )
{
return searchPlanosSeguimento( u, null, null, null );
// List< PlanoActuacao > list = new ArrayList();
@ -864,22 +900,22 @@ public class ListaPlanos extends AbstractPageBean
// return list;
}
public List< PlanoActuacao > searchPlanosConcluidos( Utilizador u, String nome, String estabelecimento, String dataVisita )
public List<PlanoActuacao> searchPlanosConcluidos( Utilizador u, String nome, String estabelecimento, String dataVisita )
{
List< PlanoActuacao > list = new ArrayList();
List<PlanoActuacao> list = new ArrayList();
try
{
PlanosDataProvider pdp = PlanosDataProvider.getInstance();
list = pdp.searchPlanosConcluidos( u, nome, estabelecimento, dataVisita );
}
catch(Exception ex)
catch ( Exception ex )
{
ErrorLogger.logException( ex );
}
return list;
}
public List<PlanoActuacao> getPlanosConcluidos(Utilizador u)
public List<PlanoActuacao> getPlanosConcluidos( Utilizador u )
{
return searchPlanosConcluidos( u, null, null, null );
// List< PlanoActuacao > list = new ArrayList();
@ -895,15 +931,13 @@ public class ListaPlanos extends AbstractPageBean
// return list;
}
public String buttonFilterActual_action()
{
String nome = null;
if ( textFilterNameActual.getText() != null )
{
nome = (( String ) textFilterNameActual.getText()).trim();
if( nome.length() == 0 )
nome = ( ( String ) textFilterNameActual.getText() ).trim();
if ( nome.length() == 0 )
{
nome = null;
}
@ -912,8 +946,8 @@ public class ListaPlanos extends AbstractPageBean
String estabelecimento = null;
if ( textFilterEstabelecimentoActual.getText() != null )
{
estabelecimento = (( String ) textFilterEstabelecimentoActual.getText()).trim();
if( estabelecimento.length() == 0 )
estabelecimento = ( ( String ) textFilterEstabelecimentoActual.getText() ).trim();
if ( estabelecimento.length() == 0 )
{
estabelecimento = null;
}
@ -938,8 +972,8 @@ public class ListaPlanos extends AbstractPageBean
String nome = null;
if ( textFilterNameSeg.getText() != null )
{
nome = (( String ) textFilterNameSeg.getText()).trim();
if( nome.length() == 0 )
nome = ( ( String ) textFilterNameSeg.getText() ).trim();
if ( nome.length() == 0 )
{
nome = null;
}
@ -948,8 +982,8 @@ public class ListaPlanos extends AbstractPageBean
String estabelecimento = null;
if ( textFilterEstabelecimentoSeg.getText() != null )
{
estabelecimento = (( String ) textFilterEstabelecimentoSeg.getText()).trim();
if( estabelecimento.length() == 0 )
estabelecimento = ( ( String ) textFilterEstabelecimentoSeg.getText() ).trim();
if ( estabelecimento.length() == 0 )
{
estabelecimento = null;
}
@ -969,14 +1003,13 @@ public class ListaPlanos extends AbstractPageBean
return null;
}
public String buttonFilterConc_action()
{
String nome = null;
if ( textFilterNameConc.getText() != null )
{
nome = (( String ) textFilterNameConc.getText()).trim();
if( nome.length() == 0 )
nome = ( ( String ) textFilterNameConc.getText() ).trim();
if ( nome.length() == 0 )
{
nome = null;
}
@ -985,8 +1018,8 @@ public class ListaPlanos extends AbstractPageBean
String estabelecimento = null;
if ( textFilterEstabelecimentoConc.getText() != null )
{
estabelecimento = (( String ) textFilterEstabelecimentoConc.getText()).trim();
if( estabelecimento.length() == 0 )
estabelecimento = ( ( String ) textFilterEstabelecimentoConc.getText() ).trim();
if ( estabelecimento.length() == 0 )
{
estabelecimento = null;
}
@ -1005,6 +1038,5 @@ public class ListaPlanos extends AbstractPageBean
return null;
}
}

@ -103,7 +103,8 @@
<webuijsf:tableColumn headerText="" id="tableColumn55" binding="#{ListaPlanos.tableColumn55}">
<webuijsf:button id="btnDesactivar" text="Desactivar Plano" onClick="return alertOnDeactivate();"
actionExpression="#{ListaPlanos.goDesactivarPlano_action}" binding="#{ListaPlanos.buttonDesactivar}" />
actionExpression="#{ListaPlanos.goDesactivarPlano_action}" binding="#{ListaPlanos.buttonDesactivar}"
/>
</webuijsf:tableColumn>
</webuijsf:tableRowGroup>

Loading…
Cancel
Save