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

/**
 * Data object for Customer.
 * @xdoclet-generated at 16-04-05
 * @copyright The XDoclet Team
 * @author XDoclet
 * @version 1.2.3
 */
public class CustomerData
   extends test.interfaces.PersonData
   implements java.io.Serializable
{
   private float credit;
   private java.lang.String[][] array;
   private byte[] image;
   private float tax;

  /* begin value object */
   private test.interfaces.CustomerLightValue CustomerLightValue = null;

   public test.interfaces.CustomerLightValue getCustomerLightValue()
   {
	  if( CustomerLightValue == null )
	  {
          CustomerLightValue = new test.interfaces.CustomerLightValue();
	  }
      try
         {
            CustomerLightValue.setCredit( getCredit() );
            CustomerLightValue.setId( getId() );
                   }
         catch (Exception e)
         {
            throw new javax.ejb.EJBException(e);
         }

	  return CustomerLightValue;
   }
   private test.interfaces.CustomerNormalValue CustomerNormalValue = null;

   public test.interfaces.CustomerNormalValue getCustomerNormalValue()
   {
	  if( CustomerNormalValue == null )
	  {
          CustomerNormalValue = new test.interfaces.CustomerNormalValue();
	  }
      try
         {
            CustomerNormalValue.setCredit( getCredit() );
            CustomerNormalValue.setId( getId() );
            CustomerNormalValue.setName( getName() );
            CustomerNormalValue.setFirstName( getFirstName() );
                   }
         catch (Exception e)
         {
            throw new javax.ejb.EJBException(e);
         }

	  return CustomerNormalValue;
   }
   private test.interfaces.CustomerValue CustomerValue = null;

   public test.interfaces.CustomerValue getCustomerValue()
   {
	  if( CustomerValue == null )
	  {
          CustomerValue = new test.interfaces.CustomerValue();
	  }
      try
         {
            CustomerValue.setCredit( getCredit() );
            CustomerValue.setId( getId() );
            CustomerValue.setName( getName() );
            CustomerValue.setFirstName( getFirstName() );
            CustomerValue.setPhone( getPhone() );
            CustomerValue.setFax( getFax() );
                   }
         catch (Exception e)
         {
            throw new javax.ejb.EJBException(e);
         }

	  return CustomerValue;
   }

   public void setCustomerNormalValue( test.interfaces.CustomerNormalValue valueHolder )
   throws test.interfaces.ApplicationException{
	  if( getVersion() != valueHolder.getVersion() )
		 throw new IllegalStateException( "Wrong version. Had " + getVersion() + ", got " + valueHolder.getVersion() );

	  try
	  {
		 setCredit( valueHolder.getCredit() );
		 setName( valueHolder.getName() );
		 setFirstName( valueHolder.getFirstName() );
	  }
	  catch (Exception e)
	  {
		 throw new javax.ejb.EJBException(e);
	  }
   }

  /* end value object */

   private long _version = 0;

   public CustomerData()
   {
   }

   public CustomerData( float credit,java.lang.String[][] array,byte[] image,float tax,java.lang.String id,java.lang.String name,java.lang.String firstName,java.lang.String phone,java.lang.String fax,java.util.Date creationDate )
   {
      setCredit(credit);
      this.array = array;
      this.image = image;
      this.tax = tax;
      setId(id);
      setName(name);
      setFirstName(firstName);
      setPhone(phone);
      setFax(fax);
      setCreationDate(creationDate);
   }

   public CustomerData( CustomerData otherData )
   {
      setCredit(otherData.getCredit());
      this.array = otherData.array;
      this.image = otherData.image;
      this.tax = otherData.tax;
      setId(otherData.getId());
      setName(otherData.getName());
      setFirstName(otherData.getFirstName());
      setPhone(otherData.getPhone());
      setFax(otherData.getFax());
      setCreationDate(otherData.getCreationDate());

   }

   public test.interfaces.CustomerPK getPrimaryKey() {
     test.interfaces.CustomerPK pk = new test.interfaces.CustomerPK(this.getId());
     return pk;
   }

   public float getCredit()
   {
      return this.credit;
   }
   public void setCredit( float credit )
   {
      this.credit = credit;
   }

   public java.lang.String[][] getArray()
   {
      return this.array;
   }
   public void setArray( java.lang.String[][] array )
   {
      this.array = array;
   }

   public byte[] getImage()
   {
      return this.image;
   }
   public void setImage( byte[] image )
   {
      this.image = image;
   }

   public float getTax()
   {
      return this.tax;
   }
   public void setTax( float tax )
   {
      this.tax = tax;
   }

   public long getVersion()
   {
      return _version;
   }

   public void setVersion(long version)
   {
      this._version = version;
   }

   public String toString()
   {
      StringBuffer str = new StringBuffer("{");

      str.append("credit=" + getCredit() + " " + "array=" + getArray() + " " + "image=" + getImage() + " " + "tax=" + getTax() + " " + "id=" + getId() + " " + "name=" + getName() + " " + "firstName=" + getFirstName() + " " + "phone=" + getPhone() + " " + "fax=" + getFax() + " " + "creationDate=" + getCreationDate());
      str.append(",version=");
      str.append(_version);
      str.append('}');

      return(str.toString());
   }

   public boolean equals( Object pOther )
   {
      if (!super.equals(pOther)) return false;
      if( pOther instanceof CustomerData )
      {
         CustomerData lTest = (CustomerData) pOther;
         boolean lEquals = true;

         lEquals = lEquals && this.credit == lTest.credit;
         if( this.array == null )
         {
            lEquals = lEquals && ( lTest.array == null );
         }
         else
         {
            lEquals = lEquals && this.array.equals( lTest.array );
         }
         lEquals = lEquals && this.image == lTest.image;
         lEquals = lEquals && this.tax == lTest.tax;

         return lEquals;
      }
      else
      {
         return false;
      }
   }

   public int hashCode()
   {
      int result = super.hashCode();

      result = 37*result + Float.floatToIntBits(credit);

      result = 37*result + ((this.array != null) ? this.array.hashCode() : 0);

      if (image != null) {
        for (int i=0; i<image.length; i++)
        {
          long l = image[i];
          result = 37*result + (int)(l^(l>>>32));
        }
      }

      result = 37*result + Float.floatToIntBits(tax);

      return result;
   }

}
