/*
 * Generated by XDoclet - Do not edit!
 */
package org.jboss.test.cmp2.fkmapping.ejb;

/**
 * Primary key for Department.
 */
public class DepartmentPK
   extends java.lang.Object
   implements java.io.Serializable
{
   private int _hashCode = 0;
   private StringBuffer _toStringValue = null;

   public java.lang.String departmentCode;
   public java.lang.String departmentCode2;

   public DepartmentPK()
   {
   }

   public DepartmentPK( java.lang.String departmentCode,java.lang.String departmentCode2 )
   {
      this.departmentCode = departmentCode;
      this.departmentCode2 = departmentCode2;
   }

   public java.lang.String getDepartmentCode()
   {
      return departmentCode;
   }
   public java.lang.String getDepartmentCode2()
   {
      return departmentCode2;
   }

   public void setDepartmentCode(java.lang.String departmentCode)
   {
      this.departmentCode = departmentCode;
      _hashCode = 0;
   }
   public void setDepartmentCode2(java.lang.String departmentCode2)
   {
      this.departmentCode2 = departmentCode2;
      _hashCode = 0;
   }

   public int hashCode()
   {
      if( _hashCode == 0 )
      {
         if (this.departmentCode != null) _hashCode += this.departmentCode.hashCode();
         if (this.departmentCode2 != null) _hashCode += this.departmentCode2.hashCode();
      }

      return _hashCode;
   }

   public boolean equals(Object obj)
   {
      if( !(obj instanceof org.jboss.test.cmp2.fkmapping.ejb.DepartmentPK) )
         return false;

      org.jboss.test.cmp2.fkmapping.ejb.DepartmentPK pk = (org.jboss.test.cmp2.fkmapping.ejb.DepartmentPK)obj;
      boolean eq = true;

      if( obj == null )
      {
         eq = false;
      }
      else
      {
         if( this.departmentCode == null && ((org.jboss.test.cmp2.fkmapping.ejb.DepartmentPK)obj).getDepartmentCode() == null )
         {
            eq = true;
         }
         else
         {
            if( this.departmentCode == null || ((org.jboss.test.cmp2.fkmapping.ejb.DepartmentPK)obj).getDepartmentCode() == null )
            {
               eq = false;
            }
            else
            {
               eq = eq && this.departmentCode.equals( pk.departmentCode );
            }
         }
         if( this.departmentCode2 == null && ((org.jboss.test.cmp2.fkmapping.ejb.DepartmentPK)obj).getDepartmentCode2() == null )
         {
            eq = true;
         }
         else
         {
            if( this.departmentCode2 == null || ((org.jboss.test.cmp2.fkmapping.ejb.DepartmentPK)obj).getDepartmentCode2() == null )
            {
               eq = false;
            }
            else
            {
               eq = eq && this.departmentCode2.equals( pk.departmentCode2 );
            }
         }
      }

      return eq;
   }

   /** @return String representation of this pk in the form of [.field1.field2.field3]. */
   public String toString()
   {
      if( _toStringValue == null )
      {
         _toStringValue = new StringBuffer("[.");
         _toStringValue.append(this.departmentCode).append('.');
         _toStringValue.append(this.departmentCode2).append('.');
         _toStringValue.append(']');
      }

      return _toStringValue.toString();
   }

}
