diff --git a/trunk/PlanosActuacao/src/planosactuacao/ApplicationBean1.java b/trunk/PlanosActuacao/src/planosactuacao/ApplicationBean1.java new file mode 100644 index 00000000..c1b27cb7 --- /dev/null +++ b/trunk/PlanosActuacao/src/planosactuacao/ApplicationBean1.java @@ -0,0 +1,151 @@ +/* + * ApplicationBean1.java + * + * Created on Aug 25, 2008, 11:20:16 AM + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import com.sun.rave.web.ui.appbase.AbstractApplicationBean; +import java.sql.Connection; +import javax.faces.FacesException; + +/** + *
Application scope data bean for your application. Create properties + * here to represent cached data that should be made available to all users + * and pages in the application.
+ * + *An instance of this class will be created for you automatically, + * the first time your application evaluates a value binding expression + * or method binding expression that references a managed bean using + * this class.
+ * + * @author lluis + */ +public class ApplicationBean1 extends AbstractApplicationBean { + //Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.
+ */ + private void _init() throws Exception { + } + //Construct a new application data bean instance.
+ */ + public ApplicationBean1() { + } + + /** + *This method is called when this bean is initially added to + * application scope. Typically, this occurs as a result of evaluating + * a value binding or method binding expression, which utilizes the + * managed bean facility to instantiate this bean and store it into + * application scope.
+ * + *You may customize this method to initialize and cache application wide + * data values (such as the lists of valid options for dropdown list + * components), or to allocate resources that are required for the + * lifetime of the application.
+ */ + @Override + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + //This method is called when this bean is removed from + * application scope. Typically, this occurs as a result of + * the application being shut down by its owning container.
+ * + *You may customize this method to clean up resources allocated
+ * during the execution of the init() method, or
+ * at any later time during the lifetime of the application.
Return an appropriate character encoding based on the
+ * Locale defined for the current JavaServer Faces
+ * view. If no more suitable encoding can be found, return
+ * "UTF-8" as a general purpose default.
The default implementation uses the implementation from
+ * our superclass, AbstractApplicationBean.
Page bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.
+ * + * @author lluis + */ +public class Dummy extends AbstractPageBean +{ + //Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.
+ */ + private void _init() throws Exception { + } + private Hyperlink hyperlink1 = new Hyperlink(); + + public Hyperlink getHyperlink1() { + return hyperlink1; + } + + public void setHyperlink1(Hyperlink h) { + this.hyperlink1 = h; + } + private Hyperlink link = new Hyperlink(); + + public Hyperlink getLink() { + return link; + } + + public void setLink(Hyperlink h) { + this.link = h; + } + + //Construct a new Page bean instance.
+ */ + public Dummy() + { +// connect(); + } + + /** + *Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.
+ * + *Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.
+ */ + @Override + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + //Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.
+ */ + @Override + public void preprocess() { + } + + /** + *Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.
+ */ + @Override + public void prerender() { + + //Verbatim verbatim = new Verbatim(); + //printUsers(); + + } + + /** + *Callback method that is called after rendering is completed for
+ * this request, if init() was called (regardless of whether
+ * or not this was the page that was actually rendered). Customize this
+ * method to release resources acquired in the init(),
+ * preprocess(), or prerender() methods (or
+ * acquired during execution of an event handler).
Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1) getBean("RequestBean1"); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1) getBean("SessionBean1"); + } + + public String lnkAnaliseAcidentes_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + return null; + } + + public void lnk_actionListener(ActionEvent e) { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + System.out.print("DUMMY LINK"); + } + + + private void printUsers() + { +// UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + + try + { + UtilizadoresDataProvider udp = UtilizadoresDataProvider.getInstance(); + + List< Utilizador > list = udp.getUtilizadoresList(); + ListIterator iter = list.listIterator(); + System.out.println("=================================================================================="); + System.out.println("LOGIN\tEMAIL\tTIPO\tESTABELECIMENTO\tRESP. LOJA\tACTIVO\tAPAGADO"); + while(iter.hasNext()) + { + Utilizador u = (Utilizador) iter.next(); + System.out.print(u.getLogin() + "\t"); + System.out.print(u.getEmail() + "\t"); + System.out.print(u.getTipo() + "\t"); + System.out.print(u.getEstabelecimento_id() + "\t"); + System.out.print(u.getResponsavel_loja() + "\t"); + System.out.print(u.getActivo() + "\t"); + System.out.print(u.getApagado() + "\t\n"); + } + System.out.println(""); + System.out.println("=================================================================================="); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + } + +// private void connect() +// { +// db.Db db = new db.Db(); +// try +// { +// Connection connection = db.connect(); +// } +// catch(Exception ex) +// { +// getSessionBean1().setMsg("Erro na ligação à Base de Dados"); +// //***** terminate session +// try { +// getExternalContext().redirect("faces/Erro.jsp"); +// } catch(Exception e) { +// // . . . handle exception . . . +// ErrorLogger.logException( e ); +// } +// ErrorLogger.logException( ex ); +// } +// } + + public String butImage_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + +// FacesContext fc = getFacesContext(); +// Logos logos = new Logos(); +// String logourl = logos.getLogo(fc); +// if(logourl != null) +// { +// image1.setUrl(logourl); +// } + + return null; + } + +} + diff --git a/trunk/PlanosActuacao/src/planosactuacao/EditarPlano.java b/trunk/PlanosActuacao/src/planosactuacao/EditarPlano.java new file mode 100644 index 00000000..888a3d9a --- /dev/null +++ b/trunk/PlanosActuacao/src/planosactuacao/EditarPlano.java @@ -0,0 +1,2400 @@ +/* + * PlanoActuacao.java + * + * Created on Aug 26, 2008, 3:10:59 PM + */ +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import com.evolute.utils.strings.StringPlainer; +import com.sun.rave.web.ui.appbase.AbstractPageBean; + +import com.sun.webui.jsf.component.Button; + +import com.sun.webui.jsf.component.Checkbox; +import com.sun.webui.jsf.component.DropDown; +import com.sun.webui.jsf.component.PanelGroup; +import com.sun.webui.jsf.component.StaticText; +import com.sun.webui.jsf.component.TextArea; +import com.sun.webui.jsf.component.TextField; + +import com.sun.webui.jsf.model.Option; +import db.entidades.Area; +import db.entidades.EstadoMedida; +import db.entidades.Medida; +import db.entidades.PlanoActuacao; +import db.entidades.PostoTrabalho; +import db.entidades.Risco; +import db.entidades.Utilizador; +import db.entidades.Valor; +import db.providers.PlanosDataProvider; +import db.providers.RiscoLogic; +import db.providers.UtilizadoresDataProvider; +import db.providers.UtilizadoresLogic; +import utils.Global; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import javax.el.MethodExpression; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlInputHidden; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.context.FacesContext; +import javax.faces.event.ActionEvent; +import javax.faces.event.MethodExpressionActionListener; +import javax.faces.event.ValueChangeEvent; +import mail.Mail; +import mail.MailNextPhase; +import mail.MailNextPhase.RESPONSAVEL_SEGURANCA_TO_DIRECTOR_LOJA; +import org.richfaces.component.html.HtmlCalendar; +import pagination.Pagina; +import pagination.Pagination; +import pagination.PaginationNormais; +import pagination.PaginationPatrimoniais; +import planosactuacao.SessionBean1.PAGINATION_ENUM; +import utils.JSFUtils; +import utils.Utils; + +/** + *Page bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.
+ * + * @author lluis + */ +public class EditarPlano extends AbstractPageBean +{ + //Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.
+ */ + private void _init() throws Exception + { + } + //Construct a new Page bean instance.
+ */ + public EditarPlano() + { + } + + /** + *Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.
+ * + *Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.
+ */ + @Override + public void init() + { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + //Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.
+ */ + @Override + public void preprocess() + { + } + + /** + *Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.
+ */ + @Override + public void prerender() + { + FacesContext fc = getFacesContext(); + //boolean isPostback = JSFUtils.isPostBack12(fc); + //boolean isPostback = JSFUtils.isPostBack(fc); + boolean isPostback = JSFUtils.isPostback(); + System.out.println( "POSTBACK : " + isPostback ); + PlanoActuacao p = getSessionBean1().getPlanoActuacao(); + + System.out.println( "\nEditarPlano . prerender() : " + p.getId() + "\n" ); + + getRiscosByPlano( p ); + if ( !isPostback ) + { + //initializePlano(); + fillValoresHash( p ); + initialize( p ); + showPlano( p ); + //fillPlano(); + } + else + { + Boolean validacao = ( Boolean ) chkValidacao.getSelected(); + if ( validacao != null ) + { + if ( validacao.booleanValue() == true ) + { + butEnviarCorrecao.setDisabled( true ); + butEnviar.setDisabled( false ); + } + else + { + butEnviarCorrecao.setDisabled( false ); + butEnviar.setDisabled( true ); + } + } + } + + if ( gridPagination.getChildCount() > 0 ) + { + gridPagination.getChildren().clear(); + } + setPagination( PAGINATION_ENUM.NORMAL ); + setPagination( PAGINATION_ENUM.PATRIMONIAIS ); + + if ( p.getCorrecao().matches( "y" ) ) + { + lblObs.setText( p.getObs_correcao() ); + } + + String errorMessage = getSessionBean1().getMsg(); + lblMsg.setText( ( errorMessage != null && ! "".equals( errorMessage.trim() ) ? "Callback method that is called after rendering is completed for
+ * this request, if init() was called (regardless of whether
+ * or not this was the page that was actually rendered). Customize this
+ * method to release resources acquired in the init(),
+ * preprocess(), or prerender() methods (or
+ * acquired during execution of an event handler).
Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected RequestBean1 getRequestBean1() + { + return ( RequestBean1 ) getBean( "RequestBean1" ); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() + { + return ( SessionBean1 ) getBean( "SessionBean1" ); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() + { + return ( ApplicationBean1 ) getBean( "ApplicationBean1" ); + } + + public String hyperlink1_action() + { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + return "lista_planos"; + } + + private void initialize( PlanoActuacao p ) + { + Utilizador u = getSessionBean1().getCurrentUser(); + + Pagination paginationNormal = new PaginationNormais( p, u ); + Pagination paginationPatrimoniais = new PaginationPatrimoniais( p, u ); + getSessionBean1().addPagination( PAGINATION_ENUM.NORMAL, paginationNormal ); + getSessionBean1().addPagination( PAGINATION_ENUM.PATRIMONIAIS, paginationPatrimoniais ); + + if ( u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA ) + { + hidValidacao.setValue( "dns" ); + } + else if ( u.getTipo().intValue() == Global.DIRECTOR_LOJA ) + { + hidValidacao.setValue( "dir_loja" ); + } + if ( u.getTipo().intValue() == Global.TECNICO_HS ) + { + hidValidacao.setValue( "hs" ); + } + if ( u.getTipo().intValue() != Global.DIRECTOR_LOJA && u.getTipo().intValue() != Global.DIRECTOR_NACIONAL_SEGURANCA + && u.getTipo().intValue() != Global.TECNICO_HS ) + { + gridValidar.setRendered( false ); + } + +// int fase = p.getFase().intValue(); + switch ( /*fase*/ getFasePlano() ) + { + case Global.FASE_SEGURANCA_PREENCHIMENTO: + if ( p.getObservacoes_dl() != null ) + { + if ( p.getObservacoes_dl().trim().length() > 0 ) + { + pg = new PanelGroup(); + gridObservacoes.getChildren().add( pg ); + st = new StaticText(); + st.setEscape( false ); + st.setStyleClass( "label" ); + st.setText( "Observações gerais DL: " ); + pg.getChildren().add( st ); + st = new StaticText(); + st.setEscape( false ); + st.setText( p.getObservacoes_dl() ); + pg.getChildren().add( st ); + } + } + + if ( p.getObservacoes_dns() != null ) + { + if ( p.getObservacoes_dns().trim().length() > 0 ) + { + pg = new PanelGroup(); + gridObservacoes.getChildren().add( pg ); + st = new StaticText(); + st.setEscape( false ); + st.setStyleClass( "label" ); + st.setText( "Observações gerais DNS: " ); + pg.getChildren().add( st ); + st = new StaticText(); + st.setEscape( false ); + st.setText( p.getObservacoes_dns() ); + pg.getChildren().add( st ); + } + } + + if ( p.getCorrecao().matches( "n" ) ) + { + butEnviar.setText( "Enviar a Director de Loja>>" ); + } + else + { + if ( p.getFase_antes_correcao().intValue() == Global.FASE_DIR_LOJA_VALIDACAO ) + { + butEnviar.setText( "Enviar a Director de Loja>>" ); + } + else if ( p.getFase_antes_correcao().intValue() == Global.FASE_DNS_PARECER ) + { + butEnviar.setText( "Enviar a Director Nacional Segurança>>" ); + } + } + + break; + + case Global.FASE_DIR_LOJA_VALIDACAO: + //butEnviar.setText("Enviar a Director de Loja"); + pg = new PanelGroup(); + pg.setId( "pgObsDl" ); + gridObservacoes.getChildren().add( pg ); + st = new StaticText(); + st.setEscape( false ); + st.setStyleClass( "label" ); + st.setText( "Observações gerais DL: " ); + pg.getChildren().add( st ); + TextArea txtObservacoesDl = new TextArea(); + txtObservacoesDl.setId( "txtObservacoesDl" ); + txtObservacoesDl.setColumns( Global.MAX_TEXTAREA_CHARS ); + txtObservacoesDl.setText( p.getObservacoes_dl() ); + pg.getChildren().add( txtObservacoesDl ); + + if ( p.getObservacoes_dns() != null ) + { + if ( p.getObservacoes_dns().trim().length() > 0 ) + { + pg = new PanelGroup(); + gridObservacoes.getChildren().add( pg ); + st = new StaticText(); + st.setEscape( false ); + st.setStyleClass( "label" ); + st.setText( "Observações gerais DNS: " ); + pg.getChildren().add( st ); + st = new StaticText(); + st.setEscape( false ); + st.setText( p.getObservacoes_dns() ); + pg.getChildren().add( st ); + } + } + + if ( p.getValidacao_director_loja().booleanValue() == true ) + { + chkValidacao.setSelected( new Boolean( true ) ); + butEnviarCorrecao.setDisabled( true ); + butEnviar.setDisabled( false ); + } + else + { + butEnviarCorrecao.setDisabled( false ); + butEnviar.setDisabled( true ); + } + butEnviar.setText( "Enviar a Director Nacional Segurança>>" ); + + if ( p.getCorrecao().matches( "y" ) ) + { + butEnviar.setText( "Enviar a Director Nacional Segurança>>" ); + } + + break; + + case Global.FASE_DNS_PARECER: + if ( p.getObservacoes_dl() != null ) + { + if ( p.getObservacoes_dl().trim().length() > 0 ) + { + pg = new PanelGroup(); + pg.setId( "pgObsDl" ); + gridObservacoes.getChildren().add( pg ); + st = new StaticText(); + st.setEscape( false ); + st.setStyleClass( "label" ); + st.setText( "Observações gerais DL: " ); + pg.getChildren().add( st ); + st = new StaticText(); + st.setEscape( false ); + st.setText( p.getObservacoes_dl() ); + pg.getChildren().add( st ); + } + } + + pg = new PanelGroup(); + pg.setId( "pgObsDns" ); + gridObservacoes.getChildren().add( pg ); + st = new StaticText(); + st.setEscape( false ); + st.setStyleClass( "label" ); + st.setText( "Observações gerais DNS: " ); + pg.getChildren().add( st ); + TextArea txtObservacoesDns = new TextArea(); + txtObservacoesDns.setId( "txtObservacoesDns" ); + txtObservacoesDns.setColumns( Global.MAX_TEXTAREA_CHARS ); + txtObservacoesDns.setText( p.getObservacoes_dns() ); + pg.getChildren().add( txtObservacoesDns ); + if ( p.getValidacao_dns().booleanValue() == true ) + { + chkValidacao.setSelected( new Boolean( true ) ); + butEnviarCorrecao.setDisabled( true ); + butEnviar.setDisabled( false ); + } + else + { + butEnviarCorrecao.setDisabled( false ); + butEnviar.setDisabled( true ); + } + + butEnviar.setText( "Enviar para Técnico de HS>>" ); + break; + + case Global.FASE_SIPRP_CONCLUSAO: + if ( p.getObservacoes_dl() != null ) + { + if ( p.getObservacoes_dl().trim().length() > 0 ) + { + pg = new PanelGroup(); + gridObservacoes.getChildren().add( pg ); + st = new StaticText(); + st.setEscape( false ); + st.setStyleClass( "label" ); + st.setText( "Observações gerais DL: " ); + pg.getChildren().add( st ); + st = new StaticText(); + st.setEscape( false ); + st.setText( p.getObservacoes_dl() ); + pg.getChildren().add( st ); + } + } + + + if ( p.getObservacoes_dns() != null ) + { + if ( p.getObservacoes_dns().trim().length() > 0 ) + { + pg = new PanelGroup(); + gridObservacoes.getChildren().add( pg ); + st = new StaticText(); + st.setEscape( false ); + st.setStyleClass( "label" ); + st.setText( "Observações gerais DNS: " ); + pg.getChildren().add( st ); + st = new StaticText(); + st.setEscape( false ); + st.setText( p.getObservacoes_dns() ); + pg.getChildren().add( st ); + } + } + + if ( p.getValidacao_hs().booleanValue() == true ) + { + chkValidacao.setSelected( new Boolean( true ) ); + butEnviar.setDisabled( false ); + } + else + { + butEnviar.setDisabled( true ); + } + butEnviar.setText( "Concluir" ); + break; + } + + chkDesactivar.setSelected( Boolean.FALSE ); + gridLayout.getChildren().add( gridPlano ); + } + + private void showPlano( PlanoActuacao p ) + { + gridArea = new HtmlPanelGrid(); + gridArea.setId( "gridArea" ); + gridArea.setColumns( 1 ); + gridArea.setColumnClasses( "gridColCenter" ); + gridArea.setWidth( "100%" ); + gridArea.setStyle( "background-color: #f6f4e8; border: solid 1px #766c6c" ); + + gridPlano.getChildren().add( gridArea ); + + if ( p.getAreas().size() > 0 ) + { + Area a = p.getAreas().get( 0 ); + showArea( a ); + if ( a.getRiscos().size() > 0 ) + { + Risco r = a.getRiscos().get( 0 ); + showRisco( r ); + showValor( r ); + showResponsavel( r ); + } + } + showPreviousValidacoes( p ); + + Utilizador currentUser = getSessionBean1().getCurrentUser(); + if ( currentUser.getTipo().intValue() == Global.TECNICO_HS || currentUser.getTipo().intValue() == Global.DIRECTOR_SIPRP ) + { + chkDesactivar.setId( "chkDesactivarPlano" ); + chkDesactivar.setLabel( "Desactivar Plano" ); + chkDesactivar.setSelected( p.getConcluidoPorDesactivacao() ); + chkDesactivar.setStyle( "float: left;" ); + gridPlano.getChildren().add( chkDesactivar ); + } + } + + private void showArea( Area a ) + { + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape( false ); + st.setStyleClass( "label" ); + st.setText( "Área: " ); + pg.getChildren().add( st ); + st = new StaticText(); + st.setEscape( false ); + st.setText( Utils.unicodeToHTML( a.getDescricao() ) ); + pg.getChildren().add( st ); + gridArea.getChildren().add( pg ); + } + + private void showRisco( Risco r ) + { + System.out.println( "\nEditarPlano . showRisco() : " + r.getId() + " - " + r.getDescricao() ); + + getSessionBean1().setCurrentRisco( r ); + + String riscoText = "Risco" + ( r.getIsPatrimonial() ? " Patrimonial: " : ": " ); + + HtmlPanelGrid grd = new HtmlPanelGrid(); + grd.setColumns( 1 ); + grd.setWidth( "100%" ); + + gridRisco = new HtmlPanelGrid(); + gridRisco.setWidth( "98%" ); + gridRisco.setColumns( 1 ); + gridRisco.setColumnClasses( "gridColLeft" ); + gridArea.getChildren().add( gridRisco ); + + pg = new PanelGroup(); + st = new StaticText(); + st.setEscape( false ); + st.setStyleClass( "label" ); + st.setText( riscoText ); + pg.getChildren().add( st ); + st = new StaticText(); + st.setEscape( false ); + st.setText( r.getDescricao() ); + pg.getChildren().add( st ); + gridRisco.getChildren().add( pg ); + } + + private void showValores( Risco r ) + { + ListExmo. (a) Senhor (a),
"; + mail_text += "O Plano de Actuação referente à auditoria de Avaliação de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " foi devolvido para correcção.
"; + mail_text += "Proceda, por favor, em www.siprp.com à(s) respectiva(s) correcção(ões) de acordo com as indicações e volte a reenviar o processo para a fase seguinte.
"; + mail_text += "Caso tenha alguma dúvida ou necessite de qualquer esclarecimento, contacte, por favor, a Área Técnica da SIPRP através do telefone 213 504 540.
"; + mail_text += "Cumprimentos,
"; + mail_text += "A equipa da SIPRP
"; + mail_text += "Exmo. (a) Senhor (a),
"; + mail_text += "Encontra-se disponível em www.siprp.com o Plano de Actuação referente à auditoria de Avaliação de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " para que possa efectuar a sua verificação.
"; + mail_text += "Exmo. (a) Senhor (a),
"; + mail_text += "Encontra-se disponível em www.siprp.com o Plano de Actuação referente à auditoria de Avaliação de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " finalizado após verificação pelos Técnicos Superiores de Higiene e Segurança da SIPRP.
"; + mail_text += "Aproveitamos para agradecer toda a disponibilidade e ficamos ao vosso dispor, caso tenha alguma dúvida ou necessite de qualquer esclarecimento, através do telefone 213 504 540.
"; + mail_text += "Cumprimentos,
"; + mail_text += "Page bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.
+ * + * @author lluis + */ +public class EnviarCorrecao extends AbstractPageBean +{ + //Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.
+ */ + private void _init() throws Exception + { + + } + + private StaticText lblMsg = new StaticText(); + + public StaticText getLblMsg() + { + return lblMsg; + } + + public void setLblMsg(StaticText st) + { + this.lblMsg = st; + } + + private TextArea txtObservacoes = new TextArea(); + + public TextArea getTxtObservacoes() + { + return txtObservacoes; + } + + public void setTxtObservacoes(TextArea ta) + { + this.txtObservacoes = ta; + } + + private DropDown drpIrPara = new DropDown(); + + public DropDown getDrpIrPara() + { + return drpIrPara; + } + + public void setDrpIrPara(DropDown dd) + { + this.drpIrPara = dd; + } + + private Button butCancelar = new Button(); + + public Button getButCancelar() + { + return butCancelar; + } + + public void setButCancelar(Button b) + { + this.butCancelar = b; + } + + private Button butEnviar = new Button(); + + public Button getButEnviar() + { + return butEnviar; + } + + public void setButEnviar(Button b) + { + this.butEnviar = b; + } + + //Construct a new Page bean instance.
+ */ + public EnviarCorrecao() + { + + } + + /** + *Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.
+ * + *Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.
+ */ + @Override + public void init() + { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + //Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.
+ */ + @Override + public void preprocess() + { + + } + + /** + *Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.
+ */ + @Override + public void prerender() + { + initialize(); + lblMsg.setText(getSessionBean1().getMsg()); + getSessionBean1().setMsg(""); + } + + /** + *Callback method that is called after rendering is completed for
+ * this request, if init() was called (regardless of whether
+ * or not this was the page that was actually rendered). Customize this
+ * method to release resources acquired in the init(),
+ * preprocess(), or prerender() methods (or
+ * acquired during execution of an event handler).
Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() + { + return (SessionBean1) getBean("SessionBean1"); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() + { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected RequestBean1 getRequestBean1() + { + return (RequestBean1) getBean("RequestBean1"); + } + + public void drpIrPara_processValueChange(ValueChangeEvent event) + { + + } + + private void initialize() + { + Utilizador u = getSessionBean1().getCurrentUser(); + com.sun.webui.jsf.model.Option[] listOptions = null; + + if(u.getTipo().intValue() == Global.DIRECTOR_LOJA) + { + listOptions = new com.sun.webui.jsf.model.Option[1]; + listOptions[0] = new Option(new Integer(Global.FASE_SEGURANCA_PREENCHIMENTO), "Responsavel de seguranca"); + } + else if(u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA) + { + listOptions = new com.sun.webui.jsf.model.Option[2]; + listOptions[0] = new Option(new Integer(Global.FASE_SEGURANCA_PREENCHIMENTO), "Responsavel de seguranca"); + listOptions[1] = new Option(new Integer(Global.FASE_DIR_LOJA_VALIDACAO), "Director de loja"); + } + + getSessionBean1().setIrParaOptions(listOptions); + getSessionBean1().setIrParaChoice(new Integer( Global.FASE_SEGURANCA_PREENCHIMENTO )); + //drpIrPara.setItems(listOptions); + //drpIrPara.setSelected(new Integer( Global.FASE_SEGURANCA_PREENCHIMENTO )); + } + + public String butCancelar_action() + { + return "editar_plano"; + } + + public String butEnviar_action() + { + Utilizador u = getSessionBean1().getCurrentUser(); +// PlanosDataProvider pdp = new PlanosDataProvider(); + PlanoActuacao p = getSessionBean1().getPlanoActuacao(); + p.setFase_anterior( p.getFase() ); + int dns_next_fase = 0; + int fase = 0; + Integer irPara = ( Integer ) drpIrPara.getSelected(); + fase = irPara.intValue(); + if ( u.getTipo().intValue() == Global.DIRECTOR_LOJA ) + { + p.setValidacao_director_loja( new Boolean( false ) ); + } + else if ( u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA ) + { + p.setValidacao_dns( new Boolean( false ) ); + } + p.setCorrecao( "y" ); + p.setFase_antes_correcao( p.getFase() ); + p.setFase( new Integer( fase ) ); + String observacoes = ""; + if ( txtObservacoes.getText() != null ) + { + if ( u.getTipo().intValue() == Global.DIRECTOR_LOJA ) + { + observacoes = "Observações do Director de Loja: "; + } + else if ( u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA ) + { + observacoes = "Observações do Director Nacional de Segurança: "; + } + observacoes += ( String ) txtObservacoes.getText(); + p.setObs_correcao( observacoes ); + } + try + { + PlanosDataProvider pdp = PlanosDataProvider.getInstance(); + pdp.updatePlano( p ); + enviarMail( p ); + return "lista_planos"; + } + catch ( Exception ex ) + { + ErrorLogger.logException( ex ); + getSessionBean1().setMsg( "Erro no envio do plano para a fase " + Global.FASES_TEXTO[ fase - 1 ] ); + } + return null; + } + + private void enviarMail( PlanoActuacao p ) + { + String assunto = ""; + String mail_text = ""; + + int fase = p.getFase().intValue(); + int tipo_utilizador = 0; + switch( fase ) + { + case Global.FASE_SEGURANCA_PREENCHIMENTO : // enviar para correccao para responsavel de seguranca + tipo_utilizador = Global.RESPONSAVEL_SEGURANCA; + assunto = "Plano de Actuacao da Avaliacao de Riscos de " + p.getData_visita_str() + " - " + p.getNome_estabelecimento() + " - Pedido de Correcao"; + mail_text = "Exmo. (a) Senhor (a),
"; + mail_text += "O Plano de Actuação referente à auditoria de Avaliação de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " foi devolvido para correcção.
"; + mail_text += "Proceda, por favor, em www.siprp.com à(s) respectiva(s) correcção(ões) de acordo com as indicações e volte a reenviar o processo para a fase seguinte.
"; + mail_text += "Caso tenha alguma dúvida ou necessite de qualquer esclarecimento, contacte, por favor, a Área Técnica da SIPRP através do telefone 213 504 540.
"; + mail_text += "Cumprimentos,
"; + mail_text += "A equipa da SIPRP
"; + mail_text += "Exmo. (a) Senhor (a),
"; + mail_text += "O Plano de Actuação referente à auditoria de Avaliação de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " foi devolvido para correcção.
"; + mail_text += "Proceda, por favor, em www.siprp.com à(s) respectiva(s) correcção(ões) de acordo com as indicações do Director Nacional de Segurança e volte a reenviar o processo para a fase seguinte.
"; + mail_text += "Cumprimentos.
"; + mail_text += "Page bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.
+ * + * @author lluis + */ +public class Erro extends AbstractPageBean { + //Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.
+ */ + private void _init() throws Exception { + } + private StaticText txtMsg = new StaticText(); + + public StaticText getTxtMsg() { + return txtMsg; + } + + public void setTxtMsg(StaticText st) { + this.txtMsg = st; + } + + //Construct a new Page bean instance.
+ */ + public Erro() { + } + + /** + *Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.
+ * + *Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.
+ */ + @Override + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + //Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.
+ */ + @Override + public void preprocess() { + } + + /** + *Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.
+ */ + @Override + public void prerender() { + txtMsg.setText( getSessionBean1().getMsg() ); + getSessionBean1().setMsg(""); + } + + /** + *Callback method that is called after rendering is completed for
+ * this request, if init() was called (regardless of whether
+ * or not this was the page that was actually rendered). Customize this
+ * method to release resources acquired in the init(),
+ * preprocess(), or prerender() methods (or
+ * acquired during execution of an event handler).
Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1) getBean("RequestBean1"); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1) getBean("SessionBean1"); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + +} + diff --git a/trunk/PlanosActuacao/src/planosactuacao/Estatistica.java b/trunk/PlanosActuacao/src/planosactuacao/Estatistica.java new file mode 100644 index 00000000..3931a827 --- /dev/null +++ b/trunk/PlanosActuacao/src/planosactuacao/Estatistica.java @@ -0,0 +1,300 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package planosactuacao; + +import com.evolute.utils.data.Mappable; +import com.evolute.utils.strings.UnicodeChecker; +import com.sun.rave.web.ui.appbase.AbstractPageBean; +import com.sun.webui.jsf.component.Button; +import com.sun.webui.jsf.component.DropDown; +import com.sun.webui.jsf.component.Table; +import com.sun.webui.jsf.component.TableRowGroup; +import com.sun.webui.jsf.model.Option; +import db.entidades.LinhaEstatistica; +import db.providers.PlanosDataProvider; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.faces.FacesException; + +/** + *Page bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.
+ * + * @version Estatistica.java + * @version Created on Mar 27, 2012, 2:22:42 PM + * @author fpalma + */ + +public class Estatistica extends AbstractPageBean { + //Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.
+ */ + private void _init() throws Exception { + } + + //Construct a new Page bean instance.
+ */ + public Estatistica() { + } + + /** + *Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.
+ * + *Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.
+ */ + @Override + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + //Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.
+ */ + @Override + public void preprocess() { + + } + + /** + *Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.
+ */ + @Override + public void prerender() { + + } + + /** + *Callback method that is called after rendering is completed for
+ * this request, if init() was called (regardless of whether
+ * or not this was the page that was actually rendered). Customize this
+ * method to release resources acquired in the init(),
+ * preprocess(), or prerender() methods (or
+ * acquired during execution of an event handler).
Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() + { + return ( ApplicationBean1 ) getBean( "ApplicationBean1" ); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() + { + return ( SessionBean1 ) getBean( "SessionBean1" ); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected RequestBean1 getRequestBean1() + { + return ( RequestBean1 ) getBean( "RequestBean1" ); + } + + public Button getButtonPesquisar() + { + return buttonPesquisar; + } + + public void setButtonPesquisar( Button buttonPesquisar ) + { + this.buttonPesquisar = buttonPesquisar; + } + + public Date getCalFimDate() + { + return calFimDate; + } + + public void setCalFimDate( Date calFimDate ) + { + this.calFimDate = calFimDate; + } + + public Date getCalInicioDate() + { + return calInicioDate; + } + + public void setCalInicioDate( Date calInicioDate ) + { + this.calInicioDate = calInicioDate; + } + + public DropDown getDropEstabelecimento() + { + return dropEstabelecimento; + } + + public void setDropEstabelecimento( DropDown dropEstabelecimento ) + { + this.dropEstabelecimento = dropEstabelecimento; + } + + public Table getTableEstatistica() + { + return tableEstatistica; + } + + public void setTableEstatistica( Table tableEstatistica ) + { + this.tableEstatistica = tableEstatistica; + } + + public TableRowGroup getTableRowGroupEstatisticas() + { + return tableRowGroupEstatisticas; + } + + public void setTableRowGroupEstatisticas( TableRowGroup tableRowGroupEstatisticas ) + { + this.tableRowGroupEstatisticas = tableRowGroupEstatisticas; + } + + public String buttonPesquisar_action() + { + System.out.println( "ACTION" ); + ListReturn a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected EditarPlano getEditarPlano() + { + return ( EditarPlano ) getBean( "EditarPlano" ); + } +} + diff --git a/trunk/PlanosActuacao/src/planosactuacao/Footer.java b/trunk/PlanosActuacao/src/planosactuacao/Footer.java new file mode 100644 index 00000000..1f529e12 --- /dev/null +++ b/trunk/PlanosActuacao/src/planosactuacao/Footer.java @@ -0,0 +1,141 @@ +/* + * Footer.java + * + * Created on Oct 6, 2008, 3:01:32 PM + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import com.sun.rave.web.ui.appbase.AbstractPageBean; +import javax.faces.FacesException; + +/** + *Page bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.
+ * + * @author lluis + */ +public class Footer extends AbstractPageBean { + //Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.
+ */ + private void _init() throws Exception { + } + + //Construct a new Page bean instance.
+ */ + public Footer() { + } + + /** + *Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.
+ * + *Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.
+ */ + @Override + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + //Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.
+ */ + @Override + public void preprocess() { + } + + /** + *Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.
+ */ + @Override + public void prerender() { + } + + /** + *Callback method that is called after rendering is completed for
+ * this request, if init() was called (regardless of whether
+ * or not this was the page that was actually rendered). Customize this
+ * method to release resources acquired in the init(),
+ * preprocess(), or prerender() methods (or
+ * acquired during execution of an event handler).
Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1) getBean("RequestBean1"); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1) getBean("SessionBean1"); + } + +} + diff --git a/trunk/PlanosActuacao/src/planosactuacao/Header.java b/trunk/PlanosActuacao/src/planosactuacao/Header.java new file mode 100644 index 00000000..bacd8562 --- /dev/null +++ b/trunk/PlanosActuacao/src/planosactuacao/Header.java @@ -0,0 +1,253 @@ +/* + * Header.java + * + * Created on Oct 6, 2008, 10:35:36 AM + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import com.sun.rave.web.ui.appbase.AbstractFragmentBean; +import com.sun.webui.jsf.component.ImageComponent; +import com.sun.webui.jsf.component.StaticText; +import db.entidades.Utilizador; +import utils.Global; +import javax.faces.FacesException; +import javax.faces.context.FacesContext; +import utils.JSFHTTPUtils; +import utils.JSFUtils; + +/** + *Fragment bean that corresponds to a similarly named JSP page + * fragment. This class contains component definitions (and initialization + * code) for all components that you have defined on this fragment, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.
+ * + * @author lluis + */ +public class Header extends AbstractFragmentBean { + //Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.
+ */ + private void _init() throws Exception { + } + private StaticText stDataPlano = new StaticText(); + + public StaticText getStDataPlano() { + return stDataPlano; + } + + public void setStDataPlano(StaticText st) { + this.stDataPlano = st; + } + private ImageComponent imgLogoEmpresa = new ImageComponent(); + + public ImageComponent getImgLogoEmpresa() { + return imgLogoEmpresa; + } + + public void setImgLogoEmpresa(ImageComponent ic) { + this.imgLogoEmpresa = ic; + } + //Callback method that is called whenever a page containing + * this page fragment is navigated to, either directly via a URL, + * or indirectly via page navigation. Override this method to acquire + * resources that will be needed for event handlers and lifecycle methods.
+ * + *The default implementation does nothing.
+ */ + @Override + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + FacesContext fc = getFacesContext(); + String referer = JSFHTTPUtils.getReferer(fc); + System.out.println("HEADER - REFERER : " + referer); + + //Callback method that is called after rendering is completed for
+ * this request, if init() was called. Override this
+ * method to release resources acquired in the init()
+ * resources that will be needed for event handlers and lifecycle methods.
The default implementation does nothing.
+ */ + @Override + public void destroy() { + } + + public String lnkLogout_action() + { + FacesContext fc = getFacesContext(); + try + { + JSFUtils.logout( fc ); + try + { + JSFUtils.redirect( fc, Global.ANALISE_ACIDENTES_URL + "Login.jsp" ); + } + catch ( Exception ex ) + { + ErrorLogger.logException( ex ); + } + } + catch ( Exception ex ) + { + ErrorLogger.logException( ex ); + } + return null; + } + + public String lnkAnaliseAcidentes_action() + { + FacesContext fc = getFacesContext(); + SessionBean1 session = JSFUtils.getSessionBean(fc); + Utilizador u = session.getCurrentUser(); + + String url = Global.ANALISE_ACIDENTES_URL; + int tipo = u.getTipo().intValue(); + switch(tipo) + { + case Global.RESPONSAVEL_SEGURANCA: + url += "FormSeguranca.jsp?user=" + u.getId().intValue(); + break; + + case Global.RH: + url += "FormRH.jsp?user=" + u.getId().intValue(); + break; + + case Global.TECNICO_HS: + url += "FormHS.jsp?user=" + u.getId().intValue(); + break; + + case Global.GESTOR: + url += "FormGestor.jsp?user=" + u.getId().intValue(); + break; + + case Global.DIRECTOR_LOJA: + url += "FormGestor.jsp?user=" + u.getId().intValue(); + break; + case Global.DIRECTOR_GERAL_RH: + url += "FormDirGerRh.jsp?user=" + u.getId().intValue(); + break; + + case Global.DIRECTOR_SIPRP: + url += "FormDirSiprp.jsp?user=" + u.getId().intValue(); +// url += "Acesso.jsp"; + break; + + case Global.DIRECTOR_NACIONAL_SEGURANCA: + url += "FormGestor.jsp?user=" + u.getId().intValue(); + break; + } + + try + { + JSFUtils.redirect(fc.getCurrentInstance(), url); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + return null; + } + + public String lnkPlanosActuacao1_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + return "lista_planos"; + } + + public String lnkGerirUtilizadores1_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + FacesContext fc = getFacesContext(); + SessionBean1 session = JSFUtils.getSessionBean(fc); + Utilizador u = session.getCurrentUser(); + + String url = Global.ANALISE_ACIDENTES_URL; + //int tipo = u.getTipo().intValue(); + + url += "GestaoUtilizadores.jsp?user=" + u.getId().intValue(); + try + { + JSFUtils.redirect(fc.getCurrentInstance(), url); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + + return null; + } + + public String lnkDadosUtilizador1_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + FacesContext fc = getFacesContext(); + SessionBean1 session = JSFUtils.getSessionBean(fc); + Utilizador u = session.getCurrentUser(); + + String url = Global.ANALISE_ACIDENTES_URL; + int tipo = u.getTipo().intValue(); + + url += "FichaUtilizador.jsp?user=" + u.getId().intValue() + "&mode=edit"; + try + { + JSFUtils.redirect(fc.getCurrentInstance(), url); + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } + + return null; + } + + public String lnkAjuda_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + return "planos_actuacao_ajuda.pdf"; + } + + + public String lnkEstatisticas_action() { + // TODO: Process the action. Return value is a navigation + // case name where null will return to the same page. + return "estatistica"; + } + +} diff --git a/trunk/PlanosActuacao/src/planosactuacao/ListaPlanos.java b/trunk/PlanosActuacao/src/planosactuacao/ListaPlanos.java new file mode 100644 index 00000000..7f39f3a9 --- /dev/null +++ b/trunk/PlanosActuacao/src/planosactuacao/ListaPlanos.java @@ -0,0 +1,1092 @@ +/* + * ListaPlanos.java + * + * Created on Aug 29, 2008, 2:57:16 PM + */ +package planosactuacao; + +import com.evolute.utils.date.DateUtils; +import com.evolute.utils.error.ErrorLogger; +import com.sun.data.provider.RowKey; +import com.sun.rave.web.ui.appbase.AbstractPageBean; +import com.sun.webui.jsf.component.Button; +import com.sun.webui.jsf.component.DropDown; +import com.sun.webui.jsf.component.PanelGroup; +import com.sun.webui.jsf.component.Table; +import com.sun.webui.jsf.component.TableColumn; +import com.sun.webui.jsf.component.TableRowGroup; +import com.sun.webui.jsf.component.TextField; +import com.sun.webui.jsf.model.Option; +import db.entidades.PlanoActuacao; +import db.entidades.Utilizador; +import db.providers.PlanosDataProvider; +import utils.Global; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +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.faces.event.ValueChangeEvent; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import shst.higiene.planoactuacao.print.PlanoActuacaoPDFCreator; +import tabledataproviders.PlanosActualDataProvider; +import tabledataproviders.PlanosConcluidosDataProvider; +import tabledataproviders.PlanosSeguimentoDataProvider; +import utils.JSFUtils; +import utils.Utils; + +/** + *Page bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.
+ * + * @author lluis + */ +public class ListaPlanos extends AbstractPageBean +{ + //Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.
+ */ + private void _init() throws Exception + { + } + private Table table1 = new Table(); + + public Table getTable1() + { + return table1; + } + + public void setTable1( Table t ) + { + this.table1 = t; + } + private TableRowGroup tableRowGroup1 = new TableRowGroup(); + + public TableRowGroup getTableRowGroup1() + { + return tableRowGroup1; + } + + public void setTableRowGroup1( TableRowGroup trg ) + { + this.tableRowGroup1 = trg; + } + private TableRowGroup tableRowGroup2 = new TableRowGroup(); + + public TableRowGroup getTableRowGroup2() + { + return tableRowGroup2; + } + + public void setTableRowGroup2( TableRowGroup trg ) + { + this.tableRowGroup2 = trg; + } + private TableRowGroup tableRowGroup3 = new TableRowGroup(); + + public TableRowGroup getTableRowGroup3() + { + return tableRowGroup3; + } + + public void setTableRowGroup3( TableRowGroup trg ) + { + this.tableRowGroup3 = trg; + } + private HtmlPanelGrid gridActual = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridActual() + { + return gridActual; + } + + public void setGridActual( HtmlPanelGrid hpg ) + { + this.gridActual = hpg; + } + private TableColumn tableColumn55 = new TableColumn(); + + public TableColumn getTableColumn55() + { + return tableColumn55; + } + + public void setTableColumn55( TableColumn c ) + { + this.tableColumn55 = c; + } + private Button buttonDesactivar = new Button(); + + public Button getButtonDesactivar() + { + return buttonDesactivar; + } + + public void setButtonDesactivar( Button b ) + { + this.buttonDesactivar = b; + } + + + private TableColumn tableColumn56 = new TableColumn(); + + public TableColumn getTableColumn56() + { + return tableColumn56; + } + + public void setTableColumn56( TableColumn c ) + { + this.tableColumn56 = c; + } + private Button buttonDesactivarSeguimento = new Button(); + + public Button getButtonDesactivarSeguimento() + { + return buttonDesactivarSeguimento; + } + + public void setButtonDesactivarSeguimento( Button b ) + { + this.buttonDesactivarSeguimento = b; + } + + + private TableColumn tableColumnConcluidos6 = new TableColumn(); + + public TableColumn getTableColumnConcluidos6() + { + return tableColumnConcluidos6; + } + + public void setTableColumnConcluidos6( TableColumn c ) + { + this.tableColumnConcluidos6 = c; + } + + private Button buttonPreencherVerificacao = new Button(); + + public Button getButtonPreencherVerificacao() + { + return buttonPreencherVerificacao; + } + + public void setButtonPreencherVerificacao( Button buttonPreencherVerificacao ) + { + this.buttonPreencherVerificacao = buttonPreencherVerificacao; + } + + + + 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() + { + return textFilterEstabelecimentoActual; + } + + public void setTextFilterEstabelecimentoActual( TextField textFilterEstabelecimentoActual ) + { + this.textFilterEstabelecimentoActual = textFilterEstabelecimentoActual; + } + + + private Date calFilterDate = null; + public Date getCalFilterDate() + { + return calFilterDate; + } + public void setCalFilterDate( Date calFilterDate ) + { + this.calFilterDate = calFilterDate; + } + + +// private com.sun.webui.jsf.component.Calendar calFilterDateActual = new com.sun.webui.jsf.component.Calendar(); +// public com.sun.webui.jsf.component.Calendar getCalFilterDateActual() +// { +// return 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() + { + return textFilterEstabelecimentoSeg; + } + + public void setTextFilterEstabelecimentoSeg( TextField textFilterEstabelecimentoSeg ) + { + this.textFilterEstabelecimentoSeg = textFilterEstabelecimentoSeg; + } + + + private Date calFilterDateSeguimento = null; + public Date getCalFilterDateSeguimento() + { + return calFilterDateSeguimento; + } + public void setCalFilterDateSeguimento( Date calFilterDateSeguimento ) + { + this.calFilterDateSeguimento = calFilterDateSeguimento; + } + +// private com.sun.webui.jsf.component.Calendar calFilterDateSeg = new com.sun.webui.jsf.component.Calendar(); +// public com.sun.webui.jsf.component.Calendar getCalFilterDateSeg() +// { +// return 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() + { + return textFilterEstabelecimentoConc; + } + + public void setTextFilterEstabelecimentoConc( TextField textFilterEstabelecimentoConc ) + { + this.textFilterEstabelecimentoConc = textFilterEstabelecimentoConc; + } + + + private Date calFilterDateConcluidos = null; + public Date getCalFilterDateConcluidos() + { + return calFilterDateConcluidos; + } + public void setCalFilterDateConcluidos( Date calFilterDateConcluidos ) + { + this.calFilterDateConcluidos = calFilterDateConcluidos; + } + +// private com.sun.webui.jsf.component.Calendar calFilterDateConc = new com.sun.webui.jsf.component.Calendar(); +// public com.sun.webui.jsf.component.Calendar getCalFilterDateConc() +// { +// return 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 DropDown dropCurrentYear = new DropDown(); + + public DropDown getDropCurrentYear() + { + return dropCurrentYear; + } + + public void setDropCurrentYear( DropDown dropCurrentYear ) + { + this.dropCurrentYear = dropCurrentYear; + } + + private static final DateFormat D_F = new SimpleDateFormat( "yyyy-MM-dd" ); + //Construct a new Page bean instance.
+ */ + public ListaPlanos() + { + } + + /** + *Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.
+ * + *Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.
+ */ + @Override + public void init() + { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + //Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.
+ */ + @Override + public void preprocess() + { + } + + /** + *Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.
+ */ + @Override + public void prerender() + { + System.out.println( "LISTA PLANOS - PRERENDER" ); + HttpServletRequest request = ( HttpServletRequest ) getExternalContext().getRequest(); + String referer = request.getRequestURI(); + String pageFrom = Utils.getPageFrom( referer ); + if ( !pageFrom.matches( "FormMedico.jsp" ) + || dropCurrentYear.getItems() == null ) + { + fillCurrentYearDrop(); + fillInitialForm(); + } + } + + private void fillInitialForm() + { + Utilizador u = getSessionBean1().getCurrentUser(); + System.out.println( "\tUser Logged In : " + ( u == null ? "NONE !" : "[" + u.getId() + "] : " + u.getLogin() ) ); + + FacesContext fc = getFacesContext(); + String estab_gestor = JSFUtils.getRequestParameter( fc, "estab_gestor" ); + + boolean renderOrNot = false; + boolean renderPreencherVerificacao = 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 ) + { + 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 ) + { + 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 ) + { + getSessionBean1().setDisableMenuUtilizadores( true ); + tableRowGroup1.setEmptyDataMsg( "Sem registos" ); + tableRowGroup2.setEmptyDataMsg( "Sem registos" ); + tableRowGroup3.setEmptyDataMsg( "Sem registos" ); + } + + //Column para desactivar plano - mostra se o utilizador for DIRECTOR SIPRP + if ( u.getTipo() != null ) + { + int uType = u.getTipo(); + renderOrNot = uType == Global.DIRECTOR_SIPRP || uType == Global.TECNICO_HS; + renderPreencherVerificacao = uType == Global.DIRECTOR_SIPRP || uType == Global.TECNICO_HS; + } + + initialize(); + } + else + { + getSessionBean1().setMsg( "Utilizador inválido." ); + } + + tableColumn55.setRendered( renderOrNot ); + buttonDesactivar.setRendered( renderOrNot ); + tableColumn56.setRendered( renderOrNot ); + buttonDesactivarSeguimento.setRendered( renderOrNot ); + + tableColumnConcluidos6.setRendered( renderPreencherVerificacao); + buttonPreencherVerificacao.setRendered( renderPreencherVerificacao); + } + + /** + *Callback method that is called after rendering is completed for
+ * this request, if init() was called (regardless of whether
+ * or not this was the page that was actually rendered). Customize this
+ * method to release resources acquired in the init(),
+ * preprocess(), or prerender() methods (or
+ * acquired during execution of an event handler).
Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected RequestBean1 getRequestBean1() + { + return ( RequestBean1 ) getBean( "RequestBean1" ); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() + { + return ( ApplicationBean1 ) getBean( "ApplicationBean1" ); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() + { + return ( SessionBean1 ) getBean( "SessionBean1" ); + } + + 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"; + } + + public String goDesactivarPlano_action() + { + System.out.println( "\ngoDesactivarPlano_action():" ); + PlanoActuacao p = getTableActivosRowData(); + desactivarPlano( p ); +// System.out.println( "\tPlanoActuacao: " + p.getId() ); + return null; + } + + public String goDesactivarPlanoSeguimento_action() + { + System.out.println( "\ngoDesactivarPlanoSeguimento_action():" ); + PlanoActuacao p = getTableSeguimentoRowData(); + desactivarPlano( p ); +// System.out.println( "\tPlanoActuacao: " + p.getId() ); + return null; + } + + public String goPreencherVerificacao_action() + { + PlanoActuacao p = getTableConcluidosRowData(); + getSessionBean1().setPlanoActuacao( p ); + +// getSessionBean1().setFase( Global.FASE_SIPRP_CONCLUSAO ); + return "editar_plano"; + } + + private void desactivarPlano( PlanoActuacao p ) + { + Utilizador currentUser = getSessionBean1().getCurrentUser(); + if ( currentUser.getTipo().intValue() == Global.DIRECTOR_SIPRP || currentUser.getTipo().intValue() == Global.TECNICO_HS ) + { + p.setFase( Global.FASE_CONCLUIDO ); + p.setConcluidoPorDesactivacao( Boolean.TRUE ); + p.setDataDesactivacao( new Date() ); + try + { + PlanosDataProvider pdp = PlanosDataProvider.getInstance(); + pdp.updatePlano( p ); + } + catch ( Exception e ) + { + ErrorLogger.logException( e ); + } + } + } + + public String goEditarPlano_action() + { + PlanoActuacao p = getTableActivosRowData(); + getSessionBean1().setPlanoActuacao( p ); + + return "editar_plano"; + } + + public String goVerPlanoFromSeguimento_action() + { + PlanoActuacao p = getTableSeguimentoRowData(); + getSessionBean1().setPlanoActuacao( p ); + return "ver_plano"; + } + + public String goVerPlanoFromConcluidos_action() + { + PlanoActuacao p = getTableConcluidosRowData(); + getSessionBean1().setPlanoActuacao( p ); + return "ver_plano"; + } + + //**** IMPRIMIR PLANO SEM RISCOS PATRIMONIAIS ****// + public String goImprimirPlano_action() + { + PlanoActuacao p = getTableActivosRowData(); + createPdf( p.getId() ); + return null; + } + + public String goImprimirPlanoFromSeguimento_action() + { + PlanoActuacao p = getTableSeguimentoRowData(); + createPdf( p.getId() ); + return null; + } + + public String goImprimirPlanoFromConcluidos_action() + { + Utilizador currentUser = getSessionBean1().getCurrentUser(); + + PlanoActuacao p = getTableConcluidosRowData(); + if ( canPrint( p, currentUser ) ) + { + createPdf( p.getId() ); + } + return null; + } + + //*** IMPRIMIR PLANO COM RISCOS PATRIMONIAIS ***// + public String goImprimirPlanoPatrimoniais_action() + { + PlanoActuacao p = getTableActivosRowData(); + createPdf( p.getId(), true ); + return null; + } + + public String goImprimirPlanoSeguimentoPatrimoniais_action() + { + PlanoActuacao p = getTableSeguimentoRowData(); + createPdf( p.getId(), true ); + return null; + } + + public String goImprimirPlanoConcluidoPatrimoniais_action() + { + Utilizador currentUser = getSessionBean1().getCurrentUser(); + + PlanoActuacao p = getTableConcluidosRowData(); + if ( canPrint( p, currentUser ) ) + { + createPdf( p.getId(), true ); + } + return null; + } + + private boolean canPrint( PlanoActuacao p, Utilizador user ) + { + int userType = user == null ? -1 : user.getTipo(); + return ! p.getConcluidoPorDesactivacao() || ( userType == Global.DIRECTOR_SIPRP || userType == Global.TECNICO_HS ); + } + + + private void createPdf( Integer pID ) + { + createPdf( pID, false ); + } + + private void createPdf( Integer pID, boolean withPatrimoniais ) + { + try + { + PlanoActuacaoPDFCreator pdfCreator = new PlanoActuacaoPDFCreator(); + + System.out.println( "CREATING PDF ..." ); + byte[] pdf = pdfCreator.createPDF( pID, true, withPatrimoniais ); + System.out.println( "\t.. DONE !" ); + showPdf( pdf, withPatrimoniais ); + } + catch ( Exception ex ) + { + ErrorLogger.logException( ex ); + System.out.println( "\n\tError creating PDF : " + ex.getMessage() ); + } + } + + private void showPdf( byte[] pdf, boolean isPatrimoniais ) throws Exception + { + String filename = isPatrimoniais ? "Plano_Patrimoniais.pdf" : "Plano.pdf"; + System.out.println( "\nPDF LEN : " + pdf.length ); + System.out.println( "FileName : " + filename ); + + FacesContext context = FacesContext.getCurrentInstance(); + HttpServletResponse response = ( HttpServletResponse ) context.getExternalContext().getResponse(); + + response.setHeader( "Expires", "0" ); + response.setHeader( "Cache-Control", "must-revalidate, post-check=0, pre-check=0" ); + response.setHeader( "Pragma", "public" ); + response.setContentType( "application/pdf" ); + response.addHeader( "Content-disposition", "attachment;filename=\"" + filename + "\"" ); + response.setContentLength( pdf.length ); + + response.getOutputStream().write( pdf ); + response.getOutputStream().flush(); + response.getOutputStream().close(); + context.responseComplete(); + + System.out.println( "SHOW PDF done." ); + } + + private void initialize() + { + Utilizador u = getSessionBean1().getCurrentUser(); + Integer ano = getSelectedYear(); + +// Integer estabelecimento_id = null; +// if ( u.getTipo().intValue() != Global.TECNICO_HS ) +// { +// estabelecimento_id = u.getEstabelecimento_id(); +// } + + System.out.println( "INITIALIZE:" ); + + if ( !getSessionBean1().getIsSearchingPlanosActuacao() ) + { + System.out.println( "\tGETTING INITIAL VALUES FOR EACH TABLE." ); + long startedTime = System.currentTimeMillis(); + + List< PlanoActuacao > listPlanosActivos = getPlanosActivos( u, ano ); + getSessionBean1().getPlanosActualDataProvider().setList( listPlanosActivos ); + + List< PlanoActuacao > listPlanosSeguimento = getPlanosSeguimento( u, ano ); + getSessionBean1().getPlanosSeguimentoDataProvider().setList( listPlanosSeguimento ); + + List< PlanoActuacao > listPlanosConcluidos = getPlanosConcluidos( u, ano ); + getSessionBean1().getPlanosConcluidosDataProvider().setList( listPlanosConcluidos ); + + long endedTime = System.currentTimeMillis(); + System.out.println( "\nGot Planos List in : " + getTime( startedTime, endedTime ) ); + } + //checkPlanosDelayed(); + } + + private String getTime( long start, long end ) + { + return DateUtils.getTimePassed( start, end ); + } + + private PlanoActuacao getTableActivosRowData() + { + RowKey rk = tableRowGroup1.getRowKey(); + int k = Integer.parseInt( rk.getRowId() ); + PlanosActualDataProvider provider = ( PlanosActualDataProvider ) tableRowGroup1.getSourceData(); + List< PlanoActuacao > list = ( LinkedList< PlanoActuacao > ) 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(); + List< PlanoActuacao > list = ( LinkedList< PlanoActuacao > ) provider.getList(); + PlanoActuacao p = ( PlanoActuacao ) list.get( k ); + + return p; + } + + private PlanoActuacao getTableConcluidosRowData() + { + RowKey rk = tableRowGroup3.getRowKey(); + int k = Integer.parseInt( rk.getRowId() ); + PlanosConcluidosDataProvider provider = ( PlanosConcluidosDataProvider ) tableRowGroup3.getSourceData(); + List< PlanoActuacao > list = ( LinkedList< PlanoActuacao > ) provider.getList(); + PlanoActuacao p = ( PlanoActuacao ) list.get( k ); + return p; + } + + + private List< PlanoActuacao > searchPlanosActivos( Utilizador u, String nome, String estabelecimento, String dataVisita, Integer ano ) + { + List< PlanoActuacao > list = null; + try + { + 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, ano ); + } + } + catch ( Exception e ) + { + ErrorLogger.logException( e ); + } + return list == null ? new LinkedList< PlanoActuacao >() : list; + } + + private ListPage bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.
+ * + * @author lluis + */ +public class Login extends AbstractPageBean +{ + //Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.
+ */ + private void _init() throws Exception { + } + private TextField txtUtilizador = new TextField(); + + public TextField getTxtUtilizador() { + return txtUtilizador; + } + + public void setTxtUtilizador(TextField tf) { + this.txtUtilizador = tf; + } + private PasswordField txtPassword = new PasswordField(); + + public PasswordField getTxtPassword() { + return txtPassword; + } + + public void setTxtPassword(PasswordField pf) { + this.txtPassword = pf; + } + private Button butLogin = new Button(); + + public Button getButLogin() { + return butLogin; + } + + public void setButLogin(Button b) { + this.butLogin = b; + } + + //Construct a new Page bean instance.
+ */ + public Login() + { +// connect(); + } + + /** + *Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.
+ * + *Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.
+ */ + @Override + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + //Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.
+ */ + @Override + public void preprocess() { + } + + /** + *Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.
+ */ + @Override + public void prerender() { + } + + /** + *Callback method that is called after rendering is completed for
+ * this request, if init() was called (regardless of whether
+ * or not this was the page that was actually rendered). Customize this
+ * method to release resources acquired in the init(),
+ * preprocess(), or prerender() methods (or
+ * acquired during execution of an event handler).
Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1) getBean("RequestBean1"); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1) getBean("SessionBean1"); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + +// private void connect() +// { +// Db db = Db.getInstance(); +// try +// { +// Connection connection = db.connect(); +// } +// catch ( Exception ex ) +// { +// getSessionBean1().setMsg("Erro na ligação à Base de Dados"); +// //***** terminate session +// try { +// getExternalContext().redirect("faces/Erro.jsp"); +// } catch(Exception e) { +// // . . . handle exception . . . +// ErrorLogger.logException( e ); +// } +// ErrorLogger.logException( ex ); +// } +// } + + public String lnkPasswordRecovery_action() + { + return null; + } + + public String butLogin_action() + { + String sRet = null; + + if(txtUtilizador.getText() != null) + { + String utilizador = (String) txtUtilizador.getText(); + if(utilizador.trim().length() > 0) + { + if(txtPassword.getText() != null) + { + String password = (String) txtPassword.getText(); + if( password.trim().length() > 0 ) + { + try + { + UtilizadoresDataProvider udp = UtilizadoresDataProvider.getInstance(); + + Utilizador u = udp.getUtilizador( utilizador ); + if( u != null && "y".equals( u.getActivo() ) ) + { + if ( ! password.equals( u.getPassword() ) ) + { + getSessionBean1().setMsg( "Palavra-chave inválida !" ); + } + else + { + Utils.doLogin( u ); + + getSessionBean1().setCurrentUser( u ); + getSessionBean1().setLoggedIn( true ); + + sRet = "lista_planos"; + } + } + else + { + getSessionBean1().setMsg("Utilizador inválido ! "); + } + } + catch(Exception ex) + { + ErrorLogger.logException( ex ); + getSessionBean1().setMsg("Utilizador inválido ! "); + } + } + else + { + getSessionBean1().setMsg("Falta palavra-chave !"); + } + } + else + { + getSessionBean1().setMsg("Falta palavra-chave !"); + } + } + else + { + getSessionBean1().setMsg("Falta utilizador !"); + } + } + else + { + getSessionBean1().setMsg("Falta utilizador !"); + } + return sRet; + } + +} + diff --git a/trunk/PlanosActuacao/src/planosactuacao/RequestBean1.java b/trunk/PlanosActuacao/src/planosactuacao/RequestBean1.java new file mode 100644 index 00000000..dd5b6d32 --- /dev/null +++ b/trunk/PlanosActuacao/src/planosactuacao/RequestBean1.java @@ -0,0 +1,110 @@ +/* + * RequestBean1.java + * + * Created on Aug 25, 2008, 11:20:16 AM + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import com.sun.rave.web.ui.appbase.AbstractRequestBean; +import javax.faces.FacesException; + +/** + *Request scope data bean for your application. Create properties + * here to represent data that should be made available across different + * pages in the same HTTP request, so that the page bean classes do not + * have to be directly linked to each other.
+ * + *An instance of this class will be created for you automatically, + * the first time your application evaluates a value binding expression + * or method binding expression that references a managed bean using + * this class.
+ * + * @author lluis + */ +public class RequestBean1 extends AbstractRequestBean { + //Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.
+ */ + private void _init() throws Exception { + } + //Construct a new request data bean instance.
+ */ + public RequestBean1() { + } + + /** + *This method is called when this bean is initially added to + * request scope. Typically, this occurs as a result of evaluating + * a value binding or method binding expression, which utilizes the + * managed bean facility to instantiate this bean and store it into + * request scope.
+ * + *You may customize this method to allocate resources that are required + * for the lifetime of the current request.
+ */ + @Override + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + //This method is called when this bean is removed from + * request scope. This occurs automatically when the corresponding + * HTTP response has been completed and sent to the client.
+ * + *You may customize this method to clean up resources allocated
+ * during the execution of the init() method, or
+ * at any later time during the lifetime of the request.
Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1) getBean("SessionBean1"); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + +} diff --git a/trunk/PlanosActuacao/src/planosactuacao/SessionBean1.java b/trunk/PlanosActuacao/src/planosactuacao/SessionBean1.java new file mode 100644 index 00000000..8737a21d --- /dev/null +++ b/trunk/PlanosActuacao/src/planosactuacao/SessionBean1.java @@ -0,0 +1,485 @@ +/* + * SessionBean1.java + * + * Created on Aug 25, 2008, 11:20:16 AM + */ + +package planosactuacao; + +import com.evolute.utils.error.ErrorLogger; +import com.sun.rave.web.ui.appbase.AbstractSessionBean; +import db.entidades.Area; +import db.entidades.PlanoActuacao; +import db.entidades.Risco; +import db.entidades.Utilizador; +import db.entidades.Valor; +import java.util.HashMap; +import java.util.Map; +import javax.faces.FacesException; +import pagination.Pagination; + +/** + *Session scope data bean for your application. Create properties + * here to represent cached data that should be made available across + * multiple HTTP requests for an individual user.
+ * + *An instance of this class will be created for you automatically, + * the first time your application evaluates a value binding expression + * or method binding expression that references a managed bean using + * this class.
+ * + * @author lluis + */ +public class SessionBean1 extends AbstractSessionBean { + + private boolean loggedIn = false; + private Utilizador currentUser = null; + private String msg; + private String aatSessionID = null; + + private Integer planoId; + private PlanoActuacao planoActuacao = null; + private Risco currentRisco = null; + private Valor currentValor = null; + + + private tabledataproviders.PlanosActualDataProvider planosActualDataProvider; + private tabledataproviders.PlanosSeguimentoDataProvider planosSeguimentoDataProvider; + private tabledataproviders.PlanosConcluidosDataProvider planosConcluidosDataProvider; + private tabledataproviders.EstatisticaPlanoDataProvider estatisticaPlanoDataProvider; + //Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.
+ */ + private void _init() throws Exception { + } + //Construct a new session data bean instance.
+ */ + public SessionBean1() { + msg = ""; + + planosActualDataProvider = new tabledataproviders.PlanosActualDataProvider(); + planosSeguimentoDataProvider = new tabledataproviders.PlanosSeguimentoDataProvider(); + planosConcluidosDataProvider = new tabledataproviders.PlanosConcluidosDataProvider(); + estatisticaPlanoDataProvider = new tabledataproviders.EstatisticaPlanoDataProvider(); + planoId = null; + + } + + /** + *This method is called when this bean is initially added to + * session scope. Typically, this occurs as a result of evaluating + * a value binding or method binding expression, which utilizes the + * managed bean facility to instantiate this bean and store it into + * session scope.
+ * + *You may customize this method to initialize and cache data values + * or resources that are required for the lifetime of a particular + * user session.
+ */ + @Override + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + //This method is called when the session containing it is about to be
+ * passivated. Typically, this occurs in a distributed servlet container
+ * when the session is about to be transferred to a different
+ * container instance, after which the activate() method
+ * will be called to indicate that the transfer is complete.
You may customize this method to release references to session data + * or resources that can not be serialized with the session itself.
+ */ + @Override + public void passivate() { + } + + /** + *This method is called when the session containing it was + * reactivated.
+ * + *You may customize this method to reacquire references to session + * data or resources that could not be serialized with the + * session itself.
+ */ + @Override + public void activate() { + } + + /** + *This method is called when this bean is removed from + * session scope. Typically, this occurs as a result of + * the session timing out or being terminated by the application.
+ * + *You may customize this method to clean up resources allocated
+ * during the execution of the init() method, or
+ * at any later time during the lifetime of the application.
Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public boolean isLoggedIn() { + return loggedIn; + } + + public void setLoggedIn(boolean loggedIn) { + this.loggedIn = loggedIn; + } + + public tabledataproviders.PlanosActualDataProvider getPlanosActualDataProvider() { + return planosActualDataProvider; + } + + public void setPlanosActualDataProvider(tabledataproviders.PlanosActualDataProvider planosActualDataProvider) { + this.planosActualDataProvider = planosActualDataProvider; + } + + public tabledataproviders.PlanosSeguimentoDataProvider getPlanosSeguimentoDataProvider() { + return planosSeguimentoDataProvider; + } + + public void setPlanosSeguimentoDataProvider(tabledataproviders.PlanosSeguimentoDataProvider planosSeguimentoDataProvider) { + this.planosSeguimentoDataProvider = planosSeguimentoDataProvider; + } + + public tabledataproviders.PlanosConcluidosDataProvider getPlanosConcluidosDataProvider() { + return planosConcluidosDataProvider; + } + + public void setPlanosConcluidosDataProvider(tabledataproviders.PlanosConcluidosDataProvider planosConcluidosDataProvider) { + this.planosConcluidosDataProvider = planosConcluidosDataProvider; + } + + public tabledataproviders.EstatisticaPlanoDataProvider getEstatisticaPlanoDataProvider() { + return estatisticaPlanoDataProvider; + } + + public void setEstatisticaPlanoDataProvider(tabledataproviders.EstatisticaPlanoDataProvider estatisticaPlanoDataProvider) { + this.estatisticaPlanoDataProvider = estatisticaPlanoDataProvider; + } + + public Integer getPlanoId() { + return planoId; + } + + public void setPlanoId(Integer planoId) { + this.planoId = planoId; + } + + public Utilizador getCurrentUser() { + return currentUser; + } + + public void setCurrentUser(Utilizador currentUser) { + this.currentUser = currentUser; + } + + public boolean isDisableMenu() { + return disableMenu; + } + + public void setDisableMenu(boolean disableMenu) { + System.out.println("DISABLE MENU : " + disableMenu); + setDisableMenuAnalises(disableMenu); + //setDisableMenuPlanos(disableMenu); + setDisableMenuUtilizadores(disableMenu); + setDisableMenuDadosUtilizador(disableMenu); + this.disableMenu = disableMenu; + } + + public boolean isDisableMenuAnalises() { + return disableMenuAnalises; + } + + public void setDisableMenuAnalises(boolean disableMenuAnalises) { + this.disableMenuAnalises = disableMenuAnalises; + } + + public boolean isDisableMenuPlanos() { + return disableMenuPlanos; + } + + public void setDisableMenuPlanos(boolean disableMenuPlanos) { + this.disableMenuPlanos = disableMenuPlanos; + } + + public boolean isDisableMenuUtilizadores() { + return disableMenuUtilizadores; + } + + public void setDisableMenuUtilizadores(boolean disableMenuUtilizadores) { + this.disableMenuUtilizadores = disableMenuUtilizadores; + } + + public boolean isDisableMenuDadosUtilizador() { + return disableMenuDadosUtilizador; + } + + public void setDisableMenuDadosUtilizador(boolean disableMenuDadosUtilizador) { + this.disableMenuDadosUtilizador = disableMenuDadosUtilizador; + } + + public boolean isDisableMenuEstatisticas() { + return disableMenuEstatisticas; + } + + public void setDisableMenuEstatisticas(boolean disableMenuEstatisticas) { + this.disableMenuEstatisticas = disableMenuEstatisticas; + } + + public int getFase() { + return fase; + } + + public void setFase(int fase) { + this.fase = fase; + } + + public PlanoActuacao getPlanoActuacao() { + return planoActuacao; + } + + public void setPlanoActuacao(PlanoActuacao planoActuacao) { + this.planoActuacao = planoActuacao; + } + + private Integer irParaChoice; + + public Integer getIrParaChoice() { + return irParaChoice; + } + + public void setIrParaChoice(Integer irParaChoice) { + this.irParaChoice = irParaChoice; + } + + private com.sun.webui.jsf.model.Option[] irParaOptions; + + public com.sun.webui.jsf.model.Option[] getIrParaOptions() { + return irParaOptions; + } + + public void setIrParaOptions(com.sun.webui.jsf.model.Option[] irParaOptions) { + this.irParaOptions = irParaOptions; + } + + public HashMapPage bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.
+ * + * @author lluis + */ +public class ViewPlano extends AbstractPageBean { + //Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.
+ */ + private void _init() throws Exception { + } + + public Table getTableEstatistica() + { + return tableEstatistica; + } + + public void setTableEstatistica( Table tableEstatistica ) + { + this.tableEstatistica = tableEstatistica; + } + + public TableRowGroup getTableRowGroupEstatisticas() + { + return tableRowGroupEstatisticas; + } + + public void setTableRowGroupEstatisticas( TableRowGroup tableRowGroupEstatisticas ) + { + this.tableRowGroupEstatisticas = tableRowGroupEstatisticas; + } + + private Button butVoltar = new Button(); + + public Button getButVoltar() { + return butVoltar; + } + + public void setButVoltar(Button b) { + this.butVoltar = b; + } + private HtmlPanelGrid gridLayout = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLayout() { + return gridLayout; + } + + public void setGridLayout(HtmlPanelGrid hpg) { + this.gridLayout = hpg; + } + //Construct a new Page bean instance.
+ */ + public ViewPlano() { + } + + /** + *Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.
+ * + *Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.
+ */ + @Override + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + //Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.
+ */ + @Override + public void preprocess() { + } + + /** + *Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.
+ */ + @Override + public void prerender() { + PlanoActuacao p = getSessionBean1().getPlanoActuacao(); + showPlano(p); + } + + /** + *Callback method that is called after rendering is completed for
+ * this request, if init() was called (regardless of whether
+ * or not this was the page that was actually rendered). Customize this
+ * method to release resources acquired in the init(),
+ * preprocess(), or prerender() methods (or
+ * acquired during execution of an event handler).
Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1) getBean("SessionBean1"); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1) getBean("ApplicationBean1"); + } + + /** + *Return a reference to the scoped data bean.
+ * + * @return reference to the scoped data bean + */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1) getBean("RequestBean1"); + } + + private void showPlano(PlanoActuacao p) { + System.out.println("\nViewPlano . showPlano( " + p.getId() + " ) : \n"); + + gridPlano = new HtmlPanelGrid(); + gridPlano.setId("gridPlano"); + gridPlano.setWidth("100%"); + gridPlano.setColumns(1); + gridPlano.setStyle("background-color: #f6f4e8; border: solid 1px #000000"); + gridPlano.setColumnClasses("gridColCenter"); + //lblTop.setText("Plano de actuação da auditoria " + p.getData_visita_str()); + + if (p.getConcluidoPorDesactivacao()) { + StaticText st = new StaticText(); + st.setText("N\u00E3o realizado por falta de cumprimento do prazo."); + st.setStyle("color: #FF0000; font-weight: bold; font-size: 13px;"); + gridPlano.getChildren().add(st); + } + concluido = p.getFase() != null && p.getFase().intValue() == Global.FASE_CONCLUIDO && !p.getConcluidoPorDesactivacao(); + gridLayout.getChildren().add(gridPlano); + showAreas(p.getAreas()); + showValidacoes(gridPlano, p); + List