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

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

   public test.interfaces.AccountData getData()
   {
      test.interfaces.AccountData dataHolder = null;
      try
      {
         dataHolder = new test.interfaces.AccountData();

         dataHolder.setId( getId() );
         dataHolder.setOwner( getOwner() );
         dataHolder.setBalance( getBalance() );
         dataHolder.setLastModificationDate( getLastModificationDate() );
         dataHolder.setAccountId( getAccountId() );
         dataHolder.setCreationDate( getCreationDate() );

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

      return dataHolder;
   }

   public void setData( test.interfaces.AccountData dataHolder )
   {
      try
      {
         setOwner( dataHolder.getOwner() );
         setBalance( dataHolder.getBalance() );
         setLastModificationDate( dataHolder.getLastModificationDate() );
         setCreationDate( dataHolder.getCreationDate() );

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

   public void ejbLoad() throws javax.ejb.EJBException
   {
      super.ejbLoad();
   }

   public void ejbStore() throws javax.ejb.EJBException
   {
         super.ejbStore();
   }

   public void ejbActivate() throws javax.ejb.EJBException
   {
      super.ejbActivate();
   }

   public void ejbPassivate() throws javax.ejb.EJBException
   {
      super.ejbPassivate();

      AccountValue = null;
   }

   public void setEntityContext(javax.ejb.EntityContext ctx) throws javax.ejb.EJBException
   {
      super.setEntityContext(ctx);
   }

   public void unsetEntityContext() throws javax.ejb.EJBException
   {
      super.unsetEntityContext();
   }

   public void ejbRemove() throws javax.ejb.EJBException, javax.ejb.RemoveException
   {
      super.ejbRemove();

   }

 /* Value Objects BEGIN */

   private test.interfaces.AccountValue AccountValue = null;

   public test.interfaces.AccountValue getAccountValue()
   {
      AccountValue = new test.interfaces.AccountValue();
      try
         {
            AccountValue.setId( getId() );
            AccountValue.setBalance( getBalance() );
            if ( getOwner() != null )
               AccountValue.setOwnerNormalValue( getOwner().getCustomerNormalValue() );

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

	  return AccountValue;
   }

   public void setAccountValue( test.interfaces.AccountValue valueHolder )
   {

	  try
	  {
		 setBalance( valueHolder.getBalance() );

	  {
       // Checks for null aggregate
       if (valueHolder.getOwnerNormalValue() != null)
       {
		 test.interfaces.CustomerPK pk = new test.interfaces.CustomerPK(valueHolder.getOwnerNormalValue().getId());

		 test.interfaces.CustomerHome home = test.interfaces.CustomerUtil.getHome();

		 test.interfaces.Customer relation = home.findByPrimaryKey(pk);
		 setOwner(relation);
        } else {
         setOwner(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 test.interfaces.Customer getOwner() ;

   public abstract void setOwner( test.interfaces.Customer owner ) ;

   public abstract float getBalance() ;

   public abstract void setBalance( float balance ) ;

   public abstract java.util.Date getLastModificationDate() ;

   public abstract void setLastModificationDate( java.util.Date lastModificationDate ) ;

   public abstract java.lang.String getAccountId() ;

   public abstract void setAccountId( java.lang.String accountId ) ;

   public abstract java.util.Date getCreationDate() ;

   public abstract void setCreationDate( java.util.Date creationDate ) ;

}
