package examples.intro;

import javax.ejb.*;
import java.rmi.RemoteException;
import java.util.*;
import java.sql.Date;
/**
 *
 * @author Copyright (c) 2000 by BEA Systems, Inc. All Rights Reserved.
 */

public class EmpBean implements EntityBean {

  protected EntityContext entityContext;
    
  public int empno;
  public String ename;
  public String job;
  public int mgr;
  public Date hiredate;
  public double sal;
  public double comm;
  public int deptno;
    
  public EmpBeanPK ejbCreate(int v_empno, String v_ename, String v_job,
                        int v_mgr, Date v_hiredate, double v_sal, 
                        double v_comm, int v_deptno)
    throws EJBException, CreateException {
    empno = v_empno;
    ename = v_ename; 
    job = v_job;
    mgr = v_mgr;
    hiredate = v_hiredate;
    sal = v_sal;
    comm = v_comm;
    deptno = v_deptno;
    return new EmpBeanPK(empno);
  }

  public void ejbPostCreate(int v_empno, String v_ename, String v_job,
                            int v_mgr, Date v_hiredate, double v_sal, 
                            double v_comm, int v_deptno)
    throws EJBException
  {
    // do nothing
  }

  public void ejbActivate() throws EJBException {
    // do nothing
  }

  public void ejbLoad() throws EJBException {
    // do nothing
  }

  public void ejbPassivate() throws EJBException {
    // do nothing
  }

  public void ejbRemove() throws EJBException {
    // do nothing
  }

  public void ejbStore() throws EJBException {
    // do nothing
  }

  public void setEntityContext(EntityContext ctx) throws EJBException {
    entityContext = ctx;
  }

  public void unsetEntityContext() {
    entityContext=null;
  }

  public int getEmpno() throws EJBException, RemoteException {
    return empno;
  }

  public String getEname() throws EJBException, RemoteException {
    return ename;
  }

  public String getJob() throws EJBException, RemoteException {
    return job;
  }

  public int getMgr() throws EJBException, RemoteException {
    return mgr;
  }

  public Date getHiredate() throws EJBException, RemoteException {
    return hiredate;
  }

  public double getSal() throws EJBException, RemoteException {
    return sal;
  }

  public double getComm() throws EJBException, RemoteException {
    return comm;
  }

  public int getDeptno() throws EJBException, RemoteException {
    return deptno;
  }

  public void setEname(String newEname) throws EJBException, RemoteException {
    ename = newEname;
  }

  public void setJob(String newJob) throws EJBException, RemoteException {
    job = newJob;
  }

  public void setMgr(int newMgr) throws EJBException, RemoteException {
    mgr = newMgr;
  }

  public void setHiredate(Date newHiredate) throws EJBException, RemoteException {
    hiredate = newHiredate;
  }

  public void setSal(double newSal) throws EJBException, RemoteException {
    sal = newSal;
  }

  public void setComm(double newComm) throws EJBException, RemoteException {
    comm = newComm;
  }

  public void setDeptno(int newDeptno) throws EJBException, RemoteException {
    deptno = newDeptno;
  }

  public String htmlToPrint() throws EJBException, RemoteException {

    String work = "<tr>" + 
      "<td>" + getEmpno()     + "</td>" +
      "<td>" + getEname()    + "</td>" + 
      "<td>" + getJob()      + "</td>" + 
      "<td>" + getMgr()      + "</td>" +
      "<td>" + getHiredate() + "</td>" +
      "<td>" + getSal()      + "</td>" + 
      "<td>" + getComm()     + "</td>" +
      "<td>" + getDeptno()   + "</td></tr>";
    return work;

  }
      
      


}

