
package acciones;

import static com.opensymphony.xwork2.Action.INPUT;
import static com.opensymphony.xwork2.Action.SUCCESS;
import com.opensymphony.xwork2.ActionSupport;
import entidad.Trama;
import java.util.List;
import servicio.ServicioTrama;



public class TramaAction extends ActionSupport {

    private ServicioTrama st= new ServicioTrama();
    private List<Trama> lstTra;
    private Trama tra;
    private Integer noca;

    
    
    
    @Override
    public String input() throws Exception {
        if (getNoca()!=null) {
            setTra(st.find(noca));
        }
        return INPUT;
    }      

      public String detalle1() throws Exception {
        if (getNoca()!=null) {
            setTra(st.find(noca));
        }
       return INPUT;
    }  
   
          public String detalle2() throws Exception {
        if (getNoca()!=null) {
            setTra(st.find(noca));
          
        } 
       return INPUT;
    }  
    
    
    

    @Override
    public String execute() throws Exception {return SUCCESS;}
    public String save() {    st.save(getTra());     return "ok"; }  
    public String remove(){    st.remove(getNoca());    return "ok";    }
     
    public String list() throws Exception { lstTra=st.findAll();  return execute();}


    
    //<editor-fold defaultstate="collapsed" desc="Getter y Setter">  
    
    public ServicioTrama getSt() {return st; }   
    public void setSt(ServicioTrama sc) {this.st = sc;}

    public Integer getNoca() { return noca; }
    public void setNoca(Integer noca) {this.noca = noca;}
    
    public Trama getTra() {return tra;}
    public void setTra(Trama tra) { this.tra = tra; }
    
    public List<Trama> getLstTra() {return lstTra;}
    public void setLstTra(List<Trama> lstTra) {this.lstTra = lstTra;}
    
 
//</editor-fold>
}
