package m05bOrdReparaEJB;


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

import m05bBD.m05bOrdRepara;

/**
 * This class is the Bean Implementation for the Entity EJB <tt>M05OrdReparaEB</tt>.
 *
 * @see     m05.exe.OrdRepara
 * @see     m05.exe.M05OrdReparaEB
 * @see     m05.exe.M05OrdReparaEBPK
 * @see     m05.exe.M05OrdReparaEBHome

 */
abstract public class m05OrdReparaBean implements EntityBean {

  private EntityContext ctx;



  public m05bOrdRepara getOrdRepara(){
    m05bOrdRepara ordenesrepara = new m05bOrdRepara();

    ordenesrepara.setOrp_codigo(getOrp_codigo());
    ordenesrepara.setOrp_concepto(getOrp_concepto());
    ordenesrepara.setOrp_empleado(getOrp_empleado());
    ordenesrepara.setOrp_importe(getOrp_importe());
    ordenesrepara.setOrp_orden(getOrp_orden());
    ordenesrepara.setOrp_tiempo(getOrp_tiempo());

    return ordenesrepara;
  }

  /**
   * Sets the OrdenesRepara information of this E-EJB.
   * @exception P2GException
   *              If the given OrdenesRepara <tt>orp_codigo</tt> field
   *              does not match the primary key that is in the E-EJB.
   */
  public void setOrdRepara(m05bOrdRepara ordenesrepara)
    throws Exception{

    //the primary key is never modified!!
    if (!(getOrp_codigo() == ordenesrepara.getOrp_codigo() && getOrp_orden() == ordenesrepara.getOrp_orden()) )
      throw new CreateException ("Cannot modify a different modelo");


    setOrp_concepto(ordenesrepara.getOrp_concepto());
    setOrp_empleado(ordenesrepara.getOrp_empleado());
    setOrp_importe(ordenesrepara.getOrp_importe());
    setOrp_codigo(ordenesrepara.getOrp_codigo());
    setOrp_tiempo(ordenesrepara.getOrp_tiempo());

  }

  abstract public String getOrp_codigo();
  abstract public void setOrp_codigo(String n);

  abstract public String getOrp_orden();
  abstract public void setOrp_orden(String n);

  abstract public String getOrp_importe();
  abstract public void setOrp_importe(String n);

  abstract public String getOrp_concepto();
  abstract public void setOrp_concepto(String n);

  abstract public String getOrp_empleado();
  abstract public void setOrp_empleado(String n);

  abstract public String getOrp_tiempo();
  abstract public void setOrp_tiempo(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 OrdRepara
   * information of this E-EJB.
   * It assigns a new primary key to the OrdRepara.
   * @see #getNewOrderNum()
   */
  public m05OrdReparaPK ejbCreate(m05bOrdRepara ordenesrepara)
    throws CreateException
  {
    try {
      setOrp_codigo(ordenesrepara.getOrp_codigo());
      setOrp_orden(ordenesrepara.getOrp_orden());
    } catch (Exception e) {
      throw new CreateException (e.getMessage());
    }
    setOrp_concepto(ordenesrepara.getOrp_concepto());
    setOrp_empleado(ordenesrepara.getOrp_empleado());
    setOrp_importe(ordenesrepara.getOrp_importe());
    setOrp_tiempo(ordenesrepara.getOrp_tiempo());

    return null;
  }

  public void ejbPostCreate(m05bOrdRepara ordenesrepara)
  {
  }


}
