You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

754 lines
20 KiB

/*
* EnviarCorrecao.java
*
* Created on November 28, 2007, 5:27 PM
* Copyright lluis
*/
package analiseacidentestrabalho;
import com.sun.data.provider.RowKey;
import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.rave.web.ui.component.Body;
import com.sun.rave.web.ui.component.Button;
import com.sun.rave.web.ui.component.Form;
import com.sun.rave.web.ui.component.Head;
import com.sun.rave.web.ui.component.Html;
import com.sun.rave.web.ui.component.Hyperlink;
import com.sun.rave.web.ui.component.ImageComponent;
import com.sun.rave.web.ui.component.Link;
import com.sun.rave.web.ui.component.Page;
import com.sun.rave.web.ui.component.PanelGroup;
import com.sun.rave.web.ui.component.StaticText;
import com.sun.rave.web.ui.component.Table;
import com.sun.rave.web.ui.component.TableColumn;
import com.sun.rave.web.ui.component.TableRowGroup;
import com.sun.rave.web.ui.component.TextArea;
import db.AnalisesDataProvider;
import db.EstadosCorrecaoDataProvider;
import global.Global;
import java.util.ArrayList;
import javax.faces.FacesException;
import javax.faces.component.html.HtmlPanelGrid;
import javax.faces.event.ValueChangeEvent;
/**
* <p>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.</p>
*/
public class EnviarCorrecao extends AbstractPageBean {
// <editor-fold defaultstate="collapsed" desc="Managed Component Definition">
private int __placeholder;
/**
* <p>Automatically managed component initialization. <strong>WARNING:</strong>
* This method is automatically generated, so any user-specified code inserted
* here is subject to being replaced.</p>
*/
private void _init() throws Exception {
}
private Page page1 = new Page();
public Page getPage1() {
return page1;
}
public void setPage1(Page p) {
this.page1 = p;
}
private Html html1 = new Html();
public Html getHtml1() {
return html1;
}
public void setHtml1(Html h) {
this.html1 = h;
}
private Head head1 = new Head();
public Head getHead1() {
return head1;
}
public void setHead1(Head h) {
this.head1 = h;
}
private Link link1 = new Link();
public Link getLink1() {
return link1;
}
public void setLink1(Link l) {
this.link1 = l;
}
private Body body1 = new Body();
public Body getBody1() {
return body1;
}
public void setBody1(Body b) {
this.body1 = b;
}
private Form form1 = new Form();
public Form getForm1() {
return form1;
}
public void setForm1(Form f) {
this.form1 = f;
}
private HtmlPanelGrid gridBase1 = new HtmlPanelGrid();
public HtmlPanelGrid getGridBase1() {
return gridBase1;
}
public void setGridBase1(HtmlPanelGrid hpg) {
this.gridBase1 = hpg;
}
private HtmlPanelGrid gridLayout1 = new HtmlPanelGrid();
public HtmlPanelGrid getGridLayout1() {
return gridLayout1;
}
public void setGridLayout1(HtmlPanelGrid hpg) {
this.gridLayout1 = hpg;
}
private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid();
public HtmlPanelGrid getGridPanel1() {
return gridPanel1;
}
public void setGridPanel1(HtmlPanelGrid hpg) {
this.gridPanel1 = hpg;
}
private PanelGroup groupPanel1 = new PanelGroup();
public PanelGroup getGroupPanel1() {
return groupPanel1;
}
public void setGroupPanel1(PanelGroup pg) {
this.groupPanel1 = pg;
}
private ImageComponent image1 = new ImageComponent();
public ImageComponent getImage1() {
return image1;
}
public void setImage1(ImageComponent ic) {
this.image1 = ic;
}
private ImageComponent image2 = new ImageComponent();
public ImageComponent getImage2() {
return image2;
}
public void setImage2(ImageComponent ic) {
this.image2 = ic;
}
private PanelGroup groupPanel2 = new PanelGroup();
public PanelGroup getGroupPanel2() {
return groupPanel2;
}
public void setGroupPanel2(PanelGroup pg) {
this.groupPanel2 = pg;
}
private StaticText lblUser1 = new StaticText();
public StaticText getLblUser1() {
return lblUser1;
}
public void setLblUser1(StaticText st) {
this.lblUser1 = st;
}
private StaticText staticText1 = new StaticText();
public StaticText getStaticText1() {
return staticText1;
}
public void setStaticText1(StaticText st) {
this.staticText1 = st;
}
private Hyperlink lnkEditUser1 = new Hyperlink();
public Hyperlink getLnkEditUser1() {
return lnkEditUser1;
}
public void setLnkEditUser1(Hyperlink h) {
this.lnkEditUser1 = h;
}
private StaticText staticText2 = new StaticText();
public StaticText getStaticText2() {
return staticText2;
}
public void setStaticText2(StaticText st) {
this.staticText2 = st;
}
private Hyperlink lnkLogout1 = new Hyperlink();
public Hyperlink getLnkLogout1() {
return lnkLogout1;
}
public void setLnkLogout1(Hyperlink h) {
this.lnkLogout1 = h;
}
private HtmlPanelGrid gridLayoutTop1 = new HtmlPanelGrid();
public HtmlPanelGrid getGridLayoutTop1() {
return gridLayoutTop1;
}
public void setGridLayoutTop1(HtmlPanelGrid hpg) {
this.gridLayoutTop1 = hpg;
}
private HtmlPanelGrid gridPanel9 = new HtmlPanelGrid();
public HtmlPanelGrid getGridPanel9() {
return gridPanel9;
}
public void setGridPanel9(HtmlPanelGrid hpg) {
this.gridPanel9 = hpg;
}
private PanelGroup groupPanel8 = new PanelGroup();
public PanelGroup getGroupPanel8() {
return groupPanel8;
}
public void setGroupPanel8(PanelGroup pg) {
this.groupPanel8 = pg;
}
private StaticText staticText10 = new StaticText();
public StaticText getStaticText10() {
return staticText10;
}
public void setStaticText10(StaticText st) {
this.staticText10 = st;
}
private ImageComponent image3 = new ImageComponent();
public ImageComponent getImage3() {
return image3;
}
public void setImage3(ImageComponent ic) {
this.image3 = ic;
}
private StaticText staticText11 = new StaticText();
public StaticText getStaticText11() {
return staticText11;
}
public void setStaticText11(StaticText st) {
this.staticText11 = st;
}
private HtmlPanelGrid gridMain1 = new HtmlPanelGrid();
public HtmlPanelGrid getGridMain1() {
return gridMain1;
}
public void setGridMain1(HtmlPanelGrid hpg) {
this.gridMain1 = hpg;
}
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 StaticText staticText6 = new StaticText();
public StaticText getStaticText6() {
return staticText6;
}
public void setStaticText6(StaticText st) {
this.staticText6 = st;
}
private TextArea txtObservacoes = new TextArea();
public TextArea getTxtObservacoes() {
return txtObservacoes;
}
public void setTxtObservacoes(TextArea ta) {
this.txtObservacoes = ta;
}
private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid();
public HtmlPanelGrid getGridPanel2() {
return gridPanel2;
}
public void setGridPanel2(HtmlPanelGrid hpg) {
this.gridPanel2 = hpg;
}
private Button butCancelar = new Button();
public Button getButCancelar() {
return butCancelar;
}
public void setButCancelar(Button b) {
this.butCancelar = b;
}
private TableColumn tableColumn1 = new TableColumn();
public TableColumn getTableColumn1() {
return tableColumn1;
}
public void setTableColumn1(TableColumn tc) {
this.tableColumn1 = tc;
}
private Hyperlink lnkEstadoCorr = new Hyperlink();
public Hyperlink getLnkEstadoCorr() {
return lnkEstadoCorr;
}
public void setLnkEstadoCorr(Hyperlink h) {
this.lnkEstadoCorr = h;
}
private StaticText staticText3 = new StaticText();
public StaticText getStaticText3() {
return staticText3;
}
public void setStaticText3(StaticText st) {
this.staticText3 = st;
}
private Hyperlink lnkNewUser1 = new Hyperlink();
public Hyperlink getLnkNewUser1() {
return lnkNewUser1;
}
public void setLnkNewUser1(Hyperlink h) {
this.lnkNewUser1 = h;
}
private StaticText staticText4 = new StaticText();
public StaticText getStaticText4() {
return staticText4;
}
public void setStaticText4(StaticText st) {
this.staticText4 = st;
}
private Hyperlink lnkAnalisesAcidente = new Hyperlink();
public Hyperlink getLnkAnalisesAcidente() {
return lnkAnalisesAcidente;
}
public void setLnkAnalisesAcidente(Hyperlink h) {
this.lnkAnalisesAcidente = h;
}
private StaticText staticText5 = new StaticText();
public StaticText getStaticText5() {
return staticText5;
}
public void setStaticText5(StaticText st) {
this.staticText5 = st;
}
// </editor-fold>
/**
* <p>Construct a new Page bean instance.</p>
*/
public EnviarCorrecao() {
}
/**
* <p>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.</p>
*
* <p>Note that, if the current request is a postback, the property
* values of the components do <strong>not</strong> represent any
* values submitted with this request. Instead, they represent the
* property values that were saved for this view when it was rendered.</p>
*/
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
// <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
// Initialize automatically managed components
// *Note* - this logic should NOT be modified
try {
_init();
} catch (Exception e) {
log("EnviarCorrecao Initialization Failure", e);
throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
}
// </editor-fold>
// Perform application initialization that must complete
// *after* managed components are initialized
// TODO - add your own initialization code here
}
/**
* <p>Callback method that is called after the component tree has been
* restored, but before any event processing takes place. This method
* will <strong>only</strong> 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.</p>
*/
public void preprocess() {
}
/**
* <p>Callback method that is called just before rendering takes place.
* This method will <strong>only</strong> 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.</p>
*/
public void prerender() {
fillTabelaEstados();
}
/**
* <p>Callback method that is called after rendering is completed for
* this request, if <code>init()</code> was called (regardless of whether
* or not this was the page that was actually rendered). Customize this
* method to release resources acquired in the <code>init()</code>,
* <code>preprocess()</code>, or <code>prerender()</code> methods (or
* acquired during execution of an event handler).</p>
*/
public void destroy() {
}
/**
* <p>Return a reference to the scoped data bean.</p>
*/
protected SessionBean1 getSessionBean1() {
return (SessionBean1)getBean("SessionBean1");
}
/**
* <p>Return a reference to the scoped data bean.</p>
*/
protected RequestBean1 getRequestBean1() {
return (RequestBean1)getBean("RequestBean1");
}
/**
* <p>Return a reference to the scoped data bean.</p>
*/
protected ApplicationBean1 getApplicationBean1() {
return (ApplicationBean1)getBean("ApplicationBean1");
}
public String lnkEditUser_action() {
// TODO: Replace with your code
return null;
}
public String lnkLogout_action() {
// TODO: Replace with your code
try
{
javax.servlet.http.HttpSession session =
(javax.servlet.http.HttpSession) getExternalContext().getSession(true);
session.invalidate();
}
catch(Exception ex){}
try {
getExternalContext().redirect("Login.jsp");
} catch(Exception e) {}
//return "login";
return null;
}
public String lnkDataAcidente_action() {
// TODO: Replace with your code
return null;
}
public String lnkNr_action() {
// TODO: Replace with your code
return null;
}
public String lnkPor_action() {
// TODO: Replace with your code
return null;
}
public String lnkNomeAcidentado_action() {
// TODO: Replace with your code
return null;
}
public String lnkFase_action() {
// TODO: Replace with your code
return null;
}
public String lnkDataAcidenteSeg_action() {
// TODO: Replace with your code
return null;
}
public String lnkNrSeg_action() {
// TODO: Replace with your code
return null;
}
public String lnkPorSeg_action() {
// TODO: Replace with your code
return null;
}
public String lnkNomeAcidentadoSeg_action() {
// TODO: Replace with your code
return null;
}
public String lnkFaseSeg_action() {
// TODO: Replace with your code
return null;
}
public void drpAno_processValueChange(ValueChangeEvent event) {
// TODO: Replace with your code
}
public void drpMes_processValueChange(ValueChangeEvent event) {
// TODO: Replace with your code
}
public void drpDia_processValueChange(ValueChangeEvent event) {
// TODO: Replace with your code
}
public String butPesquisar_action() {
// TODO: Process the button click action. Return value is a navigation
// case name where null will return to the same page.
return null;
}
public String lnkDataConcluida_action() {
// TODO: Replace with your code
return null;
}
public String lnkNrConcluida_action() {
// TODO: Replace with your code
return null;
}
public String lnkPorConcluida_action() {
// TODO: Replace with your code
return null;
}
public String lnkNomeConcluida_action() {
// TODO: Replace with your code
return null;
}
public String lnkEstabConcluida_action() {
// TODO: Replace with your code
return null;
}
private void fillTabelaEstados()
{
ArrayList list = new ArrayList();
Correcao c = null;
int estado = getSessionBean1().getCurrentAnalise().getEstado().intValue();
switch(estado)
{
case Global.ESTADO_HS:
c = new Correcao();
c.setCorrecao("y");
c.setAnalise_id(getSessionBean1().getCurrentAnalise().getId());
c.setEstado_actual(getSessionBean1().getCurrentAnalise().getEstado());
c.setEstado_corr(new Integer(Global.ESTADO_SEG));
c.setDescricao("FASE 1 - SEG - ABERTURA");
list.add(c);
c = new Correcao();
c.setCorrecao("y");
c.setAnalise_id(getSessionBean1().getCurrentAnalise().getId());
c.setEstado_actual(getSessionBean1().getCurrentAnalise().getEstado());
c.setEstado_corr(new Integer(Global.ESTADO_RH1));
c.setDescricao("FASE 2 - RH - ACOMPANHAMENTO");
list.add(c);
getSessionBean1().getEstadosCorrecaoDataProvider().setList(list);
break;
case Global.ESTADO_CONSOLIDACAO:
c = new Correcao();
c.setCorrecao("y");
c.setAnalise_id(getSessionBean1().getCurrentAnalise().getId());
c.setEstado_actual(getSessionBean1().getCurrentAnalise().getEstado());
c.setEstado_corr(new Integer(Global.ESTADO_RH2));
c.setDescricao("FASE 4 - RH - MEDIDAS + LESÃO");
list.add(c);
// c = new Correcao();
// c.setCorrecao("y");
// c.setAnalise_id(getSessionBean1().getCurrentAnalise().getId());
// c.setEstado_actual(getSessionBean1().getCurrentAnalise().getEstado());
// c.setEstado_corr(new Integer(Global.ESTADO_MEDICINA));
// c.setDescricao("Medicina");
// list.add(c);
getSessionBean1().getEstadosCorrecaoDataProvider().setList(list);
break;
}
}
public String lnkEstadoCorr_action() {
// TODO: Replace with your code
RowKey rk = tableRowGroup1.getRowKey();
int k = Integer.parseInt(rk.getRowId());
EstadosCorrecaoDataProvider provider = (EstadosCorrecaoDataProvider) tableRowGroup1.getSourceData();
ArrayList list = (ArrayList) provider.getList();
Correcao c = (Correcao)list.get(k);
c.setObservacoes("");
if(txtObservacoes.getText() != null)
{
String obs = (String) txtObservacoes.getText();
c.setObservacoes(obs);
}
AnalisesDataProvider adp = new AnalisesDataProvider();
try
{
adp.changeEstado(c);
}
catch(Exception ex)
{
ex.printStackTrace();
}
return "form_hs";
}
public String lnkNewUser_action() {
// TODO: Replace with your code
return null;
}
public String butCancelar_action() {
// TODO: Process the button click action. Return value is a navigation
// case name where null will return to the same page.
//return "form_hs";
return "analise_acidente";
}
}