/FileExtraction/Java_unseen/IMS-MAXIMS_openMAXIMS/Source Library/openmaxims_workspace/ValueObjects/src/ims/pci/vo/ClientScheduleStageVaccineVo.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.pci.vo;

/**
 * Linked to PCI.ClientScheduleStageVaccine business object (ID: 1091100009).
 */
public class ClientScheduleStageVaccineVo extends ims.pci.vo.ClientScheduleStageVaccineRefVo implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public ClientScheduleStageVaccineVo()
	{
	}
	public ClientScheduleStageVaccineVo(Integer id, int version)
	{
		super(id, version);
	}
	public ClientScheduleStageVaccineVo(ims.pci.vo.beans.ClientScheduleStageVaccineVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.stagevaccine = bean.getStageVaccine() == null ? null : bean.getStageVaccine().buildVo();
		this.scheduleddate = bean.getScheduledDate() == null ? null : bean.getScheduledDate().buildDate();
		this.delivereddate = bean.getDeliveredDate() == null ? null : bean.getDeliveredDate().buildDate();
		this.terminateddate = bean.getTerminatedDate() == null ? null : bean.getTerminatedDate().buildDate();
		this.vaccinemanufacturer = bean.getVaccineManufacturer() == null ? null : ims.clinical.vo.lookups.VaccineManufacturer.buildLookup(bean.getVaccineManufacturer());
		this.expirydate = bean.getExpiryDate() == null ? null : bean.getExpiryDate().buildDate();
		this.batchnumber = bean.getBatchNumber();
		this.paymenttype = bean.getPaymentType() == null ? null : ims.pci.vo.lookups.PaymentType.buildLookup(bean.getPaymentType());
		this.deliveredbymedic = bean.getDeliveredByMedic() == null ? null : bean.getDeliveredByMedic().buildVo();
		this.deliveredbygp = bean.getDeliveredByGp() == null ? null : bean.getDeliveredByGp().buildVo();
		this.paymentgp = bean.getPaymentGp() == null ? null : bean.getPaymentGp().buildVo();
		this.terminatedby = bean.getTerminatedBy() == null ? null : ims.pci.vo.lookups.TerminatedBy.buildLookup(bean.getTerminatedBy());
		this.terminationreason = bean.getTerminationReason() == null ? null : ims.pci.vo.lookups.TerminationReason.buildLookup(bean.getTerminationReason());
		this.isdeleted = bean.getIsDeleted();
		this.isextracted = bean.getIsExtracted();
		this.scheduletype = bean.getScheduleType() == null ? null : ims.pci.vo.lookups.ScheduleType.buildLookup(bean.getScheduleType());
		this.personrecordingdelivery = bean.getPersonRecordingDelivery() == null ? null : bean.getPersonRecordingDelivery().buildVo();
		this.iscancelled = bean.getIsCancelled();
		this.cancelledby = bean.getCancelledBy() == null ? null : new ims.core.resource.people.vo.MemberOfStaffRefVo(new Integer(bean.getCancelledBy().getId()), bean.getCancelledBy().getVersion());
		this.cancellationreason = bean.getCancellationReason() == null ? null : ims.pci.vo.lookups.VaccineCancellationReason.buildLookup(bean.getCancellationReason());
		this.cancellationdatetime = bean.getCancellationDateTime() == null ? null : bean.getCancellationDateTime().buildDateTime();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.pci.vo.beans.ClientScheduleStageVaccineVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.stagevaccine = bean.getStageVaccine() == null ? null : bean.getStageVaccine().buildVo(map);
		this.scheduleddate = bean.getScheduledDate() == null ? null : bean.getScheduledDate().buildDate();
		this.delivereddate = bean.getDeliveredDate() == null ? null : bean.getDeliveredDate().buildDate();
		this.terminateddate = bean.getTerminatedDate() == null ? null : bean.getTerminatedDate().buildDate();
		this.vaccinemanufacturer = bean.getVaccineManufacturer() == null ? null : ims.clinical.vo.lookups.VaccineManufacturer.buildLookup(bean.getVaccineManufacturer());
		this.expirydate = bean.getExpiryDate() == null ? null : bean.getExpiryDate().buildDate();
		this.batchnumber = bean.getBatchNumber();
		this.paymenttype = bean.getPaymentType() == null ? null : ims.pci.vo.lookups.PaymentType.buildLookup(bean.getPaymentType());
		this.deliveredbymedic = bean.getDeliveredByMedic() == null ? null : bean.getDeliveredByMedic().buildVo(map);
		this.deliveredbygp = bean.getDeliveredByGp() == null ? null : bean.getDeliveredByGp().buildVo(map);
		this.paymentgp = bean.getPaymentGp() == null ? null : bean.getPaymentGp().buildVo(map);
		this.terminatedby = bean.getTerminatedBy() == null ? null : ims.pci.vo.lookups.TerminatedBy.buildLookup(bean.getTerminatedBy());
		this.terminationreason = bean.getTerminationReason() == null ? null : ims.pci.vo.lookups.TerminationReason.buildLookup(bean.getTerminationReason());
		this.isdeleted = bean.getIsDeleted();
		this.isextracted = bean.getIsExtracted();
		this.scheduletype = bean.getScheduleType() == null ? null : ims.pci.vo.lookups.ScheduleType.buildLookup(bean.getScheduleType());
		this.personrecordingdelivery = bean.getPersonRecordingDelivery() == null ? null : bean.getPersonRecordingDelivery().buildVo(map);
		this.iscancelled = bean.getIsCancelled();
		this.cancelledby = bean.getCancelledBy() == null ? null : new ims.core.resource.people.vo.MemberOfStaffRefVo(new Integer(bean.getCancelledBy().getId()), bean.getCancelledBy().getVersion());
		this.cancellationreason = bean.getCancellationReason() == null ? null : ims.pci.vo.lookups.VaccineCancellationReason.buildLookup(bean.getCancellationReason());
		this.cancellationdatetime = bean.getCancellationDateTime() == null ? null : bean.getCancellationDateTime().buildDateTime();
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.pci.vo.beans.ClientScheduleStageVaccineVoBean bean = null;
		if(map != null)
			bean = (ims.pci.vo.beans.ClientScheduleStageVaccineVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.pci.vo.beans.ClientScheduleStageVaccineVoBean();
			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("STAGEVACCINE"))
			return getStageVaccine();
		if(fieldName.equals("SCHEDULEDDATE"))
			return getScheduledDate();
		if(fieldName.equals("DELIVEREDDATE"))
			return getDeliveredDate();
		if(fieldName.equals("TERMINATEDDATE"))
			return getTerminatedDate();
		if(fieldName.equals("VACCINEMANUFACTURER"))
			return getVaccineManufacturer();
		if(fieldName.equals("EXPIRYDATE"))
			return getExpiryDate();
		if(fieldName.equals("BATCHNUMBER"))
			return getBatchNumber();
		if(fieldName.equals("PAYMENTTYPE"))
			return getPaymentType();
		if(fieldName.equals("DELIVEREDBYMEDIC"))
			return getDeliveredByMedic();
		if(fieldName.equals("DELIVEREDBYGP"))
			return getDeliveredByGp();
		if(fieldName.equals("PAYMENTGP"))
			return getPaymentGp();
		if(fieldName.equals("TERMINATEDBY"))
			return getTerminatedBy();
		if(fieldName.equals("TERMINATIONREASON"))
			return getTerminationReason();
		if(fieldName.equals("ISDELETED"))
			return getIsDeleted();
		if(fieldName.equals("ISEXTRACTED"))
			return getIsExtracted();
		if(fieldName.equals("SCHEDULETYPE"))
			return getScheduleType();
		if(fieldName.equals("PERSONRECORDINGDELIVERY"))
			return getPersonRecordingDelivery();
		if(fieldName.equals("ISCANCELLED"))
			return getIsCancelled();
		if(fieldName.equals("CANCELLEDBY"))
			return getCancelledBy();
		if(fieldName.equals("CANCELLATIONREASON"))
			return getCancellationReason();
		if(fieldName.equals("CANCELLATIONDATETIME"))
			return getCancellationDateTime();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getStageVaccineIsNotNull()
	{
		return this.stagevaccine != null;
	}
	public ims.pci.vo.StageVaccineVo getStageVaccine()
	{
		return this.stagevaccine;
	}
	public void setStageVaccine(ims.pci.vo.StageVaccineVo value)
	{
		this.isValidated = false;
		this.stagevaccine = value;
	}
	public boolean getScheduledDateIsNotNull()
	{
		return this.scheduleddate != null;
	}
	public ims.framework.utils.Date getScheduledDate()
	{
		return this.scheduleddate;
	}
	public void setScheduledDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.scheduleddate = value;
	}
	public boolean getDeliveredDateIsNotNull()
	{
		return this.delivereddate != null;
	}
	public ims.framework.utils.Date getDeliveredDate()
	{
		return this.delivereddate;
	}
	public void setDeliveredDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.delivereddate = value;
	}
	public boolean getTerminatedDateIsNotNull()
	{
		return this.terminateddate != null;
	}
	public ims.framework.utils.Date getTerminatedDate()
	{
		return this.terminateddate;
	}
	public void setTerminatedDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.terminateddate = value;
	}
	public boolean getVaccineManufacturerIsNotNull()
	{
		return this.vaccinemanufacturer != null;
	}
	public ims.clinical.vo.lookups.VaccineManufacturer getVaccineManufacturer()
	{
		return this.vaccinemanufacturer;
	}
	public void setVaccineManufacturer(ims.clinical.vo.lookups.VaccineManufacturer value)
	{
		this.isValidated = false;
		this.vaccinemanufacturer = value;
	}
	public boolean getExpiryDateIsNotNull()
	{
		return this.expirydate != null;
	}
	public ims.framework.utils.Date getExpiryDate()
	{
		return this.expirydate;
	}
	public void setExpiryDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.expirydate = value;
	}
	public boolean getBatchNumberIsNotNull()
	{
		return this.batchnumber != null;
	}
	public String getBatchNumber()
	{
		return this.batchnumber;
	}
	public static int getBatchNumberMaxLength()
	{
		return 25;
	}
	public void setBatchNumber(String value)
	{
		this.isValidated = false;
		this.batchnumber = value;
	}
	public boolean getPaymentTypeIsNotNull()
	{
		return this.paymenttype != null;
	}
	public ims.pci.vo.lookups.PaymentType getPaymentType()
	{
		return this.paymenttype;
	}
	public void setPaymentType(ims.pci.vo.lookups.PaymentType value)
	{
		this.isValidated = false;
		this.paymenttype = value;
	}
	public boolean getDeliveredByMedicIsNotNull()
	{
		return this.deliveredbymedic != null;
	}
	public ims.core.vo.HcpLiteVo getDeliveredByMedic()
	{
		return this.deliveredbymedic;
	}
	public void setDeliveredByMedic(ims.core.vo.HcpLiteVo value)
	{
		this.isValidated = false;
		this.deliveredbymedic = value;
	}
	public boolean getDeliveredByGpIsNotNull()
	{
		return this.deliveredbygp != null;
	}
	public ims.core.vo.GpShortVo getDeliveredByGp()
	{
		return this.deliveredbygp;
	}
	public void setDeliveredByGp(ims.core.vo.GpShortVo value)
	{
		this.isValidated = false;
		this.deliveredbygp = value;
	}
	public boolean getPaymentGpIsNotNull()
	{
		return this.paymentgp != null;
	}
	public ims.core.vo.GpShortVo getPaymentGp()
	{
		return this.paymentgp;
	}
	public void setPaymentGp(ims.core.vo.GpShortVo value)
	{
		this.isValidated = false;
		this.paymentgp = value;
	}
	public boolean getTerminatedByIsNotNull()
	{
		return this.terminatedby != null;
	}
	public ims.pci.vo.lookups.TerminatedBy getTerminatedBy()
	{
		return this.terminatedby;
	}
	public void setTerminatedBy(ims.pci.vo.lookups.TerminatedBy value)
	{
		this.isValidated = false;
		this.terminatedby = value;
	}
	public boolean getTerminationReasonIsNotNull()
	{
		return this.terminationreason != null;
	}
	public ims.pci.vo.lookups.TerminationReason getTerminationReason()
	{
		return this.terminationreason;
	}
	public void setTerminationReason(ims.pci.vo.lookups.TerminationReason value)
	{
		this.isValidated = false;
		this.terminationreason = value;
	}
	public boolean getIsDeletedIsNotNull()
	{
		return this.isdeleted != null;
	}
	public Boolean getIsDeleted()
	{
		return this.isdeleted;
	}
	public void setIsDeleted(Boolean value)
	{
		this.isValidated = false;
		this.isdeleted = value;
	}
	public boolean getIsExtractedIsNotNull()
	{
		return this.isextracted != null;
	}
	public Boolean getIsExtracted()
	{
		return this.isextracted;
	}
	public void setIsExtracted(Boolean value)
	{
		this.isValidated = false;
		this.isextracted = value;
	}
	public boolean getScheduleTypeIsNotNull()
	{
		return this.scheduletype != null;
	}
	public ims.pci.vo.lookups.ScheduleType getScheduleType()
	{
		return this.scheduletype;
	}
	public void setScheduleType(ims.pci.vo.lookups.ScheduleType value)
	{
		this.isValidated = false;
		this.scheduletype = value;
	}
	public boolean getPersonRecordingDeliveryIsNotNull()
	{
		return this.personrecordingdelivery != null;
	}
	public ims.core.vo.MemberOfStaffLiteVo getPersonRecordingDelivery()
	{
		return this.personrecordingdelivery;
	}
	public void setPersonRecordingDelivery(ims.core.vo.MemberOfStaffLiteVo value)
	{
		this.isValidated = false;
		this.personrecordingdelivery = value;
	}
	public boolean getIsCancelledIsNotNull()
	{
		return this.iscancelled != null;
	}
	public Boolean getIsCancelled()
	{
		return this.iscancelled;
	}
	public void setIsCancelled(Boolean value)
	{
		this.isValidated = false;
		this.iscancelled = value;
	}
	public boolean getCancelledByIsNotNull()
	{
		return this.cancelledby != null;
	}
	public ims.core.resource.people.vo.MemberOfStaffRefVo getCancelledBy()
	{
		return this.cancelledby;
	}
	public void setCancelledBy(ims.core.resource.people.vo.MemberOfStaffRefVo value)
	{
		this.isValidated = false;
		this.cancelledby = value;
	}
	public boolean getCancellationReasonIsNotNull()
	{
		return this.cancellationreason != null;
	}
	public ims.pci.vo.lookups.VaccineCancellationReason getCancellationReason()
	{
		return this.cancellationreason;
	}
	public void setCancellationReason(ims.pci.vo.lookups.VaccineCancellationReason value)
	{
		this.isValidated = false;
		this.cancellationreason = value;
	}
	public boolean getCancellationDateTimeIsNotNull()
	{
		return this.cancellationdatetime != null;
	}
	public ims.framework.utils.DateTime getCancellationDateTime()
	{
		return this.cancellationdatetime;
	}
	public void setCancellationDateTime(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.cancellationdatetime = value;
	}
	/**
	* public String[] validateCustomRules()  -  function used to validate custom rules (expiry date > delivered date)
	*/
	public String[] validateCustomRules()
	{
		return validateCustomRules(null);
	}
	
	/**
	* public String[] validateCustomRules(String[] existingErrors)  -  function used to validate custom rules (expiry date > delivered date)
	*/
	public String[] validateCustomRules(String[] existingErrors)
	{
		existingErrors = validate(existingErrors);
	
		// Start custom validating rules
		if(this.isBusy)
		    return null;
		this.isBusy = true;
	
		java.util.ArrayList<String> listOfErrors = new java.util.ArrayList<String>();
	
		// Keep old errors
		if (existingErrors != null)
		{
		    for(int x = 0; x < existingErrors.length; x++)
		    {
			listOfErrors.add(existingErrors[x]);
		    }
		}
	
		// Check expiry and delivered date
	//	if (this.expirydate != null && this.delivereddate != null)
	//	{
	//	    if (this.delivereddate.isGreaterOrEqualThan(this.expirydate))
	//	    {
	//		listOfErrors.add("Delivered date can not be set after expiry date.");
	//	    }
	//	}
	
		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 String getVaccineName()
	*/
	public String getVaccineName()
	{
		if (this.stagevaccine == null)
			return null;
		if (this.stagevaccine.vaccine == null)
			return null;
		return this.stagevaccine.vaccine.getVaccineName();
	}
	
	/**
	* public VaccineLiteVo getVaccine()
	*/
	public ims.core.vo.VaccineLiteVo getVaccine()
	{
		if (this.stagevaccine == null)
			return null;
	
		return this.stagevaccine.vaccine;
	}
	
	/**
	* public void resetVaccine() - This function resets the VO
	*/
	public void resetVaccine()
	{
		this.isdeleted = false;
		this.batchnumber = null;
		this.vaccinemanufacturer = null;
		this.expirydate = null;
		this.delivereddate = null;
		this.paymenttype = null;
		this.deliveredbygp = null;
		this.deliveredbymedic = null;
		this.paymentgp = null;
		this.scheduleddate = null;
		this.terminateddate = null;
		this.terminatedby = null;
		this.terminationreason = null;
	}
	
	public boolean isValidated()
	{
		if(this.isBusy)
			return true;
		this.isBusy = true;
	
		if(!this.isValidated)
		{
			this.isBusy = false;
			return false;
		}
		if(this.stagevaccine != null)
		{
			if(!this.stagevaccine.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.deliveredbymedic != null)
		{
			if(!this.deliveredbymedic.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.deliveredbygp != null)
		{
			if(!this.deliveredbygp.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.paymentgp != null)
		{
			if(!this.paymentgp.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.stagevaccine != null)
		{
			String[] listOfOtherErrors = this.stagevaccine.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.batchnumber != null)
			if(this.batchnumber.length() > 25)
				listOfErrors.add("The length of the field [batchnumber] in the value object [ims.pci.vo.ClientScheduleStageVaccineVo] is too big. It should be less or equal to 25");
		if(this.deliveredbymedic != null)
		{
			String[] listOfOtherErrors = this.deliveredbymedic.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.deliveredbygp != null)
		{
			String[] listOfOtherErrors = this.deliveredbygp.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.paymentgp != null)
		{
			String[] listOfOtherErrors = this.paymentgp.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;
	
		ClientScheduleStageVaccineVo clone = new ClientScheduleStageVaccineVo(this.id, this.version);
		
		if(this.stagevaccine == null)
			clone.stagevaccine = null;
		else
			clone.stagevaccine = (ims.pci.vo.StageVaccineVo)this.stagevaccine.clone();
		if(this.scheduleddate == null)
			clone.scheduleddate = null;
		else
			clone.scheduleddate = (ims.framework.utils.Date)this.scheduleddate.clone();
		if(this.delivereddate == null)
			clone.delivereddate = null;
		else
			clone.delivereddate = (ims.framework.utils.Date)this.delivereddate.clone();
		if(this.terminateddate == null)
			clone.terminateddate = null;
		else
			clone.terminateddate = (ims.framework.utils.Date)this.terminateddate.clone();
		if(this.vaccinemanufacturer == null)
			clone.vaccinemanufacturer = null;
		else
			clone.vaccinemanufacturer = (ims.clinical.vo.lookups.VaccineManufacturer)this.vaccinemanufacturer.clone();
		if(this.expirydate == null)
			clone.expirydate = null;
		else
			clone.expirydate = (ims.framework.utils.Date)this.expirydate.clone();
		clone.batchnumber = this.batchnumber;
		if(this.paymenttype == null)
			clone.paymenttype = null;
		else
			clone.paymenttype = (ims.pci.vo.lookups.PaymentType)this.paymenttype.clone();
		if(this.deliveredbymedic == null)
			clone.deliveredbymedic = null;
		else
			clone.deliveredbymedic = (ims.core.vo.HcpLiteVo)this.deliveredbymedic.clone();
		if(this.deliveredbygp == null)
			clone.deliveredbygp = null;
		else
			clone.deliveredbygp = (ims.core.vo.GpShortVo)this.deliveredbygp.clone();
		if(this.paymentgp == null)
			clone.paymentgp = null;
		else
			clone.paymentgp = (ims.core.vo.GpShortVo)this.paymentgp.clone();
		if(this.terminatedby == null)
			clone.terminatedby = null;
		else
			clone.terminatedby = (ims.pci.vo.lookups.TerminatedBy)this.terminatedby.clone();
		if(this.terminationreason == null)
			clone.terminationreason = null;
		else
			clone.terminationreason = (ims.pci.vo.lookups.TerminationReason)this.terminationreason.clone();
		clone.isdeleted = this.isdeleted;
		clone.isextracted = this.isextracted;
		if(this.scheduletype == null)
			clone.scheduletype = null;
		else
			clone.scheduletype = (ims.pci.vo.lookups.ScheduleType)this.scheduletype.clone();
		if(this.personrecordingdelivery == null)
			clone.personrecordingdelivery = null;
		else
			clone.personrecordingdelivery = (ims.core.vo.MemberOfStaffLiteVo)this.personrecordingdelivery.clone();
		clone.iscancelled = this.iscancelled;
		clone.cancelledby = this.cancelledby;
		if(this.cancellationreason == null)
			clone.cancellationreason = null;
		else
			clone.cancellationreason = (ims.pci.vo.lookups.VaccineCancellationReason)this.cancellationreason.clone();
		if(this.cancellationdatetime == null)
			clone.cancellationdatetime = null;
		else
			clone.cancellationdatetime = (ims.framework.utils.DateTime)this.cancellationdatetime.clone();
		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 (!(ClientScheduleStageVaccineVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A ClientScheduleStageVaccineVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		ClientScheduleStageVaccineVo compareObj = (ClientScheduleStageVaccineVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getStageVaccine() == null && compareObj.getStageVaccine() != null)
				return -1;
			if(this.getStageVaccine() != null && compareObj.getStageVaccine() == null)
				return 1;
			if(this.getStageVaccine() != null && compareObj.getStageVaccine() != null)
				retVal = this.getStageVaccine().compareTo(compareObj.getStageVaccine());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.stagevaccine != null)
			count++;
		if(this.scheduleddate != null)
			count++;
		if(this.delivereddate != null)
			count++;
		if(this.terminateddate != null)
			count++;
		if(this.vaccinemanufacturer != null)
			count++;
		if(this.expirydate != null)
			count++;
		if(this.batchnumber != null)
			count++;
		if(this.paymenttype != null)
			count++;
		if(this.deliveredbymedic != null)
			count++;
		if(this.deliveredbygp != null)
			count++;
		if(this.paymentgp != null)
			count++;
		if(this.terminatedby != null)
			count++;
		if(this.terminationreason != null)
			count++;
		if(this.isdeleted != null)
			count++;
		if(this.isextracted != null)
			count++;
		if(this.scheduletype != null)
			count++;
		if(this.personrecordingdelivery != null)
			count++;
		if(this.iscancelled != null)
			count++;
		if(this.cancelledby != null)
			count++;
		if(this.cancellationreason != null)
			count++;
		if(this.cancellationdatetime != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 21;
	}
	protected ims.pci.vo.StageVaccineVo stagevaccine;
	protected ims.framework.utils.Date scheduleddate;
	protected ims.framework.utils.Date delivereddate;
	protected ims.framework.utils.Date terminateddate;
	protected ims.clinical.vo.lookups.VaccineManufacturer vaccinemanufacturer;
	protected ims.framework.utils.Date expirydate;
	protected String batchnumber;
	protected ims.pci.vo.lookups.PaymentType paymenttype;
	protected ims.core.vo.HcpLiteVo deliveredbymedic;
	protected ims.core.vo.GpShortVo deliveredbygp;
	protected ims.core.vo.GpShortVo paymentgp;
	protected ims.pci.vo.lookups.TerminatedBy terminatedby;
	protected ims.pci.vo.lookups.TerminationReason terminationreason;
	protected Boolean isdeleted;
	protected Boolean isextracted;
	protected ims.pci.vo.lookups.ScheduleType scheduletype;
	protected ims.core.vo.MemberOfStaffLiteVo personrecordingdelivery;
	protected Boolean iscancelled;
	protected ims.core.resource.people.vo.MemberOfStaffRefVo cancelledby;
	protected ims.pci.vo.lookups.VaccineCancellationReason cancellationreason;
	protected ims.framework.utils.DateTime cancellationdatetime;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
