package m05bSancionesEJB;

import javax.ejb.CreateException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;

import m05bBD.m05bSanciones;

/**
 * This class is the Bean Implementation for the Entity EJB <tt>M05SancionesEB</tt>.
 *
 * @see     m05.exe.Sanciones
 * @see     m05.exe.M05SancionesEB
 * @see     m05.exe.M05SancionesEBPK
 * @see     m05.exe.M05SancionesEBHome

 */
abstract public class m05SancionesBean implements EntityBean{

  private EntityContext ctx;



  /**
   * This is the primary key.
   * It is the clave, which is the primary key
   * in table <tt>m0545t00</tt>.
   */

  /**
   * Returns the Sanciones information of this E-EJB.
   */
  public m05bSanciones getSanciones(){
    m05bSanciones sancion = new m05bSanciones();

    sancion.setSan_codigo(getSan_codigo());
    sancion.setSan_matricula(getSan_matricula());
    sancion.setSan_tipo(getSan_tipo());
    sancion.setSan_codorg(getSan_codorg());
    sancion.setSan_dni(getSan_dni());
    sancion.setSan_fnotcon(getSan_fnotcon());
    sancion.setSan_descorg(getSan_descorg());
    sancion.setSan_frecep(getSan_frecep());
    sancion.setSan_fdenuncia(getSan_fdenuncia());
    sancion.setSan_frecdatos(getSan_frecdatos());
    sancion.setSan_nexdenuncia(getSan_nexdenuncia());
    sancion.setSan_fsancion(getSan_fsancion());
    sancion.setSan_nexsancion(getSan_nexsancion());
    sancion.setSan_fnotdatos(getSan_fnotdatos());
    sancion.setSan_fresolucion(getSan_fresolucion());
    sancion.setSan_fapremio(getSan_fapremio());




    return sancion;
  }

  /**
   * Sets the Sanciones information of this E-EJB.
   * @exception P2GException
   *              If the given Sanciones <tt>tas_codigo</tt> field
   *              does not match the primary key that is in the E-EJB.
   */
  public void setSanciones(m05bSanciones sancion)
    throws Exception{

    //the primary key is never modified!!
    if (getSan_codigo() != sancion.getSan_codigo() )
      throw new CreateException ("Cannot modify a different sancion");

    setSan_matricula(sancion.getSan_matricula());
    setSan_codigo (sancion.getSan_codigo());
    setSan_tipo(sancion.getSan_tipo());
    setSan_codorg(sancion.getSan_codorg());
    setSan_dni(sancion.getSan_dni());
    setSan_fnotcon(sancion.getSan_fnotcon());
    setSan_descorg(sancion.getSan_descorg());
    setSan_frecep(sancion.getSan_frecep());
    setSan_fdenuncia(sancion.getSan_fdenuncia());
    setSan_frecdatos(sancion.getSan_frecdatos());
    setSan_nexdenuncia(sancion.getSan_nexdenuncia());
    setSan_fsancion(sancion.getSan_fsancion());
    setSan_nexsancion(sancion.getSan_nexsancion());
    setSan_fnotdatos(sancion.getSan_fnotdatos());
    setSan_fresolucion(sancion.getSan_fresolucion());
    setSan_fapremio(sancion.getSan_fapremio());
  }


  abstract public String getSan_matricula();
  abstract public void setSan_matricula(String n);

  abstract public String getSan_codigo();
  abstract public void setSan_codigo(String n);

  abstract public String getSan_tipo();
  abstract public void setSan_tipo(String n);

  abstract public String getSan_codorg();
  abstract public void setSan_codorg(String n);

  abstract public String getSan_dni();
  abstract public void setSan_dni(String n);

  abstract public String getSan_fnotcon();
  abstract public void setSan_fnotcon(String n);

  abstract public String getSan_descorg();
  abstract public void setSan_descorg(String n);

  abstract public String getSan_nexsancion();
  abstract public void setSan_nexsancion(String n);

  abstract public String getSan_fsancion();
  abstract public void setSan_fsancion(String n);

  abstract public String getSan_fdenuncia();
  abstract public void setSan_fdenuncia(String n);

  abstract public String getSan_frecep();
  abstract public void setSan_frecep(String n);

  abstract public String getSan_frecdatos();
  abstract public void setSan_frecdatos(String n);

  abstract public String getSan_nexdenuncia();
  abstract public void setSan_nexdenuncia(String n);

  abstract public String getSan_fnotdatos();
  abstract public void setSan_fnotdatos(String n);

  abstract public String getSan_fresolucion();
  abstract public void setSan_fresolucion(String n);

  abstract public String getSan_fapremio();
  abstract public void setSan_fapremio(String n);


  public void ejbActivate() {
  }

  public void ejbPassivate() {
  }

  public void setEntityContext(EntityContext ctx) {
    this.ctx = ctx;
  }

  public void unsetEntityContext() {
    this.ctx = null;
  }

  public void ejbLoad() {
  }

  public void ejbStore() {
  }

  public void ejbRemove() throws RemoveException{}

  /**
   * This function initializes the Sanciones
   * information of this E-EJB.
   * It assigns a new primary key to the Sanciones.
   */
  public m05SancionesPK ejbCreate(m05bSanciones sancion)
    throws CreateException
  {
    try {
    setSan_codigo(sancion.getSan_codigo());
    } catch (Exception e) {
      throw new CreateException (e.getMessage());
    }
    setSan_matricula(sancion.getSan_matricula());
    setSan_fdenuncia(sancion.getSan_fdenuncia());
    setSan_fsancion(sancion.getSan_fsancion());
    setSan_nexsancion(sancion.getSan_nexsancion());
    setSan_fnotcon(sancion.getSan_fnotcon());
    setSan_tipo(sancion.getSan_tipo());
    setSan_codorg(sancion.getSan_codorg());
    setSan_dni(sancion.getSan_dni());
    setSan_descorg(sancion.getSan_descorg());
    setSan_frecep(sancion.getSan_frecep());
    setSan_frecdatos(sancion.getSan_frecdatos());
    setSan_nexdenuncia(sancion.getSan_nexdenuncia());
    setSan_fnotdatos(sancion.getSan_fnotdatos());
    setSan_fresolucion(sancion.getSan_fresolucion());
    setSan_fapremio(sancion.getSan_fapremio());
    
    return null;
  }

  public void ejbPostCreate(m05bSanciones sancion)  {
  }


}
