package gov.va.med.cds.tools.cleanup.errorq;



/**
 * This class holds the data that make each entry point record unique
 */
public class EntityIdentifier
{
    public String identity;
    public String namespaceId;
    public String universalId;
    public String universalIdType;


    /**
     * @return the identity
     * @generated "UML to Java V5.0 (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
     */
    public String getIdentity( )
    {
        // begin-user-code
        return identity;
        // end-user-code
    }


    /**
     * @param theIdentity the identity to set
     * @generated "UML to Java V5.0 (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
     */
    public void setIdentity( String theIdentity )
    {
        // begin-user-code
        identity = theIdentity;
        // end-user-code
    }


    /**
     * @return the namespaceId
     * @generated "UML to Java V5.0 (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
     */
    public String getNamespaceId( )
    {
        // begin-user-code
        return namespaceId;
        // end-user-code
    }


    /**
     * @param theNamespaceId the namespaceId to set
     * @generated "UML to Java V5.0 (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
     */
    public void setNamespaceId( String theNamespaceId )
    {
        // begin-user-code
        namespaceId = theNamespaceId;
        // end-user-code
    }


    /**
     * @return the universalId
     * @generated "UML to Java V5.0 (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
     */
    public String getUniversalId( )
    {
        // begin-user-code
        return universalId;
        // end-user-code
    }


    /**
     * @param theUniversalId the universalId to set
     * @generated "UML to Java V5.0 (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
     */
    public void setUniversalId( String theUniversalId )
    {
        // begin-user-code
        universalId = theUniversalId;
        // end-user-code
    }


    /**
     * @return the universalIdType
     * @generated "UML to Java V5.0 (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
     */
    public String getUniversalIdType( )
    {
        // begin-user-code
        return universalIdType;
        // end-user-code
    }


    /**
     * @param theUniversalIdType the universalIdType to set
     * @generated "UML to Java V5.0 (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
     */
    public void setUniversalIdType( String theUniversalIdType )
    {
        // begin-user-code
        universalIdType = theUniversalIdType;
        // end-user-code
    }


    /** 
     * @return a hashcode calculated based on each field in this object
     */
    public int hashCode( )
    {
        long entityIdentifierHashCode = ( identity == null ) ? 0 : identity.hashCode();
        long namespaceIdHashCode = ( namespaceId == null ) ? 0 : namespaceId.hashCode() * 21L;
        long universalIdHashCode = ( universalId == null ) ? 0 : universalId.hashCode() * 103L;
        long universalIdTypeHashCode = ( universalIdType == null ) ? 0 : universalIdType.hashCode() * 1117L;
        long hashCode = entityIdentifierHashCode + namespaceIdHashCode + universalIdHashCode + universalIdTypeHashCode;

        return ( int )hashCode;
    }


    /** 
     * @param aObject the object to test equivalence with
     * @return true with equal false otherwise
     */
    public boolean equals( Object aObject )
    {
        boolean returnValue = false;
        EntityIdentifier entityIdentifier = null;

        if ( aObject instanceof EntityIdentifier )
        {
            entityIdentifier = ( EntityIdentifier )aObject;
            boolean identityEquals = false;
            boolean namespaceIdEquals = false;
            boolean universalIdEquals = false;
            boolean universalIdTypeEquals = false;

            if ( identity != null )
            {
                identityEquals = identity.equals( entityIdentifier.getIdentity() );
            }
            else if ( entityIdentifier.getIdentity() == null )
            {
                identityEquals = true;
            }

            if ( namespaceId != null )
            {
                namespaceIdEquals = namespaceId.equals( entityIdentifier.getNamespaceId() );
            }
            else if ( entityIdentifier.getNamespaceId() == null )
            {
                namespaceIdEquals = true;
            }

            if ( universalId != null )
            {
                universalIdEquals = universalId.equals( entityIdentifier.getUniversalId() );
            }
            else if ( entityIdentifier.getUniversalId() == null )
            {
                universalIdEquals = true;
            }

            if ( universalIdType != null )
            {
                universalIdTypeEquals = universalIdType.equals( entityIdentifier.getUniversalIdType() );
            }
            else if ( entityIdentifier.getUniversalIdType() == null )
            {
                universalIdTypeEquals = true;
            }

            returnValue = identityEquals && namespaceIdEquals && universalIdEquals && universalIdTypeEquals;
        }

        return returnValue;
    }
}
