From fee9d0d7d3dba0f4fcf52d5a4afbb2a744dec4de Mon Sep 17 00:00:00 2001 From: Diogo Neves Date: Fri, 14 Jan 2011 16:03:19 +0000 Subject: [PATCH] DIR LOJA so veem analises concluidas do mesmo estabelecimento git-svn-id: https://svn.coded.pt/svn/SIPRP@1604 bb69d46d-e84e-40c8-a05a-06db0d633741 --- .../java/analiseacidentestrabalho/Acesso.java | 19 ++- .../AnaliseAcidenteTrabalho.java | 13 +- .../analiseacidentestrabalho/FormGestor.java | 123 +++++++++--------- .../java/analiseacidentestrabalho/Login.java | 22 ++-- 4 files changed, 101 insertions(+), 76 deletions(-) diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Acesso.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Acesso.java index b9757e6f..bd241ce0 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Acesso.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Acesso.java @@ -87,7 +87,9 @@ public class Acesso extends AbstractPageBean { * values submitted with this request. Instead, they represent the * property values that were saved for this view when it was rendered.

*/ - public void init() { + @Override + public void init() + { // Perform initializations inherited from our superclass super.init(); // Perform application initialization that must complete @@ -117,7 +119,10 @@ public class Acesso extends AbstractPageBean { * is processing a form submit. Customize this method to allocate * resources that will be required in your event handlers.

*/ - public void preprocess() { + @Override + public void preprocess() + { + } /** @@ -128,7 +133,9 @@ public class Acesso extends AbstractPageBean { * this method to allocate resources that will be required for rendering * this page.

*/ - public void prerender() { + @Override + public void prerender() + { Utilizador u = getSessionBean1().getCurrentUser(); //String nomeUnicode = Utils.textToUnicode(u.getNome()); //System.out.println("NOME UNICODE : " + nomeUnicode); @@ -155,8 +162,10 @@ public class Acesso extends AbstractPageBean { * acquired during execution of an event handler).

* */ - - public void destroy() { + @Override + public void destroy() + { + } /** diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidenteTrabalho.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidenteTrabalho.java index 37cd04c5..9c929897 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidenteTrabalho.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidenteTrabalho.java @@ -75,7 +75,6 @@ import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import org.apache.commons.validator.EmailValidator; import pagestate.AnaliseAcidenteTrabalhoState; -import pdf.Pdf; import pdf.PdfGenerator; import utils.Utils; @@ -6784,7 +6783,9 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { * values submitted with this request. Instead, they represent the * property values that were saved for this view when it was rendered.

*/ - public void init() { + @Override + public void init() + { // Perform initializations inherited from our superclass super.init(); // Perform application initialization that must complete @@ -6879,6 +6880,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { * is processing a form submit. Customize this method to allocate * resources that will be required in your event handlers.

*/ + @Override public void preprocess() { } @@ -6890,6 +6892,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { * this method to allocate resources that will be required for rendering * this page.

*/ + @Override public void prerender() { txtMsg.setText(getSessionBean1().getMsg()); getSessionBean1().setMsg(""); @@ -6904,6 +6907,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { * preprocess(), or prerender() methods (or * acquired during execution of an event handler).

*/ + @Override public void destroy() { } @@ -7588,7 +7592,10 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { java.util.Date ddate = new java.util.Date(a.getData_nascimento().getTime()); txtDataNascimento.setText(utils.Utils.dateToYYYYMMDD(ddate)); } - catch(Exception ex){}; + catch(Exception ex) + { + + } txtBI.setText(a.getBilhete_identidade()); txtMorada.setText(a.getMorada()); String cod_postal1 = ""; diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormGestor.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormGestor.java index 3f4e628c..0754cc52 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormGestor.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormGestor.java @@ -945,7 +945,9 @@ public class FormGestor extends AbstractPageBean { * values submitted with this request. Instead, they represent the * property values that were saved for this view when it was rendered.

*/ - public void init() { + @Override + public void init() + { // Perform initializations inherited from our superclass super.init(); // Perform application initialization that must complete @@ -984,7 +986,10 @@ public class FormGestor extends AbstractPageBean { * is processing a form submit. Customize this method to allocate * resources that will be required in your event handlers.

*/ - public void preprocess() { + @Override + public void preprocess() + { + } /** @@ -995,7 +1000,9 @@ public class FormGestor extends AbstractPageBean { * this method to allocate resources that will be required for rendering * this page.

*/ - public void prerender() { + @Override + public void prerender() + { System.out.println("=== FORM_GESTOR ==="); Utilizador curUser = getSessionBean1().getCurrentUser(); lblUser.setText( curUser.getLogin() ); @@ -1014,78 +1021,73 @@ public class FormGestor extends AbstractPageBean { } } - HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); String referer = request.getRequestURI(); String pageFrom = Utils.getPageFrom(referer); - if(!pageFrom.matches("FormGestor.jsp")) + if ( ! pageFrom.matches( "FormGestor.jsp" ) ) { try { - AnalisesDataProvider adp = AnalisesDataProvider.getInstance(); - - Integer estabelecimento_id = null; - //lblActivos.setRendered(true); - table1.setRendered(true); + AnalisesDataProvider adp = AnalisesDataProvider.getInstance(); + Integer estabelecimento_id = null; + table1.setRendered( true ); ArrayList seguimentoList = null; + //if(curUser.getGestor_geral().matches("y") || curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_NACIONAL_SEGURANCA || curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_LOJA) - if(curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR) - { - estabelecimento_id = curUser.getEstabelecimento_gestor(); - if(estabelecimento_id.intValue() == 0) - { - seguimentoList = adp.getAnalisesSeguimentoGestorList(null); - } - else - { - seguimentoList = adp.getAnalisesSeguimentoGestorList(curUser.getEstabelecimento_id()); - } - } - - else if(curUser.getGestor_geral().matches("y") || curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_NACIONAL_SEGURANCA) + if ( curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR ) { - seguimentoList = adp.getAnalisesSeguimentoGestorList(null); + estabelecimento_id = curUser.getEstabelecimento_gestor(); + if ( estabelecimento_id.intValue() == 0 ) + { + seguimentoList = adp.getAnalisesSeguimentoGestorList( null ); + } + else + { + seguimentoList = adp.getAnalisesSeguimentoGestorList( curUser.getEstabelecimento_id() ); + } } - else if(curUser.getGestor_geral().matches("n") || curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_LOJA) + else if ( curUser.getGestor_geral().matches("y") || curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_NACIONAL_SEGURANCA ) { - seguimentoList = adp.getAnalisesSeguimentoGestorList(curUser.getEstabelecimento_id()); + seguimentoList = adp.getAnalisesSeguimentoGestorList( null ); } - - getSessionBean1().getAnalisesSeguimentoDataProvider().setList(seguimentoList); + else if ( curUser.getGestor_geral().matches("n") || curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_LOJA ) + { + seguimentoList = adp.getAnalisesSeguimentoGestorList( curUser.getEstabelecimento_id() ); + } + getSessionBean1().getAnalisesSeguimentoDataProvider().setList( seguimentoList ); } - catch(Exception ex) + catch ( Exception ex ) { - //lblActivos.setRendered(false); - table1.setRendered(false); + table1.setRendered( false ); ErrorLogger.logException( ex ); } - try - { - AnalisesDataProvider adp = AnalisesDataProvider.getInstance(); - - //lblActivos.setRendered(true); - table2.setRendered(true); - ArrayList concluidasList = null; - if(getSessionBean1().getCurrentUser().getGestor_geral().matches("y") || curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_NACIONAL_SEGURANCA || curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_LOJA) - { - concluidasList = adp.getAnalisesConcluidasList(null); - } - else - { - concluidasList = adp.getAnalisesConcluidasList(getSessionBean1().getCurrentUser().getEstabelecimento_id()); - } - - getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); - } - catch(Exception ex) - { - //lblActivos.setRendered(false); - table2.setRendered(false); - ErrorLogger.logException( ex ); - } - fillAnoDropDown(); - } + try + { + AnalisesDataProvider adp = AnalisesDataProvider.getInstance(); + + table2.setRendered( true ); + ArrayList concluidasList = null; + + if ( getSessionBean1().getCurrentUser().getGestor_geral().matches("y") + || curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_NACIONAL_SEGURANCA + /*|| curUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_LOJA*/ ) + { + concluidasList = adp.getAnalisesConcluidasList( null ); + } + else + { + concluidasList = adp.getAnalisesConcluidasList( getSessionBean1().getCurrentUser().getEstabelecimento_id() ); + } + getSessionBean1().getAnalisesConcluidasDataProvider().setList( concluidasList ); + } + catch ( Exception ex ) + { + table2.setRendered( false ); + ErrorLogger.logException( ex ); + } + fillAnoDropDown(); + } } /** @@ -1096,7 +1098,10 @@ public class FormGestor extends AbstractPageBean { * preprocess(), or prerender() methods (or * acquired during execution of an event handler).

*/ - public void destroy() { + @Override + public void destroy() + { + } /** diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Login.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Login.java index 1f2b7986..9318e035 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Login.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Login.java @@ -23,15 +23,11 @@ import com.sun.rave.web.ui.component.TextField; import com.sun.rave.web.ui.model.Option; import db.providers.AnalisesDataProvider; import db.providers.UtilizadoresDataProvider; -import java.sql.Connection; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; import javax.faces.FacesException; import javax.faces.component.html.HtmlPanelGrid; -import javax.faces.context.ExternalContext; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpSession; import utils.Utils; /** @@ -265,7 +261,9 @@ public class Login extends AbstractPageBean * values submitted with this request. Instead, they represent the * property values that were saved for this view when it was rendered.

*/ - public void init() { + @Override + public void init() + { // Perform initializations inherited from our superclass super.init(); // Perform application initialization that must complete @@ -296,7 +294,9 @@ public class Login extends AbstractPageBean * is processing a form submit. Customize this method to allocate * resources that will be required in your event handlers.

*/ - public void preprocess() { + @Override + public void preprocess() + { } /** @@ -307,8 +307,9 @@ public class Login extends AbstractPageBean * this method to allocate resources that will be required for rendering * this page.

*/ - public void prerender() { - + @Override + public void prerender() + { txtMsg.setText(getSessionBean1().getMsg()); getSessionBean1().setMsg(""); } @@ -321,7 +322,10 @@ public class Login extends AbstractPageBean * preprocess(), or prerender() methods (or * acquired during execution of an event handler).

*/ - public void destroy() { + @Override + public void destroy() + { + } /**