/FileExtraction/Java_unseen/IMS-MAXIMS_openMAXIMS/Source Library/openmaxims_workspace/ValueObjects/src/ims/correspondence/vo/CorrespondenceDetailsVo.java
//#############################################################################
//#                                                                           #
//#  Copyright (C) <2015>  <IMS MAXIMS>                                       #
//#                                                                           #
//#  This program is free software: you can redistribute it and/or modify     #
//#  it under the terms of the GNU Affero General Public License as           #
//#  published by the Free Software Foundation, either version 3 of the       #
//#  License, or (at your option) any later version.                          # 
//#                                                                           #
//#  This program is distributed in the hope that it will be useful,          #
//#  but WITHOUT ANY WARRANTY; without even the implied warranty of           #
//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
//#  GNU Affero General Public License for more details.                      #
//#                                                                           #
//#  You should have received a copy of the GNU Affero General Public License #
//#  along with this program.  If not, see <http://www.gnu.org/licenses/>.    #
//#                                                                           #
//#  IMS MAXIMS provides absolutely NO GUARANTEE OF THE CLINICAL SAFTEY of    #
//#  this program.  Users of this software do so entirely at their own risk.  #
//#  IMS MAXIMS only ensures the Clinical Safety of unaltered run-time        #
//#  software that it builds, deploys and maintains.                          #
//#                                                                           #
//#############################################################################
//#EOH
// This code was generated by Barbara Worwood using IMS Development Environment (version 1.80 build 5589.25814)
// Copyright (C) 1995-2015 IMS MAXIMS. All rights reserved.
// WARNING: DO NOT MODIFY the content of this file

package ims.correspondence.vo;

/**
 * Linked to correspondence.CorrespondenceDetails business object (ID: 1052100001).
 */
