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

/**
 * Primary key for Group.
 */
public class GroupPK
   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 long groupNumber;

   public GroupPK()
   {
   }

   public GroupPK( java.lang.String departmentCode,java.lang.String departmentCode2,long groupNumber )
   {
      this.departmentCode = departmentCode;
      this.departmentCode2 = departmentCode2;
      this.groupNumber = groupNumber;
   }

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

   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 void setGroupNumber(long groupNumber)
   {
      this.groupNumber = groupNumber;
      _hashCode = 0;
   }

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

      return _hashCode;
   }

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

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

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

      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(this.groupNumber).append('.');
         _toStringValue.append(']');
      }

      return _toStringValue.toString();
   }

}
