/*
 * Generated by XDoclet - Do not edit!
 */
package test.ejb.cmr;

/**
 * CMP layer for Employee.
 * @xdoclet-generated at 16-04-05
 * @copyright The XDoclet Team
 * @author XDoclet
 * @version 1.2.3
 */
public abstract class EmployeeCMP
   extends test.ejb.cmr.EmployeeBean
   implements javax.ejb.EntityBean
{

   public test.ejb.cmr.EmployeeData getData()
   {
      test.ejb.cmr.EmployeeData dataHolder = null;
      try
      {
         dataHolder = new test.ejb.cmr.EmployeeData();

         dataHolder.setId( getId() );
         dataHolder.setName( getName() );

      }
      catch (RuntimeException e)
      {
         throw new javax.ejb.EJBException(e);
      }

      return dataHolder;
   }

   /**
    * Generated ejbPostCreate for corresponding ejbCreate method.
    *
    * @see #ejbCreate(test.ejb.cmr.EmployeeValue ev)
    */
   public void ejbPostCreate(test.ejb.cmr.EmployeeValue ev)
   {
   }

   public void ejbLoad() 
   {
   }

   public void ejbStore() 
   {
   }

   public void ejbActivate() 
   {
   }

   public void ejbPassivate() 
   {

      EmployeeValue = null;
   }

   public void setEntityContext(javax.ejb.EntityContext ctx) 
   {
   }

   public void unsetEntityContext() 
   {
   }

   public void ejbRemove() throws javax.ejb.RemoveException
   {

   }

 /* Value Objects BEGIN */

   private test.ejb.cmr.EmployeeValue EmployeeValue = null;

   public test.ejb.cmr.EmployeeValue getEmployeeValue()
   {
      EmployeeValue = new test.ejb.cmr.EmployeeValue();
      try
         {
            EmployeeValue.setId( getId() );
            EmployeeValue.setName( getName() );
            if ( getHomeAddress() != null )
               EmployeeValue.setHomeAddress( getHomeAddress().getEmployeeAddressValue() );
            if ( getWorkAddress() != null )
               EmployeeValue.setWorkAddress( getWorkAddress().getEmployeeAddressValue() );

         }
         catch (Exception e)
         {
            throw new javax.ejb.EJBException(e);
         }

	  return EmployeeValue;
   }

   public void setEmployeeValue( test.ejb.cmr.EmployeeValue valueHolder )
   {

	  try
	  {
		 setName( valueHolder.getName() );

	  {
       // Checks for null aggregate
       if (valueHolder.getHomeAddress() != null)
       {
		 java.lang.Integer pk = valueHolder.getHomeAddress().getId();

		 test.ejb.cmr.EmployeeAddressLocalHome home = test.ejb.cmr.EmployeeAddressUtil.getLocalHome();

		 test.ejb.cmr.EmployeeAddressLocal relation = home.findByPrimaryKey(pk);
		 setHomeAddress(relation);
        } else {
         setHomeAddress(null);
        }
	  }
	  {
       // Checks for null aggregate
       if (valueHolder.getWorkAddress() != null)
       {
		 java.lang.Integer pk = valueHolder.getWorkAddress().getId();

		 test.ejb.cmr.EmployeeAddressLocalHome home = test.ejb.cmr.EmployeeAddressUtil.getLocalHome();

		 test.ejb.cmr.EmployeeAddressLocal relation = home.findByPrimaryKey(pk);
		 setWorkAddress(relation);
        } else {
         setWorkAddress(null);
        }
	  }
	  }
	  catch (Exception e)
	  {
		 throw new javax.ejb.EJBException(e);
	  }
   }

/* Value Objects END */

   public abstract java.lang.Integer getId() ;

   public abstract void setId( java.lang.Integer id ) ;

   public abstract java.lang.String getName() ;

   public abstract void setName( java.lang.String name ) ;

}