public class CorrespondenceDetailsVo extends ims.correspondence.vo.CorrespondenceDetailsRefVo implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public CorrespondenceDetailsVo()
	{
	}
	public CorrespondenceDetailsVo(Integer id, int version)
	{
		super(id, version);
	}
	public CorrespondenceDetailsVo(ims.correspondence.vo.beans.CorrespondenceDetailsVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.pasevent = bean.getPasEvent() == null ? null : new ims.core.admin.pas.vo.PASEventRefVo(new Integer(bean.getPasEvent().getId()), bean.getPasEvent().getVersion());
		this.currentstatus = bean.getCurrentStatus() == null ? null : ims.core.vo.lookups.DocumentStatus.buildLookup(bean.getCurrentStatus());
		this.cspstatushistory = ims.correspondence.vo.CorrespondenceStatusHistoryVoCollection.buildFromBeanCollection(bean.getCspStatusHistory());
		this.categories = ims.correspondence.vo.CategoryNotesVoCollection.buildFromBeanCollection(bean.getCategories());
		this.recipients = ims.correspondence.vo.RecipientVoCollection.buildFromBeanCollection(bean.getRecipients());
		this.currentdocument = bean.getCurrentDocument() == null ? null : bean.getCurrentDocument().buildVo();
		this.signedby = bean.getSignedBy() == null ? null : bean.getSignedBy().buildVo();
		this.specialinterest = bean.getSpecialInterest() == null ? null : ims.correspondence.vo.lookups.SpecialInterestType.buildLookup(bean.getSpecialInterest());
		this.dateofclinic = bean.getDateOfClinic() == null ? null : bean.getDateOfClinic().buildDate();
		this.admissiondate = bean.getAdmissionDate() == null ? null : bean.getAdmissionDate().buildDate();
		this.dischargedate = bean.getDischargeDate() == null ? null : bean.getDischargeDate().buildDate();
		this.dictatedby = bean.getDictatedBy() == null ? null : bean.getDictatedBy().buildVo();
		this.dictatedbyinitials = bean.getDictatedByInitials();
		this.typedby = bean.getTypedBy() == null ? null : bean.getTypedBy().buildVo();
		this.typedbyinitials = bean.getTypedByInitials();
		this.enquiriesto = bean.getEnquiriesTo() == null ? null : bean.getEnquiriesTo().buildVo();
		this.wastypedwithoutcasenotes = bean.getWasTypedWithoutCaseNotes();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.correspondence.vo.beans.CorrespondenceDetailsVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.pasevent = bean.getPasEvent() == null ? null : new ims.core.admin.pas.vo.PASEventRefVo(new Integer(bean.getPasEvent().getId()), bean.getPasEvent().getVersion());
		this.currentstatus = bean.getCurrentStatus() == null ? null : ims.core.vo.lookups.DocumentStatus.buildLookup(bean.getCurrentStatus());
		this.cspstatushistory = ims.correspondence.vo.CorrespondenceStatusHistoryVoCollection.buildFromBeanCollection(bean.getCspStatusHistory());
		this.categories = ims.correspondence.vo.CategoryNotesVoCollection.buildFromBeanCollection(bean.getCategories());
		this.recipients = ims.correspondence.vo.RecipientVoCollection.buildFromBeanCollection(bean.getRecipients());
		this.currentdocument = bean.getCurrentDocument() == null ? null : bean.getCurrentDocument().buildVo(map);
		this.signedby = bean.getSignedBy() == null ? null : bean.getSignedBy().buildVo(map);
		this.specialinterest = bean.getSpecialInterest() == null ? null : ims.correspondence.vo.lookups.SpecialInterestType.buildLookup(bean.getSpecialInterest());
		this.dateofclinic = bean.getDateOfClinic() == null ? null : bean.getDateOfClinic().buildDate();
		this.admissiondate = bean.getAdmissionDate() == null ? null : bean.getAdmissionDate().buildDate();
		this.dischargedate = bean.getDischargeDate() == null ? null : bean.getDischargeDate().buildDate();
		this.dictatedby = bean.getDictatedBy() == null ? null : bean.getDictatedBy().buildVo(map);
		this.dictatedbyinitials = bean.getDictatedByInitials();
		this.typedby = bean.getTypedBy() == null ? null : bean.getTypedBy().buildVo(map);
		this.typedbyinitials = bean.getTypedByInitials();
		this.enquiriesto = bean.getEnquiriesTo() == null ? null : bean.getEnquiriesTo().buildVo(map);
		this.wastypedwithoutcasenotes = bean.getWasTypedWithoutCaseNotes();
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.correspondence.vo.beans.CorrespondenceDetailsVoBean bean = null;
		if(map != null)
			bean = (ims.correspondence.vo.beans.CorrespondenceDetailsVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.correspondence.vo.beans.CorrespondenceDetailsVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public Object getFieldValueByFieldName(String fieldName)
	{
		if(fieldName == null)
			throw new ims.framework.exceptions.CodingRuntimeException("Invalid field name");
		fieldName = fieldName.toUpperCase();
		if(fieldName.equals("PASEVENT"))
			return getPasEvent();
		if(fieldName.equals("CURRENTSTATUS"))
			return getCurrentStatus();
		if(fieldName.equals("CSPSTATUSHISTORY"))
			return getCspStatusHistory();
		if(fieldName.equals("CATEGORIES"))
			return getCategories();
		if(fieldName.equals("RECIPIENTS"))
			return getRecipients();
		if(fieldName.equals("CURRENTDOCUMENT"))
			return getCurrentDocument();
		if(fieldName.equals("SIGNEDBY"))
			return getSignedBy();
		if(fieldName.equals("SPECIALINTEREST"))
			return getSpecialInterest();
		if(fieldName.equals("DATEOFCLINIC"))
			return getDateOfClinic();
		if(fieldName.equals("ADMISSIONDATE"))
			return getAdmissionDate();
		if(fieldName.equals("DISCHARGEDATE"))
			return getDischargeDate();
		if(fieldName.equals("DICTATEDBY"))
			return getDictatedBy();
		if(fieldName.equals("DICTATEDBYINITIALS"))
			return getDictatedByInitials();
		if(fieldName.equals("TYPEDBY"))
			return getTypedBy();
		if(fieldName.equals("TYPEDBYINITIALS"))
			return getTypedByInitials();
		if(fieldName.equals("ENQUIRIESTO"))
			return getEnquiriesTo();
		if(fieldName.equals("WASTYPEDWITHOUTCASENOTES"))
			return getWasTypedWithoutCaseNotes();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getPasEventIsNotNull()
	{
		return this.pasevent != null;
	}
	public ims.core.admin.pas.vo.PASEventRefVo getPasEvent()
	{
		return this.pasevent;
	}
	public void setPasEvent(ims.core.admin.pas.vo.PASEventRefVo value)
	{
		this.isValidated = false;
		this.pasevent = value;
	}
	public boolean getCurrentStatusIsNotNull()
	{
		return this.currentstatus != null;
	}
	public ims.core.vo.lookups.DocumentStatus getCurrentStatus()
	{
		return this.currentstatus;
	}
	public void setCurrentStatus(ims.core.vo.lookups.DocumentStatus value)
	{
		this.isValidated = false;
		this.currentstatus = value;
	}
	public boolean getCspStatusHistoryIsNotNull()
	{
		return this.cspstatushistory != null;
	}
	public ims.correspondence.vo.CorrespondenceStatusHistoryVoCollection getCspStatusHistory()
	{
		return this.cspstatushistory;
	}
	public void setCspStatusHistory(ims.correspondence.vo.CorrespondenceStatusHistoryVoCollection value)
	{
		this.isValidated = false;
		this.cspstatushistory = value;
	}
	public boolean getCategoriesIsNotNull()
	{
		return this.categories != null;
	}
	public ims.correspondence.vo.CategoryNotesVoCollection getCategories()
	{
		return this.categories;
	}
	public void setCategories(ims.correspondence.vo.CategoryNotesVoCollection value)
	{
		this.isValidated = false;
		this.categories = value;
	}
	public boolean getRecipientsIsNotNull()
	{
		return this.recipients != null;
	}
	public ims.correspondence.vo.RecipientVoCollection getRecipients()
	{
		return this.recipients;
	}
	public void setRecipients(ims.correspondence.vo.RecipientVoCollection value)
	{
		this.isValidated = false;
		this.recipients = value;
	}
	public boolean getCurrentDocumentIsNotNull()
	{
		return this.currentdocument != null;
	}
	public ims.core.vo.DocumentVo getCurrentDocument()
	{
		return this.currentdocument;
	}
	public void setCurrentDocument(ims.core.vo.DocumentVo value)
	{
		this.isValidated = false;
		this.currentdocument = value;
	}
	public boolean getSignedByIsNotNull()
	{
		return this.signedby != null;
	}
	public ims.core.vo.MedicLiteVo getSignedBy()
	{
		return this.signedby;
	}
	public void setSignedBy(ims.core.vo.MedicLiteVo value)
	{
		this.isValidated = false;
		this.signedby = value;
	}
	public boolean getSpecialInterestIsNotNull()
	{
		return this.specialinterest != null;
	}
	public ims.correspondence.vo.lookups.SpecialInterestType getSpecialInterest()
	{
		return this.specialinterest;
	}
	public void setSpecialInterest(ims.correspondence.vo.lookups.SpecialInterestType value)
	{
		this.isValidated = false;
		this.specialinterest = value;
	}
	public boolean getDateOfClinicIsNotNull()
	{
		return this.dateofclinic != null;
	}
	public ims.framework.utils.Date getDateOfClinic()
	{
		return this.dateofclinic;
	}
	public void setDateOfClinic(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.dateofclinic = value;
	}
	public boolean getAdmissionDateIsNotNull()
	{
		return this.admissiondate != null;
	}
	public ims.framework.utils.Date getAdmissionDate()
	{
		return this.admissiondate;
	}
	public void setAdmissionDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.admissiondate = value;
	}
	public boolean getDischargeDateIsNotNull()
	{
		return this.dischargedate != null;
	}
	public ims.framework.utils.Date getDischargeDate()
	{
		return this.dischargedate;
	}
	public void setDischargeDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.dischargedate = value;
	}
	public boolean getDictatedByIsNotNull()
	{
		return this.dictatedby != null;
	}
	public ims.core.vo.MemberOfStaffLiteVo getDictatedBy()
	{
		return this.dictatedby;
	}
	public void setDictatedBy(ims.core.vo.MemberOfStaffLiteVo value)
	{
		this.isValidated = false;
		this.dictatedby = value;
	}
	public boolean getDictatedByInitialsIsNotNull()
	{
		return this.dictatedbyinitials != null;
	}
	public String getDictatedByInitials()
	{
		return this.dictatedbyinitials;
	}
	public static int getDictatedByInitialsMaxLength()
	{
		return 10;
	}
	public void setDictatedByInitials(String value)
	{
		this.isValidated = false;
		this.dictatedbyinitials = value;
	}
	public boolean getTypedByIsNotNull()
	{
		return this.typedby != null;
	}
	public ims.core.vo.MemberOfStaffLiteVo getTypedBy()
	{
		return this.typedby;
	}
	public void setTypedBy(ims.core.vo.MemberOfStaffLiteVo value)
	{
		this.isValidated = false;
		this.typedby = value;
	}
	public boolean getTypedByInitialsIsNotNull()
	{
		return this.typedbyinitials != null;
	}
	public String getTypedByInitials()
	{
		return this.typedbyinitials;
	}
	public static int getTypedByInitialsMaxLength()
	{
		return 10;
	}
	public void setTypedByInitials(String value)
	{
		this.isValidated = false;
		this.typedbyinitials = value;
	}
	public boolean getEnquiriesToIsNotNull()
	{
		return this.enquiriesto != null;
	}
	public ims.core.vo.MemberOfStaffLiteVo getEnquiriesTo()
	{
		return this.enquiriesto;
	}
	public void setEnquiriesTo(ims.core.vo.MemberOfStaffLiteVo value)
	{
		this.isValidated = false;
		this.enquiriesto = value;
	}
	public boolean getWasTypedWithoutCaseNotesIsNotNull()
	{
		return this.wastypedwithoutcasenotes != null;
	}
	public Boolean getWasTypedWithoutCaseNotes()
	{
		return this.wastypedwithoutcasenotes;
	}
	public void setWasTypedWithoutCaseNotes(Boolean value)
	{
		this.isValidated = false;
		this.wastypedwithoutcasenotes = value;
	}
	/**
	* setDocumentDetailsStatus
	*/
	public void setDocumentDetailsStatus(ims.core.vo.lookups.DocumentStatus docStatus, ims.core.vo.MemberOfStaffShortVo mos) 
	{
		if (docStatus != null)
		{
			this.setCurrentStatus(docStatus);
			ims.correspondence.vo.CorrespondenceStatusHistoryVo voStatusHistory = new ims.correspondence.vo.CorrespondenceStatusHistoryVo ();
			voStatusHistory.setStatus(docStatus);
		
			if (this.currentdocument != null && this.currentdocument.getTemplate() != null)
				voStatusHistory.setTemplateName(this.currentdocument.getTemplate().getName());
		
			this.getCspStatusHistory().add(voStatusHistory);
		}
	}
	
	public boolean isValidated()
	{
		if(this.isBusy)
			return true;
		this.isBusy = true;
	
		if(!this.isValidated)
		{
			this.isBusy = false;
			return false;
		}
		if(this.cspstatushistory != null)
		{
			if(!this.cspstatushistory.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.categories != null)
		{
			if(!this.categories.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.recipients != null)
		{
			if(!this.recipients.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.currentdocument != null)
		{
			if(!this.currentdocument.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.signedby != null)
		{
			if(!this.signedby.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.dictatedby != null)
		{
			if(!this.dictatedby.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.typedby != null)
		{
			if(!this.typedby.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.enquiriesto != null)
		{
			if(!this.enquiriesto.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		this.isBusy = false;
		return true;
	}
	public String[] validate()
	{
		return validate(null);
	}
	public String[] validate(String[] existingErrors)
	{
		if(this.isBusy)
			return null;
		this.isBusy = true;
	
		java.util.ArrayList<String> listOfErrors = new java.util.ArrayList<String>();
		if(existingErrors != null)
		{
			for(int x = 0; x < existingErrors.length; x++)
			{
				listOfErrors.add(existingErrors[x]);
			}
		}
		if(this.pasevent == null)
			listOfErrors.add("pasEvent is mandatory");
		if(this.cspstatushistory != null)
		{
			String[] listOfOtherErrors = this.cspstatushistory.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.categories != null)
		{
			String[] listOfOtherErrors = this.categories.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.recipients != null)
		{
			String[] listOfOtherErrors = this.recipients.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.currentdocument != null)
		{
			String[] listOfOtherErrors = this.currentdocument.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.signedby != null)
		{
			String[] listOfOtherErrors = this.signedby.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.dictatedby == null)
			listOfErrors.add("Dictated By is mandatory");
		if(this.dictatedby != null)
		{
			String[] listOfOtherErrors = this.dictatedby.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.dictatedbyinitials == null || this.dictatedbyinitials.length() == 0)
			listOfErrors.add("Dictated By Initials is mandatory");
		else if(this.dictatedbyinitials.length() > 10)
			listOfErrors.add("The length of the field [dictatedbyinitials] in the value object [ims.correspondence.vo.CorrespondenceDetailsVo] is too big. It should be less or equal to 10");
		if(this.typedby == null)
			listOfErrors.add("Typed By is mandatory");
		if(this.typedby != null)
		{
			String[] listOfOtherErrors = this.typedby.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.typedbyinitials == null || this.typedbyinitials.length() == 0)
			listOfErrors.add("Typed By Initials is mandatory");
		else if(this.typedbyinitials.length() > 10)
			listOfErrors.add("The length of the field [typedbyinitials] in the value object [ims.correspondence.vo.CorrespondenceDetailsVo] is too big. It should be less or equal to 10");
		if(this.enquiriesto != null)
		{
			String[] listOfOtherErrors = this.enquiriesto.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		int errorCount = listOfErrors.size();
		if(errorCount == 0)
		{
			this.isBusy = false;
			this.isValidated = true;
			return null;
		}
		String[] result = new String[errorCount];
		for(int x = 0; x < errorCount; x++)
			result[x] = (String)listOfErrors.get(x);
		this.isBusy = false;
		this.isValidated = false;
		return result;
	}
	public void clearIDAndVersion()
	{
		this.id = null;
		this.version = 0;
	}
	public Object clone()
	{
		if(this.isBusy)
			return this;
		this.isBusy = true;
	
		CorrespondenceDetailsVo clone = new CorrespondenceDetailsVo(this.id, this.version);
		
		clone.pasevent = this.pasevent;
		if(this.currentstatus == null)
			clone.currentstatus = null;
		else
			clone.currentstatus = (ims.core.vo.lookups.DocumentStatus)this.currentstatus.clone();
		if(this.cspstatushistory == null)
			clone.cspstatushistory = null;
		else
			clone.cspstatushistory = (ims.correspondence.vo.CorrespondenceStatusHistoryVoCollection)this.cspstatushistory.clone();
		if(this.categories == null)
			clone.categories = null;
		else
			clone.categories = (ims.correspondence.vo.CategoryNotesVoCollection)this.categories.clone();
		if(this.recipients == null)
			clone.recipients = null;
		else
			clone.recipients = (ims.correspondence.vo.RecipientVoCollection)this.recipients.clone();
		if(this.currentdocument == null)
			clone.currentdocument = null;
		else
			clone.currentdocument = (ims.core.vo.DocumentVo)this.currentdocument.clone();
		if(this.signedby == null)
			clone.signedby = null;
		else
			clone.signedby = (ims.core.vo.MedicLiteVo)this.signedby.clone();
		if(this.specialinterest == null)
			clone.specialinterest = null;
		else
			clone.specialinterest = (ims.correspondence.vo.lookups.SpecialInterestType)this.specialinterest.clone();
		if(this.dateofclinic == null)
			clone.dateofclinic = null;
		else
			clone.dateofclinic = (ims.framework.utils.Date)this.dateofclinic.clone();
		if(this.admissiondate == null)
			clone.admissiondate = null;
		else
			clone.admissiondate = (ims.framework.utils.Date)this.admissiondate.clone();
		if(this.dischargedate == null)
			clone.dischargedate = null;
		else
			clone.dischargedate = (ims.framework.utils.Date)this.dischargedate.clone();
		if(this.dictatedby == null)
			clone.dictatedby = null;
		else
			clone.dictatedby = (ims.core.vo.MemberOfStaffLiteVo)this.dictatedby.clone();
		clone.dictatedbyinitials = this.dictatedbyinitials;
		if(this.typedby == null)
			clone.typedby = null;
		else
			clone.typedby = (ims.core.vo.MemberOfStaffLiteVo)this.typedby.clone();
		clone.typedbyinitials = this.typedbyinitials;
		if(this.enquiriesto == null)
			clone.enquiriesto = null;
		else
			clone.enquiriesto = (ims.core.vo.MemberOfStaffLiteVo)this.enquiriesto.clone();
		clone.wastypedwithoutcasenotes = this.wastypedwithoutcasenotes;
		clone.isValidated = this.isValidated;
		
		this.isBusy = false;
		return clone;
	}
	public int compareTo(Object obj)
	{
		return compareTo(obj, true);
	}
	public int compareTo(Object obj, boolean caseInsensitive)
	{
		if (obj == null)
		{
			return -1;
		}
		if(caseInsensitive); // this is to avoid eclipse warning only.
		if (!(CorrespondenceDetailsVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A CorrespondenceDetailsVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		CorrespondenceDetailsVo compareObj = (CorrespondenceDetailsVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getID_CorrespondenceDetails() == null && compareObj.getID_CorrespondenceDetails() != null)
				return -1;
			if(this.getID_CorrespondenceDetails() != null && compareObj.getID_CorrespondenceDetails() == null)
				return 1;
			if(this.getID_CorrespondenceDetails() != null && compareObj.getID_CorrespondenceDetails() != null)
				retVal = this.getID_CorrespondenceDetails().compareTo(compareObj.getID_CorrespondenceDetails());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.pasevent != null)
			count++;
		if(this.currentstatus != null)
			count++;
		if(this.cspstatushistory != null)
			count++;
		if(this.categories != null)
			count++;
		if(this.recipients != null)
			count++;
		if(this.currentdocument != null)
			count++;
		if(this.signedby != null)
			count++;
		if(this.specialinterest != null)
			count++;
		if(this.dateofclinic != null)
			count++;
		if(this.admissiondate != null)
			count++;
		if(this.dischargedate != null)
			count++;
		if(this.dictatedby != null)
			count++;
		if(this.dictatedbyinitials != null)
			count++;
		if(this.typedby != null)
			count++;
		if(this.typedbyinitials != null)
			count++;
		if(this.enquiriesto != null)
			count++;
		if(this.wastypedwithoutcasenotes != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 17;
	}
	protected ims.core.admin.pas.vo.PASEventRefVo pasevent;
	protected ims.core.vo.lookups.DocumentStatus currentstatus;
	protected ims.correspondence.vo.CorrespondenceStatusHistoryVoCollection cspstatushistory;
	protected ims.correspondence.vo.CategoryNotesVoCollection categories;
	protected ims.correspondence.vo.RecipientVoCollection recipients;
	protected ims.core.vo.DocumentVo currentdocument;
	protected ims.core.vo.MedicLiteVo signedby;
	protected ims.correspondence.vo.lookups.SpecialInterestType specialinterest;
	protected ims.framework.utils.Date dateofclinic;
	protected ims.framework.utils.Date admissiondate;
	protected ims.framework.utils.Date dischargedate;
	protected ims.core.vo.MemberOfStaffLiteVo dictatedby;
	protected String dictatedbyinitials;
	protected ims.core.vo.MemberOfStaffLiteVo typedby;
	protected String typedbyinitials;
	protected ims.core.vo.MemberOfStaffLiteVo enquiriesto;
	protected Boolean wastypedwithoutcasenotes;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
