/*
 * WARNING: DO NOT EDIT THIS FILE. This is a generated file that is synchronized
 * by MyEclipse Hibernate tool integration.
 *
 * Created Fri Sep 17 13:48:01 CDT 2004 by MyEclipse Hibernate Tool.
 */
package gov.va.med.esr.common.model.comms;

/**
 * A class that represents a row in the COMMS_PRIT_REQUEST table. 
 * You can customize the behavior of this class by editing the class, {@link CommsPrintRequest()}.
 * WARNING: DO NOT EDIT THIS FILE. This is a generated file that is synchronized * by MyEclipse Hibernate tool integration.
 */

import gov.va.med.fw.model.AbstractKeyedEntity;

public class AacLetterRequest 
    extends AbstractKeyedEntity
{
	/**
	 * 
	 */
	private static final long serialVersionUID = -1345213095749729817L;
	public static final String DUPE_CHECK_DELIMITER = ":";
	public static final String VETERAN_LETTER = "V";
	public static final String SPOUSE_LETTER = "S";
	private static final String SPOUSE_LETTER_SUFFIX = DUPE_CHECK_DELIMITER + SPOUSE_LETTER;
	public static final String DEPENDENT_LETTER = "D";
	private static final String DEPENDENT_LETTER_SUFFIX = DUPE_CHECK_DELIMITER + DEPENDENT_LETTER;
	
    /** The cached hash code value for this instance.  Settting to 0 triggers re-calculation. */
    private int hashValue = 0;

    /** The value of the commsLog association. */
    private CommsLogEntry commsLogEntry;

    /** The value of the simple commsPrintRequestDupeCheck property. This is a hack.  */
    private String commsPrintRequestDupeCheck;

    /** The value of the simple commsTemplateFormId property. */
    private String commsTemplateFormNumber;

    /** The value of the simple commsPrintRequestXml property. */
    private String commsPrintRequestXml;

    public boolean isVeteranLetter() {
    	boolean result = true;
    	if(commsPrintRequestDupeCheck != null && (commsPrintRequestDupeCheck.endsWith(SPOUSE_LETTER_SUFFIX) ||
    			commsPrintRequestDupeCheck.endsWith(DEPENDENT_LETTER_SUFFIX)))
    			result = false;
    	return result;
    }
    
    public boolean isSpouseLetter() {
    	return commsPrintRequestDupeCheck != null && commsPrintRequestDupeCheck.endsWith(SPOUSE_LETTER_SUFFIX);
    }

    public boolean isDependentLetter() {
    	return commsPrintRequestDupeCheck != null && commsPrintRequestDupeCheck.endsWith(DEPENDENT_LETTER_SUFFIX);
    }
    
 
    /**
     * Simple constructor of AbstractCommsPrintRequest instances.
     */
    public AacLetterRequest()
    {
    }

    /**
     * Return the value of the COMMS_LOG_IDENTIFIER column.
     * @return CommsLog
     */
    public CommsLogEntry getCommsLogEntry()
    {
        return this.commsLogEntry;
    }

    /**
     * Set the value of the COMMS_LOG_IDENTIFIER column.
     * @param commsLog
     */
    public void setCommsLogEntry(CommsLogEntry commsLogEntry)
    {
        this.commsLogEntry = commsLogEntry;
    }


    /**
     * Return the value of the COMMS_PRINT_REQUEST_DUPE_CHECK column.
     * @return java.lang.String
     */
    public String getCommsPrintRequestDupeCheck()
    {
        return this.commsPrintRequestDupeCheck;
    }

    /**
     * Set the value of the COMMS_PRINT_REQUEST_DUPE_CHECK column.
     * @param commsPrintRequestDupeCheck
     */
    public void setCommsPrintRequestDupeCheck(String commsPrintRequestDupeCheck)
    {
        this.commsPrintRequestDupeCheck = commsPrintRequestDupeCheck;
    }

    /**


    /**
     * Return the value of the COMMS_TEMPLATE_FORM_ID column.
     * @return java.lang.String
     */
    public String getCommsTemplateFormNumber()
    {
        return this.commsTemplateFormNumber;
    }

    /**
     * Set the value of the COMMS_TEMPLATE_FORM_ID column.
     * @param commsTemplateFormId
     */
    public void setCommsTemplateFormNumber(String commsTemplateFormNumber)
    {
        this.commsTemplateFormNumber = commsTemplateFormNumber;
    }

    /**
     * Return the value of the COMMS_PRINT_REQUEST_XML column.
     * @return java.lang.String
     */
    public String getCommsPrintRequestXml()
    {
        return this.commsPrintRequestXml;
    }

    /**
     * Set the value of the COMMS_PRINT_REQUEST_XML column.
     * @param commsPrintRequestXml
     */
    public void setCommsPrintRequestXml(String commsPrintRequestXml)
    {
        this.commsPrintRequestXml = commsPrintRequestXml;
    }

    /**
     * Implementation of the equals comparison on the basis of equality of the primary key values.
     * @param rhs
     * @return boolean
     */
    public boolean equals(Object rhs)
    {
        if (rhs == null)
            return false;
        if (! (rhs instanceof AacLetterRequest))
            return false;
        AacLetterRequest that = (AacLetterRequest) rhs;
        if (this.getIdentifier() != null && that.getIdentifier() != null)
        {
            if (! this.getIdentifier().equals(that.getIdentifier()))
            {
                return false;
            }
        }
        return true;
    }

    /**
     * Implementation of the hashCode method conforming to the Bloch pattern with
     * the exception of array properties (these are very unlikely primary key types).
     * @return int
     */
    public int hashCode()
    {
        if (this.hashValue == 0)
        {
            int result = 17;
            int identifierValue = this.getIdentifier() == null ? 0 : this.getIdentifier().hashCode();
            result = result * 37 + identifierValue;
            this.hashValue = result;
        }
        return this.hashValue;
    }
}
