|  |  | @ -9,18 +9,27 @@ package planosactuacao; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.sun.rave.web.ui.appbase.AbstractPageBean; |  |  |  | import com.sun.rave.web.ui.appbase.AbstractPageBean; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.sun.webui.jsf.component.Button; |  |  |  | import com.sun.webui.jsf.component.Button; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.sun.webui.jsf.component.Calendar; |  |  |  | import com.sun.webui.jsf.component.Calendar; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 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.PanelGroup; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.sun.webui.jsf.component.StaticText; |  |  |  | import com.sun.webui.jsf.component.StaticText; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.sun.webui.jsf.component.TextArea; |  |  |  | import com.sun.webui.jsf.component.TextArea; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.sun.webui.jsf.component.TextField; |  |  |  | import com.sun.webui.jsf.component.TextField; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.sun.webui.jsf.model.SingleSelectOptionsList; | 
			
		
	
		
		
			
				
					
					|  |  |  | import db.entidades.Medida; |  |  |  | import db.entidades.Medida; | 
			
		
	
		
		
			
				
					
					|  |  |  | import db.entidades.PlanoActuacao; |  |  |  | import db.entidades.PlanoActuacao; | 
			
		
	
		
		
			
				
					
					|  |  |  | import db.entidades.PostoTrabalho; |  |  |  | import db.entidades.PostoTrabalho; | 
			
		
	
		
		
			
				
					
					|  |  |  | import db.entidades.Risco; |  |  |  | import db.entidades.Risco; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import db.entidades.Utilizador; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import db.providers.PlanosDataProvider; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import global.Global; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.Vector; |  |  |  | import java.util.Vector; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.faces.FacesException; |  |  |  | import javax.faces.FacesException; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import javax.faces.component.html.HtmlInputHidden; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.faces.component.html.HtmlPanelGrid; |  |  |  | import javax.faces.component.html.HtmlPanelGrid; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.faces.context.FacesContext; |  |  |  | import javax.faces.context.FacesContext; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import javax.faces.event.ValueChangeEvent; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import mail.Mail; | 
			
		
	
		
		
			
				
					
					|  |  |  | import utils.JSFUtils; |  |  |  | import utils.JSFUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | /** |  |  |  | /** | 
			
		
	
	
		
		
			
				
					|  |  | @ -122,6 +131,87 @@ public class EditarPlano extends AbstractPageBean { | 
			
		
	
		
		
			
				
					
					|  |  |  |     public void setButCancelar(Button b) { |  |  |  |     public void setButCancelar(Button b) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         this.butCancelar = b; |  |  |  |         this.butCancelar = b; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private StaticText lblMsg = new StaticText(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public StaticText getLblMsg() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return lblMsg; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void setLblMsg(StaticText st) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         this.lblMsg = st; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private HtmlPanelGrid gridValidar = new HtmlPanelGrid(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public HtmlPanelGrid getGridValidar() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return gridValidar; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void setGridValidar(HtmlPanelGrid hpg) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         this.gridValidar = hpg; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private Checkbox chkValidacao = new Checkbox(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public Checkbox getChkValidacao() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return chkValidacao; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void setChkValidacao(Checkbox c) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         this.chkValidacao = c; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private SingleSelectOptionsList drpIrParaDefaultOptions = new SingleSelectOptionsList(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public SingleSelectOptionsList getDrpIrParaDefaultOptions() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return drpIrParaDefaultOptions; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void setDrpIrParaDefaultOptions(SingleSelectOptionsList ssol) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         this.drpIrParaDefaultOptions = ssol; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private HtmlPanelGrid gridParecer = new HtmlPanelGrid(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public HtmlPanelGrid getGridParecer() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return gridParecer; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void setGridParecer(HtmlPanelGrid hpg) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         this.gridParecer = hpg; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private TextArea txtParecer = new TextArea(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public TextArea getTxtParecer() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return txtParecer; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void setTxtParecer(TextArea ta) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         this.txtParecer = ta; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private HtmlInputHidden hidValidacao = new HtmlInputHidden(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public HtmlInputHidden getHidValidacao() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return hidValidacao; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void setHidValidacao(HtmlInputHidden hih) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         this.hidValidacao = hih; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private StaticText stIrPara = new StaticText(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public StaticText getStIrPara() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return stIrPara; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void setStIrPara(StaticText st) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         this.stIrPara = st; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private DropDown drpIrPara = new DropDown(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public DropDown getDrpIrPara() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return drpIrPara; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void setDrpIrPara(DropDown dd) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         this.drpIrPara = dd; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |      |  |  |  |      | 
			
		
	
		
		
			
				
					
					|  |  |  |     /** |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |      * <p>Construct a new Page bean instance.</p> |  |  |  |      * <p>Construct a new Page bean instance.</p> | 
			
		
	
	
		
		
			
				
					|  |  | @ -163,6 +253,12 @@ public class EditarPlano extends AbstractPageBean { | 
			
		
	
		
		
			
				
					
					|  |  |  |         // Perform application initialization that must complete
 |  |  |  |         // Perform application initialization that must complete
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         // *after* managed components are initialized
 |  |  |  |         // *after* managed components are initialized
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         // TODO - add your own initialization code here
 |  |  |  |         // TODO - add your own initialization code here
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Utilizador u = getSessionBean1().getCurrentUser(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if(u.getTipo().intValue() != Global.DIRECTOR_NACIONAL_SEGURANCA) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             stIrPara.setStyleClass("hidden"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             drpIrPara.setStyleClass("hidden");             | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |          |  |  |  |          | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -205,6 +301,9 @@ public class EditarPlano extends AbstractPageBean { | 
			
		
	
		
		
			
				
					
					|  |  |  |             medidas = getSessionBean1().getMedidas(); |  |  |  |             medidas = getSessionBean1().getMedidas(); | 
			
		
	
		
		
			
				
					
					|  |  |  |             postos = getSessionBean1().getPostos(); |  |  |  |             postos = getSessionBean1().getPostos(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |          | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         lblMsg.setText(getSessionBean1().getMsg()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         getSessionBean1().setMsg(""); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     /** |  |  |  |     /** | 
			
		
	
	
		
		
			
				
					|  |  | @ -418,7 +517,7 @@ public class EditarPlano extends AbstractPageBean { | 
			
		
	
		
		
			
				
					
					|  |  |  |         plano = new PlanoActuacao(); |  |  |  |         plano = new PlanoActuacao(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         plano.setId(new Integer(1)); |  |  |  |         plano.setId(new Integer(1)); | 
			
		
	
		
		
			
				
					
					|  |  |  |         plano.setEstabelecimento_id(new Integer(1)); |  |  |  |         plano.setEstabelecimento_id(new Integer(1)); | 
			
		
	
		
		
			
				
					
					|  |  |  |         plano.setEstado(new Integer(1)); |  |  |  |         plano.setFase(new Integer(1)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         getSessionBean1().setPlanoId(new Integer(1)); |  |  |  |         getSessionBean1().setPlanoId(new Integer(1)); | 
			
		
	
		
		
			
				
					
					|  |  |  |         plano.setDescricao("Plano 1"); |  |  |  |         plano.setDescricao("Plano 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |          |  |  |  |          | 
			
		
	
	
		
		
			
				
					|  |  | @ -634,6 +733,37 @@ public class EditarPlano extends AbstractPageBean { | 
			
		
	
		
		
			
				
					
					|  |  |  |      |  |  |  |      | 
			
		
	
		
		
			
				
					
					|  |  |  |     private void initialize() |  |  |  |     private void initialize() | 
			
		
	
		
		
			
				
					
					|  |  |  |     { |  |  |  |     { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Utilizador u = getSessionBean1().getCurrentUser(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if(u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             hidValidacao.setValue("dns");             | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //gridValidar.setStyleClass("hidden"); 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |          | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //System.out.println("VISIBILITY : " + gridValidar.getStyleClass());
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //System.out.println("USER TYPE : " + u.getTipo().intValue());        
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if(u.getTipo().intValue() != Global.DIRECTOR_LOJA && u.getTipo().intValue() != Global.DIRECTOR_NACIONAL_SEGURANCA) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             //gridValidar.setStyleClass("visible");
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             //System.out.println("VISIBILITY B : " + gridValidar.getStyleClass());            
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             gridValidar.setRendered(false); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             //txtParecer.setStyleClass("hidden");            
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         else | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             //txtParecer.setRendered(false);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             gridParecer.setStyleClass("hidden");               | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //        else
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //        {
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //            if(u.getTipo().intValue() != Global.DIRECTOR_NACIONAL_SEGURANCA)
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //            {
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //                //txtParecer.setStyleClass("visible");
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //                txtParecer.setRendered(false);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //            }            
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //        }
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |          | 
			
		
	
		
		
			
				
					
					|  |  |  |         gridPlano.setWidth("100%"); |  |  |  |         gridPlano.setWidth("100%"); | 
			
		
	
		
		
			
				
					
					|  |  |  |         gridPlano.setColumns(1); |  |  |  |         gridPlano.setColumns(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |         gridPlano.setColumnClasses("gridColCenter"); |  |  |  |         gridPlano.setColumnClasses("gridColCenter"); | 
			
		
	
	
		
		
			
				
					|  |  | @ -666,13 +796,140 @@ public class EditarPlano extends AbstractPageBean { | 
			
		
	
		
		
			
				
					
					|  |  |  |     public String butEnviar_action() { |  |  |  |     public String butEnviar_action() { | 
			
		
	
		
		
			
				
					
					|  |  |  |         // TODO: Process the action. Return value is a navigation
 |  |  |  |         // TODO: Process the action. Return value is a navigation
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         // case name where null will return to the same page.
 |  |  |  |         // case name where null will return to the same page.
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         try | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |             processEnviar();             |  |  |  |             processEnviar();             | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return "lista_planos"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         catch(Exception ex) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             getSessionBean1().setMsg("Erro no envio do Plano"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         return null; |  |  |  |         return null; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |      |  |  |  |      | 
			
		
	
		
		
			
				
					
					|  |  |  |     private void processEnviar() |  |  |  |     private void processEnviar() throws Exception | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         boolean processo_validado = true; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         int dns_next_fase = 2; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |          | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         PlanoActuacao p = getSessionBean1().getPlanoActuacao(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //dummy : later on get fase from plano
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //int fase = getSessionBean1().getFase();
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         int fase = p.getFase().intValue(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         switch(fase) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //            case Global.FASE_SIPRP_EMISSAO:
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //                break;
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             case Global.FASE_SEGURANCA_PREENCHIMENTO: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             case Global.FASE_SIPRP_CONCLUSAO: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 fase++;                 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 break;                 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             case Global.FASE_DIR_LOJA_VALIDACAO: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if(processo_validado) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     fase++; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 else | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     fase = Global.FASE_SEGURANCA_PREENCHIMENTO; //fase 2
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             case Global.FASE_DNS_PARECER: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if(processo_validado) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     fase++; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 else | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     fase = dns_next_fase; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //dummy : later on will update db with new fase
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //getSessionBean1().setFase(fase);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         PlanosDataProvider pdp = new PlanosDataProvider(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         p.setFase(new Integer(fase)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         pdp.updatePlano(p); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |          | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         enviarMail(fase); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void enviarMail(int fase) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         String assunto = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         String mail_text = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |          | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         switch(fase) | 
			
		
	
		
		
			
				
					
					|  |  |  |         { |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //            case Global.FASE_SIPRP_EMISSAO:
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //                break;
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                  |  |  |  |                  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             case Global.FASE_SEGURANCA_PREENCHIMENTO: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 assunto = "PLANOS - SEGURANÇA (PREENCHIMENTO)"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 mail_text = "Notifica-se que o Plano passou para a fase Segurança(Preenchimento)"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             case Global.FASE_DIR_LOJA_VALIDACAO: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 assunto = "PLANOS - DIRECTOR LOJA (VALIDAÇÃO)"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 mail_text = "Notifica-se que o Plano passou para a fase Director de Loja(Validação)";                 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             case Global.FASE_DNS_PARECER: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 assunto = "PLANOS - DNS (PARECER)"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 mail_text = "Notifica-se que o Plano passou para a fase Dns(Parecer)";                 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             case Global.FASE_SIPRP_CONCLUSAO: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 assunto = "PLANOS - TSHS SIPRP (CONCLUSÃO)"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 mail_text = "Notifica-se que o Plano passou para a fase TSHS(Conclusão)";                 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 break;                 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         }  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |          | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if(fase < Global.FASE_CONCLUIDO)    // nao envia para ninguem na fase Concluido
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             Mail mail = new Mail(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             try | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 mail.send("lluis@evolute.pt", Mail.ENDERECO_ENVIO, assunto, mail_text);   | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 System.out.println("EMAIL ENVIADO !!"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             catch(Exception ex) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ex.printStackTrace(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 System.out.println("ERRO NO ENVIO DO EMAIL !!");             | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             }             | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void chkValidacao_processValueChange(ValueChangeEvent event) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if(chkValidacao.getSelected() != null) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             Boolean selected = (Boolean) chkValidacao.getSelected(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if(selected.booleanValue()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 //txtParecer.setRendered(true);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 gridParecer.setStyleClass("visible");                               | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             else | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 //txtParecer.setRendered(false); 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 gridParecer.setStyleClass("hidden");                    | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         else | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             //txtParecer.setRendered(false);   
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             gridParecer.setStyleClass("hidden");              | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |      |  |  |  |      | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |